@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
@@ -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;
@@ -0,0 +1,197 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
3
+ /**
4
+ * The lower pane's height each page was last dragged to, for as long as the
5
+ * window lives, keyed by the page's split name. A page that comes back opens
6
+ * at the height the user left it.
7
+ */
8
+ const heldHeights = new Map();
9
+ /** A list's rows: every row of a listing or a grid, its column strip aside. */
10
+ const LIST_ROWS = '[role="row"]:not(.pane-columns), .data-grid-row';
11
+ /**
12
+ * How far a scroller's lower edge cuts into its last visible row: zero when
13
+ * its rows fit or its edge falls between two rows. Rows may differ in
14
+ * height (a wrapped name), so the cut row is found, not computed.
15
+ */
16
+ export const cutRowDepth = (scroller) => {
17
+ if (scroller.scrollHeight <= scroller.clientHeight + 1)
18
+ return 0;
19
+ const box = scroller.getBoundingClientRect();
20
+ const bottom = box.top + scroller.clientTop + scroller.clientHeight;
21
+ for (const row of scroller.querySelectorAll(LIST_ROWS)) {
22
+ const edge = row.getBoundingClientRect();
23
+ if (edge.bottom > bottom + 0.5)
24
+ return edge.top < bottom ? Math.max(0, bottom - edge.top) : 0;
25
+ }
26
+ return 0;
27
+ };
28
+ /**
29
+ * The least an upper list keeps under a dragged split: its own min-height,
30
+ * and never under two rows, so a split held from a taller window never
31
+ * leaves the list with nothing in a shorter one.
32
+ */
33
+ const upperFloor = (top) => {
34
+ const style = getComputedStyle(top);
35
+ const row = Number.parseFloat(style.getPropertyValue('--row-height')) || 24;
36
+ return Math.max(Number.parseFloat(style.minHeight) || 0, 2 * row);
37
+ };
38
+ /**
39
+ * The lower pane's height under a dragged split: the height dragged, less
40
+ * what the upper list must keep of the two regions' room (`floor`), and
41
+ * never under the lower pane's own least (`least`), in whole pixels, none
42
+ * left included; the height dragged stands alone only while the split is
43
+ * not laid out (`room` null: a page held out of sight).
44
+ */
45
+ export const heldSplitHeight = (held, room, bounds) => room === null
46
+ ? Math.round(Math.max(bounds.least, held))
47
+ : Math.round(Math.max(bounds.least, Math.min(held, room - bounds.floor)));
48
+ /**
49
+ * The room the upper list and the lower pane share: from the list's top to
50
+ * the end of their container's content box, less whatever follows the
51
+ * lower pane, measured from the container so a lower pane held taller than
52
+ * the room (and overflowing it) is not counted as room; null while the
53
+ * container is not laid out.
54
+ */
55
+ const splitRoom = (top, pane) => {
56
+ const parent = top.parentElement;
57
+ // Not laid out (a page held out of sight): no room to fit to, which is
58
+ // not the same as a page with no room left.
59
+ if ((parent ?? top).getClientRects().length === 0)
60
+ return null;
61
+ if (parent === null)
62
+ return top.getBoundingClientRect().height + pane.getBoundingClientRect().height;
63
+ const box = parent.getBoundingClientRect();
64
+ const end = box.top + parent.clientTop + parent.clientHeight;
65
+ let after = 0;
66
+ for (let next = pane.nextElementSibling; next !== null; next = next.nextElementSibling) {
67
+ after += next.getBoundingClientRect().height;
68
+ }
69
+ return end - top.getBoundingClientRect().top - after;
70
+ };
71
+ /**
72
+ * A splitter between a page's upper list and the pane under it: the user drags the divide, the height is
73
+ * kept per page (`name`) while the window lives, and both regions come to
74
+ * rest at a whole row. The upper list (`upper`, a `PaneList`'s ref) ends at
75
+ * a row's lower edge (the slice it would have cut goes to the lower pane);
76
+ * the lower pane's own list, the first match of `lowerScroller` inside it
77
+ * (a `SplitDetail`'s body unless given), ends at a whole row with the rest
78
+ * of the pane left empty under it.
79
+ *
80
+ * The lower pane is a flex item whose basis the splitter sets; until the
81
+ * user drags, both regions take the sizes the page's stylesheet gives them. `layoutKey` changes when the rows change (a load, a
82
+ * tab switch), so the rest is measured again; a window resize is observed.
83
+ */
84
+ export function usePaneSplit(name, layoutKey, lowerScroller = '.split-detail-body') {
85
+ const upper = useRef(null);
86
+ const lower = useRef(null);
87
+ const drag = useRef(null);
88
+ const [held, setHeld] = useState(() => ({ name, height: heldHeights.get(name) ?? null }));
89
+ // A page that changes its split's name while mounted takes that page's
90
+ // kept height, not the one it was showing.
91
+ const height = held.name === name ? held.height : (heldHeights.get(name) ?? null);
92
+ const setHeight = useCallback((next) => setHeld({ name, height: next }), [name]);
93
+ const settle = useCallback(() => {
94
+ const top = upper.current;
95
+ const pane = lower.current;
96
+ if (top === null || pane === null)
97
+ return;
98
+ const inner = pane.querySelector(lowerScroller);
99
+ // Until a drag each region takes the share the stylesheet gives it (the
100
+ // shorter one as tall as its rows, up to a cap); a dragged height holds
101
+ // the lower pane there and gives the upper list the rest.
102
+ pane.style.flex = height === null ? '' : `0 0 ${height}px`;
103
+ pane.style.maxHeight = height === null ? '' : 'none';
104
+ top.style.flex = height === null ? '' : '1 1 0';
105
+ top.style.maxHeight = height === null ? '' : 'none';
106
+ if (inner !== null)
107
+ inner.style.maxHeight = '';
108
+ const floor = upperFloor(top);
109
+ // A height dragged in a taller window gives way in a shorter one, so the
110
+ // upper list keeps its floor; the drag itself is kept for when the room
111
+ // comes back.
112
+ if (height !== null) {
113
+ const room = splitRoom(top, pane);
114
+ const least = Number.parseFloat(getComputedStyle(pane).minHeight) || 0;
115
+ const fitted = heldSplitHeight(height, room, { floor, least });
116
+ if (fitted !== height)
117
+ pane.style.flex = `0 0 ${fitted}px`;
118
+ }
119
+ const cut = cutRowDepth(top);
120
+ if (cut > 0) {
121
+ const paneHeight = pane.getBoundingClientRect().height;
122
+ const room = top.getBoundingClientRect().height - floor;
123
+ // The cut slice goes to the lower pane, past the cap its stylesheet
124
+ // gives it at rest; an upper list already at its floor keeps its
125
+ // slice rather than overflow the page.
126
+ if (cut <= room) {
127
+ pane.style.flexBasis = `${paneHeight + cut}px`;
128
+ pane.style.maxHeight = `${paneHeight + cut}px`;
129
+ }
130
+ }
131
+ if (inner !== null) {
132
+ const innerCut = cutRowDepth(inner);
133
+ if (innerCut > 0)
134
+ inner.style.maxHeight = `${inner.clientHeight - innerCut}px`;
135
+ }
136
+ }, [height, lowerScroller]);
137
+ useLayoutEffect(settle, [settle, layoutKey]);
138
+ // Observed again when the layout changes, so a list that mounts after a
139
+ // load (its ref null at first) is watched from then on.
140
+ useEffect(() => {
141
+ const frame = upper.current?.parentElement;
142
+ if (frame === null || frame === undefined || typeof ResizeObserver === 'undefined') {
143
+ return undefined;
144
+ }
145
+ const observer = new ResizeObserver(() => settle());
146
+ observer.observe(frame);
147
+ return () => observer.disconnect();
148
+ }, [settle, layoutKey]);
149
+ useEffect(() => () => drag.current?.abort(), []);
150
+ const start = (event) => {
151
+ const top = upper.current;
152
+ const pane = lower.current;
153
+ if (top === null || pane === null || event.button !== 0)
154
+ return;
155
+ event.preventDefault();
156
+ drag.current?.abort();
157
+ const listeners = new AbortController();
158
+ const startY = event.clientY;
159
+ const startHeight = pane.getBoundingClientRect().height;
160
+ const least = Number.parseFloat(getComputedStyle(pane).minHeight) || 0;
161
+ const most = startHeight + top.getBoundingClientRect().height - upperFloor(top);
162
+ let latest = startHeight;
163
+ const end = () => {
164
+ listeners.abort();
165
+ heldHeights.set(name, latest);
166
+ };
167
+ drag.current = listeners;
168
+ window.addEventListener('pointermove', (moved) => {
169
+ latest = Math.round(Math.min(most, Math.max(least, startHeight - (moved.clientY - startY))));
170
+ setHeight(latest);
171
+ }, { signal: listeners.signal });
172
+ window.addEventListener('pointerup', end, { signal: listeners.signal });
173
+ window.addEventListener('pointercancel', end, { signal: listeners.signal });
174
+ };
175
+ const reset = () => {
176
+ heldHeights.delete(name);
177
+ setHeight(null);
178
+ };
179
+ return { upper, lower, drag: start, reset };
180
+ }
181
+ /**
182
+ * The splitter's band, between the upper list and the lower pane: the
183
+ * resize cursor over the hairline that divides them. A double click puts
184
+ * the divide back at the page's own share. The pointer drags it; the keys
185
+ * reach both lists without it.
186
+ */
187
+ export function PaneSplitter({ split }) {
188
+ return (_jsx("div", { "aria-hidden": true, className: "pane-splitter", onDoubleClick: split.reset, onPointerDown: split.drag }));
189
+ }
190
+ /**
191
+ * The pane under a page's list, under its `PaneSplitter`: as tall as what
192
+ * it shows until dragged, up to 38% of the page and never under seven
193
+ * dense rows, its body scrolling under its head.
194
+ */
195
+ export function SplitDetail({ split, folded = false, label, head, children }) {
196
+ return (_jsxs("section", { "aria-label": label, className: folded ? 'split-detail folded' : 'split-detail', ref: split.lower, children: [head, folded ? null : _jsx("div", { className: "split-detail-body", children: children })] }));
197
+ }
@@ -0,0 +1,35 @@
1
+ import type { ReactElement } from 'react';
2
+ /** Props for {@link SidebarResizer}. */
3
+ export interface SidebarResizerProps {
4
+ /** The sidebar's width now, in pixels. */
5
+ readonly width: number;
6
+ /** The narrowest the drag makes it. */
7
+ readonly min: number;
8
+ /** The widest the drag makes it, whatever the room. */
9
+ readonly max: number;
10
+ /** The least the page beside it keeps; the drag stops there. */
11
+ readonly pageMin: number;
12
+ /** The separator's accessible name ("Resize the sidebar"). */
13
+ readonly label: string;
14
+ /** Hears each width the drag reaches. */
15
+ readonly onResize: (width: number) => void;
16
+ /** Hears the width the drag ends on, to keep. */
17
+ readonly onResizeEnd: (width: number) => void;
18
+ }
19
+ /**
20
+ * The width a drag of the sidebar's edge gives: the start width moved by
21
+ * the pointer, kept between `min` and the widest the room allows (`max`,
22
+ * and the room less `pageMin`; `max` alone before the room is laid out),
23
+ * in whole pixels.
24
+ */
25
+ export declare function draggedWidth(start: number, moved: number, room: number, bounds: {
26
+ readonly min: number;
27
+ readonly max: number;
28
+ readonly pageMin: number;
29
+ }): number;
30
+ /**
31
+ * The sidebar's edge (`window-frame-resizer`), in the gap beside the page:
32
+ * the pointer drags it, the width following the pointer and kept on
33
+ * release. It measures the room from the window frame it stands in.
34
+ */
35
+ export declare function SidebarResizer({ width, min, max, pageMin, label, onResize, onResizeEnd }: SidebarResizerProps): ReactElement;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * The width a drag of the sidebar's edge gives: the start width moved by
4
+ * the pointer, kept between `min` and the widest the room allows (`max`,
5
+ * and the room less `pageMin`; `max` alone before the room is laid out),
6
+ * in whole pixels.
7
+ */
8
+ export function draggedWidth(start, moved, room, bounds) {
9
+ const widest = room > 0 ? Math.min(bounds.max, Math.max(bounds.min, room - bounds.pageMin)) : bounds.max;
10
+ return Math.round(Math.min(widest, Math.max(bounds.min, start + moved)));
11
+ }
12
+ /**
13
+ * The sidebar's edge (`window-frame-resizer`), in the gap beside the page:
14
+ * the pointer drags it, the width following the pointer and kept on
15
+ * release. It measures the room from the window frame it stands in.
16
+ */
17
+ export function SidebarResizer({ width, min, max, pageMin, label, onResize, onResizeEnd }) {
18
+ const start = (event) => {
19
+ if (event.button !== 0)
20
+ return;
21
+ event.preventDefault();
22
+ const handle = event.currentTarget;
23
+ const frame = handle.closest('.window-frame, .space-root') ?? handle.parentElement;
24
+ const room = frame?.getBoundingClientRect().width ?? 0;
25
+ const startX = event.clientX;
26
+ let last = width;
27
+ handle.setPointerCapture?.(event.pointerId);
28
+ const move = (next) => {
29
+ last = draggedWidth(width, next.clientX - startX, room, { min, max, pageMin });
30
+ onResize(last);
31
+ };
32
+ const end = () => {
33
+ handle.removeEventListener('pointermove', move);
34
+ handle.removeEventListener('pointerup', end);
35
+ handle.removeEventListener('pointercancel', end);
36
+ onResizeEnd(last);
37
+ };
38
+ handle.addEventListener('pointermove', move);
39
+ handle.addEventListener('pointerup', end);
40
+ handle.addEventListener('pointercancel', end);
41
+ };
42
+ return (_jsx("div", { "aria-label": label, "aria-orientation": "vertical", "aria-valuemax": max, "aria-valuemin": min, "aria-valuenow": width, className: "window-frame-resizer", onPointerDown: start, role: "separator" }));
43
+ }
@@ -0,0 +1,20 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import type { ReactElement } from 'react';
3
+ /** A status notice's tone: plain news, a failure, or an outcome that went well. */
4
+ export type StatusNoticeTone = 'info' | 'danger' | 'success';
5
+ /** Props for {@link StatusNotice}. */
6
+ export interface StatusNoticeProps {
7
+ readonly tone?: StatusNoticeTone;
8
+ /** The tone's glyph. */
9
+ readonly icon: LucideIcon;
10
+ /** The message, on one line, cut with an ellipsis and whole in its tooltip. */
11
+ readonly text: string;
12
+ }
13
+ /**
14
+ * A message about the window (an outcome, a step the host refused) as a
15
+ * pane's status line while it stands, in place of the line's own words
16
+ * (`PaneStatus`'s children): the tone's glyph and the words in the text
17
+ * colour on one line, a failure announced as an alert and anything else as
18
+ * a status. Its verbs (Show, Close) go in the status line's tools.
19
+ */
20
+ export declare function StatusNotice({ tone, icon: Icon, text }: StatusNoticeProps): ReactElement;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ICON_SM } from '../icon/sizes.js';
3
+ import { cutTooltip } from '../tooltip/Tooltip.logic.js';
4
+ /**
5
+ * A message about the window (an outcome, a step the host refused) as a
6
+ * pane's status line while it stands, in place of the line's own words
7
+ * (`PaneStatus`'s children): the tone's glyph and the words in the text
8
+ * colour on one line, a failure announced as an alert and anything else as
9
+ * a status. Its verbs (Show, Close) go in the status line's tools.
10
+ */
11
+ export function StatusNotice({ tone = 'info', icon: Icon, text }) {
12
+ return (_jsxs("span", { className: tone === 'info' ? 'status-notice' : `status-notice ${tone}`, role: tone === 'danger' ? 'alert' : 'status', children: [_jsx(Icon, { "aria-hidden": true, size: ICON_SM }), _jsx("span", { className: "status-notice-text", ...cutTooltip(text), children: text })] }));
13
+ }
@@ -0,0 +1,140 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import { type KeyboardEvent, type ReactElement, type ReactNode, type Ref } from 'react';
3
+ import type { RegionHandlers } from '../pane/Pane.js';
4
+ /** Props for {@link TreePane}. */
5
+ export interface TreePaneProps extends RegionHandlers {
6
+ /** The width the host keeps, in pixels; none takes `--sidebar-width` (240px). */
7
+ readonly width?: number;
8
+ /** The pane holds the keyboard: its frame wears the accent. */
9
+ readonly active?: boolean;
10
+ readonly label?: string;
11
+ readonly ref?: Ref<HTMLElement>;
12
+ /** Its path bar, quick row (`FilterChips`), `TreeList`, and status line. */
13
+ readonly children: ReactNode;
14
+ }
15
+ /**
16
+ * The sidebar's pane, which holds a tree: a pane at the sidebar's width
17
+ * whose rows lay out as the chevron's slot, the node's glyph, its name, and
18
+ * one trailing column. Narrower than its title and its tools side by side,
19
+ * its path bar takes a line for each.
20
+ */
21
+ export declare function TreePane({ width, active, label, ref, children, ...handlers }: TreePaneProps): ReactElement;
22
+ /** Props for {@link TreeList}. */
23
+ export interface TreeListProps extends RegionHandlers {
24
+ /** The tree's accessible name ("Services"). */
25
+ readonly label: string;
26
+ readonly ref?: Ref<HTMLDivElement>;
27
+ /** Its `TreeRow`s and `TreeTool`s, in order. */
28
+ readonly children: ReactNode;
29
+ }
30
+ /**
31
+ * The tree's rows in the sidebar's scrolling list: the sidebar's home
32
+ * (`data-pane-home="sidebar"`), which `usePaneKeys` hands the focus and
33
+ * finds the sidebar pane by, focusable by script and out of the Tab order.
34
+ * Each row steps in by its level. While the list holds the focus, its
35
+ * active descendant is the cursor row, so a screen reader follows the
36
+ * cursor the keys move.
37
+ */
38
+ export declare function TreeList({ label, ref, children, ...handlers }: TreeListProps): ReactElement;
39
+ /**
40
+ * What a tree row is: a node, a band that heads the rows under it (a
41
+ * server, a project) on the strip's ground with a hairline under it, or a
42
+ * group whose name reads as a heading over its rows.
43
+ */
44
+ export type TreeRowKind = 'node' | 'band' | 'group';
45
+ /** A tree row's disclosure: whether its children show, how to toggle them, and the chevron's name. */
46
+ export interface TreeRowToggle {
47
+ readonly open: boolean;
48
+ readonly onToggle: () => void;
49
+ /** The chevron's accessible name ("Expand shop", "Collapse shop"). */
50
+ readonly label: string;
51
+ }
52
+ /** Props for {@link TreeRow}. */
53
+ export interface TreeRowProps {
54
+ /** Names the row to the pane's cursor (`data-row-key`); unique in its pane. */
55
+ readonly rowKey: string;
56
+ /** How deep it stands: 0 at the tree's root. */
57
+ readonly level?: number;
58
+ readonly kind?: TreeRowKind;
59
+ /** A row with children: its chevron; none leaves the chevron's slot empty. */
60
+ readonly toggle?: TreeRowToggle;
61
+ /** The node's glyph, in the quiet tone. */
62
+ readonly glyph?: ReactNode;
63
+ readonly name: ReactNode;
64
+ /** Quieter words after the name ("×3"). */
65
+ readonly detail?: ReactNode;
66
+ /** The trailing column: a count, a port, a state (`StateMark`). */
67
+ readonly trailing?: ReactNode;
68
+ /** The row's own tool (Hide), shown on the cursor row only. */
69
+ readonly tool?: ReactNode;
70
+ /** Marked as chosen though it is not the cursor row (the page the main pane shows). */
71
+ readonly marked?: boolean;
72
+ /** Opens the row's item on a click anywhere but its controls. */
73
+ readonly onOpen?: () => void;
74
+ /** The row itself takes the focus: in the Tab order while it is the cursor row. */
75
+ readonly focusable?: boolean;
76
+ }
77
+ /**
78
+ * One row of a sidebar's tree: the chevron's slot, the glyph, the name (cut
79
+ * with an ellipsis, whole in its tooltip) with its quieter detail, then its
80
+ * trailing column and its own tool. Like a listing's `Row`, it follows the
81
+ * pane's cursor (`RowCursorContext`), wearing the cursor row's look and
82
+ * `aria-current`; the pointer moving over it or the focus entering it moves
83
+ * the cursor there. Its controls leave the Tab order, since the tree's keys
84
+ * run them. The expansion and its keys stay the host's.
85
+ */
86
+ export declare function TreeRow({ rowKey, level, kind, toggle, glyph, name, detail, trailing, tool, marked, onOpen, focusable }: TreeRowProps): ReactElement;
87
+ /**
88
+ * What a tree's tool row is: a plain tool (a filter field, a pager, an Add
89
+ * action), a note under a node (past the chevron's slot), a heading over a
90
+ * group further down, or a read that failed (its reason wraps, its action
91
+ * under it).
92
+ */
93
+ export type TreeToolKind = 'tool' | 'note' | 'heading' | 'danger';
94
+ /** Props for {@link TreeTool}. */
95
+ export interface TreeToolProps {
96
+ readonly kind?: TreeToolKind;
97
+ /** How deep it stands, as the rows around it. */
98
+ readonly level?: number;
99
+ /** Its glyph, before the words. */
100
+ readonly icon?: LucideIcon;
101
+ /** Its words. */
102
+ readonly text?: ReactNode;
103
+ /** The pane's cursor stands on it. */
104
+ readonly cursor?: boolean;
105
+ /** Its control after the words: a `TreeFilterInput`, a pager, an action. */
106
+ readonly children?: ReactNode;
107
+ }
108
+ /**
109
+ * A row of a tree that is not a node, at its level's indent in the small
110
+ * size: a filter field, a pager, a note, a heading, or a failed read with
111
+ * its action.
112
+ */
113
+ export declare function TreeTool({ kind, level, icon: Icon, text, cursor, children }: TreeToolProps): ReactElement;
114
+ /** Props for {@link TreeFilterInput}. */
115
+ export interface TreeFilterInputProps {
116
+ readonly value: string;
117
+ /** Hears each edit. */
118
+ readonly onChange: (value: string) => void;
119
+ /** Its accessible name ("Filter services"). */
120
+ readonly label: string;
121
+ readonly placeholder?: string;
122
+ /** The host's keys while it holds the keyboard (Escape clears, ↓ goes to the rows). */
123
+ readonly onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
124
+ readonly ref?: Ref<HTMLInputElement>;
125
+ }
126
+ /**
127
+ * A tree's filter field: a bare field that fills its `TreeTool` row, the
128
+ * row underlined in the accent while the field holds the keyboard.
129
+ */
130
+ export declare function TreeFilterInput({ value, onChange, label, placeholder, onKeyDown, ref }: TreeFilterInputProps): ReactElement;
131
+ /** Props for {@link SidebarEmpty}. */
132
+ export interface SidebarEmptyProps {
133
+ /** What it says ("No services yet."). */
134
+ readonly children: ReactNode;
135
+ }
136
+ /**
137
+ * A sidebar with nothing to list, saying so as a quiet row in the rows'
138
+ * place: from where a row's icon starts, dim, one row high.
139
+ */
140
+ export declare function SidebarEmpty({ children }: SidebarEmptyProps): ReactElement;