packages feed

glazier-react-widget 0.5.0.0 → 0.6.0.0

raw patch · 3 files changed

+30/−31 lines, 3 filesdep ~glazier-reactdep ~javascript-extrasPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: glazier-react, javascript-extras

API changes (from Hackage documentation)

- Glazier.React.Widgets.Input: SendCommandsAction :: [Command] -> Action
- Glazier.React.Widgets.Input: _SendCommandsAction :: AsAction r_aqLD => Prism' r_aqLD [Command]
+ Glazier.React.Widgets.Input: SetPropertyAction :: Property -> JSVal -> Action
+ Glazier.React.Widgets.Input: _SetPropertyAction :: AsAction r_aquF => Prism' r_aquF (Property, JSVal)
- Glazier.React.Widgets.Input: _Action :: AsAction r_aqLD => Prism' r_aqLD Action
+ Glazier.React.Widgets.Input: _Action :: AsAction r_aquF => Prism' r_aquF Action
- Glazier.React.Widgets.Input: _InputRefAction :: AsAction r_aqLD => Prism' r_aqLD JSVal
+ Glazier.React.Widgets.Input: _InputRefAction :: AsAction r_aquF => Prism' r_aquF JSVal
- Glazier.React.Widgets.Input: _SubmitAction :: AsAction r_aqLD => Prism' r_aqLD JSString
+ Glazier.React.Widgets.Input: _SubmitAction :: AsAction r_aquF => Prism' r_aquF JSString
- Glazier.React.Widgets.Input: class AsAction r_aqLD where _SendCommandsAction = (.) _Action _SendCommandsAction _SubmitAction = (.) _Action _SubmitAction _InputRefAction = (.) _Action _InputRefAction
+ Glazier.React.Widgets.Input: class AsAction r_aquF where _SetPropertyAction = (.) _Action _SetPropertyAction _SubmitAction = (.) _Action _SubmitAction _InputRefAction = (.) _Action _InputRefAction
- Glazier.React.Widgets.Input: class HasPlan c_aqPP where component = (.) plan component inputRef = (.) plan inputRef key = (.) plan key onInputRef = (.) plan onInputRef onKeyDown = (.) plan onKeyDown onRender = (.) plan onRender
+ Glazier.React.Widgets.Input: class HasPlan c_aqyX where component = (.) plan component inputRef = (.) plan inputRef key = (.) plan key onInputRef = (.) plan onInputRef onKeyDown = (.) plan onKeyDown onRender = (.) plan onRender
- Glazier.React.Widgets.Input: class HasSchema c_aqVD where className = (.) schema className placeholder = (.) schema placeholder
+ Glazier.React.Widgets.Input: class HasSchema c_aqEL where className = (.) schema className placeholder = (.) schema placeholder
- Glazier.React.Widgets.Input: className :: HasSchema c_aqVD => Lens' c_aqVD JSString
+ Glazier.React.Widgets.Input: className :: HasSchema c_aqEL => Lens' c_aqEL JSString
- Glazier.React.Widgets.Input: component :: HasPlan c_aqPP => Lens' c_aqPP ReactComponent
+ Glazier.React.Widgets.Input: component :: HasPlan c_aqyX => Lens' c_aqyX ReactComponent
- Glazier.React.Widgets.Input: inputRef :: HasPlan c_aqPP => Lens' c_aqPP JSVal
+ Glazier.React.Widgets.Input: inputRef :: HasPlan c_aqyX => Lens' c_aqyX JSVal
- Glazier.React.Widgets.Input: key :: HasPlan c_aqPP => Lens' c_aqPP JSString
+ Glazier.React.Widgets.Input: key :: HasPlan c_aqyX => Lens' c_aqyX JSString
- Glazier.React.Widgets.Input: onInputRef :: HasPlan c_aqPP => Lens' c_aqPP (Callback (JSVal -> IO ()))
+ Glazier.React.Widgets.Input: onInputRef :: HasPlan c_aqyX => Lens' c_aqyX (Callback (JSVal -> IO ()))
- Glazier.React.Widgets.Input: onKeyDown :: HasPlan c_aqPP => Lens' c_aqPP (Callback (JSVal -> IO ()))
+ Glazier.React.Widgets.Input: onKeyDown :: HasPlan c_aqyX => Lens' c_aqyX (Callback (JSVal -> IO ()))
- Glazier.React.Widgets.Input: onRender :: HasPlan c_aqPP => Lens' c_aqPP (Callback (JSVal -> IO JSVal))
+ Glazier.React.Widgets.Input: onRender :: HasPlan c_aqyX => Lens' c_aqyX (Callback (JSVal -> IO JSVal))
- Glazier.React.Widgets.Input: placeholder :: HasSchema c_aqVD => Lens' c_aqVD JSString
+ Glazier.React.Widgets.Input: placeholder :: HasSchema c_aqEL => Lens' c_aqEL JSString
- Glazier.React.Widgets.Input: plan :: HasPlan c_aqPP => Lens' c_aqPP Plan
+ Glazier.React.Widgets.Input: plan :: HasPlan c_aqyX => Lens' c_aqyX Plan
- Glazier.React.Widgets.Input: schema :: HasSchema c_aqVD => Lens' c_aqVD Schema
+ Glazier.React.Widgets.Input: schema :: HasSchema c_aqEL => Lens' c_aqEL Schema
- Glazier.React.Widgets.List: _Action :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL (Action k_a9Gw itemWidget_a9Gx)
+ Glazier.React.Widgets.List: _Action :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 (Action k_a9rm itemWidget_a9rn)
- Glazier.React.Widgets.List: _AddItemAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL (k_a9Gw, GizmoOf itemWidget_a9Gx)
+ Glazier.React.Widgets.List: _AddItemAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 (k_a9rm, GizmoOf itemWidget_a9rn)
- Glazier.React.Widgets.List: _ComponentDidUpdateAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL ()
+ Glazier.React.Widgets.List: _ComponentDidUpdateAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 ()
- Glazier.React.Widgets.List: _ComponentRefAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL JSVal
+ Glazier.React.Widgets.List: _ComponentRefAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 JSVal
- Glazier.React.Widgets.List: _DestroyItemAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL k_a9Gw
+ Glazier.React.Widgets.List: _DestroyItemAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 k_a9rm
- Glazier.React.Widgets.List: _ItemAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL (k_a9Gw, ActionOf itemWidget_a9Gx)
+ Glazier.React.Widgets.List: _ItemAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 (k_a9rm, ActionOf itemWidget_a9rn)
- Glazier.React.Widgets.List: _MakeItemAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL (k_a9Gw -> k_a9Gw, k_a9Gw -> F (Maker (ActionOf itemWidget_a9Gx)) (ModelOf itemWidget_a9Gx))
+ Glazier.React.Widgets.List: _MakeItemAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 (k_a9rm -> k_a9rm, k_a9rm -> F (Maker (ActionOf itemWidget_a9rn)) (ModelOf itemWidget_a9rn))
- Glazier.React.Widgets.List: _RenderAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL ()
+ Glazier.React.Widgets.List: _RenderAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 ()
- Glazier.React.Widgets.List: _SetFilterAction :: AsAction r_acyL k_a9Gw itemWidget_a9Gx => Prism' r_acyL (OutlineOf itemWidget_a9Gx -> Bool)
+ Glazier.React.Widgets.List: _SetFilterAction :: AsAction r_ack4 k_a9rm itemWidget_a9rn => Prism' r_ack4 (OutlineOf itemWidget_a9rn -> Bool)
- Glazier.React.Widgets.List: class AsAction r_acyL k_a9Gw itemWidget_a9Gx | r_acyL -> k_a9Gw itemWidget_a9Gx where _ComponentRefAction = (.) _Action _ComponentRefAction _RenderAction = (.) _Action _RenderAction _ComponentDidUpdateAction = (.) _Action _ComponentDidUpdateAction _DestroyItemAction = (.) _Action _DestroyItemAction _MakeItemAction = (.) _Action _MakeItemAction _AddItemAction = (.) _Action _AddItemAction _ItemAction = (.) _Action _ItemAction _SetFilterAction = (.) _Action _SetFilterAction
+ Glazier.React.Widgets.List: class AsAction r_ack4 k_a9rm itemWidget_a9rn | r_ack4 -> k_a9rm itemWidget_a9rn where _ComponentRefAction = (.) _Action _ComponentRefAction _RenderAction = (.) _Action _RenderAction _ComponentDidUpdateAction = (.) _Action _ComponentDidUpdateAction _DestroyItemAction = (.) _Action _DestroyItemAction _MakeItemAction = (.) _Action _MakeItemAction _AddItemAction = (.) _Action _AddItemAction _ItemAction = (.) _Action _ItemAction _SetFilterAction = (.) _Action _SetFilterAction
- Glazier.React.Widgets.List: class HasPlan c_acZs where component = (.) plan component componentRef = (.) plan componentRef deferredDisposables = (.) plan deferredDisposables frameNum = (.) plan frameNum key = (.) plan key onComponentDidUpdate = (.) plan onComponentDidUpdate onComponentRef = (.) plan onComponentRef onRender = (.) plan onRender
+ Glazier.React.Widgets.List: class HasPlan c_acKL where component = (.) plan component componentRef = (.) plan componentRef deferredDisposables = (.) plan deferredDisposables frameNum = (.) plan frameNum key = (.) plan key onComponentDidUpdate = (.) plan onComponentDidUpdate onComponentRef = (.) plan onComponentRef onRender = (.) plan onRender
- Glazier.React.Widgets.List: class HasSchema c_acTs k_a9yW itemWidget_a9yX t_a9yY | c_acTs -> k_a9yW itemWidget_a9yX t_a9yY where className = (.) schema className idx = (.) schema idx items = (.) schema items itemsFilter = (.) schema itemsFilter
+ Glazier.React.Widgets.List: class HasSchema c_acEL k_a9jG itemWidget_a9jH t_a9jI | c_acEL -> k_a9jG itemWidget_a9jH t_a9jI where className = (.) schema className idx = (.) schema idx items = (.) schema items itemsFilter = (.) schema itemsFilter
- Glazier.React.Widgets.List: className :: HasSchema c_acTs k_a9yW itemWidget_a9yX t_a9yY => Lens' c_acTs JSString
+ Glazier.React.Widgets.List: className :: HasSchema c_acEL k_a9jG itemWidget_a9jH t_a9jI => Lens' c_acEL JSString
- Glazier.React.Widgets.List: component :: HasPlan c_acZs => Lens' c_acZs ReactComponent
+ Glazier.React.Widgets.List: component :: HasPlan c_acKL => Lens' c_acKL ReactComponent
- Glazier.React.Widgets.List: componentRef :: HasPlan c_acZs => Lens' c_acZs JSVal
+ Glazier.React.Widgets.List: componentRef :: HasPlan c_acKL => Lens' c_acKL JSVal
- Glazier.React.Widgets.List: deferredDisposables :: HasPlan c_acZs => Lens' c_acZs (DList SomeDisposable)
+ Glazier.React.Widgets.List: deferredDisposables :: HasPlan c_acKL => Lens' c_acKL (DList SomeDisposable)
- Glazier.React.Widgets.List: frameNum :: HasPlan c_acZs => Lens' c_acZs Int
+ Glazier.React.Widgets.List: frameNum :: HasPlan c_acKL => Lens' c_acKL Int
- Glazier.React.Widgets.List: idx :: HasSchema c_acTs k_a9yW itemWidget_a9yX t_a9yY => Lens' c_acTs k_a9yW
+ Glazier.React.Widgets.List: idx :: HasSchema c_acEL k_a9jG itemWidget_a9jH t_a9jI => Lens' c_acEL k_a9jG
- Glazier.React.Widgets.List: items :: HasSchema c_acTs k_a9yW itemWidget_a9yX t_a9yY => Lens' c_acTs (Map k_a9yW (SchemaType t_a9yY itemWidget_a9yX))
+ Glazier.React.Widgets.List: items :: HasSchema c_acEL k_a9jG itemWidget_a9jH t_a9jI => Lens' c_acEL (Map k_a9jG (SchemaType t_a9jI itemWidget_a9jH))
- Glazier.React.Widgets.List: itemsFilter :: HasSchema c_acTs k_a9yW itemWidget_a9yX t_a9yY => Lens' c_acTs (OutlineOf itemWidget_a9yX -> Bool)
+ Glazier.React.Widgets.List: itemsFilter :: HasSchema c_acEL k_a9jG itemWidget_a9jH t_a9jI => Lens' c_acEL (OutlineOf itemWidget_a9jH -> Bool)
- Glazier.React.Widgets.List: key :: HasPlan c_acZs => Lens' c_acZs JSString
+ Glazier.React.Widgets.List: key :: HasPlan c_acKL => Lens' c_acKL JSString
- Glazier.React.Widgets.List: onComponentDidUpdate :: HasPlan c_acZs => Lens' c_acZs (Callback (JSVal -> IO ()))
+ Glazier.React.Widgets.List: onComponentDidUpdate :: HasPlan c_acKL => Lens' c_acKL (Callback (JSVal -> IO ()))
- Glazier.React.Widgets.List: onComponentRef :: HasPlan c_acZs => Lens' c_acZs (Callback (JSVal -> IO ()))
+ Glazier.React.Widgets.List: onComponentRef :: HasPlan c_acKL => Lens' c_acKL (Callback (JSVal -> IO ()))
- Glazier.React.Widgets.List: onRender :: HasPlan c_acZs => Lens' c_acZs (Callback (JSVal -> IO JSVal))
+ Glazier.React.Widgets.List: onRender :: HasPlan c_acKL => Lens' c_acKL (Callback (JSVal -> IO JSVal))
- Glazier.React.Widgets.List: plan :: HasPlan c_acZs => Lens' c_acZs Plan
+ Glazier.React.Widgets.List: plan :: HasPlan c_acKL => Lens' c_acKL Plan
- Glazier.React.Widgets.List: schema :: HasSchema c_acTs k_a9yW itemWidget_a9yX t_a9yY => Lens' c_acTs (Schema k_a9yW itemWidget_a9yX t_a9yY)
+ Glazier.React.Widgets.List: schema :: HasSchema c_acEL k_a9jG itemWidget_a9jH t_a9jI => Lens' c_acEL (Schema k_a9jG itemWidget_a9jH t_a9jI)

Files

glazier-react-widget.cabal view
@@ -1,5 +1,5 @@ name:                glazier-react-widget-version:             0.5.0.0+version:             0.6.0.0 synopsis:            Generic widget library using glazier-react description:         Generic widget library using glazier-react homepage:            https://github.com/louispan/glazier-react-widget#readme@@ -25,8 +25,8 @@                      , dlist >= 0.8 && < 0.9                      , free >= 4.12 && < 5                      , glazier >= 0.10 && < 1-                     , glazier-react >= 0.5 && < 1-                     , javascript-extras >= 0.2.0.2 && < 1+                     , glazier-react >= 0.6 && < 1+                     , javascript-extras >= 0.3.0.0 && < 1                      , lens >= 4 && < 5                      , mmorph >= 1 && < 2                      , mtl >= 2 && < 3
src/Glazier/React/Widgets/Input.hs view
@@ -47,7 +47,7 @@     = SetPropertyCommand JE.Property J.JSVal  data Action-    = SendCommandsAction [Command]+    = SetPropertyAction JE.Property J.JSVal     | SubmitAction J.JSString     | InputRefAction J.JSVal @@ -111,37 +111,36 @@ window :: G.WindowT (R.Scene Model Plan) (R.ReactMlT Identity) () window = do     s <- ask-    lift $ R.lf (s ^. component . to JE.toJS)-        [ ("key",  s ^. key . to JE.toJS)-        , ("render", s ^. onRender . to JE.toJS)+    lift $ R.lf (s ^. component . to JE.toJS')+        [ ("key",  s ^. key . to JE.toJS')+        , ("render", s ^. onRender . to JE.toJS')         ]  -- | Internal rendering used by the React render callback render :: G.WindowT (R.Scene Model Plan) (R.ReactMlT Identity) () render = do     s <- ask-    lift $ R.lf (JE.strJS "input")-                    [ ("key", s ^. key . to JE.toJS)-                    , ("className", s ^. className . to JE.toJS)-                    , ("placeholder", s ^. placeholder . to JE.toJS)-                    , ("autoFocus", JE.toJS True)-                    , ("onKeyDown", s ^. onKeyDown . to JE.toJS)-                    ]+    lift $ R.lf "input"+        [ ("key", s ^. key . to JE.toJS')+        , ("className", s ^. className . to JE.toJS')+        , ("placeholder", s ^. placeholder . to JE.toJS')+        , ("autoFocus", JE.toJS' True)+        , ("onKeyDown", s ^. onKeyDown . to JE.toJS')+        ]  whenKeyDown :: J.JSVal -> MaybeT IO (Maybe J.JSString, J.JSVal) whenKeyDown evt = do-        evt' <- MaybeT $ JE.fromJS evt-        evt'' <- MaybeT $ R.parseKeyboardEvent evt'-        evt''' <- lift $ R.parseEvent $ evt'-        -- target is the "input" DOM-        input <- lift $ pure . JE.toJS . R.target $ evt'''-        let k = R.keyCode evt''+        sevt <- MaybeT $ pure $ JE.fromJS evt+        kevt <- MaybeT $ pure $ R.parseKeyboardEvent sevt+        let evt' = R.parseEvent sevt+            k = R.keyCode kevt+        input <- lift $ pure . JE.toJS . R.target $ evt'         case k of             -- FIXME: ESCAPE_KEY             27 -> pure (Nothing, input)             -- FIXME: ENTER_KEY             13 -> do-                v <- MaybeT $ JE.getProperty "value" input >>= JE.fromJS+                v <- MaybeT $ JE.fromJS' <$> JE.getProperty "value" input                 pure (Just v, input)             _ -> empty @@ -150,7 +149,7 @@   where     goLazy :: (Maybe J.JSString, J.JSVal) -> MaybeT IO [Action]     goLazy (ms, j) = pure $-        SendCommandsAction [SetPropertyCommand ("value", JE.toJS J.empty) j]+        SetPropertyAction ("value", JE.toJS' J.empty) j         : maybe [] (pure . SubmitAction) ms  -- | State update logic.@@ -161,7 +160,7 @@ gadget = do     a <- ask     case a of-        SendCommandsAction cmds -> pure $ D.fromList cmds+        SetPropertyAction props j -> pure $ D.singleton $ SetPropertyCommand props j          -- parent widgets should detect this case to do something with submitted action         SubmitAction _ -> pure empty
src/Glazier/React/Widgets/List.hs view
@@ -146,11 +146,11 @@ window :: G.WindowT (R.Scene (Model k itemWidget) Plan) (R.ReactMlT Identity) () window = do     s <- ask-    lift $ R.lf (s ^. component . to JE.toJS)-        [ ("key",  s ^. key . to JE.toJS)-        , ("render", s ^. onRender . to JE.toJS)-        , ("ref", s ^. onComponentRef . to JE.toJS)-        , ("componentDidUpdate", s ^. onComponentDidUpdate . to JE.toJS)+    lift $ R.lf (s ^. component . to JE.toJS')+        [ ("key",  s ^. key . to JE.toJS')+        , ("render", s ^. onRender . to JE.toJS')+        , ("ref", s ^. onComponentRef . to JE.toJS')+        , ("componentDidUpdate", s ^. onComponentDidUpdate . to JE.toJS')         ]  -- | Internal rendering used by the React render callback@@ -161,9 +161,9 @@ render separator itemWindow = do     s <- ask     xs <- fmap (view R.scene) . filter ((s ^. itemsFilter) . R.outline . view R.model) . fmap snd .  M.toList <$> view items-    lift $ R.bh (JE.strJS "ul") [ ("key", s ^. key . to JE.toJS)-                                 , ("className", s ^. className . to JE.toJS)-                                 ] $ do+    lift $ R.bh "ul" [ ("key", s ^. key . to JE.toJS')+                     , ("className", s ^. className . to JE.toJS')+                     ] $ do         let itemsWindows = (view G._WindowT itemWindow) <$> xs             separatedWindows = DL.intersperse separator itemsWindows         sequenceA_ separatedWindows