@getcortexlabs/mavis-core 0.1.0-alpha.9 → 0.1.0-rc.11.1
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.
- package/README.md +2 -2
- package/dist/capabilities.d.ts +7 -7
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +29 -4
- package/dist/capabilities.js.map +1 -1
- package/dist/chart.d.ts +43 -0
- package/dist/chart.d.ts.map +1 -0
- package/dist/chart.js +105 -0
- package/dist/chart.js.map +1 -0
- package/dist/collections.d.ts +46 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +48 -0
- package/dist/collections.js.map +1 -0
- package/dist/contracts.d.ts +20 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +2 -0
- package/dist/contracts.js.map +1 -1
- package/dist/discovery.d.ts +49 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +80 -0
- package/dist/discovery.js.map +1 -0
- package/dist/experimental-regions.d.ts +10 -0
- package/dist/experimental-regions.d.ts.map +1 -1
- package/dist/experimental-regions.js +23 -0
- package/dist/experimental-regions.js.map +1 -1
- package/dist/experimental.d.ts +5 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +29 -0
- package/dist/experimental.js.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/interactive.d.ts +36 -0
- package/dist/interactive.d.ts.map +1 -0
- package/dist/interactive.js +61 -0
- package/dist/interactive.js.map +1 -0
- package/dist/link.d.ts +2 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js.map +1 -1
- package/dist/motion.d.ts +8 -0
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +11 -0
- package/dist/motion.js.map +1 -1
- package/dist/navigation-transition.d.ts +10 -0
- package/dist/navigation-transition.d.ts.map +1 -0
- package/dist/navigation-transition.js +10 -0
- package/dist/navigation-transition.js.map +1 -0
- package/dist/number-flow-format.d.ts +16 -0
- package/dist/number-flow-format.d.ts.map +1 -0
- package/dist/number-flow-format.js +49 -0
- package/dist/number-flow-format.js.map +1 -0
- package/dist/popover.d.ts +17 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +19 -0
- package/dist/popover.js.map +1 -0
- package/dist/section-scroll.d.ts +14 -0
- package/dist/section-scroll.d.ts.map +1 -0
- package/dist/section-scroll.js +28 -0
- package/dist/section-scroll.js.map +1 -0
- package/dist/time.d.ts +34 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/time.js +78 -0
- package/dist/time.js.map +1 -0
- package/dist/vue/carousel.d.ts +13 -0
- package/dist/vue/carousel.d.ts.map +1 -0
- package/dist/vue/carousel.js +136 -0
- package/dist/vue/carousel.js.map +1 -0
- package/dist/vue/chart.d.ts +194 -0
- package/dist/vue/chart.d.ts.map +1 -0
- package/dist/vue/chart.js +245 -0
- package/dist/vue/chart.js.map +1 -0
- package/dist/vue/command-palette.d.ts +129 -0
- package/dist/vue/command-palette.d.ts.map +1 -0
- package/dist/vue/command-palette.js +190 -0
- package/dist/vue/command-palette.js.map +1 -0
- package/dist/vue/component-motion.d.ts +17 -0
- package/dist/vue/component-motion.d.ts.map +1 -0
- package/dist/vue/component-motion.js +83 -0
- package/dist/vue/component-motion.js.map +1 -0
- package/dist/vue/component-props.d.ts +1016 -18
- package/dist/vue/component-props.d.ts.map +1 -1
- package/dist/vue/component-props.js +28 -0
- package/dist/vue/component-props.js.map +1 -1
- package/dist/vue/configurator.d.ts +2 -2
- package/dist/vue/configurator.d.ts.map +1 -1
- package/dist/vue/configurator.js +3 -1
- package/dist/vue/configurator.js.map +1 -1
- package/dist/vue/data-table.d.ts +17 -0
- package/dist/vue/data-table.d.ts.map +1 -0
- package/dist/vue/data-table.js +133 -0
- package/dist/vue/data-table.js.map +1 -0
- package/dist/vue/date-calendar.d.ts +2 -0
- package/dist/vue/date-calendar.d.ts.map +1 -1
- package/dist/vue/date-calendar.js +20 -1
- package/dist/vue/date-calendar.js.map +1 -1
- package/dist/vue/date-picker.d.ts +8 -8
- package/dist/vue/date-props.d.ts +6 -0
- package/dist/vue/date-props.d.ts.map +1 -1
- package/dist/vue/date-props.js +3 -0
- package/dist/vue/date-props.js.map +1 -1
- package/dist/vue/discovery-components.d.ts +50 -0
- package/dist/vue/discovery-components.d.ts.map +1 -0
- package/dist/vue/discovery-components.js +2 -0
- package/dist/vue/discovery-components.js.map +1 -0
- package/dist/vue/discovery-controls.d.ts +197 -0
- package/dist/vue/discovery-controls.d.ts.map +1 -0
- package/dist/vue/discovery-controls.js +185 -0
- package/dist/vue/discovery-controls.js.map +1 -0
- package/dist/vue/discovery-props.d.ts +249 -0
- package/dist/vue/discovery-props.d.ts.map +1 -0
- package/dist/vue/discovery-props.js +87 -0
- package/dist/vue/discovery-props.js.map +1 -0
- package/dist/vue/global-components.d.ts +131 -0
- package/dist/vue/global-components.d.ts.map +1 -1
- package/dist/vue/index.d.ts +25 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +21 -0
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/interactive-components.d.ts +31 -0
- package/dist/vue/interactive-components.d.ts.map +1 -0
- package/dist/vue/interactive-components.js +2 -0
- package/dist/vue/interactive-components.js.map +1 -0
- package/dist/vue/interactive-props.d.ts +254 -0
- package/dist/vue/interactive-props.d.ts.map +1 -0
- package/dist/vue/interactive-props.js +85 -0
- package/dist/vue/interactive-props.js.map +1 -0
- package/dist/vue/list-motion.d.ts +7 -0
- package/dist/vue/list-motion.d.ts.map +1 -0
- package/dist/vue/list-motion.js +28 -0
- package/dist/vue/list-motion.js.map +1 -0
- package/dist/vue/menu.d.ts +122 -0
- package/dist/vue/menu.d.ts.map +1 -0
- package/dist/vue/menu.js +79 -0
- package/dist/vue/menu.js.map +1 -0
- package/dist/vue/navigation-controls.d.ts +125 -0
- package/dist/vue/navigation-controls.d.ts.map +1 -0
- package/dist/vue/navigation-controls.js +130 -0
- package/dist/vue/navigation-controls.js.map +1 -0
- package/dist/vue/navigation-props.d.ts +283 -0
- package/dist/vue/navigation-props.d.ts.map +1 -0
- package/dist/vue/navigation-props.js +82 -0
- package/dist/vue/navigation-props.js.map +1 -0
- package/dist/vue/number-flow.d.ts +75 -0
- package/dist/vue/number-flow.d.ts.map +1 -0
- package/dist/vue/number-flow.js +57 -0
- package/dist/vue/number-flow.js.map +1 -0
- package/dist/vue/partition.d.ts +15 -0
- package/dist/vue/partition.d.ts.map +1 -0
- package/dist/vue/partition.js +42 -0
- package/dist/vue/partition.js.map +1 -0
- package/dist/vue/platform.d.ts +37 -0
- package/dist/vue/platform.d.ts.map +1 -0
- package/dist/vue/platform.js +46 -0
- package/dist/vue/platform.js.map +1 -0
- package/dist/vue/props.d.ts +76 -36
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +3 -1
- package/dist/vue/props.js.map +1 -1
- package/dist/vue/sortable-list.d.ts +24 -0
- package/dist/vue/sortable-list.d.ts.map +1 -0
- package/dist/vue/sortable-list.js +251 -0
- package/dist/vue/sortable-list.js.map +1 -0
- package/dist/vue/swipe-actions.d.ts +96 -0
- package/dist/vue/swipe-actions.d.ts.map +1 -0
- package/dist/vue/swipe-actions.js +174 -0
- package/dist/vue/swipe-actions.js.map +1 -0
- package/dist/vue/time-picker.d.ts +488 -0
- package/dist/vue/time-picker.d.ts.map +1 -0
- package/dist/vue/time-picker.js +190 -0
- package/dist/vue/time-picker.js.map +1 -0
- package/dist/vue/tree-view.d.ts +111 -0
- package/dist/vue/tree-view.d.ts.map +1 -0
- package/dist/vue/tree-view.js +204 -0
- package/dist/vue/tree-view.js.map +1 -0
- package/dist/vue/virtual-list.d.ts +26 -0
- package/dist/vue/virtual-list.d.ts.map +1 -0
- package/dist/vue/virtual-list.js +2 -0
- package/dist/vue/virtual-list.js.map +1 -0
- package/dist/vue/wayfinding-controls.d.ts +199 -0
- package/dist/vue/wayfinding-controls.d.ts.map +1 -0
- package/dist/vue/wayfinding-controls.js +330 -0
- package/dist/vue/wayfinding-controls.js.map +1 -0
- package/dist/vue/wayfinding-props.d.ts +221 -0
- package/dist/vue/wayfinding-props.d.ts.map +1 -0
- package/dist/vue/wayfinding-props.js +86 -0
- package/dist/vue/wayfinding-props.js.map +1 -0
- package/dist/vue/workflows.d.ts +2 -2
- package/dist/vue/workflows.d.ts.map +1 -1
- package/dist/vue/workflows.js +17 -4
- package/dist/vue/workflows.js.map +1 -1
- package/dist/wayfinding.d.ts +50 -0
- package/dist/wayfinding.d.ts.map +1 -0
- package/dist/wayfinding.js +54 -0
- package/dist/wayfinding.js.map +1 -0
- package/package.json +2 -2
- package/src/capabilities.ts +30 -4
- package/src/chart.ts +151 -0
- package/src/collections.ts +87 -0
- package/src/contracts.ts +2 -0
- package/src/discovery.ts +139 -0
- package/src/experimental-regions.ts +29 -0
- package/src/experimental.ts +40 -0
- package/src/index.ts +18 -1
- package/src/interactive.ts +91 -0
- package/src/link.ts +2 -0
- package/src/motion.ts +14 -0
- package/src/navigation-transition.ts +14 -0
- package/src/number-flow-format.ts +68 -0
- package/src/popover.ts +38 -0
- package/src/section-scroll.ts +46 -0
- package/src/time.ts +83 -0
- package/src/vue/carousel.ts +198 -0
- package/src/vue/chart.ts +337 -0
- package/src/vue/command-palette.ts +235 -0
- package/src/vue/component-motion.ts +109 -0
- package/src/vue/component-props.ts +57 -0
- package/src/vue/configurator.ts +3 -1
- package/src/vue/data-table.ts +190 -0
- package/src/vue/date-calendar.ts +30 -1
- package/src/vue/date-props.ts +3 -0
- package/src/vue/discovery-components.ts +60 -0
- package/src/vue/discovery-controls.ts +241 -0
- package/src/vue/discovery-props.ts +92 -0
- package/src/vue/global-components.ts +121 -0
- package/src/vue/index.ts +44 -0
- package/src/vue/interactive-components.ts +29 -0
- package/src/vue/interactive-props.ts +90 -0
- package/src/vue/list-motion.ts +31 -0
- package/src/vue/menu.ts +100 -0
- package/src/vue/navigation-controls.ts +159 -0
- package/src/vue/navigation-props.ts +87 -0
- package/src/vue/number-flow.ts +83 -0
- package/src/vue/partition.ts +49 -0
- package/src/vue/platform.ts +73 -0
- package/src/vue/props.ts +3 -1
- package/src/vue/sortable-list.ts +308 -0
- package/src/vue/swipe-actions.ts +226 -0
- package/src/vue/time-picker.ts +227 -0
- package/src/vue/tree-view.ts +259 -0
- package/src/vue/virtual-list.ts +28 -0
- package/src/vue/wayfinding-controls.ts +430 -0
- package/src/vue/wayfinding-props.ts +97 -0
- package/src/vue/workflows.ts +17 -4
- package/src/wayfinding.ts +85 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { PropType } from '@vue/runtime-core'
|
|
2
|
+
import type { ChoiceValue } from '../choice.js'
|
|
3
|
+
import type { VirtualItemKey } from '../collections.js'
|
|
4
|
+
import type { CivilDate, DateRange } from '../date.js'
|
|
5
|
+
import type { DataColumn, DataSort, RangeValue, TreeNode } from '../discovery.js'
|
|
6
|
+
import { datePickerProps } from './date-props.js'
|
|
7
|
+
import { sliderProps } from './props.js'
|
|
8
|
+
|
|
9
|
+
const label = { type: String, required: true as const }
|
|
10
|
+
const keys = { type: Array as PropType<readonly ChoiceValue[]>, default: () => [] }
|
|
11
|
+
export const rangeSliderProps = {
|
|
12
|
+
...sliderProps,
|
|
13
|
+
modelValue: { type: Array as unknown as PropType<RangeValue>, default: () => [0, 100] as const },
|
|
14
|
+
lowerLabel: { type: String, default: 'Minimum' },
|
|
15
|
+
upperLabel: { type: String, default: 'Maximum' },
|
|
16
|
+
formatValue: Function as PropType<(value: number) => string>,
|
|
17
|
+
readonly: Boolean,
|
|
18
|
+
}
|
|
19
|
+
export const ratingProps = {
|
|
20
|
+
label,
|
|
21
|
+
id: String,
|
|
22
|
+
modelValue: { type: Number, default: 0 },
|
|
23
|
+
max: { type: Number, default: 5 },
|
|
24
|
+
step: { type: Number as PropType<1 | 0.5>, default: 1 },
|
|
25
|
+
disabled: Boolean,
|
|
26
|
+
readonly: Boolean,
|
|
27
|
+
clearable: { type: Boolean, default: true },
|
|
28
|
+
clearLabel: { type: String, default: 'Clear rating' },
|
|
29
|
+
formatValue: Function as PropType<(value: number, max: number) => string>,
|
|
30
|
+
}
|
|
31
|
+
export const calendarProps = {
|
|
32
|
+
id: String,
|
|
33
|
+
label,
|
|
34
|
+
mode: { type: String as PropType<'single' | 'range'>, default: 'single' },
|
|
35
|
+
modelValue: { type: [String, Object] as PropType<CivilDate | DateRange | null>, default: null },
|
|
36
|
+
min: datePickerProps.min,
|
|
37
|
+
max: datePickerProps.max,
|
|
38
|
+
unavailableDates: datePickerProps.unavailableDates,
|
|
39
|
+
locale: datePickerProps.locale,
|
|
40
|
+
firstDayOfWeek: datePickerProps.firstDayOfWeek,
|
|
41
|
+
initialMonth: datePickerProps.initialMonth,
|
|
42
|
+
disabled: Boolean,
|
|
43
|
+
readonly: Boolean,
|
|
44
|
+
invalidRangeLabel: { type: String, default: 'This range includes an unavailable date.' },
|
|
45
|
+
}
|
|
46
|
+
export const dataTableProps = {
|
|
47
|
+
id: String,
|
|
48
|
+
label,
|
|
49
|
+
items: { type: Array as PropType<readonly Record<string, unknown>[]>, required: true as const },
|
|
50
|
+
itemKey: {
|
|
51
|
+
type: [String, Function] as PropType<VirtualItemKey<Record<string, unknown>>>,
|
|
52
|
+
default: 'id',
|
|
53
|
+
},
|
|
54
|
+
columns: { type: Array as PropType<readonly DataColumn[]>, required: true as const },
|
|
55
|
+
sort: { type: Object as PropType<DataSort | null>, default: null },
|
|
56
|
+
selected: keys,
|
|
57
|
+
selectable: Boolean,
|
|
58
|
+
disabled: Boolean,
|
|
59
|
+
loading: Boolean,
|
|
60
|
+
rowDisabled: Function as PropType<(item: Record<string, unknown>) => boolean>,
|
|
61
|
+
rowLabel: Function as PropType<(item: Record<string, unknown>) => string>,
|
|
62
|
+
selectLabel: { type: String, default: 'Select' },
|
|
63
|
+
selectAllLabel: { type: String, default: 'Select this page' },
|
|
64
|
+
emptyLabel: { type: String, default: 'No results' },
|
|
65
|
+
loadingLabel: { type: String, default: 'Loading results' },
|
|
66
|
+
}
|
|
67
|
+
export const treeViewProps = {
|
|
68
|
+
id: String,
|
|
69
|
+
label,
|
|
70
|
+
nodes: { type: Array as PropType<readonly TreeNode[]>, required: true as const },
|
|
71
|
+
modelValue: { type: [String, Number] as PropType<ChoiceValue | null>, default: null },
|
|
72
|
+
expanded: keys,
|
|
73
|
+
loadingKeys: keys,
|
|
74
|
+
disabled: Boolean,
|
|
75
|
+
emptyLabel: { type: String, default: 'No items' },
|
|
76
|
+
loadingLabel: { type: String, default: 'Loading' },
|
|
77
|
+
expandedLabel: { type: String, default: 'Expanded' },
|
|
78
|
+
collapsedLabel: { type: String, default: 'Collapsed' },
|
|
79
|
+
}
|
|
80
|
+
export const carouselProps = {
|
|
81
|
+
id: String,
|
|
82
|
+
label,
|
|
83
|
+
items: { type: Array as PropType<readonly unknown[]>, required: true as const },
|
|
84
|
+
itemKey: { type: [String, Function] as PropType<VirtualItemKey>, default: 'id' },
|
|
85
|
+
modelValue: { type: [String, Number] as PropType<ChoiceValue | null>, default: null },
|
|
86
|
+
disabled: Boolean,
|
|
87
|
+
loop: Boolean,
|
|
88
|
+
previousLabel: { type: String, default: 'Previous slide' },
|
|
89
|
+
nextLabel: { type: String, default: 'Next slide' },
|
|
90
|
+
slideLabel: { type: String, default: 'Slide' },
|
|
91
|
+
emptyLabel: { type: String, default: 'No slides' },
|
|
92
|
+
}
|
|
@@ -29,7 +29,103 @@ type SheetEvents = {
|
|
|
29
29
|
/** Template props come from the same declarations used by both renderers. */
|
|
30
30
|
declare module '@vue/runtime-core' {
|
|
31
31
|
export interface GlobalComponents {
|
|
32
|
+
MSortableList: import('./interactive-components.js').SortableListComponent
|
|
33
|
+
MNumberFlow: DefineComponent<ComponentProps['MNumberFlow']>
|
|
34
|
+
MSwipeActions: DefineComponent<
|
|
35
|
+
ComponentProps['MSwipeActions'] & {
|
|
36
|
+
'onUpdate:modelValue'?: (side: import('../interactive.js').SwipeSide) => void
|
|
37
|
+
onAction?: (action: import('../interactive.js').SwipeAction) => void
|
|
38
|
+
}
|
|
39
|
+
> & { new (): { $slots: { default?: () => unknown } } }
|
|
40
|
+
MResizablePanels: DefineComponent<
|
|
41
|
+
ComponentProps['MResizablePanels'] & Model & { onResize?: (value: number) => void }
|
|
42
|
+
> & {
|
|
43
|
+
new (): { $slots: { primary?: () => unknown; secondary?: () => unknown } }
|
|
44
|
+
}
|
|
45
|
+
MImageCompare: DefineComponent<ComponentProps['MImageCompare'] & Model>
|
|
46
|
+
MImageViewer: DefineComponent<
|
|
47
|
+
ComponentProps['MImageViewer'] & {
|
|
48
|
+
'onUpdate:modelValue'?: (key: ChoiceValue) => void
|
|
49
|
+
'onUpdate:open'?: (open: boolean) => void
|
|
50
|
+
onClose?: (reason: string) => void
|
|
51
|
+
onError?: (image: import('../interactive.js').ViewerImage) => void
|
|
52
|
+
}
|
|
53
|
+
>
|
|
54
|
+
|
|
55
|
+
MCommandPalette: DefineComponent<
|
|
56
|
+
ComponentProps['MCommandPalette'] & {
|
|
57
|
+
'onUpdate:open'?: (open: boolean) => void
|
|
58
|
+
'onUpdate:query'?: (query: string) => void
|
|
59
|
+
onSelect?: (key: ChoiceValue, item: import('../wayfinding.js').CommandItem) => void
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
MNavigationRail: DefineComponent<
|
|
63
|
+
ComponentProps['MNavigationRail'] & {
|
|
64
|
+
'onUpdate:collapsed'?: (collapsed: boolean) => void
|
|
65
|
+
onError?: (error: unknown) => void
|
|
66
|
+
}
|
|
67
|
+
> & {
|
|
68
|
+
new (): {
|
|
69
|
+
$slots: {
|
|
70
|
+
header?: (scope: { collapsed: boolean }) => unknown
|
|
71
|
+
footer?: (scope: { collapsed: boolean }) => unknown
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
MBreadcrumb: DefineComponent<
|
|
76
|
+
ComponentProps['MBreadcrumb'] & { onError?: (error: unknown) => void }
|
|
77
|
+
>
|
|
78
|
+
MTooltip: DefineComponent<ComponentProps['MTooltip']>
|
|
79
|
+
MTimeline: DefineComponent<ComponentProps['MTimeline']> & {
|
|
80
|
+
new (): {
|
|
81
|
+
$slots: {
|
|
82
|
+
default?: (scope: {
|
|
83
|
+
item: import('../wayfinding.js').TimelineItem
|
|
84
|
+
index: number
|
|
85
|
+
}) => unknown
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
MChart: DefineComponent<
|
|
90
|
+
ComponentProps['MChart'] & {
|
|
91
|
+
'onUpdate:modelValue'?: (value: import('../chart.js').ChartSelection | null) => void
|
|
92
|
+
'onUpdate:hiddenSeries'?: (keys: ChoiceValue[]) => void
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
|
|
96
|
+
MPopover: DefineComponent<
|
|
97
|
+
ComponentProps['MPopover'] & {
|
|
98
|
+
'onUpdate:open'?: (open: boolean) => void
|
|
99
|
+
onClose?: (reason: import('../popover.js').PopoverCloseReason) => void
|
|
100
|
+
onOpened?: () => void
|
|
101
|
+
}
|
|
102
|
+
> & { new (): { $slots: { default?: (scope: { close(): void }) => unknown } } }
|
|
103
|
+
MMenu: DefineComponent<
|
|
104
|
+
ComponentProps['MMenu'] & {
|
|
105
|
+
'onUpdate:open'?: (open: boolean) => void
|
|
106
|
+
onClose?: (reason: import('../popover.js').PopoverCloseReason) => void
|
|
107
|
+
onSelect?: (value: ChoiceValue, item: import('../collections.js').MenuAction) => void
|
|
108
|
+
}
|
|
109
|
+
>
|
|
110
|
+
MAppBar: DefineComponent<
|
|
111
|
+
ComponentProps['MAppBar'] & { onBack?: () => void; onError?: (error: unknown) => void }
|
|
112
|
+
> & {
|
|
113
|
+
new (): { $slots: { leading?: () => unknown; actions?: () => unknown } }
|
|
114
|
+
}
|
|
115
|
+
MTabBar: DefineComponent<ComponentProps['MTabBar'] & { onError?: (error: unknown) => void }>
|
|
116
|
+
MTimePicker: DefineComponent<
|
|
117
|
+
ComponentProps['MTimePicker'] & {
|
|
118
|
+
'onUpdate:modelValue'?: (value: string | null) => void
|
|
119
|
+
'onUpdate:draft'?: (value: string) => void
|
|
120
|
+
onValidityChange?: (value: import('../time.js').TimeValidation) => void
|
|
121
|
+
onFocus?: () => void
|
|
122
|
+
onBlur?: () => void
|
|
123
|
+
},
|
|
124
|
+
InputHandle
|
|
125
|
+
>
|
|
126
|
+
MVirtualList: import('./virtual-list.js').VirtualListComponent
|
|
32
127
|
MThemeProvider: typeof import('./theme-provider.js').MThemeProvider
|
|
128
|
+
MPlatform: typeof import('./platform.js').MPlatform
|
|
33
129
|
MSpan: typeof import('./inline-content.js').MSpan
|
|
34
130
|
MDatePicker: DefineComponent<
|
|
35
131
|
ComponentProps['MDatePicker'] & {
|
|
@@ -88,6 +184,31 @@ declare module '@vue/runtime-core' {
|
|
|
88
184
|
MPagination: DefineComponent<
|
|
89
185
|
ComponentProps['MPagination'] & { 'onUpdate:modelValue'?: (value: number) => void }
|
|
90
186
|
>
|
|
187
|
+
MDataTable: import('./discovery-components.js').DataTableComponent
|
|
188
|
+
MCarousel: import('./discovery-components.js').CarouselComponent
|
|
189
|
+
MRangeSlider: DefineComponent<
|
|
190
|
+
ComponentProps['MRangeSlider'] & {
|
|
191
|
+
'onUpdate:modelValue'?: (value: import('../discovery.js').RangeValue) => void
|
|
192
|
+
}
|
|
193
|
+
>
|
|
194
|
+
MCalendar: DefineComponent<
|
|
195
|
+
ComponentProps['MCalendar'] & {
|
|
196
|
+
'onUpdate:modelValue'?: (
|
|
197
|
+
value: import('../date.js').CivilDate | import('../date.js').DateRange | null,
|
|
198
|
+
) => void
|
|
199
|
+
onInvalid?: () => void
|
|
200
|
+
}
|
|
201
|
+
> & { new (): { $slots: { footer?: () => unknown } } }
|
|
202
|
+
MRating: DefineComponent<
|
|
203
|
+
ComponentProps['MRating'] & { 'onUpdate:modelValue'?: (value: number) => void }
|
|
204
|
+
>
|
|
205
|
+
MTreeView: DefineComponent<
|
|
206
|
+
ComponentProps['MTreeView'] & {
|
|
207
|
+
'onUpdate:modelValue'?: (key: ChoiceValue) => void
|
|
208
|
+
'onUpdate:expanded'?: (keys: ChoiceValue[]) => void
|
|
209
|
+
onLoad?: (node: import('../discovery.js').TreeNode) => void
|
|
210
|
+
}
|
|
211
|
+
>
|
|
91
212
|
MScreen: DefineComponent<ComponentProps['MScreen']>
|
|
92
213
|
MRow: DefineComponent<ComponentProps['MRow']>
|
|
93
214
|
MColumn: DefineComponent<ComponentProps['MColumn']>
|
package/src/vue/index.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
export { createThemeContext, themeKey, useMavisTheme } from './theme.js'
|
|
2
|
+
export { useMavisListMotion } from './list-motion.js'
|
|
3
|
+
export {
|
|
4
|
+
useComponentState,
|
|
5
|
+
useComponentLayout,
|
|
6
|
+
useComponentSelection,
|
|
7
|
+
useComponentContent,
|
|
8
|
+
isComponentMotionRegion,
|
|
9
|
+
} from './component-motion.js'
|
|
10
|
+
export {
|
|
11
|
+
MPlatform,
|
|
12
|
+
useMavisPlatform,
|
|
13
|
+
platformProps,
|
|
14
|
+
platformKey,
|
|
15
|
+
createPlatformContext,
|
|
16
|
+
} from './platform.js'
|
|
17
|
+
export type { MavisPlatform, MavisPlatformTarget, MavisPlatformContext } from './platform.js'
|
|
2
18
|
export type {
|
|
3
19
|
MavisThemeContext,
|
|
4
20
|
Appearance,
|
|
@@ -86,3 +102,31 @@ export * from './configurator-props.js'
|
|
|
86
102
|
export * from './configurator.js'
|
|
87
103
|
export { useLoadingDecoration } from './loading-effect.js'
|
|
88
104
|
export { navigationKey, useMavisNavigation, useNavigationOptions } from './navigation.js'
|
|
105
|
+
|
|
106
|
+
export * from './navigation-props.js'
|
|
107
|
+
export * from './navigation-controls.js'
|
|
108
|
+
export * from './menu.js'
|
|
109
|
+
export * from './time-picker.js'
|
|
110
|
+
|
|
111
|
+
export type { VirtualListComponent } from './virtual-list.js'
|
|
112
|
+
|
|
113
|
+
export * from './discovery-props.js'
|
|
114
|
+
export * from './discovery-controls.js'
|
|
115
|
+
export * from './carousel.js'
|
|
116
|
+
export * from './tree-view.js'
|
|
117
|
+
export * from './data-table.js'
|
|
118
|
+
|
|
119
|
+
export type { CarouselComponent, DataTableComponent } from './discovery-components.js'
|
|
120
|
+
|
|
121
|
+
export * from './wayfinding-props.js'
|
|
122
|
+
export * from './wayfinding-controls.js'
|
|
123
|
+
export * from './command-palette.js'
|
|
124
|
+
export * from './chart.js'
|
|
125
|
+
|
|
126
|
+
export * from './interactive-props.js'
|
|
127
|
+
export * from './number-flow.js'
|
|
128
|
+
export * from './sortable-list.js'
|
|
129
|
+
export * from './swipe-actions.js'
|
|
130
|
+
export * from './partition.js'
|
|
131
|
+
|
|
132
|
+
export type { SortableListComponent } from './interactive-components.js'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PublicProps, VNode, VNodeChild } from '@vue/runtime-core'
|
|
2
|
+
import type { ChoiceValue } from '../choice.js'
|
|
3
|
+
import type { SortableMove } from '../interactive.js'
|
|
4
|
+
import type { ComponentProps } from './component-props.js'
|
|
5
|
+
type SortableProps<T> = PublicProps &
|
|
6
|
+
Omit<ComponentProps['MSortableList'], 'modelValue' | 'itemKey' | 'itemLabel'> & {
|
|
7
|
+
modelValue: readonly T[]
|
|
8
|
+
itemKey?: Extract<keyof T, string> | ((item: T) => ChoiceValue)
|
|
9
|
+
itemLabel?: (item: T) => string
|
|
10
|
+
'onUpdate:modelValue'?: (items: T[]) => void
|
|
11
|
+
onReorder?: (move: SortableMove) => void
|
|
12
|
+
}
|
|
13
|
+
interface SortableContext<T> {
|
|
14
|
+
props: SortableProps<T>
|
|
15
|
+
attrs: Record<string, unknown>
|
|
16
|
+
emit: (event: string, ...args: unknown[]) => void
|
|
17
|
+
slots: {
|
|
18
|
+
default?: (scope: { item: T; index: number; itemKey: ChoiceValue }) => VNodeChild
|
|
19
|
+
empty?: () => VNodeChild
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export interface SortableListComponent {
|
|
23
|
+
<T>(
|
|
24
|
+
props: NonNullable<Awaited<typeof setup>>['props'],
|
|
25
|
+
context?: Pick<NonNullable<Awaited<typeof setup>>, 'attrs' | 'emit' | 'slots'>,
|
|
26
|
+
exposed?: undefined,
|
|
27
|
+
setup?: Promise<SortableContext<T>>,
|
|
28
|
+
): VNode & { __ctx?: NonNullable<Awaited<typeof setup>> }
|
|
29
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { PropType } from '@vue/runtime-core'
|
|
2
|
+
import type { ChoiceValue } from '../choice.js'
|
|
3
|
+
import type { VirtualItemKey } from '../collections.js'
|
|
4
|
+
import type { SwipeAction, SwipeSide, ViewerImage } from '../interactive.js'
|
|
5
|
+
import type { NumberFlowFormat } from '../number-flow-format.js'
|
|
6
|
+
import { textProps } from './props.js'
|
|
7
|
+
|
|
8
|
+
const label = { type: String, required: true as const }
|
|
9
|
+
export const numberFlowProps = {
|
|
10
|
+
id: String,
|
|
11
|
+
value: { type: Number, required: true as const },
|
|
12
|
+
locale: { type: String, default: 'en-US' },
|
|
13
|
+
format: Object as PropType<NumberFlowFormat>,
|
|
14
|
+
formatValue: Function as PropType<(value: number) => string>,
|
|
15
|
+
label: String,
|
|
16
|
+
variant: { ...textProps.variant, default: 'title' },
|
|
17
|
+
tone: textProps.tone,
|
|
18
|
+
duration: { type: Number, default: 650 },
|
|
19
|
+
animated: { type: Boolean, default: true },
|
|
20
|
+
announce: Boolean,
|
|
21
|
+
}
|
|
22
|
+
export const sortableListProps = {
|
|
23
|
+
id: String,
|
|
24
|
+
label,
|
|
25
|
+
modelValue: { type: Array as PropType<readonly unknown[]>, required: true as const },
|
|
26
|
+
itemKey: { type: [String, Function] as PropType<VirtualItemKey>, default: 'id' },
|
|
27
|
+
itemLabel: Function as PropType<(item: unknown) => string>,
|
|
28
|
+
height: { type: Number, default: 360 },
|
|
29
|
+
disabled: Boolean,
|
|
30
|
+
handleLabel: { type: String, default: 'Reorder' },
|
|
31
|
+
moveUpLabel: { type: String, default: 'Move up' },
|
|
32
|
+
moveDownLabel: { type: String, default: 'Move down' },
|
|
33
|
+
emptyLabel: { type: String, default: 'No items' },
|
|
34
|
+
}
|
|
35
|
+
export const swipeActionsProps = {
|
|
36
|
+
label,
|
|
37
|
+
modelValue: { type: String as PropType<SwipeSide>, default: null },
|
|
38
|
+
start: { type: Array as PropType<readonly SwipeAction[]>, default: () => [] },
|
|
39
|
+
end: { type: Array as PropType<readonly SwipeAction[]>, default: () => [] },
|
|
40
|
+
disabled: Boolean,
|
|
41
|
+
actionWidth: { type: Number, default: 96 },
|
|
42
|
+
direction: { type: String as PropType<'ltr' | 'rtl'>, default: 'ltr' },
|
|
43
|
+
actionsLabel: { type: String, default: 'Actions' },
|
|
44
|
+
closeLabel: { type: String, default: 'Close actions' },
|
|
45
|
+
}
|
|
46
|
+
export const resizablePanelsProps = {
|
|
47
|
+
id: String,
|
|
48
|
+
label,
|
|
49
|
+
modelValue: { type: Number, default: 40 },
|
|
50
|
+
min: { type: Number, default: 20 },
|
|
51
|
+
max: { type: Number, default: 80 },
|
|
52
|
+
step: { type: Number, default: 2 },
|
|
53
|
+
snap: { type: Array as PropType<readonly number[]>, default: () => [25, 50, 75] },
|
|
54
|
+
orientation: { type: String as PropType<'horizontal' | 'vertical'>, default: 'horizontal' },
|
|
55
|
+
direction: { type: String as PropType<'ltr' | 'rtl'>, default: 'ltr' },
|
|
56
|
+
height: { type: Number, default: 360 },
|
|
57
|
+
collapsible: Boolean,
|
|
58
|
+
disabled: Boolean,
|
|
59
|
+
primaryLabel: { type: String, default: 'First panel' },
|
|
60
|
+
secondaryLabel: { type: String, default: 'Second panel' },
|
|
61
|
+
collapseLabel: { type: String, default: 'Collapse panel' },
|
|
62
|
+
expandLabel: { type: String, default: 'Expand panel' },
|
|
63
|
+
}
|
|
64
|
+
export const imageCompareProps = {
|
|
65
|
+
label,
|
|
66
|
+
before: { type: String, required: true as const },
|
|
67
|
+
after: { type: String, required: true as const },
|
|
68
|
+
beforeLabel: { type: String, default: 'Before' },
|
|
69
|
+
afterLabel: { type: String, default: 'After' },
|
|
70
|
+
modelValue: { type: Number, default: 50 },
|
|
71
|
+
step: { type: Number, default: 1 },
|
|
72
|
+
aspectRatio: { type: Number, default: 1.5 },
|
|
73
|
+
orientation: { type: String as PropType<'horizontal' | 'vertical'>, default: 'horizontal' },
|
|
74
|
+
disabled: Boolean,
|
|
75
|
+
}
|
|
76
|
+
export const imageViewerProps = {
|
|
77
|
+
label,
|
|
78
|
+
images: { type: Array as PropType<readonly ViewerImage[]>, required: true as const },
|
|
79
|
+
modelValue: { type: [String, Number] as PropType<ChoiceValue | null>, default: null },
|
|
80
|
+
open: Boolean,
|
|
81
|
+
maxZoom: { type: Number, default: 4 },
|
|
82
|
+
disabled: Boolean,
|
|
83
|
+
closeLabel: { type: String, default: 'Close viewer' },
|
|
84
|
+
previousLabel: { type: String, default: 'Previous image' },
|
|
85
|
+
nextLabel: { type: String, default: 'Next image' },
|
|
86
|
+
zoomInLabel: { type: String, default: 'Zoom in' },
|
|
87
|
+
zoomOutLabel: { type: String, default: 'Zoom out' },
|
|
88
|
+
resetLabel: { type: String, default: 'Reset zoom' },
|
|
89
|
+
errorLabel: { type: String, default: 'Image unavailable' },
|
|
90
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { markRaw, onScopeDispose } from '@vue/runtime-core'
|
|
2
|
+
import {
|
|
3
|
+
createMotionRegion,
|
|
4
|
+
type MotionLayoutOptions,
|
|
5
|
+
type MotionPlayback,
|
|
6
|
+
} from '../experimental.js'
|
|
7
|
+
|
|
8
|
+
/** Shared Vue data changes; the host measures keyed direct children and Jolt owns playback. */
|
|
9
|
+
export function useMavisListMotion(options: MotionLayoutOptions = {}) {
|
|
10
|
+
const region = markRaw(createMotionRegion())
|
|
11
|
+
let active: MotionPlayback | undefined
|
|
12
|
+
let disposed = false
|
|
13
|
+
onScopeDispose(() => {
|
|
14
|
+
disposed = true
|
|
15
|
+
active?.stop()
|
|
16
|
+
})
|
|
17
|
+
return {
|
|
18
|
+
region,
|
|
19
|
+
update(change: () => void): MotionPlayback {
|
|
20
|
+
if (disposed) throw new Error('This list motion scope is disposed.')
|
|
21
|
+
if (typeof change !== 'function')
|
|
22
|
+
throw new TypeError('List motion needs a synchronous data change.')
|
|
23
|
+
if (!region.available) {
|
|
24
|
+
change()
|
|
25
|
+
return { finished: Promise.resolve(false), stop() {} }
|
|
26
|
+
}
|
|
27
|
+
active = region.animateLayout(change, options)
|
|
28
|
+
return active
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/vue/menu.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineComponent, h, type Component } from '@vue/runtime-core'
|
|
2
|
+
import { choiceKey, type ChoiceValue } from '../choice.js'
|
|
3
|
+
import { validateMenu, type MenuAction } from '../collections.js'
|
|
4
|
+
import type { PopoverCloseReason } from '../popover.js'
|
|
5
|
+
import { menuProps } from './navigation-props.js'
|
|
6
|
+
import { MThemeProvider } from './theme-provider.js'
|
|
7
|
+
import { useMavisTheme } from './theme.js'
|
|
8
|
+
|
|
9
|
+
export function createMenu(
|
|
10
|
+
ui: {
|
|
11
|
+
Popover: Component
|
|
12
|
+
Column: Component
|
|
13
|
+
Text: Component
|
|
14
|
+
Button: Component
|
|
15
|
+
Separator: Component
|
|
16
|
+
},
|
|
17
|
+
keyboard?: (event: unknown) => void,
|
|
18
|
+
) {
|
|
19
|
+
return defineComponent({
|
|
20
|
+
name: 'MMenu',
|
|
21
|
+
inheritAttrs: false,
|
|
22
|
+
props: menuProps,
|
|
23
|
+
emits: {
|
|
24
|
+
'update:open': (_open: boolean) => true,
|
|
25
|
+
select: (_value: ChoiceValue, _item: MenuAction) => true,
|
|
26
|
+
close: (_reason: PopoverCloseReason) => true,
|
|
27
|
+
},
|
|
28
|
+
setup(props, { attrs, emit }) {
|
|
29
|
+
const { theme } = useMavisTheme()
|
|
30
|
+
return () => {
|
|
31
|
+
validateMenu(props.items)
|
|
32
|
+
const { items: _items, ...presentation } = props
|
|
33
|
+
return h(
|
|
34
|
+
ui.Popover,
|
|
35
|
+
{
|
|
36
|
+
...attrs,
|
|
37
|
+
...presentation,
|
|
38
|
+
role: 'menu',
|
|
39
|
+
padding: 'xs',
|
|
40
|
+
'onUpdate:open': (open: boolean) => emit('update:open', open),
|
|
41
|
+
onClose: (reason: PopoverCloseReason) => emit('close', reason),
|
|
42
|
+
},
|
|
43
|
+
() =>
|
|
44
|
+
h(ui.Column, { gap: 'xs', ...(keyboard ? { onKeydown: keyboard } : {}) }, () =>
|
|
45
|
+
props.items.map((item) => {
|
|
46
|
+
if ('type' in item)
|
|
47
|
+
return item.type === 'separator'
|
|
48
|
+
? h(ui.Separator, { key: `decoration:${item.key}` })
|
|
49
|
+
: h(ui.Text, {
|
|
50
|
+
key: `decoration:${item.key}`,
|
|
51
|
+
text: item.label,
|
|
52
|
+
accessibilityLabel: item.label,
|
|
53
|
+
variant: 'overline',
|
|
54
|
+
tone: 'muted',
|
|
55
|
+
})
|
|
56
|
+
const action = () =>
|
|
57
|
+
h(ui.Button, {
|
|
58
|
+
key: choiceKey(item.value),
|
|
59
|
+
text: item.label,
|
|
60
|
+
accessibilityLabel: item.label,
|
|
61
|
+
icon: item.icon,
|
|
62
|
+
variant: 'ghost',
|
|
63
|
+
disabled: item.disabled,
|
|
64
|
+
...(keyboard
|
|
65
|
+
? {
|
|
66
|
+
role: 'menuitem',
|
|
67
|
+
tabindex: -1,
|
|
68
|
+
style: {
|
|
69
|
+
justifyContent: 'flex-start',
|
|
70
|
+
color: item.destructive ? theme.value.colors.danger : undefined,
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
: {}),
|
|
74
|
+
onClick: () => {
|
|
75
|
+
if (!props.open || props.disabled || item.disabled) return
|
|
76
|
+
emit('select', item.value, item)
|
|
77
|
+
emit('update:open', false)
|
|
78
|
+
emit('close', 'select')
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
return h(
|
|
82
|
+
MThemeProvider,
|
|
83
|
+
{
|
|
84
|
+
key: choiceKey(item.value),
|
|
85
|
+
theme: item.destructive
|
|
86
|
+
? {
|
|
87
|
+
...theme.value,
|
|
88
|
+
colors: { ...theme.value.colors, text: theme.value.colors.danger },
|
|
89
|
+
}
|
|
90
|
+
: theme.value,
|
|
91
|
+
},
|
|
92
|
+
action,
|
|
93
|
+
)
|
|
94
|
+
}),
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
}
|