@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.
Files changed (107) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/dist/button/TextLink.d.ts +21 -2
  3. package/dist/button/TextLink.js +14 -3
  4. package/dist/button/button.css +7 -0
  5. package/dist/dialog/SectionedDialog.d.ts +37 -0
  6. package/dist/dialog/SectionedDialog.js +158 -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/field/FieldLayout.d.ts +3 -2
  11. package/dist/field/FieldLayout.js +8 -3
  12. package/dist/frame/AppRoot.d.ts +1 -1
  13. package/dist/frame/AppRoot.js +2 -1
  14. package/dist/frame/Dock.d.ts +1 -1
  15. package/dist/frame/Dock.js +2 -1
  16. package/dist/frame/FilterChips.d.ts +5 -2
  17. package/dist/frame/FilterChips.js +35 -2
  18. package/dist/frame/FilterChips.logic.d.ts +24 -0
  19. package/dist/frame/FilterChips.logic.js +34 -0
  20. package/dist/frame/PageParts.d.ts +4 -3
  21. package/dist/frame/PageParts.js +10 -3
  22. package/dist/frame/SideBySide.d.ts +33 -0
  23. package/dist/frame/SideBySide.js +62 -0
  24. package/dist/frame/Tree.d.ts +20 -7
  25. package/dist/frame/Tree.js +21 -8
  26. package/dist/frame/WindowFrame.d.ts +1 -1
  27. package/dist/frame/WindowFrame.js +2 -1
  28. package/dist/frame/frame.css +56 -1
  29. package/dist/frame/index.d.ts +4 -2
  30. package/dist/frame/index.js +4 -2
  31. package/dist/grid/grid.css +1 -0
  32. package/dist/keyboard/Keyboard.logic.js +20 -3
  33. package/dist/keychord/KeyChord.d.ts +21 -4
  34. package/dist/keychord/KeyChord.js +24 -5
  35. package/dist/keychord/ShortcutIndex.d.ts +49 -0
  36. package/dist/keychord/ShortcutIndex.js +28 -0
  37. package/dist/keychord/index.d.ts +8 -2
  38. package/dist/keychord/index.js +8 -2
  39. package/dist/keychord/keychord.css +101 -0
  40. package/dist/labels/dialog.d.ts +2 -0
  41. package/dist/labels/dialog.js +2 -1
  42. package/dist/labels/keys.d.ts +5 -0
  43. package/dist/labels/keys.js +2 -1
  44. package/dist/legend/legend.css +6 -10
  45. package/dist/listing/Listing.d.ts +54 -4
  46. package/dist/listing/Listing.js +61 -7
  47. package/dist/listing/PaneMessage.d.ts +7 -4
  48. package/dist/listing/PaneMessage.js +11 -4
  49. package/dist/listing/index.d.ts +1 -1
  50. package/dist/listing/listing.css +124 -5
  51. package/dist/menu/Menu.d.ts +52 -8
  52. package/dist/menu/Menu.js +288 -80
  53. package/dist/menu/Menu.logic.d.ts +39 -12
  54. package/dist/menu/Menu.logic.js +36 -8
  55. package/dist/menu/index.d.ts +4 -3
  56. package/dist/menu/index.js +2 -1
  57. package/dist/menu/menu.css +4 -0
  58. package/dist/palette/Palette.d.ts +3 -1
  59. package/dist/palette/Palette.js +14 -2
  60. package/dist/palette/PaletteRows.d.ts +28 -14
  61. package/dist/palette/PaletteRows.js +21 -17
  62. package/dist/pane/Pane.d.ts +50 -6
  63. package/dist/pane/Pane.js +112 -5
  64. package/dist/pane/PaneKeys.d.ts +5 -1
  65. package/dist/pane/PaneKeys.js +28 -3
  66. package/dist/pane/PaneKeys.logic.d.ts +25 -0
  67. package/dist/pane/PaneKeys.logic.js +30 -0
  68. package/dist/pane/PaneTabs.js +7 -3
  69. package/dist/pane/index.d.ts +1 -1
  70. package/dist/pane/index.js +1 -1
  71. package/dist/pane/panetabs.css +14 -2
  72. package/dist/pane/usePaneKeys.d.ts +8 -1
  73. package/dist/pane/usePaneKeys.js +32 -12
  74. package/dist/styles.css +40 -3
  75. package/dist/surface/FactList.d.ts +54 -0
  76. package/dist/surface/FactList.js +33 -0
  77. package/dist/surface/index.d.ts +4 -1
  78. package/dist/surface/index.js +4 -1
  79. package/dist/surface/surface.css +85 -2
  80. package/dist/terminal/TerminalMenu.js +1 -1
  81. package/dist/terminal/ghostty/core.d.ts +12 -4
  82. package/dist/terminal/ghostty/core.js +12 -4
  83. package/dist/terminal/index.d.ts +4 -2
  84. package/dist/terminal/index.js +4 -2
  85. package/dist/terminal/terminal.css +3 -2
  86. package/dist/text/Code.d.ts +15 -0
  87. package/dist/text/Code.js +12 -0
  88. package/dist/text/index.d.ts +6 -1
  89. package/dist/text/index.js +6 -1
  90. package/dist/text/text.css +21 -0
  91. package/dist/themes/tokens.js +8 -3
  92. package/dist/tokens.css +4 -0
  93. package/dist/viewer/HexView.js +17 -8
  94. package/dist/viewer/ImageView.js +5 -3
  95. package/dist/viewer/PdfView.d.ts +8 -1
  96. package/dist/viewer/PdfView.js +27 -2
  97. package/dist/viewer/SyntaxHighlighter.d.ts +3 -2
  98. package/dist/viewer/SyntaxHighlighter.js +7 -2
  99. package/dist/viewer/SyntaxLanguage.logic.d.ts +5 -0
  100. package/dist/viewer/SyntaxLanguage.logic.js +17 -3
  101. package/dist/viewer/SyntaxService.d.ts +3 -1
  102. package/dist/viewer/SyntaxService.js +8 -1
  103. package/dist/viewer/TextView.js +14 -7
  104. package/dist/viewer/ViewerClipboard.js +17 -6
  105. package/dist/viewer/ViewerFrame.logic.js +4 -1
  106. package/dist/viewer/types.d.ts +3 -2
  107. package/package.json +1 -1
@@ -63,7 +63,7 @@
63
63
  :where(.listing-root) .pane {
64
64
  position: relative;
65
65
  isolation: isolate;
66
- flex: 1 1 0;
66
+ flex: 1;
67
67
  min-width: 0;
68
68
  display: flex;
69
69
  flex-direction: column;
@@ -734,6 +734,7 @@ button.crumb-label.crumb-siblings > svg {
734
734
  .disclosure,
735
735
  .settings-sidebar-page,
736
736
  .settings-sidebar-subsection,
737
+ .sectioned-dialog-nav-row,
737
738
  .quiet-control,
738
739
  .quiet-track-item,
739
740
  .toggle-chip
@@ -1019,7 +1020,7 @@ button.crumb-label.crumb-siblings > svg {
1019
1020
  and an app's own placement of the label wins. */
1020
1021
  :where(
1021
1022
  .pane-listing:is(.listing-root, .listing-root *):has(> .row):not(
1022
- :has(> .row > .row-icon:not(:empty))
1023
+ :has(> .row > .row-icon:not(:empty), > .row > .row-pick)
1023
1024
  )
1024
1025
  )
1025
1026
  > .pane-columns
@@ -1712,12 +1713,16 @@ button.crumb-label.crumb-siblings > svg {
1712
1713
 
1713
1714
  /* A warning (.warning): the warning tone's TriangleAlert, drawn as a mask
1714
1715
  in --warning as the danger line's glyph is, then the words in --text. A
1715
- host that draws its own glyph first (an svg) gets no second one. */
1716
+ host that draws its own glyph first (an svg, inside a PaneMessage's
1717
+ words too) gets no second one. */
1716
1718
  :where(.listing-root) .pane-message.warning {
1717
1719
  color: var(--text);
1718
1720
  }
1719
1721
 
1720
- :where(.listing-root) .pane-message.warning:not(:has(> svg:first-child))::before {
1722
+ :where(.listing-root)
1723
+ .pane-message.warning:not(
1724
+ :has(> svg:first-child, > .pane-message-text > svg:first-child)
1725
+ )::before {
1721
1726
  content: '';
1722
1727
  flex: none;
1723
1728
  width: var(--icon-md);
@@ -1727,11 +1732,19 @@ button.crumb-label.crumb-siblings > svg {
1727
1732
  center / contain no-repeat;
1728
1733
  }
1729
1734
 
1730
- :where(.listing-root) .pane-message.warning > svg:first-child {
1735
+ :where(.listing-root) .pane-message.warning > svg:first-child,
1736
+ :where(.listing-root) .pane-message.warning > .pane-message-text > svg:first-child {
1731
1737
  flex: none;
1732
1738
  color: var(--warning);
1733
1739
  }
1734
1740
 
1741
+ /* A refusal's own glyph takes the danger tone, as the drawn one does. */
1742
+ :where(.listing-root) .pane-message.danger > svg:first-child,
1743
+ :where(.listing-root) .pane-message.danger > .pane-message-text > svg:first-child {
1744
+ flex: none;
1745
+ color: var(--danger);
1746
+ }
1747
+
1735
1748
  /* A line that says a listing has no rows (`.empty`, Listing's `empty`)
1736
1749
  reads as a quiet row in the rows' place: it starts where a row's icon
1737
1750
  starts, in the rows' own typeface and size (the host's, as the rows'
@@ -1742,6 +1755,33 @@ button.crumb-label.crumb-siblings > svg {
1742
1755
  line-height: var(--line-height-compact);
1743
1756
  }
1744
1757
 
1758
+ /* A message's words in one box (PaneMessage), so text and inline code
1759
+ flow as a sentence beside the glyph instead of as separate flex items.
1760
+ A glyph the host leads the words with lands in that box too: it keeps
1761
+ the glyph's place, the message's gap before the words, on the text's
1762
+ middle. The box takes the room after the glyph from a zero basis, so a
1763
+ long sentence wraps in its own column beside the glyph (a hanging
1764
+ indent), never under it. */
1765
+ :where(.listing-root) .pane-message-text {
1766
+ flex: 1;
1767
+ min-width: 0;
1768
+ }
1769
+
1770
+ :where(.listing-root) .pane-message-text > svg:first-child {
1771
+ width: var(--icon-md);
1772
+ height: var(--icon-md);
1773
+ margin-inline-end: var(--space-4);
1774
+ vertical-align: middle;
1775
+ }
1776
+
1777
+ /* The words after a glyph of the host's own hang in their own column, as
1778
+ they do beside the drawn one: the box steps in by the glyph and its gap,
1779
+ and its first line steps back out to start with the glyph. */
1780
+ :where(.listing-root) .pane-message-text:has(> svg:first-child) {
1781
+ padding-inline-start: calc(var(--icon-md) + var(--space-4));
1782
+ text-indent: calc(-1 * (var(--icon-md) + var(--space-4)));
1783
+ }
1784
+
1745
1785
  :where(.listing-root) .pane-message code {
1746
1786
  font-family: var(--font-mono);
1747
1787
  }
@@ -2371,6 +2411,32 @@ button.crumb-label.crumb-siblings > svg {
2371
2411
  color: var(--on-selected);
2372
2412
  }
2373
2413
 
2414
+ /* A link in words (TextLink) on an active selection takes the selection's
2415
+ words, a dimmed one the selection's quiet words: in its own accent or
2416
+ danger tone it would vanish on the accent fill. The list weighs as much as
2417
+ its danger and disabled rules (two classes), so it wins over each. */
2418
+ :where(.listing-root)
2419
+ .row.selected:where(
2420
+ :not(
2421
+ :root[data-window-inactive] .listing-root *,
2422
+ .listing-root:has(.pane.active) .pane:not(.active, .active .pane) *
2423
+ )
2424
+ )
2425
+ :is(.text-link, .text-link.danger) {
2426
+ color: var(--on-selected);
2427
+ }
2428
+
2429
+ :where(.listing-root)
2430
+ .row.selected:where(
2431
+ :not(
2432
+ :root[data-window-inactive] .listing-root *,
2433
+ .listing-root:has(.pane.active) .pane:not(.active, .active .pane) *
2434
+ )
2435
+ )
2436
+ .text-link:disabled {
2437
+ color: var(--on-selected-dim);
2438
+ }
2439
+
2374
2440
  /* A lit or red action under the pointer or the focus keeps the selection's
2375
2441
  words too: their own rules weigh more than the one above, and their tones
2376
2442
  are not floored on the accent. */
@@ -2531,6 +2597,29 @@ button.crumb-label.crumb-siblings > svg {
2531
2597
  border-color: var(--border-strong);
2532
2598
  }
2533
2599
 
2600
+ /* A row that is one choice of several (Row's `radio`): the radio in the
2601
+ icon column and the name after it, both in the name's cell, which spans
2602
+ the two columns as the strip's name label does. The words keep the
2603
+ name's ellipsis; the radio keeps its size. */
2604
+ :where(.listing-root) .row > .row-name.row-pick {
2605
+ grid-column: 1 / span 2;
2606
+ display: grid;
2607
+ grid-template-columns: var(--icon-column) minmax(0, 1fr);
2608
+ align-items: center;
2609
+ }
2610
+
2611
+ :where(.listing-root) .row-pick > .row-radio {
2612
+ justify-self: start;
2613
+ margin: 0;
2614
+ }
2615
+
2616
+ :where(.listing-root) .row-pick > .row-pick-name {
2617
+ min-width: 0;
2618
+ overflow: hidden;
2619
+ text-overflow: ellipsis;
2620
+ white-space: nowrap;
2621
+ }
2622
+
2534
2623
  /* A row that stands out from its peers (Row's `emphasis`): its name in the
2535
2624
  strong weight. */
2536
2625
  :where(.listing-root) .row.row-emphasis > .row-name {
@@ -2623,3 +2712,33 @@ button.crumb-label.crumb-siblings > svg {
2623
2712
  transform: translateY(-50%);
2624
2713
  white-space: nowrap;
2625
2714
  }
2715
+
2716
+ /* ---- The visual bell (PaneBox's bell) ----
2717
+ A key that could not act shoves the pane's cursor row sideways for one
2718
+ beat, the wrong-password shake. The parity classes alternate `bell-0`
2719
+ and `bell-1` on consecutive rings (useBellBeat), on keyframes of two
2720
+ names with the same steps (menu.css), so every refused key shoves again,
2721
+ the repeats of a held one included. Without motion the row flips to the
2722
+ selection fill for the beat instead, its words in the selection's. */
2723
+ :where(.listing-root) .pane.bell-0 .row.cursor {
2724
+ animation: row-nudge-a var(--duration-slow) var(--ease-in-out);
2725
+ }
2726
+
2727
+ :where(.listing-root) .pane.bell-1 .row.cursor {
2728
+ animation: row-nudge-b var(--duration-slow) var(--ease-in-out);
2729
+ }
2730
+
2731
+ @media (prefers-reduced-motion: reduce) {
2732
+ :where(.listing-root) .pane:is(.bell-0, .bell-1) .row.cursor {
2733
+ animation: none;
2734
+ --row-fill: var(--selected-bg);
2735
+ background: var(--row-fill);
2736
+ }
2737
+
2738
+ :where(.listing-root)
2739
+ .pane:is(.bell-0, .bell-1)
2740
+ .row.cursor
2741
+ :is(.row-icon, .row-name, .row-meta) {
2742
+ color: var(--on-selected);
2743
+ }
2744
+ }
@@ -38,8 +38,32 @@ export interface MenuHeadingEntry {
38
38
  readonly kind: 'heading';
39
39
  readonly label: string;
40
40
  }
41
+ /**
42
+ * An item that opens a submenu beside it ("Copy As", opening Path and File
43
+ * URL): its glyph and words, and a chevron at its end in place of a chord.
44
+ * It runs nothing itself; its submenu's items do.
45
+ */
46
+ export interface MenuSubmenuEntry {
47
+ readonly kind: 'submenu';
48
+ /** Names the item; unique in the menu, its submenus' items included. Never passed to `onPick`. */
49
+ readonly id: string;
50
+ /** The submenu's name, in words: "Copy As", "Open With". */
51
+ readonly label: string;
52
+ /** A lucide glyph in the icon column. */
53
+ readonly icon?: LucideIcon;
54
+ /** Anything else in the icon column, when `icon` is absent. */
55
+ readonly mark?: ReactNode;
56
+ /** Listed but not openable now: dimmed and passed over by the keys. Say why in `tip`. */
57
+ readonly disabled?: boolean;
58
+ /** More about the item, or why it is disabled: its tooltip and description. */
59
+ readonly tip?: string;
60
+ /** The submenu's entries, in order: items, separators, and headings, never another submenu. */
61
+ readonly entries: readonly MenuLeafEntry[];
62
+ }
63
+ /** An entry a submenu can hold: any but another submenu, so a menu nests one level deep. */
64
+ export type MenuLeafEntry = MenuItemEntry | MenuSeparatorEntry | MenuHeadingEntry;
41
65
  /** One entry of a menu, in order. */
42
- export type MenuEntry = MenuItemEntry | MenuSeparatorEntry | MenuHeadingEntry;
66
+ export type MenuEntry = MenuLeafEntry | MenuSubmenuEntry;
43
67
  /** Props for {@link Menu}. */
44
68
  export interface MenuProps {
45
69
  /** The menu's accessible name: "Actions", "Other versions". */
@@ -54,11 +78,21 @@ export interface MenuProps {
54
78
  * toggle it. Used when `at` is absent.
55
79
  */
56
80
  readonly anchor?: HTMLElement | null;
57
- /** The item the cursor starts on (the current one); the first that can run when absent. */
81
+ /**
82
+ * The item the cursor starts on (the current one), in the menu itself,
83
+ * not a submenu; the first that can run when absent.
84
+ */
58
85
  readonly initial?: string | null;
59
86
  /** The small size, for a menu of short commands (`.folder-menu-compact`). */
60
87
  readonly compact?: boolean;
61
- /** Runs an item that can run, by its id; the caller closes the menu. */
88
+ /**
89
+ * The direction it reads in, which its keys, a submenu's side, and the
90
+ * chevron follow; when absent, the direction of `anchor`, or of the place
91
+ * it is rendered in, as it opens (the document body it is drawn on may
92
+ * read the other way).
93
+ */
94
+ readonly dir?: 'ltr' | 'rtl';
95
+ /** Runs an item that can run, by its id, a submenu's items included; the caller closes the menu. */
62
96
  readonly onPick: (id: string) => void;
63
97
  /**
64
98
  * Closes the menu, saying how it was dismissed: by a key in it (Escape,
@@ -72,18 +106,28 @@ export interface MenuProps {
72
106
  * dropped from an element (a crumb's ⌄, an Actions button): each item its
73
107
  * glyph, its words, and its chord as key caps; a destructive one in the
74
108
  * danger tone; a setting with its check; the current place with its dot;
75
- * separators and group headings between them. It is the menu look
109
+ * separators and group headings between them; and items that open a
110
+ * submenu beside them, one level deep. It is the menu look
76
111
  * (`.folder-menu`) drawn through a portal on the document's body (or the
77
112
  * element shown full screen), so no pane or dialog clips it, placed inside
78
113
  * the window (`placeMenu`); React still carries its events to its owner.
79
114
  *
80
115
  * It takes the focus and holds the keys while open (`menuKeyAction`: ↑ ↓,
81
- * Home, End, Return and Space, Escape and Tab), which travel no further, so
82
- * neither a dialog nor the page hears them; `data-native-keyboard` keeps
83
- * the browser-key guard and a page's own key handlers out
116
+ * Home, End, Return and Space, → and ←, Escape and Tab), which travel no
117
+ * further, so neither a dialog nor the page hears them; `data-native-keyboard`
118
+ * keeps the browser-key guard and a page's own key handlers out
84
119
  * (`isNativeKeyboardTarget`), and `data-overlay` marks it an open overlay
85
120
  * while it shows. A press on it never takes the focus from it; a press or
86
121
  * a focus anywhere else closes it. A menu taller than the window less its
87
122
  * margins scrolls, and the keys keep the cursor's item in view.
123
+ *
124
+ * A submenu opens beside its item (on the inline-end side, or the other
125
+ * when the window has no room there) when the pointer rests on the item or
126
+ * presses it, showing without the keys, or with the keys and its cursor on
127
+ * its first item that can run on → (← in a right-to-left page), Return,
128
+ * or Space. ← goes back to its item, and Escape closes the submenu alone;
129
+ * Tab closes the whole menu. The pointer crossing other items on its way
130
+ * into the submenu leaves it open for a moment, and moving over the
131
+ * submenu gives it the keys.
88
132
  */
89
- export declare function Menu({ label, entries, at, anchor, initial, compact, onPick, onClose }: MenuProps): ReactElement;
133
+ export declare function Menu({ label, entries, at, anchor, initial, compact, dir: dirGiven, onPick, onClose }: MenuProps): ReactElement;