@bigpixelrocket/uiok 0.3.0 → 0.5.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.
- package/CHANGELOG.md +50 -1
- package/dist/button/TextLink.d.ts +19 -3
- package/dist/button/TextLink.js +4 -3
- package/dist/dialog/ConfirmDialog.d.ts +7 -1
- package/dist/dialog/ConfirmDialog.js +2 -2
- package/dist/dialog/ModalDialog.js +8 -2
- package/dist/dialog/ProgressDialog.d.ts +7 -1
- package/dist/dialog/ProgressDialog.js +2 -2
- package/dist/dialog/TypedNameDialog.d.ts +8 -0
- package/dist/field/Check.d.ts +9 -2
- package/dist/field/Check.js +5 -4
- package/dist/field/Controls.d.ts +198 -0
- package/dist/field/Controls.js +94 -0
- package/dist/field/FieldLayout.d.ts +126 -0
- package/dist/field/FieldLayout.js +89 -0
- package/dist/field/index.d.ts +9 -6
- package/dist/field/index.js +9 -6
- package/dist/frame/Dock.js +1 -1
- package/dist/frame/SidebarResizer.js +1 -1
- package/dist/frame/Tree.d.ts +17 -4
- package/dist/frame/Tree.js +34 -9
- package/dist/frame/WindowFrame.js +2 -1
- package/dist/frame/frame.css +26 -4
- package/dist/icon/ProductMark.d.ts +57 -0
- package/dist/icon/ProductMark.js +26 -0
- package/dist/icon/icon.css +53 -0
- package/dist/icon/index.d.ts +3 -1
- package/dist/icon/index.js +3 -1
- package/dist/labels/UiokLabels.d.ts +3 -0
- package/dist/labels/UiokLabels.js +3 -1
- package/dist/labels/index.d.ts +1 -0
- package/dist/labels/index.js +1 -0
- package/dist/labels/settings.d.ts +6 -0
- package/dist/labels/settings.js +1 -0
- package/dist/labels/viewer.d.ts +193 -0
- package/dist/labels/viewer.js +124 -0
- package/dist/listing/Listing.d.ts +60 -4
- package/dist/listing/Listing.js +39 -10
- package/dist/listing/ListingScope.d.ts +7 -0
- package/dist/listing/ListingScope.js +8 -0
- package/dist/listing/PaneMessage.d.ts +28 -0
- package/dist/listing/PaneMessage.js +12 -0
- package/dist/listing/Timeline.d.ts +51 -0
- package/dist/listing/Timeline.js +28 -0
- package/dist/listing/index.d.ts +7 -3
- package/dist/listing/index.js +6 -2
- package/dist/listing/listing.css +185 -22
- package/dist/log/Ansi.logic.d.ts +27 -0
- package/dist/log/Ansi.logic.js +203 -0
- package/dist/log/LogWell.d.ts +11 -2
- package/dist/log/LogWell.js +15 -3
- package/dist/log/index.d.ts +1 -0
- package/dist/log/index.js +1 -0
- package/dist/log/log.css +80 -0
- package/dist/menu/Menu.d.ts +89 -0
- package/dist/menu/Menu.js +143 -0
- package/dist/menu/Menu.logic.d.ts +56 -0
- package/dist/menu/Menu.logic.js +64 -0
- package/dist/menu/index.d.ts +5 -1
- package/dist/menu/index.js +5 -1
- package/dist/menu/menu.css +51 -0
- package/dist/palette/Palette.d.ts +3 -2
- package/dist/palette/Palette.js +8 -4
- package/dist/palette/PaletteRows.d.ts +129 -0
- package/dist/palette/PaletteRows.js +74 -0
- package/dist/palette/index.d.ts +5 -2
- package/dist/palette/index.js +5 -2
- package/dist/pane/PaneFrame.d.ts +22 -1
- package/dist/pane/PaneFrame.js +42 -5
- package/dist/pane/index.d.ts +1 -1
- package/dist/shell/SettingsDialog.d.ts +20 -2
- package/dist/shell/SettingsDialog.js +13 -3
- package/dist/shell/index.d.ts +1 -1
- package/dist/styles.css +4 -0
- package/dist/surface/Card.d.ts +18 -0
- package/dist/surface/Card.js +10 -0
- package/dist/surface/FactTable.d.ts +44 -0
- package/dist/surface/FactTable.js +33 -0
- package/dist/surface/Notice.d.ts +45 -0
- package/dist/surface/Notice.js +27 -0
- package/dist/surface/index.d.ts +7 -3
- package/dist/surface/index.js +7 -3
- package/dist/surface/surface.css +64 -0
- package/dist/tabs/PageTabs.d.ts +6 -0
- package/dist/tabs/PageTabs.js +1 -1
- package/dist/tabs/tabs.css +14 -0
- package/dist/terminal/TerminalBox.d.ts +30 -0
- package/dist/terminal/TerminalBox.js +17 -0
- package/dist/terminal/index.d.ts +3 -1
- package/dist/terminal/index.js +3 -1
- package/dist/terminal/terminal.css +29 -0
- package/dist/themes/themes.generated.css +21 -0
- package/dist/themes/tokens.d.ts +1 -0
- package/dist/themes/tokens.js +16 -1
- package/dist/viewer/AudioView.d.ts +13 -0
- package/dist/viewer/AudioView.js +25 -0
- package/dist/viewer/HexJump.logic.d.ts +16 -0
- package/dist/viewer/HexJump.logic.js +27 -0
- package/dist/viewer/HexRows.logic.d.ts +55 -0
- package/dist/viewer/HexRows.logic.js +84 -0
- package/dist/viewer/HexSelection.logic.d.ts +57 -0
- package/dist/viewer/HexSelection.logic.js +68 -0
- package/dist/viewer/HexView.d.ts +10 -0
- package/dist/viewer/HexView.js +291 -0
- package/dist/viewer/HexViewport.logic.d.ts +61 -0
- package/dist/viewer/HexViewport.logic.js +79 -0
- package/dist/viewer/ImageView.d.ts +19 -0
- package/dist/viewer/ImageView.js +230 -0
- package/dist/viewer/ImageZoom.logic.d.ts +65 -0
- package/dist/viewer/ImageZoom.logic.js +119 -0
- package/dist/viewer/LatestRead.logic.d.ts +27 -0
- package/dist/viewer/LatestRead.logic.js +55 -0
- package/dist/viewer/MediaControls.d.ts +25 -0
- package/dist/viewer/MediaControls.js +183 -0
- package/dist/viewer/MediaPlayer.logic.d.ts +53 -0
- package/dist/viewer/MediaPlayer.logic.js +68 -0
- package/dist/viewer/PdfView.d.ts +23 -0
- package/dist/viewer/PdfView.js +25 -0
- package/dist/viewer/QuietFocus.d.ts +19 -0
- package/dist/viewer/QuietFocus.js +27 -0
- package/dist/viewer/ScaledScroll.logic.d.ts +30 -0
- package/dist/viewer/ScaledScroll.logic.js +28 -0
- package/dist/viewer/ScaledScrollbar.d.ts +19 -0
- package/dist/viewer/ScaledScrollbar.js +71 -0
- package/dist/viewer/SyntaxHighlighter.d.ts +29 -0
- package/dist/viewer/SyntaxHighlighter.js +144 -0
- package/dist/viewer/SyntaxLanguage.logic.d.ts +110 -0
- package/dist/viewer/SyntaxLanguage.logic.js +283 -0
- package/dist/viewer/SyntaxService.d.ts +75 -0
- package/dist/viewer/SyntaxService.js +49 -0
- package/dist/viewer/SyntaxSession.logic.d.ts +78 -0
- package/dist/viewer/SyntaxSession.logic.js +221 -0
- package/dist/viewer/SyntaxWorker.d.ts +6 -0
- package/dist/viewer/SyntaxWorker.js +8 -0
- package/dist/viewer/TextEncoding.logic.d.ts +35 -0
- package/dist/viewer/TextEncoding.logic.js +58 -0
- package/dist/viewer/TextRows.logic.d.ts +86 -0
- package/dist/viewer/TextRows.logic.js +241 -0
- package/dist/viewer/TextSelection.logic.d.ts +97 -0
- package/dist/viewer/TextSelection.logic.js +139 -0
- package/dist/viewer/TextView.d.ts +13 -0
- package/dist/viewer/TextView.js +448 -0
- package/dist/viewer/TextViewport.logic.d.ts +70 -0
- package/dist/viewer/TextViewport.logic.js +116 -0
- package/dist/viewer/VideoView.d.ts +18 -0
- package/dist/viewer/VideoView.js +53 -0
- package/dist/viewer/ViewerClipboard.d.ts +30 -0
- package/dist/viewer/ViewerClipboard.js +70 -0
- package/dist/viewer/ViewerFrame.logic.d.ts +61 -0
- package/dist/viewer/ViewerFrame.logic.js +130 -0
- package/dist/viewer/ViewerKeys.d.ts +16 -0
- package/dist/viewer/ViewerKeys.js +14 -0
- package/dist/viewer/ViewerScope.d.ts +12 -0
- package/dist/viewer/ViewerScope.js +22 -0
- package/dist/viewer/ViewerViews.d.ts +28 -0
- package/dist/viewer/ViewerViews.js +22 -0
- package/dist/viewer/ViewerWindow.d.ts +53 -0
- package/dist/viewer/ViewerWindow.js +219 -0
- package/dist/viewer/index.d.ts +12 -0
- package/dist/viewer/index.js +12 -0
- package/dist/viewer/types.d.ts +151 -0
- package/dist/viewer/types.js +26 -0
- package/dist/viewer/useElementHeight.d.ts +6 -0
- package/dist/viewer/useElementHeight.js +22 -0
- package/dist/viewer/useElementSize.d.ts +7 -0
- package/dist/viewer/useElementSize.js +24 -0
- package/dist/viewer/useEscapeToClear.d.ts +8 -0
- package/dist/viewer/useEscapeToClear.js +26 -0
- package/dist/viewer/useHexDocument.d.ts +41 -0
- package/dist/viewer/useHexDocument.js +144 -0
- package/dist/viewer/useMediaElement.d.ts +10 -0
- package/dist/viewer/useMediaElement.js +24 -0
- package/dist/viewer/useSyntaxHighlight.d.ts +24 -0
- package/dist/viewer/useSyntaxHighlight.js +133 -0
- package/dist/viewer/useTextDocument.d.ts +66 -0
- package/dist/viewer/useTextDocument.js +245 -0
- package/dist/viewer/viewer.css +645 -0
- package/package.json +7 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** The room a menu keeps from the window's edges, and the gap it leaves under what it drops from, in pixels. */
|
|
2
|
+
export const MENU_MARGIN = 4;
|
|
3
|
+
/** Clamps `start` so `extent` fits between the margins of `room`; the margin wins where it cannot. */
|
|
4
|
+
const clamp = (start, extent, room) => Math.max(MENU_MARGIN, Math.min(start, room - MENU_MARGIN - extent));
|
|
5
|
+
/**
|
|
6
|
+
* Where a menu stands, its top-left corner in window coordinates. Opened at
|
|
7
|
+
* a point, it hangs down and right from it, moved in to stay inside the
|
|
8
|
+
* window, and opens upward from the point when there is no room below.
|
|
9
|
+
* Dropped from a box, it starts under the box's leading edge, a margin
|
|
10
|
+
* below, and stands over the box instead when there is room above and none
|
|
11
|
+
* below; either way it stays inside the window. A menu its stylesheet
|
|
12
|
+
* caps at the window's height less both margins (`.menu-popup`) measures
|
|
13
|
+
* at that cap, so it starts at the top margin.
|
|
14
|
+
*/
|
|
15
|
+
export function placeMenu(from, size, viewport) {
|
|
16
|
+
const room = (top) => top + size.height <= viewport.height - MENU_MARGIN;
|
|
17
|
+
if ('point' in from) {
|
|
18
|
+
const { x, y } = from.point;
|
|
19
|
+
const top = room(y) || y - size.height < MENU_MARGIN ? y : y - size.height;
|
|
20
|
+
return {
|
|
21
|
+
left: clamp(x, size.width, viewport.width),
|
|
22
|
+
top: clamp(top, size.height, viewport.height)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const { box } = from;
|
|
26
|
+
const below = box.bottom + MENU_MARGIN;
|
|
27
|
+
const above = box.top - MENU_MARGIN - size.height;
|
|
28
|
+
const top = room(below) || above < MENU_MARGIN ? below : above;
|
|
29
|
+
return {
|
|
30
|
+
left: clamp(box.left, size.width, viewport.width),
|
|
31
|
+
top: clamp(top, size.height, viewport.height)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The menu's keys, as a desktop menu's: ↑ and ↓ move the cursor over the
|
|
36
|
+
* items that can run, Home and End to the first and the last, Return and
|
|
37
|
+
* Space run the cursor's item, Escape and Tab close it. A chord with a
|
|
38
|
+
* modifier is not the menu's (null), and neither is any other key.
|
|
39
|
+
*/
|
|
40
|
+
export function menuKeyAction(event) {
|
|
41
|
+
if (event.metaKey || event.ctrlKey || event.altKey)
|
|
42
|
+
return null;
|
|
43
|
+
if (event.key === 'Tab')
|
|
44
|
+
return { kind: 'close' };
|
|
45
|
+
if (event.shiftKey)
|
|
46
|
+
return null;
|
|
47
|
+
switch (event.key) {
|
|
48
|
+
case 'ArrowUp':
|
|
49
|
+
return { kind: 'move', delta: -1 };
|
|
50
|
+
case 'ArrowDown':
|
|
51
|
+
return { kind: 'move', delta: 1 };
|
|
52
|
+
case 'Home':
|
|
53
|
+
return { kind: 'edge', to: 'first' };
|
|
54
|
+
case 'End':
|
|
55
|
+
return { kind: 'edge', to: 'last' };
|
|
56
|
+
case 'Enter':
|
|
57
|
+
case ' ':
|
|
58
|
+
return { kind: 'run' };
|
|
59
|
+
case 'Escape':
|
|
60
|
+
return { kind: 'close' };
|
|
61
|
+
default:
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
package/dist/menu/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Menus: `Menu`, a menu of verbs or places opened at a point or dropped
|
|
3
|
+
* from an element, with `placeMenu` and `menuKeyAction` under it; and for
|
|
4
|
+
* filtered menus: the fuzzy matcher (`matchQuery`), the rules every filtered
|
|
3
5
|
* menu and palette shares (a refused keystroke, the cursor's moves, the trail
|
|
4
6
|
* of levels opened in place), the visual bell's beat, and the menu look in
|
|
5
7
|
* menu.css under `.listing-root`.
|
|
@@ -7,3 +9,5 @@
|
|
|
7
9
|
export { hasNegativeTerms, hasQueryTerms, matchQuery, type FuzzyMatch } from './fuzzyMatch.js';
|
|
8
10
|
export { enteredLevel, leftLevel, menuQueryRefused, movedPickableCursor, moveMenuCursor, pickableCursor, returnedCursor, trailLevel, type LevelReturn, type LevelStep, type PickableRow } from './MenuQuery.logic.js';
|
|
9
11
|
export { useBellBeat } from './useBellBeat.js';
|
|
12
|
+
export { Menu, type MenuEntry, type MenuHeadingEntry, type MenuItemEntry, type MenuProps, type MenuSeparatorEntry } from './Menu.js';
|
|
13
|
+
export { MENU_MARGIN, menuKeyAction, placeMenu, type MenuBox, type MenuKeyAction, type MenuPoint, type MenuSize } from './Menu.logic.js';
|
package/dist/menu/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Menus: `Menu`, a menu of verbs or places opened at a point or dropped
|
|
3
|
+
* from an element, with `placeMenu` and `menuKeyAction` under it; and for
|
|
4
|
+
* filtered menus: the fuzzy matcher (`matchQuery`), the rules every filtered
|
|
3
5
|
* menu and palette shares (a refused keystroke, the cursor's moves, the trail
|
|
4
6
|
* of levels opened in place), the visual bell's beat, and the menu look in
|
|
5
7
|
* menu.css under `.listing-root`.
|
|
@@ -7,3 +9,5 @@
|
|
|
7
9
|
export { hasNegativeTerms, hasQueryTerms, matchQuery } from './fuzzyMatch.js';
|
|
8
10
|
export { enteredLevel, leftLevel, menuQueryRefused, movedPickableCursor, moveMenuCursor, pickableCursor, returnedCursor, trailLevel } from './MenuQuery.logic.js';
|
|
9
11
|
export { useBellBeat } from './useBellBeat.js';
|
|
12
|
+
export { Menu } from './Menu.js';
|
|
13
|
+
export { MENU_MARGIN, menuKeyAction, placeMenu } from './Menu.logic.js';
|
package/dist/menu/menu.css
CHANGED
|
@@ -361,3 +361,54 @@
|
|
|
361
361
|
transform: translateX(2px);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
+
|
|
365
|
+
/* ---- A menu opened at a point or dropped from an element (Menu) ----
|
|
366
|
+
|
|
367
|
+
The menu surface on the document's body, fixed where placeMenu puts it
|
|
368
|
+
(the component sets left and top), above dialogs, since a dialog's own
|
|
369
|
+
controls open menus too. As wide as its longest item, within reason, and
|
|
370
|
+
never taller than the window less placeMenu's margin at either edge
|
|
371
|
+
(MENU_MARGIN, --space-2): a longer menu scrolls, and the keys bring the
|
|
372
|
+
cursor's item into view. The cap holds its padding and border too
|
|
373
|
+
(border-box), and no entry shrinks to fit it (a row keeps its height, a
|
|
374
|
+
separator its line): the menu scrolls instead. */
|
|
375
|
+
.folder-menu.menu-popup {
|
|
376
|
+
position: fixed;
|
|
377
|
+
box-sizing: border-box;
|
|
378
|
+
top: 0;
|
|
379
|
+
left: 0;
|
|
380
|
+
z-index: var(--z-dialog-popover);
|
|
381
|
+
width: auto;
|
|
382
|
+
min-width: 180px;
|
|
383
|
+
max-width: min(480px, calc(100vw - 2 * var(--space-4)));
|
|
384
|
+
max-height: calc(100vh - 2 * var(--space-2));
|
|
385
|
+
overflow-y: auto;
|
|
386
|
+
overscroll-behavior: contain;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.folder-menu.menu-popup > * {
|
|
390
|
+
flex-shrink: 0;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/* Its icons in the quiet tone, at a weight the cursor row's and a
|
|
394
|
+
destructive item's rules above outrank. */
|
|
395
|
+
:where(.menu-popup) .folder-menu-option > .row-icon {
|
|
396
|
+
display: inline-flex;
|
|
397
|
+
align-items: center;
|
|
398
|
+
color: var(--text-dim);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/* An item's words and the current one's dot after them; long words give
|
|
402
|
+
way with an ellipsis, the dot never. */
|
|
403
|
+
.menu-label {
|
|
404
|
+
display: flex;
|
|
405
|
+
align-items: center;
|
|
406
|
+
min-width: 0;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.menu-label-text {
|
|
410
|
+
min-width: 0;
|
|
411
|
+
overflow: hidden;
|
|
412
|
+
text-overflow: ellipsis;
|
|
413
|
+
white-space: nowrap;
|
|
414
|
+
}
|
|
@@ -21,8 +21,9 @@ export interface PaletteProps {
|
|
|
21
21
|
* answers its own keys first. A press inside never takes the focus from the
|
|
22
22
|
* field. The caller draws the query row (`PaletteQuery`), the list, any
|
|
23
23
|
* notes, and the legend inside, and owns filtering and the cursor
|
|
24
|
-
* (`matchQuery`, `menuQueryRefused`, `moveMenuCursor`).
|
|
25
|
-
* listing scope (`.listing-root`)
|
|
24
|
+
* (`matchQuery`, `menuQueryRefused`, `moveMenuCursor`). The box carries
|
|
25
|
+
* the listing scope (`.listing-root`), so rows and listings drawn in it keep
|
|
26
|
+
* their look wherever the palette mounts.
|
|
26
27
|
*/
|
|
27
28
|
export declare function Palette({ label, className, busy, onClose, children }: PaletteProps): ReactElement;
|
|
28
29
|
/**
|
package/dist/palette/Palette.js
CHANGED
|
@@ -3,6 +3,7 @@ import { ArrowLeft } from 'lucide-react';
|
|
|
3
3
|
import { FilterIcon } from '../filter/FilterIcon.js';
|
|
4
4
|
import { ICON_SM } from '../icon/index.js';
|
|
5
5
|
import { useLabels } from '../labels/UiokProvider.js';
|
|
6
|
+
import { ListingScopeContext } from '../listing/ListingScope.js';
|
|
6
7
|
import { useBellBeat } from '../menu/useBellBeat.js';
|
|
7
8
|
import { tooltip } from '../tooltip/Tooltip.logic.js';
|
|
8
9
|
/**
|
|
@@ -25,8 +26,9 @@ const keepFocus = (event) => {
|
|
|
25
26
|
* answers its own keys first. A press inside never takes the focus from the
|
|
26
27
|
* field. The caller draws the query row (`PaletteQuery`), the list, any
|
|
27
28
|
* notes, and the legend inside, and owns filtering and the cursor
|
|
28
|
-
* (`matchQuery`, `menuQueryRefused`, `moveMenuCursor`).
|
|
29
|
-
* listing scope (`.listing-root`)
|
|
29
|
+
* (`matchQuery`, `menuQueryRefused`, `moveMenuCursor`). The box carries
|
|
30
|
+
* the listing scope (`.listing-root`), so rows and listings drawn in it keep
|
|
31
|
+
* their look wherever the palette mounts.
|
|
30
32
|
*/
|
|
31
33
|
export function Palette({ label, className, busy = false, onClose, children }) {
|
|
32
34
|
return (_jsx("div", { className: "palette-backdrop", onMouseDown: (event) => {
|
|
@@ -37,12 +39,14 @@ export function Palette({ label, className, busy = false, onClose, children }) {
|
|
|
37
39
|
// waits on a request) must not leave the keys on the page behind.
|
|
38
40
|
event.preventDefault();
|
|
39
41
|
onClose();
|
|
40
|
-
}, children: _jsx("div", { "aria-busy": busy || undefined, "aria-label": label, "aria-modal": "true", className: className === undefined
|
|
42
|
+
}, children: _jsx("div", { "aria-busy": busy || undefined, "aria-label": label, "aria-modal": "true", className: className === undefined
|
|
43
|
+
? 'folder-menu palette listing-root'
|
|
44
|
+
: `folder-menu palette listing-root ${className}`, onKeyDown: (event) => {
|
|
41
45
|
if (event.key === 'Escape' && !event.nativeEvent.isComposing) {
|
|
42
46
|
event.preventDefault();
|
|
43
47
|
onClose();
|
|
44
48
|
}
|
|
45
|
-
}, onMouseDown: keepFocus, role: "dialog", children: children }) }));
|
|
49
|
+
}, onMouseDown: keepFocus, role: "dialog", children: _jsx(ListingScopeContext, { value: true, children: children }) }) }));
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* A palette's query row: the filter mark, the level chip while the palette
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode, type Ref } from 'react';
|
|
2
|
+
/** Props for {@link PaletteList}. */
|
|
3
|
+
export interface PaletteListProps {
|
|
4
|
+
/** The listbox's id, which `PaletteQuery`'s `listId` names. */
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** The list's accessible name: "Runtimes", "PHP versions". */
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** Its rows: `PaletteOption`s, `PaletteHeading`s, and a `PaletteNote` when it is empty. */
|
|
9
|
+
readonly children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A palette's list: the listbox its query field drives, seventeen rows tall
|
|
13
|
+
* at most and fading the edge that has more (`.folder-menu-options`). The
|
|
14
|
+
* caller filters and orders the rows and keeps the cursor.
|
|
15
|
+
*/
|
|
16
|
+
export declare function PaletteList({ id, label, children }: PaletteListProps): ReactElement;
|
|
17
|
+
/**
|
|
18
|
+
* How a row's context reads: a `path` gives way at its start so the folder
|
|
19
|
+
* it ends in stays; a `sentence` (what the item is) and a `command` (what a
|
|
20
|
+
* script runs, in the code face) give way at their end.
|
|
21
|
+
*/
|
|
22
|
+
export type PaletteContextKind = 'path' | 'sentence' | 'command';
|
|
23
|
+
/** Props for {@link PaletteOption}. */
|
|
24
|
+
export interface PaletteOptionProps {
|
|
25
|
+
/** The row's id, which the query field names as its active descendant while it is the cursor. */
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/** The row's name: words, or `MarkedText` with the query's matches lit. */
|
|
28
|
+
readonly name: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The row's accessible name. Pass it whenever `name` is markup
|
|
31
|
+
* (`MarkedText`): without it the row is named by the drawn words, which a
|
|
32
|
+
* screen reader may read split at the highlights ("Po stgreSQL").
|
|
33
|
+
*/
|
|
34
|
+
readonly label?: string;
|
|
35
|
+
/** The glyph in the icon column (a `ProductMark`, a lucide icon), decorative. */
|
|
36
|
+
readonly mark?: ReactNode;
|
|
37
|
+
/** What the row says after its name, quieter: where the item is, or what it does. */
|
|
38
|
+
readonly context?: string;
|
|
39
|
+
/** How the context reads and gives way; a sentence when absent. */
|
|
40
|
+
readonly contextKind?: PaletteContextKind;
|
|
41
|
+
/** The trailing column: a version, a count (words in the quiet tone), or a `KeyChord`. */
|
|
42
|
+
readonly trail?: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Marks the row's item as the current one (the version in use, the place
|
|
45
|
+
* shown), with what current means here ("Installed", "Shown") as the dot's
|
|
46
|
+
* name: a `CurrentDot` after the trail.
|
|
47
|
+
*/
|
|
48
|
+
readonly current?: string | null;
|
|
49
|
+
/** The keyboard's cursor stands on it: the cursor fill and bar. */
|
|
50
|
+
readonly cursor?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* It cannot be picked (already added, taken): dimmed, passed over by the
|
|
53
|
+
* keys and the pointer, and its press refused. Say why in `description`.
|
|
54
|
+
*/
|
|
55
|
+
readonly disabled?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Read after the name by assistive technology, in place of what the row
|
|
58
|
+
* derives: its context, a trail in words, and what `current` means, in
|
|
59
|
+
* that order. Give it to say why the row is disabled, or to word a trail
|
|
60
|
+
* that is not text (a `KeyChord`); an empty string reads nothing after
|
|
61
|
+
* the name.
|
|
62
|
+
*/
|
|
63
|
+
readonly description?: string;
|
|
64
|
+
/** A press picks it; never called while it is disabled. */
|
|
65
|
+
readonly onPick: () => void;
|
|
66
|
+
/** The pointer moved over it, which moves the cursor there; never called while it is disabled. */
|
|
67
|
+
readonly onPoint?: () => void;
|
|
68
|
+
/** The row's element, for the caller to scroll the cursor row into view. */
|
|
69
|
+
readonly ref?: Ref<HTMLDivElement>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One option of a palette's list: its mark, its name, its context (a
|
|
73
|
+
* sentence, a path, or a command, one line, cut with an ellipsis and shown
|
|
74
|
+
* whole in its tooltip), and a trailing column (a version, a count, a
|
|
75
|
+
* chord) with the current item's dot. The cursor row wears the cursor fill
|
|
76
|
+
* and bar, its quiet words in the tone made for that fill; a disabled row
|
|
77
|
+
* is dimmed and never takes the cursor or a pick. The palette keeps the
|
|
78
|
+
* focus in its field, so a press here never takes it. Its name is `label`
|
|
79
|
+
* or its words; the context, a trail in words, and what `current` means
|
|
80
|
+
* are read after it as its description, unless `description` says it.
|
|
81
|
+
*/
|
|
82
|
+
export declare function PaletteOption({ id, name, label, mark, context, contextKind, trail, current, cursor, disabled, description, onPick, onPoint, ref }: PaletteOptionProps): ReactElement;
|
|
83
|
+
/** Props for {@link PaletteHeading}. */
|
|
84
|
+
export interface PaletteHeadingProps {
|
|
85
|
+
/** The group's name: "Installed", "Databases". */
|
|
86
|
+
readonly children: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A group's name over its rows in a palette's or a menu's list, with a
|
|
90
|
+
* hairline running out from it, exactly one row tall so the list still
|
|
91
|
+
* ends on a whole row. Drawn, not listed: assistive technology hears the
|
|
92
|
+
* options alone.
|
|
93
|
+
*/
|
|
94
|
+
export declare function PaletteHeading({ children }: PaletteHeadingProps): ReactElement;
|
|
95
|
+
/** Props for {@link PaletteNote}. */
|
|
96
|
+
export interface PaletteNoteProps {
|
|
97
|
+
/** The note's words: why the list is empty, what a key does. */
|
|
98
|
+
readonly children: ReactNode;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A note in a palette, in the interface face with its text over the rows'
|
|
102
|
+
* names, two lines at most: inside the list, why it is empty ("No runtime
|
|
103
|
+
* matches"); inside `PaletteNotes`, something about the list as a whole.
|
|
104
|
+
*/
|
|
105
|
+
export declare function PaletteNote({ children }: PaletteNoteProps): ReactElement;
|
|
106
|
+
/** Props for {@link PaletteFailure}. */
|
|
107
|
+
export interface PaletteFailureProps {
|
|
108
|
+
/** What failed, in strong words: "Could not install PHP 8.5.4." */
|
|
109
|
+
readonly message: string;
|
|
110
|
+
/** Why, or what to do, after it: the tool's own words. */
|
|
111
|
+
readonly detail?: string | null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A failure under a palette's list, inside `PaletteNotes`: the danger glyph
|
|
115
|
+
* in the icon column, the message in strong words and its detail after,
|
|
116
|
+
* announced as an alert, and its words can be swept and copied.
|
|
117
|
+
*/
|
|
118
|
+
export declare function PaletteFailure({ message, detail }: PaletteFailureProps): ReactElement;
|
|
119
|
+
/** Props for {@link PaletteNotes}. */
|
|
120
|
+
export interface PaletteNotesProps {
|
|
121
|
+
/** `PaletteNote`s and a `PaletteFailure`. */
|
|
122
|
+
readonly children: ReactNode;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The notes under a palette's list, ruled off from it: what the list as a
|
|
126
|
+
* whole needs said, and a failure of the pick that was tried. Draw it only
|
|
127
|
+
* while it has something to say.
|
|
128
|
+
*/
|
|
129
|
+
export declare function PaletteNotes({ children }: PaletteNotesProps): ReactElement;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { CurrentDot } from '../listing/CurrentDot.js';
|
|
4
|
+
import { cutTooltip } from '../tooltip/Tooltip.logic.js';
|
|
5
|
+
/**
|
|
6
|
+
* A palette's list: the listbox its query field drives, seventeen rows tall
|
|
7
|
+
* at most and fading the edge that has more (`.folder-menu-options`). The
|
|
8
|
+
* caller filters and orders the rows and keeps the cursor.
|
|
9
|
+
*/
|
|
10
|
+
export function PaletteList({ id, label, children }) {
|
|
11
|
+
return (_jsx("div", { "aria-label": label, className: "folder-menu-options", id: id, role: "listbox", children: children }));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One option of a palette's list: its mark, its name, its context (a
|
|
15
|
+
* sentence, a path, or a command, one line, cut with an ellipsis and shown
|
|
16
|
+
* whole in its tooltip), and a trailing column (a version, a count, a
|
|
17
|
+
* chord) with the current item's dot. The cursor row wears the cursor fill
|
|
18
|
+
* and bar, its quiet words in the tone made for that fill; a disabled row
|
|
19
|
+
* is dimmed and never takes the cursor or a pick. The palette keeps the
|
|
20
|
+
* focus in its field, so a press here never takes it. Its name is `label`
|
|
21
|
+
* or its words; the context, a trail in words, and what `current` means
|
|
22
|
+
* are read after it as its description, unless `description` says it.
|
|
23
|
+
*/
|
|
24
|
+
export function PaletteOption({ id, name, label, mark, context, contextKind = 'sentence', trail, current = null, cursor = false, disabled = false, description, onPick, onPoint, ref }) {
|
|
25
|
+
// The name's own id, private to the row, so it never meets a caller's id.
|
|
26
|
+
const nameId = useId();
|
|
27
|
+
const contextClass = contextKind === 'path' ? 'palette-context' : `palette-context palette-${contextKind}`;
|
|
28
|
+
// The row is named by its name alone, which hides the words drawn after
|
|
29
|
+
// it, so those are read as its description unless the caller words one.
|
|
30
|
+
const described = description ??
|
|
31
|
+
[context, typeof trail === 'string' || typeof trail === 'number' ? String(trail) : '', current]
|
|
32
|
+
.filter((part) => typeof part === 'string' && part !== '')
|
|
33
|
+
.join(', ');
|
|
34
|
+
return (_jsxs("div", { "aria-description": described === '' ? undefined : described, "aria-disabled": disabled || undefined, "aria-label": label ?? (typeof name === 'string' ? name : undefined), "aria-labelledby": label === undefined && typeof name !== 'string' ? nameId : undefined, "aria-selected": cursor, className: cursor ? 'folder-menu-option cursor' : 'folder-menu-option', id: id, onClick: () => {
|
|
35
|
+
if (!disabled)
|
|
36
|
+
onPick();
|
|
37
|
+
}, onMouseMove: () => {
|
|
38
|
+
if (!disabled && !cursor)
|
|
39
|
+
onPoint?.();
|
|
40
|
+
}, ref: ref, role: "option", children: [_jsx("span", { "aria-hidden": true, className: "row-icon", children: mark }), _jsxs("span", { className: "palette-text", children: [_jsx("span", { className: "row-name", id: nameId, children: name }), context === undefined || context === '' ? null : (_jsx("span", { className: contextClass, ...cutTooltip(context), children: contextKind === 'path' ? _jsx("bdi", { children: context }) : context }))] }), _jsxs("span", { className: "palette-trail", children: [trail === undefined || trail === null ? null : (_jsx("span", { className: "palette-meta", children: trail })), current === null ? null : _jsx(CurrentDot, { label: current })] })] }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A group's name over its rows in a palette's or a menu's list, with a
|
|
44
|
+
* hairline running out from it, exactly one row tall so the list still
|
|
45
|
+
* ends on a whole row. Drawn, not listed: assistive technology hears the
|
|
46
|
+
* options alone.
|
|
47
|
+
*/
|
|
48
|
+
export function PaletteHeading({ children }) {
|
|
49
|
+
return (_jsx("div", { className: "entry-menu-heading", role: "presentation", children: children }));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A note in a palette, in the interface face with its text over the rows'
|
|
53
|
+
* names, two lines at most: inside the list, why it is empty ("No runtime
|
|
54
|
+
* matches"); inside `PaletteNotes`, something about the list as a whole.
|
|
55
|
+
*/
|
|
56
|
+
export function PaletteNote({ children }) {
|
|
57
|
+
return _jsx("p", { className: "folder-menu-note", children: children });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A failure under a palette's list, inside `PaletteNotes`: the danger glyph
|
|
61
|
+
* in the icon column, the message in strong words and its detail after,
|
|
62
|
+
* announced as an alert, and its words can be swept and copied.
|
|
63
|
+
*/
|
|
64
|
+
export function PaletteFailure({ message, detail = null }) {
|
|
65
|
+
return (_jsxs("p", { className: "folder-menu-note palette-failure", role: "alert", children: [_jsx("strong", { children: message }), detail === null || detail === '' ? null : ` ${detail}`] }));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The notes under a palette's list, ruled off from it: what the list as a
|
|
69
|
+
* whole needs said, and a failure of the pick that was tried. Draw it only
|
|
70
|
+
* while it has something to say.
|
|
71
|
+
*/
|
|
72
|
+
export function PaletteNotes({ children }) {
|
|
73
|
+
return _jsx("div", { className: "palette-notes", children: children });
|
|
74
|
+
}
|
package/dist/palette/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Palettes: `Palette`, the modal frame (backdrop, box, Escape, focus kept in
|
|
3
|
-
* the field),
|
|
4
|
-
* and refusal
|
|
3
|
+
* the field), `PaletteQuery`, its query row with the level chip, count,
|
|
4
|
+
* and refusal, and its rows: `PaletteList` of `PaletteOption`s under
|
|
5
|
+
* `PaletteHeading`s, with `PaletteNote`, and `PaletteNotes` holding notes
|
|
6
|
+
* and a `PaletteFailure` under the list. Styled by palette.css over the menu look, under `.listing-root`.
|
|
5
7
|
*/
|
|
6
8
|
export { Palette, PaletteQuery, type PaletteLevel, type PaletteProps, type PaletteQueryProps } from './Palette.js';
|
|
9
|
+
export { PaletteFailure, PaletteHeading, PaletteList, PaletteNote, PaletteNotes, PaletteOption, type PaletteContextKind, type PaletteFailureProps, type PaletteHeadingProps, type PaletteListProps, type PaletteNoteProps, type PaletteNotesProps, type PaletteOptionProps } from './PaletteRows.js';
|
package/dist/palette/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Palettes: `Palette`, the modal frame (backdrop, box, Escape, focus kept in
|
|
3
|
-
* the field),
|
|
4
|
-
* and refusal
|
|
3
|
+
* the field), `PaletteQuery`, its query row with the level chip, count,
|
|
4
|
+
* and refusal, and its rows: `PaletteList` of `PaletteOption`s under
|
|
5
|
+
* `PaletteHeading`s, with `PaletteNote`, and `PaletteNotes` holding notes
|
|
6
|
+
* and a `PaletteFailure` under the list. Styled by palette.css over the menu look, under `.listing-root`.
|
|
5
7
|
*/
|
|
6
8
|
export { Palette, PaletteQuery } from './Palette.js';
|
|
9
|
+
export { PaletteFailure, PaletteHeading, PaletteList, PaletteNote, PaletteNotes, PaletteOption } from './PaletteRows.js';
|
package/dist/pane/PaneFrame.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import { type MenuEntry } from '../menu/Menu.js';
|
|
2
3
|
/** A crumb that is a control: a press goes to the place it names. */
|
|
3
4
|
export interface PaneCrumb {
|
|
4
5
|
readonly label: string;
|
|
@@ -7,6 +8,18 @@ export interface PaneCrumb {
|
|
|
7
8
|
/** What a press does, when the label alone does not say it. */
|
|
8
9
|
readonly tip?: string;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The other places beside the last crumb's (a service's other versions, a
|
|
13
|
+
* project's other commands), which a ⌄ after its words opens as a `Menu`.
|
|
14
|
+
*/
|
|
15
|
+
export interface PaneSiblings {
|
|
16
|
+
/** The menu's accessible name and what the ⌄ says it opens: "Other versions". */
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** The places, the one shown among them with its `current`; `MenuEntry`s. */
|
|
19
|
+
readonly entries: readonly MenuEntry[];
|
|
20
|
+
/** Goes to the place picked, by its entry's id; the menu closes itself. */
|
|
21
|
+
readonly onPick: (id: string) => void;
|
|
22
|
+
}
|
|
10
23
|
/** Props for {@link PanePathBar}. */
|
|
11
24
|
export interface PanePathBarProps {
|
|
12
25
|
/**
|
|
@@ -23,6 +36,12 @@ export interface PanePathBarProps {
|
|
|
23
36
|
readonly heading?: boolean;
|
|
24
37
|
/** Drawn after the last crumb's label, inside its crumb: the `CurrentDot` of the one shown. */
|
|
25
38
|
readonly here?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* The last crumb's siblings: the crumb becomes a button with a ⌄ after
|
|
41
|
+
* its words that drops them as a menu under it, the cursor on the one
|
|
42
|
+
* shown (the entry with `current`).
|
|
43
|
+
*/
|
|
44
|
+
readonly siblings?: PaneSiblings | null;
|
|
26
45
|
/** Facts and compact controls at the bar's end. */
|
|
27
46
|
readonly children?: ReactNode;
|
|
28
47
|
}
|
|
@@ -34,6 +53,8 @@ export interface PanePathBarProps {
|
|
|
34
53
|
* way first, the last one only once they have. A cut crumb opens its whole
|
|
35
54
|
* text as a tooltip, and a crumb in full view opens none (a control's
|
|
36
55
|
* `tip`, when it has one, says what a press does instead, cut or not).
|
|
56
|
+
* A bar with `siblings` makes its last crumb a ⌄ button that drops the
|
|
57
|
+
* places beside it (a service's other versions) as a `Menu`.
|
|
37
58
|
* Facts and controls sit at the bar's end (`.path-tools`): a state
|
|
38
59
|
* as `PathFact`, compact verbs as `QuietAction` and `.path-star` icon
|
|
39
60
|
* buttons. In a bar too narrow for everything, things give way in one
|
|
@@ -44,7 +65,7 @@ export interface PanePathBarProps {
|
|
|
44
65
|
* Nothing is drawn over anything, and no control leaves the row. The bar
|
|
45
66
|
* fits itself after every render and whenever any box in it resizes.
|
|
46
67
|
*/
|
|
47
|
-
export declare function PanePathBar({ trail, mark, heading, here, children }: PanePathBarProps): ReactElement;
|
|
68
|
+
export declare function PanePathBar({ trail, mark, heading, here, siblings, children }: PanePathBarProps): ReactElement;
|
|
48
69
|
/** Props for {@link PathFact}. */
|
|
49
70
|
export interface PathFactProps {
|
|
50
71
|
/**
|
package/dist/pane/PaneFrame.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown } from 'lucide-react';
|
|
3
|
+
import { Fragment, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { ICON_SM } from '../icon/sizes.js';
|
|
5
|
+
import { Menu } from '../menu/Menu.js';
|
|
6
|
+
import { cutTooltip, describedTooltip, tooltip } from '../tooltip/Tooltip.logic.js';
|
|
4
7
|
import { InPathBarContext } from './PaneActions.js';
|
|
5
8
|
import { clearWordTips, giveWordTips } from './toolWords.js';
|
|
6
9
|
/** A fact of words alone, or of words after marks: the bar cuts its words. */
|
|
@@ -132,6 +135,38 @@ function showFocusedCrumb(trail, crumb) {
|
|
|
132
135
|
trail.scrollLeft = Math.min(max, Math.ceil(trail.scrollLeft + (at.right + ring - (box.right - fade))));
|
|
133
136
|
}
|
|
134
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* The last crumb with its siblings: a button with the crumb's words and a
|
|
140
|
+
* ⌄ (`aria-haspopup="menu"`) that drops the siblings' `Menu` under it and
|
|
141
|
+
* takes it away again; picking one or a key that closes the menu gives
|
|
142
|
+
* the focus back to the crumb. On a page's path bar it stands in the
|
|
143
|
+
* page's heading.
|
|
144
|
+
*/
|
|
145
|
+
function SiblingsCrumb({ label, heading, siblings }) {
|
|
146
|
+
const [crumb, setCrumb] = useState(null);
|
|
147
|
+
const [open, setOpen] = useState(false);
|
|
148
|
+
const current = siblings.entries.find((entry) => (entry.kind === undefined || entry.kind === 'item') &&
|
|
149
|
+
entry.current !== undefined &&
|
|
150
|
+
entry.current !== null);
|
|
151
|
+
const close = (by) => {
|
|
152
|
+
setOpen(false);
|
|
153
|
+
if (by === 'keyboard')
|
|
154
|
+
crumb?.focus();
|
|
155
|
+
};
|
|
156
|
+
const button = (_jsxs("button", { "aria-expanded": open, "aria-haspopup": "menu", className: "crumb-label crumb-siblings",
|
|
157
|
+
// A press while the menu is open closes it and gives the focus back
|
|
158
|
+
// here, since the menu that held it goes away.
|
|
159
|
+
onClick: () => (open ? close('keyboard') : setOpen(true)),
|
|
160
|
+
// While the menu holds the focus, a press here closes it, not the focus.
|
|
161
|
+
onMouseDown: (event) => {
|
|
162
|
+
if (open)
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
}, ref: setCrumb, type: "button", ...tooltip(`${label} · ${siblings.label}`), children: [_jsx("span", { className: "crumb-text", children: label }), _jsx(ChevronDown, { "aria-hidden": true, size: ICON_SM })] }));
|
|
165
|
+
return (_jsxs(_Fragment, { children: [heading ? _jsx("h2", { className: "crumb-heading", children: button }) : button, open && crumb !== null && (_jsx(Menu, { anchor: crumb, compact: true, entries: siblings.entries, initial: current?.id ?? null, label: siblings.label, onClose: close, onPick: (id) => {
|
|
166
|
+
siblings.onPick(id);
|
|
167
|
+
close('keyboard');
|
|
168
|
+
} }))] }));
|
|
169
|
+
}
|
|
135
170
|
/**
|
|
136
171
|
* The row a pane opens with: a path bar, in the listing look (under
|
|
137
172
|
* `.listing-root`). Its crumbs say where the pane is; one handed as a
|
|
@@ -140,6 +175,8 @@ function showFocusedCrumb(trail, crumb) {
|
|
|
140
175
|
* way first, the last one only once they have. A cut crumb opens its whole
|
|
141
176
|
* text as a tooltip, and a crumb in full view opens none (a control's
|
|
142
177
|
* `tip`, when it has one, says what a press does instead, cut or not).
|
|
178
|
+
* A bar with `siblings` makes its last crumb a ⌄ button that drops the
|
|
179
|
+
* places beside it (a service's other versions) as a `Menu`.
|
|
143
180
|
* Facts and controls sit at the bar's end (`.path-tools`): a state
|
|
144
181
|
* as `PathFact`, compact verbs as `QuietAction` and `.path-star` icon
|
|
145
182
|
* buttons. In a bar too narrow for everything, things give way in one
|
|
@@ -150,7 +187,7 @@ function showFocusedCrumb(trail, crumb) {
|
|
|
150
187
|
* Nothing is drawn over anything, and no control leaves the row. The bar
|
|
151
188
|
* fits itself after every render and whenever any box in it resizes.
|
|
152
189
|
*/
|
|
153
|
-
export function PanePathBar({ trail, mark, heading = false, here, children }) {
|
|
190
|
+
export function PanePathBar({ trail, mark, heading = false, here, siblings = null, children }) {
|
|
154
191
|
const rowRef = useRef(null);
|
|
155
192
|
const sizes = useRef(null);
|
|
156
193
|
const last = trail.at(-1);
|
|
@@ -239,7 +276,7 @@ export function PanePathBar({ trail, mark, heading = false, here, children }) {
|
|
|
239
276
|
const last = index === trail.length - 1;
|
|
240
277
|
const label = typeof crumb === 'string' ? crumb : crumb.label;
|
|
241
278
|
const Label = last && heading ? 'h2' : 'span';
|
|
242
|
-
return (_jsxs(Fragment, { children: [index > 0 && (_jsx("span", { "aria-hidden": true, className: "crumb-separator", children: "/" })), _jsxs("span", { className: last ? 'crumb here' : 'crumb', children: [typeof crumb === 'string' ? (_jsx(Label, { className: "crumb-label", children: _jsx("span", { className: "crumb-text", ...cutTooltip(label), children: label }) })) : (_jsx("button", { className: "crumb-label", onClick: crumb.onOpen, type: "button", ...describedTooltip(crumb.tip), children: _jsx("span", { className: "crumb-text", ...(crumb.tip === undefined ? cutTooltip(label) : {}), children: label }) })), last && here] })] }, `${index}:${label}`));
|
|
279
|
+
return (_jsxs(Fragment, { children: [index > 0 && (_jsx("span", { "aria-hidden": true, className: "crumb-separator", children: "/" })), _jsxs("span", { className: last ? 'crumb here' : 'crumb', children: [last && siblings !== null ? (_jsx(SiblingsCrumb, { heading: heading, label: label, siblings: siblings })) : typeof crumb === 'string' ? (_jsx(Label, { className: "crumb-label", children: _jsx("span", { className: "crumb-text", ...cutTooltip(label), children: label }) })) : (_jsx("button", { className: "crumb-label", onClick: crumb.onOpen, type: "button", ...describedTooltip(crumb.tip), children: _jsx("span", { className: "crumb-text", ...(crumb.tip === undefined ? cutTooltip(label) : {}), children: label }) })), last && here] })] }, last && siblings !== null ? 'siblings' : `${index}:${label}`));
|
|
243
280
|
})] }), children !== undefined && children !== null && children !== false && (_jsx("div", { className: "path-tools", children: _jsx(InPathBarContext.Provider, { value: true, children: children }) }))] }));
|
|
244
281
|
}
|
|
245
282
|
/**
|
package/dist/pane/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { PaneBox, PaneList, type PaneBoxProps, type PaneListProps, type RegionHandlers } from './Pane.js';
|
|
12
12
|
export { InRowContext, QuietAction, RowIconAction, RowLinkLookContext, useInRow, type ControlVerb, type LinkLook, type QuietActionProps, type RowIconActionProps } from './PaneActions.js';
|
|
13
|
-
export { PanePathBar, PaneStatus, PathFact, type PaneCrumb, type PanePathBarProps, type PaneStatusProps, type PathFactProps } from './PaneFrame.js';
|
|
13
|
+
export { PanePathBar, PaneStatus, PathFact, type PaneCrumb, type PaneSiblings, type PanePathBarProps, type PaneStatusProps, type PathFactProps } from './PaneFrame.js';
|
|
14
14
|
export { isTabStop, nextTabStop, pageRows, paneRow, paneRows, showRow, tabStops, verbControl, type SidebarTabStops, type TabStop } from './PaneKeys.js';
|
|
15
15
|
export { movedIndex, NO_MAIN_VERBS, paneKeyAction, sameVerbs, type MainVerbs, type PaneKeyAction, type PaneKeyOptions, type PaneKeyStroke, type PaneMove } from './PaneKeys.logic.js';
|
|
16
16
|
export { PaneTabs, type PaneTabItem, type PaneTabsProps } from './PaneTabs.js';
|
|
@@ -6,6 +6,20 @@ export interface SettingsSubsectionEntry {
|
|
|
6
6
|
readonly id: string;
|
|
7
7
|
readonly title: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* A sidebar row's chip with more than words: a glyph before them (an
|
|
11
|
+
* up arrow for an offered build, a restart for one ready) and a tooltip that
|
|
12
|
+
* says what they mean ("Update to 1.4.4"), which the row's accessible name
|
|
13
|
+
* reads in place of the bare words.
|
|
14
|
+
*/
|
|
15
|
+
export interface SettingsChip {
|
|
16
|
+
/** The chip's words: "1.4.4". */
|
|
17
|
+
readonly text: string;
|
|
18
|
+
/** A glyph before the words, at the small icon size. */
|
|
19
|
+
readonly icon?: LucideIcon;
|
|
20
|
+
/** What the chip means, as its tooltip and in the row's accessible name. */
|
|
21
|
+
readonly tip?: string;
|
|
22
|
+
}
|
|
9
23
|
/** One page of the Settings dialog, with its body ready to draw. */
|
|
10
24
|
export interface SettingsPage {
|
|
11
25
|
/** Unique across every page in the dialog. */
|
|
@@ -24,8 +38,12 @@ export interface SettingsPage {
|
|
|
24
38
|
* its own box (an updates page's notes) while the rest stays put.
|
|
25
39
|
*/
|
|
26
40
|
readonly fills?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
|
|
41
|
+
/**
|
|
42
|
+
* A short label the page's sidebar row shows after its title as a
|
|
43
|
+
* warning chip (an offered build's version), in words alone or with a
|
|
44
|
+
* glyph and a tooltip (`SettingsChip`); none for none.
|
|
45
|
+
*/
|
|
46
|
+
readonly chip?: string | SettingsChip | null;
|
|
29
47
|
readonly body: ReactNode;
|
|
30
48
|
}
|
|
31
49
|
/** A sidebar header and the pages under it, in the order they are listed. */
|