@vokality/design-system 0.0.0-stage → 1.2.2

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 (350) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +134 -2
  3. package/dist/charts/chart.d.ts +52 -0
  4. package/dist/charts/chart.js +108 -0
  5. package/dist/components/Accordion/Accordion.d.ts +15 -0
  6. package/dist/components/Accordion/Accordion.js +16 -0
  7. package/dist/components/Alert/Alert.d.ts +14 -0
  8. package/dist/components/Alert/Alert.js +12 -0
  9. package/dist/components/AppShell/AppShell.d.ts +21 -0
  10. package/dist/components/AppShell/AppShell.js +48 -0
  11. package/dist/components/Avatar/Avatar.d.ts +11 -0
  12. package/dist/components/Avatar/Avatar.js +19 -0
  13. package/dist/components/AvatarGroup/AvatarGroup.d.ts +11 -0
  14. package/dist/components/AvatarGroup/AvatarGroup.js +13 -0
  15. package/dist/components/Badge/Badge.d.ts +9 -0
  16. package/dist/components/Badge/Badge.js +6 -0
  17. package/dist/components/BarChart/BarChart.d.ts +7 -0
  18. package/dist/components/BarChart/BarChart.js +45 -0
  19. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +11 -0
  20. package/dist/components/Breadcrumbs/Breadcrumbs.js +11 -0
  21. package/dist/components/Button/Button.d.ts +17 -0
  22. package/dist/components/Button/Button.js +23 -0
  23. package/dist/components/Calendar/Calendar.d.ts +21 -0
  24. package/dist/components/Calendar/Calendar.js +144 -0
  25. package/dist/components/Card/Card.d.ts +16 -0
  26. package/dist/components/Card/Card.js +11 -0
  27. package/dist/components/Checkbox/Checkbox.d.ts +12 -0
  28. package/dist/components/Checkbox/Checkbox.js +24 -0
  29. package/dist/components/Code/Code.d.ts +7 -0
  30. package/dist/components/Code/Code.js +6 -0
  31. package/dist/components/CodeBlock/CodeBlock.d.ts +10 -0
  32. package/dist/components/CodeBlock/CodeBlock.js +43 -0
  33. package/dist/components/Combobox/Combobox.d.ts +23 -0
  34. package/dist/components/Combobox/Combobox.js +188 -0
  35. package/dist/components/Combobox/ListPanel.d.ts +16 -0
  36. package/dist/components/Combobox/ListPanel.js +75 -0
  37. package/dist/components/CommandPalette/CommandPalette.d.ts +23 -0
  38. package/dist/components/CommandPalette/CommandPalette.js +86 -0
  39. package/dist/components/Container/Container.d.ts +10 -0
  40. package/dist/components/Container/Container.js +7 -0
  41. package/dist/components/ContextMenu/ContextMenu.d.ts +11 -0
  42. package/dist/components/ContextMenu/ContextMenu.js +56 -0
  43. package/dist/components/DatePicker/DatePicker.d.ts +25 -0
  44. package/dist/components/DatePicker/DatePicker.js +198 -0
  45. package/dist/components/DescriptionList/DescriptionList.d.ts +12 -0
  46. package/dist/components/DescriptionList/DescriptionList.js +6 -0
  47. package/dist/components/Dialog/Dialog.d.ts +23 -0
  48. package/dist/components/Dialog/Dialog.js +53 -0
  49. package/dist/components/Divider/Divider.d.ts +6 -0
  50. package/dist/components/Divider/Divider.js +10 -0
  51. package/dist/components/Drawer/Drawer.d.ts +6 -0
  52. package/dist/components/Drawer/Drawer.js +6 -0
  53. package/dist/components/EmptyState/EmptyState.d.ts +11 -0
  54. package/dist/components/EmptyState/EmptyState.js +10 -0
  55. package/dist/components/ErrorSummary/ErrorSummary.d.ts +10 -0
  56. package/dist/components/ErrorSummary/ErrorSummary.js +28 -0
  57. package/dist/components/FaqList/FaqList.d.ts +10 -0
  58. package/dist/components/FaqList/FaqList.js +6 -0
  59. package/dist/components/Field/Field.d.ts +12 -0
  60. package/dist/components/Field/Field.js +25 -0
  61. package/dist/components/Figure/Figure.d.ts +11 -0
  62. package/dist/components/Figure/Figure.js +6 -0
  63. package/dist/components/FileUpload/FileUpload.d.ts +25 -0
  64. package/dist/components/FileUpload/FileUpload.js +47 -0
  65. package/dist/components/Grid/Grid.d.ts +12 -0
  66. package/dist/components/Grid/Grid.js +10 -0
  67. package/dist/components/HatchDivider/HatchDivider.d.ts +2 -0
  68. package/dist/components/HatchDivider/HatchDivider.js +5 -0
  69. package/dist/components/Heading/Heading.d.ts +12 -0
  70. package/dist/components/Heading/Heading.js +11 -0
  71. package/dist/components/Icon/Icon.d.ts +8 -0
  72. package/dist/components/Icon/Icon.js +17 -0
  73. package/dist/components/IconButton/IconButton.d.ts +11 -0
  74. package/dist/components/IconButton/IconButton.js +16 -0
  75. package/dist/components/Inline/Inline.d.ts +13 -0
  76. package/dist/components/Inline/Inline.js +8 -0
  77. package/dist/components/Input/Input.d.ts +10 -0
  78. package/dist/components/Input/Input.js +25 -0
  79. package/dist/components/Kbd/Kbd.d.ts +7 -0
  80. package/dist/components/Kbd/Kbd.js +6 -0
  81. package/dist/components/LineChart/LineChart.d.ts +7 -0
  82. package/dist/components/LineChart/LineChart.js +53 -0
  83. package/dist/components/Link/Link.d.ts +7 -0
  84. package/dist/components/Link/Link.js +12 -0
  85. package/dist/components/LinkProvider/LinkProvider.d.ts +22 -0
  86. package/dist/components/LinkProvider/LinkProvider.js +21 -0
  87. package/dist/components/List/List.d.ts +24 -0
  88. package/dist/components/List/List.js +24 -0
  89. package/dist/components/MediaCard/MediaCard.d.ts +19 -0
  90. package/dist/components/MediaCard/MediaCard.js +25 -0
  91. package/dist/components/Menu/Menu.d.ts +14 -0
  92. package/dist/components/Menu/Menu.js +53 -0
  93. package/dist/components/Menu/entries.d.ts +40 -0
  94. package/dist/components/Menu/entries.js +146 -0
  95. package/dist/components/MultiSelect/MultiSelect.d.ts +24 -0
  96. package/dist/components/MultiSelect/MultiSelect.js +166 -0
  97. package/dist/components/NavList/NavList.d.ts +19 -0
  98. package/dist/components/NavList/NavList.js +10 -0
  99. package/dist/components/NumberInput/NumberInput.d.ts +13 -0
  100. package/dist/components/NumberInput/NumberInput.js +90 -0
  101. package/dist/components/OtpInput/OtpInput.d.ts +19 -0
  102. package/dist/components/OtpInput/OtpInput.js +75 -0
  103. package/dist/components/PageHeader/PageHeader.d.ts +18 -0
  104. package/dist/components/PageHeader/PageHeader.js +11 -0
  105. package/dist/components/Pagination/Pagination.d.ts +15 -0
  106. package/dist/components/Pagination/Pagination.js +22 -0
  107. package/dist/components/PasswordInput/PasswordInput.d.ts +7 -0
  108. package/dist/components/PasswordInput/PasswordInput.js +11 -0
  109. package/dist/components/Popover/Popover.d.ts +18 -0
  110. package/dist/components/Popover/Popover.js +26 -0
  111. package/dist/components/Progress/Progress.d.ts +13 -0
  112. package/dist/components/Progress/Progress.js +24 -0
  113. package/dist/components/Prose/Prose.d.ts +8 -0
  114. package/dist/components/Prose/Prose.js +7 -0
  115. package/dist/components/Quote/Quote.d.ts +10 -0
  116. package/dist/components/Quote/Quote.js +7 -0
  117. package/dist/components/Radio/Radio.d.ts +7 -0
  118. package/dist/components/Radio/Radio.js +9 -0
  119. package/dist/components/RadioGroup/RadioGroup.d.ts +21 -0
  120. package/dist/components/RadioGroup/RadioGroup.js +41 -0
  121. package/dist/components/SearchInput/SearchInput.d.ts +10 -0
  122. package/dist/components/SearchInput/SearchInput.js +39 -0
  123. package/dist/components/SectionHeader/SectionHeader.d.ts +10 -0
  124. package/dist/components/SectionHeader/SectionHeader.js +9 -0
  125. package/dist/components/SegmentedControl/SegmentedControl.d.ts +19 -0
  126. package/dist/components/SegmentedControl/SegmentedControl.js +21 -0
  127. package/dist/components/Select/Select.d.ts +26 -0
  128. package/dist/components/Select/Select.js +262 -0
  129. package/dist/components/Skeleton/Skeleton.d.ts +8 -0
  130. package/dist/components/Skeleton/Skeleton.js +13 -0
  131. package/dist/components/Slider/Slider.d.ts +21 -0
  132. package/dist/components/Slider/Slider.js +43 -0
  133. package/dist/components/Sparkline/Sparkline.d.ts +11 -0
  134. package/dist/components/Sparkline/Sparkline.js +15 -0
  135. package/dist/components/Spinner/Spinner.d.ts +8 -0
  136. package/dist/components/Spinner/Spinner.js +8 -0
  137. package/dist/components/SquareGlyph/SquareGlyph.d.ts +7 -0
  138. package/dist/components/SquareGlyph/SquareGlyph.js +6 -0
  139. package/dist/components/Stack/Stack.d.ts +11 -0
  140. package/dist/components/Stack/Stack.js +8 -0
  141. package/dist/components/Stat/Stat.d.ts +13 -0
  142. package/dist/components/Stat/Stat.js +22 -0
  143. package/dist/components/Steps/Steps.d.ts +13 -0
  144. package/dist/components/Steps/Steps.js +13 -0
  145. package/dist/components/Switch/Switch.d.ts +7 -0
  146. package/dist/components/Switch/Switch.js +16 -0
  147. package/dist/components/Table/Table.d.ts +48 -0
  148. package/dist/components/Table/Table.js +144 -0
  149. package/dist/components/Tabs/Tabs.d.ts +19 -0
  150. package/dist/components/Tabs/Tabs.js +29 -0
  151. package/dist/components/Tag/Tag.d.ts +12 -0
  152. package/dist/components/Tag/Tag.js +8 -0
  153. package/dist/components/Text/Text.d.ts +10 -0
  154. package/dist/components/Text/Text.js +7 -0
  155. package/dist/components/Textarea/Textarea.d.ts +6 -0
  156. package/dist/components/Textarea/Textarea.js +17 -0
  157. package/dist/components/ThemeScript/ThemeScript.d.ts +7 -0
  158. package/dist/components/ThemeScript/ThemeScript.js +9 -0
  159. package/dist/components/TileGrid/TileGrid.d.ts +13 -0
  160. package/dist/components/TileGrid/TileGrid.js +8 -0
  161. package/dist/components/TimePicker/TimePicker.d.ts +28 -0
  162. package/dist/components/TimePicker/TimePicker.js +192 -0
  163. package/dist/components/Timeline/Timeline.d.ts +16 -0
  164. package/dist/components/Timeline/Timeline.js +10 -0
  165. package/dist/components/Toaster/Toaster.d.ts +50 -0
  166. package/dist/components/Toaster/Toaster.js +63 -0
  167. package/dist/components/Tooltip/Tooltip.d.ts +11 -0
  168. package/dist/components/Tooltip/Tooltip.js +21 -0
  169. package/dist/components/TreeView/TreeView.d.ts +30 -0
  170. package/dist/components/TreeView/TreeView.js +127 -0
  171. package/dist/components.css +1798 -0
  172. package/dist/fonts/FONT-NOTICES.txt +20 -0
  173. package/dist/fonts/IBMPlexSans-Latin.woff2 +0 -0
  174. package/dist/fonts/IBMPlexSans-OFL.txt +93 -0
  175. package/dist/fonts/Manrope-Latin.woff2 +0 -0
  176. package/dist/fonts/Manrope-OFL.txt +93 -0
  177. package/dist/fonts/SpaceGrotesk-Latin.woff2 +0 -0
  178. package/dist/fonts/SpaceGrotesk-OFL.txt +93 -0
  179. package/dist/fonts.css +23 -0
  180. package/dist/hooks/useTheme.d.ts +16 -0
  181. package/dist/hooks/useTheme.js +82 -0
  182. package/dist/icons/arrow-down.svg +1 -0
  183. package/dist/icons/arrow-up-right.svg +1 -0
  184. package/dist/icons/arrow-up.svg +1 -0
  185. package/dist/icons/calendar.svg +1 -0
  186. package/dist/icons/chart.svg +1 -0
  187. package/dist/icons/check.svg +1 -0
  188. package/dist/icons/chevron-down.svg +1 -0
  189. package/dist/icons/chevron-left.svg +1 -0
  190. package/dist/icons/chevron-right.svg +1 -0
  191. package/dist/icons/chevrons-up-down.svg +1 -0
  192. package/dist/icons/circle-alert.svg +1 -0
  193. package/dist/icons/circle-check.svg +1 -0
  194. package/dist/icons/clock.svg +1 -0
  195. package/dist/icons/copy.svg +1 -0
  196. package/dist/icons/ellipsis.svg +1 -0
  197. package/dist/icons/file.svg +1 -0
  198. package/dist/icons/folder.svg +1 -0
  199. package/dist/icons/home.svg +1 -0
  200. package/dist/icons/info.svg +1 -0
  201. package/dist/icons/map-pin.svg +1 -0
  202. package/dist/icons/menu.svg +1 -0
  203. package/dist/icons/minus.svg +1 -0
  204. package/dist/icons/pencil.svg +1 -0
  205. package/dist/icons/phone.svg +1 -0
  206. package/dist/icons/plus.svg +1 -0
  207. package/dist/icons/quote.svg +1 -0
  208. package/dist/icons/search.svg +1 -0
  209. package/dist/icons/sidebar.svg +1 -0
  210. package/dist/icons/trash.svg +1 -0
  211. package/dist/icons/triangle-alert.svg +1 -0
  212. package/dist/icons/upload.svg +1 -0
  213. package/dist/icons/users.svg +1 -0
  214. package/dist/icons/x.svg +1 -0
  215. package/dist/index.d.ts +178 -0
  216. package/dist/index.js +93 -0
  217. package/dist/internal/CharCount.d.ts +17 -0
  218. package/dist/internal/CharCount.js +23 -0
  219. package/dist/internal/choice.d.ts +65 -0
  220. package/dist/internal/choice.js +111 -0
  221. package/dist/internal/focusables.d.ts +3 -0
  222. package/dist/internal/focusables.js +8 -0
  223. package/dist/internal/options.d.ts +15 -0
  224. package/dist/internal/options.js +30 -0
  225. package/dist/internal/status.d.ts +6 -0
  226. package/dist/internal/status.js +5 -0
  227. package/dist/internal/useIsoLayoutEffect.d.ts +3 -0
  228. package/dist/internal/useIsoLayoutEffect.js +4 -0
  229. package/dist/internal/useScrollActive.d.ts +3 -0
  230. package/dist/internal/useScrollActive.js +12 -0
  231. package/dist/internal/useUid.d.ts +2 -0
  232. package/dist/internal/useUid.js +6 -0
  233. package/dist/lib/cx.d.ts +2 -0
  234. package/dist/lib/cx.js +4 -0
  235. package/dist/lib/dates.d.ts +10 -0
  236. package/dist/lib/dates.js +107 -0
  237. package/dist/lib/format.d.ts +15 -0
  238. package/dist/lib/format.js +50 -0
  239. package/dist/lib/icons.d.ts +220 -0
  240. package/dist/lib/icons.js +54 -0
  241. package/dist/lib/intl.d.ts +4 -0
  242. package/dist/lib/intl.js +19 -0
  243. package/dist/lib/math.d.ts +5 -0
  244. package/dist/lib/math.js +36 -0
  245. package/dist/lib/omit.d.ts +2 -0
  246. package/dist/lib/omit.js +10 -0
  247. package/dist/lib/space.d.ts +4 -0
  248. package/dist/lib/space.js +9 -0
  249. package/dist/lib/text.d.ts +8 -0
  250. package/dist/lib/text.js +12 -0
  251. package/dist/lib/theme.d.ts +16 -0
  252. package/dist/lib/theme.js +14 -0
  253. package/dist/lib/utils.d.ts +17 -0
  254. package/dist/lib/utils.js +5 -0
  255. package/dist/tailwind.css +110 -0
  256. package/dist/tokens.css +316 -0
  257. package/dist/tokens.dtcg.json +1606 -0
  258. package/dist/tokens.json +1217 -0
  259. package/dist/types.d.ts +67 -0
  260. package/dist/types.js +1 -0
  261. package/dist/vokality.css +2139 -0
  262. package/dist/vokality.iife.js +19408 -0
  263. package/docs/brand.md +163 -0
  264. package/docs/components/Accordion/README.md +24 -0
  265. package/docs/components/Alert/README.md +31 -0
  266. package/docs/components/AppShell/README.md +20 -0
  267. package/docs/components/Avatar/README.md +17 -0
  268. package/docs/components/AvatarGroup/README.md +12 -0
  269. package/docs/components/Badge/README.md +24 -0
  270. package/docs/components/BarChart/README.md +30 -0
  271. package/docs/components/Breadcrumbs/README.md +16 -0
  272. package/docs/components/Button/README.md +43 -0
  273. package/docs/components/Calendar/README.md +43 -0
  274. package/docs/components/Card/README.md +16 -0
  275. package/docs/components/Checkbox/README.md +30 -0
  276. package/docs/components/Code/README.md +9 -0
  277. package/docs/components/CodeBlock/README.md +15 -0
  278. package/docs/components/Combobox/README.md +43 -0
  279. package/docs/components/CommandPalette/README.md +20 -0
  280. package/docs/components/Container/README.md +10 -0
  281. package/docs/components/ContextMenu/README.md +13 -0
  282. package/docs/components/Dashboard/README.md +12 -0
  283. package/docs/components/DatePicker/README.md +34 -0
  284. package/docs/components/DescriptionList/README.md +18 -0
  285. package/docs/components/Dialog/README.md +28 -0
  286. package/docs/components/Divider/README.md +15 -0
  287. package/docs/components/Drawer/README.md +16 -0
  288. package/docs/components/EmptyState/README.md +17 -0
  289. package/docs/components/ErrorPage/README.md +11 -0
  290. package/docs/components/ErrorSummary/README.md +16 -0
  291. package/docs/components/FaqList/README.md +11 -0
  292. package/docs/components/Field/README.md +27 -0
  293. package/docs/components/Figure/README.md +9 -0
  294. package/docs/components/FileUpload/README.md +20 -0
  295. package/docs/components/FormPage/README.md +11 -0
  296. package/docs/components/Grid/README.md +11 -0
  297. package/docs/components/HatchDivider/README.md +10 -0
  298. package/docs/components/Heading/README.md +10 -0
  299. package/docs/components/Icon/README.md +23 -0
  300. package/docs/components/IconButton/README.md +28 -0
  301. package/docs/components/Inline/README.md +9 -0
  302. package/docs/components/Input/README.md +31 -0
  303. package/docs/components/Kbd/README.md +13 -0
  304. package/docs/components/LineChart/README.md +27 -0
  305. package/docs/components/Link/README.md +31 -0
  306. package/docs/components/List/README.md +21 -0
  307. package/docs/components/ListDetail/README.md +11 -0
  308. package/docs/components/MediaCard/README.md +16 -0
  309. package/docs/components/Menu/README.md +45 -0
  310. package/docs/components/MultiSelect/README.md +41 -0
  311. package/docs/components/NavList/README.md +21 -0
  312. package/docs/components/NumberInput/README.md +19 -0
  313. package/docs/components/OtpInput/README.md +17 -0
  314. package/docs/components/PageHeader/README.md +17 -0
  315. package/docs/components/Pagination/README.md +22 -0
  316. package/docs/components/PasswordInput/README.md +13 -0
  317. package/docs/components/Popover/README.md +23 -0
  318. package/docs/components/Progress/README.md +19 -0
  319. package/docs/components/Prose/README.md +12 -0
  320. package/docs/components/Quote/README.md +13 -0
  321. package/docs/components/Radio/README.md +25 -0
  322. package/docs/components/RadioGroup/README.md +23 -0
  323. package/docs/components/SearchInput/README.md +23 -0
  324. package/docs/components/SectionHeader/README.md +14 -0
  325. package/docs/components/SegmentedControl/README.md +19 -0
  326. package/docs/components/Select/README.md +52 -0
  327. package/docs/components/SettingsPage/README.md +11 -0
  328. package/docs/components/SignIn/README.md +11 -0
  329. package/docs/components/Skeleton/README.md +16 -0
  330. package/docs/components/Slider/README.md +22 -0
  331. package/docs/components/Sparkline/README.md +13 -0
  332. package/docs/components/Spinner/README.md +16 -0
  333. package/docs/components/SquareGlyph/README.md +18 -0
  334. package/docs/components/Stack/README.md +11 -0
  335. package/docs/components/Stat/README.md +20 -0
  336. package/docs/components/Steps/README.md +22 -0
  337. package/docs/components/Switch/README.md +27 -0
  338. package/docs/components/Table/README.md +35 -0
  339. package/docs/components/Tabs/README.md +26 -0
  340. package/docs/components/Tag/README.md +21 -0
  341. package/docs/components/Text/README.md +11 -0
  342. package/docs/components/Textarea/README.md +20 -0
  343. package/docs/components/ThemeScript/README.md +47 -0
  344. package/docs/components/TileGrid/README.md +12 -0
  345. package/docs/components/TimePicker/README.md +19 -0
  346. package/docs/components/Timeline/README.md +12 -0
  347. package/docs/components/Toaster/README.md +34 -0
  348. package/docs/components/Tooltip/README.md +23 -0
  349. package/docs/components/TreeView/README.md +15 -0
  350. package/package.json +76 -4
@@ -0,0 +1,107 @@
1
+ import { resolveLocale } from "./format.js";
2
+ import { dateFormat } from "./intl.js";
3
+ /* Dates are exchanged as "YYYY-MM-DD" strings and handled as local-midnight Date objects. */
4
+ export function pad2(n) { return (n < 10 ? "0" : "") + n; }
5
+ export function toISO(d) { return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()); }
6
+ export function parseISO(s) {
7
+ if (!s)
8
+ return null;
9
+ if (s instanceof Date)
10
+ return new Date(s.getFullYear(), s.getMonth(), s.getDate());
11
+ const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
12
+ return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null;
13
+ }
14
+ export function addDays(d, n) { return new Date(d.getFullYear(), d.getMonth(), d.getDate() + n); }
15
+ export function addMonths(d, n) {
16
+ const t = new Date(d.getFullYear(), d.getMonth() + n, 1);
17
+ const last = new Date(t.getFullYear(), t.getMonth() + 1, 0).getDate();
18
+ return new Date(t.getFullYear(), t.getMonth(), Math.min(d.getDate(), last));
19
+ }
20
+ export function sameDay(a, b) {
21
+ return Boolean(a && b) && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
22
+ }
23
+ export function clampDate(d, min, max) {
24
+ return min && d < min ? min : max && d > max ? max : d;
25
+ }
26
+ /* Time: values are "HH:MM" (24-hour); display follows the locale's clock. */
27
+ export function parseTime(text) {
28
+ let s = String(text || "").trim().toLowerCase().replace(/\s+/g, "");
29
+ if (!s)
30
+ return null;
31
+ const pm = /p\.?m?\.?$/.test(s), am = /a\.?m?\.?$/.test(s);
32
+ s = s.replace(/[ap]\.?m?\.?$/, "");
33
+ const m = /^(\d{1,2})(?:[:.h]?(\d{2}))?$/.exec(s);
34
+ if (!m)
35
+ return null;
36
+ let hh = +m[1];
37
+ const mm = m[2] ? +m[2] : 0;
38
+ if (pm && hh < 12)
39
+ hh += 12;
40
+ if (am && hh === 12)
41
+ hh = 0;
42
+ if (hh > 23 || mm > 59)
43
+ return null;
44
+ return pad2(hh) + ":" + pad2(mm);
45
+ }
46
+ export function formatTime(value, locale) {
47
+ if (!value)
48
+ return "";
49
+ const [h, m] = value.split(":");
50
+ return dateFormat(resolveLocale(locale), { hour: "numeric", minute: "2-digit" }).format(new Date(2000, 0, 1, +h, +m));
51
+ }
52
+ /* Typed dates: ISO, the locale's numeric order (10/11/2026, 11-10-2026), or month names (Oct 11 2026, 11 okt 2026). */
53
+ export function parseDateInput(text, locale) {
54
+ const s = String(text || "").trim();
55
+ if (!s)
56
+ return null;
57
+ if (/^\d{4}-\d{2}-\d{2}$/.test(s))
58
+ return parseISO(s) ? s : null;
59
+ const loc = resolveLocale(locale);
60
+ const order = dateFormat(loc, { year: "numeric", month: "2-digit", day: "2-digit" })
61
+ .formatToParts(new Date(2026, 10, 22))
62
+ .filter((p) => p.type === "day" || p.type === "month" || p.type === "year")
63
+ .map((p) => p.type);
64
+ const months = {};
65
+ for (const width of ["long", "short"]) {
66
+ const f = dateFormat(loc, { month: width });
67
+ const fe = dateFormat("en-US", { month: width });
68
+ for (let m = 0; m < 12; m++) {
69
+ months[f.format(new Date(2026, m, 1)).toLowerCase().replace(/\.$/, "")] = m + 1;
70
+ months[fe.format(new Date(2026, m, 1)).toLowerCase()] = m + 1;
71
+ }
72
+ }
73
+ const tokens = s.toLowerCase().replace(/,/g, " ").split(/[\s/.\-]+/).filter(Boolean);
74
+ let named = null;
75
+ const nums = [];
76
+ for (const t of tokens) {
77
+ if (/^\d+$/.test(t))
78
+ nums.push(+t);
79
+ else if (months[t.replace(/\.$/, "")])
80
+ named = months[t.replace(/\.$/, "")];
81
+ }
82
+ let y, mo, d;
83
+ if (named) {
84
+ mo = named;
85
+ if (nums.length < 1)
86
+ return null;
87
+ d = nums[0] > 31 ? nums[1] : nums[0];
88
+ y = nums[0] > 31 ? nums[0] : nums[1];
89
+ }
90
+ else {
91
+ if (nums.length !== 3)
92
+ return null;
93
+ const map = {};
94
+ order.forEach((k, i) => { map[k] = nums[i]; });
95
+ y = map.year;
96
+ mo = map.month;
97
+ d = map.day;
98
+ }
99
+ if (y == null)
100
+ y = new Date().getFullYear();
101
+ if (y < 100)
102
+ y += 2000;
103
+ const date = new Date(y, mo - 1, d);
104
+ if (date.getFullYear() !== y || date.getMonth() !== mo - 1 || date.getDate() !== d)
105
+ return null;
106
+ return toISO(date);
107
+ }
@@ -0,0 +1,15 @@
1
+ export type NumberOptions = Intl.NumberFormatOptions & {
2
+ locale?: string;
3
+ };
4
+ export type DateOptions = Intl.DateTimeFormatOptions & {
5
+ locale?: string;
6
+ style?: "short" | "medium" | "long" | "full";
7
+ };
8
+ /** Locales Vokality projects ship in. Papiamentu (pap-*) has no Intl data yet and formats as Dutch for the same region. */
9
+ export declare const LOCALES: readonly string[];
10
+ export declare function resolveLocale(locale?: string): string;
11
+ export declare function formatNumber(value: number, opts?: NumberOptions): string;
12
+ export declare function formatCurrency(amount: number, currency?: string, opts?: NumberOptions): string;
13
+ export declare function formatPercent(value: number, opts?: NumberOptions): string;
14
+ export declare function formatDate(value: string | Date, opts?: DateOptions): string;
15
+ export declare function formatBytes(n: number): string;
@@ -0,0 +1,50 @@
1
+ import { omit } from "./omit.js";
2
+ import { parseISO } from "./dates.js";
3
+ import { dateFormat, numberFormat } from "./intl.js";
4
+ /** Locales Vokality projects ship in. Papiamentu (pap-*) has no Intl data yet and formats as Dutch for the same region. */
5
+ export const LOCALES = ["en-US", "nl-CW", "nl-AW", "nl-SX", "nl-SR", "nl-NL"];
6
+ const CURRENCY_SYMBOL_FALLBACK = { XCG: "Cg.", ANG: "NAf.", AWG: "Afl.", SRD: "SRD" };
7
+ export function resolveLocale(locale) {
8
+ const loc = locale || "en-US";
9
+ try {
10
+ if (Intl.NumberFormat.supportedLocalesOf([loc]).length)
11
+ return loc;
12
+ }
13
+ catch { }
14
+ const m = /^pap-([A-Za-z]{2})$/i.exec(loc);
15
+ if (m)
16
+ return "nl-" + m[1].toUpperCase();
17
+ return "en-US";
18
+ }
19
+ export function formatNumber(value, opts = {}) {
20
+ return numberFormat(resolveLocale(opts.locale), omit(opts, ["locale"])).format(value);
21
+ }
22
+ export function formatCurrency(amount, currency, opts = {}) {
23
+ const cur = (currency || "USD").toUpperCase();
24
+ const base = { style: "currency", currency: cur };
25
+ // The Surinamese dollar's local symbol is "$", which reads as USD: always show the code.
26
+ if (cur === "SRD")
27
+ base.currencyDisplay = "code";
28
+ let out = numberFormat(resolveLocale(opts.locale), { ...base, ...omit(opts, ["locale"]) }).format(amount);
29
+ // Older browsers without CLDR 46 data print the bare ISO code for the Caribbean guilder.
30
+ if (CURRENCY_SYMBOL_FALLBACK[cur] && cur !== "SRD")
31
+ out = out.replace(new RegExp("\\b" + cur + "\\b\\s?"), CURRENCY_SYMBOL_FALLBACK[cur] + " ");
32
+ return out;
33
+ }
34
+ export function formatPercent(value, opts = {}) {
35
+ return numberFormat(resolveLocale(opts.locale), { style: "percent", maximumFractionDigits: 1, ...omit(opts, ["locale"]) }).format(value);
36
+ }
37
+ export function formatDate(value, opts = {}) {
38
+ const d = value instanceof Date ? value : /^\d{4}-\d{2}-\d{2}$/.test(String(value)) ? parseISO(value) : new Date(value);
39
+ const style = opts.style || "medium";
40
+ const rest = omit(opts, ["locale", "style"]);
41
+ const hasParts = Object.keys(rest).some((k) => ["weekday", "year", "month", "day", "hour", "minute"].includes(k));
42
+ return dateFormat(resolveLocale(opts.locale), hasParts ? rest : { dateStyle: style, ...rest }).format(d ?? undefined);
43
+ }
44
+ export function formatBytes(n) {
45
+ if (n < 1024)
46
+ return n + " B";
47
+ if (n < 1048576)
48
+ return (n / 1024).toFixed(n < 10240 ? 1 : 0) + " KB";
49
+ return (n / 1048576).toFixed(1) + " MB";
50
+ }
@@ -0,0 +1,220 @@
1
+ export interface IconCircle {
2
+ cx: number;
3
+ cy: number;
4
+ r: number;
5
+ }
6
+ export interface IconDef {
7
+ size: number;
8
+ stroke: number;
9
+ d: string[];
10
+ circle?: IconCircle | IconCircle[];
11
+ }
12
+ /** Lucide outlines in the Vokality icon set. */
13
+ export declare const ICONS: {
14
+ "arrow-up-right": {
15
+ size: number;
16
+ stroke: number;
17
+ d: string[];
18
+ };
19
+ quote: {
20
+ size: number;
21
+ stroke: number;
22
+ d: string[];
23
+ };
24
+ "chevron-left": {
25
+ size: number;
26
+ stroke: number;
27
+ d: string[];
28
+ };
29
+ "chevron-right": {
30
+ size: number;
31
+ stroke: number;
32
+ d: string[];
33
+ };
34
+ "chevron-down": {
35
+ size: number;
36
+ stroke: number;
37
+ d: string[];
38
+ };
39
+ check: {
40
+ size: number;
41
+ stroke: number;
42
+ d: string[];
43
+ };
44
+ search: {
45
+ size: number;
46
+ stroke: number;
47
+ d: string[];
48
+ circle: {
49
+ cx: number;
50
+ cy: number;
51
+ r: number;
52
+ };
53
+ };
54
+ calendar: {
55
+ size: number;
56
+ stroke: number;
57
+ d: string[];
58
+ };
59
+ info: {
60
+ size: number;
61
+ stroke: number;
62
+ d: string[];
63
+ circle: {
64
+ cx: number;
65
+ cy: number;
66
+ r: number;
67
+ };
68
+ };
69
+ "circle-check": {
70
+ size: number;
71
+ stroke: number;
72
+ d: string[];
73
+ circle: {
74
+ cx: number;
75
+ cy: number;
76
+ r: number;
77
+ };
78
+ };
79
+ "circle-alert": {
80
+ size: number;
81
+ stroke: number;
82
+ d: string[];
83
+ circle: {
84
+ cx: number;
85
+ cy: number;
86
+ r: number;
87
+ };
88
+ };
89
+ "triangle-alert": {
90
+ size: number;
91
+ stroke: number;
92
+ d: string[];
93
+ };
94
+ ellipsis: {
95
+ size: number;
96
+ stroke: number;
97
+ d: never[];
98
+ circle: {
99
+ cx: number;
100
+ cy: number;
101
+ r: number;
102
+ }[];
103
+ };
104
+ "arrow-up": {
105
+ size: number;
106
+ stroke: number;
107
+ d: string[];
108
+ };
109
+ "arrow-down": {
110
+ size: number;
111
+ stroke: number;
112
+ d: string[];
113
+ };
114
+ "chevrons-up-down": {
115
+ size: number;
116
+ stroke: number;
117
+ d: string[];
118
+ };
119
+ minus: {
120
+ size: number;
121
+ stroke: number;
122
+ d: string[];
123
+ };
124
+ plus: {
125
+ size: number;
126
+ stroke: number;
127
+ d: string[];
128
+ };
129
+ upload: {
130
+ size: number;
131
+ stroke: number;
132
+ d: string[];
133
+ };
134
+ file: {
135
+ size: number;
136
+ stroke: number;
137
+ d: string[];
138
+ };
139
+ pencil: {
140
+ size: number;
141
+ stroke: number;
142
+ d: string[];
143
+ };
144
+ copy: {
145
+ size: number;
146
+ stroke: number;
147
+ d: string[];
148
+ };
149
+ trash: {
150
+ size: number;
151
+ stroke: number;
152
+ d: string[];
153
+ };
154
+ home: {
155
+ size: number;
156
+ stroke: number;
157
+ d: string[];
158
+ };
159
+ folder: {
160
+ size: number;
161
+ stroke: number;
162
+ d: string[];
163
+ };
164
+ users: {
165
+ size: number;
166
+ stroke: number;
167
+ d: string[];
168
+ circle: {
169
+ cx: number;
170
+ cy: number;
171
+ r: number;
172
+ };
173
+ };
174
+ chart: {
175
+ size: number;
176
+ stroke: number;
177
+ d: string[];
178
+ };
179
+ clock: {
180
+ size: number;
181
+ stroke: number;
182
+ d: string[];
183
+ circle: {
184
+ cx: number;
185
+ cy: number;
186
+ r: number;
187
+ };
188
+ };
189
+ sidebar: {
190
+ size: number;
191
+ stroke: number;
192
+ d: string[];
193
+ };
194
+ menu: {
195
+ size: number;
196
+ stroke: number;
197
+ d: string[];
198
+ };
199
+ x: {
200
+ size: number;
201
+ stroke: number;
202
+ d: string[];
203
+ };
204
+ phone: {
205
+ size: number;
206
+ stroke: number;
207
+ d: string[];
208
+ };
209
+ "map-pin": {
210
+ size: number;
211
+ stroke: number;
212
+ d: string[];
213
+ circle: {
214
+ cx: number;
215
+ cy: number;
216
+ r: number;
217
+ };
218
+ };
219
+ };
220
+ export type IconName = keyof typeof ICONS;
@@ -0,0 +1,54 @@
1
+ /** Lucide outlines in the Vokality icon set. */
2
+ export const ICONS = {
3
+ "arrow-up-right": { size: 17, stroke: 1.5, d: ["M7 7h10v10M7 17 17 7"] },
4
+ quote: {
5
+ size: 18,
6
+ stroke: 1.75,
7
+ d: [
8
+ "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
9
+ "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"
10
+ ]
11
+ },
12
+ "chevron-left": { size: 16, stroke: 1.75, d: ["m15 18-6-6 6-6"] },
13
+ "chevron-right": { size: 16, stroke: 1.75, d: ["m9 18 6-6-6-6"] },
14
+ "chevron-down": { size: 16, stroke: 1.75, d: ["m6 9 6 6 6-6"] },
15
+ check: { size: 16, stroke: 1.75, d: ["M20 6 9 17l-5-5"] },
16
+ search: { size: 16, stroke: 1.75, d: ["m21 21-4.3-4.3"], circle: { cx: 11, cy: 11, r: 8 } },
17
+ calendar: { size: 16, stroke: 1.75, d: ["M8 2v4", "M16 2v4", "M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z", "M3 10h18"] },
18
+ info: { size: 18, stroke: 1.75, d: ["M12 16v-4", "M12 8h.01"], circle: { cx: 12, cy: 12, r: 10 } },
19
+ "circle-check": { size: 18, stroke: 1.75, d: ["m9 12 2 2 4-4"], circle: { cx: 12, cy: 12, r: 10 } },
20
+ "circle-alert": { size: 18, stroke: 1.75, d: ["M12 8v4", "M12 16h.01"], circle: { cx: 12, cy: 12, r: 10 } },
21
+ "triangle-alert": { size: 18, stroke: 1.75, d: ["m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3", "M12 9v4", "M12 17h.01"] },
22
+ ellipsis: { size: 18, stroke: 1.75, d: [], circle: [{ cx: 5, cy: 12, r: 1 }, { cx: 12, cy: 12, r: 1 }, { cx: 19, cy: 12, r: 1 }] },
23
+ "arrow-up": { size: 14, stroke: 1.75, d: ["m5 12 7-7 7 7", "M12 19V5"] },
24
+ "arrow-down": { size: 14, stroke: 1.75, d: ["M12 5v14", "m19 12-7 7-7-7"] },
25
+ "chevrons-up-down": { size: 14, stroke: 1.75, d: ["m7 15 5 5 5-5", "m7 9 5-5 5 5"] },
26
+ minus: { size: 16, stroke: 1.75, d: ["M5 12h14"] },
27
+ plus: { size: 16, stroke: 1.75, d: ["M5 12h14", "M12 5v14"] },
28
+ upload: { size: 20, stroke: 1.5, d: ["M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", "M17 8l-5-5-5 5", "M12 3v12"] },
29
+ file: { size: 16, stroke: 1.5, d: ["M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", "M14 2v4a2 2 0 0 0 2 2h4"] },
30
+ pencil: { size: 16, stroke: 1.5, d: ["M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z", "m15 5 4 4"] },
31
+ copy: { size: 16, stroke: 1.5, d: ["M10 8h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z", "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"] },
32
+ trash: { size: 16, stroke: 1.5, d: ["M3 6h18", "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"] },
33
+ home: { size: 16, stroke: 1.5, d: ["M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8", "M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"] },
34
+ folder: { size: 16, stroke: 1.5, d: ["M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"] },
35
+ users: { size: 16, stroke: 1.5, d: ["M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", "M22 21v-2a4 4 0 0 0-3-3.87", "M16 3.13a4 4 0 0 1 0 7.75"], circle: { cx: 9, cy: 7, r: 4 } },
36
+ chart: { size: 16, stroke: 1.5, d: ["M3 3v16a2 2 0 0 0 2 2h16", "M18 17V9", "M13 17V5", "M8 17v-3"] },
37
+ clock: { size: 16, stroke: 1.75, d: ["M12 6v6l4 2"], circle: { cx: 12, cy: 12, r: 10 } },
38
+ sidebar: { size: 18, stroke: 1.75, d: ["M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z", "M9 3v18"] },
39
+ menu: { size: 22, stroke: 1.75, d: ["M4 6h16M4 12h16M4 18h16"] },
40
+ x: { size: 22, stroke: 1.75, d: ["M18 6 6 18M6 6l12 12"] },
41
+ phone: {
42
+ size: 14,
43
+ stroke: 1.5,
44
+ d: [
45
+ "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"
46
+ ]
47
+ },
48
+ "map-pin": {
49
+ size: 14,
50
+ stroke: 1.5,
51
+ d: ["M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"],
52
+ circle: { cx: 12, cy: 10, r: 3 }
53
+ }
54
+ };
@@ -0,0 +1,4 @@
1
+ /** A cached Intl.DateTimeFormat for this locale and options. */
2
+ export declare function dateFormat(locale: string | undefined, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
3
+ /** A cached Intl.NumberFormat for this locale and options. */
4
+ export declare function numberFormat(locale: string | undefined, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
@@ -0,0 +1,19 @@
1
+ /* Intl formatters are costly to build; these return a cached one per locale and options. */
2
+ const dateFormats = new Map();
3
+ const numberFormats = new Map();
4
+ /** A cached Intl.DateTimeFormat for this locale and options. */
5
+ export function dateFormat(locale, options = {}) {
6
+ const key = (locale ?? "") + "|" + JSON.stringify(options);
7
+ let f = dateFormats.get(key);
8
+ if (!f)
9
+ dateFormats.set(key, (f = new Intl.DateTimeFormat(locale, options)));
10
+ return f;
11
+ }
12
+ /** A cached Intl.NumberFormat for this locale and options. */
13
+ export function numberFormat(locale, options = {}) {
14
+ const key = (locale ?? "") + "|" + JSON.stringify(options);
15
+ let f = numberFormats.get(key);
16
+ if (!f)
17
+ numberFormats.set(key, (f = new Intl.NumberFormat(locale, options)));
18
+ return f;
19
+ }
@@ -0,0 +1,5 @@
1
+ export type PageItem = number | "gap-l" | "gap-r";
2
+ /** Page numbers to show around `page`, with gaps: [1, "gap-l", 4, 5, 6, "gap-r", 10]. */
3
+ export declare function pageList(page: number, count: number, siblings: number): PageItem[];
4
+ /** Round axis ticks from 0 to at least `max`, about `count` steps of 1, 2, 2.5 or 5 × 10ⁿ. */
5
+ export declare function niceTicks(max: number, count?: number): number[];
@@ -0,0 +1,36 @@
1
+ /** Page numbers to show around `page`, with gaps: [1, "gap-l", 4, 5, 6, "gap-r", 10]. */
2
+ export function pageList(page, count, siblings) {
3
+ const out = [];
4
+ let lo = Math.max(2, page - siblings), hi = Math.min(count - 1, page + siblings);
5
+ if (page - siblings <= 3) {
6
+ lo = 2;
7
+ hi = Math.min(count - 1, Math.max(hi, 3 + siblings * 2));
8
+ }
9
+ if (page + siblings >= count - 2) {
10
+ hi = count - 1;
11
+ lo = Math.max(2, Math.min(lo, count - 2 - siblings * 2));
12
+ }
13
+ out.push(1);
14
+ if (lo > 2)
15
+ out.push("gap-l");
16
+ for (let i = lo; i <= hi; i++)
17
+ out.push(i);
18
+ if (hi < count - 1)
19
+ out.push("gap-r");
20
+ if (count > 1)
21
+ out.push(count);
22
+ return out;
23
+ }
24
+ /** Round axis ticks from 0 to at least `max`, about `count` steps of 1, 2, 2.5 or 5 × 10ⁿ. */
25
+ export function niceTicks(max, count) {
26
+ if (!(max > 0))
27
+ return [0, 1];
28
+ const raw = max / (count || 4), mag = Math.pow(10, Math.floor(Math.log10(raw))), f = raw / mag;
29
+ const step = (f <= 1 ? 1 : f <= 2 ? 2 : f <= 2.5 ? 2.5 : f <= 5 ? 5 : 10) * mag;
30
+ const ticks = [];
31
+ for (let v = 0; v <= max + step * 0.0001; v += step)
32
+ ticks.push(+v.toFixed(10));
33
+ if (ticks[ticks.length - 1] < max)
34
+ ticks.push(+(ticks[ticks.length - 1] + step).toFixed(10));
35
+ return ticks;
36
+ }
@@ -0,0 +1,2 @@
1
+ /** A copy of `props` without `keys`: for passing the rest of a component's props to its element. */
2
+ export declare function omit<T extends object, K extends string>(props: T, keys: readonly K[]): Omit<T, K>;
@@ -0,0 +1,10 @@
1
+ /** A copy of `props` without `keys`: for passing the rest of a component's props to its element. */
2
+ export function omit(props, keys) {
3
+ const drop = new Set(keys);
4
+ const out = {};
5
+ for (const k in props) {
6
+ if (Object.prototype.hasOwnProperty.call(props, k) && !drop.has(k))
7
+ out[k] = props[k];
8
+ }
9
+ return out;
10
+ }
@@ -0,0 +1,4 @@
1
+ import type { SpaceStep } from "../types.js";
2
+ export declare const SPACE: Record<SpaceStep, string>;
3
+ /** A spacing step ("md") as its token, or any other CSS length as given; `fallback` when unset. */
4
+ export declare function space(value: SpaceStep | string | undefined, fallback: SpaceStep): string;
@@ -0,0 +1,9 @@
1
+ export const SPACE = {
2
+ none: "0", xs: "var(--space-xs)", sm: "var(--space-sm)", md: "var(--space-md)", lg: "var(--space-lg)",
3
+ xl: "var(--space-xl)", "2xl": "var(--space-2xl)", "3xl": "var(--space-3xl)",
4
+ };
5
+ /** A spacing step ("md") as its token, or any other CSS length as given; `fallback` when unset. */
6
+ export function space(value, fallback) {
7
+ const v = value == null ? fallback : value;
8
+ return SPACE[v] || v;
9
+ }
@@ -0,0 +1,8 @@
1
+ import type * as React from "react";
2
+ /**
3
+ * Text props are often plain strings but may be any node: a <p> around a
4
+ * <div> or <form> is invalid HTML and breaks hydration, so use a <div> then.
5
+ */
6
+ export declare function para(content: React.ReactNode): "p" | "div";
7
+ /** Two-digit step numbers: 1 → "01". */
8
+ export declare function pad(n: number | string): string;
@@ -0,0 +1,12 @@
1
+ const isInline = (c) => c == null || typeof c === "string" || typeof c === "number" || typeof c === "boolean";
2
+ /**
3
+ * Text props are often plain strings but may be any node: a <p> around a
4
+ * <div> or <form> is invalid HTML and breaks hydration, so use a <div> then.
5
+ */
6
+ export function para(content) {
7
+ return isInline(content) || (Array.isArray(content) && content.every(isInline)) ? "p" : "div";
8
+ }
9
+ /** Two-digit step numbers: 1 → "01". */
10
+ export function pad(n) {
11
+ return String(n).length < 2 ? "0" + n : String(n);
12
+ }
@@ -0,0 +1,16 @@
1
+ export type Theme = "dark" | "light" | "contrast";
2
+ export interface ThemeOptions {
3
+ /** Theme when nothing is saved and the system has no preference (or followSystem is false). Default "dark". */
4
+ defaultTheme?: Theme;
5
+ /** localStorage key for the saved choice. Default "vk-theme". */
6
+ storageKey?: string;
7
+ /** Use prefers-contrast and prefers-color-scheme when nothing is saved. Default true. */
8
+ followSystem?: boolean;
9
+ }
10
+ export declare const THEMES: Theme[];
11
+ /**
12
+ * Source of a tiny blocking script that sets data-theme on <html> before the
13
+ * page paints: the saved choice, else the system's contrast and color-scheme
14
+ * preference, else defaultTheme. Inline it in <head> (ThemeScript does).
15
+ */
16
+ export declare function themeScript(options?: ThemeOptions): string;
@@ -0,0 +1,14 @@
1
+ export const THEMES = ["dark", "light", "contrast"];
2
+ /**
3
+ * Source of a tiny blocking script that sets data-theme on <html> before the
4
+ * page paints: the saved choice, else the system's contrast and color-scheme
5
+ * preference, else defaultTheme. Inline it in <head> (ThemeScript does).
6
+ */
7
+ export function themeScript(options = {}) {
8
+ // JSON-quoted, with "<" escaped so the value can never close the inline <script>.
9
+ const key = JSON.stringify(String(options.storageKey || "vk-theme")).replace(/</g, "\\u003c");
10
+ const fallback = JSON.stringify(options.defaultTheme && THEMES.includes(options.defaultTheme) ? options.defaultTheme : "dark");
11
+ const system = options.followSystem === false ? "" :
12
+ 'if(matchMedia("(prefers-contrast: more)").matches)t="contrast";else if(matchMedia("(prefers-color-scheme: light)").matches)t="light";else if(matchMedia("(prefers-color-scheme: dark)").matches)t="dark";';
13
+ return "(function(){var t=" + fallback + ";try{var s=localStorage.getItem(" + key + ');if(s==="dark"||s==="light"||s==="contrast")t=s;else{' + system + '}}catch(e){}document.documentElement.setAttribute("data-theme",t)})();';
14
+ }
@@ -0,0 +1,17 @@
1
+ import { addDays, addMonths, formatTime, parseDateInput, parseISO, parseTime, toISO } from "./dates.js";
2
+ import { formatBytes, resolveLocale } from "./format.js";
3
+ import { niceTicks, pageList } from "./math.js";
4
+ /** Lower-level helpers the components use, for apps that need the same behaviour. */
5
+ export declare const utils: {
6
+ parseDateInput: typeof parseDateInput;
7
+ parseTime: typeof parseTime;
8
+ formatTime: typeof formatTime;
9
+ pageList: typeof pageList;
10
+ toISO: typeof toISO;
11
+ parseISO: typeof parseISO;
12
+ addDays: typeof addDays;
13
+ addMonths: typeof addMonths;
14
+ formatBytes: typeof formatBytes;
15
+ niceTicks: typeof niceTicks;
16
+ resolveLocale: typeof resolveLocale;
17
+ };
@@ -0,0 +1,5 @@
1
+ import { addDays, addMonths, formatTime, parseDateInput, parseISO, parseTime, toISO } from "./dates.js";
2
+ import { formatBytes, resolveLocale } from "./format.js";
3
+ import { niceTicks, pageList } from "./math.js";
4
+ /** Lower-level helpers the components use, for apps that need the same behaviour. */
5
+ export const utils = { parseDateInput, parseTime, formatTime, pageList, toISO, parseISO, addDays, addMonths, formatBytes, niceTicks, resolveLocale };