@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,350 @@
1
+ import {
2
+ computed,
3
+ onBeforeUnmount,
4
+ defineComponent,
5
+ h,
6
+ mergeProps,
7
+ nextTick,
8
+ ref,
9
+ watch,
10
+ type Component,
11
+ } from '@vue/runtime-core'
12
+ import type { InputHandle } from '../input.js'
13
+ import type { ChoiceValue } from '../choice.js'
14
+ import { choiceKey } from '../choice.js'
15
+ import {
16
+ formatNumber,
17
+ parseNumberDraft,
18
+ stepNumber,
19
+ validateNumberConstraints,
20
+ type NumberDraft,
21
+ } from '../number-input.js'
22
+ import { toggleMultiSelection, validateMultiSelection } from '../multi-select.js'
23
+ import { numberInputProps, multiSelectProps } from './configurator-props.js'
24
+ import { useButtonAction } from './button-content.js'
25
+
26
+ interface Primitives {
27
+ Column: Component
28
+ Row: Component
29
+ Text: Component
30
+ Button: Component
31
+ Input: Component
32
+ Chip: Component
33
+ Checkbox: Component
34
+ Sheet: Component
35
+ focusTrigger: (component: unknown) => void
36
+ }
37
+
38
+ /** Shared controls compose the renderer primitives, keeping editing and selection in one place. */
39
+ export function createConfiguratorControls(ui: Primitives, platform: 'web' | 'native') {
40
+ const NumberInput = defineComponent({
41
+ name: 'MNumberInput',
42
+ inheritAttrs: false,
43
+ props: numberInputProps,
44
+ emits: {
45
+ 'update:modelValue': (_value: number | null) => true,
46
+ 'update:draft': (_value: string) => true,
47
+ validityChange: (_value: NumberDraft) => true,
48
+ focus: () => true,
49
+ blur: () => true,
50
+ },
51
+ setup(props, { attrs, emit, expose }) {
52
+ useButtonAction()
53
+ const editor = ref<InputHandle>()
54
+ const local = ref(props.draft ?? formatNumber(props.modelValue, props.locale))
55
+ const draft = computed(() => props.draft ?? local.value)
56
+ const parsed = computed(() => parseNumberDraft(draft.value, props.locale, props))
57
+ let alive = true
58
+ onBeforeUnmount(() => {
59
+ alive = false
60
+ })
61
+ let revision = 0
62
+ let requested: number | null | undefined
63
+ function setDraft(value: string) {
64
+ local.value = value
65
+ emit('update:draft', value)
66
+ }
67
+ watch(
68
+ () => [props.modelValue, props.locale] as const,
69
+ ([value, locale], previous) => {
70
+ if (!Object.is(value, requested) || locale !== previous[1])
71
+ setDraft(formatNumber(value, locale))
72
+ requested = undefined
73
+ },
74
+ )
75
+ watch(
76
+ () => props.draft,
77
+ (value) => {
78
+ if (value !== undefined) local.value = value
79
+ },
80
+ )
81
+ function publish(value: number | null) {
82
+ const current = ++revision
83
+ requested = value
84
+ emit('update:modelValue', value)
85
+ void nextTick(() => {
86
+ if (!alive || current !== revision) return
87
+ if (!Object.is(props.modelValue, value))
88
+ setDraft(formatNumber(props.modelValue, props.locale))
89
+ requested = undefined
90
+ })
91
+ }
92
+ function edit(value: string) {
93
+ if (props.disabled || props.readonly) return
94
+ revision++
95
+ setDraft(value)
96
+ const validation = parseNumberDraft(value, props.locale, props)
97
+ emit('validityChange', validation)
98
+ if (validation.status === 'valid' || validation.status === 'empty')
99
+ publish(validation.value)
100
+ }
101
+ function step(direction: -1 | 1) {
102
+ if (props.disabled || props.readonly) return
103
+ const current = parsed.value.status === 'valid' ? parsed.value.value : props.modelValue
104
+ const value = stepNumber(current, direction, props)
105
+ setDraft(formatNumber(value, props.locale))
106
+ publish(value)
107
+ emit('validityChange', { status: 'valid', value })
108
+ }
109
+ expose({
110
+ focus: () => editor.value?.focus(),
111
+ blur: () => editor.value?.blur(),
112
+ } satisfies InputHandle)
113
+ return () => {
114
+ validateNumberConstraints(props)
115
+ if (!props.label.trim()) throw new TypeError('NumberInput requires a label.')
116
+ const blocked = props.disabled || props.readonly
117
+ const issue = ['invalid', 'range'].includes(parsed.value.status)
118
+ const message = issue
119
+ ? props.locale === 'pt-BR'
120
+ ? 'Informe um número dentro dos limites.'
121
+ : 'Enter a number within the allowed range.'
122
+ : ''
123
+ return h(
124
+ ui.Row,
125
+ {
126
+ gap: 'sm',
127
+ align: 'end',
128
+ width: props.width,
129
+ grow: props.grow,
130
+ shrink: props.shrink,
131
+ accessibilityHidden: props.accessibilityHidden,
132
+ },
133
+ () => [
134
+ h(
135
+ ui.Input,
136
+ mergeProps(attrs, {
137
+ ref: editor,
138
+ id: props.id,
139
+ modelValue: draft.value,
140
+ label: props.label,
141
+ name: props.name,
142
+ placeholder: props.placeholder,
143
+ inputmode: 'decimal',
144
+ disabled: props.disabled,
145
+ readonly: props.readonly,
146
+ helperText: props.helperText,
147
+ error: props.error || message,
148
+ accessibilityHidden: props.accessibilityHidden,
149
+ width: 0,
150
+ grow: 1,
151
+ autocorrect: false,
152
+ autocapitalize: 'none',
153
+ 'onUpdate:modelValue': edit,
154
+ onFocus: () => emit('focus'),
155
+ onBlur: () => emit('blur'),
156
+ ...(platform === 'web'
157
+ ? {
158
+ onKeydown: (event: {
159
+ key: string
160
+ isComposing: boolean
161
+ preventDefault(): void
162
+ }) => {
163
+ if (
164
+ !blocked &&
165
+ !event.isComposing &&
166
+ ['ArrowUp', 'ArrowDown'].includes(event.key)
167
+ ) {
168
+ event.preventDefault()
169
+ step(event.key === 'ArrowUp' ? 1 : -1)
170
+ }
171
+ },
172
+ }
173
+ : {}),
174
+ }),
175
+ ),
176
+ h(ui.Button, {
177
+ text: '−',
178
+ variant: 'secondary',
179
+ accessibilityLabel: `${props.decrementLabel}: ${props.label}`,
180
+ disabled:
181
+ blocked ||
182
+ (props.min !== undefined &&
183
+ props.modelValue !== null &&
184
+ props.modelValue <= props.min),
185
+ onClick: () => step(-1),
186
+ }),
187
+ h(ui.Button, {
188
+ text: '+',
189
+ variant: 'secondary',
190
+ accessibilityLabel: `${props.incrementLabel}: ${props.label}`,
191
+ disabled:
192
+ blocked ||
193
+ (props.max !== undefined &&
194
+ props.modelValue !== null &&
195
+ props.modelValue >= props.max),
196
+ onClick: () => step(1),
197
+ }),
198
+ ],
199
+ )
200
+ }
201
+ },
202
+ })
203
+ const MultiSelect = defineComponent({
204
+ name: 'MMultiSelect',
205
+ inheritAttrs: false,
206
+ props: multiSelectProps,
207
+ emits: { 'update:modelValue': (_values: ChoiceValue[]) => true },
208
+ setup(props, { attrs, emit }) {
209
+ useButtonAction()
210
+ const open = ref(false),
211
+ query = ref('')
212
+ const trigger = ref<unknown>()
213
+ let alive = true
214
+ onBeforeUnmount(() => {
215
+ alive = false
216
+ })
217
+ function restoreFocus() {
218
+ void nextTick(() => {
219
+ if (alive) ui.focusTrigger(trigger.value)
220
+ })
221
+ }
222
+ watch(
223
+ () => props.disabled || props.readonly,
224
+ (blocked) => {
225
+ if (blocked) open.value = false
226
+ },
227
+ )
228
+ watch(open, (value) => {
229
+ if (!value && platform === 'native' && !props.disabled) restoreFocus()
230
+ })
231
+ function toggle(value: ChoiceValue) {
232
+ if (props.disabled || props.readonly) return
233
+ const next = toggleMultiSelection(props.options, props.modelValue, value, props.maxSelected)
234
+ if (next) emit('update:modelValue', next)
235
+ }
236
+ return () => {
237
+ validateMultiSelection(props.options, props.modelValue, props.maxSelected)
238
+ if (!props.label.trim()) throw new TypeError('MultiSelect requires a label.')
239
+ const selected = props.modelValue.map((value) =>
240
+ props.options.find((option) => option.value === value)!,
241
+ )
242
+ const filter = query.value.trim().toLocaleLowerCase()
243
+ const options = props.options.filter((option) =>
244
+ option.label.toLocaleLowerCase().includes(filter),
245
+ )
246
+ return h(
247
+ ui.Column,
248
+ mergeProps(attrs, {
249
+ gap: 'sm',
250
+ width: props.width,
251
+ grow: props.grow,
252
+ shrink: props.shrink,
253
+ accessibilityHidden: props.accessibilityHidden,
254
+ }),
255
+ () => [
256
+ h(ui.Text, { text: props.label, variant: 'caption', weight: '600' }),
257
+ h(ui.Button, {
258
+ ref: trigger,
259
+ id: props.id,
260
+ text: selected.length ? `${props.label} · ${selected.length}` : props.placeholder,
261
+ accessibilityLabel: `${props.label}: ${selected.map((option) => option.label).join(', ') || props.placeholder}`,
262
+ variant: 'secondary',
263
+ disabled: props.disabled || props.readonly,
264
+ onClick: () => {
265
+ ui.focusTrigger(trigger.value)
266
+ query.value = ''
267
+ open.value = true
268
+ },
269
+ }),
270
+ selected.length
271
+ ? h(ui.Row, { gap: 'sm', wrap: true }, () =>
272
+ selected.map((option) =>
273
+ h(ui.Chip, {
274
+ key: choiceKey(option.value),
275
+ label: option.label,
276
+ removable: true,
277
+ removeLabel: `${props.removeLabel}: ${option.label}`,
278
+ disabled: props.disabled || props.readonly || option.disabled,
279
+ onRemove: () => {
280
+ toggle(option.value)
281
+ restoreFocus()
282
+ },
283
+ }),
284
+ ),
285
+ )
286
+ : null,
287
+ props.error || props.helperText
288
+ ? h(ui.Text, {
289
+ text: props.error || props.helperText,
290
+ tone: props.error ? 'danger' : 'muted',
291
+ variant: 'caption',
292
+ })
293
+ : null,
294
+ h(
295
+ ui.Sheet,
296
+ {
297
+ open: open.value,
298
+ title: props.label,
299
+ closeLabel: props.closeLabel,
300
+ 'onUpdate:open': (value: boolean) => {
301
+ open.value = value
302
+ },
303
+ },
304
+ () => [
305
+ h(ui.Column, { gap: 'md' }, () => [
306
+ h(ui.Input, {
307
+ modelValue: query.value,
308
+ label: props.searchLabel,
309
+ type: 'search',
310
+ autocorrect: false,
311
+ 'onUpdate:modelValue': (value: string) => {
312
+ query.value = value
313
+ },
314
+ }),
315
+ ...options.map((option) =>
316
+ h(ui.Checkbox, {
317
+ key: choiceKey(option.value),
318
+ label: option.label,
319
+ helperText: option.helperText ?? '',
320
+ modelValue: props.modelValue.includes(option.value),
321
+ disabled:
322
+ props.disabled ||
323
+ props.readonly ||
324
+ option.disabled ||
325
+ (!props.modelValue.includes(option.value) &&
326
+ props.maxSelected !== undefined &&
327
+ props.modelValue.length >= props.maxSelected),
328
+ 'onUpdate:modelValue': () => toggle(option.value),
329
+ }),
330
+ ),
331
+ !options.length ? h(ui.Text, { text: props.emptyLabel, tone: 'muted' }) : null,
332
+ h(ui.Button, {
333
+ text: props.closeLabel,
334
+ onClick: () => {
335
+ open.value = false
336
+ },
337
+ }),
338
+ ]),
339
+ ],
340
+ ),
341
+ ],
342
+ )
343
+ }
344
+ },
345
+ })
346
+ return {
347
+ MNumberInput: NumberInput as typeof NumberInput & { new (): InputHandle },
348
+ MMultiSelect: MultiSelect,
349
+ }
350
+ }
@@ -0,0 +1,39 @@
1
+ import type { PropType } from '@vue/runtime-core'
2
+ import type { Property, PropertyValue } from '../contracts.js'
3
+
4
+ type VueProperty<P extends Property> = { type: PropType<PropertyValue<P>> } & (P extends {
5
+ default: infer D
6
+ }
7
+ ? { default: D extends undefined ? undefined : PropertyValue<P> }
8
+ : unknown) &
9
+ (P extends { required: true } ? { required: true } : unknown)
10
+
11
+ const constructors = {
12
+ string: String,
13
+ number: Number,
14
+ boolean: Boolean,
15
+ object: Object,
16
+ function: Function,
17
+ }
18
+
19
+ /** Vue owns coercion and warnings; portable metadata owns names, defaults and allowed values. */
20
+ export function vueProperty<P extends Property>(definition: P): VueProperty<P> {
21
+ const kinds = Array.isArray(definition.kind) ? definition.kind : [definition.kind]
22
+ const types = kinds.map((kind: keyof typeof constructors) => constructors[kind])
23
+ return {
24
+ type: types.length === 1 ? types[0] : types,
25
+ ...('default' in definition ? { default: definition.default } : {}),
26
+ ...(definition.required ? { required: true } : {}),
27
+ ...(definition.values
28
+ ? { validator: (value: unknown) => definition.values!.includes(value) }
29
+ : {}),
30
+ } as VueProperty<P>
31
+ }
32
+
33
+ export function vueProps<P extends Record<string, Property>>(properties: P) {
34
+ return Object.fromEntries(
35
+ Object.entries(properties).map(([key, value]) => [key, vueProperty(value)]),
36
+ ) as {
37
+ [K in keyof P]: VueProperty<P[K]>
38
+ }
39
+ }
@@ -0,0 +1,190 @@
1
+ import type { DataTableComponent } from './discovery-components.js'
2
+ import {
3
+ computed,
4
+ defineComponent,
5
+ h,
6
+ mergeProps,
7
+ type Component,
8
+ type VNodeChild,
9
+ } from '@vue/runtime-core'
10
+ import { choiceKey, type ChoiceValue } from '../choice.js'
11
+ import {
12
+ collectionKeys,
13
+ nextDataSort,
14
+ selectPage,
15
+ validateColumns,
16
+ type DataColumn,
17
+ type DataSort,
18
+ } from '../discovery.js'
19
+ import { dataTableProps } from './discovery-props.js'
20
+ import { useMavisTheme } from './theme.js'
21
+
22
+ export function createDataTable(
23
+ ui: {
24
+ Column: Component
25
+ Row: Component
26
+ Text: Component
27
+ Button: Component
28
+ Checkbox: Component
29
+ Progress: Component
30
+ table: (
31
+ columns: readonly DataColumn[],
32
+ header: VNodeChild[],
33
+ rows: { key: string; cells: VNodeChild[]; selected: boolean }[],
34
+ label: string,
35
+ busy: boolean,
36
+ ) => VNodeChild
37
+ },
38
+ platform: 'web' | 'native',
39
+ ) {
40
+ return defineComponent({
41
+ name: 'MDataTable',
42
+ inheritAttrs: false,
43
+ props: dataTableProps,
44
+ emits: {
45
+ 'update:sort': (_sort: DataSort | null) => true,
46
+ 'update:selected': (_selected: ChoiceValue[]) => true,
47
+ },
48
+ setup(props, { attrs, slots, emit }) {
49
+ const { theme } = useMavisTheme()
50
+ const keys = computed(() => collectionKeys(props.items, props.itemKey))
51
+ const selectable = computed(() =>
52
+ keys.value.filter((_, index) => !props.rowDisabled?.(props.items[index]!)),
53
+ )
54
+ const selectedIds = computed(() => new Set(props.selected.map(choiceKey)))
55
+ function select(page: readonly ChoiceValue[], checked: boolean) {
56
+ if (!props.disabled && !props.loading)
57
+ emit('update:selected', selectPage(props.selected, page, checked))
58
+ }
59
+ return () => {
60
+ validateColumns(props.columns)
61
+ if (
62
+ props.sort &&
63
+ !props.columns.some((column) => column.key === props.sort!.key && column.sortable)
64
+ )
65
+ throw new RangeError('Sort must identify a sortable column.')
66
+ const count = selectable.value.filter((key) => selectedIds.value.has(choiceKey(key))).length
67
+ const headers = props.columns.map((column) =>
68
+ column.sortable
69
+ ? h(ui.Button, {
70
+ text: column.label,
71
+ variant: 'ghost',
72
+ disabled: props.disabled || props.loading,
73
+ icon:
74
+ props.sort?.key !== column.key
75
+ ? 'arrow-up-down'
76
+ : props.sort.direction === 'ascending'
77
+ ? 'arrow-up'
78
+ : 'arrow-down',
79
+ accessibilityLabel: `${column.label}${platform === 'native' && props.sort?.key === column.key ? `, ${props.sort.direction}` : ''}`,
80
+ onClick: () => {
81
+ if (!props.disabled && !props.loading)
82
+ emit('update:sort', nextDataSort(props.sort, column.key))
83
+ },
84
+ })
85
+ : h(ui.Text, { text: column.label, weight: '600', variant: 'caption' }),
86
+ )
87
+ const columns = props.columns.map((column) => ({
88
+ ...column,
89
+ sort: props.sort?.key === column.key ? props.sort.direction : undefined,
90
+ }))
91
+ if (props.selectable) {
92
+ let selectionKey = '__mavis_selection'
93
+ while (columns.some((column) => column.key === selectionKey))
94
+ selectionKey = '_' + selectionKey
95
+ columns.unshift({
96
+ key: selectionKey,
97
+ // The checkbox carries the accessible label; this column has no visible caption.
98
+ label: '',
99
+ width: 64,
100
+ sort: undefined,
101
+ })
102
+ headers.unshift(
103
+ h(ui.Checkbox, {
104
+ label: props.selectAllLabel,
105
+ modelValue: count > 0 && count === selectable.value.length,
106
+ indeterminate: count > 0 && count < selectable.value.length,
107
+ disabled: props.disabled || props.loading || !selectable.value.length,
108
+ 'onUpdate:modelValue': (value: boolean) => select(selectable.value, value),
109
+ ...(platform === 'web' ? { class: 'm-data-table-selection' } : {}),
110
+ }),
111
+ )
112
+ }
113
+ const rows = props.items.map((item, index) => {
114
+ const key = keys.value[index]!
115
+ const cells = props.columns.map((column) => {
116
+ const raw = column.value ? column.value(item) : item[column.key]
117
+ const value =
118
+ raw == null || typeof raw === 'string' || typeof raw === 'number' ? raw : String(raw)
119
+ const slot = { item, itemKey: key, column, value, index }
120
+ return (
121
+ slots[`cell:${column.key}`]?.(slot) ??
122
+ slots.cell?.(slot) ??
123
+ h(ui.Text, {
124
+ text: String(value ?? '—'),
125
+ align: column.align === 'end' ? 'right' : 'left',
126
+ })
127
+ )
128
+ })
129
+ if (props.selectable)
130
+ cells.unshift(
131
+ h(ui.Checkbox, {
132
+ label: `${props.selectLabel} ${props.rowLabel?.(item) ?? String(key)}`,
133
+ modelValue: selectedIds.value.has(choiceKey(key)),
134
+ disabled: props.disabled || props.loading || props.rowDisabled?.(item),
135
+ 'onUpdate:modelValue': (value: boolean) => {
136
+ if (!props.rowDisabled?.(item)) select([key], value)
137
+ },
138
+ ...(platform === 'web' ? { class: 'm-data-table-selection' } : {}),
139
+ }),
140
+ )
141
+ return { key: choiceKey(key), cells, selected: selectedIds.value.has(choiceKey(key)) }
142
+ })
143
+ return h(
144
+ ui.Column,
145
+ mergeProps(
146
+ { id: props.id, gap: 'md' },
147
+ attrs,
148
+ platform === 'web'
149
+ ? {
150
+ class: 'm-data-table',
151
+ style: {
152
+ '--m-color-border': theme.value.colors.border,
153
+ '--m-color-primarySoft': theme.value.colors.primarySoft,
154
+ },
155
+ }
156
+ : {},
157
+ ),
158
+ () => [
159
+ h(ui.Row, { justify: 'between', gap: 'md', wrap: true }, () => [
160
+ h(ui.Text, { as: 'h2', variant: 'heading', text: props.label }),
161
+ slots.actions?.(),
162
+ ]),
163
+ h(
164
+ ui.Column,
165
+ { radius: 'lg', backgroundColor: theme.value.colors.surface, gap: 'none' },
166
+ () => [
167
+ props.loading
168
+ ? h(ui.Progress, { indeterminate: true, label: props.loadingLabel, size: 'sm' })
169
+ : null,
170
+ ui.table(columns, headers, rows, props.label, props.loading),
171
+ !rows.length
172
+ ? (slots.empty?.() ??
173
+ h(ui.Text, {
174
+ text: props.loading ? props.loadingLabel : props.emptyLabel,
175
+ tone: 'muted',
176
+ style: { padding: 24 },
177
+ ...(platform === 'web'
178
+ ? { role: 'status' }
179
+ : { accessibilityLiveRegion: 'polite' }),
180
+ }))
181
+ : null,
182
+ ],
183
+ ),
184
+ slots.footer?.(),
185
+ ],
186
+ )
187
+ }
188
+ },
189
+ }) as unknown as DataTableComponent
190
+ }
@@ -0,0 +1,76 @@
1
+ import { computed, watch, type ExtractPropTypes } from '@vue/runtime-core'
2
+ import {
3
+ addCivilDays,
4
+ addCivilMonths,
5
+ calendarMonth,
6
+ civilWeekday,
7
+ dateAvailability,
8
+ dateLocales,
9
+ parseCivilDate,
10
+ type CivilDate,
11
+ } from '../date.js'
12
+ import { dateCalendarProps } from './date-props.js'
13
+
14
+ /** @internal Calendar arithmetic and live bounds shared by Web and native presentations. */
15
+ export function useDateCalendar(
16
+ props: ExtractPropTypes<typeof dateCalendarProps>,
17
+ change: (value: CivilDate) => void,
18
+ ) {
19
+ const words = computed(() => dateLocales[props.locale])
20
+ const firstDay = computed(() => props.firstDayOfWeek ?? words.value.firstDayOfWeek)
21
+ const cells = computed(() => calendarMonth(props.activeDate, firstDay.value))
22
+ const title = computed(() => {
23
+ const parts = parseCivilDate(props.activeDate)!
24
+ return `${words.value.months[parts.month - 1]} ${String(parts.year).padStart(4, '0')}`
25
+ })
26
+ const weekdays = computed(() =>
27
+ Array.from({ length: 7 }, (_, index) => (index + firstDay.value) % 7),
28
+ )
29
+ const available = (date: CivilDate) => dateAvailability(date, props) === null
30
+ function clamp(value: CivilDate) {
31
+ if (props.min && value < props.min) return props.min
32
+ if (props.max && value > props.max) return props.max
33
+ return value
34
+ }
35
+ function move(value: CivilDate) {
36
+ change(clamp(value))
37
+ }
38
+ function canPage(amount: number) {
39
+ const next = addCivilMonths(props.activeDate, amount)
40
+ return (
41
+ next.slice(0, 7) !== props.activeDate.slice(0, 7) &&
42
+ (!props.min || next.slice(0, 7) >= props.min.slice(0, 7)) &&
43
+ (!props.max || next.slice(0, 7) <= props.max.slice(0, 7))
44
+ )
45
+ }
46
+ function page(amount: number) {
47
+ if (canPage(amount)) move(addCivilMonths(props.activeDate, amount))
48
+ }
49
+ function key(key: string, shift = false, rtl = false): boolean {
50
+ const active = props.activeDate
51
+ if (key === 'ArrowLeft') move(addCivilDays(active, rtl ? 1 : -1))
52
+ else if (key === 'ArrowRight') move(addCivilDays(active, rtl ? -1 : 1))
53
+ else if (key === 'ArrowUp') move(addCivilDays(active, -7))
54
+ else if (key === 'ArrowDown') move(addCivilDays(active, 7))
55
+ else if (key === 'Home')
56
+ move(addCivilDays(active, -((civilWeekday(active) - firstDay.value + 7) % 7)))
57
+ else if (key === 'End')
58
+ move(addCivilDays(active, 6 - ((civilWeekday(active) - firstDay.value + 7) % 7)))
59
+ else if (key === 'PageUp') move(addCivilMonths(active, shift ? -12 : -1))
60
+ else if (key === 'PageDown') move(addCivilMonths(active, shift ? 12 : 1))
61
+ else return false
62
+ return true
63
+ }
64
+ watch(
65
+ () => [props.min, props.max, props.activeDate],
66
+ () => {
67
+ const value = clamp(props.activeDate)
68
+ if (value !== props.activeDate) change(value)
69
+ },
70
+ )
71
+ const inRange = (date: CivilDate) =>
72
+ Boolean(
73
+ props.rangeStart && props.rangeEnd && date >= props.rangeStart && date <= props.rangeEnd,
74
+ )
75
+ return { words, title, firstDay, cells, weekdays, available, move, canPage, page, key, inRange }
76
+ }