From bcddc75f56f5b319444c9fd8bde43687d97f2b3b Mon Sep 17 00:00:00 2001 From: Jan Andrle Date: Wed, 11 Dec 2024 16:20:49 +0100 Subject: [PATCH] :abc: updated docs (examples) --- docs/components/examples/introducing/helloWorld.js | 13 ++++++++----- docs/components/examples/signals/dom-attrs.js | 2 +- docs/components/mnemonic/elements-init.js | 12 ++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/components/examples/introducing/helloWorld.js b/docs/components/examples/introducing/helloWorld.js index 47c0fe9..71d4340 100644 --- a/docs/components/examples/introducing/helloWorld.js +++ b/docs/components/examples/introducing/helloWorld.js @@ -1,15 +1,18 @@ import { el } from "deka-dom-el"; import { S } from "deka-dom-el/signals"; -const clicks= S(0); // A document.body.append( - el().append( + el(HelloWorldComponent) +); +function HelloWorldComponent(){ + const clicksS= S(0); // A + return el().append( el("p", S(()=> - "Hello World "+"🎉".repeat(clicks()) // B + "Hello World "+"🎉".repeat(clicksS()) // B )), el("button", { type: "button", - onclick: ()=> clicks(clicks()+1), // C + onclick: ()=> clicksS(clicksS()+1), // C textContent: "Fire", }) ) -); +} diff --git a/docs/components/examples/signals/dom-attrs.js b/docs/components/examples/signals/dom-attrs.js index a26219e..88b3ba2 100644 --- a/docs/components/examples/signals/dom-attrs.js +++ b/docs/components/examples/signals/dom-attrs.js @@ -4,7 +4,7 @@ const count= S(0); import { el } from "deka-dom-el"; document.body.append( el("p", S(()=> "Currently: "+count())), - el("p", { classList: { red: S(()=> count()%2) }, dataset: { count }, textContent: "Attributes example" }) + el("p", { classList: { red: S(()=> count()%2 === 0) }, dataset: { count }, textContent: "Attributes example" }) ); document.head.append( el("style", ".red { color: red; }") diff --git a/docs/components/mnemonic/elements-init.js b/docs/components/mnemonic/elements-init.js index 94d5dea..0893128 100644 --- a/docs/components/mnemonic/elements-init.js +++ b/docs/components/mnemonic/elements-init.js @@ -4,24 +4,24 @@ import { mnemonicUl } from "../mnemonicUl.html.js"; export function mnemonic(){ return mnemonicUl().append( el("li").append( - el("code", "assign(, ...): "), - " — assign properties to the element", + el("code", "assign(, ...): "), + " — assign properties (prefered, or attributes) to the element", ), el("li").append( el("code", "el(, )[.append(...)]: "), " — simple element containing only text", ), el("li").append( - el("code", "el(, )[.append(...)]: "), - " — element with more properties", + el("code", "el(, )[.append(...)]: "), + " — element with more properties (prefered, or attributes)", ), el("li").append( el("code", "el(, )[.append(...)]: "), - " — using component represented by function", + " — using component represented by function (must accept object like for )", ), el("li").append( el("code", "el(<...>, <...>, ...)"), - " — see following page" + " — see following section of documentation", ), el("li").append( el("code", "elNS()()[.append(...)]: "),