@getcortexlabs/mavis-core 0.1.0-alpha.9 → 0.1.0-rc.12

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 (340) hide show
  1. package/README.md +2 -2
  2. package/dist/capabilities.d.ts +7 -7
  3. package/dist/capabilities.d.ts.map +1 -1
  4. package/dist/capabilities.js +48 -4
  5. package/dist/capabilities.js.map +1 -1
  6. package/dist/chart.d.ts +43 -0
  7. package/dist/chart.d.ts.map +1 -0
  8. package/dist/chart.js +105 -0
  9. package/dist/chart.js.map +1 -0
  10. package/dist/collections.d.ts +46 -0
  11. package/dist/collections.d.ts.map +1 -0
  12. package/dist/collections.js +48 -0
  13. package/dist/collections.js.map +1 -0
  14. package/dist/contracts.d.ts +20 -0
  15. package/dist/contracts.d.ts.map +1 -1
  16. package/dist/contracts.js +2 -0
  17. package/dist/contracts.js.map +1 -1
  18. package/dist/creative-controls.d.ts +47 -0
  19. package/dist/creative-controls.d.ts.map +1 -0
  20. package/dist/creative-controls.js +112 -0
  21. package/dist/creative-controls.js.map +1 -0
  22. package/dist/dashboard.d.ts +72 -0
  23. package/dist/dashboard.d.ts.map +1 -0
  24. package/dist/dashboard.js +115 -0
  25. package/dist/dashboard.js.map +1 -0
  26. package/dist/discovery.d.ts +49 -0
  27. package/dist/discovery.d.ts.map +1 -0
  28. package/dist/discovery.js +80 -0
  29. package/dist/discovery.js.map +1 -0
  30. package/dist/experimental-regions.d.ts +10 -0
  31. package/dist/experimental-regions.d.ts.map +1 -1
  32. package/dist/experimental-regions.js +23 -0
  33. package/dist/experimental-regions.js.map +1 -1
  34. package/dist/experimental.d.ts +5 -0
  35. package/dist/experimental.d.ts.map +1 -1
  36. package/dist/experimental.js +29 -0
  37. package/dist/experimental.js.map +1 -1
  38. package/dist/index.d.ts +15 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +13 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/interactive.d.ts +36 -0
  43. package/dist/interactive.d.ts.map +1 -0
  44. package/dist/interactive.js +61 -0
  45. package/dist/interactive.js.map +1 -0
  46. package/dist/link.d.ts +2 -0
  47. package/dist/link.d.ts.map +1 -1
  48. package/dist/link.js.map +1 -1
  49. package/dist/motion.d.ts +8 -0
  50. package/dist/motion.d.ts.map +1 -1
  51. package/dist/motion.js +11 -0
  52. package/dist/motion.js.map +1 -1
  53. package/dist/navigation-transition.d.ts +10 -0
  54. package/dist/navigation-transition.d.ts.map +1 -0
  55. package/dist/navigation-transition.js +10 -0
  56. package/dist/navigation-transition.js.map +1 -0
  57. package/dist/number-flow-format.d.ts +16 -0
  58. package/dist/number-flow-format.d.ts.map +1 -0
  59. package/dist/number-flow-format.js +49 -0
  60. package/dist/number-flow-format.js.map +1 -0
  61. package/dist/popover.d.ts +17 -0
  62. package/dist/popover.d.ts.map +1 -0
  63. package/dist/popover.js +19 -0
  64. package/dist/popover.js.map +1 -0
  65. package/dist/screen-components.d.ts +45 -0
  66. package/dist/screen-components.d.ts.map +1 -0
  67. package/dist/screen-components.js +23 -0
  68. package/dist/screen-components.js.map +1 -0
  69. package/dist/section-scroll.d.ts +14 -0
  70. package/dist/section-scroll.d.ts.map +1 -0
  71. package/dist/section-scroll.js +28 -0
  72. package/dist/section-scroll.js.map +1 -0
  73. package/dist/time.d.ts +34 -0
  74. package/dist/time.d.ts.map +1 -0
  75. package/dist/time.js +78 -0
  76. package/dist/time.js.map +1 -0
  77. package/dist/vue/animated-text.d.ts +101 -0
  78. package/dist/vue/animated-text.d.ts.map +1 -0
  79. package/dist/vue/animated-text.js +56 -0
  80. package/dist/vue/animated-text.js.map +1 -0
  81. package/dist/vue/carousel.d.ts +13 -0
  82. package/dist/vue/carousel.d.ts.map +1 -0
  83. package/dist/vue/carousel.js +136 -0
  84. package/dist/vue/carousel.js.map +1 -0
  85. package/dist/vue/chart.d.ts +194 -0
  86. package/dist/vue/chart.d.ts.map +1 -0
  87. package/dist/vue/chart.js +245 -0
  88. package/dist/vue/chart.js.map +1 -0
  89. package/dist/vue/command-palette.d.ts +129 -0
  90. package/dist/vue/command-palette.d.ts.map +1 -0
  91. package/dist/vue/command-palette.js +190 -0
  92. package/dist/vue/command-palette.js.map +1 -0
  93. package/dist/vue/component-motion.d.ts +17 -0
  94. package/dist/vue/component-motion.d.ts.map +1 -0
  95. package/dist/vue/component-motion.js +83 -0
  96. package/dist/vue/component-motion.js.map +1 -0
  97. package/dist/vue/component-props.d.ts +1708 -21
  98. package/dist/vue/component-props.d.ts.map +1 -1
  99. package/dist/vue/component-props.js +50 -0
  100. package/dist/vue/component-props.js.map +1 -1
  101. package/dist/vue/composer.d.ts +159 -0
  102. package/dist/vue/composer.d.ts.map +1 -0
  103. package/dist/vue/composer.js +142 -0
  104. package/dist/vue/composer.js.map +1 -0
  105. package/dist/vue/configurator.d.ts +2 -2
  106. package/dist/vue/configurator.d.ts.map +1 -1
  107. package/dist/vue/configurator.js +3 -1
  108. package/dist/vue/configurator.js.map +1 -1
  109. package/dist/vue/creative-controls.d.ts +328 -0
  110. package/dist/vue/creative-controls.d.ts.map +1 -0
  111. package/dist/vue/creative-controls.js +396 -0
  112. package/dist/vue/creative-controls.js.map +1 -0
  113. package/dist/vue/creative-props.d.ts +260 -0
  114. package/dist/vue/creative-props.d.ts.map +1 -0
  115. package/dist/vue/creative-props.js +92 -0
  116. package/dist/vue/creative-props.js.map +1 -0
  117. package/dist/vue/dashboard-charts.d.ts +240 -0
  118. package/dist/vue/dashboard-charts.d.ts.map +1 -0
  119. package/dist/vue/dashboard-charts.js +263 -0
  120. package/dist/vue/dashboard-charts.js.map +1 -0
  121. package/dist/vue/dashboard-effects.d.ts +211 -0
  122. package/dist/vue/dashboard-effects.d.ts.map +1 -0
  123. package/dist/vue/dashboard-effects.js +235 -0
  124. package/dist/vue/dashboard-effects.js.map +1 -0
  125. package/dist/vue/dashboard-props.d.ts +244 -0
  126. package/dist/vue/dashboard-props.d.ts.map +1 -0
  127. package/dist/vue/dashboard-props.js +94 -0
  128. package/dist/vue/dashboard-props.js.map +1 -0
  129. package/dist/vue/data-table.d.ts +17 -0
  130. package/dist/vue/data-table.d.ts.map +1 -0
  131. package/dist/vue/data-table.js +133 -0
  132. package/dist/vue/data-table.js.map +1 -0
  133. package/dist/vue/date-calendar.d.ts +2 -0
  134. package/dist/vue/date-calendar.d.ts.map +1 -1
  135. package/dist/vue/date-calendar.js +20 -1
  136. package/dist/vue/date-calendar.js.map +1 -1
  137. package/dist/vue/date-picker.d.ts +8 -8
  138. package/dist/vue/date-props.d.ts +6 -0
  139. package/dist/vue/date-props.d.ts.map +1 -1
  140. package/dist/vue/date-props.js +3 -0
  141. package/dist/vue/date-props.js.map +1 -1
  142. package/dist/vue/discovery-components.d.ts +50 -0
  143. package/dist/vue/discovery-components.d.ts.map +1 -0
  144. package/dist/vue/discovery-components.js +2 -0
  145. package/dist/vue/discovery-components.js.map +1 -0
  146. package/dist/vue/discovery-controls.d.ts +197 -0
  147. package/dist/vue/discovery-controls.d.ts.map +1 -0
  148. package/dist/vue/discovery-controls.js +185 -0
  149. package/dist/vue/discovery-controls.js.map +1 -0
  150. package/dist/vue/discovery-props.d.ts +249 -0
  151. package/dist/vue/discovery-props.d.ts.map +1 -0
  152. package/dist/vue/discovery-props.js +87 -0
  153. package/dist/vue/discovery-props.js.map +1 -0
  154. package/dist/vue/global-components.d.ts +237 -0
  155. package/dist/vue/global-components.d.ts.map +1 -1
  156. package/dist/vue/index.d.ts +41 -0
  157. package/dist/vue/index.d.ts.map +1 -1
  158. package/dist/vue/index.js +37 -0
  159. package/dist/vue/index.js.map +1 -1
  160. package/dist/vue/interactive-components.d.ts +31 -0
  161. package/dist/vue/interactive-components.d.ts.map +1 -0
  162. package/dist/vue/interactive-components.js +2 -0
  163. package/dist/vue/interactive-components.js.map +1 -0
  164. package/dist/vue/interactive-props.d.ts +254 -0
  165. package/dist/vue/interactive-props.d.ts.map +1 -0
  166. package/dist/vue/interactive-props.js +85 -0
  167. package/dist/vue/interactive-props.js.map +1 -0
  168. package/dist/vue/kanban.d.ts +150 -0
  169. package/dist/vue/kanban.d.ts.map +1 -0
  170. package/dist/vue/kanban.js +267 -0
  171. package/dist/vue/kanban.js.map +1 -0
  172. package/dist/vue/list-motion.d.ts +7 -0
  173. package/dist/vue/list-motion.d.ts.map +1 -0
  174. package/dist/vue/list-motion.js +28 -0
  175. package/dist/vue/list-motion.js.map +1 -0
  176. package/dist/vue/marquee.d.ts +96 -0
  177. package/dist/vue/marquee.d.ts.map +1 -0
  178. package/dist/vue/marquee.js +186 -0
  179. package/dist/vue/marquee.js.map +1 -0
  180. package/dist/vue/menu.d.ts +122 -0
  181. package/dist/vue/menu.d.ts.map +1 -0
  182. package/dist/vue/menu.js +79 -0
  183. package/dist/vue/menu.js.map +1 -0
  184. package/dist/vue/navigation-controls.d.ts +125 -0
  185. package/dist/vue/navigation-controls.d.ts.map +1 -0
  186. package/dist/vue/navigation-controls.js +130 -0
  187. package/dist/vue/navigation-controls.js.map +1 -0
  188. package/dist/vue/navigation-props.d.ts +283 -0
  189. package/dist/vue/navigation-props.d.ts.map +1 -0
  190. package/dist/vue/navigation-props.js +82 -0
  191. package/dist/vue/navigation-props.js.map +1 -0
  192. package/dist/vue/number-flow.d.ts +75 -0
  193. package/dist/vue/number-flow.d.ts.map +1 -0
  194. package/dist/vue/number-flow.js +57 -0
  195. package/dist/vue/number-flow.js.map +1 -0
  196. package/dist/vue/partition.d.ts +15 -0
  197. package/dist/vue/partition.d.ts.map +1 -0
  198. package/dist/vue/partition.js +42 -0
  199. package/dist/vue/partition.js.map +1 -0
  200. package/dist/vue/pin-cell.d.ts +14 -0
  201. package/dist/vue/pin-cell.d.ts.map +1 -0
  202. package/dist/vue/pin-cell.js +19 -0
  203. package/dist/vue/pin-cell.js.map +1 -0
  204. package/dist/vue/pin-input.d.ts +14 -0
  205. package/dist/vue/pin-input.d.ts.map +1 -0
  206. package/dist/vue/pin-input.js +23 -0
  207. package/dist/vue/pin-input.js.map +1 -0
  208. package/dist/vue/platform.d.ts +37 -0
  209. package/dist/vue/platform.d.ts.map +1 -0
  210. package/dist/vue/platform.js +46 -0
  211. package/dist/vue/platform.js.map +1 -0
  212. package/dist/vue/props.d.ts +82 -42
  213. package/dist/vue/props.d.ts.map +1 -1
  214. package/dist/vue/props.js +3 -1
  215. package/dist/vue/props.js.map +1 -1
  216. package/dist/vue/screen-component-props.d.ts +236 -0
  217. package/dist/vue/screen-component-props.d.ts.map +1 -0
  218. package/dist/vue/screen-component-props.js +90 -0
  219. package/dist/vue/screen-component-props.js.map +1 -0
  220. package/dist/vue/scroll-frame.d.ts +223 -0
  221. package/dist/vue/scroll-frame.d.ts.map +1 -0
  222. package/dist/vue/scroll-frame.js +346 -0
  223. package/dist/vue/scroll-frame.js.map +1 -0
  224. package/dist/vue/sortable-list.d.ts +24 -0
  225. package/dist/vue/sortable-list.d.ts.map +1 -0
  226. package/dist/vue/sortable-list.js +251 -0
  227. package/dist/vue/sortable-list.js.map +1 -0
  228. package/dist/vue/speed-dial.d.ts +73 -0
  229. package/dist/vue/speed-dial.d.ts.map +1 -0
  230. package/dist/vue/speed-dial.js +78 -0
  231. package/dist/vue/speed-dial.js.map +1 -0
  232. package/dist/vue/swipe-actions.d.ts +96 -0
  233. package/dist/vue/swipe-actions.d.ts.map +1 -0
  234. package/dist/vue/swipe-actions.js +174 -0
  235. package/dist/vue/swipe-actions.js.map +1 -0
  236. package/dist/vue/swipe-deck.d.ts +120 -0
  237. package/dist/vue/swipe-deck.d.ts.map +1 -0
  238. package/dist/vue/swipe-deck.js +229 -0
  239. package/dist/vue/swipe-deck.js.map +1 -0
  240. package/dist/vue/time-picker.d.ts +488 -0
  241. package/dist/vue/time-picker.d.ts.map +1 -0
  242. package/dist/vue/time-picker.js +190 -0
  243. package/dist/vue/time-picker.js.map +1 -0
  244. package/dist/vue/tour.d.ts +120 -0
  245. package/dist/vue/tour.d.ts.map +1 -0
  246. package/dist/vue/tour.js +165 -0
  247. package/dist/vue/tour.js.map +1 -0
  248. package/dist/vue/tree-view.d.ts +111 -0
  249. package/dist/vue/tree-view.d.ts.map +1 -0
  250. package/dist/vue/tree-view.js +204 -0
  251. package/dist/vue/tree-view.js.map +1 -0
  252. package/dist/vue/virtual-list.d.ts +26 -0
  253. package/dist/vue/virtual-list.d.ts.map +1 -0
  254. package/dist/vue/virtual-list.js +2 -0
  255. package/dist/vue/virtual-list.js.map +1 -0
  256. package/dist/vue/wayfinding-controls.d.ts +199 -0
  257. package/dist/vue/wayfinding-controls.d.ts.map +1 -0
  258. package/dist/vue/wayfinding-controls.js +330 -0
  259. package/dist/vue/wayfinding-controls.js.map +1 -0
  260. package/dist/vue/wayfinding-props.d.ts +221 -0
  261. package/dist/vue/wayfinding-props.d.ts.map +1 -0
  262. package/dist/vue/wayfinding-props.js +86 -0
  263. package/dist/vue/wayfinding-props.js.map +1 -0
  264. package/dist/vue/workflows.d.ts +2 -2
  265. package/dist/vue/workflows.d.ts.map +1 -1
  266. package/dist/vue/workflows.js +17 -4
  267. package/dist/vue/workflows.js.map +1 -1
  268. package/dist/wayfinding.d.ts +50 -0
  269. package/dist/wayfinding.d.ts.map +1 -0
  270. package/dist/wayfinding.js +54 -0
  271. package/dist/wayfinding.js.map +1 -0
  272. package/package.json +2 -2
  273. package/src/capabilities.ts +50 -4
  274. package/src/chart.ts +151 -0
  275. package/src/collections.ts +87 -0
  276. package/src/contracts.ts +2 -0
  277. package/src/creative-controls.ts +169 -0
  278. package/src/dashboard.ts +164 -0
  279. package/src/discovery.ts +139 -0
  280. package/src/experimental-regions.ts +29 -0
  281. package/src/experimental.ts +40 -0
  282. package/src/index.ts +23 -1
  283. package/src/interactive.ts +91 -0
  284. package/src/link.ts +2 -0
  285. package/src/motion.ts +14 -0
  286. package/src/navigation-transition.ts +14 -0
  287. package/src/number-flow-format.ts +68 -0
  288. package/src/popover.ts +38 -0
  289. package/src/screen-components.ts +59 -0
  290. package/src/section-scroll.ts +46 -0
  291. package/src/time.ts +83 -0
  292. package/src/vue/animated-text.ts +72 -0
  293. package/src/vue/carousel.ts +198 -0
  294. package/src/vue/chart.ts +337 -0
  295. package/src/vue/command-palette.ts +235 -0
  296. package/src/vue/component-motion.ts +109 -0
  297. package/src/vue/component-props.ts +104 -0
  298. package/src/vue/composer.ts +192 -0
  299. package/src/vue/configurator.ts +3 -1
  300. package/src/vue/creative-controls.ts +524 -0
  301. package/src/vue/creative-props.ts +94 -0
  302. package/src/vue/dashboard-charts.ts +346 -0
  303. package/src/vue/dashboard-effects.ts +304 -0
  304. package/src/vue/dashboard-props.ts +95 -0
  305. package/src/vue/data-table.ts +190 -0
  306. package/src/vue/date-calendar.ts +30 -1
  307. package/src/vue/date-props.ts +3 -0
  308. package/src/vue/discovery-components.ts +60 -0
  309. package/src/vue/discovery-controls.ts +241 -0
  310. package/src/vue/discovery-props.ts +92 -0
  311. package/src/vue/global-components.ts +237 -0
  312. package/src/vue/index.ts +64 -0
  313. package/src/vue/interactive-components.ts +29 -0
  314. package/src/vue/interactive-props.ts +90 -0
  315. package/src/vue/kanban.ts +360 -0
  316. package/src/vue/list-motion.ts +31 -0
  317. package/src/vue/marquee.ts +248 -0
  318. package/src/vue/menu.ts +100 -0
  319. package/src/vue/navigation-controls.ts +159 -0
  320. package/src/vue/navigation-props.ts +87 -0
  321. package/src/vue/number-flow.ts +83 -0
  322. package/src/vue/partition.ts +49 -0
  323. package/src/vue/pin-cell.ts +26 -0
  324. package/src/vue/pin-input.ts +31 -0
  325. package/src/vue/platform.ts +73 -0
  326. package/src/vue/props.ts +3 -1
  327. package/src/vue/screen-component-props.ts +92 -0
  328. package/src/vue/scroll-frame.ts +429 -0
  329. package/src/vue/sortable-list.ts +308 -0
  330. package/src/vue/speed-dial.ts +108 -0
  331. package/src/vue/swipe-actions.ts +226 -0
  332. package/src/vue/swipe-deck.ts +277 -0
  333. package/src/vue/time-picker.ts +227 -0
  334. package/src/vue/tour.ts +239 -0
  335. package/src/vue/tree-view.ts +259 -0
  336. package/src/vue/virtual-list.ts +28 -0
  337. package/src/vue/wayfinding-controls.ts +430 -0
  338. package/src/vue/wayfinding-props.ts +97 -0
  339. package/src/vue/workflows.ts +17 -4
  340. package/src/wayfinding.ts +85 -0
@@ -0,0 +1,430 @@
1
+ import { useComponentLayout, useComponentState, useComponentSelection } from './component-motion.js'
2
+ import { componentMotion } from '../motion.js'
3
+ import {
4
+ computed,
5
+ defineComponent,
6
+ h,
7
+ markRaw,
8
+ mergeProps,
9
+ nextTick,
10
+ onScopeDispose,
11
+ ref,
12
+ watch,
13
+ type Component,
14
+ type PropType,
15
+ } from '@vue/runtime-core'
16
+ import { choiceKey } from '../choice.js'
17
+ import {
18
+ breadcrumbParts,
19
+ validateRail,
20
+ validateTimeline,
21
+ type TimelineItem,
22
+ } from '../wayfinding.js'
23
+ import { createMotionSurface } from '../experimental.js'
24
+ import { breadcrumbProps, navigationRailProps, timelineProps } from './wayfinding-props.js'
25
+ import { useMavisTheme } from './theme.js'
26
+
27
+ interface Primitives {
28
+ railWidth(read: () => number): Record<string, unknown>
29
+ focus(component: unknown): void
30
+ Row: Component
31
+ Column: Component
32
+ Box: Component
33
+ Text: Component
34
+ Button: Component
35
+ Link: Component
36
+ Icon: Component
37
+ Badge: Component
38
+ Separator: Component
39
+ }
40
+ export function createWayfindingControls(ui: Primitives, platform: 'web' | 'native') {
41
+ const web = platform === 'web'
42
+ const Signal = defineComponent({
43
+ props: { active: Boolean, color: String, size: { type: Number, default: 8 } },
44
+ setup(props) {
45
+ const { theme } = useMavisTheme()
46
+ const motion = markRaw(createMotionSurface())
47
+ const play = () => {
48
+ if (motion.available)
49
+ motion.animate(
50
+ { scale: props.active ? [0.7, 1] : 1, opacity: props.active ? 1 : 0.45 },
51
+ componentMotion(theme.value, 'feedback'),
52
+ )
53
+ }
54
+ onScopeDispose(motion.use(play))
55
+ watch(() => props.active, play)
56
+ return () =>
57
+ h(ui.Box, {
58
+ width: props.size,
59
+ height: props.size,
60
+ radius: 'full',
61
+ backgroundColor: props.color,
62
+ motionSurface: motion,
63
+ accessibilityHidden: true,
64
+ })
65
+ },
66
+ })
67
+ const MNavigationRail = defineComponent({
68
+ name: 'MNavigationRail',
69
+ inheritAttrs: false,
70
+ props: navigationRailProps,
71
+ emits: { 'update:collapsed': (_collapsed: boolean) => true, error: (_error: unknown) => true },
72
+ setup(props, { attrs, slots, emit }) {
73
+ const { theme } = useMavisTheme()
74
+ const selection = useComponentSelection(() => props.modelValue)
75
+ const width = ui.railWidth(() => (props.collapsed ? 80 : 256))
76
+ return () => {
77
+ validateRail(props.groups)
78
+ if (!props.label.trim()) throw new TypeError('Navigation rail requires a label.')
79
+ return h(
80
+ ui.Column,
81
+ mergeProps(
82
+ {
83
+ id: props.id,
84
+ gap: 'lg',
85
+ padding: 'sm',
86
+ radius: 'lg',
87
+ ...width,
88
+ motionRegion: selection.region,
89
+ backgroundColor: theme.value.colors.surface,
90
+ },
91
+ attrs,
92
+ web
93
+ ? {
94
+ class: 'm-navigation-rail',
95
+ role: 'navigation',
96
+ 'aria-label': props.label,
97
+ style: { maxWidth: '100%', border: `1px solid ${theme.value.colors.border}` },
98
+ }
99
+ : {
100
+ accessibilityLabel: props.label,
101
+ borderWidth: 1,
102
+ borderColor: theme.value.colors.border,
103
+ },
104
+ ),
105
+ () => [
106
+ slots.header?.({ collapsed: props.collapsed }),
107
+ ...props.groups.map((group) =>
108
+ h(
109
+ ui.Column,
110
+ {
111
+ key: group.key,
112
+ gap: 'xs',
113
+ ...(web ? { role: 'group', 'aria-label': group.label } : {}),
114
+ },
115
+ () => [
116
+ props.collapsed
117
+ ? h(ui.Separator, { accessibilityHidden: true })
118
+ : h(ui.Text, {
119
+ text: group.label,
120
+ variant: 'overline',
121
+ tone: 'muted',
122
+ paddingX: 'sm',
123
+ }),
124
+ ...group.items.map((item) => {
125
+ const current = item.value === props.modelValue
126
+ const badge = item.badge === undefined ? '' : ` ${item.badge}`
127
+ return h(
128
+ ui.Button,
129
+ {
130
+ key: choiceKey(item.value),
131
+ text: props.collapsed ? undefined : item.label,
132
+ icon: item.icon ?? (props.collapsed ? 'circle' : undefined),
133
+ href: item.href,
134
+ navigate: item.navigate,
135
+ disabled: props.disabled || item.disabled,
136
+ variant: current ? 'secondary' : 'ghost',
137
+ accessibilityLabel: `${item.label}${badge}${current && !web ? `. ${props.currentLabel}` : ''}`,
138
+ ...(web
139
+ ? {
140
+ 'aria-current': current ? 'page' : undefined,
141
+ title: props.collapsed ? `${item.label}${badge}` : undefined,
142
+ style: {
143
+ justifyContent: props.collapsed ? 'center' : 'flex-start',
144
+ minWidth: 0,
145
+ },
146
+ }
147
+ : {}),
148
+ onError: (error: unknown) => emit('error', error),
149
+ },
150
+ {
151
+ leading: !props.collapsed
152
+ ? () =>
153
+ h(ui.Row, { gap: 'sm' }, () => [
154
+ h(ui.Box, {
155
+ motionSurface: current ? selection.marker : undefined,
156
+ width: 6,
157
+ height: 6,
158
+ radius: 'full',
159
+ accessibilityHidden: true,
160
+ backgroundColor: current
161
+ ? theme.value.colors.primary
162
+ : theme.value.colors.border,
163
+ size: 6,
164
+ }),
165
+ item.icon ? h(ui.Icon, { name: item.icon, size: 18 }) : null,
166
+ ])
167
+ : undefined,
168
+ trailing:
169
+ !props.collapsed && item.badge !== undefined
170
+ ? () => [
171
+ web ? ' ' : null,
172
+ h(ui.Badge, {
173
+ text: String(item.badge),
174
+ tone: current ? 'primary' : 'neutral',
175
+ accessibilityHidden: true,
176
+ }),
177
+ ]
178
+ : undefined,
179
+ },
180
+ )
181
+ }),
182
+ ],
183
+ ),
184
+ ),
185
+ slots.footer?.({ collapsed: props.collapsed }),
186
+ props.collapsible
187
+ ? h(ui.Button, {
188
+ text: props.collapsed ? undefined : props.collapseLabel,
189
+ icon: props.collapsed ? 'panel-left-open' : 'panel-left-close',
190
+ accessibilityLabel: props.collapsed ? props.expandLabel : props.collapseLabel,
191
+ variant: 'ghost',
192
+ disabled: props.disabled,
193
+ ...(web ? { 'aria-expanded': !props.collapsed } : {}),
194
+ onClick: () => emit('update:collapsed', !props.collapsed),
195
+ })
196
+ : null,
197
+ ],
198
+ )
199
+ }
200
+ },
201
+ })
202
+ const MBreadcrumb = defineComponent({
203
+ name: 'MBreadcrumb',
204
+ inheritAttrs: false,
205
+ props: breadcrumbProps,
206
+ emits: { error: (_error: unknown) => true },
207
+ setup(props, { attrs, emit }) {
208
+ const expanded = ref(false)
209
+ const layout = useComponentLayout(() => [props.items, expanded.value])
210
+ const links = new Map<string, unknown>()
211
+ watch(
212
+ () => props.items.map((item) => choiceKey(item.key)).join('|'),
213
+ () => {
214
+ expanded.value = false
215
+ },
216
+ )
217
+ return () => {
218
+ if (!props.label.trim()) throw new TypeError('Breadcrumb requires a label.')
219
+ const parts = breadcrumbParts(props.items, props.maxItems)
220
+ const entries =
221
+ expanded.value || !parts.hidden.length
222
+ ? props.items
223
+ : [...parts.before, null, ...parts.after]
224
+ return h(
225
+ ui.Row,
226
+ mergeProps(
227
+ { id: props.id, gap: 'xs', wrap: true, motionRegion: layout },
228
+ attrs,
229
+ web
230
+ ? { class: 'm-breadcrumb', role: 'navigation', 'aria-label': props.label }
231
+ : { accessibilityLabel: props.label },
232
+ ),
233
+ () =>
234
+ entries.flatMap((item, index) => [
235
+ index
236
+ ? h(ui.Icon, {
237
+ key: `separator:${index}`,
238
+ name: 'chevron-right',
239
+ size: 14,
240
+ tone: 'muted',
241
+ accessibilityHidden: true,
242
+ })
243
+ : null,
244
+ item === null
245
+ ? h(ui.Button, {
246
+ key: 'expand',
247
+ icon: 'ellipsis',
248
+ accessibilityLabel: props.expandLabel,
249
+ variant: 'ghost',
250
+ size: 'sm',
251
+ onClick: () => {
252
+ expanded.value = true
253
+ const first = parts.hidden[0]
254
+ if (first) void nextTick(() => ui.focus(links.get(choiceKey(first.key))))
255
+ },
256
+ })
257
+ : item === props.items[props.items.length - 1]
258
+ ? h(ui.Text, {
259
+ key: choiceKey(item.key),
260
+ text: item.label,
261
+ weight: '600',
262
+ shrink: 1,
263
+ ...(web ? { 'aria-current': 'page' } : {}),
264
+ })
265
+ : h(ui.Link, {
266
+ ref: (value: unknown) => {
267
+ if (value) links.set(choiceKey(item.key), value)
268
+ else links.delete(choiceKey(item.key))
269
+ },
270
+ key: choiceKey(item.key),
271
+ text: item.label,
272
+ href: item.href,
273
+ navigate: item.navigate,
274
+ shrink: 1,
275
+ onError: (error: unknown) => emit('error', error),
276
+ }),
277
+ ]),
278
+ )
279
+ }
280
+ },
281
+ })
282
+ const Entry = defineComponent({
283
+ props: {
284
+ item: { type: Object as PropType<TimelineItem>, required: true },
285
+ last: Boolean,
286
+ statusText: String,
287
+ },
288
+ setup(props, { slots }) {
289
+ const { theme } = useMavisTheme()
290
+ const status = computed(() => props.item.status ?? 'complete')
291
+ const color = computed(() =>
292
+ status.value === 'error'
293
+ ? theme.value.colors.danger
294
+ : status.value === 'upcoming'
295
+ ? theme.value.colors.muted
296
+ : theme.value.colors.primary,
297
+ )
298
+ const connector = useComponentState(() => ({
299
+ scaleY: status.value === 'upcoming' ? 0.15 : 1,
300
+ opacity: status.value === 'upcoming' ? 0.3 : 1,
301
+ }))
302
+ const statusMotion = useComponentState(() => ({
303
+ scale: status.value === 'current' ? 1.08 : 1,
304
+ }))
305
+ const motion = markRaw(createMotionSurface())
306
+ onScopeDispose(
307
+ motion.use((owner) => {
308
+ owner.animate({ y: [10, 0] }, componentMotion(theme.value, 'layout'))
309
+ }),
310
+ )
311
+ return () =>
312
+ h(
313
+ ui.Box,
314
+ {
315
+ motionSurface: motion,
316
+ ...(web ? { role: 'listitem', class: 'm-timeline-entry' } : {}),
317
+ },
318
+ () =>
319
+ h(ui.Row, { gap: 'md', align: 'stretch' }, () => [
320
+ h(
321
+ ui.Column,
322
+ { width: 32, align: 'center', gap: 'xs', shrink: 0, accessibilityHidden: true },
323
+ () => [
324
+ h(
325
+ ui.Box,
326
+ {
327
+ width: 32,
328
+ height: 32,
329
+ motionSurface: statusMotion,
330
+ radius: 'full',
331
+ backgroundColor:
332
+ status.value === 'upcoming'
333
+ ? theme.value.colors.surface
334
+ : theme.value.colors.primarySoft,
335
+ },
336
+ () =>
337
+ h(ui.Row, { justify: 'center', height: 32 }, () =>
338
+ h(ui.Icon, {
339
+ name:
340
+ props.item.icon ??
341
+ (status.value === 'complete'
342
+ ? 'check'
343
+ : status.value === 'error'
344
+ ? 'circle-alert'
345
+ : 'circle-dot'),
346
+ size: 16,
347
+ tone:
348
+ status.value === 'error'
349
+ ? 'danger'
350
+ : status.value === 'upcoming'
351
+ ? 'muted'
352
+ : 'primary',
353
+ }),
354
+ ),
355
+ ),
356
+ !props.last
357
+ ? h(ui.Box, {
358
+ width: 2,
359
+ grow: 1,
360
+ motionSurface: connector,
361
+ backgroundColor: theme.value.colors.border,
362
+ height: 24,
363
+ })
364
+ : null,
365
+ ],
366
+ ),
367
+ h(ui.Column, { grow: 1, shrink: 1, gap: 'sm', paddingY: 'xs' }, () => [
368
+ h(ui.Row, { gap: 'sm', wrap: true, justify: 'between' }, () => [
369
+ h(ui.Text, { text: props.item.title, weight: '600', shrink: 1 }),
370
+ props.item.time
371
+ ? h(ui.Text, { text: props.item.time, variant: 'caption', tone: 'muted' })
372
+ : null,
373
+ ]),
374
+ h(ui.Row, { gap: 'xs' }, () => [
375
+ h(Signal, { color: color.value, active: status.value === 'current', size: 6 }),
376
+ h(ui.Text, {
377
+ text: props.statusText,
378
+ variant: 'caption',
379
+ tone: status.value === 'error' ? 'danger' : 'muted',
380
+ }),
381
+ ]),
382
+ props.item.description
383
+ ? h(ui.Text, { text: props.item.description, tone: 'muted' })
384
+ : null,
385
+ slots.default?.(),
386
+ !props.last ? h(ui.Box, { height: 16, accessibilityHidden: true }) : null,
387
+ ]),
388
+ ]),
389
+ )
390
+ },
391
+ })
392
+ const MTimeline = defineComponent({
393
+ name: 'MTimeline',
394
+ inheritAttrs: false,
395
+ props: timelineProps,
396
+ setup(props, { attrs, slots }) {
397
+ const layout = useComponentLayout(() => props.items.map((item) => item.key))
398
+ return () => {
399
+ validateTimeline(props.items)
400
+ if (!props.label.trim()) throw new TypeError('Timeline requires a label.')
401
+ return h(
402
+ ui.Column,
403
+ mergeProps(
404
+ { id: props.id, gap: 'none', motionRegion: layout },
405
+ attrs,
406
+ web
407
+ ? { class: 'm-timeline', role: 'list', 'aria-label': props.label }
408
+ : { accessibilityLabel: props.label },
409
+ ),
410
+ () =>
411
+ props.items.length
412
+ ? props.items.map((item, index) =>
413
+ h(
414
+ Entry,
415
+ {
416
+ key: choiceKey(item.key),
417
+ item,
418
+ last: index === props.items.length - 1,
419
+ statusText: props.statusLabels[item.status ?? 'complete'],
420
+ },
421
+ () => slots.default?.({ item, index }),
422
+ ),
423
+ )
424
+ : h(ui.Text, { text: props.emptyLabel, tone: 'muted' }),
425
+ )
426
+ }
427
+ },
428
+ })
429
+ return { MNavigationRail, MBreadcrumb, MTimeline }
430
+ }
@@ -0,0 +1,97 @@
1
+ import type { PropType } from '@vue/runtime-core'
2
+ import type { ChoiceValue } from '../choice.js'
3
+ import type {
4
+ BreadcrumbItem,
5
+ CommandItem,
6
+ NavigationGroup,
7
+ TimelineItem,
8
+ TimelineStatus,
9
+ } from '../wayfinding.js'
10
+ import type { ChartCategory, ChartSelection, ChartSeries } from '../chart.js'
11
+ import { buttonProps, sheetProps } from './props.js'
12
+ import type { PopoverPlacement } from '../popover.js'
13
+
14
+ const label = { type: String, required: true as const }
15
+ export const commandPaletteProps = {
16
+ id: String,
17
+ label,
18
+ open: Boolean,
19
+ items: { type: Array as PropType<readonly CommandItem[]>, required: true as const },
20
+ query: { type: String, default: undefined },
21
+ disabled: Boolean,
22
+ loading: Boolean,
23
+ /** Opt-in Cmd/Ctrl+K on Web, ignored in editable elements and other modal dialogs. */
24
+ shortcut: Boolean,
25
+ searchLabel: { type: String, default: 'Search commands' },
26
+ placeholder: { type: String, default: 'What would you like to do?' },
27
+ emptyLabel: { type: String, default: 'No matching commands' },
28
+ loadingLabel: { type: String, default: 'Loading commands' },
29
+ closeLabel: { type: String, default: 'Close commands' },
30
+ returnFocus: sheetProps.returnFocus,
31
+ }
32
+ export const navigationRailProps = {
33
+ id: String,
34
+ label,
35
+ groups: { type: Array as PropType<readonly NavigationGroup[]>, required: true as const },
36
+ modelValue: { type: [String, Number] as PropType<ChoiceValue | null>, default: null },
37
+ collapsed: Boolean,
38
+ disabled: Boolean,
39
+ collapsible: { type: Boolean, default: true },
40
+ collapseLabel: { type: String, default: 'Collapse navigation' },
41
+ expandLabel: { type: String, default: 'Expand navigation' },
42
+ currentLabel: { type: String, default: 'Current page' },
43
+ }
44
+ export const breadcrumbProps = {
45
+ id: String,
46
+ label: { type: String, default: 'Breadcrumb' },
47
+ items: { type: Array as PropType<readonly BreadcrumbItem[]>, required: true as const },
48
+ maxItems: { type: Number, default: 4 },
49
+ expandLabel: { type: String, default: 'Show full path' },
50
+ }
51
+ export const tooltipProps = {
52
+ id: String,
53
+ text: label,
54
+ triggerLabel: label,
55
+ icon: { ...buttonProps.icon, default: 'info' },
56
+ variant: { ...buttonProps.variant, default: 'ghost' },
57
+ disabled: Boolean,
58
+ delay: { type: Number, default: 350 },
59
+ placement: { type: String as PropType<PopoverPlacement>, default: 'top-start' },
60
+ }
61
+ export const timelineProps = {
62
+ id: String,
63
+ label,
64
+ items: { type: Array as PropType<readonly TimelineItem[]>, required: true as const },
65
+ emptyLabel: { type: String, default: 'No activity yet' },
66
+ statusLabels: {
67
+ type: Object as PropType<Record<TimelineStatus, string>>,
68
+ default: () => ({
69
+ complete: 'Complete',
70
+ current: 'In progress',
71
+ upcoming: 'Upcoming',
72
+ error: 'Needs attention',
73
+ }),
74
+ },
75
+ }
76
+ export const chartProps = {
77
+ id: String,
78
+ label,
79
+ description: String,
80
+ categories: { type: Array as PropType<readonly ChartCategory[]>, required: true as const },
81
+ series: { type: Array as PropType<readonly ChartSeries[]>, required: true as const },
82
+ type: { type: String as PropType<'line' | 'bar'>, default: 'line' },
83
+ domain: Array as unknown as PropType<readonly [number, number]>,
84
+ height: { type: Number, default: 240 },
85
+ modelValue: { type: Object as PropType<ChartSelection | null>, default: null },
86
+ disabled: Boolean,
87
+ hiddenSeries: { type: Array as PropType<readonly ChoiceValue[]>, default: () => [] },
88
+ formatValue: Function as PropType<(value: number) => string>,
89
+ showData: { type: Boolean, default: false },
90
+ showDataLabel: { type: String, default: 'Show data' },
91
+ hideDataLabel: { type: String, default: 'Hide data' },
92
+ emptyLabel: { type: String, default: 'No chart data' },
93
+ missingLabel: { type: String, default: 'No value' },
94
+ clearLabel: { type: String, default: 'Clear selection' },
95
+ categoryLabel: { type: String, default: 'Category' },
96
+ seriesLabel: { type: String, default: 'Series' },
97
+ }
@@ -1,3 +1,4 @@
1
+ import { useComponentLayout, useComponentContent } from './component-motion.js'
1
2
  import {
2
3
  defineComponent,
3
4
  h,
@@ -32,13 +33,14 @@ export function createWorkflows(ui: Primitives, platform: 'web' | 'native') {
32
33
  props: formGroupProps,
33
34
  setup(props, { attrs, slots }) {
34
35
  const generatedId = `m-form-group-${useId()}`
36
+ const layout = useComponentLayout(() => props.description, false)
35
37
  return () => {
36
38
  if (!props.label.trim()) throw new TypeError('Form groups require a visible label.')
37
39
  const id = props.id ?? generatedId
38
40
  return h(
39
41
  ui.Column,
40
42
  mergeProps(
41
- { gap: 'md', id },
43
+ { gap: 'md', id, motionRegion: layout },
42
44
  attrs,
43
45
  platform === 'web'
44
46
  ? {
@@ -68,6 +70,8 @@ export function createWorkflows(ui: Primitives, platform: 'web' | 'native') {
68
70
  const { theme } = useMavisTheme()
69
71
  const id = `m-form-errors-${useId()}`
70
72
  const revision = shallowRef(0)
73
+ const layout = useComponentLayout(() => revision.value)
74
+ const arrival = useComponentContent(undefined, true)
71
75
  let release: (() => void) | undefined
72
76
  watch(
73
77
  () => props.form,
@@ -88,7 +92,14 @@ export function createWorkflows(ui: Primitives, platform: 'web' | 'native') {
88
92
  return h(
89
93
  ui.Column,
90
94
  mergeProps(
91
- { gap: 'sm', padding: 'md', radius: 'md', backgroundColor: theme.value.colors.surface },
95
+ {
96
+ gap: 'sm',
97
+ padding: 'md',
98
+ radius: 'md',
99
+ backgroundColor: theme.value.colors.surface,
100
+ motionRegion: layout,
101
+ motionSurface: arrival,
102
+ },
92
103
  attrs,
93
104
  platform === 'web'
94
105
  ? { role: props.announce ? 'alert' : 'region', 'aria-labelledby': id }
@@ -120,13 +131,14 @@ export function createWorkflows(ui: Primitives, platform: 'web' | 'native') {
120
131
  props: stepsProps,
121
132
  emits: { 'update:modelValue': (_value: ChoiceValue) => true },
122
133
  setup(props, { attrs, emit }) {
134
+ const layout = useComponentLayout(() => [props.steps, props.modelValue])
123
135
  return () => {
124
136
  if (!props.label.trim()) throw new TypeError('Steps require a navigation label.')
125
137
  validateSteps(props.steps, props.modelValue)
126
138
  return h(
127
139
  ui.Row,
128
140
  mergeProps(
129
- { gap: 'sm', wrap: true },
141
+ { gap: 'sm', wrap: true, motionRegion: layout },
130
142
  attrs,
131
143
  platform === 'web' ? { role: 'navigation', 'aria-label': props.label } : {},
132
144
  ),
@@ -176,6 +188,7 @@ export function createWorkflows(ui: Primitives, platform: 'web' | 'native') {
176
188
  emits: { 'update:modelValue': (_page: number) => true },
177
189
  setup(props, { attrs, emit }) {
178
190
  const root = shallowRef<unknown>()
191
+ const layout = useComponentLayout(() => [props.modelValue, props.total, props.pageSize])
179
192
  const id = `m-pagination-${useId()}`
180
193
  let restore = () => {}
181
194
  onBeforeUpdate(() => {
@@ -212,7 +225,7 @@ export function createWorkflows(ui: Primitives, platform: 'web' | 'native') {
212
225
  : null,
213
226
  state.count === 0 ? h(ui.Text, { tone: 'muted', text: props.emptyLabel }) : null,
214
227
  state.outOfRange ? h(ui.Text, { tone: 'danger', text: props.invalidPageLabel }) : null,
215
- h(ui.Row, { gap: 'sm', wrap: true }, () => [
228
+ h(ui.Row, { gap: 'sm', wrap: true, motionRegion: layout }, () => [
216
229
  h(ui.Button, {
217
230
  variant: 'secondary',
218
231
  text: props.previousLabel,
@@ -0,0 +1,85 @@
1
+ import { collectionKeys } from './discovery.js'
2
+ import type { ChoiceValue } from './choice.js'
3
+ import type { IconName } from './icon.js'
4
+ import { linkDestination, type LinkNavigate } from './link.js'
5
+ import { validateNavigation, type NavigationItem } from './collections.js'
6
+
7
+ export interface CommandItem {
8
+ value: ChoiceValue
9
+ label: string
10
+ description?: string
11
+ keywords?: readonly string[]
12
+ group?: string
13
+ icon?: IconName
14
+ /** Display hint only. Applications own action-specific keyboard shortcuts. */
15
+ shortcut?: string
16
+ disabled?: boolean
17
+ }
18
+ const searchable = (value: string) =>
19
+ value
20
+ .normalize('NFD')
21
+ .replace(/[\u0300-\u036f]/g, '')
22
+ .toLowerCase()
23
+ export function filterCommands(items: readonly CommandItem[], query: string) {
24
+ collectionKeys(items, 'value')
25
+ for (const item of items) if (!item.label.trim()) throw new TypeError('Commands require labels.')
26
+ const terms = searchable(query.trim()).split(/\s+/).filter(Boolean)
27
+ return items.filter((item) => {
28
+ const haystack = searchable(
29
+ [item.label, item.description, item.group, ...(item.keywords ?? [])]
30
+ .filter(Boolean)
31
+ .join(' '),
32
+ )
33
+ return terms.every((term) => haystack.includes(term))
34
+ })
35
+ }
36
+ export interface NavigationGroup {
37
+ key: string
38
+ label: string
39
+ items: readonly NavigationItem[]
40
+ }
41
+ export function validateRail(groups: readonly NavigationGroup[]) {
42
+ collectionKeys(groups, 'key')
43
+ for (const group of groups)
44
+ if (!group.label.trim()) throw new TypeError('Navigation groups require labels.')
45
+ validateNavigation(groups.flatMap((group) => group.items))
46
+ }
47
+ export interface BreadcrumbItem {
48
+ key: ChoiceValue
49
+ label: string
50
+ /** All ancestors require a destination. The last entry is the current page. */
51
+ href?: string
52
+ navigate?: LinkNavigate
53
+ }
54
+ export function breadcrumbParts(items: readonly BreadcrumbItem[], maxItems: number) {
55
+ collectionKeys(items, 'key')
56
+ if (!Number.isInteger(maxItems) || maxItems < 2)
57
+ throw new RangeError('Breadcrumb maxItems must be an integer of at least 2.')
58
+ items.forEach((item, index) => {
59
+ if (!item.label.trim()) throw new TypeError('Breadcrumb entries require labels.')
60
+ if (index < items.length - 1 && !item.href)
61
+ throw new TypeError('Breadcrumb ancestors require destinations.')
62
+ if (item.href !== undefined) linkDestination(item.href)
63
+ })
64
+ if (items.length <= maxItems) return { before: items, hidden: [], after: [] }
65
+ const split = items.length - maxItems + 1
66
+ return { before: items.slice(0, 1), hidden: items.slice(1, split), after: items.slice(split) }
67
+ }
68
+ export type TimelineStatus = 'complete' | 'current' | 'upcoming' | 'error'
69
+ export interface TimelineItem {
70
+ key: ChoiceValue
71
+ title: string
72
+ description?: string
73
+ /** Application-formatted text: no implicit timezone or date parsing. */
74
+ time?: string
75
+ status?: TimelineStatus
76
+ icon?: IconName
77
+ }
78
+ export function validateTimeline(items: readonly TimelineItem[]) {
79
+ collectionKeys(items, 'key')
80
+ for (const item of items) {
81
+ if (!item.title.trim()) throw new TypeError('Timeline entries require titles.')
82
+ if (item.status && !['complete', 'current', 'upcoming', 'error'].includes(item.status))
83
+ throw new TypeError('Unknown timeline status.')
84
+ }
85
+ }