Flame is a fast & simple framework inspired by the Elm architecture for building Lynx applications in PureScript
See the project page or pursuit
Install:
spago install flameExample counter app:
module Counter.Main where
import Prelude
import Effect (Effect)
import Flame (AppId(..), Html, Subscription, Update)
import Flame as F
import Flame.Html.Attribute as FHA
import Flame.Html.Element as FHE
-- | The model represents the state of the app
type Model = Int
-- | Data type used to represent events
data Message = Increment | Decrement
-- | Initial state of the app
init ∷ Model
init = 0
-- | Update the model without scheduling any effects
update ∷ Update Model Message
update model = case _ of
Increment → F.noMessages $ model + 1
Decrement → F.noMessages $ model - 1
-- | Render Lynx views and text, with onClick handling tap events
view ∷ Model → Html Message
view model = FHE.createElement "view" [ FHA.id "main" ]
[ FHE.createElement "view" [ FHA.onClick Decrement ] [ FHE.text "-" ]
, FHE.text $ show model
, FHE.createElement "view" [ FHA.onClick Increment ] [ FHE.text "+" ]
]
-- | Events that come from outside the view
subscribe ∷ Array (Subscription Message)
subscribe = []
-- | Mount the application in the Lynx root with a unique application ID
main ∷ Effect Unit
main = F.mount (AppId "counter")
{ model: init
, view
, update
, subscribe
}breeze can be used to generate Flame markup from HTML
Licenses for loadash, stage0 and snabbdom-to-html added under licenses since parts of the rendering code was adapted from these projects
If this project is useful for you, consider throwing a buck to keep development possible