@getcortexlabs/mavis-core 0.1.0-alpha.10 → 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 (100) hide show
  1. package/dist/capabilities.d.ts +7 -7
  2. package/dist/capabilities.d.ts.map +1 -1
  3. package/dist/capabilities.js +16 -4
  4. package/dist/capabilities.js.map +1 -1
  5. package/dist/chart.d.ts +40 -0
  6. package/dist/chart.d.ts.map +1 -0
  7. package/dist/chart.js +73 -0
  8. package/dist/chart.js.map +1 -0
  9. package/dist/discovery.d.ts +49 -0
  10. package/dist/discovery.d.ts.map +1 -0
  11. package/dist/discovery.js +80 -0
  12. package/dist/discovery.js.map +1 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +3 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/vue/carousel.d.ts +11 -0
  18. package/dist/vue/carousel.d.ts.map +1 -0
  19. package/dist/vue/carousel.js +115 -0
  20. package/dist/vue/carousel.js.map +1 -0
  21. package/dist/vue/chart.d.ts +194 -0
  22. package/dist/vue/chart.d.ts.map +1 -0
  23. package/dist/vue/chart.js +246 -0
  24. package/dist/vue/chart.js.map +1 -0
  25. package/dist/vue/command-palette.d.ts +129 -0
  26. package/dist/vue/command-palette.d.ts.map +1 -0
  27. package/dist/vue/command-palette.js +187 -0
  28. package/dist/vue/command-palette.js.map +1 -0
  29. package/dist/vue/component-props.d.ts +475 -18
  30. package/dist/vue/component-props.d.ts.map +1 -1
  31. package/dist/vue/component-props.js +14 -0
  32. package/dist/vue/component-props.js.map +1 -1
  33. package/dist/vue/configurator.d.ts +2 -2
  34. package/dist/vue/data-table.d.ts +17 -0
  35. package/dist/vue/data-table.d.ts.map +1 -0
  36. package/dist/vue/data-table.js +133 -0
  37. package/dist/vue/data-table.js.map +1 -0
  38. package/dist/vue/date-picker.d.ts +8 -8
  39. package/dist/vue/date-props.d.ts +6 -0
  40. package/dist/vue/date-props.d.ts.map +1 -1
  41. package/dist/vue/date-props.js +3 -0
  42. package/dist/vue/date-props.js.map +1 -1
  43. package/dist/vue/discovery-components.d.ts +50 -0
  44. package/dist/vue/discovery-components.d.ts.map +1 -0
  45. package/dist/vue/discovery-components.js +2 -0
  46. package/dist/vue/discovery-components.js.map +1 -0
  47. package/dist/vue/discovery-controls.d.ts +197 -0
  48. package/dist/vue/discovery-controls.d.ts.map +1 -0
  49. package/dist/vue/discovery-controls.js +166 -0
  50. package/dist/vue/discovery-controls.js.map +1 -0
  51. package/dist/vue/discovery-props.d.ts +249 -0
  52. package/dist/vue/discovery-props.d.ts.map +1 -0
  53. package/dist/vue/discovery-props.js +87 -0
  54. package/dist/vue/discovery-props.js.map +1 -0
  55. package/dist/vue/global-components.d.ts +61 -0
  56. package/dist/vue/global-components.d.ts.map +1 -1
  57. package/dist/vue/index.d.ts +10 -0
  58. package/dist/vue/index.d.ts.map +1 -1
  59. package/dist/vue/index.js +9 -0
  60. package/dist/vue/index.js.map +1 -1
  61. package/dist/vue/menu.d.ts +1 -1
  62. package/dist/vue/props.d.ts +36 -36
  63. package/dist/vue/time-picker.d.ts +2 -2
  64. package/dist/vue/tree-view.d.ts +111 -0
  65. package/dist/vue/tree-view.d.ts.map +1 -0
  66. package/dist/vue/tree-view.js +180 -0
  67. package/dist/vue/tree-view.js.map +1 -0
  68. package/dist/vue/wayfinding-controls.d.ts +198 -0
  69. package/dist/vue/wayfinding-controls.d.ts.map +1 -0
  70. package/dist/vue/wayfinding-controls.js +310 -0
  71. package/dist/vue/wayfinding-controls.js.map +1 -0
  72. package/dist/vue/wayfinding-props.d.ts +221 -0
  73. package/dist/vue/wayfinding-props.d.ts.map +1 -0
  74. package/dist/vue/wayfinding-props.js +86 -0
  75. package/dist/vue/wayfinding-props.js.map +1 -0
  76. package/dist/vue/workflows.d.ts +2 -2
  77. package/dist/wayfinding.d.ts +50 -0
  78. package/dist/wayfinding.d.ts.map +1 -0
  79. package/dist/wayfinding.js +54 -0
  80. package/dist/wayfinding.js.map +1 -0
  81. package/package.json +1 -1
  82. package/src/capabilities.ts +16 -4
  83. package/src/chart.ts +112 -0
  84. package/src/discovery.ts +139 -0
  85. package/src/index.ts +5 -0
  86. package/src/vue/carousel.ts +173 -0
  87. package/src/vue/chart.ts +338 -0
  88. package/src/vue/command-palette.ts +232 -0
  89. package/src/vue/component-props.ts +28 -0
  90. package/src/vue/data-table.ts +190 -0
  91. package/src/vue/date-props.ts +3 -0
  92. package/src/vue/discovery-components.ts +60 -0
  93. package/src/vue/discovery-controls.ts +218 -0
  94. package/src/vue/discovery-props.ts +92 -0
  95. package/src/vue/global-components.ts +66 -0
  96. package/src/vue/index.ts +13 -0
  97. package/src/vue/tree-view.ts +220 -0
  98. package/src/vue/wayfinding-controls.ts +412 -0
  99. package/src/vue/wayfinding-props.ts +97 -0
  100. package/src/wayfinding.ts +85 -0
@@ -0,0 +1,338 @@
1
+ import {
2
+ computed,
3
+ defineComponent,
4
+ h,
5
+ markRaw,
6
+ mergeProps,
7
+ onScopeDispose,
8
+ ref,
9
+ watch,
10
+ type Component,
11
+ type PropType,
12
+ } from '@vue/runtime-core'
13
+ import { chartGeometry, type ChartGeometry, type ChartSelection } from '../chart.js'
14
+ import { choiceKey, type ChoiceValue } from '../choice.js'
15
+ import { createMotionSurface } from '../experimental.js'
16
+ import { chartProps } from './wayfinding-props.js'
17
+ import { useMavisTheme } from './theme.js'
18
+
19
+ export const chartPlotProps = {
20
+ geometry: { type: Object as PropType<ChartGeometry>, required: true as const },
21
+ colors: { type: Array as PropType<readonly string[]>, required: true as const },
22
+ type: { type: String as PropType<'line' | 'bar'>, required: true as const },
23
+ height: { type: Number, required: true as const },
24
+ selected: {
25
+ type: Object as PropType<{ category: number; series: number } | null>,
26
+ default: null,
27
+ },
28
+ disabled: Boolean,
29
+ }
30
+ export function createChart(
31
+ ui: {
32
+ Row: Component
33
+ Column: Component
34
+ Box: Component
35
+ Text: Component
36
+ Button: Component
37
+ Reveal: Component
38
+ Select: Component
39
+ Plot: Component
40
+ },
41
+ platform: 'web' | 'native',
42
+ ) {
43
+ return defineComponent({
44
+ name: 'MChart',
45
+ inheritAttrs: false,
46
+ props: chartProps,
47
+ emits: {
48
+ 'update:modelValue': (_selection: ChartSelection | null) => true,
49
+ 'update:hiddenSeries': (_keys: ChoiceValue[]) => true,
50
+ },
51
+ setup(props, { attrs, emit }) {
52
+ const web = platform === 'web'
53
+ const { theme } = useMavisTheme()
54
+ const dataOpen = ref(props.showData)
55
+ watch(
56
+ () => props.showData,
57
+ (value) => {
58
+ dataOpen.value = value
59
+ },
60
+ )
61
+ const allGeometry = computed(() =>
62
+ chartGeometry(props.categories, props.series, props.domain),
63
+ )
64
+ const visible = computed(() =>
65
+ props.series.filter((series) => !props.hiddenSeries.includes(series.key)),
66
+ )
67
+ const geometry = computed(() => ({
68
+ ...allGeometry.value,
69
+ series: allGeometry.value.series.filter(
70
+ (series) => !props.hiddenSeries.includes(series.key),
71
+ ),
72
+ }))
73
+ const selected = computed(() => {
74
+ if (!props.modelValue) return null
75
+ const category = props.categories.findIndex(
76
+ (item) => item.key === props.modelValue!.category,
77
+ )
78
+ const series = visible.value.findIndex((item) => item.key === props.modelValue!.series)
79
+ return category < 0 || series < 0 ? null : { category, series }
80
+ })
81
+ const format = (value: number | null | undefined) =>
82
+ value == null ? props.missingLabel : (props.formatValue?.(value) ?? String(value))
83
+ const colors = computed(() => {
84
+ const palette = [
85
+ theme.value.colors.primary,
86
+ theme.value.colors.accent,
87
+ theme.value.colors.success,
88
+ theme.value.colors.warning,
89
+ theme.value.colors.danger,
90
+ theme.value.colors.muted,
91
+ theme.value.colors.text,
92
+ theme.value.colors.border,
93
+ ]
94
+ return visible.value.map(
95
+ (series) => series.color ?? palette[props.series.indexOf(series) % palette.length]!,
96
+ )
97
+ })
98
+ const summary = computed(() => {
99
+ const point = selected.value
100
+ if (!point) return props.description ?? props.label
101
+ const series = visible.value[point.series]!
102
+ return `${props.categories[point.category]!.label} · ${series.label}: ${format(series.values[point.category])}`
103
+ })
104
+ function choose(category: number, series: number) {
105
+ if (props.disabled || !props.categories[category] || !visible.value[series]) return
106
+ emit('update:modelValue', {
107
+ category: props.categories[category]!.key,
108
+ series: visible.value[series]!.key,
109
+ })
110
+ }
111
+ const surface = markRaw(createMotionSurface())
112
+ function animate() {
113
+ if (surface.available)
114
+ surface.animate(
115
+ { opacity: [0.35, 1], y: [6, 0] },
116
+ { duration: theme.value.motion.enterDuration, ease: 'easeOut' },
117
+ )
118
+ }
119
+ onScopeDispose(surface.use(animate))
120
+ watch(() => [geometry.value, props.type], animate, { flush: 'post' })
121
+ return () => {
122
+ if (!props.label.trim()) throw new TypeError('Chart requires a label.')
123
+ if (!Number.isFinite(props.height) || props.height < 120 || props.height > 800)
124
+ throw new RangeError('Chart height must be between 120 and 800.')
125
+ if (!['line', 'bar'].includes(props.type))
126
+ throw new TypeError('Chart type must be line or bar.')
127
+ // Validate hidden series too; toggling a legend must never reveal invalid data.
128
+ const domain = allGeometry.value
129
+ const hasData = geometry.value.series.some((series) => series.points.some(Boolean))
130
+ return h(
131
+ ui.Column,
132
+ mergeProps({ id: props.id, gap: 'md' }, attrs, {
133
+ class: 'm-chart',
134
+ ...(web ? { role: 'group', 'aria-label': props.label } : {}),
135
+ }),
136
+ () => [
137
+ h(ui.Column, { gap: 'xs' }, () => [
138
+ h(ui.Text, { text: props.label, as: 'h2', variant: 'heading' }),
139
+ props.description
140
+ ? h(ui.Text, { text: props.description, tone: 'muted', variant: 'caption' })
141
+ : null,
142
+ ]),
143
+ h(ui.Row, { gap: 'xs', wrap: true }, () =>
144
+ props.series.map((series) => {
145
+ const shown = !props.hiddenSeries.includes(series.key)
146
+ return h(
147
+ ui.Button,
148
+ {
149
+ key: choiceKey(series.key),
150
+ text: series.label,
151
+ variant: shown ? 'secondary' : 'ghost',
152
+ size: 'sm',
153
+ disabled: props.disabled,
154
+ ...(web
155
+ ? { 'aria-pressed': shown }
156
+ : { accessibilityState: shown ? 'selected' : '' }),
157
+ onClick: () => {
158
+ if (!props.disabled)
159
+ emit(
160
+ 'update:hiddenSeries',
161
+ shown
162
+ ? [...props.hiddenSeries, series.key]
163
+ : props.hiddenSeries.filter((key) => key !== series.key),
164
+ )
165
+ },
166
+ },
167
+ {
168
+ leading: () =>
169
+ h(ui.Box, {
170
+ width: 8,
171
+ height: 8,
172
+ radius: 'full',
173
+ backgroundColor: shown
174
+ ? colors.value[visible.value.indexOf(series)]
175
+ : theme.value.colors.border,
176
+ accessibilityHidden: true,
177
+ }),
178
+ },
179
+ )
180
+ }),
181
+ ),
182
+ // An exact native column prevents measured plot shapes from expanding their own viewport.
183
+ h(
184
+ web ? ui.Row : 'GridLayout',
185
+ web ? { gap: 'xs', align: 'stretch' } : { columns: '56, *', height: props.height },
186
+ () => [
187
+ h(
188
+ ui.Column,
189
+ { col: 0, justify: 'between', width: 56, shrink: 0, height: props.height },
190
+ () =>
191
+ [...domain.ticks].reverse().map((value, index) =>
192
+ h(ui.Text, {
193
+ key: index,
194
+ text: format(value),
195
+ variant: 'caption',
196
+ tone: 'muted',
197
+ align: 'right',
198
+ }),
199
+ ),
200
+ ),
201
+ h(
202
+ ui.Box,
203
+ { col: 1, grow: 1, shrink: 1, height: props.height, motionSurface: surface },
204
+ () =>
205
+ hasData
206
+ ? h(ui.Plot, {
207
+ geometry: geometry.value,
208
+ colors: colors.value,
209
+ type: props.type,
210
+ height: props.height,
211
+ selected: selected.value,
212
+ disabled: props.disabled,
213
+ onSelect: choose,
214
+ })
215
+ : h(
216
+ ui.Column,
217
+ { height: props.height, justify: 'center', align: 'center' },
218
+ () => h(ui.Text, { text: props.emptyLabel, tone: 'muted' }),
219
+ ),
220
+ ),
221
+ ],
222
+ ),
223
+ props.categories.length
224
+ ? h(ui.Row, { justify: 'between', gap: 'sm' }, () => [
225
+ h(ui.Text, {
226
+ text: props.categories[0]!.label,
227
+ variant: 'caption',
228
+ tone: 'muted',
229
+ }),
230
+ props.categories.length > 1
231
+ ? h(ui.Text, {
232
+ text: props.categories[props.categories.length - 1]!.label,
233
+ variant: 'caption',
234
+ tone: 'muted',
235
+ align: 'right',
236
+ })
237
+ : null,
238
+ ])
239
+ : null,
240
+ h(ui.Text, {
241
+ text: summary.value,
242
+ weight: '600',
243
+ ...(web
244
+ ? { role: 'status', 'aria-live': 'polite', 'aria-atomic': 'true' }
245
+ : { accessibilityLiveRegion: 'polite' }),
246
+ }),
247
+ props.categories.length && visible.value.length
248
+ ? h(ui.Row, { gap: 'sm', wrap: true }, () => [
249
+ h(ui.Select, {
250
+ label: props.categoryLabel,
251
+ placeholder: props.categoryLabel,
252
+ grow: 1,
253
+ shrink: 1,
254
+ options: props.categories.map((item) => ({
255
+ value: item.key,
256
+ label: item.label,
257
+ })),
258
+ modelValue: props.modelValue?.category ?? null,
259
+ disabled: props.disabled,
260
+ 'onUpdate:modelValue': (key: ChoiceValue) =>
261
+ choose(
262
+ props.categories.findIndex((item) => item.key === key),
263
+ selected.value?.series ?? 0,
264
+ ),
265
+ }),
266
+ h(ui.Select, {
267
+ label: props.seriesLabel,
268
+ grow: 1,
269
+ shrink: 1,
270
+ options: visible.value.map((item) => ({ value: item.key, label: item.label })),
271
+ modelValue: visible.value[selected.value?.series ?? 0]!.key,
272
+ disabled: props.disabled,
273
+ 'onUpdate:modelValue': (key: ChoiceValue) =>
274
+ choose(
275
+ selected.value?.category ?? 0,
276
+ visible.value.findIndex((item) => item.key === key),
277
+ ),
278
+ }),
279
+ ])
280
+ : null,
281
+ h(ui.Row, { gap: 'sm', wrap: true }, () => [
282
+ h(ui.Button, {
283
+ text: dataOpen.value ? props.hideDataLabel : props.showDataLabel,
284
+ icon: 'table-2',
285
+ variant: 'ghost',
286
+ ...(web ? { 'aria-expanded': dataOpen.value } : {}),
287
+ onClick: () => {
288
+ dataOpen.value = !dataOpen.value
289
+ },
290
+ }),
291
+ selected.value
292
+ ? h(ui.Button, {
293
+ text: props.clearLabel,
294
+ variant: 'ghost',
295
+ disabled: props.disabled,
296
+ onClick: () => {
297
+ if (!props.disabled) emit('update:modelValue', null)
298
+ },
299
+ })
300
+ : null,
301
+ ]),
302
+ h(ui.Reveal, { show: dataOpen.value, gap: 'sm' }, () =>
303
+ h(
304
+ ui.Column,
305
+ { gap: 'sm', ...(web ? { role: 'list', 'aria-label': props.showDataLabel } : {}) },
306
+ () =>
307
+ props.categories.map((category, index) =>
308
+ h(
309
+ ui.Column,
310
+ {
311
+ key: choiceKey(category.key),
312
+ gap: 'xs',
313
+ padding: 'sm',
314
+ radius: 'md',
315
+ backgroundColor: theme.value.colors.surface,
316
+ ...(web ? { role: 'listitem' } : {}),
317
+ },
318
+ () => [
319
+ h(ui.Text, { text: category.label, weight: '600' }),
320
+ ...props.series.map((series) =>
321
+ h(ui.Text, {
322
+ key: choiceKey(series.key),
323
+ text: `${series.label}: ${format(series.values[index])}`,
324
+ variant: 'caption',
325
+ tone: 'muted',
326
+ }),
327
+ ),
328
+ ],
329
+ ),
330
+ ),
331
+ ),
332
+ ),
333
+ ],
334
+ )
335
+ }
336
+ },
337
+ })
338
+ }
@@ -0,0 +1,232 @@
1
+ import {
2
+ computed,
3
+ defineComponent,
4
+ h,
5
+ nextTick,
6
+ onMounted,
7
+ onScopeDispose,
8
+ ref,
9
+ watch,
10
+ type Component,
11
+ } from '@vue/runtime-core'
12
+ import { filterCommands, type CommandItem } from '../wayfinding.js'
13
+ import { choiceKey, type ChoiceValue } from '../choice.js'
14
+ import type { InputHandle } from '../input.js'
15
+ import { commandPaletteProps } from './wayfinding-props.js'
16
+ import { useCachedActivity } from './cached-activity.js'
17
+
18
+ export interface CommandKeyboard {
19
+ key: string
20
+ isComposing?: boolean
21
+ altKey?: boolean
22
+ ctrlKey?: boolean
23
+ metaKey?: boolean
24
+ preventDefault(): void
25
+ }
26
+ export function createCommandPalette(
27
+ ui: {
28
+ Sheet: Component
29
+ Input: Component
30
+ Column: Component
31
+ Row: Component
32
+ Text: Component
33
+ Button: Component
34
+ Badge: Component
35
+ focus(component: unknown): void
36
+ shortcut?(callback: () => void, enabled: () => boolean): () => void
37
+ },
38
+ platform: 'web' | 'native',
39
+ ) {
40
+ return defineComponent({
41
+ name: 'MCommandPalette',
42
+ inheritAttrs: false,
43
+ props: commandPaletteProps,
44
+ emits: {
45
+ 'update:open': (_value: boolean) => true,
46
+ 'update:query': (_value: string) => true,
47
+ select: (_key: ChoiceValue, _item: CommandItem) => true,
48
+ },
49
+ setup(props, { attrs, emit }) {
50
+ const web = platform === 'web'
51
+ const active = useCachedActivity()
52
+ const local = ref('')
53
+ const input = ref<InputHandle>()
54
+ const buttons = new Map<string, unknown>()
55
+ const query = computed(() => props.query ?? local.value)
56
+ const matches = computed(() => filterCommands(props.items, query.value))
57
+ function update(value: string) {
58
+ local.value = value
59
+ emit('update:query', value)
60
+ }
61
+ function select(item: CommandItem) {
62
+ if (!props.open || props.disabled || props.loading || item.disabled) return
63
+ emit('select', item.value, item)
64
+ emit('update:open', false)
65
+ }
66
+ let release = () => {}
67
+ onMounted(() => {
68
+ release =
69
+ ui.shortcut?.(
70
+ () => emit('update:open', !props.open),
71
+ () => active.value && props.shortcut && !props.disabled,
72
+ ) ?? release
73
+ })
74
+ onScopeDispose(() => release())
75
+ watch(
76
+ () => props.open,
77
+ (open) => {
78
+ if (!open && props.query === undefined) local.value = ''
79
+ },
80
+ )
81
+ watch(
82
+ () => props.disabled,
83
+ (disabled) => {
84
+ if (disabled && props.open) emit('update:open', false)
85
+ },
86
+ )
87
+ function keys(event: CommandKeyboard, item?: CommandItem) {
88
+ if (
89
+ event.isComposing ||
90
+ event.altKey ||
91
+ event.ctrlKey ||
92
+ event.metaKey ||
93
+ props.loading ||
94
+ props.disabled
95
+ )
96
+ return
97
+ const available = matches.value.filter((entry) => !entry.disabled)
98
+ if (!available.length) return
99
+ const current = item ? available.findIndex((entry) => entry.value === item.value) : -1
100
+ let next: number
101
+ if (event.key === 'ArrowDown') next = Math.min(current + 1, available.length - 1)
102
+ else if (event.key === 'ArrowUp') next = current < 0 ? available.length - 1 : current - 1
103
+ else if (item && event.key === 'Home') next = 0
104
+ else if (item && event.key === 'End') next = available.length - 1
105
+ else if (!item && event.key === 'Enter') {
106
+ event.preventDefault()
107
+ select(available[0]!)
108
+ return
109
+ } else return
110
+ event.preventDefault()
111
+ if (next < 0) input.value?.focus()
112
+ else ui.focus(buttons.get(choiceKey(available[next]!.value)))
113
+ }
114
+ return () => {
115
+ if (!props.label.trim() || !props.searchLabel.trim())
116
+ throw new TypeError('Command palette requires a title and search label.')
117
+ return h(
118
+ ui.Sheet,
119
+ {
120
+ ...attrs,
121
+ id: props.id,
122
+ open: props.open && !props.disabled,
123
+ title: props.label,
124
+ closeLabel: props.closeLabel,
125
+ returnFocus: props.returnFocus,
126
+ gap: 'md',
127
+ 'onUpdate:open': (open: boolean) => emit('update:open', open),
128
+ },
129
+ () => [
130
+ h(ui.Input, {
131
+ ref: input,
132
+ label: props.searchLabel,
133
+ placeholder: props.placeholder,
134
+ modelValue: query.value,
135
+ disabled: props.disabled,
136
+ 'onUpdate:modelValue': update,
137
+ onSubmit: web
138
+ ? undefined
139
+ : () => {
140
+ const first = matches.value.find((item) => !item.disabled)
141
+ if (first) select(first)
142
+ },
143
+ ...(web
144
+ ? {
145
+ onKeydown: (event: CommandKeyboard) => keys(event),
146
+ onVnodeMounted: () =>
147
+ void nextTick(() => {
148
+ if (props.open) input.value?.focus()
149
+ }),
150
+ }
151
+ : {}),
152
+ }),
153
+ h(
154
+ ui.Column,
155
+ {
156
+ gap: 'xs',
157
+ ...(web
158
+ ? {
159
+ class: 'm-command-results',
160
+ role: 'group',
161
+ 'aria-label': props.label,
162
+ 'aria-busy': props.loading,
163
+ }
164
+ : {}),
165
+ },
166
+ () =>
167
+ props.loading || !matches.value.length
168
+ ? h(ui.Text, {
169
+ text: props.loading ? props.loadingLabel : props.emptyLabel,
170
+ tone: 'muted',
171
+ ...(web ? { role: 'status' } : { accessibilityLiveRegion: 'polite' }),
172
+ })
173
+ : matches.value.flatMap((item, index) => [
174
+ item.group && item.group !== matches.value[index - 1]?.group
175
+ ? h(ui.Text, {
176
+ key: `group:${choiceKey(item.value)}`,
177
+ text: item.group,
178
+ variant: 'overline',
179
+ tone: 'muted',
180
+ })
181
+ : null,
182
+ h(
183
+ ui.Column,
184
+ { key: choiceKey(item.value), gap: 'xs', paddingY: 'xs' },
185
+ () => [
186
+ h(
187
+ ui.Button,
188
+ {
189
+ ref: (value: unknown) => {
190
+ if (value) buttons.set(choiceKey(item.value), value)
191
+ else buttons.delete(choiceKey(item.value))
192
+ },
193
+ text: item.label,
194
+ icon: item.icon,
195
+ variant: 'ghost',
196
+ disabled: item.disabled,
197
+ accessibilityLabel: `${item.label}${item.shortcut ? ` ${item.shortcut}` : ''}`,
198
+ ...(web
199
+ ? {
200
+ style: { justifyContent: 'flex-start' },
201
+ onKeydown: (event: CommandKeyboard) => keys(event, item),
202
+ }
203
+ : {}),
204
+ onClick: () => select(item),
205
+ },
206
+ item.shortcut
207
+ ? {
208
+ trailing: () => [
209
+ web ? ' ' : null,
210
+ h(ui.Badge, { text: item.shortcut, accessibilityHidden: true }),
211
+ ],
212
+ }
213
+ : undefined,
214
+ ),
215
+ item.description
216
+ ? h(ui.Text, {
217
+ text: item.description,
218
+ variant: 'caption',
219
+ tone: 'muted',
220
+ paddingX: 'sm',
221
+ })
222
+ : null,
223
+ ],
224
+ ),
225
+ ]),
226
+ ),
227
+ ],
228
+ )
229
+ }
230
+ },
231
+ })
232
+ }
@@ -1,3 +1,19 @@
1
+ import {
2
+ commandPaletteProps,
3
+ navigationRailProps,
4
+ breadcrumbProps,
5
+ tooltipProps,
6
+ timelineProps,
7
+ chartProps,
8
+ } from './wayfinding-props.js'
9
+ import {
10
+ dataTableProps,
11
+ carouselProps,
12
+ rangeSliderProps,
13
+ calendarProps,
14
+ ratingProps,
15
+ treeViewProps,
16
+ } from './discovery-props.js'
1
17
  import {
2
18
  popoverProps,
3
19
  menuProps,
@@ -18,6 +34,18 @@ import { formGroupProps, formErrorsProps, stepsProps, paginationProps } from './
18
34
  /** Complete registry, kept separate from the primitives used to compose controls. */
19
35
  export const componentProps = {
20
36
  ...foundationProps,
37
+ MCommandPalette: commandPaletteProps,
38
+ MNavigationRail: navigationRailProps,
39
+ MBreadcrumb: breadcrumbProps,
40
+ MTooltip: tooltipProps,
41
+ MTimeline: timelineProps,
42
+ MChart: chartProps,
43
+ MDataTable: dataTableProps,
44
+ MCarousel: carouselProps,
45
+ MRangeSlider: rangeSliderProps,
46
+ MCalendar: calendarProps,
47
+ MRating: ratingProps,
48
+ MTreeView: treeViewProps,
21
49
  MNumberInput: numberInputProps,
22
50
  MMultiSelect: multiSelectProps,
23
51
  MImage: imageProps,