marko 6.3.46 → 6.3.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/cheatsheet.md +19 -16
  2. package/dist/common/accessor.d.ts +0 -3
  3. package/dist/common/accessor.debug.d.ts +0 -3
  4. package/dist/common/constants/resume-symbol.d.ts +5 -2
  5. package/dist/common/helpers.d.ts +2 -0
  6. package/dist/debug/dom/catch.feat.js +1 -1
  7. package/dist/debug/dom/catch.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-input.feat.js +1 -1
  9. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-open.feat.js +1 -1
  11. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-select.feat.js +1 -1
  13. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  16. package/dist/debug/dom/controllable.feat.js +1 -1
  17. package/dist/debug/dom/controllable.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  20. package/dist/debug/dom/placeholder.feat.js +1 -1
  21. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  22. package/dist/debug/{dom-WyMgkHne.js → dom-CA_HiiES.js} +23 -8
  23. package/dist/debug/{dom-CIt3_Sdm.mjs → dom-DBMLPLeE.mjs} +18 -9
  24. package/dist/debug/dom.js +20 -24
  25. package/dist/debug/dom.mjs +20 -24
  26. package/dist/debug/html.js +19 -5
  27. package/dist/debug/html.mjs +18 -5
  28. package/dist/dom/catch.feat.js +1 -1
  29. package/dist/dom/catch.feat.mjs +1 -1
  30. package/dist/dom/controllable-input.feat.js +1 -1
  31. package/dist/dom/controllable-input.feat.mjs +1 -1
  32. package/dist/dom/controllable-open.feat.js +1 -1
  33. package/dist/dom/controllable-open.feat.mjs +1 -1
  34. package/dist/dom/controllable-select.feat.js +1 -1
  35. package/dist/dom/controllable-select.feat.mjs +1 -1
  36. package/dist/dom/controllable-textarea.feat.js +1 -1
  37. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  38. package/dist/dom/controllable.feat.js +1 -1
  39. package/dist/dom/controllable.feat.mjs +1 -1
  40. package/dist/dom/dom.d.ts +1 -1
  41. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  42. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  43. package/dist/dom/placeholder.feat.js +1 -1
  44. package/dist/dom/placeholder.feat.mjs +1 -1
  45. package/dist/{dom-R3sALHJt.js → dom-BfydlrCq.js} +27 -23
  46. package/dist/{dom-DN6BTUmH.mjs → dom-UwNQ-AXt.mjs} +12 -13
  47. package/dist/dom.js +20 -20
  48. package/dist/dom.mjs +14 -14
  49. package/dist/html/writer.d.ts +2 -1
  50. package/dist/html.d.ts +1 -1
  51. package/dist/html.js +16 -5
  52. package/dist/html.mjs +16 -5
  53. package/dist/translator/index.js +11 -19
  54. package/dist/translator/visitors/constants/sibling-text.d.ts +0 -1
  55. package/package.json +3 -3
  56. package/dist/common/constants/load-signal-value.d.ts +0 -5
  57. package/dist/common/constants/load-signal-value.debug.d.ts +0 -5
package/cheatsheet.md CHANGED
@@ -4,20 +4,20 @@ Marko 6 = HTML superset, not JSX and not Marko 4/5 syntax. `.marko` files are co
4
4
 
5
5
  ## Golden rules
6
6
 
7
- 1. Text interpolation: `${expr}` inside tag bodies. A bare line at the template root parses as a tag (concise mode): `Welcome aboard` fails to compile, but `p is a tag` compiles **silently** to `<p is a tag></p>`, since any line starting with a real tag name loses its words to attributes. Wrap text in an element (`<p>Welcome aboard</p>`) or prefix the line with `--` and a space (`-- Welcome ${name}`). Attributes take raw JS after `=` with no braces or quotes: `<div title=user.name data-n=1 + 1>`.
8
- 2. A top-level `>` hugging its operand in an attribute value **ends the tag** silently: `<button disabled=count>=8 onClick() {…}>More</button>` is `disabled=count` plus the text `=8 onClick() {…}>`, so the handler never binds. Space a `>=` (`disabled=count >= 8`), and parenthesize a bare `>` comparison (`hidden=(a > b)`) and a TS type argument `<let/s=(new Set<string>())>`. Do not move the type onto the tag variable instead: `<let/s:Set<string>=new Set()>` compiles but fails type-check with TS2322 (the annotation does not flow into the initializer). A `>` nested inside `(…)`/`{…}`/`[…]` is safe (`class={ big: n > 1 }`). `<` never closes a tag (`disabled=count<=1` is fine).
7
+ 1. Text interpolation: `${expr}` inside tag bodies. A bare line at the template root parses as a tag (concise mode): `Welcome aboard` fails to compile, but `p is a tag` compiles silently to `<p is a tag></p>`, since any line starting with a real tag name loses its words to attributes. Wrap text in an element (`<p>Welcome aboard</p>`) or prefix the line with `--` and a space (`-- Welcome ${name}`). Attributes take raw JS after `=` with no braces or quotes: `<div title=user.name data-n=1 + 1>`.
8
+ 2. A top-level `>` hugging its operand in an attribute value ends the tag silently: `<button disabled=count>=8 onClick() {…}>More</button>` is `disabled=count` plus the text `=8 onClick() {…}>`, so the handler never binds. Space a `>=` (`disabled=count >= 8`); parenthesize a bare `>` comparison (`hidden=(a > b)`) and a TS type argument (`<let/s=(new Set<string>())>`, else it parses as `new Set() < string`). Do not move the type onto the tag variable instead: `<let/s:Set<string>=new Set()>` compiles but fails type-check with TS2322 (the annotation does not flow into the initializer). A `>` nested inside `(…)`/`{…}`/`[…]` is safe (`class={ big: n > 1 }`). `<` never closes a tag (`disabled=count<=1` is fine).
9
9
  3. State: `<let/name=initial>` (slash then var name!). Update by plain assignment in an event handler: `count++`, `text = "hi"`. No setState, no hooks.
10
- 4. Derived values: `<const/total=items.length * price>` auto-recomputes. Never use an effect to derive state. A tag variable is whatever the tag returns, not the attribute you passed. `<let/draft=input.text>` re-runs on every `input.text` change but returns state it controls, so `draft` keeps your edits; only a controllable `<let>` (`valueChange=`, or `<let/draft:=input.text>`) takes the new value. Pick by intent: recomputes → `<const>`, seeds then diverges → `<let>`. A `<let>` you never assign is just a frozen `<const>`. Updates batch: mid-handler a reassigned `<let>` reads current but its derived `<const>` reads stale, so recompute from the `<let>`.
10
+ 4. Derived values: `<const/total=items.length * price>` auto-recomputes. Never use an effect to derive state. A tag variable is whatever the tag returns, not the attribute passed to it. `<let/draft=input.text>` re-runs on every `input.text` change but returns state it controls, so `draft` keeps its edits; only a controllable `<let>` (`valueChange=`, or `<let/draft:=input.text>`) takes the new value. Pick by intent: recomputes → `<const>`, seeds then diverges → `<let>`. A `<let>` that is never assigned is just a frozen `<const>`. Updates batch: mid-handler a reassigned `<let>` reads current but its derived `<const>` reads stale, so recompute from the `<let>`.
11
11
  5. Never mutate state in place: `items.push(x)` does not update the UI. Always reassign:
12
12
  - add: `items = items.concat(x)`
13
13
  - remove: `items = items.toSpliced(i, 1)`
14
14
  - update: `items = items.toSpliced(i, 1, { ...item, done: true })`
15
15
  - object: `user = { ...user, name }`
16
16
  6. Events: method shorthand `onClick() { ... }` or `onClick=fn`. Handlers receive `(event, element)`; delegation means the element is the second parameter, not `event.currentTarget`: `onSubmit(e) { e.preventDefault(); save() }`, `onClick(e, el) { el.focus() }`. Don't sync input values through `onInput`/`onChange`; that's what the change handlers below are for. Prefix with `async` to `await` in the body: `async onClick() { await save() }`.
17
- 7. Native inputs are uncontrolled by default: `value=` sets the default value later writes update what `form.reset()` restores, never a dirty field's display. Adding the matching `*Change` handler is what makes them controlled: `valueChange` on `<input>`/`<textarea>`/`<select>`, `checkedChange` on checkboxes/radios, `openChange` on `<details>`/`<dialog>`. `value:=text` is the shorthand for `value=text valueChange(v) { text = v }`. (`<textarea value:=text/>`: value attribute, not body.) `:=` differs by operand: on an identifier (`value:=text`) it assigns that variable; on a member expression (`<let/count:=input.count>` in a child) it wires `input.countChange`, so the child is controlled when the parent passes that handler and keeps its own state when it doesn't.
17
+ 7. Native inputs are uncontrolled by default: `value=` sets the default value. Later writes update what `form.reset()` restores, never a dirty field's display. Adding the matching `*Change` handler is what makes them controlled: `valueChange` on `<input>`/`<textarea>`/`<select>`, `checkedChange` on checkboxes/radios, `openChange` on `<details>`/`<dialog>`. `value:=text` is the shorthand for `value=text valueChange(v) { text = v }`. (`<textarea value:=text/>`: value attribute, not body.) `:=` differs by operand: on an identifier (`value:=text`) it assigns that variable; on a member expression (`<let/count:=input.count>` in a child) it wires `input.countChange`, so the child is controlled when the parent passes that handler and keeps its own state when it doesn't.
18
18
  8. Transform in the handler when needed; number inputs give strings: `<input type="number" value=n valueChange(v) { n = +v }>`, or `value:parseFloat:=n`. Uncommitted edits (debounce, commit on blur) never sync through a `<script>`; that is rule 4's derive-by-effect trap. Pair a controllable `<let/value:=input.value>` with `<let/pending=null>`, show `<const/draft=pending ?? value>`, collect with `valueChange(v) { pending = v }`, and commit by assigning `value = pending; pending = null`. Prefer that to calling `input.valueChange(...)`, which throws unless every caller controls the tag.
19
19
  9. Radio/checkbox groups: `checkedValue:=picked` on each input (shared var, distinct `value=`); the match is checked; array var for multi-checkbox. Dropdown: `<select value:=picked>`.
20
- 10. Module-level values, helpers and type aliases need `static`: `static const LIMIT = 10`, `static function fmt(n) {…}`, `static type Row = {…}`. Without it `function fmt(n) {` parses as a tag: ``Unable to find entry point for custom tag `<function>` ``, an error that points at `static`. Prefer it to `<const>` for anything that never changes: `<const/LIMIT=10>` emits a per-instance signal plus a `$setup` call. `server`/`client` narrow `static` to one platform (`client import { Chart } from "chart"`); the binding is `undefined` on the other, so read a `client` one only from `<script>`/handlers/`<lifecycle>` reading it while rendering throws `is not a function` during SSR.
20
+ 10. Module-level values, helpers and type aliases need `static`: `static const LIMIT = 10`, `static function fmt(n) {…}`, `static type Row = {…}`. Prefer it to `<const>` for anything that never changes: `<const/LIMIT=10>` runs per instance, `static` hoists it to a module constant. `server`/`client` narrow `static` to one platform (`client import { Chart } from "chart"`); the binding is `undefined` on the other, so read a `client` one only from `<script>`/handlers/`<lifecycle>`. Reading it while rendering throws `is not a function` during SSR.
21
21
 
22
22
  ## Canonical component
23
23
 
@@ -58,13 +58,14 @@ Marko 6 = HTML superset, not JSX and not Marko 4/5 syntax. `.marko` files are co
58
58
  ## Control flow
59
59
 
60
60
  ```marko
61
- <if=(count > 10)> A </if> // parenthesize comparisons; a bare `>` ends the tag (rule 2)
61
+ <if=(count > 10)> A </if> // parenthesize comparisons; a hugging `>` ends the tag (rule 2)
62
62
  <else if=other> B </else>
63
63
  <else> C </else>
64
64
 
65
65
  <for|item, index| of=list by="id"> ${item.name} </for> // by keys the loop (no key= attr!)
66
- <for|city| of=cities by=(city) => city> ${city} </for> // primitives: by takes a function; the loop param is not in scope in by=, so by=city is an undefined variable
67
- <for|i| from=0 until=5> ${i} </for> // 0..4
66
+ <for|city| of=cities by=(city) => city> ${city} </for> // primitives: by takes a function, evaluated before the loop
67
+ <for|i| from=0 until=5> ${i} </for> // 0..4 (to= is inclusive, step= optional)
68
+ <for|key, value| in=obj> ${key}=${value} </for> // object entries
68
69
 
69
70
  <show=open> stays mounted, keeps state (form drafts) when hidden </show>
70
71
  ```
@@ -125,17 +126,20 @@ Don't fetch while rendering: start data loads early, pass the promise through th
125
126
  </div>
126
127
  ```
127
128
 
128
- - Repeated attr tags (many `<@tab ...>`) arrive as the singular prop `input.tab`, which is iterable but not an array: `input.tab[i]` and `input.tab.length` are undefined. To index or count, spread first: `<const/tabs=[...input.tab ?? []]>` then `tabs[active]`/`tabs.length`. Looping directly is fine: `<for|tab| of=input.tab>`.
129
+ - Repeated attr tags (many `<@tab ...>`) arrive as the singular prop `input.tab`: the first tab's attrs, made iterable, not an array: `input.tab[i]` and `input.tab.length` are undefined. To index or count, spread first: `<const/tabs=[...input.tab ?? []]>` then `tabs[active]`/`tabs.length`. Looping directly is fine: `<for|tab| of=input.tab>`.
130
+ - Text: `0` renders; `false`/`null`/`undefined`/`""`/`NaN` render nothing. `$!{html}` inserts raw HTML.
129
131
  - Conditional attrs: `false`/`null` attrs are omitted from HTML. `aria-selected` etc. want strings: `aria-selected=(i === active && "true")`.
130
- - `class=` / `style=` accept strings, objects, arrays: `class=["btn", { active }]`, `style={ color }` (single braces). `style=` keys are kebab-case CSS names (`{ "background-color": c }`), not camelCase.
132
+ - `class=` / `style=` accept strings, objects, arrays: `class=["btn", { active }]`, `style={ color }` (single braces). `style=` keys are kebab-case CSS names (`{ "background-color": c }`); camelCase keys are written verbatim. `...input` spreads attrs onto a tag; `content=` passes body content as an attr.
133
+ - `<define/Panel|input|>` declares a local tag inline; `<${Toolbar.Undo}/>` renders a dynamic tag (falsy name → content only).
134
+ - `<select value:=picked>`: every `<option>` needs `value=`; `multiple` binds an array.
131
135
  - `<id/x>` mints a collision-free id for label/input wiring (`<label for=x>`/`<input id=x>`); don't hardcode ids in reusable tags; `<id/x=input.id>` reuses a caller's.
132
136
  - Head tags render where written: a `<title>`/`<meta>`/`<link>` inside a nested component stays in the body, giving a second title or an inert canonical. `<head>` is already written by the time descendants render, so page meta has to be known before it: under @marko/run declare it in the route's `+meta.*` file and read `$global.meta` from the layout that owns `<head>`, otherwise pass it down or set it on `$global` at the render call.
133
137
 
134
138
  ## Sharing data (`$global`)
135
139
 
136
- - Read request-scoped `$global` from any template, no threading: `${$global.messages.title}`. Otherwise prop-drill through `input`; there is no provider/consumer context API.
140
+ - Read request-scoped `$global` from any template, no threading: `${$global.messages.title}`. Otherwise pass data down through `input`.
137
141
  - Populate at the render call: `template.render({ $global: { messages } })`. Under @marko/run a middleware's `return next({ messages })` merges into `$global.data`.
138
- - `$global` is not serialized to the client by default. Mark any key the browser itself evaluates, e.g. an event handler, a `<script>`, markup the browser (re)creates, or a `<const>` that recomputes from state: `$global.serializedGlobals = { messages: true }` at the render call (under @marko/run, `context.serializedGlobals.data = true`; it ships `params`/`url` already). What the server already rendered needs no opt-in.
142
+ - `$global` is not serialized to the client by default. Mark any key the browser itself evaluates, e.g. an event handler, a `<script>`, markup the browser (re)creates, or a `<const>` that recomputes from state: `$global.serializedGlobals = { messages: true }` at the render call (under @marko/run, `context.serializedGlobals.data = true`; it ships `params`/`url` already). What the server already rendered needs no opt-in; a debug build logs an unserialized key read in the browser.
139
143
 
140
144
  ## Client-side effects
141
145
 
@@ -166,7 +170,7 @@ Imperative libs (charts, maps) needing mount/update/destroy: use `<lifecycle>`,
166
170
 
167
171
  ## Lazy loading
168
172
 
169
- Defer a tag's JS into its own bundle until a trigger fires: `render`, `visible#sel`, `idle`, `media(...)`, `on-click#sel` (combine with `|`). Server HTML renders immediately; `<try>` shows a `@placeholder` while loading. Don't hand-roll an `IntersectionObserver`.
173
+ Defer a tag's JS into its own bundle until a trigger fires: `visible#sel`, `idle`, `media(...)`, `on-click#sel` (combine with `|`), or `render` alone. Server HTML renders immediately; in the browser `<try>` shows a `@placeholder` while loading. Don't hand-roll an `IntersectionObserver`.
170
174
 
171
175
  ```marko
172
176
  import PriceChart from "<price-chart>" with { load: "visible#chart" }
@@ -196,7 +200,7 @@ Each left-hand habit is an error or silently wrong.
196
200
  | Wrong (React/Vue/Marko5 habit) | Right |
197
201
  | ----------------------------------------------------------- | ------------------------------------------------------------------------------------ |
198
202
  | `disabled=n>=8` (hugging `>` in a value) | `disabled=n >= 8` or `disabled=(n >= 8)`; a hugging `>` silently closes the tag |
199
- | `<let/s=new Set<string>()>` (type argument in a value) | `<let/s=(new Set<string>())>`; a tag-var annotation fails type-check |
203
+ | `<let/s=new Set<string>()>` (type argument in a value) | `<let/s=(new Set<string>())>`; else it parses as `new Set() < string` |
200
204
  | `{expr}` in markup, `className`, `key=`, `style={{...}}` | `${expr}`, `class`, `by=` on `<for>`, `style={...}` |
201
205
  | `onClick={() => ...}` / `@click` / `on-click("name")` | `onClick() { ... }` |
202
206
  | `const [x, setX] = useState()` / `state` / `class {}` block | `<let/x=0>` then `x = 1` |
@@ -213,18 +217,17 @@ Each left-hand habit is an error or silently wrong.
213
217
  | `el.focus()` on a ref | `el().focus()` inside `<script>`/handler |
214
218
  | `input.tab[0]` / `input.tab.length` | `[...input.tab ?? []]` first (attr tags are iterables, not arrays) |
215
219
  | bare text on its own line at template root | wrap in an element (`<p>...`), or prefix the line with `--` and a space |
216
- | `by=item` using the loop variable | `by="propName"` or `by=(item) => key`; `by=` is evaluated outside the loop |
217
220
  | `onInput(e) { q = e.target.value }` to sync an input | `value:=q`; the change handler owns the value |
218
221
  | `<script>` syncing a draft field back from `value` | `<const/draft=pending ?? value>`; a `<let>` holds only the uncommitted edit |
219
222
  | fetching inside the component that renders the data | start the promise early (route handler / top of template), pass it down to `<await>` |
220
223
  | `style={ backgroundColor: c }` (camelCase keys) | `style={ "background-color": c }` (kebab-case) |
221
224
  | `this.querySelector` / `this.getRootNode()` in `<script>` | element ref getter: `<div/el>` then `el()` (there is no `this`) |
222
- | `<div/my-el>` / `<input/card-input>` (hyphen in tag var) | valid JS identifier: `<div/myEl>` (the error won't name the hyphen) |
223
225
  | hand-rolled radios `checked=x checkedChange(v){…}` | `checkedValue:=picked` on each radio (shared var, distinct `value=`) |
224
226
  | hand-rolled `IntersectionObserver` to defer a widget's JS | `import W from "<w>" with { load: "visible#sel" }` |
225
227
  | imperative lib wired through `<script>` mount + cleanup | `<lifecycle onMount/onUpdate/onDestroy>` (keeps `this` across all three) |
226
228
  | `createContext`/provider to share data | `input` (prop drilling) or request-scoped `$global` |
227
229
  | `<title>`/`<meta>` in a nested component | put page meta in the layout that owns `<head>`; head tags never hoist |
230
+ | `<option selected=...>` in a controlled `<select>` | `value=` on every option and `value:=picked` on the select |
228
231
  | `$global.x` in client-reactive code, not allow-listed | `$global.serializedGlobals = { x: true }` first; otherwise the read is `undefined` |
229
232
  | hand-namespaced global classes (`.my-card-title`) | `<style/styles>` + `class=styles.card` (scoped CSS modules) |
230
233
  | `tsc --noEmit` to type check templates | `mtc`; `tsc` skips `.marko` files and exits 0 |
@@ -2,7 +2,6 @@ import * as AccessorPrefix from "./constants/accessor-prefix";
2
2
  import * as AccessorProp from "./constants/accessor-prop";
3
3
  import * as ClosureSignalProp from "./constants/closure-signal-prop";
4
4
  import * as KeyedScopesProp from "./constants/keyed-scopes-prop";
5
- import * as LoadSignalValue from "./constants/load-signal-value";
6
5
  import * as PendingRenderProp from "./constants/pending-render-prop";
7
6
  import * as RendererProp from "./constants/renderer-prop";
8
7
  type AccessorPrefix = AccessorPrefix.Value;
@@ -17,5 +16,3 @@ type ClosureSignalProp = ClosureSignalProp.Value;
17
16
  export { ClosureSignalProp };
18
17
  type KeyedScopesProp = KeyedScopesProp.Value;
19
18
  export { KeyedScopesProp };
20
- type LoadSignalValue = LoadSignalValue.Value;
21
- export { LoadSignalValue };
@@ -2,7 +2,6 @@ import * as AccessorPrefix from "./constants/accessor-prefix.debug";
2
2
  import * as AccessorProp from "./constants/accessor-prop.debug";
3
3
  import * as ClosureSignalProp from "./constants/closure-signal-prop.debug";
4
4
  import * as KeyedScopesProp from "./constants/keyed-scopes-prop.debug";
5
- import * as LoadSignalValue from "./constants/load-signal-value.debug";
6
5
  import * as PendingRenderProp from "./constants/pending-render-prop.debug";
7
6
  import * as RendererProp from "./constants/renderer-prop.debug";
8
7
  type AccessorPrefix = AccessorPrefix.Value;
@@ -17,5 +16,3 @@ type ClosureSignalProp = ClosureSignalProp.Value;
17
16
  export { ClosureSignalProp };
18
17
  type KeyedScopesProp = KeyedScopesProp.Value;
19
18
  export { KeyedScopesProp };
20
- type LoadSignalValue = LoadSignalValue.Value;
21
- export { LoadSignalValue };
@@ -1,7 +1,10 @@
1
- export declare const Node = "*";
1
+ export declare const Node = "$";
2
+ export declare const EmptyText = "%";
3
+ export declare const HtmlStart = "&";
4
+ export declare const HtmlEnd = "'";
2
5
  export declare const BranchStart = "[";
3
6
  export declare const BranchEnd = "]";
4
- export declare const BranchEndNativeTag = "'";
7
+ export declare const BranchEndNativeTag = "(";
5
8
  export declare const BranchEndSingleNode = "|";
6
9
  export declare const BranchEndOnlyChildInParent = ")";
7
10
  export declare const BranchEndSingleNodeOnlyChildInParent = "}";
@@ -15,3 +15,5 @@ export declare function normalizeDynamicRenderer<Renderer>(value: any): Renderer
15
15
  export declare const decodeAccessor: (num: number) => string;
16
16
  export declare let branchesEnabled: undefined | 1;
17
17
  export declare function withBranches<T>(runtime?: T): T;
18
+ export declare let dynamicHtmlEnabled: undefined | 1;
19
+ export declare function withDynamicHtml<T>(runtime: T): T;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  //#region src/dom/catch.feat.ts
4
4
  const handlePendingTry = (fn, scope, branch) => {
5
5
  while (branch) {
@@ -1,4 +1,4 @@
1
- import { An as PendingEffects, Sn as Scope, g as renderCatch, jn as PendingRenders, kn as ParentBranch, nn as installCatch, rn as placeholderShown, tn as caughtError, wn as ClosestBranch, xn as Pending } from "../dom-CIt3_Sdm.mjs";
1
+ import { An as ParentBranch, Cn as Scope, Mn as PendingRenders, Sn as Pending, Tn as ClosestBranch, g as renderCatch, jn as PendingEffects, nn as installCatch, rn as placeholderShown, tn as caughtError } from "../dom-DBMLPLeE.mjs";
2
2
  //#region src/dom/catch.feat.ts
3
3
  const handlePendingTry = (fn, scope, branch) => {
4
4
  while (branch) {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  //#region src/dom/controllable-input.feat.ts
4
4
  require_control_flow.controllableScripts[0] = require_control_flow._attr_input_checked_script;
5
5
  require_control_flow.controllableScripts[1] = require_control_flow._attr_input_checkedValue_script;
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
1
+ import { A as _attr_input_value_script, C as _attr_input_checkedValue_script, T as _attr_input_checked_script, z as controllableScripts } from "../dom-DBMLPLeE.mjs";
2
2
  //#region src/dom/controllable-input.feat.ts
3
3
  controllableScripts[0] = _attr_input_checked_script;
4
4
  controllableScripts[1] = _attr_input_checkedValue_script;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  //#region src/dom/controllable-open.feat.ts
4
4
  require_control_flow.controllableScripts[4] = require_control_flow._attr_details_or_dialog_open_script;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
1
+ import { y as _attr_details_or_dialog_open_script, z as controllableScripts } from "../dom-DBMLPLeE.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  //#region src/dom/controllable-select.feat.ts
4
4
  require_control_flow.controllableScripts[3] = require_control_flow._attr_select_value_script;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { N as _attr_select_value_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
1
+ import { N as _attr_select_value_script, z as controllableScripts } from "../dom-DBMLPLeE.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  //#region src/dom/controllable-textarea.feat.ts
4
4
  require_control_flow.controllableScripts[2] = require_control_flow._attr_input_value_script;
5
5
  //#endregion
@@ -1,4 +1,4 @@
1
- import { A as _attr_input_value_script, z as controllableScripts } from "../dom-CIt3_Sdm.mjs";
1
+ import { A as _attr_input_value_script, z as controllableScripts } from "../dom-DBMLPLeE.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  require("./controllable-input.feat.js");
4
4
  require("./controllable-open.feat.js");
5
5
  require("./controllable-select.feat.js");
@@ -1,4 +1,4 @@
1
- import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-CIt3_Sdm.mjs";
1
+ import { F as _controllable_open, I as _controllable_select, L as _controllable_textarea, P as _controllable_input, R as controllableRenders } from "../dom-DBMLPLeE.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  //#region src/dom/dynamic-tag-var.feat.ts
4
4
  const elementGetter = (branch) => () => require_control_flow._el_read(branch[require_control_flow.StartNode]);
5
5
  require_control_flow.installDynamicTagVar((branch) => branch[require_control_flow.TagVariable](elementGetter(branch)));
@@ -1,4 +1,4 @@
1
- import { Nn as StartNode, Pn as TagVariable, Zt as DYNAMIC_TAG_VAR_REGISTER_ID, gt as _resume, kt as _el_read, m as installDynamicTagVar } from "../dom-CIt3_Sdm.mjs";
1
+ import { Fn as TagVariable, Pn as StartNode, Zt as DYNAMIC_TAG_VAR_REGISTER_ID, gt as _resume, kt as _el_read, m as installDynamicTagVar } from "../dom-DBMLPLeE.mjs";
2
2
  //#region src/dom/dynamic-tag-var.feat.ts
3
3
  const elementGetter = (branch) => () => _el_read(branch[StartNode]);
4
4
  installDynamicTagVar((branch) => branch[TagVariable](elementGetter(branch)));
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const require_control_flow = require("../dom-WyMgkHne.js");
2
+ const require_control_flow = require("../dom-CA_HiiES.js");
3
3
  //#region src/dom/placeholder.feat.ts
4
4
  require_control_flow.registeredValues[require_control_flow.PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
5
5
  if (tryBranch["#PlaceholderBranch"]) {
@@ -1,4 +1,4 @@
1
- import { Ct as registeredValues, Kt as destroyBranch, Mn as PlaceholderBranch, Qt as PLACEHOLDER_DISMISS_REGISTER_ID } from "../dom-CIt3_Sdm.mjs";
1
+ import { Ct as registeredValues, Kt as destroyBranch, Nn as PlaceholderBranch, Qt as PLACEHOLDER_DISMISS_REGISTER_ID } from "../dom-DBMLPLeE.mjs";
2
2
  //#region src/dom/placeholder.feat.ts
3
3
  registeredValues[PLACEHOLDER_DISMISS_REGISTER_ID] = (tryBranch) => {
4
4
  if (tryBranch["#PlaceholderBranch"]) {
@@ -178,6 +178,11 @@ function withBranches(runtime) {
178
178
  branchesEnabled = 1;
179
179
  return runtime;
180
180
  }
181
+ let dynamicHtmlEnabled;
182
+ function withDynamicHtml(runtime) {
183
+ dynamicHtmlEnabled = 1;
184
+ return runtime;
185
+ }
181
186
  //#endregion
182
187
  //#region src/common/errors.ts
183
188
  const lowercaseEventHandlerReg = /^on[a-z]/;
@@ -944,7 +949,7 @@ function init(runtimeId = "M") {
944
949
  while (startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling));
945
950
  branch["_"] ??= visitScope;
946
951
  branch[EndNode] = branch[StartNode] = startVisit;
947
- if (visitType === "'") branch[getDebugKey(0, startVisit)] = startVisit;
952
+ if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
948
953
  } else {
949
954
  curBranchScopes = push(curBranchScopes, branch);
950
955
  if (accessor) {
@@ -1011,6 +1016,7 @@ function init(runtimeId = "M") {
1011
1016
  let lastToken;
1012
1017
  let lastTokenIndex;
1013
1018
  let visitBranches;
1019
+ let htmlStart;
1014
1020
  let embedAnchor;
1015
1021
  serializeContext._ = registeredValues;
1016
1022
  if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
@@ -1029,11 +1035,14 @@ function init(runtimeId = "M") {
1029
1035
  visitText = visit.data;
1030
1036
  visitType = visitText[lastTokenIndex++];
1031
1037
  visitScope = getScope(nextToken());
1032
- if (visitType === "*") {
1033
- const prev = visit.previousSibling;
1034
- visitScope[nextToken()] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
1035
- } else if (branchesEnabled) (visitBranches ||= createVisitBranches())();
1036
- else if (lazyEnabled && render.b) visits[retained++] = visit;
1038
+ if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") if (visitType === "&") htmlStart = visit;
1039
+ else {
1040
+ visitScope[nextToken()] = htmlStart;
1041
+ visitScope[DynamicHTMLLastChild + lastToken] = visit;
1042
+ }
1043
+ else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1044
+ else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
1045
+ else visitScope[nextToken()] = visitType === "$" ? visit.previousSibling : visit.parentNode.insertBefore(new Text(), visit);
1037
1046
  }
1038
1047
  if (embedRenders && !embedAnchor && visit) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]);
1039
1048
  visits.length = retained;
@@ -1283,14 +1292,14 @@ function _attrs_script(scope, nodeAccessor) {
1283
1292
  controllableScripts[scope[ControlledType + nodeAccessor]]?.(scope, nodeAccessor);
1284
1293
  for (const name in events) _on(el, name, events[name]);
1285
1294
  }
1286
- function _html(scope, value, accessor) {
1295
+ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accessor) {
1287
1296
  const firstChild = scope[accessor];
1288
1297
  const parentNode = firstChild.parentNode;
1289
1298
  const lastChild = scope["DynamicHTMLLastChild:" + accessor] || firstChild;
1290
1299
  const newContent = parseHTML(_to_text(value), parentNode.namespaceURI);
1291
1300
  insertChildNodes(parentNode, firstChild, scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), scope[DynamicHTMLLastChild + accessor] = newContent.lastChild);
1292
1301
  removeChildNodes(firstChild, lastChild);
1293
- }
1302
+ });
1294
1303
  function normalizeClientRender(value) {
1295
1304
  const renderer = normalizeDynamicRenderer(value);
1296
1305
  if (renderer) if (renderer["id"]) return renderer;
@@ -2864,6 +2873,12 @@ Object.defineProperty(exports, "queueEffect", {
2864
2873
  return queueEffect;
2865
2874
  }
2866
2875
  });
2876
+ Object.defineProperty(exports, "queueRender", {
2877
+ enumerable: true,
2878
+ get: function() {
2879
+ return queueRender;
2880
+ }
2881
+ });
2867
2882
  Object.defineProperty(exports, "ready", {
2868
2883
  enumerable: true,
2869
2884
  get: function() {
@@ -177,6 +177,11 @@ function withBranches(runtime) {
177
177
  branchesEnabled = 1;
178
178
  return runtime;
179
179
  }
180
+ let dynamicHtmlEnabled;
181
+ function withDynamicHtml(runtime) {
182
+ dynamicHtmlEnabled = 1;
183
+ return runtime;
184
+ }
180
185
  //#endregion
181
186
  //#region src/common/errors.ts
182
187
  const lowercaseEventHandlerReg = /^on[a-z]/;
@@ -943,7 +948,7 @@ function init(runtimeId = "M") {
943
948
  while (startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling));
944
949
  branch["_"] ??= visitScope;
945
950
  branch[EndNode] = branch[StartNode] = startVisit;
946
- if (visitType === "'") branch[getDebugKey(0, startVisit)] = startVisit;
951
+ if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
947
952
  } else {
948
953
  curBranchScopes = push(curBranchScopes, branch);
949
954
  if (accessor) {
@@ -1010,6 +1015,7 @@ function init(runtimeId = "M") {
1010
1015
  let lastToken;
1011
1016
  let lastTokenIndex;
1012
1017
  let visitBranches;
1018
+ let htmlStart;
1013
1019
  let embedAnchor;
1014
1020
  serializeContext._ = registeredValues;
1015
1021
  if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
@@ -1028,11 +1034,14 @@ function init(runtimeId = "M") {
1028
1034
  visitText = visit.data;
1029
1035
  visitType = visitText[lastTokenIndex++];
1030
1036
  visitScope = getScope(nextToken());
1031
- if (visitType === "*") {
1032
- const prev = visit.previousSibling;
1033
- visitScope[nextToken()] = prev && (prev.nodeType < 8 || prev.data) ? prev : visit.parentNode.insertBefore(new Text(), visit);
1034
- } else if (branchesEnabled) (visitBranches ||= createVisitBranches())();
1035
- else if (lazyEnabled && render.b) visits[retained++] = visit;
1037
+ if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") if (visitType === "&") htmlStart = visit;
1038
+ else {
1039
+ visitScope[nextToken()] = htmlStart;
1040
+ visitScope[DynamicHTMLLastChild + lastToken] = visit;
1041
+ }
1042
+ else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1043
+ else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
1044
+ else visitScope[nextToken()] = visitType === "$" ? visit.previousSibling : visit.parentNode.insertBefore(new Text(), visit);
1036
1045
  }
1037
1046
  if (embedRenders && !embedAnchor && visit) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit.nextSibling), [renderId, scopeLookup]);
1038
1047
  visits.length = retained;
@@ -1282,14 +1291,14 @@ function _attrs_script(scope, nodeAccessor) {
1282
1291
  controllableScripts[scope[ControlledType + nodeAccessor]]?.(scope, nodeAccessor);
1283
1292
  for (const name in events) _on(el, name, events[name]);
1284
1293
  }
1285
- function _html(scope, value, accessor) {
1294
+ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accessor) {
1286
1295
  const firstChild = scope[accessor];
1287
1296
  const parentNode = firstChild.parentNode;
1288
1297
  const lastChild = scope["DynamicHTMLLastChild:" + accessor] || firstChild;
1289
1298
  const newContent = parseHTML(_to_text(value), parentNode.namespaceURI);
1290
1299
  insertChildNodes(parentNode, firstChild, scope[accessor] = newContent.firstChild || newContent.appendChild(new Text()), scope[DynamicHTMLLastChild + accessor] = newContent.lastChild);
1291
1300
  removeChildNodes(firstChild, lastChild);
1292
- }
1301
+ });
1293
1302
  function normalizeClientRender(value) {
1294
1303
  const renderer = normalizeDynamicRenderer(value);
1295
1304
  if (renderer) if (renderer["id"]) return renderer;
@@ -2083,4 +2092,4 @@ function byFirstArg(name) {
2083
2092
  return name;
2084
2093
  }
2085
2094
  //#endregion
2086
- export { _attrs_script as $, $signal as $t, _attr_input_value_script as A, PendingEffects as An, _for_closure as At, _attr as B, _return as Bt, _attr_input_checkedValue_script as C, AwaitCounter as Cn, registeredValues as Ct, _attr_input_value_attribute_default as D, Global as Dn, _closure_get as Dt, _attr_input_value as E, Gen$1 as En, _closure as Et, _controllable_open as F, _id as Ft, _attr_nonce as G, _assert_init as Gt, _attr_class_item as H, _script as Ht, _controllable_select as I, _if_closure as It, _attr_style_items as J, removeAndDestroyBranch as Jt, _attr_style as K, destroyBranch as Kt, _controllable_textarea as L, _let as Lt, _attr_select_value_default as M, PlaceholderBranch as Mn, _global_read as Mt, _attr_select_value_script as N, StartNode as Nn, _hoist as Nt, _attr_input_value_default as O, Load as On, _const as Ot, _controllable_input as P, TagVariable as Pn, _hoist_resume as Pt, _attrs_partial_content as Q, PLACEHOLDER_DISMISS_REGISTER_ID as Qt, controllableRenders as R, _let_change as Rt, _attr_input_checkedValue_default as S, Scope as Sn, readyFailed as St, _attr_input_checked_script as T, EndNode as Tn, _child_setup as Tt, _attr_class_items as U, _var as Ut, _attr_class as V, _return_change as Vt, _attr_content as W, _var_change as Wt, _attrs_content as X, _on as Xt, _attrs as Y, syncGen as Yt, _attrs_partial as Z, DYNAMIC_TAG_VAR_REGISTER_ID as Zt, _attr_details_or_dialog_open as _, Clone as _n, _var_resume as _t, _for_in as a, queueAsyncRender as an, _text_content as at, _attr_input_checked as b, Setup as bn, initEmbedded as bt, _for_until as c, runEffects as cn, toInsertNode as ct, _show as d, forOf as dn, _content_resume as dt, $signalReset as en, _html as et, _try as f, forTo as fn, createAndSetupBranch as ft, renderCatch as g, _call as gn, _resume as gt, patchDynamicTag as h, _hoist_read_error as hn, _el as ht, _dynamic_tag_content as i, prepareEffects as in, _text as it, _attr_select_value as j, PendingRenders as jn, _for_selector as jt, _attr_input_value_dynamic_default as k, ParentBranch as kn, _el_read as kt, _if as l, runId as ln, _content as lt, installDynamicTagVar as m, _assert_hoist as mn, setupBranch as mt, _await_promise as n, installCatch as nn, _style_rule_item as nt, _for_of as o, queueEffect as on, _to_text as ot, addAwaitCounter as p, forUntil as pn, createBranch as pt, _attr_style_item as q, insertBranchBefore as qt, _dynamic_tag as r, placeholderShown as rn, _style_shell as rt, _for_to as s, run as sn, insertChildNodes as st, _await_content as t, caughtError as tn, _lifecycle as tt, _resume_dynamic_tag as u, forIn as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, Owner as vn, getRegisteredWithScope as vt, _attr_input_checked_default as w, ClosestBranch as wn, withLazy as wt, _attr_input_checkedValue as x, Pending as xn, ready as xt, _attr_details_or_dialog_open_script as y, Params as yn, init as yt, controllableScripts as z, _or as zt };
2095
+ export { _attrs_script as $, $signal as $t, _attr_input_value_script as A, ParentBranch as An, _for_closure as At, _attr as B, _return as Bt, _attr_input_checkedValue_script as C, Scope as Cn, registeredValues as Ct, _attr_input_value_attribute_default as D, Gen$1 as Dn, _closure_get as Dt, _attr_input_value as E, EndNode as En, _closure as Et, _controllable_open as F, TagVariable as Fn, _id as Ft, _attr_nonce as G, _assert_init as Gt, _attr_class_item as H, _script as Ht, _controllable_select as I, _if_closure as It, _attr_style_items as J, removeAndDestroyBranch as Jt, _attr_style as K, destroyBranch as Kt, _controllable_textarea as L, _let as Lt, _attr_select_value_default as M, PendingRenders as Mn, _global_read as Mt, _attr_select_value_script as N, PlaceholderBranch as Nn, _hoist as Nt, _attr_input_value_default as O, Global as On, _const as Ot, _controllable_input as P, StartNode as Pn, _hoist_resume as Pt, _attrs_partial_content as Q, PLACEHOLDER_DISMISS_REGISTER_ID as Qt, controllableRenders as R, _let_change as Rt, _attr_input_checkedValue_default as S, Pending as Sn, readyFailed as St, _attr_input_checked_script as T, ClosestBranch as Tn, _child_setup as Tt, _attr_class_items as U, _var as Ut, _attr_class as V, _return_change as Vt, _attr_content as W, _var_change as Wt, _attrs_content as X, _on as Xt, _attrs as Y, syncGen as Yt, _attrs_partial as Z, DYNAMIC_TAG_VAR_REGISTER_ID as Zt, _attr_details_or_dialog_open as _, _call as _n, _var_resume as _t, _for_in as a, queueAsyncRender as an, _text_content as at, _attr_input_checked as b, Params as bn, initEmbedded as bt, _for_until as c, run as cn, toInsertNode as ct, _show as d, forIn as dn, _content_resume as dt, $signalReset as en, _html as et, _try as f, forOf as fn, createAndSetupBranch as ft, renderCatch as g, _hoist_read_error as gn, _resume as gt, patchDynamicTag as h, _assert_hoist as hn, _el as ht, _dynamic_tag_content as i, prepareEffects as in, _text as it, _attr_select_value as j, PendingEffects as jn, _for_selector as jt, _attr_input_value_dynamic_default as k, Load as kn, _el_read as kt, _if as l, runEffects as ln, _content as lt, installDynamicTagVar as m, forUntil as mn, setupBranch as mt, _await_promise as n, installCatch as nn, _style_rule_item as nt, _for_of as o, queueEffect as on, _to_text as ot, addAwaitCounter as p, forTo as pn, createBranch as pt, _attr_style_item as q, insertBranchBefore as qt, _dynamic_tag as r, placeholderShown as rn, _style_shell as rt, _for_to as s, queueRender as sn, insertChildNodes as st, _await_content as t, caughtError as tn, _lifecycle as tt, _resume_dynamic_tag as u, runId as un, _content_closures as ut, _attr_details_or_dialog_open_default as v, Clone as vn, getRegisteredWithScope as vt, _attr_input_checked_default as w, AwaitCounter as wn, withLazy as wt, _attr_input_checkedValue as x, Setup as xn, ready as xt, _attr_details_or_dialog_open_script as y, Owner as yn, init as yt, controllableScripts as z, _or as zt };
package/dist/debug/dom.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_control_flow = require("./dom-WyMgkHne.js");
3
+ const require_control_flow = require("./dom-CA_HiiES.js");
4
4
  //#region src/common/attr-tag.ts
5
5
  const empty = [];
6
6
  const rest = Symbol("Attribute Tag");
@@ -22,10 +22,6 @@ function* attrTagIterator() {
22
22
  yield* this[rest];
23
23
  }
24
24
  //#endregion
25
- //#region src/common/constants/load-signal-value.debug.ts
26
- const Value = "value";
27
- const Signal = "signal";
28
- //#endregion
29
25
  //#region src/common/compat-meta.ts
30
26
  const SET_SCOPE_REGISTER_ID = "$compat_setScope";
31
27
  const RENDER_BODY_ID = "$compat_renderBody";
@@ -213,9 +209,10 @@ const _load_template = /*@__PURE__*/ require_control_flow.withLazy((id, load) =>
213
209
  const _load_setup = /*@__PURE__*/ require_control_flow.withLazy((nodeAccessor, childScopeAccessor, load) => {
214
210
  let pending;
215
211
  let renderer;
212
+ const insertCached = (child, marker) => insertLoaded(renderer, child, marker);
216
213
  return (owner) => {
217
214
  const child = owner[childScopeAccessor];
218
- if (renderer) insertLoaded(renderer, child, owner[nodeAccessor]);
215
+ if (renderer) require_control_flow.queueRender(child, insertCached, -1, owner[nodeAccessor]);
219
216
  else {
220
217
  const awaitCounter = require_control_flow.addAwaitCounter(owner);
221
218
  child[require_control_flow.Load] ||= /* @__PURE__ */ new Map();
@@ -227,27 +224,26 @@ const _load_setup = /*@__PURE__*/ require_control_flow.withLazy((nodeAccessor, c
227
224
  };
228
225
  });
229
226
  function insertLoaded(renderer, branch, marker, awaitCounter) {
230
- const parent = marker.parentNode, values = branch[require_control_flow.Load], insert = () => {
227
+ const parent = marker.parentNode, values = branch[require_control_flow.Load], clone = () => {
228
+ require_control_flow.syncGen(branch);
229
+ renderer[require_control_flow.Clone](branch, parent.namespaceURI);
230
+ branch[require_control_flow.Load] = 0;
231
+ }, insert = () => {
231
232
  require_control_flow.insertBranchBefore(branch, parent, marker);
232
233
  marker.remove();
233
234
  awaitCounter?.c();
234
235
  };
235
236
  let remaining;
236
- require_control_flow.syncGen(branch);
237
- renderer[require_control_flow.Clone](branch, parent.namespaceURI);
238
- branch[require_control_flow.Load] = 0;
239
237
  if (remaining = values?.size) {
240
238
  const fail = loadFailed(branch, awaitCounter);
241
- for (const [promise, entry] of values) promise.then((signal) => {
242
- entry[Signal] = signal;
243
- if (!--remaining) require_control_flow.queueAsyncRender(branch, (branch) => {
244
- require_control_flow.syncGen(branch);
245
- renderer[require_control_flow.Setup]?.(branch);
246
- values.forEach((e) => e[Signal]._(branch, e[Value]));
247
- insert();
248
- });
249
- }, (error) => remaining > 0 && (remaining = 0, fail(error)));
239
+ values.forEach(([, apply], promise) => promise.then((mod) => (apply._ = mod._) && !--remaining && require_control_flow.queueAsyncRender(branch, (branch) => {
240
+ clone();
241
+ renderer["setup"]?.(branch);
242
+ values.forEach(([value, apply]) => apply(branch, value));
243
+ insert();
244
+ }), (error) => remaining > 0 && (remaining = 0, fail(error))));
250
245
  } else {
246
+ clone();
251
247
  require_control_flow.setupBranch(renderer, branch);
252
248
  insert();
253
249
  }
@@ -261,13 +257,13 @@ function loadFailed(scope, awaitCounter) {
261
257
  }
262
258
  const _load_signal = /*@__PURE__*/ require_control_flow.withLazy((load) => {
263
259
  let pending;
264
- let signal;
265
- return (scope, value) => {
260
+ const apply = (scope, value) => {
266
261
  pending ||= load();
267
- if (scope["#Load"] || !("#Load" in scope) && scope["#Gen"] === require_control_flow.runId) (scope[require_control_flow.Load] ||= /* @__PURE__ */ new Map()).set(pending, { [Value]: value });
268
- else if (signal) signal(scope, value);
269
- else pending.then((mod) => require_control_flow.queueAsyncRender(scope, signal = mod._, value), () => 0);
262
+ if (scope["#Load"] || !("#Load" in scope) && scope["#Gen"] === require_control_flow.runId) (scope[require_control_flow.Load] ||= /* @__PURE__ */ new Map()).set(pending, [value, apply]);
263
+ else if (apply._) apply._(scope, value);
264
+ else pending.then((mod) => require_control_flow.queueAsyncRender(scope, apply._ = mod._, value), () => 0);
270
265
  };
266
+ return apply;
271
267
  });
272
268
  function _load_visible_trigger(selector, options) {
273
269
  let pending;