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

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 (417) 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 +168 -0
  25. package/dist/capabilities.js.map +1 -0
  26. package/dist/chip.d.ts +9 -0
  27. package/dist/chip.d.ts.map +1 -0
  28. package/dist/chip.js +16 -0
  29. package/dist/chip.js.map +1 -0
  30. package/dist/choice-motion.d.ts +14 -0
  31. package/dist/choice-motion.d.ts.map +1 -0
  32. package/dist/choice-motion.js +5 -0
  33. package/dist/choice-motion.js.map +1 -0
  34. package/dist/choice.d.ts +15 -0
  35. package/dist/choice.d.ts.map +1 -0
  36. package/dist/choice.js +27 -0
  37. package/dist/choice.js.map +1 -0
  38. package/dist/collections.d.ts +46 -0
  39. package/dist/collections.d.ts.map +1 -0
  40. package/dist/collections.js +48 -0
  41. package/dist/collections.js.map +1 -0
  42. package/dist/combobox.d.ts +42 -0
  43. package/dist/combobox.d.ts.map +1 -0
  44. package/dist/combobox.js +159 -0
  45. package/dist/combobox.js.map +1 -0
  46. package/dist/contracts.d.ts +1321 -0
  47. package/dist/contracts.d.ts.map +1 -0
  48. package/dist/contracts.js +268 -0
  49. package/dist/contracts.js.map +1 -0
  50. package/dist/date-input.d.ts +10 -0
  51. package/dist/date-input.d.ts.map +1 -0
  52. package/dist/date-input.js +58 -0
  53. package/dist/date-input.js.map +1 -0
  54. package/dist/date-time.d.ts +19 -0
  55. package/dist/date-time.d.ts.map +1 -0
  56. package/dist/date-time.js +27 -0
  57. package/dist/date-time.js.map +1 -0
  58. package/dist/date.d.ts +96 -0
  59. package/dist/date.d.ts.map +1 -0
  60. package/dist/date.js +235 -0
  61. package/dist/date.js.map +1 -0
  62. package/dist/dialog.d.ts +4 -0
  63. package/dist/dialog.d.ts.map +1 -0
  64. package/dist/dialog.js +21 -0
  65. package/dist/dialog.js.map +1 -0
  66. package/dist/empty-state.d.ts +2 -0
  67. package/dist/empty-state.d.ts.map +1 -0
  68. package/dist/empty-state.js +5 -0
  69. package/dist/empty-state.js.map +1 -0
  70. package/dist/experimental-collections.d.ts +82 -0
  71. package/dist/experimental-collections.d.ts.map +1 -0
  72. package/dist/experimental-collections.js +8 -0
  73. package/dist/experimental-collections.js.map +1 -0
  74. package/dist/experimental-effects.d.ts +107 -0
  75. package/dist/experimental-effects.d.ts.map +1 -0
  76. package/dist/experimental-effects.js +24 -0
  77. package/dist/experimental-effects.js.map +1 -0
  78. package/dist/experimental-platforms.d.ts +94 -0
  79. package/dist/experimental-platforms.d.ts.map +1 -0
  80. package/dist/experimental-platforms.js +2 -0
  81. package/dist/experimental-platforms.js.map +1 -0
  82. package/dist/experimental-playback.d.ts +63 -0
  83. package/dist/experimental-playback.d.ts.map +1 -0
  84. package/dist/experimental-playback.js +46 -0
  85. package/dist/experimental-playback.js.map +1 -0
  86. package/dist/experimental-regions.d.ts +179 -0
  87. package/dist/experimental-regions.d.ts.map +1 -0
  88. package/dist/experimental-regions.js +554 -0
  89. package/dist/experimental-regions.js.map +1 -0
  90. package/dist/experimental-sensors.d.ts +42 -0
  91. package/dist/experimental-sensors.d.ts.map +1 -0
  92. package/dist/experimental-sensors.js +2 -0
  93. package/dist/experimental-sensors.js.map +1 -0
  94. package/dist/experimental-surfaces.d.ts +127 -0
  95. package/dist/experimental-surfaces.d.ts.map +1 -0
  96. package/dist/experimental-surfaces.js +2 -0
  97. package/dist/experimental-surfaces.js.map +1 -0
  98. package/dist/experimental.d.ts +197 -0
  99. package/dist/experimental.d.ts.map +1 -0
  100. package/dist/experimental.js +855 -0
  101. package/dist/experimental.js.map +1 -0
  102. package/dist/files.d.ts +87 -0
  103. package/dist/files.d.ts.map +1 -0
  104. package/dist/files.js +328 -0
  105. package/dist/files.js.map +1 -0
  106. package/dist/form.d.ts +39 -0
  107. package/dist/form.d.ts.map +1 -0
  108. package/dist/form.js +170 -0
  109. package/dist/form.js.map +1 -0
  110. package/dist/grid.d.ts +3 -0
  111. package/dist/grid.d.ts.map +1 -0
  112. package/dist/grid.js +16 -0
  113. package/dist/grid.js.map +1 -0
  114. package/dist/icon.d.ts +15 -0
  115. package/dist/icon.d.ts.map +1 -0
  116. package/dist/icon.js +28 -0
  117. package/dist/icon.js.map +1 -0
  118. package/dist/icons.d.ts +2002 -0
  119. package/dist/icons.d.ts.map +1 -0
  120. package/dist/icons.js +2003 -0
  121. package/dist/icons.js.map +1 -0
  122. package/dist/index.d.ts +56 -3
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +39 -1
  125. package/dist/index.js.map +1 -1
  126. package/dist/input.d.ts +14 -0
  127. package/dist/input.d.ts.map +1 -1
  128. package/dist/input.js +12 -0
  129. package/dist/input.js.map +1 -1
  130. package/dist/link.d.ts +36 -0
  131. package/dist/link.d.ts.map +1 -0
  132. package/dist/link.js +60 -0
  133. package/dist/link.js.map +1 -0
  134. package/dist/list-item.d.ts +3 -0
  135. package/dist/list-item.d.ts.map +1 -0
  136. package/dist/list-item.js +7 -0
  137. package/dist/list-item.js.map +1 -0
  138. package/dist/motion.d.ts +58 -0
  139. package/dist/motion.d.ts.map +1 -0
  140. package/dist/motion.js +73 -0
  141. package/dist/motion.js.map +1 -0
  142. package/dist/multi-select.d.ts +4 -0
  143. package/dist/multi-select.d.ts.map +1 -0
  144. package/dist/multi-select.js +23 -0
  145. package/dist/multi-select.js.map +1 -0
  146. package/dist/navigation-transition.d.ts +10 -0
  147. package/dist/navigation-transition.d.ts.map +1 -0
  148. package/dist/navigation-transition.js +10 -0
  149. package/dist/navigation-transition.js.map +1 -0
  150. package/dist/navigation.d.ts +22 -0
  151. package/dist/navigation.d.ts.map +1 -0
  152. package/dist/navigation.js +54 -0
  153. package/dist/navigation.js.map +1 -0
  154. package/dist/number-input.d.ts +21 -0
  155. package/dist/number-input.d.ts.map +1 -0
  156. package/dist/number-input.js +63 -0
  157. package/dist/number-input.js.map +1 -0
  158. package/dist/popover.d.ts +17 -0
  159. package/dist/popover.d.ts.map +1 -0
  160. package/dist/popover.js +19 -0
  161. package/dist/popover.js.map +1 -0
  162. package/dist/progress.d.ts +19 -0
  163. package/dist/progress.d.ts.map +1 -0
  164. package/dist/progress.js +19 -0
  165. package/dist/progress.js.map +1 -0
  166. package/dist/responsive.d.ts +18 -0
  167. package/dist/responsive.d.ts.map +1 -0
  168. package/dist/responsive.js +35 -0
  169. package/dist/responsive.js.map +1 -0
  170. package/dist/section-scroll.d.ts +14 -0
  171. package/dist/section-scroll.d.ts.map +1 -0
  172. package/dist/section-scroll.js +28 -0
  173. package/dist/section-scroll.js.map +1 -0
  174. package/dist/segmented.d.ts +11 -0
  175. package/dist/segmented.d.ts.map +1 -0
  176. package/dist/segmented.js +30 -0
  177. package/dist/segmented.js.map +1 -0
  178. package/dist/sheet.d.ts +19 -0
  179. package/dist/sheet.d.ts.map +1 -0
  180. package/dist/sheet.js +15 -0
  181. package/dist/sheet.js.map +1 -0
  182. package/dist/tabs.d.ts +11 -0
  183. package/dist/tabs.d.ts.map +1 -0
  184. package/dist/tabs.js +28 -0
  185. package/dist/tabs.js.map +1 -0
  186. package/dist/theme/themes.d.ts.map +1 -1
  187. package/dist/theme/themes.js +85 -12
  188. package/dist/theme/themes.js.map +1 -1
  189. package/dist/theme/types.d.ts +64 -4
  190. package/dist/theme/types.d.ts.map +1 -1
  191. package/dist/theme/typography.d.ts +10 -0
  192. package/dist/theme/typography.d.ts.map +1 -0
  193. package/dist/theme/typography.js +90 -0
  194. package/dist/theme/typography.js.map +1 -0
  195. package/dist/time.d.ts +34 -0
  196. package/dist/time.d.ts.map +1 -0
  197. package/dist/time.js +78 -0
  198. package/dist/time.js.map +1 -0
  199. package/dist/toast.d.ts +43 -0
  200. package/dist/toast.d.ts.map +1 -0
  201. package/dist/toast.js +228 -0
  202. package/dist/toast.js.map +1 -0
  203. package/dist/vue/button-content.d.ts +10 -0
  204. package/dist/vue/button-content.d.ts.map +1 -0
  205. package/dist/vue/button-content.js +54 -0
  206. package/dist/vue/button-content.js.map +1 -0
  207. package/dist/vue/cached-activity.d.ts +3 -0
  208. package/dist/vue/cached-activity.d.ts.map +1 -0
  209. package/dist/vue/cached-activity.js +13 -0
  210. package/dist/vue/cached-activity.js.map +1 -0
  211. package/dist/vue/combobox.d.ts +155 -0
  212. package/dist/vue/combobox.d.ts.map +1 -0
  213. package/dist/vue/combobox.js +195 -0
  214. package/dist/vue/combobox.js.map +1 -0
  215. package/dist/vue/component-props.d.ts +2853 -0
  216. package/dist/vue/component-props.d.ts.map +1 -0
  217. package/dist/vue/component-props.js +29 -0
  218. package/dist/vue/component-props.js.map +1 -0
  219. package/dist/vue/configurator-props.d.ts +277 -0
  220. package/dist/vue/configurator-props.d.ts.map +1 -0
  221. package/dist/vue/configurator-props.js +63 -0
  222. package/dist/vue/configurator-props.js.map +1 -0
  223. package/dist/vue/configurator.d.ts +403 -0
  224. package/dist/vue/configurator.d.ts.map +1 -0
  225. package/dist/vue/configurator.js +287 -0
  226. package/dist/vue/configurator.js.map +1 -0
  227. package/dist/vue/contracts.d.ts +18 -0
  228. package/dist/vue/contracts.d.ts.map +1 -0
  229. package/dist/vue/contracts.js +24 -0
  230. package/dist/vue/contracts.js.map +1 -0
  231. package/dist/vue/date-calendar.d.ts +64 -0
  232. package/dist/vue/date-calendar.d.ts.map +1 -0
  233. package/dist/vue/date-calendar.js +65 -0
  234. package/dist/vue/date-calendar.js.map +1 -0
  235. package/dist/vue/date-picker.d.ts +1000 -0
  236. package/dist/vue/date-picker.d.ts.map +1 -0
  237. package/dist/vue/date-picker.js +334 -0
  238. package/dist/vue/date-picker.js.map +1 -0
  239. package/dist/vue/date-props.d.ts +272 -0
  240. package/dist/vue/date-props.d.ts.map +1 -0
  241. package/dist/vue/date-props.js +78 -0
  242. package/dist/vue/date-props.js.map +1 -0
  243. package/dist/vue/dialog.d.ts +21 -0
  244. package/dist/vue/dialog.d.ts.map +1 -0
  245. package/dist/vue/dialog.js +58 -0
  246. package/dist/vue/dialog.js.map +1 -0
  247. package/dist/vue/files.d.ts +53 -0
  248. package/dist/vue/files.d.ts.map +1 -0
  249. package/dist/vue/files.js +40 -0
  250. package/dist/vue/files.js.map +1 -0
  251. package/dist/vue/forms.d.ts +4 -0
  252. package/dist/vue/forms.d.ts.map +1 -0
  253. package/dist/vue/forms.js +15 -0
  254. package/dist/vue/forms.js.map +1 -0
  255. package/dist/vue/global-components.d.ts +198 -3
  256. package/dist/vue/global-components.d.ts.map +1 -1
  257. package/dist/vue/index.d.ts +44 -4
  258. package/dist/vue/index.d.ts.map +1 -1
  259. package/dist/vue/index.js +36 -2
  260. package/dist/vue/index.js.map +1 -1
  261. package/dist/vue/inline-content.d.ts +54 -0
  262. package/dist/vue/inline-content.d.ts.map +1 -0
  263. package/dist/vue/inline-content.js +64 -0
  264. package/dist/vue/inline-content.js.map +1 -0
  265. package/dist/vue/layout-context.d.ts +4 -2
  266. package/dist/vue/layout-context.d.ts.map +1 -1
  267. package/dist/vue/layout-context.js +7 -2
  268. package/dist/vue/layout-context.js.map +1 -1
  269. package/dist/vue/list-motion.d.ts +7 -0
  270. package/dist/vue/list-motion.d.ts.map +1 -0
  271. package/dist/vue/list-motion.js +28 -0
  272. package/dist/vue/list-motion.js.map +1 -0
  273. package/dist/vue/loading-effect.d.ts +7 -0
  274. package/dist/vue/loading-effect.d.ts.map +1 -0
  275. package/dist/vue/loading-effect.js +32 -0
  276. package/dist/vue/loading-effect.js.map +1 -0
  277. package/dist/vue/menu.d.ts +122 -0
  278. package/dist/vue/menu.d.ts.map +1 -0
  279. package/dist/vue/menu.js +79 -0
  280. package/dist/vue/menu.js.map +1 -0
  281. package/dist/vue/navigation-controls.d.ts +124 -0
  282. package/dist/vue/navigation-controls.d.ts.map +1 -0
  283. package/dist/vue/navigation-controls.js +117 -0
  284. package/dist/vue/navigation-controls.js.map +1 -0
  285. package/dist/vue/navigation-props.d.ts +283 -0
  286. package/dist/vue/navigation-props.d.ts.map +1 -0
  287. package/dist/vue/navigation-props.js +82 -0
  288. package/dist/vue/navigation-props.js.map +1 -0
  289. package/dist/vue/navigation.d.ts +7 -0
  290. package/dist/vue/navigation.d.ts.map +1 -0
  291. package/dist/vue/navigation.js +15 -0
  292. package/dist/vue/navigation.js.map +1 -0
  293. package/dist/vue/platform.d.ts +37 -0
  294. package/dist/vue/platform.d.ts.map +1 -0
  295. package/dist/vue/platform.js +46 -0
  296. package/dist/vue/platform.js.map +1 -0
  297. package/dist/vue/props.d.ts +3326 -510
  298. package/dist/vue/props.d.ts.map +1 -1
  299. package/dist/vue/props.js +314 -83
  300. package/dist/vue/props.js.map +1 -1
  301. package/dist/vue/reveal-state.d.ts +18 -0
  302. package/dist/vue/reveal-state.d.ts.map +1 -0
  303. package/dist/vue/reveal-state.js +76 -0
  304. package/dist/vue/reveal-state.js.map +1 -0
  305. package/dist/vue/theme-provider.d.ts +58 -0
  306. package/dist/vue/theme-provider.d.ts.map +1 -0
  307. package/dist/vue/theme-provider.js +69 -0
  308. package/dist/vue/theme-provider.js.map +1 -0
  309. package/dist/vue/theme.d.ts +1029 -19
  310. package/dist/vue/theme.d.ts.map +1 -1
  311. package/dist/vue/theme.js +47 -2
  312. package/dist/vue/theme.js.map +1 -1
  313. package/dist/vue/time-picker.d.ts +488 -0
  314. package/dist/vue/time-picker.d.ts.map +1 -0
  315. package/dist/vue/time-picker.js +190 -0
  316. package/dist/vue/time-picker.js.map +1 -0
  317. package/dist/vue/toast.d.ts +29 -0
  318. package/dist/vue/toast.d.ts.map +1 -0
  319. package/dist/vue/toast.js +79 -0
  320. package/dist/vue/toast.js.map +1 -0
  321. package/dist/vue/virtual-list.d.ts +26 -0
  322. package/dist/vue/virtual-list.d.ts.map +1 -0
  323. package/dist/vue/virtual-list.js +2 -0
  324. package/dist/vue/virtual-list.js.map +1 -0
  325. package/dist/vue/workflow-props.d.ts +110 -0
  326. package/dist/vue/workflow-props.d.ts.map +1 -0
  327. package/dist/vue/workflow-props.js +37 -0
  328. package/dist/vue/workflow-props.js.map +1 -0
  329. package/dist/vue/workflows.d.ts +267 -0
  330. package/dist/vue/workflows.d.ts.map +1 -0
  331. package/dist/vue/workflows.js +200 -0
  332. package/dist/vue/workflows.js.map +1 -0
  333. package/package.json +5 -1
  334. package/src/accordion.ts +66 -0
  335. package/src/alert.ts +16 -0
  336. package/src/app-icons.ts +57 -0
  337. package/src/avatar.ts +11 -0
  338. package/src/badge.ts +11 -0
  339. package/src/capabilities.ts +171 -0
  340. package/src/chip.ts +20 -0
  341. package/src/choice-motion.ts +12 -0
  342. package/src/choice.ts +41 -0
  343. package/src/collections.ts +87 -0
  344. package/src/combobox.ts +198 -0
  345. package/src/contracts.ts +324 -0
  346. package/src/date-input.ts +87 -0
  347. package/src/date-time.ts +37 -0
  348. package/src/date.ts +280 -0
  349. package/src/dialog.ts +22 -0
  350. package/src/empty-state.ts +4 -0
  351. package/src/experimental-collections.ts +87 -0
  352. package/src/experimental-effects.ts +146 -0
  353. package/src/experimental-platforms.ts +96 -0
  354. package/src/experimental-playback.ts +115 -0
  355. package/src/experimental-regions.ts +777 -0
  356. package/src/experimental-sensors.ts +50 -0
  357. package/src/experimental-surfaces.ts +124 -0
  358. package/src/experimental.ts +1102 -0
  359. package/src/files.ts +408 -0
  360. package/src/form.ts +190 -0
  361. package/src/grid.ts +19 -0
  362. package/src/icon.ts +30 -0
  363. package/src/icons.ts +2002 -0
  364. package/src/index.ts +88 -2
  365. package/src/input.ts +27 -0
  366. package/src/link.ts +91 -0
  367. package/src/list-item.ts +5 -0
  368. package/src/motion.ts +80 -0
  369. package/src/multi-select.ts +30 -0
  370. package/src/navigation-transition.ts +14 -0
  371. package/src/navigation.ts +61 -0
  372. package/src/number-input.ts +80 -0
  373. package/src/popover.ts +38 -0
  374. package/src/progress.ts +22 -0
  375. package/src/responsive.ts +61 -0
  376. package/src/section-scroll.ts +46 -0
  377. package/src/segmented.ts +39 -0
  378. package/src/sheet.ts +31 -0
  379. package/src/tabs.ts +35 -0
  380. package/src/theme/themes.ts +89 -12
  381. package/src/theme/types.ts +55 -2
  382. package/src/theme/typography.ts +84 -0
  383. package/src/time.ts +83 -0
  384. package/src/toast.ts +249 -0
  385. package/src/vue/button-content.ts +60 -0
  386. package/src/vue/cached-activity.ts +13 -0
  387. package/src/vue/combobox.ts +238 -0
  388. package/src/vue/component-props.ts +42 -0
  389. package/src/vue/configurator-props.ts +67 -0
  390. package/src/vue/configurator.ts +350 -0
  391. package/src/vue/contracts.ts +39 -0
  392. package/src/vue/date-calendar.ts +76 -0
  393. package/src/vue/date-picker.ts +410 -0
  394. package/src/vue/date-props.ts +86 -0
  395. package/src/vue/dialog.ts +63 -0
  396. package/src/vue/files.ts +53 -0
  397. package/src/vue/forms.ts +20 -0
  398. package/src/vue/global-components.ts +182 -4
  399. package/src/vue/index.ts +84 -4
  400. package/src/vue/inline-content.ts +71 -0
  401. package/src/vue/layout-context.ts +10 -3
  402. package/src/vue/list-motion.ts +31 -0
  403. package/src/vue/loading-effect.ts +44 -0
  404. package/src/vue/menu.ts +100 -0
  405. package/src/vue/navigation-controls.ts +138 -0
  406. package/src/vue/navigation-props.ts +87 -0
  407. package/src/vue/navigation.ts +16 -0
  408. package/src/vue/platform.ts +73 -0
  409. package/src/vue/props.ts +348 -96
  410. package/src/vue/reveal-state.ts +83 -0
  411. package/src/vue/theme-provider.ts +74 -0
  412. package/src/vue/theme.ts +65 -3
  413. package/src/vue/time-picker.ts +227 -0
  414. package/src/vue/toast.ts +99 -0
  415. package/src/vue/virtual-list.ts +28 -0
  416. package/src/vue/workflow-props.ts +41 -0
  417. package/src/vue/workflows.ts +257 -0
package/src/badge.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { Palette } from './theme/types.js'
2
+ export type BadgeTone = 'neutral' | 'primary' | 'accent' | 'success' | 'warning' | 'danger'
3
+
4
+ export function badgeColors(colors: Readonly<Palette>, tone: BadgeTone) {
5
+ if (tone === 'primary') return { color: colors.primary, backgroundColor: colors.primarySoft }
6
+ if (tone === 'accent') return { color: colors.accent, backgroundColor: colors.accentSoft }
7
+ return {
8
+ color: tone === 'neutral' ? colors.text : colors[tone],
9
+ backgroundColor: colors.elevated,
10
+ }
11
+ }
@@ -0,0 +1,171 @@
1
+ /** Source capabilities, not a promise that every feature is in the last npm release. */
2
+ export const componentNames = [
3
+ 'MScreen',
4
+ 'MRow',
5
+ 'MColumn',
6
+ 'MStack',
7
+ 'MGrid',
8
+ 'MLink',
9
+ 'MBox',
10
+ 'MCard',
11
+ 'MText',
12
+ 'MSpan',
13
+ 'MThemeProvider',
14
+ 'MPlatform',
15
+ 'MIcon',
16
+ 'MButton',
17
+ 'MInput',
18
+ 'MSlider',
19
+ 'MSwitch',
20
+ 'MCheckbox',
21
+ 'MRadioGroup',
22
+ 'MSelect',
23
+ 'MSheet',
24
+ 'MDialog',
25
+ 'MToast',
26
+ 'MTabs',
27
+ 'MChip',
28
+ 'MEmptyState',
29
+ 'MAccordion',
30
+ 'MSegmentedControl',
31
+ 'MSkeleton',
32
+ 'MProgress',
33
+ 'MAlert',
34
+ 'MAvatar',
35
+ 'MBadge',
36
+ 'MListItem',
37
+ 'MSeparator',
38
+ 'MReveal',
39
+ 'MDatePicker',
40
+ 'MDateRangePicker',
41
+ 'MNumberInput',
42
+ 'MMultiSelect',
43
+ 'MImage',
44
+ 'MCombobox',
45
+ 'MFilePicker',
46
+ 'MFormGroup',
47
+ 'MFormErrors',
48
+ 'MSteps',
49
+ 'MPagination',
50
+ 'MPopover',
51
+ 'MMenu',
52
+ 'MAppBar',
53
+ 'MTabBar',
54
+ 'MTimePicker',
55
+ 'MVirtualList',
56
+ ] as const
57
+ export type ComponentName = (typeof componentNames)[number]
58
+ export type CapabilityStatus = 'experimental' | 'planned' | 'unsupported' | 'unverified'
59
+
60
+ export const targetCapabilities = {
61
+ version: 1,
62
+ source: 'repository',
63
+ publishedBaseline: '0.1.0-alpha.10',
64
+ developmentMotion: {
65
+ availability: 'published',
66
+ joltCommit: null,
67
+ publishedJoltRelease: '0.1.0-rc.10',
68
+ features: {
69
+ gradient: ['web', 'ios', 'android'],
70
+ loadingEffects: ['web', 'ios'],
71
+ textEffects: ['web', 'ios', 'android'],
72
+ circularVisibility: ['web', 'ios'],
73
+ retainedScrollHeader: ['web', 'ios', 'android'],
74
+ retainedReorder: ['web', 'ios', 'android'],
75
+ },
76
+ },
77
+ targets: [
78
+ {
79
+ id: 'vue-web',
80
+ framework: 'vue',
81
+ renderer: 'dom',
82
+ status: 'experimental',
83
+ components: componentNames,
84
+ rendering: {
85
+ client: 'experimental',
86
+ serverImport: 'experimental',
87
+ serverHTML: 'experimental',
88
+ hydration: 'experimental',
89
+ ssg: 'experimental',
90
+ streaming: 'unverified',
91
+ rsc: 'unsupported',
92
+ },
93
+ motion: { engine: 'jolt', minimum: '0.1.0-rc.10', start: 'client-mount' },
94
+ ssr: {
95
+ availability: '0.1.0-alpha.5',
96
+ host: 'nuxt',
97
+ hostVersion: '4.6.3',
98
+ vueVersion: '3.5.44',
99
+ nodeVersion: '22.23.3',
100
+ preset: 'node-server',
101
+ deferred: [
102
+ 'sheet-dialog-presentation',
103
+ 'select-popup',
104
+ 'date-calendar',
105
+ 'combobox-results',
106
+ 'file-selection',
107
+ 'toast-presentation',
108
+ 'motion-measurement',
109
+ ],
110
+ preHydrationEditors: [
111
+ 'MInput',
112
+ 'MCheckbox',
113
+ 'MRadioGroup',
114
+ 'MSlider',
115
+ 'MDatePicker',
116
+ 'MDateRangePicker',
117
+ 'MCombobox',
118
+ ],
119
+ },
120
+ },
121
+ {
122
+ id: 'vue-nativescript',
123
+ framework: 'vue',
124
+ renderer: 'nativescript',
125
+ status: 'experimental',
126
+ components: componentNames,
127
+ rendering: {
128
+ client: 'experimental',
129
+ serverImport: 'unsupported',
130
+ serverHTML: 'unsupported',
131
+ hydration: 'unsupported',
132
+ ssg: 'unsupported',
133
+ streaming: 'unsupported',
134
+ rsc: 'unsupported',
135
+ },
136
+ motion: { engine: 'jolt', minimum: '0.1.0-rc.10', start: 'native-loaded' },
137
+ },
138
+ ],
139
+ planned: [
140
+ { id: 'react-web', issue: 145 },
141
+ { id: 'next', issue: 159 },
142
+ { id: 'angular-web', issue: 152 },
143
+ { id: 'svelte-web', issue: 153 },
144
+ { id: 'solid-web', issue: 154 },
145
+ { id: 'react-nativescript', issue: 35 },
146
+ { id: 'angular-nativescript', issue: 36 },
147
+ { id: 'svelte-nativescript', issue: 37 },
148
+ { id: 'solid-nativescript', issue: 38 },
149
+ { id: 'typescript-nativescript', issue: 39 },
150
+ ],
151
+ research: [
152
+ { id: 'react-native', issue: 40 },
153
+ { id: 'flutter', issue: 41 },
154
+ { id: 'swiftui-compose', issue: 42 },
155
+ ],
156
+ } as const
157
+
158
+ export const themeContract = {
159
+ version: 1,
160
+ units: {
161
+ layout: { web: 'css-px', nativescript: 'dip' },
162
+ dimension: ['layout-number', 'percent', 'auto'],
163
+ fontSize: 'layout',
164
+ lineHeight: 'ratio',
165
+ letterSpacing: 'em',
166
+ pressScale: 'multiplier',
167
+ },
168
+ tokens: ['colors', 'space', 'radius', 'typography', 'components', 'elevation', 'motion'],
169
+ fontFamily: ['system', 'shared-family-name', 'platform-family-record'],
170
+ ownership: 'application-or-controlled-scope',
171
+ } as const
package/src/chip.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { Palette } from './theme/types.js'
2
+
3
+ export type ChipTone = 'primary' | 'accent'
4
+
5
+ export function checkChipLabels(label: string, removable: boolean, removeLabel?: string) {
6
+ if (typeof label !== 'string' || !label.trim())
7
+ throw new TypeError('Chip needs a non-empty label.')
8
+ if (removable && (typeof removeLabel !== 'string' || !removeLabel.trim()))
9
+ throw new TypeError('A removable Chip needs a contextual removeLabel.')
10
+ }
11
+
12
+ export function chipColors(colors: Readonly<Palette>, tone: ChipTone, selected: boolean) {
13
+ return {
14
+ color: selected ? colors[tone] : colors.text,
15
+ backgroundColor: selected
16
+ ? colors[tone === 'primary' ? 'primarySoft' : 'accentSoft']
17
+ : colors.surface,
18
+ borderColor: selected ? colors[tone] : colors.border,
19
+ }
20
+ }
@@ -0,0 +1,12 @@
1
+ import type { MavisTheme } from './theme/types.js'
2
+
3
+ /** Paint uses the theme's interaction timing; adapters own surfaces and disposal. */
4
+ export function choiceMotion(theme: Readonly<MavisTheme>) {
5
+ return { type: 'tween' as const, duration: theme.motion.enterDuration, ease: theme.motion.ease }
6
+ }
7
+ export interface ChoicePaint {
8
+ backgroundColor?: string
9
+ borderColor?: string
10
+ color?: string
11
+ borderRadius?: number
12
+ }
package/src/choice.ts ADDED
@@ -0,0 +1,41 @@
1
+ /** Labels can change with the language; values identify the choices. */
2
+ export type ChoiceValue = string | number
3
+ export interface ChoiceOption {
4
+ value: ChoiceValue
5
+ label: string
6
+ helperText?: string
7
+ disabled?: boolean
8
+ }
9
+
10
+ export function isChoiceValue(value: unknown): value is ChoiceValue {
11
+ return typeof value === 'string' || (typeof value === 'number' && Number.isFinite(value))
12
+ }
13
+
14
+ /** A typed key keeps the number 1 distinct from the string "1". */
15
+ export function choiceKey(value: ChoiceValue): string {
16
+ return `${typeof value === 'number' ? 'n' : 's'}:${value}`
17
+ }
18
+
19
+ export function validateChoices(options: readonly ChoiceOption[], value: ChoiceValue | null) {
20
+ if (value !== null && !isChoiceValue(value))
21
+ throw new TypeError('Choice values must be strings, finite numbers or null for no selection.')
22
+ const seen = new Set<ChoiceValue>()
23
+ for (const option of options) {
24
+ if (
25
+ !option ||
26
+ !isChoiceValue(option.value) ||
27
+ typeof option.label !== 'string' ||
28
+ !option.label.trim()
29
+ )
30
+ throw new TypeError(
31
+ 'Each choice needs a string or finite number value and a non-empty label.',
32
+ )
33
+ if (seen.has(option.value)) throw new RangeError(`Duplicate choice value: ${option.value}`)
34
+ seen.add(option.value)
35
+ }
36
+ }
37
+
38
+ /** Disabled and repeated activations leave the controlled value alone. */
39
+ export function canChoose(option: ChoiceOption, value: ChoiceValue | null, disabled = false) {
40
+ return !disabled && !option.disabled && option.value !== value
41
+ }
@@ -0,0 +1,87 @@
1
+ import { choiceKey, type ChoiceValue } from './choice.js'
2
+ import type { IconName } from './icon.js'
3
+ import { linkDestination, type LinkNavigate } from './link.js'
4
+
5
+ export interface MenuAction {
6
+ value: ChoiceValue
7
+ label: string
8
+ icon?: IconName
9
+ disabled?: boolean
10
+ destructive?: boolean
11
+ }
12
+ export type MenuItem =
13
+ MenuAction | { type: 'separator'; key: string } | { type: 'group'; key: string; label: string }
14
+ export interface NavigationItem {
15
+ value: ChoiceValue
16
+ label: string
17
+ href: string
18
+ icon?: IconName
19
+ badge?: string | number
20
+ disabled?: boolean
21
+ navigate?: LinkNavigate
22
+ }
23
+ export function validateMenu(items: readonly MenuItem[]) {
24
+ const keys = new Set<string>()
25
+ for (const item of items) {
26
+ const key = 'type' in item ? `decoration:${item.key}` : choiceKey(item.value)
27
+ if (keys.has(key)) throw new RangeError('Menu items require unique keys.')
28
+ keys.add(key)
29
+ if ((!('type' in item) || item.type === 'group') && !item.label.trim())
30
+ throw new TypeError('Menu actions and groups require labels.')
31
+ }
32
+ }
33
+ export function validateNavigation(items: readonly NavigationItem[]) {
34
+ validateMenu(items)
35
+ items.forEach((item) => linkDestination(item.href))
36
+ }
37
+ export type VirtualItemKey<T = unknown> = string | ((item: T) => ChoiceValue)
38
+ export interface VirtualItemSlot<T = unknown> {
39
+ item: T
40
+ index: number
41
+ itemKey: ChoiceValue
42
+ }
43
+ export interface VirtualListHandle {
44
+ scrollToIndex(index: number): void
45
+ }
46
+ export function virtualKeys<T>(items: readonly T[], itemKey: VirtualItemKey<T>): ChoiceValue[] {
47
+ const seen = new Set<string>()
48
+ return items.map((item) => {
49
+ const key =
50
+ typeof itemKey === 'function' ? itemKey(item) : (item as Record<string, unknown>)?.[itemKey]
51
+ if (
52
+ (typeof key !== 'string' && typeof key !== 'number') ||
53
+ (typeof key === 'number' && !Number.isFinite(key))
54
+ )
55
+ throw new TypeError('Virtual list items require finite number or string keys.')
56
+ const id = choiceKey(key)
57
+ if (seen.has(id)) throw new RangeError('Virtual list keys must be unique.')
58
+ seen.add(id)
59
+ return key
60
+ })
61
+ }
62
+ export function virtualWindow(
63
+ count: number,
64
+ rowHeight: number,
65
+ height: number,
66
+ offset: number,
67
+ overscan = 3,
68
+ ) {
69
+ if (
70
+ !Number.isInteger(count) ||
71
+ count < 0 ||
72
+ !Number.isFinite(rowHeight) ||
73
+ rowHeight <= 0 ||
74
+ !Number.isFinite(height) ||
75
+ height <= 0 ||
76
+ !Number.isInteger(overscan) ||
77
+ overscan < 0 ||
78
+ !Number.isFinite(offset)
79
+ )
80
+ throw new RangeError(
81
+ 'Virtual list requires positive finite dimensions and nonnegative integer overscan.',
82
+ )
83
+ const scrollTop = Math.max(0, Math.min(offset, Math.max(0, count * rowHeight - height)))
84
+ const start = Math.max(0, Math.floor(scrollTop / rowHeight) - overscan)
85
+ const end = Math.min(count, Math.ceil((scrollTop + height) / rowHeight) + overscan)
86
+ return { start, end, scrollTop, totalHeight: count * rowHeight }
87
+ }
@@ -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
+ }