aboutsummaryrefslogtreecommitdiff
path: root/docs/src/app/page/api/lustre.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src/app/page/api/lustre.gleam')
-rw-r--r--docs/src/app/page/api/lustre.gleam116
1 files changed, 116 insertions, 0 deletions
diff --git a/docs/src/app/page/api/lustre.gleam b/docs/src/app/page/api/lustre.gleam
new file mode 100644
index 0000000..63f8547
--- /dev/null
+++ b/docs/src/app/page/api/lustre.gleam
@@ -0,0 +1,116 @@
+// IMPORTS ---------------------------------------------------------------------
+
+import app/layout
+import gleam/string
+import lustre/element.{Element}
+
+// PAGE ------------------------------------------------------------------------
+
+pub fn view() -> Element(msg) {
+ [title, applications, components, utilities]
+ |> string.join("\n")
+ |> layout.docs
+}
+
+// CONTENT: TITLE --------------------------------------------------------------
+
+const title: String = "
+# lustre
+"
+
+const applications: String = "
+## Applications
+
+### App | erlang javascript
+
+```gleam
+pub type App(flags, model, msg)
+```
+
+### Error | erlang javascript
+
+```gleam
+pub type Error {
+ AppAlreadyStarted
+ AppNotYetStarted
+ ComponentAlreadyRegistered
+ ElementNotFound
+ NotABrowser
+}
+```
+
+### element | javascript
+
+```gleam
+pub fn element(el: Element(msg)) -> App(Nil, Nil, msg)
+```
+
+### simple | javascript
+
+```gleam
+pub fn simple(
+ init: fn(flags) -> model,
+ update: fn(model, msg) -> model,
+ view: fn(model) -> Element(msg)
+) -> App(flags, model, msg)
+```
+
+### application | javascript
+
+```gleam
+pub fn application(
+ init: fn(flags) -> #(model, Effect(msg)),
+ update: fn(model, msg) -> #(model, Effect(msg)),
+ view: fn(model) -> Element(msg)
+) -> App(flags, model, msg)
+```
+
+### start | javascript
+
+```gleam
+pub fn start(
+ app: App(flags, model, msg),
+ selector: String,
+ flags: flags,
+) -> Result(fn(msg) -> Nil, Error)
+```
+
+### destroy | javascript
+
+```gleam
+pub fn destroy(app: App(flags, model, msg)) -> Nil
+```
+"
+
+const components: String = "
+## Components
+
+### component | javascript
+
+```gleam
+pub fn component(
+ name: String,
+ init: fn() -> #(model, Effect(msg)),
+ update: fn(model, msg) -> #(model, Effect(msg)),
+ view: fn(model) -> Element(msg),
+ on_attribute_change: Map(String, Decoder(msg)),
+) -> Result(Nil, Error)
+```
+"
+
+const utilities: String = "
+## Utilities
+
+### is_browser | erlang javascript
+
+```gleam
+pub fn is_browser() -> Bool
+```
+
+### is_registered | erlang javascript
+
+```gleam
+pub fn is_registered(_name: String) -> Bool
+```
+
+"