@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,7 +1,7 @@
1
1
  import { AreStore, AreScene, AreSyntax, AreCompiler, AreInterpreter, AreInstructionDefaultNames, AreNodeFeatures, AreContext, AreLifecycle, AreSignalsContext, AreAttributeFeatures, Are, AreNode, AreAttribute, AreCompilerError, AreMutation, AreDeclaration, AreSignal, AreInterpreterError, AreTokenizer, AreTransformer, AreEngine, AreRoute as AreRoute$1, AreSignals, AreEvent } from '@adaas/are';
2
+ import { A_Frame } from '@adaas/a-frame/core';
2
3
  import { A_Inject, A_Caller, A_Feature, A_Meta, A_Scope, A_Dependency, A_Component, A_Context, A_ComponentMeta, A_FormatterHelper, A_Fragment } from '@adaas/a-concept';
3
4
  import { A_Logger } from '@adaas/a-utils/a-logger';
4
- import { A_Frame } from '@adaas/a-frame';
5
5
  import { A_ExecutionContext } from '@adaas/a-utils/a-execution';
6
6
  import { A_Route } from '@adaas/a-utils/a-route';
7
7
  import { A_ServiceFeatures } from '@adaas/a-utils/a-service';
@@ -23,8 +23,12 @@ var AreHTMLAttribute = class extends AreAttribute {
23
23
  return this.scope.issuer();
24
24
  }
25
25
  };
26
-
27
- // src/attributes/AreBinding.attribute.ts
26
+ AreHTMLAttribute = __decorateClass([
27
+ A_Frame.Define({
28
+ namespace: "a-are-html",
29
+ description: "Base class for all typed HTML attributes in the ARE framework. Provides typed access to the owning AreHTMLNode via the scope injector so that attribute subclasses can inspect host-node properties and resolve store bindings during transformation, compilation, and lifecycle phases."
30
+ })
31
+ ], AreHTMLAttribute);
28
32
  var AreBindingAttribute = class extends AreHTMLAttribute {
29
33
  // get value(): string {
30
34
  // const [firstPart, ...pathPart] = this.content.split('.');
@@ -32,6 +36,12 @@ var AreBindingAttribute = class extends AreHTMLAttribute {
32
36
  // return AreCommonHelper.extractPropertyByPath(primaryObject, pathPart.join('.')) as string;
33
37
  // }
34
38
  };
39
+ AreBindingAttribute = __decorateClass([
40
+ A_Frame.Define({
41
+ namespace: "a-are-html",
42
+ description: "Attribute type for two-way value bindings (: prefix). Marks that the attribute value should be resolved dynamically from the node store rather than used verbatim, enabling reactive updates whenever the underlying store value changes during a rendering cycle."
43
+ })
44
+ ], AreBindingAttribute);
35
45
  var AreDirectiveAttribute = class extends AreHTMLAttribute {
36
46
  /**
37
47
  * Returns a custom directive component associated with this attribute, if available.
@@ -43,14 +53,28 @@ var AreDirectiveAttribute = class extends AreHTMLAttribute {
43
53
  return component;
44
54
  }
45
55
  };
46
-
47
- // src/attributes/AreEvent.attribute.ts
56
+ AreDirectiveAttribute = __decorateClass([
57
+ A_Frame.Define({
58
+ namespace: "a-are-html",
59
+ description: "Attribute type for directive invocations ($ prefix). Carries the resolved directive component class and a cloned template node. The associated directive uses these during its Compile phase to emit conditional or repeated instruction groups and to manage per-item or per-condition subscopes."
60
+ })
61
+ ], AreDirectiveAttribute);
48
62
  var AreEventAttribute = class extends AreHTMLAttribute {
49
63
  };
50
-
51
- // src/attributes/AreStatic.attribute.ts
64
+ AreEventAttribute = __decorateClass([
65
+ A_Frame.Define({
66
+ namespace: "a-are-html",
67
+ description: "Attribute type for DOM event listeners (@ prefix). Marks the attribute as an event binding \u2014 the compiler emits an AddListener instruction that attaches a handler expression resolved from the store to the specified event name on the host element."
68
+ })
69
+ ], AreEventAttribute);
52
70
  var AreStaticAttribute = class extends AreHTMLAttribute {
53
71
  };
72
+ AreStaticAttribute = __decorateClass([
73
+ A_Frame.Define({
74
+ namespace: "a-are-html",
75
+ description: "Attribute type for plain static HTML attributes with no dynamic prefix. Its value is emitted verbatim via an AddAttribute instruction at compile time and does not participate in reactive update cycles."
76
+ })
77
+ ], AreStaticAttribute);
54
78
  var AreDirectiveMeta = class extends A_ComponentMeta {
55
79
  constructor() {
56
80
  super(...arguments);
@@ -73,8 +97,6 @@ var AreDirectiveFeatures = {
73
97
  */
74
98
  Update: "_AreDirective_Update"
75
99
  };
76
-
77
- // src/lib/AreDirective/AreDirective.component.ts
78
100
  var AreDirective = class extends A_Component {
79
101
  //==================================================================================
80
102
  //======================== LIFECYCLE DECORATORS ====================================
@@ -170,6 +192,10 @@ __decorateClass([
170
192
  __decorateParam(0, A_Inject(A_Caller))
171
193
  ], AreDirective.prototype, "update", 1);
172
194
  AreDirective = __decorateClass([
195
+ A_Frame.Define({
196
+ namespace: "a-are-html",
197
+ description: "Abstract base component for all ARE directive types. Provides lifecycle decorators (Transform, Compile, Apply, Revert, Priority) that subclasses hook into at each pipeline stage. Subclasses implement Transform to rewrite the attribute or template node, Compile to emit scene instructions, Apply to activate them in the DOM, and Revert to undo them on removal."
198
+ }),
173
199
  A_Meta.Define(AreDirectiveMeta)
174
200
  ], AreDirective);
175
201
 
@@ -198,9 +224,8 @@ var AddCommentInstruction = class extends AreDeclaration {
198
224
  }
199
225
  };
200
226
  AddCommentInstruction = __decorateClass([
201
- A_Frame.Component({
202
- namespace: "A-ARE",
203
- name: "AddCommentInstruction",
227
+ A_Frame.Define({
228
+ namespace: "a-are-html",
204
229
  description: "Appends a comment node to an element. Apply creates the comment node; revert removes it. Content can be a static string or a dynamic getter for interpolations."
205
230
  })
206
231
  ], AddCommentInstruction);
@@ -210,8 +235,6 @@ var AreDirectiveContext = class extends A_ExecutionContext {
210
235
  this.scope = {};
211
236
  }
212
237
  };
213
-
214
- // src/directives/AreDirectiveFor.directive.ts
215
238
  var AreDirectiveFor = class extends AreDirective {
216
239
  transform(attribute, scope, store, scene, logger, ...args) {
217
240
  logger.debug(`[Transform] directive $FOR for <${attribute.owner.aseid.toString()}>`);
@@ -227,11 +250,9 @@ var AreDirectiveFor = class extends AreDirective {
227
250
  const { key, index, arrayExpr } = this.parseExpression(attribute.content);
228
251
  const array = this.resolveArray(store, arrayExpr, attribute.content);
229
252
  attribute.value = array;
230
- console.log('Initial array for "for" directive:', scene);
231
253
  for (let i = 0; i < array.length; i++) {
232
254
  this.spawnItemNode(attribute.template, attribute.owner, key, index, array[i], i);
233
255
  }
234
- console.log('Template for "for" directive:', forTemplate);
235
256
  }
236
257
  compile(attribute, store, scene, ...args) {
237
258
  const hostInstruction = scene.host;
@@ -242,49 +263,78 @@ var AreDirectiveFor = class extends AreDirective {
242
263
  scene.unPlan(hostInstruction);
243
264
  }
244
265
  update(attribute, store, scene, ...args) {
245
- const { key, index, arrayExpr } = this.parseExpression(attribute.content);
266
+ const { key, index, arrayExpr, trackExpr } = this.parseExpression(attribute.content);
246
267
  const newArray = this.resolveArray(store, arrayExpr, attribute.content);
247
268
  const owner = attribute.owner;
248
269
  const currentChildren = [...owner.children];
249
270
  attribute.value = newArray;
250
- const newLen = newArray.length;
251
- const newItemSet = new Set(newArray);
252
- const keptChildren = [];
253
- const removedChildren = [];
254
- for (const child of currentChildren) {
271
+ const computeKey = this.makeKeyFn(key, index, trackExpr);
272
+ const childByKey = /* @__PURE__ */ new Map();
273
+ const remaining = /* @__PURE__ */ new Set();
274
+ for (let i = 0; i < currentChildren.length; i++) {
275
+ const child = currentChildren[i];
255
276
  const ctx = child.scope.resolveFlat(AreDirectiveContext);
256
- if (ctx && newItemSet.has(ctx.scope[key])) {
257
- keptChildren.push(child);
277
+ const k = ctx ? computeKey(ctx.scope[key], ctx.scope[index || "index"]) : /* @__PURE__ */ Symbol("orphan");
278
+ childByKey.set(k, child);
279
+ remaining.add(child);
280
+ }
281
+ const newOnes = [];
282
+ for (let i = 0; i < newArray.length; i++) {
283
+ const item = newArray[i];
284
+ const k = computeKey(item, i);
285
+ const existing = childByKey.get(k);
286
+ if (existing) {
287
+ remaining.delete(existing);
288
+ let directiveContext = existing.scope.resolveFlat(AreDirectiveContext);
289
+ if (!directiveContext) {
290
+ directiveContext = new AreDirectiveContext(existing.aseid);
291
+ existing.scope.register(directiveContext);
292
+ }
293
+ directiveContext.scope = {
294
+ ...directiveContext.scope,
295
+ [key]: item,
296
+ [index || "index"]: i
297
+ };
258
298
  } else {
259
- removedChildren.push(child);
299
+ const itemNode = this.spawnItemNode(attribute.template, owner, key, index, item, i);
300
+ newOnes.push(itemNode);
260
301
  }
261
302
  }
262
- for (const child of removedChildren) {
303
+ for (const child of remaining) {
263
304
  child.unmount();
264
305
  owner.removeChild(child);
265
306
  }
266
- for (let i = 0; i < keptChildren.length; i++) {
267
- let directiveContext = keptChildren[i].scope.resolveFlat(AreDirectiveContext);
268
- if (!directiveContext) {
269
- directiveContext = new AreDirectiveContext(keptChildren[i].aseid);
270
- keptChildren[i].scope.register(directiveContext);
271
- }
272
- directiveContext.scope = {
273
- ...directiveContext.scope,
274
- [key]: newArray[i],
275
- [index || "index"]: i
276
- };
277
- }
278
- for (let i = keptChildren.length; i < newLen; i++) {
279
- const itemNode = this.spawnItemNode(attribute.template, owner, key, index, newArray[i], i);
280
- itemNode.transform();
281
- itemNode.compile();
282
- itemNode.mount();
307
+ for (const child of newOnes) {
308
+ child.transform();
309
+ child.compile();
310
+ child.mount();
283
311
  }
284
312
  }
285
313
  // ─────────────────────────────────────────────────────────────────────────────
286
314
  // ── Helpers ──────────────────────────────────────────────────────────────────
287
315
  // ─────────────────────────────────────────────────────────────────────────────
316
+ /**
317
+ * Build a key-function that derives a stable identity from each item.
318
+ * If the user provided a `track <expr>` clause, evaluate it as a path on
319
+ * the item; otherwise fall back to the item identity (reference equality).
320
+ */
321
+ makeKeyFn(key, index, trackExpr) {
322
+ if (!trackExpr) {
323
+ return (item, i) => item ?? i;
324
+ }
325
+ const path = trackExpr.startsWith(key + ".") ? trackExpr.slice(key.length + 1) : trackExpr;
326
+ return (item, i) => {
327
+ if (item == null) return i;
328
+ if (path === key || path === "$index") return path === "$index" ? i : item;
329
+ const parts = path.split(".");
330
+ let v = item;
331
+ for (const p of parts) {
332
+ if (v == null) return i;
333
+ v = v[p];
334
+ }
335
+ return v ?? i;
336
+ };
337
+ }
288
338
  /**
289
339
  * Parses the $for expression string into its constituent parts.
290
340
  *
@@ -294,16 +344,29 @@ var AreDirectiveFor = class extends AreDirective {
294
344
  * (item, index) in items
295
345
  * item in filter(items)
296
346
  * item, index in filter(items, 'active')
347
+ * item in items track item.id
348
+ * (item, i) in items track item.id
297
349
  */
298
350
  parseExpression(content) {
299
- const inIndex = content.lastIndexOf(" in ");
300
- const keyAndIndex = content.slice(0, inIndex).trim().replace(/^\(|\)$/g, "");
301
- const arrayExpr = content.slice(inIndex + 4).trim();
351
+ let trackExpr;
352
+ const trackIdx = content.search(/\s+track\s+/);
353
+ let body = content;
354
+ if (trackIdx !== -1) {
355
+ const m = content.slice(trackIdx).match(/\s+track\s+(.+)$/);
356
+ if (m) {
357
+ trackExpr = m[1].trim();
358
+ body = content.slice(0, trackIdx).trim();
359
+ }
360
+ }
361
+ const inIndex = body.lastIndexOf(" in ");
362
+ const keyAndIndex = body.slice(0, inIndex).trim().replace(/^\(|\)$/g, "");
363
+ const arrayExpr = body.slice(inIndex + 4).trim();
302
364
  const keyParts = keyAndIndex.split(",").map((p) => p.trim());
303
365
  return {
304
366
  key: keyParts[0],
305
367
  index: keyParts[1] || void 0,
306
- arrayExpr
368
+ arrayExpr,
369
+ trackExpr
307
370
  };
308
371
  }
309
372
  /**
@@ -394,6 +457,10 @@ __decorateClass([
394
457
  __decorateParam(2, A_Inject(AreScene))
395
458
  ], AreDirectiveFor.prototype, "update", 1);
396
459
  AreDirectiveFor = __decorateClass([
460
+ A_Frame.Define({
461
+ namespace: "a-are-html",
462
+ description: "Built-in $for directive. Iterates over an array expression resolved from the store and renders a cloned template fragment per item, managing per-item subscopes and comment-node anchors. Supports keyed diffing via an optional track clause to minimise DOM mutations on collection updates."
463
+ }),
397
464
  AreDirective.Priority(1)
398
465
  ], AreDirectiveFor);
399
466
  var AreDirectiveIf = class extends AreDirective {
@@ -412,7 +479,6 @@ var AreDirectiveIf = class extends AreDirective {
412
479
  attribute.template = ifTemplate;
413
480
  }
414
481
  compile(attribute, store, scene, syntax, directiveContext, ...args) {
415
- console.log('Compiling directive "if" with attribute content:', attribute);
416
482
  attribute.value = syntax.evaluate(attribute.content, store, {
417
483
  ...directiveContext?.scope || {}
418
484
  });
@@ -428,8 +494,11 @@ var AreDirectiveIf = class extends AreDirective {
428
494
  attribute.template.scene.deactivate();
429
495
  }
430
496
  update(attribute, store, scope, syntax, scene, ...args) {
431
- attribute.value = syntax.evaluate(attribute.content, store);
432
- if (attribute.value) {
497
+ const previous = !!attribute.value;
498
+ const next = !!syntax.evaluate(attribute.content, store);
499
+ attribute.value = next;
500
+ if (previous === next) return;
501
+ if (next) {
433
502
  attribute.template.scene.activate();
434
503
  attribute.template.mount();
435
504
  } else {
@@ -463,6 +532,10 @@ __decorateClass([
463
532
  __decorateParam(4, A_Inject(AreScene))
464
533
  ], AreDirectiveIf.prototype, "update", 1);
465
534
  AreDirectiveIf = __decorateClass([
535
+ A_Frame.Define({
536
+ namespace: "a-are-html",
537
+ description: "Built-in $if directive. Conditionally renders a subtree based on a store expression. Replaces the target element with a stable comment anchor when the condition is false and restores the fully rendered subtree when it becomes true, preventing any leaking of the host element between states."
538
+ }),
466
539
  AreDirective.Priority(2)
467
540
  ], AreDirectiveIf);
468
541
  var AddAttributeInstruction = class extends AreMutation {
@@ -475,9 +548,8 @@ var AddAttributeInstruction = class extends AreMutation {
475
548
  }
476
549
  };
477
550
  AddAttributeInstruction = __decorateClass([
478
- A_Frame.Component({
479
- namespace: "A-ARE",
480
- name: "AddAttributeInstruction",
551
+ A_Frame.Define({
552
+ namespace: "a-are-html",
481
553
  description: "Sets an attribute on an HTML element. Apply calls setAttribute; revert calls removeAttribute."
482
554
  })
483
555
  ], AddAttributeInstruction);
@@ -491,9 +563,8 @@ var AddElementInstruction = class extends AreDeclaration {
491
563
  }
492
564
  };
493
565
  AddElementInstruction = __decorateClass([
494
- A_Frame.Component({
495
- namespace: "A-ARE",
496
- name: "AddElementInstruction",
566
+ A_Frame.Define({
567
+ namespace: "a-are-html",
497
568
  description: "Creates a new HTML element in the DOM. Apply creates the element; revert removes it."
498
569
  })
499
570
  ], AddElementInstruction);
@@ -507,9 +578,8 @@ var AddInterpolationInstruction = class extends AreMutation {
507
578
  }
508
579
  };
509
580
  AddInterpolationInstruction = __decorateClass([
510
- A_Frame.Component({
511
- namespace: "A-ARE",
512
- name: "AddInterpolationInstruction",
581
+ A_Frame.Define({
582
+ namespace: "a-are-html",
513
583
  description: "Appends a reactive text node whose content is resolved dynamically from the store. Apply creates the text node with the getter; revert removes it."
514
584
  })
515
585
  ], AddInterpolationInstruction);
@@ -523,9 +593,8 @@ var AddListenerInstruction = class extends AreMutation {
523
593
  }
524
594
  };
525
595
  AddListenerInstruction = __decorateClass([
526
- A_Frame.Component({
527
- namespace: "A-ARE",
528
- name: "AddListenerInstruction",
596
+ A_Frame.Define({
597
+ namespace: "a-are-html",
529
598
  description: "Attaches a DOM event listener to an element. Apply calls addEventListener; revert calls removeEventListener."
530
599
  })
531
600
  ], AddListenerInstruction);
@@ -539,9 +608,8 @@ var AddStyleInstruction = class extends AreMutation {
539
608
  }
540
609
  };
541
610
  AddStyleInstruction = __decorateClass([
542
- A_Frame.Component({
543
- namespace: "A-ARE",
544
- name: "AddStyleInstruction",
611
+ A_Frame.Define({
612
+ namespace: "a-are-html",
545
613
  description: "Sets an inline CSS style property on an element. Apply sets the property; revert removes it."
546
614
  })
547
615
  ], AddStyleInstruction);
@@ -555,9 +623,8 @@ var AddTextInstruction = class extends AreDeclaration {
555
623
  }
556
624
  };
557
625
  AddTextInstruction = __decorateClass([
558
- A_Frame.Component({
559
- namespace: "A-ARE",
560
- name: "AddTextInstruction",
626
+ A_Frame.Define({
627
+ namespace: "a-are-html",
561
628
  description: "Appends a text node to an element. Apply creates the text node; revert removes it. Content can be a static string or a dynamic getter for interpolations."
562
629
  })
563
630
  ], AddTextInstruction);
@@ -569,6 +636,12 @@ var AreStyle = class extends A_Fragment {
569
636
  this.styles = styles;
570
637
  }
571
638
  };
639
+ AreStyle = __decorateClass([
640
+ A_Frame.Define({
641
+ namespace: "a-are-html",
642
+ description: "Context fragment that holds the resolved CSS style rules string for a component scope. Populated during lifecycle initialisation and read by the compiler when emitting AddStyle instructions for inline styles declared on the component host element."
643
+ })
644
+ ], AreStyle);
572
645
 
573
646
  // src/lib/AreHTMLNode/AreHTMLNode.ts
574
647
  var AreHTMLNode = class extends AreNode {
@@ -626,14 +699,11 @@ var AreHTMLNode = class extends AreNode {
626
699
  }
627
700
  };
628
701
  AreHTMLNode = __decorateClass([
629
- A_Frame.Entity({
630
- namespace: "A-ARE",
631
- name: "AreHTMLNode",
702
+ A_Frame.Define({
703
+ namespace: "a-are-html",
632
704
  description: "AreHTMLNode represents a node in the HTML structure. It extends the base AreNode and includes properties and methods specific to HTML nodes, such as handling attributes, directives, events, and styles."
633
705
  })
634
706
  ], AreHTMLNode);
635
-
636
- // src/nodes/AreComment.ts
637
707
  var AreComment = class extends AreHTMLNode {
638
708
  fromNew(newEntity) {
639
709
  super.fromNew({
@@ -645,6 +715,12 @@ var AreComment = class extends AreHTMLNode {
645
715
  });
646
716
  }
647
717
  };
718
+ AreComment = __decorateClass([
719
+ A_Frame.Define({
720
+ namespace: "a-are-html",
721
+ description: "Node type representing a comment node in the AreHTMLNode tree. Used as a stable DOM anchor by structural directives such as $if and $for that swap rendered content in and out, ensuring the parent container always has a consistent insertion point."
722
+ })
723
+ ], AreComment);
648
724
  var AreComponentNode = class extends AreHTMLNode {
649
725
  /**
650
726
  * A custom component associated with this node, which can be used to provide custom logic and behavior for the node. This component is typically defined in the context and can be resolved based on the node's type or other identifying information. The component can include its own template, markup, styles, and features that are specific to the functionality it provides.
@@ -658,14 +734,11 @@ var AreComponentNode = class extends AreHTMLNode {
658
734
  }
659
735
  };
660
736
  AreComponentNode = __decorateClass([
661
- A_Frame.Entity({
662
- namespace: "A-ARE",
663
- name: "AreComponentNode",
737
+ A_Frame.Define({
738
+ namespace: "a-are-html",
664
739
  description: "AreComponentNode represents a node in the scene graph that corresponds to a component. It extends the base AreNode and includes additional properties and methods specific to component nodes, such as handling attributes, bindings, directives, events, styles, and interpolations associated with the component."
665
740
  })
666
741
  ], AreComponentNode);
667
-
668
- // src/nodes/AreInterpolation.ts
669
742
  var AreInterpolation = class extends AreHTMLNode {
670
743
  fromNew(newEntity) {
671
744
  super.fromNew({
@@ -677,6 +750,12 @@ var AreInterpolation = class extends AreHTMLNode {
677
750
  });
678
751
  }
679
752
  };
753
+ AreInterpolation = __decorateClass([
754
+ A_Frame.Define({
755
+ namespace: "a-are-html",
756
+ description: "Node type representing a reactive inline expression in the AreHTMLNode tree. Its content expression is resolved from the store at render time and kept live via an AddInterpolation instruction that updates the corresponding text node on each reactive cycle."
757
+ })
758
+ ], AreInterpolation);
680
759
  var AreRootNode = class extends AreHTMLNode {
681
760
  /**
682
761
  * For the root node, we can default to a generic container element like <div> since it serves as the root of the component tree and does not correspond to a specific HTML tag defined in the markup. The actual content and structure of the root node will be determined by the child nodes and components that are rendered within it, allowing for flexibility in how the root node is used and what it contains.
@@ -696,14 +775,11 @@ var AreRootNode = class extends AreHTMLNode {
696
775
  }
697
776
  };
698
777
  AreRootNode = __decorateClass([
699
- A_Frame.Entity({
700
- namespace: "A-ARE",
701
- name: "AreRootNode",
778
+ A_Frame.Define({
779
+ namespace: "a-are-html",
702
780
  description: "AreRootNode represents the root node in the scene graph. It extends the base AreHTMLNode and includes additional properties and methods specific to the root node, such as handling the root element and its associated component."
703
781
  })
704
782
  ], AreRootNode);
705
-
706
- // src/nodes/AreText.ts
707
783
  var AreText = class extends AreHTMLNode {
708
784
  fromNew(newEntity) {
709
785
  super.fromNew({
@@ -715,7 +791,13 @@ var AreText = class extends AreHTMLNode {
715
791
  });
716
792
  }
717
793
  };
718
- var AreRoute = class _AreRoute extends AreSignal {
794
+ AreText = __decorateClass([
795
+ A_Frame.Define({
796
+ namespace: "a-are-html",
797
+ description: "Node type representing a plain or partially-dynamic text segment in the AreHTMLNode tree. Emits an AddText instruction that sets or updates the corresponding DOM text node; the content may carry a store getter for any dynamic portion."
798
+ })
799
+ ], AreText);
800
+ var AreRoute = class extends AreSignal {
719
801
  constructor(path) {
720
802
  super({
721
803
  data: new A_Route(path)
@@ -725,12 +807,110 @@ var AreRoute = class _AreRoute extends AreSignal {
725
807
  return this.data;
726
808
  }
727
809
  static default() {
728
- return new _AreRoute(document.location.pathname || "/");
810
+ return new AreRoute(document.location.pathname || "/");
729
811
  }
730
812
  compare(other) {
731
813
  return this.route.toRegExp().test(other.data.toString());
732
814
  }
733
815
  };
816
+ AreRoute = __decorateClass([
817
+ A_Frame.Define({
818
+ namespace: "a-are-html",
819
+ description: "ARE signal that carries an A_Route value. Dispatched by AreRouteWatcher on client-side navigation events (pushState, replaceState, popstate). The signal bus delivers it to all subscribed root nodes, triggering route-based conditional rendering across the component tree."
820
+ })
821
+ ], AreRoute);
822
+
823
+ // src/engine/AreHTML.constants.ts
824
+ var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
825
+ "allowfullscreen",
826
+ "async",
827
+ "autofocus",
828
+ "autoplay",
829
+ "checked",
830
+ "controls",
831
+ "default",
832
+ "defer",
833
+ "disabled",
834
+ "formnovalidate",
835
+ "hidden",
836
+ "inert",
837
+ "ismap",
838
+ "itemscope",
839
+ "loop",
840
+ "multiple",
841
+ "muted",
842
+ "nomodule",
843
+ "novalidate",
844
+ "open",
845
+ "playsinline",
846
+ "readonly",
847
+ "required",
848
+ "reversed",
849
+ "selected"
850
+ ]);
851
+ function isBooleanAttribute(name) {
852
+ return BOOLEAN_ATTRIBUTES.has(name.toLowerCase());
853
+ }
854
+ var IDL_FORM_PROPERTIES = {
855
+ INPUT: /* @__PURE__ */ new Set(["value", "checked", "indeterminate"]),
856
+ TEXTAREA: /* @__PURE__ */ new Set(["value"]),
857
+ SELECT: /* @__PURE__ */ new Set(["value"]),
858
+ OPTION: /* @__PURE__ */ new Set(["selected"])
859
+ };
860
+ function isIDLFormProperty(tagName, attrName) {
861
+ const set = IDL_FORM_PROPERTIES[tagName.toUpperCase()];
862
+ return !!set && set.has(attrName);
863
+ }
864
+ function normalizeClassValue(value) {
865
+ if (value === null || value === void 0 || value === false) return "";
866
+ if (typeof value === "string") return value;
867
+ if (typeof value === "number") return String(value);
868
+ if (Array.isArray(value)) {
869
+ return value.map(normalizeClassValue).filter(Boolean).join(" ");
870
+ }
871
+ if (typeof value === "object") {
872
+ const parts = [];
873
+ for (const key of Object.keys(value)) {
874
+ if (value[key]) parts.push(key);
875
+ }
876
+ return parts.join(" ");
877
+ }
878
+ return "";
879
+ }
880
+ function normalizeStyleValue(value) {
881
+ if (value === null || value === void 0 || value === false) return "";
882
+ if (typeof value === "string") return value;
883
+ if (typeof value === "number") return String(value);
884
+ if (Array.isArray(value)) {
885
+ return value.map(normalizeStyleValue).filter(Boolean).join("; ");
886
+ }
887
+ if (typeof value === "object") {
888
+ const parts = [];
889
+ for (const key of Object.keys(value)) {
890
+ const v = value[key];
891
+ if (v === null || v === void 0 || v === false) continue;
892
+ const kebab = key.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase());
893
+ parts.push(`${kebab}: ${v}`);
894
+ }
895
+ return parts.join("; ");
896
+ }
897
+ return "";
898
+ }
899
+ function parseEventName(raw) {
900
+ const [event, ...modifiers] = raw.split(".");
901
+ return { event, modifiers: new Set(modifiers) };
902
+ }
903
+ var LISTENER_OPTION_MODIFIERS = /* @__PURE__ */ new Set(["capture", "once", "passive"]);
904
+ function toDOMString(value) {
905
+ if (value === null || value === void 0) return "";
906
+ if (typeof value === "string") return value;
907
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
908
+ try {
909
+ return JSON.stringify(value);
910
+ } catch {
911
+ return "";
912
+ }
913
+ }
734
914
  var AreHTMLEngineContext = class extends AreContext {
735
915
  constructor(props) {
736
916
  super(props.container?.body.innerHTML || props.source || "");
@@ -856,7 +1036,11 @@ var AreHTMLEngineContext = class extends AreContext {
856
1036
  if (!this.index.elementListeners.has(element)) {
857
1037
  this.index.elementListeners.set(element, /* @__PURE__ */ new Map());
858
1038
  }
859
- this.index.elementListeners.get(element).set(eventName, listener);
1039
+ const byEvent = this.index.elementListeners.get(element);
1040
+ if (!byEvent.has(eventName)) {
1041
+ byEvent.set(eventName, /* @__PURE__ */ new Set());
1042
+ }
1043
+ byEvent.get(eventName).add(listener);
860
1044
  }
861
1045
  /**
862
1046
  * Retrieves the event listener associated with a specific DOM element and event name from the context's index. This method looks up the element in the elementListeners map and then retrieves the listener for the specified event name. If no listener is found for the given element and event, it returns undefined. This allows the engine to efficiently access and manage event listeners that have been attached to dynamically created elements, enabling proper cleanup when instructions are reverted or when nodes are removed from the DOM.
@@ -866,6 +1050,14 @@ var AreHTMLEngineContext = class extends AreContext {
866
1050
  * @returns
867
1051
  */
868
1052
  getListener(element, eventName) {
1053
+ const set = this.index.elementListeners.get(element)?.get(eventName);
1054
+ if (!set || set.size === 0) return void 0;
1055
+ return set.values().next().value;
1056
+ }
1057
+ /**
1058
+ * Returns all listeners registered for a given element + event name.
1059
+ */
1060
+ getListeners(element, eventName) {
869
1061
  return this.index.elementListeners.get(element)?.get(eventName);
870
1062
  }
871
1063
  /**
@@ -874,10 +1066,26 @@ var AreHTMLEngineContext = class extends AreContext {
874
1066
  * @param element
875
1067
  * @param eventName
876
1068
  */
877
- removeListener(element, eventName) {
878
- this.index.elementListeners.get(element)?.delete(eventName);
1069
+ removeListener(element, eventName, listener) {
1070
+ const byEvent = this.index.elementListeners.get(element);
1071
+ if (!byEvent) return;
1072
+ if (listener) {
1073
+ const set = byEvent.get(eventName);
1074
+ if (set) {
1075
+ set.delete(listener);
1076
+ if (set.size === 0) byEvent.delete(eventName);
1077
+ }
1078
+ } else {
1079
+ byEvent.delete(eventName);
1080
+ }
879
1081
  }
880
1082
  };
1083
+ AreHTMLEngineContext = __decorateClass([
1084
+ A_Frame.Define({
1085
+ namespace: "a-are-html",
1086
+ description: "Runtime index for the HTML rendering engine. Maps each AreNode and instruction ASEID to its corresponding DOM element so that apply and revert handlers on interpreter instructions can look up their DOM node in O(1). Tracks root-element mounts and maintains the group-level index used by structural directives."
1087
+ })
1088
+ ], AreHTMLEngineContext);
881
1089
  var AreHTMLCompiler = class extends AreCompiler {
882
1090
  compileInterpolation(interpolation, scene, store, logger, ...args) {
883
1091
  scene.plan(new AddTextInstruction({ content: interpolation.content, evaluate: true }));
@@ -919,38 +1127,66 @@ var AreHTMLCompiler = class extends AreCompiler {
919
1127
  handler: attribute.content
920
1128
  }));
921
1129
  }
922
- compileBindingAttribute(attribute, scene, parentStore, store, ...args) {
1130
+ compileBindingAttribute(attribute, scene, parentStore, store, syntax, ...args) {
923
1131
  if (!scene.host)
924
1132
  throw new AreCompilerError({
925
1133
  title: "Scene Host Not Found",
926
1134
  description: `No host found for the scene with id: ${scene.id}. Please ensure that the scene is properly initialized and has a host before compiling binding attributes.`
927
1135
  });
928
1136
  const node = attribute.owner;
929
- if (node.component && node.component.props[attribute.name]) {
930
- const propDefinition = node.component.props[attribute.name];
931
- let value = parentStore.get(attribute.content);
932
- if (propDefinition.type) {
933
- switch (propDefinition.type) {
934
- case "string":
935
- value = String(value);
936
- break;
937
- case "number":
938
- value = Number(value);
939
- break;
940
- case "boolean":
941
- value = Boolean(value);
942
- break;
943
- }
1137
+ const props = node.component?.props;
1138
+ let propName;
1139
+ if (props) {
1140
+ if (props[attribute.name]) {
1141
+ propName = attribute.name;
1142
+ } else {
1143
+ const camel = A_FormatterHelper.toCamelCase(attribute.name);
1144
+ if (props[camel]) propName = camel;
944
1145
  }
945
- store.set(attribute.name, value);
946
- } else {
947
- const instruction = new AddAttributeInstruction(scene.host, {
948
- name: attribute.name,
949
- content: attribute.content,
950
- evaluate: true
951
- });
952
- scene.plan(instruction);
953
1146
  }
1147
+ if (propName && props) {
1148
+ const propDefinition = props[propName];
1149
+ const coerce = (raw) => {
1150
+ let value = raw;
1151
+ if (propDefinition.type) {
1152
+ switch (propDefinition.type) {
1153
+ case "string":
1154
+ value = value === void 0 || value === null ? "" : String(value);
1155
+ break;
1156
+ case "number":
1157
+ value = Number(value);
1158
+ break;
1159
+ case "boolean":
1160
+ value = Boolean(value);
1161
+ break;
1162
+ }
1163
+ }
1164
+ return value;
1165
+ };
1166
+ const watcher = {
1167
+ update: () => {
1168
+ try {
1169
+ parentStore.watch(watcher);
1170
+ const next = coerce(syntax.evaluate(attribute.content, parentStore));
1171
+ parentStore.unwatch(watcher);
1172
+ store.set(propName, next);
1173
+ } catch (e) {
1174
+ parentStore.unwatch(watcher);
1175
+ }
1176
+ }
1177
+ };
1178
+ parentStore.watch(watcher);
1179
+ const initial = coerce(syntax.evaluate(attribute.content, parentStore));
1180
+ parentStore.unwatch(watcher);
1181
+ store.set(propName, initial);
1182
+ return;
1183
+ }
1184
+ const instruction = new AddAttributeInstruction(scene.host, {
1185
+ name: attribute.name,
1186
+ content: attribute.content,
1187
+ evaluate: true
1188
+ });
1189
+ scene.plan(instruction);
954
1190
  }
955
1191
  };
956
1192
  __decorateClass([
@@ -989,12 +1225,12 @@ __decorateClass([
989
1225
  __decorateParam(1, A_Inject(AreScene)),
990
1226
  __decorateParam(2, A_Dependency.Parent()),
991
1227
  __decorateParam(2, A_Inject(AreStore)),
992
- __decorateParam(3, A_Inject(AreStore))
1228
+ __decorateParam(3, A_Inject(AreStore)),
1229
+ __decorateParam(4, A_Inject(AreSyntax))
993
1230
  ], AreHTMLCompiler.prototype, "compileBindingAttribute", 1);
994
1231
  AreHTMLCompiler = __decorateClass([
995
- A_Frame.Component({
996
- namespace: "A-ARE",
997
- name: "AreHTMLCompiler",
1232
+ A_Frame.Define({
1233
+ namespace: "a-are-html",
998
1234
  description: "HTML-specific compiler for A-Concept Rendering Engine (ARE) components, extending the base AreCompiler to handle HTML templates, styles, and rendering logic tailored for web environments."
999
1235
  })
1000
1236
  ], AreHTMLCompiler);
@@ -1021,6 +1257,7 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1021
1257
  });
1022
1258
  }
1023
1259
  const element = context.container.createElement(tag);
1260
+ element.setAttribute("data-aseid", node.aseid.toString());
1024
1261
  if (mountPoint.nodeType === Node.ELEMENT_NODE) {
1025
1262
  mountPoint.appendChild(element);
1026
1263
  } else {
@@ -1062,23 +1299,80 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1062
1299
  });
1063
1300
  }
1064
1301
  const { name, content, evaluate } = mutation.payload;
1065
- const value = evaluate ? syntax.evaluate(content, store, {
1302
+ const rawValue = evaluate ? syntax.evaluate(content, store, {
1066
1303
  ...directiveContext?.scope || {}
1067
1304
  }) : content;
1068
- if (mutation.cache === void 0) {
1069
- const existingValue = element.getAttribute(name);
1070
- const result = existingValue ? `${existingValue} ${value}` : value;
1071
- element.setAttribute(name, result);
1072
- mutation.cache = value;
1305
+ const el = element;
1306
+ const lowerName = name.toLowerCase();
1307
+ if (isBooleanAttribute(lowerName)) {
1308
+ if (rawValue) {
1309
+ el.setAttribute(lowerName, "");
1310
+ try {
1311
+ el[lowerName] = true;
1312
+ } catch {
1313
+ }
1314
+ } else {
1315
+ el.removeAttribute(lowerName);
1316
+ try {
1317
+ el[lowerName] = false;
1318
+ } catch {
1319
+ }
1320
+ }
1321
+ mutation.cache = rawValue ? "true" : "";
1322
+ return;
1323
+ }
1324
+ if (isIDLFormProperty(el.tagName, name)) {
1325
+ const propName = name === "value" ? "value" : name === "checked" ? "checked" : name === "selected" ? "selected" : name === "indeterminate" ? "indeterminate" : name;
1326
+ try {
1327
+ if (propName === "checked" || propName === "selected" || propName === "indeterminate") {
1328
+ el[propName] = !!rawValue;
1329
+ } else {
1330
+ el[propName] = toDOMString(rawValue);
1331
+ }
1332
+ } catch {
1333
+ }
1334
+ if (propName !== "value") {
1335
+ if (rawValue) el.setAttribute(name, "");
1336
+ else el.removeAttribute(name);
1337
+ } else {
1338
+ el.setAttribute(name, toDOMString(rawValue));
1339
+ }
1340
+ mutation.cache = toDOMString(rawValue);
1341
+ return;
1342
+ }
1343
+ if (lowerName === "class") {
1344
+ const newValue = normalizeClassValue(rawValue);
1345
+ if (mutation.cache === void 0) {
1346
+ const existingValue = el.getAttribute("class");
1347
+ const merged = existingValue ? `${existingValue} ${newValue}`.trim() : newValue;
1348
+ if (merged) el.setAttribute("class", merged);
1349
+ else el.removeAttribute("class");
1350
+ } else {
1351
+ const existingValue = el.getAttribute("class");
1352
+ const existingParts = existingValue ? existingValue.split(/\s+/).filter(Boolean) : [];
1353
+ const oldParts = new Set(mutation.cache.split(/\s+/).filter(Boolean));
1354
+ const newParts = newValue ? newValue.split(/\s+/).filter(Boolean) : [];
1355
+ const merged = [...existingParts.filter((p) => !oldParts.has(p)), ...newParts].join(" ");
1356
+ if (merged) el.setAttribute("class", merged);
1357
+ else el.removeAttribute("class");
1358
+ }
1359
+ mutation.cache = newValue;
1360
+ return;
1361
+ }
1362
+ if (lowerName === "style") {
1363
+ const newValue = normalizeStyleValue(rawValue);
1364
+ if (newValue) el.setAttribute("style", newValue);
1365
+ else el.removeAttribute("style");
1366
+ mutation.cache = newValue;
1367
+ return;
1368
+ }
1369
+ const stringValue = toDOMString(rawValue);
1370
+ if (stringValue === "" && evaluate && (rawValue === false || rawValue === null || rawValue === void 0)) {
1371
+ el.removeAttribute(name);
1073
1372
  } else {
1074
- const existingValue = element.getAttribute(name);
1075
- const existingParts = existingValue ? existingValue.split(/\s+/).filter(Boolean) : [];
1076
- const oldParts = new Set(mutation.cache.split(/\s+/).filter(Boolean));
1077
- const newParts = value ? value.split(/\s+/).filter(Boolean) : [];
1078
- const result = [...existingParts.filter((part) => !oldParts.has(part)), ...newParts].join(" ");
1079
- element.setAttribute(name, result);
1080
- mutation.cache = value;
1373
+ el.setAttribute(name, stringValue);
1081
1374
  }
1375
+ mutation.cache = stringValue;
1082
1376
  }
1083
1377
  removeAttribute(mutation, context) {
1084
1378
  try {
@@ -1100,12 +1394,19 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1100
1394
  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.`
1101
1395
  });
1102
1396
  }
1397
+ const { event: eventName, modifiers } = parseEventName(mutation.payload.name);
1398
+ const listenerOptions = {};
1399
+ if (modifiers.has("capture")) listenerOptions.capture = true;
1400
+ if (modifiers.has("once")) listenerOptions.once = true;
1401
+ if (modifiers.has("passive")) listenerOptions.passive = true;
1103
1402
  const handlers = syntax.extractEmitHandlers(mutation.payload.handler);
1403
+ let liveEvent = null;
1104
1404
  const handlerScope = {};
1105
1405
  for (const handler of handlers) {
1106
1406
  const handlerFn = (...args) => {
1107
1407
  const event = new AreEvent(handler);
1108
- event.set("args", args);
1408
+ const effectiveArgs = args.length === 0 && liveEvent ? [liveEvent] : liveEvent ? [...args, liveEvent] : args;
1409
+ event.set("args", effectiveArgs);
1109
1410
  event.set("element", element);
1110
1411
  event.set("instruction", mutation);
1111
1412
  mutation.owner.emit(event);
@@ -1113,34 +1414,80 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1113
1414
  handlerScope[`$${handler}`] = handlerFn;
1114
1415
  }
1115
1416
  const callback = (e) => {
1116
- context.startPerformance("Click");
1117
- const result = syntax.evaluate(mutation.payload.handler, store, {
1118
- ...handlerScope,
1119
- ...directiveContext?.scope || {}
1120
- });
1121
- if (typeof result === "function") result(e);
1417
+ try {
1418
+ liveEvent = e;
1419
+ if (modifiers.has("self") && e.target !== element) return;
1420
+ if (modifiers.has("stop")) e.stopPropagation();
1421
+ if (modifiers.has("prevent")) e.preventDefault();
1422
+ if (e instanceof KeyboardEvent && modifiers.size > 0) {
1423
+ const key = (e.key || "").toLowerCase();
1424
+ const KEY_ALIASES = {
1425
+ enter: ["enter"],
1426
+ esc: ["escape"],
1427
+ escape: ["escape"],
1428
+ tab: ["tab"],
1429
+ space: [" ", "spacebar"],
1430
+ up: ["arrowup"],
1431
+ down: ["arrowdown"],
1432
+ left: ["arrowleft"],
1433
+ right: ["arrowright"],
1434
+ delete: ["delete", "backspace"]
1435
+ };
1436
+ const keyMods = [...modifiers].filter((m) => m in KEY_ALIASES || m === "ctrl" || m === "alt" || m === "shift" || m === "meta");
1437
+ if (keyMods.length > 0) {
1438
+ const keyMatch = keyMods.some((m) => {
1439
+ if (m === "ctrl") return e.ctrlKey;
1440
+ if (m === "alt") return e.altKey;
1441
+ if (m === "shift") return e.shiftKey;
1442
+ if (m === "meta") return e.metaKey;
1443
+ const aliases = KEY_ALIASES[m];
1444
+ return aliases && aliases.includes(key);
1445
+ });
1446
+ if (!keyMatch) return;
1447
+ }
1448
+ }
1449
+ context.startPerformance("event:" + eventName);
1450
+ const result = syntax.evaluate(mutation.payload.handler, store, {
1451
+ ...handlerScope,
1452
+ $event: e,
1453
+ ...directiveContext?.scope || {}
1454
+ });
1455
+ if (typeof result === "function") result(e);
1456
+ context.endPerformance("event:" + eventName);
1457
+ } catch (err) {
1458
+ logger?.error(err);
1459
+ } finally {
1460
+ liveEvent = null;
1461
+ }
1122
1462
  };
1123
- if (callback) {
1124
- element.addEventListener(mutation.payload.name, callback);
1125
- context.addListener(element, mutation.payload.name, callback);
1463
+ const useOptions = listenerOptions.capture || listenerOptions.once || listenerOptions.passive;
1464
+ if (useOptions) {
1465
+ element.addEventListener(eventName, callback, listenerOptions);
1466
+ } else {
1467
+ element.addEventListener(eventName, callback);
1126
1468
  }
1469
+ mutation.payload._callback = callback;
1470
+ context.addListener(element, mutation.payload.name, callback);
1127
1471
  }
1128
1472
  removeEventListener(mutation, context) {
1129
1473
  const element = context.getElementByInstruction(mutation.parent);
1130
1474
  if (!element) return;
1131
1475
  const { name } = mutation.payload;
1132
- const listener = context.getListener(element, name);
1476
+ const { event: eventName } = parseEventName(name);
1477
+ const listener = mutation.payload._callback;
1133
1478
  if (listener) {
1134
- element.removeEventListener(name, listener);
1135
- context.removeListener(element, name);
1479
+ element.removeEventListener(eventName, listener);
1480
+ context.removeListener(element, name, listener);
1481
+ mutation.payload._callback = void 0;
1136
1482
  }
1137
1483
  }
1138
1484
  addText(declaration, context, store, syntax, directiveContext, logger) {
1139
1485
  const node = declaration.owner.parent;
1140
1486
  const { content, evaluate } = declaration.payload;
1141
- const value = evaluate ? syntax.evaluate(content, store, {
1487
+ const rawValue = evaluate ? syntax.evaluate(content, store, {
1142
1488
  ...directiveContext?.scope || {}
1143
1489
  }) : content;
1490
+ const value = toDOMString(rawValue);
1144
1491
  if (!node) {
1145
1492
  const textNode = context.container.createTextNode(value);
1146
1493
  context.container.body.appendChild(textNode);
@@ -1173,9 +1520,10 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1173
1520
  addComment(declaration, context, store, syntax, directiveContext, logger) {
1174
1521
  const node = declaration.owner.parent;
1175
1522
  const { content, evaluate } = declaration.payload;
1176
- const value = evaluate ? syntax.evaluate(content, store, {
1523
+ const rawValue = evaluate ? syntax.evaluate(content, store, {
1177
1524
  ...directiveContext?.scope || {}
1178
1525
  }) : content;
1526
+ const value = toDOMString(rawValue);
1179
1527
  if (!node) {
1180
1528
  const commentNode = context.container.createComment(value);
1181
1529
  context.container.body.appendChild(commentNode);
@@ -1207,7 +1555,7 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1207
1555
  }
1208
1556
  };
1209
1557
  __decorateClass([
1210
- A_Frame.Method({
1558
+ A_Frame.Define({
1211
1559
  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."
1212
1560
  }),
1213
1561
  AreInterpreter.Apply(AreInstructionDefaultNames.Default),
@@ -1217,7 +1565,7 @@ __decorateClass([
1217
1565
  __decorateParam(2, A_Inject(A_Logger))
1218
1566
  ], AreHTMLInterpreter.prototype, "addElement", 1);
1219
1567
  __decorateClass([
1220
- A_Frame.Method({
1568
+ A_Frame.Define({
1221
1569
  description: "Remove an HTML element that was created by a CreateElement declaration. Cleans up the DOM and the context index."
1222
1570
  }),
1223
1571
  AreInterpreter.Revert(AreInstructionDefaultNames.Default),
@@ -1226,7 +1574,7 @@ __decorateClass([
1226
1574
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
1227
1575
  ], AreHTMLInterpreter.prototype, "removeElement", 1);
1228
1576
  __decorateClass([
1229
- A_Frame.Method({
1577
+ A_Frame.Define({
1230
1578
  description: "Add an attribute to an HTML element based on the provided mutation instruction."
1231
1579
  }),
1232
1580
  AreInterpreter.Apply(AreHTMLInstructions.AddAttribute),
@@ -1239,7 +1587,7 @@ __decorateClass([
1239
1587
  __decorateParam(5, A_Inject(A_Logger))
1240
1588
  ], AreHTMLInterpreter.prototype, "addAttribute", 1);
1241
1589
  __decorateClass([
1242
- A_Frame.Method({
1590
+ A_Frame.Define({
1243
1591
  description: "Remove an attribute from an HTML element based on the provided mutation instruction."
1244
1592
  }),
1245
1593
  AreInterpreter.Revert(AreHTMLInstructions.AddAttribute),
@@ -1247,7 +1595,7 @@ __decorateClass([
1247
1595
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
1248
1596
  ], AreHTMLInterpreter.prototype, "removeAttribute", 1);
1249
1597
  __decorateClass([
1250
- A_Frame.Method({
1598
+ A_Frame.Define({
1251
1599
  description: "Add an event listener to an HTML element based on the provided mutation instruction."
1252
1600
  }),
1253
1601
  AreInterpreter.Apply(AreHTMLInstructions.AddListener),
@@ -1259,7 +1607,7 @@ __decorateClass([
1259
1607
  __decorateParam(5, A_Inject(A_Logger))
1260
1608
  ], AreHTMLInterpreter.prototype, "addEventListener", 1);
1261
1609
  __decorateClass([
1262
- A_Frame.Method({
1610
+ A_Frame.Define({
1263
1611
  description: "Remove an event listener from an HTML element based on the provided mutation instruction."
1264
1612
  }),
1265
1613
  AreInterpreter.Revert(AreHTMLInstructions.AddListener),
@@ -1267,7 +1615,7 @@ __decorateClass([
1267
1615
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
1268
1616
  ], AreHTMLInterpreter.prototype, "removeEventListener", 1);
1269
1617
  __decorateClass([
1270
- A_Frame.Method({
1618
+ A_Frame.Define({
1271
1619
  description: "Add text content to an HTML element based on the provided declaration instruction."
1272
1620
  }),
1273
1621
  AreInterpreter.Apply(AreHTMLInstructions.AddText),
@@ -1280,7 +1628,7 @@ __decorateClass([
1280
1628
  __decorateParam(5, A_Inject(A_Logger))
1281
1629
  ], AreHTMLInterpreter.prototype, "addText", 1);
1282
1630
  __decorateClass([
1283
- A_Frame.Method({
1631
+ A_Frame.Define({
1284
1632
  description: "Remove text content from an HTML element based on the provided declaration instruction."
1285
1633
  }),
1286
1634
  AreInterpreter.Revert(AreHTMLInstructions.AddText),
@@ -1288,7 +1636,7 @@ __decorateClass([
1288
1636
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
1289
1637
  ], AreHTMLInterpreter.prototype, "removeText", 1);
1290
1638
  __decorateClass([
1291
- A_Frame.Method({
1639
+ A_Frame.Define({
1292
1640
  description: "Add a comment node to the DOM based on the provided declaration instruction."
1293
1641
  }),
1294
1642
  AreInterpreter.Apply(AreHTMLInstructions.AddComment),
@@ -1301,7 +1649,7 @@ __decorateClass([
1301
1649
  __decorateParam(5, A_Inject(A_Logger))
1302
1650
  ], AreHTMLInterpreter.prototype, "addComment", 1);
1303
1651
  __decorateClass([
1304
- A_Frame.Method({
1652
+ A_Frame.Define({
1305
1653
  description: "Remove a comment node from the DOM based on the provided declaration instruction."
1306
1654
  }),
1307
1655
  AreInterpreter.Revert(AreHTMLInstructions.AddComment),
@@ -1309,16 +1657,15 @@ __decorateClass([
1309
1657
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
1310
1658
  ], AreHTMLInterpreter.prototype, "removeComment", 1);
1311
1659
  AreHTMLInterpreter = __decorateClass([
1312
- A_Frame.Component({
1313
- namespace: "A-ARE",
1314
- name: "AreHTMLInterpreter",
1315
- 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."
1660
+ A_Frame.Define({
1661
+ namespace: "a-are-html",
1662
+ 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."
1316
1663
  })
1317
1664
  ], AreHTMLInterpreter);
1318
1665
  var AreHTMLTokenizer = class extends AreTokenizer {
1319
1666
  constructor() {
1320
1667
  super(...arguments);
1321
- this.ATTR_PATTERN = /([$:@]?[\w-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>/"'=]+)))?/g;
1668
+ this.ATTR_PATTERN = /([$:@]?[\w.-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>/"'=]+)))?/g;
1322
1669
  }
1323
1670
  tokenize(node, context, logger) {
1324
1671
  super.tokenize(node, context, logger);
@@ -1371,6 +1718,12 @@ __decorateClass([
1371
1718
  __decorateParam(1, A_Inject(AreContext)),
1372
1719
  __decorateParam(2, A_Inject(A_Logger))
1373
1720
  ], AreHTMLTokenizer.prototype, "tokenize", 1);
1721
+ AreHTMLTokenizer = __decorateClass([
1722
+ A_Frame.Define({
1723
+ namespace: "a-are-html",
1724
+ description: "HTML-specific tokenizer extending AreTokenizer. Parses raw HTML template strings into AreHTMLNode trees by scanning element tags and resolving directive ($), event (@), binding (:), and static attributes to their typed attribute classes, constructing AreComponentNode and AreRootNode instances where required."
1725
+ })
1726
+ ], AreHTMLTokenizer);
1374
1727
  var AreHTMLLifecycle = class extends AreLifecycle {
1375
1728
  initComponent(node, scope, context, logger, ...args) {
1376
1729
  super.init(node, scope, context, logger, ...args);
@@ -1434,6 +1787,12 @@ __decorateClass([
1434
1787
  __decorateParam(2, A_Inject(A_Feature)),
1435
1788
  __decorateParam(3, A_Inject(A_Logger))
1436
1789
  ], AreHTMLLifecycle.prototype, "updateDirectiveAttribute", 1);
1790
+ AreHTMLLifecycle = __decorateClass([
1791
+ A_Frame.Define({
1792
+ namespace: "a-are-html",
1793
+ 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."
1794
+ })
1795
+ ], AreHTMLLifecycle);
1437
1796
  var AreHTMLTransformer = class extends AreTransformer {
1438
1797
  transformDirectiveAttribute(directive, store, feature, logger, ...args) {
1439
1798
  store.watch(directive);
@@ -1455,6 +1814,12 @@ __decorateClass([
1455
1814
  __decorateParam(2, A_Inject(A_Feature)),
1456
1815
  __decorateParam(3, A_Inject(A_Logger))
1457
1816
  ], AreHTMLTransformer.prototype, "transformDirectiveAttribute", 1);
1817
+ AreHTMLTransformer = __decorateClass([
1818
+ A_Frame.Define({
1819
+ namespace: "a-are-html",
1820
+ description: "HTML-specific transformer extending AreTransformer. Handles directive-attribute structural rewrites before compilation \u2014 sorting directives by declared priority and expanding compound directive expressions \u2014 so the compiler receives a clean, ordered AreHTMLNode tree ready for instruction emission."
1821
+ })
1822
+ ], AreHTMLTransformer);
1458
1823
 
1459
1824
  // src/engine/AreHTML.engine.ts
1460
1825
  var AreHTMLEngine = class extends AreEngine {
@@ -1566,8 +1931,12 @@ var AreHTMLEngine = class extends AreEngine {
1566
1931
  if (nextOpen !== -1 && nextOpen < nextClose) {
1567
1932
  const charAfter = source[nextOpen + tagName.length + 1];
1568
1933
  if (charAfter === " " || charAfter === ">" || charAfter === "/") {
1569
- level++;
1570
- searchIndex = nextOpen + tagName.length + 1;
1934
+ const innerEnd = AreHTMLEngine.findTagClose(source, nextOpen);
1935
+ const isSelfClose = innerEnd !== -1 && source[innerEnd - 1] === "/";
1936
+ if (!isSelfClose) {
1937
+ level++;
1938
+ }
1939
+ searchIndex = innerEnd === -1 ? nextOpen + tagName.length + 1 : innerEnd + 1;
1571
1940
  continue;
1572
1941
  }
1573
1942
  }
@@ -1611,10 +1980,9 @@ __decorateClass([
1611
1980
  __decorateParam(0, A_Inject(A_Scope))
1612
1981
  ], AreHTMLEngine.prototype, "init", 1);
1613
1982
  AreHTMLEngine = __decorateClass([
1614
- A_Frame.Component({
1615
- namespace: "A-ARE",
1616
- name: "AreHTMLEngine",
1617
- description: "HTML Rendering Engine for A-Concept Rendering Engine (ARE), responsible for processing and rendering HTML templates within the ARE framework."
1983
+ A_Frame.Define({
1984
+ namespace: "a-are-html",
1985
+ description: "Concrete HTML rendering engine that assembles the full ARE pipeline for web environments. Bootstraps and wires AreHTMLTokenizer, AreHTMLTransformer, AreHTMLCompiler, AreHTMLInterpreter, and AreHTMLLifecycle; mounts root nodes from inline or fetched templates; and drives reactive re-renders via the AreSignals bus."
1618
1986
  })
1619
1987
  ], AreHTMLEngine);
1620
1988
  var AreRoot = class extends Are {
@@ -1707,13 +2075,12 @@ __decorateClass([
1707
2075
  __decorateParam(4, A_Inject(AreSignalsContext))
1708
2076
  ], AreRoot.prototype, "onSignal", 1);
1709
2077
  AreRoot = __decorateClass([
1710
- A_Frame.Component({
1711
- namespace: "A-ARE",
1712
- name: "AreRoot",
2078
+ A_Frame.Define({
2079
+ namespace: "a-are-html",
1713
2080
  description: "The AreRoot component serves as the foundational entry point for the A-Concept Rendering Engine (ARE). It is responsible for initializing the rendering process, managing the root node of the component tree, and handling signal-based rendering logic. The AreRoot component processes incoming signals to determine which child components to render, allowing for dynamic and responsive UI updates based on application state and user interactions."
1714
2081
  })
1715
2082
  ], AreRoot);
1716
- var AreWatcher = class extends A_Component {
2083
+ var AreRouteWatcher = class extends A_Component {
1717
2084
  constructor() {
1718
2085
  super();
1719
2086
  this.handlers = /* @__PURE__ */ new Set();
@@ -1769,14 +2136,13 @@ var AreWatcher = class extends A_Component {
1769
2136
  }
1770
2137
  }
1771
2138
  };
1772
- AreWatcher = __decorateClass([
1773
- A_Frame.Component({
1774
- namespace: "A-ARE",
1775
- name: "AreWatcher",
1776
- description: "AreWatcher is a component that observes browser navigation events (history pushState, replaceState, and popstate) and notifies registered handlers when the URL changes, enabling client-side routing and reactive route-based rendering within the ARE framework."
2139
+ AreRouteWatcher = __decorateClass([
2140
+ A_Frame.Define({
2141
+ namespace: "a-are-html",
2142
+ description: "AreRouteWatcher is a component that observes browser navigation events (history pushState, replaceState, and popstate) and notifies registered handlers when the URL changes, enabling client-side routing and reactive route-based rendering within the ARE framework."
1777
2143
  })
1778
- ], AreWatcher);
2144
+ ], AreRouteWatcher);
1779
2145
 
1780
- export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, AreInterpolation, AreRoot, AreRootNode, AreRoute, AreStaticAttribute, AreStyle, AreText, AreWatcher };
2146
+ export { AddAttributeInstruction, AddElementInstruction, AddInterpolationInstruction, AddListenerInstruction, AddStyleInstruction, AddTextInstruction, AreBindingAttribute, AreComment, AreComponentNode, AreDirective, AreDirectiveAttribute, AreDirectiveContext, AreDirectiveFeatures, AreDirectiveFor, AreDirectiveIf, AreDirectiveMeta, AreEventAttribute, AreHTMLAttribute, AreHTMLCompiler, AreHTMLEngine, AreHTMLEngineContext, AreHTMLInstructions, AreHTMLInterpreter, AreHTMLLifecycle, AreHTMLNode, AreHTMLTokenizer, AreHTMLTransformer, AreInterpolation, AreRoot, AreRootNode, AreRoute, AreRouteWatcher, AreStaticAttribute, AreStyle, AreText, BOOLEAN_ATTRIBUTES, IDL_FORM_PROPERTIES, LISTENER_OPTION_MODIFIERS, isBooleanAttribute, isIDLFormProperty, normalizeClassValue, normalizeStyleValue, parseEventName, toDOMString };
1781
2147
  //# sourceMappingURL=index.mjs.map
1782
2148
  //# sourceMappingURL=index.mjs.map