@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,169 @@
1
+ /* The terminal component. The host's class sizes and places .terminal; the
2
+ mount fills it and paints the terminal ground until the canvas does. Colors
3
+ come from the --terminal-* tokens (themes.generated.css). The engine draws
4
+ 13px text on 19px lines (TERMINAL_FONT_SIZE, TERMINAL_LINE_HEIGHT) 4px in
5
+ from the mount's edges; every host pads the other 8px, so its text starts
6
+ 12px from the host's edge, where a listing's path bar starts its own. */
7
+ .terminal {
8
+ display: flex;
9
+ min-width: 0;
10
+ min-height: 0;
11
+ }
12
+
13
+ .terminal-mount {
14
+ position: relative;
15
+ flex: 1;
16
+ min-width: 0;
17
+ min-height: 0;
18
+ overflow: hidden;
19
+ background: var(--terminal-bg);
20
+ outline: none;
21
+ }
22
+
23
+ /* A read-only terminal takes focus for selection and copy; say so when the
24
+ keyboard put it there. */
25
+ .terminal-mount[tabindex='0']:focus-visible {
26
+ box-shadow: inset 0 0 0 2px var(--accent);
27
+ }
28
+
29
+ .terminal-canvas {
30
+ display: block;
31
+ width: 100%;
32
+ height: 100%;
33
+ cursor: text;
34
+ }
35
+
36
+ /* The scrollback rail: a thin thumb over the right edge, tinted from the
37
+ terminal's own text color so it reads in both flavors. */
38
+ .terminal-scrollbar {
39
+ position: absolute;
40
+ top: 4px;
41
+ right: 1px;
42
+ bottom: 4px;
43
+ z-index: 1;
44
+ width: 8px;
45
+ cursor: default;
46
+ touch-action: none;
47
+ outline: none;
48
+ }
49
+
50
+ .terminal-scrollbar-thumb {
51
+ position: absolute;
52
+ top: 0;
53
+ right: 1px;
54
+ left: 1px;
55
+ border-radius: 3px;
56
+ background: color-mix(in srgb, var(--terminal-fg) 28%, transparent);
57
+ transition: background-color 120ms ease-out;
58
+ }
59
+
60
+ .terminal-scrollbar:hover .terminal-scrollbar-thumb,
61
+ .terminal-scrollbar:focus-visible .terminal-scrollbar-thumb {
62
+ background: color-mix(in srgb, var(--terminal-fg) 50%, transparent);
63
+ }
64
+
65
+ /* Holds a read-only terminal's selection as DOM text, selected, so the Edit
66
+ menu's Copy finds it; never seen or read aloud. */
67
+ .terminal-copy-buffer {
68
+ position: absolute;
69
+ width: 1px;
70
+ height: 1px;
71
+ overflow: hidden;
72
+ clip-path: inset(50%);
73
+ white-space: pre;
74
+ user-select: text;
75
+ }
76
+
77
+ /* Set where the terminal's first line would be: the engine's 4px in, at its
78
+ size and pitch. */
79
+ .terminal-failure {
80
+ flex: 1;
81
+ margin: 0;
82
+ padding: 4px;
83
+ background: var(--terminal-bg);
84
+ color: var(--terminal-fg);
85
+ font: 13px/19px var(--font-mono);
86
+ }
87
+
88
+ /* The terminal's menu (TerminalMenu), which a secondary click opens at the
89
+ point it landed: the menu look (menu.css) in surface, row metrics, and
90
+ chords, drawn here because a terminal sits anywhere, outside any
91
+ .listing-root and in dialogs. Fixed, since it is placed in window
92
+ coordinates over the screen it acts on. */
93
+ .terminal-menu {
94
+ position: fixed;
95
+ top: 0;
96
+ left: 0;
97
+ z-index: var(--z-panel);
98
+ display: flex;
99
+ flex-direction: column;
100
+ min-width: 180px;
101
+ padding: 4px;
102
+ background: var(--surface);
103
+ border: 1px solid var(--border-strong);
104
+ border-radius: 8px;
105
+ box-shadow: var(--shadow-menu);
106
+ color: var(--text);
107
+ font: 12px var(--font-mono);
108
+ outline: none;
109
+ }
110
+
111
+ /* A row: its icon, its name, and its chord at the right edge. */
112
+ .terminal-menu-item {
113
+ display: grid;
114
+ grid-template-columns: 20px minmax(0, 1fr) auto;
115
+ align-items: center;
116
+ height: 24px;
117
+ padding: 0 6px;
118
+ border-radius: 4px;
119
+ cursor: default;
120
+ }
121
+
122
+ .terminal-menu-item.cursor {
123
+ background: var(--cursor-row-bg);
124
+ }
125
+
126
+ .terminal-menu-icon {
127
+ display: inline-flex;
128
+ align-items: center;
129
+ color: var(--text-dim);
130
+ }
131
+
132
+ .terminal-menu-item .keychord {
133
+ padding-left: 10px;
134
+ color: var(--text-dim);
135
+ }
136
+
137
+ /* The visual bell: a veil of the terminal's own text color over the screen
138
+ that fades out over BELL_FLASH_MS (Terminal.logic.ts), so it reads in both
139
+ flavors. Under reduced motion it is a still tint at the edges instead, on
140
+ for the same time and off again with no fade. */
141
+ .terminal-mount[data-bell]::after {
142
+ content: '';
143
+ position: absolute;
144
+ inset: 0;
145
+ z-index: 2;
146
+ background: color-mix(in srgb, var(--terminal-fg) 12%, transparent);
147
+ pointer-events: none;
148
+ opacity: 0;
149
+ animation: terminal-bell 250ms ease-out;
150
+ }
151
+
152
+ @keyframes terminal-bell {
153
+ from {
154
+ opacity: 1;
155
+ }
156
+ }
157
+
158
+ @media (prefers-reduced-motion: reduce) {
159
+ .terminal-scrollbar-thumb {
160
+ transition: none;
161
+ }
162
+
163
+ .terminal-mount[data-bell]::after {
164
+ background: none;
165
+ box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--terminal-fg) 40%, transparent);
166
+ opacity: 1;
167
+ animation: none;
168
+ }
169
+ }
@@ -0,0 +1,14 @@
1
+ import type { ReactElement } from 'react';
2
+ /** Props for {@link MarkedText}. */
3
+ export interface MarkedTextProps {
4
+ readonly text: string;
5
+ /** The matched UTF-16 code unit indices, ascending (`highlightSegments`). */
6
+ readonly positions: readonly number[];
7
+ }
8
+ /**
9
+ * Text with the characters a fuzzy match hit marked in place: a listing's
10
+ * names under a filter, a menu's or a palette's rows under a query. The marks
11
+ * only tint behind the text (`.name-hit`), so a name keeps the colour it
12
+ * already carries.
13
+ */
14
+ export declare function MarkedText({ text, positions }: MarkedTextProps): ReactElement;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { highlightSegments } from './highlightSegments.js';
3
+ /**
4
+ * Text with the characters a fuzzy match hit marked in place: a listing's
5
+ * names under a filter, a menu's or a palette's rows under a query. The marks
6
+ * only tint behind the text (`.name-hit`), so a name keeps the colour it
7
+ * already carries.
8
+ */
9
+ export function MarkedText({ text, positions }) {
10
+ return (_jsx(_Fragment, { children: highlightSegments(text, positions).map((segment, index) => segment.hit ? (_jsx("span", { className: "name-hit", children: segment.text }, index)) : (segment.text)) }));
11
+ }
@@ -0,0 +1,13 @@
1
+ /** One run of a text's characters, either all matched or all unmatched. */
2
+ export interface HighlightSegment {
3
+ readonly text: string;
4
+ readonly hit: boolean;
5
+ }
6
+ /**
7
+ * Splits a text into alternating matched and unmatched runs, so a row marks
8
+ * whole runs instead of wrapping every character in its own element.
9
+ * `positions` are the matched UTF-16 code unit indices, ascending, as a
10
+ * fuzzy matcher reports them; a character outside the basic plane is
11
+ * matched by both of its code units, so it lands whole in one run.
12
+ */
13
+ export declare const highlightSegments: (text: string, positions: readonly number[]) => readonly HighlightSegment[];
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Splits a text into alternating matched and unmatched runs, so a row marks
3
+ * whole runs instead of wrapping every character in its own element.
4
+ * `positions` are the matched UTF-16 code unit indices, ascending, as a
5
+ * fuzzy matcher reports them; a character outside the basic plane is
6
+ * matched by both of its code units, so it lands whole in one run.
7
+ */
8
+ export const highlightSegments = (text, positions) => {
9
+ if (positions.length === 0) {
10
+ return text === '' ? [] : [{ text, hit: false }];
11
+ }
12
+ const hits = new Set(positions);
13
+ const segments = [];
14
+ let run = '';
15
+ let runHit = hits.has(0);
16
+ for (let index = 0; index < text.length; index += 1) {
17
+ const hit = hits.has(index);
18
+ if (hit !== runHit && run !== '') {
19
+ segments.push({ text: run, hit: runHit });
20
+ run = '';
21
+ }
22
+ runHit = hit;
23
+ run += text[index] ?? '';
24
+ }
25
+ if (run !== '') {
26
+ segments.push({ text: run, hit: runHit });
27
+ }
28
+ return segments;
29
+ };
@@ -0,0 +1,3 @@
1
+ /** Marked text: `MarkedText` tints the characters a match hit, from the runs `highlightSegments` splits. */
2
+ export { highlightSegments, type HighlightSegment } from './highlightSegments.js';
3
+ export { MarkedText, type MarkedTextProps } from './MarkedText.js';
@@ -0,0 +1,3 @@
1
+ /** Marked text: `MarkedText` tints the characters a match hit, from the runs `highlightSegments` splits. */
2
+ export { highlightSegments } from './highlightSegments.js';
3
+ export { MarkedText } from './MarkedText.js';
@@ -0,0 +1,11 @@
1
+ /* ---- Marked text (MarkedText) ----
2
+
3
+ Matched characters are tinted, never recoloured: a row name may already
4
+ carry a colour of its own (a file's kind), and repainting it would trade
5
+ that colour for the match. The tint sits behind whatever colour the name
6
+ has, so it composes with names that draw their own background too. Drawn
7
+ inside the listing scope (.listing-root). */
8
+ :where(.listing-root) .name-hit {
9
+ border-radius: 2px;
10
+ background: color-mix(in srgb, var(--accent) 22%, transparent);
11
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The themes a page wears, as attributes on its root element
3
+ * (`data-light-theme`, `data-dark-theme`), and the one watch every reader of
4
+ * the colour tokens in script shares. The stylesheet's block for a theme
5
+ * takes over while its id is set, so CSS follows a change on its own; code
6
+ * that reads a token's value in script (a canvas, a chart) reads it again
7
+ * when `subscribeThemeChange` calls.
8
+ *
9
+ * Set the attributes before the first paint where you can (a server-rendered
10
+ * root, an inline script, or a preload), so the page never flashes the
11
+ * default theme; `wearThemes` sets them from script at any time after.
12
+ */
13
+ import { type AppearanceThemes } from './ids.js';
14
+ /** Has `root` wear `themes`, leaving an attribute that already names its theme untouched. */
15
+ export declare function wearThemes(root: HTMLElement, themes: AppearanceThemes): void;
16
+ /**
17
+ * Calls `listener` whenever the colour tokens may have changed: the
18
+ * appearance flips (`prefers-color-scheme`), or `root` comes to wear another
19
+ * theme. Returns the unsubscribe.
20
+ */
21
+ export declare function subscribeThemeChange(listener: () => void, root?: HTMLElement, view?: Window): () => void;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The themes a page wears, as attributes on its root element
3
+ * (`data-light-theme`, `data-dark-theme`), and the one watch every reader of
4
+ * the colour tokens in script shares. The stylesheet's block for a theme
5
+ * takes over while its id is set, so CSS follows a change on its own; code
6
+ * that reads a token's value in script (a canvas, a chart) reads it again
7
+ * when `subscribeThemeChange` calls.
8
+ *
9
+ * Set the attributes before the first paint where you can (a server-rendered
10
+ * root, an inline script, or a preload), so the page never flashes the
11
+ * default theme; `wearThemes` sets them from script at any time after.
12
+ */
13
+ import { THEME_ATTRIBUTES } from './ids.js';
14
+ /** Has `root` wear `themes`, leaving an attribute that already names its theme untouched. */
15
+ export function wearThemes(root, themes) {
16
+ if (root.getAttribute(THEME_ATTRIBUTES.light) !== themes.light) {
17
+ root.setAttribute(THEME_ATTRIBUTES.light, themes.light);
18
+ }
19
+ if (root.getAttribute(THEME_ATTRIBUTES.dark) !== themes.dark) {
20
+ root.setAttribute(THEME_ATTRIBUTES.dark, themes.dark);
21
+ }
22
+ }
23
+ /**
24
+ * Calls `listener` whenever the colour tokens may have changed: the
25
+ * appearance flips (`prefers-color-scheme`), or `root` comes to wear another
26
+ * theme. Returns the unsubscribe.
27
+ */
28
+ export function subscribeThemeChange(listener, root = document.documentElement, view = window) {
29
+ const scheme = view.matchMedia?.('(prefers-color-scheme: dark)');
30
+ const notify = () => listener();
31
+ scheme?.addEventListener('change', notify);
32
+ const observer = new MutationObserver(notify);
33
+ observer.observe(root, {
34
+ attributes: true,
35
+ attributeFilter: [THEME_ATTRIBUTES.light, THEME_ATTRIBUTES.dark]
36
+ });
37
+ return () => {
38
+ scheme?.removeEventListener('change', notify);
39
+ observer.disconnect();
40
+ };
41
+ }
@@ -0,0 +1,125 @@
1
+ /**
2
+ * The theme catalog: every theme a page can wear, as a palette of named
3
+ * source colours keyed by the ids `ids.ts` lists. `tokens.ts` derives the
4
+ * colour tokens from a palette, and `themes.test.ts` writes them into
5
+ * `themes.generated.css`; a host process that paints a window's ground
6
+ * before the stylesheet loads can read it from the same entries.
7
+ *
8
+ * Pure data with no DOM or React dependency, so a generator and a host
9
+ * import one copy. Components name themes through `ids.ts` and paint only
10
+ * with the tokens, never with these colours (`test/colorLiterals.test.ts`).
11
+ */
12
+ import { type Hex } from './color.js';
13
+ import { type ThemeAppearance, type ThemeId } from './ids.js';
14
+ import type { ThemeOverrides } from './tokens.js';
15
+ /**
16
+ * A theme's source colours, by Catppuccin's role names, which the syntax
17
+ * tokens (`--syntax-*`) already carry. Another
18
+ * family maps its colours onto the roles by what each role means here, not
19
+ * by its own names:
20
+ *
21
+ * - The accents, by hue: `rosewater` and `flamingo` (pale warm pinks, a
22
+ * cursor and string escapes), `pink`, `mauve` (purple: keywords), `red` (errors, danger), `maroon` (a softer red),
23
+ * `peach` (orange: numbers), `yellow` (warnings),
24
+ * `green` (success, strings), `teal`, `sky` and `sapphire` (two cyans),
25
+ * `blue` (the accent: selection, focus, links), and `lavender` (a
26
+ * blue-violet: the primary hue and the primary button).
27
+ * - The neutrals, from the foreground to the deepest ground: `text` (body
28
+ * text), `subtext1` and `subtext0` (secondary text, each a step quieter),
29
+ * `overlay2`, `overlay1`, and `overlay0` (comments, hints, and inactive
30
+ * marks, each quieter still), `surface2`, `surface1`, and `surface0`
31
+ * (strong borders, borders, and hover fills), `base` (panels), `mantle`
32
+ * (the window's ground), and `crust` (the header bar). In a dark theme
33
+ * each ground is darker than the one before it; in a light theme the
34
+ * header still sits a step under the ground, as `crust` does in Latte.
35
+ */
36
+ export interface ThemePalette {
37
+ readonly rosewater: Hex;
38
+ readonly flamingo: Hex;
39
+ readonly pink: Hex;
40
+ readonly mauve: Hex;
41
+ readonly red: Hex;
42
+ readonly maroon: Hex;
43
+ readonly peach: Hex;
44
+ readonly yellow: Hex;
45
+ readonly green: Hex;
46
+ readonly teal: Hex;
47
+ readonly sky: Hex;
48
+ readonly sapphire: Hex;
49
+ readonly blue: Hex;
50
+ readonly lavender: Hex;
51
+ readonly text: Hex;
52
+ readonly subtext1: Hex;
53
+ readonly subtext0: Hex;
54
+ readonly overlay2: Hex;
55
+ readonly overlay1: Hex;
56
+ readonly overlay0: Hex;
57
+ readonly surface2: Hex;
58
+ readonly surface1: Hex;
59
+ readonly surface0: Hex;
60
+ readonly base: Hex;
61
+ readonly mantle: Hex;
62
+ readonly crust: Hex;
63
+ }
64
+ /**
65
+ * A theme's terminal colours: the 16 ANSI colours (SGR 30 to 37, then 90 to
66
+ * 97) and the cursor, as the theme's own terminal port publishes them. The
67
+ * terminal's ground and text are the palette's `base` and `text`, and its
68
+ * selection is the accent, so neither is listed here.
69
+ */
70
+ export interface TerminalPalette {
71
+ /** Exactly 16, in SGR order. */
72
+ readonly ansi: readonly Hex[];
73
+ /** The terminal cursor's colour. */
74
+ readonly cursor: Hex;
75
+ }
76
+ /**
77
+ * The eight categorical hues (`--group-<hue>`), by plain name, for marks that
78
+ * tell items of a set apart by colour alone: a group, a tag, a label. A hue
79
+ * names a category, never a status.
80
+ */
81
+ export type GroupHue = 'blue' | 'green' | 'purple' | 'orange' | 'teal' | 'pink' | 'yellow' | 'red';
82
+ /** A theme's colours: what the catalog holds for an id of `ids.ts`. */
83
+ interface ThemeColours {
84
+ /** The source colours every token is derived from. */
85
+ readonly palette: ThemePalette;
86
+ /** The terminal's ANSI colours and cursor. */
87
+ readonly terminal: TerminalPalette;
88
+ /**
89
+ * Group hues drawn in a colour other than their palette role's, where two
90
+ * roles share one of the theme's few hues and their marks would look
91
+ * alike. A group mark sits beside its item's name, so it may wear a colour
92
+ * the theme's text could not; the marks' hairline ring follows these too.
93
+ * Every other hue wears its role (`blue` the palette's blue, `purple` its
94
+ * mauve, `orange` its peach).
95
+ */
96
+ readonly groups?: Readonly<Partial<Record<GroupHue, Hex>>>;
97
+ /**
98
+ * Tokens hand-tuned where no rule in `tokens.ts` gives the value the theme
99
+ * was designed with, each with the reason it is tuned. Every other token
100
+ * follows the rules, so a new theme needs no overrides to be legible; a
101
+ * token derived from an overridden one follows the override.
102
+ */
103
+ readonly overrides?: ThemeOverrides;
104
+ }
105
+ /** One theme of the catalog: its entry in `ids.ts` and its colours. */
106
+ export interface Theme extends ThemeColours {
107
+ /** The theme's id in `ids.ts`. */
108
+ readonly id: ThemeId;
109
+ /** The display name a theme picker shows. */
110
+ readonly name: string;
111
+ /** The appearance the theme is worn under. */
112
+ readonly appearance: ThemeAppearance;
113
+ }
114
+ /**
115
+ * Every theme, in the order `ids.ts` lists them (light themes first, the
116
+ * order a theme picker lists them in).
117
+ */
118
+ export declare const THEMES: readonly Theme[];
119
+ /** The theme of the catalog with `id`. */
120
+ export declare function themeById(id: ThemeId): Theme;
121
+ /** The theme a light appearance wears until the user picks another. */
122
+ export declare const DEFAULT_LIGHT_THEME: Theme;
123
+ /** The theme a dark appearance wears until the user picks another. */
124
+ export declare const DEFAULT_DARK_THEME: Theme;
125
+ export {};