@bigpixelrocket/uiok 0.5.0 → 0.7.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 +72 -1
- package/dist/button/TextLink.d.ts +21 -2
- package/dist/button/TextLink.js +14 -3
- package/dist/button/button.css +7 -0
- package/dist/dialog/SectionedDialog.d.ts +37 -0
- package/dist/dialog/SectionedDialog.js +158 -0
- package/dist/dialog/dialog.css +102 -0
- package/dist/dialog/index.d.ts +4 -2
- package/dist/dialog/index.js +4 -2
- package/dist/field/FieldLayout.d.ts +3 -2
- package/dist/field/FieldLayout.js +8 -3
- package/dist/frame/AppRoot.d.ts +1 -1
- package/dist/frame/AppRoot.js +2 -1
- package/dist/frame/Dock.d.ts +1 -1
- package/dist/frame/Dock.js +2 -1
- package/dist/frame/FilterChips.d.ts +5 -2
- package/dist/frame/FilterChips.js +35 -2
- package/dist/frame/FilterChips.logic.d.ts +24 -0
- package/dist/frame/FilterChips.logic.js +34 -0
- package/dist/frame/PageParts.d.ts +4 -3
- package/dist/frame/PageParts.js +10 -3
- package/dist/frame/SideBySide.d.ts +33 -0
- package/dist/frame/SideBySide.js +62 -0
- package/dist/frame/Tree.d.ts +20 -7
- package/dist/frame/Tree.js +21 -8
- package/dist/frame/WindowFrame.d.ts +1 -1
- package/dist/frame/WindowFrame.js +2 -1
- package/dist/frame/frame.css +56 -1
- package/dist/frame/index.d.ts +4 -2
- package/dist/frame/index.js +4 -2
- package/dist/grid/grid.css +1 -0
- package/dist/keyboard/Keyboard.logic.js +20 -3
- package/dist/keychord/KeyChord.d.ts +21 -4
- package/dist/keychord/KeyChord.js +24 -5
- package/dist/keychord/ShortcutIndex.d.ts +49 -0
- package/dist/keychord/ShortcutIndex.js +28 -0
- package/dist/keychord/index.d.ts +8 -2
- package/dist/keychord/index.js +8 -2
- package/dist/keychord/keychord.css +101 -0
- package/dist/labels/dialog.d.ts +2 -0
- package/dist/labels/dialog.js +2 -1
- package/dist/labels/keys.d.ts +5 -0
- package/dist/labels/keys.js +2 -1
- package/dist/legend/legend.css +6 -10
- package/dist/listing/Listing.d.ts +54 -4
- package/dist/listing/Listing.js +61 -7
- package/dist/listing/PaneMessage.d.ts +7 -4
- package/dist/listing/PaneMessage.js +11 -4
- package/dist/listing/index.d.ts +1 -1
- package/dist/listing/listing.css +124 -5
- package/dist/menu/Menu.d.ts +52 -8
- package/dist/menu/Menu.js +288 -80
- package/dist/menu/Menu.logic.d.ts +39 -12
- package/dist/menu/Menu.logic.js +36 -8
- package/dist/menu/index.d.ts +4 -3
- package/dist/menu/index.js +2 -1
- package/dist/menu/menu.css +4 -0
- package/dist/palette/Palette.d.ts +3 -1
- package/dist/palette/Palette.js +14 -2
- package/dist/palette/PaletteRows.d.ts +28 -14
- package/dist/palette/PaletteRows.js +21 -17
- package/dist/pane/Pane.d.ts +50 -6
- package/dist/pane/Pane.js +112 -5
- package/dist/pane/PaneKeys.d.ts +5 -1
- package/dist/pane/PaneKeys.js +28 -3
- package/dist/pane/PaneKeys.logic.d.ts +25 -0
- package/dist/pane/PaneKeys.logic.js +30 -0
- package/dist/pane/PaneTabs.js +7 -3
- package/dist/pane/index.d.ts +1 -1
- package/dist/pane/index.js +1 -1
- package/dist/pane/panetabs.css +14 -2
- package/dist/pane/usePaneKeys.d.ts +8 -1
- package/dist/pane/usePaneKeys.js +32 -12
- package/dist/styles.css +40 -3
- package/dist/surface/FactList.d.ts +54 -0
- package/dist/surface/FactList.js +33 -0
- package/dist/surface/index.d.ts +4 -1
- package/dist/surface/index.js +4 -1
- package/dist/surface/surface.css +85 -2
- package/dist/terminal/TerminalMenu.js +1 -1
- package/dist/terminal/ghostty/core.d.ts +12 -4
- package/dist/terminal/ghostty/core.js +12 -4
- package/dist/terminal/index.d.ts +4 -2
- package/dist/terminal/index.js +4 -2
- package/dist/terminal/terminal.css +3 -2
- package/dist/text/Code.d.ts +15 -0
- package/dist/text/Code.js +12 -0
- package/dist/text/index.d.ts +6 -1
- package/dist/text/index.js +6 -1
- package/dist/text/text.css +21 -0
- package/dist/themes/tokens.js +8 -3
- package/dist/tokens.css +4 -0
- package/dist/viewer/HexView.js +17 -8
- package/dist/viewer/ImageView.js +5 -3
- package/dist/viewer/PdfView.d.ts +8 -1
- package/dist/viewer/PdfView.js +27 -2
- package/dist/viewer/SyntaxHighlighter.d.ts +3 -2
- package/dist/viewer/SyntaxHighlighter.js +7 -2
- package/dist/viewer/SyntaxLanguage.logic.d.ts +5 -0
- package/dist/viewer/SyntaxLanguage.logic.js +17 -3
- package/dist/viewer/SyntaxService.d.ts +3 -1
- package/dist/viewer/SyntaxService.js +8 -1
- package/dist/viewer/TextView.js +14 -7
- package/dist/viewer/ViewerClipboard.js +17 -6
- package/dist/viewer/ViewerFrame.logic.js +4 -1
- package/dist/viewer/types.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,13 +1,46 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
2
3
|
import { ICON_SM } from '../icon/sizes.js';
|
|
4
|
+
import { sidewaysWheel } from './FilterChips.logic.js';
|
|
3
5
|
/**
|
|
4
6
|
* A pane's quick row of filters under its path bar (`pane-quick-row`), as a
|
|
5
7
|
* sidebar's Running and Updates: each a quiet button with its glyph, its
|
|
6
8
|
* word, and its count, pressed while on. A press toggles its filter and
|
|
7
|
-
* leaves the focus where it was.
|
|
9
|
+
* leaves the focus where it was. The row is one line: chips that do not
|
|
10
|
+
* fit scroll sideways under an edge fade (`.scroll-fade-x`), a mouse's
|
|
11
|
+
* vertical wheel scrolls it sideways while it can move that way
|
|
12
|
+
* (`sidewaysWheel`), and a chip the keys reach comes whole into view.
|
|
8
13
|
*/
|
|
9
14
|
export function FilterChips({ chips, on, onToggle, label }) {
|
|
10
|
-
|
|
15
|
+
const rowRef = useRef(null);
|
|
16
|
+
// A wheel listener React would make passive, so it can keep the page
|
|
17
|
+
// still while it turns the row; one it leaves alone scrolls the page.
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const row = rowRef.current;
|
|
20
|
+
if (row === null)
|
|
21
|
+
return undefined;
|
|
22
|
+
const onWheel = (event) => {
|
|
23
|
+
// Shift turns a wheel sideways and Control (or Command) zooms on their
|
|
24
|
+
// own; the row leaves both to the browser.
|
|
25
|
+
if (event.shiftKey || event.ctrlKey || event.metaKey)
|
|
26
|
+
return;
|
|
27
|
+
const delta = sidewaysWheel(event, row, getComputedStyle(row).direction === 'rtl');
|
|
28
|
+
if (delta === null)
|
|
29
|
+
return;
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
row.scrollLeft += delta;
|
|
32
|
+
};
|
|
33
|
+
row.addEventListener('wheel', onWheel, { passive: false });
|
|
34
|
+
return () => row.removeEventListener('wheel', onWheel);
|
|
35
|
+
}, []);
|
|
36
|
+
return (_jsx("div", { "aria-label": label, className: "pane-quick-row scroll-fade-x",
|
|
37
|
+
// A chip the keys reach comes whole into view, past the edge fade, at
|
|
38
|
+
// once: nothing here scrolls smoothly, so reduced motion has nothing to stop.
|
|
39
|
+
onFocus: (event) => {
|
|
40
|
+
if (event.target !== event.currentTarget) {
|
|
41
|
+
event.target.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });
|
|
42
|
+
}
|
|
43
|
+
}, ref: rowRef, role: "toolbar", children: chips.map((chip) => {
|
|
11
44
|
const Icon = chip.icon;
|
|
12
45
|
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
46
|
}) }));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** A wheel event's deltas, as the DOM reports them. */
|
|
2
|
+
export interface WheelDeltas {
|
|
3
|
+
readonly deltaX: number;
|
|
4
|
+
readonly deltaY: number;
|
|
5
|
+
/** `WheelEvent.deltaMode`: 0 pixels, 1 lines, 2 pages. */
|
|
6
|
+
readonly deltaMode: number;
|
|
7
|
+
}
|
|
8
|
+
/** Where a sideways scroller stands: its `scrollLeft`, `scrollWidth`, and `clientWidth`. */
|
|
9
|
+
export interface SidewaysBox {
|
|
10
|
+
readonly scrollLeft: number;
|
|
11
|
+
readonly scrollWidth: number;
|
|
12
|
+
readonly clientWidth: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* How far a wheel moves a sideways line, as a change to its `scrollLeft`,
|
|
16
|
+
* or null to leave the event alone: when it is mostly sideways already (a
|
|
17
|
+
* trackpad, or Shift with a wheel, which the browser turns sideways
|
|
18
|
+
* itself), when the line has nothing hidden, and when the line already
|
|
19
|
+
* stands at the end the wheel points to, so the page under it scrolls as
|
|
20
|
+
* it would without the line. Down moves toward the line's end, which is
|
|
21
|
+
* its left in a right-to-left line (`rtl`), where `scrollLeft` runs from 0
|
|
22
|
+
* down to less than 0.
|
|
23
|
+
*/
|
|
24
|
+
export declare function sidewaysWheel(wheel: WheelDeltas, box: SidewaysBox, rtl?: boolean): number | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The quick row of filters is one line that scrolls sideways under the
|
|
3
|
+
* base sheet's inline edge fade, with no scrollbar drawn. A trackpad
|
|
4
|
+
* scrolls it sideways on its own; a plain mouse wheel sends only a
|
|
5
|
+
* vertical delta, which these rules turn onto the line.
|
|
6
|
+
*/
|
|
7
|
+
/** How far one wheel line moves the line, in pixels: a listing row's height (`--row-height`). */
|
|
8
|
+
const LINE_PIXELS = 24;
|
|
9
|
+
/**
|
|
10
|
+
* How far a wheel moves a sideways line, as a change to its `scrollLeft`,
|
|
11
|
+
* or null to leave the event alone: when it is mostly sideways already (a
|
|
12
|
+
* trackpad, or Shift with a wheel, which the browser turns sideways
|
|
13
|
+
* itself), when the line has nothing hidden, and when the line already
|
|
14
|
+
* stands at the end the wheel points to, so the page under it scrolls as
|
|
15
|
+
* it would without the line. Down moves toward the line's end, which is
|
|
16
|
+
* its left in a right-to-left line (`rtl`), where `scrollLeft` runs from 0
|
|
17
|
+
* down to less than 0.
|
|
18
|
+
*/
|
|
19
|
+
export function sidewaysWheel(wheel, box, rtl = false) {
|
|
20
|
+
if (wheel.deltaY === 0 || Math.abs(wheel.deltaX) >= Math.abs(wheel.deltaY))
|
|
21
|
+
return null;
|
|
22
|
+
const room = box.scrollWidth - box.clientWidth;
|
|
23
|
+
if (room <= 0)
|
|
24
|
+
return null;
|
|
25
|
+
const unit = wheel.deltaMode === 1 ? LINE_PIXELS : wheel.deltaMode === 2 ? box.clientWidth : 1;
|
|
26
|
+
const delta = wheel.deltaY * unit;
|
|
27
|
+
const along = rtl ? -box.scrollLeft : box.scrollLeft;
|
|
28
|
+
// Within half a pixel of an end counts as there: scroll positions are fractional at 2x.
|
|
29
|
+
const atStart = along <= 0.5;
|
|
30
|
+
const atEnd = along >= room - 0.5;
|
|
31
|
+
if ((delta < 0 && atStart) || (delta > 0 && atEnd))
|
|
32
|
+
return null;
|
|
33
|
+
return rtl ? -delta : delta;
|
|
34
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LucideIcon } from 'lucide-react';
|
|
2
|
-
import type
|
|
2
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
3
3
|
/** Props of a part that only lays out what it holds. */
|
|
4
4
|
export interface PagePartProps {
|
|
5
5
|
readonly children: ReactNode;
|
|
@@ -34,8 +34,9 @@ export interface PageNoteProps {
|
|
|
34
34
|
readonly children: ReactNode;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* A loading or empty line in a page, where its rows would be
|
|
38
|
-
* spinner beside the words, from the rows'
|
|
37
|
+
* A loading or empty line in a page, where its rows would be, or a note
|
|
38
|
+
* after a listing: its glyph or spinner beside the words, from the rows'
|
|
39
|
+
* inset. Drawn outside every listing scope, it carries the scope itself.
|
|
39
40
|
*/
|
|
40
41
|
export declare function PageNote({ icon: Icon, busy, children }: PageNoteProps): ReactElement;
|
|
41
42
|
/** The one command that answers an empty list (Add service), under its `PageNote`. */
|
package/dist/frame/PageParts.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
2
3
|
import { Button } from '../button/Button.js';
|
|
3
4
|
import { Spinner } from '../icon/Spinner.js';
|
|
4
5
|
import { ICON_MD, ICON_SM } from '../icon/sizes.js';
|
|
6
|
+
import { ListingScopeContext } from '../listing/ListingScope.js';
|
|
5
7
|
import { drawn } from './WindowFrame.js';
|
|
6
8
|
/** A page in the main pane (in its `PageSlot`): a column that fills the pane. */
|
|
7
9
|
export function PanePage({ children }) {
|
|
@@ -27,11 +29,16 @@ export function PageFilter({ children }) {
|
|
|
27
29
|
return _jsx("div", { className: "pane-page-filter", children: children });
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
|
-
* A loading or empty line in a page, where its rows would be
|
|
31
|
-
* spinner beside the words, from the rows'
|
|
32
|
+
* A loading or empty line in a page, where its rows would be, or a note
|
|
33
|
+
* after a listing: its glyph or spinner beside the words, from the rows'
|
|
34
|
+
* inset. Drawn outside every listing scope, it carries the scope itself.
|
|
32
35
|
*/
|
|
33
36
|
export function PageNote({ icon: Icon, busy = false, children }) {
|
|
34
|
-
|
|
37
|
+
const scoped = useContext(ListingScopeContext);
|
|
38
|
+
const note = (_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", { className: "pane-message-text", children: children })] }));
|
|
39
|
+
// Outside every listing scope it carries the scope itself, as a listing
|
|
40
|
+
// does, so it keeps its look anywhere.
|
|
41
|
+
return scoped ? note : _jsx("div", { className: "listing-root", children: note });
|
|
35
42
|
}
|
|
36
43
|
/** The one command that answers an empty list (Add service), under its `PageNote`. */
|
|
37
44
|
export function EmptyAction({ children }) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
/** Props for {@link SideBySide}. */
|
|
3
|
+
export interface SideBySideProps {
|
|
4
|
+
/**
|
|
5
|
+
* The width in pixels, of the room the pair itself is given (its pane's
|
|
6
|
+
* page, never the window), from which the two stand side by side; in
|
|
7
|
+
* less, the second stands under the first.
|
|
8
|
+
*/
|
|
9
|
+
readonly from: number;
|
|
10
|
+
/** The first part, at the inline start side by side and on top stacked: a listing, a section. */
|
|
11
|
+
readonly first: ReactNode;
|
|
12
|
+
/** The first part's accessible name ("Settings"), which its group carries. */
|
|
13
|
+
readonly firstLabel: string;
|
|
14
|
+
/** The second part, beside the first or under it. */
|
|
15
|
+
readonly second: ReactNode;
|
|
16
|
+
/** The second part's accessible name ("Extensions"), which its group carries. */
|
|
17
|
+
readonly secondLabel: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Two of a page's listings or sections, side by side in equal columns while
|
|
21
|
+
* the room the pair is given is `from` pixels wide or more, one over the
|
|
22
|
+
* other in less, a hairline between them either way. Once side by side, it
|
|
23
|
+
* stacks only under `from` less a scrollbar's width, so a scrollbar the
|
|
24
|
+
* two columns bring cannot flip it back and forth; a changed `from`
|
|
25
|
+
* applies whole to the first width measured against it. The room is the
|
|
26
|
+
* pair's own, measured as it resizes (`data-layout`: `side-by-side` or
|
|
27
|
+
* `stacked`), so a pane narrowed by its sidebar or a split stacks them
|
|
28
|
+
* though the window is wide. It is a layout alone: each part is a group
|
|
29
|
+
* named by its label, in the page's reading order (the first, then the
|
|
30
|
+
* second), and holds no cursor and answers no key; the rows inside follow
|
|
31
|
+
* whatever `RowCursorContext` is around them.
|
|
32
|
+
*/
|
|
33
|
+
export declare function SideBySide({ from, first, firstLabel, second, secondLabel }: SideBySideProps): ReactElement;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* How far under `from` a pair already side by side stays so, in pixels:
|
|
5
|
+
* wider than a classic scrollbar (15px on macOS, 17px on Windows). Two
|
|
6
|
+
* columns can be taller than one stack, so side by side a scrollbar may
|
|
7
|
+
* appear in the pane and narrow the pair under `from`; stacking then would
|
|
8
|
+
* take the scrollbar away and stand them side by side again, back and
|
|
9
|
+
* forth. Holding the layout through a scrollbar's width keeps it still.
|
|
10
|
+
*/
|
|
11
|
+
const SCROLLBAR_HOLD = 20;
|
|
12
|
+
/**
|
|
13
|
+
* Two of a page's listings or sections, side by side in equal columns while
|
|
14
|
+
* the room the pair is given is `from` pixels wide or more, one over the
|
|
15
|
+
* other in less, a hairline between them either way. Once side by side, it
|
|
16
|
+
* stacks only under `from` less a scrollbar's width, so a scrollbar the
|
|
17
|
+
* two columns bring cannot flip it back and forth; a changed `from`
|
|
18
|
+
* applies whole to the first width measured against it. The room is the
|
|
19
|
+
* pair's own, measured as it resizes (`data-layout`: `side-by-side` or
|
|
20
|
+
* `stacked`), so a pane narrowed by its sidebar or a split stacks them
|
|
21
|
+
* though the window is wide. It is a layout alone: each part is a group
|
|
22
|
+
* named by its label, in the page's reading order (the first, then the
|
|
23
|
+
* second), and holds no cursor and answers no key; the rows inside follow
|
|
24
|
+
* whatever `RowCursorContext` is around them.
|
|
25
|
+
*/
|
|
26
|
+
export function SideBySide({ from, first, firstLabel, second, secondLabel }) {
|
|
27
|
+
const ref = useRef(null);
|
|
28
|
+
const [sideBySide, setSideBySide] = useState(false);
|
|
29
|
+
// The `from` the last laid-out width was measured against.
|
|
30
|
+
const measuredFrom = useRef(null);
|
|
31
|
+
// Measured before the first paint, so the pair never draws in the other
|
|
32
|
+
// layout first. A threshold a prop gives cannot reach a container query,
|
|
33
|
+
// whose conditions read no custom property, so the width is read here.
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
const element = ref.current;
|
|
36
|
+
if (element === null)
|
|
37
|
+
return undefined;
|
|
38
|
+
// A width of 0 is a page not laid out (held behind another tab), which
|
|
39
|
+
// keeps its layout. The hold is for a scrollbar the layout itself
|
|
40
|
+
// brought, so the first width measured against a new `from` (as it
|
|
41
|
+
// mounts, as `from` changes, or when a page hidden through the change
|
|
42
|
+
// comes into view) decides without it. The `from` last measured lives
|
|
43
|
+
// in a ref, not in this effect, so an effect that runs again with the
|
|
44
|
+
// same `from` (a page shown again through <Activity>) keeps the hold.
|
|
45
|
+
const measure = () => {
|
|
46
|
+
const width = element.clientWidth;
|
|
47
|
+
if (width === 0)
|
|
48
|
+
return;
|
|
49
|
+
const hold = measuredFrom.current === from;
|
|
50
|
+
measuredFrom.current = from;
|
|
51
|
+
setSideBySide((now) => width >= (now && hold ? from - SCROLLBAR_HOLD : from));
|
|
52
|
+
};
|
|
53
|
+
measure();
|
|
54
|
+
// Optional: jsdom has no ResizeObserver.
|
|
55
|
+
if (typeof ResizeObserver === 'undefined')
|
|
56
|
+
return undefined;
|
|
57
|
+
const observer = new ResizeObserver(measure);
|
|
58
|
+
observer.observe(element);
|
|
59
|
+
return () => observer.disconnect();
|
|
60
|
+
}, [from]);
|
|
61
|
+
return (_jsxs("div", { className: "side-by-side", "data-layout": sideBySide ? 'side-by-side' : 'stacked', ref: ref, children: [_jsx("div", { "aria-label": firstLabel, className: "side-by-side-part", role: "group", children: first }), _jsx("div", { "aria-label": secondLabel, className: "side-by-side-part", role: "group", children: second })] }));
|
|
62
|
+
}
|
package/dist/frame/Tree.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type LucideIcon } from 'lucide-react';
|
|
2
|
-
import { type KeyboardEvent, type ReactElement, type ReactNode, type Ref } from 'react';
|
|
3
|
-
import type
|
|
2
|
+
import { type KeyboardEvent, type MouseEvent, type ReactElement, type ReactNode, type Ref } from 'react';
|
|
3
|
+
import { type RegionHandlers } from '../pane/Pane.js';
|
|
4
4
|
/** Props for {@link TreePane}. */
|
|
5
5
|
export interface TreePaneProps extends RegionHandlers {
|
|
6
6
|
/** The width the host keeps, in pixels; none takes `--sidebar-width` (240px). */
|
|
@@ -33,7 +33,9 @@ export interface TreeListProps extends RegionHandlers {
|
|
|
33
33
|
* finds the sidebar pane by, focusable by script and out of the Tab order.
|
|
34
34
|
* Each row steps in by its level. While the list holds the focus, its
|
|
35
35
|
* active descendant is the cursor row, so a screen reader follows the
|
|
36
|
-
* cursor the keys move.
|
|
36
|
+
* cursor the keys move. As the home, it hands the keyboard's menu key (the
|
|
37
|
+
* Menu key, Shift-F10) to the cursor row's `onContextMenu`, as a page's
|
|
38
|
+
* `PaneList` does.
|
|
37
39
|
*/
|
|
38
40
|
export declare function TreeList({ label, ref, children, ...handlers }: TreeListProps): ReactElement;
|
|
39
41
|
/**
|
|
@@ -71,6 +73,15 @@ export interface TreeRowProps {
|
|
|
71
73
|
readonly marked?: boolean;
|
|
72
74
|
/** Opens the row's item on a click anywhere but its controls. */
|
|
73
75
|
readonly onOpen?: () => void;
|
|
76
|
+
/**
|
|
77
|
+
* A secondary click (the right button, a Control-click, the menu key) on
|
|
78
|
+
* the row, with the row's key, for the row's menu: open it at
|
|
79
|
+
* `event.clientX` and `event.clientY`. The row moves the pane's cursor to
|
|
80
|
+
* itself first, so the menu acts on the cursor row, and cancels the
|
|
81
|
+
* browser's own menu; a cancelled event is one the `TreeList` and
|
|
82
|
+
* `TreePane` around it leave alone, so one click never opens two menus.
|
|
83
|
+
*/
|
|
84
|
+
readonly onContextMenu?: (event: MouseEvent<HTMLElement>, rowKey: string) => void;
|
|
74
85
|
/** The row itself takes the focus: in the Tab order while it is the cursor row. */
|
|
75
86
|
readonly focusable?: boolean;
|
|
76
87
|
/**
|
|
@@ -86,10 +97,12 @@ export interface TreeRowProps {
|
|
|
86
97
|
* trailing column and its own tool. Like a listing's `Row`, it follows the
|
|
87
98
|
* pane's cursor (`RowCursorContext`), wearing the cursor row's look and
|
|
88
99
|
* `aria-current`; the pointer moving over it or the focus entering it moves
|
|
89
|
-
* the cursor there
|
|
90
|
-
*
|
|
100
|
+
* the cursor there, and one with `onContextMenu` takes the cursor on a
|
|
101
|
+
* secondary click, then hands the click and its key to the app for the
|
|
102
|
+
* row's menu. Its controls leave the Tab order, since the tree's keys run
|
|
103
|
+
* them. The expansion and its keys stay the host's.
|
|
91
104
|
*/
|
|
92
|
-
export declare function TreeRow({ rowKey, level, kind, toggle, glyph, name, detail, trailing, tool, marked, onOpen, focusable, add }: TreeRowProps): ReactElement;
|
|
105
|
+
export declare function TreeRow({ rowKey, level, kind, toggle, glyph, name, detail, trailing, tool, marked, onOpen, onContextMenu, focusable, add }: TreeRowProps): ReactElement;
|
|
93
106
|
/**
|
|
94
107
|
* What a tree's tool row is: a plain tool (a filter field, a pager, an Add
|
|
95
108
|
* action), a note under a node (past the chevron's slot), a heading over a
|
|
@@ -104,7 +117,7 @@ export interface TreeToolProps {
|
|
|
104
117
|
readonly level?: number;
|
|
105
118
|
/** Its glyph, before the words. */
|
|
106
119
|
readonly icon?: LucideIcon;
|
|
107
|
-
/** Its words. */
|
|
120
|
+
/** Its words; words in a string the sidebar cuts show whole in a tooltip. */
|
|
108
121
|
readonly text?: ReactNode;
|
|
109
122
|
/**
|
|
110
123
|
* Its key among the tree's rows, which joins it to the pane's cursor
|
package/dist/frame/Tree.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Plus } from 'lucide-react';
|
|
|
3
3
|
import { createContext, useCallback, useContext, useId, useLayoutEffect, useMemo, useRef, useSyncExternalStore } from 'react';
|
|
4
4
|
import { ICON_MD } from '../icon/sizes.js';
|
|
5
5
|
import { RowCursorContext } from '../listing/Listing.js';
|
|
6
|
+
import { regionHandlers, unclaimedContextMenu, useMenuKeyHome } from '../pane/Pane.js';
|
|
6
7
|
import { InListingRowContext, InRowContext } from '../pane/PaneActions.js';
|
|
7
8
|
import { cutTooltip } from '../tooltip/Tooltip.logic.js';
|
|
8
9
|
import { useSharedRef } from './sharedRef.js';
|
|
@@ -18,7 +19,7 @@ const levelStyle = (level) => level > 0 ? { '--tree-level': level } : undefined;
|
|
|
18
19
|
* its path bar takes a line for each.
|
|
19
20
|
*/
|
|
20
21
|
export function TreePane({ width, active = false, label, ref, children, ...handlers }) {
|
|
21
|
-
return (_jsx("aside", { "aria-label": label, className: active ? 'pane tree-pane active' : 'pane tree-pane', ref: ref, style: width === undefined ? undefined : { width }, ...handlers, children: children }));
|
|
22
|
+
return (_jsx("aside", { "aria-label": label, className: active ? 'pane tree-pane active' : 'pane tree-pane', ref: ref, style: width === undefined ? undefined : { width }, ...regionHandlers(handlers), children: children }));
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* The tree's rows in the sidebar's scrolling list: the sidebar's home
|
|
@@ -26,9 +27,13 @@ export function TreePane({ width, active = false, label, ref, children, ...handl
|
|
|
26
27
|
* finds the sidebar pane by, focusable by script and out of the Tab order.
|
|
27
28
|
* Each row steps in by its level. While the list holds the focus, its
|
|
28
29
|
* active descendant is the cursor row, so a screen reader follows the
|
|
29
|
-
* cursor the keys move.
|
|
30
|
+
* cursor the keys move. As the home, it hands the keyboard's menu key (the
|
|
31
|
+
* Menu key, Shift-F10) to the cursor row's `onContextMenu`, as a page's
|
|
32
|
+
* `PaneList` does.
|
|
30
33
|
*/
|
|
31
34
|
export function TreeList({ label, ref, children, ...handlers }) {
|
|
35
|
+
const region = regionHandlers(handlers);
|
|
36
|
+
const menuKey = useMenuKeyHome(true, region);
|
|
32
37
|
const tree = useId();
|
|
33
38
|
const cursor = useContext(RowCursorContext);
|
|
34
39
|
const [list, attach] = useSharedRef(ref);
|
|
@@ -77,7 +82,7 @@ export function TreeList({ label, ref, children, ...handlers }) {
|
|
|
77
82
|
});
|
|
78
83
|
}
|
|
79
84
|
}), [tree]);
|
|
80
|
-
return (_jsx("div", { "aria-label": label, className: "pane-list tree", "data-pane-home": "sidebar", ref: attach, role: "tree", tabIndex: -1, ...
|
|
85
|
+
return (_jsx("div", { "aria-label": label, className: "pane-list tree", "data-pane-home": "sidebar", ref: attach, role: "tree", tabIndex: -1, ...region, ...menuKey, children: _jsx(TreeIdContext.Provider, { value: scope, children: children }) }));
|
|
81
86
|
}
|
|
82
87
|
/**
|
|
83
88
|
* One row of a sidebar's tree: the chevron's slot, the glyph, the name (cut
|
|
@@ -85,10 +90,12 @@ export function TreeList({ label, ref, children, ...handlers }) {
|
|
|
85
90
|
* trailing column and its own tool. Like a listing's `Row`, it follows the
|
|
86
91
|
* pane's cursor (`RowCursorContext`), wearing the cursor row's look and
|
|
87
92
|
* `aria-current`; the pointer moving over it or the focus entering it moves
|
|
88
|
-
* the cursor there
|
|
89
|
-
*
|
|
93
|
+
* the cursor there, and one with `onContextMenu` takes the cursor on a
|
|
94
|
+
* secondary click, then hands the click and its key to the app for the
|
|
95
|
+
* row's menu. Its controls leave the Tab order, since the tree's keys run
|
|
96
|
+
* them. The expansion and its keys stay the host's.
|
|
90
97
|
*/
|
|
91
|
-
export function TreeRow({ rowKey, level = 0, kind = 'node', toggle, glyph, name, detail, trailing, tool, marked = false, onOpen, focusable = false, add = false }) {
|
|
98
|
+
export function TreeRow({ rowKey, level = 0, kind = 'node', toggle, glyph, name, detail, trailing, tool, marked = false, onOpen, onContextMenu, focusable = false, add = false }) {
|
|
92
99
|
const cursor = useContext(RowCursorContext);
|
|
93
100
|
const tree = useContext(TreeIdContext);
|
|
94
101
|
const current = useSyncExternalStore(cursor.subscribe, () => cursor.current() === rowKey);
|
|
@@ -110,7 +117,13 @@ export function TreeRow({ rowKey, level = 0, kind = 'node', toggle, glyph, name,
|
|
|
110
117
|
]
|
|
111
118
|
.filter(Boolean)
|
|
112
119
|
.join(' ');
|
|
113
|
-
return (_jsx(InListingRowContext.Provider, { value: true, children: _jsx(InRowContext.Provider, { value: true, children: _jsxs("div", { "aria-current": current ? 'true' : undefined, "aria-expanded": toggle === undefined ? undefined : toggle.open, "aria-level": level + 1, "aria-selected": marked, className: classes, "data-row-key": rowKey, id: tree === null ? undefined : rowId(tree.id, rowKey), onClick: onOpen,
|
|
120
|
+
return (_jsx(InListingRowContext.Provider, { value: true, children: _jsx(InRowContext.Provider, { value: true, children: _jsxs("div", { "aria-current": current ? 'true' : undefined, "aria-expanded": toggle === undefined ? undefined : toggle.open, "aria-level": level + 1, "aria-selected": marked, className: classes, "data-row-key": rowKey, "data-row-menu": onContextMenu === undefined ? undefined : '', id: tree === null ? undefined : rowId(tree.id, rowKey), onClick: onOpen, onContextMenu: unclaimedContextMenu(onContextMenu &&
|
|
121
|
+
((event) => {
|
|
122
|
+
// The menu acts on the row it opened over, so that row is the cursor first.
|
|
123
|
+
if (!current)
|
|
124
|
+
cursor.point(rowKey);
|
|
125
|
+
onContextMenu(event, rowKey);
|
|
126
|
+
})), onFocus: () => cursor.point(rowKey), onPointerMove: () => {
|
|
114
127
|
if (!current)
|
|
115
128
|
cursor.point(rowKey);
|
|
116
129
|
}, role: "treeitem", style: levelStyle(level), tabIndex: focusable ? (current ? 0 : -1) : undefined, children: [toggle === undefined ? (_jsx("span", { "aria-hidden": true, className: "row-icon" })) : (_jsx(TreeToggle, { label: toggle.label, onToggle: toggle.onToggle, open: toggle.open })), _jsx("span", { "aria-hidden": true, className: "tree-glyph", children: glyph === undefined && add ? _jsx(Plus, { size: ICON_MD }) : glyph }), _jsxs("span", { className: "row-name tree-name", ...(typeof name === 'string' && detail === undefined ? cutTooltip(name) : {}), children: [name, detail === undefined ? null : (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "tree-detail", children: detail })] }))] }), _jsxs("span", { className: "row-meta align-right", children: [trailing, tool === undefined ? null : _jsx("span", { className: "tree-row-tool", children: tool })] })] }) }) }));
|
|
@@ -148,7 +161,7 @@ export function TreeTool({ kind = 'tool', level = 0, icon: Icon, text, rowKey, c
|
|
|
148
161
|
: () => {
|
|
149
162
|
if (!current)
|
|
150
163
|
cursor.point(rowKey);
|
|
151
|
-
}, "aria-level": rowKey === undefined ? undefined : level + 1, role: rowKey !== undefined ? 'treeitem' : kind === 'danger' ? 'alert' : undefined, style: levelStyle(level), children: [Icon === undefined ? null : (_jsx("span", { "aria-hidden": true, className: "tree-note-glyph", children: _jsx(Icon, { size: ICON_MD }) })), text === undefined ? null : (_jsx("span", { className: "tree-note-text", role: rowKey !== undefined && kind === 'danger' ? 'alert' : undefined, children: text })), children] }));
|
|
164
|
+
}, "aria-level": rowKey === undefined ? undefined : level + 1, role: rowKey !== undefined ? 'treeitem' : kind === 'danger' ? 'alert' : undefined, style: levelStyle(level), children: [Icon === undefined ? null : (_jsx("span", { "aria-hidden": true, className: "tree-note-glyph", children: _jsx(Icon, { size: ICON_MD }) })), text === undefined ? null : (_jsx("span", { className: "tree-note-text", role: rowKey !== undefined && kind === 'danger' ? 'alert' : undefined, ...(typeof text === 'string' ? cutTooltip(text) : {}), children: text })), children] }));
|
|
152
165
|
}
|
|
153
166
|
/**
|
|
154
167
|
* A tree's filter field: a bare field that fills its `TreeTool` row, the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type RegionHandlers } from '../pane/Pane.js';
|
|
3
3
|
/** Whether a slot was given something to draw: idiomatic `cond && <Part />` passes false for none. */
|
|
4
4
|
export declare const drawn: (node: ReactNode) => boolean;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ListingScopeContext } from '../listing/ListingScope.js';
|
|
3
|
+
import { regionHandlers } from '../pane/Pane.js';
|
|
3
4
|
/** Whether a slot was given something to draw: idiomatic `cond && <Part />` passes false for none. */
|
|
4
5
|
export const drawn = (node) => node !== null && node !== undefined && node !== false && node !== '';
|
|
5
6
|
/**
|
|
@@ -16,5 +17,5 @@ export const drawn = (node) => node !== null && node !== undefined && node !== f
|
|
|
16
17
|
export function WindowFrame({ brand, sidebar = null, resizer = null, sidebarWidth, main, tray = null, dock = null, legend = null, trailing = null, group }) {
|
|
17
18
|
const shown = drawn(sidebar);
|
|
18
19
|
const parts = (_jsxs(_Fragment, { children: [shown ? _jsx("div", { className: "window-frame-slot window-frame-sidebar", children: sidebar }) : null, shown ? resizer : null, _jsx("div", { className: "window-frame-slot window-frame-main", children: main }), drawn(tray) ? _jsx("div", { className: "window-frame-slot window-frame-tray", children: tray }) : null, drawn(dock) ? _jsx("div", { className: "window-frame-slot window-frame-dock", children: dock }) : null] }));
|
|
19
|
-
return (_jsx(ListingScopeContext, { value: true, children: _jsxs("div", { className: "window-frame space-root listing-root", "data-sidebar": shown ? 'shown' : 'hidden', style: { '--window-band-width': `${sidebarWidth}px` }, children: [_jsxs("div", { className: "window-frame-band", children: [_jsx("div", { className: "window-frame-band-lead", children: brand }), _jsx("span", { "aria-hidden": true, className: "window-frame-band-rest" }), drawn(trailing) ? _jsx("div", { className: "shell-trailing", children: trailing }) : null] }), group === undefined ? (parts) : (_jsx("div", { className: "window-frame-group", ...group, children: parts })), drawn(legend) ? _jsx("div", { className: "window-frame-legend", children: legend }) : null] }) }));
|
|
20
|
+
return (_jsx(ListingScopeContext, { value: true, children: _jsxs("div", { className: "window-frame space-root listing-root", "data-sidebar": shown ? 'shown' : 'hidden', style: { '--window-band-width': `${sidebarWidth}px` }, children: [_jsxs("div", { className: "window-frame-band", children: [_jsx("div", { className: "window-frame-band-lead", children: brand }), _jsx("span", { "aria-hidden": true, className: "window-frame-band-rest" }), drawn(trailing) ? _jsx("div", { className: "shell-trailing", children: trailing }) : null] }), group === undefined ? (parts) : (_jsx("div", { className: "window-frame-group", ...regionHandlers(group), children: parts })), drawn(legend) ? _jsx("div", { className: "window-frame-legend", children: legend }) : null] }) }));
|
|
20
21
|
}
|
package/dist/frame/frame.css
CHANGED
|
@@ -531,15 +531,32 @@
|
|
|
531
531
|
|
|
532
532
|
/* A row of quiet buttons under a pane's path bar (FilterChips: the tree's
|
|
533
533
|
Running and Updates filters): each a word with its glyph and count, and
|
|
534
|
-
`aria-pressed="true"` while its filter is on.
|
|
534
|
+
`aria-pressed="true"` while its filter is on. It is one line: chips that
|
|
535
|
+
do not fit scroll sideways, with no scrollbar drawn, under the base
|
|
536
|
+
sheet's inline edge fade (.scroll-fade-x, on the element), which leaves
|
|
537
|
+
the rule under the row solid. The block padding is the room a chip's
|
|
538
|
+
focus ring needs inside the scroller. Nothing scrolls smoothly (a wheel
|
|
539
|
+
and a chip reached by the keys move it at once), so reduced motion has
|
|
540
|
+
nothing to stop. */
|
|
535
541
|
.pane-quick-row {
|
|
536
542
|
display: flex;
|
|
537
543
|
gap: var(--space-2);
|
|
538
544
|
padding: var(--space-2) var(--pane-row-inset);
|
|
539
545
|
border-bottom: var(--line) solid var(--border);
|
|
546
|
+
overflow-x: auto;
|
|
547
|
+
overflow-y: hidden;
|
|
548
|
+
scroll-behavior: auto;
|
|
549
|
+
/* A chip the keys bring into view stops clear of the edge fade and with
|
|
550
|
+
room for its focus ring. */
|
|
551
|
+
scroll-padding-inline: calc(
|
|
552
|
+
var(--scroll-fade-size, var(--space-6)) + var(--focus-ring-width) + var(--focus-offset)
|
|
553
|
+
);
|
|
554
|
+
scrollbar-width: none;
|
|
540
555
|
}
|
|
541
556
|
|
|
542
557
|
.pane-quick-button {
|
|
558
|
+
flex: none;
|
|
559
|
+
white-space: nowrap;
|
|
543
560
|
display: inline-flex;
|
|
544
561
|
align-items: center;
|
|
545
562
|
gap: var(--space-2);
|
|
@@ -730,6 +747,14 @@
|
|
|
730
747
|
min-width: 0;
|
|
731
748
|
}
|
|
732
749
|
|
|
750
|
+
/* Set straight in a pane's body (a PaneList, a PanePage, a PageSlot, which
|
|
751
|
+
draws no box of its own, or one part of a SideBySide), its tools keep the
|
|
752
|
+
rows' inset from the pane's edges, where a section head and a row's icon
|
|
753
|
+
start, as a list of facts does. */
|
|
754
|
+
:is(.pane-list, .pane-page, .page-slot, .side-by-side-part) > .pane-toolbar {
|
|
755
|
+
padding-inline: var(--pane-row-inset);
|
|
756
|
+
}
|
|
757
|
+
|
|
733
758
|
.pane-toolbar > * {
|
|
734
759
|
flex: none;
|
|
735
760
|
}
|
|
@@ -781,6 +806,36 @@
|
|
|
781
806
|
margin: var(--space-4) var(--pane-row-inset) var(--space-2);
|
|
782
807
|
}
|
|
783
808
|
|
|
809
|
+
/* Two of a page's listings or sections (SideBySide): one over the other
|
|
810
|
+
until the pair's own room reaches its threshold, then in two equal
|
|
811
|
+
columns; the component measures the room and says which in
|
|
812
|
+
data-layout. A hairline parts them, under the first stacked and after
|
|
813
|
+
it side by side, where the first stretches to the taller one's height so
|
|
814
|
+
the line runs the pair's whole height. */
|
|
815
|
+
.side-by-side {
|
|
816
|
+
display: grid;
|
|
817
|
+
grid-template-columns: minmax(0, 1fr);
|
|
818
|
+
align-items: start;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.side-by-side[data-layout='side-by-side'] {
|
|
822
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
.side-by-side-part {
|
|
826
|
+
min-width: 0;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.side-by-side-part:first-child {
|
|
830
|
+
border-block-end: var(--line) solid var(--border);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.side-by-side[data-layout='side-by-side'] > .side-by-side-part:first-child {
|
|
834
|
+
align-self: stretch;
|
|
835
|
+
border-block-end: none;
|
|
836
|
+
border-inline-end: var(--line) solid var(--border);
|
|
837
|
+
}
|
|
838
|
+
|
|
784
839
|
/* A bar at a pane's foot, under its list: a select-all bar, a form's
|
|
785
840
|
actions. */
|
|
786
841
|
.pane-foot-bar {
|
package/dist/frame/index.d.ts
CHANGED
|
@@ -7,14 +7,16 @@
|
|
|
7
7
|
* and its `PaneWarning`, a pane status line's `StatusNotice`, the `Dock`
|
|
8
8
|
* with its log and input, the splitter between a list and the pane under
|
|
9
9
|
* it (`usePaneSplit`, `PaneSplitter`, `SplitDetail`), and a page's parts
|
|
10
|
-
* (`PageSlot`, `PanePage`, `Toolbar`, `PageNote`, `SectionHead`,
|
|
11
|
-
* rest). Their look is `frame.css` in
|
|
10
|
+
* (`PageSlot`, `PanePage`, `Toolbar`, `PageNote`, `SectionHead`,
|
|
11
|
+
* `SideBySide`, and the rest). Their look is `frame.css` in
|
|
12
|
+
* `@bigpixelrocket/uiok/styles.css`.
|
|
12
13
|
*/
|
|
13
14
|
export { AppRoot, PageSlot, SpacePanel, type AppRootProps, type PageSlotProps, type SpacePanelProps } from './AppRoot.js';
|
|
14
15
|
export { Dock, dockHeight, DockInput, DockLog, DockLogEntry, type DockInputProps, type DockLogEntryProps, type DockLogProps, type DockProps } from './Dock.js';
|
|
15
16
|
export { FilterChips, type FilterChip, type FilterChipsProps } from './FilterChips.js';
|
|
16
17
|
export { EmptyAction, FootBar, PageFilter, PageNote, PanePage, PaneWarning, SectionHead, ShowSidebarButton, Toolbar, ToolbarGap, ToolbarGrow, type PageNoteProps, type PagePartProps, type SectionHeadProps, type ShowSidebarButtonProps, type ToolbarProps } from './PageParts.js';
|
|
17
18
|
export { cutRowDepth, heldSplitHeight, PaneSplitter, SplitDetail, usePaneSplit, type PaneSplit, type PaneSplitterProps, type SplitDetailProps } from './PaneSplit.js';
|
|
19
|
+
export { SideBySide, type SideBySideProps } from './SideBySide.js';
|
|
18
20
|
export { draggedWidth, SidebarResizer, type SidebarResizerProps } from './SidebarResizer.js';
|
|
19
21
|
export { StatusNotice, type StatusNoticeProps, type StatusNoticeTone } from './StatusNotice.js';
|
|
20
22
|
export { SidebarEmpty, TreeFilterInput, TreeList, TreePane, TreeRow, TreeTool, type SidebarEmptyProps, type TreeFilterInputProps, type TreeListProps, type TreePaneProps, type TreeRowKind, type TreeRowProps, type TreeRowToggle, type TreeToolKind, type TreeToolProps } from './Tree.js';
|
package/dist/frame/index.js
CHANGED
|
@@ -7,14 +7,16 @@
|
|
|
7
7
|
* and its `PaneWarning`, a pane status line's `StatusNotice`, the `Dock`
|
|
8
8
|
* with its log and input, the splitter between a list and the pane under
|
|
9
9
|
* it (`usePaneSplit`, `PaneSplitter`, `SplitDetail`), and a page's parts
|
|
10
|
-
* (`PageSlot`, `PanePage`, `Toolbar`, `PageNote`, `SectionHead`,
|
|
11
|
-
* rest). Their look is `frame.css` in
|
|
10
|
+
* (`PageSlot`, `PanePage`, `Toolbar`, `PageNote`, `SectionHead`,
|
|
11
|
+
* `SideBySide`, and the rest). Their look is `frame.css` in
|
|
12
|
+
* `@bigpixelrocket/uiok/styles.css`.
|
|
12
13
|
*/
|
|
13
14
|
export { AppRoot, PageSlot, SpacePanel } from './AppRoot.js';
|
|
14
15
|
export { Dock, dockHeight, DockInput, DockLog, DockLogEntry } from './Dock.js';
|
|
15
16
|
export { FilterChips } from './FilterChips.js';
|
|
16
17
|
export { EmptyAction, FootBar, PageFilter, PageNote, PanePage, PaneWarning, SectionHead, ShowSidebarButton, Toolbar, ToolbarGap, ToolbarGrow } from './PageParts.js';
|
|
17
18
|
export { cutRowDepth, heldSplitHeight, PaneSplitter, SplitDetail, usePaneSplit } from './PaneSplit.js';
|
|
19
|
+
export { SideBySide } from './SideBySide.js';
|
|
18
20
|
export { draggedWidth, SidebarResizer } from './SidebarResizer.js';
|
|
19
21
|
export { StatusNotice } from './StatusNotice.js';
|
|
20
22
|
export { SidebarEmpty, TreeFilterInput, TreeList, TreePane, TreeRow, TreeTool } from './Tree.js';
|
package/dist/grid/grid.css
CHANGED
|
@@ -53,9 +53,26 @@ export function isTextEditingTarget(target) {
|
|
|
53
53
|
if (target.closest('textarea') instanceof HTMLTextAreaElement) {
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
return isEditableContent(target);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Whether an element's content is editable, as the browser resolves it
|
|
60
|
+
* (`isContentEditable`), or, where that is missing (jsdom), by walking up
|
|
61
|
+
* past `inherit` and absent or unknown values to the nearest `true`, `''`,
|
|
62
|
+
* `plaintext-only`, or `false`.
|
|
63
|
+
*/
|
|
64
|
+
function isEditableContent(element) {
|
|
65
|
+
if (element instanceof HTMLElement && typeof element.isContentEditable === 'boolean') {
|
|
66
|
+
return element.isContentEditable;
|
|
67
|
+
}
|
|
68
|
+
for (let node = element; node !== null; node = node.parentElement) {
|
|
69
|
+
const setting = node.getAttribute('contenteditable')?.toLowerCase();
|
|
70
|
+
if (setting === '' || setting === 'true' || setting === 'plaintext-only')
|
|
71
|
+
return true;
|
|
72
|
+
if (setting === 'false')
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
59
76
|
}
|
|
60
77
|
/**
|
|
61
78
|
* Controls and explicitly focusable surfaces whose native key behavior must
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
2
|
import type { Chord } from '../keyboard/Keyboard.logic.js';
|
|
3
3
|
import { type LayerModifier } from '../keyboard/KeyChord.logic.js';
|
|
4
4
|
/**
|
|
@@ -19,9 +19,26 @@ export interface KeyChordProps {
|
|
|
19
19
|
readonly recording?: boolean;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* A chord as a row of key caps in a `<kbd>`. The accessible name
|
|
23
|
-
* the full chord in words ("Shift Command N", from
|
|
24
|
-
* when the drawing omits a modifier a strip shows
|
|
22
|
+
* A chord as a row of key caps in a `<kbd role="img">`. The accessible name
|
|
23
|
+
* is always the full chord in words ("Shift Command N", from
|
|
24
|
+
* `UiokLabels.keys`), even when the drawing omits a modifier a strip shows
|
|
25
|
+
* once, and a control round it reads it in its own name. A chord with an
|
|
25
26
|
* empty key draws its modifiers alone.
|
|
26
27
|
*/
|
|
27
28
|
export declare function KeyChord({ chord, omit, tone, recording }: KeyChordProps): ReactElement;
|
|
29
|
+
/** Props for {@link KeyChords}. */
|
|
30
|
+
export interface KeyChordsProps {
|
|
31
|
+
/** The chords that run one verb, in the order to show them. */
|
|
32
|
+
readonly chords: readonly Chord[];
|
|
33
|
+
/** Every chord's look (`KeyChord`'s `tone`). */
|
|
34
|
+
readonly tone?: KeyChordTone;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Several chords that run one verb, each its own `KeyChord`, parted by the
|
|
38
|
+
* `keys.or` word ("⇧⌘N or ⌘N"), drawn quiet between them and read between
|
|
39
|
+
* their names ("Shift Command N or Command N"), so two chords never run
|
|
40
|
+
* together as one. One chord draws alone; none draws nothing. Put `keycap`
|
|
41
|
+
* on an element round it to draw each chord as a key cap. Draws
|
|
42
|
+
* `.keychords` with `.keychords-or` between the chords.
|
|
43
|
+
*/
|
|
44
|
+
export declare function KeyChords({ chords, tone }: KeyChordsProps): ReactElement | null;
|