@adaas/are-html 0.0.22 → 0.0.24

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 (191) hide show
  1. package/dist/browser/index.d.mts +194 -10
  2. package/dist/browser/index.mjs +696 -245
  3. package/dist/browser/index.mjs.map +1 -1
  4. package/dist/node/{AreBinding.attribute-doUvtOjc.d.mts → AreBinding.attribute-BWzEIw6H.d.mts} +45 -0
  5. package/dist/node/{AreBinding.attribute-Bm5LlOyE.d.ts → AreBinding.attribute-GpT-5Qmf.d.ts} +45 -0
  6. package/dist/node/attributes/AreBinding.attribute.d.mts +1 -1
  7. package/dist/node/attributes/AreBinding.attribute.d.ts +1 -1
  8. package/dist/node/attributes/AreDirective.attribute.d.mts +1 -1
  9. package/dist/node/attributes/AreDirective.attribute.d.ts +1 -1
  10. package/dist/node/attributes/AreEvent.attribute.d.mts +1 -1
  11. package/dist/node/attributes/AreEvent.attribute.d.ts +1 -1
  12. package/dist/node/attributes/AreStatic.attribute.d.mts +1 -1
  13. package/dist/node/attributes/AreStatic.attribute.d.ts +1 -1
  14. package/dist/node/directives/AreDirectiveFor.directive.d.mts +18 -1
  15. package/dist/node/directives/AreDirectiveFor.directive.d.ts +18 -1
  16. package/dist/node/directives/AreDirectiveFor.directive.js +57 -9
  17. package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -1
  18. package/dist/node/directives/AreDirectiveFor.directive.mjs +57 -9
  19. package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -1
  20. package/dist/node/directives/AreDirectiveIf.directive.d.mts +18 -2
  21. package/dist/node/directives/AreDirectiveIf.directive.d.ts +18 -2
  22. package/dist/node/directives/AreDirectiveIf.directive.js +29 -6
  23. package/dist/node/directives/AreDirectiveIf.directive.js.map +1 -1
  24. package/dist/node/directives/AreDirectiveIf.directive.mjs +29 -6
  25. package/dist/node/directives/AreDirectiveIf.directive.mjs.map +1 -1
  26. package/dist/node/directives/AreDirectiveShow.directive.d.mts +1 -1
  27. package/dist/node/directives/AreDirectiveShow.directive.d.ts +1 -1
  28. package/dist/node/engine/AreHTML.compiler.d.mts +4 -2
  29. package/dist/node/engine/AreHTML.compiler.d.ts +4 -2
  30. package/dist/node/engine/AreHTML.compiler.js +11 -4
  31. package/dist/node/engine/AreHTML.compiler.js.map +1 -1
  32. package/dist/node/engine/AreHTML.compiler.mjs +11 -4
  33. package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
  34. package/dist/node/engine/AreHTML.constants.d.mts +33 -1
  35. package/dist/node/engine/AreHTML.constants.d.ts +33 -1
  36. package/dist/node/engine/AreHTML.constants.js +166 -0
  37. package/dist/node/engine/AreHTML.constants.js.map +1 -1
  38. package/dist/node/engine/AreHTML.constants.mjs +165 -1
  39. package/dist/node/engine/AreHTML.constants.mjs.map +1 -1
  40. package/dist/node/engine/AreHTML.context.d.mts +66 -0
  41. package/dist/node/engine/AreHTML.context.d.ts +66 -0
  42. package/dist/node/engine/AreHTML.context.js +98 -0
  43. package/dist/node/engine/AreHTML.context.js.map +1 -1
  44. package/dist/node/engine/AreHTML.context.mjs +98 -0
  45. package/dist/node/engine/AreHTML.context.mjs.map +1 -1
  46. package/dist/node/engine/AreHTML.interpreter.d.mts +3 -0
  47. package/dist/node/engine/AreHTML.interpreter.d.ts +3 -0
  48. package/dist/node/engine/AreHTML.interpreter.js +66 -10
  49. package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
  50. package/dist/node/engine/AreHTML.interpreter.mjs +66 -10
  51. package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
  52. package/dist/node/engine/AreHTML.lifecycle.d.mts +1 -8
  53. package/dist/node/engine/AreHTML.lifecycle.d.ts +1 -8
  54. package/dist/node/engine/AreHTML.lifecycle.js +29 -44
  55. package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
  56. package/dist/node/engine/AreHTML.lifecycle.mjs +29 -44
  57. package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
  58. package/dist/node/engine/AreHTML.tokenizer.d.mts +1 -1
  59. package/dist/node/engine/AreHTML.tokenizer.d.ts +1 -1
  60. package/dist/node/engine/AreHTML.tokenizer.js +7 -1
  61. package/dist/node/engine/AreHTML.tokenizer.js.map +1 -1
  62. package/dist/node/engine/AreHTML.tokenizer.mjs +7 -1
  63. package/dist/node/engine/AreHTML.tokenizer.mjs.map +1 -1
  64. package/dist/node/engine/AreHTML.transformer.d.mts +1 -1
  65. package/dist/node/engine/AreHTML.transformer.d.ts +1 -1
  66. package/dist/node/index.d.mts +4 -3
  67. package/dist/node/index.d.ts +4 -3
  68. package/dist/node/index.js +7 -0
  69. package/dist/node/index.mjs +1 -0
  70. package/dist/node/instructions/AddStaticHTML.instruction.d.mts +8 -0
  71. package/dist/node/instructions/AddStaticHTML.instruction.d.ts +8 -0
  72. package/dist/node/instructions/AddStaticHTML.instruction.js +31 -0
  73. package/dist/node/instructions/AddStaticHTML.instruction.js.map +1 -0
  74. package/dist/node/instructions/AddStaticHTML.instruction.mjs +24 -0
  75. package/dist/node/instructions/AddStaticHTML.instruction.mjs.map +1 -0
  76. package/dist/node/instructions/AreHTML.instructions.constants.d.mts +1 -0
  77. package/dist/node/instructions/AreHTML.instructions.constants.d.ts +1 -0
  78. package/dist/node/instructions/AreHTML.instructions.constants.js +1 -0
  79. package/dist/node/instructions/AreHTML.instructions.constants.js.map +1 -1
  80. package/dist/node/instructions/AreHTML.instructions.constants.mjs +1 -0
  81. package/dist/node/instructions/AreHTML.instructions.constants.mjs.map +1 -1
  82. package/dist/node/instructions/AreHTML.instructions.types.d.mts +9 -1
  83. package/dist/node/instructions/AreHTML.instructions.types.d.ts +9 -1
  84. package/dist/node/lib/AreDirective/AreDirective.component.d.mts +1 -1
  85. package/dist/node/lib/AreDirective/AreDirective.component.d.ts +1 -1
  86. package/dist/node/lib/AreDirective/AreDirective.types.d.mts +1 -1
  87. package/dist/node/lib/AreDirective/AreDirective.types.d.ts +1 -1
  88. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +1 -1
  89. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +1 -1
  90. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +1 -1
  91. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +1 -1
  92. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +1 -1
  93. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +1 -1
  94. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +51 -0
  95. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -1
  96. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +51 -0
  97. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -1
  98. package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
  99. package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
  100. package/dist/node/nodes/AreComment.d.mts +1 -1
  101. package/dist/node/nodes/AreComment.d.ts +1 -1
  102. package/dist/node/nodes/AreComponent.d.mts +1 -1
  103. package/dist/node/nodes/AreComponent.d.ts +1 -1
  104. package/dist/node/nodes/AreInterpolation.d.mts +1 -1
  105. package/dist/node/nodes/AreInterpolation.d.ts +1 -1
  106. package/dist/node/nodes/AreRoot.d.mts +1 -1
  107. package/dist/node/nodes/AreRoot.d.ts +1 -1
  108. package/dist/node/nodes/AreText.d.mts +1 -1
  109. package/dist/node/nodes/AreText.d.ts +1 -1
  110. package/examples/dashboard/concept.ts +1 -1
  111. package/examples/dashboard/dist/index.html +1 -1
  112. package/examples/dashboard/dist/{mqh9ryml-xat335.js → mqiw5sqa-ypckmj.js} +403 -57
  113. package/examples/for-perf/dist/index.html +1 -1
  114. package/examples/for-perf/dist/{mqh9ryfo-6a8d0o.js → mqp8i2py-vltsx0.js} +3030 -2474
  115. package/examples/lazy-loading/README.md +76 -0
  116. package/examples/lazy-loading/concept.ts +55 -0
  117. package/examples/lazy-loading/containers/UI.container.ts +215 -0
  118. package/examples/lazy-loading/dist/app.js +3803 -0
  119. package/examples/{for-perf/dist/mqh9ryfq-4pf5cv.js → lazy-loading/dist/chunks/chunk-6K72IBO4.js} +2708 -5476
  120. package/examples/lazy-loading/dist/index.html +36 -0
  121. package/examples/lazy-loading/dist/lazy/about-page.js +59 -0
  122. package/examples/lazy-loading/dist/lazy/reports-page.js +65 -0
  123. package/examples/lazy-loading/dist/lazy/settings-page.js +54 -0
  124. package/examples/lazy-loading/public/index.html +36 -0
  125. package/examples/lazy-loading/src/components/AppShell.component.ts +44 -0
  126. package/examples/lazy-loading/src/components/HomePage.component.ts +59 -0
  127. package/examples/lazy-loading/src/components/LazyOutlet.component.ts +108 -0
  128. package/examples/lazy-loading/src/components/NavBar.component.ts +98 -0
  129. package/examples/lazy-loading/src/concept.ts +116 -0
  130. package/examples/lazy-loading/src/lazy/AboutPage.component.ts +54 -0
  131. package/examples/lazy-loading/src/lazy/ReportsPage.component.ts +56 -0
  132. package/examples/lazy-loading/src/lazy/SettingsPage.component.ts +45 -0
  133. package/examples/lazy-loading/src/runtime/ComponentManifest.fragment.ts +61 -0
  134. package/examples/lazy-loading/src/runtime/LazyComponentResolver.fragment.ts +77 -0
  135. package/examples/os-desktop/README.md +91 -0
  136. package/examples/os-desktop/concept.ts +54 -0
  137. package/examples/os-desktop/containers/OS.container.ts +198 -0
  138. package/examples/os-desktop/containers/apps/AppBackend.ts +29 -0
  139. package/examples/os-desktop/containers/apps/GanttApp.backend.ts +56 -0
  140. package/examples/os-desktop/containers/apps/MarketingApp.backend.ts +68 -0
  141. package/examples/os-desktop/dist/app.js +4410 -0
  142. package/examples/os-desktop/dist/apps/gantt/app.js +271 -0
  143. package/examples/os-desktop/dist/apps/marketing/app.js +346 -0
  144. package/examples/{for-perf/dist/mqh9ryde-m243t8.js → os-desktop/dist/chunks/chunk-6K72IBO4.js} +2708 -5476
  145. package/examples/os-desktop/dist/chunks/chunk-EIIGUL6N.js +30 -0
  146. package/examples/os-desktop/dist/chunks/chunk-WOH7L5UR.js +30 -0
  147. package/examples/os-desktop/dist/index.html +33 -0
  148. package/examples/os-desktop/public/index.html +33 -0
  149. package/examples/os-desktop/src/apps/gantt/GanttApp.component.ts +41 -0
  150. package/examples/os-desktop/src/apps/gantt/GanttChart.component.ts +126 -0
  151. package/examples/os-desktop/src/apps/gantt/GanttStore.ts +47 -0
  152. package/examples/os-desktop/src/apps/gantt/GanttToolbar.component.ts +73 -0
  153. package/examples/os-desktop/src/apps/gantt/index.ts +13 -0
  154. package/examples/os-desktop/src/apps/marketing/MarketingApp.component.ts +53 -0
  155. package/examples/os-desktop/src/apps/marketing/MarketingStore.ts +34 -0
  156. package/examples/os-desktop/src/apps/marketing/PostEditor.component.ts +153 -0
  157. package/examples/os-desktop/src/apps/marketing/PostPreview.component.ts +110 -0
  158. package/examples/os-desktop/src/apps/marketing/index.ts +16 -0
  159. package/examples/os-desktop/src/concept.ts +126 -0
  160. package/examples/os-desktop/src/os/AppStage.component.ts +112 -0
  161. package/examples/os-desktop/src/os/AppWindow.component.ts +102 -0
  162. package/examples/os-desktop/src/os/Desktop.component.ts +106 -0
  163. package/examples/os-desktop/src/os/Dock.component.ts +174 -0
  164. package/examples/os-desktop/src/os/Hud.component.ts +83 -0
  165. package/examples/os-desktop/src/os/Launchpad.component.ts +191 -0
  166. package/examples/os-desktop/src/os/MenuBar.component.ts +156 -0
  167. package/examples/os-desktop/src/runtime/AppComponentResolver.fragment.ts +121 -0
  168. package/examples/os-desktop/src/runtime/AppRegistry.fragment.ts +104 -0
  169. package/examples/os-desktop/src/signals/MouseState.signal.ts +34 -0
  170. package/examples/os-desktop/src/signals/OSRoute.signal.ts +37 -0
  171. package/examples/os-desktop/src/signals/SelectionState.signal.ts +34 -0
  172. package/examples/signal-routing/dist/index.html +1 -1
  173. package/examples/signal-routing/dist/{mqh9ryc9-dkcbkx.js → mqp8hgce-4d6rh0.js} +3196 -2640
  174. package/package.json +13 -9
  175. package/src/directives/AreDirectiveFor.directive.ts +99 -16
  176. package/src/directives/AreDirectiveIf.directive.ts +33 -4
  177. package/src/engine/AreHTML.compiler.ts +25 -2
  178. package/src/engine/AreHTML.constants.ts +142 -0
  179. package/src/engine/AreHTML.context.ts +112 -0
  180. package/src/engine/AreHTML.interpreter.ts +114 -13
  181. package/src/engine/AreHTML.lifecycle.ts +81 -74
  182. package/src/engine/AreHTML.tokenizer.ts +30 -1
  183. package/src/index.ts +1 -0
  184. package/src/instructions/AddStaticHTML.instruction.ts +23 -0
  185. package/src/instructions/AreHTML.instructions.constants.ts +1 -0
  186. package/src/instructions/AreHTML.instructions.types.ts +9 -0
  187. package/src/lib/AreHTMLNode/AreHTMLNode.ts +74 -0
  188. package/src/lib/AreRoot/AreRoot.component.ts +3 -3
  189. package/tests/PropPropagation.test.ts +181 -0
  190. package/tests/StaticIsland.test.ts +115 -0
  191. package/tests/jest.setup.ts +11 -0
@@ -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
  *
@@ -156,6 +201,17 @@ declare class AreDirectiveFor extends AreDirective {
156
201
  * pass for the same `$for` is in flight (see `update`).
157
202
  */
158
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;
159
215
  /**
160
216
  * Completes an update pass. If another update() arrived while a chunked
161
217
  * render was streaming, run exactly one more pass now from the latest store
@@ -193,6 +249,12 @@ declare class AreDirectiveFor extends AreDirective {
193
249
  * Supports both plain key lookups and function-call expressions:
194
250
  * items → store.get('items')
195
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.
196
258
  */
197
259
  private resolveArray;
198
260
  /**
@@ -233,7 +295,23 @@ declare class AreDirectiveContext extends A_ExecutionContext {
233
295
  declare class AreDirectiveIf extends AreDirective {
234
296
  transform(attribute: AreDirectiveAttribute, scope: A_Scope, store: AreStore, scene: AreScene, logger: A_Logger, ...args: any[]): void;
235
297
  compile(attribute: AreDirectiveAttribute, store: AreStore, scene: AreScene, syntax: AreSyntax, directiveContext?: AreDirectiveContext, ...args: any[]): void;
236
- update(attribute: AreDirectiveAttribute, store: AreStore, scope: A_Scope, syntax: AreSyntax, scene: AreScene, ...args: any[]): void;
298
+ update(attribute: AreDirectiveAttribute, store: AreStore, scope: A_Scope, syntax: AreSyntax, scene: AreScene, directiveContext?: AreDirectiveContext, ...args: any[]): void;
299
+ /**
300
+ * Evaluates the `$if` condition defensively.
301
+ *
302
+ * A condition can reference data that is momentarily unavailable — most
303
+ * commonly a nested `$if` (e.g. `$if="selected.fields.length"`) living
304
+ * inside a parent `$if="selected"` whose object has just become `null`.
305
+ * Because the nested directive is still subscribed to the store, its
306
+ * update fires on that same change and the raw expression would throw
307
+ * `Cannot read properties of null`, crashing the whole update pipeline.
308
+ *
309
+ * Treating an evaluation error as `false` is the correct contract for a
310
+ * conditional: if the condition cannot be resolved, the subtree simply
311
+ * stays hidden until the referenced data is present again (at which point
312
+ * the parent `$if` re-activates and re-evaluates this one).
313
+ */
314
+ private evaluateCondition;
237
315
  }
238
316
 
239
317
  /**
@@ -289,6 +367,14 @@ type AreHtmlAddStyleInstructionPayload = {
289
367
  /** Full CSS string to inject as a <style> block scoped to the component. Applied to the document head and reverted on unmount. */
290
368
  styles: string;
291
369
  };
370
+ type AreHtmlAddStaticHTMLInstructionPayload = {
371
+ /**
372
+ * Verbatim inner markup of a static island, materialised on the parent
373
+ * element in a single pass (browser-parsed `innerHTML` / cached `<template>`
374
+ * clone). Decodes HTML entities (e.g. `&nbsp;`) for free via the parser.
375
+ */
376
+ html: string;
377
+ };
292
378
  type AreHtmlHideInstructionPayload = {
293
379
  /**
294
380
  * Optional explicit display value to restore when the element becomes
@@ -327,6 +413,10 @@ declare class AddListenerInstruction extends AreMutation<AreHtmlAddListenerInstr
327
413
  constructor(parent: AreDeclaration, props: AreHtmlAddListenerInstructionPayload | AreInstructionSerialized<AreHtmlAddListenerInstructionPayload>);
328
414
  }
329
415
 
416
+ declare class AddStaticHTMLInstruction extends AreMutation<AreHtmlAddStaticHTMLInstructionPayload> {
417
+ constructor(parent: AreDeclaration, props: AreHtmlAddStaticHTMLInstructionPayload | AreInstructionSerialized<AreHtmlAddStaticHTMLInstructionPayload>);
418
+ }
419
+
330
420
  declare class AddStyleInstruction extends AreMutation<AreHtmlAddStyleInstructionPayload> {
331
421
  constructor(parent: AreDeclaration, props: AreHtmlAddStyleInstructionPayload | AreInstructionSerialized<AreHtmlAddStyleInstructionPayload>);
332
422
  }
@@ -352,6 +442,7 @@ declare const AreHTMLInstructions: {
352
442
  readonly AddListener: "_AreHTML_AddListener";
353
443
  readonly AddInterpolation: "_AreHTML_AddInterpolation";
354
444
  readonly AddComment: "_AreHTML_AddComment";
445
+ readonly AddStaticHTML: "_AreHTML_AddStaticHTML";
355
446
  readonly HideElement: "_AreHTML_HideElement";
356
447
  };
357
448
 
@@ -468,6 +559,38 @@ declare const LISTENER_OPTION_MODIFIERS: Set<string>;
468
559
  * Avoids "undefined"/"null"/"[object Object]" leaks into the DOM.
469
560
  */
470
561
  declare function toDOMString(value: any): string;
562
+ /**
563
+ * Standard HTML element names that are safe to materialise wholesale via
564
+ * `innerHTML` / a cached `<template>` clone.
565
+ *
566
+ * The set is intentionally an allow-list of plain HTML flow/phrasing/table/list
567
+ * /form-display tags. Anything NOT in this set — custom elements, registered
568
+ * ARE components (resolved by PascalCase tag), and SVG/MathML elements — is
569
+ * excluded so those subtrees keep flowing through the normal per-node pipeline
570
+ * (SVG needs createElementNS; components need their own lifecycle).
571
+ */
572
+ declare const STANDARD_HTML_TAGS: Set<string>;
573
+ /**
574
+ * Detects whether an inner-markup string is a fully *static island* — i.e. it
575
+ * contains no ARE-reactive constructs and therefore can be rendered in one shot
576
+ * (browser-parsed `innerHTML` / cached `<template>` clone) instead of being
577
+ * exploded into one AreNode per element/text/interpolation.
578
+ *
579
+ * A subtree is static iff it contains:
580
+ * 1. no `{{ }}` interpolations, and
581
+ * 2. no dynamic attributes (`$`-directive / `:`-binding / `@`-event), and
582
+ * 3. only standard HTML tags (no custom elements, ARE components or SVG).
583
+ *
584
+ * The scanner is quote-aware so a `:` / `@` / `$` inside an attribute *value*
585
+ * (e.g. `href="http://…"`, `style="color:red"`) is never mistaken for a
586
+ * dynamic-attribute prefix. The detector is deliberately conservative: any
587
+ * ambiguity resolves to `false` (skip the optimisation, keep the safe path).
588
+ *
589
+ * NOTE: pure-text content (no tags at all) is also considered static — this is
590
+ * what lets `&nbsp;`, `&amp;`, `&#160;` and friends decode correctly, since the
591
+ * browser HTML parser handles entities that hand-built text nodes do not.
592
+ */
593
+ declare function isStaticMarkup(inner: string): boolean;
471
594
 
472
595
  type AreHTMLContextConstructor = {
473
596
  container: Document;
@@ -517,8 +640,74 @@ declare class AreHTMLEngineContext extends AreContext {
517
640
  * 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.
518
641
  */
519
642
  protected _container: Document;
643
+ /**
644
+ * Parsed-fragment cache for static islands (see AddStaticHTMLInstruction).
645
+ *
646
+ * Keyed by `hostTag\u0000markup`, each entry holds a `DocumentFragment` whose
647
+ * children were parsed by the browser exactly once — in the *correct element
648
+ * context* (the host tag), so table fragments (`<tr>`, `<td>`, …) and other
649
+ * context-sensitive content parse correctly. Repeated static islands with
650
+ * identical markup (e.g. list rows, reused components) clone the pre-parsed
651
+ * fragment instead of re-parsing the HTML string on every mount — turning an
652
+ * O(parse) operation into an O(clone) one.
653
+ */
654
+ protected _staticFragmentCache: Map<string, DocumentFragment>;
655
+ /**
656
+ * Live-DOM attachments deferred while a mount pass is batching.
657
+ *
658
+ * A freshly-mounted subtree is built inside a *detached* root element, so
659
+ * every descendant `appendChild`/`insertBefore` happens off-document and
660
+ * triggers zero layout/paint invalidation. The single mutation that actually
661
+ * connects the built subtree to the live document is deferred and collected
662
+ * here, then flushed once when the batch closes — collapsing O(nodes) reflows
663
+ * into O(1) per mount root.
664
+ */
665
+ protected _pendingAttachments: Array<() => void>;
666
+ /**
667
+ * Depth of the currently open batching scopes. Re-entrant so that nested
668
+ * `beginBatch`/`endBatch` pairs flush exactly once, when the outermost scope
669
+ * closes.
670
+ */
671
+ protected _batchDepth: number;
520
672
  constructor(props: Partial<AreHTMLContextConstructor>);
521
673
  get container(): Document;
674
+ /**
675
+ * `true` while a synchronous mount pass is batching live-DOM attachments.
676
+ * Interpreter handlers consult this to decide whether to attach an element
677
+ * immediately or hand the attachment to {@link deferAttach}.
678
+ */
679
+ get isBatching(): boolean;
680
+ /**
681
+ * Opens a batching scope. Re-entrant: only the outermost matching
682
+ * {@link endBatch} flushes the deferred attachments, so a single mount pass
683
+ * connects its built subtree to the live DOM exactly once.
684
+ */
685
+ beginBatch(): void;
686
+ /**
687
+ * Registers a live-DOM attachment to run when the current batch flushes. If
688
+ * no batch is active the attachment runs immediately, preserving the original
689
+ * synchronous behaviour for updates that mount outside a batch.
690
+ *
691
+ * @param attach the DOM mutation that connects a built subtree to the document
692
+ */
693
+ deferAttach(attach: () => void): void;
694
+ /**
695
+ * Closes a batching scope. When the outermost scope closes, every deferred
696
+ * attachment runs in registration (document) order, connecting the built
697
+ * subtrees to the live DOM in a single pass.
698
+ */
699
+ endBatch(): void;
700
+ /**
701
+ * Returns a `DocumentFragment` containing the parsed form of `html`, parsed
702
+ * once in the context of `hostTag` (so context-sensitive content such as
703
+ * table rows/cells parses correctly) and cached thereafter. Callers should
704
+ * `cloneNode(true)` the returned fragment rather than mutating it, so the
705
+ * cache stays reusable.
706
+ *
707
+ * @param hostTag the tag name of the element the markup will be injected into
708
+ * @param html verbatim static-island inner markup
709
+ */
710
+ getStaticFragment(hostTag: string, html: string): DocumentFragment;
522
711
  /**
523
712
  * 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.
524
713
  *
@@ -604,7 +793,7 @@ declare class AreHTMLCompiler extends AreCompiler {
604
793
  compileStaticAttribute(attribute: AreStaticAttribute, scene: AreScene, ...args: any[]): void;
605
794
  compileDirectiveAttribute(directive: AreDirectiveAttribute, store: AreStore, feature: A_Feature, logger?: A_Logger, ...args: any[]): void;
606
795
  compileEventAttribute(attribute: AreEventAttribute, scene: AreScene, ...args: any[]): void;
607
- compileBindingAttribute(attribute: AreBindingAttribute, scene: AreScene, parentStore: AreStore, store: AreStore, syntax: AreSyntax, ...args: any[]): void;
796
+ compileBindingAttribute(attribute: AreBindingAttribute, scene: AreScene, parentStore: AreStore, store: AreStore, syntax: AreSyntax, directiveContext?: AreDirectiveContext, ...args: any[]): void;
608
797
  }
609
798
 
610
799
  /**
@@ -694,6 +883,8 @@ declare class AreHTMLInterpreter extends AreInterpreter {
694
883
  removeEventListener(mutation: AddListenerInstruction, context: AreHTMLEngineContext): void;
695
884
  addText(declaration: AddTextInstruction, context: AreHTMLEngineContext, store: AreStore, syntax: AreSyntax, directiveContext?: AreDirectiveContext, logger?: A_Logger): void;
696
885
  removeText(declaration: AddTextInstruction, context: AreHTMLEngineContext): void;
886
+ addStaticHTML(mutation: AddStaticHTMLInstruction, context: AreHTMLEngineContext, logger?: A_Logger): void;
887
+ removeStaticHTML(mutation: AddStaticHTMLInstruction, context: AreHTMLEngineContext): void;
697
888
  addComment(declaration: AddCommentInstruction, context: AreHTMLEngineContext, store: AreStore, syntax: AreSyntax, directiveContext?: AreDirectiveContext, logger?: A_Logger): void;
698
889
  removeComment(declaration: AddCommentInstruction, context: AreHTMLEngineContext): void;
699
890
  addStyle(mutation: AddStyleInstruction, context: AreHTMLEngineContext, logger?: A_Logger): void;
@@ -707,13 +898,6 @@ declare class AreHTMLInterpreter extends AreInterpreter {
707
898
  }
708
899
 
709
900
  declare class AreHTMLLifecycle extends AreLifecycle {
710
- /**
711
- * Per-chunk time budget (ms) for the time-sliced initial mount walk. While
712
- * mounting a large subtree we keep applying nodes until this much wall-clock
713
- * time has elapsed, then yield to the browser so it can paint and process
714
- * input before the next chunk. ~16ms targets a single animation frame.
715
- */
716
- private static readonly MOUNT_BUDGET_MS;
717
901
  initComponent(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, signalsContext?: AreSignalsContext, logger?: A_Logger, ...args: any[]): void;
718
902
  initRoot(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, signalsContext?: AreSignalsContext, logger?: A_Logger, ...args: any[]): void;
719
903
  initText(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, logger?: A_Logger, ...args: any[]): void;
@@ -842,4 +1026,4 @@ declare class AreRouteWatcher extends A_Component {
842
1026
  private notify;
843
1027
  }
844
1028
 
845
- 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 };
1029
+ 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 };