@bigpixelrocket/uiok 0.2.3 → 0.4.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 (215) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/dist/charts/Sparkline.d.ts +20 -0
  3. package/dist/charts/Sparkline.js +12 -0
  4. package/dist/charts/Sparkline.logic.d.ts +9 -0
  5. package/dist/charts/Sparkline.logic.js +27 -0
  6. package/dist/charts/charts.css +17 -0
  7. package/dist/charts/index.d.ts +2 -0
  8. package/dist/charts/index.js +2 -0
  9. package/dist/dialog/ConfirmDialog.d.ts +17 -1
  10. package/dist/dialog/ConfirmDialog.js +4 -3
  11. package/dist/dialog/ModalDialog.d.ts +8 -0
  12. package/dist/dialog/ModalDialog.js +4 -2
  13. package/dist/dialog/ProgressDialog.d.ts +40 -0
  14. package/dist/dialog/ProgressDialog.js +40 -0
  15. package/dist/dialog/TypedNameDialog.d.ts +44 -0
  16. package/dist/dialog/TypedNameDialog.js +17 -0
  17. package/dist/dialog/index.d.ts +5 -2
  18. package/dist/dialog/index.js +4 -1
  19. package/dist/field/Check.d.ts +9 -2
  20. package/dist/field/Check.js +5 -4
  21. package/dist/field/Controls.d.ts +198 -0
  22. package/dist/field/Controls.js +94 -0
  23. package/dist/field/FieldLayout.d.ts +126 -0
  24. package/dist/field/FieldLayout.js +89 -0
  25. package/dist/field/Switch.d.ts +26 -0
  26. package/dist/field/Switch.js +20 -0
  27. package/dist/field/index.d.ts +10 -6
  28. package/dist/field/index.js +10 -6
  29. package/dist/frame/AppRoot.d.ts +44 -0
  30. package/dist/frame/AppRoot.js +26 -0
  31. package/dist/frame/Dock.d.ts +88 -0
  32. package/dist/frame/Dock.js +129 -0
  33. package/dist/frame/FilterChips.d.ts +28 -0
  34. package/dist/frame/FilterChips.js +14 -0
  35. package/dist/frame/PageParts.d.ts +69 -0
  36. package/dist/frame/PageParts.js +60 -0
  37. package/dist/frame/PaneSplit.d.ts +74 -0
  38. package/dist/frame/PaneSplit.js +197 -0
  39. package/dist/frame/SidebarResizer.d.ts +35 -0
  40. package/dist/frame/SidebarResizer.js +43 -0
  41. package/dist/frame/StatusNotice.d.ts +20 -0
  42. package/dist/frame/StatusNotice.js +13 -0
  43. package/dist/frame/Tree.d.ts +147 -0
  44. package/dist/frame/Tree.js +164 -0
  45. package/dist/frame/TreeToggle.d.ts +18 -0
  46. package/dist/frame/TreeToggle.js +17 -0
  47. package/dist/frame/WindowFrame.d.ts +57 -0
  48. package/dist/frame/WindowFrame.js +19 -0
  49. package/dist/frame/frame.css +801 -0
  50. package/dist/frame/index.d.ts +22 -0
  51. package/dist/frame/index.js +22 -0
  52. package/dist/frame/sharedRef.d.ts +8 -0
  53. package/dist/frame/sharedRef.js +26 -0
  54. package/dist/index.d.ts +3 -0
  55. package/dist/index.js +3 -0
  56. package/dist/labels/UiokLabels.d.ts +6 -0
  57. package/dist/labels/UiokLabels.js +5 -1
  58. package/dist/labels/dialog.d.ts +12 -0
  59. package/dist/labels/dialog.js +7 -1
  60. package/dist/labels/index.d.ts +2 -0
  61. package/dist/labels/index.js +2 -0
  62. package/dist/labels/settings.d.ts +46 -0
  63. package/dist/labels/settings.js +29 -0
  64. package/dist/labels/viewer.d.ts +193 -0
  65. package/dist/labels/viewer.js +124 -0
  66. package/dist/listing/EmptyState.d.ts +40 -0
  67. package/dist/listing/EmptyState.js +14 -0
  68. package/dist/listing/PaneMessage.d.ts +28 -0
  69. package/dist/listing/PaneMessage.js +12 -0
  70. package/dist/listing/index.d.ts +5 -1
  71. package/dist/listing/index.js +5 -1
  72. package/dist/listing/listing.css +66 -2
  73. package/dist/log/LogWell.d.ts +34 -0
  74. package/dist/log/LogWell.js +39 -0
  75. package/dist/log/LogWell.logic.d.ts +16 -0
  76. package/dist/log/LogWell.logic.js +26 -0
  77. package/dist/log/index.d.ts +8 -0
  78. package/dist/log/index.js +8 -0
  79. package/dist/log/log.css +57 -0
  80. package/dist/pane/Pane.d.ts +49 -0
  81. package/dist/pane/Pane.js +17 -0
  82. package/dist/pane/PaneKeys.d.ts +10 -3
  83. package/dist/pane/PaneKeys.js +26 -7
  84. package/dist/pane/index.d.ts +4 -2
  85. package/dist/pane/index.js +4 -2
  86. package/dist/pane/usePaneKeys.js +9 -11
  87. package/dist/shell/AboutWindow.d.ts +21 -0
  88. package/dist/shell/AboutWindow.js +10 -0
  89. package/dist/shell/LanguageChoice.d.ts +27 -0
  90. package/dist/shell/LanguageChoice.js +17 -0
  91. package/dist/shell/LoadFailure.d.ts +22 -0
  92. package/dist/shell/LoadFailure.js +15 -0
  93. package/dist/shell/Lockup.d.ts +52 -0
  94. package/dist/shell/Lockup.js +30 -0
  95. package/dist/shell/SettingsDialog.d.ts +97 -0
  96. package/dist/shell/SettingsDialog.js +219 -0
  97. package/dist/shell/SettingsDialog.logic.d.ts +33 -0
  98. package/dist/shell/SettingsDialog.logic.js +42 -0
  99. package/dist/shell/SettingsFiles.d.ts +55 -0
  100. package/dist/shell/SettingsFiles.js +30 -0
  101. package/dist/shell/SettingsPageKeys.d.ts +42 -0
  102. package/dist/shell/SettingsPageKeys.js +70 -0
  103. package/dist/shell/SettingsSubsection.d.ts +34 -0
  104. package/dist/shell/SettingsSubsection.js +30 -0
  105. package/dist/shell/SignIn.d.ts +61 -0
  106. package/dist/shell/SignIn.js +36 -0
  107. package/dist/shell/ThemePicker.d.ts +74 -0
  108. package/dist/shell/ThemePicker.js +96 -0
  109. package/dist/shell/ThemePicker.logic.d.ts +13 -0
  110. package/dist/shell/ThemePicker.logic.js +26 -0
  111. package/dist/shell/TitleBar.d.ts +44 -0
  112. package/dist/shell/TitleBar.js +23 -0
  113. package/dist/shell/UpdatePill.d.ts +26 -0
  114. package/dist/shell/UpdatePill.js +17 -0
  115. package/dist/shell/Updates.d.ts +99 -0
  116. package/dist/shell/Updates.js +72 -0
  117. package/dist/shell/index.d.ts +27 -0
  118. package/dist/shell/index.js +27 -0
  119. package/dist/shell/shell.css +243 -4
  120. package/dist/styles.css +5 -0
  121. package/dist/surface/Card.d.ts +18 -0
  122. package/dist/surface/Card.js +10 -0
  123. package/dist/surface/Notice.d.ts +45 -0
  124. package/dist/surface/Notice.js +27 -0
  125. package/dist/surface/index.d.ts +5 -3
  126. package/dist/surface/index.js +5 -3
  127. package/dist/themes/catalog.js +4 -0
  128. package/dist/themes/themes.generated.css +245 -0
  129. package/dist/themes/tokens.d.ts +17 -5
  130. package/dist/themes/tokens.js +67 -1
  131. package/dist/tokens.css +11 -0
  132. package/dist/viewer/AudioView.d.ts +13 -0
  133. package/dist/viewer/AudioView.js +25 -0
  134. package/dist/viewer/HexJump.logic.d.ts +16 -0
  135. package/dist/viewer/HexJump.logic.js +27 -0
  136. package/dist/viewer/HexRows.logic.d.ts +55 -0
  137. package/dist/viewer/HexRows.logic.js +84 -0
  138. package/dist/viewer/HexSelection.logic.d.ts +57 -0
  139. package/dist/viewer/HexSelection.logic.js +68 -0
  140. package/dist/viewer/HexView.d.ts +10 -0
  141. package/dist/viewer/HexView.js +291 -0
  142. package/dist/viewer/HexViewport.logic.d.ts +61 -0
  143. package/dist/viewer/HexViewport.logic.js +79 -0
  144. package/dist/viewer/ImageView.d.ts +19 -0
  145. package/dist/viewer/ImageView.js +230 -0
  146. package/dist/viewer/ImageZoom.logic.d.ts +65 -0
  147. package/dist/viewer/ImageZoom.logic.js +119 -0
  148. package/dist/viewer/LatestRead.logic.d.ts +27 -0
  149. package/dist/viewer/LatestRead.logic.js +55 -0
  150. package/dist/viewer/MediaControls.d.ts +25 -0
  151. package/dist/viewer/MediaControls.js +183 -0
  152. package/dist/viewer/MediaPlayer.logic.d.ts +53 -0
  153. package/dist/viewer/MediaPlayer.logic.js +68 -0
  154. package/dist/viewer/PdfView.d.ts +23 -0
  155. package/dist/viewer/PdfView.js +25 -0
  156. package/dist/viewer/QuietFocus.d.ts +19 -0
  157. package/dist/viewer/QuietFocus.js +27 -0
  158. package/dist/viewer/ScaledScroll.logic.d.ts +30 -0
  159. package/dist/viewer/ScaledScroll.logic.js +28 -0
  160. package/dist/viewer/ScaledScrollbar.d.ts +19 -0
  161. package/dist/viewer/ScaledScrollbar.js +71 -0
  162. package/dist/viewer/SyntaxHighlighter.d.ts +29 -0
  163. package/dist/viewer/SyntaxHighlighter.js +144 -0
  164. package/dist/viewer/SyntaxLanguage.logic.d.ts +110 -0
  165. package/dist/viewer/SyntaxLanguage.logic.js +283 -0
  166. package/dist/viewer/SyntaxService.d.ts +75 -0
  167. package/dist/viewer/SyntaxService.js +49 -0
  168. package/dist/viewer/SyntaxSession.logic.d.ts +78 -0
  169. package/dist/viewer/SyntaxSession.logic.js +221 -0
  170. package/dist/viewer/SyntaxWorker.d.ts +6 -0
  171. package/dist/viewer/SyntaxWorker.js +8 -0
  172. package/dist/viewer/TextEncoding.logic.d.ts +35 -0
  173. package/dist/viewer/TextEncoding.logic.js +58 -0
  174. package/dist/viewer/TextRows.logic.d.ts +86 -0
  175. package/dist/viewer/TextRows.logic.js +241 -0
  176. package/dist/viewer/TextSelection.logic.d.ts +97 -0
  177. package/dist/viewer/TextSelection.logic.js +139 -0
  178. package/dist/viewer/TextView.d.ts +13 -0
  179. package/dist/viewer/TextView.js +448 -0
  180. package/dist/viewer/TextViewport.logic.d.ts +70 -0
  181. package/dist/viewer/TextViewport.logic.js +116 -0
  182. package/dist/viewer/VideoView.d.ts +18 -0
  183. package/dist/viewer/VideoView.js +53 -0
  184. package/dist/viewer/ViewerClipboard.d.ts +30 -0
  185. package/dist/viewer/ViewerClipboard.js +70 -0
  186. package/dist/viewer/ViewerFrame.logic.d.ts +61 -0
  187. package/dist/viewer/ViewerFrame.logic.js +130 -0
  188. package/dist/viewer/ViewerKeys.d.ts +16 -0
  189. package/dist/viewer/ViewerKeys.js +14 -0
  190. package/dist/viewer/ViewerScope.d.ts +12 -0
  191. package/dist/viewer/ViewerScope.js +22 -0
  192. package/dist/viewer/ViewerViews.d.ts +28 -0
  193. package/dist/viewer/ViewerViews.js +22 -0
  194. package/dist/viewer/ViewerWindow.d.ts +53 -0
  195. package/dist/viewer/ViewerWindow.js +219 -0
  196. package/dist/viewer/index.d.ts +12 -0
  197. package/dist/viewer/index.js +12 -0
  198. package/dist/viewer/types.d.ts +151 -0
  199. package/dist/viewer/types.js +26 -0
  200. package/dist/viewer/useElementHeight.d.ts +6 -0
  201. package/dist/viewer/useElementHeight.js +22 -0
  202. package/dist/viewer/useElementSize.d.ts +7 -0
  203. package/dist/viewer/useElementSize.js +24 -0
  204. package/dist/viewer/useEscapeToClear.d.ts +8 -0
  205. package/dist/viewer/useEscapeToClear.js +26 -0
  206. package/dist/viewer/useHexDocument.d.ts +41 -0
  207. package/dist/viewer/useHexDocument.js +144 -0
  208. package/dist/viewer/useMediaElement.d.ts +10 -0
  209. package/dist/viewer/useMediaElement.js +24 -0
  210. package/dist/viewer/useSyntaxHighlight.d.ts +24 -0
  211. package/dist/viewer/useSyntaxHighlight.js +133 -0
  212. package/dist/viewer/useTextDocument.d.ts +66 -0
  213. package/dist/viewer/useTextDocument.js +245 -0
  214. package/dist/viewer/viewer.css +645 -0
  215. package/package.json +7 -1
@@ -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", 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;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '../button/Button.js';
3
+ import { Spinner } from '../icon/Spinner.js';
4
+ import { ICON_MD, ICON_SM } from '../icon/sizes.js';
5
+ import { drawn } from './WindowFrame.js';
6
+ /** A page in the main pane (in its `PageSlot`): a column that fills the pane. */
7
+ export function PanePage({ children }) {
8
+ return _jsx("div", { className: "pane-page", children: children });
9
+ }
10
+ /**
11
+ * One line of tools that keep their size: a `ToolbarGrow` among them gives
12
+ * way when the line is short, and `end` stands at the far end.
13
+ */
14
+ export function Toolbar({ children, end }) {
15
+ return (_jsxs("div", { className: "pane-toolbar", children: [children, drawn(end) ? _jsx("div", { className: "pane-toolbar-end", children: end }) : null] }));
16
+ }
17
+ /** A toolbar's item that gives way when the line is short (a field, a long name). */
18
+ export function ToolbarGrow({ children }) {
19
+ return _jsx("div", { className: "pane-toolbar-grow", children: children });
20
+ }
21
+ /** A hairline between two groups of a toolbar's tools. */
22
+ export function ToolbarGap() {
23
+ return _jsx("span", { "aria-hidden": true, className: "pane-toolbar-gap" });
24
+ }
25
+ /** A page's filter under its tab strip (a filter field, a query). */
26
+ export function PageFilter({ children }) {
27
+ return _jsx("div", { className: "pane-page-filter", children: children });
28
+ }
29
+ /**
30
+ * A loading or empty line in a page, where its rows would be: its glyph or
31
+ * spinner beside the words, from the rows' inset.
32
+ */
33
+ export function PageNote({ icon: Icon, busy = false, children }) {
34
+ return (_jsxs("p", { className: "pane-message pane-page-note", role: busy ? 'status' : undefined, children: [busy ? (_jsx(Spinner, { size: ICON_MD })) : Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, size: ICON_MD })), _jsx("span", { children: children })] }));
35
+ }
36
+ /** The one command that answers an empty list (Add service), under its `PageNote`. */
37
+ export function EmptyAction({ children }) {
38
+ return _jsx("div", { className: "pane-empty-action", children: children });
39
+ }
40
+ /** A heading over one of a page's listings, in the rows' inset. */
41
+ export function SectionHead({ children, level = 3 }) {
42
+ const Heading = `h${level}`;
43
+ return _jsx(Heading, { className: "pane-section-head overline", children: children });
44
+ }
45
+ /** A bar at a pane's foot under its list: a select-all bar, a form's actions. */
46
+ export function FootBar({ children }) {
47
+ return _jsx("div", { className: "pane-foot-bar", children: children });
48
+ }
49
+ /** A warning line under a pane's path bar, over its rows (a list cut short). */
50
+ export function PaneWarning({ children }) {
51
+ return (_jsx("p", { className: "pane-warning", role: "status", children: children }));
52
+ }
53
+ /**
54
+ * The tool that shows the hidden sidebar again, in the main pane's path
55
+ * bar (among `PanePathBar`'s children), where it leads the bar's tools
56
+ * before the page's facts.
57
+ */
58
+ export function ShowSidebarButton({ label, onShow, icon: Icon }) {
59
+ return (_jsxs(Button, { className: "window-frame-show-sidebar", onClick: onShow, size: "small", children: [Icon === undefined ? null : _jsx(Icon, { "aria-hidden": true, size: ICON_SM }), label] }));
60
+ }
@@ -0,0 +1,74 @@
1
+ import { type PointerEvent as ReactPointerEvent, type ReactElement, type ReactNode, type RefObject } from 'react';
2
+ /**
3
+ * How far a scroller's lower edge cuts into its last visible row: zero when
4
+ * its rows fit or its edge falls between two rows. Rows may differ in
5
+ * height (a wrapped name), so the cut row is found, not computed.
6
+ */
7
+ export declare const cutRowDepth: (scroller: HTMLElement) => number;
8
+ /**
9
+ * The lower pane's height under a dragged split: the height dragged, less
10
+ * what the upper list must keep of the two regions' room (`floor`), and
11
+ * never under the lower pane's own least (`least`), in whole pixels, none
12
+ * left included; the height dragged stands alone only while the split is
13
+ * not laid out (`room` null: a page held out of sight).
14
+ */
15
+ export declare const heldSplitHeight: (held: number, room: number | null, bounds: {
16
+ readonly floor: number;
17
+ readonly least: number;
18
+ }) => number;
19
+ /** One splitter between a page's upper list and its lower pane (`usePaneSplit`). */
20
+ export interface PaneSplit {
21
+ /** The upper list's scroller, which gives way as the lower pane grows. */
22
+ readonly upper: RefObject<HTMLDivElement | null>;
23
+ /** The lower pane (`SplitDetail`), whose height the splitter sets. */
24
+ readonly lower: RefObject<HTMLElement | null>;
25
+ /** Starts a drag on the splitter's band. */
26
+ readonly drag: (event: ReactPointerEvent<HTMLDivElement>) => void;
27
+ /** Puts the lower pane back at the page's own share. */
28
+ readonly reset: () => void;
29
+ }
30
+ /**
31
+ * A splitter between a page's upper list and the pane under it: the user drags the divide, the height is
32
+ * kept per page (`name`) while the window lives, and both regions come to
33
+ * rest at a whole row. The upper list (`upper`, a `PaneList`'s ref) ends at
34
+ * a row's lower edge (the slice it would have cut goes to the lower pane);
35
+ * the lower pane's own list, the first match of `lowerScroller` inside it
36
+ * (a `SplitDetail`'s body unless given), ends at a whole row with the rest
37
+ * of the pane left empty under it.
38
+ *
39
+ * The lower pane is a flex item whose basis the splitter sets; until the
40
+ * user drags, both regions take the sizes the page's stylesheet gives them. `layoutKey` changes when the rows change (a load, a
41
+ * tab switch), so the rest is measured again; a window resize is observed.
42
+ */
43
+ export declare function usePaneSplit(name: string, layoutKey: unknown, lowerScroller?: string): PaneSplit;
44
+ /** Props for {@link PaneSplitter}. */
45
+ export interface PaneSplitterProps {
46
+ /** The split it drags (`usePaneSplit`). */
47
+ readonly split: PaneSplit;
48
+ }
49
+ /**
50
+ * The splitter's band, between the upper list and the lower pane: the
51
+ * resize cursor over the hairline that divides them. A double click puts
52
+ * the divide back at the page's own share. The pointer drags it; the keys
53
+ * reach both lists without it.
54
+ */
55
+ export declare function PaneSplitter({ split }: PaneSplitterProps): ReactElement;
56
+ /** Props for {@link SplitDetail}. */
57
+ export interface SplitDetailProps {
58
+ /** The split it is the lower pane of (`usePaneSplit`). */
59
+ readonly split: PaneSplit;
60
+ /** Kept at its head alone (its body folded away), whatever was dragged. */
61
+ readonly folded?: boolean;
62
+ /** Its accessible name ("Selected row"). */
63
+ readonly label?: string;
64
+ /** Its head, over the body that scrolls (a strip, a title with its verbs). */
65
+ readonly head?: ReactNode;
66
+ /** What it shows, in its scrolling body. */
67
+ readonly children?: ReactNode;
68
+ }
69
+ /**
70
+ * The pane under a page's list, under its `PaneSplitter`: as tall as what
71
+ * it shows until dragged, up to 38% of the page and never under seven
72
+ * dense rows, its body scrolling under its head.
73
+ */
74
+ export declare function SplitDetail({ split, folded, label, head, children }: SplitDetailProps): ReactElement;