@adaas/are-html 0.0.2 → 0.0.4

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 (200) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/index.d.mts +88 -5
  3. package/dist/browser/index.mjs +542 -176
  4. package/dist/browser/index.mjs.map +1 -1
  5. package/dist/node/attributes/AreBinding.attribute.js +17 -4
  6. package/dist/node/attributes/AreBinding.attribute.js.map +1 -1
  7. package/dist/node/attributes/AreBinding.attribute.mjs +10 -3
  8. package/dist/node/attributes/AreBinding.attribute.mjs.map +1 -1
  9. package/dist/node/attributes/AreDirective.attribute.js +17 -4
  10. package/dist/node/attributes/AreDirective.attribute.js.map +1 -1
  11. package/dist/node/attributes/AreDirective.attribute.mjs +10 -3
  12. package/dist/node/attributes/AreDirective.attribute.mjs.map +1 -1
  13. package/dist/node/attributes/AreEvent.attribute.js +17 -4
  14. package/dist/node/attributes/AreEvent.attribute.js.map +1 -1
  15. package/dist/node/attributes/AreEvent.attribute.mjs +10 -3
  16. package/dist/node/attributes/AreEvent.attribute.mjs.map +1 -1
  17. package/dist/node/attributes/AreStatic.attribute.js +17 -4
  18. package/dist/node/attributes/AreStatic.attribute.js.map +1 -1
  19. package/dist/node/attributes/AreStatic.attribute.mjs +10 -3
  20. package/dist/node/attributes/AreStatic.attribute.mjs.map +1 -1
  21. package/dist/node/directives/AreDirectiveFor.directive.d.mts +8 -0
  22. package/dist/node/directives/AreDirectiveFor.directive.d.ts +8 -0
  23. package/dist/node/directives/AreDirectiveFor.directive.js +78 -33
  24. package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -1
  25. package/dist/node/directives/AreDirectiveFor.directive.mjs +78 -33
  26. package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -1
  27. package/dist/node/directives/AreDirectiveIf.directive.d.mts +18 -0
  28. package/dist/node/directives/AreDirectiveIf.directive.d.ts +18 -0
  29. package/dist/node/directives/AreDirectiveIf.directive.js +10 -3
  30. package/dist/node/directives/AreDirectiveIf.directive.js.map +1 -1
  31. package/dist/node/directives/AreDirectiveIf.directive.mjs +10 -3
  32. package/dist/node/directives/AreDirectiveIf.directive.mjs.map +1 -1
  33. package/dist/node/engine/AreHTML.compiler.d.mts +2 -2
  34. package/dist/node/engine/AreHTML.compiler.d.ts +2 -2
  35. package/dist/node/engine/AreHTML.compiler.js +57 -29
  36. package/dist/node/engine/AreHTML.compiler.js.map +1 -1
  37. package/dist/node/engine/AreHTML.compiler.mjs +58 -30
  38. package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
  39. package/dist/node/engine/AreHTML.constants.d.mts +53 -1
  40. package/dist/node/engine/AreHTML.constants.d.ts +53 -1
  41. package/dist/node/engine/AreHTML.constants.js +100 -0
  42. package/dist/node/engine/AreHTML.constants.js.map +1 -1
  43. package/dist/node/engine/AreHTML.constants.mjs +93 -0
  44. package/dist/node/engine/AreHTML.constants.mjs.map +1 -1
  45. package/dist/node/engine/AreHTML.context.d.mts +6 -2
  46. package/dist/node/engine/AreHTML.context.d.ts +6 -2
  47. package/dist/node/engine/AreHTML.context.js +42 -7
  48. package/dist/node/engine/AreHTML.context.js.map +1 -1
  49. package/dist/node/engine/AreHTML.context.mjs +35 -6
  50. package/dist/node/engine/AreHTML.context.mjs.map +1 -1
  51. package/dist/node/engine/AreHTML.engine.js +10 -7
  52. package/dist/node/engine/AreHTML.engine.js.map +1 -1
  53. package/dist/node/engine/AreHTML.engine.mjs +10 -7
  54. package/dist/node/engine/AreHTML.engine.mjs.map +1 -1
  55. package/dist/node/engine/AreHTML.interpreter.js +155 -43
  56. package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
  57. package/dist/node/engine/AreHTML.interpreter.mjs +155 -43
  58. package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
  59. package/dist/node/engine/AreHTML.lifecycle.js +17 -12
  60. package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
  61. package/dist/node/engine/AreHTML.lifecycle.mjs +9 -2
  62. package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
  63. package/dist/node/engine/AreHTML.tokenizer.js +14 -9
  64. package/dist/node/engine/AreHTML.tokenizer.js.map +1 -1
  65. package/dist/node/engine/AreHTML.tokenizer.mjs +10 -3
  66. package/dist/node/engine/AreHTML.tokenizer.mjs.map +1 -1
  67. package/dist/node/engine/AreHTML.transformer.js +13 -8
  68. package/dist/node/engine/AreHTML.transformer.js.map +1 -1
  69. package/dist/node/engine/AreHTML.transformer.mjs +9 -2
  70. package/dist/node/engine/AreHTML.transformer.mjs.map +1 -1
  71. package/dist/node/index.d.mts +2 -1
  72. package/dist/node/index.d.ts +2 -1
  73. package/dist/node/index.js +3 -3
  74. package/dist/node/index.mjs +1 -1
  75. package/dist/node/instructions/AddAttribute.instruction.js +3 -4
  76. package/dist/node/instructions/AddAttribute.instruction.js.map +1 -1
  77. package/dist/node/instructions/AddAttribute.instruction.mjs +3 -4
  78. package/dist/node/instructions/AddAttribute.instruction.mjs.map +1 -1
  79. package/dist/node/instructions/AddComment.instruction.js +3 -4
  80. package/dist/node/instructions/AddComment.instruction.js.map +1 -1
  81. package/dist/node/instructions/AddComment.instruction.mjs +3 -4
  82. package/dist/node/instructions/AddComment.instruction.mjs.map +1 -1
  83. package/dist/node/instructions/AddElement.instruction.js +3 -4
  84. package/dist/node/instructions/AddElement.instruction.js.map +1 -1
  85. package/dist/node/instructions/AddElement.instruction.mjs +3 -4
  86. package/dist/node/instructions/AddElement.instruction.mjs.map +1 -1
  87. package/dist/node/instructions/AddInterpolation.instruction.js +3 -4
  88. package/dist/node/instructions/AddInterpolation.instruction.js.map +1 -1
  89. package/dist/node/instructions/AddInterpolation.instruction.mjs +3 -4
  90. package/dist/node/instructions/AddInterpolation.instruction.mjs.map +1 -1
  91. package/dist/node/instructions/AddListener.instruction.js +3 -4
  92. package/dist/node/instructions/AddListener.instruction.js.map +1 -1
  93. package/dist/node/instructions/AddListener.instruction.mjs +3 -4
  94. package/dist/node/instructions/AddListener.instruction.mjs.map +1 -1
  95. package/dist/node/instructions/AddStyle.instruction.js +3 -4
  96. package/dist/node/instructions/AddStyle.instruction.js.map +1 -1
  97. package/dist/node/instructions/AddStyle.instruction.mjs +3 -4
  98. package/dist/node/instructions/AddStyle.instruction.mjs.map +1 -1
  99. package/dist/node/instructions/AddText.instruction.js +3 -4
  100. package/dist/node/instructions/AddText.instruction.js.map +1 -1
  101. package/dist/node/instructions/AddText.instruction.mjs +3 -4
  102. package/dist/node/instructions/AddText.instruction.mjs.map +1 -1
  103. package/dist/node/lib/AreDirective/AreDirective.component.js +5 -0
  104. package/dist/node/lib/AreDirective/AreDirective.component.js.map +1 -1
  105. package/dist/node/lib/AreDirective/AreDirective.component.mjs +5 -0
  106. package/dist/node/lib/AreDirective/AreDirective.component.mjs.map +1 -1
  107. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.js +17 -4
  108. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.js.map +1 -1
  109. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.mjs +10 -3
  110. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.mjs.map +1 -1
  111. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +3 -4
  112. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -1
  113. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +3 -4
  114. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -1
  115. package/dist/node/lib/AreRoot/AreRoot.component.js +3 -4
  116. package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
  117. package/dist/node/lib/AreRoot/AreRoot.component.mjs +3 -4
  118. package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
  119. package/dist/node/lib/{AreWatcher/AreWatcher.component.d.mts → AreRouteWatcher/AreRouteWatcher.component.d.mts} +2 -2
  120. package/dist/node/lib/{AreWatcher/AreWatcher.component.d.ts → AreRouteWatcher/AreRouteWatcher.component.d.ts} +2 -2
  121. package/dist/node/lib/{AreWatcher/AreWatcher.component.js → AreRouteWatcher/AreRouteWatcher.component.js} +9 -10
  122. package/dist/node/lib/AreRouteWatcher/AreRouteWatcher.component.js.map +1 -0
  123. package/dist/node/lib/{AreWatcher/AreWatcher.component.mjs → AreRouteWatcher/AreRouteWatcher.component.mjs} +10 -11
  124. package/dist/node/lib/AreRouteWatcher/AreRouteWatcher.component.mjs.map +1 -0
  125. package/dist/node/lib/AreStyle/AreStyle.context.js +17 -4
  126. package/dist/node/lib/AreStyle/AreStyle.context.js.map +1 -1
  127. package/dist/node/lib/AreStyle/AreStyle.context.mjs +10 -3
  128. package/dist/node/lib/AreStyle/AreStyle.context.mjs.map +1 -1
  129. package/dist/node/nodes/AreComment.js +17 -4
  130. package/dist/node/nodes/AreComment.js.map +1 -1
  131. package/dist/node/nodes/AreComment.mjs +10 -3
  132. package/dist/node/nodes/AreComment.mjs.map +1 -1
  133. package/dist/node/nodes/AreComponent.js +3 -4
  134. package/dist/node/nodes/AreComponent.js.map +1 -1
  135. package/dist/node/nodes/AreComponent.mjs +3 -4
  136. package/dist/node/nodes/AreComponent.mjs.map +1 -1
  137. package/dist/node/nodes/AreInterpolation.js +17 -4
  138. package/dist/node/nodes/AreInterpolation.js.map +1 -1
  139. package/dist/node/nodes/AreInterpolation.mjs +10 -3
  140. package/dist/node/nodes/AreInterpolation.mjs.map +1 -1
  141. package/dist/node/nodes/AreRoot.js +3 -4
  142. package/dist/node/nodes/AreRoot.js.map +1 -1
  143. package/dist/node/nodes/AreRoot.mjs +3 -4
  144. package/dist/node/nodes/AreRoot.mjs.map +1 -1
  145. package/dist/node/nodes/AreText.js +17 -4
  146. package/dist/node/nodes/AreText.js.map +1 -1
  147. package/dist/node/nodes/AreText.mjs +10 -3
  148. package/dist/node/nodes/AreText.mjs.map +1 -1
  149. package/dist/node/signals/AreRoute.signal.js +18 -5
  150. package/dist/node/signals/AreRoute.signal.js.map +1 -1
  151. package/dist/node/signals/AreRoute.signal.mjs +10 -3
  152. package/dist/node/signals/AreRoute.signal.mjs.map +1 -1
  153. package/docs/SYNTAX.md +714 -0
  154. package/docs/arehtml.monaco.json +235 -0
  155. package/docs/arehtml.monaco.ts +119 -0
  156. package/examples/dashboard/dist/index.html +1 -1
  157. package/examples/dashboard/dist/mpioi5ab-8c3oa9.js +13674 -0
  158. package/examples/jumpstart/dist/index.html +1 -1
  159. package/examples/{dashboard/dist/mnzfypsd-6zjt7w.js → jumpstart/dist/mor90p6y-0plg7g.js} +1869 -1926
  160. package/examples/jumpstart/dist/{mnpl1g4i-nobz9g.js → mor90p7p-1898bz.js} +2797 -2282
  161. package/examples/jumpstart/src/components/List.component.ts +14 -13
  162. package/examples/jumpstart/src/concept.ts +5 -4
  163. package/jest.config.ts +1 -1
  164. package/package.json +10 -6
  165. package/src/attributes/AreBinding.attribute.ts +5 -0
  166. package/src/attributes/AreDirective.attribute.ts +5 -0
  167. package/src/attributes/AreEvent.attribute.ts +5 -0
  168. package/src/attributes/AreStatic.attribute.ts +5 -0
  169. package/src/directives/AreDirectiveFor.directive.ts +97 -60
  170. package/src/directives/AreDirectiveIf.directive.ts +37 -15
  171. package/src/engine/AreHTML.compiler.ts +64 -36
  172. package/src/engine/AreHTML.constants.ts +144 -0
  173. package/src/engine/AreHTML.context.ts +33 -4
  174. package/src/engine/AreHTML.engine.ts +12 -7
  175. package/src/engine/AreHTML.interpreter.ts +195 -68
  176. package/src/engine/AreHTML.lifecycle.ts +5 -0
  177. package/src/engine/AreHTML.tokenizer.ts +6 -1
  178. package/src/engine/AreHTML.transformer.ts +5 -0
  179. package/src/index.ts +2 -2
  180. package/src/instructions/AddAttribute.instruction.ts +3 -4
  181. package/src/instructions/AddComment.instruction.ts +3 -4
  182. package/src/instructions/AddElement.instruction.ts +3 -4
  183. package/src/instructions/AddInterpolation.instruction.ts +3 -4
  184. package/src/instructions/AddListener.instruction.ts +3 -4
  185. package/src/instructions/AddStyle.instruction.ts +3 -4
  186. package/src/instructions/AddText.instruction.ts +3 -4
  187. package/src/lib/AreDirective/AreDirective.component.ts +5 -0
  188. package/src/lib/AreHTMLAttribute/AreHTML.attribute.ts +5 -0
  189. package/src/lib/AreHTMLNode/AreHTMLNode.ts +3 -4
  190. package/src/lib/AreRoot/AreRoot.component.ts +3 -4
  191. package/src/lib/{AreWatcher/AreWatcher.component.ts → AreRouteWatcher/AreRouteWatcher.component.ts} +5 -6
  192. package/src/lib/AreStyle/AreStyle.context.ts +5 -0
  193. package/src/nodes/AreComment.ts +5 -0
  194. package/src/nodes/AreComponent.ts +3 -4
  195. package/src/nodes/AreInterpolation.ts +5 -0
  196. package/src/nodes/AreRoot.ts +3 -4
  197. package/src/nodes/AreText.ts +5 -0
  198. package/src/signals/AreRoute.signal.ts +5 -0
  199. package/dist/node/lib/AreWatcher/AreWatcher.component.js.map +0 -1
  200. package/dist/node/lib/AreWatcher/AreWatcher.component.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/engine/AreHTML.interpreter.ts"],"names":["AreHTMLInterpreter","AreInterpreter","AreInterpreterError","AreEvent","A_Frame","AreInstructionDefaultNames","AreHTMLInstructions","A_Caller","AreHTMLEngineContext","A_Logger","AreStore","AreSyntax","AreDirectiveContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BaA,0BAAA,GAAN,iCAAiCC,kBAAA,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,MAA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AA,EAAA,eAAA,EAAA,CAAA,CAAA;AA5aSA,0BAAA,GAAN,eAAA,CAAA;AAAA,EALNI,eAAQ,SAAA,CAAU;AAAA,IACf,SAAA,EAAW,OAAA;AAAA,IACX,IAAA,EAAM,oBAAA;AAAA,IACN,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYJ,0BAAA,CAAA","file":"AreHTML.interpreter.js","sourcesContent":["import { A_Caller, A_Inject } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame\";\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 { AreDirectiveContext } from \"@adaas/are-html/directive/AreDirective.context\";\nimport { AreHTMLNode } from \"../lib/AreHTMLNode/AreHTMLNode\";\nimport { AreHTMLEngineContext } from \"./AreHTML.context\";\n\n\n@A_Frame.Component({\n namespace: 'A-ARE',\n name: 'AreHTMLInterpreter',\n description: 'AreHTMLInterpreter is a component that serves as a host for rendering AreNodes into HTML. It provides the necessary context and environment for AreNodes to be rendered and interact with the DOM.'\n})\nexport class AreHTMLInterpreter extends AreInterpreter {\n // ─────────────────────────────────────────────────────────────────────────────\n // ── CreateElement — Apply / Revert ───────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n @A_Frame.Method({\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 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 = 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 = context.container.createElement(tag);\n\n element.setAttribute('data-aseid', node.aseid.toString());\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.Method({\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.Method({\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 value = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\n\n\n /**\n * First time\n */\n if (mutation.cache === undefined) {\n\n const existingValue = (element as HTMLElement).getAttribute(name);\n\n const result = (existingValue ? `${existingValue} ${value}` : value);\n\n (element as HTMLElement).setAttribute(name, result);\n\n mutation.cache = value;\n\n } else {\n\n const existingValue = (element as HTMLElement).getAttribute(name);\n\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 = value ? value.split(/\\s+/).filter(Boolean) : [];\n\n const result = [...existingParts.filter(part => !oldParts.has(part)), ...newParts].join(' ');\n\n (element as HTMLElement).setAttribute(name, result);\n\n mutation.cache = value;\n }\n\n\n }\n\n @A_Frame.Method({\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 (element as HTMLElement)?.removeAttribute(name);\n }\n } catch (error) {\n console.log('Error removing attribute:', error);\n }\n\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── addEventListener — Apply / Revert ────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Method({\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 * \n * e.g. @click=\"handleClick($event, element)\"\n * \n * e.g. @click=\"(e)=> user.name ? handleClick(e) : null\" (with conditional logic)\n * \n * e.g. @click=\"(e)=> isValid(user.name) ? handleClick(e) : null\" (with conditional logic)\n * \n * e.g. @click=\"(e)=> isValid(user.name) ? handleClick(e, format(user.name)) : null\" (with conditional logic)\n */\n\n\n const handlers = syntax.extractEmitHandlers(mutation.payload.handler);\n const handlerScope = {}\n\n for (const handler of handlers) {\n const handlerFn = (...args: any[]) => {\n const event = new AreEvent(handler)\n\n event.set('args', args);\n event.set('element', element);\n event.set('instruction', mutation);\n\n mutation.owner.emit(event);\n }\n\n handlerScope[`$${handler}`] = handlerFn;\n }\n\n const callback = (e: Event) => {\n context.startPerformance('Click')\n\n const result = syntax.evaluate(mutation.payload.handler, store, {\n ...handlerScope,\n ...(directiveContext?.scope || {})\n });\n if (typeof result === 'function') result(e);\n };\n\n\n if (callback) {\n element.addEventListener(mutation.payload.name, callback);\n context.addListener(element, mutation.payload.name, callback);\n }\n }\n\n\n @A_Frame.Method({\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\n const listener = context.getListener(element, name);\n\n if (listener) {\n element.removeEventListener(name, listener);\n context.removeListener(element, name);\n }\n }\n\n\n // ─────────────────────────────────────────────────────────────────────────────\n // ── AddText — Apply / Revert ─────────────────────────────────────────────────\n // ─────────────────────────────────────────────────────────────────────────────\n\n @A_Frame.Method({\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 value = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\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.Method({\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.Method({\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 value = evaluate ? syntax.evaluate(content, store, {\n ...(directiveContext?.scope || {})\n }) : content;\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.Method({\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}"]}
1
+ {"version":3,"sources":["../../../src/engine/AreHTML.interpreter.ts"],"names":["AreHTMLInterpreter","AreInterpreter","AreInterpreterError","isBooleanAttribute","isIDLFormProperty","toDOMString","normalizeClassValue","normalizeStyleValue","parseEventName","AreEvent","A_Frame","AreInstructionDefaultNames","AreHTMLInstructions","A_Caller","AreHTMLEngineContext","A_Logger","AreStore","AreSyntax","AreDirectiveContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCaA,0BAAA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,CAAA;AAAA,CAAA,EA3dzBd,0BAAA,CAydT,SAAA,EAAA,YAAA,EAAA,CAAA,CAAA;AAmBA,eAAA,CAAA;AAAA,EALCU,aAAQ,MAAA,CAAO;AAAA,IACZ,WAAA,EAAa;AAAA,GAChB,CAAA;AAAA,EACAT,kBAAA,CAAe,KAAA,CAAMW,kDAAA,CAAoB,UAAU,CAAA;AAAA,EACnDX,kBAAA,CAAe,MAAA,CAAOW,kDAAA,CAAoB,UAAU,CAAA;AAAA,EAEhD,qCAASC,iBAAQ,CAAA,CAAA;AAAA,EACjB,qCAASC,oCAAoB,CAAA,CAAA;AAAA,EAC7B,qCAASE,YAAQ,CAAA,CAAA;AAAA,EACjB,qCAASC,aAAS,CAAA,CAAA;AAAA,EAClB,qCAASC,wCAAmB,CAAA,CAAA;AAAA,EAE5B,qCAASH,gBAAQ,CAAA;AAAA,CAAA,EAnfbf,0BAAA,CA4eT,SAAA,EAAA,YAAA,EAAA,CAAA,CAAA;AAwDA,eAAA,CAAA;AAAA,EAJCU,aAAQ,MAAA,CAAO;AAAA,IACZ,WAAA,EAAa;AAAA,GAChB,CAAA;AAAA,EACAT,kBAAA,CAAe,MAAA,CAAOW,kDAAA,CAAoB,UAAU,CAAA;AAAA,EAEhD,qCAASC,iBAAQ,CAAA,CAAA;AAAA,EACjB,qCAASC,oCAAoB,CAAA;AAAA,CAAA,EAtiBzBd,0BAAA,CAoiBT,SAAA,EAAA,eAAA,EAAA,CAAA,CAAA;AApiBSA,0BAAA,GAAN,eAAA,CAAA;AAAA,EAJNU,aAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYV,0BAAA,CAAA","file":"AreHTML.interpreter.js","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 { 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} 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 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 = context.container.createElement(tag);\n element.setAttribute('data-aseid', node.aseid.toString());\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 = context.container.createElement(tag);\n\n element.setAttribute('data-aseid', node.aseid.toString());\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 // ── 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 (element as HTMLElement)?.removeAttribute(name);\n }\n } catch (error) {\n console.log('Error removing attribute:', error);\n }\n\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 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}"]}
@@ -1,11 +1,12 @@
1
1
  import { __decorateClass, __decorateParam } from '../chunk-EQQGB2QZ.mjs';
2
2
  import { A_Inject, A_Caller } from '@adaas/a-concept';
3
- import { A_Frame } from '@adaas/a-frame';
3
+ import { A_Frame } from '@adaas/a-frame/core';
4
4
  import { A_Logger } from '@adaas/a-utils/a-logger';
5
5
  import { AreInterpreter, AreInstructionDefaultNames, AreStore, AreSyntax, AreInterpreterError, AreEvent } from '@adaas/are';
6
6
  import { AreHTMLInstructions } from '@adaas/are-html/instructions/AreHTML.instructions.constants';
7
7
  import { AreDirectiveContext } from '@adaas/are-html/directive/AreDirective.context';
8
8
  import { AreHTMLEngineContext } from './AreHTML.context';
9
+ import { isBooleanAttribute, isIDLFormProperty, toDOMString, normalizeClassValue, normalizeStyleValue, parseEventName } from './AreHTML.constants';
9
10
 
10
11
  let AreHTMLInterpreter = class extends AreInterpreter {
11
12
  addElement(declaration, context, logger) {
@@ -30,6 +31,7 @@ let AreHTMLInterpreter = class extends AreInterpreter {
30
31
  });
31
32
  }
32
33
  const element = context.container.createElement(tag);
34
+ element.setAttribute("data-aseid", node.aseid.toString());
33
35
  if (mountPoint.nodeType === Node.ELEMENT_NODE) {
34
36
  mountPoint.appendChild(element);
35
37
  } else {
@@ -71,23 +73,80 @@ let AreHTMLInterpreter = class extends AreInterpreter {
71
73
  });
72
74
  }
73
75
  const { name, content, evaluate } = mutation.payload;
74
- const value = evaluate ? syntax.evaluate(content, store, {
76
+ const rawValue = evaluate ? syntax.evaluate(content, store, {
75
77
  ...directiveContext?.scope || {}
76
78
  }) : content;
77
- if (mutation.cache === void 0) {
78
- const existingValue = element.getAttribute(name);
79
- const result = existingValue ? `${existingValue} ${value}` : value;
80
- element.setAttribute(name, result);
81
- mutation.cache = value;
79
+ const el = element;
80
+ const lowerName = name.toLowerCase();
81
+ if (isBooleanAttribute(lowerName)) {
82
+ if (rawValue) {
83
+ el.setAttribute(lowerName, "");
84
+ try {
85
+ el[lowerName] = true;
86
+ } catch {
87
+ }
88
+ } else {
89
+ el.removeAttribute(lowerName);
90
+ try {
91
+ el[lowerName] = false;
92
+ } catch {
93
+ }
94
+ }
95
+ mutation.cache = rawValue ? "true" : "";
96
+ return;
97
+ }
98
+ if (isIDLFormProperty(el.tagName, name)) {
99
+ const propName = name === "value" ? "value" : name === "checked" ? "checked" : name === "selected" ? "selected" : name === "indeterminate" ? "indeterminate" : name;
100
+ try {
101
+ if (propName === "checked" || propName === "selected" || propName === "indeterminate") {
102
+ el[propName] = !!rawValue;
103
+ } else {
104
+ el[propName] = toDOMString(rawValue);
105
+ }
106
+ } catch {
107
+ }
108
+ if (propName !== "value") {
109
+ if (rawValue) el.setAttribute(name, "");
110
+ else el.removeAttribute(name);
111
+ } else {
112
+ el.setAttribute(name, toDOMString(rawValue));
113
+ }
114
+ mutation.cache = toDOMString(rawValue);
115
+ return;
116
+ }
117
+ if (lowerName === "class") {
118
+ const newValue = normalizeClassValue(rawValue);
119
+ if (mutation.cache === void 0) {
120
+ const existingValue = el.getAttribute("class");
121
+ const merged = existingValue ? `${existingValue} ${newValue}`.trim() : newValue;
122
+ if (merged) el.setAttribute("class", merged);
123
+ else el.removeAttribute("class");
124
+ } else {
125
+ const existingValue = el.getAttribute("class");
126
+ const existingParts = existingValue ? existingValue.split(/\s+/).filter(Boolean) : [];
127
+ const oldParts = new Set(mutation.cache.split(/\s+/).filter(Boolean));
128
+ const newParts = newValue ? newValue.split(/\s+/).filter(Boolean) : [];
129
+ const merged = [...existingParts.filter((p) => !oldParts.has(p)), ...newParts].join(" ");
130
+ if (merged) el.setAttribute("class", merged);
131
+ else el.removeAttribute("class");
132
+ }
133
+ mutation.cache = newValue;
134
+ return;
135
+ }
136
+ if (lowerName === "style") {
137
+ const newValue = normalizeStyleValue(rawValue);
138
+ if (newValue) el.setAttribute("style", newValue);
139
+ else el.removeAttribute("style");
140
+ mutation.cache = newValue;
141
+ return;
142
+ }
143
+ const stringValue = toDOMString(rawValue);
144
+ if (stringValue === "" && evaluate && (rawValue === false || rawValue === null || rawValue === void 0)) {
145
+ el.removeAttribute(name);
82
146
  } else {
83
- const existingValue = element.getAttribute(name);
84
- const existingParts = existingValue ? existingValue.split(/\s+/).filter(Boolean) : [];
85
- const oldParts = new Set(mutation.cache.split(/\s+/).filter(Boolean));
86
- const newParts = value ? value.split(/\s+/).filter(Boolean) : [];
87
- const result = [...existingParts.filter((part) => !oldParts.has(part)), ...newParts].join(" ");
88
- element.setAttribute(name, result);
89
- mutation.cache = value;
147
+ el.setAttribute(name, stringValue);
90
148
  }
149
+ mutation.cache = stringValue;
91
150
  }
92
151
  removeAttribute(mutation, context) {
93
152
  try {
@@ -109,12 +168,19 @@ let AreHTMLInterpreter = class extends AreInterpreter {
109
168
  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.`
110
169
  });
111
170
  }
171
+ const { event: eventName, modifiers } = parseEventName(mutation.payload.name);
172
+ const listenerOptions = {};
173
+ if (modifiers.has("capture")) listenerOptions.capture = true;
174
+ if (modifiers.has("once")) listenerOptions.once = true;
175
+ if (modifiers.has("passive")) listenerOptions.passive = true;
112
176
  const handlers = syntax.extractEmitHandlers(mutation.payload.handler);
177
+ let liveEvent = null;
113
178
  const handlerScope = {};
114
179
  for (const handler of handlers) {
115
180
  const handlerFn = (...args) => {
116
181
  const event = new AreEvent(handler);
117
- event.set("args", args);
182
+ const effectiveArgs = args.length === 0 && liveEvent ? [liveEvent] : liveEvent ? [...args, liveEvent] : args;
183
+ event.set("args", effectiveArgs);
118
184
  event.set("element", element);
119
185
  event.set("instruction", mutation);
120
186
  mutation.owner.emit(event);
@@ -122,34 +188,80 @@ let AreHTMLInterpreter = class extends AreInterpreter {
122
188
  handlerScope[`$${handler}`] = handlerFn;
123
189
  }
124
190
  const callback = (e) => {
125
- context.startPerformance("Click");
126
- const result = syntax.evaluate(mutation.payload.handler, store, {
127
- ...handlerScope,
128
- ...directiveContext?.scope || {}
129
- });
130
- if (typeof result === "function") result(e);
191
+ try {
192
+ liveEvent = e;
193
+ if (modifiers.has("self") && e.target !== element) return;
194
+ if (modifiers.has("stop")) e.stopPropagation();
195
+ if (modifiers.has("prevent")) e.preventDefault();
196
+ if (e instanceof KeyboardEvent && modifiers.size > 0) {
197
+ const key = (e.key || "").toLowerCase();
198
+ const KEY_ALIASES = {
199
+ enter: ["enter"],
200
+ esc: ["escape"],
201
+ escape: ["escape"],
202
+ tab: ["tab"],
203
+ space: [" ", "spacebar"],
204
+ up: ["arrowup"],
205
+ down: ["arrowdown"],
206
+ left: ["arrowleft"],
207
+ right: ["arrowright"],
208
+ delete: ["delete", "backspace"]
209
+ };
210
+ const keyMods = [...modifiers].filter((m) => m in KEY_ALIASES || m === "ctrl" || m === "alt" || m === "shift" || m === "meta");
211
+ if (keyMods.length > 0) {
212
+ const keyMatch = keyMods.some((m) => {
213
+ if (m === "ctrl") return e.ctrlKey;
214
+ if (m === "alt") return e.altKey;
215
+ if (m === "shift") return e.shiftKey;
216
+ if (m === "meta") return e.metaKey;
217
+ const aliases = KEY_ALIASES[m];
218
+ return aliases && aliases.includes(key);
219
+ });
220
+ if (!keyMatch) return;
221
+ }
222
+ }
223
+ context.startPerformance("event:" + eventName);
224
+ const result = syntax.evaluate(mutation.payload.handler, store, {
225
+ ...handlerScope,
226
+ $event: e,
227
+ ...directiveContext?.scope || {}
228
+ });
229
+ if (typeof result === "function") result(e);
230
+ context.endPerformance("event:" + eventName);
231
+ } catch (err) {
232
+ logger?.error(err);
233
+ } finally {
234
+ liveEvent = null;
235
+ }
131
236
  };
132
- if (callback) {
133
- element.addEventListener(mutation.payload.name, callback);
134
- context.addListener(element, mutation.payload.name, callback);
237
+ const useOptions = listenerOptions.capture || listenerOptions.once || listenerOptions.passive;
238
+ if (useOptions) {
239
+ element.addEventListener(eventName, callback, listenerOptions);
240
+ } else {
241
+ element.addEventListener(eventName, callback);
135
242
  }
243
+ mutation.payload._callback = callback;
244
+ context.addListener(element, mutation.payload.name, callback);
136
245
  }
137
246
  removeEventListener(mutation, context) {
138
247
  const element = context.getElementByInstruction(mutation.parent);
139
248
  if (!element) return;
140
249
  const { name } = mutation.payload;
141
- const listener = context.getListener(element, name);
250
+ const { event: eventName } = parseEventName(name);
251
+ const listener = mutation.payload._callback;
142
252
  if (listener) {
143
- element.removeEventListener(name, listener);
144
- context.removeListener(element, name);
253
+ element.removeEventListener(eventName, listener);
254
+ context.removeListener(element, name, listener);
255
+ mutation.payload._callback = void 0;
145
256
  }
146
257
  }
147
258
  addText(declaration, context, store, syntax, directiveContext, logger) {
148
259
  const node = declaration.owner.parent;
149
260
  const { content, evaluate } = declaration.payload;
150
- const value = evaluate ? syntax.evaluate(content, store, {
261
+ const rawValue = evaluate ? syntax.evaluate(content, store, {
151
262
  ...directiveContext?.scope || {}
152
263
  }) : content;
264
+ const value = toDOMString(rawValue);
153
265
  if (!node) {
154
266
  const textNode = context.container.createTextNode(value);
155
267
  context.container.body.appendChild(textNode);
@@ -182,9 +294,10 @@ let AreHTMLInterpreter = class extends AreInterpreter {
182
294
  addComment(declaration, context, store, syntax, directiveContext, logger) {
183
295
  const node = declaration.owner.parent;
184
296
  const { content, evaluate } = declaration.payload;
185
- const value = evaluate ? syntax.evaluate(content, store, {
297
+ const rawValue = evaluate ? syntax.evaluate(content, store, {
186
298
  ...directiveContext?.scope || {}
187
299
  }) : content;
300
+ const value = toDOMString(rawValue);
188
301
  if (!node) {
189
302
  const commentNode = context.container.createComment(value);
190
303
  context.container.body.appendChild(commentNode);
@@ -216,7 +329,7 @@ let AreHTMLInterpreter = class extends AreInterpreter {
216
329
  }
217
330
  };
218
331
  __decorateClass([
219
- A_Frame.Method({
332
+ A_Frame.Define({
220
333
  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."
221
334
  }),
222
335
  AreInterpreter.Apply(AreInstructionDefaultNames.Default),
@@ -226,7 +339,7 @@ __decorateClass([
226
339
  __decorateParam(2, A_Inject(A_Logger))
227
340
  ], AreHTMLInterpreter.prototype, "addElement", 1);
228
341
  __decorateClass([
229
- A_Frame.Method({
342
+ A_Frame.Define({
230
343
  description: "Remove an HTML element that was created by a CreateElement declaration. Cleans up the DOM and the context index."
231
344
  }),
232
345
  AreInterpreter.Revert(AreInstructionDefaultNames.Default),
@@ -235,7 +348,7 @@ __decorateClass([
235
348
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
236
349
  ], AreHTMLInterpreter.prototype, "removeElement", 1);
237
350
  __decorateClass([
238
- A_Frame.Method({
351
+ A_Frame.Define({
239
352
  description: "Add an attribute to an HTML element based on the provided mutation instruction."
240
353
  }),
241
354
  AreInterpreter.Apply(AreHTMLInstructions.AddAttribute),
@@ -248,7 +361,7 @@ __decorateClass([
248
361
  __decorateParam(5, A_Inject(A_Logger))
249
362
  ], AreHTMLInterpreter.prototype, "addAttribute", 1);
250
363
  __decorateClass([
251
- A_Frame.Method({
364
+ A_Frame.Define({
252
365
  description: "Remove an attribute from an HTML element based on the provided mutation instruction."
253
366
  }),
254
367
  AreInterpreter.Revert(AreHTMLInstructions.AddAttribute),
@@ -256,7 +369,7 @@ __decorateClass([
256
369
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
257
370
  ], AreHTMLInterpreter.prototype, "removeAttribute", 1);
258
371
  __decorateClass([
259
- A_Frame.Method({
372
+ A_Frame.Define({
260
373
  description: "Add an event listener to an HTML element based on the provided mutation instruction."
261
374
  }),
262
375
  AreInterpreter.Apply(AreHTMLInstructions.AddListener),
@@ -268,7 +381,7 @@ __decorateClass([
268
381
  __decorateParam(5, A_Inject(A_Logger))
269
382
  ], AreHTMLInterpreter.prototype, "addEventListener", 1);
270
383
  __decorateClass([
271
- A_Frame.Method({
384
+ A_Frame.Define({
272
385
  description: "Remove an event listener from an HTML element based on the provided mutation instruction."
273
386
  }),
274
387
  AreInterpreter.Revert(AreHTMLInstructions.AddListener),
@@ -276,7 +389,7 @@ __decorateClass([
276
389
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
277
390
  ], AreHTMLInterpreter.prototype, "removeEventListener", 1);
278
391
  __decorateClass([
279
- A_Frame.Method({
392
+ A_Frame.Define({
280
393
  description: "Add text content to an HTML element based on the provided declaration instruction."
281
394
  }),
282
395
  AreInterpreter.Apply(AreHTMLInstructions.AddText),
@@ -289,7 +402,7 @@ __decorateClass([
289
402
  __decorateParam(5, A_Inject(A_Logger))
290
403
  ], AreHTMLInterpreter.prototype, "addText", 1);
291
404
  __decorateClass([
292
- A_Frame.Method({
405
+ A_Frame.Define({
293
406
  description: "Remove text content from an HTML element based on the provided declaration instruction."
294
407
  }),
295
408
  AreInterpreter.Revert(AreHTMLInstructions.AddText),
@@ -297,7 +410,7 @@ __decorateClass([
297
410
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
298
411
  ], AreHTMLInterpreter.prototype, "removeText", 1);
299
412
  __decorateClass([
300
- A_Frame.Method({
413
+ A_Frame.Define({
301
414
  description: "Add a comment node to the DOM based on the provided declaration instruction."
302
415
  }),
303
416
  AreInterpreter.Apply(AreHTMLInstructions.AddComment),
@@ -310,7 +423,7 @@ __decorateClass([
310
423
  __decorateParam(5, A_Inject(A_Logger))
311
424
  ], AreHTMLInterpreter.prototype, "addComment", 1);
312
425
  __decorateClass([
313
- A_Frame.Method({
426
+ A_Frame.Define({
314
427
  description: "Remove a comment node from the DOM based on the provided declaration instruction."
315
428
  }),
316
429
  AreInterpreter.Revert(AreHTMLInstructions.AddComment),
@@ -318,10 +431,9 @@ __decorateClass([
318
431
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
319
432
  ], AreHTMLInterpreter.prototype, "removeComment", 1);
320
433
  AreHTMLInterpreter = __decorateClass([
321
- A_Frame.Component({
322
- namespace: "A-ARE",
323
- name: "AreHTMLInterpreter",
324
- description: "AreHTMLInterpreter is a component that serves as a host for rendering AreNodes into HTML. It provides the necessary context and environment for AreNodes to be rendered and interact with the DOM."
434
+ A_Frame.Define({
435
+ namespace: "a-are-html",
436
+ description: "DOM interpreter for the HTML rendering pipeline. Extends AreInterpreter to apply and revert each ARE instruction type directly against the browser DOM \u2014 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."
325
437
  })
326
438
  ], AreHTMLInterpreter);
327
439