@marinoscar/platform-cli 0.1.0-next.23 → 0.1.0-next.25

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 (227) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +4 -3
  3. package/dist/engine/commands/node.d.ts.map +1 -1
  4. package/dist/engine/commands/node.js +73 -6
  5. package/dist/engine/commands/node.js.map +1 -1
  6. package/dist/engine/conformance.d.ts +3 -0
  7. package/dist/engine/conformance.d.ts.map +1 -1
  8. package/dist/engine/conformance.js +7 -0
  9. package/dist/engine/conformance.js.map +1 -1
  10. package/dist/engine/create-cli.d.ts +21 -0
  11. package/dist/engine/create-cli.d.ts.map +1 -1
  12. package/dist/engine/create-cli.js +11 -0
  13. package/dist/engine/create-cli.js.map +1 -1
  14. package/dist/engine/index.d.ts +26 -3
  15. package/dist/engine/index.d.ts.map +1 -1
  16. package/dist/engine/index.js +13 -1
  17. package/dist/engine/index.js.map +1 -1
  18. package/dist/engine/node/capabilities.d.ts +199 -4
  19. package/dist/engine/node/capabilities.d.ts.map +1 -1
  20. package/dist/engine/node/capabilities.js +292 -11
  21. package/dist/engine/node/capabilities.js.map +1 -1
  22. package/dist/engine/node/daemon-channels.d.ts +66 -0
  23. package/dist/engine/node/daemon-channels.d.ts.map +1 -0
  24. package/dist/engine/node/daemon-channels.js +65 -0
  25. package/dist/engine/node/daemon-channels.js.map +1 -0
  26. package/dist/engine/node/daemon.d.ts.map +1 -1
  27. package/dist/engine/node/daemon.js +52 -0
  28. package/dist/engine/node/daemon.js.map +1 -1
  29. package/dist/engine/node/doctor.d.ts +2 -0
  30. package/dist/engine/node/doctor.d.ts.map +1 -1
  31. package/dist/engine/node/doctor.js +56 -3
  32. package/dist/engine/node/doctor.js.map +1 -1
  33. package/dist/engine/node/executors/credential-hygiene.d.ts +1 -1
  34. package/dist/engine/node/executors/credential-hygiene.d.ts.map +1 -1
  35. package/dist/engine/node/executors/credential-hygiene.js +23 -2
  36. package/dist/engine/node/executors/credential-hygiene.js.map +1 -1
  37. package/dist/engine/node/executors/index.d.ts +52 -7
  38. package/dist/engine/node/executors/index.d.ts.map +1 -1
  39. package/dist/engine/node/executors/index.js +14 -0
  40. package/dist/engine/node/executors/index.js.map +1 -1
  41. package/dist/engine/node/executors/registry.d.ts.map +1 -1
  42. package/dist/engine/node/executors/registry.js +13 -2
  43. package/dist/engine/node/executors/registry.js.map +1 -1
  44. package/dist/engine/node/install-deps.d.ts +164 -6
  45. package/dist/engine/node/install-deps.d.ts.map +1 -1
  46. package/dist/engine/node/install-deps.js +251 -9
  47. package/dist/engine/node/install-deps.js.map +1 -1
  48. package/dist/engine/node/ipc-protocol.d.ts +49 -2
  49. package/dist/engine/node/ipc-protocol.d.ts.map +1 -1
  50. package/dist/engine/node/ipc-protocol.js +39 -0
  51. package/dist/engine/node/ipc-protocol.js.map +1 -1
  52. package/dist/engine/node/lifecycle.js +2 -1
  53. package/dist/engine/node/lifecycle.js.map +1 -1
  54. package/dist/engine/node/logger.d.ts +13 -0
  55. package/dist/engine/node/logger.d.ts.map +1 -1
  56. package/dist/engine/node/logger.js.map +1 -1
  57. package/dist/engine/node/memory-watchdog.d.ts +11 -0
  58. package/dist/engine/node/memory-watchdog.d.ts.map +1 -1
  59. package/dist/engine/node/memory-watchdog.js +28 -4
  60. package/dist/engine/node/memory-watchdog.js.map +1 -1
  61. package/dist/engine/node/models.d.ts +195 -0
  62. package/dist/engine/node/models.d.ts.map +1 -0
  63. package/dist/engine/node/models.js +379 -0
  64. package/dist/engine/node/models.js.map +1 -0
  65. package/dist/engine/node/node-dashboard-source.d.ts +46 -19
  66. package/dist/engine/node/node-dashboard-source.d.ts.map +1 -1
  67. package/dist/engine/node/node-dashboard-source.js +70 -102
  68. package/dist/engine/node/node-dashboard-source.js.map +1 -1
  69. package/dist/engine/node/node-engine.d.ts +20 -2
  70. package/dist/engine/node/node-engine.d.ts.map +1 -1
  71. package/dist/engine/node/node-engine.js +99 -11
  72. package/dist/engine/node/node-engine.js.map +1 -1
  73. package/dist/engine/node/runtime-state.d.ts +24 -0
  74. package/dist/engine/node/runtime-state.d.ts.map +1 -0
  75. package/dist/engine/node/runtime-state.js +19 -0
  76. package/dist/engine/node/runtime-state.js.map +1 -0
  77. package/dist/engine/node/runtime-tuning.d.ts +111 -2
  78. package/dist/engine/node/runtime-tuning.d.ts.map +1 -1
  79. package/dist/engine/node/runtime-tuning.js +133 -4
  80. package/dist/engine/node/runtime-tuning.js.map +1 -1
  81. package/dist/engine/node/service.d.ts.map +1 -1
  82. package/dist/engine/node/service.js +4 -0
  83. package/dist/engine/node/service.js.map +1 -1
  84. package/dist/engine/node/start.d.ts +7 -0
  85. package/dist/engine/node/start.d.ts.map +1 -1
  86. package/dist/engine/node/start.js +71 -3
  87. package/dist/engine/node/start.js.map +1 -1
  88. package/dist/engine/node/worker-env-aliases.d.ts +39 -0
  89. package/dist/engine/node/worker-env-aliases.d.ts.map +1 -0
  90. package/dist/engine/node/worker-env-aliases.js +126 -0
  91. package/dist/engine/node/worker-env-aliases.js.map +1 -0
  92. package/dist/engine/node/worker-env-table.d.ts.map +1 -1
  93. package/dist/engine/node/worker-env-table.js +4 -1
  94. package/dist/engine/node/worker-env-table.js.map +1 -1
  95. package/dist/engine/node/worker-env.d.ts +18 -1
  96. package/dist/engine/node/worker-env.d.ts.map +1 -1
  97. package/dist/engine/node/worker-env.js +13 -0
  98. package/dist/engine/node/worker-env.js.map +1 -1
  99. package/dist/engine/registries.d.ts.map +1 -1
  100. package/dist/engine/registries.js +7 -0
  101. package/dist/engine/registries.js.map +1 -1
  102. package/dist/engine/tui/app.d.ts.map +1 -1
  103. package/dist/engine/tui/app.js +15 -2
  104. package/dist/engine/tui/app.js.map +1 -1
  105. package/dist/engine/tui/builtin-screens.d.ts.map +1 -1
  106. package/dist/engine/tui/builtin-screens.js +6 -0
  107. package/dist/engine/tui/builtin-screens.js.map +1 -1
  108. package/dist/engine/tui/conformance.d.ts +143 -0
  109. package/dist/engine/tui/conformance.d.ts.map +1 -0
  110. package/dist/engine/tui/conformance.js +423 -0
  111. package/dist/engine/tui/conformance.js.map +1 -0
  112. package/dist/engine/tui/dashboard/index.d.ts +8 -0
  113. package/dist/engine/tui/dashboard/index.d.ts.map +1 -0
  114. package/dist/engine/tui/dashboard/index.js +5 -0
  115. package/dist/engine/tui/dashboard/index.js.map +1 -0
  116. package/dist/engine/tui/dashboard/jobs-insights.d.ts +145 -0
  117. package/dist/engine/tui/dashboard/jobs-insights.d.ts.map +1 -0
  118. package/dist/engine/tui/dashboard/jobs-insights.js +63 -0
  119. package/dist/engine/tui/dashboard/jobs-insights.js.map +1 -0
  120. package/dist/engine/tui/dashboard/node-embedded.d.ts +33 -0
  121. package/dist/engine/tui/dashboard/node-embedded.d.ts.map +1 -0
  122. package/dist/engine/tui/dashboard/node-embedded.js +81 -0
  123. package/dist/engine/tui/dashboard/node-embedded.js.map +1 -0
  124. package/dist/engine/tui/dashboard/source.d.ts +274 -0
  125. package/dist/engine/tui/dashboard/source.d.ts.map +1 -0
  126. package/dist/engine/tui/dashboard/source.js +351 -0
  127. package/dist/engine/tui/dashboard/source.js.map +1 -0
  128. package/dist/engine/tui/dashboard/use-dashboard.d.ts +23 -0
  129. package/dist/engine/tui/dashboard/use-dashboard.d.ts.map +1 -0
  130. package/dist/engine/tui/dashboard/use-dashboard.js +32 -0
  131. package/dist/engine/tui/dashboard/use-dashboard.js.map +1 -0
  132. package/dist/engine/tui/layout.d.ts +20 -0
  133. package/dist/engine/tui/layout.d.ts.map +1 -1
  134. package/dist/engine/tui/layout.js +7 -0
  135. package/dist/engine/tui/layout.js.map +1 -1
  136. package/dist/engine/tui/menu-registry.d.ts +124 -0
  137. package/dist/engine/tui/menu-registry.d.ts.map +1 -0
  138. package/dist/engine/tui/menu-registry.js +151 -0
  139. package/dist/engine/tui/menu-registry.js.map +1 -0
  140. package/dist/engine/tui/menu-tree.d.ts +179 -0
  141. package/dist/engine/tui/menu-tree.d.ts.map +1 -0
  142. package/dist/engine/tui/menu-tree.js +250 -0
  143. package/dist/engine/tui/menu-tree.js.map +1 -0
  144. package/dist/engine/tui/screen-registry.d.ts +1 -1
  145. package/dist/engine/tui/screen-registry.d.ts.map +1 -1
  146. package/dist/engine/tui/screen-registry.js +2 -1
  147. package/dist/engine/tui/screen-registry.js.map +1 -1
  148. package/dist/engine/tui/screens/jobs.d.ts +12 -0
  149. package/dist/engine/tui/screens/jobs.d.ts.map +1 -0
  150. package/dist/engine/tui/screens/jobs.js +72 -0
  151. package/dist/engine/tui/screens/jobs.js.map +1 -0
  152. package/dist/engine/tui/screens/menu.d.ts +4 -1
  153. package/dist/engine/tui/screens/menu.d.ts.map +1 -1
  154. package/dist/engine/tui/screens/menu.js +85 -22
  155. package/dist/engine/tui/screens/menu.js.map +1 -1
  156. package/dist/engine/tui/screens/node.d.ts.map +1 -1
  157. package/dist/engine/tui/screens/node.js +82 -37
  158. package/dist/engine/tui/screens/node.js.map +1 -1
  159. package/dist/engine/tui/screens/not-logged-in.d.ts +12 -0
  160. package/dist/engine/tui/screens/not-logged-in.d.ts.map +1 -0
  161. package/dist/engine/tui/screens/not-logged-in.js +14 -0
  162. package/dist/engine/tui/screens/not-logged-in.js.map +1 -0
  163. package/dist/engine/tui/scroll-box.d.ts +15 -0
  164. package/dist/engine/tui/scroll-box.d.ts.map +1 -1
  165. package/dist/engine/tui/scroll-box.js +10 -0
  166. package/dist/engine/tui/scroll-box.js.map +1 -1
  167. package/dist/engine/tui/testing/feeds.d.ts +58 -0
  168. package/dist/engine/tui/testing/feeds.d.ts.map +1 -0
  169. package/dist/engine/tui/testing/feeds.js +67 -0
  170. package/dist/engine/tui/testing/feeds.js.map +1 -0
  171. package/dist/engine/tui/testing/harness.d.ts +241 -0
  172. package/dist/engine/tui/testing/harness.d.ts.map +1 -0
  173. package/dist/engine/tui/testing/harness.js +332 -0
  174. package/dist/engine/tui/testing/harness.js.map +1 -0
  175. package/dist/engine/tui/ui/active-items.d.ts +40 -0
  176. package/dist/engine/tui/ui/active-items.d.ts.map +1 -0
  177. package/dist/engine/tui/ui/active-items.js +38 -0
  178. package/dist/engine/tui/ui/active-items.js.map +1 -0
  179. package/dist/engine/tui/ui/event-log.d.ts +58 -0
  180. package/dist/engine/tui/ui/event-log.d.ts.map +1 -0
  181. package/dist/engine/tui/ui/event-log.js +32 -0
  182. package/dist/engine/tui/ui/event-log.js.map +1 -0
  183. package/dist/engine/tui/ui/index.d.ts +20 -0
  184. package/dist/engine/tui/ui/index.d.ts.map +1 -0
  185. package/dist/engine/tui/ui/index.js +14 -0
  186. package/dist/engine/tui/ui/index.js.map +1 -0
  187. package/dist/engine/tui/ui/meter-legend.d.ts +26 -0
  188. package/dist/engine/tui/ui/meter-legend.d.ts.map +1 -0
  189. package/dist/engine/tui/ui/meter-legend.js +25 -0
  190. package/dist/engine/tui/ui/meter-legend.js.map +1 -0
  191. package/dist/engine/tui/ui/run-summary.d.ts +58 -0
  192. package/dist/engine/tui/ui/run-summary.d.ts.map +1 -0
  193. package/dist/engine/tui/ui/run-summary.js +29 -0
  194. package/dist/engine/tui/ui/run-summary.js.map +1 -0
  195. package/dist/engine/tui/ui/segment-meter.d.ts +72 -0
  196. package/dist/engine/tui/ui/segment-meter.d.ts.map +1 -0
  197. package/dist/engine/tui/ui/segment-meter.js +128 -0
  198. package/dist/engine/tui/ui/segment-meter.js.map +1 -0
  199. package/dist/engine/tui/ui/status-line.d.ts +42 -0
  200. package/dist/engine/tui/ui/status-line.d.ts.map +1 -0
  201. package/dist/engine/tui/ui/status-line.js +35 -0
  202. package/dist/engine/tui/ui/status-line.js.map +1 -0
  203. package/dist/engine/tui/ui/tone.d.ts +46 -0
  204. package/dist/engine/tui/ui/tone.d.ts.map +1 -0
  205. package/dist/engine/tui/ui/tone.js +48 -0
  206. package/dist/engine/tui/ui/tone.js.map +1 -0
  207. package/dist/node/index.d.ts +2 -2
  208. package/dist/node/index.d.ts.map +1 -1
  209. package/dist/node/index.js +1 -1
  210. package/dist/node/index.js.map +1 -1
  211. package/dist/testing/index.d.ts +2 -2
  212. package/dist/testing/index.d.ts.map +1 -1
  213. package/dist/testing/index.js +1 -1
  214. package/dist/testing/index.js.map +1 -1
  215. package/dist/tui/index.d.ts +2 -2
  216. package/dist/tui/index.d.ts.map +1 -1
  217. package/dist/tui/index.js +1 -1
  218. package/dist/tui/index.js.map +1 -1
  219. package/dist/tui/testing/index.d.ts +5 -0
  220. package/dist/tui/testing/index.d.ts.map +1 -0
  221. package/dist/tui/testing/index.js +12 -0
  222. package/dist/tui/testing/index.js.map +1 -0
  223. package/dist/tui/ui/index.d.ts +2 -0
  224. package/dist/tui/ui/index.d.ts.map +1 -0
  225. package/dist/tui/ui/index.js +10 -0
  226. package/dist/tui/ui/index.js.map +1 -0
  227. package/package.json +16 -3
@@ -0,0 +1,124 @@
1
+ import { type TuiMenuContext } from './screen-registry.js';
2
+ import type { TuiColor } from './theme.js';
3
+ /**
4
+ * The id of the implicit root section. Reserved.
5
+ *
6
+ * @stability experimental
7
+ */
8
+ export declare const TUI_MENU_ROOT = "root";
9
+ /**
10
+ * The deepest a section may nest (a section directly under the root is level 1).
11
+ *
12
+ * @stability experimental
13
+ */
14
+ export declare const TUI_MENU_MAX_DEPTH = 4;
15
+ /**
16
+ * A menu label: fixed, or a function of the login state.
17
+ *
18
+ * @stability experimental
19
+ */
20
+ export type TuiMenuLabel = string | ((context: TuiMenuContext) => string);
21
+ /**
22
+ * Fields both node kinds share.
23
+ *
24
+ * @stability experimental
25
+ */
26
+ export interface TuiMenuNodeBase {
27
+ /** Unique across sections and entries: lowercase `[a-z][a-z0-9-]*`; `root` is reserved. */
28
+ id: string;
29
+ /** The section it sits in. Default `root`. */
30
+ parent?: string | undefined;
31
+ /** What the menu shows; a function gets `{ loggedIn }`. */
32
+ label: TuiMenuLabel;
33
+ /** Position among its siblings: lower first; ties sort by id. */
34
+ order: number;
35
+ /**
36
+ * Visible when logged out. Omitted means INHERITED from the nearest ancestor
37
+ * that sets it (default false: hidden until login). An explicit `false`
38
+ * opts one child out of an offline section.
39
+ */
40
+ loggedOut?: boolean | undefined;
41
+ /** Hide the node once logged in (a "Login" entry that moves elsewhere). */
42
+ hideWhenLoggedIn?: boolean | undefined;
43
+ /** A theme token name (`error`, `success`, ...) or a plain colour such as `red`. Presentation only. */
44
+ color?: TuiColor;
45
+ }
46
+ /**
47
+ * A submenu.
48
+ *
49
+ * @stability experimental
50
+ */
51
+ export interface TuiMenuSection extends TuiMenuNodeBase {
52
+ /** Discriminant. */
53
+ kind: 'section';
54
+ /** Shown under the breadcrumb instead of the default hint. */
55
+ subtitle?: string | undefined;
56
+ }
57
+ /**
58
+ * A menu line that opens a registered screen.
59
+ *
60
+ * @stability experimental
61
+ */
62
+ export interface TuiMenuEntry extends TuiMenuNodeBase {
63
+ /** Discriminant. */
64
+ kind: 'entry';
65
+ /** A registered screen route (built-in or `registerTuiScreen`). */
66
+ route: string;
67
+ /** The screen asks for a further input step first; rendered with a trailing `…`. */
68
+ ellipsis?: boolean | undefined;
69
+ /**
70
+ * Opening the screen while logged out shows the shared "not logged in"
71
+ * notice instead. Default: true unless the entry is visible when logged out.
72
+ */
73
+ requiresLogin?: boolean | undefined;
74
+ }
75
+ /**
76
+ * A node of the menu tree.
77
+ *
78
+ * @stability experimental
79
+ */
80
+ export type TuiMenuNode = TuiMenuSection | TuiMenuEntry;
81
+ /**
82
+ * Adds a section or an entry to the TUI menu tree.
83
+ *
84
+ * Unknown `parent` and unknown `route` are rejected when `createCli` builds
85
+ * the CLI (so registration order is free), together with cycles and nesting
86
+ * deeper than {@link TUI_MENU_MAX_DEPTH}.
87
+ *
88
+ * @param node - A section (`kind: 'section'`) or an entry (`kind: 'entry'`, with a `route`).
89
+ * @throws Error when the id is malformed, reserved or taken, a field is missing, or `createCli` has already built the CLI.
90
+ * @stability experimental
91
+ * @extensionPoint registry
92
+ * @example
93
+ * ```ts
94
+ * registerTuiMenuNode({ kind: 'section', id: 'node', label: 'Worker node', order: 40 });
95
+ * registerTuiMenuNode({ kind: 'entry', id: 'node-dashboard', parent: 'node', route: 'node-dashboard', label: 'Dashboard', order: 10 });
96
+ * ```
97
+ */
98
+ export declare function registerTuiMenuNode(node: TuiMenuNode): void;
99
+ /**
100
+ * The menu nodes registered so far, in registration order.
101
+ *
102
+ * @returns A frozen copy.
103
+ * @stability experimental
104
+ */
105
+ export declare function listTuiMenuNodes(): readonly TuiMenuNode[];
106
+ /**
107
+ * Checks the references between nodes and screens.
108
+ *
109
+ * @param nodes - The registered nodes.
110
+ * @param routes - Every screen route that exists.
111
+ * @throws Error naming the offending node id for an unknown or non-section parent, an unknown route, a cycle, or nesting deeper than {@link TUI_MENU_MAX_DEPTH}.
112
+ * @stability experimental
113
+ */
114
+ export declare function validateTuiMenuNodes(nodes: readonly TuiMenuNode[], routes: readonly string[]): void;
115
+ /**
116
+ * Validates the registered nodes against the screens, then refuses later
117
+ * registrations; `createCli` calls it.
118
+ *
119
+ * @throws Error from {@link validateTuiMenuNodes}; nothing is frozen then.
120
+ */
121
+ export declare function freezeTuiMenuRegistry(by: string): void;
122
+ /** Empties the registry. Tests only. */
123
+ export declare function resetTuiMenuRegistryForTests(): void;
124
+ //# sourceMappingURL=menu-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-registry.d.ts","sourceRoot":"","sources":["../../../src/engine/tui/menu-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAiD,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC1G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmB3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,cAAc,KAAK,MAAM,CAAC,CAAC;AAE1E;;;;GAIG;AACH,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AgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAItD;AAED,wCAAwC;AACxC,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}
@@ -0,0 +1,151 @@
1
+ import { createCliRegistry } from '../../core/index.js';
2
+ import { BUILTIN_TUI_SCREENS, listRegisteredTuiScreens } from './screen-registry.js';
3
+ // =============================================================================
4
+ // The TUI menu tree registry (RETRO-G1.1, #1065)
5
+ // =============================================================================
6
+ //
7
+ // `registerTuiScreen` puts a screen in one flat list. A MENU NODE places things
8
+ // in a tree: a SECTION is a submenu (with a breadcrumb, a subtitle and a
9
+ // logged-out rule), an ENTRY opens a registered screen from inside a section.
10
+ // Nothing here is required: a screen that no entry references is shown at the
11
+ // root with its own label and order, exactly as before, so an app that never
12
+ // calls `registerTuiMenuNode` keeps today's menu.
13
+ //
14
+ // PURE ON PURPOSE, like screen-registry.ts: React is not imported at all, so
15
+ // registering a node from `createCli` never loads ink. References (`parent`,
16
+ // `route`) are resolved when `createCli` freezes the registries, not when a
17
+ // node is registered, so the order of registration does not matter.
18
+ // =============================================================================
19
+ /**
20
+ * The id of the implicit root section. Reserved.
21
+ *
22
+ * @stability experimental
23
+ */
24
+ export const TUI_MENU_ROOT = 'root';
25
+ /**
26
+ * The deepest a section may nest (a section directly under the root is level 1).
27
+ *
28
+ * @stability experimental
29
+ */
30
+ export const TUI_MENU_MAX_DEPTH = 4;
31
+ const ID_PATTERN = /^[a-z][a-z0-9-]*$/;
32
+ const registry = createCliRegistry({
33
+ name: 'TUI menu node',
34
+ registerFn: 'registerTuiMenuNode',
35
+ idOf: (node) => node.id,
36
+ validate: (node) => {
37
+ const id = node.id;
38
+ if (typeof id !== 'string' || !ID_PATTERN.test(id)) {
39
+ throw new Error(`TUI menu node id "${String(id)}" is invalid: use lowercase letters, digits and hyphens.`);
40
+ }
41
+ if (id === TUI_MENU_ROOT) {
42
+ throw new Error(`TUI menu node id "${TUI_MENU_ROOT}" is reserved for the menu root.`);
43
+ }
44
+ if (node.kind !== 'section' && node.kind !== 'entry') {
45
+ throw new Error(`TUI menu node "${id}" needs kind "section" or "entry".`);
46
+ }
47
+ if (typeof node.order !== 'number' || !Number.isFinite(node.order)) {
48
+ throw new Error(`TUI menu node "${id}" needs a finite numeric order.`);
49
+ }
50
+ if (typeof node.label !== 'string' && typeof node.label !== 'function') {
51
+ throw new Error(`TUI menu node "${id}" needs a label (a string or a function of the login state).`);
52
+ }
53
+ if (typeof node.label === 'string' && node.label.trim() === '') {
54
+ throw new Error(`TUI menu node "${id}" needs a non-empty label.`);
55
+ }
56
+ if (node.parent !== undefined && (typeof node.parent !== 'string' || node.parent === '')) {
57
+ throw new Error(`TUI menu node "${id}" has an invalid parent.`);
58
+ }
59
+ if (node.kind === 'entry' && (typeof node.route !== 'string' || node.route === '')) {
60
+ throw new Error(`TUI menu entry "${id}" needs the route of a registered screen.`);
61
+ }
62
+ },
63
+ });
64
+ /**
65
+ * Adds a section or an entry to the TUI menu tree.
66
+ *
67
+ * Unknown `parent` and unknown `route` are rejected when `createCli` builds
68
+ * the CLI (so registration order is free), together with cycles and nesting
69
+ * deeper than {@link TUI_MENU_MAX_DEPTH}.
70
+ *
71
+ * @param node - A section (`kind: 'section'`) or an entry (`kind: 'entry'`, with a `route`).
72
+ * @throws Error when the id is malformed, reserved or taken, a field is missing, or `createCli` has already built the CLI.
73
+ * @stability experimental
74
+ * @extensionPoint registry
75
+ * @example
76
+ * ```ts
77
+ * registerTuiMenuNode({ kind: 'section', id: 'node', label: 'Worker node', order: 40 });
78
+ * registerTuiMenuNode({ kind: 'entry', id: 'node-dashboard', parent: 'node', route: 'node-dashboard', label: 'Dashboard', order: 10 });
79
+ * ```
80
+ */
81
+ export function registerTuiMenuNode(node) {
82
+ registry.register(Object.freeze({ ...node }));
83
+ }
84
+ /**
85
+ * The menu nodes registered so far, in registration order.
86
+ *
87
+ * @returns A frozen copy.
88
+ * @stability experimental
89
+ */
90
+ export function listTuiMenuNodes() {
91
+ return registry.list();
92
+ }
93
+ /**
94
+ * Checks the references between nodes and screens.
95
+ *
96
+ * @param nodes - The registered nodes.
97
+ * @param routes - Every screen route that exists.
98
+ * @throws Error naming the offending node id for an unknown or non-section parent, an unknown route, a cycle, or nesting deeper than {@link TUI_MENU_MAX_DEPTH}.
99
+ * @stability experimental
100
+ */
101
+ export function validateTuiMenuNodes(nodes, routes) {
102
+ const byId = new Map(nodes.map((node) => [node.id, node]));
103
+ for (const node of nodes) {
104
+ const parent = node.parent ?? TUI_MENU_ROOT;
105
+ if (parent !== TUI_MENU_ROOT) {
106
+ const found = byId.get(parent);
107
+ if (found === undefined) {
108
+ throw new Error(`TUI menu node "${node.id}" has unknown parent "${parent}".`);
109
+ }
110
+ if (found.kind !== 'section') {
111
+ throw new Error(`TUI menu node "${node.id}" has parent "${parent}", which is an entry; a parent must be a section.`);
112
+ }
113
+ }
114
+ if (node.kind === 'entry' && !routes.includes(node.route)) {
115
+ throw new Error(`TUI menu entry "${node.id}" opens unknown screen route "${node.route}"; register it with registerTuiScreen.`);
116
+ }
117
+ }
118
+ for (const node of nodes) {
119
+ // Walk up; the chain must reach the root within the cap without repeating.
120
+ const seen = new Set([node.id]);
121
+ let level = node.kind === 'section' ? 1 : 0;
122
+ let parent = node.parent ?? TUI_MENU_ROOT;
123
+ while (parent !== TUI_MENU_ROOT) {
124
+ if (seen.has(parent)) {
125
+ throw new Error(`TUI menu node "${node.id}" is part of a cycle through "${parent}".`);
126
+ }
127
+ seen.add(parent);
128
+ level += 1;
129
+ parent = byId.get(parent)?.parent ?? TUI_MENU_ROOT;
130
+ }
131
+ if (level > TUI_MENU_MAX_DEPTH) {
132
+ throw new Error(`TUI menu node "${node.id}" nests ${level} sections deep; the limit is ${TUI_MENU_MAX_DEPTH}.`);
133
+ }
134
+ }
135
+ }
136
+ /**
137
+ * Validates the registered nodes against the screens, then refuses later
138
+ * registrations; `createCli` calls it.
139
+ *
140
+ * @throws Error from {@link validateTuiMenuNodes}; nothing is frozen then.
141
+ */
142
+ export function freezeTuiMenuRegistry(by) {
143
+ const routes = [...BUILTIN_TUI_SCREENS, ...listRegisteredTuiScreens()].map((screen) => screen.route);
144
+ validateTuiMenuNodes(registry.list(), routes);
145
+ registry.freeze(by);
146
+ }
147
+ /** Empties the registry. Tests only. */
148
+ export function resetTuiMenuRegistryForTests() {
149
+ registry.reset();
150
+ }
151
+ //# sourceMappingURL=menu-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-registry.js","sourceRoot":"","sources":["../../../src/engine/tui/menu-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAuB,MAAM,sBAAsB,CAAC;AAG1G,gFAAgF;AAChF,kDAAkD;AAClD,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,kDAAkD;AAClD,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,oEAAoE;AACpE,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AAEpC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAyEpC,MAAM,UAAU,GAAG,mBAAmB,CAAC;AAEvC,MAAM,QAAQ,GAAG,iBAAiB,CAAc;IAC9C,IAAI,EAAE,eAAe;IACrB,UAAU,EAAE,qBAAqB;IACjC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;IACvB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,EAAE,GAAI,IAAyB,CAAC,EAAE,CAAC;QACzC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAC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wB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrG,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,4BAA4B;IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,179 @@
1
+ import { type TuiMenuLabel, type TuiMenuNode } from './menu-registry.js';
2
+ import { type TuiMenuContext } from './screen-registry.js';
3
+ import type { TuiColor, TuiTheme } from './theme.js';
4
+ /**
5
+ * What the tree needs to know about a screen: its route, its root label and its order.
6
+ *
7
+ * @stability experimental
8
+ */
9
+ export interface TuiMenuScreenInfo {
10
+ /** The screen's route id. */
11
+ route: string;
12
+ /** Its root menu label. */
13
+ label: TuiMenuLabel;
14
+ /** Its root menu order. */
15
+ order: number;
16
+ }
17
+ /**
18
+ * What both kinds of built tree node carry.
19
+ *
20
+ * @stability experimental
21
+ */
22
+ export interface TuiMenuTreeNodeBase {
23
+ /** The node id (`screen:<route>` for a synthesised root entry). */
24
+ id: string;
25
+ /** The section it sits in (`root` for a top-level node). */
26
+ parentId: string;
27
+ /** The label, or a function of the login state. */
28
+ label: TuiMenuLabel;
29
+ /** Position among its siblings. */
30
+ order: number;
31
+ /** The node's own logged-out flag; `undefined` inherits from the parent. */
32
+ loggedOut: boolean | undefined;
33
+ /** Hidden once logged in. */
34
+ hideWhenLoggedIn: boolean;
35
+ /** A theme token, colour name or colour; resolve it with {@link tuiMenuColor}. */
36
+ color: TuiColor;
37
+ }
38
+ /**
39
+ * A section in the built tree.
40
+ *
41
+ * @stability experimental
42
+ */
43
+ export interface TuiMenuTreeSection extends TuiMenuTreeNodeBase {
44
+ /** Discriminant. */
45
+ kind: 'section';
46
+ /** Replaces the default hint under the breadcrumb. */
47
+ subtitle: string | undefined;
48
+ /** Children, sorted by order then id. */
49
+ children: TuiMenuTreeNode[];
50
+ }
51
+ /**
52
+ * An entry in the built tree.
53
+ *
54
+ * @stability experimental
55
+ */
56
+ export interface TuiMenuTreeEntry extends TuiMenuTreeNodeBase {
57
+ /** Discriminant. */
58
+ kind: 'entry';
59
+ /** The screen it opens. */
60
+ route: string;
61
+ /** Rendered with a trailing `…`. */
62
+ ellipsis: boolean;
63
+ /** An explicit `requiresLogin`; `undefined` derives it from the logged-out rule. */
64
+ requiresLogin: boolean | undefined;
65
+ /** True for a screen no node references, shown at the root as it always was. */
66
+ synthesised: boolean;
67
+ }
68
+ /**
69
+ * A node of the built tree.
70
+ *
71
+ * @stability experimental
72
+ */
73
+ export type TuiMenuTreeNode = TuiMenuTreeSection | TuiMenuTreeEntry;
74
+ /**
75
+ * The built menu: the root section plus an index by id.
76
+ *
77
+ * @stability experimental
78
+ */
79
+ export interface TuiMenuTree {
80
+ /** The implicit root section (id `root`). */
81
+ readonly root: TuiMenuTreeSection;
82
+ /** Every section by id, the root included. */
83
+ readonly sections: ReadonlyMap<string, TuiMenuTreeSection>;
84
+ /** Every entry (synthesised ones too), in tree order. */
85
+ readonly entries: readonly TuiMenuTreeEntry[];
86
+ /** True when the app registered at least one menu node. */
87
+ readonly customised: boolean;
88
+ }
89
+ /** Display name of the root in a breadcrumb. */
90
+ export declare const TUI_MENU_HOME_LABEL = "Home";
91
+ /**
92
+ * Builds the menu tree from registered nodes and the screens.
93
+ *
94
+ * Every screen that no entry opens becomes a root entry with its own label and
95
+ * order (visible when logged out, no login gate), so a CLI with no menu nodes
96
+ * lists exactly the screens it always did. A screen that an entry opens is
97
+ * left out of the root, so it appears once. Children sort by `order`, then id.
98
+ * References are assumed valid (`createCli` checks them when it freezes); an
99
+ * unresolvable node is placed at the root rather than lost.
100
+ *
101
+ * @param nodes - The registered nodes.
102
+ * @param screens - Every screen (built-in and app) with its root label and order.
103
+ * @returns The tree.
104
+ * @stability experimental
105
+ */
106
+ export declare function buildTuiMenuTree(nodes: readonly TuiMenuNode[], screens: readonly TuiMenuScreenInfo[]): TuiMenuTree;
107
+ /**
108
+ * The children of a section a user in this login state sees, in order.
109
+ *
110
+ * `loggedOut` CASCADES: a node with no explicit flag takes its parent's
111
+ * effective value, so a child added to an offline section cannot vanish for
112
+ * logged-out users by forgetting the flag; an explicit `false` opts one out.
113
+ * `hideWhenLoggedIn` hides a node once logged in. A section shows only when it
114
+ * has at least one visible descendant entry.
115
+ *
116
+ * @param sectionId - A section id; `root` for the top.
117
+ * @param context - The login state.
118
+ * @param tree - The tree (default: built from the registry, with built-in labels unresolved).
119
+ * @returns The visible children; empty for an unknown section.
120
+ * @stability experimental
121
+ */
122
+ export declare function visibleTuiMenuChildren(sectionId: string, context: TuiMenuContext, tree?: TuiMenuTree): TuiMenuTreeNode[];
123
+ /**
124
+ * The text of a menu line: the label for the login state, then the
125
+ * decorations, which only this function adds: a section ends in ` ▸`, an
126
+ * entry with `ellipsis` in `…`, and a 1-based `position` of 1 to 9 gets an
127
+ * `N. ` accelerator (later positions get equal-width padding so the column
128
+ * stays aligned).
129
+ *
130
+ * @param node - A tree node.
131
+ * @param position - The node's 1-based place among the visible items; omit for no prefix.
132
+ * @param context - The login state for a label function (default logged out).
133
+ * @returns The line.
134
+ * @stability experimental
135
+ */
136
+ export declare function tuiMenuItemLabel(node: TuiMenuTreeNode, position?: number, context?: TuiMenuContext): string;
137
+ /**
138
+ * The path from the root to a section: `Home › Node › Settings`.
139
+ *
140
+ * @param sectionId - A section id; `root` or an unknown id gives `Home`.
141
+ * @param context - The login state for label functions (default logged out).
142
+ * @param tree - The tree (default: built from the registry).
143
+ * @returns The labels joined with ` › `.
144
+ * @stability experimental
145
+ */
146
+ export declare function tuiBreadcrumb(sectionId: string, context?: TuiMenuContext, tree?: TuiMenuTree): string;
147
+ /**
148
+ * The parent of a section (`root` for a top-level one and for the root itself).
149
+ *
150
+ * @param sectionId - A section id.
151
+ * @param tree - The tree (default: built from the registry).
152
+ * @returns The parent section id.
153
+ * @stability experimental
154
+ */
155
+ export declare function tuiParentSectionId(sectionId: string, tree?: TuiMenuTree): string;
156
+ /**
157
+ * Whether opening a route while logged out should show the "not logged in"
158
+ * notice. True only when every entry that opens the route requires a login
159
+ * (`requiresLogin`, else "not visible when logged out"); a route no entry
160
+ * opens, or a synthesised root entry, never does.
161
+ *
162
+ * @param route - The screen route.
163
+ * @param tree - The tree (default: built from the registry).
164
+ * @returns Whether the route is login-gated.
165
+ * @stability experimental
166
+ */
167
+ export declare function tuiRouteRequiresLogin(route: string, tree?: TuiMenuTree): boolean;
168
+ /**
169
+ * Resolves a node's `color` for drawing: a theme token name or a basic colour
170
+ * name maps through the theme (so an app's palette applies and `NO_COLOR`
171
+ * yields no colour); any other string is used as written unless colour is off.
172
+ *
173
+ * @param theme - The app theme.
174
+ * @param color - The node's `color`.
175
+ * @returns A colour for ink, or `undefined` for none.
176
+ * @stability experimental
177
+ */
178
+ export declare function tuiMenuColor(theme: TuiTheme, color: TuiColor): TuiColor;
179
+ //# sourceMappingURL=menu-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-tree.d.ts","sourceRoot":"","sources":["../../../src/engine/tui/menu-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAiD,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC1G,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAcrD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,KAAK,EAAE,YAAY,CAAC;IACpB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,mEAAm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