@bigpixelrocket/uiok 0.2.2 → 0.3.0

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 (158) hide show
  1. package/CHANGELOG.md +62 -1
  2. package/dist/button/TextLink.d.ts +27 -0
  3. package/dist/button/TextLink.js +15 -0
  4. package/dist/button/button.css +48 -0
  5. package/dist/button/index.d.ts +2 -1
  6. package/dist/button/index.js +2 -1
  7. package/dist/charts/Sparkline.d.ts +20 -0
  8. package/dist/charts/Sparkline.js +12 -0
  9. package/dist/charts/Sparkline.logic.d.ts +9 -0
  10. package/dist/charts/Sparkline.logic.js +27 -0
  11. package/dist/charts/charts.css +17 -0
  12. package/dist/charts/index.d.ts +2 -0
  13. package/dist/charts/index.js +2 -0
  14. package/dist/dialog/ConfirmDialog.d.ts +17 -1
  15. package/dist/dialog/ConfirmDialog.js +10 -4
  16. package/dist/dialog/DialogLists.d.ts +8 -1
  17. package/dist/dialog/DialogLists.js +3 -2
  18. package/dist/dialog/ModalDialog.d.ts +8 -0
  19. package/dist/dialog/ModalDialog.js +4 -2
  20. package/dist/dialog/ProgressDialog.d.ts +34 -0
  21. package/dist/dialog/ProgressDialog.js +40 -0
  22. package/dist/dialog/TypedNameDialog.d.ts +36 -0
  23. package/dist/dialog/TypedNameDialog.js +17 -0
  24. package/dist/dialog/index.d.ts +5 -2
  25. package/dist/dialog/index.js +4 -1
  26. package/dist/field/Switch.d.ts +26 -0
  27. package/dist/field/Switch.js +20 -0
  28. package/dist/field/field.css +110 -2
  29. package/dist/field/index.d.ts +3 -2
  30. package/dist/field/index.js +3 -2
  31. package/dist/filter/filter.css +16 -0
  32. package/dist/frame/AppRoot.d.ts +44 -0
  33. package/dist/frame/AppRoot.js +26 -0
  34. package/dist/frame/Dock.d.ts +88 -0
  35. package/dist/frame/Dock.js +129 -0
  36. package/dist/frame/FilterChips.d.ts +28 -0
  37. package/dist/frame/FilterChips.js +14 -0
  38. package/dist/frame/PageParts.d.ts +69 -0
  39. package/dist/frame/PageParts.js +60 -0
  40. package/dist/frame/PaneSplit.d.ts +74 -0
  41. package/dist/frame/PaneSplit.js +197 -0
  42. package/dist/frame/SidebarResizer.d.ts +35 -0
  43. package/dist/frame/SidebarResizer.js +43 -0
  44. package/dist/frame/StatusNotice.d.ts +20 -0
  45. package/dist/frame/StatusNotice.js +13 -0
  46. package/dist/frame/Tree.d.ts +140 -0
  47. package/dist/frame/Tree.js +141 -0
  48. package/dist/frame/TreeToggle.d.ts +18 -0
  49. package/dist/frame/TreeToggle.js +17 -0
  50. package/dist/frame/WindowFrame.d.ts +57 -0
  51. package/dist/frame/WindowFrame.js +19 -0
  52. package/dist/frame/frame.css +801 -0
  53. package/dist/frame/index.d.ts +22 -0
  54. package/dist/frame/index.js +22 -0
  55. package/dist/frame/sharedRef.d.ts +8 -0
  56. package/dist/frame/sharedRef.js +26 -0
  57. package/dist/grid/DataGrid.d.ts +10 -2
  58. package/dist/grid/DataGrid.js +47 -13
  59. package/dist/grid/DataGrid.logic.d.ts +16 -0
  60. package/dist/grid/DataGrid.logic.js +28 -0
  61. package/dist/grid/grid.css +128 -4
  62. package/dist/index.d.ts +4 -0
  63. package/dist/index.js +4 -0
  64. package/dist/labels/UiokLabels.d.ts +6 -0
  65. package/dist/labels/UiokLabels.js +5 -1
  66. package/dist/labels/dialog.d.ts +12 -0
  67. package/dist/labels/dialog.js +7 -1
  68. package/dist/labels/index.d.ts +2 -0
  69. package/dist/labels/index.js +2 -0
  70. package/dist/labels/keys.js +2 -0
  71. package/dist/labels/paneTabs.d.ts +27 -0
  72. package/dist/labels/paneTabs.js +10 -0
  73. package/dist/labels/selectAll.d.ts +4 -1
  74. package/dist/labels/selectAll.js +1 -1
  75. package/dist/labels/settings.d.ts +46 -0
  76. package/dist/labels/settings.js +29 -0
  77. package/dist/legend/KeyLegendStrip.d.ts +9 -1
  78. package/dist/legend/KeyLegendStrip.js +119 -5
  79. package/dist/legend/legend.css +52 -0
  80. package/dist/listing/EmptyState.d.ts +40 -0
  81. package/dist/listing/EmptyState.js +14 -0
  82. package/dist/listing/Listing.d.ts +23 -5
  83. package/dist/listing/Listing.js +11 -8
  84. package/dist/listing/index.d.ts +3 -1
  85. package/dist/listing/index.js +3 -1
  86. package/dist/listing/listing.css +172 -5
  87. package/dist/log/LogWell.d.ts +34 -0
  88. package/dist/log/LogWell.js +39 -0
  89. package/dist/log/LogWell.logic.d.ts +16 -0
  90. package/dist/log/LogWell.logic.js +26 -0
  91. package/dist/log/index.d.ts +8 -0
  92. package/dist/log/index.js +8 -0
  93. package/dist/log/log.css +57 -0
  94. package/dist/pane/Pane.d.ts +49 -0
  95. package/dist/pane/Pane.js +17 -0
  96. package/dist/pane/PaneActions.d.ts +3 -1
  97. package/dist/pane/PaneActions.js +6 -5
  98. package/dist/pane/PaneKeys.d.ts +10 -3
  99. package/dist/pane/PaneKeys.js +26 -7
  100. package/dist/pane/PaneTabs.d.ts +92 -0
  101. package/dist/pane/PaneTabs.js +326 -0
  102. package/dist/pane/PaneTabs.logic.d.ts +97 -0
  103. package/dist/pane/PaneTabs.logic.js +158 -0
  104. package/dist/pane/index.d.ts +7 -1
  105. package/dist/pane/index.js +7 -1
  106. package/dist/pane/panetabs.css +408 -0
  107. package/dist/pane/usePaneKeys.js +9 -11
  108. package/dist/pane/useTabDrag.d.ts +49 -0
  109. package/dist/pane/useTabDrag.js +306 -0
  110. package/dist/segmented/SegmentedChoice.d.ts +8 -1
  111. package/dist/segmented/SegmentedChoice.js +7 -4
  112. package/dist/shell/AboutWindow.d.ts +21 -0
  113. package/dist/shell/AboutWindow.js +10 -0
  114. package/dist/shell/LanguageChoice.d.ts +27 -0
  115. package/dist/shell/LanguageChoice.js +17 -0
  116. package/dist/shell/LoadFailure.d.ts +22 -0
  117. package/dist/shell/LoadFailure.js +15 -0
  118. package/dist/shell/Lockup.d.ts +52 -0
  119. package/dist/shell/Lockup.js +30 -0
  120. package/dist/shell/SettingsDialog.d.ts +97 -0
  121. package/dist/shell/SettingsDialog.js +219 -0
  122. package/dist/shell/SettingsDialog.logic.d.ts +33 -0
  123. package/dist/shell/SettingsDialog.logic.js +42 -0
  124. package/dist/shell/SettingsFiles.d.ts +55 -0
  125. package/dist/shell/SettingsFiles.js +30 -0
  126. package/dist/shell/SettingsPageKeys.d.ts +42 -0
  127. package/dist/shell/SettingsPageKeys.js +70 -0
  128. package/dist/shell/SettingsSubsection.d.ts +34 -0
  129. package/dist/shell/SettingsSubsection.js +30 -0
  130. package/dist/shell/SignIn.d.ts +61 -0
  131. package/dist/shell/SignIn.js +36 -0
  132. package/dist/shell/ThemePicker.d.ts +74 -0
  133. package/dist/shell/ThemePicker.js +96 -0
  134. package/dist/shell/ThemePicker.logic.d.ts +13 -0
  135. package/dist/shell/ThemePicker.logic.js +26 -0
  136. package/dist/shell/TitleBar.d.ts +44 -0
  137. package/dist/shell/TitleBar.js +23 -0
  138. package/dist/shell/UpdatePill.d.ts +26 -0
  139. package/dist/shell/UpdatePill.js +17 -0
  140. package/dist/shell/Updates.d.ts +99 -0
  141. package/dist/shell/Updates.js +72 -0
  142. package/dist/shell/index.d.ts +27 -0
  143. package/dist/shell/index.js +27 -0
  144. package/dist/shell/shell.css +243 -4
  145. package/dist/styles.css +10 -0
  146. package/dist/surface/GroupSwatch.d.ts +22 -0
  147. package/dist/surface/GroupSwatch.js +15 -0
  148. package/dist/surface/Tag.d.ts +26 -0
  149. package/dist/surface/Tag.js +12 -0
  150. package/dist/surface/index.d.ts +7 -0
  151. package/dist/surface/index.js +7 -0
  152. package/dist/surface/surface.css +116 -1
  153. package/dist/themes/catalog.js +4 -0
  154. package/dist/themes/themes.generated.css +244 -0
  155. package/dist/themes/tokens.d.ts +17 -5
  156. package/dist/themes/tokens.js +75 -1
  157. package/dist/tokens.css +11 -0
  158. package/package.json +1 -1
@@ -3,11 +3,14 @@
3
3
  * the rules for which slot a key runs, the one `ConfirmDialog`, the compact
4
4
  * lists a confirmation's body holds (`DialogItems` for what it acts on,
5
5
  * `DialogStatements` for the statements it runs, `DialogFacts` for facts
6
- * about the action), and the
6
+ * about the action), the `ProgressDialog` of long work, the
7
+ * `TypedNameDialog` for work a slip would cost most, and the
7
8
  * `DialogLayer` a host mounts them into.
8
9
  */
9
10
  export { ConfirmDialog } from './ConfirmDialog.js';
10
11
  export { DialogLayer } from './DialogLayer.js';
12
+ export { ProgressDialog } from './ProgressDialog.js';
13
+ export { TypedNameDialog } from './TypedNameDialog.js';
11
14
  export { DIALOG_ITEMS_SHOWN, DialogFacts, DialogItems, DialogStatements, shownItems } from './DialogLists.js';
12
15
  export { DialogLegend } from './DialogLegend.js';
13
16
  export { filterLeaveLabel, legendKeyAction, legendSignature } from './DialogLegend.logic.js';
@@ -0,0 +1,26 @@
1
+ import type { ReactElement } from 'react';
2
+ import { type ControlVerb } from '../pane/PaneActions.js';
3
+ /** Props for {@link Switch}. */
4
+ export interface SwitchProps {
5
+ /** Whether the thing it stands for is on. */
6
+ readonly checked: boolean;
7
+ /** Hears the state a press asks for. */
8
+ readonly onChange: (checked: boolean) => void;
9
+ /** Its words ("Sharing"), beside it, or its accessible name alone with `labelHidden`. */
10
+ readonly label: string;
11
+ /** Speaks the label without drawing it: a switch in a row whose name says what it turns on. */
12
+ readonly labelHidden?: boolean;
13
+ readonly disabled?: boolean;
14
+ /** The verb the row's keys run it for (`data-verb`), as a row's other controls carry. */
15
+ readonly verb?: ControlVerb;
16
+ }
17
+ /**
18
+ * A switch for a running thing turned on or off at once (a service,
19
+ * sharing), in the shared `.switch` look on a native checkbox with
20
+ * `role="switch"`; a setting is a check, not a switch. With its label drawn
21
+ * it stands in a `field-choice` label, the whole label its target. In a
22
+ * listing row it leaves the Tab order, as a row's other controls do, since
23
+ * the cursor row's keys run it, and a press toggles it without opening the
24
+ * row.
25
+ */
26
+ export declare function Switch({ checked, onChange, label, labelHidden, disabled, verb }: SwitchProps): ReactElement;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useInRow } from '../pane/PaneActions.js';
3
+ /** A press on the switch or its words toggles it alone, never also opening the row it stands in. */
4
+ const keepToSelf = (event) => event.stopPropagation();
5
+ /**
6
+ * A switch for a running thing turned on or off at once (a service,
7
+ * sharing), in the shared `.switch` look on a native checkbox with
8
+ * `role="switch"`; a setting is a check, not a switch. With its label drawn
9
+ * it stands in a `field-choice` label, the whole label its target. In a
10
+ * listing row it leaves the Tab order, as a row's other controls do, since
11
+ * the cursor row's keys run it, and a press toggles it without opening the
12
+ * row.
13
+ */
14
+ export function Switch({ checked, onChange, label, labelHidden = false, disabled = false, verb }) {
15
+ const inRow = useInRow();
16
+ const control = (_jsx("input", { "aria-label": labelHidden ? label : undefined, checked: checked, className: "switch", "data-verb": verb, disabled: disabled, onChange: (event) => onChange(event.currentTarget.checked), onClick: keepToSelf, role: "switch", tabIndex: inRow ? -1 : undefined, type: "checkbox" }));
17
+ if (labelHidden)
18
+ return control;
19
+ return (_jsxs("label", { className: "field-choice", onClick: keepToSelf, children: [control, label] }));
20
+ }
@@ -18,6 +18,9 @@
18
18
  focus edge.
19
19
  - .switch on a checkbox with role="switch": a pill track and its knob.
20
20
  - .range on an input of type range: a thin trough, its filled part, a knob.
21
+ - .field-editor on a container: the field's well round an editor the
22
+ page brings (a code editor), with its hover, focus edge, invalid,
23
+ read-only, and changed looks.
21
24
  - .field-label, .field-note, .field-problem: the words around a field,
22
25
  in the interface face; .field-group stacks them, .field-choice puts a
23
26
  check or switch beside its words, .field-grid lays label and value
@@ -164,14 +167,16 @@
164
167
  inset 0 1px 0 var(--well-shade);
165
168
  }
166
169
 
167
- .field[data-tone] {
170
+ .field[data-tone],
171
+ .field-editor[data-tone] {
168
172
  --field-tone-bar: var(--line-strong);
169
173
  }
170
174
 
171
175
  /* Right to left the bar stands on the right, the leading edge. The rule
172
176
  reads the dir attribute, as the listing's do: bundlers' CSS minifiers
173
177
  rewrite the direction pseudo-class into a list of languages. */
174
- .field[data-tone]:where([dir='rtl'] *, [dir='rtl']) {
178
+ .field[data-tone]:where([dir='rtl'] *, [dir='rtl']),
179
+ .field-editor[data-tone]:where([dir='rtl'] *, [dir='rtl']) {
175
180
  --field-tone-bar: calc(-1 * var(--line-strong));
176
181
  }
177
182
 
@@ -286,6 +291,96 @@ select.field option {
286
291
  color: var(--text);
287
292
  }
288
293
 
294
+ /* A list box's chosen rows, which the rule above would paint away: the
295
+ selection's colours while the list holds the keys, the quiet fill when
296
+ it does not (as a listing's selection goes quiet), and the fill with
297
+ quiet words when the list is off. A gradient, since a browser keeps its
298
+ own colour for a chosen option's background-color. */
299
+ select.field:is([multiple], [size]:not([size='1'])) option:checked {
300
+ background: linear-gradient(var(--selected-bg), var(--selected-bg));
301
+ color: var(--on-selected);
302
+ }
303
+
304
+ select.field:is([multiple], [size]:not([size='1'])):not(:focus) option:checked {
305
+ background: linear-gradient(var(--fill), var(--fill));
306
+ color: var(--text);
307
+ }
308
+
309
+ select.field:is([multiple], [size]:not([size='1'])):disabled option:checked {
310
+ background: linear-gradient(var(--fill), var(--fill));
311
+ color: var(--text-on-surface);
312
+ }
313
+
314
+ /* A field that holds no value (SQL NULL): its placeholder in the missing
315
+ value's look, dim italic, as a grid's NULL cell. */
316
+ .field.value-null::placeholder {
317
+ color: var(--text-dim);
318
+ font-style: italic;
319
+ }
320
+
321
+ /* -- A field's frame round an editor -- */
322
+
323
+ /* An editor the page brings (a code editor) that stands in a form as a
324
+ field does takes the field's well on its container: the outline,
325
+ corners, ground, and well shade, the hover lift, the accent focus edge
326
+ while anything inside holds the keys, the danger outline when invalid,
327
+ and the accent outline and bar of a changed value (data-tone="accent").
328
+ Read-only (.read-only) recesses the ground and draws no focus edge: the
329
+ value is there to read and copy. The editor fills the frame, which
330
+ clips it to the corners. */
331
+ .field-editor {
332
+ box-sizing: border-box;
333
+ min-width: 0;
334
+ overflow: hidden;
335
+ border: var(--line) solid var(--control-border);
336
+ border-radius: var(--radius-md);
337
+ box-shadow: inset 0 1px 0 var(--well-shade);
338
+ background: var(--ground);
339
+ color: var(--text);
340
+ transition:
341
+ border-color var(--duration-fast),
342
+ outline-color var(--duration-fast);
343
+ }
344
+
345
+ .field-editor:hover:not(
346
+ :focus-within,
347
+ [aria-invalid='true'],
348
+ [data-tone],
349
+ .read-only,
350
+ [aria-disabled='true']
351
+ ) {
352
+ border-color: var(--text);
353
+ }
354
+
355
+ .field-editor:focus-within {
356
+ border-color: var(--accent);
357
+ outline: var(--line) solid var(--accent);
358
+ outline-offset: var(--focus-offset-flush);
359
+ }
360
+
361
+ .field-editor[aria-invalid='true'] {
362
+ border-color: var(--danger);
363
+ }
364
+
365
+ .field-editor[aria-invalid='true']:focus-within {
366
+ outline-color: var(--danger);
367
+ }
368
+
369
+ .field-editor[data-tone='accent']:not([aria-invalid='true']) {
370
+ border-color: var(--accent);
371
+ box-shadow:
372
+ inset var(--field-tone-bar) 0 0 0 var(--accent),
373
+ inset 0 1px 0 var(--well-shade);
374
+ }
375
+
376
+ .field-editor.read-only,
377
+ .field-editor.read-only:focus-within {
378
+ border-color: var(--border-strong);
379
+ outline: none;
380
+ box-shadow: none;
381
+ background: var(--surface-recessed);
382
+ }
383
+
289
384
  /* -- Checkbox and radio -- */
290
385
 
291
386
  /* The on fill and the mark drawn on it: the accent, or a tone's. A mixed
@@ -711,6 +806,19 @@ select.field option {
711
806
  var(--font-ui);
712
807
  }
713
808
 
809
+ /* A group whose choices stand in columns (a long list of short choices):
810
+ --field-columns columns of equal width, 2 unless the host sets it; the
811
+ legend and any note span them all. */
812
+ .field-columns {
813
+ display: grid;
814
+ grid-template-columns: repeat(var(--field-columns, 2), minmax(0, 1fr));
815
+ gap: var(--space-2) var(--space-6);
816
+ }
817
+
818
+ .field-columns > :is(legend, .field-note, .field-problem) {
819
+ grid-column: 1 / -1;
820
+ }
821
+
714
822
  /* A check, radio, or switch with its words beside it; the whole label is
715
823
  the target. The words wrap rather than run out of the column. */
716
824
  .field-choice {
@@ -3,8 +3,9 @@
3
3
  * `.field`, `.check`, `.switch`, `.field-label`, `.field-note`,
4
4
  * `.field-problem`, `.field-group`, `.field-choice`, `.field-grid`), so most
5
5
  * forms need no component; `Check` adds the mixed state a checkbox can only
6
- * reach from script, and `labelHelp` puts a control's help in its label's
7
- * tooltip.
6
+ * reach from script, `Switch` turns a running thing on or off, and
7
+ * `labelHelp` puts a control's help in its label's tooltip.
8
8
  */
9
9
  export { Check, type CheckProps } from './Check.js';
10
10
  export { labelHelp, type LabelHelp } from './labelHelp.js';
11
+ export { Switch, type SwitchProps } from './Switch.js';
@@ -3,8 +3,9 @@
3
3
  * `.field`, `.check`, `.switch`, `.field-label`, `.field-note`,
4
4
  * `.field-problem`, `.field-group`, `.field-choice`, `.field-grid`), so most
5
5
  * forms need no component; `Check` adds the mixed state a checkbox can only
6
- * reach from script, and `labelHelp` puts a control's help in its label's
7
- * tooltip.
6
+ * reach from script, `Switch` turns a running thing on or off, and
7
+ * `labelHelp` puts a control's help in its label's tooltip.
8
8
  */
9
9
  export { Check } from './Check.js';
10
10
  export { labelHelp } from './labelHelp.js';
11
+ export { Switch } from './Switch.js';
@@ -92,3 +92,19 @@
92
92
  :where(.listing-root) :is(:focus-within, :has(> input:not(:placeholder-shown))) > .filter-icon {
93
93
  color: var(--accent);
94
94
  }
95
+
96
+ /* A query the field refuses (its input aria-invalid="true", with the
97
+ reason in a problem line or a tooltip the input names): the field's foot
98
+ and its focus edge turn to --danger, and so does its lit mark, in place
99
+ of the divider and the accent. */
100
+ :where(.listing-root) .filter-field:has(input[aria-invalid='true']) {
101
+ border-bottom-color: var(--danger);
102
+ }
103
+
104
+ :where(.listing-root) .filter-field:has(input[aria-invalid='true']):focus-within {
105
+ box-shadow: inset 0 calc(-1 * var(--line-strong)) 0 var(--danger);
106
+ }
107
+
108
+ :where(.listing-root) .filter-field:has(input[aria-invalid='true']) > .filter-icon {
109
+ color: var(--danger);
110
+ }
@@ -0,0 +1,44 @@
1
+ import type { ReactElement, ReactNode, Ref } from 'react';
2
+ import type { RegionHandlers } from '../pane/Pane.js';
3
+ /** Props for {@link AppRoot}. */
4
+ export interface AppRootProps {
5
+ /**
6
+ * The release channel the window wears (`data-channel`), which colours
7
+ * its `ChannelMarker` and channel tags; none on the release.
8
+ */
9
+ readonly channel?: string | null;
10
+ /** The window's content: a `SpacePanel`, or the frame itself. */
11
+ readonly children: ReactNode;
12
+ }
13
+ /**
14
+ * The app window's root: one column the window's height holding its
15
+ * content, which owns the whole window, its top band included. A window
16
+ * that wears it sets the interface face and the body's ground and text, and
17
+ * keeps every dialog clear of its top band (`--dialog-inset-top`).
18
+ */
19
+ export declare function AppRoot({ channel, children }: AppRootProps): ReactElement;
20
+ /** Props for {@link SpacePanel}. */
21
+ export interface SpacePanelProps extends RegionHandlers {
22
+ readonly ref?: Ref<HTMLDivElement>;
23
+ /** The space's frame (`WindowFrame`). */
24
+ readonly children: ReactNode;
25
+ }
26
+ /**
27
+ * The panel the content's keyboard commands work in, inside `AppRoot`: a
28
+ * focus boundary the host's key handlers hang on, focusable by script and
29
+ * out of the Tab order, never a control, so it draws no ring.
30
+ */
31
+ export declare function SpacePanel({ ref, children, ...handlers }: SpacePanelProps): ReactElement;
32
+ /** Props for {@link PageSlot}. */
33
+ export interface PageSlotProps {
34
+ /** The page is the front tab's; false keeps it mounted out of sight. */
35
+ readonly shown: boolean;
36
+ /** The page (`PanePage`). */
37
+ readonly children: ReactNode;
38
+ }
39
+ /**
40
+ * One page of the main pane: the front tab's page lays out as the pane's
41
+ * own child, and a held page (a background tab with unsaved changes) stays
42
+ * mounted and hidden, so it keeps its state.
43
+ */
44
+ export declare function PageSlot({ shown, children }: PageSlotProps): ReactElement;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The app window's root: one column the window's height holding its
4
+ * content, which owns the whole window, its top band included. A window
5
+ * that wears it sets the interface face and the body's ground and text, and
6
+ * keeps every dialog clear of its top band (`--dialog-inset-top`).
7
+ */
8
+ export function AppRoot({ channel = null, children }) {
9
+ return (_jsx("div", { className: "app-shell", "data-channel": channel ?? undefined, children: _jsx("main", { className: "shell-content", children: children }) }));
10
+ }
11
+ /**
12
+ * The panel the content's keyboard commands work in, inside `AppRoot`: a
13
+ * focus boundary the host's key handlers hang on, focusable by script and
14
+ * out of the Tab order, never a control, so it draws no ring.
15
+ */
16
+ export function SpacePanel({ ref, children, ...handlers }) {
17
+ return (_jsx("div", { className: "space-panel", ref: ref, tabIndex: -1, ...handlers, children: children }));
18
+ }
19
+ /**
20
+ * One page of the main pane: the front tab's page lays out as the pane's
21
+ * own child, and a held page (a background tab with unsaved changes) stays
22
+ * mounted and hidden, so it keeps its state.
23
+ */
24
+ export function PageSlot({ shown, children }) {
25
+ return (_jsx("div", { className: "page-slot", hidden: !shown, children: children }));
26
+ }
@@ -0,0 +1,88 @@
1
+ import { type ReactElement, type ReactNode, type Ref } from 'react';
2
+ import type { RegionHandlers } from '../pane/Pane.js';
3
+ /**
4
+ * The height a dock takes: the height its host keeps, between `min` and
5
+ * the room under the band less what the main pane keeps (`pageMin`), in
6
+ * whole pixels; `min` alone wins when the room is smaller still, none left
7
+ * included. The kept height stands alone only while the frame is not laid
8
+ * out (`room` null: hidden, or not yet drawn).
9
+ */
10
+ export declare function dockHeight(kept: number, room: number | null, bounds: {
11
+ readonly min: number;
12
+ readonly pageMin: number;
13
+ }): number;
14
+ /** Props for {@link Dock}. */
15
+ export interface DockProps extends RegionHandlers {
16
+ /** Whether it shows; closed, it takes no room and keeps its state. */
17
+ readonly open: boolean;
18
+ /** Its accessible name ("Console"). */
19
+ readonly label: string;
20
+ /**
21
+ * The height in pixels the host keeps for it. It never grows with what
22
+ * it shows (its body scrolls), and it gives way to keep `pageMin` for
23
+ * the main pane over it in a short window.
24
+ */
25
+ readonly height: number;
26
+ /** The least the main pane over it keeps, in pixels; 160 unless given. */
27
+ readonly pageMin?: number;
28
+ /** The pane holds the keyboard: its frame wears the accent. */
29
+ readonly active?: boolean;
30
+ /** `danger` draws its frame in the danger colour (a production server's console). */
31
+ readonly tone?: 'danger';
32
+ /**
33
+ * Hears each height a drag of its top edge reaches; none draws no edge.
34
+ * The edge's accessible name is `resizeLabel`.
35
+ */
36
+ readonly onResize?: (height: number) => void;
37
+ /** Hears the height a drag ends on, to keep. */
38
+ readonly onResizeEnd?: (height: number) => void;
39
+ /** The edge's accessible name ("Resize the console"). */
40
+ readonly resizeLabel?: string;
41
+ /** Its toolbar, over its body: a title, its facts, its verbs. */
42
+ readonly bar?: ReactNode;
43
+ readonly ref?: Ref<HTMLElement>;
44
+ /** Its body: a `DockLog` over a `DockInput`, a `LogWell`, a terminal. */
45
+ readonly children: ReactNode;
46
+ }
47
+ /**
48
+ * A pane in the dock under the main pane (`WindowFrame`'s `dock`): its
49
+ * bar, then its body, which scrolls, at the height its host keeps. With
50
+ * `onResize` its top edge, in the gap over it, drags its height, the
51
+ * main pane keeping `pageMin`; a window too short for both gives the dock
52
+ * the less room, never the main pane.
53
+ */
54
+ export declare function Dock({ open, label, height, pageMin, active, tone, onResize, onResizeEnd, resizeLabel, bar, ref, children, ...handlers }: DockProps): ReactElement;
55
+ /** Props for {@link DockLog}. */
56
+ export interface DockLogProps {
57
+ /** Its accessible name ("Activity"). */
58
+ readonly label: string;
59
+ /** What it says while it has no entry. */
60
+ readonly empty?: ReactNode;
61
+ readonly ref?: Ref<HTMLOListElement>;
62
+ /** Its entries (`DockLogEntry`), the newest last. */
63
+ readonly children?: ReactNode;
64
+ }
65
+ /**
66
+ * A dock's log: its entries over a hairline each, the newest at the foot;
67
+ * entries far from the foot skip layout until scrolled to.
68
+ */
69
+ export declare function DockLog({ label, empty, ref, children }: DockLogProps): ReactElement;
70
+ /** Props for {@link DockLogEntry}. */
71
+ export interface DockLogEntryProps {
72
+ /** What happened. */
73
+ readonly children: ReactNode;
74
+ /** Its verbs, on a line under it (Show, Retry). */
75
+ readonly actions?: ReactNode;
76
+ }
77
+ /** One entry of a `DockLog`, with its verbs under it. */
78
+ export declare function DockLogEntry({ children, actions }: DockLogEntryProps): ReactElement;
79
+ /** Props for {@link DockInput}. */
80
+ export interface DockInputProps {
81
+ /** The control it holds (a field, an editor). */
82
+ readonly children: ReactNode;
83
+ }
84
+ /**
85
+ * What a dock takes typed in, at its log's foot, ringed while it holds the
86
+ * keyboard; it grows with what it holds up to half the dock, then scrolls.
87
+ */
88
+ export declare function DockInput({ children }: DockInputProps): ReactElement;
@@ -0,0 +1,129 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children, useLayoutEffect, useState } from 'react';
3
+ import { useSharedRef } from './sharedRef.js';
4
+ import { drawn } from './WindowFrame.js';
5
+ /**
6
+ * The height a dock takes: the height its host keeps, between `min` and
7
+ * the room under the band less what the main pane keeps (`pageMin`), in
8
+ * whole pixels; `min` alone wins when the room is smaller still, none left
9
+ * included. The kept height stands alone only while the frame is not laid
10
+ * out (`room` null: hidden, or not yet drawn).
11
+ */
12
+ export function dockHeight(kept, room, bounds) {
13
+ if (room === null)
14
+ return Math.round(Math.max(bounds.min, kept));
15
+ return Math.round(Math.max(bounds.min, Math.min(kept, room - bounds.pageMin)));
16
+ }
17
+ /** An element's height with its bottom margin, or 0 for none. */
18
+ const outerHeight = (element) => element === null
19
+ ? 0
20
+ : element.getBoundingClientRect().height +
21
+ (Number.parseFloat(getComputedStyle(element).marginBottom) || 0);
22
+ /**
23
+ * The room the main pane and the dock share: from the main pane's top to
24
+ * the end of the frame's content, less the tray, the legend, and the gaps
25
+ * under the main pane and the dock. Measured from the frame, so a dock held
26
+ * taller than a shrunken window (and squashing the main pane) is not
27
+ * counted as room; null while the frame is not laid out (hidden or not
28
+ * yet drawn), never mistaken for a frame with no room left.
29
+ */
30
+ const sharedRoom = (dock) => {
31
+ const slot = dock.closest('.window-frame-dock');
32
+ const frame = dock.closest('.window-frame');
33
+ const main = slot?.parentElement?.querySelector(':scope > .window-frame-main');
34
+ if (slot === null || frame === null || main === null || main === undefined)
35
+ return null;
36
+ if (frame.getClientRects().length === 0)
37
+ return null;
38
+ const box = frame.getBoundingClientRect();
39
+ const end = box.top +
40
+ frame.clientTop +
41
+ frame.clientHeight -
42
+ (Number.parseFloat(getComputedStyle(frame).paddingBottom) || 0);
43
+ const tray = slot.parentElement?.querySelector(':scope > .window-frame-tray') ?? null;
44
+ const legend = frame.querySelector(':scope > .window-frame-legend');
45
+ const gaps = (Number.parseFloat(getComputedStyle(main).marginBottom) || 0) +
46
+ (Number.parseFloat(getComputedStyle(dock).marginBottom) || 0);
47
+ return end - main.getBoundingClientRect().top - outerHeight(tray) - outerHeight(legend) - gaps;
48
+ };
49
+ /** The least a dock is: its bar and a line of its body. */
50
+ const DOCK_MIN = 64;
51
+ /**
52
+ * A pane in the dock under the main pane (`WindowFrame`'s `dock`): its
53
+ * bar, then its body, which scrolls, at the height its host keeps. With
54
+ * `onResize` its top edge, in the gap over it, drags its height, the
55
+ * main pane keeping `pageMin`; a window too short for both gives the dock
56
+ * the less room, never the main pane.
57
+ */
58
+ export function Dock({ open, label, height, pageMin = 160, active = false, tone, onResize, onResizeEnd, resizeLabel, bar = null, ref, children, ...handlers }) {
59
+ const [self, attach] = useSharedRef(ref);
60
+ const [room, setRoom] = useState(null);
61
+ const bounds = { min: DOCK_MIN, pageMin };
62
+ const shown = dockHeight(height, room, bounds);
63
+ useLayoutEffect(() => {
64
+ const element = self.current;
65
+ const frame = element?.closest('.window-frame');
66
+ if (!open || element === null || frame === null || frame === undefined)
67
+ return undefined;
68
+ const measure = () => setRoom(sharedRoom(element));
69
+ measure();
70
+ if (typeof ResizeObserver === 'undefined')
71
+ return undefined;
72
+ const observer = new ResizeObserver(measure);
73
+ const main = element
74
+ .closest('.window-frame-dock')
75
+ ?.parentElement?.querySelector(':scope > .window-frame-main');
76
+ // The frame for a window resize, the main pane's slot for a tray or a
77
+ // legend that comes, goes, or changes height in a frame of fixed size.
78
+ // The room leaves the dock's own height out, so its change settles.
79
+ observer.observe(frame);
80
+ if (main !== null && main !== undefined)
81
+ observer.observe(main);
82
+ return () => observer.disconnect();
83
+ }, [open, self]);
84
+ const start = (event) => {
85
+ if (event.button !== 0 || onResize === undefined || self.current === null)
86
+ return;
87
+ event.preventDefault();
88
+ const edge = event.currentTarget;
89
+ const startY = event.clientY;
90
+ const startRoom = sharedRoom(self.current);
91
+ let last = shown;
92
+ edge.setPointerCapture?.(event.pointerId);
93
+ const move = (next) => {
94
+ last = dockHeight(shown - (next.clientY - startY), startRoom, bounds);
95
+ onResize(last);
96
+ };
97
+ const end = () => {
98
+ edge.removeEventListener('pointermove', move);
99
+ edge.removeEventListener('pointerup', end);
100
+ edge.removeEventListener('pointercancel', end);
101
+ onResizeEnd?.(last);
102
+ };
103
+ edge.addEventListener('pointermove', move);
104
+ edge.addEventListener('pointerup', end);
105
+ edge.addEventListener('pointercancel', end);
106
+ };
107
+ const classes = ['pane', 'window-dock', active ? 'active' : '', open ? '' : 'closed']
108
+ .filter(Boolean)
109
+ .join(' ');
110
+ return (_jsxs("section", { "aria-label": label, className: classes, "data-tone": tone, ref: attach, style: { height: shown }, ...handlers, children: [onResize === undefined ? null : (_jsx("div", { "aria-label": resizeLabel, "aria-orientation": "horizontal", "aria-valuemin": DOCK_MIN, "aria-valuenow": shown, className: "pane-splitter", onPointerDown: start, role: "separator" })), drawn(bar) ? _jsx("div", { className: "dock-bar", children: bar }) : null, _jsx("div", { className: "dock-body", children: children })] }));
111
+ }
112
+ /**
113
+ * A dock's log: its entries over a hairline each, the newest at the foot;
114
+ * entries far from the foot skip layout until scrolled to.
115
+ */
116
+ export function DockLog({ label, empty, ref, children }) {
117
+ return (_jsx("ol", { "aria-label": label, className: "dock-log selectable", ref: ref, children: Children.count(children) === 0 && empty !== undefined ? (_jsx("li", { className: "dock-log-empty", children: empty })) : (children) }));
118
+ }
119
+ /** One entry of a `DockLog`, with its verbs under it. */
120
+ export function DockLogEntry({ children, actions }) {
121
+ return (_jsxs("li", { className: "dock-log-entry", children: [children, drawn(actions) ? _jsx("div", { className: "dock-log-actions", children: actions }) : null] }));
122
+ }
123
+ /**
124
+ * What a dock takes typed in, at its log's foot, ringed while it holds the
125
+ * keyboard; it grows with what it holds up to half the dock, then scrolls.
126
+ */
127
+ export function DockInput({ children }) {
128
+ return _jsx("div", { className: "dock-input", children: children });
129
+ }
@@ -0,0 +1,28 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import type { ReactElement } from 'react';
3
+ /** One filter of a quick row. */
4
+ export interface FilterChip<Id extends string> {
5
+ readonly id: Id;
6
+ /** The filter's word ("Running"). */
7
+ readonly label: string;
8
+ readonly icon?: LucideIcon;
9
+ /** How many rows it keeps; none hides the count. */
10
+ readonly count?: number | string | null;
11
+ }
12
+ /** Props for {@link FilterChips}. */
13
+ export interface FilterChipsProps<Id extends string> {
14
+ readonly chips: readonly FilterChip<Id>[];
15
+ /** The filters that are on. */
16
+ readonly on: readonly Id[];
17
+ /** Turns one filter on or off. */
18
+ readonly onToggle: (id: Id) => void;
19
+ /** The row's accessible name ("Filters"). */
20
+ readonly label: string;
21
+ }
22
+ /**
23
+ * A pane's quick row of filters under its path bar (`pane-quick-row`), as a
24
+ * sidebar's Running and Updates: each a quiet button with its glyph, its
25
+ * word, and its count, pressed while on. A press toggles its filter and
26
+ * leaves the focus where it was.
27
+ */
28
+ export declare function FilterChips<Id extends string>({ chips, on, onToggle, label }: FilterChipsProps<Id>): ReactElement;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ICON_SM } from '../icon/sizes.js';
3
+ /**
4
+ * A pane's quick row of filters under its path bar (`pane-quick-row`), as a
5
+ * sidebar's Running and Updates: each a quiet button with its glyph, its
6
+ * word, and its count, pressed while on. A press toggles its filter and
7
+ * leaves the focus where it was.
8
+ */
9
+ export function FilterChips({ chips, on, onToggle, label }) {
10
+ return (_jsx("div", { "aria-label": label, className: "pane-quick-row", role: "toolbar", children: chips.map((chip) => {
11
+ const Icon = chip.icon;
12
+ return (_jsxs("button", { "aria-pressed": on.includes(chip.id), className: "pane-quick-button quiet-track-item", onClick: () => onToggle(chip.id), onMouseDown: (event) => event.preventDefault(), type: "button", children: [Icon === undefined ? null : _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), chip.label, chip.count === undefined || chip.count === null ? null : (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "pane-quick-count", children: chip.count })] }))] }, chip.id));
13
+ }) }));
14
+ }
@@ -0,0 +1,69 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import type { ReactElement, ReactNode } from 'react';
3
+ /** Props of a part that only lays out what it holds. */
4
+ export interface PagePartProps {
5
+ readonly children: ReactNode;
6
+ }
7
+ /** A page in the main pane (in its `PageSlot`): a column that fills the pane. */
8
+ export declare function PanePage({ children }: PagePartProps): ReactElement;
9
+ /** Props for {@link Toolbar}. */
10
+ export interface ToolbarProps {
11
+ /** Its tools, in order: each keeps its size but a `ToolbarGrow`; `ToolbarGap` parts two groups. */
12
+ readonly children: ReactNode;
13
+ /** A group at the toolbar's far end. */
14
+ readonly end?: ReactNode;
15
+ }
16
+ /**
17
+ * One line of tools that keep their size: a `ToolbarGrow` among them gives
18
+ * way when the line is short, and `end` stands at the far end.
19
+ */
20
+ export declare function Toolbar({ children, end }: ToolbarProps): ReactElement;
21
+ /** A toolbar's item that gives way when the line is short (a field, a long name). */
22
+ export declare function ToolbarGrow({ children }: PagePartProps): ReactElement;
23
+ /** A hairline between two groups of a toolbar's tools. */
24
+ export declare function ToolbarGap(): ReactElement;
25
+ /** A page's filter under its tab strip (a filter field, a query). */
26
+ export declare function PageFilter({ children }: PagePartProps): ReactElement;
27
+ /** Props for {@link PageNote}. */
28
+ export interface PageNoteProps {
29
+ /** Its glyph, dim; none with `busy`. */
30
+ readonly icon?: LucideIcon;
31
+ /** Something is loading: the spinner stands for the glyph and the line is a status. */
32
+ readonly busy?: boolean;
33
+ /** Its words ("Loading services…", "No services yet."). */
34
+ readonly children: ReactNode;
35
+ }
36
+ /**
37
+ * A loading or empty line in a page, where its rows would be: its glyph or
38
+ * spinner beside the words, from the rows' inset.
39
+ */
40
+ export declare function PageNote({ icon: Icon, busy, children }: PageNoteProps): ReactElement;
41
+ /** The one command that answers an empty list (Add service), under its `PageNote`. */
42
+ export declare function EmptyAction({ children }: PagePartProps): ReactElement;
43
+ /** Props for {@link SectionHead}. */
44
+ export interface SectionHeadProps {
45
+ /** Its words, set as an overline. */
46
+ readonly children: ReactNode;
47
+ /** Its heading level in the page's outline: 3 unless given. */
48
+ readonly level?: 2 | 3 | 4;
49
+ }
50
+ /** A heading over one of a page's listings, in the rows' inset. */
51
+ export declare function SectionHead({ children, level }: SectionHeadProps): ReactElement;
52
+ /** A bar at a pane's foot under its list: a select-all bar, a form's actions. */
53
+ export declare function FootBar({ children }: PagePartProps): ReactElement;
54
+ /** A warning line under a pane's path bar, over its rows (a list cut short). */
55
+ export declare function PaneWarning({ children }: PagePartProps): ReactElement;
56
+ /** Props for {@link ShowSidebarButton}. */
57
+ export interface ShowSidebarButtonProps {
58
+ /** Its words ("Show panel"). */
59
+ readonly label: string;
60
+ readonly onShow: () => void;
61
+ /** Its glyph before the words. */
62
+ readonly icon?: LucideIcon;
63
+ }
64
+ /**
65
+ * The tool that shows the hidden sidebar again, in the main pane's path
66
+ * bar (among `PanePathBar`'s children), where it leads the bar's tools
67
+ * before the page's facts.
68
+ */
69
+ export declare function ShowSidebarButton({ label, onShow, icon: Icon }: ShowSidebarButtonProps): ReactElement;