@bigpixelrocket/uiok 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/button/TextLink.d.ts +9 -2
  3. package/dist/button/TextLink.js +4 -3
  4. package/dist/button/button.css +7 -0
  5. package/dist/dialog/SectionedDialog.d.ts +37 -0
  6. package/dist/dialog/SectionedDialog.js +157 -0
  7. package/dist/dialog/dialog.css +102 -0
  8. package/dist/dialog/index.d.ts +4 -2
  9. package/dist/dialog/index.js +4 -2
  10. package/dist/frame/AppRoot.d.ts +1 -1
  11. package/dist/frame/AppRoot.js +2 -1
  12. package/dist/frame/Dock.d.ts +1 -1
  13. package/dist/frame/Dock.js +2 -1
  14. package/dist/frame/FilterChips.d.ts +5 -2
  15. package/dist/frame/FilterChips.js +35 -2
  16. package/dist/frame/FilterChips.logic.d.ts +24 -0
  17. package/dist/frame/FilterChips.logic.js +34 -0
  18. package/dist/frame/PageParts.d.ts +4 -3
  19. package/dist/frame/PageParts.js +10 -3
  20. package/dist/frame/SideBySide.d.ts +32 -0
  21. package/dist/frame/SideBySide.js +50 -0
  22. package/dist/frame/Tree.d.ts +1 -1
  23. package/dist/frame/Tree.js +3 -2
  24. package/dist/frame/WindowFrame.d.ts +1 -1
  25. package/dist/frame/WindowFrame.js +2 -1
  26. package/dist/frame/frame.css +48 -1
  27. package/dist/frame/index.d.ts +4 -2
  28. package/dist/frame/index.js +4 -2
  29. package/dist/grid/grid.css +1 -0
  30. package/dist/keyboard/Keyboard.logic.js +20 -3
  31. package/dist/keychord/KeyChord.d.ts +17 -1
  32. package/dist/keychord/KeyChord.js +16 -1
  33. package/dist/keychord/ShortcutIndex.d.ts +49 -0
  34. package/dist/keychord/ShortcutIndex.js +28 -0
  35. package/dist/keychord/index.d.ts +8 -2
  36. package/dist/keychord/index.js +8 -2
  37. package/dist/keychord/keychord.css +101 -0
  38. package/dist/labels/dialog.d.ts +2 -0
  39. package/dist/labels/dialog.js +2 -1
  40. package/dist/labels/keys.d.ts +5 -0
  41. package/dist/labels/keys.js +2 -1
  42. package/dist/listing/Listing.d.ts +36 -4
  43. package/dist/listing/Listing.js +21 -6
  44. package/dist/listing/PaneMessage.d.ts +7 -4
  45. package/dist/listing/PaneMessage.js +11 -4
  46. package/dist/listing/index.d.ts +1 -1
  47. package/dist/listing/listing.css +84 -4
  48. package/dist/menu/Menu.d.ts +52 -8
  49. package/dist/menu/Menu.js +288 -80
  50. package/dist/menu/Menu.logic.d.ts +39 -12
  51. package/dist/menu/Menu.logic.js +36 -8
  52. package/dist/menu/index.d.ts +4 -3
  53. package/dist/menu/index.js +2 -1
  54. package/dist/menu/menu.css +6 -0
  55. package/dist/palette/PaletteRows.d.ts +11 -2
  56. package/dist/palette/PaletteRows.js +6 -4
  57. package/dist/pane/Pane.d.ts +42 -6
  58. package/dist/pane/Pane.js +92 -5
  59. package/dist/pane/PaneKeys.d.ts +5 -1
  60. package/dist/pane/PaneKeys.js +28 -3
  61. package/dist/pane/PaneKeys.logic.d.ts +25 -0
  62. package/dist/pane/PaneKeys.logic.js +30 -0
  63. package/dist/pane/index.d.ts +1 -1
  64. package/dist/pane/index.js +1 -1
  65. package/dist/pane/usePaneKeys.d.ts +8 -1
  66. package/dist/pane/usePaneKeys.js +32 -12
  67. package/dist/styles.css +17 -3
  68. package/dist/surface/FactList.d.ts +54 -0
  69. package/dist/surface/FactList.js +33 -0
  70. package/dist/surface/index.d.ts +4 -1
  71. package/dist/surface/index.js +4 -1
  72. package/dist/surface/surface.css +75 -2
  73. package/dist/terminal/ghostty/core.d.ts +12 -4
  74. package/dist/terminal/ghostty/core.js +12 -4
  75. package/dist/terminal/index.d.ts +4 -2
  76. package/dist/terminal/index.js +4 -2
  77. package/dist/text/Code.d.ts +15 -0
  78. package/dist/text/Code.js +12 -0
  79. package/dist/text/index.d.ts +6 -1
  80. package/dist/text/index.js +6 -1
  81. package/dist/text/text.css +21 -0
  82. package/dist/themes/tokens.js +3 -1
  83. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import type { LucideIcon } from 'lucide-react';
2
- import type { ReactElement, ReactNode } from 'react';
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: its glyph or
38
- * spinner beside the words, from the rows' inset.
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`. */
@@ -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: its glyph or
31
- * spinner beside the words, from the rows' inset.
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
- return (_jsxs("p", { className: "pane-message pane-page-note", role: busy ? 'status' : undefined, children: [busy ? (_jsx(Spinner, { size: ICON_MD })) : Icon === undefined ? null : (_jsx(Icon, { "aria-hidden": true, size: ICON_MD })), _jsx("span", { children: children })] }));
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", { 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,32 @@
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. The room is the
25
+ * pair's own, measured as it resizes (`data-layout`: `side-by-side` or
26
+ * `stacked`), so a pane narrowed by its sidebar or a split stacks them
27
+ * though the window is wide. It is a layout alone: each part is a group
28
+ * named by its label, in the page's reading order (the first, then the
29
+ * second), and holds no cursor and answers no key; the rows inside follow
30
+ * whatever `RowCursorContext` is around them.
31
+ */
32
+ export declare function SideBySide({ from, first, firstLabel, second, secondLabel }: SideBySideProps): ReactElement;
@@ -0,0 +1,50 @@
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. The room is the
18
+ * pair's own, measured as it resizes (`data-layout`: `side-by-side` or
19
+ * `stacked`), so a pane narrowed by its sidebar or a split stacks them
20
+ * though the window is wide. It is a layout alone: each part is a group
21
+ * named by its label, in the page's reading order (the first, then the
22
+ * second), and holds no cursor and answers no key; the rows inside follow
23
+ * whatever `RowCursorContext` is around them.
24
+ */
25
+ export function SideBySide({ from, first, firstLabel, second, secondLabel }) {
26
+ const ref = useRef(null);
27
+ const [sideBySide, setSideBySide] = useState(false);
28
+ // Measured before the first paint, so the pair never draws in the other
29
+ // layout first. A threshold a prop gives cannot reach a container query,
30
+ // whose conditions read no custom property, so the width is read here.
31
+ useLayoutEffect(() => {
32
+ const element = ref.current;
33
+ if (element === null)
34
+ return undefined;
35
+ // A width of 0 is a page not laid out (held behind another tab), which keeps its layout.
36
+ const measure = () => {
37
+ const width = element.clientWidth;
38
+ if (width > 0)
39
+ setSideBySide((now) => width >= (now ? from - SCROLLBAR_HOLD : from));
40
+ };
41
+ measure();
42
+ // Optional: jsdom has no ResizeObserver.
43
+ if (typeof ResizeObserver === 'undefined')
44
+ return undefined;
45
+ const observer = new ResizeObserver(measure);
46
+ observer.observe(element);
47
+ return () => observer.disconnect();
48
+ }, [from]);
49
+ 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 })] }));
50
+ }
@@ -1,6 +1,6 @@
1
1
  import { type LucideIcon } from 'lucide-react';
2
2
  import { type KeyboardEvent, type ReactElement, type ReactNode, type Ref } from 'react';
3
- import type { RegionHandlers } from '../pane/Pane.js';
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). */
@@ -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 } 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
@@ -77,7 +78,7 @@ export function TreeList({ label, ref, children, ...handlers }) {
77
78
  });
78
79
  }
79
80
  }), [tree]);
80
- return (_jsx("div", { "aria-label": label, className: "pane-list tree", "data-pane-home": "sidebar", ref: attach, role: "tree", tabIndex: -1, ...handlers, children: _jsx(TreeIdContext.Provider, { value: scope, children: children }) }));
81
+ return (_jsx("div", { "aria-label": label, className: "pane-list tree", "data-pane-home": "sidebar", ref: attach, role: "tree", tabIndex: -1, ...regionHandlers(handlers), children: _jsx(TreeIdContext.Provider, { value: scope, children: children }) }));
81
82
  }
82
83
  /**
83
84
  * One row of a sidebar's tree: the chevron's slot, the glyph, the name (cut
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement, ReactNode, Ref } from 'react';
2
- import type { RegionHandlers } from '../pane/Pane.js';
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
  }
@@ -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);
@@ -781,6 +798,36 @@
781
798
  margin: var(--space-4) var(--pane-row-inset) var(--space-2);
782
799
  }
783
800
 
801
+ /* Two of a page's listings or sections (SideBySide): one over the other
802
+ until the pair's own room reaches its threshold, then in two equal
803
+ columns; the component measures the room and says which in
804
+ data-layout. A hairline parts them, under the first stacked and after
805
+ it side by side, where the first stretches to the taller one's height so
806
+ the line runs the pair's whole height. */
807
+ .side-by-side {
808
+ display: grid;
809
+ grid-template-columns: minmax(0, 1fr);
810
+ align-items: start;
811
+ }
812
+
813
+ .side-by-side[data-layout='side-by-side'] {
814
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
815
+ }
816
+
817
+ .side-by-side-part {
818
+ min-width: 0;
819
+ }
820
+
821
+ .side-by-side-part:first-child {
822
+ border-block-end: var(--line) solid var(--border);
823
+ }
824
+
825
+ .side-by-side[data-layout='side-by-side'] > .side-by-side-part:first-child {
826
+ align-self: stretch;
827
+ border-block-end: none;
828
+ border-inline-end: var(--line) solid var(--border);
829
+ }
830
+
784
831
  /* A bar at a pane's foot, under its list: a select-all bar, a form's
785
832
  actions. */
786
833
  .pane-foot-bar {
@@ -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`, and the
11
- * rest). Their look is `frame.css` in `@bigpixelrocket/uiok/styles.css`.
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';
@@ -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`, and the
11
- * rest). Their look is `frame.css` in `@bigpixelrocket/uiok/styles.css`.
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';
@@ -420,6 +420,7 @@
420
420
  .disclosure,
421
421
  .settings-sidebar-page,
422
422
  .settings-sidebar-subsection,
423
+ .sectioned-dialog-nav-row,
423
424
  .quiet-control,
424
425
  .quiet-track-item,
425
426
  .toggle-chip
@@ -53,9 +53,26 @@ export function isTextEditingTarget(target) {
53
53
  if (target.closest('textarea') instanceof HTMLTextAreaElement) {
54
54
  return true;
55
55
  }
56
- const contentEditable = target.closest('[contenteditable]');
57
- const setting = contentEditable?.getAttribute('contenteditable')?.toLowerCase();
58
- return setting === '' || setting === 'true' || setting === 'plaintext-only';
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 { ReactElement } from 'react';
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
  /**
@@ -25,3 +25,19 @@ export interface KeyChordProps {
25
25
  * empty key draws its modifiers alone.
26
26
  */
27
27
  export declare function KeyChord({ chord, omit, tone, recording }: KeyChordProps): ReactElement;
28
+ /** Props for {@link KeyChords}. */
29
+ export interface KeyChordsProps {
30
+ /** The chords that run one verb, in the order to show them. */
31
+ readonly chords: readonly Chord[];
32
+ /** Every chord's look (`KeyChord`'s `tone`). */
33
+ readonly tone?: KeyChordTone;
34
+ }
35
+ /**
36
+ * Several chords that run one verb, each its own `KeyChord`, parted by the
37
+ * `keys.or` word ("⇧⌘N or ⌘N"), drawn quiet between them and read between
38
+ * their names ("Shift Command N or Command N"), so two chords never run
39
+ * together as one. One chord draws alone; none draws nothing. Put `keycap`
40
+ * on an element round it to draw each chord as a key cap. Draws
41
+ * `.keychords` with `.keychords-or` between the chords.
42
+ */
43
+ export declare function KeyChords({ chords, tone }: KeyChordsProps): ReactElement | null;
@@ -1,5 +1,6 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowBigUp, ArrowDown, ArrowDownToLine, ArrowLeft, ArrowRight, ArrowRightToLine, ArrowUp, ArrowUpToLine, ChevronUp, ChevronsDown, ChevronsUp, Command, CornerDownLeft, Delete, Option, Slash } from 'lucide-react';
3
+ import { Fragment } from 'react';
3
4
  import { chordParts, chordSpoken } from '../keyboard/KeyChord.logic.js';
4
5
  import { useLabels } from '../labels/UiokProvider.js';
5
6
  /**
@@ -53,3 +54,17 @@ export function KeyChord({ chord, omit = [], tone, recording = false }) {
53
54
  const parts = chordParts(chord).filter((part) => typeof part === 'object' ? part.key !== '' : !omit.includes(part));
54
55
  return (_jsx("kbd", { "aria-label": chordSpoken(chord, keys), className: "keychord", "data-state": recording ? 'recording' : undefined, "data-tone": tone, children: parts.map((part, index) => (_jsx(Key, { labels: keys, part: part }, index))) }));
55
56
  }
57
+ /**
58
+ * Several chords that run one verb, each its own `KeyChord`, parted by the
59
+ * `keys.or` word ("⇧⌘N or ⌘N"), drawn quiet between them and read between
60
+ * their names ("Shift Command N or Command N"), so two chords never run
61
+ * together as one. One chord draws alone; none draws nothing. Put `keycap`
62
+ * on an element round it to draw each chord as a key cap. Draws
63
+ * `.keychords` with `.keychords-or` between the chords.
64
+ */
65
+ export function KeyChords({ chords, tone }) {
66
+ const { keys } = useLabels();
67
+ if (chords.length === 0)
68
+ return null;
69
+ return (_jsx("span", { className: "keychords", children: chords.map((chord, index) => (_jsxs(Fragment, { children: [index === 0 ? null : _jsx("span", { className: "keychords-or", children: keys.or }), _jsx(KeyChord, { chord: chord, tone: tone })] }, index))) }));
70
+ }
@@ -0,0 +1,49 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import type { Chord } from '../keyboard/Keyboard.logic.js';
3
+ /** Props for {@link ShortcutIndex}. */
4
+ export interface ShortcutIndexProps {
5
+ /** The index's accessible name: "Keyboard shortcuts". */
6
+ readonly label: string;
7
+ /** Its groups (`ShortcutGroup`), in order. */
8
+ readonly children: ReactNode;
9
+ }
10
+ /**
11
+ * Every key a window answers, in groups of verbs, each verb with the chords
12
+ * that run it: one grid for every group, so the chords stand in one column
13
+ * at the index's end from the first group to the last, whatever each group's
14
+ * longest verb. Put it in a dialog (a frosted `ModalDialog`) or a page; a
15
+ * find field above it is the host's. Draws `.shortcut-index`.
16
+ */
17
+ export declare function ShortcutIndex({ label, children }: ShortcutIndexProps): ReactElement;
18
+ /** Props for {@link ShortcutGroup}. */
19
+ export interface ShortcutGroupProps {
20
+ /** The group's name, as an overline over its verbs: "Services". */
21
+ readonly title: string;
22
+ /** Its verbs (`ShortcutRow`). */
23
+ readonly children: ReactNode;
24
+ }
25
+ /** One group of a `ShortcutIndex`: its name over its verbs, a hairline above every group but the first. */
26
+ export declare function ShortcutGroup({ title, children }: ShortcutGroupProps): ReactElement;
27
+ /** Props for {@link ShortcutRow}. */
28
+ export interface ShortcutRowProps {
29
+ /** The verb, as menus name it: "Restart". */
30
+ readonly verb: string;
31
+ /** What it does, beyond its name, in a quieter line under it. */
32
+ readonly detail?: string;
33
+ /** The chords that run it now, each drawn as a key cap; none draws `none`. */
34
+ readonly chords: readonly Chord[];
35
+ /** The words in the chord column when it has no chord: "No shortcut". */
36
+ readonly none?: string;
37
+ /** Its chords were changed from the defaults: the caps wear the accent tone. */
38
+ readonly changed?: boolean;
39
+ /** Not available where the index was opened: the verb and its chords a tone down. */
40
+ readonly dim?: boolean;
41
+ }
42
+ /**
43
+ * One verb of a `ShortcutGroup`: its name (and a detail under it) at the
44
+ * start, its chords as key caps at the end, in the index's one chord
45
+ * column; several chords are parted by "or" (`KeyChords`) and wrap within
46
+ * the column, aligned to its end. Each chord is named in words for
47
+ * assistive technology (`KeyChord`).
48
+ */
49
+ export declare function ShortcutRow({ verb, detail, chords, none, changed, dim }: ShortcutRowProps): ReactElement;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { KeyChords } from './KeyChord.js';
4
+ /**
5
+ * Every key a window answers, in groups of verbs, each verb with the chords
6
+ * that run it: one grid for every group, so the chords stand in one column
7
+ * at the index's end from the first group to the last, whatever each group's
8
+ * longest verb. Put it in a dialog (a frosted `ModalDialog`) or a page; a
9
+ * find field above it is the host's. Draws `.shortcut-index`.
10
+ */
11
+ export function ShortcutIndex({ label, children }) {
12
+ return (_jsx("div", { "aria-label": label, className: "shortcut-index", role: "region", children: children }));
13
+ }
14
+ /** One group of a `ShortcutIndex`: its name over its verbs, a hairline above every group but the first. */
15
+ export function ShortcutGroup({ title, children }) {
16
+ const headingId = useId();
17
+ return (_jsxs("section", { "aria-labelledby": headingId, className: "shortcut-group", children: [_jsx("h3", { className: "shortcut-group-title overline", id: headingId, children: title }), _jsx("dl", { className: "shortcut-group-rows", children: children })] }));
18
+ }
19
+ /**
20
+ * One verb of a `ShortcutGroup`: its name (and a detail under it) at the
21
+ * start, its chords as key caps at the end, in the index's one chord
22
+ * column; several chords are parted by "or" (`KeyChords`) and wrap within
23
+ * the column, aligned to its end. Each chord is named in words for
24
+ * assistive technology (`KeyChord`).
25
+ */
26
+ export function ShortcutRow({ verb, detail, chords, none, changed = false, dim = false }) {
27
+ return (_jsxs("div", { className: dim ? 'shortcut-row dim' : 'shortcut-row', children: [_jsxs("dt", { className: "shortcut-verb", children: [verb, detail === undefined ? null : _jsx("span", { className: "shortcut-detail", children: detail })] }), _jsx("dd", { className: "shortcut-chords keycap", children: chords.length === 0 ? (_jsx("span", { className: "shortcut-none", children: none })) : (_jsx(KeyChords, { chords: chords, tone: changed ? 'accent' : undefined })) })] }));
28
+ }
@@ -1,2 +1,8 @@
1
- /** `KeyChord`: a chord drawn as key caps, named in words for assistive technology. */
2
- export { KeyChord, type KeyChordProps, type KeyChordTone } from './KeyChord.js';
1
+ /**
2
+ * `KeyChord`: a chord drawn as key caps, named in words for assistive
3
+ * technology; `KeyChords`, several chords for one verb parted by "or";
4
+ * `ShortcutIndex` with `ShortcutGroup` and `ShortcutRow`, every
5
+ * key a window answers in groups whose chords share one column.
6
+ */
7
+ export { KeyChord, KeyChords, type KeyChordProps, type KeyChordsProps, type KeyChordTone } from './KeyChord.js';
8
+ export { ShortcutGroup, ShortcutIndex, ShortcutRow, type ShortcutGroupProps, type ShortcutIndexProps, type ShortcutRowProps } from './ShortcutIndex.js';
@@ -1,2 +1,8 @@
1
- /** `KeyChord`: a chord drawn as key caps, named in words for assistive technology. */
2
- export { KeyChord } from './KeyChord.js';
1
+ /**
2
+ * `KeyChord`: a chord drawn as key caps, named in words for assistive
3
+ * technology; `KeyChords`, several chords for one verb parted by "or";
4
+ * `ShortcutIndex` with `ShortcutGroup` and `ShortcutRow`, every
5
+ * key a window answers in groups whose chords share one column.
6
+ */
7
+ export { KeyChord, KeyChords } from './KeyChord.js';
8
+ export { ShortcutGroup, ShortcutIndex, ShortcutRow } from './ShortcutIndex.js';
@@ -117,3 +117,104 @@
117
117
  outline: var(--line) solid var(--accent);
118
118
  outline-offset: var(--line);
119
119
  }
120
+
121
+ /* ---- Several chords (KeyChords) ----
122
+
123
+ Chords that run one verb, parted by a quiet word ("or") so two never
124
+ read as one run of keys; they wrap whole, never inside a chord. */
125
+ .keychords {
126
+ display: inline-flex;
127
+ flex-wrap: wrap;
128
+ align-items: center;
129
+ gap: var(--space-2) var(--space-3);
130
+ }
131
+
132
+ .keychords-or {
133
+ color: var(--text-dim);
134
+ font-size: var(--font-size-caption);
135
+ }
136
+
137
+ /* ---- Shortcut index (ShortcutIndex, ShortcutGroup, ShortcutRow) ----
138
+
139
+ Every key a window answers, in groups: one grid down the whole index
140
+ (each group and each row a subgrid of it), so the chord column stands at
141
+ the index's end at one width from the first group to the last. A verb
142
+ takes the room left; its chords sit at the column's end, several
143
+ wrapping within it. The column is as wide as its longest chords but
144
+ never more than half the index, so a verb with many chords wraps them
145
+ instead of squeezing every verb to nothing. A hairline parts the
146
+ groups. */
147
+ .shortcut-index {
148
+ display: grid;
149
+ grid-template-columns: minmax(0, 1fr) fit-content(50%);
150
+ column-gap: var(--space-8);
151
+ font: var(--font-size-small) / var(--line-height-compact) var(--font-ui);
152
+ }
153
+
154
+ .shortcut-group,
155
+ .shortcut-group-rows,
156
+ .shortcut-row {
157
+ display: grid;
158
+ grid-column: 1 / -1;
159
+ grid-template-columns: subgrid;
160
+ margin: 0;
161
+ }
162
+
163
+ .shortcut-group {
164
+ padding-block: var(--space-6);
165
+ }
166
+
167
+ .shortcut-group:first-child {
168
+ padding-block-start: 0;
169
+ }
170
+
171
+ .shortcut-group + .shortcut-group {
172
+ border-top: var(--line) solid var(--border);
173
+ }
174
+
175
+ .shortcut-group-title {
176
+ grid-column: 1 / -1;
177
+ margin: 0 0 var(--space-3);
178
+ }
179
+
180
+ .shortcut-row {
181
+ align-items: center;
182
+ min-height: var(--row-height-dense);
183
+ padding-block: var(--space-1);
184
+ }
185
+
186
+ .shortcut-verb {
187
+ min-width: 0;
188
+ color: var(--text);
189
+ overflow-wrap: break-word;
190
+ }
191
+
192
+ .shortcut-detail {
193
+ display: block;
194
+ color: var(--text-dim);
195
+ font-size: var(--font-size-caption);
196
+ }
197
+
198
+ .shortcut-chords {
199
+ display: flex;
200
+ justify-content: flex-end;
201
+ margin: 0;
202
+ }
203
+
204
+ .shortcut-chords > .keychords {
205
+ justify-content: flex-end;
206
+ }
207
+
208
+ .shortcut-none {
209
+ color: var(--text-dim);
210
+ }
211
+
212
+ /* A verb not available where the index was opened: a tone down, its caps
213
+ too. */
214
+ .shortcut-row.dim > .shortcut-verb {
215
+ color: var(--text-dim);
216
+ }
217
+
218
+ .shortcut-row.dim > .shortcut-chords {
219
+ opacity: var(--disabled-opacity);
220
+ }
@@ -36,6 +36,8 @@ export interface DialogLabels {
36
36
  readonly runInBackground: string;
37
37
  /** The note under a typed-name confirmation's field (`TypedNameDialog`): "Type the name to confirm." */
38
38
  readonly typeName: string;
39
+ /** The accessible name of a sectioned dialog's sidebar (`SectionedDialog`): "Sections". */
40
+ readonly sections: string;
39
41
  }
40
42
  /** English dialog words: the `dialog` group `UiokProvider` starts from. */
41
43
  export declare const DEFAULT_DIALOG_LABELS: DialogLabels;
@@ -10,5 +10,6 @@ export const DEFAULT_DIALOG_LABELS = {
10
10
  stop: 'Stop',
11
11
  tryAgain: 'Try Again',
12
12
  runInBackground: 'Run in Background',
13
- typeName: 'Type the name to confirm.'
13
+ typeName: 'Type the name to confirm.',
14
+ sections: 'Sections'
14
15
  };
@@ -23,6 +23,11 @@ export interface KeyLabels {
23
23
  readonly spaceCap: string;
24
24
  /** What the Escape key cap says when a chord is drawn: "esc". */
25
25
  readonly escapeCap: string;
26
+ /**
27
+ * The word between two chords that run the same verb (`KeyChords`), drawn
28
+ * and read between them: "or".
29
+ */
30
+ readonly or: string;
26
31
  }
27
32
  /** English key names and macOS glyphs: the `keys` group `UiokProvider` starts from. */
28
33
  export declare const DEFAULT_KEY_LABELS: KeyLabels;