@adaas/are-html 0.0.11 → 0.0.13

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 (113) hide show
  1. package/dist/browser/index.d.mts +19 -4
  2. package/dist/browser/index.mjs +115 -8
  3. package/dist/browser/index.mjs.map +1 -1
  4. package/dist/node/{AreBinding.attribute-C6JasbJL.d.ts → AreBinding.attribute-Bm5LlOyE.d.ts} +7 -0
  5. package/dist/node/{AreBinding.attribute-C6qrxN8K.d.mts → AreBinding.attribute-doUvtOjc.d.mts} +7 -0
  6. package/dist/node/attributes/AreBinding.attribute.d.mts +1 -1
  7. package/dist/node/attributes/AreBinding.attribute.d.ts +1 -1
  8. package/dist/node/attributes/AreDirective.attribute.d.mts +1 -1
  9. package/dist/node/attributes/AreDirective.attribute.d.ts +1 -1
  10. package/dist/node/attributes/AreEvent.attribute.d.mts +1 -1
  11. package/dist/node/attributes/AreEvent.attribute.d.ts +1 -1
  12. package/dist/node/attributes/AreStatic.attribute.d.mts +1 -1
  13. package/dist/node/attributes/AreStatic.attribute.d.ts +1 -1
  14. package/dist/node/directives/AreDirectiveFor.directive.d.mts +1 -1
  15. package/dist/node/directives/AreDirectiveFor.directive.d.ts +1 -1
  16. package/dist/node/directives/AreDirectiveFor.directive.js +11 -1
  17. package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -1
  18. package/dist/node/directives/AreDirectiveFor.directive.mjs +11 -1
  19. package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -1
  20. package/dist/node/directives/AreDirectiveIf.directive.d.mts +1 -1
  21. package/dist/node/directives/AreDirectiveIf.directive.d.ts +1 -1
  22. package/dist/node/engine/AreHTML.compiler.d.mts +8 -1
  23. package/dist/node/engine/AreHTML.compiler.d.ts +8 -1
  24. package/dist/node/engine/AreHTML.compiler.js +17 -0
  25. package/dist/node/engine/AreHTML.compiler.js.map +1 -1
  26. package/dist/node/engine/AreHTML.compiler.mjs +17 -0
  27. package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
  28. package/dist/node/engine/AreHTML.context.js +2 -2
  29. package/dist/node/engine/AreHTML.context.js.map +1 -1
  30. package/dist/node/engine/AreHTML.context.mjs +3 -3
  31. package/dist/node/engine/AreHTML.context.mjs.map +1 -1
  32. package/dist/node/engine/AreHTML.interpreter.d.mts +3 -0
  33. package/dist/node/engine/AreHTML.interpreter.d.ts +3 -0
  34. package/dist/node/engine/AreHTML.interpreter.js +44 -0
  35. package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
  36. package/dist/node/engine/AreHTML.interpreter.mjs +44 -0
  37. package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
  38. package/dist/node/engine/AreHTML.lifecycle.d.mts +2 -1
  39. package/dist/node/engine/AreHTML.lifecycle.d.ts +2 -1
  40. package/dist/node/engine/AreHTML.lifecycle.js +13 -1
  41. package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
  42. package/dist/node/engine/AreHTML.lifecycle.mjs +13 -1
  43. package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
  44. package/dist/node/engine/AreHTML.tokenizer.d.mts +1 -1
  45. package/dist/node/engine/AreHTML.tokenizer.d.ts +1 -1
  46. package/dist/node/engine/AreHTML.transformer.d.mts +1 -1
  47. package/dist/node/engine/AreHTML.transformer.d.ts +1 -1
  48. package/dist/node/index.d.mts +1 -1
  49. package/dist/node/index.d.ts +1 -1
  50. package/dist/node/instructions/AreHTML.instructions.types.d.mts +2 -4
  51. package/dist/node/instructions/AreHTML.instructions.types.d.ts +2 -4
  52. package/dist/node/lib/AreDirective/AreDirective.component.d.mts +1 -1
  53. package/dist/node/lib/AreDirective/AreDirective.component.d.ts +1 -1
  54. package/dist/node/lib/AreDirective/AreDirective.types.d.mts +1 -1
  55. package/dist/node/lib/AreDirective/AreDirective.types.d.ts +1 -1
  56. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +1 -1
  57. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +1 -1
  58. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +1 -1
  59. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +1 -1
  60. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +1 -1
  61. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +1 -1
  62. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +14 -0
  63. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -1
  64. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +14 -0
  65. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -1
  66. package/dist/node/lib/AreRoot/AreRoot.component.js +16 -3
  67. package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
  68. package/dist/node/lib/AreRoot/AreRoot.component.mjs +16 -3
  69. package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
  70. package/dist/node/nodes/AreComment.d.mts +1 -1
  71. package/dist/node/nodes/AreComment.d.ts +1 -1
  72. package/dist/node/nodes/AreComponent.d.mts +1 -1
  73. package/dist/node/nodes/AreComponent.d.ts +1 -1
  74. package/dist/node/nodes/AreInterpolation.d.mts +1 -1
  75. package/dist/node/nodes/AreInterpolation.d.ts +1 -1
  76. package/dist/node/nodes/AreRoot.d.mts +1 -1
  77. package/dist/node/nodes/AreRoot.d.ts +1 -1
  78. package/dist/node/nodes/AreText.d.mts +1 -1
  79. package/dist/node/nodes/AreText.d.ts +1 -1
  80. package/examples/component-styles/concept.ts +41 -0
  81. package/examples/component-styles/containers/UI.container.ts +122 -0
  82. package/examples/component-styles/dist/index.html +25 -0
  83. package/examples/{jumpstart/dist/mor90p6y-0plg7g.js → component-styles/dist/mpq29j47-owas2v.js} +8326 -5942
  84. package/examples/component-styles/public/index.html +25 -0
  85. package/examples/component-styles/src/components/AppPage.component.ts +74 -0
  86. package/examples/component-styles/src/components/TheAlert.component.ts +81 -0
  87. package/examples/component-styles/src/components/TheButton.component.ts +71 -0
  88. package/examples/component-styles/src/components/TheCard.component.ts +64 -0
  89. package/examples/component-styles/src/concept.ts +70 -0
  90. package/examples/dashboard/dist/index.html +1 -1
  91. package/examples/dashboard/dist/{mpmt0gys-1r9rcu.js → mppzjw80-9gwa4h.js} +1223 -863
  92. package/examples/jumpstart/dist/index.html +1 -1
  93. package/examples/jumpstart/dist/{mor90p7p-1898bz.js → mppwx932-xbmb0x.js} +4215 -1984
  94. package/examples/signal-routing/concept.ts +41 -0
  95. package/examples/signal-routing/containers/UI.container.ts +126 -0
  96. package/examples/signal-routing/dist/index.html +18 -0
  97. package/examples/signal-routing/dist/mpq6u1wz-2pkqe2.js +14002 -0
  98. package/examples/signal-routing/public/index.html +18 -0
  99. package/examples/signal-routing/src/components/AboutPage.component.ts +74 -0
  100. package/examples/signal-routing/src/components/AppShell.component.ts +42 -0
  101. package/examples/signal-routing/src/components/HomePage.component.ts +76 -0
  102. package/examples/signal-routing/src/components/NavBar.component.ts +104 -0
  103. package/examples/signal-routing/src/components/SettingsPage.component.ts +98 -0
  104. package/examples/signal-routing/src/concept.ts +114 -0
  105. package/package.json +7 -5
  106. package/src/directives/AreDirectiveFor.directive.ts +12 -1
  107. package/src/engine/AreHTML.compiler.ts +24 -7
  108. package/src/engine/AreHTML.context.ts +6 -4
  109. package/src/engine/AreHTML.interpreter.ts +54 -0
  110. package/src/engine/AreHTML.lifecycle.ts +16 -12
  111. package/src/instructions/AreHTML.instructions.types.ts +2 -4
  112. package/src/lib/AreHTMLNode/AreHTMLNode.ts +15 -0
  113. package/src/lib/AreRoot/AreRoot.component.ts +31 -7
@@ -106,6 +106,13 @@ declare class AreHTMLNode extends AreNode {
106
106
  * The styles defined for the node, which can include inline styles or styles defined in a separate stylesheet that are applied to the node. These styles can be used to control the visual appearance of the node and can be defined using standard CSS syntax.
107
107
  */
108
108
  get styles(): AreStyle;
109
+ /**
110
+ * Registers or updates the component-scoped CSS string for this node.
111
+ * Called by the @Are.Styles-decorated method on the associated component.
112
+ * A new AreStyle fragment is registered in scope on first call; subsequent
113
+ * calls update the existing fragment in-place.
114
+ */
115
+ setStyles(css: string): void;
109
116
  }
110
117
 
111
118
  declare class AreHTMLAttribute extends AreAttribute {
@@ -213,10 +220,8 @@ type AreHtmlAddCommentInstructionPayload = {
213
220
  evaluate?: boolean;
214
221
  };
215
222
  type AreHtmlAddStyleInstructionPayload = {
216
- /** CSS property name in camelCase (e.g. "backgroundColor") or kebab-case (e.g. "background-color") */
217
- property: string;
218
- /** CSS property value */
219
- value: string;
223
+ /** Full CSS string to inject as a <style> block scoped to the component. Applied to the document head and reverted on unmount. */
224
+ styles: string;
220
225
  };
221
226
  type AreHtmlAddListenerInstructionPayload = {
222
227
  /** DOM event name (e.g. "click", "input", "submit") */
@@ -494,6 +499,13 @@ declare class AreHTMLEngineContext extends AreContext {
494
499
  }
495
500
 
496
501
  declare class AreHTMLCompiler extends AreCompiler {
502
+ /**
503
+ * Extends the base compile for all AreHTMLNode instances (elements, components, root nodes).
504
+ * After the standard element/attribute/children instructions are emitted, checks whether
505
+ * the node has a registered AreStyle and plans an AddStyleInstruction so the interpreter
506
+ * can inject the CSS into the document head during mount.
507
+ */
508
+ compileHTMLNode(node: AreHTMLNode, scene: AreScene, logger?: A_Logger, ...args: any[]): void;
497
509
  /**
498
510
  * Default compile method for interpolations, which can be overridden by specific implementations if needed.
499
511
  *
@@ -544,6 +556,8 @@ declare class AreHTMLInterpreter extends AreInterpreter {
544
556
  removeText(declaration: AddTextInstruction, context: AreHTMLEngineContext): void;
545
557
  addComment(declaration: AddCommentInstruction, context: AreHTMLEngineContext, store: AreStore, syntax: AreSyntax, directiveContext?: AreDirectiveContext, logger?: A_Logger): void;
546
558
  removeComment(declaration: AddCommentInstruction, context: AreHTMLEngineContext): void;
559
+ addStyle(mutation: AddStyleInstruction, context: AreHTMLEngineContext, logger?: A_Logger): void;
560
+ removeStyle(mutation: AddStyleInstruction, context: AreHTMLEngineContext): void;
547
561
  /**
548
562
  * Returns true when any ancestor of the given node has the tag `svg`,
549
563
  * meaning the node lives inside an SVG subtree and its DOM element must be
@@ -554,6 +568,7 @@ declare class AreHTMLInterpreter extends AreInterpreter {
554
568
 
555
569
  declare class AreHTMLLifecycle extends AreLifecycle {
556
570
  initComponent(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, signalsContext?: AreSignalsContext, logger?: A_Logger, ...args: any[]): void;
571
+ initRoot(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, signalsContext?: AreSignalsContext, logger?: A_Logger, ...args: any[]): void;
557
572
  initText(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, logger?: A_Logger, ...args: any[]): void;
558
573
  initInterpolation(node: AreHTMLNode, scope: A_Scope, context: AreHTMLEngineContext, logger?: A_Logger, ...args: any[]): void;
559
574
  mount(
@@ -1,4 +1,4 @@
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';
1
+ import { AreStore, AreScene, AreSyntax, AreCompiler, AreInterpreter, AreInstructionDefaultNames, AreNodeFeatures, AreContext, AreLifecycle, AreSignalsContext, AreAttributeFeatures, Are, AreNode, AreDeclaration, AreAttribute, AreCompilerError, AreMutation, AreSignal, AreInterpreterError, AreTokenizer, AreTransformer, AreEngine, AreSignals, AreEvent } from '@adaas/are';
2
2
  import { A_Frame } from '@adaas/a-frame/core';
3
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';
4
4
  import { A_Logger } from '@adaas/a-utils/a-logger';
@@ -391,7 +391,17 @@ var AreDirectiveFor = class extends AreDirective {
391
391
  if (arg.startsWith("'") && arg.endsWith("'")) return arg.slice(1, -1);
392
392
  if (arg.startsWith('"') && arg.endsWith('"')) return arg.slice(1, -1);
393
393
  if (!isNaN(Number(arg))) return Number(arg);
394
- return store.get(arg);
394
+ const stripped = arg.replace(/\?$/, "");
395
+ if (stripped.includes(".")) {
396
+ const parts = stripped.split(".").map((p) => p.replace(/\?$/, ""));
397
+ let val = store.get(parts[0]);
398
+ for (let j = 1; j < parts.length; j++) {
399
+ if (val == null) return void 0;
400
+ val = val[parts[j]];
401
+ }
402
+ return val ?? void 0;
403
+ }
404
+ return store.get(stripped);
395
405
  });
396
406
  result = fn(...resolvedArgs);
397
407
  } else if (arrayExpr.includes(".")) {
@@ -705,6 +715,20 @@ var AreHTMLNode = class extends AreNode {
705
715
  get styles() {
706
716
  return this.scope.resolveFlat(AreStyle);
707
717
  }
718
+ /**
719
+ * Registers or updates the component-scoped CSS string for this node.
720
+ * Called by the @Are.Styles-decorated method on the associated component.
721
+ * A new AreStyle fragment is registered in scope on first call; subsequent
722
+ * calls update the existing fragment in-place.
723
+ */
724
+ setStyles(css) {
725
+ const existing = this.scope.resolveFlat(AreStyle);
726
+ if (existing) {
727
+ existing.styles = css;
728
+ } else {
729
+ this.scope.register(new AreStyle(css, this.aseid.toString()));
730
+ }
731
+ }
708
732
  };
709
733
  AreHTMLNode = __decorateClass([
710
734
  A_Frame.Define({
@@ -1007,7 +1031,7 @@ var AreHTMLEngineContext = class extends AreContext {
1007
1031
  const node = instruction.owner;
1008
1032
  this.index.instructionToElement.set(instruction.aseid.toString(), element);
1009
1033
  this.index.elementToInstruction.set(element, instruction.aseid.toString());
1010
- if (node) {
1034
+ if (node && instruction instanceof AreDeclaration) {
1011
1035
  this.index.nodeToHostElements.set(node.aseid.toString(), element);
1012
1036
  }
1013
1037
  if (instruction.group) {
@@ -1036,7 +1060,7 @@ var AreHTMLEngineContext = class extends AreContext {
1036
1060
  this.index.instructionToElement.delete(instruction.aseid.toString());
1037
1061
  this.index.elementToInstruction.delete(element);
1038
1062
  const node = instruction.owner;
1039
- if (node) {
1063
+ if (node && instruction instanceof AreDeclaration) {
1040
1064
  this.index.nodeToHostElements.delete(node.aseid.toString());
1041
1065
  }
1042
1066
  if (instruction.group) {
@@ -1120,6 +1144,15 @@ AreHTMLEngineContext = __decorateClass([
1120
1144
  })
1121
1145
  ], AreHTMLEngineContext);
1122
1146
  var AreHTMLCompiler = class extends AreCompiler {
1147
+ compileHTMLNode(node, scene, logger, ...args) {
1148
+ super.compile(node, scene, logger, ...args);
1149
+ if (node.styles?.styles) {
1150
+ const host = scene.host;
1151
+ if (host) {
1152
+ scene.plan(new AddStyleInstruction(host, { styles: node.styles.styles }));
1153
+ }
1154
+ }
1155
+ }
1123
1156
  compileInterpolation(interpolation, scene, store, logger, ...args) {
1124
1157
  scene.plan(new AddTextInstruction({ content: interpolation.content, evaluate: true }));
1125
1158
  }
@@ -1232,6 +1265,12 @@ var AreHTMLCompiler = class extends AreCompiler {
1232
1265
  scene.plan(instruction);
1233
1266
  }
1234
1267
  };
1268
+ __decorateClass([
1269
+ AreCompiler.Compile(AreHTMLNode),
1270
+ __decorateParam(0, A_Inject(A_Caller)),
1271
+ __decorateParam(1, A_Inject(AreScene)),
1272
+ __decorateParam(2, A_Inject(A_Logger))
1273
+ ], AreHTMLCompiler.prototype, "compileHTMLNode", 1);
1235
1274
  __decorateClass([
1236
1275
  AreCompiler.Compile(AreInterpolation),
1237
1276
  __decorateParam(0, A_Inject(A_Caller)),
@@ -1615,6 +1654,32 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1615
1654
  element.parentNode?.removeChild(element);
1616
1655
  context.removeInstructionElement(declaration);
1617
1656
  }
1657
+ addStyle(mutation, context, logger) {
1658
+ try {
1659
+ const { styles } = mutation.payload;
1660
+ const styleId = `are-style-${String(mutation.aseid)}`;
1661
+ const existing = context.getElementByInstruction(mutation);
1662
+ if (existing) {
1663
+ existing.textContent = styles;
1664
+ } else {
1665
+ const styleEl = context.container.createElement("style");
1666
+ styleEl.setAttribute("data-are-id", styleId);
1667
+ styleEl.textContent = styles;
1668
+ (context.container.head ?? context.container.body).appendChild(styleEl);
1669
+ context.setInstructionElement(mutation, styleEl);
1670
+ logger?.debug("green", `Style injected for ${String(mutation.aseid)}`);
1671
+ }
1672
+ } catch (error) {
1673
+ logger?.error(error);
1674
+ }
1675
+ }
1676
+ removeStyle(mutation, context) {
1677
+ const styleEl = context.getElementByInstruction(mutation);
1678
+ if (styleEl?.parentNode) {
1679
+ styleEl.parentNode.removeChild(styleEl);
1680
+ }
1681
+ context.removeInstructionElement(mutation);
1682
+ }
1618
1683
  // ─────────────────────────────────────────────────────────────────────────────
1619
1684
  // ── SVG helpers ───────────────────────────────────────────────────────────────
1620
1685
  // ─────────────────────────────────────────────────────────────────────────────
@@ -1735,6 +1800,24 @@ __decorateClass([
1735
1800
  __decorateParam(0, A_Inject(A_Caller)),
1736
1801
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
1737
1802
  ], AreHTMLInterpreter.prototype, "removeComment", 1);
1803
+ __decorateClass([
1804
+ A_Frame.Define({
1805
+ description: "Inject a <style> element into the document <head> carrying the component CSS. Keyed by instruction ASEID so multiple components with styles do not collide. Subsequent Update calls refresh the textContent in-place."
1806
+ }),
1807
+ AreInterpreter.Apply(AreHTMLInstructions.AddStyle),
1808
+ AreInterpreter.Update(AreHTMLInstructions.AddStyle),
1809
+ __decorateParam(0, A_Inject(A_Caller)),
1810
+ __decorateParam(1, A_Inject(AreHTMLEngineContext)),
1811
+ __decorateParam(2, A_Inject(A_Logger))
1812
+ ], AreHTMLInterpreter.prototype, "addStyle", 1);
1813
+ __decorateClass([
1814
+ A_Frame.Define({
1815
+ description: "Remove the <style> element that was injected by addStyle, cleaning up the document head."
1816
+ }),
1817
+ AreInterpreter.Revert(AreHTMLInstructions.AddStyle),
1818
+ __decorateParam(0, A_Inject(A_Caller)),
1819
+ __decorateParam(1, A_Inject(AreHTMLEngineContext))
1820
+ ], AreHTMLInterpreter.prototype, "removeStyle", 1);
1738
1821
  AreHTMLInterpreter = __decorateClass([
1739
1822
  A_Frame.Define({
1740
1823
  namespace: "a-are-html",
@@ -1805,6 +1888,11 @@ AreHTMLTokenizer = __decorateClass([
1805
1888
  ], AreHTMLTokenizer);
1806
1889
  var AreHTMLLifecycle = class extends AreLifecycle {
1807
1890
  initComponent(node, scope, context, signalsContext, logger, ...args) {
1891
+ if (node.component)
1892
+ signalsContext?.subscribe(node);
1893
+ super.init(node, scope, context, logger, ...args);
1894
+ }
1895
+ initRoot(node, scope, context, signalsContext, logger, ...args) {
1808
1896
  signalsContext?.subscribe(node);
1809
1897
  super.init(node, scope, context, logger, ...args);
1810
1898
  }
@@ -1835,13 +1923,20 @@ var AreHTMLLifecycle = class extends AreLifecycle {
1835
1923
  };
1836
1924
  __decorateClass([
1837
1925
  AreLifecycle.Init(AreComponentNode),
1838
- AreLifecycle.Init(AreRootNode),
1839
1926
  __decorateParam(0, A_Inject(A_Caller)),
1840
1927
  __decorateParam(1, A_Inject(A_Scope)),
1841
1928
  __decorateParam(2, A_Inject(AreHTMLEngineContext)),
1842
1929
  __decorateParam(3, A_Inject(AreSignalsContext)),
1843
1930
  __decorateParam(4, A_Inject(A_Logger))
1844
1931
  ], AreHTMLLifecycle.prototype, "initComponent", 1);
1932
+ __decorateClass([
1933
+ AreLifecycle.Init(AreRootNode),
1934
+ __decorateParam(0, A_Inject(A_Caller)),
1935
+ __decorateParam(1, A_Inject(A_Scope)),
1936
+ __decorateParam(2, A_Inject(AreHTMLEngineContext)),
1937
+ __decorateParam(3, A_Inject(AreSignalsContext)),
1938
+ __decorateParam(4, A_Inject(A_Logger))
1939
+ ], AreHTMLLifecycle.prototype, "initRoot", 1);
1845
1940
  __decorateClass([
1846
1941
  AreLifecycle.Init(AreText),
1847
1942
  __decorateParam(0, A_Inject(A_Caller)),
@@ -2098,9 +2193,16 @@ var AreRoot = class extends Are {
2098
2193
  async template(root, logger, signalsContext) {
2099
2194
  const rootId = root.id;
2100
2195
  if (signalsContext && !signalsContext.hasRoot(rootId)) {
2196
+ if (!root.content?.trim()) {
2197
+ const defaultMatch = root.markup?.match(/\bdefault=["']([^"']*)["']/);
2198
+ const defaultComponent = defaultMatch?.[1];
2199
+ if (defaultComponent) {
2200
+ root.setContent(`<${defaultComponent}></${defaultComponent}>`);
2201
+ }
2202
+ }
2101
2203
  return;
2102
2204
  }
2103
- const currentRoute = AreRoute$1.default();
2205
+ const currentRoute = AreRoute.default();
2104
2206
  let componentName;
2105
2207
  if (currentRoute) {
2106
2208
  const initialVector = new A_SignalVector([currentRoute]);
@@ -2113,12 +2215,17 @@ var AreRoot = class extends Are {
2113
2215
  componentName = A_FormatterHelper.toKebabCase(renderTarget.name);
2114
2216
  }
2115
2217
  }
2218
+ if (!componentName) {
2219
+ if (root.content?.trim()) {
2220
+ return;
2221
+ }
2222
+ }
2116
2223
  if (!componentName) {
2117
2224
  const defaultMatch = root.markup?.match(/\bdefault=["']([^"']*)["']/);
2118
2225
  componentName = defaultMatch?.[1];
2119
2226
  }
2120
2227
  if (!componentName) {
2121
- logger.warning('AreRoot: No component found for initial render. Please ensure a route condition or "default" attribute is set.');
2228
+ logger.warning('AreRoot: No component found for initial render. Provide body content, a route condition, or a "default" attribute.');
2122
2229
  return;
2123
2230
  }
2124
2231
  root.setContent(`<${componentName}></${componentName}>`);
@@ -2135,12 +2242,12 @@ var AreRoot = class extends Are {
2135
2242
  }
2136
2243
  const componentName = renderTarget?.name ? A_FormatterHelper.toKebabCase(renderTarget.name) : store.get("default");
2137
2244
  if (!componentName) {
2138
- logger.warning("No component found for rendering in AreRoot. Please ensure that the signal vector matches at least one component or that a default component name is provided in the store.");
2139
2245
  return;
2140
2246
  }
2141
2247
  root.setContent(`<${componentName}></${componentName}>`);
2142
2248
  for (let i = 0; i < root.children.length; i++) {
2143
2249
  const child = root.children[i];
2250
+ signalsContext?.unsubscribe(child);
2144
2251
  child.unmount();
2145
2252
  child.destroy();
2146
2253
  root.removeChild(child);