@adaas/are-html 0.0.22 → 0.0.24

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 (191) hide show
  1. package/dist/browser/index.d.mts +194 -10
  2. package/dist/browser/index.mjs +696 -245
  3. package/dist/browser/index.mjs.map +1 -1
  4. package/dist/node/{AreBinding.attribute-doUvtOjc.d.mts → AreBinding.attribute-BWzEIw6H.d.mts} +45 -0
  5. package/dist/node/{AreBinding.attribute-Bm5LlOyE.d.ts → AreBinding.attribute-GpT-5Qmf.d.ts} +45 -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 +18 -1
  15. package/dist/node/directives/AreDirectiveFor.directive.d.ts +18 -1
  16. package/dist/node/directives/AreDirectiveFor.directive.js +57 -9
  17. package/dist/node/directives/AreDirectiveFor.directive.js.map +1 -1
  18. package/dist/node/directives/AreDirectiveFor.directive.mjs +57 -9
  19. package/dist/node/directives/AreDirectiveFor.directive.mjs.map +1 -1
  20. package/dist/node/directives/AreDirectiveIf.directive.d.mts +18 -2
  21. package/dist/node/directives/AreDirectiveIf.directive.d.ts +18 -2
  22. package/dist/node/directives/AreDirectiveIf.directive.js +29 -6
  23. package/dist/node/directives/AreDirectiveIf.directive.js.map +1 -1
  24. package/dist/node/directives/AreDirectiveIf.directive.mjs +29 -6
  25. package/dist/node/directives/AreDirectiveIf.directive.mjs.map +1 -1
  26. package/dist/node/directives/AreDirectiveShow.directive.d.mts +1 -1
  27. package/dist/node/directives/AreDirectiveShow.directive.d.ts +1 -1
  28. package/dist/node/engine/AreHTML.compiler.d.mts +4 -2
  29. package/dist/node/engine/AreHTML.compiler.d.ts +4 -2
  30. package/dist/node/engine/AreHTML.compiler.js +11 -4
  31. package/dist/node/engine/AreHTML.compiler.js.map +1 -1
  32. package/dist/node/engine/AreHTML.compiler.mjs +11 -4
  33. package/dist/node/engine/AreHTML.compiler.mjs.map +1 -1
  34. package/dist/node/engine/AreHTML.constants.d.mts +33 -1
  35. package/dist/node/engine/AreHTML.constants.d.ts +33 -1
  36. package/dist/node/engine/AreHTML.constants.js +166 -0
  37. package/dist/node/engine/AreHTML.constants.js.map +1 -1
  38. package/dist/node/engine/AreHTML.constants.mjs +165 -1
  39. package/dist/node/engine/AreHTML.constants.mjs.map +1 -1
  40. package/dist/node/engine/AreHTML.context.d.mts +66 -0
  41. package/dist/node/engine/AreHTML.context.d.ts +66 -0
  42. package/dist/node/engine/AreHTML.context.js +98 -0
  43. package/dist/node/engine/AreHTML.context.js.map +1 -1
  44. package/dist/node/engine/AreHTML.context.mjs +98 -0
  45. package/dist/node/engine/AreHTML.context.mjs.map +1 -1
  46. package/dist/node/engine/AreHTML.interpreter.d.mts +3 -0
  47. package/dist/node/engine/AreHTML.interpreter.d.ts +3 -0
  48. package/dist/node/engine/AreHTML.interpreter.js +66 -10
  49. package/dist/node/engine/AreHTML.interpreter.js.map +1 -1
  50. package/dist/node/engine/AreHTML.interpreter.mjs +66 -10
  51. package/dist/node/engine/AreHTML.interpreter.mjs.map +1 -1
  52. package/dist/node/engine/AreHTML.lifecycle.d.mts +1 -8
  53. package/dist/node/engine/AreHTML.lifecycle.d.ts +1 -8
  54. package/dist/node/engine/AreHTML.lifecycle.js +29 -44
  55. package/dist/node/engine/AreHTML.lifecycle.js.map +1 -1
  56. package/dist/node/engine/AreHTML.lifecycle.mjs +29 -44
  57. package/dist/node/engine/AreHTML.lifecycle.mjs.map +1 -1
  58. package/dist/node/engine/AreHTML.tokenizer.d.mts +1 -1
  59. package/dist/node/engine/AreHTML.tokenizer.d.ts +1 -1
  60. package/dist/node/engine/AreHTML.tokenizer.js +7 -1
  61. package/dist/node/engine/AreHTML.tokenizer.js.map +1 -1
  62. package/dist/node/engine/AreHTML.tokenizer.mjs +7 -1
  63. package/dist/node/engine/AreHTML.tokenizer.mjs.map +1 -1
  64. package/dist/node/engine/AreHTML.transformer.d.mts +1 -1
  65. package/dist/node/engine/AreHTML.transformer.d.ts +1 -1
  66. package/dist/node/index.d.mts +4 -3
  67. package/dist/node/index.d.ts +4 -3
  68. package/dist/node/index.js +7 -0
  69. package/dist/node/index.mjs +1 -0
  70. package/dist/node/instructions/AddStaticHTML.instruction.d.mts +8 -0
  71. package/dist/node/instructions/AddStaticHTML.instruction.d.ts +8 -0
  72. package/dist/node/instructions/AddStaticHTML.instruction.js +31 -0
  73. package/dist/node/instructions/AddStaticHTML.instruction.js.map +1 -0
  74. package/dist/node/instructions/AddStaticHTML.instruction.mjs +24 -0
  75. package/dist/node/instructions/AddStaticHTML.instruction.mjs.map +1 -0
  76. package/dist/node/instructions/AreHTML.instructions.constants.d.mts +1 -0
  77. package/dist/node/instructions/AreHTML.instructions.constants.d.ts +1 -0
  78. package/dist/node/instructions/AreHTML.instructions.constants.js +1 -0
  79. package/dist/node/instructions/AreHTML.instructions.constants.js.map +1 -1
  80. package/dist/node/instructions/AreHTML.instructions.constants.mjs +1 -0
  81. package/dist/node/instructions/AreHTML.instructions.constants.mjs.map +1 -1
  82. package/dist/node/instructions/AreHTML.instructions.types.d.mts +9 -1
  83. package/dist/node/instructions/AreHTML.instructions.types.d.ts +9 -1
  84. package/dist/node/lib/AreDirective/AreDirective.component.d.mts +1 -1
  85. package/dist/node/lib/AreDirective/AreDirective.component.d.ts +1 -1
  86. package/dist/node/lib/AreDirective/AreDirective.types.d.mts +1 -1
  87. package/dist/node/lib/AreDirective/AreDirective.types.d.ts +1 -1
  88. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.mts +1 -1
  89. package/dist/node/lib/AreHTML/AreHTML.tokenizer.d.ts +1 -1
  90. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.mts +1 -1
  91. package/dist/node/lib/AreHTMLAttribute/AreHTML.attribute.d.ts +1 -1
  92. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.mts +1 -1
  93. package/dist/node/lib/AreHTMLNode/AreHTMLNode.d.ts +1 -1
  94. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js +51 -0
  95. package/dist/node/lib/AreHTMLNode/AreHTMLNode.js.map +1 -1
  96. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs +51 -0
  97. package/dist/node/lib/AreHTMLNode/AreHTMLNode.mjs.map +1 -1
  98. package/dist/node/lib/AreRoot/AreRoot.component.js.map +1 -1
  99. package/dist/node/lib/AreRoot/AreRoot.component.mjs.map +1 -1
  100. package/dist/node/nodes/AreComment.d.mts +1 -1
  101. package/dist/node/nodes/AreComment.d.ts +1 -1
  102. package/dist/node/nodes/AreComponent.d.mts +1 -1
  103. package/dist/node/nodes/AreComponent.d.ts +1 -1
  104. package/dist/node/nodes/AreInterpolation.d.mts +1 -1
  105. package/dist/node/nodes/AreInterpolation.d.ts +1 -1
  106. package/dist/node/nodes/AreRoot.d.mts +1 -1
  107. package/dist/node/nodes/AreRoot.d.ts +1 -1
  108. package/dist/node/nodes/AreText.d.mts +1 -1
  109. package/dist/node/nodes/AreText.d.ts +1 -1
  110. package/examples/dashboard/concept.ts +1 -1
  111. package/examples/dashboard/dist/index.html +1 -1
  112. package/examples/dashboard/dist/{mqh9ryml-xat335.js → mqiw5sqa-ypckmj.js} +403 -57
  113. package/examples/for-perf/dist/index.html +1 -1
  114. package/examples/for-perf/dist/{mqh9ryfo-6a8d0o.js → mqp8i2py-vltsx0.js} +3030 -2474
  115. package/examples/lazy-loading/README.md +76 -0
  116. package/examples/lazy-loading/concept.ts +55 -0
  117. package/examples/lazy-loading/containers/UI.container.ts +215 -0
  118. package/examples/lazy-loading/dist/app.js +3803 -0
  119. package/examples/{for-perf/dist/mqh9ryfq-4pf5cv.js → lazy-loading/dist/chunks/chunk-6K72IBO4.js} +2708 -5476
  120. package/examples/lazy-loading/dist/index.html +36 -0
  121. package/examples/lazy-loading/dist/lazy/about-page.js +59 -0
  122. package/examples/lazy-loading/dist/lazy/reports-page.js +65 -0
  123. package/examples/lazy-loading/dist/lazy/settings-page.js +54 -0
  124. package/examples/lazy-loading/public/index.html +36 -0
  125. package/examples/lazy-loading/src/components/AppShell.component.ts +44 -0
  126. package/examples/lazy-loading/src/components/HomePage.component.ts +59 -0
  127. package/examples/lazy-loading/src/components/LazyOutlet.component.ts +108 -0
  128. package/examples/lazy-loading/src/components/NavBar.component.ts +98 -0
  129. package/examples/lazy-loading/src/concept.ts +116 -0
  130. package/examples/lazy-loading/src/lazy/AboutPage.component.ts +54 -0
  131. package/examples/lazy-loading/src/lazy/ReportsPage.component.ts +56 -0
  132. package/examples/lazy-loading/src/lazy/SettingsPage.component.ts +45 -0
  133. package/examples/lazy-loading/src/runtime/ComponentManifest.fragment.ts +61 -0
  134. package/examples/lazy-loading/src/runtime/LazyComponentResolver.fragment.ts +77 -0
  135. package/examples/os-desktop/README.md +91 -0
  136. package/examples/os-desktop/concept.ts +54 -0
  137. package/examples/os-desktop/containers/OS.container.ts +198 -0
  138. package/examples/os-desktop/containers/apps/AppBackend.ts +29 -0
  139. package/examples/os-desktop/containers/apps/GanttApp.backend.ts +56 -0
  140. package/examples/os-desktop/containers/apps/MarketingApp.backend.ts +68 -0
  141. package/examples/os-desktop/dist/app.js +4410 -0
  142. package/examples/os-desktop/dist/apps/gantt/app.js +271 -0
  143. package/examples/os-desktop/dist/apps/marketing/app.js +346 -0
  144. package/examples/{for-perf/dist/mqh9ryde-m243t8.js → os-desktop/dist/chunks/chunk-6K72IBO4.js} +2708 -5476
  145. package/examples/os-desktop/dist/chunks/chunk-EIIGUL6N.js +30 -0
  146. package/examples/os-desktop/dist/chunks/chunk-WOH7L5UR.js +30 -0
  147. package/examples/os-desktop/dist/index.html +33 -0
  148. package/examples/os-desktop/public/index.html +33 -0
  149. package/examples/os-desktop/src/apps/gantt/GanttApp.component.ts +41 -0
  150. package/examples/os-desktop/src/apps/gantt/GanttChart.component.ts +126 -0
  151. package/examples/os-desktop/src/apps/gantt/GanttStore.ts +47 -0
  152. package/examples/os-desktop/src/apps/gantt/GanttToolbar.component.ts +73 -0
  153. package/examples/os-desktop/src/apps/gantt/index.ts +13 -0
  154. package/examples/os-desktop/src/apps/marketing/MarketingApp.component.ts +53 -0
  155. package/examples/os-desktop/src/apps/marketing/MarketingStore.ts +34 -0
  156. package/examples/os-desktop/src/apps/marketing/PostEditor.component.ts +153 -0
  157. package/examples/os-desktop/src/apps/marketing/PostPreview.component.ts +110 -0
  158. package/examples/os-desktop/src/apps/marketing/index.ts +16 -0
  159. package/examples/os-desktop/src/concept.ts +126 -0
  160. package/examples/os-desktop/src/os/AppStage.component.ts +112 -0
  161. package/examples/os-desktop/src/os/AppWindow.component.ts +102 -0
  162. package/examples/os-desktop/src/os/Desktop.component.ts +106 -0
  163. package/examples/os-desktop/src/os/Dock.component.ts +174 -0
  164. package/examples/os-desktop/src/os/Hud.component.ts +83 -0
  165. package/examples/os-desktop/src/os/Launchpad.component.ts +191 -0
  166. package/examples/os-desktop/src/os/MenuBar.component.ts +156 -0
  167. package/examples/os-desktop/src/runtime/AppComponentResolver.fragment.ts +121 -0
  168. package/examples/os-desktop/src/runtime/AppRegistry.fragment.ts +104 -0
  169. package/examples/os-desktop/src/signals/MouseState.signal.ts +34 -0
  170. package/examples/os-desktop/src/signals/OSRoute.signal.ts +37 -0
  171. package/examples/os-desktop/src/signals/SelectionState.signal.ts +34 -0
  172. package/examples/signal-routing/dist/index.html +1 -1
  173. package/examples/signal-routing/dist/{mqh9ryc9-dkcbkx.js → mqp8hgce-4d6rh0.js} +3196 -2640
  174. package/package.json +13 -9
  175. package/src/directives/AreDirectiveFor.directive.ts +99 -16
  176. package/src/directives/AreDirectiveIf.directive.ts +33 -4
  177. package/src/engine/AreHTML.compiler.ts +25 -2
  178. package/src/engine/AreHTML.constants.ts +142 -0
  179. package/src/engine/AreHTML.context.ts +112 -0
  180. package/src/engine/AreHTML.interpreter.ts +114 -13
  181. package/src/engine/AreHTML.lifecycle.ts +81 -74
  182. package/src/engine/AreHTML.tokenizer.ts +30 -1
  183. package/src/index.ts +1 -0
  184. package/src/instructions/AddStaticHTML.instruction.ts +23 -0
  185. package/src/instructions/AreHTML.instructions.constants.ts +1 -0
  186. package/src/instructions/AreHTML.instructions.types.ts +9 -0
  187. package/src/lib/AreHTMLNode/AreHTMLNode.ts +74 -0
  188. package/src/lib/AreRoot/AreRoot.component.ts +3 -3
  189. package/tests/PropPropagation.test.ts +181 -0
  190. package/tests/StaticIsland.test.ts +115 -0
  191. package/tests/jest.setup.ts +11 -0
@@ -0,0 +1,121 @@
1
+ import { A_TYPES__Ctor } from "@adaas/a-concept";
2
+ import { A_Frame } from "@adaas/a-frame/core";
3
+ import { Are, AreComponentResolver } from "@adaas/are";
4
+ import { AppDescriptor, AppRegistry } from "./AppRegistry.fragment";
5
+
6
+
7
+ /**
8
+ * AppComponentResolver — the engine's lazy-loading hook for application code.
9
+ *
10
+ * The engine ({@link AreComponentResolver}) consults this whenever it renders a
11
+ * tag that is NOT a registered component. We answer the question "which app
12
+ * owns this tag, and where do I fetch its class from?".
13
+ *
14
+ * The crucial idea: **an app is ONE bundle that exports a SET of components.**
15
+ * The first time any of an app's tags is requested we dynamically `import()`
16
+ * the app's single bundle (cached per URL), then pick the right named export
17
+ * for the requested tag. The engine registers that class globally, so the next
18
+ * tag from the same app resolves from the already-evaluated module — one
19
+ * network request per app, however many components it ships.
20
+ *
21
+ * Two entry points:
22
+ * - {@link resolve} — the lazy path the engine calls on a render miss.
23
+ * - {@link preload} — the eager path the Launchpad calls on *install*, so
24
+ * "adding an app loads all its components" up front.
25
+ */
26
+ @A_Frame.Define({
27
+ namespace: 'a-are-os-desktop',
28
+ description: 'Resolves unregistered component tags to classes from their owning app bundle (one code-split bundle per app, many components). Plugged into the engine via AreComponentResolver; also exposes preload() to eagerly load every component of an app on install.'
29
+ })
30
+ export class AppComponentResolver extends AreComponentResolver {
31
+
32
+ protected _registry: AppRegistry;
33
+
34
+ /** Cache of in-flight / settled bundle imports, keyed by bundle URL. */
35
+ protected _bundles: Map<string, Promise<Record<string, unknown>>> = new Map();
36
+
37
+ /** Tags already handed to the engine (registered) — skip re-resolving. */
38
+ protected _resolved: Set<string> = new Set();
39
+
40
+ constructor(data: { registry: AppRegistry }) {
41
+ super({ name: 'AppComponentResolver' });
42
+ this._registry = data.registry;
43
+ }
44
+
45
+ /**
46
+ * Lazy path: resolve a single tag on a render miss. Returns `undefined` for
47
+ * tags that do not belong to any installed app (they stay plain elements)
48
+ * or that the engine already has registered.
49
+ */
50
+ async resolve(entity: string): Promise<A_TYPES__Ctor<Are> | undefined> {
51
+ if (this._resolved.has(entity)) {
52
+ return undefined;
53
+ }
54
+
55
+ const app = this._registry.appByComponentTag(entity);
56
+
57
+ if (!app) {
58
+ return undefined;
59
+ }
60
+
61
+ const exportName = this.exportNameForTag(app, entity);
62
+
63
+ if (!exportName) {
64
+ return undefined;
65
+ }
66
+
67
+ const mod = await this.importBundle(app.bundle);
68
+ const Component = mod[exportName];
69
+
70
+ if (typeof Component !== 'function') {
71
+ return undefined;
72
+ }
73
+
74
+ this._resolved.add(entity);
75
+
76
+ return Component as A_TYPES__Ctor<Are>;
77
+ }
78
+
79
+ /**
80
+ * Eager path: fetch an app's WHOLE bundle (all its components) on install,
81
+ * so "adding an app loads all its necessary components" up front. Called by
82
+ * the Launchpad. It only *warms* the import cache and returns the classes —
83
+ * it deliberately does NOT mark the tags resolved, so the engine still does
84
+ * the actual global registration lazily on first render (now instant,
85
+ * because the bundle is already in memory). This keeps a single owner of
86
+ * registration (the engine) while making install the moment the code lands.
87
+ */
88
+ async preload(app: AppDescriptor): Promise<A_TYPES__Ctor<Are>[]> {
89
+ const mod = await this.importBundle(app.bundle);
90
+ const classes: A_TYPES__Ctor<Are>[] = [];
91
+
92
+ for (const ref of app.components) {
93
+ const Component = mod[ref.export];
94
+ if (typeof Component === 'function') {
95
+ classes.push(Component as A_TYPES__Ctor<Are>);
96
+ }
97
+ }
98
+
99
+ return classes;
100
+ }
101
+
102
+ protected exportNameForTag(app: AppDescriptor, tag: string): string | undefined {
103
+ return app.components.find(c => c.tag === tag)?.export;
104
+ }
105
+
106
+ /**
107
+ * Dynamic import of an app bundle, de-duplicated per URL. Because the shell
108
+ * and every app bundle are code-split against shared framework chunks, the
109
+ * classes returned here `extend` the SAME `Are`/DI runtime the OS shell runs.
110
+ */
111
+ protected importBundle(url: string): Promise<Record<string, unknown>> {
112
+ let pending = this._bundles.get(url);
113
+
114
+ if (!pending) {
115
+ pending = import(/* @vite-ignore */ url) as Promise<Record<string, unknown>>;
116
+ this._bundles.set(url, pending);
117
+ }
118
+
119
+ return pending;
120
+ }
121
+ }
@@ -0,0 +1,104 @@
1
+ import { A_Fragment } from "@adaas/a-concept";
2
+ import { A_Frame } from "@adaas/a-frame/core";
3
+
4
+
5
+ /** A single component contributed by an app's bundle. */
6
+ export type AppComponentRef = {
7
+ /** Custom-element tag (kebab-case of the class name). */
8
+ tag: string;
9
+ /** Named export inside the app bundle that provides this component's class. */
10
+ export: string;
11
+ };
12
+
13
+ /**
14
+ * The public descriptor of an installable application, served by the OS kernel
15
+ * at `GET /api/apps`. It is the single contract between the OS shell and an
16
+ * app: the OS never imports an app's source — it only knows its metadata, the
17
+ * URL of its single code-split bundle, and which tags that bundle provides.
18
+ */
19
+ export type AppDescriptor = {
20
+ /** Stable id, also the URL segment: `/app/<id>`. */
21
+ id: string;
22
+ /** Human-facing name shown in the dock and window title. */
23
+ name: string;
24
+ /** Emoji used as the app icon. */
25
+ icon: string;
26
+ /** Accent colour for the app's window chrome / dock highlight. */
27
+ accent: string;
28
+ /** Short marketing line shown in the Launchpad. */
29
+ tagline: string;
30
+ /** Root component tag the OS mounts inside the window (e.g. `marketing-app`). */
31
+ rootTag: string;
32
+ /** Public URL of the app's single (code-split) bundle. */
33
+ bundle: string;
34
+ /** Base path of the app's OWN backend API (e.g. `/apps/marketing/api`). */
35
+ api: string;
36
+ /** Every component the bundle exports, so any of its tags can be resolved. */
37
+ components: AppComponentRef[];
38
+ };
39
+
40
+
41
+ /**
42
+ * AppRegistry — the OS's view of the application catalogue.
43
+ *
44
+ * It holds the list of *available* apps (discovered from the backend) and the
45
+ * set the user has *installed*. Installing an app is a frontend-only state
46
+ * change here (the bundle is fetched lazily on demand by the resolver); a real
47
+ * OS would persist this and gate it behind auth/licensing.
48
+ *
49
+ * The registry is a plain data fragment shared across the OS shell components
50
+ * (Dock, Launchpad, MenuBar, AppStage) and the {@link AppComponentResolver}.
51
+ */
52
+ @A_Frame.Define({
53
+ namespace: 'a-are-os-desktop',
54
+ description: 'Holds the catalogue of available applications (from GET /api/apps) and the set the user has installed. Shared by the OS shell components and the AppComponentResolver to map component tags to their owning app bundle.'
55
+ })
56
+ export class AppRegistry extends A_Fragment {
57
+
58
+ protected _available: AppDescriptor[] = [];
59
+ protected _installed: Set<string> = new Set();
60
+
61
+ constructor(data: { available: AppDescriptor[]; installed?: string[] }) {
62
+ super({ name: 'AppRegistry' });
63
+ this._available = data.available ?? [];
64
+ for (const id of data.installed ?? []) {
65
+ this._installed.add(id);
66
+ }
67
+ }
68
+
69
+ /** Every app the backend offers. */
70
+ available(): AppDescriptor[] {
71
+ return this._available;
72
+ }
73
+
74
+ /** Apps the user has installed, in catalogue order. */
75
+ installed(): AppDescriptor[] {
76
+ return this._available.filter(app => this._installed.has(app.id));
77
+ }
78
+
79
+ isInstalled(id: string): boolean {
80
+ return this._installed.has(id);
81
+ }
82
+
83
+ install(id: string): void {
84
+ if (this._available.some(app => app.id === id)) {
85
+ this._installed.add(id);
86
+ }
87
+ }
88
+
89
+ uninstall(id: string): void {
90
+ this._installed.delete(id);
91
+ }
92
+
93
+ /** Look up an app by its id. */
94
+ get(id: string): AppDescriptor | undefined {
95
+ return this._available.find(app => app.id === id);
96
+ }
97
+
98
+ /** Find the installed app that owns a given component tag (root or child). */
99
+ appByComponentTag(tag: string): AppDescriptor | undefined {
100
+ return this.installed().find(app =>
101
+ app.rootTag === tag || app.components.some(c => c.tag === tag)
102
+ );
103
+ }
104
+ }
@@ -0,0 +1,34 @@
1
+ import { AreSignal } from "@adaas/are";
2
+ import { A_Frame } from "@adaas/a-frame/core";
3
+
4
+
5
+ /**
6
+ * MouseState — the live pointer-position signal.
7
+ *
8
+ * Emitted (throttled) from a global `mousemove` listener wired up in the
9
+ * browser bootstrap. It is a *state* signal, not an event: the bus keeps only
10
+ * the latest value, so any component that mounts later still sees the current
11
+ * pointer position.
12
+ *
13
+ * This example uses it to drive the corner HUD's live coordinates and to prove
14
+ * that several unrelated signal TYPES can travel the same bus and be consumed
15
+ * by `@Are.Signal(MouseState)` typed handlers without interfering with routing.
16
+ */
17
+ @A_Frame.Define({
18
+ namespace: 'a-are-os-desktop',
19
+ description: 'Live pointer-position state signal {x, y}. Emitted throttled from a global mousemove listener and consumed by the HUD via a typed @Are.Signal(MouseState) handler.'
20
+ })
21
+ export class MouseState extends AreSignal<{ x: number; y: number }> {
22
+
23
+ constructor(x: number, y: number) {
24
+ super({ data: { x, y } });
25
+ }
26
+
27
+ get x(): number {
28
+ return this.data.x;
29
+ }
30
+
31
+ get y(): number {
32
+ return this.data.y;
33
+ }
34
+ }
@@ -0,0 +1,37 @@
1
+ import { A_Signal } from "@adaas/a-utils/a-signal";
2
+ import { AreSignal } from "@adaas/are";
3
+ import { A_Frame } from "@adaas/a-frame/core";
4
+
5
+
6
+ /**
7
+ * OSRoute — the routing signal for the OS desktop.
8
+ *
9
+ * The OS uses URL-style routes to decide what the screen shows:
10
+ * - `/` or `/desktop` → empty desktop (wallpaper + dock, no window)
11
+ * - `/launchpad` → the App Store overlay (install apps)
12
+ * - `/app/<id>` → the focused application window for app `<id>`
13
+ *
14
+ * Dispatched by the Dock, the Launchpad and the window chrome. Multiple
15
+ * components react to it independently (the AppStage swaps the visible surface,
16
+ * the MenuBar updates the active-app title, the Dock highlights the running
17
+ * app) — which is the whole point of signal-based routing: one signal, many
18
+ * independent reactions, no shared controller.
19
+ */
20
+ @A_Frame.Define({
21
+ namespace: 'a-are-os-desktop',
22
+ description: 'OS routing signal carrying the active route (/desktop, /launchpad, /app/<id>). Drives which surface the desktop shows and is consumed independently by the AppStage, MenuBar and Dock.'
23
+ })
24
+ export class OSRoute extends AreSignal<{ path: string }> {
25
+
26
+ constructor(path: string) {
27
+ super({ data: { path } });
28
+ }
29
+
30
+ get path(): string {
31
+ return this.data.path;
32
+ }
33
+
34
+ compare(other: A_Signal<{ path: string }>): boolean {
35
+ return this.data.path === other.data.path;
36
+ }
37
+ }
@@ -0,0 +1,34 @@
1
+ import { AreSignal } from "@adaas/are";
2
+ import { A_Frame } from "@adaas/a-frame/core";
3
+
4
+
5
+ /**
6
+ * SelectionState — the current text-selection signal.
7
+ *
8
+ * Emitted from a global `selectionchange` listener wired up in the browser
9
+ * bootstrap. Carries the selected text and its length. Like {@link MouseState}
10
+ * it is a *state* signal — the bus retains the latest selection.
11
+ *
12
+ * Two unrelated consumers react to it, demonstrating cross-component reuse of a
13
+ * single signal: the OS HUD shows "N chars selected", and the Marketing app
14
+ * (when open) offers to turn the current selection into a hashtag. Neither
15
+ * consumer knows about the other.
16
+ */
17
+ @A_Frame.Define({
18
+ namespace: 'a-are-os-desktop',
19
+ description: 'Current text-selection state signal {text, length}. Emitted from a global selectionchange listener and consumed independently by the OS HUD and the Marketing app.'
20
+ })
21
+ export class SelectionState extends AreSignal<{ text: string; length: number }> {
22
+
23
+ constructor(text: string) {
24
+ super({ data: { text, length: text.length } });
25
+ }
26
+
27
+ get text(): string {
28
+ return this.data.text;
29
+ }
30
+
31
+ get length(): number {
32
+ return this.data.length;
33
+ }
34
+ }
@@ -13,6 +13,6 @@
13
13
  <body>
14
14
  <are-root id="app"><app-shell></app-shell></are-root>
15
15
 
16
- <script type="module" src="./mqh9ryc9-dkcbkx.js"></script>
16
+ <script type="module" src="./mqp8hgce-4d6rh0.js"></script>
17
17
  </body>
18
18
  </html>