@adaas/are-html 0.0.3 → 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 (28) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/index.d.mts +2 -2
  3. package/dist/browser/index.mjs +6 -6
  4. package/dist/browser/index.mjs.map +1 -1
  5. package/dist/node/index.d.mts +1 -1
  6. package/dist/node/index.d.ts +1 -1
  7. package/dist/node/index.js +3 -3
  8. package/dist/node/index.mjs +1 -1
  9. package/dist/node/lib/{AreWatcher/AreWatcher.component.d.mts → AreRouteWatcher/AreRouteWatcher.component.d.mts} +2 -2
  10. package/dist/node/lib/{AreWatcher/AreWatcher.component.d.ts → AreRouteWatcher/AreRouteWatcher.component.d.ts} +2 -2
  11. package/dist/node/lib/{AreWatcher/AreWatcher.component.js → AreRouteWatcher/AreRouteWatcher.component.js} +6 -6
  12. package/dist/node/lib/AreRouteWatcher/AreRouteWatcher.component.js.map +1 -0
  13. package/dist/node/lib/{AreWatcher/AreWatcher.component.mjs → AreRouteWatcher/AreRouteWatcher.component.mjs} +7 -7
  14. package/dist/node/lib/AreRouteWatcher/AreRouteWatcher.component.mjs.map +1 -0
  15. package/dist/node/signals/AreRoute.signal.js +1 -1
  16. package/dist/node/signals/AreRoute.signal.js.map +1 -1
  17. package/dist/node/signals/AreRoute.signal.mjs +1 -1
  18. package/dist/node/signals/AreRoute.signal.mjs.map +1 -1
  19. package/examples/dashboard/dist/mpioi5ab-8c3oa9.js +6 -6
  20. package/examples/jumpstart/dist/mor90p6y-0plg7g.js +8 -8
  21. package/examples/jumpstart/dist/mor90p7p-1898bz.js +8 -8
  22. package/jest.config.ts +1 -1
  23. package/package.json +1 -1
  24. package/src/index.ts +2 -2
  25. package/src/lib/{AreWatcher/AreWatcher.component.ts → AreRouteWatcher/AreRouteWatcher.component.ts} +2 -2
  26. package/src/signals/AreRoute.signal.ts +1 -1
  27. package/dist/node/lib/AreWatcher/AreWatcher.component.js.map +0 -1
  28. package/dist/node/lib/AreWatcher/AreWatcher.component.mjs.map +0 -1
@@ -30,7 +30,7 @@ export { AreDirectiveMeta } from './lib/AreDirective/AreDirective.meta.mjs';
30
30
  export { AreDirectiveOrderDecoratorParameters } from './lib/AreDirective/AreDirective.types.mjs';
31
31
  export { AreRoot } from './lib/AreRoot/AreRoot.component.mjs';
32
32
  export { AreStyle } from './lib/AreStyle/AreStyle.context.mjs';
33
- export { AreWatcher } from './lib/AreWatcher/AreWatcher.component.mjs';
33
+ export { AreRouteWatcher } from './lib/AreRouteWatcher/AreRouteWatcher.component.mjs';
34
34
  import '@adaas/are';
35
35
  import '@adaas/a-concept';
36
36
  import '@adaas/a-utils/a-logger';
@@ -30,7 +30,7 @@ export { AreDirectiveMeta } from './lib/AreDirective/AreDirective.meta.js';
30
30
  export { AreDirectiveOrderDecoratorParameters } from './lib/AreDirective/AreDirective.types.js';
31
31
  export { AreRoot } from './lib/AreRoot/AreRoot.component.js';
32
32
  export { AreStyle } from './lib/AreStyle/AreStyle.context.js';
33
- export { AreWatcher } from './lib/AreWatcher/AreWatcher.component.js';
33
+ export { AreRouteWatcher } from './lib/AreRouteWatcher/AreRouteWatcher.component.js';
34
34
  import '@adaas/are';
35
35
  import '@adaas/a-concept';
36
36
  import '@adaas/a-utils/a-logger';
@@ -40,7 +40,7 @@ var AreDirective_types = require('./lib/AreDirective/AreDirective.types');
40
40
  var AreRoot_component = require('./lib/AreRoot/AreRoot.component');
41
41
  var AreStyle_context = require('./lib/AreStyle/AreStyle.context');
42
42
  var AreStyle_types = require('./lib/AreStyle/AreStyle.types');
43
- var AreWatcher_component = require('./lib/AreWatcher/AreWatcher.component');
43
+ var AreRouteWatcher_component = require('./lib/AreRouteWatcher/AreRouteWatcher.component');
44
44
 
45
45
 
46
46
 
@@ -284,10 +284,10 @@ Object.keys(AreStyle_types).forEach(function (k) {
284
284
  get: function () { return AreStyle_types[k]; }
285
285
  });
286
286
  });
287
- Object.keys(AreWatcher_component).forEach(function (k) {
287
+ Object.keys(AreRouteWatcher_component).forEach(function (k) {
288
288
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
289
289
  enumerable: true,
290
- get: function () { return AreWatcher_component[k]; }
290
+ get: function () { return AreRouteWatcher_component[k]; }
291
291
  });
292
292
  });
293
293
  //# sourceMappingURL=index.js.map
@@ -38,6 +38,6 @@ export * from './lib/AreDirective/AreDirective.types';
38
38
  export * from './lib/AreRoot/AreRoot.component';
39
39
  export * from './lib/AreStyle/AreStyle.context';
40
40
  export * from './lib/AreStyle/AreStyle.types';
41
- export * from './lib/AreWatcher/AreWatcher.component';
41
+ export * from './lib/AreRouteWatcher/AreRouteWatcher.component';
42
42
  //# sourceMappingURL=index.mjs.map
43
43
  //# sourceMappingURL=index.mjs.map
@@ -1,6 +1,6 @@
1
1
  import { A_Component } from '@adaas/a-concept';
2
2
 
3
- declare class AreWatcher extends A_Component {
3
+ declare class AreRouteWatcher extends A_Component {
4
4
  private readonly handlers;
5
5
  private current;
6
6
  constructor();
@@ -15,4 +15,4 @@ declare class AreWatcher extends A_Component {
15
15
  private notify;
16
16
  }
17
17
 
18
- export { AreWatcher };
18
+ export { AreRouteWatcher };
@@ -1,6 +1,6 @@
1
1
  import { A_Component } from '@adaas/a-concept';
2
2
 
3
- declare class AreWatcher extends A_Component {
3
+ declare class AreRouteWatcher extends A_Component {
4
4
  private readonly handlers;
5
5
  private current;
6
6
  constructor();
@@ -15,4 +15,4 @@ declare class AreWatcher extends A_Component {
15
15
  private notify;
16
16
  }
17
17
 
18
- export { AreWatcher };
18
+ export { AreRouteWatcher };
@@ -11,7 +11,7 @@ var __decorateClass = (decorators, target, key, kind) => {
11
11
  result = (decorator(result)) || result;
12
12
  return result;
13
13
  };
14
- exports.AreWatcher = class AreWatcher extends aConcept.A_Component {
14
+ exports.AreRouteWatcher = class AreRouteWatcher extends aConcept.A_Component {
15
15
  constructor() {
16
16
  super();
17
17
  this.handlers = /* @__PURE__ */ new Set();
@@ -67,11 +67,11 @@ exports.AreWatcher = class AreWatcher extends aConcept.A_Component {
67
67
  }
68
68
  }
69
69
  };
70
- exports.AreWatcher = __decorateClass([
70
+ exports.AreRouteWatcher = __decorateClass([
71
71
  core.A_Frame.Define({
72
72
  namespace: "a-are-html",
73
- 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."
73
+ 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."
74
74
  })
75
- ], exports.AreWatcher);
76
- //# sourceMappingURL=AreWatcher.component.js.map
77
- //# sourceMappingURL=AreWatcher.component.js.map
75
+ ], exports.AreRouteWatcher);
76
+ //# sourceMappingURL=AreRouteWatcher.component.js.map
77
+ //# sourceMappingURL=AreRouteWatcher.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/AreRouteWatcher/AreRouteWatcher.component.ts"],"names":["AreRouteWatcher","A_Component","A_Frame"],"mappings":";;;;;;;;;;;;;AAOaA,uBAAA,GAAN,8BAA8BC,oBAAA,CAAY;AAAA,EAK7C,WAAA,GAAc;AACV,IAAA,KAAA,EAAM;AAJV,IAAA,IAAA,CAAiB,QAAA,uBAAwC,GAAA,EAAI;AAC7D,IAAA,IAAA,CAAQ,OAAA,GAAe,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AA4BnD;AAAA,IAAA,IAAA,CAAQ,aAAa,MAAY;AAC7B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,eAAe,MAAY;AAC/B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,cAAc,MAAY;AAC9B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,C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SAAS,CAAA;AAC3C,IAAA,OAAA,CAAQ,YAAA,GAAe,KAAA,CAAM,OAAA,CAAQ,YAAY,CAAA;AAAA,EACrD;AAAA;AAAA,EAIQ,MAAA,GAAe;AACnB,IAAA,MAAM,IAAA,GAAO,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AAEzC,IAAA,IAAI,IAAA,CAAK,IAAA,KAAS,IAAA,CAAK,OAAA,CAAQ,IAAA,EAAM;AAErC,IAAA,IAAA,CAAK,OAAA,GAAU,IAAA;AAEf,IAAA,KAAA,MAAW,OAAA,IAAW,KAAK,QAAA,EAAU;AACjC,MAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AAAA,IACxB;AAAA,EACJ;AACJ;AA3EaD,uBAAA,GAAN,eAAA,CAAA;AAAA,EAJNE,aAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYF,uBAAA,CAAA","file":"AreRouteWatcher.component.js","sourcesContent":["import { A_Component } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n 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.'\n})\nexport class AreRouteWatcher extends A_Component {\n\n private readonly handlers: Set<(url: URL) => void> = new Set();\n private current: URL = new URL(window.location.href);\n\n constructor() {\n super();\n this.patchHistory();\n this.attachListeners();\n }\n\n // ── Public ────────────────────────────────────────────────────────────────\n\n onChange(handler: (url: URL) => void): () => void {\n this.handlers.add(handler);\n return () => this.handlers.delete(handler); // returns unsubscribe fn\n }\n\n get url(): URL {\n return this.current;\n }\n\n destroy(): void {\n window.removeEventListener('popstate', this.onPopState);\n window.removeEventListener('hashchange', this.onHashChange);\n window.removeEventListener('urlchange', this.onURLChange);\n this.handlers.clear();\n }\n\n // ── Listeners ─────────────────────────────────────────────────────────────\n\n private onPopState = (): void => {\n this.notify();\n }\n\n private onHashChange = (): void => {\n this.notify();\n }\n\n private onURLChange = (): void => {\n this.notify();\n }\n\n private attachListeners(): void {\n window.addEventListener('popstate', this.onPopState);\n window.addEventListener('hashchange', this.onHashChange);\n window.addEventListener('urlchange', this.onURLChange); // custom event from patch\n }\n\n // ── Patch pushState / replaceState ────────────────────────────────────────\n\n private patchHistory(): void {\n const patch = (original: typeof history.pushState) =>\n function (this: History, ...args: Parameters<typeof history.pushState>) {\n original.apply(this, args);\n window.dispatchEvent(new Event('urlchange'));\n };\n\n history.pushState = patch(history.pushState);\n history.replaceState = patch(history.replaceState);\n }\n\n // ── Notify ────────────────────────────────────────────────────────────────\n\n private notify(): void {\n const next = new URL(window.location.href);\n\n if (next.href === this.current.href) return; // no actual change\n\n this.current = next;\n\n for (const handler of this.handlers) {\n handler(this.current);\n }\n }\n}"]}
@@ -2,7 +2,7 @@ import { __decorateClass } from '../../chunk-EQQGB2QZ.mjs';
2
2
  import { A_Component } from '@adaas/a-concept';
3
3
  import { A_Frame } from '@adaas/a-frame/core';
4
4
 
5
- let AreWatcher = class extends A_Component {
5
+ let AreRouteWatcher = class extends A_Component {
6
6
  constructor() {
7
7
  super();
8
8
  this.handlers = /* @__PURE__ */ new Set();
@@ -58,13 +58,13 @@ let AreWatcher = class extends A_Component {
58
58
  }
59
59
  }
60
60
  };
61
- AreWatcher = __decorateClass([
61
+ AreRouteWatcher = __decorateClass([
62
62
  A_Frame.Define({
63
63
  namespace: "a-are-html",
64
- 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."
64
+ 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."
65
65
  })
66
- ], AreWatcher);
66
+ ], AreRouteWatcher);
67
67
 
68
- export { AreWatcher };
69
- //# sourceMappingURL=AreWatcher.component.mjs.map
70
- //# sourceMappingURL=AreWatcher.component.mjs.map
68
+ export { AreRouteWatcher };
69
+ //# sourceMappingURL=AreRouteWatcher.component.mjs.map
70
+ //# sourceMappingURL=AreRouteWatcher.component.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/AreRouteWatcher/AreRouteWatcher.component.ts"],"names":[],"mappings":";;;;AAOO,IAAM,eAAA,GAAN,cAA8B,WAAA,CAAY;AAAA,EAK7C,WAAA,GAAc;AACV,IAAA,KAAA,EAAM;AAJV,IAAA,IAAA,CAAiB,QAAA,uBAAwC,GAAA,EAAI;AAC7D,IAAA,IAAA,CAAQ,OAAA,GAAe,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AA4BnD;AAAA,IAAA,IAAA,CAAQ,aAAa,MAAY;AAC7B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,eAAe,MAAY;AAC/B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,cAAc,MAAY;AAC9B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAlCI,IAAA,IAAA,CAAK,YAAA,EAAa;AAClB,IAAA,IAAA,CAAK,eAAA,EAAgB;AAAA,EACzB;AAAA;AAAA,EAIA,SAAS,OAAA,EAAyC;AAC9C,IAAA,IAAA,CAAK,QAAA,CAAS,IAAI,OAAO,CAAA;AACzB,IAAA,OAAO,MAAM,IAAA,CAAK,QAAA,CAAS,MAAA,CAAO,OAAO,CAAA;AAAA,EAC7C;AAAA,EAEA,IAAI,GAAA,GAAW;AACX,IAAA,OAAO,IAAA,CAAK,OAAA;AAAA,EAChB;AAAA,EAEA,OAAA,GAAgB;AACZ,IAAA,MAAA,CAAO,mBAAA,CAAoB,UAAA,EAAY,IAAA,CAAK,UAAU,CAA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AA,EACJ;AACJ;AA3Ea,eAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,eAAA,CAAA","file":"AreRouteWatcher.component.mjs","sourcesContent":["import { A_Component } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n 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.'\n})\nexport class AreRouteWatcher extends A_Component {\n\n private readonly handlers: Set<(url: URL) => void> = new Set();\n private current: URL = new URL(window.location.href);\n\n constructor() {\n super();\n this.patchHistory();\n this.attachListeners();\n }\n\n // ── Public ────────────────────────────────────────────────────────────────\n\n onChange(handler: (url: URL) => void): () => void {\n this.handlers.add(handler);\n return () => this.handlers.delete(handler); // returns unsubscribe fn\n }\n\n get url(): URL {\n return this.current;\n }\n\n destroy(): void {\n window.removeEventListener('popstate', this.onPopState);\n window.removeEventListener('hashchange', this.onHashChange);\n window.removeEventListener('urlchange', this.onURLChange);\n this.handlers.clear();\n }\n\n // ── Listeners ─────────────────────────────────────────────────────────────\n\n private onPopState = (): void => {\n this.notify();\n }\n\n private onHashChange = (): void => {\n this.notify();\n }\n\n private onURLChange = (): void => {\n this.notify();\n }\n\n private attachListeners(): void {\n window.addEventListener('popstate', this.onPopState);\n window.addEventListener('hashchange', this.onHashChange);\n window.addEventListener('urlchange', this.onURLChange); // custom event from patch\n }\n\n // ── Patch pushState / replaceState ────────────────────────────────────────\n\n private patchHistory(): void {\n const patch = (original: typeof history.pushState) =>\n function (this: History, ...args: Parameters<typeof history.pushState>) {\n original.apply(this, args);\n window.dispatchEvent(new Event('urlchange'));\n };\n\n history.pushState = patch(history.pushState);\n history.replaceState = patch(history.replaceState);\n }\n\n // ── Notify ────────────────────────────────────────────────────────────────\n\n private notify(): void {\n const next = new URL(window.location.href);\n\n if (next.href === this.current.href) return; // no actual change\n\n this.current = next;\n\n for (const handler of this.handlers) {\n handler(this.current);\n }\n }\n}"]}
@@ -31,7 +31,7 @@ exports.AreRoute = class AreRoute extends are.AreSignal {
31
31
  exports.AreRoute = __decorateClass([
32
32
  core.A_Frame.Define({
33
33
  namespace: "a-are-html",
34
- description: "ARE signal that carries an A_Route value. Dispatched by AreWatcher 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."
34
+ 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."
35
35
  })
36
36
  ], exports.AreRoute);
37
37
  //# sourceMappingURL=AreRoute.signal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/signals/AreRoute.signal.ts"],"names":["AreRoute","AreSignal","A_Route","A_Frame"],"mappings":";;;;;;;;;;;;;;AAWaA,gBAAA,GAAN,uBAAuBC,aAAA,CAAmB;AAAA,EAE7C,YAAY,IAAA,EAAuB;AAC/B,IAAA,KAAA,CAAM;AAAA,MACF,IAAA,EAAM,IAAIC,cAAA,CAAQ,IAAI;AAAA,KACzB,CAAA;AAAA,EACL;AAAA,EAEA,IAAI,KAAA,GAAiB;AACjB,IAAA,OAAO,IAAA,CAAK,IAAA;AAAA,EAChB;AAAA,EAEA,OAAO,OAAA,GAAgC;AACnC,IAAA,OAAO,IAAIF,gBAAA,CAAS,QAAA,CAAS,QAAA,CAAS,YAAY,GAAG,CAAA;AAAA,EACzD;AAAA,EAGA,QAAQ,KAAA,EAAmC;AACvC,IAAA,OAAO,IAAA,CAAK,MAAM,QAAA,EAAS,CAAE,KAAK,KAAA,CAAM,IAAA,CAAK,UAAU,CAAA;AAAA,EAC3D;AACJ;AApBaA,gBAAA,GAAN,eAAA,CAAA;AAAA,EAJNG,aAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYH,gBAAA,CAAA","file":"AreRoute.signal.js","sourcesContent":["import { A_Route } from \"@adaas/a-utils/a-route\";\nimport { A_Signal } from \"@adaas/a-utils/a-signal\";\nimport { AreSignal } from \"@adaas/are\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'ARE signal that carries an A_Route value. Dispatched by AreWatcher 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.'\n})\nexport class AreRoute extends AreSignal<A_Route> {\n\n constructor(path: string | RegExp) {\n super({\n data: new A_Route(path)\n });\n }\n\n get route(): A_Route {\n return this.data;\n }\n\n static default(): AreRoute | undefined {\n return new AreRoute(document.location.pathname || '/');\n }\n\n\n compare(other: A_Signal<A_Route>): boolean {\n return this.route.toRegExp().test(other.data.toString());\n }\n}"]}
1
+ {"version":3,"sources":["../../../src/signals/AreRoute.signal.ts"],"names":["AreRoute","AreSignal","A_Route","A_Frame"],"mappings":";;;;;;;;;;;;;;AAWaA,gBAAA,GAAN,uBAAuBC,aAAA,CAAmB;AAAA,EAE7C,YAAY,IAAA,EAAuB;AAC/B,IAAA,KAAA,CAAM;AAAA,MACF,IAAA,EAAM,IAAIC,cAAA,CAAQ,IAAI;AAAA,KACzB,CAAA;AAAA,EACL;AAAA,EAEA,IAAI,KAAA,GAAiB;AACjB,IAAA,OAAO,IAAA,CAAK,IAAA;AAAA,EAChB;AAAA,EAEA,OAAO,OAAA,GAAgC;AACnC,IAAA,OAAO,IAAIF,gBAAA,CAAS,QAAA,CAAS,QAAA,CAAS,YAAY,GAAG,CAAA;AAAA,EACzD;AAAA,EAGA,QAAQ,KAAA,EAAmC;AACvC,IAAA,OAAO,IAAA,CAAK,MAAM,QAAA,EAAS,CAAE,KAAK,KAAA,CAAM,IAAA,CAAK,UAAU,CAAA;AAAA,EAC3D;AACJ;AApBaA,gBAAA,GAAN,eAAA,CAAA;AAAA,EAJNG,aAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYH,gBAAA,CAAA","file":"AreRoute.signal.js","sourcesContent":["import { A_Route } from \"@adaas/a-utils/a-route\";\nimport { A_Signal } from \"@adaas/a-utils/a-signal\";\nimport { AreSignal } from \"@adaas/are\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n 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.'\n})\nexport class AreRoute extends AreSignal<A_Route> {\n\n constructor(path: string | RegExp) {\n super({\n data: new A_Route(path)\n });\n }\n\n get route(): A_Route {\n return this.data;\n }\n\n static default(): AreRoute | undefined {\n return new AreRoute(document.location.pathname || '/');\n }\n\n\n compare(other: A_Signal<A_Route>): boolean {\n return this.route.toRegExp().test(other.data.toString());\n }\n}"]}
@@ -22,7 +22,7 @@ let AreRoute = class extends AreSignal {
22
22
  AreRoute = __decorateClass([
23
23
  A_Frame.Define({
24
24
  namespace: "a-are-html",
25
- description: "ARE signal that carries an A_Route value. Dispatched by AreWatcher 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."
25
+ 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."
26
26
  })
27
27
  ], AreRoute);
28
28
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/signals/AreRoute.signal.ts"],"names":[],"mappings":";;;;;AAWO,IAAM,QAAA,GAAN,cAAuB,SAAA,CAAmB;AAAA,EAE7C,YAAY,IAAA,EAAuB;AAC/B,IAAA,KAAA,CAAM;AAAA,MACF,IAAA,EAAM,IAAI,OAAA,CAAQ,IAAI;AAAA,KACzB,CAAA;AAAA,EACL;AAAA,EAEA,IAAI,KAAA,GAAiB;AACjB,IAAA,OAAO,IAAA,CAAK,IAAA;AAAA,EAChB;AAAA,EAEA,OAAO,OAAA,GAAgC;AACnC,IAAA,OAAO,IAAI,QAAA,CAAS,QAAA,CAAS,QAAA,CAAS,YAAY,GAAG,CAAA;AAAA,EACzD;AAAA,EAGA,QAAQ,KAAA,EAAmC;AACvC,IAAA,OAAO,IAAA,CAAK,MAAM,QAAA,EAAS,CAAE,KAAK,KAAA,CAAM,IAAA,CAAK,UAAU,CAAA;AAAA,EAC3D;AACJ;AApBa,QAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,QAAA,CAAA","file":"AreRoute.signal.mjs","sourcesContent":["import { A_Route } from \"@adaas/a-utils/a-route\";\nimport { A_Signal } from \"@adaas/a-utils/a-signal\";\nimport { AreSignal } from \"@adaas/are\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n description: 'ARE signal that carries an A_Route value. Dispatched by AreWatcher 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.'\n})\nexport class AreRoute extends AreSignal<A_Route> {\n\n constructor(path: string | RegExp) {\n super({\n data: new A_Route(path)\n });\n }\n\n get route(): A_Route {\n return this.data;\n }\n\n static default(): AreRoute | undefined {\n return new AreRoute(document.location.pathname || '/');\n }\n\n\n compare(other: A_Signal<A_Route>): boolean {\n return this.route.toRegExp().test(other.data.toString());\n }\n}"]}
1
+ {"version":3,"sources":["../../../src/signals/AreRoute.signal.ts"],"names":[],"mappings":";;;;;AAWO,IAAM,QAAA,GAAN,cAAuB,SAAA,CAAmB;AAAA,EAE7C,YAAY,IAAA,EAAuB;AAC/B,IAAA,KAAA,CAAM;AAAA,MACF,IAAA,EAAM,IAAI,OAAA,CAAQ,IAAI;AAAA,KACzB,CAAA;AAAA,EACL;AAAA,EAEA,IAAI,KAAA,GAAiB;AACjB,IAAA,OAAO,IAAA,CAAK,IAAA;AAAA,EAChB;AAAA,EAEA,OAAO,OAAA,GAAgC;AACnC,IAAA,OAAO,IAAI,QAAA,CAAS,QAAA,CAAS,QAAA,CAAS,YAAY,GAAG,CAAA;AAAA,EACzD;AAAA,EAGA,QAAQ,KAAA,EAAmC;AACvC,IAAA,OAAO,IAAA,CAAK,MAAM,QAAA,EAAS,CAAE,KAAK,KAAA,CAAM,IAAA,CAAK,UAAU,CAAA;AAAA,EAC3D;AACJ;AApBa,QAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,QAAA,CAAA","file":"AreRoute.signal.mjs","sourcesContent":["import { A_Route } from \"@adaas/a-utils/a-route\";\nimport { A_Signal } from \"@adaas/a-utils/a-signal\";\nimport { AreSignal } from \"@adaas/are\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n 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.'\n})\nexport class AreRoute extends AreSignal<A_Route> {\n\n constructor(path: string | RegExp) {\n super({\n data: new A_Route(path)\n });\n }\n\n get route(): A_Route {\n return this.data;\n }\n\n static default(): AreRoute | undefined {\n return new AreRoute(document.location.pathname || '/');\n }\n\n\n compare(other: A_Signal<A_Route>): boolean {\n return this.route.toRegExp().test(other.data.toString());\n }\n}"]}
@@ -10846,7 +10846,7 @@ AreEngine = __decorateClass3([
10846
10846
  })
10847
10847
  ], AreEngine);
10848
10848
  var _a144;
10849
- var AreWatcher = (_a144 = class extends v {
10849
+ var AreRouteWatcher = (_a144 = class extends v {
10850
10850
  /**
10851
10851
  * Initialize the watcher. This method is called once when the watcher is first created. Use this to set up any necessary state or start observing changes.
10852
10852
  */
@@ -10859,16 +10859,16 @@ var AreWatcher = (_a144 = class extends v {
10859
10859
  }
10860
10860
  destroy() {
10861
10861
  }
10862
- }, __name(_a144, "AreWatcher"), _a144);
10862
+ }, __name(_a144, "AreRouteWatcher"), _a144);
10863
10863
  __decorateClass3([
10864
10864
  Ce.Stop()
10865
- ], AreWatcher.prototype, "destroy", 1);
10866
- AreWatcher = __decorateClass3([
10865
+ ], AreRouteWatcher.prototype, "destroy", 1);
10866
+ AreRouteWatcher = __decorateClass3([
10867
10867
  A3.Define({
10868
10868
  namespace: "A-ARE",
10869
10869
  description: "Abstract base component that observes external changes and emits A_Signals to drive reactive updates within the ARE pipeline. Subclasses override init() to set up initial state and watch() to begin observing \u2014 for example, polling a data source, listening to DOM events, or subscribing to a store \u2014 and call the appropriate signal methods to notify the engine when a re-render is needed."
10870
10870
  })
10871
- ], AreWatcher);
10871
+ ], AreRouteWatcher);
10872
10872
  var _a145;
10873
10873
  var _a146;
10874
10874
  var AreContainer = (_a146 = class extends A_Service {
@@ -10907,7 +10907,7 @@ __decorateClass3([
10907
10907
  __decorateParam3(1, ke(AreContext)),
10908
10908
  __decorateParam3(2, F.All()),
10909
10909
  __decorateParam3(2, F.Flat()),
10910
- __decorateParam3(2, ke(AreWatcher)),
10910
+ __decorateParam3(2, ke(AreRouteWatcher)),
10911
10911
  __decorateParam3(3, ke(A_Logger))
10912
10912
  ], AreContainer.prototype, _a145, 1);
10913
10913
  var _a147;
@@ -8998,7 +8998,7 @@ AreEngine = __decorateClass3([
8998
8998
  })
8999
8999
  ], AreEngine);
9000
9000
  var _a109;
9001
- var AreWatcher = (_a109 = class extends v {
9001
+ var AreRouteWatcher = (_a109 = class extends v {
9002
9002
  /**
9003
9003
  * Initialize the watcher. This method is called once when the watcher is first created. Use this to set up any necessary state or start observing changes.
9004
9004
  */
@@ -9011,17 +9011,17 @@ var AreWatcher = (_a109 = class extends v {
9011
9011
  }
9012
9012
  destroy() {
9013
9013
  }
9014
- }, __name(_a109, "AreWatcher"), _a109);
9014
+ }, __name(_a109, "AreRouteWatcher"), _a109);
9015
9015
  __decorateClass3([
9016
9016
  Ce.Stop()
9017
- ], AreWatcher.prototype, "destroy", 1);
9018
- AreWatcher = __decorateClass3([
9017
+ ], AreRouteWatcher.prototype, "destroy", 1);
9018
+ AreRouteWatcher = __decorateClass3([
9019
9019
  c2.Component({
9020
9020
  namespace: "A-ARE",
9021
- name: "AreWatcher",
9022
- description: "AreWatcher is a component that observes changes and produces A_Signals Depending on the actual handlers"
9021
+ name: "AreRouteWatcher",
9022
+ description: "AreRouteWatcher is a component that observes changes and produces A_Signals Depending on the actual handlers"
9023
9023
  })
9024
- ], AreWatcher);
9024
+ ], AreRouteWatcher);
9025
9025
  var _a110;
9026
9026
  var _a111;
9027
9027
  var AreContainer = (_a111 = class extends A_Service {
@@ -9060,7 +9060,7 @@ __decorateClass3([
9060
9060
  __decorateParam3(1, ke(AreContext)),
9061
9061
  __decorateParam3(2, F.All()),
9062
9062
  __decorateParam3(2, F.Flat()),
9063
- __decorateParam3(2, ke(AreWatcher)),
9063
+ __decorateParam3(2, ke(AreRouteWatcher)),
9064
9064
  __decorateParam3(3, ke(A_Logger))
9065
9065
  ], AreContainer.prototype, _a110, 1);
9066
9066
  var _a112;
@@ -8998,7 +8998,7 @@ AreEngine = __decorateClass3([
8998
8998
  })
8999
8999
  ], AreEngine);
9000
9000
  var _a109;
9001
- var AreWatcher = (_a109 = class extends v {
9001
+ var AreRouteWatcher = (_a109 = class extends v {
9002
9002
  /**
9003
9003
  * Initialize the watcher. This method is called once when the watcher is first created. Use this to set up any necessary state or start observing changes.
9004
9004
  */
@@ -9011,17 +9011,17 @@ var AreWatcher = (_a109 = class extends v {
9011
9011
  }
9012
9012
  destroy() {
9013
9013
  }
9014
- }, __name(_a109, "AreWatcher"), _a109);
9014
+ }, __name(_a109, "AreRouteWatcher"), _a109);
9015
9015
  __decorateClass3([
9016
9016
  Ce.Stop()
9017
- ], AreWatcher.prototype, "destroy", 1);
9018
- AreWatcher = __decorateClass3([
9017
+ ], AreRouteWatcher.prototype, "destroy", 1);
9018
+ AreRouteWatcher = __decorateClass3([
9019
9019
  c2.Component({
9020
9020
  namespace: "A-ARE",
9021
- name: "AreWatcher",
9022
- description: "AreWatcher is a component that observes changes and produces A_Signals Depending on the actual handlers"
9021
+ name: "AreRouteWatcher",
9022
+ description: "AreRouteWatcher is a component that observes changes and produces A_Signals Depending on the actual handlers"
9023
9023
  })
9024
- ], AreWatcher);
9024
+ ], AreRouteWatcher);
9025
9025
  var _a110;
9026
9026
  var _a111;
9027
9027
  var AreContainer = (_a111 = class extends A_Service {
@@ -9060,7 +9060,7 @@ __decorateClass3([
9060
9060
  __decorateParam3(1, ke(AreContext)),
9061
9061
  __decorateParam3(2, F.All()),
9062
9062
  __decorateParam3(2, F.Flat()),
9063
- __decorateParam3(2, ke(AreWatcher)),
9063
+ __decorateParam3(2, ke(AreRouteWatcher)),
9064
9064
  __decorateParam3(3, ke(A_Logger))
9065
9065
  ], AreContainer.prototype, _a110, 1);
9066
9066
  var _a112;
package/jest.config.ts CHANGED
@@ -29,7 +29,7 @@ const config: Config.InitialOptions = {
29
29
  "^@adaas/are/syntax/(.*)": "<rootDir>/node_modules/@adaas/are/dist/node/lib/AreSyntax/$1.js",
30
30
  "^@adaas/are/tokenizer/(.*)": "<rootDir>/node_modules/@adaas/are/dist/node/lib/AreTokenizer/$1.js",
31
31
  "^@adaas/are/transformer/(.*)": "<rootDir>/node_modules/@adaas/are/dist/node/lib/AreTransformer/$1.js",
32
- "^@adaas/are/watcher/(.*)": "<rootDir>/node_modules/@adaas/are/dist/node/lib/AreWatcher/$1.js",
32
+ "^@adaas/are/watcher/(.*)": "<rootDir>/node_modules/@adaas/are/dist/node/lib/AreRouteWatcher/$1.js",
33
33
 
34
34
  // ── @adaas/are-html internal path aliases (mirrors tsconfig.json paths) ──
35
35
  // Base ARE-HTML entities
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaas/are-html",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A-Concept Rendering Engine (ARE) is a powerful rendering engine designed to work seamlessly with the A-Concept framework. This library provides an HTML engine implementation of ARE, enabling developers to create dynamic and interactive user interfaces for web applications using standard HTML syntax.",
5
5
  "keywords": [
6
6
  "a-concept",
package/src/index.ts CHANGED
@@ -75,6 +75,6 @@ export * from './lib/AreStyle/AreStyle.context';
75
75
  export * from './lib/AreStyle/AreStyle.types';
76
76
 
77
77
  // ─────────────────────────────────────────────────────────────────────────────
78
- // ── Lib / AreWatcher ─────────────────────────────────────────────────────────
78
+ // ── Lib / AreRouteWatcher ─────────────────────────────────────────────────────────
79
79
  // ─────────────────────────────────────────────────────────────────────────────
80
- export * from './lib/AreWatcher/AreWatcher.component';
80
+ export * from './lib/AreRouteWatcher/AreRouteWatcher.component';
@@ -3,9 +3,9 @@ import { A_Frame } from "@adaas/a-frame/core";
3
3
 
4
4
  @A_Frame.Define({
5
5
  namespace: 'a-are-html',
6
- 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.'
6
+ 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.'
7
7
  })
8
- export class AreWatcher extends A_Component {
8
+ export class AreRouteWatcher extends A_Component {
9
9
 
10
10
  private readonly handlers: Set<(url: URL) => void> = new Set();
11
11
  private current: URL = new URL(window.location.href);
@@ -7,7 +7,7 @@ import { A_Frame } from "@adaas/a-frame/core";
7
7
 
8
8
  @A_Frame.Define({
9
9
  namespace: 'a-are-html',
10
- description: 'ARE signal that carries an A_Route value. Dispatched by AreWatcher 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.'
10
+ 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.'
11
11
  })
12
12
  export class AreRoute extends AreSignal<A_Route> {
13
13
 
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/lib/AreWatcher/AreWatcher.component.ts"],"names":["AreWatcher","A_Component","A_Frame"],"mappings":";;;;;;;;;;;;;AAOaA,kBAAA,GAAN,yBAAyBC,oBAAA,CAAY;AAAA,EAKxC,WAAA,GAAc;AACV,IAAA,KAAA,EAAM;AAJV,IAAA,IAAA,CAAiB,QAAA,uBAAwC,GAAA,EAAI;AAC7D,IAAA,IAAA,CAAQ,OAAA,GAAe,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AA4BnD;AAAA,IAAA,IAAA,CAAQ,aAAa,MAAY;AAC7B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,eAAe,MAAY;AAC/B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,cAAc,MAAY;AAC9B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAlCI,IAAA,IAAA,CAAK,YAAA,EAAa;AAClB,IAAA,IAAA,CAAK,eAAA,EAAgB;AAAA,EACzB;AAAA;AAAA,EAIA,SAAS,OAAA,EAAyC;AAC9C,IAAA,IAAA,CAAK,QAAA,CAAS,IAAI,OAAO,CAAA;AACzB,IAAA,OAAO,MAAM,IAAA,CAAK,QAAA,CAAS,MAAA,CAAO,OAAO,CAAA;A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,CAAK,OAAA,CAAQ,IAAA,EAAM;AAErC,IAAA,IAAA,CAAK,OAAA,GAAU,IAAA;AAEf,IAAA,KAAA,MAAW,OAAA,IAAW,KAAK,QAAA,EAAU;AACjC,MAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AAAA,IACxB;AAAA,EACJ;AACJ;AA3EaD,kBAAA,GAAN,eAAA,CAAA;AAAA,EAJNE,aAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACYF,kBAAA,CAAA","file":"AreWatcher.component.js","sourcesContent":["import { A_Component } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n 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.'\n})\nexport class AreWatcher extends A_Component {\n\n private readonly handlers: Set<(url: URL) => void> = new Set();\n private current: URL = new URL(window.location.href);\n\n constructor() {\n super();\n this.patchHistory();\n this.attachListeners();\n }\n\n // ── Public ────────────────────────────────────────────────────────────────\n\n onChange(handler: (url: URL) => void): () => void {\n this.handlers.add(handler);\n return () => this.handlers.delete(handler); // returns unsubscribe fn\n }\n\n get url(): URL {\n return this.current;\n }\n\n destroy(): void {\n window.removeEventListener('popstate', this.onPopState);\n window.removeEventListener('hashchange', this.onHashChange);\n window.removeEventListener('urlchange', this.onURLChange);\n this.handlers.clear();\n }\n\n // ── Listeners ─────────────────────────────────────────────────────────────\n\n private onPopState = (): void => {\n this.notify();\n }\n\n private onHashChange = (): void => {\n this.notify();\n }\n\n private onURLChange = (): void => {\n this.notify();\n }\n\n private attachListeners(): void {\n window.addEventListener('popstate', this.onPopState);\n window.addEventListener('hashchange', this.onHashChange);\n window.addEventListener('urlchange', this.onURLChange); // custom event from patch\n }\n\n // ── Patch pushState / replaceState ────────────────────────────────────────\n\n private patchHistory(): void {\n const patch = (original: typeof history.pushState) =>\n function (this: History, ...args: Parameters<typeof history.pushState>) {\n original.apply(this, args);\n window.dispatchEvent(new Event('urlchange'));\n };\n\n history.pushState = patch(history.pushState);\n history.replaceState = patch(history.replaceState);\n }\n\n // ── Notify ────────────────────────────────────────────────────────────────\n\n private notify(): void {\n const next = new URL(window.location.href);\n\n if (next.href === this.current.href) return; // no actual change\n\n this.current = next;\n\n for (const handler of this.handlers) {\n handler(this.current);\n }\n }\n}"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/lib/AreWatcher/AreWatcher.component.ts"],"names":[],"mappings":";;;;AAOO,IAAM,UAAA,GAAN,cAAyB,WAAA,CAAY;AAAA,EAKxC,WAAA,GAAc;AACV,IAAA,KAAA,EAAM;AAJV,IAAA,IAAA,CAAiB,QAAA,uBAAwC,GAAA,EAAI;AAC7D,IAAA,IAAA,CAAQ,OAAA,GAAe,IAAI,GAAA,CAAI,MAAA,CAAO,SAAS,IAAI,CAAA;AA4BnD;AAAA,IAAA,IAAA,CAAQ,aAAa,MAAY;AAC7B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,eAAe,MAAY;AAC/B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAEA,IAAA,IAAA,CAAQ,cAAc,MAAY;AAC9B,MAAA,IAAA,CAAK,MAAA,EAAO;AAAA,IAChB,CAAA;AAlCI,IAAA,IAAA,CAAK,YAAA,EAAa;AAClB,IAAA,IAAA,CAAK,eAAA,EAAgB;AAAA,EACzB;AAAA;AAAA,EAIA,SAAS,OAAA,EAAyC;AAC9C,IAAA,IAAA,CAAK,QAAA,CAAS,IAAI,OAAO,CAAA;AACzB,IAAA,OAAO,MAAM,IAAA,CAAK,QAAA,CAAS,MAAA,CAAO,OAAO,CAAA;AAAA,EAC7C;AAAA,EAEA,IAAI,GAAA,GAAW;AACX,IAAA,OAAO,IA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,GAAU,IAAA;AAEf,IAAA,KAAA,MAAW,OAAA,IAAW,KAAK,QAAA,EAAU;AACjC,MAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AAAA,IACxB;AAAA,EACJ;AACJ;AA3Ea,UAAA,GAAN,eAAA,CAAA;AAAA,EAJN,QAAQ,MAAA,CAAO;AAAA,IACZ,SAAA,EAAW,YAAA;AAAA,IACX,WAAA,EAAa;AAAA,GAChB;AAAA,CAAA,EACY,UAAA,CAAA","file":"AreWatcher.component.mjs","sourcesContent":["import { A_Component } from \"@adaas/a-concept\";\nimport { A_Frame } from \"@adaas/a-frame/core\";\n\n@A_Frame.Define({\n namespace: 'a-are-html',\n 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.'\n})\nexport class AreWatcher extends A_Component {\n\n private readonly handlers: Set<(url: URL) => void> = new Set();\n private current: URL = new URL(window.location.href);\n\n constructor() {\n super();\n this.patchHistory();\n this.attachListeners();\n }\n\n // ── Public ────────────────────────────────────────────────────────────────\n\n onChange(handler: (url: URL) => void): () => void {\n this.handlers.add(handler);\n return () => this.handlers.delete(handler); // returns unsubscribe fn\n }\n\n get url(): URL {\n return this.current;\n }\n\n destroy(): void {\n window.removeEventListener('popstate', this.onPopState);\n window.removeEventListener('hashchange', this.onHashChange);\n window.removeEventListener('urlchange', this.onURLChange);\n this.handlers.clear();\n }\n\n // ── Listeners ─────────────────────────────────────────────────────────────\n\n private onPopState = (): void => {\n this.notify();\n }\n\n private onHashChange = (): void => {\n this.notify();\n }\n\n private onURLChange = (): void => {\n this.notify();\n }\n\n private attachListeners(): void {\n window.addEventListener('popstate', this.onPopState);\n window.addEventListener('hashchange', this.onHashChange);\n window.addEventListener('urlchange', this.onURLChange); // custom event from patch\n }\n\n // ── Patch pushState / replaceState ────────────────────────────────────────\n\n private patchHistory(): void {\n const patch = (original: typeof history.pushState) =>\n function (this: History, ...args: Parameters<typeof history.pushState>) {\n original.apply(this, args);\n window.dispatchEvent(new Event('urlchange'));\n };\n\n history.pushState = patch(history.pushState);\n history.replaceState = patch(history.replaceState);\n }\n\n // ── Notify ────────────────────────────────────────────────────────────────\n\n private notify(): void {\n const next = new URL(window.location.href);\n\n if (next.href === this.current.href) return; // no actual change\n\n this.current = next;\n\n for (const handler of this.handlers) {\n handler(this.current);\n }\n }\n}"]}