Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/easafe/purescript-flame
Fast & simple framework for building web applications
https://github.com/easafe/purescript-flame
elm-architecture purescript ui web
Last synced: 14 days ago
JSON representation
Fast & simple framework for building web applications
- Host: GitHub
- URL: https://github.com/easafe/purescript-flame
- Owner: easafe
- License: mit
- Created: 2019-04-07T22:10:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-09T15:41:18.000Z (3 months ago)
- Last Synced: 2024-10-09T19:23:04.696Z (30 days ago)
- Topics: elm-architecture, purescript, ui, web
- Language: PureScript
- Homepage: https://flame.asafe.dev
- Size: 2.65 MB
- Stars: 292
- Watchers: 9
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-purescript - purescript-flame - Flame is a fast & simple framework for building web applications in PureScript inspired by purescript-hedwig and Elm (UI Libraries)
README
## Flame ![build status](https://github.com/easafe/purescript-flame/actions/workflows/CI.yml/badge.svg)
Flame is a fast & simple framework inspired by the Elm architecture for building web applications in PureScript
### Documentation
See the [project page](https://flame.asafe.dev/) or [pursuit](https://pursuit.purescript.org/packages/purescript-flame)
### Examples
See the [examples folder](/examples)
### Quick start
Install:
```bash
spago install flame
```Example counter app:
```purescript
module Counter.Main whereimport Prelude
import Effect (Effect)
import Flame (Html, QuerySelector(..), Subscription)
-- Side effects free updating; see docs for other examples
import Flame.Application.NoEffects as FAN
import Flame.Html.Element as HE
import Flame.Html.Attribute as HA-- | 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` is called to handle events
update :: Model -> Message -> Model
update model = case _ of
Increment -> model + 1
Decrement -> model - 1-- | `view` is called whenever the model is updated
view :: Model -> Html Message
view model = HE.main "main" [
HE.button [HA.onClick Decrement] "-",
HE.text $ show model,
HE.button [HA.onClick Increment] "+"
]-- | Events that come from outside the `view`
subscribe :: Array (Subscription Message)
subscribe = []-- | Mount the application on the given selector
main :: Effect Unit
main = FAN.mount_ (QuerySelector "body") {
init,
view,
update,
subscribe
}
```### Tools
[breeze](https://github.com/easafe/haskell-breeze) can be used to generate Flame markup from HTML
### Licensing
Licenses for loadash, stage0 and snabbdom-to-html added under [licenses](licenses/) since parts of the rendering code was adapted from these projects
### Funding
If this project is useful for you, consider [throwing a buck](https://asafe.dev/donate) to keep development possible