@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
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/engine/AreHTML.interpreter.ts"],"names":[],"mappings":";;;;;;;;;;AAqCO,IAAM,kBAAA,GAAN,cAAiC,cAAA,CAAe;AAAA,EASnD,UAAA,CACwB,WAAA,EACY,OAAA,EACZ,MAAA,EACtB;AACE,IAAA,IAAI;AACA,MAAA,MAAM,OAAO,WAAA,CAAY,KAAA;AAEzB,MAAA,IAAI,WAAA,GAAuC,IAAA;AAC3C,MAAA,IAAI,SAAkC,IAAA,CAAK,MAAA;AAE3C,MAAA,OAAO,MAAA,EAAQ;AACX,QAAA,IAAI,OAAA,CAAQ,cAAA,CAAe,MAAM,CAAA,EAAG;AAChC,UAAA;AAAA,QACJ;AACA,QAAA,WAAA,GAAc,MAAA;AACd,QAAA,MAAA,GAAS,MAAA,CAAO,MAAA;AAAA,MACpB;AAIA,MAAA,MAAM,MAAM,IAAA,CAAK,GAAA;AAEjB,MAAA,MAAM,KAAA,GAAQ,GAAA,KAAQ,KAAA,IAAS,IAAA,CAAK,eAAe,IAAI,CAAA;AAEvD,MAAA,IAAI,MAAA,EAAQ;AAER,QAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,cAAA,CAAe,MAAM,CAAA;AAEhD,QAAA,IAAI,CAAC,UAAA,EAAY;AACb,UAAA,MAAM,IAAI,mBAAA,CAAoB;AAAA,YAC1B,KAAA,EAAO,uBAAA;AAAA,YACP,WAAA,EAAa,CAAA,mDAAA,EAAsD,IAAA,CAAK,EAAE,CAAA,yIAAA;AAAA,WAC7E,CAAA;AAAA,QACL;AAEA,QAAA,MAAM,OAAA,GAAU,KAAA,GACV,OAAA,CAAQ,SAAA,CAAU,eAAA,CAAgB,aAAA,EAAe,GAAG,CAAA,GACpD,OAAA,CAAQ,SAAA,CAAU,aAAA,CAAc,GAAG,CAAA;AAEzC,QAAA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AqBA,eAAA,CAAA;AAAA,EALC,QAAQ,MAAA,CAAO;AAAA,IACZ,WAAA,EAAa;AAAA,GAChB,CAAA;AAAA,EACA,cAAA,CAAe,KAAA,CAAM,mBAAA,CAAoB,QAAQ,CAAA;AAAA,EACjD,cAAA,CAAe,MAAA,CAAO,mBAAA,CAAoB,QAAQ,CAAA;AAAA,EAE9C,4BAAS,QAAQ,CAAA,CAAA;AAAA,EACjB,4BAAS,oBAAoB,CAAA,CAAA;AAAA,EAC7B,4BAAS,QAAQ,CAAA;AAAA,CAAA,EAxoBb,kBAAA,CAqoBT,SAAA,EAAA,UAAA,EAAA,CAAA,CAAA;AAiCA,eAAA,CAAA;AAAA,EAJC,QAAQ,MAAA,CAAO;AAAA,IACZ,WAAA,EAAa;AAAA,GAChB,CAAA;AAAA,EACA,cAAA,CAAe,MAAA,CAAO,mBAAA,CAAoB,QAAQ,CAAA;AAAA,EAE9C,4BAAS,QAAQ,CAAA,CAAA;AAAA,EACjB,4BAAS,oBAAoB,CAAA;AAAA,CAAA,EAxqBzB,kBAAA,CAsqBT,SAAA,EAAA,aAAA,EAAA,CAAA,CAAA;AAtqBS,kBAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,kBAAA,CAAA","file":"AreHTML.interpreter.mjs","sourcesContent":["import { A_Caller, A_Inject } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\"\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport {\n AreSyntax, AreStore,\n AreEvent,\n AreInstructionDefaultNames,\n AreInterpreterError,\n AreInterpreter\n} from \"@adaas/are\";\nimport { AreHTMLInstructions } from \"@adaas/are-html/instructions/AreHTML.instructions.constants\";\nimport { AddAttributeInstruction } from \"@adaas/are-html/instructions/AddAttribute.instruction\";\nimport { AddCommentInstruction } from \"@adaas/are-html/instructions/AddComment.instruction\";\nimport { AddElementInstruction } from \"@adaas/are-html/instructions/AddElement.instruction\";\nimport { AddListenerInstruction } from \"@adaas/are-html/instructions/AddListener.instruction\";\nimport { AddTextInstruction } from \"@adaas/are-html/instructions/AddText.instruction\";\nimport { AddStyleInstruction } from \"@adaas/are-html/instructions/AddStyle.instruction\";\nimport { HideElementInstruction } from \"@adaas/are-html/instructions/HideElement.instruction\";\nimport { AreDirectiveContext } from \"@adaas/are-html/directive/AreDirective.context\";\nimport { AreHTMLNode } from \"../lib/AreHTMLNode/AreHTMLNode\";\nimport { AreHTMLEngineContext } from \"./AreHTML.context\";\nimport {\n isBooleanAttribute,\n isIDLFormProperty,\n normalizeClassValue,\n normalizeStyleValue,\n parseEventName,\n toDOMString,\n SVG_NAMESPACE,\n SVG_ATTRIBUTE_NS,\n} from \"./AreHTML.constants\";\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'DOM interpreter for the HTML rendering pipeline. Extends AreInterpreter to apply and revert each ARE instruction type directly against the browser DOM — creating and removing elements, setting and removing attributes and event listeners, managing inline styles, and inserting text and comment nodes. Driven by the scene diff computed per render cycle.'\n})\nexport class AreHTMLInterpreter extends AreInterpreter {\n // ─────────────────────────────────────────────────────────────────────────────\n // ── CreateElement — Apply / Revert ───────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n @A_Frame.Define({\n description: 'Create an HTML element based on the provided declaration instruction. Handles both root-level mounting and child element creation based on the structural parent hierarchy.'\n })\n @AreInterpreter.Apply(AreInstructionDefaultNames.Default)\n @AreInterpreter.Apply(AreHTMLInstructions.AddElement)\n addElement(\n @A_Inject(A_Caller) declaration: AddElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n try {\n const node = declaration.owner as AreHTMLNode;\n\n let currentNode: AreHTMLNode | undefined = node;\n let parent: AreHTMLNode | undefined = node.parent as AreHTMLNode | undefined;\n\n while (parent) {\n if (context.getNodeElement(parent)) {\n break;\n }\n currentNode = parent;\n parent = parent.parent as AreHTMLNode | undefined;\n }\n\n\n // Determine the element tag — components render as a wrapper div\n const tag = node.tag;\n\n const isSVG = tag === 'svg' || this.isInSVGContext(node);\n\n if (parent) {\n\n const mountPoint = context.getNodeElement(parent)\n\n if (!mountPoint) {\n throw new AreInterpreterError({\n title: 'Mount Point Not Found',\n description: `Could not find a mount point for the node with id \"${node.id}\". Ensure that the parent node is rendered before its children, or that a valid root element with the corresponding id exists in the DOM.`\n });\n }\n\n const element = isSVG\n ? context.container.createElementNS(SVG_NAMESPACE, tag)\n : context.container.createElement(tag);\n\n if (mountPoint.nodeType === Node.ELEMENT_NODE) {\n // parent is a real element — just append\n mountPoint.appendChild(element);\n } else {\n // parent is an anchor (comment/text node) — insert before it\n // so content always appears before the anchor marker\n mountPoint.parentNode?.insertBefore(element, mountPoint);\n }\n\n context.setInstructionElement(declaration, element);\n\n } else {\n const mountPoint = context.container.getElementById(node.id);\n if (!mountPoint) {\n throw new AreInterpreterError({\n title: 'Mount Point Not Found',\n description: `Could not find a mount point for the node with id \"${node.id}\". Ensure that the parent node is rendered before its children, or that a valid root element with the corresponding id exists in the DOM.`\n });\n }\n\n const element = isSVG\n ? context.container.createElementNS(SVG_NAMESPACE, tag)\n : context.container.createElement(tag);\n\n mountPoint.parentNode?.replaceChild(element, mountPoint);\n\n context.setInstructionElement(declaration, element);\n }\n\n // Register the element in the context index\n\n logger?.debug('green', `Element ${node.aseid.toString()} added to Context:`);\n\n } catch (error) {\n logger?.error(error);\n throw error;\n }\n }\n\n\n @A_Frame.Define({\n description: 'Remove an HTML element that was created by a CreateElement declaration. Cleans up the DOM and the context index.'\n })\n @AreInterpreter.Revert(AreInstructionDefaultNames.Default)\n @AreInterpreter.Revert(AreHTMLInstructions.AddElement)\n removeElement(\n @A_Inject(A_Caller) declaration: AddElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(declaration);\n\n if (element && element.parentNode) {\n element.parentNode.removeChild(element);\n }\n\n context.removeInstructionElement(declaration);\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddAttribute — Apply / Revert ────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n @A_Frame.Define({\n description: 'Add an attribute to an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddAttribute)\n @AreInterpreter.Update(AreHTMLInstructions.AddAttribute)\n addAttribute(\n @A_Inject(A_Caller) mutation: AddAttributeInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ): void {\n const element = context.getElementByInstruction(mutation.parent!);\n\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${mutation.parent}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before applying attribute mutations.`\n });\n }\n const { name, content, evaluate } = mutation.payload;\n\n const rawValue = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\n\n const el = element as HTMLElement;\n const lowerName = name.toLowerCase();\n\n // ── 0. Namespace-prefixed attributes (xlink:href, xml:space, xmlns:*) ──\n const colonIdx = name.indexOf(':');\n if (colonIdx > 0) {\n const ns = SVG_ATTRIBUTE_NS[name.slice(0, colonIdx)];\n if (ns) {\n (el as Element).setAttributeNS(ns, name, toDOMString(rawValue));\n mutation.cache = toDOMString(rawValue);\n return;\n }\n }\n\n // ── 1. Boolean attributes ────────────────────────────────────────────\n if (isBooleanAttribute(lowerName)) {\n if (rawValue) {\n el.setAttribute(lowerName, '');\n // also reflect IDL property where supported (disabled, hidden, …)\n try { (el as any)[lowerName] = true; } catch { /* ignore */ }\n } else {\n el.removeAttribute(lowerName);\n try { (el as any)[lowerName] = false; } catch { /* ignore */ }\n }\n mutation.cache = rawValue ? 'true' : '';\n return;\n }\n\n // ── 2. Form-control IDL properties (value/checked/selected) ─────────\n if (isIDLFormProperty(el.tagName, name)) {\n const propName = name === 'value' ? 'value'\n : name === 'checked' ? 'checked'\n : name === 'selected' ? 'selected'\n : name === 'indeterminate' ? 'indeterminate'\n : name;\n try {\n if (propName === 'checked' || propName === 'selected' || propName === 'indeterminate') {\n (el as any)[propName] = !!rawValue;\n } else {\n (el as any)[propName] = toDOMString(rawValue);\n }\n } catch { /* ignore */ }\n // also keep the attribute in sync for SSR/CSS selectors\n if (propName !== 'value') {\n if (rawValue) el.setAttribute(name, ''); else el.removeAttribute(name);\n } else {\n el.setAttribute(name, toDOMString(rawValue));\n }\n mutation.cache = toDOMString(rawValue);\n return;\n }\n\n // ── 3. Class binding — supports object/array/string and merges ──────\n if (lowerName === 'class') {\n const newValue = normalizeClassValue(rawValue);\n\n if (mutation.cache === undefined) {\n const existingValue = el.getAttribute('class');\n const merged = existingValue ? `${existingValue} ${newValue}`.trim() : newValue;\n if (merged) el.setAttribute('class', merged); else el.removeAttribute('class');\n } else {\n const existingValue = el.getAttribute('class');\n const existingParts = existingValue ? existingValue.split(/\\s+/).filter(Boolean) : [];\n const oldParts = new Set((mutation.cache as string).split(/\\s+/).filter(Boolean));\n const newParts = newValue ? newValue.split(/\\s+/).filter(Boolean) : [];\n\n const merged = [...existingParts.filter(p => !oldParts.has(p)), ...newParts].join(' ');\n if (merged) el.setAttribute('class', merged); else el.removeAttribute('class');\n }\n mutation.cache = newValue;\n return;\n }\n\n // ── 4. Style binding — supports object/array/string ─────────────────\n if (lowerName === 'style') {\n const newValue = normalizeStyleValue(rawValue);\n if (newValue) el.setAttribute('style', newValue); else el.removeAttribute('style');\n mutation.cache = newValue;\n return;\n }\n\n // ── 5. Default: replace attribute (no whitespace merge) ─────────────\n const stringValue = toDOMString(rawValue);\n if (stringValue === '' && evaluate && (rawValue === false || rawValue === null || rawValue === undefined)) {\n el.removeAttribute(name);\n } else {\n el.setAttribute(name, stringValue);\n }\n mutation.cache = stringValue;\n\n\n }\n\n @A_Frame.Define({\n description: 'Remove an attribute from an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddAttribute)\n removeAttribute(\n @A_Inject(A_Caller) mutation: AddAttributeInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n try {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (!element) return;\n\n const { name } = mutation.payload;\n\n if (name && element.nodeType === Node.ELEMENT_NODE) {\n const colonIdx = name.indexOf(':');\n if (colonIdx > 0) {\n const ns = SVG_ATTRIBUTE_NS[name.slice(0, colonIdx)];\n if (ns) {\n (element as Element).removeAttributeNS(ns, name.slice(colonIdx + 1));\n } else {\n (element as HTMLElement).removeAttribute(name);\n }\n } else {\n (element as HTMLElement).removeAttribute(name);\n }\n }\n } catch (error) {\n console.log('Error removing attribute:', error);\n }\n\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── HideElement — Apply / Revert ─────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n // Drives the `$show` directive. Apply hides the element by forcing its inline\n // `display:none` (which beats stylesheet rules and, unlike rewriting the whole\n // `style` attribute, does NOT clobber other inline styles or `:style`\n // bindings). The element stays mounted — its subtree, listeners and scene\n // state are preserved — so toggling visibility is far cheaper than $if's\n // mount/unmount cycle. Revert restores the element's previous inline display.\n @A_Frame.Define({\n description: 'Hide an element by setting inline display:none, caching its previous inline display value for restoration on revert.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.HideElement)\n hideElement(\n @A_Inject(A_Caller) mutation: HideElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (!element || element.nodeType !== Node.ELEMENT_NODE) return;\n\n const el = element as HTMLElement;\n\n // Remember the element's own inline display so it can be restored exactly.\n mutation.cache = el.style.display;\n el.style.display = 'none';\n }\n\n @A_Frame.Define({\n description: 'Restore an element hidden by a HideElement instruction back to its previous inline display value.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.HideElement)\n showElement(\n @A_Inject(A_Caller) mutation: HideElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (!element || element.nodeType !== Node.ELEMENT_NODE) return;\n\n const el = element as HTMLElement;\n\n // Restore the cached inline display. An explicit payload display, when\n // provided, takes precedence; otherwise fall back to the cached value\n // (empty string clears the inline rule and reverts to the CSS default).\n el.style.display = mutation.payload?.display ?? mutation.cache ?? '';\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── addEventListener — Apply / Revert ────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Define({\n description: 'Add an event listener to an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddListener)\n addEventListener(\n @A_Inject(A_Caller) mutation: AddListenerInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n\n const element = context.getElementByInstruction(mutation.parent);\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${mutation.parent}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before adding event listeners.`\n });\n }\n\n /**\n * e.g. @click=\"handleClick\"\n * e.g. @click=\"handleClick($event, element)\"\n * e.g. @click.stop.prevent=\"handleClick\"\n * e.g. @keydown.enter=\"submit\"\n * e.g. @click=\"(e)=> user.name ? handleClick(e) : null\"\n */\n\n const { event: eventName, modifiers } = parseEventName(mutation.payload.name);\n\n const listenerOptions: AddEventListenerOptions = {};\n if (modifiers.has('capture')) listenerOptions.capture = true;\n if (modifiers.has('once')) listenerOptions.once = true;\n if (modifiers.has('passive')) listenerOptions.passive = true;\n\n const handlers = syntax.extractEmitHandlers(mutation.payload.handler);\n\n // Holds the live DOM event so handler invocations (with or without\n // template arguments) always have access to it.\n let liveEvent: Event | null = null;\n\n const handlerScope: Record<string, any> = {};\n\n for (const handler of handlers) {\n const handlerFn = (...args: any[]) => {\n const event = new AreEvent(handler);\n // If user passed only template args (e.g. $h('x')), append the DOM\n // event as the last arg. If they passed nothing, args[0] is the DOM event.\n const effectiveArgs = args.length === 0 && liveEvent\n ? [liveEvent]\n : liveEvent\n ? [...args, liveEvent]\n : args;\n event.set('args', effectiveArgs);\n event.set('element', element);\n event.set('instruction', mutation);\n // Expose the raw DOM event under the conventional 'native' key so that\n // event handlers can do: event.get('native')?.target as HTMLInputElement\n if (liveEvent) event.set('native', liveEvent as any);\n mutation.owner.emit(event);\n };\n handlerScope[`$${handler}`] = handlerFn;\n }\n\n const callback = (e: Event) => {\n try {\n liveEvent = e;\n\n if (modifiers.has('self') && e.target !== element) return;\n if (modifiers.has('stop')) e.stopPropagation();\n if (modifiers.has('prevent')) e.preventDefault();\n\n // key-name modifiers for keyboard events: @keydown.enter / .esc / .tab / .space / .up / .down / .left / .right / .delete\n if (e instanceof KeyboardEvent && modifiers.size > 0) {\n const key = (e.key || '').toLowerCase();\n const KEY_ALIASES: Record<string, string[]> = {\n enter: ['enter'],\n esc: ['escape'],\n escape: ['escape'],\n tab: ['tab'],\n space: [' ', 'spacebar'],\n up: ['arrowup'],\n down: ['arrowdown'],\n left: ['arrowleft'],\n right: ['arrowright'],\n delete: ['delete', 'backspace'],\n };\n const keyMods = [...modifiers].filter(m =>\n m in KEY_ALIASES ||\n m === 'ctrl' || m === 'alt' || m === 'shift' || m === 'meta');\n\n if (keyMods.length > 0) {\n const keyMatch = keyMods.some(m => {\n if (m === 'ctrl') return e.ctrlKey;\n if (m === 'alt') return e.altKey;\n if (m === 'shift') return e.shiftKey;\n if (m === 'meta') return e.metaKey;\n const aliases = KEY_ALIASES[m];\n return aliases && aliases.includes(key);\n });\n if (!keyMatch) return;\n }\n }\n\n context.startPerformance('event:' + eventName);\n\n const result = syntax.evaluate(mutation.payload.handler, store, {\n ...handlerScope,\n $event: e,\n ...(directiveContext?.scope || {})\n });\n if (typeof result === 'function') result(e);\n\n context.endPerformance('event:' + eventName);\n } catch (err) {\n logger?.error(err);\n } finally {\n liveEvent = null;\n }\n };\n\n const useOptions = listenerOptions.capture || listenerOptions.once || listenerOptions.passive;\n if (useOptions) {\n element.addEventListener(eventName, callback, listenerOptions);\n } else {\n element.addEventListener(eventName, callback);\n }\n // Track on both the context (for diagnostics) and the mutation itself\n // so the revert path can detach the exact same callback.\n (mutation.payload as any)._callback = callback;\n context.addListener(element, mutation.payload.name, callback);\n }\n\n\n @A_Frame.Define({\n description: 'Remove an event listener from an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddListener)\n removeEventListener(\n @A_Inject(A_Caller) mutation: AddListenerInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(mutation.parent);\n\n if (!element) return;\n\n const { name } = mutation.payload;\n const { event: eventName } = parseEventName(name);\n\n const listener = (mutation.payload as any)._callback as EventListenerOrEventListenerObject | undefined;\n\n if (listener) {\n element.removeEventListener(eventName, listener);\n context.removeListener(element, name, listener);\n (mutation.payload as any)._callback = undefined;\n }\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddText — Apply / Revert ─────────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Define({\n description: 'Add text content to an HTML element based on the provided declaration instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddText)\n @AreInterpreter.Update(AreHTMLInstructions.AddText)\n addText(\n @A_Inject(A_Caller) declaration: AddTextInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n const node = declaration.owner.parent;\n const { content, evaluate } = declaration.payload;\n\n const rawValue = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\n\n const value = toDOMString(rawValue);\n\n\n if (!node) {\n const textNode = context.container.createTextNode(value);\n context.container.body.appendChild(textNode);\n context.setInstructionElement(declaration, textNode);\n\n } else {\n const element = context.getNodeElement(node);\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${declaration.owner.parent.aseid}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before applying attribute mutations.`\n });\n\n }\n\n const existingNode = context.getElementByInstruction(declaration);\n\n if (existingNode) {\n existingNode.textContent = value;\n } else {\n const textNode = context.container.createTextNode(value);\n element.appendChild(textNode);\n\n context.setInstructionElement(declaration, textNode);\n }\n }\n\n\n\n logger?.debug('green', `Text ${node?.aseid.toString()} added to Context:`);\n\n }\n\n\n @A_Frame.Define({\n description: 'Remove text content from an HTML element based on the provided declaration instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddText)\n removeText(\n @A_Inject(A_Caller) declaration: AddTextInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(declaration);\n\n if (!element) return;\n\n element.parentNode?.removeChild(element);\n context.removeInstructionElement(declaration);\n }\n\n\n\n @A_Frame.Define({\n description: 'Add a comment node to the DOM based on the provided declaration instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddComment)\n @AreInterpreter.Update(AreHTMLInstructions.AddComment)\n addComment(\n @A_Inject(A_Caller) declaration: AddCommentInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n const node = declaration.owner.parent;\n const { content, evaluate } = declaration.payload;\n\n const rawValue = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\n\n const value = toDOMString(rawValue);\n\n\n if (!node) {\n const commentNode = context.container.createComment(value);\n context.container.body.appendChild(commentNode);\n context.setInstructionElement(declaration, commentNode);\n\n } else {\n const element = context.getNodeElement(node);\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${declaration.owner.parent.aseid}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before applying attribute mutations.`\n });\n }\n\n const existingNode = context.getElementByInstruction(declaration);\n\n if (existingNode) {\n existingNode.textContent = value;\n } else {\n const commentNode = context.container.createComment(value);\n element.appendChild(commentNode);\n\n context.setInstructionElement(declaration, commentNode);\n }\n }\n\n\n\n logger?.debug('green', `Comment ${node?.aseid.toString()} added to Context:`);\n }\n\n\n @A_Frame.Define({\n description: 'Remove a comment node from the DOM based on the provided declaration instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddComment)\n removeComment(\n @A_Inject(A_Caller) declaration: AddCommentInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(declaration);\n\n if (!element) return;\n\n element.parentNode?.removeChild(element);\n context.removeInstructionElement(declaration);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddStyle — Apply / Update / Revert ───────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Define({\n description: 'Inject a <style> element into the document <head> carrying the component CSS. Keyed by instruction ASEID so multiple components with styles do not collide. Subsequent Update calls refresh the textContent in-place.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddStyle)\n @AreInterpreter.Update(AreHTMLInstructions.AddStyle)\n addStyle(\n @A_Inject(A_Caller) mutation: AddStyleInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ): void {\n try {\n\n\n const { styles } = mutation.payload;\n const styleId = `are-style-${String(mutation.aseid)}`;\n\n const existing = context.getElementByInstruction(mutation) as HTMLStyleElement | undefined;\n if (existing) {\n existing.textContent = styles;\n } else {\n const styleEl = context.container.createElement('style') as HTMLStyleElement;\n styleEl.setAttribute('data-are-id', styleId);\n styleEl.textContent = styles;\n (context.container.head ?? context.container.body).appendChild(styleEl);\n\n context.setInstructionElement(mutation, styleEl);\n logger?.debug('green', `Style injected for ${String(mutation.aseid)}`);\n }\n } catch (error) {\n logger?.error(error);\n }\n\n }\n\n @A_Frame.Define({\n description: 'Remove the <style> element that was injected by addStyle, cleaning up the document head.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddStyle)\n removeStyle(\n @A_Inject(A_Caller) mutation: AddStyleInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n const styleEl = context.getElementByInstruction(mutation);\n if (styleEl?.parentNode) {\n styleEl.parentNode.removeChild(styleEl);\n }\n context.removeInstructionElement(mutation);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── SVG helpers ───────────────────────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Returns true when any ancestor of the given node has the tag `svg`,\n * meaning the node lives inside an SVG subtree and its DOM element must be\n * created via createElementNS(SVG_NAMESPACE, tag).\n */\n private isInSVGContext(node: AreHTMLNode): boolean {\n let current: AreHTMLNode | undefined = node.parent as AreHTMLNode | undefined;\n while (current) {\n if (current.tag === 'svg') return true;\n // <foreignObject> resets the namespace back to HTML\n if (current.tag === 'foreignobject') return false;\n current = current.parent as AreHTMLNode | undefined;\n }\n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MAAA,CAAO;AAAA,IACZ,WAAA,EAAa;AAAA,GAChB,CAAA;AAAA,EACA,cAAA,CAAe,KAAA,CAAM,mBAAA,CAAoB,QAAQ,CAAA;AAAA,EACjD,cAAA,CAAe,MAAA,CAAO,mBAAA,CAAoB,QAAQ,CAAA;AAAA,EAE9C,4BAAS,QAAQ,CAAA,CAAA;AAAA,EACjB,4BAAS,oBAAoB,CAAA,CAAA;AAAA,EAC7B,4BAAS,QAAQ,CAAA;AAAA,CAAA,EA5uBb,kBAAA,CAyuBT,SAAA,EAAA,UAAA,EAAA,CAAA,CAAA;AAiCA,eAAA,CAAA;AAAA,EAJC,QAAQ,MAAA,CAAO;AAAA,IACZ,WAAA,EAAa;AAAA,GAChB,CAAA;AAAA,EACA,cAAA,CAAe,MAAA,CAAO,mBAAA,CAAoB,QAAQ,CAAA;AAAA,EAE9C,4BAAS,QAAQ,CAAA,CAAA;AAAA,EACjB,4BAAS,oBAAoB,CAAA;AAAA,CAAA,EA5wBzB,kBAAA,CA0wBT,SAAA,EAAA,aAAA,EAAA,CAAA,CAAA;AA1wBS,kBAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,kBAAA,CAAA","file":"AreHTML.interpreter.mjs","sourcesContent":["import { A_Caller, A_Inject } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\"\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport {\n AreSyntax, AreStore,\n AreEvent,\n AreInstructionDefaultNames,\n AreInterpreterError,\n AreInterpreter\n} from \"@adaas/are\";\nimport { AreHTMLInstructions } from \"@adaas/are-html/instructions/AreHTML.instructions.constants\";\nimport { AddAttributeInstruction } from \"@adaas/are-html/instructions/AddAttribute.instruction\";\nimport { AddCommentInstruction } from \"@adaas/are-html/instructions/AddComment.instruction\";\nimport { AddElementInstruction } from \"@adaas/are-html/instructions/AddElement.instruction\";\nimport { AddListenerInstruction } from \"@adaas/are-html/instructions/AddListener.instruction\";\nimport { AddTextInstruction } from \"@adaas/are-html/instructions/AddText.instruction\";\nimport { AddStyleInstruction } from \"@adaas/are-html/instructions/AddStyle.instruction\";\nimport { AddStaticHTMLInstruction } from \"@adaas/are-html/instructions/AddStaticHTML.instruction\";\nimport { HideElementInstruction } from \"@adaas/are-html/instructions/HideElement.instruction\";\nimport { AreDirectiveContext } from \"@adaas/are-html/directive/AreDirective.context\";\nimport { AreHTMLNode } from \"../lib/AreHTMLNode/AreHTMLNode\";\nimport { AreHTMLEngineContext } from \"./AreHTML.context\";\nimport {\n isBooleanAttribute,\n isIDLFormProperty,\n normalizeClassValue,\n normalizeStyleValue,\n parseEventName,\n toDOMString,\n SVG_NAMESPACE,\n SVG_ATTRIBUTE_NS,\n} from \"./AreHTML.constants\";\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'DOM interpreter for the HTML rendering pipeline. Extends AreInterpreter to apply and revert each ARE instruction type directly against the browser DOM — creating and removing elements, setting and removing attributes and event listeners, managing inline styles, and inserting text and comment nodes. Driven by the scene diff computed per render cycle.'\n})\nexport class AreHTMLInterpreter extends AreInterpreter {\n // ─────────────────────────────────────────────────────────────────────────────\n // ── CreateElement — Apply / Revert ───────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n @A_Frame.Define({\n description: 'Create an HTML element based on the provided declaration instruction. Handles both root-level mounting and child element creation based on the structural parent hierarchy.'\n })\n @AreInterpreter.Apply(AreInstructionDefaultNames.Default)\n @AreInterpreter.Apply(AreHTMLInstructions.AddElement)\n addElement(\n @A_Inject(A_Caller) declaration: AddElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n try {\n const node = declaration.owner as AreHTMLNode;\n\n let currentNode: AreHTMLNode | undefined = node;\n let parent: AreHTMLNode | undefined = node.parent as AreHTMLNode | undefined;\n\n while (parent) {\n if (context.getNodeElement(parent)) {\n break;\n }\n currentNode = parent;\n parent = parent.parent as AreHTMLNode | undefined;\n }\n\n\n // Determine the element tag — components render as a wrapper div\n const tag = node.tag;\n\n const isSVG = tag === 'svg' || this.isInSVGContext(node);\n\n if (parent) {\n\n const mountPoint = context.getNodeElement(parent)\n\n if (!mountPoint) {\n throw new AreInterpreterError({\n title: 'Mount Point Not Found',\n description: `Could not find a mount point for the node with id \"${node.id}\". Ensure that the parent node is rendered before its children, or that a valid root element with the corresponding id exists in the DOM.`\n });\n }\n\n const element = isSVG\n ? context.container.createElementNS(SVG_NAMESPACE, tag)\n : context.container.createElement(tag);\n\n // Index the element synchronously so descendants can resolve this\n // node as their mount point during the same (still off-document) pass.\n context.setInstructionElement(declaration, element);\n\n const attach = mountPoint.nodeType === Node.ELEMENT_NODE\n // parent is a real element — just append\n ? () => mountPoint.appendChild(element)\n // parent is an anchor (comment/text node) — insert before it\n // so content always appears before the anchor marker\n : () => { mountPoint.parentNode?.insertBefore(element, mountPoint); };\n\n // When batching, only the mutation that touches the *live* document\n // needs deferring; appends into an already-detached subtree are free\n // and run immediately so the offline tree keeps taking shape.\n if (context.isBatching && mountPoint.isConnected) {\n context.deferAttach(attach);\n } else {\n attach();\n }\n\n } else {\n const mountPoint = context.container.getElementById(node.id);\n if (!mountPoint) {\n throw new AreInterpreterError({\n title: 'Mount Point Not Found',\n description: `Could not find a mount point for the node with id \"${node.id}\". Ensure that the parent node is rendered before its children, or that a valid root element with the corresponding id exists in the DOM.`\n });\n }\n\n const element = isSVG\n ? context.container.createElementNS(SVG_NAMESPACE, tag)\n : context.container.createElement(tag);\n\n context.setInstructionElement(declaration, element);\n\n const attach = () => { mountPoint.parentNode?.replaceChild(element, mountPoint); };\n\n // The placeholder lives in the live DOM — defer the swap so the\n // whole subtree built into `element` lands in one mutation.\n if (context.isBatching && mountPoint.isConnected) {\n context.deferAttach(attach);\n } else {\n attach();\n }\n }\n\n // Register the element in the context index\n\n logger?.debug('green', `Element ${node.aseid.toString()} added to Context:`);\n\n } catch (error) {\n logger?.error(error);\n throw error;\n }\n }\n\n\n @A_Frame.Define({\n description: 'Remove an HTML element that was created by a CreateElement declaration. Cleans up the DOM and the context index.'\n })\n @AreInterpreter.Revert(AreInstructionDefaultNames.Default)\n @AreInterpreter.Revert(AreHTMLInstructions.AddElement)\n removeElement(\n @A_Inject(A_Caller) declaration: AddElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(declaration);\n\n // Skip the live-DOM detach when the element is already off-document: an\n // ancestor removed earlier in the same unmount took this whole subtree\n // with it, and a detached subtree is garbage-collected as a unit. The\n // per-node removeChild would be wasted work. The index bookkeeping below\n // must still run to drop the strong references that would pin it in memory.\n if (element && element.parentNode && element.isConnected) {\n element.parentNode.removeChild(element);\n }\n\n context.removeInstructionElement(declaration);\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddAttribute — Apply / Revert ────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n @A_Frame.Define({\n description: 'Add an attribute to an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddAttribute)\n @AreInterpreter.Update(AreHTMLInstructions.AddAttribute)\n addAttribute(\n @A_Inject(A_Caller) mutation: AddAttributeInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ): void {\n const element = context.getElementByInstruction(mutation.parent!);\n\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${mutation.parent}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before applying attribute mutations.`\n });\n }\n const { name, content, evaluate } = mutation.payload;\n\n const rawValue = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\n\n const el = element as HTMLElement;\n const lowerName = name.toLowerCase();\n\n // ── 0. Namespace-prefixed attributes (xlink:href, xml:space, xmlns:*) ──\n const colonIdx = name.indexOf(':');\n if (colonIdx > 0) {\n const ns = SVG_ATTRIBUTE_NS[name.slice(0, colonIdx)];\n if (ns) {\n (el as Element).setAttributeNS(ns, name, toDOMString(rawValue));\n mutation.cache = toDOMString(rawValue);\n return;\n }\n }\n\n // ── 1. Boolean attributes ────────────────────────────────────────────\n if (isBooleanAttribute(lowerName)) {\n if (rawValue) {\n el.setAttribute(lowerName, '');\n // also reflect IDL property where supported (disabled, hidden, …)\n try { (el as any)[lowerName] = true; } catch { /* ignore */ }\n } else {\n el.removeAttribute(lowerName);\n try { (el as any)[lowerName] = false; } catch { /* ignore */ }\n }\n mutation.cache = rawValue ? 'true' : '';\n return;\n }\n\n // ── 2. Form-control IDL properties (value/checked/selected) ─────────\n if (isIDLFormProperty(el.tagName, name)) {\n const propName = name === 'value' ? 'value'\n : name === 'checked' ? 'checked'\n : name === 'selected' ? 'selected'\n : name === 'indeterminate' ? 'indeterminate'\n : name;\n try {\n if (propName === 'checked' || propName === 'selected' || propName === 'indeterminate') {\n (el as any)[propName] = !!rawValue;\n } else {\n (el as any)[propName] = toDOMString(rawValue);\n }\n } catch { /* ignore */ }\n // also keep the attribute in sync for SSR/CSS selectors\n if (propName !== 'value') {\n if (rawValue) el.setAttribute(name, ''); else el.removeAttribute(name);\n } else {\n el.setAttribute(name, toDOMString(rawValue));\n }\n mutation.cache = toDOMString(rawValue);\n return;\n }\n\n // ── 3. Class binding — supports object/array/string and merges ──────\n if (lowerName === 'class') {\n const newValue = normalizeClassValue(rawValue);\n\n if (mutation.cache === undefined) {\n const existingValue = el.getAttribute('class');\n const merged = existingValue ? `${existingValue} ${newValue}`.trim() : newValue;\n if (merged) el.setAttribute('class', merged); else el.removeAttribute('class');\n } else {\n const existingValue = el.getAttribute('class');\n const existingParts = existingValue ? existingValue.split(/\\s+/).filter(Boolean) : [];\n const oldParts = new Set((mutation.cache as string).split(/\\s+/).filter(Boolean));\n const newParts = newValue ? newValue.split(/\\s+/).filter(Boolean) : [];\n\n const merged = [...existingParts.filter(p => !oldParts.has(p)), ...newParts].join(' ');\n if (merged) el.setAttribute('class', merged); else el.removeAttribute('class');\n }\n mutation.cache = newValue;\n return;\n }\n\n // ── 4. Style binding — supports object/array/string ─────────────────\n if (lowerName === 'style') {\n const newValue = normalizeStyleValue(rawValue);\n if (newValue) el.setAttribute('style', newValue); else el.removeAttribute('style');\n mutation.cache = newValue;\n return;\n }\n\n // ── 5. Default: replace attribute (no whitespace merge) ─────────────\n const stringValue = toDOMString(rawValue);\n if (stringValue === '' && evaluate && (rawValue === false || rawValue === null || rawValue === undefined)) {\n el.removeAttribute(name);\n } else {\n el.setAttribute(name, stringValue);\n }\n mutation.cache = stringValue;\n\n\n }\n\n @A_Frame.Define({\n description: 'Remove an attribute from an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddAttribute)\n removeAttribute(\n @A_Inject(A_Caller) mutation: AddAttributeInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n try {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (!element) return;\n\n const { name } = mutation.payload;\n\n // No point stripping attributes off an element that is already\n // detached from the live document (it is about to be discarded with\n // its whole subtree). Only touch attributes while the element is live.\n if (name && element.nodeType === Node.ELEMENT_NODE && element.isConnected) {\n const colonIdx = name.indexOf(':');\n if (colonIdx > 0) {\n const ns = SVG_ATTRIBUTE_NS[name.slice(0, colonIdx)];\n if (ns) {\n (element as Element).removeAttributeNS(ns, name.slice(colonIdx + 1));\n } else {\n (element as HTMLElement).removeAttribute(name);\n }\n } else {\n (element as HTMLElement).removeAttribute(name);\n }\n }\n } catch (error) {\n console.log('Error removing attribute:', error);\n }\n\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── HideElement — Apply / Revert ─────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n // Drives the `$show` directive. Apply hides the element by forcing its inline\n // `display:none` (which beats stylesheet rules and, unlike rewriting the whole\n // `style` attribute, does NOT clobber other inline styles or `:style`\n // bindings). The element stays mounted — its subtree, listeners and scene\n // state are preserved — so toggling visibility is far cheaper than $if's\n // mount/unmount cycle. Revert restores the element's previous inline display.\n @A_Frame.Define({\n description: 'Hide an element by setting inline display:none, caching its previous inline display value for restoration on revert.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.HideElement)\n hideElement(\n @A_Inject(A_Caller) mutation: HideElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (!element || element.nodeType !== Node.ELEMENT_NODE) return;\n\n const el = element as HTMLElement;\n\n // Remember the element's own inline display so it can be restored exactly.\n mutation.cache = el.style.display;\n el.style.display = 'none';\n }\n\n @A_Frame.Define({\n description: 'Restore an element hidden by a HideElement instruction back to its previous inline display value.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.HideElement)\n showElement(\n @A_Inject(A_Caller) mutation: HideElementInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (!element || element.nodeType !== Node.ELEMENT_NODE) return;\n\n // A detached element is being discarded with its subtree — restoring its\n // inline display would be pointless work. Only restore while it is live.\n if (!element.isConnected) return;\n\n const el = element as HTMLElement;\n\n // Restore the cached inline display. An explicit payload display, when\n // provided, takes precedence; otherwise fall back to the cached value\n // (empty string clears the inline rule and reverts to the CSS default).\n el.style.display = mutation.payload?.display ?? mutation.cache ?? '';\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── addEventListener — Apply / Revert ────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Define({\n description: 'Add an event listener to an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddListener)\n addEventListener(\n @A_Inject(A_Caller) mutation: AddListenerInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n\n const element = context.getElementByInstruction(mutation.parent);\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${mutation.parent}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before adding event listeners.`\n });\n }\n\n /**\n * e.g. @click=\"handleClick\"\n * e.g. @click=\"handleClick($event, element)\"\n * e.g. @click.stop.prevent=\"handleClick\"\n * e.g. @keydown.enter=\"submit\"\n * e.g. @click=\"(e)=> user.name ? handleClick(e) : null\"\n */\n\n const { event: eventName, modifiers } = parseEventName(mutation.payload.name);\n\n const listenerOptions: AddEventListenerOptions = {};\n if (modifiers.has('capture')) listenerOptions.capture = true;\n if (modifiers.has('once')) listenerOptions.once = true;\n if (modifiers.has('passive')) listenerOptions.passive = true;\n\n const handlers = syntax.extractEmitHandlers(mutation.payload.handler);\n\n // Holds the live DOM event so handler invocations (with or without\n // template arguments) always have access to it.\n let liveEvent: Event | null = null;\n\n const handlerScope: Record<string, any> = {};\n\n for (const handler of handlers) {\n const handlerFn = (...args: any[]) => {\n const event = new AreEvent(handler);\n // If user passed only template args (e.g. $h('x')), append the DOM\n // event as the last arg. If they passed nothing, args[0] is the DOM event.\n const effectiveArgs = args.length === 0 && liveEvent\n ? [liveEvent]\n : liveEvent\n ? [...args, liveEvent]\n : args;\n event.set('args', effectiveArgs);\n event.set('element', element);\n event.set('instruction', mutation);\n // Expose the raw DOM event under the conventional 'native' key so that\n // event handlers can do: event.get('native')?.target as HTMLInputElement\n if (liveEvent) event.set('native', liveEvent as any);\n mutation.owner.emit(event);\n };\n handlerScope[`$${handler}`] = handlerFn;\n }\n\n const callback = (e: Event) => {\n try {\n liveEvent = e;\n\n if (modifiers.has('self') && e.target !== element) return;\n if (modifiers.has('stop')) e.stopPropagation();\n if (modifiers.has('prevent')) e.preventDefault();\n\n // key-name modifiers for keyboard events: @keydown.enter / .esc / .tab / .space / .up / .down / .left / .right / .delete\n if (e instanceof KeyboardEvent && modifiers.size > 0) {\n const key = (e.key || '').toLowerCase();\n const KEY_ALIASES: Record<string, string[]> = {\n enter: ['enter'],\n esc: ['escape'],\n escape: ['escape'],\n tab: ['tab'],\n space: [' ', 'spacebar'],\n up: ['arrowup'],\n down: ['arrowdown'],\n left: ['arrowleft'],\n right: ['arrowright'],\n delete: ['delete', 'backspace'],\n };\n const keyMods = [...modifiers].filter(m =>\n m in KEY_ALIASES ||\n m === 'ctrl' || m === 'alt' || m === 'shift' || m === 'meta');\n\n if (keyMods.length > 0) {\n const keyMatch = keyMods.some(m => {\n if (m === 'ctrl') return e.ctrlKey;\n if (m === 'alt') return e.altKey;\n if (m === 'shift') return e.shiftKey;\n if (m === 'meta') return e.metaKey;\n const aliases = KEY_ALIASES[m];\n return aliases && aliases.includes(key);\n });\n if (!keyMatch) return;\n }\n }\n\n context.startPerformance('event:' + eventName);\n\n const result = syntax.evaluate(mutation.payload.handler, store, {\n ...handlerScope,\n $event: e,\n ...(directiveContext?.scope || {})\n });\n if (typeof result === 'function') result(e);\n\n context.endPerformance('event:' + eventName);\n } catch (err) {\n logger?.error(err);\n } finally {\n liveEvent = null;\n }\n };\n\n const useOptions = listenerOptions.capture || listenerOptions.once || listenerOptions.passive;\n if (useOptions) {\n element.addEventListener(eventName, callback, listenerOptions);\n } else {\n element.addEventListener(eventName, callback);\n }\n // Track on both the context (for diagnostics) and the mutation itself\n // so the revert path can detach the exact same callback.\n (mutation.payload as any)._callback = callback;\n context.addListener(element, mutation.payload.name, callback);\n }\n\n\n @A_Frame.Define({\n description: 'Remove an event listener from an HTML element based on the provided mutation instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddListener)\n removeEventListener(\n @A_Inject(A_Caller) mutation: AddListenerInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(mutation.parent);\n\n if (!element) return;\n\n const { name } = mutation.payload;\n const { event: eventName } = parseEventName(name);\n\n const listener = (mutation.payload as any)._callback as EventListenerOrEventListenerObject | undefined;\n\n if (listener) {\n // Detaching a listener from an element that is already off-document is\n // unnecessary — the element and its listeners are collected together.\n // Still clear the context bookkeeping so no strong reference lingers.\n if (element.isConnected) {\n element.removeEventListener(eventName, listener);\n }\n context.removeListener(element, name, listener);\n (mutation.payload as any)._callback = undefined;\n }\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddText — Apply / Revert ─────────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Define({\n description: 'Add text content to an HTML element based on the provided declaration instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddText)\n @AreInterpreter.Update(AreHTMLInstructions.AddText)\n addText(\n @A_Inject(A_Caller) declaration: AddTextInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n const node = declaration.owner.parent;\n const { content, evaluate } = declaration.payload;\n\n const rawValue = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\n\n const value = toDOMString(rawValue);\n\n\n if (!node) {\n const textNode = context.container.createTextNode(value);\n context.container.body.appendChild(textNode);\n context.setInstructionElement(declaration, textNode);\n\n } else {\n const element = context.getNodeElement(node);\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${declaration.owner.parent.aseid}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before applying attribute mutations.`\n });\n\n }\n\n const existingNode = context.getElementByInstruction(declaration);\n\n if (existingNode) {\n existingNode.textContent = value;\n } else {\n const textNode = context.container.createTextNode(value);\n element.appendChild(textNode);\n\n context.setInstructionElement(declaration, textNode);\n }\n }\n\n\n\n logger?.debug('green', `Text ${node?.aseid.toString()} added to Context:`);\n\n }\n\n\n @A_Frame.Define({\n description: 'Remove text content from an HTML element based on the provided declaration instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddText)\n removeText(\n @A_Inject(A_Caller) declaration: AddTextInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(declaration);\n\n if (!element) return;\n\n // Off-document text nodes vanish with their detached parent subtree, so\n // skip the removeChild and just release the index reference.\n if (element.isConnected) {\n element.parentNode?.removeChild(element);\n }\n context.removeInstructionElement(declaration);\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddStaticHTML — Apply / Update / Revert ──────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n // Materialises a fully static subtree (a \"static island\") onto its host\n // element in a single pass. The tokenizer captured the inner markup verbatim\n // instead of exploding it into per-element/per-text AreNodes, so here we hand\n // the markup to the browser parser ONCE (via a cached <template>) and clone\n // the pre-parsed fragment in. This collapses N DOM mutations into one and\n // decodes HTML entities (e.g. &nbsp;) natively.\n @A_Frame.Define({\n description: 'Inject a static island\\'s inner markup onto its host element in one pass via a cached, browser-parsed <template> clone. Decodes HTML entities natively.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddStaticHTML)\n @AreInterpreter.Update(AreHTMLInstructions.AddStaticHTML)\n addStaticHTML(\n @A_Inject(A_Caller) mutation: AddStaticHTMLInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${mutation.parent}\". Ensure the host element is rendered before materialising its static island.`\n });\n }\n\n const el = element as HTMLElement;\n const { html } = mutation.payload;\n\n // Clear any previously injected content (Update path) before re-injecting.\n el.textContent = '';\n\n // Parse once (in the host tag's context) and clone the cached fragment.\n const fragment = context.getStaticFragment(el.tagName.toLowerCase(), html);\n el.appendChild(fragment.cloneNode(true));\n\n logger?.debug('green', `Static island materialised onto <${(mutation.owner.parent ?? mutation.owner)?.aseid?.toString?.()}>`);\n }\n\n\n @A_Frame.Define({\n description: 'Clear a static island\\'s injected markup from its host element on revert.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddStaticHTML)\n removeStaticHTML(\n @A_Inject(A_Caller) mutation: AddStaticHTMLInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(mutation.parent!);\n\n if (element && element.nodeType === Node.ELEMENT_NODE && element.isConnected) {\n (element as HTMLElement).textContent = '';\n }\n }\n\n\n\n @A_Frame.Define({\n description: 'Add a comment node to the DOM based on the provided declaration instruction.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddComment)\n @AreInterpreter.Update(AreHTMLInstructions.AddComment)\n addComment(\n @A_Inject(A_Caller) declaration: AddCommentInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreStore) store: AreStore,\n @A_Inject(AreSyntax) syntax: AreSyntax,\n @A_Inject(AreDirectiveContext) directiveContext?: AreDirectiveContext,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ) {\n const node = declaration.owner.parent;\n const { content, evaluate } = declaration.payload;\n\n const rawValue = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\n\n const value = toDOMString(rawValue);\n\n\n if (!node) {\n const commentNode = context.container.createComment(value);\n context.container.body.appendChild(commentNode);\n context.setInstructionElement(declaration, commentNode);\n\n } else {\n const element = context.getNodeElement(node);\n\n if (!element) {\n throw new AreInterpreterError({\n title: 'Element Not Found',\n description: `Could not find a DOM element associated with the instruction ASEID \"${declaration.owner.parent.aseid}\". Ensure that the parent instruction is properly rendered and associated with a DOM element before applying attribute mutations.`\n });\n }\n\n const existingNode = context.getElementByInstruction(declaration);\n\n if (existingNode) {\n existingNode.textContent = value;\n } else {\n const commentNode = context.container.createComment(value);\n element.appendChild(commentNode);\n\n context.setInstructionElement(declaration, commentNode);\n }\n }\n\n\n\n logger?.debug('green', `Comment ${node?.aseid.toString()} added to Context:`);\n }\n\n\n @A_Frame.Define({\n description: 'Remove a comment node from the DOM based on the provided declaration instruction.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddComment)\n removeComment(\n @A_Inject(A_Caller) declaration: AddCommentInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ) {\n const element = context.getElementByInstruction(declaration);\n\n if (!element) return;\n\n // Off-document comment anchors are discarded with their detached parent\n // subtree; skip the removeChild and just release the index reference.\n if (element.isConnected) {\n element.parentNode?.removeChild(element);\n }\n context.removeInstructionElement(declaration);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddStyle — Apply / Update / Revert ───────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Define({\n description: 'Inject a <style> element into the document <head> carrying the component CSS. Keyed by instruction ASEID so multiple components with styles do not collide. Subsequent Update calls refresh the textContent in-place.'\n })\n @AreInterpreter.Apply(AreHTMLInstructions.AddStyle)\n @AreInterpreter.Update(AreHTMLInstructions.AddStyle)\n addStyle(\n @A_Inject(A_Caller) mutation: AddStyleInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ): void {\n try {\n\n\n const { styles } = mutation.payload;\n const styleId = `are-style-${String(mutation.aseid)}`;\n\n const existing = context.getElementByInstruction(mutation) as HTMLStyleElement | undefined;\n if (existing) {\n existing.textContent = styles;\n } else {\n const styleEl = context.container.createElement('style') as HTMLStyleElement;\n styleEl.setAttribute('data-are-id', styleId);\n styleEl.textContent = styles;\n (context.container.head ?? context.container.body).appendChild(styleEl);\n\n context.setInstructionElement(mutation, styleEl);\n logger?.debug('green', `Style injected for ${String(mutation.aseid)}`);\n }\n } catch (error) {\n logger?.error(error);\n }\n\n }\n\n @A_Frame.Define({\n description: 'Remove the <style> element that was injected by addStyle, cleaning up the document head.'\n })\n @AreInterpreter.Revert(AreHTMLInstructions.AddStyle)\n removeStyle(\n @A_Inject(A_Caller) mutation: AddStyleInstruction,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n ): void {\n const styleEl = context.getElementByInstruction(mutation);\n if (styleEl?.parentNode) {\n styleEl.parentNode.removeChild(styleEl);\n }\n context.removeInstructionElement(mutation);\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── SVG helpers ───────────────────────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n /**\n * Returns true when any ancestor of the given node has the tag `svg`,\n * meaning the node lives inside an SVG subtree and its DOM element must be\n * created via createElementNS(SVG_NAMESPACE, tag).\n */\n private isInSVGContext(node: AreHTMLNode): boolean {\n let current: AreHTMLNode | undefined = node.parent as AreHTMLNode | undefined;\n while (current) {\n if (current.tag === 'svg') return true;\n // <foreignObject> resets the namespace back to HTML\n if (current.tag === 'foreignobject') return false;\n current = current.parent as AreHTMLNode | undefined;\n }\n return false;\n }\n}"]}
@@ -1,7 +1,7 @@
1
1
  import { A_Scope, A_Feature } from '@adaas/a-concept';
2
2
  import { AreLifecycle, AreSignalsContext, AreScene } from '@adaas/are';
3
3
  import { A_Logger } from '@adaas/a-utils/a-logger';
4
- import { e as AreHTMLNode, b as AreDirectiveAttribute } from '../AreBinding.attribute-doUvtOjc.mjs';
4
+ import { e as AreHTMLNode, b as AreDirectiveAttribute } from '../AreBinding.attribute-BWzEIw6H.mjs';
5
5
  import { AreHTMLEngineContext } from './AreHTML.context.mjs';
6
6
  import '../lib/AreStyle/AreStyle.context.mjs';
7
7
  import './AreHTML.types.mjs';
@@ -19,7 +19,7 @@ declare class AreHTMLLifecycle extends AreLifecycle {
19
19
  /**
20
20
  * Node Content
21
21
  */
22
- scene: AreScene, logger?: A_Logger, ...args: any[]): void;
22
+ scene: AreScene, logger?: A_Logger, ...args: any[]): void | Promise<void>;
23
23
  updateDirectiveAttribute(directive: AreDirectiveAttribute, scope: A_Scope, feature: A_Feature, logger?: A_Logger, ...args: any[]): void;
24
24
  }
25
25
 
@@ -1,7 +1,7 @@
1
1
  import { A_Scope, A_Feature } from '@adaas/a-concept';
2
2
  import { AreLifecycle, AreSignalsContext, AreScene } from '@adaas/are';
3
3
  import { A_Logger } from '@adaas/a-utils/a-logger';
4
- import { e as AreHTMLNode, b as AreDirectiveAttribute } from '../AreBinding.attribute-Bm5LlOyE.js';
4
+ import { e as AreHTMLNode, b as AreDirectiveAttribute } from '../AreBinding.attribute-GpT-5Qmf.js';
5
5
  import { AreHTMLEngineContext } from './AreHTML.context.js';
6
6
  import '../lib/AreStyle/AreStyle.context.js';
7
7
  import './AreHTML.types.js';
@@ -19,7 +19,7 @@ declare class AreHTMLLifecycle extends AreLifecycle {
19
19
  /**
20
20
  * Node Content
21
21
  */
22
- scene: AreScene, logger?: A_Logger, ...args: any[]): void;
22
+ scene: AreScene, logger?: A_Logger, ...args: any[]): void | Promise<void>;
23
23
  updateDirectiveAttribute(directive: AreDirectiveAttribute, scope: A_Scope, feature: A_Feature, logger?: A_Logger, ...args: any[]): void;
24
24
  }
25
25
 
@@ -45,10 +45,38 @@ exports.AreHTMLLifecycle = class AreHTMLLifecycle extends are.AreLifecycle {
45
45
  mount(node, scene, logger, ...args) {
46
46
  logger?.debug(`[Mount] Component Trigger for <${node.aseid.entity}> with aseid :{${node.aseid.toString()}}`);
47
47
  if (scene.isInactive) return;
48
- node.interpret();
49
- for (let i = 0; i < node.children.length; i++) {
50
- const child = node.children[i];
51
- child.mount();
48
+ const context = node.scope.resolve(AreHTML_context.AreHTMLEngineContext);
49
+ context?.beginBatch();
50
+ const afterMountQueue = [];
51
+ try {
52
+ node.interpret();
53
+ const stack = [];
54
+ for (let i = node.children.length - 1; i >= 0; i--) {
55
+ stack.push({ node: node.children[i], entered: false });
56
+ }
57
+ while (stack.length > 0) {
58
+ const frame = stack[stack.length - 1];
59
+ const current = frame.node;
60
+ if (frame.entered) {
61
+ stack.pop();
62
+ afterMountQueue.push(current);
63
+ continue;
64
+ }
65
+ frame.entered = true;
66
+ current.call(are.AreNodeFeatures.onBeforeMount, current.scope);
67
+ if (!current.scene.isInactive) {
68
+ current.interpret();
69
+ for (let i = current.children.length - 1; i >= 0; i--) {
70
+ stack.push({ node: current.children[i], entered: false });
71
+ }
72
+ }
73
+ }
74
+ } finally {
75
+ context?.endBatch();
76
+ }
77
+ for (let i = 0; i < afterMountQueue.length; i++) {
78
+ const mounted = afterMountQueue[i];
79
+ mounted.call(are.AreNodeFeatures.onAfterMount, mounted.scope);
52
80
  }
53
81
  }
54
82
  updateDirectiveAttribute(directive, scope, feature, logger, ...args) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/engine/AreHTML.lifecycle.ts"],"names":["AreHTMLLifecycle","AreLifecycle","AreScene","AreDirectiveFeatures","A_FormatterHelper","AreComponentNode","A_Caller","A_Scope","AreHTMLEngineContext","AreSignalsContext","A_Logger","AreRootNode","AreText","AreInterpolation","A_Feature","AreNodeFeatures","AreHTMLNode","AreAttributeFeatures","AreDirectiveAttribute","A_Frame"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBaA,wBAAA,GAAN,+BAA+BC,gBAAA,CAAa;AAAA,EAG/C,cACwB,IAAA,EACD,KAAA,EACa,OAAA,EACH,cAAA,EACT,WACjB,IAAA,EACC;AAEJ,IAAA,IAAI,IAAA,CAAK,SAAA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BAAA,EAAA,CAAA,CAAA;AAvGSA,wBAAA,GAAN,eAAA,CAAA;AAAA,EAJNmB,aAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYnB,wBAAA,CAAA","file":"AreHTML.lifecycle.js","sourcesContent":["import { A_Caller, A_Feature, A_FormatterHelper, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { AreLifecycle, AreScene, AreAttributeFeatures, AreSignalsContext, AreNodeFeatures, AreFeatures } from \"@adaas/are\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport { AreComponentNode } from \"@adaas/are-html/nodes/AreComponent\";\nimport { AreRootNode } from \"@adaas/are-html/nodes/AreRoot\";\nimport { AreInterpolation } from \"@adaas/are-html/nodes/AreInterpolation\";\nimport { AreText } from \"@adaas/are-html/nodes/AreText\";\nimport { AreDirectiveAttribute } from \"@adaas/are-html/attributes/AreDirective.attribute\";\nimport { AreDirectiveFeatures } from \"@adaas/are-html/directive/AreDirective.constants\";\nimport { AreHTMLEngineContext } from \"./AreHTML.context\";\nimport { AreHTMLNode } from \"../lib/AreHTMLNode/AreHTMLNode\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'HTML-specific lifecycle handler extending AreLifecycle. Wires DOM-aware init hooks for component nodes, root nodes, interpolations, text nodes, and directive attributes to the ARE rendering pipeline, connecting each entity to its HTML engine context and priming the scene for subsequent compilation and interpretation.'\n})\nexport class AreHTMLLifecycle extends AreLifecycle {\n\n @AreLifecycle.Init(AreComponentNode)\n initComponent(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n\n if (node.component)\n signalsContext?.subscribe(node);\n\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreRootNode)\n initRoot(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n signalsContext?.subscribe(node);\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreText)\n initText(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n\n @AreLifecycle.Init(AreInterpolation)\n initInterpolation(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n @A_Feature.Extend({\n name: AreNodeFeatures.onMount,\n scope: [AreHTMLNode]\n })\n mount(\n /**\n * Node to be mounted\n */\n @A_Inject(A_Caller) node: AreHTMLNode,\n /**\n * Node Content\n */\n @A_Inject(AreScene) scene: AreScene,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n\n logger?.debug(`[Mount] Component Trigger for <${node.aseid.entity}> with aseid :{${node.aseid.toString()}}`);\n\n /**\n * Skip mounting nodes whose scene has been deactivated (e.g. $if template nodes\n * when the condition is false). Mirrors the guard in AreLifecycle.mount.\n */\n if (scene.isInactive) return;\n\n /**\n * 1. We should simply run and render node itself.\n */\n node.interpret();\n /**\n * 2. Then go through all children of the node and mount the.\n */\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n child.mount();\n }\n }\n\n @A_Feature.Extend({\n name: AreAttributeFeatures.Update,\n scope: [AreDirectiveAttribute],\n })\n updateDirectiveAttribute(\n @A_Inject(A_Caller) directive: AreDirectiveAttribute,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(A_Feature) feature: A_Feature,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n /**\n * 3. If the attribute is a directive, then we should find a component that is responsible for\n * the directive compiling logic, and call it. \n * In case component is not found we just want to log a warning, \n * since the directive may be handled by some parent component or simply is a mistake in the template.\n */\n if (directive.component) {\n feature.chain(directive.component, AreDirectiveFeatures.Update, directive.owner.scope);\n } else {\n logger?.warning(`Directive handler component not found for directive: ${directive.name}. Make sure to create a component named \"AreDirective${A_FormatterHelper.toPascalCase(directive.name)}\" to handle this directive.`);\n }\n }\n\n}"]}
1
+ {"version":3,"sources":["../../../src/engine/AreHTML.lifecycle.ts"],"names":["AreHTMLLifecycle","AreLifecycle","AreScene","AreHTMLEngineContext","AreNodeFeatures","AreDirectiveFeatures","A_FormatterHelper","AreComponentNode","A_Caller","A_Scope","AreSignalsContext","A_Logger","AreRootNode","AreText","AreInterpolation","A_Feature","AreHTMLNode","AreAttributeFeatures","AreDirectiveAttribute","A_Frame"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBaA,wBAAA,GAAN,+BAA+BC,gBAAA,CAAa;AAAA,EAG/C,cACwB,IAAA,EACD,KAAA,EACa,OAAA,EACH,cAAA,EACT,WACjB,IAAA,EACC;AAEJ,IAAA,IAAI,IAAA,CAAK,SAAA;AACL,MAAA,cAAA,EAAgB,UAAU,IAAI,CAAA;AAElC,IAAA,KAAA,CAAM,KAAK,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,GAAG,IAAI,CAAA;AAAA,EACpD;AAAA,EAIA,SACwB,IAAA,EACD,KAAA,EACa,OAAA,EAC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JNmB,aAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYnB,wBAAA,CAAA","file":"AreHTML.lifecycle.js","sourcesContent":["import { A_Caller, A_Feature, A_FormatterHelper, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { AreLifecycle, AreScene, AreAttributeFeatures, AreSignalsContext, AreNodeFeatures, AreFeatures } from \"@adaas/are\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport { AreComponentNode } from \"@adaas/are-html/nodes/AreComponent\";\nimport { AreRootNode } from \"@adaas/are-html/nodes/AreRoot\";\nimport { AreInterpolation } from \"@adaas/are-html/nodes/AreInterpolation\";\nimport { AreText } from \"@adaas/are-html/nodes/AreText\";\nimport { AreDirectiveAttribute } from \"@adaas/are-html/attributes/AreDirective.attribute\";\nimport { AreDirectiveFeatures } from \"@adaas/are-html/directive/AreDirective.constants\";\nimport { AreHTMLEngineContext } from \"./AreHTML.context\";\nimport { AreHTMLNode } from \"../lib/AreHTMLNode/AreHTMLNode\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'HTML-specific lifecycle handler extending AreLifecycle. Wires DOM-aware init hooks for component nodes, root nodes, interpolations, text nodes, and directive attributes to the ARE rendering pipeline, connecting each entity to its HTML engine context and priming the scene for subsequent compilation and interpretation.'\n})\nexport class AreHTMLLifecycle extends AreLifecycle {\n\n @AreLifecycle.Init(AreComponentNode)\n initComponent(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n\n if (node.component)\n signalsContext?.subscribe(node);\n\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreRootNode)\n initRoot(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n signalsContext?.subscribe(node);\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreText)\n initText(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n\n @AreLifecycle.Init(AreInterpolation)\n initInterpolation(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n @A_Feature.Extend({\n name: AreNodeFeatures.onMount,\n scope: [AreHTMLNode]\n })\n mount(\n /**\n * Node to be mounted\n */\n @A_Inject(A_Caller) node: AreHTMLNode,\n /**\n * Node Content\n */\n @A_Inject(AreScene) scene: AreScene,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void | Promise<void> {\n\n logger?.debug(`[Mount] Component Trigger for <${node.aseid.entity}> with aseid :{${node.aseid.toString()}}`);\n\n /**\n * Skip mounting nodes whose scene has been deactivated (e.g. $if template nodes\n * when the condition is false). Mirrors the guard in AreLifecycle.mount.\n */\n if (scene.isInactive) return;\n\n /**\n * Open a batching scope for the whole (synchronous) mount pass. Every\n * element created below is built into a *detached* root and attached to\n * the live DOM only when the batch flushes — turning O(nodes) reflows into\n * a single one per mount root. `try/finally` guarantees the batch closes\n * (and the depth counter stays balanced) even if interpretation throws.\n *\n * The context is resolved from the node's scope (the scope the onMount\n * feature runs in) so the override keeps the base `mount` signature.\n */\n const context = node.scope.resolve<AreHTMLEngineContext>(AreHTMLEngineContext);\n\n context?.beginBatch();\n\n /**\n * `onAfterMount` must observe the node already connected to the live\n * document (consumer components may measure layout / focus there). Since\n * the subtree is built off-document and attached only when the batch\n * flushes, we collect the post-order `onAfterMount` targets here and fire\n * them once the flush has connected everything.\n */\n const afterMountQueue: AreHTMLNode[] = [];\n\n try {\n /**\n * 1. Render the root of this mount itself.\n */\n node.interpret();\n\n /**\n * 2. Walk the descendant subtree iteratively with an explicit enter/exit\n * stack. We keep the iterative (non-recursive) shape — it is cheaper\n * than deep recursion and gives us a single, clear place that owns the\n * per-node hook ordering:\n * - enter → onBeforeMount, then (if active) interpret + queue children\n * - exit → onAfterMount (fires AFTER the node's whole subtree, i.e.\n * post-order, matching the recursive `node.mount()` contract)\n *\n * [!] The initial mount is intentionally ATOMIC (fully synchronous). It\n * does NOT time-slice / yield. Yielding mid-walk exposes a partially\n * mounted tree to the event loop: any update dispatched during a gap\n * (signal-driven re-render, async data load, etc.) interprets a node\n * whose parent has not been mounted yet — producing\n * `mount-point-not-found` and out-of-order DOM. The whole page must\n * therefore appear in the DOM in one uninterrupted pass. Heavy lists\n * are sliced at the source instead (see AreDirectiveFor), where the\n * batching is reentrancy-safe.\n */\n interface MountFrame { node: AreHTMLNode; entered: boolean; }\n\n const stack: MountFrame[] = [];\n for (let i = node.children.length - 1; i >= 0; i--) {\n stack.push({ node: node.children[i] as AreHTMLNode, entered: false });\n }\n\n while (stack.length > 0) {\n const frame = stack[stack.length - 1];\n const current = frame.node;\n\n if (frame.entered) {\n // Post-order exit: the whole subtree below `current` is mounted.\n // Defer the onAfterMount hook until after the batch flush so the\n // node is connected to the live DOM when it runs.\n stack.pop();\n afterMountQueue.push(current);\n continue;\n }\n\n frame.entered = true;\n\n // onBeforeMount always fires (even for inactive nodes), matching the\n // recursive AreNode.mount() semantics.\n current.call(AreNodeFeatures.onBeforeMount, current.scope);\n\n if (!current.scene.isInactive) {\n current.interpret();\n // Push children in reverse so they pop in document order.\n for (let i = current.children.length - 1; i >= 0; i--) {\n stack.push({ node: current.children[i] as AreHTMLNode, entered: false });\n }\n }\n }\n } finally {\n // Flush the deferred attachments — the fully built subtree lands in the\n // live DOM in a single pass.\n context?.endBatch();\n }\n\n // The subtree is now connected; fire onAfterMount in the original\n // post-order, each with its node live in the document.\n for (let i = 0; i < afterMountQueue.length; i++) {\n const mounted = afterMountQueue[i];\n mounted.call(AreNodeFeatures.onAfterMount, mounted.scope);\n }\n }\n\n\n @A_Feature.Extend({\n name: AreAttributeFeatures.Update,\n scope: [AreDirectiveAttribute],\n })\n updateDirectiveAttribute(\n @A_Inject(A_Caller) directive: AreDirectiveAttribute,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(A_Feature) feature: A_Feature,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n /**\n * 3. If the attribute is a directive, then we should find a component that is responsible for\n * the directive compiling logic, and call it. \n * In case component is not found we just want to log a warning, \n * since the directive may be handled by some parent component or simply is a mistake in the template.\n */\n if (directive.component) {\n feature.chain(directive.component, AreDirectiveFeatures.Update, directive.owner.scope);\n } else {\n logger?.warning(`Directive handler component not found for directive: ${directive.name}. Make sure to create a component named \"AreDirective${A_FormatterHelper.toPascalCase(directive.name)}\" to handle this directive.`);\n }\n }\n\n}"]}
@@ -33,10 +33,38 @@ let AreHTMLLifecycle = class extends AreLifecycle {
33
33
  mount(node, scene, logger, ...args) {
34
34
  logger?.debug(`[Mount] Component Trigger for <${node.aseid.entity}> with aseid :{${node.aseid.toString()}}`);
35
35
  if (scene.isInactive) return;
36
- node.interpret();
37
- for (let i = 0; i < node.children.length; i++) {
38
- const child = node.children[i];
39
- child.mount();
36
+ const context = node.scope.resolve(AreHTMLEngineContext);
37
+ context?.beginBatch();
38
+ const afterMountQueue = [];
39
+ try {
40
+ node.interpret();
41
+ const stack = [];
42
+ for (let i = node.children.length - 1; i >= 0; i--) {
43
+ stack.push({ node: node.children[i], entered: false });
44
+ }
45
+ while (stack.length > 0) {
46
+ const frame = stack[stack.length - 1];
47
+ const current = frame.node;
48
+ if (frame.entered) {
49
+ stack.pop();
50
+ afterMountQueue.push(current);
51
+ continue;
52
+ }
53
+ frame.entered = true;
54
+ current.call(AreNodeFeatures.onBeforeMount, current.scope);
55
+ if (!current.scene.isInactive) {
56
+ current.interpret();
57
+ for (let i = current.children.length - 1; i >= 0; i--) {
58
+ stack.push({ node: current.children[i], entered: false });
59
+ }
60
+ }
61
+ }
62
+ } finally {
63
+ context?.endBatch();
64
+ }
65
+ for (let i = 0; i < afterMountQueue.length; i++) {
66
+ const mounted = afterMountQueue[i];
67
+ mounted.call(AreNodeFeatures.onAfterMount, mounted.scope);
40
68
  }
41
69
  }
42
70
  updateDirectiveAttribute(directive, scope, feature, logger, ...args) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/engine/AreHTML.lifecycle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAkBO,IAAM,gBAAA,GAAN,cAA+B,YAAA,CAAa;AAAA,EAG/C,cACwB,IAAA,EACD,KAAA,EACa,OAAA,EACH,cAAA,EACT,WACjB,IAAA,EACC;AAEJ,IAAA,IAAI,IAAA,CAAK,SAAA;AACL,MAAA,cAAA,EAAgB,UAAU,IAAI,CAAA;AAElC,IAAA,KAAA,CAAM,KAAK,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,GAAG,IAAI,CAAA;AAAA,EACpD;AAAA,EAIA,SACwB,IAAA,EACD,KAAA,EACa,OAAA,EACH,cAAA,EACT,WACjB,IAAA,EACC;AACJ,IAAA,cAAA,EAAgB,UAAU,IAAI,CAAA;AAC9B,IAAA,KAAA,CAAM,KAAK,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,GAAG,IAAI,CAAA;AAAA,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,4BAAS,oBAAoB,CAAA,CAAA;AAAA,EAC7B,4BAAS,QAAQ,CAAA;AAAA,CAAA,EApDb,gBAAA,CAgDT,SAAA,EAAA,mBAAA,EAAA,CAAA,CAAA;AAgBA,eAAA,CAAA;AAAA,EAJC,UAAU,MAAA,CAAO;AAAA,IACd,MAAM,eAAA,CAAgB,OAAA;AAAA,IACtB,KAAA,EAAO,CAAC,WAAW;AAAA,GACtB,CAAA;AAAA,EAKI,4BAAS,QAAQ,CAAA,CAAA;AAAA,EAIjB,4BAAS,QAAQ,CAAA,CAAA;AAAA,EAEjB,4BAAS,QAAQ,CAAA;AAAA,CAAA,EA1Eb,gBAAA,CAgET,SAAA,EAAA,OAAA,EAAA,CAAA,CAAA;AAuCA,eAAA,CAAA;AAAA,EAJC,UAAU,MAAA,CAAO;AAAA,IACd,MAAM,oBAAA,CAAqB,MAAA;AAAA,IAC3B,KAAA,EAAO,CAAC,qBAAqB;AAAA,GAChC,CAAA;AAAA,EAEI,4BAAS,QAAQ,CAAA,CAAA;AAAA,EACjB,4BAAS,OAAO,CAAA,CAAA;AAAA,EAChB,4BAAS,SAAS,CAAA,CAAA;AAAA,EAClB,4BAAS,QAAQ,CAAA;AAAA,CAAA,EA3Gb,gBAAA,CAuGT,SAAA,EAAA,0BAAA,EAAA,CAAA,CAAA;AAvGS,gBAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,gBAAA,CAAA","file":"AreHTML.lifecycle.mjs","sourcesContent":["import { A_Caller, A_Feature, A_FormatterHelper, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { AreLifecycle, AreScene, AreAttributeFeatures, AreSignalsContext, AreNodeFeatures, AreFeatures } from \"@adaas/are\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport { AreComponentNode } from \"@adaas/are-html/nodes/AreComponent\";\nimport { AreRootNode } from \"@adaas/are-html/nodes/AreRoot\";\nimport { AreInterpolation } from \"@adaas/are-html/nodes/AreInterpolation\";\nimport { AreText } from \"@adaas/are-html/nodes/AreText\";\nimport { AreDirectiveAttribute } from \"@adaas/are-html/attributes/AreDirective.attribute\";\nimport { AreDirectiveFeatures } from \"@adaas/are-html/directive/AreDirective.constants\";\nimport { AreHTMLEngineContext } from \"./AreHTML.context\";\nimport { AreHTMLNode } from \"../lib/AreHTMLNode/AreHTMLNode\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'HTML-specific lifecycle handler extending AreLifecycle. Wires DOM-aware init hooks for component nodes, root nodes, interpolations, text nodes, and directive attributes to the ARE rendering pipeline, connecting each entity to its HTML engine context and priming the scene for subsequent compilation and interpretation.'\n})\nexport class AreHTMLLifecycle extends AreLifecycle {\n\n @AreLifecycle.Init(AreComponentNode)\n initComponent(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n\n if (node.component)\n signalsContext?.subscribe(node);\n\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreRootNode)\n initRoot(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n signalsContext?.subscribe(node);\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreText)\n initText(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n\n @AreLifecycle.Init(AreInterpolation)\n initInterpolation(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n @A_Feature.Extend({\n name: AreNodeFeatures.onMount,\n scope: [AreHTMLNode]\n })\n mount(\n /**\n * Node to be mounted\n */\n @A_Inject(A_Caller) node: AreHTMLNode,\n /**\n * Node Content\n */\n @A_Inject(AreScene) scene: AreScene,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n\n logger?.debug(`[Mount] Component Trigger for <${node.aseid.entity}> with aseid :{${node.aseid.toString()}}`);\n\n /**\n * Skip mounting nodes whose scene has been deactivated (e.g. $if template nodes\n * when the condition is false). Mirrors the guard in AreLifecycle.mount.\n */\n if (scene.isInactive) return;\n\n /**\n * 1. We should simply run and render node itself.\n */\n node.interpret();\n /**\n * 2. Then go through all children of the node and mount the.\n */\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n child.mount();\n }\n }\n\n @A_Feature.Extend({\n name: AreAttributeFeatures.Update,\n scope: [AreDirectiveAttribute],\n })\n updateDirectiveAttribute(\n @A_Inject(A_Caller) directive: AreDirectiveAttribute,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(A_Feature) feature: A_Feature,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n /**\n * 3. If the attribute is a directive, then we should find a component that is responsible for\n * the directive compiling logic, and call it. \n * In case component is not found we just want to log a warning, \n * since the directive may be handled by some parent component or simply is a mistake in the template.\n */\n if (directive.component) {\n feature.chain(directive.component, AreDirectiveFeatures.Update, directive.owner.scope);\n } else {\n logger?.warning(`Directive handler component not found for directive: ${directive.name}. Make sure to create a component named \"AreDirective${A_FormatterHelper.toPascalCase(directive.name)}\" to handle this directive.`);\n }\n }\n\n}"]}
1
+ {"version":3,"sources":["../../../src/engine/AreHTML.lifecycle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAkBO,IAAM,gBAAA,GAAN,cAA+B,YAAA,CAAa;AAAA,EAG/C,cACwB,IAAA,EACD,KAAA,EACa,OAAA,EACH,cAAA,EACT,WACjB,IAAA,EACC;AAEJ,IAAA,IAAI,IAAA,CAAK,SAAA;AACL,MAAA,cAAA,EAAgB,UAAU,IAAI,CAAA;AAElC,IAAA,KAAA,CAAM,KAAK,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,GAAG,IAAI,CAAA;AAAA,EACpD;AAAA,EAIA,SACwB,IAAA,EACD,KAAA,EACa,OAAA,EACH,cAAA,EACT,WACjB,IAAA,EACC;AACJ,IAAA,cAAA,EAAgB,UAAU,IAAI,CAAA;AAC9B,IAAA,KAAA,CAAM,KAAK,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,GAAG,IAAI,CAAA;AAAA,EACpD;AAAA,EAIA,QAAA,CACwB,IAAA,EACD,KAAA,EACa,OAAA,EACZ,WACjB,IAAA,EACC;AACJ,IAAA,MAAM,KAAA,GAAQ,IAAI,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAErC,IAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAAA,EACxB;AAAA,EAIA,iBAAA,CACwB,IAAA,EACD,KAAA,EACa,OAAA,EACZ,WACjB,IAAA,EACC;AACJ,IAAA,MAAM,KAAA,GAAQ,IAAI,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAErC,IAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AAAA,EACxB;AAAA,EAMA,KAAA,CAIwB,IAAA,EAIA,KAAA,EAEA,MAAA,EAAA,GACjB,I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AAAA,EAEjB,4BAAS,QAAQ,CAAA;AAAA,CAAA,EA1Eb,gBAAA,CAgET,SAAA,EAAA,OAAA,EAAA,CAAA,CAAA;AA2HA,eAAA,CAAA;AAAA,EAJC,UAAU,MAAA,CAAO;AAAA,IACd,MAAM,oBAAA,CAAqB,MAAA;AAAA,IAC3B,KAAA,EAAO,CAAC,qBAAqB;AAAA,GAChC,CAAA;AAAA,EAEI,4BAAS,QAAQ,CAAA,CAAA;AAAA,EACjB,4BAAS,OAAO,CAAA,CAAA;AAAA,EAChB,4BAAS,SAAS,CAAA,CAAA;AAAA,EAClB,4BAAS,QAAQ,CAAA;AAAA,CAAA,EA/Lb,gBAAA,CA2LT,SAAA,EAAA,0BAAA,EAAA,CAAA,CAAA;AA3LS,gBAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,gBAAA,CAAA","file":"AreHTML.lifecycle.mjs","sourcesContent":["import { A_Caller, A_Feature, A_FormatterHelper, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { AreLifecycle, AreScene, AreAttributeFeatures, AreSignalsContext, AreNodeFeatures, AreFeatures } from \"@adaas/are\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport { AreComponentNode } from \"@adaas/are-html/nodes/AreComponent\";\nimport { AreRootNode } from \"@adaas/are-html/nodes/AreRoot\";\nimport { AreInterpolation } from \"@adaas/are-html/nodes/AreInterpolation\";\nimport { AreText } from \"@adaas/are-html/nodes/AreText\";\nimport { AreDirectiveAttribute } from \"@adaas/are-html/attributes/AreDirective.attribute\";\nimport { AreDirectiveFeatures } from \"@adaas/are-html/directive/AreDirective.constants\";\nimport { AreHTMLEngineContext } from \"./AreHTML.context\";\nimport { AreHTMLNode } from \"../lib/AreHTMLNode/AreHTMLNode\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'HTML-specific lifecycle handler extending AreLifecycle. Wires DOM-aware init hooks for component nodes, root nodes, interpolations, text nodes, and directive attributes to the ARE rendering pipeline, connecting each entity to its HTML engine context and priming the scene for subsequent compilation and interpretation.'\n})\nexport class AreHTMLLifecycle extends AreLifecycle {\n\n @AreLifecycle.Init(AreComponentNode)\n initComponent(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n\n if (node.component)\n signalsContext?.subscribe(node);\n\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreRootNode)\n initRoot(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(AreSignalsContext) signalsContext?: AreSignalsContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n signalsContext?.subscribe(node);\n super.init(node, scope, context, logger, ...args);\n }\n\n\n @AreLifecycle.Init(AreText)\n initText(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n\n @AreLifecycle.Init(AreInterpolation)\n initInterpolation(\n @A_Inject(A_Caller) node: AreHTMLNode,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(AreHTMLEngineContext) context: AreHTMLEngineContext,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void {\n const scene = new AreScene(node.aseid);\n\n scope.register(scene);\n }\n\n @A_Feature.Extend({\n name: AreNodeFeatures.onMount,\n scope: [AreHTMLNode]\n })\n mount(\n /**\n * Node to be mounted\n */\n @A_Inject(A_Caller) node: AreHTMLNode,\n /**\n * Node Content\n */\n @A_Inject(AreScene) scene: AreScene,\n\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ): void | Promise<void> {\n\n logger?.debug(`[Mount] Component Trigger for <${node.aseid.entity}> with aseid :{${node.aseid.toString()}}`);\n\n /**\n * Skip mounting nodes whose scene has been deactivated (e.g. $if template nodes\n * when the condition is false). Mirrors the guard in AreLifecycle.mount.\n */\n if (scene.isInactive) return;\n\n /**\n * Open a batching scope for the whole (synchronous) mount pass. Every\n * element created below is built into a *detached* root and attached to\n * the live DOM only when the batch flushes — turning O(nodes) reflows into\n * a single one per mount root. `try/finally` guarantees the batch closes\n * (and the depth counter stays balanced) even if interpretation throws.\n *\n * The context is resolved from the node's scope (the scope the onMount\n * feature runs in) so the override keeps the base `mount` signature.\n */\n const context = node.scope.resolve<AreHTMLEngineContext>(AreHTMLEngineContext);\n\n context?.beginBatch();\n\n /**\n * `onAfterMount` must observe the node already connected to the live\n * document (consumer components may measure layout / focus there). Since\n * the subtree is built off-document and attached only when the batch\n * flushes, we collect the post-order `onAfterMount` targets here and fire\n * them once the flush has connected everything.\n */\n const afterMountQueue: AreHTMLNode[] = [];\n\n try {\n /**\n * 1. Render the root of this mount itself.\n */\n node.interpret();\n\n /**\n * 2. Walk the descendant subtree iteratively with an explicit enter/exit\n * stack. We keep the iterative (non-recursive) shape — it is cheaper\n * than deep recursion and gives us a single, clear place that owns the\n * per-node hook ordering:\n * - enter → onBeforeMount, then (if active) interpret + queue children\n * - exit → onAfterMount (fires AFTER the node's whole subtree, i.e.\n * post-order, matching the recursive `node.mount()` contract)\n *\n * [!] The initial mount is intentionally ATOMIC (fully synchronous). It\n * does NOT time-slice / yield. Yielding mid-walk exposes a partially\n * mounted tree to the event loop: any update dispatched during a gap\n * (signal-driven re-render, async data load, etc.) interprets a node\n * whose parent has not been mounted yet — producing\n * `mount-point-not-found` and out-of-order DOM. The whole page must\n * therefore appear in the DOM in one uninterrupted pass. Heavy lists\n * are sliced at the source instead (see AreDirectiveFor), where the\n * batching is reentrancy-safe.\n */\n interface MountFrame { node: AreHTMLNode; entered: boolean; }\n\n const stack: MountFrame[] = [];\n for (let i = node.children.length - 1; i >= 0; i--) {\n stack.push({ node: node.children[i] as AreHTMLNode, entered: false });\n }\n\n while (stack.length > 0) {\n const frame = stack[stack.length - 1];\n const current = frame.node;\n\n if (frame.entered) {\n // Post-order exit: the whole subtree below `current` is mounted.\n // Defer the onAfterMount hook until after the batch flush so the\n // node is connected to the live DOM when it runs.\n stack.pop();\n afterMountQueue.push(current);\n continue;\n }\n\n frame.entered = true;\n\n // onBeforeMount always fires (even for inactive nodes), matching the\n // recursive AreNode.mount() semantics.\n current.call(AreNodeFeatures.onBeforeMount, current.scope);\n\n if (!current.scene.isInactive) {\n current.interpret();\n // Push children in reverse so they pop in document order.\n for (let i = current.children.length - 1; i >= 0; i--) {\n stack.push({ node: current.children[i] as AreHTMLNode, entered: false });\n }\n }\n }\n } finally {\n // Flush the deferred attachments — the fully built subtree lands in the\n // live DOM in a single pass.\n context?.endBatch();\n }\n\n // The subtree is now connected; fire onAfterMount in the original\n // post-order, each with its node live in the document.\n for (let i = 0; i < afterMountQueue.length; i++) {\n const mounted = afterMountQueue[i];\n mounted.call(AreNodeFeatures.onAfterMount, mounted.scope);\n }\n }\n\n\n @A_Feature.Extend({\n name: AreAttributeFeatures.Update,\n scope: [AreDirectiveAttribute],\n })\n updateDirectiveAttribute(\n @A_Inject(A_Caller) directive: AreDirectiveAttribute,\n @A_Inject(A_Scope) scope: A_Scope,\n @A_Inject(A_Feature) feature: A_Feature,\n @A_Inject(A_Logger) logger?: A_Logger,\n ...args: any[]\n ) {\n /**\n * 3. If the attribute is a directive, then we should find a component that is responsible for\n * the directive compiling logic, and call it. \n * In case component is not found we just want to log a warning, \n * since the directive may be handled by some parent component or simply is a mistake in the template.\n */\n if (directive.component) {\n feature.chain(directive.component, AreDirectiveFeatures.Update, directive.owner.scope);\n } else {\n logger?.warning(`Directive handler component not found for directive: ${directive.name}. Make sure to create a component named \"AreDirective${A_FormatterHelper.toPascalCase(directive.name)}\" to handle this directive.`);\n }\n }\n\n}"]}
@@ -1,6 +1,6 @@
1
1
  import { A_Logger } from '@adaas/a-utils/a-logger';
2
2
  import { AreTokenizer, AreNode, AreContext } from '@adaas/are';
3
- import { d as AreHTMLAttribute } from '../AreBinding.attribute-doUvtOjc.mjs';
3
+ import { d as AreHTMLAttribute } from '../AreBinding.attribute-BWzEIw6H.mjs';
4
4
  import '@adaas/a-concept';
5
5
  import '../lib/AreStyle/AreStyle.context.mjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { A_Logger } from '@adaas/a-utils/a-logger';
2
2
  import { AreTokenizer, AreNode, AreContext } from '@adaas/are';
3
- import { d as AreHTMLAttribute } from '../AreBinding.attribute-Bm5LlOyE.js';
3
+ import { d as AreHTMLAttribute } from '../AreBinding.attribute-GpT-5Qmf.js';
4
4
  import '@adaas/a-concept';
5
5
  import '../lib/AreStyle/AreStyle.context.js';
6
6
 
@@ -9,6 +9,7 @@ var AreDirective_attribute = require('@adaas/are-html/attributes/AreDirective.at
9
9
  var AreEvent_attribute = require('@adaas/are-html/attributes/AreEvent.attribute');
10
10
  var AreBinding_attribute = require('@adaas/are-html/attributes/AreBinding.attribute');
11
11
  var AreStatic_attribute = require('@adaas/are-html/attributes/AreStatic.attribute');
12
+ var AreHTML_constants = require('./AreHTML.constants');
12
13
  var core = require('@adaas/a-frame/core');
13
14
 
14
15
  var __defProp = Object.defineProperty;
@@ -28,7 +29,12 @@ exports.AreHTMLTokenizer = class AreHTMLTokenizer extends are.AreTokenizer {
28
29
  this.ATTR_PATTERN = /([$:@]?[\w.-]+(?::[\w.-]+)?)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>/"'=]+)))?/g;
29
30
  }
30
31
  tokenize(node, context, logger) {
31
- super.tokenize(node, context, logger);
32
+ const isStaticIsland = node instanceof AreComponent.AreComponentNode && !!node.content && AreHTML_constants.isStaticMarkup(node.content);
33
+ if (isStaticIsland) {
34
+ node.markStatic(node.content);
35
+ } else {
36
+ super.tokenize(node, context, logger);
37
+ }
32
38
  context.startPerformance("attributeExtraction");
33
39
  const attributes = this.extractAttributes(node.markup);
34
40
  for (const attr of attributes) {