@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,310 @@
1
+ /* Charts (src/charts/). Series are painted --chart-1 to --chart-8 in turn,
2
+ mostly by the components on each mark; the rules here draw the chrome
3
+ around them from the other theme tokens.
4
+
5
+ PieChart: the pie, then a legend of each slice with its share; hovering
6
+ one lights the other. */
7
+ .pie-chart {
8
+ display: flex;
9
+ align-items: flex-start;
10
+ gap: 16px;
11
+ margin: 0;
12
+ color: var(--text);
13
+ font: 12px var(--font-ui);
14
+ }
15
+
16
+ .pie-slice {
17
+ stroke: var(--surface);
18
+ stroke-width: 1;
19
+ opacity: 0.9;
20
+ }
21
+
22
+ .pie-slice.lit {
23
+ opacity: 1;
24
+ stroke: var(--text);
25
+ }
26
+
27
+ .pie-legend {
28
+ display: grid;
29
+ gap: 2px;
30
+ margin: 0;
31
+ padding: 0;
32
+ list-style: none;
33
+ }
34
+
35
+ .pie-legend li {
36
+ display: flex;
37
+ white-space: nowrap;
38
+ align-items: center;
39
+ gap: 6px;
40
+ padding: 1px 4px;
41
+ border-radius: 3px;
42
+ }
43
+
44
+ .pie-legend li.lit {
45
+ background: var(--hover-wash);
46
+ }
47
+
48
+ .pie-swatch {
49
+ flex: none;
50
+ width: 10px;
51
+ height: 10px;
52
+ border-radius: 2px;
53
+ }
54
+
55
+ .pie-value {
56
+ color: var(--row-meta-text);
57
+ font-variant-numeric: tabular-nums;
58
+ }
59
+
60
+ /* LineChart: a frame as wide
61
+ as its cell, the plot's grid and frame, a line per series in the series
62
+ colours, the hover's guide and read-out, a dragged time range, and the
63
+ legend under it. */
64
+ .line-chart {
65
+ display: flex;
66
+ flex-direction: column;
67
+ gap: 4px;
68
+ min-width: 0;
69
+ margin: 0;
70
+ color: var(--text);
71
+ font: 11px var(--font-ui);
72
+ }
73
+
74
+ .line-frame {
75
+ position: relative;
76
+ min-width: 0;
77
+ }
78
+
79
+ .line-svg {
80
+ display: block;
81
+ }
82
+
83
+ .line-grid {
84
+ stroke: color-mix(in srgb, var(--border) 70%, transparent);
85
+ }
86
+
87
+ .line-tick text {
88
+ fill: var(--row-meta-text);
89
+ font-variant-numeric: tabular-nums;
90
+ }
91
+
92
+ .line-axes {
93
+ fill: none;
94
+ stroke: var(--border-strong);
95
+ }
96
+
97
+ .line-series {
98
+ fill: none;
99
+ stroke-width: 1.5;
100
+ stroke-linejoin: round;
101
+ stroke-linecap: round;
102
+ }
103
+
104
+ .line-guide {
105
+ stroke: var(--text-dim);
106
+ stroke-dasharray: 2 2;
107
+ pointer-events: none;
108
+ }
109
+
110
+ .line-plot {
111
+ fill: transparent;
112
+ }
113
+
114
+ .line-plot.selectable {
115
+ cursor: col-resize;
116
+ }
117
+
118
+ .line-selection {
119
+ fill: color-mix(in srgb, var(--accent) 14%, transparent);
120
+ stroke: var(--accent);
121
+ pointer-events: none;
122
+ }
123
+
124
+ .line-readout {
125
+ position: absolute;
126
+ top: 8px;
127
+ display: flex;
128
+ flex-direction: column;
129
+ gap: 2px;
130
+ padding: 4px 6px;
131
+ border: 1px solid var(--border);
132
+ border-radius: 4px;
133
+ background: var(--surface);
134
+ white-space: nowrap;
135
+ pointer-events: none;
136
+ font-variant-numeric: tabular-nums;
137
+ }
138
+
139
+ .line-legend {
140
+ display: flex;
141
+ flex-wrap: wrap;
142
+ gap: 2px 10px;
143
+ margin: 0;
144
+ padding: 0;
145
+ list-style: none;
146
+ }
147
+
148
+ .line-legend li,
149
+ .line-readout span {
150
+ display: flex;
151
+ align-items: center;
152
+ gap: 5px;
153
+ }
154
+
155
+ .line-swatch {
156
+ flex: none;
157
+ width: 10px;
158
+ height: 3px;
159
+ border-radius: 1px;
160
+ }
161
+
162
+ /* ScatterChart: a frame the
163
+ user resizes by its corner, the plot's grid and frame, the points in the
164
+ first series colour, the dragged zoom rectangle, and a caption with the
165
+ count and Reset zoom. */
166
+ .scatter-chart {
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 6px;
170
+ margin: 0;
171
+ color: var(--text);
172
+ font: 11px var(--font-ui);
173
+ }
174
+
175
+ .scatter-frame {
176
+ width: min(100%, 720px);
177
+ height: 380px;
178
+ min-width: 240px;
179
+ min-height: 180px;
180
+ overflow: hidden;
181
+ resize: both;
182
+ border: 1px solid var(--border);
183
+ border-radius: 6px;
184
+ }
185
+
186
+ .scatter-svg {
187
+ display: block;
188
+ }
189
+
190
+ .scatter-grid {
191
+ stroke: color-mix(in srgb, var(--border) 70%, transparent);
192
+ }
193
+
194
+ .scatter-tick text {
195
+ fill: var(--row-meta-text);
196
+ font-variant-numeric: tabular-nums;
197
+ }
198
+
199
+ .scatter-axes {
200
+ fill: none;
201
+ stroke: var(--border-strong);
202
+ }
203
+
204
+ .scatter-plot {
205
+ fill: transparent;
206
+ cursor: crosshair;
207
+ }
208
+
209
+ .scatter-selection {
210
+ fill: color-mix(in srgb, var(--accent) 14%, transparent);
211
+ stroke: var(--accent);
212
+ pointer-events: none;
213
+ }
214
+
215
+ .scatter-point {
216
+ fill: var(--chart-1);
217
+ fill-opacity: 0.8;
218
+ stroke: var(--surface);
219
+ stroke-width: 1;
220
+ cursor: pointer;
221
+ }
222
+
223
+ .scatter-point:hover,
224
+ .scatter-point:focus-visible,
225
+ .scatter-point.lit {
226
+ fill-opacity: 1;
227
+ stroke: var(--text);
228
+ outline: none;
229
+ }
230
+
231
+ .scatter-title {
232
+ fill: var(--text-dim);
233
+ font-weight: 600;
234
+ }
235
+
236
+ .scatter-caption {
237
+ display: flex;
238
+ align-items: center;
239
+ gap: 12px;
240
+ color: var(--row-meta-text);
241
+ }
242
+
243
+ /* ResultChart, the chart of a table: its title, legend, axes and their
244
+ labels, grid, and marks in the chart tokens, drawn inside the SVG so its
245
+ picture saves whole, and a read-out of the value under the pointer. */
246
+ .result-chart {
247
+ display: flex;
248
+ flex-direction: column;
249
+ gap: 4px;
250
+ margin: 0;
251
+ color: var(--text);
252
+ font: 11px var(--font-ui);
253
+ }
254
+
255
+ .result-chart svg {
256
+ display: block;
257
+ font: 11px var(--font-ui);
258
+ }
259
+
260
+ .result-chart-title {
261
+ fill: var(--text);
262
+ font-size: 13px;
263
+ font-weight: 600;
264
+ }
265
+
266
+ .result-chart-legend,
267
+ .result-chart-axis text {
268
+ fill: var(--row-meta-text);
269
+ font-variant-numeric: tabular-nums;
270
+ }
271
+
272
+ .result-chart-axis-title {
273
+ fill: var(--text-dim);
274
+ font-weight: 600;
275
+ }
276
+
277
+ .result-chart-grid {
278
+ stroke: color-mix(in srgb, var(--border) 70%, transparent);
279
+ }
280
+
281
+ .result-chart-baseline {
282
+ stroke: var(--border-strong);
283
+ }
284
+
285
+ .result-chart-line {
286
+ stroke-width: 2;
287
+ stroke-linejoin: round;
288
+ }
289
+
290
+ .result-chart-area {
291
+ fill-opacity: 0.35;
292
+ stroke: none;
293
+ }
294
+
295
+ .result-chart-mark {
296
+ stroke: var(--surface);
297
+ stroke-width: 0.5;
298
+ }
299
+
300
+ .result-chart-mark:hover {
301
+ stroke: var(--text);
302
+ stroke-width: 1.5;
303
+ }
304
+
305
+ .result-chart-readout {
306
+ min-height: 1.4em;
307
+ margin: 0;
308
+ color: var(--row-meta-text);
309
+ font-variant-numeric: tabular-nums;
310
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Charts drawn in SVG from the theme's chart tokens: `LineChart`,
3
+ * `PieChart`, `ScatterChart`, and `ResultChart` for a table of rows, plus
4
+ * the helpers that save a chart as a picture.
5
+ */
6
+ export { svgMarkup, svgPng, tokenColour } from './Drawing.js';
7
+ export type { LinePoint } from './Line.logic.js';
8
+ export { LineChart, type LineChartProps, type LineSeries } from './LineChart.js';
9
+ export type { PieSlice } from './Pie.logic.js';
10
+ export { PieChart, type PieChartProps } from './PieChart.js';
11
+ export { ResultChart, type ResultChartProps } from './ResultChart.js';
12
+ export { RESULT_CHART_TYPES, STACKABLE_CHART_TYPES, type ChartSeries, type ResultChartType } from './ResultChart.logic.js';
13
+ export type { ScatterAxis, ScatterAxisKind } from './Scatter.logic.js';
14
+ export { ScatterChart, type ScatterChartProps, type ScatterPoint } from './ScatterChart.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Charts drawn in SVG from the theme's chart tokens: `LineChart`,
3
+ * `PieChart`, `ScatterChart`, and `ResultChart` for a table of rows, plus
4
+ * the helpers that save a chart as a picture.
5
+ */
6
+ export { svgMarkup, svgPng, tokenColour } from './Drawing.js';
7
+ export { LineChart } from './LineChart.js';
8
+ export { PieChart } from './PieChart.js';
9
+ export { ResultChart } from './ResultChart.js';
10
+ export { RESULT_CHART_TYPES, STACKABLE_CHART_TYPES } from './ResultChart.logic.js';
11
+ export { ScatterChart } from './ScatterChart.js';
@@ -0,0 +1,2 @@
1
+ /** The chart token the series at `index` (from zero) is drawn in, as a `var()`. */
2
+ export declare const seriesColour: (index: number) => string;
@@ -0,0 +1,8 @@
1
+ /*
2
+ * The colour of the nth series, slice, or legend entry in every chart: the
3
+ * theme's chart tokens in turn, starting over after the last.
4
+ */
5
+ /** How many series colours the theme defines (`--chart-1` to `--chart-8`). */
6
+ const SERIES_COLOURS = 8;
7
+ /** The chart token the series at `index` (from zero) is drawn in, as a `var()`. */
8
+ export const seriesColour = (index) => `var(--chart-${(index % SERIES_COLOURS) + 1})`;
@@ -0,0 +1,2 @@
1
+ /** `useClock`: the time for labels that count ("5 seconds ago"), rendering only when one changes. */
2
+ export { useClock } from './useClock.js';
@@ -0,0 +1,2 @@
1
+ /** `useClock`: the time for labels that count ("5 seconds ago"), rendering only when one changes. */
2
+ export { useClock } from './useClock.js';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The time a component's labels read from. While `active` it wakes, and
3
+ * renders, at the first instant `changesAt` says one of its labels reads
4
+ * otherwise (every second unless given), and holds still between them, so
5
+ * nothing renders for a label that would read the same. A render for any
6
+ * other reason that comes after such an instant or after the clock was set
7
+ * back, the first one after the component comes back into view among them,
8
+ * reads the time afresh, so a label never shows a time other than the
9
+ * render's. `changesAt` takes a time and returns the first instant after it
10
+ * at which a label changes, or Infinity (or NaN) when none ever does; a new
11
+ * function schedules the wake again.
12
+ * While inactive it returns the current time without holding a timer.
13
+ */
14
+ export declare function useClock(active: boolean, changesAt?: (now: number) => number): number;
@@ -0,0 +1,57 @@
1
+ import { useEffect, useMemo, useState } from 'react';
2
+ /**
3
+ * The longest the clock waits before it reads the wall clock again. A timer
4
+ * counts on a clock that stops while the computer sleeps, so one set for a
5
+ * label minutes away would fire that much after a wake; reading every second
6
+ * keeps a label no more than a second late after a sleep or a change of the
7
+ * system time, as a clock that ticked every second did, and renders nothing
8
+ * until a label reads otherwise.
9
+ */
10
+ const LOOK_MS = 1000;
11
+ /** A clock for labels that count seconds: the next second. */
12
+ const everySecond = (now) => now + 1000;
13
+ /**
14
+ * The time a component's labels read from. While `active` it wakes, and
15
+ * renders, at the first instant `changesAt` says one of its labels reads
16
+ * otherwise (every second unless given), and holds still between them, so
17
+ * nothing renders for a label that would read the same. A render for any
18
+ * other reason that comes after such an instant or after the clock was set
19
+ * back, the first one after the component comes back into view among them,
20
+ * reads the time afresh, so a label never shows a time other than the
21
+ * render's. `changesAt` takes a time and returns the first instant after it
22
+ * at which a label changes, or Infinity (or NaN) when none ever does; a new
23
+ * function schedules the wake again.
24
+ * While inactive it returns the current time without holding a timer.
25
+ */
26
+ export function useClock(active, changesAt = everySecond) {
27
+ const [now, setNow] = useState(() => Date.now());
28
+ const due = useMemo(() => (active ? changesAt(now) : now), [active, changesAt, now]);
29
+ // Each wake starts from the time the last one held, so a change that
30
+ // comes between a render and this effect is never skipped.
31
+ useEffect(() => {
32
+ if (!active || !Number.isFinite(due)) {
33
+ return;
34
+ }
35
+ let timer;
36
+ const look = () => {
37
+ timer = setTimeout(() => {
38
+ const at = Date.now();
39
+ // Before the change, on a clock that has not gone back: nothing
40
+ // reads otherwise yet.
41
+ if (at < due && at >= now) {
42
+ look();
43
+ return;
44
+ }
45
+ setNow(at);
46
+ }, Math.min(Math.max(due - Date.now(), 0), LOOK_MS));
47
+ };
48
+ look();
49
+ return () => clearTimeout(timer);
50
+ }, [active, due, now]);
51
+ if (!active)
52
+ return Date.now();
53
+ const current = Date.now();
54
+ // The time held, while no label has changed since and the clock has not
55
+ // gone back before it.
56
+ return current < due && current >= now ? now : current;
57
+ }
@@ -0,0 +1,50 @@
1
+ import { type ReactElement } from 'react';
2
+ import { type PickerKind, type PickerParts } from './DateTimePicker.logic.js';
3
+ /** Props for {@link DateTimePicker}. */
4
+ export interface DateTimePickerProps {
5
+ /** What it picks: a date, a time, or both. */
6
+ readonly kind: PickerKind;
7
+ /** How many digits of a second a time keeps, 0 to 6; 0 shows no fraction field. */
8
+ readonly fraction?: number;
9
+ /** The field's value as typed, which the picker reads with `parse`. */
10
+ readonly value: string;
11
+ /** Called with the picked value, written with `format`. */
12
+ readonly onChange: (value: string) => void;
13
+ /** The week's first day in the month grid, 1 Monday to 7 Sunday; Monday unless given. */
14
+ readonly firstDay?: number;
15
+ /** The button's accessible name, what it picks ("Pick the due date"). */
16
+ readonly label: string;
17
+ /**
18
+ * What hovering the button says; its `label` unless given. A store that
19
+ * takes values the picker cannot pick says so here.
20
+ */
21
+ readonly hint?: string;
22
+ /** Whether the button is disabled. */
23
+ readonly disabled?: boolean;
24
+ /**
25
+ * Writes picked parts as the field's value; `formatPicker` (ISO 8601,
26
+ * date and time joined by `T`) unless given. A store that joins them with
27
+ * a space passes `(kind, parts, fraction) => formatPicker(kind, parts, fraction, ' ')`.
28
+ */
29
+ readonly format?: (kind: PickerKind, parts: PickerParts, fraction: number) => string;
30
+ /**
31
+ * Reads the field's value into parts, or null for one the picker cannot
32
+ * show, which opens it on today; `parsePicker` unless given.
33
+ */
34
+ readonly parse?: (value: string) => PickerParts | null;
35
+ }
36
+ /**
37
+ * The button beside a date or time field that opens its picker: a month's
38
+ * days a week a row from `firstDay`, the previous and next month, Today,
39
+ * and for a time its hour, minute, and second, with the fraction of a
40
+ * second where the value keeps one (`fraction` digits). A pick writes the
41
+ * value through `onChange`; Done or Escape closes it, as does a pointer
42
+ * outside it, and a day picked for a date closes it. A value the picker
43
+ * cannot show (a keyword, the zero date) opens it on today and stays as
44
+ * typed until a pick. Month and weekday names come from `Intl` in the
45
+ * `dateTime` labels' locale; the field words from the same group.
46
+ *
47
+ * The panel is an overlay (`data-overlay`), so a window key policy that
48
+ * watches overlays holds its own keys while it is open.
49
+ */
50
+ export declare function DateTimePicker({ kind, fraction, value, onChange, firstDay, label, hint, disabled, format, parse }: DateTimePickerProps): ReactElement;
@@ -0,0 +1,98 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { CalendarDays, ChevronLeft, ChevronRight, Clock } from 'lucide-react';
3
+ import { useEffect, useId, useRef, useState } from 'react';
4
+ import { Button } from '../button/Button.js';
5
+ import { IconButton } from '../button/IconButton.js';
6
+ import { useLabels } from '../labels/UiokProvider.js';
7
+ import { tooltip } from '../tooltip/Tooltip.logic.js';
8
+ import { formatPicker, monthGrid, nowParts, parsePicker, stepMonth, utcDay, weekdayNames } from './DateTimePicker.logic.js';
9
+ /** The fields of a time, each with its largest value. */
10
+ const TIME_FIELDS = [
11
+ { part: 'hour', max: 23 },
12
+ { part: 'minute', max: 59 },
13
+ { part: 'second', max: 59 }
14
+ ];
15
+ /** A time field's label. */
16
+ const timeFieldLabel = (labels, part) => labels[part];
17
+ /**
18
+ * The button beside a date or time field that opens its picker: a month's
19
+ * days a week a row from `firstDay`, the previous and next month, Today,
20
+ * and for a time its hour, minute, and second, with the fraction of a
21
+ * second where the value keeps one (`fraction` digits). A pick writes the
22
+ * value through `onChange`; Done or Escape closes it, as does a pointer
23
+ * outside it, and a day picked for a date closes it. A value the picker
24
+ * cannot show (a keyword, the zero date) opens it on today and stays as
25
+ * typed until a pick. Month and weekday names come from `Intl` in the
26
+ * `dateTime` labels' locale; the field words from the same group.
27
+ *
28
+ * The panel is an overlay (`data-overlay`), so a window key policy that
29
+ * watches overlays holds its own keys while it is open.
30
+ */
31
+ export function DateTimePicker({ kind, fraction = 0, value, onChange, firstDay = 1, label, hint, disabled = false, format = formatPicker, parse = parsePicker }) {
32
+ const labels = useLabels().dateTime;
33
+ const [open, setOpen] = useState(false);
34
+ const [shown, setShown] = useState(() => parse(value) ?? nowParts());
35
+ const box = useRef(null);
36
+ const titleId = useId();
37
+ const picked = parse(value);
38
+ // A pointer outside the picker closes it.
39
+ useEffect(() => {
40
+ if (!open)
41
+ return;
42
+ const onPointer = (event) => {
43
+ if (!(event.target instanceof Node) || !box.current?.contains(event.target))
44
+ setOpen(false);
45
+ };
46
+ document.addEventListener('pointerdown', onPointer, true);
47
+ return () => document.removeEventListener('pointerdown', onPointer, true);
48
+ }, [open]);
49
+ const write = (parts) => {
50
+ setShown(parts);
51
+ onChange(format(kind, parts, fraction));
52
+ };
53
+ const base = picked ?? shown;
54
+ const days = monthGrid(shown.year, shown.month, firstDay);
55
+ const monthName = new Intl.DateTimeFormat(labels.locale, {
56
+ month: 'long',
57
+ year: 'numeric',
58
+ timeZone: 'UTC'
59
+ }).format(utcDay(shown.year, shown.month - 1, 1));
60
+ const close = () => setOpen(false);
61
+ return (_jsxs("div", { className: "date-picker", ref: box, children: [_jsx(IconButton, { "aria-expanded": open, "aria-label": label, disabled: disabled, onClick: () => {
62
+ setShown(parse(value) ?? nowParts());
63
+ setOpen(!open);
64
+ }, size: "small", ...tooltip(hint ?? label), children: kind === 'time' ? _jsx(Clock, { "aria-hidden": true, size: 13 }) : _jsx(CalendarDays, { "aria-hidden": true, size: 13 }) }), open && (_jsxs("div", { "aria-labelledby": titleId, className: "date-picker-panel", "data-overlay": true, onKeyDown: (event) => {
65
+ if (event.key === 'Escape') {
66
+ event.preventDefault();
67
+ event.stopPropagation();
68
+ close();
69
+ }
70
+ }, role: "dialog", children: [kind !== 'time' && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "date-picker-head", children: [_jsx(IconButton, { "aria-label": labels.previousMonth, onClick: () => setShown(stepMonth(shown, -1)), size: "small", children: _jsx(ChevronLeft, { "aria-hidden": true, size: 13 }) }), _jsx("strong", { id: titleId, children: monthName }), _jsx(IconButton, { "aria-label": labels.nextMonth, onClick: () => setShown(stepMonth(shown, 1)), size: "small", children: _jsx(ChevronRight, { "aria-hidden": true, size: 13 }) })] }), _jsxs("div", { className: "date-picker-days", role: "grid", children: [_jsx("div", { className: "date-picker-week", role: "row", children: weekdayNames(firstDay, labels.locale).map((name) => (_jsx("span", { className: "date-picker-weekday", role: "columnheader", children: name }, name))) }), Array.from({ length: days.length / 7 }, (_, week) => (_jsx("div", { className: "date-picker-week", role: "row", children: days.slice(week * 7, week * 7 + 7).map((day) => {
71
+ const current = picked !== null &&
72
+ picked.year === day.year &&
73
+ picked.month === day.month &&
74
+ picked.day === day.day;
75
+ return (_jsx("button", { "aria-selected": current, className: [
76
+ 'date-picker-day',
77
+ day.inMonth ? '' : 'outside',
78
+ current ? 'current' : ''
79
+ ]
80
+ .filter(Boolean)
81
+ .join(' '), onClick: () => {
82
+ write({ ...base, year: day.year, month: day.month, day: day.day });
83
+ if (kind === 'date')
84
+ close();
85
+ }, role: "gridcell", type: "button", children: day.day }, `${day.month}-${day.day}`));
86
+ }) }, week)))] })] })), kind !== 'date' && (_jsxs("div", { className: "date-picker-time", id: kind === 'time' ? titleId : undefined, children: [TIME_FIELDS.map((field) => (_jsxs("label", { className: "date-picker-field", children: [timeFieldLabel(labels, field.part), _jsx("input", { className: "date-picker-input", inputMode: "numeric", max: field.max, min: 0, onChange: (event) => {
87
+ const next = Math.min(field.max, Math.max(0, Number(event.currentTarget.value)));
88
+ if (Number.isFinite(next))
89
+ write({ ...base, [field.part]: next });
90
+ }, type: "number", value: base[field.part] })] }, field.part))), fraction > 0 && (_jsxs("label", { className: "date-picker-field", children: [fraction > 3 ? labels.microsecond : labels.millisecond, _jsx("input", { className: "date-picker-input", inputMode: "numeric", onChange: (event) => write({
91
+ ...base,
92
+ fraction: event.currentTarget.value.replace(/\D/gu, '').slice(0, fraction)
93
+ }), value: base.fraction.padEnd(fraction, '0').slice(0, fraction) })] }))] })), _jsxs("div", { className: "date-picker-foot", children: [_jsx(Button, { onClick: () => {
94
+ write(nowParts());
95
+ if (kind === 'date')
96
+ close();
97
+ }, size: "small", children: kind === 'date' ? labels.today : labels.now }), _jsx(Button, { onClick: close, size: "small", variant: "primary", children: labels.done })] })] }))] }));
98
+ }
@@ -0,0 +1,59 @@
1
+ /** What the picker picks: a date, a time, or both, with `fraction` digits of a second. */
2
+ export type PickerKind = 'date' | 'time' | 'datetime';
3
+ /** A value's parts; a missing date or time reads as 1 January of year 0 or midnight. */
4
+ export interface PickerParts {
5
+ /** The year, four digits when written. */
6
+ readonly year: number;
7
+ /** The month, 1 to 12. */
8
+ readonly month: number;
9
+ /** The day of the month, from 1. */
10
+ readonly day: number;
11
+ /** The hour, 0 to 23. */
12
+ readonly hour: number;
13
+ /** The minute, 0 to 59. */
14
+ readonly minute: number;
15
+ /** The second, 0 to 59. */
16
+ readonly second: number;
17
+ /** The fraction of a second as its digits, empty for none. */
18
+ readonly fraction: string;
19
+ }
20
+ /** Today and now, in the computer's own time zone. */
21
+ export declare const nowParts: (now?: Date) => PickerParts;
22
+ /**
23
+ * A value's parts, or null when it is not a date or time the picker can
24
+ * show (a keyword such as `now`, the zero date `0000-00-00`, a time past a
25
+ * day), which the field keeps as typed. It reads `YYYY-MM-DD`, `HH:MM`,
26
+ * `HH:MM:SS` with up to six digits of a fraction, and a date and a time
27
+ * joined by `T` or a space.
28
+ */
29
+ export declare function parsePicker(value: string): PickerParts | null;
30
+ /**
31
+ * The parts written as `kind` keeps them: `YYYY-MM-DD`, `HH:MM:SS`, or both
32
+ * joined by `separator` (ISO 8601's `T` unless given; a space for a store
33
+ * that writes them so), the seconds followed by `fraction` digits of a
34
+ * second when `fraction` is above 0.
35
+ */
36
+ export declare function formatPicker(kind: PickerKind, parts: PickerParts, fraction: number, separator?: string): string;
37
+ /**
38
+ * Midnight UTC on a day, `monthIndex` counting from 0 and overflowing as
39
+ * `Date.UTC` does. Unlike `Date.UTC`, it keeps years 0 to 99 as written
40
+ * rather than moving them to 1900 to 1999.
41
+ */
42
+ export declare function utcDay(year: number, monthIndex: number, day: number): Date;
43
+ /** The days in a month, 1 to 12. */
44
+ export declare const daysIn: (year: number, month: number) => number;
45
+ /**
46
+ * The days a month's grid shows, a week a row from `firstDay` (1 Monday to
47
+ * 7 Sunday): each date with whether it is in the month, the days of the
48
+ * weeks around it filling the first and last rows.
49
+ */
50
+ export declare function monthGrid(year: number, month: number, firstDay: number): {
51
+ readonly year: number;
52
+ readonly month: number;
53
+ readonly day: number;
54
+ readonly inMonth: boolean;
55
+ }[];
56
+ /** The month `by` months on, its day kept where the month has it. */
57
+ export declare function stepMonth(parts: PickerParts, by: number): PickerParts;
58
+ /** The weekday names from `firstDay` (1 Monday to 7 Sunday), short, in `locale`'s language. */
59
+ export declare function weekdayNames(firstDay: number, locale?: string): string[];