@fungi.computer/nacre 0.0.0-stage → 0.0.2

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 (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -2
  3. package/dist/app-directory.d.ts +600 -0
  4. package/dist/app-directory.js +323 -0
  5. package/dist/browser-actions.d.ts +7 -0
  6. package/dist/browser-actions.js +56 -0
  7. package/dist/command-host.d.ts +140 -0
  8. package/dist/command-host.js +532 -0
  9. package/dist/commands.d.ts +25 -0
  10. package/dist/commands.js +78 -0
  11. package/dist/index.d.ts +8 -0
  12. package/dist/index.js +9 -0
  13. package/dist/keys.d.ts +47 -0
  14. package/dist/keys.js +136 -0
  15. package/dist/shell-module.d.ts +98 -0
  16. package/dist/shell-module.js +90 -0
  17. package/dist/window-manager.d.ts +159 -0
  18. package/dist/window-manager.js +796 -0
  19. package/dist/workbench-contract.d.ts +70 -0
  20. package/dist/workbench-contract.js +1 -0
  21. package/dist/workbench-directory.d.ts +343 -0
  22. package/dist/workbench-directory.js +65 -0
  23. package/dist/workbench-host-types.d.ts +114 -0
  24. package/dist/workbench-host-types.js +1 -0
  25. package/dist/workbench-host.d.ts +34 -0
  26. package/dist/workbench-host.js +356 -0
  27. package/dist/workbench-model.d.ts +223 -0
  28. package/dist/workbench-model.js +93 -0
  29. package/dist/workbench.d.ts +4 -0
  30. package/dist/workbench.js +2 -0
  31. package/docs/api/README.md +21 -0
  32. package/docs/api/app-directory.md +587 -0
  33. package/docs/api/command-host.md +225 -0
  34. package/docs/api/commands.md +199 -0
  35. package/docs/api/index.md +1860 -0
  36. package/docs/api/keys.md +183 -0
  37. package/docs/api/shell-module.md +233 -0
  38. package/docs/api/window-manager.md +269 -0
  39. package/docs/api/workbench-directory.md +141 -0
  40. package/docs/api/workbench.md +201 -0
  41. package/package.json +98 -3
@@ -0,0 +1,183 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/nacre**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/nacre](README.md) / keys
8
+
9
+ # keys
10
+
11
+ ## Type Aliases
12
+
13
+ ### ShellChord
14
+
15
+ ```ts
16
+ type ShellChord = Readonly<{
17
+ key: string;
18
+ alt: boolean;
19
+ ctrl: boolean;
20
+ meta: boolean;
21
+ shift: boolean;
22
+ }>;
23
+ ```
24
+
25
+ One physical chord parsed from a Whistle binding such as `alt+left`.
26
+
27
+ ---
28
+
29
+ ### KeyEventFacts
30
+
31
+ ```ts
32
+ type KeyEventFacts = Pick<
33
+ KeyboardEvent,
34
+ "altKey" | "ctrlKey" | "key" | "metaKey" | "shiftKey"
35
+ >;
36
+ ```
37
+
38
+ Keyboard facts shared by DOM events and terminal adapters.
39
+
40
+ ---
41
+
42
+ ### LeaderKey
43
+
44
+ ```ts
45
+ type LeaderKey = WhistleBindingProjection &
46
+ Readonly<{
47
+ key: string;
48
+ }>;
49
+ ```
50
+
51
+ One key offered after the leader chord, with the command it runs.
52
+
53
+ ---
54
+
55
+ ### ShellKeyHost
56
+
57
+ ```ts
58
+ type ShellKeyHost = Readonly<{
59
+ active: () => WhistleSnapshot;
60
+ subscribe: (listener) => () => void;
61
+ execute: (commandId, input) => Promise<WhistleExecutionOutcome>;
62
+ }>;
63
+ ```
64
+
65
+ The shell host operations the key dispatcher reads.
66
+
67
+ ## Functions
68
+
69
+ ### parseChord()
70
+
71
+ ```ts
72
+ function parseChord(
73
+ binding,
74
+ mac,
75
+ ): Readonly<{
76
+ key: string;
77
+ alt: boolean;
78
+ ctrl: boolean;
79
+ meta: boolean;
80
+ shift: boolean;
81
+ }> | null;
82
+ ```
83
+
84
+ Parse one single-chord binding. Sequences (including `<leader>x`) and unknown
85
+ modifiers return `null`; they are never matched as one chord.
86
+
87
+ #### Parameters
88
+
89
+ | Parameter | Type |
90
+ | --------- | --------- |
91
+ | `binding` | `string` |
92
+ | `mac` | `boolean` |
93
+
94
+ #### Returns
95
+
96
+ \| `Readonly`\<\{ `key`: `string`; `alt`: `boolean`; `ctrl`: `boolean`; `meta`:
97
+ `boolean`; `shift`: `boolean`; \}\> \| `null`
98
+
99
+ ---
100
+
101
+ ### chordMatches()
102
+
103
+ ```ts
104
+ function chordMatches(event, chord): boolean;
105
+ ```
106
+
107
+ Whether one key event is exactly this chord.
108
+
109
+ #### Parameters
110
+
111
+ | Parameter | Type |
112
+ | --------- | --------------------------------- |
113
+ | `event` | [`KeyEventFacts`](#keyeventfacts) |
114
+ | `chord` | [`ShellChord`](#shellchord) |
115
+
116
+ #### Returns
117
+
118
+ `boolean`
119
+
120
+ ---
121
+
122
+ ### leaderKeys()
123
+
124
+ ```ts
125
+ function leaderKeys(active): readonly LeaderKey[];
126
+ ```
127
+
128
+ The single-keystroke `<leader>x` rows, first binding per key.
129
+
130
+ #### Parameters
131
+
132
+ | Parameter | Type |
133
+ | --------- | ----------------- |
134
+ | `active` | `WhistleSnapshot` |
135
+
136
+ #### Returns
137
+
138
+ readonly [`LeaderKey`](#leaderkey)[]
139
+
140
+ ---
141
+
142
+ ### leaderKeyMatches()
143
+
144
+ ```ts
145
+ function leaderKeyMatches(event, key): boolean;
146
+ ```
147
+
148
+ Whether one key event (after the leader) selects this leader key.
149
+
150
+ #### Parameters
151
+
152
+ | Parameter | Type |
153
+ | --------- | ------------------------------------------------------------------------------ |
154
+ | `event` | `Pick`\<`KeyboardEvent`, `"altKey"` \| `"ctrlKey"` \| `"key"` \| `"metaKey"`\> |
155
+ | `key` | `string` |
156
+
157
+ #### Returns
158
+
159
+ `boolean`
160
+
161
+ ---
162
+
163
+ ### installShellKeys()
164
+
165
+ ```ts
166
+ function installShellKeys(root, host, mac): () => void;
167
+ ```
168
+
169
+ Dispatch the active view's single-chord bindings from the shell document. Text
170
+ entry is a mode: while an input is focused only Ctrl/Cmd chords fire, so
171
+ Alt-arrows keep their word-navigation meaning.
172
+
173
+ #### Parameters
174
+
175
+ | Parameter | Type |
176
+ | --------- | ------------------------------- |
177
+ | `root` | `HTMLElement` |
178
+ | `host` | [`ShellKeyHost`](#shellkeyhost) |
179
+ | `mac` | `boolean` |
180
+
181
+ #### Returns
182
+
183
+ () => `void`
@@ -0,0 +1,233 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/nacre**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/nacre](README.md) / shell-module
8
+
9
+ # shell-module
10
+
11
+ ## Classes
12
+
13
+ ### ShellModuleError
14
+
15
+ The picked shell's module could not be loaded or does not fit the contract.
16
+
17
+ #### Extends
18
+
19
+ - `Error`
20
+
21
+ #### Constructors
22
+
23
+ ##### Constructor
24
+
25
+ ```ts
26
+ new ShellModuleError(message?): ShellModuleError;
27
+ ```
28
+
29
+ ###### Parameters
30
+
31
+ | Parameter | Type |
32
+ | ---------- | -------- |
33
+ | `message?` | `string` |
34
+
35
+ ###### Returns
36
+
37
+ [`ShellModuleError`](#shellmoduleerror)
38
+
39
+ ###### Inherited from
40
+
41
+ ```ts
42
+ Error.constructor;
43
+ ```
44
+
45
+ ##### Constructor
46
+
47
+ ```ts
48
+ new ShellModuleError(message?, options?): ShellModuleError;
49
+ ```
50
+
51
+ ###### Parameters
52
+
53
+ | Parameter | Type |
54
+ | ---------- | -------------- |
55
+ | `message?` | `string` |
56
+ | `options?` | `ErrorOptions` |
57
+
58
+ ###### Returns
59
+
60
+ [`ShellModuleError`](#shellmoduleerror)
61
+
62
+ ###### Inherited from
63
+
64
+ ```ts
65
+ Error.constructor;
66
+ ```
67
+
68
+ #### Properties
69
+
70
+ ##### name
71
+
72
+ ```ts
73
+ readonly name: "ShellModuleError" = "ShellModuleError";
74
+ ```
75
+
76
+ Always ShellModuleError.
77
+
78
+ ###### Overrides
79
+
80
+ ```ts
81
+ Error.name;
82
+ ```
83
+
84
+ ## Type Aliases
85
+
86
+ ### ShellMountInput
87
+
88
+ ```ts
89
+ type ShellMountInput = Readonly<{
90
+ workbench: TeamWorkbenchHostHandle;
91
+ storage: AppStorage;
92
+ methods: Readonly<{
93
+ call: Promise<WhistleJsonValue>;
94
+ }>;
95
+ }>;
96
+ ```
97
+
98
+ What a host hands the shell a Team picked. The host composes that shell into its
99
+ own top-level document, so it runs with the host's escalated permissions: the
100
+ workbench mounts each child App in its sandboxed frame, and `storage`/`methods`
101
+ are the shell installation's own desktop data.
102
+
103
+ ---
104
+
105
+ ### MountShell
106
+
107
+ ```ts
108
+ type MountShell = (root, input) => Promise<() => void>;
109
+ ```
110
+
111
+ Render the shell into `root`; resolves once it is mounted, with the function
112
+ that removes it again. The shell loads its own code and styles.
113
+
114
+ #### Parameters
115
+
116
+ | Parameter | Type |
117
+ | --------- | ------------------------------------- |
118
+ | `root` | `HTMLElement` |
119
+ | `input` | [`ShellMountInput`](#shellmountinput) |
120
+
121
+ #### Returns
122
+
123
+ `Promise`\<() => `void`\>
124
+
125
+ ---
126
+
127
+ ### ShellPlatformControls
128
+
129
+ ```ts
130
+ type ShellPlatformControls = Readonly<{
131
+ controls: WorkbenchHostControls;
132
+ suggestDesktopSettings: void;
133
+ dispose: void;
134
+ }>;
135
+ ```
136
+
137
+ Settings a shell renders for a host that has none of its own, such as a
138
+ standalone Oyster: the shell draws them into `root`, and the host hands
139
+ `controls` to its workbench so Apps and the dashboard can open them.
140
+
141
+ ---
142
+
143
+ ### RequestShellAppAccess
144
+
145
+ ```ts
146
+ type RequestShellAppAccess = (
147
+ target,
148
+ request,
149
+ dialog,
150
+ ) => Promise<AppPermissionOutcome>;
151
+ ```
152
+
153
+ A host's App-access flow. The host owns admission, current grants and saving;
154
+ the shell renders the prompt and navigates its own Settings.
155
+
156
+ #### Parameters
157
+
158
+ | Parameter | Type |
159
+ | --------- | -------------------------------------------------------------------------------------------------------- |
160
+ | `target` | `Parameters`\<[`WorkbenchHostControls`](index.md#workbenchhostcontrols)\[`"requestAppAccess"`\]\>\[`0`\] |
161
+ | `request` | `AppPermissionRequest` |
162
+ | `dialog` | `Readonly`\<\{ `ask`: `Promise`\<`AppPermissionOutcome`\>; `customize`: `"customize"`; \}\> |
163
+
164
+ #### Returns
165
+
166
+ `Promise`\<`AppPermissionOutcome`\>
167
+
168
+ ---
169
+
170
+ ### MountPlatformControls
171
+
172
+ ```ts
173
+ type MountPlatformControls = (root, input) => Promise<ShellPlatformControls>;
174
+ ```
175
+
176
+ Render the shell's own Settings using the embedding host's access authority.
177
+
178
+ #### Parameters
179
+
180
+ | Parameter | Type |
181
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
182
+ | `root` | `HTMLElement` |
183
+ | `input` | `Readonly`\<\{ `teamId`: `string`; `keysWire`: `Pick`\<`KeyWire`\<`string`\>, `"issue"` \| `"revoke"` \| `"summary"`\>; `requestAppAccess`: [`RequestShellAppAccess`](#requestshellappaccess); \}\> |
184
+
185
+ #### Returns
186
+
187
+ `Promise`\<[`ShellPlatformControls`](#shellplatformcontrols)\>
188
+
189
+ ---
190
+
191
+ ### ShellModule
192
+
193
+ ```ts
194
+ type ShellModule = Readonly<{
195
+ mountShell: MountShell;
196
+ mountPlatformControls: MountPlatformControls | null;
197
+ }>;
198
+ ```
199
+
200
+ What a host gets from a picked shell Release's module.
201
+
202
+ ## Functions
203
+
204
+ ### importShellModule()
205
+
206
+ ```ts
207
+ function importShellModule(
208
+ moduleUrl,
209
+ hostOrigin,
210
+ ): Promise<
211
+ Readonly<{
212
+ mountShell: MountShell;
213
+ mountPlatformControls: MountPlatformControls | null;
214
+ }>
215
+ >;
216
+ ```
217
+
218
+ Import the picked shell Release's module from the host's own origin and check
219
+ that it exports `mountShell`, and `mountPlatformControls` when it offers its own
220
+ Settings. The host never bundles a shell.
221
+
222
+ #### Parameters
223
+
224
+ | Parameter | Type |
225
+ | ------------ | -------- |
226
+ | `moduleUrl` | `URL` |
227
+ | `hostOrigin` | `string` |
228
+
229
+ #### Returns
230
+
231
+ `Promise`\<`Readonly`\<\{ `mountShell`: [`MountShell`](#mountshell);
232
+ `mountPlatformControls`: [`MountPlatformControls`](#mountplatformcontrols) \|
233
+ `null`; \}\>\>
@@ -0,0 +1,269 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/nacre**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/nacre](README.md) / window-manager
8
+
9
+ # window-manager
10
+
11
+ ## Type Aliases
12
+
13
+ ### WindowLaunch
14
+
15
+ ```ts
16
+ type WindowLaunch = Readonly<{
17
+ windowId: string;
18
+ }>;
19
+ ```
20
+
21
+ Minimum identity required to own a window across mount generations.
22
+
23
+ ---
24
+
25
+ ### WindowStatus
26
+
27
+ ```ts
28
+ type WindowStatus = "loading" | "ready" | "minimized" | "error";
29
+ ```
30
+
31
+ Current presentation state of a managed window.
32
+
33
+ ---
34
+
35
+ ### WindowHost
36
+
37
+ ```ts
38
+ type WindowHost<Launch> = Readonly<{
39
+ setVisibility: (visibility) => void | Promise<void>;
40
+ reconfigure: (launch, signal?) => void | Promise<void>;
41
+ requestClose?: () => boolean | Promise<boolean>;
42
+ requestBack?: () => boolean | Promise<boolean>;
43
+ activateNavigation?: (activation) => boolean | Promise<boolean>;
44
+ activateStatus?: (action) => boolean | Promise<boolean>;
45
+ dispose: () => void | Promise<void>;
46
+ }>;
47
+ ```
48
+
49
+ Mount operations supplied by the embedding host; selection and authority stay
50
+ with it.
51
+
52
+ #### Type Parameters
53
+
54
+ | Type Parameter |
55
+ | -------------------------------------------------- |
56
+ | `Launch` _extends_ [`WindowLaunch`](#windowlaunch) |
57
+
58
+ ---
59
+
60
+ ### WindowEvents
61
+
62
+ ```ts
63
+ type WindowEvents = Readonly<{
64
+ onComputerChoice: () => Promise<void>;
65
+ onNavigationState: (state) => void;
66
+ onStatusItems: (items) => void;
67
+ }>;
68
+ ```
69
+
70
+ What a mounted App tells its window while it lives.
71
+
72
+ ---
73
+
74
+ ### WindowProjection
75
+
76
+ ```ts
77
+ type WindowProjection<Launch, Container> = Readonly<{
78
+ windowId: string;
79
+ launch: Launch;
80
+ container: Container;
81
+ status: WindowStatus;
82
+ generation: number;
83
+ error?: unknown;
84
+ cleanupError?: unknown;
85
+ navigation: AppNavigationState | null;
86
+ statusItems: readonly AppStatusItem[];
87
+ }>;
88
+ ```
89
+
90
+ Immutable snapshot of one window and its mount generation.
91
+
92
+ #### Type Parameters
93
+
94
+ | Type Parameter |
95
+ | -------------------------------------------------- |
96
+ | `Launch` _extends_ [`WindowLaunch`](#windowlaunch) |
97
+ | `Container` |
98
+
99
+ ---
100
+
101
+ ### WindowsProjection
102
+
103
+ ```ts
104
+ type WindowsProjection<Launch, Container> = Readonly<{
105
+ windows: readonly WindowProjection<Launch, Container>[];
106
+ }>;
107
+ ```
108
+
109
+ Current ordered collection of managed window snapshots.
110
+
111
+ #### Type Parameters
112
+
113
+ | Type Parameter |
114
+ | -------------------------------------------------- |
115
+ | `Launch` _extends_ [`WindowLaunch`](#windowlaunch) |
116
+ | `Container` |
117
+
118
+ ---
119
+
120
+ ### WindowMount
121
+
122
+ ```ts
123
+ type WindowMount<Launch, Container> = (
124
+ container,
125
+ launch,
126
+ signal,
127
+ events,
128
+ ) => WindowHost<Launch> | Promise<WindowHost<Launch>>;
129
+ ```
130
+
131
+ Create a host-owned mount in a container, observing cancellation and navigation.
132
+
133
+ #### Type Parameters
134
+
135
+ | Type Parameter |
136
+ | -------------------------------------------------- |
137
+ | `Launch` _extends_ [`WindowLaunch`](#windowlaunch) |
138
+ | `Container` |
139
+
140
+ #### Parameters
141
+
142
+ | Parameter | Type |
143
+ | ----------- | ------------------------------- |
144
+ | `container` | `Container` |
145
+ | `launch` | `Launch` |
146
+ | `signal` | `AbortSignal` |
147
+ | `events` | [`WindowEvents`](#windowevents) |
148
+
149
+ #### Returns
150
+
151
+ \| [`WindowHost`](#windowhost)\<`Launch`\> \|
152
+ `Promise`\<[`WindowHost`](#windowhost)\<`Launch`\>\>
153
+
154
+ ---
155
+
156
+ ### WindowManager
157
+
158
+ ```ts
159
+ type WindowManager<Launch, Container> = Readonly<{
160
+ open: (launch) => Promise<void>;
161
+ attach: (windowId) => void;
162
+ minimize: (windowId) => Promise<void>;
163
+ restore: (windowId) => Promise<void>;
164
+ hideAll: () => Promise<void>;
165
+ restoreHidden: () => Promise<void>;
166
+ close: (windowId) => Promise<void>;
167
+ reconfigure: (windowId, launch) => Promise<void>;
168
+ update: (windowId, derive) => Promise<void>;
169
+ replace: (windowId, launch) => Promise<void>;
170
+ back: (windowId) => Promise<boolean>;
171
+ activateNavigation: (windowId, activation) => Promise<boolean>;
172
+ activateStatus: (windowId, action) => Promise<boolean>;
173
+ registerComputerChoice: (windowId, handler) => () => void;
174
+ dispose: () => Promise<void>;
175
+ read: () => WindowsProjection<Launch, Container>;
176
+ subscribe: (listener) => () => void;
177
+ }>;
178
+ ```
179
+
180
+ Own window lifetimes, visibility and serialized host mutations.
181
+
182
+ #### Type Parameters
183
+
184
+ | Type Parameter |
185
+ | -------------------------------------------------- |
186
+ | `Launch` _extends_ [`WindowLaunch`](#windowlaunch) |
187
+ | `Container` |
188
+
189
+ ---
190
+
191
+ ### WindowManagerOptions
192
+
193
+ ```ts
194
+ type WindowManagerOptions<Launch, Container> = Readonly<{
195
+ mount: WindowMount<Launch, Container>;
196
+ createContainer: (launch) => Container;
197
+ waitForAttachment?: boolean;
198
+ onFailure?: (failure) => void;
199
+ isAttached?: (container) => boolean;
200
+ validateReconfiguration?: (current, next) => void;
201
+ isChromeOnlyChange?: (current, next) => boolean;
202
+ }>;
203
+ ```
204
+
205
+ Host adapters used to create, attach and validate window mounts.
206
+
207
+ #### Type Parameters
208
+
209
+ | Type Parameter |
210
+ | -------------------------------------------------- |
211
+ | `Launch` _extends_ [`WindowLaunch`](#windowlaunch) |
212
+ | `Container` |
213
+
214
+ ## Functions
215
+
216
+ ### hasVisibleWindows()
217
+
218
+ ```ts
219
+ function hasVisibleWindows<Launch, Container>(projection): boolean;
220
+ ```
221
+
222
+ Whether any projected App window is still visible in the workspace.
223
+
224
+ #### Type Parameters
225
+
226
+ | Type Parameter |
227
+ | ------------------------------------------------------------ |
228
+ | `Launch` _extends_ `Readonly`\<\{ `windowId`: `string`; \}\> |
229
+ | `Container` |
230
+
231
+ #### Parameters
232
+
233
+ | Parameter | Type |
234
+ | ------------ | ------------------------------------------------------------------ |
235
+ | `projection` | [`WindowsProjection`](#windowsprojection)\<`Launch`, `Container`\> |
236
+
237
+ #### Returns
238
+
239
+ `boolean`
240
+
241
+ ---
242
+
243
+ ### createWindowManager()
244
+
245
+ ```ts
246
+ function createWindowManager<Launch, Container>(
247
+ options,
248
+ ): WindowManager<Launch, Container>;
249
+ ```
250
+
251
+ Owns App-window generations while leaving selection and App authority to the
252
+ caller. A stale mount is always disposed when it eventually resolves.
253
+
254
+ #### Type Parameters
255
+
256
+ | Type Parameter |
257
+ | ------------------------------------------------------------ |
258
+ | `Launch` _extends_ `Readonly`\<\{ `windowId`: `string`; \}\> |
259
+ | `Container` |
260
+
261
+ #### Parameters
262
+
263
+ | Parameter | Type |
264
+ | --------- | ------------------------------------------------------------------------ |
265
+ | `options` | [`WindowManagerOptions`](#windowmanageroptions)\<`Launch`, `Container`\> |
266
+
267
+ #### Returns
268
+
269
+ [`WindowManager`](#windowmanager)\<`Launch`, `Container`\>