packages feed

threepenny-editors 0.2.0.9 → 0.2.0.10

raw patch · 3 files changed

+14/−16 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,5 @@+# 0.2.0.10 (2017-05-23)+    * Nested grids. All layouts are now grid based. # 0.2.0.9 (2017-05-23)     * Detect grid layouts and render them accordingly  # 0.2.0.8 (2017-05-21)
src/Graphics/UI/Threepenny/Editors/Base.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DeriveFunctor     #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TupleSections     #-}@@ -26,6 +25,7 @@   , Compose(..)   )where +import           Control.Monad import           Data.Functor.Compose import           Data.Maybe import           Graphics.UI.Threepenny.Attributes@@ -68,24 +68,20 @@ single :: Element -> Layout single = Single -getHorizontal :: Layout -> Maybe [Layout]-getHorizontal (Horizontal h) = Just h-getHorizontal _ = Nothing+getHorizontal :: Layout -> [Layout]+getHorizontal (Horizontal h) = h+getHorizontal other = [other] -getSingle :: Layout -> Maybe Element-getSingle (Single e) = Just e-getSingle _ = Nothing+getSingleOrGrid :: Layout -> UI Element+getSingleOrGrid (Single e) = return e+getSingleOrGrid other = runLayout other --- getGridLayout :: Layout -> Maybe [[Element]]-getGridLayout :: Layout -> Maybe [[Element]]-getGridLayout (Vertical hh) = mapM getHorizontal hh >>= mapM (mapM getSingle)-getGridLayout _ = Nothing+getGridLayout :: Layout -> UI [[Element]]+getGridLayout (Vertical hh) = mapM (mapM getSingleOrGrid) $ fmap getHorizontal hh+getGridLayout other = getGridLayout $ Vertical [other]  runLayout :: Layout -> UI Element-runLayout (getGridLayout -> Just g) = grid (fmap (fmap return) g) -runLayout (Vertical ll)   = column $ fmap runLayout ll-runLayout (Horizontal ll) = row $ fmap runLayout ll-runLayout (Single x)      = return x+runLayout = getGridLayout >=> grid . fmap (fmap return)  data EditorDef a = EditorDef   { editorDefTidings :: Tidings a
threepenny-editors.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           threepenny-editors-version:        0.2.0.9+version:        0.2.0.10 synopsis:       Composable algebraic editors description:    This package provides a type class 'Editable' and combinators to                 easily put together form-like editors for algebraic datatypes.