packages feed

threepenny-editors 0.2.0.13 → 0.2.0.14

raw patch · 3 files changed

+16/−2 lines, 3 filesdep +casingPVP ok

version bump matches the API change (PVP)

Dependencies added: casing

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,5 @@+# 0.2.0.14 (2017-07-01)+    * Improved rendering of field names in generic editors. # 0.2.0.13 (2017-06-22)     * Added `liftEditor` to expose the underlying `Element` of an editor.       This enables setting attributes in the element, including class and id.
src/Graphics/UI/Threepenny/Editors/Profunctor.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE FlexibleContexts #-}@@ -41,6 +42,7 @@   )where  import           Data.Bifunctor+import           Data.Char import           Data.Default import           Data.Functor.Compose import           Data.Functor.Identity@@ -50,6 +52,7 @@ import           Generics.SOP hiding (Compose) import           Graphics.UI.Threepenny.Core import qualified Graphics.UI.Threepenny.Editors.Base as Base+import           Text.Casing  -- | A function from 'Behavior' @a@ to 'Editor' @a@ newtype EditorFactory a b = EditorFactory@@ -252,7 +255,15 @@ fieldsEditor = go id sList where   go :: forall ys. All Editable ys => (forall f . NP f xs -> NP f ys) -> SList ys -> NP (K String) ys -> NP (EditorFactory (NP I xs)) ys   go _ SNil Nil = Nil-  go f SCons (K fn :* xs) = field fn (unI . hd . f) editor :* go (tl . f) sList xs+  go f SCons (K fn :* xs) = field (toFieldLabel fn) (unI . hd . f) editor :* go (tl . f) sList xs++toFieldLabel :: String -> String+toFieldLabel (fromAny -> Identifier (x:xx)) =+  unwords (onHead toUpper x : map (onHead toLower) xx) ++ ":"+    where+      onHead f (x:xx) = f x : xx+      onHead _ [] = []+toFieldLabel _ = ""  -- | EditorFactory with an Applicative instance for vertical composition newtype VEF a b = VEF {unVEF :: EditorFactory a b} deriving (Functor, Profunctor)
threepenny-editors.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           threepenny-editors-version:        0.2.0.13+version:        0.2.0.14 synopsis:       Composable algebraic editors description:    This package provides a type class 'Editable' and combinators to                 easily put together form-like editors for algebraic datatypes.@@ -41,6 +41,7 @@     , generics-sop     , profunctors     , threepenny-gui > 0.7+    , casing   exposed-modules:       Graphics.UI.Threepenny.Editors       Graphics.UI.Threepenny.Editors.Base