From 640e3354fffd9f05306ca728c5d8c4a73bd76353 Mon Sep 17 00:00:00 2001 From: Hayleigh Thompson Date: Sat, 21 May 2022 04:15:12 +0100 Subject: :rocket: Deploy docs to GitHub Pages./mybackend -o test.s test.cl --- docs/gleam.js | 209 ++++ docs/highlightjs-gleam.js | 109 ++ docs/index.css | 698 +++++++++++++ docs/index.html | 331 ++++++ docs/lustre.html | 512 ++++++++++ docs/lustre/attribute.html | 979 ++++++++++++++++++ docs/lustre/cmd.html | 418 ++++++++ docs/lustre/element.html | 2397 ++++++++++++++++++++++++++++++++++++++++++++ docs/lustre/event.html | 602 +++++++++++ 9 files changed, 6255 insertions(+) create mode 100644 docs/gleam.js create mode 100644 docs/highlightjs-gleam.js create mode 100644 docs/index.css create mode 100644 docs/index.html create mode 100644 docs/lustre.html create mode 100644 docs/lustre/attribute.html create mode 100644 docs/lustre/cmd.html create mode 100644 docs/lustre/element.html create mode 100644 docs/lustre/event.html (limited to 'docs') diff --git a/docs/gleam.js b/docs/gleam.js new file mode 100644 index 0000000..73530ce --- /dev/null +++ b/docs/gleam.js @@ -0,0 +1,209 @@ +"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 new file mode 100644 index 0000000..292b8ca --- /dev/null +++ b/docs/highlightjs-gleam.js @@ -0,0 +1,109 @@ +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 new file mode 100644 index 0000000..ce095d6 --- /dev/null +++ b/docs/index.css @@ -0,0 +1,698 @@ +@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 new file mode 100644 index 0000000..e21d25a --- /dev/null +++ b/docs/index.html @@ -0,0 +1,331 @@ + + + + + + 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 will not work if your are +targeting 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/eval. 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/examples/.

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

+ lustre + +

+ + + +
+

+ Types + +

+ + +
+
+

+ + Attribute + +

+ + +
+
+
+
pub type Attribute(action) =
+  attribute.Attribute(action)
+ + +
+
+ +
+
+

+ + Cmd + +

+ + +
+
+
+
pub type Cmd(action) =
+  cmd.Cmd(action)
+ + +
+
+ +
+
+

+ + Element + +

+ + +
+
+
+
pub type Element(action) =
+  element.Element(action)
+ + +
+
+ +
+
+

+ + Error + +

+ + +
+
+
+
pub type Error {
+  ElementNotFound
+}
+ +

+ Constructors +

+
    + +
  • +
    + +
    ElementNotFound
    +
    + +
    + + + + +
    +
  • + +
+ +
+
+ +
+
+

+ + Program + +

+ + +
+
+
+
pub opaque type Program(state, action)
+ + +
+
+ +
+ + + + + + +
+

+ Functions + +

+ +
+
+

+ + application + +

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

Create a more complex application mimicing TEA – the Elm architecture. We +start with some initial state, a function to update that state, and then +a render function to derive our program’s view from that state.

+

Events produced by elements are passed a dispatch function that can be +used to emit actions that trigger your update function to be called and +trigger a rerender.

+
+
+ +
+
+

+ + basic + +

+ + +
+
pub fn basic(element: Element(a)) -> Program(Nil, a)
+

Create a basic lustre program 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 programs don’t have any global application state and so the +plumbing is a lot simpler. If you find yourself passing lot’s state of state +around, you might want to consider using application instead.

+
+
+ +
+
+

+ + start + +

+ + +
+
pub fn start(program: Program(a, b), selector: String) -> Result(
+  fn(b) -> Nil,
+  Error,
+)
+

Once you have created a program with either basic or application, you +need to actually start it! This function will mount your program 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 program and trigger an update.

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

+ lustre/attribute + +

+ + + +
+

+ Types + +

+ + +
+
+

+ + Attribute + +

+ + +
+
+
+
pub opaque type Attribute(action)
+ + +
+
+ +
+ + + + + + +
+

+ Functions + +

+ +
+
+

+ + accept + +

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

+ + action + +

+ + +
+
pub fn action(uri: String) -> Attribute(a)
+
+
+ +
+
+

+ + alt + +

+ + +
+
pub fn alt(text: String) -> Attribute(a)
+
+
+ +
+
+

+ + attribute + +

+ + +
+
pub fn attribute(name: String, value: String) -> Attribute(a)
+
+
+ +
+
+

+ + autocomplete + +

+ + +
+
pub fn autocomplete(should_autocomplete: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + autofocus + +

+ + +
+
pub fn autofocus(should_autofocus: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + autoplay + +

+ + +
+
pub fn autoplay(should_autoplay: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + checked + +

+ + +
+
pub fn checked(is_checked: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + class + +

+ + +
+
pub fn class(name: String) -> Attribute(a)
+
+
+ +
+
+

+ + classes + +

+ + +
+
pub fn classes(names: List(#(String, Bool))) -> Attribute(a)
+
+
+ +
+
+

+ + cols + +

+ + +
+
pub fn cols(val: Int) -> Attribute(a)
+
+
+ +
+
+

+ + controls + +

+ + +
+
pub fn controls(visible: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + disabled + +

+ + +
+
pub fn disabled(is_disabled: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + download + +

+ + +
+
pub fn download(filename: String) -> Attribute(a)
+
+
+ +
+
+

+ + event + +

+ + +
+
pub fn event(name: String, handler: fn(Dynamic, fn(a) -> Nil) ->
+    Nil) -> Attribute(a)
+
+
+ +
+
+

+ + for + +

+ + +
+
pub fn for(id: String) -> Attribute(a)
+
+
+ +
+
+

+ + height + +

+ + +
+
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)
+
+
+ +
+
+

+ + pattern + +

+ + +
+
pub fn pattern(regex: String) -> Attribute(a)
+
+
+ +
+
+

+ + placeholder + +

+ + +
+
pub fn placeholder(text: String) -> Attribute(a)
+
+
+ +
+
+

+ + property + +

+ + +
+
pub fn property(name: String, value: Dynamic) -> Attribute(a)
+
+
+ +
+
+

+ + readonly + +

+ + +
+
pub fn readonly(is_readonly: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + rel + +

+ + +
+
pub fn rel(relationship: String) -> Attribute(a)
+
+
+ +
+
+

+ + require + +

+ + +
+
pub fn require(is_required: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + rows + +

+ + +
+
pub fn rows(val: Int) -> Attribute(a)
+
+
+ +
+
+

+ + selected + +

+ + +
+
pub fn selected(is_selected: Bool) -> Attribute(a)
+
+
+ +
+
+

+ + src + +

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

+ + step + +

+ + +
+
pub fn step(val: String) -> Attribute(a)
+
+
+ +
+
+

+ + style + +

+ + +
+
pub fn style(properties: List(#(String, String))) -> Attribute(a)
+
+
+ +
+
+

+ + target + +

+ + +
+
pub fn target(target: String) -> Attribute(a)
+
+
+ +
+
+

+ + type_ + +

+ + +
+
pub fn type_(name: String) -> Attribute(a)
+
+
+ +
+
+

+ + value + +

+ + +
+
pub fn value(val: Dynamic) -> Attribute(a)
+
+
+ +
+
+

+ + width + +

+ + +
+
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 new file mode 100644 index 0000000..5f5220a --- /dev/null +++ b/docs/lustre/cmd.html @@ -0,0 +1,418 @@ + + + + + + lustre/cmd - lustre + + + + + + + + + + + + +
+ + +
+ +

+ lustre/cmd + +

+ + + +
+

+ Types + +

+ + +
+
+

+ + Cmd + +

+ + +
+
+
+
pub opaque type Cmd(action)
+ + +
+
+ +
+ + + + + + +
+

+ Functions + +

+ +
+
+

+ + batch + +

+ + +
+
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)
+
+
+ +
+
+

+ + to_list + +

+ + +
+
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 new file mode 100644 index 0000000..b392213 --- /dev/null +++ b/docs/lustre/element.html @@ -0,0 +1,2397 @@ + + + + + + lustre/element - lustre + + + + + + + + + + + + +
+ + +
+ +

+ lustre/element + +

+ + + +
+

+ Types + +

+ + +
+
+

+ + Element + +

+ + +
+
+
+
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)
+
+
+ +
+
+

+ + address + +

+ + +
+
pub fn address(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + area + +

+ + +
+
pub fn area(attributes: List(Attribute(a))) -> Element(a)
+
+
+ +
+
+

+ + article + +

+ + +
+
pub fn article(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + aside + +

+ + +
+
pub fn aside(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + audio + +

+ + +
+
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)
+
+
+ +
+
+

+ + blockquote + +

+ + +
+
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)
+
+
+ +
+
+

+ + button + +

+ + +
+
pub fn button(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + canvas + +

+ + +
+
pub fn canvas(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + caption + +

+ + +
+
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)
+
+
+ +
+
+

+ + colgroup + +

+ + +
+
pub fn colgroup(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + datalist + +

+ + +
+
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)
+
+
+ +
+
+

+ + details + +

+ + +
+
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)
+
+
+ +
+
+

+ + dialog + +

+ + +
+
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)
+
+
+ +
+
+

+ + embed + +

+ + +
+
pub fn embed(attributes: List(Attribute(a))) -> Element(a)
+
+
+ +
+
+

+ + fieldset + +

+ + +
+
pub fn fieldset(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + figcaption + +

+ + +
+
pub fn figcaption(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + figure + +

+ + +
+
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)
+
+
+ +
+
+

+ + fragment + +

+ + +
+
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)
+
+
+ +
+
+

+ + iframe + +

+ + +
+
pub fn iframe(attributes: List(Attribute(a))) -> Element(a)
+
+
+ +
+
+

+ + img + +

+ + +
+
pub fn img(attributes: List(Attribute(a))) -> Element(a)
+
+
+ +
+
+

+ + input + +

+ + +
+
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)
+
+
+ +
+
+

+ + label + +

+ + +
+
pub fn label(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + legend + +

+ + +
+
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)
+
+
+ +
+
+

+ + mathml + +

+ + +
+
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)
+
+
+ +
+
+

+ + meter + +

+ + +
+
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.

+
+
+ +
+
+

+ + noscript + +

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

+ + object + +

+ + +
+
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)
+
+
+ +
+
+

+ + optgroup + +

+ + +
+
pub fn optgroup(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + option + +

+ + +
+
pub fn option(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + output + +

+ + +
+
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)
+
+
+ +
+
+

+ + param + +

+ + +
+
pub fn param(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + picture + +

+ + +
+
pub fn picture(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + portal + +

+ + +
+
pub fn portal(attributes: List(Attribute(a))) -> Element(a)
+
+
+ +
+
+

+ + pre + +

+ + +
+
pub fn pre(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + progress + +

+ + +
+
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)
+
+
+ +
+
+

+ + section + +

+ + +
+
pub fn section(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + select + +

+ + +
+
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)
+
+
+ +
+
+

+ + small + +

+ + +
+
pub fn small(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + source + +

+ + +
+
pub fn source(attributes: List(Attribute(a))) -> Element(a)
+
+
+ +
+
+

+ + span + +

+ + +
+
pub fn span(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + stateful + +

+ + +
+
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!

+
+
+ +
+
+

+ + strong + +

+ + +
+
pub fn strong(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + style + +

+ + +
+
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)
+
+
+ +
+
+

+ + summary + +

+ + +
+
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)
+
+
+ +
+
+

+ + table + +

+ + +
+
pub fn table(attributes: List(Attribute(a)), children: List(
+    Element(a),
+  )) -> Element(a)
+
+
+ +
+
+

+ + tbody + +

+ + +
+
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)
+
+
+ +
+
+

+ + template + +

+ + +
+
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.

+
+
+ +
+
+

+ + textarea + +

+ + +
+
pub fn textarea(attributes: List(Attribute(a))) -> Element(a)
+
+
+ +
+
+

+ + tfoot + +

+ + +
+
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)
+
+
+ +
+
+

+ + thead + +

+ + +
+
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)
+
+
+ +
+
+

+ + title + +

+ + +
+
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)
+
+
+ +
+
+

+ + track + +

+ + +
+
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)
+
+
+ +
+
+

+ + video + +

+ + +
+
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 new file mode 100644 index 0000000..109f30b --- /dev/null +++ b/docs/lustre/event.html @@ -0,0 +1,602 @@ + + + + + + lustre/event - lustre + + + + + + + + + + + + +
+ + +
+ +

+ lustre/event + +

+ + + + + + + + + +
+

+ Functions + +

+ +
+
+

+ + dispatch + +

+ + +
+
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,
+)
+
+
+ +
+
+

+ + on_blur + +

+ + +
+
pub fn on_blur(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
+
+
+ +
+
+

+ + on_check + +

+ + +
+
pub fn on_check(handler: fn(Bool, fn(a) -> Nil) -> Nil) -> Attribute(
+  a,
+)
+
+
+ +
+
+

+ + on_click + +

+ + +
+
pub fn on_click(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
+
+
+ +
+
+

+ + on_focus + +

+ + +
+
pub fn on_focus(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
+
+
+ +
+
+

+ + on_input + +

+ + +
+
pub fn on_input(handler: fn(String, fn(a) -> Nil) -> Nil) -> Attribute(
+  a,
+)
+
+
+ +
+
+

+ + on_keydown + +

+ + +
+
pub fn on_keydown(handler: fn(String, fn(a) -> Nil) -> Nil) -> Attribute(
+  a,
+)
+
+
+ +
+
+

+ + on_keypress + +

+ + +
+
pub fn on_keypress(handler: fn(String, fn(a) -> Nil) -> Nil) -> Attribute(
+  a,
+)
+
+
+ +
+
+

+ + on_keyup + +

+ + +
+
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,
+)
+
+
+ +
+
+

+ + on_mouse_out + +

+ + +
+
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,
+)
+
+
+ +
+
+

+ + on_mouse_up + +

+ + +
+
pub fn on_mouse_up(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(
+  a,
+)
+
+
+ +
+
+

+ + on_submit + +

+ + +
+
pub fn on_submit(handler: fn(fn(a) -> Nil) -> Nil) -> Attribute(a)
+
+
+ +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3