@adaas/are-html 0.0.21 → 0.0.23

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 (154) hide show
  1. package/.conf/tsconfig.base.json +1 -0
  2. package/.conf/tsconfig.browser.json +1 -0
  3. package/.conf/tsconfig.node.json +1 -0
  4. package/dist/browser/index.d.mts +214 -3
  5. package/dist/browser/index.mjs +787 -201
  6. package/dist/browser/index.mjs.map +1 -1
  7. package/dist/node/{AreBinding.attribute-doUvtOjc.d.mts → AreBinding.attribute-BWzEIw6H.d.mts} +45 -0
  8. package/dist/node/{AreBinding.attribute-Bm5LlOyE.d.ts → AreBinding.attribute-GpT-5Qmf.d.ts} +45 -0
  9. package/dist/node/attributes/AreBinding.attribute.d.mts +1 -1
  10. package/dist/node/attributes/AreBinding.attribute.d.ts +1 -1
  11. package/dist/node/attributes/AreDirective.attribute.d.mts +1 -1
  12. package/dist/node/attributes/AreDirective.attribute.d.ts +1 -1
  13. package/dist/node/attributes/AreEvent.attribute.d.mts +1 -1
  14. package/dist/node/attributes/AreEvent.attribute.d.ts +1 -1
  15. package/dist/node/attributes/AreStatic.attribute.d.mts +1 -1
  16. package/dist/node/attributes/AreStatic.attribute.d.ts +1 -1
  17. package/dist/node/directives/AreDirectiveFor.directive.d.mts +55 -2
  18. package/dist/node/directives/AreDirectiveFor.directive.d.ts +55 -2
  19. package/dist/node/directives/AreDirectiveFor.directive.js +141 -12
  20. package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -1
  21. package/dist/node/directives/AreDirectiveFor.directive.mjs +141 -12
  22. package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -1
  23. package/dist/node/directives/AreDirectiveIf.directive.d.mts +1 -1
  24. package/dist/node/directives/AreDirectiveIf.directive.d.ts +1 -1
  25. package/dist/node/directives/AreDirectiveShow.directive.d.mts +1 -1
  26. package/dist/node/directives/AreDirectiveShow.directive.d.ts +1 -1
  27. package/dist/node/engine/AreHTML.compiler.d.mts +1 -1
  28. package/dist/node/engine/AreHTML.compiler.d.ts +1 -1
  29. package/dist/node/engine/AreHTML.compiler.js +4 -0
  30. package/dist/node/engine/AreHTML.compiler.js.map +1 -1
  31. package/dist/node/engine/AreHTML.compiler.mjs +4 -0
  32. package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
  33. package/dist/node/engine/AreHTML.constants.d.mts +33 -1
  34. package/dist/node/engine/AreHTML.constants.d.ts +33 -1
  35. package/dist/node/engine/AreHTML.constants.js +166 -0
  36. package/dist/node/engine/AreHTML.constants.js.map +1 -1
  37. package/dist/node/engine/AreHTML.constants.mjs +165 -1
  38. package/dist/node/engine/AreHTML.constants.mjs.map +1 -1
  39. package/dist/node/engine/AreHTML.context.d.mts +66 -0
  40. package/dist/node/engine/AreHTML.context.d.ts +66 -0
  41. package/dist/node/engine/AreHTML.context.js +98 -0
  42. package/dist/node/engine/AreHTML.context.js.map +1 -1
  43. package/dist/node/engine/AreHTML.context.mjs +98 -0
  44. package/dist/node/engine/AreHTML.context.mjs.map +1 -1
  45. package/dist/node/engine/AreHTML.interpreter.d.mts +3 -0
  46. package/dist/node/engine/AreHTML.interpreter.d.ts +3 -0
  47. package/dist/node/engine/AreHTML.interpreter.js +66 -10
  48. package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
  49. package/dist/node/engine/AreHTML.interpreter.mjs +66 -10
  50. package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
  51. package/dist/node/engine/AreHTML.lifecycle.d.mts +2 -2
  52. package/dist/node/engine/AreHTML.lifecycle.d.ts +2 -2
  53. package/dist/node/engine/AreHTML.lifecycle.js +32 -4
  54. package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
  55. package/dist/node/engine/AreHTML.lifecycle.mjs +32 -4
  56. package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
  57. package/dist/node/engine/AreHTML.tokenizer.d.mts +1 -1
  58. package/dist/node/engine/AreHTML.tokenizer.d.ts +1 -1
  59. package/dist/node/engine/AreHTML.tokenizer.js +7 -1
  60. package/dist/node/engine/AreHTML.tokenizer.js.map +1 -1
  61. package/dist/node/engine/AreHTML.tokenizer.mjs +7 -1
  62. package/dist/node/engine/AreHTML.tokenizer.mjs.map +1 -1
  63. package/dist/node/engine/AreHTML.transformer.d.mts +1 -1
  64. package/dist/node/engine/AreHTML.transformer.d.ts +1 -1
  65. package/dist/node/helpers/AreScheduler.helper.d.mts +39 -0
  66. package/dist/node/helpers/AreScheduler.helper.d.ts +39 -0
  67. package/dist/node/helpers/AreScheduler.helper.js +40 -0
  68. package/dist/node/helpers/AreScheduler.helper.js.map +1 -0
  69. package/dist/node/helpers/AreScheduler.helper.mjs +40 -0
  70. package/dist/node/helpers/AreScheduler.helper.mjs.map +1 -0
  71. package/dist/node/index.d.mts +4 -3
  72. package/dist/node/index.d.ts +4 -3
  73. package/dist/node/index.js +7 -0
  74. package/dist/node/index.mjs +1 -0
  75. package/dist/node/instructions/AddStaticHTML.instruction.d.mts +8 -0
  76. package/dist/node/instructions/AddStaticHTML.instruction.d.ts +8 -0
  77. package/dist/node/instructions/AddStaticHTML.instruction.js +31 -0
  78. package/dist/node/instructions/AddStaticHTML.instruction.js.map +1 -0
  79. package/dist/node/instructions/AddStaticHTML.instruction.mjs +24 -0
  80. package/dist/node/instructions/AddStaticHTML.instruction.mjs.map +1 -0
  81. package/dist/node/instructions/AreHTML.instructions.constants.d.mts +1 -0
  82. package/dist/node/instructions/AreHTML.instructions.constants.d.ts +1 -0
  83. package/dist/node/instructions/AreHTML.instructions.constants.js +1 -0
  84. package/dist/node/instructions/AreHTML.instructions.constants.js.map +1 -1
  85. package/dist/node/instructions/AreHTML.instructions.constants.mjs +1 -0
  86. package/dist/node/instructions/AreHTML.instructions.constants.mjs.map +1 -1
  87. package/dist/node/instructions/AreHTML.instructions.types.d.mts +9 -1
  88. package/dist/node/instructions/AreHTML.instructions.types.d.ts +9 -1
  89. package/dist/node/lib/AreDirective/AreDirective.component.d.mts +1 -1
  90. package/dist/node/lib/AreDirective/AreDirective.component.d.ts +1 -1
  91. package/dist/node/lib/AreDirective/AreDirective.types.d.mts +1 -1
  92. package/dist/node/lib/AreDirective/AreDirective.types.d.ts +1 -1
  93. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +1 -1
  94. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +1 -1
  95. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +1 -1
  96. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +1 -1
  97. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +1 -1
  98. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +1 -1
  99. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +51 -0
  100. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -1
  101. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +51 -0
  102. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -1
  103. package/dist/node/lib/AreRoot/AreRoot.component.js +1 -1
  104. package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
  105. package/dist/node/lib/AreRoot/AreRoot.component.mjs +1 -1
  106. package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
  107. package/dist/node/nodes/AreComment.d.mts +1 -1
  108. package/dist/node/nodes/AreComment.d.ts +1 -1
  109. package/dist/node/nodes/AreComponent.d.mts +1 -1
  110. package/dist/node/nodes/AreComponent.d.ts +1 -1
  111. package/dist/node/nodes/AreInterpolation.d.mts +1 -1
  112. package/dist/node/nodes/AreInterpolation.d.ts +1 -1
  113. package/dist/node/nodes/AreRoot.d.mts +1 -1
  114. package/dist/node/nodes/AreRoot.d.ts +1 -1
  115. package/dist/node/nodes/AreText.d.mts +1 -1
  116. package/dist/node/nodes/AreText.d.ts +1 -1
  117. package/examples/dashboard/concept.ts +1 -1
  118. package/examples/dashboard/dist/index.html +1 -1
  119. package/examples/dashboard/dist/{mq19zxz4-mnlgmd.js → mqiw5sqa-ypckmj.js} +2275 -1323
  120. package/examples/dashboard/src/concept.ts +3 -2
  121. package/examples/for-perf/concept.ts +45 -0
  122. package/examples/for-perf/containers/UI.container.ts +161 -0
  123. package/examples/for-perf/dist/index.html +270 -0
  124. package/examples/for-perf/dist/mqj1mpf2-z4aokv.js +15664 -0
  125. package/examples/for-perf/dist/mqj1mpff-4fr7mw.js +15664 -0
  126. package/examples/for-perf/public/index.html +270 -0
  127. package/examples/for-perf/src/components/PerfApp.component.ts +37 -0
  128. package/examples/for-perf/src/components/PerfControls.component.ts +34 -0
  129. package/examples/for-perf/src/components/PerfGrid.component.ts +225 -0
  130. package/examples/for-perf/src/components/PerfHeader.component.ts +34 -0
  131. package/examples/for-perf/src/components/PerfStats.component.ts +43 -0
  132. package/examples/for-perf/src/concept.ts +94 -0
  133. package/examples/jumpstart/dist/index.html +1 -1
  134. package/examples/jumpstart/dist/{mq7hqrxy-4kus50.js → mq7mgf58-vbf07e.js} +269 -91
  135. package/examples/signal-routing/dist/index.html +1 -1
  136. package/examples/signal-routing/dist/{mq7k53th-qiwy4x.js → mqiwo23h-bhcolu.js} +2090 -1430
  137. package/jest.config.ts +1 -0
  138. package/package.json +10 -9
  139. package/src/directives/AreDirectiveFor.directive.ts +233 -19
  140. package/src/engine/AreHTML.compiler.ts +13 -0
  141. package/src/engine/AreHTML.constants.ts +142 -0
  142. package/src/engine/AreHTML.context.ts +112 -0
  143. package/src/engine/AreHTML.interpreter.ts +114 -13
  144. package/src/engine/AreHTML.lifecycle.ts +91 -7
  145. package/src/engine/AreHTML.tokenizer.ts +30 -1
  146. package/src/helpers/AreScheduler.helper.ts +61 -0
  147. package/src/index.ts +1 -0
  148. package/src/instructions/AddStaticHTML.instruction.ts +23 -0
  149. package/src/instructions/AreHTML.instructions.constants.ts +1 -0
  150. package/src/instructions/AreHTML.instructions.types.ts +9 -0
  151. package/src/lib/AreHTMLNode/AreHTMLNode.ts +74 -0
  152. package/src/lib/AreRoot/AreRoot.component.ts +4 -1
  153. package/tests/StaticIsland.test.ts +115 -0
  154. package/tsconfig.json +1 -0
@@ -69,6 +69,7 @@
69
69
  "@adaas/are-html/root/*": ["../src/lib/AreRoot/*"],
70
70
  "@adaas/are-html/directives/*": ["../src/directives/*"],
71
71
  "@adaas/are-html/style/*": ["../src/lib/AreStyle/*"],
72
+ "@adaas/are-html/helpers/*": ["../src/helpers/*"],
72
73
  "@adaas/are-html/lib/*": ["../src/lib/*"],
73
74
  },
74
75
  /* ===============================
@@ -13,6 +13,7 @@
13
13
  "@adaas/are-html/instructions/*": ["src/instructions/*"],
14
14
  "@adaas/are-html/watchers/*": ["src/watchers/*"],
15
15
  "@adaas/are-html/signals/*": ["src/signals/*"],
16
+ "@adaas/are-html/helpers/*": ["src/helpers/*"],
16
17
  // Custom Lib Exports
17
18
  "@adaas/are-html/style/*": ["src/lib/AreStyle/*"],
18
19
  "@adaas/are-html/directive/*": ["src/lib/AreDirective/*"],
@@ -13,6 +13,7 @@
13
13
  "@adaas/are-html/instructions/*": ["src/instructions/*"],
14
14
  "@adaas/are-html/watchers/*": ["src/watchers/*"],
15
15
  "@adaas/are-html/signals/*": ["src/signals/*"],
16
+ "@adaas/are-html/helpers/*": ["src/helpers/*"],
16
17
  // Custom Lib Exports
17
18
  "@adaas/are-html/style/*": ["src/lib/AreStyle/*"],
18
19
  "@adaas/are-html/directive/*": ["src/lib/AreDirective/*"],
@@ -73,11 +73,56 @@ declare class AreStyle extends A_Fragment {
73
73
  }
74
74
 
75
75
  declare class AreHTMLNode extends AreNode {
76
+ /**
77
+ * When set, this node is a *static island* root: its entire inner subtree
78
+ * was detected (at tokenize time) to contain no ARE-reactive constructs —
79
+ * no interpolations, no dynamic attributes and only standard HTML tags.
80
+ *
81
+ * Instead of being exploded into one child AreNode per element/text node,
82
+ * the inner markup is preserved verbatim here and materialised in a single
83
+ * pass by the interpreter (browser-parsed `innerHTML` / cached `<template>`
84
+ * clone). The node's OWN attributes (including any dynamic `:`/`@`/`$` on
85
+ * the island root) still compile and stay reactive as usual.
86
+ */
87
+ protected _staticInnerHTML?: string;
76
88
  /**
77
89
  * Actual node type.
78
90
  * By default it's a tag name
79
91
  */
80
92
  get tag(): string;
93
+ /**
94
+ * The verbatim inner markup captured when this node was identified as a
95
+ * static island, or `undefined` for ordinary (per-node) nodes.
96
+ */
97
+ get staticInnerHTML(): string | undefined;
98
+ /**
99
+ * Whether this node is a static-island root (see `_staticInnerHTML`).
100
+ */
101
+ get isStaticIsland(): boolean;
102
+ /**
103
+ * Marks this node as a static-island root, capturing the verbatim inner
104
+ * markup to be materialised in one shot by the interpreter. Called by the
105
+ * tokenizer when the node's inner content is detected to be fully static.
106
+ */
107
+ markStatic(innerHTML: string): void;
108
+ /**
109
+ * Deep-clone the node. Overridden to carry over the static-island marker
110
+ * (`_staticInnerHTML`), which lives on AreHTMLNode and is therefore NOT
111
+ * copied by the base AreNode.clone(). Without this, cloning a directive
112
+ * template ($if/$for) that wraps a static island (e.g. `<span $if>★</span>`)
113
+ * would drop the captured inner markup and render an empty element. The
114
+ * base clone() recurses via each child's polymorphic clone(), so nested
115
+ * island children are preserved automatically through this override.
116
+ */
117
+ clone<T extends AreNode = AreNode>(this: T): T;
118
+ /**
119
+ * Clone the node while transferring its existing scope to the clone (used by
120
+ * the $if/$for directives to turn the original node into a lightweight group
121
+ * container). Overridden for the same reason as `clone()`: the static-island
122
+ * marker must survive so a directive applied to an island root keeps its
123
+ * inner markup.
124
+ */
125
+ cloneWithScope<T extends AreNode = AreNode>(this: T): T;
81
126
  /**
82
127
  * The static attributes defined for the node, which are typically used to represent static properties or characteristics of the node that do not change based on the context or state. These attributes are usually defined in the template and are not reactive.
83
128
  *
@@ -123,9 +168,56 @@ declare class AreBindingAttribute extends AreHTMLAttribute {
123
168
  }
124
169
 
125
170
  declare class AreDirectiveFor extends AreDirective {
171
+ /**
172
+ * Lists whose number of NEW item nodes is at or below this threshold render
173
+ * fully synchronously — byte-for-byte the previous behavior. Typical UIs
174
+ * (menus, small tables) are therefore completely unaffected; only genuinely
175
+ * large lists pay the (tiny) scheduling cost to keep the main thread responsive.
176
+ */
177
+ private static readonly SYNC_THRESHOLD;
178
+ /**
179
+ * Per-chunk time budget (ms). During a large-list render we mount item nodes
180
+ * until this much time has elapsed, then yield to the browser so it can paint
181
+ * and process input before the next chunk. ~16ms targets one animation frame.
182
+ */
183
+ private static readonly CHUNK_BUDGET_MS;
184
+ /**
185
+ * Per-attribute serialization state. A new update() that arrives while a
186
+ * chunked render of the SAME `$for` is still in flight does NOT start a second
187
+ * concurrent pass (which could interleave mutations on the shared children
188
+ * list); instead it marks `pending` and the in-flight run re-runs once more
189
+ * with the latest data when it finishes. This guarantees the children list is
190
+ * only ever mutated by one pass at a time and the final state always reflects
191
+ * the most recent store value.
192
+ */
193
+ private static readonly renderState;
126
194
  transform(attribute: AreDirectiveAttribute, scope: A_Scope, store: AreStore, scene: AreScene, logger: A_Logger, ...args: any[]): void;
127
195
  compile(attribute: AreDirectiveAttribute, store: AreStore, scene: AreScene, ...args: any[]): void;
128
- update(attribute: AreDirectiveAttribute, store: AreStore, scene: AreScene, ...args: any[]): void;
196
+ update(attribute: AreDirectiveAttribute, store: AreStore, scene: AreScene, ...args: any[]): void | Promise<void>;
197
+ /**
198
+ * Core of the `$for` update: re-diff the source array against the current
199
+ * children, reconcile reused/removed items, then mount the new ones (small
200
+ * lists synchronously, large lists time-sliced). Never called while another
201
+ * pass for the same `$for` is in flight (see `update`).
202
+ */
203
+ private performUpdate;
204
+ /**
205
+ * Repositions the item nodes' DOM elements so the rendered order matches the
206
+ * source array order. The keyed diff (steps 1–4) reuses existing nodes in
207
+ * place and mounts new ones at the end; without this pass a `prepend` or
208
+ * `shuffle` would leave reused rows where they were and pile new rows at the
209
+ * bottom. We walk the desired order RIGHT-TO-LEFT, keeping a `ref` pointer to
210
+ * the element each item must precede (starting at the `$for` anchor comment),
211
+ * and only call `insertBefore` when an element is not already in position —
212
+ * so a plain `append` (already-correct order) performs ZERO DOM moves.
213
+ */
214
+ private reconcileOrder;
215
+ /**
216
+ * Completes an update pass. If another update() arrived while a chunked
217
+ * render was streaming, run exactly one more pass now from the latest store
218
+ * value so the final DOM always reflects the most recent data.
219
+ */
220
+ private finishUpdate;
129
221
  /**
130
222
  * Walks the node's ancestor chain (inclusive) and reports whether the
131
223
  * whole path is currently active — i.e. the subtree is actually rendered
@@ -157,6 +249,12 @@ declare class AreDirectiveFor extends AreDirective {
157
249
  * Supports both plain key lookups and function-call expressions:
158
250
  * items → store.get('items')
159
251
  * filter(items) → store.get('filter')(store.get('items'))
252
+ *
253
+ * `contextScope` carries item-scoped variables introduced by an enclosing
254
+ * directive (e.g. the `row` of an outer `$for`). It is consulted BEFORE the
255
+ * store so a nested `$for="cell in row.cells"` resolves `row` from the
256
+ * parent iteration instead of looking for a (non-existent) top-level store
257
+ * key. Leading identifiers not present in the context fall back to the store.
160
258
  */
161
259
  private resolveArray;
162
260
  /**
@@ -253,6 +351,14 @@ type AreHtmlAddStyleInstructionPayload = {
253
351
  /** Full CSS string to inject as a <style> block scoped to the component. Applied to the document head and reverted on unmount. */
254
352
  styles: string;
255
353
  };
354
+ type AreHtmlAddStaticHTMLInstructionPayload = {
355
+ /**
356
+ * Verbatim inner markup of a static island, materialised on the parent
357
+ * element in a single pass (browser-parsed `innerHTML` / cached `<template>`
358
+ * clone). Decodes HTML entities (e.g. `&nbsp;`) for free via the parser.
359
+ */
360
+ html: string;
361
+ };
256
362
  type AreHtmlHideInstructionPayload = {
257
363
  /**
258
364
  * Optional explicit display value to restore when the element becomes
@@ -291,6 +397,10 @@ declare class AddListenerInstruction extends AreMutation<AreHtmlAddListenerInstr
291
397
  constructor(parent: AreDeclaration, props: AreHtmlAddListenerInstructionPayload | AreInstructionSerialized<AreHtmlAddListenerInstructionPayload>);
292
398
  }
293
399
 
400
+ declare class AddStaticHTMLInstruction extends AreMutation<AreHtmlAddStaticHTMLInstructionPayload> {
401
+ constructor(parent: AreDeclaration, props: AreHtmlAddStaticHTMLInstructionPayload | AreInstructionSerialized<AreHtmlAddStaticHTMLInstructionPayload>);
402
+ }
403
+
294
404
  declare class AddStyleInstruction extends AreMutation<AreHtmlAddStyleInstructionPayload> {
295
405
  constructor(parent: AreDeclaration, props: AreHtmlAddStyleInstructionPayload | AreInstructionSerialized<AreHtmlAddStyleInstructionPayload>);
296
406
  }
@@ -316,6 +426,7 @@ declare const AreHTMLInstructions: {
316
426
  readonly AddListener: "_AreHTML_AddListener";
317
427
  readonly AddInterpolation: "_AreHTML_AddInterpolation";
318
428
  readonly AddComment: "_AreHTML_AddComment";
429
+ readonly AddStaticHTML: "_AreHTML_AddStaticHTML";
319
430
  readonly HideElement: "_AreHTML_HideElement";
320
431
  };
321
432
 
@@ -432,6 +543,38 @@ declare const LISTENER_OPTION_MODIFIERS: Set<string>;
432
543
  * Avoids "undefined"/"null"/"[object Object]" leaks into the DOM.
433
544
  */
434
545
  declare function toDOMString(value: any): string;
546
+ /**
547
+ * Standard HTML element names that are safe to materialise wholesale via
548
+ * `innerHTML` / a cached `<template>` clone.
549
+ *
550
+ * The set is intentionally an allow-list of plain HTML flow/phrasing/table/list
551
+ * /form-display tags. Anything NOT in this set — custom elements, registered
552
+ * ARE components (resolved by PascalCase tag), and SVG/MathML elements — is
553
+ * excluded so those subtrees keep flowing through the normal per-node pipeline
554
+ * (SVG needs createElementNS; components need their own lifecycle).
555
+ */
556
+ declare const STANDARD_HTML_TAGS: Set<string>;
557
+ /**
558
+ * Detects whether an inner-markup string is a fully *static island* — i.e. it
559
+ * contains no ARE-reactive constructs and therefore can be rendered in one shot
560
+ * (browser-parsed `innerHTML` / cached `<template>` clone) instead of being
561
+ * exploded into one AreNode per element/text/interpolation.
562
+ *
563
+ * A subtree is static iff it contains:
564
+ * 1. no `{{ }}` interpolations, and
565
+ * 2. no dynamic attributes (`$`-directive / `:`-binding / `@`-event), and
566
+ * 3. only standard HTML tags (no custom elements, ARE components or SVG).
567
+ *
568
+ * The scanner is quote-aware so a `:` / `@` / `$` inside an attribute *value*
569
+ * (e.g. `href="http://…"`, `style="color:red"`) is never mistaken for a
570
+ * dynamic-attribute prefix. The detector is deliberately conservative: any
571
+ * ambiguity resolves to `false` (skip the optimisation, keep the safe path).
572
+ *
573
+ * NOTE: pure-text content (no tags at all) is also considered static — this is
574
+ * what lets `&nbsp;`, `&amp;`, `&#160;` and friends decode correctly, since the
575
+ * browser HTML parser handles entities that hand-built text nodes do not.
576
+ */
577
+ declare function isStaticMarkup(inner: string): boolean;
435
578
 
436
579
  type AreHTMLContextConstructor = {
437
580
  container: Document;
@@ -481,8 +624,74 @@ declare class AreHTMLEngineContext extends AreContext {
481
624
  * The root container for the HTML engine, which can be either a Document or a ShadowRoot. This is where the engine will mount the generated DOM elements. The context uses this container to manage the relationship between AreNodes, instructions, and their corresponding DOM elements, allowing for efficient updates and cleanups as the application state changes.
482
625
  */
483
626
  protected _container: Document;
627
+ /**
628
+ * Parsed-fragment cache for static islands (see AddStaticHTMLInstruction).
629
+ *
630
+ * Keyed by `hostTag\u0000markup`, each entry holds a `DocumentFragment` whose
631
+ * children were parsed by the browser exactly once — in the *correct element
632
+ * context* (the host tag), so table fragments (`<tr>`, `<td>`, …) and other
633
+ * context-sensitive content parse correctly. Repeated static islands with
634
+ * identical markup (e.g. list rows, reused components) clone the pre-parsed
635
+ * fragment instead of re-parsing the HTML string on every mount — turning an
636
+ * O(parse) operation into an O(clone) one.
637
+ */
638
+ protected _staticFragmentCache: Map<string, DocumentFragment>;
639
+ /**
640
+ * Live-DOM attachments deferred while a mount pass is batching.
641
+ *
642
+ * A freshly-mounted subtree is built inside a *detached* root element, so
643
+ * every descendant `appendChild`/`insertBefore` happens off-document and
644
+ * triggers zero layout/paint invalidation. The single mutation that actually
645
+ * connects the built subtree to the live document is deferred and collected
646
+ * here, then flushed once when the batch closes — collapsing O(nodes) reflows
647
+ * into O(1) per mount root.
648
+ */
649
+ protected _pendingAttachments: Array<() => void>;
650
+ /**
651
+ * Depth of the currently open batching scopes. Re-entrant so that nested
652
+ * `beginBatch`/`endBatch` pairs flush exactly once, when the outermost scope
653
+ * closes.
654
+ */
655
+ protected _batchDepth: number;
484
656
  constructor(props: Partial<AreHTMLContextConstructor>);
485
657
  get container(): Document;
658
+ /**
659
+ * `true` while a synchronous mount pass is batching live-DOM attachments.
660
+ * Interpreter handlers consult this to decide whether to attach an element
661
+ * immediately or hand the attachment to {@link deferAttach}.
662
+ */
663
+ get isBatching(): boolean;
664
+ /**
665
+ * Opens a batching scope. Re-entrant: only the outermost matching
666
+ * {@link endBatch} flushes the deferred attachments, so a single mount pass
667
+ * connects its built subtree to the live DOM exactly once.
668
+ */
669
+ beginBatch(): void;
670
+ /**
671
+ * Registers a live-DOM attachment to run when the current batch flushes. If
672
+ * no batch is active the attachment runs immediately, preserving the original
673
+ * synchronous behaviour for updates that mount outside a batch.
674
+ *
675
+ * @param attach the DOM mutation that connects a built subtree to the document
676
+ */
677
+ deferAttach(attach: () => void): void;
678
+ /**
679
+ * Closes a batching scope. When the outermost scope closes, every deferred
680
+ * attachment runs in registration (document) order, connecting the built
681
+ * subtrees to the live DOM in a single pass.
682
+ */
683
+ endBatch(): void;
684
+ /**
685
+ * Returns a `DocumentFragment` containing the parsed form of `html`, parsed
686
+ * once in the context of `hostTag` (so context-sensitive content such as
687
+ * table rows/cells parses correctly) and cached thereafter. Callers should
688
+ * `cloneNode(true)` the returned fragment rather than mutating it, so the
689
+ * cache stays reusable.
690
+ *
691
+ * @param hostTag the tag name of the element the markup will be injected into
692
+ * @param html verbatim static-island inner markup
693
+ */
694
+ getStaticFragment(hostTag: string, html: string): DocumentFragment;
486
695
  /**
487
696
  * Retrieves the DOM element associated with a given AreNode. This method looks up the node's ASEID in the nodeToHostElements map to find the corresponding DOM element. If the node is not found, it returns undefined. This allows the engine to efficiently access and manipulate the DOM elements that correspond to specific nodes in the AreNode tree, enabling dynamic updates and interactions based on the application state.
488
697
  *
@@ -658,6 +867,8 @@ declare class AreHTMLInterpreter extends AreInterpreter {
658
867
  removeEventListener(mutation: AddListenerInstruction, context: AreHTMLEngineContext): void;
659
868
  addText(declaration: AddTextInstruction, context: AreHTMLEngineContext, store: AreStore, syntax: AreSyntax, directiveContext?: AreDirectiveContext, logger?: A_Logger): void;
660
869
  removeText(declaration: AddTextInstruction, context: AreHTMLEngineContext): void;
870
+ addStaticHTML(mutation: AddStaticHTMLInstruction, context: AreHTMLEngineContext, logger?: A_Logger): void;
871
+ removeStaticHTML(mutation: AddStaticHTMLInstruction, context: AreHTMLEngineContext): void;
661
872
  addComment(declaration: AddCommentInstruction, context: AreHTMLEngineContext, store: AreStore, syntax: AreSyntax, directiveContext?: AreDirectiveContext, logger?: A_Logger): void;
662
873
  removeComment(declaration: AddCommentInstruction, context: AreHTMLEngineContext): void;
663
874
  addStyle(mutation: AddStyleInstruction, context: AreHTMLEngineContext, logger?: A_Logger): void;
@@ -683,7 +894,7 @@ declare class AreHTMLLifecycle extends AreLifecycle {
683
894
  /**
684
895
  * Node Content
685
896
  */
686
- scene: AreScene, logger?: A_Logger, ...args: any[]): void;
897
+ scene: AreScene, logger?: A_Logger, ...args: any[]): void | Promise<void>;
687
898
  updateDirectiveAttribute(directive: AreDirectiveAttribute, scope: A_Scope, feature: A_Feature, logger?: A_Logger, ...args: any[]): void;
688
899
  }
689
900
 
@@ -799,4 +1010,4 @@ declare class AreRouteWatcher extends A_Component {
799
1010
  private notify;
800
1011
  }
801
1012
 
802
- export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, type AreDirectiveOrderDecoratorParameters, AreDirectiveShow, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, type AreHTMLContextConstructor, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, type AreHtmlAddAttributeInstructionPayload, type AreHtmlAddCommentInstructionPayload, type AreHtmlAddElementInstructionPayload, type AreHtmlAddInterpolationInstructionPayload, type AreHtmlAddListenerInstructionPayload, type AreHtmlAddStyleInstructionPayload, type AreHtmlAddTextInstructionPayload, type AreHtmlHideInstructionPayload, AreInterpolation, AreRoot, AreRootCache, type AreRootCacheEntry, AreRootNode, AreRoute, AreRouteWatcher, AreStaticAttribute, AreStyle, AreText, BOOLEAN_ATTRIBUTES, HideElementInstruction, IDL_FORM_PROPERTIES, LISTENER_OPTION_MODIFIERS, type ParsedEventName, SVG_ATTRIBUTE_NS, SVG_NAMESPACE, VOID_ELEMENTS, isBooleanAttribute, isIDLFormProperty, isVoidElement, normalizeClassValue, normalizeStyleValue, parseEventName, toDOMString };
1013
+ export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStaticHTMLInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, type AreDirectiveOrderDecoratorParameters, AreDirectiveShow, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, type AreHTMLContextConstructor, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, type AreHtmlAddAttributeInstructionPayload, type AreHtmlAddCommentInstructionPayload, type AreHtmlAddElementInstructionPayload, type AreHtmlAddInterpolationInstructionPayload, type AreHtmlAddListenerInstructionPayload, type AreHtmlAddStaticHTMLInstructionPayload, type AreHtmlAddStyleInstructionPayload, type AreHtmlAddTextInstructionPayload, type AreHtmlHideInstructionPayload, AreInterpolation, AreRoot, AreRootCache, type AreRootCacheEntry, AreRootNode, AreRoute, AreRouteWatcher, AreStaticAttribute, AreStyle, AreText, BOOLEAN_ATTRIBUTES, HideElementInstruction, IDL_FORM_PROPERTIES, LISTENER_OPTION_MODIFIERS, type ParsedEventName, STANDARD_HTML_TAGS, SVG_ATTRIBUTE_NS, SVG_NAMESPACE, VOID_ELEMENTS, isBooleanAttribute, isIDLFormProperty, isStaticMarkup, isVoidElement, normalizeClassValue, normalizeStyleValue, parseEventName, toDOMString };