@marinoscar/platform-cli 0.1.0-next.22 → 0.1.0-next.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.
- package/CHANGELOG.md +28 -0
- package/README.md +6 -1
- package/dist/engine/commands/node.d.ts.map +1 -1
- package/dist/engine/commands/node.js +8 -0
- package/dist/engine/commands/node.js.map +1 -1
- package/dist/engine/config.d.ts +38 -0
- package/dist/engine/config.d.ts.map +1 -1
- package/dist/engine/config.js +55 -0
- package/dist/engine/config.js.map +1 -1
- package/dist/engine/create-cli.d.ts +29 -0
- package/dist/engine/create-cli.d.ts.map +1 -1
- package/dist/engine/create-cli.js +18 -0
- package/dist/engine/create-cli.js.map +1 -1
- package/dist/engine/index.d.ts +28 -3
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +15 -1
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/node/daemon-channels.d.ts +66 -0
- package/dist/engine/node/daemon-channels.d.ts.map +1 -0
- package/dist/engine/node/daemon-channels.js +65 -0
- package/dist/engine/node/daemon-channels.js.map +1 -0
- package/dist/engine/node/daemon.d.ts.map +1 -1
- package/dist/engine/node/daemon.js +52 -0
- package/dist/engine/node/daemon.js.map +1 -1
- package/dist/engine/node/executors/credential-hygiene.d.ts +1 -1
- package/dist/engine/node/executors/credential-hygiene.d.ts.map +1 -1
- package/dist/engine/node/executors/credential-hygiene.js +23 -2
- package/dist/engine/node/executors/credential-hygiene.js.map +1 -1
- package/dist/engine/node/executors/index.d.ts +52 -7
- package/dist/engine/node/executors/index.d.ts.map +1 -1
- package/dist/engine/node/executors/index.js +14 -0
- package/dist/engine/node/executors/index.js.map +1 -1
- package/dist/engine/node/executors/registry.d.ts.map +1 -1
- package/dist/engine/node/executors/registry.js +13 -2
- package/dist/engine/node/executors/registry.js.map +1 -1
- package/dist/engine/node/ipc-protocol.d.ts +49 -2
- package/dist/engine/node/ipc-protocol.d.ts.map +1 -1
- package/dist/engine/node/ipc-protocol.js +39 -0
- package/dist/engine/node/ipc-protocol.js.map +1 -1
- package/dist/engine/node/lifecycle.js +2 -1
- package/dist/engine/node/lifecycle.js.map +1 -1
- package/dist/engine/node/logger.d.ts +13 -0
- package/dist/engine/node/logger.d.ts.map +1 -1
- package/dist/engine/node/logger.js.map +1 -1
- package/dist/engine/node/memory-watchdog.d.ts +11 -0
- package/dist/engine/node/memory-watchdog.d.ts.map +1 -1
- package/dist/engine/node/memory-watchdog.js +28 -4
- package/dist/engine/node/memory-watchdog.js.map +1 -1
- package/dist/engine/node/node-dashboard-source.d.ts +46 -19
- package/dist/engine/node/node-dashboard-source.d.ts.map +1 -1
- package/dist/engine/node/node-dashboard-source.js +70 -102
- package/dist/engine/node/node-dashboard-source.js.map +1 -1
- package/dist/engine/node/node-engine.d.ts +7 -1
- package/dist/engine/node/node-engine.d.ts.map +1 -1
- package/dist/engine/node/node-engine.js +81 -8
- package/dist/engine/node/node-engine.js.map +1 -1
- package/dist/engine/node/runtime-state.d.ts +24 -0
- package/dist/engine/node/runtime-state.d.ts.map +1 -0
- package/dist/engine/node/runtime-state.js +19 -0
- package/dist/engine/node/runtime-state.js.map +1 -0
- package/dist/engine/node/runtime-tuning.d.ts +111 -2
- package/dist/engine/node/runtime-tuning.d.ts.map +1 -1
- package/dist/engine/node/runtime-tuning.js +133 -4
- package/dist/engine/node/runtime-tuning.js.map +1 -1
- package/dist/engine/node/service.d.ts.map +1 -1
- package/dist/engine/node/service.js +4 -0
- package/dist/engine/node/service.js.map +1 -1
- package/dist/engine/node/start.d.ts +7 -0
- package/dist/engine/node/start.d.ts.map +1 -1
- package/dist/engine/node/start.js +33 -1
- package/dist/engine/node/start.js.map +1 -1
- package/dist/engine/node/worker-env-aliases.d.ts +39 -0
- package/dist/engine/node/worker-env-aliases.d.ts.map +1 -0
- package/dist/engine/node/worker-env-aliases.js +126 -0
- package/dist/engine/node/worker-env-aliases.js.map +1 -0
- package/dist/engine/node/worker-env-table.d.ts.map +1 -1
- package/dist/engine/node/worker-env-table.js +4 -1
- package/dist/engine/node/worker-env-table.js.map +1 -1
- package/dist/engine/node/worker-env.d.ts +13 -1
- package/dist/engine/node/worker-env.d.ts.map +1 -1
- package/dist/engine/node/worker-env.js +8 -0
- package/dist/engine/node/worker-env.js.map +1 -1
- package/dist/engine/registries.d.ts.map +1 -1
- package/dist/engine/registries.js +10 -0
- package/dist/engine/registries.js.map +1 -1
- package/dist/engine/tui/app-registry.d.ts +103 -0
- package/dist/engine/tui/app-registry.d.ts.map +1 -0
- package/dist/engine/tui/app-registry.js +103 -0
- package/dist/engine/tui/app-registry.js.map +1 -0
- package/dist/engine/tui/app.d.ts +9 -1
- package/dist/engine/tui/app.d.ts.map +1 -1
- package/dist/engine/tui/app.js +52 -18
- package/dist/engine/tui/app.js.map +1 -1
- package/dist/engine/tui/builtin-screens.d.ts.map +1 -1
- package/dist/engine/tui/builtin-screens.js +6 -0
- package/dist/engine/tui/builtin-screens.js.map +1 -1
- package/dist/engine/tui/context.d.ts +220 -0
- package/dist/engine/tui/context.d.ts.map +1 -0
- package/dist/engine/tui/context.js +258 -0
- package/dist/engine/tui/context.js.map +1 -0
- package/dist/engine/tui/dashboard/index.d.ts +8 -0
- package/dist/engine/tui/dashboard/index.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/index.js +5 -0
- package/dist/engine/tui/dashboard/index.js.map +1 -0
- package/dist/engine/tui/dashboard/jobs-insights.d.ts +145 -0
- package/dist/engine/tui/dashboard/jobs-insights.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/jobs-insights.js +63 -0
- package/dist/engine/tui/dashboard/jobs-insights.js.map +1 -0
- package/dist/engine/tui/dashboard/node-embedded.d.ts +33 -0
- package/dist/engine/tui/dashboard/node-embedded.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/node-embedded.js +81 -0
- package/dist/engine/tui/dashboard/node-embedded.js.map +1 -0
- package/dist/engine/tui/dashboard/source.d.ts +274 -0
- package/dist/engine/tui/dashboard/source.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/source.js +351 -0
- package/dist/engine/tui/dashboard/source.js.map +1 -0
- package/dist/engine/tui/dashboard/use-dashboard.d.ts +23 -0
- package/dist/engine/tui/dashboard/use-dashboard.d.ts.map +1 -0
- package/dist/engine/tui/dashboard/use-dashboard.js +32 -0
- package/dist/engine/tui/dashboard/use-dashboard.js.map +1 -0
- package/dist/engine/tui/index.d.ts +2 -0
- package/dist/engine/tui/index.d.ts.map +1 -1
- package/dist/engine/tui/index.js +19 -1
- package/dist/engine/tui/index.js.map +1 -1
- package/dist/engine/tui/layout.d.ts +20 -0
- package/dist/engine/tui/layout.d.ts.map +1 -1
- package/dist/engine/tui/layout.js +17 -3
- package/dist/engine/tui/layout.js.map +1 -1
- package/dist/engine/tui/menu-registry.d.ts +124 -0
- package/dist/engine/tui/menu-registry.d.ts.map +1 -0
- package/dist/engine/tui/menu-registry.js +151 -0
- package/dist/engine/tui/menu-registry.js.map +1 -0
- package/dist/engine/tui/menu-tree.d.ts +179 -0
- package/dist/engine/tui/menu-tree.d.ts.map +1 -0
- package/dist/engine/tui/menu-tree.js +250 -0
- package/dist/engine/tui/menu-tree.js.map +1 -0
- package/dist/engine/tui/raw-mode.d.ts +54 -0
- package/dist/engine/tui/raw-mode.d.ts.map +1 -0
- package/dist/engine/tui/raw-mode.js +106 -0
- package/dist/engine/tui/raw-mode.js.map +1 -0
- package/dist/engine/tui/screen-registry.d.ts +4 -2
- package/dist/engine/tui/screen-registry.d.ts.map +1 -1
- package/dist/engine/tui/screen-registry.js +2 -1
- package/dist/engine/tui/screen-registry.js.map +1 -1
- package/dist/engine/tui/screens/invoke.d.ts.map +1 -1
- package/dist/engine/tui/screens/invoke.js +5 -2
- package/dist/engine/tui/screens/invoke.js.map +1 -1
- package/dist/engine/tui/screens/jobs.d.ts +12 -0
- package/dist/engine/tui/screens/jobs.d.ts.map +1 -0
- package/dist/engine/tui/screens/jobs.js +72 -0
- package/dist/engine/tui/screens/jobs.js.map +1 -0
- package/dist/engine/tui/screens/login.d.ts.map +1 -1
- package/dist/engine/tui/screens/login.js +17 -9
- package/dist/engine/tui/screens/login.js.map +1 -1
- package/dist/engine/tui/screens/logout.d.ts.map +1 -1
- package/dist/engine/tui/screens/logout.js +12 -5
- package/dist/engine/tui/screens/logout.js.map +1 -1
- package/dist/engine/tui/screens/menu.d.ts +4 -1
- package/dist/engine/tui/screens/menu.d.ts.map +1 -1
- package/dist/engine/tui/screens/menu.js +90 -60
- package/dist/engine/tui/screens/menu.js.map +1 -1
- package/dist/engine/tui/screens/node.d.ts.map +1 -1
- package/dist/engine/tui/screens/node.js +88 -39
- package/dist/engine/tui/screens/node.js.map +1 -1
- package/dist/engine/tui/screens/not-logged-in.d.ts +12 -0
- package/dist/engine/tui/screens/not-logged-in.d.ts.map +1 -0
- package/dist/engine/tui/screens/not-logged-in.js +14 -0
- package/dist/engine/tui/screens/not-logged-in.js.map +1 -0
- package/dist/engine/tui/screens/status.d.ts.map +1 -1
- package/dist/engine/tui/screens/status.js +8 -4
- package/dist/engine/tui/screens/status.js.map +1 -1
- package/dist/engine/tui/scroll-box.d.ts +15 -0
- package/dist/engine/tui/scroll-box.d.ts.map +1 -1
- package/dist/engine/tui/scroll-box.js +10 -0
- package/dist/engine/tui/scroll-box.js.map +1 -1
- package/dist/engine/tui/theme.d.ts +179 -0
- package/dist/engine/tui/theme.d.ts.map +1 -0
- package/dist/engine/tui/theme.js +111 -0
- package/dist/engine/tui/theme.js.map +1 -0
- package/dist/engine/tui/tty.d.ts +7 -0
- package/dist/engine/tui/tty.d.ts.map +1 -1
- package/dist/engine/tui/tty.js +8 -1
- package/dist/engine/tui/tty.js.map +1 -1
- package/dist/engine/tui/ui/active-items.d.ts +40 -0
- package/dist/engine/tui/ui/active-items.d.ts.map +1 -0
- package/dist/engine/tui/ui/active-items.js +38 -0
- package/dist/engine/tui/ui/active-items.js.map +1 -0
- package/dist/engine/tui/ui/event-log.d.ts +58 -0
- package/dist/engine/tui/ui/event-log.d.ts.map +1 -0
- package/dist/engine/tui/ui/event-log.js +32 -0
- package/dist/engine/tui/ui/event-log.js.map +1 -0
- package/dist/engine/tui/ui/index.d.ts +20 -0
- package/dist/engine/tui/ui/index.d.ts.map +1 -0
- package/dist/engine/tui/ui/index.js +14 -0
- package/dist/engine/tui/ui/index.js.map +1 -0
- package/dist/engine/tui/ui/meter-legend.d.ts +26 -0
- package/dist/engine/tui/ui/meter-legend.d.ts.map +1 -0
- package/dist/engine/tui/ui/meter-legend.js +25 -0
- package/dist/engine/tui/ui/meter-legend.js.map +1 -0
- package/dist/engine/tui/ui/run-summary.d.ts +58 -0
- package/dist/engine/tui/ui/run-summary.d.ts.map +1 -0
- package/dist/engine/tui/ui/run-summary.js +29 -0
- package/dist/engine/tui/ui/run-summary.js.map +1 -0
- package/dist/engine/tui/ui/segment-meter.d.ts +72 -0
- package/dist/engine/tui/ui/segment-meter.d.ts.map +1 -0
- package/dist/engine/tui/ui/segment-meter.js +128 -0
- package/dist/engine/tui/ui/segment-meter.js.map +1 -0
- package/dist/engine/tui/ui/status-line.d.ts +42 -0
- package/dist/engine/tui/ui/status-line.d.ts.map +1 -0
- package/dist/engine/tui/ui/status-line.js +35 -0
- package/dist/engine/tui/ui/status-line.js.map +1 -0
- package/dist/engine/tui/ui/tone.d.ts +46 -0
- package/dist/engine/tui/ui/tone.d.ts.map +1 -0
- package/dist/engine/tui/ui/tone.js +48 -0
- package/dist/engine/tui/ui/tone.js.map +1 -0
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/tui/index.d.ts +2 -2
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +6 -4
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/ui/index.d.ts +2 -0
- package/dist/tui/ui/index.d.ts.map +1 -0
- package/dist/tui/ui/index.js +10 -0
- package/dist/tui/ui/index.js.map +1 -0
- package/package.json +8 -3
|
@@ -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,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAC;IACX,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,KAAK,EAAE,YAAY,CAAC;IACpB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,SAAS,EAAE,OAAO,GAAG,SAAS,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uBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,GAAE,WAA2B,GAAG,eAAe,EAAE,CAQvI;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,cAAoC,GAAG,MAAM,CAKhI;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,cAAoC,EAAE,IAAI,GAAE,WAA2B,GAAG,MAAM,CAUzI;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,WAA2B,GAAG,MAAM,CAE/F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,WAA2B,GAAG,OAAO,CAI/F;AAeD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAIvE"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { listTuiMenuNodes, TUI_MENU_ROOT, } from './menu-registry.js';
|
|
2
|
+
import { BUILTIN_TUI_SCREENS, listRegisteredTuiScreens } from './screen-registry.js';
|
|
3
|
+
/** Display name of the root in a breadcrumb. */
|
|
4
|
+
export const TUI_MENU_HOME_LABEL = 'Home';
|
|
5
|
+
function byOrder(a, b) {
|
|
6
|
+
return a.order - b.order || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Builds the menu tree from registered nodes and the screens.
|
|
10
|
+
*
|
|
11
|
+
* Every screen that no entry opens becomes a root entry with its own label and
|
|
12
|
+
* order (visible when logged out, no login gate), so a CLI with no menu nodes
|
|
13
|
+
* lists exactly the screens it always did. A screen that an entry opens is
|
|
14
|
+
* left out of the root, so it appears once. Children sort by `order`, then id.
|
|
15
|
+
* References are assumed valid (`createCli` checks them when it freezes); an
|
|
16
|
+
* unresolvable node is placed at the root rather than lost.
|
|
17
|
+
*
|
|
18
|
+
* @param nodes - The registered nodes.
|
|
19
|
+
* @param screens - Every screen (built-in and app) with its root label and order.
|
|
20
|
+
* @returns The tree.
|
|
21
|
+
* @stability experimental
|
|
22
|
+
*/
|
|
23
|
+
export function buildTuiMenuTree(nodes, screens) {
|
|
24
|
+
const sections = new Map();
|
|
25
|
+
const root = {
|
|
26
|
+
kind: 'section',
|
|
27
|
+
id: TUI_MENU_ROOT,
|
|
28
|
+
parentId: TUI_MENU_ROOT,
|
|
29
|
+
label: TUI_MENU_HOME_LABEL,
|
|
30
|
+
order: 0,
|
|
31
|
+
loggedOut: undefined,
|
|
32
|
+
hideWhenLoggedIn: false,
|
|
33
|
+
color: undefined,
|
|
34
|
+
subtitle: undefined,
|
|
35
|
+
children: [],
|
|
36
|
+
};
|
|
37
|
+
sections.set(root.id, root);
|
|
38
|
+
for (const node of nodes) {
|
|
39
|
+
if (node.kind !== 'section')
|
|
40
|
+
continue;
|
|
41
|
+
sections.set(node.id, {
|
|
42
|
+
kind: 'section',
|
|
43
|
+
id: node.id,
|
|
44
|
+
parentId: node.parent ?? TUI_MENU_ROOT,
|
|
45
|
+
label: node.label,
|
|
46
|
+
order: node.order,
|
|
47
|
+
loggedOut: node.loggedOut,
|
|
48
|
+
hideWhenLoggedIn: node.hideWhenLoggedIn === true,
|
|
49
|
+
color: node.color,
|
|
50
|
+
subtitle: node.subtitle,
|
|
51
|
+
children: [],
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const entries = [];
|
|
55
|
+
const place = (child) => {
|
|
56
|
+
(sections.get(child.parentId) ?? root).children.push(child);
|
|
57
|
+
};
|
|
58
|
+
for (const section of sections.values()) {
|
|
59
|
+
if (section !== root)
|
|
60
|
+
place(section);
|
|
61
|
+
}
|
|
62
|
+
for (const node of nodes) {
|
|
63
|
+
if (node.kind !== 'entry')
|
|
64
|
+
continue;
|
|
65
|
+
const entry = {
|
|
66
|
+
kind: 'entry',
|
|
67
|
+
id: node.id,
|
|
68
|
+
parentId: node.parent ?? TUI_MENU_ROOT,
|
|
69
|
+
label: node.label,
|
|
70
|
+
order: node.order,
|
|
71
|
+
loggedOut: node.loggedOut,
|
|
72
|
+
hideWhenLoggedIn: node.hideWhenLoggedIn === true,
|
|
73
|
+
color: node.color,
|
|
74
|
+
route: node.route,
|
|
75
|
+
ellipsis: node.ellipsis === true,
|
|
76
|
+
requiresLogin: node.requiresLogin,
|
|
77
|
+
synthesised: false,
|
|
78
|
+
};
|
|
79
|
+
entries.push(entry);
|
|
80
|
+
place(entry);
|
|
81
|
+
}
|
|
82
|
+
const referenced = new Set(entries.map((entry) => entry.route));
|
|
83
|
+
for (const screen of screens) {
|
|
84
|
+
if (referenced.has(screen.route))
|
|
85
|
+
continue;
|
|
86
|
+
const entry = {
|
|
87
|
+
kind: 'entry',
|
|
88
|
+
// Not a valid registered id, so it can never collide with one.
|
|
89
|
+
id: `screen:${screen.route}`,
|
|
90
|
+
parentId: TUI_MENU_ROOT,
|
|
91
|
+
label: screen.label,
|
|
92
|
+
order: screen.order,
|
|
93
|
+
loggedOut: true,
|
|
94
|
+
hideWhenLoggedIn: false,
|
|
95
|
+
color: undefined,
|
|
96
|
+
route: screen.route,
|
|
97
|
+
ellipsis: false,
|
|
98
|
+
requiresLogin: false,
|
|
99
|
+
synthesised: true,
|
|
100
|
+
};
|
|
101
|
+
entries.push(entry);
|
|
102
|
+
place(entry);
|
|
103
|
+
}
|
|
104
|
+
for (const section of sections.values())
|
|
105
|
+
section.children.sort(byOrder);
|
|
106
|
+
return { root, sections, entries, customised: nodes.length > 0 };
|
|
107
|
+
}
|
|
108
|
+
/** The tree from the registry, with built-in labels unknown (their route stands in): for pure callers and tests. */
|
|
109
|
+
function defaultTree() {
|
|
110
|
+
const screens = [
|
|
111
|
+
...BUILTIN_TUI_SCREENS.map(({ route, order }) => ({ route, order, label: route })),
|
|
112
|
+
...listRegisteredTuiScreens(),
|
|
113
|
+
];
|
|
114
|
+
return buildTuiMenuTree(listTuiMenuNodes(), screens);
|
|
115
|
+
}
|
|
116
|
+
/** The effective logged-out flag: the nearest explicit one, walking up; false at the root. */
|
|
117
|
+
function effectiveLoggedOut(node, tree) {
|
|
118
|
+
let current = node;
|
|
119
|
+
const guard = new Set();
|
|
120
|
+
while (current !== undefined && !guard.has(current.id)) {
|
|
121
|
+
if (current.loggedOut !== undefined)
|
|
122
|
+
return current.loggedOut;
|
|
123
|
+
guard.add(current.id);
|
|
124
|
+
current = current.id === TUI_MENU_ROOT ? undefined : tree.sections.get(current.parentId);
|
|
125
|
+
}
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The children of a section a user in this login state sees, in order.
|
|
130
|
+
*
|
|
131
|
+
* `loggedOut` CASCADES: a node with no explicit flag takes its parent's
|
|
132
|
+
* effective value, so a child added to an offline section cannot vanish for
|
|
133
|
+
* logged-out users by forgetting the flag; an explicit `false` opts one out.
|
|
134
|
+
* `hideWhenLoggedIn` hides a node once logged in. A section shows only when it
|
|
135
|
+
* has at least one visible descendant entry.
|
|
136
|
+
*
|
|
137
|
+
* @param sectionId - A section id; `root` for the top.
|
|
138
|
+
* @param context - The login state.
|
|
139
|
+
* @param tree - The tree (default: built from the registry, with built-in labels unresolved).
|
|
140
|
+
* @returns The visible children; empty for an unknown section.
|
|
141
|
+
* @stability experimental
|
|
142
|
+
*/
|
|
143
|
+
export function visibleTuiMenuChildren(sectionId, context, tree = defaultTree()) {
|
|
144
|
+
const section = tree.sections.get(sectionId);
|
|
145
|
+
if (section === undefined)
|
|
146
|
+
return [];
|
|
147
|
+
return section.children.filter((child) => {
|
|
148
|
+
if (context.loggedIn && child.hideWhenLoggedIn)
|
|
149
|
+
return false;
|
|
150
|
+
if (child.kind === 'entry')
|
|
151
|
+
return effectiveLoggedOut(child, tree) || context.loggedIn;
|
|
152
|
+
return visibleTuiMenuChildren(child.id, context, tree).length > 0;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The text of a menu line: the label for the login state, then the
|
|
157
|
+
* decorations, which only this function adds: a section ends in ` ▸`, an
|
|
158
|
+
* entry with `ellipsis` in `…`, and a 1-based `position` of 1 to 9 gets an
|
|
159
|
+
* `N. ` accelerator (later positions get equal-width padding so the column
|
|
160
|
+
* stays aligned).
|
|
161
|
+
*
|
|
162
|
+
* @param node - A tree node.
|
|
163
|
+
* @param position - The node's 1-based place among the visible items; omit for no prefix.
|
|
164
|
+
* @param context - The login state for a label function (default logged out).
|
|
165
|
+
* @returns The line.
|
|
166
|
+
* @stability experimental
|
|
167
|
+
*/
|
|
168
|
+
export function tuiMenuItemLabel(node, position, context = { loggedIn: false }) {
|
|
169
|
+
const text = typeof node.label === 'function' ? node.label(context) : node.label;
|
|
170
|
+
const base = node.kind === 'section' ? `${text} ▸` : node.ellipsis ? `${text}…` : text;
|
|
171
|
+
if (position === undefined)
|
|
172
|
+
return base;
|
|
173
|
+
return `${position >= 1 && position <= 9 ? `${position}. ` : ' '}${base}`;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The path from the root to a section: `Home › Node › Settings`.
|
|
177
|
+
*
|
|
178
|
+
* @param sectionId - A section id; `root` or an unknown id gives `Home`.
|
|
179
|
+
* @param context - The login state for label functions (default logged out).
|
|
180
|
+
* @param tree - The tree (default: built from the registry).
|
|
181
|
+
* @returns The labels joined with ` › `.
|
|
182
|
+
* @stability experimental
|
|
183
|
+
*/
|
|
184
|
+
export function tuiBreadcrumb(sectionId, context = { loggedIn: false }, tree = defaultTree()) {
|
|
185
|
+
const trail = [];
|
|
186
|
+
const guard = new Set();
|
|
187
|
+
let current = tree.sections.get(sectionId);
|
|
188
|
+
while (current !== undefined && current.id !== TUI_MENU_ROOT && !guard.has(current.id)) {
|
|
189
|
+
guard.add(current.id);
|
|
190
|
+
trail.unshift(typeof current.label === 'function' ? current.label(context) : current.label);
|
|
191
|
+
current = tree.sections.get(current.parentId);
|
|
192
|
+
}
|
|
193
|
+
return [TUI_MENU_HOME_LABEL, ...trail].join(' › ');
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The parent of a section (`root` for a top-level one and for the root itself).
|
|
197
|
+
*
|
|
198
|
+
* @param sectionId - A section id.
|
|
199
|
+
* @param tree - The tree (default: built from the registry).
|
|
200
|
+
* @returns The parent section id.
|
|
201
|
+
* @stability experimental
|
|
202
|
+
*/
|
|
203
|
+
export function tuiParentSectionId(sectionId, tree = defaultTree()) {
|
|
204
|
+
return tree.sections.get(sectionId)?.parentId ?? TUI_MENU_ROOT;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Whether opening a route while logged out should show the "not logged in"
|
|
208
|
+
* notice. True only when every entry that opens the route requires a login
|
|
209
|
+
* (`requiresLogin`, else "not visible when logged out"); a route no entry
|
|
210
|
+
* opens, or a synthesised root entry, never does.
|
|
211
|
+
*
|
|
212
|
+
* @param route - The screen route.
|
|
213
|
+
* @param tree - The tree (default: built from the registry).
|
|
214
|
+
* @returns Whether the route is login-gated.
|
|
215
|
+
* @stability experimental
|
|
216
|
+
*/
|
|
217
|
+
export function tuiRouteRequiresLogin(route, tree = defaultTree()) {
|
|
218
|
+
const opening = tree.entries.filter((entry) => entry.route === route);
|
|
219
|
+
if (opening.length === 0)
|
|
220
|
+
return false;
|
|
221
|
+
return opening.every((entry) => entry.requiresLogin ?? !effectiveLoggedOut(entry, tree));
|
|
222
|
+
}
|
|
223
|
+
const NAMED_COLOURS = {
|
|
224
|
+
red: 'error',
|
|
225
|
+
green: 'success',
|
|
226
|
+
yellow: 'warning',
|
|
227
|
+
blue: 'info',
|
|
228
|
+
gray: 'dim',
|
|
229
|
+
grey: 'dim',
|
|
230
|
+
magenta: 'accent',
|
|
231
|
+
cyan: 'primary',
|
|
232
|
+
};
|
|
233
|
+
const THEME_TOKENS = ['primary', 'success', 'warning', 'error', 'info', 'dim', 'accent', 'banner'];
|
|
234
|
+
/**
|
|
235
|
+
* Resolves a node's `color` for drawing: a theme token name or a basic colour
|
|
236
|
+
* name maps through the theme (so an app's palette applies and `NO_COLOR`
|
|
237
|
+
* yields no colour); any other string is used as written unless colour is off.
|
|
238
|
+
*
|
|
239
|
+
* @param theme - The app theme.
|
|
240
|
+
* @param color - The node's `color`.
|
|
241
|
+
* @returns A colour for ink, or `undefined` for none.
|
|
242
|
+
* @stability experimental
|
|
243
|
+
*/
|
|
244
|
+
export function tuiMenuColor(theme, color) {
|
|
245
|
+
if (color === undefined || !theme.color)
|
|
246
|
+
return undefined;
|
|
247
|
+
const token = THEME_TOKENS.includes(color) ? color : NAMED_COLOURS[color];
|
|
248
|
+
return token === undefined ? color : theme[token];
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=menu-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-tree.js","sourceRoot":"","sources":["../../../src/engine/tui/menu-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,aAAa,GAGd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAuB,MAAM,sBAAsB,CAAC;AA0G1G,gDAAgD;AAChD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAE1C,SAAS,OAAO,CAAC,CAAgC,EAAE,CAAgC;IACjF,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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S,CAAC;IAC1D,MAAM,KAAK,GAAI,YAAkC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAuC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACpI,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True only when `stream` is a TTY whose `setRawMode` works. The probe turns
|
|
3
|
+
* raw mode on and straight off again; any throw (EIO on a serial or LXC
|
|
4
|
+
* console, a redirected fd) means the terminal cannot support it.
|
|
5
|
+
*
|
|
6
|
+
* @param stream - A candidate stdin.
|
|
7
|
+
* @returns Whether ink can drive it.
|
|
8
|
+
* @stability experimental
|
|
9
|
+
*/
|
|
10
|
+
export declare function canUseRawMode(stream: unknown): stream is NodeJS.ReadStream;
|
|
11
|
+
/**
|
|
12
|
+
* A stdin ink can drive, and how to let go of it.
|
|
13
|
+
*
|
|
14
|
+
* @stability experimental
|
|
15
|
+
*/
|
|
16
|
+
export interface InteractiveStdin {
|
|
17
|
+
/** The stream to hand to ink. */
|
|
18
|
+
readonly stream: NodeJS.ReadStream;
|
|
19
|
+
/** True when it is the controlling terminal opened here rather than the given stdin. */
|
|
20
|
+
readonly fromControllingTerminal: boolean;
|
|
21
|
+
/** Destroys a stream this module opened; a no-op for the given stdin. Idempotent. */
|
|
22
|
+
release(): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Seams of {@link resolveInteractiveStdin}; each defaults to the real process.
|
|
26
|
+
*
|
|
27
|
+
* @stability experimental
|
|
28
|
+
*/
|
|
29
|
+
export interface ResolveInteractiveStdinOptions {
|
|
30
|
+
/** The preferred stdin. Defaults to `process.stdin`. */
|
|
31
|
+
stdin?: unknown;
|
|
32
|
+
/** Opens the controlling terminal read-only. Defaults to `/dev/tty`. Return `undefined` or throw for none. */
|
|
33
|
+
openTerminal?: (() => NodeJS.ReadStream | undefined) | undefined;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Finds a stdin ink can drive in raw mode. Prefers the given stdin; when it
|
|
37
|
+
* cannot (fd 0 redirected or broken) opens the controlling terminal read-only.
|
|
38
|
+
* Never throws.
|
|
39
|
+
*
|
|
40
|
+
* @param options - Test seams.
|
|
41
|
+
* @returns A handle, or `null` when no usable terminal exists.
|
|
42
|
+
* @stability experimental
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveInteractiveStdin(options?: ResolveInteractiveStdinOptions): InteractiveStdin | null;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a stdin ink can drive exists, without keeping it: the TTY gate's
|
|
47
|
+
* question. Opens and closes the controlling terminal when it has to.
|
|
48
|
+
*
|
|
49
|
+
* @param options - Test seams.
|
|
50
|
+
* @returns True when {@link resolveInteractiveStdin} would succeed.
|
|
51
|
+
* @stability experimental
|
|
52
|
+
*/
|
|
53
|
+
export declare function hasInteractiveStdin(options?: ResolveInteractiveStdinOptions): boolean;
|
|
54
|
+
//# sourceMappingURL=raw-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw-mode.d.ts","sourceRoot":"","sources":["../../../src/engine/tui/raw-mode.ts"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC,UAAU,CAU1E;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC;IACnC,wFAAwF;IACxF,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,qFAAqF;IACrF,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC7C,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8GAA8G;IAC9G,YAAY,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;CAClE;AAYD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,8BAAmC,GAAG,gBAAgB,GAAG,IAAI,CAiC7G;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,8BAAmC,GAAG,OAAO,CAIzF"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { closeSync, openSync } from 'node:fs';
|
|
2
|
+
import { ReadStream } from 'node:tty';
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Raw-mode resolution (RETRO-G1.2, #1066)
|
|
5
|
+
// =============================================================================
|
|
6
|
+
//
|
|
7
|
+
// ink puts stdin into raw mode to read keystrokes. On serial, hypervisor and
|
|
8
|
+
// LXC consoles, or when fd 0 is redirected while stdout is still a terminal,
|
|
9
|
+
// `setRawMode` throws EIO, and ink surfaces that synchronously from `render`:
|
|
10
|
+
// the whole CLI dies with a stack trace. The controlling terminal (`/dev/tty`)
|
|
11
|
+
// often still works in those cases, so the TUI falls back to it.
|
|
12
|
+
//
|
|
13
|
+
// PURE ON PURPOSE: node built-ins only, no ink and no React, so the TTY gate
|
|
14
|
+
// (tty.ts) can ask "could the TUI start?" without loading the renderer.
|
|
15
|
+
// =============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* True only when `stream` is a TTY whose `setRawMode` works. The probe turns
|
|
18
|
+
* raw mode on and straight off again; any throw (EIO on a serial or LXC
|
|
19
|
+
* console, a redirected fd) means the terminal cannot support it.
|
|
20
|
+
*
|
|
21
|
+
* @param stream - A candidate stdin.
|
|
22
|
+
* @returns Whether ink can drive it.
|
|
23
|
+
* @stability experimental
|
|
24
|
+
*/
|
|
25
|
+
export function canUseRawMode(stream) {
|
|
26
|
+
const candidate = stream;
|
|
27
|
+
if (!candidate || candidate.isTTY !== true || typeof candidate.setRawMode !== 'function')
|
|
28
|
+
return false;
|
|
29
|
+
try {
|
|
30
|
+
candidate.setRawMode(true);
|
|
31
|
+
candidate.setRawMode(false);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function openControllingTerminal() {
|
|
39
|
+
const fd = openSync('/dev/tty', 'r');
|
|
40
|
+
try {
|
|
41
|
+
return new ReadStream(fd);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
closeSync(fd);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Finds a stdin ink can drive in raw mode. Prefers the given stdin; when it
|
|
50
|
+
* cannot (fd 0 redirected or broken) opens the controlling terminal read-only.
|
|
51
|
+
* Never throws.
|
|
52
|
+
*
|
|
53
|
+
* @param options - Test seams.
|
|
54
|
+
* @returns A handle, or `null` when no usable terminal exists.
|
|
55
|
+
* @stability experimental
|
|
56
|
+
*/
|
|
57
|
+
export function resolveInteractiveStdin(options = {}) {
|
|
58
|
+
try {
|
|
59
|
+
const stdin = 'stdin' in options ? options.stdin : process.stdin;
|
|
60
|
+
if (canUseRawMode(stdin)) {
|
|
61
|
+
return { stream: stdin, fromControllingTerminal: false, release: () => undefined };
|
|
62
|
+
}
|
|
63
|
+
let opened;
|
|
64
|
+
try {
|
|
65
|
+
opened = (options.openTerminal ?? openControllingTerminal)();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null; // No /dev/tty (Windows, a daemon without a controlling terminal).
|
|
69
|
+
}
|
|
70
|
+
if (opened === undefined)
|
|
71
|
+
return null;
|
|
72
|
+
const terminal = opened;
|
|
73
|
+
if (!canUseRawMode(terminal)) {
|
|
74
|
+
terminal.destroy?.();
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
let released = false;
|
|
78
|
+
return {
|
|
79
|
+
stream: terminal,
|
|
80
|
+
fromControllingTerminal: true,
|
|
81
|
+
release: () => {
|
|
82
|
+
if (released)
|
|
83
|
+
return;
|
|
84
|
+
released = true;
|
|
85
|
+
terminal.destroy?.();
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Whether a stdin ink can drive exists, without keeping it: the TTY gate's
|
|
95
|
+
* question. Opens and closes the controlling terminal when it has to.
|
|
96
|
+
*
|
|
97
|
+
* @param options - Test seams.
|
|
98
|
+
* @returns True when {@link resolveInteractiveStdin} would succeed.
|
|
99
|
+
* @stability experimental
|
|
100
|
+
*/
|
|
101
|
+
export function hasInteractiveStdin(options = {}) {
|
|
102
|
+
const handle = resolveInteractiveStdin(options);
|
|
103
|
+
handle?.release();
|
|
104
|
+
return handle !== null;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=raw-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw-mode.js","sourceRoot":"","sources":["../../../src/engine/tui/raw-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,gFAAgF;AAChF,2CAA2C;AAC3C,gFAAgF;AAChF,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,iEAAiE;AACjE,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,gFAAgF;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe;IAC3C,MAAM,SAAS,GAAG,MAAuD,CAAC;IAC1E,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,SA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a,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,QAAgD,CAAC,OAAO,EAAE,EAAE,CAAC;YAC9D,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,uBAAuB,EAAE,IAAI;YAC7B,OAAO,EAAE,GAAG,EAAE;gBACZ,IAAI,QAAQ;oBAAE,OAAO;gBACrB,QAAQ,GAAG,IAAI,CAAC;gBACf,QAAgD,CAAC,OAAO,EAAE,EAAE,CAAC;YAChE,CAAC;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA0C,EAAE;IAC9E,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,OAAO,MAAM,KAAK,IAAI,CAAC;AACzB,CAAC"}
|
|
@@ -5,8 +5,10 @@ import type { ComponentType } from 'react';
|
|
|
5
5
|
* @stability experimental
|
|
6
6
|
*/
|
|
7
7
|
export interface TuiScreenProps {
|
|
8
|
-
/**
|
|
8
|
+
/** Leave the screen: pops the navigation stack (back to the menu for a screen opened from it). */
|
|
9
9
|
onDone: () => void;
|
|
10
|
+
/** What the opener passed to `nav.push(route, params)`; `undefined` from the menu. */
|
|
11
|
+
params?: unknown;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* What a menu label may depend on.
|
|
@@ -50,7 +52,7 @@ export interface TuiScreenRegistration extends TuiScreenOrder {
|
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* The platform's own screens, in menu order: `login` 10, `invoke` 20,
|
|
53
|
-
* `status` 30, `node` 40, `deploy` 50, `logout` 60. An app screen picks an
|
|
55
|
+
* `status` 30, `jobs` 35, `node` 40, `deploy` 50, `logout` 60. An app screen picks an
|
|
54
56
|
* `order` relative to these. Their components are attached when the TUI
|
|
55
57
|
* starts; the ids and orders are here so a duplicate is caught without
|
|
56
58
|
* loading the UI.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-registry.d.ts","sourceRoot":"","sources":["../../../src/engine/tui/screen-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAqB3C;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,
|
|
1
|
+
{"version":3,"file":"screen-registry.d.ts","sourceRoot":"","sources":["../../../src/engine/tui/screen-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAqB3C;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,kGAAkG;IAClG,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,sFAAsF;IACtF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;IACd,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,wDAAwD;IACxD,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,cAAc,KAAK,MAAM,CAAC,CAAC;IACtD;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,GAAG,SAAS,CAAC;IACtD;;;OAGG;IACH,IAAI,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;CACnE;AAKD;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,cAAc,EAQvD,CAAC;AAOH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAyBrE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,SAAS,qBAAqB,EAAE,CAE3E;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAEnF;AAED,yDAAyD;AACzD,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,wCAAwC;AACxC,wBAAgB,8BAA8B,IAAI,IAAI,CAGrD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const RESERVED_ROUTES = ['menu', 'quit'];
|
|
3
3
|
/**
|
|
4
4
|
* The platform's own screens, in menu order: `login` 10, `invoke` 20,
|
|
5
|
-
* `status` 30, `node` 40, `deploy` 50, `logout` 60. An app screen picks an
|
|
5
|
+
* `status` 30, `jobs` 35, `node` 40, `deploy` 50, `logout` 60. An app screen picks an
|
|
6
6
|
* `order` relative to these. Their components are attached when the TUI
|
|
7
7
|
* starts; the ids and orders are here so a duplicate is caught without
|
|
8
8
|
* loading the UI.
|
|
@@ -13,6 +13,7 @@ export const BUILTIN_TUI_SCREENS = Object.freeze([
|
|
|
13
13
|
{ route: 'login', order: 10 },
|
|
14
14
|
{ route: 'invoke', order: 20 },
|
|
15
15
|
{ route: 'status', order: 30 },
|
|
16
|
+
{ route: 'jobs', order: 35 },
|
|
16
17
|
{ route: 'node', order: 40 },
|
|
17
18
|
{ route: 'deploy', order: 50 },
|
|
18
19
|
{ route: 'logout', order: 60 },
|