Jelajahi Sumber

Move the stm-local entry out of the document section in TEMPLATES.md

Per review feedback: the stm-local-{name} attribute entry sat inside the statum-document.js walk-bindings list (a parenthetical noted the module but the placement attributed it to document). Removed from that list with an explicit pointer to the binding module's section, which already documents it and the whole variable family; the expression-syntax paragraph now names statum-binding.js as the owner of stm-local-* locals.
saddle-ClankerSaddle 2 minggu lalu
induk
melakukan
7800ff6b6b
1 mengubah file dengan 6 tambahan dan 9 penghapusan
  1. 6 9
      TEMPLATES.md

+ 6 - 9
TEMPLATES.md

@@ -141,7 +141,8 @@ nothing else. All modules are ES5, dependency-free, guarded IIFEs.
 
 `stm-*` attribute values are JavaScript expressions evaluated against a scope
 built from state: `{ typeName: public }` for every held slot type, plus loop
-variables and `stm-local-*` locals in nested scopes. `statum.read('counter')`
+variables (statum-binding.js: `stm-local-*` locals; loop variables from the
+walk) in nested scopes. `statum.read('counter')`
 is the programmatic equivalent. Expression compilation is cached. An
 expression evaluating to `undefined` means "not resolved yet" and LEAVES THE
 ELEMENT UNTOUCHED (the server-rendered original DOM is preserved — this is
@@ -243,14 +244,10 @@ Walk bindings:
   expression over the item, usually a field) REUSE DOM nodes for unchanged
   keys, preserving focus/selection/input state; unkeyed loops rebuild
   wholesale. `data-stm-active="1"` + `hidden` mark an active holder.
-- **`stm-local-{name}="expr"`**: local variable (statum-binding.js). The
-  expression is evaluated LAZILY (at most once per render pass, only when
-  read) against the parent scope; the variable is visible to this element
-  and its descendants (a child scope) and shadows slot types/outer
-  variables. Multiple locals per element; same-element locals cannot
-  reference each other. The legacy `stm-def-{name}-as` spelling is an exact
-  obsolescent alias (one console.warn per element); mkpstm emits the modern
-  form for `pstm-input` fragment parameters.
+- **`stm-local-{name}="expr"`** and the other variable bindings
+  (`stm-global-*`, `stm-declare-*`, `-from-*` forms) belong to the BINDING
+  module — see its section; they are listed here only because they extend
+  the scope the walk builds.
 - **`stm-text`** / **`stm-html`**: set text content / inner HTML from an
   expression. `undefined` leaves content untouched; otherwise stringified
   (`null` → `''`). Note (known issue C1): on editable controls `stm-text`