@getcortexlabs/mavis-core 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (482) hide show
  1. package/README.md +2 -2
  2. package/dist/accordion.d.ts +17 -0
  3. package/dist/accordion.d.ts.map +1 -0
  4. package/dist/accordion.js +42 -0
  5. package/dist/accordion.js.map +1 -0
  6. package/dist/alert.d.ts +21 -0
  7. package/dist/alert.d.ts.map +1 -0
  8. package/dist/alert.js +13 -0
  9. package/dist/alert.js.map +1 -0
  10. package/dist/app-icons.d.ts +27 -0
  11. package/dist/app-icons.d.ts.map +1 -0
  12. package/dist/app-icons.js +42 -0
  13. package/dist/app-icons.js.map +1 -0
  14. package/dist/avatar.d.ts +10 -0
  15. package/dist/avatar.d.ts.map +1 -0
  16. package/dist/avatar.js +11 -0
  17. package/dist/avatar.js.map +1 -0
  18. package/dist/badge.d.ts +7 -0
  19. package/dist/badge.d.ts.map +1 -0
  20. package/dist/badge.js +11 -0
  21. package/dist/badge.js.map +1 -0
  22. package/dist/capabilities.d.ts +132 -0
  23. package/dist/capabilities.d.ts.map +1 -0
  24. package/dist/capabilities.js +180 -0
  25. package/dist/capabilities.js.map +1 -0
  26. package/dist/chart.d.ts +40 -0
  27. package/dist/chart.d.ts.map +1 -0
  28. package/dist/chart.js +73 -0
  29. package/dist/chart.js.map +1 -0
  30. package/dist/chip.d.ts +9 -0
  31. package/dist/chip.d.ts.map +1 -0
  32. package/dist/chip.js +16 -0
  33. package/dist/chip.js.map +1 -0
  34. package/dist/choice-motion.d.ts +14 -0
  35. package/dist/choice-motion.d.ts.map +1 -0
  36. package/dist/choice-motion.js +5 -0
  37. package/dist/choice-motion.js.map +1 -0
  38. package/dist/choice.d.ts +15 -0
  39. package/dist/choice.d.ts.map +1 -0
  40. package/dist/choice.js +27 -0
  41. package/dist/choice.js.map +1 -0
  42. package/dist/collections.d.ts +46 -0
  43. package/dist/collections.d.ts.map +1 -0
  44. package/dist/collections.js +48 -0
  45. package/dist/collections.js.map +1 -0
  46. package/dist/combobox.d.ts +42 -0
  47. package/dist/combobox.d.ts.map +1 -0
  48. package/dist/combobox.js +159 -0
  49. package/dist/combobox.js.map +1 -0
  50. package/dist/contracts.d.ts +1321 -0
  51. package/dist/contracts.d.ts.map +1 -0
  52. package/dist/contracts.js +268 -0
  53. package/dist/contracts.js.map +1 -0
  54. package/dist/date-input.d.ts +10 -0
  55. package/dist/date-input.d.ts.map +1 -0
  56. package/dist/date-input.js +58 -0
  57. package/dist/date-input.js.map +1 -0
  58. package/dist/date-time.d.ts +19 -0
  59. package/dist/date-time.d.ts.map +1 -0
  60. package/dist/date-time.js +27 -0
  61. package/dist/date-time.js.map +1 -0
  62. package/dist/date.d.ts +96 -0
  63. package/dist/date.d.ts.map +1 -0
  64. package/dist/date.js +235 -0
  65. package/dist/date.js.map +1 -0
  66. package/dist/dialog.d.ts +4 -0
  67. package/dist/dialog.d.ts.map +1 -0
  68. package/dist/dialog.js +21 -0
  69. package/dist/dialog.js.map +1 -0
  70. package/dist/discovery.d.ts +49 -0
  71. package/dist/discovery.d.ts.map +1 -0
  72. package/dist/discovery.js +80 -0
  73. package/dist/discovery.js.map +1 -0
  74. package/dist/empty-state.d.ts +2 -0
  75. package/dist/empty-state.d.ts.map +1 -0
  76. package/dist/empty-state.js +5 -0
  77. package/dist/empty-state.js.map +1 -0
  78. package/dist/experimental-collections.d.ts +82 -0
  79. package/dist/experimental-collections.d.ts.map +1 -0
  80. package/dist/experimental-collections.js +8 -0
  81. package/dist/experimental-collections.js.map +1 -0
  82. package/dist/experimental-effects.d.ts +107 -0
  83. package/dist/experimental-effects.d.ts.map +1 -0
  84. package/dist/experimental-effects.js +24 -0
  85. package/dist/experimental-effects.js.map +1 -0
  86. package/dist/experimental-platforms.d.ts +94 -0
  87. package/dist/experimental-platforms.d.ts.map +1 -0
  88. package/dist/experimental-platforms.js +2 -0
  89. package/dist/experimental-platforms.js.map +1 -0
  90. package/dist/experimental-playback.d.ts +63 -0
  91. package/dist/experimental-playback.d.ts.map +1 -0
  92. package/dist/experimental-playback.js +46 -0
  93. package/dist/experimental-playback.js.map +1 -0
  94. package/dist/experimental-regions.d.ts +179 -0
  95. package/dist/experimental-regions.d.ts.map +1 -0
  96. package/dist/experimental-regions.js +554 -0
  97. package/dist/experimental-regions.js.map +1 -0
  98. package/dist/experimental-sensors.d.ts +42 -0
  99. package/dist/experimental-sensors.d.ts.map +1 -0
  100. package/dist/experimental-sensors.js +2 -0
  101. package/dist/experimental-sensors.js.map +1 -0
  102. package/dist/experimental-surfaces.d.ts +127 -0
  103. package/dist/experimental-surfaces.d.ts.map +1 -0
  104. package/dist/experimental-surfaces.js +2 -0
  105. package/dist/experimental-surfaces.js.map +1 -0
  106. package/dist/experimental.d.ts +197 -0
  107. package/dist/experimental.d.ts.map +1 -0
  108. package/dist/experimental.js +855 -0
  109. package/dist/experimental.js.map +1 -0
  110. package/dist/files.d.ts +87 -0
  111. package/dist/files.d.ts.map +1 -0
  112. package/dist/files.js +328 -0
  113. package/dist/files.js.map +1 -0
  114. package/dist/form.d.ts +39 -0
  115. package/dist/form.d.ts.map +1 -0
  116. package/dist/form.js +170 -0
  117. package/dist/form.js.map +1 -0
  118. package/dist/grid.d.ts +3 -0
  119. package/dist/grid.d.ts.map +1 -0
  120. package/dist/grid.js +16 -0
  121. package/dist/grid.js.map +1 -0
  122. package/dist/icon.d.ts +15 -0
  123. package/dist/icon.d.ts.map +1 -0
  124. package/dist/icon.js +28 -0
  125. package/dist/icon.js.map +1 -0
  126. package/dist/icons.d.ts +2002 -0
  127. package/dist/icons.d.ts.map +1 -0
  128. package/dist/icons.js +2003 -0
  129. package/dist/icons.js.map +1 -0
  130. package/dist/index.d.ts +59 -3
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +42 -1
  133. package/dist/index.js.map +1 -1
  134. package/dist/input.d.ts +14 -0
  135. package/dist/input.d.ts.map +1 -1
  136. package/dist/input.js +12 -0
  137. package/dist/input.js.map +1 -1
  138. package/dist/link.d.ts +36 -0
  139. package/dist/link.d.ts.map +1 -0
  140. package/dist/link.js +60 -0
  141. package/dist/link.js.map +1 -0
  142. package/dist/list-item.d.ts +3 -0
  143. package/dist/list-item.d.ts.map +1 -0
  144. package/dist/list-item.js +7 -0
  145. package/dist/list-item.js.map +1 -0
  146. package/dist/motion.d.ts +58 -0
  147. package/dist/motion.d.ts.map +1 -0
  148. package/dist/motion.js +73 -0
  149. package/dist/motion.js.map +1 -0
  150. package/dist/multi-select.d.ts +4 -0
  151. package/dist/multi-select.d.ts.map +1 -0
  152. package/dist/multi-select.js +23 -0
  153. package/dist/multi-select.js.map +1 -0
  154. package/dist/navigation-transition.d.ts +10 -0
  155. package/dist/navigation-transition.d.ts.map +1 -0
  156. package/dist/navigation-transition.js +10 -0
  157. package/dist/navigation-transition.js.map +1 -0
  158. package/dist/navigation.d.ts +22 -0
  159. package/dist/navigation.d.ts.map +1 -0
  160. package/dist/navigation.js +54 -0
  161. package/dist/navigation.js.map +1 -0
  162. package/dist/number-input.d.ts +21 -0
  163. package/dist/number-input.d.ts.map +1 -0
  164. package/dist/number-input.js +63 -0
  165. package/dist/number-input.js.map +1 -0
  166. package/dist/popover.d.ts +17 -0
  167. package/dist/popover.d.ts.map +1 -0
  168. package/dist/popover.js +19 -0
  169. package/dist/popover.js.map +1 -0
  170. package/dist/progress.d.ts +19 -0
  171. package/dist/progress.d.ts.map +1 -0
  172. package/dist/progress.js +19 -0
  173. package/dist/progress.js.map +1 -0
  174. package/dist/responsive.d.ts +18 -0
  175. package/dist/responsive.d.ts.map +1 -0
  176. package/dist/responsive.js +35 -0
  177. package/dist/responsive.js.map +1 -0
  178. package/dist/section-scroll.d.ts +14 -0
  179. package/dist/section-scroll.d.ts.map +1 -0
  180. package/dist/section-scroll.js +28 -0
  181. package/dist/section-scroll.js.map +1 -0
  182. package/dist/segmented.d.ts +11 -0
  183. package/dist/segmented.d.ts.map +1 -0
  184. package/dist/segmented.js +30 -0
  185. package/dist/segmented.js.map +1 -0
  186. package/dist/sheet.d.ts +19 -0
  187. package/dist/sheet.d.ts.map +1 -0
  188. package/dist/sheet.js +15 -0
  189. package/dist/sheet.js.map +1 -0
  190. package/dist/tabs.d.ts +11 -0
  191. package/dist/tabs.d.ts.map +1 -0
  192. package/dist/tabs.js +28 -0
  193. package/dist/tabs.js.map +1 -0
  194. package/dist/theme/themes.d.ts.map +1 -1
  195. package/dist/theme/themes.js +85 -12
  196. package/dist/theme/themes.js.map +1 -1
  197. package/dist/theme/types.d.ts +64 -4
  198. package/dist/theme/types.d.ts.map +1 -1
  199. package/dist/theme/typography.d.ts +10 -0
  200. package/dist/theme/typography.d.ts.map +1 -0
  201. package/dist/theme/typography.js +90 -0
  202. package/dist/theme/typography.js.map +1 -0
  203. package/dist/time.d.ts +34 -0
  204. package/dist/time.d.ts.map +1 -0
  205. package/dist/time.js +78 -0
  206. package/dist/time.js.map +1 -0
  207. package/dist/toast.d.ts +43 -0
  208. package/dist/toast.d.ts.map +1 -0
  209. package/dist/toast.js +228 -0
  210. package/dist/toast.js.map +1 -0
  211. package/dist/vue/button-content.d.ts +10 -0
  212. package/dist/vue/button-content.d.ts.map +1 -0
  213. package/dist/vue/button-content.js +54 -0
  214. package/dist/vue/button-content.js.map +1 -0
  215. package/dist/vue/cached-activity.d.ts +3 -0
  216. package/dist/vue/cached-activity.d.ts.map +1 -0
  217. package/dist/vue/cached-activity.js +13 -0
  218. package/dist/vue/cached-activity.js.map +1 -0
  219. package/dist/vue/carousel.d.ts +11 -0
  220. package/dist/vue/carousel.d.ts.map +1 -0
  221. package/dist/vue/carousel.js +115 -0
  222. package/dist/vue/carousel.js.map +1 -0
  223. package/dist/vue/chart.d.ts +194 -0
  224. package/dist/vue/chart.d.ts.map +1 -0
  225. package/dist/vue/chart.js +246 -0
  226. package/dist/vue/chart.js.map +1 -0
  227. package/dist/vue/combobox.d.ts +155 -0
  228. package/dist/vue/combobox.d.ts.map +1 -0
  229. package/dist/vue/combobox.js +195 -0
  230. package/dist/vue/combobox.js.map +1 -0
  231. package/dist/vue/command-palette.d.ts +129 -0
  232. package/dist/vue/command-palette.d.ts.map +1 -0
  233. package/dist/vue/command-palette.js +187 -0
  234. package/dist/vue/command-palette.js.map +1 -0
  235. package/dist/vue/component-props.d.ts +3310 -0
  236. package/dist/vue/component-props.d.ts.map +1 -0
  237. package/dist/vue/component-props.js +43 -0
  238. package/dist/vue/component-props.js.map +1 -0
  239. package/dist/vue/configurator-props.d.ts +277 -0
  240. package/dist/vue/configurator-props.d.ts.map +1 -0
  241. package/dist/vue/configurator-props.js +63 -0
  242. package/dist/vue/configurator-props.js.map +1 -0
  243. package/dist/vue/configurator.d.ts +403 -0
  244. package/dist/vue/configurator.d.ts.map +1 -0
  245. package/dist/vue/configurator.js +287 -0
  246. package/dist/vue/configurator.js.map +1 -0
  247. package/dist/vue/contracts.d.ts +18 -0
  248. package/dist/vue/contracts.d.ts.map +1 -0
  249. package/dist/vue/contracts.js +24 -0
  250. package/dist/vue/contracts.js.map +1 -0
  251. package/dist/vue/data-table.d.ts +17 -0
  252. package/dist/vue/data-table.d.ts.map +1 -0
  253. package/dist/vue/data-table.js +133 -0
  254. package/dist/vue/data-table.js.map +1 -0
  255. package/dist/vue/date-calendar.d.ts +64 -0
  256. package/dist/vue/date-calendar.d.ts.map +1 -0
  257. package/dist/vue/date-calendar.js +65 -0
  258. package/dist/vue/date-calendar.js.map +1 -0
  259. package/dist/vue/date-picker.d.ts +1000 -0
  260. package/dist/vue/date-picker.d.ts.map +1 -0
  261. package/dist/vue/date-picker.js +334 -0
  262. package/dist/vue/date-picker.js.map +1 -0
  263. package/dist/vue/date-props.d.ts +278 -0
  264. package/dist/vue/date-props.d.ts.map +1 -0
  265. package/dist/vue/date-props.js +81 -0
  266. package/dist/vue/date-props.js.map +1 -0
  267. package/dist/vue/dialog.d.ts +21 -0
  268. package/dist/vue/dialog.d.ts.map +1 -0
  269. package/dist/vue/dialog.js +58 -0
  270. package/dist/vue/dialog.js.map +1 -0
  271. package/dist/vue/discovery-components.d.ts +50 -0
  272. package/dist/vue/discovery-components.d.ts.map +1 -0
  273. package/dist/vue/discovery-components.js +2 -0
  274. package/dist/vue/discovery-components.js.map +1 -0
  275. package/dist/vue/discovery-controls.d.ts +197 -0
  276. package/dist/vue/discovery-controls.d.ts.map +1 -0
  277. package/dist/vue/discovery-controls.js +166 -0
  278. package/dist/vue/discovery-controls.js.map +1 -0
  279. package/dist/vue/discovery-props.d.ts +249 -0
  280. package/dist/vue/discovery-props.d.ts.map +1 -0
  281. package/dist/vue/discovery-props.js +87 -0
  282. package/dist/vue/discovery-props.js.map +1 -0
  283. package/dist/vue/files.d.ts +53 -0
  284. package/dist/vue/files.d.ts.map +1 -0
  285. package/dist/vue/files.js +40 -0
  286. package/dist/vue/files.js.map +1 -0
  287. package/dist/vue/forms.d.ts +4 -0
  288. package/dist/vue/forms.d.ts.map +1 -0
  289. package/dist/vue/forms.js +15 -0
  290. package/dist/vue/forms.js.map +1 -0
  291. package/dist/vue/global-components.d.ts +259 -3
  292. package/dist/vue/global-components.d.ts.map +1 -1
  293. package/dist/vue/index.d.ts +54 -4
  294. package/dist/vue/index.d.ts.map +1 -1
  295. package/dist/vue/index.js +45 -2
  296. package/dist/vue/index.js.map +1 -1
  297. package/dist/vue/inline-content.d.ts +54 -0
  298. package/dist/vue/inline-content.d.ts.map +1 -0
  299. package/dist/vue/inline-content.js +64 -0
  300. package/dist/vue/inline-content.js.map +1 -0
  301. package/dist/vue/layout-context.d.ts +4 -2
  302. package/dist/vue/layout-context.d.ts.map +1 -1
  303. package/dist/vue/layout-context.js +7 -2
  304. package/dist/vue/layout-context.js.map +1 -1
  305. package/dist/vue/list-motion.d.ts +7 -0
  306. package/dist/vue/list-motion.d.ts.map +1 -0
  307. package/dist/vue/list-motion.js +28 -0
  308. package/dist/vue/list-motion.js.map +1 -0
  309. package/dist/vue/loading-effect.d.ts +7 -0
  310. package/dist/vue/loading-effect.d.ts.map +1 -0
  311. package/dist/vue/loading-effect.js +32 -0
  312. package/dist/vue/loading-effect.js.map +1 -0
  313. package/dist/vue/menu.d.ts +122 -0
  314. package/dist/vue/menu.d.ts.map +1 -0
  315. package/dist/vue/menu.js +79 -0
  316. package/dist/vue/menu.js.map +1 -0
  317. package/dist/vue/navigation-controls.d.ts +124 -0
  318. package/dist/vue/navigation-controls.d.ts.map +1 -0
  319. package/dist/vue/navigation-controls.js +117 -0
  320. package/dist/vue/navigation-controls.js.map +1 -0
  321. package/dist/vue/navigation-props.d.ts +283 -0
  322. package/dist/vue/navigation-props.d.ts.map +1 -0
  323. package/dist/vue/navigation-props.js +82 -0
  324. package/dist/vue/navigation-props.js.map +1 -0
  325. package/dist/vue/navigation.d.ts +7 -0
  326. package/dist/vue/navigation.d.ts.map +1 -0
  327. package/dist/vue/navigation.js +15 -0
  328. package/dist/vue/navigation.js.map +1 -0
  329. package/dist/vue/platform.d.ts +37 -0
  330. package/dist/vue/platform.d.ts.map +1 -0
  331. package/dist/vue/platform.js +46 -0
  332. package/dist/vue/platform.js.map +1 -0
  333. package/dist/vue/props.d.ts +3326 -510
  334. package/dist/vue/props.d.ts.map +1 -1
  335. package/dist/vue/props.js +314 -83
  336. package/dist/vue/props.js.map +1 -1
  337. package/dist/vue/reveal-state.d.ts +18 -0
  338. package/dist/vue/reveal-state.d.ts.map +1 -0
  339. package/dist/vue/reveal-state.js +76 -0
  340. package/dist/vue/reveal-state.js.map +1 -0
  341. package/dist/vue/theme-provider.d.ts +58 -0
  342. package/dist/vue/theme-provider.d.ts.map +1 -0
  343. package/dist/vue/theme-provider.js +69 -0
  344. package/dist/vue/theme-provider.js.map +1 -0
  345. package/dist/vue/theme.d.ts +1029 -19
  346. package/dist/vue/theme.d.ts.map +1 -1
  347. package/dist/vue/theme.js +47 -2
  348. package/dist/vue/theme.js.map +1 -1
  349. package/dist/vue/time-picker.d.ts +488 -0
  350. package/dist/vue/time-picker.d.ts.map +1 -0
  351. package/dist/vue/time-picker.js +190 -0
  352. package/dist/vue/time-picker.js.map +1 -0
  353. package/dist/vue/toast.d.ts +29 -0
  354. package/dist/vue/toast.d.ts.map +1 -0
  355. package/dist/vue/toast.js +79 -0
  356. package/dist/vue/toast.js.map +1 -0
  357. package/dist/vue/tree-view.d.ts +111 -0
  358. package/dist/vue/tree-view.d.ts.map +1 -0
  359. package/dist/vue/tree-view.js +180 -0
  360. package/dist/vue/tree-view.js.map +1 -0
  361. package/dist/vue/virtual-list.d.ts +26 -0
  362. package/dist/vue/virtual-list.d.ts.map +1 -0
  363. package/dist/vue/virtual-list.js +2 -0
  364. package/dist/vue/virtual-list.js.map +1 -0
  365. package/dist/vue/wayfinding-controls.d.ts +198 -0
  366. package/dist/vue/wayfinding-controls.d.ts.map +1 -0
  367. package/dist/vue/wayfinding-controls.js +310 -0
  368. package/dist/vue/wayfinding-controls.js.map +1 -0
  369. package/dist/vue/wayfinding-props.d.ts +221 -0
  370. package/dist/vue/wayfinding-props.d.ts.map +1 -0
  371. package/dist/vue/wayfinding-props.js +86 -0
  372. package/dist/vue/wayfinding-props.js.map +1 -0
  373. package/dist/vue/workflow-props.d.ts +110 -0
  374. package/dist/vue/workflow-props.d.ts.map +1 -0
  375. package/dist/vue/workflow-props.js +37 -0
  376. package/dist/vue/workflow-props.js.map +1 -0
  377. package/dist/vue/workflows.d.ts +267 -0
  378. package/dist/vue/workflows.d.ts.map +1 -0
  379. package/dist/vue/workflows.js +200 -0
  380. package/dist/vue/workflows.js.map +1 -0
  381. package/dist/wayfinding.d.ts +50 -0
  382. package/dist/wayfinding.d.ts.map +1 -0
  383. package/dist/wayfinding.js +54 -0
  384. package/dist/wayfinding.js.map +1 -0
  385. package/package.json +5 -1
  386. package/src/accordion.ts +66 -0
  387. package/src/alert.ts +16 -0
  388. package/src/app-icons.ts +57 -0
  389. package/src/avatar.ts +11 -0
  390. package/src/badge.ts +11 -0
  391. package/src/capabilities.ts +183 -0
  392. package/src/chart.ts +112 -0
  393. package/src/chip.ts +20 -0
  394. package/src/choice-motion.ts +12 -0
  395. package/src/choice.ts +41 -0
  396. package/src/collections.ts +87 -0
  397. package/src/combobox.ts +198 -0
  398. package/src/contracts.ts +324 -0
  399. package/src/date-input.ts +87 -0
  400. package/src/date-time.ts +37 -0
  401. package/src/date.ts +280 -0
  402. package/src/dialog.ts +22 -0
  403. package/src/discovery.ts +139 -0
  404. package/src/empty-state.ts +4 -0
  405. package/src/experimental-collections.ts +87 -0
  406. package/src/experimental-effects.ts +146 -0
  407. package/src/experimental-platforms.ts +96 -0
  408. package/src/experimental-playback.ts +115 -0
  409. package/src/experimental-regions.ts +777 -0
  410. package/src/experimental-sensors.ts +50 -0
  411. package/src/experimental-surfaces.ts +124 -0
  412. package/src/experimental.ts +1102 -0
  413. package/src/files.ts +408 -0
  414. package/src/form.ts +190 -0
  415. package/src/grid.ts +19 -0
  416. package/src/icon.ts +30 -0
  417. package/src/icons.ts +2002 -0
  418. package/src/index.ts +93 -2
  419. package/src/input.ts +27 -0
  420. package/src/link.ts +91 -0
  421. package/src/list-item.ts +5 -0
  422. package/src/motion.ts +80 -0
  423. package/src/multi-select.ts +30 -0
  424. package/src/navigation-transition.ts +14 -0
  425. package/src/navigation.ts +61 -0
  426. package/src/number-input.ts +80 -0
  427. package/src/popover.ts +38 -0
  428. package/src/progress.ts +22 -0
  429. package/src/responsive.ts +61 -0
  430. package/src/section-scroll.ts +46 -0
  431. package/src/segmented.ts +39 -0
  432. package/src/sheet.ts +31 -0
  433. package/src/tabs.ts +35 -0
  434. package/src/theme/themes.ts +89 -12
  435. package/src/theme/types.ts +55 -2
  436. package/src/theme/typography.ts +84 -0
  437. package/src/time.ts +83 -0
  438. package/src/toast.ts +249 -0
  439. package/src/vue/button-content.ts +60 -0
  440. package/src/vue/cached-activity.ts +13 -0
  441. package/src/vue/carousel.ts +173 -0
  442. package/src/vue/chart.ts +338 -0
  443. package/src/vue/combobox.ts +238 -0
  444. package/src/vue/command-palette.ts +232 -0
  445. package/src/vue/component-props.ts +70 -0
  446. package/src/vue/configurator-props.ts +67 -0
  447. package/src/vue/configurator.ts +350 -0
  448. package/src/vue/contracts.ts +39 -0
  449. package/src/vue/data-table.ts +190 -0
  450. package/src/vue/date-calendar.ts +76 -0
  451. package/src/vue/date-picker.ts +410 -0
  452. package/src/vue/date-props.ts +89 -0
  453. package/src/vue/dialog.ts +63 -0
  454. package/src/vue/discovery-components.ts +60 -0
  455. package/src/vue/discovery-controls.ts +218 -0
  456. package/src/vue/discovery-props.ts +92 -0
  457. package/src/vue/files.ts +53 -0
  458. package/src/vue/forms.ts +20 -0
  459. package/src/vue/global-components.ts +248 -4
  460. package/src/vue/index.ts +97 -4
  461. package/src/vue/inline-content.ts +71 -0
  462. package/src/vue/layout-context.ts +10 -3
  463. package/src/vue/list-motion.ts +31 -0
  464. package/src/vue/loading-effect.ts +44 -0
  465. package/src/vue/menu.ts +100 -0
  466. package/src/vue/navigation-controls.ts +138 -0
  467. package/src/vue/navigation-props.ts +87 -0
  468. package/src/vue/navigation.ts +16 -0
  469. package/src/vue/platform.ts +73 -0
  470. package/src/vue/props.ts +348 -96
  471. package/src/vue/reveal-state.ts +83 -0
  472. package/src/vue/theme-provider.ts +74 -0
  473. package/src/vue/theme.ts +65 -3
  474. package/src/vue/time-picker.ts +227 -0
  475. package/src/vue/toast.ts +99 -0
  476. package/src/vue/tree-view.ts +220 -0
  477. package/src/vue/virtual-list.ts +28 -0
  478. package/src/vue/wayfinding-controls.ts +412 -0
  479. package/src/vue/wayfinding-props.ts +97 -0
  480. package/src/vue/workflow-props.ts +41 -0
  481. package/src/vue/workflows.ts +257 -0
  482. package/src/wayfinding.ts +85 -0
@@ -0,0 +1,198 @@
1
+ import { choiceKey, validateChoices, type ChoiceOption, type ChoiceValue } from './choice.js'
2
+
3
+ /** The application owns networking, authentication and cancellation primitives. */
4
+ export interface ComboboxSearchContext {
5
+ readonly requestId: number
6
+ readonly limit: number
7
+ /** Register fetch.abort(), a timer cleanup, or another host cancellation callback. */
8
+ onCancel(cleanup: () => void): void
9
+ }
10
+ export type ComboboxSearch = (
11
+ query: string,
12
+ context: ComboboxSearchContext,
13
+ ) => Promise<readonly ChoiceOption[]>
14
+ export interface ComboboxSnapshot {
15
+ query: string
16
+ options: readonly ChoiceOption[]
17
+ }
18
+ export type ComboboxSearchStatus = 'idle' | 'debouncing' | 'loading' | 'success' | 'empty' | 'error'
19
+ export interface ComboboxSearchState {
20
+ readonly query: string
21
+ readonly status: ComboboxSearchStatus
22
+ readonly options: readonly ChoiceOption[]
23
+ readonly limited: boolean
24
+ }
25
+ export interface ComboboxSearchOptions {
26
+ search: ComboboxSearch
27
+ debounce?: number
28
+ minQueryLength?: number
29
+ maxResults?: number
30
+ initialResults?: ComboboxSnapshot
31
+ onChange?: (state: ComboboxSearchState) => void
32
+ }
33
+
34
+ export function validateComboboxPolicy(
35
+ debounce: number,
36
+ minQueryLength: number,
37
+ maxResults: number,
38
+ ) {
39
+ if (!Number.isInteger(debounce) || debounce < 0 || debounce > 60000)
40
+ throw new RangeError('Combobox debounce must be an integer from 0 to 60000 milliseconds.')
41
+ if (!Number.isInteger(minQueryLength) || minQueryLength < 0 || minQueryLength > 1000)
42
+ throw new RangeError('Combobox minQueryLength must be an integer from 0 to 1000.')
43
+ if (!Number.isInteger(maxResults) || maxResults < 1 || maxResults > 100)
44
+ throw new RangeError('Combobox maxResults must be an integer from 1 to 100.')
45
+ }
46
+
47
+ /** A single bounded result page. No request starts at construction, including during SSR. */
48
+ export function createComboboxSearch(config: ComboboxSearchOptions) {
49
+ const debounce = config.debounce ?? 200
50
+ const minQueryLength = config.minQueryLength ?? 1
51
+ const maxResults = config.maxResults ?? 50
52
+ validateComboboxPolicy(debounce, minQueryLength, maxResults)
53
+ let generation = 0
54
+ let disposed = false
55
+ let timer: ReturnType<typeof setTimeout> | undefined
56
+ let cleanups: (() => void)[] = []
57
+ let cached: ComboboxSearchState | undefined
58
+ function result(query: string, options: readonly ChoiceOption[]): ComboboxSearchState {
59
+ if (!Array.isArray(options)) throw new TypeError('Combobox search must return an array.')
60
+ validateChoices(options, null)
61
+ return Object.freeze({
62
+ query,
63
+ status: options.length ? 'success' : 'empty',
64
+ options: Object.freeze(
65
+ options.slice(0, maxResults).map((option) => Object.freeze({ ...option })),
66
+ ),
67
+ limited: options.length > maxResults,
68
+ })
69
+ }
70
+ let state: ComboboxSearchState = Object.freeze({
71
+ query: '',
72
+ status: 'idle',
73
+ options: [],
74
+ limited: false,
75
+ })
76
+ if (config.initialResults)
77
+ state = cached = result(config.initialResults.query, config.initialResults.options)
78
+ function publish(next: ComboboxSearchState) {
79
+ state = Object.freeze(next)
80
+ config.onChange?.(state)
81
+ }
82
+ function invalidate() {
83
+ generation++
84
+ clearTimeout(timer)
85
+ timer = undefined
86
+ const previous = cleanups
87
+ cleanups = []
88
+ // One host cleanup cannot prevent the remaining requests/resources from being cancelled.
89
+ for (const cleanup of previous) {
90
+ try {
91
+ cleanup()
92
+ } catch {
93
+ /* Host cancellation failures never revive a request. */
94
+ }
95
+ }
96
+ }
97
+ function cancel() {
98
+ invalidate()
99
+ if (!disposed && (state.status === 'loading' || state.status === 'debouncing'))
100
+ publish({ query: state.query, status: 'idle', options: [], limited: false })
101
+ }
102
+ function request(query: string, force = false) {
103
+ if (disposed) return
104
+ invalidate()
105
+ if (!force && cached?.query === query) {
106
+ publish(cached)
107
+ return
108
+ }
109
+ if (query.trim().length < minQueryLength) {
110
+ publish({ query, status: 'idle', options: [], limited: false })
111
+ return
112
+ }
113
+ const identity = generation
114
+ publish({
115
+ query,
116
+ status: debounce && !force ? 'debouncing' : 'loading',
117
+ options: [],
118
+ limited: false,
119
+ })
120
+ const run = async () => {
121
+ timer = undefined
122
+ if (disposed || identity !== generation) return
123
+ publish({ query, status: 'loading', options: [], limited: false })
124
+ try {
125
+ const options = await config.search(query, {
126
+ requestId: identity,
127
+ limit: maxResults,
128
+ onCancel(cleanup) {
129
+ if (disposed || identity !== generation) cleanup()
130
+ else cleanups.push(cleanup)
131
+ },
132
+ })
133
+ if (disposed || identity !== generation) return
134
+ const next = result(query, options)
135
+ cleanups = []
136
+ cached = next
137
+ publish(next)
138
+ } catch {
139
+ if (disposed || identity !== generation) return
140
+ cleanups = []
141
+ publish({ query, status: 'error', options: [], limited: false })
142
+ }
143
+ }
144
+ if (debounce && !force) timer = setTimeout(() => void run(), debounce)
145
+ else void run()
146
+ }
147
+ return {
148
+ get state() {
149
+ return state
150
+ },
151
+ request,
152
+ retry: () => request(state.query, true),
153
+ cancel,
154
+ dispose() {
155
+ if (disposed) return
156
+ disposed = true
157
+ invalidate()
158
+ cached = undefined
159
+ },
160
+ }
161
+ }
162
+
163
+ /** Highlight identity survives a page replacement only while its enabled option remains. */
164
+ export function comboboxHighlight(
165
+ options: readonly ChoiceOption[],
166
+ previous?: string,
167
+ ): string | undefined {
168
+ return options.some((option) => !option.disabled && choiceKey(option.value) === previous)
169
+ ? previous
170
+ : undefined
171
+ }
172
+ export function comboboxMove(
173
+ options: readonly ChoiceOption[],
174
+ previous: string | undefined,
175
+ direction: 1 | -1,
176
+ ) {
177
+ const available = options.filter((option) => !option.disabled)
178
+ if (!available.length) return undefined
179
+ const index = available.findIndex((option) => choiceKey(option.value) === previous)
180
+ const next =
181
+ index < 0
182
+ ? direction === 1
183
+ ? 0
184
+ : available.length - 1
185
+ : Math.max(0, Math.min(available.length - 1, index + direction))
186
+ return choiceKey(available[next]!.value)
187
+ }
188
+ export function comboboxSelected(
189
+ value: ChoiceValue | null,
190
+ options: readonly ChoiceOption[],
191
+ retained?: ChoiceOption | null,
192
+ ): ChoiceOption | undefined {
193
+ if (value === null) return undefined
194
+ return (
195
+ options.find((option) => option.value === value) ??
196
+ (retained?.value === value ? retained : undefined)
197
+ )
198
+ }
@@ -0,0 +1,324 @@
1
+ import type { MotionSurface, MotionRegion } from './experimental.js'
2
+ import type { Dimension } from './layout.js'
3
+ import type { InputAction, InputHandle } from './input.js'
4
+ import type { IconName } from './icon.js'
5
+ import type { LinkNavigate, LinkTarget } from './link.js'
6
+ import type { FontWeight, Palette, Radius, Spacing } from './theme/types.js'
7
+
8
+ type PropertyKind = 'string' | 'number' | 'boolean' | 'object' | 'function'
9
+ declare const propertyValue: unique symbol
10
+
11
+ /** Plain metadata; the symbol carries a TypeScript type and is never emitted. */
12
+ export interface Property<T = unknown> {
13
+ readonly kind: PropertyKind | readonly PropertyKind[]
14
+ readonly default?: T
15
+ readonly required?: boolean
16
+ readonly values?: readonly T[]
17
+ readonly token?: 'space' | 'radius' | 'palette' | 'fontWeight' | 'icon'
18
+ readonly units?: 'layout' | 'dimension'
19
+ readonly runtimeOnly?: boolean
20
+ readonly [propertyValue]?: T
21
+ }
22
+
23
+ function property<T>() {
24
+ return <const D extends Property<T>>(definition: D) => definition as D & Property<T>
25
+ }
26
+
27
+ export type PropertyValue<P> = P extends Property<infer T> ? T : never
28
+ export type ContractProps<P extends Record<string, Property>> = {
29
+ [K in keyof P as P[K] extends { required: true } ? K : never]: PropertyValue<P[K]>
30
+ } & {
31
+ [K in keyof P as P[K] extends { required: true } ? never : K]?: PropertyValue<P[K]>
32
+ }
33
+
34
+ const text = property<string>()
35
+ const number = property<number>()
36
+ const boolean = property<boolean>()
37
+ const optionalText = text({ kind: 'string', default: undefined })
38
+ const flag = boolean({ kind: 'boolean', default: false })
39
+
40
+ export const spacingProperty = property<Spacing>()({
41
+ kind: ['string', 'number'],
42
+ default: undefined,
43
+ token: 'space',
44
+ units: 'layout',
45
+ })
46
+ export const radiusProperty = property<Radius | number>()({
47
+ kind: ['string', 'number'],
48
+ default: undefined,
49
+ token: 'radius',
50
+ units: 'layout',
51
+ })
52
+ export const dimensionProperty = property<Dimension>()({
53
+ kind: ['number', 'string'],
54
+ default: undefined,
55
+ units: 'dimension',
56
+ })
57
+ export const weightProperty = property<FontWeight>()({
58
+ kind: 'string',
59
+ default: undefined,
60
+ token: 'fontWeight',
61
+ })
62
+ const icon = property<IconName>()({ kind: 'string', default: undefined, token: 'icon' })
63
+
64
+ export const viewContract = {
65
+ id: optionalText,
66
+ accessibilityLabel: optionalText,
67
+ accessibilityHidden: boolean({ kind: 'boolean', default: undefined }),
68
+ }
69
+ export const flexContract = {
70
+ grow: number({ kind: 'number', default: 0 }),
71
+ shrink: number({ kind: 'number', default: undefined }),
72
+ }
73
+ export const boxContract = {
74
+ ...viewContract,
75
+ ...flexContract,
76
+ padding: spacingProperty,
77
+ paddingX: spacingProperty,
78
+ paddingY: spacingProperty,
79
+ radius: radiusProperty,
80
+ width: dimensionProperty,
81
+ height: dimensionProperty,
82
+ backgroundColor: text({ kind: 'string' }),
83
+ }
84
+ export const motionBoxContract = {
85
+ ...boxContract,
86
+ motionSurface: property<MotionSurface>()({
87
+ kind: 'object',
88
+ default: undefined,
89
+ runtimeOnly: true,
90
+ }),
91
+ motionRegion: property<MotionRegion>()({ kind: 'object', default: undefined, runtimeOnly: true }),
92
+ }
93
+ export type Align = 'start' | 'center' | 'end' | 'stretch'
94
+ export type Justify = 'start' | 'center' | 'end' | 'between' | 'around'
95
+ const layout = {
96
+ ...boxContract,
97
+ gap: spacingProperty,
98
+ justify: property<Justify>()({
99
+ kind: 'string',
100
+ values: ['start', 'center', 'end', 'between', 'around'],
101
+ default: 'start',
102
+ }),
103
+ wrap: flag,
104
+ }
105
+ export const rowContract = {
106
+ ...layout,
107
+ motionRegion: motionBoxContract.motionRegion,
108
+ align: property<Align>()({
109
+ kind: 'string',
110
+ values: ['start', 'center', 'end', 'stretch'],
111
+ default: 'center',
112
+ }),
113
+ }
114
+ export const columnContract = {
115
+ ...layout,
116
+ motionRegion: motionBoxContract.motionRegion,
117
+ align: property<Align>()({
118
+ kind: 'string',
119
+ values: ['start', 'center', 'end', 'stretch'],
120
+ default: 'stretch',
121
+ }),
122
+ }
123
+
124
+ export const navigationContract = {
125
+ href: optionalText,
126
+ target: property<LinkTarget>()({ kind: 'string', values: ['_self', '_blank'], default: '_self' }),
127
+ rel: optionalText,
128
+ navigate: property<LinkNavigate>()({ kind: 'function', default: undefined, runtimeOnly: true }),
129
+ }
130
+
131
+ export const buttonContract = {
132
+ ...navigationContract,
133
+ /** Experimental retained-reorder handle; native keyboard input belongs to Jolt. */
134
+ reorderHandle: flag,
135
+ motionSurface: property<MotionSurface>()({
136
+ kind: 'object',
137
+ default: undefined,
138
+ runtimeOnly: true,
139
+ }),
140
+ ...viewContract,
141
+ ...flexContract,
142
+ text: optionalText,
143
+ type: property<'button' | 'submit' | 'reset'>()({
144
+ kind: 'string',
145
+ values: ['button', 'submit', 'reset'],
146
+ default: 'button',
147
+ }),
148
+ name: optionalText,
149
+ value: optionalText,
150
+ form: optionalText,
151
+ variant: property<'primary' | 'secondary' | 'ghost'>()({
152
+ kind: 'string',
153
+ values: ['primary', 'secondary', 'ghost'],
154
+ default: 'primary',
155
+ }),
156
+ size: property<'sm' | 'md' | 'lg'>()({
157
+ kind: 'string',
158
+ values: ['sm', 'md', 'lg'],
159
+ default: 'md',
160
+ }),
161
+ disabled: flag,
162
+ loading: flag,
163
+ loadingIndicator: property<'none' | 'dots' | 'bars' | 'ring'>()({
164
+ kind: 'string',
165
+ values: ['none', 'dots', 'bars', 'ring'],
166
+ default: 'none',
167
+ }),
168
+ loadingText: text({ kind: 'string', default: 'Loading…' }),
169
+ icon,
170
+ trailingIcon: icon,
171
+ }
172
+
173
+ export const paletteTones: readonly (keyof Palette)[] = [
174
+ 'background',
175
+ 'surface',
176
+ 'elevated',
177
+ 'text',
178
+ 'muted',
179
+ 'primary',
180
+ 'onPrimary',
181
+ 'primarySoft',
182
+ 'accent',
183
+ 'onAccent',
184
+ 'accentSoft',
185
+ 'border',
186
+ 'warning',
187
+ 'success',
188
+ 'danger',
189
+ ]
190
+ export const textContract = {
191
+ motionSurface: property<MotionSurface>()({
192
+ kind: 'object',
193
+ default: undefined,
194
+ runtimeOnly: true,
195
+ }),
196
+ weight: weightProperty,
197
+ ...viewContract,
198
+ ...flexContract,
199
+ text: optionalText,
200
+ as: property<'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>()({
201
+ kind: 'string',
202
+ values: ['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
203
+ default: 'p',
204
+ }),
205
+ variant: property<'display' | 'title' | 'heading' | 'body' | 'caption' | 'overline'>()({
206
+ kind: 'string',
207
+ values: ['display', 'title', 'heading', 'body', 'caption', 'overline'],
208
+ default: 'body',
209
+ }),
210
+ tone: property<keyof Palette>()({
211
+ kind: 'string',
212
+ values: paletteTones,
213
+ default: 'text',
214
+ token: 'palette',
215
+ }),
216
+ align: property<'left' | 'center' | 'right'>()({
217
+ kind: 'string',
218
+ values: ['left', 'center', 'right'],
219
+ default: 'left',
220
+ }),
221
+ wrap: boolean({ kind: 'boolean', default: true }),
222
+ }
223
+ export const inputContract = {
224
+ id: viewContract.id,
225
+ accessibilityHidden: viewContract.accessibilityHidden,
226
+ ...flexContract,
227
+ width: dimensionProperty,
228
+ modelValue: text({ kind: 'string', default: '' }),
229
+ label: text({ kind: 'string', required: true }),
230
+ placeholder: text({ kind: 'string', default: '' }),
231
+ helperText: text({ kind: 'string', default: '' }),
232
+ error: text({ kind: 'string', default: '' }),
233
+ type: property<'text' | 'email' | 'password' | 'tel' | 'url' | 'search'>()({
234
+ kind: 'string',
235
+ values: ['text', 'email', 'password', 'tel', 'url', 'search'],
236
+ default: 'text',
237
+ }),
238
+ name: optionalText,
239
+ autocomplete: optionalText,
240
+ required: flag,
241
+ inputmode: property<
242
+ 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'
243
+ >()({ kind: 'string', default: undefined }),
244
+ form: optionalText,
245
+ disabled: flag,
246
+ readonly: flag,
247
+ multiline: flag,
248
+ rows: number({ kind: 'number', default: 3 }),
249
+ maxLength: number({ kind: 'number', default: undefined }),
250
+ autocapitalize: property<'none' | 'sentences' | 'words' | 'characters'>()({
251
+ kind: 'string',
252
+ values: ['none', 'sentences', 'words', 'characters'],
253
+ default: undefined,
254
+ }),
255
+ autocorrect: boolean({ kind: 'boolean', default: undefined }),
256
+ returnKey: property<'done' | 'next' | 'go' | 'search' | 'send'>()({
257
+ kind: 'string',
258
+ values: ['done', 'next', 'go', 'search', 'send'],
259
+ default: 'done',
260
+ }),
261
+ trailingAction: property<InputAction>()({ kind: 'object', default: undefined }),
262
+ icon,
263
+ trailingIcon: icon,
264
+ }
265
+
266
+ /** Value changes are requests to the owner, not mutations of parent state. */
267
+ export interface InputEvents {
268
+ valueChange(value: string): void
269
+ submit(value: string): void
270
+ focus(): void
271
+ blur(): void
272
+ action(): void
273
+ }
274
+ export interface ButtonEvents {
275
+ activate(): void
276
+ error(error: unknown): void
277
+ }
278
+ export type TextInputHandle = InputHandle
279
+
280
+ export const componentContracts = {
281
+ MBox: { version: 1, props: motionBoxContract, slots: ['default'], events: {} },
282
+ MRow: { version: 1, props: rowContract, slots: ['default'], events: {} },
283
+ MColumn: { version: 1, props: columnContract, slots: ['default'], events: {} },
284
+ MText: { version: 1, props: textContract, slots: ['text', 'spans'], events: {} },
285
+ MButton: {
286
+ version: 1,
287
+ props: buttonContract,
288
+ slots: ['text', 'leading-decoration', 'trailing-decoration'],
289
+ events: { activate: 'none', error: 'unknown' },
290
+ },
291
+ MInput: {
292
+ version: 1,
293
+ props: inputContract,
294
+ slots: [],
295
+ events: {
296
+ valueChange: 'string',
297
+ submit: 'string',
298
+ focus: 'none',
299
+ blur: 'none',
300
+ action: 'none',
301
+ },
302
+ binding: { prop: 'modelValue', event: 'valueChange', owner: 'parent' },
303
+ handles: ['focus', 'blur'],
304
+ },
305
+ } as const
306
+
307
+ /** JSON-compatible descriptions; unset defaults remain distinct from no default. */
308
+ export function describeContract(name: keyof typeof componentContracts) {
309
+ const contract = componentContracts[name]
310
+ return {
311
+ ...contract,
312
+ props: Object.fromEntries(
313
+ Object.entries(contract.props).map(([name, definition]) => [
314
+ name,
315
+ {
316
+ ...definition,
317
+ ...('default' in definition && definition.default === undefined
318
+ ? { default: { unset: true } }
319
+ : {}),
320
+ },
321
+ ]),
322
+ ),
323
+ }
324
+ }
@@ -0,0 +1,87 @@
1
+ import {
2
+ civilDate,
3
+ isCivilDate,
4
+ validateDateDraft,
5
+ validateDateConstraints,
6
+ validateDateRangeDraft,
7
+ type CivilDate,
8
+ type DateConstraints,
9
+ type DateLocale,
10
+ type DateRangeDraft,
11
+ type DateValidation,
12
+ } from './date.js'
13
+
14
+ /** Deliberately bounded numeric editing grammars; no locale guessing or timestamp conversion. */
15
+ export type DateInputFormat = 'iso' | 'locale' | 'yyyy-MM-dd' | 'dd/MM/yyyy' | 'MM/dd/yyyy'
16
+ export function resolveDateInputFormat(format: DateInputFormat, locale: DateLocale) {
17
+ if (format === 'iso' || format === 'yyyy-MM-dd') return 'yyyy-MM-dd'
18
+ if (format === 'locale') return locale === 'pt-BR' ? 'dd/MM/yyyy' : 'MM/dd/yyyy'
19
+ if (format === 'dd/MM/yyyy' || format === 'MM/dd/yyyy') return format
20
+ throw new RangeError(
21
+ 'Unsupported dateFormat. Use iso, locale, yyyy-MM-dd, dd/MM/yyyy or MM/dd/yyyy.',
22
+ )
23
+ }
24
+ export function dateInputPlaceholder(format: DateInputFormat, locale: DateLocale): string {
25
+ const pattern = resolveDateInputFormat(format, locale)
26
+ return pattern.replace('yyyy', locale === 'pt-BR' ? 'AAAA' : 'YYYY').replace('dd', 'DD')
27
+ }
28
+ export function formatDateInput(
29
+ value: CivilDate,
30
+ format: DateInputFormat = 'iso',
31
+ locale: DateLocale = 'en-US',
32
+ ): string {
33
+ civilDate(value)
34
+ const [year, month, day] = value.split('-')
35
+ return resolveDateInputFormat(format, locale)
36
+ .replace('yyyy', year!)
37
+ .replace('MM', month!)
38
+ .replace('dd', day!)
39
+ }
40
+ export function parseDateInput(
41
+ value: string,
42
+ format: DateInputFormat = 'iso',
43
+ locale: DateLocale = 'en-US',
44
+ ): CivilDate | null {
45
+ const pattern = resolveDateInputFormat(format, locale)
46
+ if (pattern === 'yyyy-MM-dd') return isCivilDate(value) ? value : null
47
+ const match = /^(\d{2})\/(\d{2})\/(\d{4})$/.exec(value)
48
+ if (!match) return null
49
+ const iso = `${match[3]}-${pattern === 'dd/MM/yyyy' ? match[2] : match[1]}-${pattern === 'dd/MM/yyyy' ? match[1] : match[2]}`
50
+ return isCivilDate(iso) ? iso : null
51
+ }
52
+ export function validateDateInput(
53
+ value: string,
54
+ options: DateConstraints,
55
+ format: DateInputFormat,
56
+ locale: DateLocale,
57
+ ): DateValidation {
58
+ validateDateConstraints(options)
59
+ const pattern = resolveDateInputFormat(format, locale)
60
+ const parsed = parseDateInput(value, format, locale)
61
+ if (!value || parsed) return validateDateDraft(parsed ?? '', options)
62
+ const incomplete =
63
+ value.length < 10 &&
64
+ (pattern === 'yyyy-MM-dd'
65
+ ? /^\d{0,4}(-\d{0,2}(-\d{0,2})?)?$/.test(value)
66
+ : /^\d{0,2}(\/\d{0,2}(\/\d{0,4})?)?$/.test(value))
67
+ return { valid: false, complete: false, reason: incomplete ? 'incomplete' : 'invalid' }
68
+ }
69
+ export function validateDateRangeInput(
70
+ draft: DateRangeDraft,
71
+ options: DateConstraints,
72
+ format: DateInputFormat,
73
+ locale: DateLocale,
74
+ ): DateValidation {
75
+ const start = validateDateInput(draft.start, options, format, locale)
76
+ const end = validateDateInput(draft.end, options, format, locale)
77
+ const complete = start.complete && end.complete
78
+ if (!start.valid) return { ...start, complete }
79
+ if (!end.valid) return { ...end, complete }
80
+ return validateDateRangeDraft(
81
+ {
82
+ start: parseDateInput(draft.start, format, locale) ?? '',
83
+ end: parseDateInput(draft.end, format, locale) ?? '',
84
+ },
85
+ options,
86
+ )
87
+ }
@@ -0,0 +1,37 @@
1
+ /** An instant is a Date or milliseconds since the Unix epoch; strings are never guessed. */
2
+ export type DateTimeValue = Date | number
3
+ export type DateTimeStyle = 'short' | 'medium' | 'long' | 'full'
4
+ export interface DateTimeFormatOptions {
5
+ /** Explicit IANA zone (or UTC), required for deterministic server/client presentation. */
6
+ timeZone: string
7
+ locale?: string
8
+ dateStyle?: DateTimeStyle
9
+ timeStyle?: DateTimeStyle
10
+ }
11
+ export function dateTimeMilliseconds(value: DateTimeValue): number {
12
+ const milliseconds = value instanceof Date ? value.getTime() : value
13
+ if (
14
+ typeof milliseconds !== 'number' ||
15
+ !Number.isFinite(milliseconds) ||
16
+ Math.abs(milliseconds) > 8640000000000000
17
+ )
18
+ throw new RangeError('An instant must be a valid Date or finite epoch milliseconds.')
19
+ return Math.trunc(milliseconds)
20
+ }
21
+ /** @internal Shared option validation, without acquiring a platform formatter. */
22
+ export function resolveDateTimeOptions(options: DateTimeFormatOptions) {
23
+ if (!options || typeof options.timeZone !== 'string' || !options.timeZone.trim())
24
+ throw new RangeError('An explicit timeZone is required.')
25
+ const locale = options.locale ?? 'en-US'
26
+ if (!/^[a-z]{2,8}(?:-[a-z0-9]{1,8})*$/i.test(locale)) throw new RangeError('Use a BCP 47 locale.')
27
+ for (const style of [options.dateStyle, options.timeStyle])
28
+ if (style !== undefined && !['short', 'medium', 'long', 'full'].includes(style))
29
+ throw new RangeError('Invalid date/time style.')
30
+ const defaults = options.dateStyle === undefined && options.timeStyle === undefined
31
+ return {
32
+ locale,
33
+ timeZone: options.timeZone,
34
+ dateStyle: defaults ? ('medium' as const) : options.dateStyle,
35
+ timeStyle: defaults ? ('short' as const) : options.timeStyle,
36
+ }
37
+ }