From 9919bc2702c89168d1805eaa0db9e4baff091260 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Sat, 19 Aug 2023 22:21:19 +0100 Subject: :truck: Shift things around to accomodate a monorepo. --- docs/gleam.js | 209 ---- docs/highlightjs-gleam.js | 109 -- docs/index.css | 698 ----------- docs/index.html | 337 ------ docs/lustre.html | 626 ---------- docs/lustre/attribute.html | 1110 ------------------ docs/lustre/cmd.html | 444 ------- docs/lustre/element.html | 2753 -------------------------------------------- docs/lustre/event.html | 661 ----------- 9 files changed, 6947 deletions(-) delete mode 100644 docs/gleam.js delete mode 100644 docs/highlightjs-gleam.js delete mode 100644 docs/index.css delete mode 100644 docs/index.html delete mode 100644 docs/lustre.html delete mode 100644 docs/lustre/attribute.html delete mode 100644 docs/lustre/cmd.html delete mode 100644 docs/lustre/element.html delete mode 100644 docs/lustre/event.html (limited to 'docs') diff --git a/docs/gleam.js b/docs/gleam.js deleted file mode 100644 index 73530ce..0000000 --- a/docs/gleam.js +++ /dev/null @@ -1,209 +0,0 @@ -"use strict"; - -window.Gleam = function() { - /* Global Object */ - const self = {}; - - /* Public Properties */ - - self.hashOffset = undefined; - - /* Public Methods */ - - self.getProperty = function(property) { - let value; - try { - value = localStorage.getItem(`Gleam.${property}`); - } - catch (_error) {} - if (-1 < [null, undefined].indexOf(value)) { - return gleamConfig[property].values[0].value; - } - return value; - }; - - self.icons = function() { - return Array.from(arguments).reduce( - (acc, name) => - `${acc} - `, - "" - ); - } - - self.scrollToHash = function() { - const locationHash = arguments[0] || window.location.hash; - const query = locationHash ? locationHash : "body"; - const hashTop = document.querySelector(query).offsetTop; - window.scrollTo(0, hashTop - self.hashOffset); - return locationHash; - }; - - self.toggleSidebar = function() { - const previousState = - bodyClasses.contains("drawer-open") ? "open" : "closed"; - - let state; - if (0 < arguments.length) { - state = false === arguments[0] ? "closed" : "open"; - } - else { - state = "open" === previousState ? "closed" : "open"; - } - - bodyClasses.remove(`drawer-${previousState}`); - bodyClasses.add(`drawer-${state}`); - - if ("open" === state) { - document.addEventListener("click", closeSidebar, false); - } - }; - - /* Private Properties */ - - const html = document.documentElement; - const body = document.body; - const bodyClasses = body.classList; - const sidebar = document.querySelector(".sidebar"); - const sidebarToggles = document.querySelectorAll(".sidebar-toggle"); - const displayControls = document.createElement("div"); - - displayControls.classList.add("display-controls"); - sidebar.appendChild(displayControls); - - /* Private Methods */ - - const initProperty = function(property) { - const config = gleamConfig[property]; - - displayControls.insertAdjacentHTML( - "beforeend", - config.values.reduce( - (acc, item, index) => { - const tooltip = - item.label - ? `alt="${item.label}" title="${item.label}"` - : ""; - let inner; - if (item.icons) { - inner = self.icons(...item.icons); - } - else if (item.label) { - inner = item.label; - } - else { - inner = ""; - } - return ` - ${acc} - - ${inner} - - `; - }, - ` - ` - ); - - setProperty(null, property, function() { - return self.getProperty(property); - }); - }; - - const setProperty = function(_event, property) { - const previousValue = self.getProperty(property); - - const update = - 2 < arguments.length ? arguments[2] : gleamConfig[property].update; - const value = update(); - - try { - localStorage.setItem("Gleam." + property, value); - } - catch (_error) {} - - bodyClasses.remove(`${property}-${previousValue}`); - bodyClasses.add(`${property}-${value}`); - - const isDefault = value === gleamConfig[property].values[0].value; - const toggleClasses = - document.querySelector(`#${property}-toggle`).classList; - toggleClasses.remove(`toggle-${isDefault ? 1 : 0}`); - toggleClasses.add(`toggle-${isDefault ? 0 : 1}`); - - try { - gleamConfig[property].callback(value); - } - catch(_error) {} - - return value; - } - - const setHashOffset = function() { - const el = document.createElement("div"); - el.style.cssText = - ` - height: var(--hash-offset); - pointer-events: none; - position: absolute; - visibility: hidden; - width: 0; - `; - body.appendChild(el); - self.hashOffset = parseInt( - getComputedStyle(el).getPropertyValue("height") || "0" - ); - body.removeChild(el); - }; - - const closeSidebar = function(event) { - if (! event.target.closest(".sidebar-toggle")) { - document.removeEventListener("click", closeSidebar, false); - self.toggleSidebar(false); - } - }; - - const init = function() { - for (const property in gleamConfig) { - initProperty(property); - const toggle = document.querySelector(`#${property}-toggle`); - toggle.addEventListener("click", function(event) { - setProperty(event, property); - }); - } - - sidebarToggles.forEach(function(sidebarToggle) { - sidebarToggle.addEventListener("click", function(event) { - event.preventDefault(); - self.toggleSidebar(); - }); - }); - - setHashOffset(); - window.addEventListener("load", function(_event) { - self.scrollToHash(); - }); - window.addEventListener("hashchange", function(_event) { - self.scrollToHash(); - }); - - document.querySelectorAll(` - .module-name > a, - .member-name a[href^='#'] - `).forEach(function(title) { - title.innerHTML = - title.innerHTML.replace(/([A-Z])|([_/])/g, "$2$1"); - }); - }; - - /* Initialise */ - - init(); - - return self; -}(); diff --git a/docs/highlightjs-gleam.js b/docs/highlightjs-gleam.js deleted file mode 100644 index 292b8ca..0000000 --- a/docs/highlightjs-gleam.js +++ /dev/null @@ -1,109 +0,0 @@ -hljs.registerLanguage("gleam", function (hljs) { - const KEYWORDS = - "as assert case const external fn if import let " + - "opaque pub todo try tuple type"; - const STRING = { - className: "string", - variants: [{ begin: /"/, end: /"/ }], - contains: [hljs.BACKSLASH_ESCAPE], - relevance: 0, - }; - const NAME = { - className: "variable", - begin: "\\b[a-z][a-z0-9_]*\\b", - relevance: 0, - }; - const DISCARD_NAME = { - className: "comment", - begin: "\\b_[a-z][a-z0-9_]*\\b", - relevance: 0, - }; - const NUMBER = { - className: "number", - variants: [ - { - // binary - begin: "\\b0[bB](?:_?[01]+)+", - }, - { - // octal - begin: "\\b0[oO](?:_?[0-7]+)+", - }, - { - // hex - begin: "\\b0[xX](?:_?[0-9a-fA-F]+)+", - }, - { - // dec, float - begin: "\\b\\d(?:_?\\d+)*(?:\\.(?:\\d(?:_?\\d+)*)*)?", - }, - ], - relevance: 0, - }; - - return { - name: "Gleam", - aliases: ["gleam"], - contains: [ - hljs.C_LINE_COMMENT_MODE, - STRING, - { - // bit string - begin: "<<", - end: ">>", - contains: [ - { - className: "keyword", - beginKeywords: - "binary bytes int float bit_string bits utf8 utf16 utf32 " + - "utf8_codepoint utf16_codepoint utf32_codepoint signed unsigned " + - "big little native unit size", - }, - KEYWORDS, - STRING, - NAME, - DISCARD_NAME, - NUMBER, - ], - relevance: 10, - }, - { - className: "function", - beginKeywords: "fn", - end: "\\(", - excludeEnd: true, - contains: [ - { - className: "title", - begin: "[a-z][a-z0-9_]*\\w*", - relevance: 0, - }, - ], - }, - { - className: "keyword", - beginKeywords: KEYWORDS, - }, - { - // Type names and constructors - className: "title", - begin: "\\b[A-Z][A-Za-z0-9]*\\b", - relevance: 0, - }, - { - className: "operator", - begin: "[+\\-*/%!=<>&|.]+", - relevance: 0, - }, - NAME, - DISCARD_NAME, - NUMBER, - ], - }; -}); -document.querySelectorAll("pre code").forEach(block => { - if (block.className === "") { - block.classList.add("gleam"); - } - hljs.highlightBlock(block); -}); diff --git a/docs/index.css b/docs/index.css deleted file mode 100644 index ce095d6..0000000 --- a/docs/index.css +++ /dev/null @@ -1,698 +0,0 @@ -@import url("https://fonts.googleapis.com/css2?family=Karla:wght@400;700&family=Ubuntu+Mono&display=swap"); - -:root { - /* Colours */ - --black: #2a2020; - --hard-black: #000; - --pink: #ffaff3; - --hot-pink: #d900b8; - --white: #fff; - --pink-white: #fff8fe; - --mid-grey: #dfe2e5; - --light-grey: #f5f5f5; - --boi-blue: #a6f0fc; - - /* Derived colours */ - --text: var(--black); - --background: var(--white); - --accented-background: var(--pink-white); - --code-border: var(--pink); - --code-background: var(--light-grey); - --table-border: var(--mid-grey); - --table-background: var(--pink-white); - --links: var(--hot-pink); - --accent: var(--pink); - - /* Sizes */ - --content-width: 680px; - --header-height: 60px; - --hash-offset: calc(var(--header-height) * 1.67); - --sidebar-width: 240px; - --gap: 24px; - --small-gap: calc(var(--gap) / 2); - --tiny-gap: calc(var(--small-gap) / 2); - --large-gap: calc(var(--gap) * 2); - --sidebar-toggle-size: 33px; - - /* etc */ - --shadow: - 0 0 0 1px rgba(50, 50, 93, .075), - 0 0 1px #e9ecef, - 0 2px 4px -2px rgba(138, 141, 151, .6); - --nav-shadow: 0 0 6px 2px rgba(0, 0, 0, .1); -} - -* { - box-sizing: border-box; -} - -body, -html { - padding: 0; - margin: 0; - font-family: "Karla", sans-serif; - font-size: 17px; - line-height: 1.4; - position: relative; - min-height: 100vh; - word-break: break-word; -} - -html { - /* This is necessary so hash targets appear below the fixed header */ - scroll-padding-top: var(--hash-offset); -} - -a, -a:visited { - color: var(--links); - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -button, -select { - background: transparent; - border: 0 none; - cursor: pointer; - font-family: inherit; - font-size: 100%; - line-height: 1.15; - margin: 0; - text-transform: none; -} - -button::-moz-focus-inner { - border-style: none; - padding: 0; -} - -button:-moz-focusring { - outline: 1px dotted ButtonText; -} - -button { - -webkit-appearance: button; - line-height: 1; - margin: 0; - overflow: visible; - padding: 0; -} - -button:active, -select:active { - outline: 0 none; -} - -li { - margin-bottom: 4px; -} - -p { - margin: var(--small-gap) 0; -} - -.rendered-markdown h1, -.rendered-markdown h2, -.rendered-markdown h3, -.rendered-markdown h4, -.rendered-markdown h5 { - font-size: 1.3rem; -} - -/* Code */ - -pre, -code { - font-family: "Ubuntu Mono", monospace; - line-height: 1.2; - background-color: var(--code-background); -} - -pre { - margin: var(--gap) 0; - border-radius: 1px; - overflow: auto; - box-shadow: var(--shadow); -} - -pre > code, -code.hljs { - padding: var(--small-gap) var(--gap); - background: transparent; -} - -p code { - margin: 0 2px; - border-radius: 3px; - padding: 0 0.2em; - color: var(--inline-code); -} - -/* Page layout */ - -.page { - display: flex; -} - -.content { - margin-left: var(--sidebar-width); - padding: calc(var(--header-height) + var(--gap)) var(--gap) 0 var(--gap); - width: calc(100% - var(--sidebar-width)); - max-width: var(--content-width); -} - -/* Page header */ - -.page-header { - box-shadow: var(--nav-shadow); - height: var(--header-height); - color: black; - color: var(--hard-black); - background-color: var(--pink); - display: flex; - padding: var(--small-gap) var(--gap); - position: fixed; - left: 0; - right: 0; - top: 0; - z-index: 300; -} - -.page-header h2 { - align-items: baseline; - display: flex; - margin: 0; - max-width: 100%; -} - -.page-header a, -.page-header a:visited { - color: black; - color: var(--hard-black); - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.sidebar-toggle { - display: none; - font-size: var(--sidebar-toggle-size); - opacity: 0; - transition: opacity 1s ease; -} - -.page-header .sidebar-toggle { - color: white; - color: var(--white); - margin: 0 var(--small-gap) 0 0; -} - -/* Version selector */ - -#project-version { - --half-small-gap: calc(var(--small-gap) / 2); - --icon-size: .75em; - flex-shrink: 0; - font-size: .9rem; - font-weight: normal; - margin-left: var(--half-small-gap); -} - -#project-version > span { - padding-left: var(--half-small-gap); -} - -#project-version form { - align-items: center; - display: inline-flex; - justify-content: flex-end; -} - -#project-version select { - appearance: none; - -webkit-appearance: none; - padding: .6rem calc(1.3 * var(--icon-size)) .6rem var(--half-small-gap); - position: relative; - z-index: 1; -} - -#project-version option { - background-color: var(--code-background); -} - -#project-version .icon { - font-size: var(--icon-size); - margin-left: calc(-1.65 * var(--icon-size)); -} - -/* Module doc */ - -.module-name > a, -.module-member-kind > a { - color: inherit; -} - -.module-name > a:hover, -.module-member-kind > a:hover { - text-decoration: none; -} - -.module-name > .icon-gleam-chasse, -.module-member-kind > .icon-gleam-chasse, -.module-member-kind > .icon-gleam-chasse-2 { - color: var(--pink); - display: block; - font-size: 1rem; - margin: var(--small-gap) 0 0; -} - -.module-name { - color: var(--hard-black); - margin: 0 0 var(--gap); - font-weight: 700; -} - -/* Sidebar */ - -.sidebar { - background-color: var(--background); - font-size: .95rem; - max-height: calc(100vh - var(--header-height)); - overflow-y: auto; - overscroll-behavior: contain; - padding-top: var(--gap); - padding-bottom: calc(3 * var(--gap)); - padding-left: var(--gap); - position: fixed; - top: var(--header-height); - transition: transform .5s ease; - width: var(--sidebar-width); - z-index: 100; -} - -.sidebar h2 { - margin: 0; -} - -.sidebar ul { - list-style: none; - margin: var(--small-gap) 0; - padding: 0; -} - -.sidebar li { - line-height: 1.2; - margin-bottom: 4px; -} - -.sidebar .sidebar-toggle { - color: var(--pink); - font-size: calc(.8 * var(--sidebar-toggle-size)); -} - -body.drawer-closed .label-open, -body.drawer-open .label-closed { - display: none; -} - -.display-controls { - display: flex; - flex-wrap: wrap; - margin-top: var(--small-gap); - padding-right: var(--gap); -} - -.display-controls .control { - margin: .5rem 0; -} - -.display-controls .control:not(:first-child) { - margin-left: 1rem; -} - -.toggle { - align-items: center; - display: flex; - font-size: .96rem; -} - -.toggle-0 .label:not(.label-0), -.toggle-1 .label:not(.label-1) { - display: none; -} - -.label { - display: flex; -} - -.label .icon { - margin: 0 .28rem; -} - -/* Module members (types, functions) */ - -.module-members { - margin-top: var(--large-gap); -} - -.module-member-kind { - font-size: 2rem; - color: var(--text); -} - -.member { - margin: var(--large-gap) 0; - padding-bottom: var(--gap); -} - -.member-name { - display: flex; - align-items: center; - justify-content: space-between; - border-left: 4px solid var(--accent); - padding: var(--small-gap) var(--gap); - background-color: var(--accented-background); -} - -.member-name h2 { - display: flex; - font-size: 1.5rem; - margin: 0; -} - -.member-name h2 a { - color: var(--text); -} - -.member-source { - align-self: baseline; - flex-shrink: 0; - line-height: calc(1.4 * 1.5rem); - margin: 0 0 0 var(--small-gap); -} - -/* Custom type constructors */ - -.constructor-list { - list-style: none; - padding: 0; -} - -.constructor-row { - align-items: center; - display: flex; -} - -.constructor-item { - margin-bottom: var(--small-gap); -} - -.constructor-argument-item { - display: flex; -} - -.constructor-argument-label { - flex-shrink: 0; -} - -.constructor-argument-doc { - margin-left: var(--gap); -} - -.constructor-argument-list { - margin-bottom: var(--small-gap); -} - -.constructor-item-docs { - margin-left: var(--large-gap); - margin-bottom: var(--gap); -} - -.constructor-item .icon { - flex-shrink: 0; - font-size: .7rem; - margin: 0 .88rem; -} - -.constructor-name { - box-shadow: unset; - margin: 0; -} - -.constructor-name > code { - padding: var(--small-gap); -} - -/* Tables */ - -table { - border-spacing: 0; - border-collapse: collapse; -} - -table td, -table th { - padding: 6px 13px; - border: 1px solid var(--table-border); -} - -table tr:nth-child(2n) { - background-color: var(--table-background); -} - -/* Footer */ - -.pride { - width: 100%; - display: none; - flex-direction: row; - position: absolute; - bottom: 0; - z-index: 100; -} - -.show-pride .pride { - display: flex; -} - -.show-pride .sidebar { - margin-bottom: var(--gap); -} - -.pride div { - flex: 1; - text-align: center; - padding: var(--tiny-gap); -} - -.pride .white { - background-color: var(--white); -} -.pride .pink { - background-color: var(--pink); -} -.pride .blue { - background-color: var(--boi-blue); -} - -.pride-button { - position: absolute; - right: 2px; - bottom: 2px; - opacity: .2; - font-size: .9rem; -} - -.pride-button { - text-decoration: none; - cursor: default; -} - -/* Icons */ - -.svg-lib { - height: 0; - overflow: hidden; - position: absolute; - width: 0; -} - -.icon { - display: inline-block; - fill: currentColor; - height: 1em; - stroke: currentColor; - stroke-width: 0; - width: 1em; -} - -.icon-gleam-chasse { - width: 8.182em; -} - -.icon-gleam-chasse-2 { - width: 4.909em; -} - -/* Pre-Wrap Option */ - -body.prewrap-on code, -body.prewrap-on pre { - white-space: pre-wrap; -} - -/* Dark Theme Option */ - -body.theme-dark { - /* Colour palette adapted from: - * https://github.com/dustypomerleau/yarra-valley - */ - - --argument-atom: #c651e5; - --class-module: #ff89b5; - --comment: #7e818b; - --escape: #7cdf89; - --function-call: #abb8c0; - --function-definition: #8af899; - --interpolation-regex: #ee37aa; - --keyword-operator: #ff9d35; - --number-boolean: #f14360; - --object: #99c2eb; - --punctuation: #4ce7ff; - --string: #aecc00; - - --inline-code: #ff9d35; - - --bg: #292d3e; - --bg-tint-1: #3e4251; --bg-tint-2: #535664; --bg-tint-3: #696c77; --bg-tint-4: #7e818b; - --bg-shade-1: #242837; --bg-shade-2: #202431; --bg-shade-3: #1c1f2b; - --bg-mono-1: #33384d; --bg-mono-2: #3d435d; --bg-mono-3: #474e6c; --bg-mono-4: #51597b; - - --fg: #cac0a9; - --fg-tint-1: #fdf2d8; --fg-tint-2: #fdf3dc; --fg-tint-3: #fdf5e0; - --fg-shade-1: #e3d8be; --fg-shade-2: #cac0a9; --fg-shade-3: #b1a894; --fg-shade-4: #97907f; - - --orange-shade-1: #e58d2f; --orange-shade-2: #cc7d2a; --orange-shade-3: #b26d25; - - --taupe-mono-1: #fdf1d4; --taupe-mono-2: #fce9bc; --taupe-mono-3: #fbe1a3; - - /* Theme Overrides */ - - --accent: var(--pink); - --accented-background: var(--bg-shade-1); - --background: var(--bg); - --code-background: var(--bg-shade-2); - --table-background: var(--bg-mono-1); - --hard-black: var(--taupe-mono-1); - --links: var(--pink); - --text: var(--taupe-mono-1); - - --shadow: - 0 0 0 1px rgba(50, 50, 93, .075), - 0 0 1px var(--fg-shade-3), - 0 2px 4px -2px rgba(138, 141, 151, .2); - --nav-shadow: 0 0 5px 5px rgba(0, 0, 0, .1); -} - -body.theme-dark { - background-color: var(--bg); - color: var(--fg-shade-1); -} - -body.theme-dark .page-header { - background-color: var(--bg-mono-1); -} - -body.theme-dark .page-header h2 { - color: var(--fg-shade-1); -} - - -body.theme-dark .page-header a, -body.theme-dark .page-header a:visited { - color: var(--pink); -} - -body.theme-dark .page-header .sidebar-toggle { - color: var(--fg-shade-1); -} - -body.theme-dark #project-version select, -body.theme-dark .control { - color: var(--fg-shade-1); -} - -body.theme-dark .module-name { - color: var(--taupe-mono-1); -} - -body.theme-dark .pride { - color: var(--bg-shade-3); -} - -body.theme-dark .pride .white { - background-color: var(--fg-shade-1); -} - -body.theme-dark .pride .pink { - background-color: var(--argument-atom); -} - -body.theme-dark .pride .blue { - background-color: var(--punctuation); -} - -/* Medium and larger displays */ -@media (min-width: 680px) { - #prewrap-toggle { - display: none; - } -} - -/* Small displays */ -@media (max-width: 920px) { - .page-header { - padding-left: var(--small-gap); - padding-right: var(--small-gap); - } - - .page-header h2 { - max-width: calc(100% - var(--sidebar-toggle-size) - var(--small-gap)); - } - - .content { - width: 100%; - max-width: unset; - margin-left: unset; - } - - .sidebar { - box-shadow: var(--nav-shadow); - height: 100vh; - max-height: unset; - top: 0; - transform: translate(calc(-10px - var(--sidebar-width))); - z-index: 500; - } - - body.drawer-open .sidebar { - transform: translate(0); - } - - .sidebar-toggle { - display: block; - opacity: 1; - } - - .sidebar .sidebar-toggle { - height: var(--sidebar-toggle-size); - position: absolute; - right: var(--small-gap); - top: var(--small-gap); - width: var(--sidebar-toggle-size); - } -} diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index f5fda5e..0000000 --- a/docs/index.html +++ /dev/null @@ -1,337 +0,0 @@ - - - - - - lustre - - - - - - - - - - - - -
- - -
- -

Lustre

-

A framework for building create web apps – powered by Gleam and React!

-
-

Package Version -Hex Docs

-
import gleam/int
-import lustre
-import lustre/element.{ button, div, p, text }
-import lustre/event.{ dispatch, on_click }
-
-pub fn main () {
-    let app = lustre.application(0, update, render)
-    lustre.start(app, "#app")
-}
-
-type Action {
-    Incr
-    Decr
-}
-
-fn update (state, action) {
-    case action {
-        Incr -> state + 1
-        Decr -> state - 1
-    }
-}
-
-fn render (state) {
-    div([], [
-        button([ on_click(dispatch(Decr)) ], [ text("-") ]),
-        p([], [ text(int.to_string(state)) ]),
-        button([ on_click(dispatch(Incr)) ], [ text("+") ])
-    ])
-}
-
-
-

❗️ This package relies on Gleam’s JavaScript FFI and is intended to be run in -the browser. It will not work if your are targetting Node.js or Erlang.

-
-

Installation

-

If available on Hex, this package can be added to your Gleam project:

-
gleam add lustre
-
-

and its documentation can be found at https://hexdocs.pm/lustre. You will also -need to install react and react-dom from npm:

-
npm i react react-dom
-
-
-

Development

-

First, make sure you have both Gleam and Node.js installed, then:

-
npm i
-npm start
-
-

This sets up chokidar to watch our gleam source code and runs the compiler -whenever we make a change. It also starts a server that will serve the examples -located in test/example/.

- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/lustre.html b/docs/lustre.html deleted file mode 100644 index d0bbc53..0000000 --- a/docs/lustre.html +++ /dev/null @@ -1,626 +0,0 @@ - - - - - - lustre - lustre - - - - - - - - - - - - -
- - -
- -

- lustre - -

-

Lustre is a declarative framework for building Web apps in Gleam.

- - - -
-

- Types - -

- - -
-
-

- - App - -

- - - </> - - -
-
-

An App describes a Lustre application: what state it holds and what kind -of actions get dispatched to update that state. The only useful thing you can -do with an App is pass it to start.

-

You can construct an App from the two constructors exposed in this module: -basic and application. Although you can’t do -anything but start them, the constructors are separated in case -you want to set up an application but defer starting it until some later point -in time.

-
                                      +--------+
-                                      |        |
-                                      | update |
-                                      |        |
-                                      +--------+
-                                        ^    |
-                                        |    | 
-                                 Action |    | #(State, Action)
-                                        |    |
-                                        |    v
-  +------+                    +------------------------+
-  |      |  #(State, Action)  |                        |
-  | init |------------------->|     Lustre Runtime     |
-  |      |                    |                        |
-  +------+                    +------------------------+
-                                        ^    |
-                                        |    |
-                                 Action |    | State
-                                        |    |
-                                        |    v
-                                      +--------+
-                                      |        |
-                                      | render |
-                                      |        |
-                                      +--------+
-
-

Someone please PR the Gleam docs generator to fix the monospace font, -thanks! 💖

-
-
pub opaque type App(state, action)
- - -
-
- -
- -
-
-
pub type Error {
-  ElementNotFound
-}
- -

- Constructors -

-
    - -
  • -
    - -
    ElementNotFound
    -
    - -
    - - - - -
    -
  • - -
- -
-
- -
- - - - - - -
-

- Functions - -

- -
- -
pub fn application(init: #(a, Cmd(b)), update: fn(a, b) ->
-    #(a, Cmd(b)), render: fn(a) -> Element(b)) -> App(a, b)
-

An evolution of a simple app that allows you to return a -Cmd from your init and updates. Commands give -us a way to perform side effects like sending an HTTP request or running a -timer and then dispatch actions back to the runtime to trigger an update.

-
import lustre
-import lustre/cmd
-import lustre/element
-
-pub fn main () {
-    let init = #(0, tick())
-    let update = fn (state, action) {
-        case action {
-            Tick -> #(state + 1, tick())
-        }
-    }
-    let render = fn (state) {
-        element.div([], [
-            element.text("Count is: ")
-            element.text(state |> int.to_string |> element.text)
-        ])
-    }
-
-    let app = lustre.simple(init, update, render)
-    lustre.start(app, "#root")   
-}
-
-fn tick () -> Cmd(Action) {
-    cmd.from(fn (dispatch) {
-        setInterval(fn () {
-            dispatch(Tick)
-        }, 1000)
-    })
-}
-
-external fn set_timeout (f: fn () -> a, delay: Int) -> Nil 
-    = "" "window.setTimeout"
-
-
-
- -
- -
pub fn element(element: Element(a)) -> App(Nil, a)
-

Create a basic lustre app that just renders some element on the page. -Note that this doesn’t mean the content is static! With element.stateful -you can still create components with local state.

-

Basic lustre apps don’t have any global application state and so the -plumbing is a lot simpler. If you find yourself passing lots of state around, -you might want to consider using simple or application -instead.

-
import lustre
-import lustre/element
-
-pub fn main () {
-    let app = lustre.element(
-        element.h1([], [
-            element.text("Hello, world!") 
-        ])
-    )
-
-    lustre.start(app, "#root")
-}
-
-
-
- -
- -
pub fn simple(init: a, update: fn(a, b) -> a, render: fn(a) ->
-    Element(b)) -> App(a, b)
-

If you start off with a simple [element](#element) app, you may find -yourself leaning on stateful elements -to manage state used throughout your app. If that’s the case or if you know -you need some global state from the get-go, you might want to construct a -simple app instead.

-

This is one app constructor that allows your HTML elements to dispatch actions -to update your program state.

-
import gleam/int
-import lustre
-import lustre/element
-import lustre/event.{ dispatch }
-
-type Action {
-    Incr
-    Decr
-}
-
-pub fn main () {
-    let init = 0
-    let update = fn (state, action) {
-        case action {
-            Incr -> state + 1
-            Decr -> state - 1
-        }
-    }
-    let render = fn (state) {
-        element.div([], [
-            element.button([ event.on_click(dispatch(Decr)) ], [
-                element.text("-")
-            ]),
-            element.text(state |> int.to_string |> element.text),
-            element.button([ event.on_click(dispatch(Incr)) ], [
-                element.text("+")
-            ])
-        ])
-    }
-
-    let app = lustre.simple(init, update, render)
-    lustre.start(app, "#root")
-}
-
-
-
- -
- -
pub fn start(app: App(a, b), selector: String) -> Result(
-  fn(b) -> Nil,
-  Error,
-)
-

Once you have created a app with either basic or application, you -need to actually start it! This function will mount your app to the DOM -node that matches the query selector you provide.

-

If everything mounted OK, we’ll get back a dispatch function that you can -call to send actions to your app and trigger an update.

-
import lustre
-
-pub fn main () {
-    let app = lustre.appliation(init, update, render)
-    assert Ok(dispatch) = lustre.start(app, "#root")
-
-    dispatch(Incr)
-    dispatch(Incr)
-    dispatch(Incr)
-}
-
-
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/lustre/attribute.html b/docs/lustre/attribute.html deleted file mode 100644 index 0fd6856..0000000 --- a/docs/lustre/attribute.html +++ /dev/null @@ -1,1110 +0,0 @@ - - - - - - lustre/attribute - lustre - - - - - - - - - - - - -
- - -
- -

- lustre/attribute - -

- - - -
-

- Types - -

- - -
- -
-
-
pub opaque type Attribute(action)
- - -
-
- -
- - - - - - -
-

- Functions - -

- -
- -
pub fn accept(types: List(String)) -> Attribute(a)
-
-
- -
- -
pub fn accept_charset(types: List(String)) -> Attribute(a)
-
-
- -
- -
pub fn action(uri: String) -> Attribute(a)
-
-
- -
-
-

- - alt - -

- - - </> - - -
-
pub fn alt(text: String) -> Attribute(a)
-
-
- -
- -
pub fn attribute(name: String, value: String) -> Attribute(a)
-
-
- -
- -
pub fn autocomplete(should_autocomplete: Bool) -> Attribute(a)
-
-
- -
- -
pub fn autofocus(should_autofocus: Bool) -> Attribute(a)
-
-
- -
- -
pub fn autoplay(should_autoplay: Bool) -> Attribute(a)
-
-
- -
- -
pub fn checked(is_checked: Bool) -> Attribute(a)
-
-
- -
- -
pub fn class(name: String) -> Attribute(a)
-
-
- -
- -
pub fn classes(names: List(#(String, Bool))) -> Attribute(a)
-
-
- -
-
-

- - cols - -

- - - </> - - -
-
pub fn cols(val: Int) -> Attribute(a)
-
-
- -
- -
pub fn controls(visible: Bool) -> Attribute(a)
-
-
- -
- -
pub fn disabled(is_disabled: Bool) -> Attribute(a)
-
-
- -
- -
pub fn download(filename: String) -> Attribute(a)
-
-
- -
- -
pub fn event(name: String, handler: fn(Dynamic, fn(a) -> Nil) ->
-    Nil) -> Attribute(a)
-
-
- -
-
-

- - for - -

- - - </> - - -
-
pub fn for(id: String) -> Attribute(a)
-
-
- -
- -
pub fn height(val: Int) -> Attribute(a)
-
-
- -
-
-

- - href - -

- - - </> - - -
-
pub fn href(uri: String) -> Attribute(a)
-
-
- -
-
-

- - id - -

- - - </> - - -
-
pub fn id(name: String) -> Attribute(a)
-
-
- -
-
-

- - loop - -

- - - </> - - -
-
pub fn loop(should_loop: Bool) -> Attribute(a)
-
-
- -
-
-

- - max - -

- - - </> - - -
-
pub fn max(val: String) -> Attribute(a)
-
-
- -
-
-

- - min - -

- - - </> - - -
-
pub fn min(val: String) -> Attribute(a)
-
-
- -
-
-

- - name - -

- - - </> - - -
-
pub fn name(name: String) -> Attribute(a)
-
-
- -
- -
pub fn pattern(regex: String) -> Attribute(a)
-
-
- -
- -
pub fn placeholder(text: String) -> Attribute(a)
-
-
- -
- -
pub fn property(name: String, value: Dynamic) -> Attribute(a)
-
-
- -
- -
pub fn readonly(is_readonly: Bool) -> Attribute(a)
-
-
- -
-
-

- - rel - -

- - - </> - - -
-
pub fn rel(relationship: String) -> Attribute(a)
-
-
- -
- -
pub fn require(is_required: Bool) -> Attribute(a)
-
-
- -
-
-

- - rows - -

- - - </> - - -
-
pub fn rows(val: Int) -> Attribute(a)
-
-
- -
- -
pub fn selected(is_selected: Bool) -> Attribute(a)
-
-
- -
-
-

- - src - -

- - - </> - - -
-
pub fn src(uri: String) -> Attribute(a)
-
-
- -
-
-

- - step - -

- - - </> - - -
-
pub fn step(val: String) -> Attribute(a)
-
-
- -
- -
pub fn style(properties: List(#(String, String))) -> Attribute(a)
-
-
- -
- -
pub fn target(target: String) -> Attribute(a)
-
-
- -
- -
pub fn type_(name: String) -> Attribute(a)
-
-
- -
- -
pub fn value(val: Dynamic) -> Attribute(a)
-
-
- -
- -
pub fn width(val: Int) -> Attribute(a)
-
-
- -
-
-

- - wrap - -

- - - </> - - -
-
pub fn wrap(mode: String) -> Attribute(a)
-
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/lustre/cmd.html b/docs/lustre/cmd.html deleted file mode 100644 index a89fbe8..0000000 --- a/docs/lustre/cmd.html +++ /dev/null @@ -1,444 +0,0 @@ - - - - - - lustre/cmd - lustre - - - - - - - - - - - - -
- - -
- -

- lustre/cmd - -

- - - -
-

- Types - -

- - -
-
-

- - Cmd - -

- - - </> - - -
-
-
-
pub opaque type Cmd(action)
- - -
-
- -
- - - - - - -
-

- Functions - -

- -
- -
pub fn batch(cmds: List(Cmd(a))) -> Cmd(a)
-
-
- -
-
-

- - from - -

- - - </> - - -
-
pub fn from(cmd: fn(fn(a) -> Nil) -> Nil) -> Cmd(a)
-
-
- -
-
-

- - map - -

- - - </> - - -
-
pub fn map(cmd: Cmd(a), f: fn(a) -> b) -> Cmd(b)
-
-
- -
-
-

- - none - -

- - - </> - - -
-
pub fn none() -> Cmd(a)
-
-
- -
- -
pub fn to_list(cmd: Cmd(a)) -> List(fn(fn(a) -> Nil) -> Nil)
-
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/lustre/element.html b/docs/lustre/element.html deleted file mode 100644 index 24862ea..0000000 --- a/docs/lustre/element.html +++ /dev/null @@ -1,2753 +0,0 @@ - - - - - - lustre/element - lustre - - - - - - - - - - - - -
- - -
- -

- lustre/element - -

- - - -
-

- Types - -

- - -
- -
-
-
pub external type Element(action)
- - -
-
- -
- - - - - - -
-

- Functions - -

- -
-
-

- - a - -

- - - </> - - -
-
pub fn a(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - abbr - -

- - - </> - - -
-
pub fn abbr(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn address(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - area - -

- - - </> - - -
-
pub fn area(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
- -
pub fn article(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn aside(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn audio(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - b - -

- - - </> - - -
-
pub fn b(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - base - -

- - - </> - - -
-
pub fn base(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
-
-

- - bdi - -

- - - </> - - -
-
pub fn bdi(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - bdo - -

- - - </> - - -
-
pub fn bdo(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn blockquote(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - body - -

- - - </> - - -
-
pub fn body(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - br - -

- - - </> - - -
-
pub fn br(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
- -
pub fn button(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn canvas(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn caption(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - cite - -

- - - </> - - -
-
pub fn cite(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - code - -

- - - </> - - -
-
pub fn code(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - col - -

- - - </> - - -
-
pub fn col(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn colgroup(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn datalist(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - dd - -

- - - </> - - -
-
pub fn dd(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - del - -

- - - </> - - -
-
pub fn del(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn details(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - dfn - -

- - - </> - - -
-
pub fn dfn(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn dialog(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - div - -

- - - </> - - -
-
pub fn div(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - dl - -

- - - </> - - -
-
pub fn dl(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - dt - -

- - - </> - - -
-
pub fn dt(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - em - -

- - - </> - - -
-
pub fn em(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn embed(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
- -
pub fn fieldset(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn figcaption(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn figure(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn footer(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - form - -

- - - </> - - -
-
pub fn form(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub external fn fragment(
-  children: List(Element(action)),
-) -> Element(action)
-

A fragment doesn’t appear in the DOM, but allows us to treat a list of elements -as if it were a single one.

-
-
- -
-
-

- - h1 - -

- - - </> - - -
-
pub fn h1(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - h2 - -

- - - </> - - -
-
pub fn h2(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - h3 - -

- - - </> - - -
-
pub fn h3(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - h4 - -

- - - </> - - -
-
pub fn h4(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - h5 - -

- - - </> - - -
-
pub fn h5(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - h6 - -

- - - </> - - -
-
pub fn h6(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
- - - - </> - - -
-
pub fn head(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn header(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - hr - -

- - - </> - - -
-
pub fn hr(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
-
-

- - html - -

- - - </> - - -
-
pub fn html(attributes: List(Attribute(a)), head: Element(a), body: Element(
-    a,
-  )) -> Element(a)
-
-
- -
-
-

- - i - -

- - - </> - - -
-
pub fn i(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn iframe(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
-
-

- - img - -

- - - </> - - -
-
pub fn img(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
- -
pub fn input(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
-
-

- - ins - -

- - - </> - - -
-
pub fn ins(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - kbd - -

- - - </> - - -
-
pub fn kbd(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn label(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn legend(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - li - -

- - - </> - - -
-
pub fn li(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - main - -

- - - </> - - -
-
pub fn main(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - map - -

- - - </> - - -
-
pub external fn map(
-  element: Element(a),
-  f: fn(a) -> b,
-) -> Element(b)
-

Transforms the actions produced by some element.

-
-
- -
-
-

- - map_ - -

- - - </> - - -
-
pub fn map_(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - mark - -

- - - </> - - -
-
pub fn mark(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn mathml(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
- - - - </> - - -
-
pub fn menu(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - meta - -

- - - </> - - -
-
pub fn meta(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
- -
pub fn meter(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
- - - - </> - - -
-
pub fn nav(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - node - -

- - - </> - - -
-
pub external fn node(
-  tag: String,
-  attributes: List(Attribute(action)),
-  children: List(Element(action)),
-) -> Element(action)
-

Construct a plain HTML element or registered Web Component by providing the -tag name, a list of attributes (including event handlers), and a list of -child elements.

-
-
- -
- -
pub fn noscript(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn object(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - ol - -

- - - </> - - -
-
pub fn ol(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn optgroup(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn option(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn output(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - p - -

- - - </> - - -
-
pub fn p(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn param(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn picture(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn portal(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
-
-

- - pre - -

- - - </> - - -
-
pub fn pre(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn progress(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - rp - -

- - - </> - - -
-
pub fn rp(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - rt - -

- - - </> - - -
-
pub fn rt(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - ruby - -

- - - </> - - -
-
pub fn ruby(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - s - -

- - - </> - - -
-
pub fn s(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - samp - -

- - - </> - - -
-
pub fn samp(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn section(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn select(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - slot - -

- - - </> - - -
-
pub fn slot(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn small(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn source(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
-
-

- - span - -

- - - </> - - -
-
pub fn span(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub external fn stateful(
-  init: state,
-  render: fn(state, fn(state) -> Nil) -> Element(action),
-) -> Element(action)
-

A stateful element is exactly what it sounds like: some element with local -encapsulated state! The render function we must provide is called with the -element’s current state as well as a function to set a new state. Whenever -that function is called, the element is re-rendered.

-

You might be wondering where the stateless version of this function is. -Those are just regular Gleam functions that return Elements!

-
-
- -
- -
pub fn strong(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn style(attributes: List(Attribute(a)), css: String) -> Element(
-  a,
-)
-
-
- -
-
-

- - sub - -

- - - </> - - -
-
pub fn sub(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn summary(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - sup - -

- - - </> - - -
-
pub fn sup(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - svg - -

- - - </> - - -
-
pub fn svg(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn table(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn tbody(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - td - -

- - - </> - - -
-
pub fn td(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn template(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - text - -

- - - </> - - -
-
pub external fn text(content: String) -> Element(action)
-

Render a Gleam string as an HTML text node.

-
-
- -
- -
pub fn textarea(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
- -
pub fn tfoot(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - th - -

- - - </> - - -
-
pub fn th(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn thead(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - time - -

- - - </> - - -
-
pub fn time(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn title(attributes: List(Attribute(a)), name: String) -> Element(
-  a,
-)
-
-
- -
-
-

- - tr - -

- - - </> - - -
-
pub fn tr(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn track(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - u - -

- - - </> - - -
-
pub fn u(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - ul - -

- - - </> - - -
-
pub fn ul(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - var_ - -

- - - </> - - -
-
pub fn var_(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
- -
pub fn video(attributes: List(Attribute(a)), children: List(
-    Element(a),
-  )) -> Element(a)
-
-
- -
-
-

- - wbr - -

- - - </> - - -
-
pub fn wbr(attributes: List(Attribute(a))) -> Element(a)
-
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/lustre/event.html b/docs/lustre/event.html deleted file mode 100644 index 66ba645..0000000 --- a/docs/lustre/event.html +++ /dev/null @@ -1,661 +0,0 @@ - - - - - - lustre/event - lustre - - - - - - - - - - - - -
- - -
- -

- lustre/event - -

- - - - - - - - - -
-

- Functions - -

- -
- -
pub fn dispatch(action: a) -> fn(fn(a) -> Nil) -> Nil
-
-
- -
-
-

- - on - -

- - - </> - - -
-
pub fn on(name: String, handler: fn(Dynamic, fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_blur(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
-
-
- -
- -
pub fn on_check(handler: fn(Bool, fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_click(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
-
-
- -
- -
pub fn on_focus(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
-
-
- -
- -
pub fn on_input(handler: fn(String, fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_keydown(handler: fn(String, fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_keypress(handler: fn(String, fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_keyup(handler: fn(String, fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_mouse_down(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_mouse_enter(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_mouse_leave(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_mouse_out(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_mouse_over(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_mouse_up(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(
-  a,
-)
-
-
- -
- -
pub fn on_submit(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
-
-
- -
- - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3