@adaas/are-html 0.0.12 → 0.0.14

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 (108) hide show
  1. package/dist/browser/index.d.mts +19 -4
  2. package/dist/browser/index.mjs +114 -7
  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/AreDirectiveIf.directive.d.mts +1 -1
  17. package/dist/node/directives/AreDirectiveIf.directive.d.ts +1 -1
  18. package/dist/node/engine/AreHTML.compiler.d.mts +8 -1
  19. package/dist/node/engine/AreHTML.compiler.d.ts +8 -1
  20. package/dist/node/engine/AreHTML.compiler.js +17 -0
  21. package/dist/node/engine/AreHTML.compiler.js.map +1 -1
  22. package/dist/node/engine/AreHTML.compiler.mjs +17 -0
  23. package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
  24. package/dist/node/engine/AreHTML.context.js +2 -2
  25. package/dist/node/engine/AreHTML.context.js.map +1 -1
  26. package/dist/node/engine/AreHTML.context.mjs +3 -3
  27. package/dist/node/engine/AreHTML.context.mjs.map +1 -1
  28. package/dist/node/engine/AreHTML.interpreter.d.mts +3 -0
  29. package/dist/node/engine/AreHTML.interpreter.d.ts +3 -0
  30. package/dist/node/engine/AreHTML.interpreter.js +44 -0
  31. package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
  32. package/dist/node/engine/AreHTML.interpreter.mjs +44 -0
  33. package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
  34. package/dist/node/engine/AreHTML.lifecycle.d.mts +2 -1
  35. package/dist/node/engine/AreHTML.lifecycle.d.ts +2 -1
  36. package/dist/node/engine/AreHTML.lifecycle.js +13 -1
  37. package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
  38. package/dist/node/engine/AreHTML.lifecycle.mjs +13 -1
  39. package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
  40. package/dist/node/engine/AreHTML.tokenizer.d.mts +1 -1
  41. package/dist/node/engine/AreHTML.tokenizer.d.ts +1 -1
  42. package/dist/node/engine/AreHTML.transformer.d.mts +1 -1
  43. package/dist/node/engine/AreHTML.transformer.d.ts +1 -1
  44. package/dist/node/index.d.mts +1 -1
  45. package/dist/node/index.d.ts +1 -1
  46. package/dist/node/instructions/AreHTML.instructions.types.d.mts +2 -4
  47. package/dist/node/instructions/AreHTML.instructions.types.d.ts +2 -4
  48. package/dist/node/lib/AreDirective/AreDirective.component.d.mts +1 -1
  49. package/dist/node/lib/AreDirective/AreDirective.component.d.ts +1 -1
  50. package/dist/node/lib/AreDirective/AreDirective.types.d.mts +1 -1
  51. package/dist/node/lib/AreDirective/AreDirective.types.d.ts +1 -1
  52. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +1 -1
  53. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +1 -1
  54. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +1 -1
  55. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +1 -1
  56. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +1 -1
  57. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +1 -1
  58. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +14 -0
  59. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -1
  60. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +14 -0
  61. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -1
  62. package/dist/node/lib/AreRoot/AreRoot.component.js +26 -3
  63. package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
  64. package/dist/node/lib/AreRoot/AreRoot.component.mjs +26 -3
  65. package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
  66. package/dist/node/nodes/AreComment.d.mts +1 -1
  67. package/dist/node/nodes/AreComment.d.ts +1 -1
  68. package/dist/node/nodes/AreComponent.d.mts +1 -1
  69. package/dist/node/nodes/AreComponent.d.ts +1 -1
  70. package/dist/node/nodes/AreInterpolation.d.mts +1 -1
  71. package/dist/node/nodes/AreInterpolation.d.ts +1 -1
  72. package/dist/node/nodes/AreRoot.d.mts +1 -1
  73. package/dist/node/nodes/AreRoot.d.ts +1 -1
  74. package/dist/node/nodes/AreText.d.mts +1 -1
  75. package/dist/node/nodes/AreText.d.ts +1 -1
  76. package/examples/component-styles/concept.ts +41 -0
  77. package/examples/component-styles/containers/UI.container.ts +122 -0
  78. package/examples/component-styles/dist/index.html +25 -0
  79. package/examples/{jumpstart/dist/mor90p6y-0plg7g.js → component-styles/dist/mpq29j47-owas2v.js} +8326 -5942
  80. package/examples/component-styles/public/index.html +25 -0
  81. package/examples/component-styles/src/components/AppPage.component.ts +74 -0
  82. package/examples/component-styles/src/components/TheAlert.component.ts +81 -0
  83. package/examples/component-styles/src/components/TheButton.component.ts +71 -0
  84. package/examples/component-styles/src/components/TheCard.component.ts +64 -0
  85. package/examples/component-styles/src/concept.ts +70 -0
  86. package/examples/dashboard/dist/index.html +1 -1
  87. package/examples/dashboard/dist/{mpmt0gys-1r9rcu.js → mppzjw80-9gwa4h.js} +1223 -863
  88. package/examples/jumpstart/dist/index.html +1 -1
  89. package/examples/jumpstart/dist/{mor90p7p-1898bz.js → mppwx932-xbmb0x.js} +4215 -1984
  90. package/examples/signal-routing/concept.ts +41 -0
  91. package/examples/signal-routing/containers/UI.container.ts +126 -0
  92. package/examples/signal-routing/dist/index.html +18 -0
  93. package/examples/signal-routing/dist/mpq6u1wz-2pkqe2.js +14002 -0
  94. package/examples/signal-routing/public/index.html +18 -0
  95. package/examples/signal-routing/src/components/AboutPage.component.ts +74 -0
  96. package/examples/signal-routing/src/components/AppShell.component.ts +42 -0
  97. package/examples/signal-routing/src/components/HomePage.component.ts +76 -0
  98. package/examples/signal-routing/src/components/NavBar.component.ts +104 -0
  99. package/examples/signal-routing/src/components/SettingsPage.component.ts +98 -0
  100. package/examples/signal-routing/src/concept.ts +114 -0
  101. package/package.json +7 -5
  102. package/src/engine/AreHTML.compiler.ts +24 -7
  103. package/src/engine/AreHTML.context.ts +6 -4
  104. package/src/engine/AreHTML.interpreter.ts +54 -0
  105. package/src/engine/AreHTML.lifecycle.ts +16 -12
  106. package/src/instructions/AreHTML.instructions.types.ts +2 -4
  107. package/src/lib/AreHTMLNode/AreHTMLNode.ts +15 -0
  108. package/src/lib/AreRoot/AreRoot.component.ts +47 -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';
@@ -715,6 +715,20 @@ var AreHTMLNode = class extends AreNode {
715
715
  get styles() {
716
716
  return this.scope.resolveFlat(AreStyle);
717
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
+ }
718
732
  };
719
733
  AreHTMLNode = __decorateClass([
720
734
  A_Frame.Define({
@@ -1017,7 +1031,7 @@ var AreHTMLEngineContext = class extends AreContext {
1017
1031
  const node = instruction.owner;
1018
1032
  this.index.instructionToElement.set(instruction.aseid.toString(), element);
1019
1033
  this.index.elementToInstruction.set(element, instruction.aseid.toString());
1020
- if (node) {
1034
+ if (node && instruction instanceof AreDeclaration) {
1021
1035
  this.index.nodeToHostElements.set(node.aseid.toString(), element);
1022
1036
  }
1023
1037
  if (instruction.group) {
@@ -1046,7 +1060,7 @@ var AreHTMLEngineContext = class extends AreContext {
1046
1060
  this.index.instructionToElement.delete(instruction.aseid.toString());
1047
1061
  this.index.elementToInstruction.delete(element);
1048
1062
  const node = instruction.owner;
1049
- if (node) {
1063
+ if (node && instruction instanceof AreDeclaration) {
1050
1064
  this.index.nodeToHostElements.delete(node.aseid.toString());
1051
1065
  }
1052
1066
  if (instruction.group) {
@@ -1130,6 +1144,15 @@ AreHTMLEngineContext = __decorateClass([
1130
1144
  })
1131
1145
  ], AreHTMLEngineContext);
1132
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
+ }
1133
1156
  compileInterpolation(interpolation, scene, store, logger, ...args) {
1134
1157
  scene.plan(new AddTextInstruction({ content: interpolation.content, evaluate: true }));
1135
1158
  }
@@ -1242,6 +1265,12 @@ var AreHTMLCompiler = class extends AreCompiler {
1242
1265
  scene.plan(instruction);
1243
1266
  }
1244
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);
1245
1274
  __decorateClass([
1246
1275
  AreCompiler.Compile(AreInterpolation),
1247
1276
  __decorateParam(0, A_Inject(A_Caller)),
@@ -1625,6 +1654,32 @@ var AreHTMLInterpreter = class extends AreInterpreter {
1625
1654
  element.parentNode?.removeChild(element);
1626
1655
  context.removeInstructionElement(declaration);
1627
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
+ }
1628
1683
  // ─────────────────────────────────────────────────────────────────────────────
1629
1684
  // ── SVG helpers ───────────────────────────────────────────────────────────────
1630
1685
  // ─────────────────────────────────────────────────────────────────────────────
@@ -1745,6 +1800,24 @@ __decorateClass([
1745
1800
  __decorateParam(0, A_Inject(A_Caller)),
1746
1801
  __decorateParam(1, A_Inject(AreHTMLEngineContext))
1747
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);
1748
1821
  AreHTMLInterpreter = __decorateClass([
1749
1822
  A_Frame.Define({
1750
1823
  namespace: "a-are-html",
@@ -1815,6 +1888,11 @@ AreHTMLTokenizer = __decorateClass([
1815
1888
  ], AreHTMLTokenizer);
1816
1889
  var AreHTMLLifecycle = class extends AreLifecycle {
1817
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) {
1818
1896
  signalsContext?.subscribe(node);
1819
1897
  super.init(node, scope, context, logger, ...args);
1820
1898
  }
@@ -1845,13 +1923,20 @@ var AreHTMLLifecycle = class extends AreLifecycle {
1845
1923
  };
1846
1924
  __decorateClass([
1847
1925
  AreLifecycle.Init(AreComponentNode),
1848
- AreLifecycle.Init(AreRootNode),
1849
1926
  __decorateParam(0, A_Inject(A_Caller)),
1850
1927
  __decorateParam(1, A_Inject(A_Scope)),
1851
1928
  __decorateParam(2, A_Inject(AreHTMLEngineContext)),
1852
1929
  __decorateParam(3, A_Inject(AreSignalsContext)),
1853
1930
  __decorateParam(4, A_Inject(A_Logger))
1854
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);
1855
1940
  __decorateClass([
1856
1941
  AreLifecycle.Init(AreText),
1857
1942
  __decorateParam(0, A_Inject(A_Caller)),
@@ -2108,9 +2193,16 @@ var AreRoot = class extends Are {
2108
2193
  async template(root, logger, signalsContext) {
2109
2194
  const rootId = root.id;
2110
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
+ }
2111
2203
  return;
2112
2204
  }
2113
- const currentRoute = AreRoute$1.default();
2205
+ const currentRoute = AreRoute.default();
2114
2206
  let componentName;
2115
2207
  if (currentRoute) {
2116
2208
  const initialVector = new A_SignalVector([currentRoute]);
@@ -2123,12 +2215,23 @@ var AreRoot = class extends Are {
2123
2215
  componentName = A_FormatterHelper.toKebabCase(renderTarget.name);
2124
2216
  }
2125
2217
  }
2218
+ if (!componentName) {
2219
+ if (root.content?.trim()) {
2220
+ return;
2221
+ }
2222
+ }
2223
+ if (!componentName) {
2224
+ const defaultComp = signalsContext?.getDefault(rootId);
2225
+ if (defaultComp?.name) {
2226
+ componentName = A_FormatterHelper.toKebabCase(defaultComp.name);
2227
+ }
2228
+ }
2126
2229
  if (!componentName) {
2127
2230
  const defaultMatch = root.markup?.match(/\bdefault=["']([^"']*)["']/);
2128
2231
  componentName = defaultMatch?.[1];
2129
2232
  }
2130
2233
  if (!componentName) {
2131
- logger.warning('AreRoot: No component found for initial render. Please ensure a route condition or "default" attribute is set.');
2234
+ logger.warning('AreRoot: No component found for initial render. Provide body content, a route condition, or a "default" attribute.');
2132
2235
  return;
2133
2236
  }
2134
2237
  root.setContent(`<${componentName}></${componentName}>`);
@@ -2145,12 +2248,16 @@ var AreRoot = class extends Are {
2145
2248
  }
2146
2249
  const componentName = renderTarget?.name ? A_FormatterHelper.toKebabCase(renderTarget.name) : store.get("default");
2147
2250
  if (!componentName) {
2148
- 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.");
2251
+ return;
2252
+ }
2253
+ const currentChild = root.children[0];
2254
+ if (currentChild?.type === componentName) {
2149
2255
  return;
2150
2256
  }
2151
2257
  root.setContent(`<${componentName}></${componentName}>`);
2152
2258
  for (let i = 0; i < root.children.length; i++) {
2153
2259
  const child = root.children[i];
2260
+ signalsContext?.unsubscribe(child);
2154
2261
  child.unmount();
2155
2262
  child.destroy();
2156
2263
  root.removeChild(child);