@bigpixelrocket/uiok 0.0.0-stage → 0.1.1

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 (280) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +569 -0
  4. package/README.md +44 -2
  5. package/dist/VisuallyHidden.d.ts +13 -0
  6. package/dist/VisuallyHidden.js +13 -0
  7. package/dist/activity/ActivityBar.d.ts +29 -0
  8. package/dist/activity/ActivityBar.js +21 -0
  9. package/dist/activity/activity.css +43 -0
  10. package/dist/activity/index.d.ts +2 -0
  11. package/dist/activity/index.js +2 -0
  12. package/dist/button/Button.d.ts +26 -0
  13. package/dist/button/Button.js +14 -0
  14. package/dist/button/IconButton.d.ts +18 -0
  15. package/dist/button/IconButton.js +14 -0
  16. package/dist/button/button.css +95 -0
  17. package/dist/button/index.d.ts +3 -0
  18. package/dist/button/index.js +3 -0
  19. package/dist/charts/Drawing.d.ts +27 -0
  20. package/dist/charts/Drawing.js +117 -0
  21. package/dist/charts/Drawing.logic.d.ts +2 -0
  22. package/dist/charts/Drawing.logic.js +22 -0
  23. package/dist/charts/Line.logic.d.ts +33 -0
  24. package/dist/charts/Line.logic.js +72 -0
  25. package/dist/charts/LineChart.d.ts +34 -0
  26. package/dist/charts/LineChart.js +100 -0
  27. package/dist/charts/Pie.logic.d.ts +16 -0
  28. package/dist/charts/Pie.logic.js +28 -0
  29. package/dist/charts/PieChart.d.ts +20 -0
  30. package/dist/charts/PieChart.js +16 -0
  31. package/dist/charts/ResultChart.d.ts +47 -0
  32. package/dist/charts/ResultChart.js +175 -0
  33. package/dist/charts/ResultChart.logic.d.ts +42 -0
  34. package/dist/charts/ResultChart.logic.js +165 -0
  35. package/dist/charts/Scatter.logic.d.ts +55 -0
  36. package/dist/charts/Scatter.logic.js +134 -0
  37. package/dist/charts/ScatterChart.d.ts +36 -0
  38. package/dist/charts/ScatterChart.js +99 -0
  39. package/dist/charts/charts.css +310 -0
  40. package/dist/charts/index.d.ts +14 -0
  41. package/dist/charts/index.js +11 -0
  42. package/dist/charts/seriesColour.d.ts +2 -0
  43. package/dist/charts/seriesColour.js +8 -0
  44. package/dist/clock/index.d.ts +2 -0
  45. package/dist/clock/index.js +2 -0
  46. package/dist/clock/useClock.d.ts +14 -0
  47. package/dist/clock/useClock.js +57 -0
  48. package/dist/datetime/DateTimePicker.d.ts +50 -0
  49. package/dist/datetime/DateTimePicker.js +98 -0
  50. package/dist/datetime/DateTimePicker.logic.d.ts +59 -0
  51. package/dist/datetime/DateTimePicker.logic.js +103 -0
  52. package/dist/datetime/datetime.css +115 -0
  53. package/dist/datetime/index.d.ts +7 -0
  54. package/dist/datetime/index.js +7 -0
  55. package/dist/dialog/ConfirmDialog.d.ts +73 -0
  56. package/dist/dialog/ConfirmDialog.js +30 -0
  57. package/dist/dialog/DialogLegend.d.ts +21 -0
  58. package/dist/dialog/DialogLegend.js +28 -0
  59. package/dist/dialog/DialogLegend.logic.d.ts +145 -0
  60. package/dist/dialog/DialogLegend.logic.js +71 -0
  61. package/dist/dialog/ModalDialog.d.ts +101 -0
  62. package/dist/dialog/ModalDialog.js +184 -0
  63. package/dist/dialog/dialog.css +283 -0
  64. package/dist/dialog/index.d.ts +8 -0
  65. package/dist/dialog/index.js +8 -0
  66. package/dist/filter/FilterEscape.d.ts +16 -0
  67. package/dist/filter/FilterEscape.js +15 -0
  68. package/dist/filter/FilterIcon.d.ts +8 -0
  69. package/dist/filter/FilterIcon.js +11 -0
  70. package/dist/filter/filter.css +42 -0
  71. package/dist/filter/index.d.ts +3 -0
  72. package/dist/filter/index.js +3 -0
  73. package/dist/grid/DataGrid.d.ts +149 -0
  74. package/dist/grid/DataGrid.js +373 -0
  75. package/dist/grid/DataGrid.logic.d.ts +57 -0
  76. package/dist/grid/DataGrid.logic.js +121 -0
  77. package/dist/grid/grid.css +206 -0
  78. package/dist/grid/index.d.ts +7 -0
  79. package/dist/grid/index.js +7 -0
  80. package/dist/index.d.ts +32 -0
  81. package/dist/index.js +32 -0
  82. package/dist/keyboard/BrowserKeys.d.ts +15 -0
  83. package/dist/keyboard/BrowserKeys.js +28 -0
  84. package/dist/keyboard/KeyChord.logic.d.ts +25 -0
  85. package/dist/keyboard/KeyChord.logic.js +50 -0
  86. package/dist/keyboard/Keyboard.logic.d.ts +84 -0
  87. package/dist/keyboard/Keyboard.logic.js +137 -0
  88. package/dist/keyboard/OverlayWatch.d.ts +28 -0
  89. package/dist/keyboard/OverlayWatch.js +119 -0
  90. package/dist/keyboard/PageSelectAll.d.ts +14 -0
  91. package/dist/keyboard/PageSelectAll.js +22 -0
  92. package/dist/keyboard/index.d.ts +9 -0
  93. package/dist/keyboard/index.js +9 -0
  94. package/dist/keychord/KeyChord.d.ts +16 -0
  95. package/dist/keychord/KeyChord.js +55 -0
  96. package/dist/keychord/index.d.ts +2 -0
  97. package/dist/keychord/index.js +2 -0
  98. package/dist/keychord/keychord.css +41 -0
  99. package/dist/labels/UiokLabels.d.ts +41 -0
  100. package/dist/labels/UiokLabels.js +31 -0
  101. package/dist/labels/UiokProvider.d.ts +44 -0
  102. package/dist/labels/UiokProvider.js +54 -0
  103. package/dist/labels/charts.d.ts +34 -0
  104. package/dist/labels/charts.js +15 -0
  105. package/dist/labels/dateTime.d.ts +32 -0
  106. package/dist/labels/dateTime.js +14 -0
  107. package/dist/labels/dialog.d.ts +18 -0
  108. package/dist/labels/dialog.js +6 -0
  109. package/dist/labels/index.d.ts +13 -0
  110. package/dist/labels/index.js +13 -0
  111. package/dist/labels/keys.d.ts +28 -0
  112. package/dist/labels/keys.js +53 -0
  113. package/dist/labels/legend.d.ts +21 -0
  114. package/dist/labels/legend.js +7 -0
  115. package/dist/labels/listing.d.ts +16 -0
  116. package/dist/labels/listing.js +8 -0
  117. package/dist/labels/pager.d.ts +32 -0
  118. package/dist/labels/pager.js +20 -0
  119. package/dist/labels/palette.d.ts +17 -0
  120. package/dist/labels/palette.js +6 -0
  121. package/dist/labels/selectAll.d.ts +15 -0
  122. package/dist/labels/selectAll.js +6 -0
  123. package/dist/labels/terminal.d.ts +25 -0
  124. package/dist/labels/terminal.js +9 -0
  125. package/dist/legend/KeyLegend.logic.d.ts +84 -0
  126. package/dist/legend/KeyLegend.logic.js +109 -0
  127. package/dist/legend/KeyLegendStrip.d.ts +36 -0
  128. package/dist/legend/KeyLegendStrip.js +82 -0
  129. package/dist/legend/index.d.ts +3 -0
  130. package/dist/legend/index.js +3 -0
  131. package/dist/legend/legend.css +148 -0
  132. package/dist/listing/CurrentDot.d.ts +15 -0
  133. package/dist/listing/CurrentDot.js +13 -0
  134. package/dist/listing/Listing.d.ts +230 -0
  135. package/dist/listing/Listing.js +265 -0
  136. package/dist/listing/PathParts.logic.d.ts +17 -0
  137. package/dist/listing/PathParts.logic.js +18 -0
  138. package/dist/listing/index.d.ts +10 -0
  139. package/dist/listing/index.js +10 -0
  140. package/dist/listing/listing.css +867 -0
  141. package/dist/menu/MenuQuery.logic.d.ts +69 -0
  142. package/dist/menu/MenuQuery.logic.js +75 -0
  143. package/dist/menu/fuzzyMatch.d.ts +31 -0
  144. package/dist/menu/fuzzyMatch.js +296 -0
  145. package/dist/menu/index.d.ts +9 -0
  146. package/dist/menu/index.js +9 -0
  147. package/dist/menu/menu.css +203 -0
  148. package/dist/menu/useBellBeat.d.ts +8 -0
  149. package/dist/menu/useBellBeat.js +26 -0
  150. package/dist/namecut/NameCut.d.ts +22 -0
  151. package/dist/namecut/NameCut.js +28 -0
  152. package/dist/namecut/NameCut.logic.d.ts +51 -0
  153. package/dist/namecut/NameCut.logic.js +120 -0
  154. package/dist/namecut/index.d.ts +3 -0
  155. package/dist/namecut/index.js +3 -0
  156. package/dist/namecut/namecut.css +67 -0
  157. package/dist/pager/Pager.d.ts +37 -0
  158. package/dist/pager/Pager.js +38 -0
  159. package/dist/pager/Pager.logic.d.ts +13 -0
  160. package/dist/pager/Pager.logic.js +63 -0
  161. package/dist/pager/index.d.ts +7 -0
  162. package/dist/pager/index.js +7 -0
  163. package/dist/pager/pager.css +62 -0
  164. package/dist/palette/Palette.d.ts +79 -0
  165. package/dist/palette/Palette.js +60 -0
  166. package/dist/palette/index.d.ts +6 -0
  167. package/dist/palette/index.js +6 -0
  168. package/dist/palette/palette.css +159 -0
  169. package/dist/pane/PaneActions.d.ts +104 -0
  170. package/dist/pane/PaneActions.js +62 -0
  171. package/dist/pane/PaneFrame.d.ts +51 -0
  172. package/dist/pane/PaneFrame.js +28 -0
  173. package/dist/pane/PaneKeys.d.ts +41 -0
  174. package/dist/pane/PaneKeys.js +104 -0
  175. package/dist/pane/PaneKeys.logic.d.ts +95 -0
  176. package/dist/pane/PaneKeys.logic.js +109 -0
  177. package/dist/pane/index.d.ts +11 -0
  178. package/dist/pane/index.js +11 -0
  179. package/dist/pane/usePaneKeys.d.ts +141 -0
  180. package/dist/pane/usePaneKeys.js +313 -0
  181. package/dist/run/RunHeader.d.ts +50 -0
  182. package/dist/run/RunHeader.js +31 -0
  183. package/dist/run/RunProgress.logic.d.ts +29 -0
  184. package/dist/run/RunProgress.logic.js +34 -0
  185. package/dist/run/index.d.ts +3 -0
  186. package/dist/run/index.js +3 -0
  187. package/dist/run/run.css +190 -0
  188. package/dist/segmented/SegmentedChoice.d.ts +22 -0
  189. package/dist/segmented/SegmentedChoice.js +31 -0
  190. package/dist/segmented/index.d.ts +2 -0
  191. package/dist/segmented/index.js +2 -0
  192. package/dist/segmented/segmented.css +49 -0
  193. package/dist/selectall/CheckRange.logic.d.ts +8 -0
  194. package/dist/selectall/CheckRange.logic.js +23 -0
  195. package/dist/selectall/SelectAllBar.d.ts +25 -0
  196. package/dist/selectall/SelectAllBar.js +24 -0
  197. package/dist/selectall/index.d.ts +7 -0
  198. package/dist/selectall/index.js +7 -0
  199. package/dist/selectall/selectall.css +31 -0
  200. package/dist/store/KeepUnchanged.logic.d.ts +19 -0
  201. package/dist/store/KeepUnchanged.logic.js +33 -0
  202. package/dist/store/SameProps.d.ts +15 -0
  203. package/dist/store/SameProps.js +46 -0
  204. package/dist/store/ValueStore.d.ts +17 -0
  205. package/dist/store/ValueStore.js +23 -0
  206. package/dist/store/index.d.ts +8 -0
  207. package/dist/store/index.js +8 -0
  208. package/dist/store/useStableHandlers.d.ts +13 -0
  209. package/dist/store/useStableHandlers.js +22 -0
  210. package/dist/styles.css +85 -0
  211. package/dist/tabs/PageTabs.d.ts +38 -0
  212. package/dist/tabs/PageTabs.js +33 -0
  213. package/dist/tabs/index.d.ts +2 -0
  214. package/dist/tabs/index.js +2 -0
  215. package/dist/tabs/tabs.css +64 -0
  216. package/dist/terminal/Terminal.d.ts +104 -0
  217. package/dist/terminal/Terminal.js +309 -0
  218. package/dist/terminal/Terminal.logic.d.ts +66 -0
  219. package/dist/terminal/Terminal.logic.js +156 -0
  220. package/dist/terminal/TerminalMenu.d.ts +36 -0
  221. package/dist/terminal/TerminalMenu.js +87 -0
  222. package/dist/terminal/TerminalMenu.logic.d.ts +78 -0
  223. package/dist/terminal/TerminalMenu.logic.js +68 -0
  224. package/dist/terminal/TerminalScrollback.d.ts +10 -0
  225. package/dist/terminal/TerminalScrollback.js +11 -0
  226. package/dist/terminal/ghostty/LICENSE +21 -0
  227. package/dist/terminal/ghostty/core.d.ts +315 -0
  228. package/dist/terminal/ghostty/core.js +1189 -0
  229. package/dist/terminal/ghostty/fallbackColors.d.ts +12 -0
  230. package/dist/terminal/ghostty/fallbackColors.js +23 -0
  231. package/dist/terminal/ghostty/fonts/LICENSE +21 -0
  232. package/dist/terminal/ghostty/fonts/SymbolsNerdFontMono-Regular.woff2 +0 -0
  233. package/dist/terminal/ghostty/keyCodes.logic.d.ts +20 -0
  234. package/dist/terminal/ghostty/keyCodes.logic.js +249 -0
  235. package/dist/terminal/ghostty/links.logic.d.ts +39 -0
  236. package/dist/terminal/ghostty/links.logic.js +84 -0
  237. package/dist/terminal/ghostty/renderer.d.ts +98 -0
  238. package/dist/terminal/ghostty/renderer.js +481 -0
  239. package/dist/terminal/ghostty/runtime.d.ts +126 -0
  240. package/dist/terminal/ghostty/runtime.js +346 -0
  241. package/dist/terminal/ghostty/spriteGlyphs.logic.d.ts +64 -0
  242. package/dist/terminal/ghostty/spriteGlyphs.logic.js +546 -0
  243. package/dist/terminal/ghostty/surface.d.ts +285 -0
  244. package/dist/terminal/ghostty/surface.js +1565 -0
  245. package/dist/terminal/ghostty/surface.logic.d.ts +181 -0
  246. package/dist/terminal/ghostty/surface.logic.js +392 -0
  247. package/dist/terminal/ghostty/vendor/LICENSE +21 -0
  248. package/dist/terminal/ghostty/vendor/ghostty-effects.wasm +0 -0
  249. package/dist/terminal/ghostty/vendor/ghostty-vt.wasm +0 -0
  250. package/dist/terminal/index.d.ts +12 -0
  251. package/dist/terminal/index.js +12 -0
  252. package/dist/terminal/terminal.css +169 -0
  253. package/dist/text/MarkedText.d.ts +14 -0
  254. package/dist/text/MarkedText.js +11 -0
  255. package/dist/text/highlightSegments.d.ts +13 -0
  256. package/dist/text/highlightSegments.js +29 -0
  257. package/dist/text/index.d.ts +3 -0
  258. package/dist/text/index.js +3 -0
  259. package/dist/text/text.css +11 -0
  260. package/dist/themes/attributes.d.ts +21 -0
  261. package/dist/themes/attributes.js +41 -0
  262. package/dist/themes/catalog.d.ts +125 -0
  263. package/dist/themes/catalog.js +940 -0
  264. package/dist/themes/color.d.ts +29 -0
  265. package/dist/themes/color.js +52 -0
  266. package/dist/themes/ids.d.ts +139 -0
  267. package/dist/themes/ids.js +59 -0
  268. package/dist/themes/index.d.ts +12 -0
  269. package/dist/themes/index.js +12 -0
  270. package/dist/themes/themes.generated.css +1830 -0
  271. package/dist/themes/tokens.d.ts +189 -0
  272. package/dist/themes/tokens.js +462 -0
  273. package/dist/tooltip/Tooltip.d.ts +21 -0
  274. package/dist/tooltip/Tooltip.js +105 -0
  275. package/dist/tooltip/Tooltip.logic.d.ts +49 -0
  276. package/dist/tooltip/Tooltip.logic.js +50 -0
  277. package/dist/tooltip/index.d.ts +3 -0
  278. package/dist/tooltip/index.js +3 -0
  279. package/dist/tooltip/tooltip.css +45 -0
  280. package/package.json +91 -4
@@ -0,0 +1,63 @@
1
+ /*
2
+ * The pages of a long list and the page numbers its `Pager` offers: every
3
+ * page while there are fewer than `SHOW_ALL_PAGES`, else the first and last
4
+ * five, a page every twentieth of the way, every page within ten of the
5
+ * current one, and pages at doubling distances from it.
6
+ */
7
+ /** Below this many pages the selector lists every one. */
8
+ const SHOW_ALL_PAGES = 200;
9
+ /** Pages always listed at either end of a long list. */
10
+ const SLICE = 5;
11
+ /** The long list is crossed in this many even steps. */
12
+ const STEPS = 20;
13
+ /** Pages listed one by one either side of the current page. */
14
+ const RANGE = 10;
15
+ /** How many pages `count` items take at `size` a page; never fewer than one. */
16
+ export const pageCount = (count, size) => Math.max(1, Math.ceil(count / Math.max(1, size)));
17
+ /** `page` (from 0) held inside a list of `pages` pages. */
18
+ export const clampPage = (page, pages) => Math.min(Math.max(0, Math.floor(page)), Math.max(0, pages - 1));
19
+ /** The items of `page` (from 0), `size` a page. */
20
+ export const pageSlice = (items, page, size) => {
21
+ const at = clampPage(page, pageCount(items.length, size)) * size;
22
+ return items.slice(at, at + size);
23
+ };
24
+ /** The page (from 0) that holds the item at `index`, `size` a page. */
25
+ export const pageOf = (index, size) => Math.floor(Math.max(0, index) / Math.max(1, size));
26
+ /**
27
+ * The page numbers (from 1) the selector lists for `pages` pages while
28
+ * `current` (from 1) is shown, in order, each once.
29
+ */
30
+ export function selectorPages(pages, current) {
31
+ if (pages < SHOW_ALL_PAGES)
32
+ return Array.from({ length: pages }, (_, index) => index + 1);
33
+ const listed = new Set();
34
+ const last = pages - SLICE;
35
+ const increment = Math.floor(pages / STEPS);
36
+ for (let page = 1; page <= SLICE; page += 1)
37
+ listed.add(page);
38
+ for (let page = last; page <= pages; page += 1)
39
+ listed.add(page);
40
+ // Even steps across the list, every page once they come near the current one.
41
+ let page = SLICE;
42
+ let near = false;
43
+ while (page <= last) {
44
+ if (page >= current - RANGE && page <= current + RANGE) {
45
+ page += 1;
46
+ near = true;
47
+ }
48
+ else {
49
+ page += increment;
50
+ if (page > current - RANGE && !near)
51
+ page = current - RANGE;
52
+ }
53
+ if (page > 0 && page <= last)
54
+ listed.add(page);
55
+ }
56
+ // Pages at doubling distances either side of the current one.
57
+ for (let distance = 2; current + distance <= last; distance *= 2)
58
+ listed.add(current + distance);
59
+ for (let distance = 2; current - distance > 0; distance *= 2)
60
+ listed.add(current - distance);
61
+ listed.add(current);
62
+ return [...listed].filter((entry) => entry >= 1 && entry <= pages).sort((a, b) => a - b);
63
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `Pager`: Begin, Previous, a page menu, Next, and End for a long list;
3
+ * plus the page arithmetic a paged list needs and the page numbers the
4
+ * menu offers.
5
+ */
6
+ export { Pager, type PagerProps } from './Pager.js';
7
+ export { clampPage, pageCount, pageOf, pageSlice, selectorPages } from './Pager.logic.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `Pager`: Begin, Previous, a page menu, Next, and End for a long list;
3
+ * plus the page arithmetic a paged list needs and the page numbers the
4
+ * menu offers.
5
+ */
6
+ export { Pager } from './Pager.js';
7
+ export { clampPage, pageCount, pageOf, pageSlice, selectorPages } from './Pager.logic.js';
@@ -0,0 +1,62 @@
1
+ /* ---- Pager (Pager) ----
2
+
3
+ Begin and Previous, the page menu, Next and End, each step a compact
4
+ control drawn as a path bar's, an icon step's place kept while it is
5
+ hidden so the menu never moves. */
6
+ .pager {
7
+ display: flex;
8
+ align-items: center;
9
+ gap: 2px;
10
+ }
11
+
12
+ .pager-step {
13
+ flex: none;
14
+ display: inline-flex;
15
+ align-items: center;
16
+ justify-content: center;
17
+ width: 20px;
18
+ height: 20px;
19
+ padding: 0;
20
+ border: none;
21
+ border-radius: 4px;
22
+ background: transparent;
23
+ color: var(--text-dim);
24
+ cursor: pointer;
25
+ }
26
+
27
+ /* A step drawn in words, alone or beside its icon. */
28
+ .pager-step.worded {
29
+ width: auto;
30
+ gap: 3px;
31
+ padding: 0 5px;
32
+ font: inherit;
33
+ font-size: 12px;
34
+ white-space: nowrap;
35
+ }
36
+
37
+ button.pager-step:hover:enabled {
38
+ background: var(--hover-wash);
39
+ box-shadow: var(--hover-frost);
40
+ color: var(--text);
41
+ }
42
+
43
+ button.pager-step:focus-visible {
44
+ outline: 2px solid var(--accent);
45
+ outline-offset: -2px;
46
+ }
47
+
48
+ .pager-page {
49
+ height: 20px;
50
+ padding: 0 4px;
51
+ border: 1px solid var(--border-strong);
52
+ border-radius: 4px;
53
+ background: var(--ground);
54
+ color: var(--text);
55
+ font: inherit;
56
+ font-size: 12px;
57
+ }
58
+
59
+ .pager-page:focus-visible {
60
+ outline: none;
61
+ border-color: var(--accent);
62
+ }
@@ -0,0 +1,79 @@
1
+ import type { ChangeEvent, KeyboardEvent, ReactElement, ReactNode, RefObject } from 'react';
2
+ /** Props for {@link Palette}. */
3
+ export interface PaletteProps {
4
+ /** The dialog's accessible name. */
5
+ readonly label: string;
6
+ /** Classes of the caller's own, after `folder-menu palette`. */
7
+ readonly className?: string;
8
+ /** Whether the palette waits on a request; nothing moves under it meanwhile. */
9
+ readonly busy?: boolean;
10
+ /** Closes the palette: Escape inside it, or a press on the backdrop. */
11
+ readonly onClose: () => void;
12
+ /** The query row (`PaletteQuery`), the list, any notes, and the legend. */
13
+ readonly children: ReactNode;
14
+ }
15
+ /**
16
+ * The frame every palette shares: the backdrop, which closes the palette on
17
+ * a press on itself alone, and the box anchored near the top of the window,
18
+ * labelled as a modal dialog (`aria-modal`, so `MODAL_SELECTOR` and
19
+ * `watchOverlays` see it while it shows). Escape from anywhere in the box
20
+ * closes it, unless an input method's composition takes it; the field
21
+ * answers its own keys first. A press inside never takes the focus from the
22
+ * field. The caller draws the query row (`PaletteQuery`), the list, any
23
+ * notes, and the legend inside, and owns filtering and the cursor
24
+ * (`matchQuery`, `menuQueryRefused`, `moveMenuCursor`). Draw it inside the
25
+ * listing scope (`.listing-root`).
26
+ */
27
+ export declare function Palette({ label, className, busy, onClose, children }: PaletteProps): ReactElement;
28
+ /**
29
+ * The level a palette stands in below its first, named in a chip before
30
+ * the field; a click on it goes back.
31
+ */
32
+ export interface PaletteLevel {
33
+ /** The level's name, drawn in the chip. */
34
+ readonly title: string;
35
+ /** Whether stepping back is refused right now (the palette waits on a request). */
36
+ readonly disabled?: boolean;
37
+ /** Steps back out of the level. */
38
+ readonly onBack: () => void;
39
+ }
40
+ /** Props for {@link PaletteQuery}. */
41
+ export interface PaletteQueryProps {
42
+ /** The field's ref, for the caller to focus on open. */
43
+ readonly inputRef: RefObject<HTMLInputElement | null>;
44
+ /** The query as typed. */
45
+ readonly value: string;
46
+ /** The field's accessible name. */
47
+ readonly label: string;
48
+ /** The field's placeholder. */
49
+ readonly placeholder: string;
50
+ /** The id of the listbox the field drives. */
51
+ readonly listId: string;
52
+ /** The id of the cursor row, if any. */
53
+ readonly activeId: string | undefined;
54
+ /** How many keystrokes the palette has refused; each new one rings the bell. */
55
+ readonly bell: number;
56
+ /** The level the palette stands in below its first; null or absent at the top. */
57
+ readonly level?: PaletteLevel | null;
58
+ /** The count while a query is typed ("3 of 12"); null draws none. */
59
+ readonly count: string | null;
60
+ /** The query the last refused keystroke would have made, until the next change. */
61
+ readonly refused: string | null;
62
+ /** A tag at the field's end: what the rows act on. */
63
+ readonly aside?: ReactNode;
64
+ /** The field's edits; the caller filters, refuses, and rings the bell. */
65
+ readonly onChange: (event: ChangeEvent<HTMLInputElement>) => void;
66
+ /** The field's keys; the caller moves the cursor, runs the pick, and holds Tab. */
67
+ readonly onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
68
+ }
69
+ /**
70
+ * A palette's query row: the filter mark, the level chip while the palette
71
+ * stands below its first level, the field (a combobox over the list it
72
+ * names, holding the focus), then the count ("3 of 12") while a query
73
+ * narrows the list, or, after a refused keystroke, why it was refused in the
74
+ * count's place, and any tag the caller puts at the field's end. A refused
75
+ * keystroke also rings the visual bell on the row, once per refusal
76
+ * (`useBellBeat`). The chip's words and the refusal come from the `palette`
77
+ * label group.
78
+ */
79
+ export declare function PaletteQuery({ inputRef, value, label, placeholder, listId, activeId, bell, level, count, refused, aside, onChange, onKeyDown }: PaletteQueryProps): ReactElement;
@@ -0,0 +1,60 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowLeft } from 'lucide-react';
3
+ import { FilterIcon } from '../filter/FilterIcon.js';
4
+ import { useLabels } from '../labels/UiokProvider.js';
5
+ import { useBellBeat } from '../menu/useBellBeat.js';
6
+ import { tooltip } from '../tooltip/Tooltip.logic.js';
7
+ /**
8
+ * Keeps the focus in the field through a press on the palette: a row, the
9
+ * level chip, or a legend slot is pressed without taking the keys from the
10
+ * field. A press in the field is the field's own, so the caret still goes
11
+ * where it lands.
12
+ */
13
+ const keepFocus = (event) => {
14
+ if (!(event.target instanceof HTMLInputElement)) {
15
+ event.preventDefault();
16
+ }
17
+ };
18
+ /**
19
+ * The frame every palette shares: the backdrop, which closes the palette on
20
+ * a press on itself alone, and the box anchored near the top of the window,
21
+ * labelled as a modal dialog (`aria-modal`, so `MODAL_SELECTOR` and
22
+ * `watchOverlays` see it while it shows). Escape from anywhere in the box
23
+ * closes it, unless an input method's composition takes it; the field
24
+ * answers its own keys first. A press inside never takes the focus from the
25
+ * field. The caller draws the query row (`PaletteQuery`), the list, any
26
+ * notes, and the legend inside, and owns filtering and the cursor
27
+ * (`matchQuery`, `menuQueryRefused`, `moveMenuCursor`). Draw it inside the
28
+ * listing scope (`.listing-root`).
29
+ */
30
+ export function Palette({ label, className, busy = false, onClose, children }) {
31
+ return (_jsx("div", { className: "palette-backdrop", onMouseDown: (event) => {
32
+ // Only a press on the backdrop itself closes; one inside the palette is the palette's.
33
+ if (event.target !== event.currentTarget)
34
+ return;
35
+ // The field keeps the focus: a press that closes nothing (the palette
36
+ // waits on a request) must not leave the keys on the page behind.
37
+ event.preventDefault();
38
+ onClose();
39
+ }, children: _jsx("div", { "aria-busy": busy || undefined, "aria-label": label, "aria-modal": "true", className: className === undefined ? 'folder-menu palette' : `folder-menu palette ${className}`, onKeyDown: (event) => {
40
+ if (event.key === 'Escape' && !event.nativeEvent.isComposing) {
41
+ event.preventDefault();
42
+ onClose();
43
+ }
44
+ }, onMouseDown: keepFocus, role: "dialog", children: children }) }));
45
+ }
46
+ /**
47
+ * A palette's query row: the filter mark, the level chip while the palette
48
+ * stands below its first level, the field (a combobox over the list it
49
+ * names, holding the focus), then the count ("3 of 12") while a query
50
+ * narrows the list, or, after a refused keystroke, why it was refused in the
51
+ * count's place, and any tag the caller puts at the field's end. A refused
52
+ * keystroke also rings the visual bell on the row, once per refusal
53
+ * (`useBellBeat`). The chip's words and the refusal come from the `palette`
54
+ * label group.
55
+ */
56
+ export function PaletteQuery({ inputRef, value, label, placeholder, listId, activeId, bell, level = null, count, refused, aside, onChange, onKeyDown }) {
57
+ const labels = useLabels().palette;
58
+ const beat = useBellBeat(bell);
59
+ return (_jsxs("div", { className: beat === null ? 'folder-menu-query' : `folder-menu-query bell-${beat}`, children: [_jsx(FilterIcon, {}), level !== null && (_jsxs("button", { "aria-label": labels.backFrom(level.title), className: "palette-level", disabled: level.disabled, onClick: level.onBack, tabIndex: -1, type: "button", ...tooltip(labels.back, '←'), children: [_jsx(ArrowLeft, { "aria-hidden": true, size: 11 }), level.title] })), _jsx("input", { "aria-activedescendant": activeId, "aria-autocomplete": "list", "aria-controls": listId, "aria-expanded": true, "aria-label": label, onChange: onChange, onKeyDown: onKeyDown, placeholder: placeholder, ref: inputRef, role: "combobox", spellCheck: false, value: value }), refused !== null ? (_jsx("span", { className: "palette-refused", children: labels.nothingMatches(refused) })) : (count !== null && _jsx("span", { className: "folder-menu-count", children: count })), aside] }));
60
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Palettes: `Palette`, the modal frame (backdrop, box, Escape, focus kept in
3
+ * the field), and `PaletteQuery`, its query row with the level chip, count,
4
+ * and refusal. Styled by palette.css over the menu look, under `.listing-root`.
5
+ */
6
+ export { Palette, PaletteQuery, type PaletteLevel, type PaletteProps, type PaletteQueryProps } from './Palette.js';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Palettes: `Palette`, the modal frame (backdrop, box, Escape, focus kept in
3
+ * the field), and `PaletteQuery`, its query row with the level chip, count,
4
+ * and refusal. Styled by palette.css over the menu look, under `.listing-root`.
5
+ */
6
+ export { Palette, PaletteQuery } from './Palette.js';
@@ -0,0 +1,159 @@
1
+ /* ---- Palette look (Palette, PaletteQuery) ----
2
+
3
+ A palette: one list over the page. It is the menu surface (menu.css) over
4
+ a backdrop, closing on a dialog's key legend. Scoped by
5
+ :where(.listing-root) like the listing look. */
6
+
7
+ /* The backdrop takes the whole window, as a dialog's does, so nothing behind
8
+ it can take the keys while the palette is open. */
9
+ :where(.listing-root) .palette-backdrop {
10
+ position: fixed;
11
+ inset: 0;
12
+ z-index: var(--z-dialog);
13
+ display: flex;
14
+ align-items: flex-start;
15
+ justify-content: center;
16
+ padding: 104px 16px 16px;
17
+ background: color-mix(in srgb, var(--bg) 45%, transparent);
18
+ }
19
+
20
+ :where(.listing-root) .folder-menu.palette {
21
+ position: static;
22
+ /* The listing's face, whatever face the app's root sets. */
23
+ font-family: var(--font-mono);
24
+ font-size: 13px;
25
+ /* Room for a row's name and its context, and for a legend's four slots. */
26
+ width: 600px;
27
+ max-width: 100%;
28
+ max-height: 100%;
29
+ box-shadow: var(--shadow-dialog);
30
+ }
31
+
32
+ :where(.listing-root) .palette .folder-menu-query {
33
+ flex: none;
34
+ }
35
+
36
+ /* A dialog's key legend footer at the palette's foot, its hairline run out
37
+ to the palette's edges. */
38
+ :where(.listing-root) .palette > .dialog-legend {
39
+ margin: 4px -4px -4px;
40
+ }
41
+
42
+ :where(.listing-root) .palette .folder-menu-options {
43
+ flex: 0 1 auto;
44
+ /* Never squeezed below a row, however short the window. */
45
+ min-height: 24px;
46
+ max-height: 420px;
47
+ }
48
+
49
+ :where(.listing-root) .palette-text {
50
+ display: flex;
51
+ align-items: baseline;
52
+ gap: 1.5ch;
53
+ min-width: 0;
54
+ }
55
+
56
+ :where(.listing-root) .palette-text .row-name {
57
+ flex: 0 1 auto;
58
+ min-width: 3ch;
59
+ overflow: hidden;
60
+ text-overflow: ellipsis;
61
+ white-space: nowrap;
62
+ }
63
+
64
+ /* What a row says after its name: where an item is, or what a command does.
65
+ A long path gives way at its start, so the folder it ends in stays; the
66
+ text itself still reads left to right inside a <bdi>. */
67
+ :where(.listing-root) .palette-context {
68
+ flex: 1 1 0;
69
+ min-width: 0;
70
+ overflow: hidden;
71
+ color: var(--row-meta-text);
72
+ font-size: 12px;
73
+ text-overflow: ellipsis;
74
+ white-space: nowrap;
75
+ direction: rtl;
76
+ text-align: left;
77
+ }
78
+
79
+ :where(.listing-root) .palette-context > bdi {
80
+ direction: ltr;
81
+ }
82
+
83
+ :where(.listing-root) .palette-trail {
84
+ display: inline-flex;
85
+ align-items: center;
86
+ gap: 2px;
87
+ padding-left: 8px;
88
+ }
89
+
90
+ /* What a row says after its name when that is a sentence or a command line
91
+ rather than a path: it reads and gives way at its end. */
92
+ :where(.listing-root) .palette-context.palette-sentence {
93
+ direction: ltr;
94
+ }
95
+
96
+ /* A row's end in the listing's meta tone: versions, a count, a chord. */
97
+ :where(.listing-root) .palette-meta {
98
+ display: inline-flex;
99
+ align-items: center;
100
+ color: var(--row-meta-text);
101
+ font-size: 12px;
102
+ white-space: pre;
103
+ }
104
+
105
+ /* The notes under a palette's list, ruled off from it, their text over
106
+ the rows' names; a failure among them in the danger tone. */
107
+ :where(.listing-root) .palette-notes {
108
+ margin: 4px -4px 0;
109
+ padding: 4px 4px 0;
110
+ border-top: 1px solid var(--border);
111
+ }
112
+
113
+ :where(.listing-root) .palette-notes .folder-menu-note {
114
+ margin: 0;
115
+ padding: 3px 8px 3px 26px;
116
+ }
117
+
118
+ :where(.listing-root) .palette-notes .palette-failure {
119
+ color: var(--danger);
120
+ }
121
+
122
+ /* A refused keystroke, said where the count stands; a long refused paste
123
+ gives way to the field rather than pushing past the palette's edge. */
124
+ :where(.listing-root) .palette-refused {
125
+ min-width: 0;
126
+ overflow: hidden;
127
+ margin-left: 1ch;
128
+ text-overflow: ellipsis;
129
+ color: var(--warning);
130
+ font-family: var(--font-ui);
131
+ font-size: 11px;
132
+ white-space: nowrap;
133
+ }
134
+
135
+ /* The level the list shows, a chip before the query that steps back out
136
+ when pressed. */
137
+ :where(.listing-root) .palette-level {
138
+ display: inline-flex;
139
+ flex: none;
140
+ align-items: center;
141
+ gap: 4px;
142
+ margin-right: 8px;
143
+ padding: 1px 6px;
144
+ border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border-strong));
145
+ border-radius: 4px;
146
+ background: color-mix(in srgb, var(--accent) 12%, transparent);
147
+ color: var(--text);
148
+ font: inherit;
149
+ font-weight: 600;
150
+ cursor: pointer;
151
+ }
152
+
153
+ :where(.listing-root) .palette-level:hover:enabled {
154
+ background: color-mix(in srgb, var(--accent) 22%, transparent);
155
+ }
156
+
157
+ :where(.listing-root) .palette-level:focus-visible {
158
+ outline: none;
159
+ }
@@ -0,0 +1,104 @@
1
+ import type { LucideIcon } from 'lucide-react';
2
+ import { type ReactElement, type Ref } from 'react';
3
+ /**
4
+ * How a set of compact links draws: icons alone, words alone, or both, as a
5
+ * user's icon-or-text preference chooses.
6
+ */
7
+ export type LinkLook = 'icons' | 'text' | 'both';
8
+ /**
9
+ * How the `RowIconAction`s under it draw. An app whose rows follow a
10
+ * preference provides it; icons alone without one. A `Listing` whose grid
11
+ * is a function of the look steps it down to a plainer one when its words
12
+ * would make it scroll sideways.
13
+ */
14
+ export declare const RowLinkLookContext: import("react").Context<LinkLook>;
15
+ /**
16
+ * Set inside a listing row, whose controls the cursor row's keys reach. The
17
+ * listing's `Row` provides it, true unless the row keeps its controls in the
18
+ * Tab order (`tabbable`).
19
+ */
20
+ export declare const InRowContext: import("react").Context<boolean>;
21
+ /**
22
+ * Whether a control sits in a listing row. Such a control leaves the Tab
23
+ * order: the cursor row's keys run it (Return, ⌘⌫, `.`, ⌘⏎), and Tab moves
24
+ * between panes and the page's other controls instead of through every row.
25
+ */
26
+ export declare const useInRow: () => boolean;
27
+ /**
28
+ * What the keys run a control for, read by `verbControl` off the rendered
29
+ * pane. A row's control carries it as `data-verb`; a path bar's controls
30
+ * name the page's verbs with `data-page-verb` instead. Several verbs on one
31
+ * control are separated by spaces (`enter reveal`). The conventional ones
32
+ * `paneKeyAction` asks for are `enter` (Return), `remove` (⌘⌫), `reveal`
33
+ * (`.`), `toggle` (⌘⏎), and `restart` (⌥⌘⏎); an app adds its own (`edit`,
34
+ * `clear`, `toggle-all`) for the chords it maps.
35
+ */
36
+ export type ControlVerb = string;
37
+ /** Props for {@link QuietAction}. */
38
+ export interface QuietActionProps {
39
+ readonly icon: LucideIcon;
40
+ /** The verb it shows ("Remove"), also its `data-word` for a key legend. */
41
+ readonly word: string;
42
+ /** The accessible name, which names the target ("Remove PostgreSQL 17"). */
43
+ readonly label: string;
44
+ /** Lit in the accent as its bar's lead action, as the cursor row's is. */
45
+ readonly lit?: boolean;
46
+ readonly disabled?: boolean;
47
+ /** The tooltip, also its accessible description; none without it. */
48
+ readonly tip?: string;
49
+ /** The chord that runs it, which its tooltip names after `tip` ("⌥↩"). */
50
+ readonly shortcut?: string;
51
+ readonly onClick: () => void;
52
+ readonly ref?: Ref<HTMLButtonElement>;
53
+ /**
54
+ * Inert but still focusable (`aria-disabled`), for a control whose dialog
55
+ * hands the focus back to it when it closes.
56
+ */
57
+ readonly softDisabled?: boolean;
58
+ /** What the cursor row's keys run it for (`ControlVerb`). */
59
+ readonly verb?: ControlVerb;
60
+ /** What the page's chords run it for, as a path bar's control. */
61
+ readonly pageVerb?: ControlVerb;
62
+ /**
63
+ * Which of several controls on one verb this is ("start", "stop"), for
64
+ * logic that must tell them apart without reading the translated `word`.
65
+ */
66
+ readonly action?: string;
67
+ }
68
+ /**
69
+ * A row's one quiet action, or a compact control in a path bar: an icon and
70
+ * a verb in the dim tone, lit in the accent on the cursor row (and as a
71
+ * path bar's lead action, `lit`). In a row it leaves the Tab order
72
+ * (`useInRow`), and a press never reaches the row's own `onOpen`. Drawn by
73
+ * `.pane-act` in the listing look.
74
+ */
75
+ export declare function QuietAction({ icon: Icon, word, label, lit, disabled, tip, shortcut, onClick, ref, softDisabled, verb, pageVerb, action }: QuietActionProps): ReactElement;
76
+ /** Props for {@link RowIconAction}. */
77
+ export interface RowIconActionProps {
78
+ readonly icon: LucideIcon;
79
+ /** The accessible name ("Show PHP 8.4.12 in Finder"). */
80
+ readonly label: string;
81
+ readonly disabled?: boolean;
82
+ readonly onClick: () => void;
83
+ readonly ref?: Ref<HTMLButtonElement>;
84
+ /** Inert but still focusable, as on `QuietAction`. */
85
+ readonly softDisabled?: boolean;
86
+ /** The tooltip; the accessible name unless it says more (a path). */
87
+ readonly tip?: string;
88
+ /** What the cursor row's keys run it for (`ControlVerb`). */
89
+ readonly verb?: ControlVerb;
90
+ /**
91
+ * The verb a key legend names it by ("Start", "Reveal"); under a
92
+ * `RowLinkLookContext` of words, the word it draws.
93
+ */
94
+ readonly word?: string;
95
+ }
96
+ /**
97
+ * A compact icon control: in a row, one that shows on its row's hover, its
98
+ * keyboard focus, and the cursor (Reveal, a secondary Start or Remove), so
99
+ * a row keeps one visible action; at a status line's end, Reveal or Copy.
100
+ * In a row it leaves the Tab order (`useInRow`). Drawn by `.pane-icon-act`
101
+ * in the listing look. Under `RowLinkLookContext` an action that names its
102
+ * verb (`word`, a row link) draws it in place of the icon or beside it.
103
+ */
104
+ export declare function RowIconAction({ icon: Icon, label, disabled, onClick, ref, softDisabled, tip, verb, word }: RowIconActionProps): ReactElement;
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ import { describedTooltip, tooltip } from '../tooltip/Tooltip.logic.js';
4
+ /**
5
+ * How the `RowIconAction`s under it draw. An app whose rows follow a
6
+ * preference provides it; icons alone without one. A `Listing` whose grid
7
+ * is a function of the look steps it down to a plainer one when its words
8
+ * would make it scroll sideways.
9
+ */
10
+ export const RowLinkLookContext = createContext('icons');
11
+ /**
12
+ * Set inside a listing row, whose controls the cursor row's keys reach. The
13
+ * listing's `Row` provides it, true unless the row keeps its controls in the
14
+ * Tab order (`tabbable`).
15
+ */
16
+ export const InRowContext = createContext(false);
17
+ /**
18
+ * Whether a control sits in a listing row. Such a control leaves the Tab
19
+ * order: the cursor row's keys run it (Return, ⌘⌫, `.`, ⌘⏎), and Tab moves
20
+ * between panes and the page's other controls instead of through every row.
21
+ */
22
+ export const useInRow = () => useContext(InRowContext);
23
+ /**
24
+ * A row's one quiet action, or a compact control in a path bar: an icon and
25
+ * a verb in the dim tone, lit in the accent on the cursor row (and as a
26
+ * path bar's lead action, `lit`). In a row it leaves the Tab order
27
+ * (`useInRow`), and a press never reaches the row's own `onOpen`. Drawn by
28
+ * `.pane-act` in the listing look.
29
+ */
30
+ export function QuietAction({ icon: Icon, word, label, lit = false, disabled = false, tip, shortcut, onClick, ref, softDisabled = false, verb, pageVerb, action }) {
31
+ const inRow = useInRow();
32
+ return (_jsxs("button", { "aria-disabled": softDisabled || undefined, "aria-label": label, className: lit ? 'pane-act lit' : 'pane-act', "data-action": action, "data-page-verb": pageVerb, "data-verb": verb, "data-word": word, disabled: disabled, onClick: (event) => {
33
+ event.stopPropagation();
34
+ if (!softDisabled)
35
+ onClick();
36
+ }, ref: ref, tabIndex: inRow ? -1 : undefined, type: "button", ...(tip === undefined ? {} : describedTooltip(tip)), ...(tip === undefined || shortcut === undefined
37
+ ? {}
38
+ : { 'data-tooltip-shortcut': shortcut }), children: [_jsx(Icon, { "aria-hidden": true, size: 12 }), word] }));
39
+ }
40
+ /**
41
+ * A compact icon control: in a row, one that shows on its row's hover, its
42
+ * keyboard focus, and the cursor (Reveal, a secondary Start or Remove), so
43
+ * a row keeps one visible action; at a status line's end, Reveal or Copy.
44
+ * In a row it leaves the Tab order (`useInRow`). Drawn by `.pane-icon-act`
45
+ * in the listing look. Under `RowLinkLookContext` an action that names its
46
+ * verb (`word`, a row link) draws it in place of the icon or beside it.
47
+ */
48
+ export function RowIconAction({ icon: Icon, label, disabled = false, onClick, ref, softDisabled = false, tip = label, verb, word }) {
49
+ const inRow = useInRow();
50
+ const chosen = useContext(RowLinkLookContext);
51
+ // Only an action that names its verb draws it in words.
52
+ const look = word === undefined ? 'icons' : chosen;
53
+ return (_jsxs("button", { "aria-disabled": softDisabled || undefined, "aria-label": label, className: look === 'icons' ? 'pane-icon-act' : 'pane-icon-act worded', "data-verb": verb, "data-word": word, disabled: disabled, onClick: (event) => {
54
+ event.stopPropagation();
55
+ if (!softDisabled)
56
+ onClick();
57
+ }, ref: ref, tabIndex: inRow ? -1 : undefined, type: "button", ...(look !== 'icons' && tip === word
58
+ ? {}
59
+ : tip === label
60
+ ? tooltip(label)
61
+ : describedTooltip(tip)), children: [look !== 'text' && _jsx(Icon, { "aria-hidden": true, size: 13 }), look !== 'icons' && _jsx("span", { children: word })] }));
62
+ }