@getcortexlabs/mavis 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 +6 -6
- package/dist/native/motion-region.d.ts +1 -0
- package/dist/native/motion-region.d.ts.map +1 -1
- package/dist/native/motion-region.js +8 -1
- package/dist/native/motion-region.js.map +1 -1
- package/dist/native/motion-surface.d.ts +1 -1
- package/dist/native/motion-surface.d.ts.map +1 -1
- package/dist/native/motion-surface.js +17 -1
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/number-flow-format.android.d.ts +3 -0
- package/dist/native/number-flow-format.android.d.ts.map +1 -0
- package/dist/native/number-flow-format.android.js +27 -0
- package/dist/native/number-flow-format.android.js.map +1 -0
- package/dist/native/number-flow-format.d.ts +4 -0
- package/dist/native/number-flow-format.d.ts.map +1 -0
- package/dist/native/number-flow-format.ios.d.ts +3 -0
- package/dist/native/number-flow-format.ios.d.ts.map +1 -0
- package/dist/native/number-flow-format.ios.js +24 -0
- package/dist/native/number-flow-format.ios.js.map +1 -0
- package/dist/native/number-flow-format.js +5 -0
- package/dist/native/number-flow-format.js.map +1 -0
- package/dist/native/section-scroll.d.ts +9 -0
- package/dist/native/section-scroll.d.ts.map +1 -0
- package/dist/native/section-scroll.js +69 -0
- package/dist/native/section-scroll.js.map +1 -0
- package/dist/native/segmented.d.ts.map +1 -1
- package/dist/native/segmented.js +4 -3
- package/dist/native/segmented.js.map +1 -1
- package/dist/vue/animated-number.d.ts +6 -0
- package/dist/vue/animated-number.d.ts.map +1 -0
- package/dist/vue/animated-number.js +52 -0
- package/dist/vue/animated-number.js.map +1 -0
- package/dist/vue/component-width.d.ts +7 -0
- package/dist/vue/component-width.d.ts.map +1 -0
- package/dist/vue/component-width.js +29 -0
- package/dist/vue/component-width.js.map +1 -0
- package/dist/vue/components/ChartPlot.d.ts +66 -0
- package/dist/vue/components/ChartPlot.d.ts.map +1 -0
- package/dist/vue/components/ChartPlot.js +236 -0
- package/dist/vue/components/ChartPlot.js.map +1 -0
- package/dist/vue/components/ChoiceControl.d.ts +3 -0
- package/dist/vue/components/ChoiceControl.d.ts.map +1 -1
- package/dist/vue/components/ChoiceControl.js +29 -22
- package/dist/vue/components/ChoiceControl.js.map +1 -1
- package/dist/vue/components/DateCalendar.d.ts +16 -1
- package/dist/vue/components/DateCalendar.d.ts.map +1 -1
- package/dist/vue/components/DateCalendar.js +45 -10
- package/dist/vue/components/DateCalendar.js.map +1 -1
- package/dist/vue/components/LoadingDecoration.d.ts +1 -1
- package/dist/vue/components/MAccordion.d.ts +1 -1
- package/dist/vue/components/MAlert.d.ts +3 -3
- package/dist/vue/components/MAlert.d.ts.map +1 -1
- package/dist/vue/components/MAlert.js +3 -0
- package/dist/vue/components/MAlert.js.map +1 -1
- package/dist/vue/components/MAvatar.d.ts +1 -1
- package/dist/vue/components/MAvatar.d.ts.map +1 -1
- package/dist/vue/components/MAvatar.js +5 -1
- package/dist/vue/components/MAvatar.js.map +1 -1
- package/dist/vue/components/MBadge.d.ts +1 -1
- package/dist/vue/components/MBadge.d.ts.map +1 -1
- package/dist/vue/components/MBadge.js +3 -1
- package/dist/vue/components/MBadge.js.map +1 -1
- package/dist/vue/components/MButton.d.ts +6 -6
- package/dist/vue/components/MCard.d.ts +3 -3
- package/dist/vue/components/MChip.d.ts +2 -2
- package/dist/vue/components/MCombobox.d.ts +3 -3
- package/dist/vue/components/MCombobox.d.ts.map +1 -1
- package/dist/vue/components/MCombobox.js +3 -1
- package/dist/vue/components/MCombobox.js.map +1 -1
- package/dist/vue/components/MDatePicker.d.ts +16 -16
- package/dist/vue/components/MDialog.d.ts +3 -3
- package/dist/vue/components/MEmptyState.d.ts +2 -2
- package/dist/vue/components/MEmptyState.d.ts.map +1 -1
- package/dist/vue/components/MEmptyState.js +3 -0
- package/dist/vue/components/MEmptyState.js.map +1 -1
- package/dist/vue/components/MFilePicker.d.ts +4 -4
- package/dist/vue/components/MFilePicker.d.ts.map +1 -1
- package/dist/vue/components/MFilePicker.js +3 -0
- package/dist/vue/components/MFilePicker.js.map +1 -1
- package/dist/vue/components/MGrid.d.ts +13 -2
- package/dist/vue/components/MGrid.d.ts.map +1 -1
- package/dist/vue/components/MGrid.js +5 -1
- package/dist/vue/components/MGrid.js.map +1 -1
- package/dist/vue/components/MIcon.d.ts +3 -3
- package/dist/vue/components/MImage.d.ts +2 -2
- package/dist/vue/components/MImage.d.ts.map +1 -1
- package/dist/vue/components/MImage.js +8 -1
- package/dist/vue/components/MImage.js.map +1 -1
- package/dist/vue/components/MImageCompare.d.ts +92 -0
- package/dist/vue/components/MImageCompare.d.ts.map +1 -0
- package/dist/vue/components/MImageCompare.js +138 -0
- package/dist/vue/components/MImageCompare.js.map +1 -0
- package/dist/vue/components/MImageViewer.d.ts +121 -0
- package/dist/vue/components/MImageViewer.d.ts.map +1 -0
- package/dist/vue/components/MImageViewer.js +444 -0
- package/dist/vue/components/MImageViewer.js.map +1 -0
- package/dist/vue/components/MInput.d.ts +4 -4
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MInput.js +3 -0
- package/dist/vue/components/MInput.js.map +1 -1
- package/dist/vue/components/MListItem.d.ts +1 -1
- package/dist/vue/components/MPopover.d.ts +106 -0
- package/dist/vue/components/MPopover.d.ts.map +1 -0
- package/dist/vue/components/MPopover.js +247 -0
- package/dist/vue/components/MPopover.js.map +1 -0
- package/dist/vue/components/MProgress.d.ts +3 -3
- package/dist/vue/components/MProgress.d.ts.map +1 -1
- package/dist/vue/components/MProgress.js +5 -2
- package/dist/vue/components/MProgress.js.map +1 -1
- package/dist/vue/components/MRangeSlider.d.ts +105 -0
- package/dist/vue/components/MRangeSlider.d.ts.map +1 -0
- package/dist/vue/components/MRangeSlider.js +134 -0
- package/dist/vue/components/MRangeSlider.js.map +1 -0
- package/dist/vue/components/MResizablePanels.d.ts +137 -0
- package/dist/vue/components/MResizablePanels.d.ts.map +1 -0
- package/dist/vue/components/MResizablePanels.js +148 -0
- package/dist/vue/components/MResizablePanels.js.map +1 -0
- package/dist/vue/components/MReveal.d.ts +11 -11
- package/dist/vue/components/MSelect.d.ts +1 -1
- package/dist/vue/components/MSheet.d.ts +6 -6
- package/dist/vue/components/MStack.d.ts +22 -11
- package/dist/vue/components/MStack.d.ts.map +1 -1
- package/dist/vue/components/MStack.js +6 -1
- package/dist/vue/components/MStack.js.map +1 -1
- package/dist/vue/components/MTabs.d.ts.map +1 -1
- package/dist/vue/components/MTabs.js +6 -5
- package/dist/vue/components/MTabs.js.map +1 -1
- package/dist/vue/components/MText.d.ts +4 -4
- package/dist/vue/components/MTimePicker.d.ts +655 -0
- package/dist/vue/components/MTimePicker.d.ts.map +1 -0
- package/dist/vue/components/MTimePicker.js +50 -0
- package/dist/vue/components/MTimePicker.js.map +1 -0
- package/dist/vue/components/MTooltip.d.ts +65 -0
- package/dist/vue/components/MTooltip.d.ts.map +1 -0
- package/dist/vue/components/MTooltip.js +35 -0
- package/dist/vue/components/MTooltip.js.map +1 -0
- package/dist/vue/components/MVirtualList.d.ts +3 -0
- package/dist/vue/components/MVirtualList.d.ts.map +1 -0
- package/dist/vue/components/MVirtualList.js +106 -0
- package/dist/vue/components/MVirtualList.js.map +1 -0
- package/dist/vue/components/MotionRows.d.ts +15 -0
- package/dist/vue/components/MotionRows.d.ts.map +1 -0
- package/dist/vue/components/MotionRows.js +12 -0
- package/dist/vue/components/MotionRows.js.map +1 -0
- package/dist/vue/components/configurator.d.ts +2 -2
- package/dist/vue/components/discovery.d.ts +282 -0
- package/dist/vue/components/discovery.d.ts.map +1 -0
- package/dist/vue/components/discovery.js +65 -0
- package/dist/vue/components/discovery.js.map +1 -0
- package/dist/vue/components/interactive.d.ts +164 -0
- package/dist/vue/components/interactive.d.ts.map +1 -0
- package/dist/vue/components/interactive.js +33 -0
- package/dist/vue/components/interactive.js.map +1 -0
- package/dist/vue/components/layout.d.ts +47 -25
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +2 -1
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/components/navigation.d.ts +225 -0
- package/dist/vue/components/navigation.d.ts.map +1 -0
- package/dist/vue/components/navigation.js +16 -0
- package/dist/vue/components/navigation.js.map +1 -0
- package/dist/vue/components/wayfinding.d.ts +441 -0
- package/dist/vue/components/wayfinding.d.ts.map +1 -0
- package/dist/vue/components/wayfinding.js +39 -0
- package/dist/vue/components/wayfinding.js.map +1 -0
- package/dist/vue/components/workflows.d.ts +2 -2
- package/dist/vue/index.d.ts +14 -4
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +38 -3
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/router-navigation.d.ts +25 -0
- package/dist/vue/router-navigation.d.ts.map +1 -0
- package/dist/vue/router-navigation.js +15 -0
- package/dist/vue/router-navigation.js.map +1 -0
- package/dist/vue/services.d.ts.map +1 -1
- package/dist/vue/services.js +7 -2
- package/dist/vue/services.js.map +1 -1
- package/package.json +4 -4
- package/src/native/motion-region.ts +14 -1
- package/src/native/motion-surface.ts +24 -1
- package/src/native/number-flow-format.android.ts +61 -0
- package/src/native/number-flow-format.ios.ts +40 -0
- package/src/native/number-flow-format.ts +9 -0
- package/src/native/section-scroll.ts +81 -0
- package/src/native/segmented.ts +4 -3
- package/src/vue/animated-number.ts +57 -0
- package/src/vue/component-width.ts +34 -0
- package/src/vue/components/ChartPlot.ts +267 -0
- package/src/vue/components/ChoiceControl.ts +32 -25
- package/src/vue/components/DateCalendar.ts +50 -9
- package/src/vue/components/MAlert.ts +3 -0
- package/src/vue/components/MAvatar.ts +5 -1
- package/src/vue/components/MBadge.ts +3 -1
- package/src/vue/components/MCombobox.ts +6 -1
- package/src/vue/components/MEmptyState.ts +3 -0
- package/src/vue/components/MFilePicker.ts +3 -0
- package/src/vue/components/MGrid.ts +14 -0
- package/src/vue/components/MImage.ts +10 -1
- package/src/vue/components/MImageCompare.ts +162 -0
- package/src/vue/components/MImageViewer.ts +489 -0
- package/src/vue/components/MInput.ts +3 -0
- package/src/vue/components/MPopover.ts +305 -0
- package/src/vue/components/MProgress.ts +8 -2
- package/src/vue/components/MRangeSlider.ts +157 -0
- package/src/vue/components/MResizablePanels.ts +180 -0
- package/src/vue/components/MStack.ts +6 -0
- package/src/vue/components/MTabs.ts +10 -4
- package/src/vue/components/MTimePicker.ts +57 -0
- package/src/vue/components/MTooltip.ts +39 -0
- package/src/vue/components/MVirtualList.ts +140 -0
- package/src/vue/components/MotionRows.ts +17 -0
- package/src/vue/components/discovery.ts +91 -0
- package/src/vue/components/interactive.ts +43 -0
- package/src/vue/components/layout.ts +2 -0
- package/src/vue/components/navigation.ts +19 -0
- package/src/vue/components/wayfinding.ts +48 -0
- package/src/vue/index.ts +80 -1
- package/src/vue/router-navigation.ts +39 -0
- package/src/vue/services.ts +8 -1
- package/dist/date-format.android.d.ts +0 -5
- package/dist/date-format.android.d.ts.map +0 -1
- package/dist/date-format.android.js +0 -39
- package/dist/date-format.android.js.map +0 -1
- package/dist/date-format.ios.d.ts +0 -5
- package/dist/date-format.ios.d.ts.map +0 -1
- package/dist/date-format.ios.js +0 -29
- package/dist/date-format.ios.js.map +0 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import {
|
|
2
|
+
animate,
|
|
3
|
+
motionValue,
|
|
4
|
+
set,
|
|
5
|
+
stop,
|
|
6
|
+
onReducedMotion,
|
|
7
|
+
reducedMotion,
|
|
8
|
+
type MotionValue,
|
|
9
|
+
} from '@rafaelaugusto/jolt'
|
|
10
|
+
import { defineComponent, h, ref, watch, nextTick, onBeforeUnmount } from 'nativescript-vue'
|
|
11
|
+
import type { EventData, TapGestureEventData, View } from '@nativescript/core'
|
|
12
|
+
import { chartPlotProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
13
|
+
import {
|
|
14
|
+
chartHitTest,
|
|
15
|
+
interpolateChart,
|
|
16
|
+
componentMotion,
|
|
17
|
+
type ChartGeometry,
|
|
18
|
+
type ChartPoint,
|
|
19
|
+
} from '@getcortexlabs/mavis-core'
|
|
20
|
+
|
|
21
|
+
/** Bounded native geometry, without a WebView or a second animation scheduler. */
|
|
22
|
+
export const ChartPlot = defineComponent({
|
|
23
|
+
name: 'MChartPlot',
|
|
24
|
+
props: chartPlotProps,
|
|
25
|
+
emits: { select: (_category: number, _series: number) => true },
|
|
26
|
+
setup(props, { emit }) {
|
|
27
|
+
const { theme } = useMavisTheme()
|
|
28
|
+
const width = ref(0)
|
|
29
|
+
let progress: MotionValue | undefined
|
|
30
|
+
let playback: ReturnType<typeof animate> | undefined
|
|
31
|
+
let off: (() => void) | undefined
|
|
32
|
+
let releaseReduced: (() => void) | undefined
|
|
33
|
+
let generation = 0
|
|
34
|
+
let loaded = false
|
|
35
|
+
const settle = () => {
|
|
36
|
+
if (reducedMotion() && progress) {
|
|
37
|
+
generation++
|
|
38
|
+
stop(progress)
|
|
39
|
+
set(progress, 1)
|
|
40
|
+
paint(destination)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let presentation: ChartGeometry | undefined
|
|
44
|
+
let origin: ChartGeometry | undefined
|
|
45
|
+
let destination = props.geometry
|
|
46
|
+
const marks = new Map<string, View>()
|
|
47
|
+
function paint(geometry: ChartGeometry) {
|
|
48
|
+
presentation = geometry
|
|
49
|
+
const height = props.height
|
|
50
|
+
const x = (point: ChartPoint) => point.x * width.value
|
|
51
|
+
const y = (point: ChartPoint) => 8 + point.y * (height - 16)
|
|
52
|
+
const zero = 8 + geometry.zero * (height - 16)
|
|
53
|
+
const group = (width.value / Math.max(1, geometry.series[0]?.points.length ?? 0)) * 0.7
|
|
54
|
+
const bar = group / Math.max(1, geometry.series.length)
|
|
55
|
+
const write = (key: string, values: Record<string, number>) => {
|
|
56
|
+
const view = marks.get(key)
|
|
57
|
+
if (view?.isLoaded) Object.assign(view, values)
|
|
58
|
+
}
|
|
59
|
+
geometry.series.forEach((series, seriesIndex) =>
|
|
60
|
+
series.points.forEach((point, index) => {
|
|
61
|
+
if (!point) return
|
|
62
|
+
if (props.type === 'bar')
|
|
63
|
+
write(`bar:${seriesIndex}:${index}`, {
|
|
64
|
+
left: x(point) - group / 2 + seriesIndex * bar,
|
|
65
|
+
top: Math.min(y(point), zero),
|
|
66
|
+
width: Math.max(1, bar * 0.82),
|
|
67
|
+
height: Math.max(1, Math.abs(zero - y(point))),
|
|
68
|
+
})
|
|
69
|
+
else {
|
|
70
|
+
const radius =
|
|
71
|
+
props.selected?.category === index && props.selected.series === seriesIndex ? 5 : 3
|
|
72
|
+
write(`point:${seriesIndex}:${index}`, {
|
|
73
|
+
left: x(point) - radius,
|
|
74
|
+
top: y(point) - radius,
|
|
75
|
+
})
|
|
76
|
+
const previous = series.points[index - 1]
|
|
77
|
+
if (previous) {
|
|
78
|
+
const dx = x(point) - x(previous),
|
|
79
|
+
dy = y(point) - y(previous)
|
|
80
|
+
const length = Math.hypot(dx, dy)
|
|
81
|
+
write(`line:${seriesIndex}:${index}`, {
|
|
82
|
+
left: (x(point) + x(previous)) / 2 - length / 2,
|
|
83
|
+
top: (y(point) + y(previous)) / 2 - 1.25,
|
|
84
|
+
width: length,
|
|
85
|
+
rotate: (Math.atan2(dy, dx) * 180) / Math.PI,
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
function update() {
|
|
93
|
+
destination = props.geometry
|
|
94
|
+
if (!progress) {
|
|
95
|
+
presentation = destination
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
origin = presentation
|
|
99
|
+
const token = ++generation
|
|
100
|
+
if (reducedMotion()) {
|
|
101
|
+
settle()
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
playback?.stop()
|
|
105
|
+
set(progress, 0)
|
|
106
|
+
paint(interpolateChart(origin, destination, 0))
|
|
107
|
+
const current = animate(progress, 1, componentMotion(theme.value, 'data'))
|
|
108
|
+
playback = current
|
|
109
|
+
void current.finished.then((completed) => {
|
|
110
|
+
if (completed && playback === current && progress && token === generation)
|
|
111
|
+
paint(destination)
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
function connect() {
|
|
115
|
+
if (progress) return
|
|
116
|
+
progress = motionValue(0)
|
|
117
|
+
releaseReduced = onReducedMotion(settle)
|
|
118
|
+
off = progress.subscribe((value) => paint(interpolateChart(origin, destination, value)), {
|
|
119
|
+
immediate: false,
|
|
120
|
+
})
|
|
121
|
+
update()
|
|
122
|
+
}
|
|
123
|
+
function disconnect() {
|
|
124
|
+
generation++
|
|
125
|
+
releaseReduced?.()
|
|
126
|
+
releaseReduced = undefined
|
|
127
|
+
off?.()
|
|
128
|
+
off = undefined
|
|
129
|
+
playback?.stop()
|
|
130
|
+
playback = undefined
|
|
131
|
+
if (progress) stop(progress)
|
|
132
|
+
progress = undefined
|
|
133
|
+
presentation = props.geometry
|
|
134
|
+
}
|
|
135
|
+
watch(() => props.geometry, update, { flush: 'post' })
|
|
136
|
+
watch(
|
|
137
|
+
() => [props.height, props.type, props.selected],
|
|
138
|
+
() => {
|
|
139
|
+
if (presentation) paint(presentation)
|
|
140
|
+
},
|
|
141
|
+
{ flush: 'post' },
|
|
142
|
+
)
|
|
143
|
+
onBeforeUnmount(() => {
|
|
144
|
+
loaded = false
|
|
145
|
+
disconnect()
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
return () => {
|
|
149
|
+
const height = props.height
|
|
150
|
+
const x = (point: ChartPoint) => point.x * width.value
|
|
151
|
+
const y = (point: ChartPoint) => 8 + point.y * (height - 16)
|
|
152
|
+
const zero = 8 + props.geometry.zero * (height - 16)
|
|
153
|
+
const count = props.geometry.series[0]?.points.length ?? 0
|
|
154
|
+
const groupWidth = (width.value / Math.max(1, count)) * 0.7
|
|
155
|
+
const barWidth = groupWidth / Math.max(1, props.geometry.series.length)
|
|
156
|
+
const shape = (key: string, values: Record<string, unknown>) =>
|
|
157
|
+
h('ContentView', {
|
|
158
|
+
key,
|
|
159
|
+
accessibilityHidden: true,
|
|
160
|
+
isUserInteractionEnabled: false,
|
|
161
|
+
...values,
|
|
162
|
+
onLoaded: (event: EventData) => {
|
|
163
|
+
marks.set(key, event.object as View)
|
|
164
|
+
},
|
|
165
|
+
onUnloaded: () => marks.delete(key),
|
|
166
|
+
})
|
|
167
|
+
return h(
|
|
168
|
+
'AbsoluteLayout',
|
|
169
|
+
{
|
|
170
|
+
class: 'm-chart-plot',
|
|
171
|
+
onLoaded: () => {
|
|
172
|
+
loaded = true
|
|
173
|
+
void nextTick(() => {
|
|
174
|
+
if (loaded) connect()
|
|
175
|
+
})
|
|
176
|
+
},
|
|
177
|
+
onUnloaded: () => {
|
|
178
|
+
loaded = false
|
|
179
|
+
disconnect()
|
|
180
|
+
},
|
|
181
|
+
height,
|
|
182
|
+
accessibilityHidden: true,
|
|
183
|
+
onLayoutChanged: (event: EventData) => {
|
|
184
|
+
const size = (event.object as View).getActualSize()
|
|
185
|
+
if (width.value !== size.width) {
|
|
186
|
+
width.value = size.width
|
|
187
|
+
void nextTick(() => {
|
|
188
|
+
if (presentation) paint(presentation)
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
onTap: (event: TapGestureEventData) => {
|
|
193
|
+
if (props.disabled || !width.value || !count) return
|
|
194
|
+
const hit = chartHitTest(
|
|
195
|
+
props.geometry,
|
|
196
|
+
props.type,
|
|
197
|
+
event.getX() / width.value,
|
|
198
|
+
(event.getY() - 8) / (height - 16),
|
|
199
|
+
)
|
|
200
|
+
if (hit) emit('select', hit.category, hit.series)
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
width.value <= 0
|
|
204
|
+
? []
|
|
205
|
+
: [
|
|
206
|
+
...props.geometry.ticks.map((_, i) =>
|
|
207
|
+
shape(`grid:${i}`, {
|
|
208
|
+
left: 0,
|
|
209
|
+
top: 8 + ((height - 16) * i) / 4,
|
|
210
|
+
width: width.value,
|
|
211
|
+
height: 1,
|
|
212
|
+
backgroundColor: theme.value.colors.border,
|
|
213
|
+
}),
|
|
214
|
+
),
|
|
215
|
+
...props.geometry.series.flatMap((series, seriesIndex) =>
|
|
216
|
+
series.points.flatMap((point, index) => {
|
|
217
|
+
if (!point) return []
|
|
218
|
+
const color = props.colors[seriesIndex]
|
|
219
|
+
const selected =
|
|
220
|
+
props.selected?.category === index && props.selected.series === seriesIndex
|
|
221
|
+
const previous = series.points[index - 1]
|
|
222
|
+
const line =
|
|
223
|
+
props.type === 'line' && previous
|
|
224
|
+
? (() => {
|
|
225
|
+
const dx = x(point) - x(previous),
|
|
226
|
+
dy = y(point) - y(previous)
|
|
227
|
+
const length = Math.hypot(dx, dy)
|
|
228
|
+
return shape(`line:${seriesIndex}:${index}`, {
|
|
229
|
+
left: (x(point) + x(previous)) / 2 - length / 2,
|
|
230
|
+
top: (y(point) + y(previous)) / 2 - 1.25,
|
|
231
|
+
width: length,
|
|
232
|
+
height: 2.5,
|
|
233
|
+
rotate: (Math.atan2(dy, dx) * 180) / Math.PI,
|
|
234
|
+
backgroundColor: color,
|
|
235
|
+
borderRadius: 1.25,
|
|
236
|
+
})
|
|
237
|
+
})()
|
|
238
|
+
: null
|
|
239
|
+
const radius = selected ? 5 : 3
|
|
240
|
+
return [
|
|
241
|
+
line,
|
|
242
|
+
props.type === 'bar'
|
|
243
|
+
? shape(`bar:${seriesIndex}:${index}`, {
|
|
244
|
+
left: x(point) - groupWidth / 2 + seriesIndex * barWidth,
|
|
245
|
+
top: Math.min(y(point), zero),
|
|
246
|
+
width: Math.max(1, barWidth * 0.82),
|
|
247
|
+
height: Math.max(1, Math.abs(zero - y(point))),
|
|
248
|
+
borderRadius: 3,
|
|
249
|
+
backgroundColor: color,
|
|
250
|
+
opacity: props.selected && !selected ? 0.45 : 1,
|
|
251
|
+
})
|
|
252
|
+
: shape(`point:${seriesIndex}:${index}`, {
|
|
253
|
+
left: x(point) - radius,
|
|
254
|
+
top: y(point) - radius,
|
|
255
|
+
width: radius * 2,
|
|
256
|
+
height: radius * 2,
|
|
257
|
+
borderRadius: radius,
|
|
258
|
+
backgroundColor: color,
|
|
259
|
+
}),
|
|
260
|
+
]
|
|
261
|
+
}),
|
|
262
|
+
),
|
|
263
|
+
],
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
})
|
|
@@ -23,7 +23,12 @@ registerElement('MavisRadioButton', () => MavisButton)
|
|
|
23
23
|
export const ChoiceControl = defineComponent({
|
|
24
24
|
name: 'ChoiceControl',
|
|
25
25
|
inheritAttrs: false,
|
|
26
|
-
props: {
|
|
26
|
+
props: {
|
|
27
|
+
...checkboxProps,
|
|
28
|
+
radio: Boolean,
|
|
29
|
+
labelHidden: Boolean,
|
|
30
|
+
pressFeedback: { type: Boolean, default: true },
|
|
31
|
+
},
|
|
27
32
|
emits: ['activate'],
|
|
28
33
|
setup(props, { attrs, emit }) {
|
|
29
34
|
const { theme } = useMavisTheme()
|
|
@@ -220,33 +225,35 @@ export const ChoiceControl = defineComponent({
|
|
|
220
225
|
: null,
|
|
221
226
|
},
|
|
222
227
|
),
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
default: () => [
|
|
232
|
-
h(MText, {
|
|
233
|
-
text: props.label,
|
|
234
|
-
accessibilityHidden: true,
|
|
228
|
+
props.labelHidden
|
|
229
|
+
? null
|
|
230
|
+
: h(
|
|
231
|
+
MColumn,
|
|
232
|
+
{
|
|
233
|
+
gap: 'xs',
|
|
235
234
|
isUserInteractionEnabled: false,
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
tone: 'muted',
|
|
235
|
+
accessibilityHidden: true,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
default: () => [
|
|
239
|
+
h(MText, {
|
|
240
|
+
text: props.label,
|
|
243
241
|
accessibilityHidden: true,
|
|
244
242
|
isUserInteractionEnabled: false,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
243
|
+
style: { fontWeight: '600' },
|
|
244
|
+
}),
|
|
245
|
+
props.helperText
|
|
246
|
+
? h(MText, {
|
|
247
|
+
text: props.helperText,
|
|
248
|
+
variant: 'caption',
|
|
249
|
+
tone: 'muted',
|
|
250
|
+
accessibilityHidden: true,
|
|
251
|
+
isUserInteractionEnabled: false,
|
|
252
|
+
})
|
|
253
|
+
: null,
|
|
254
|
+
],
|
|
255
|
+
},
|
|
256
|
+
),
|
|
250
257
|
],
|
|
251
258
|
},
|
|
252
259
|
),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMotionSurface } from '../use-motion-surface.js'
|
|
1
2
|
import { defineComponent, h } from 'nativescript-vue'
|
|
2
3
|
import { calendarDayLabel } from '@getcortexlabs/mavis-core'
|
|
3
4
|
import {
|
|
@@ -5,10 +6,42 @@ import {
|
|
|
5
6
|
dateCalendarEmits,
|
|
6
7
|
useDateCalendar,
|
|
7
8
|
useMavisTheme,
|
|
9
|
+
useCalendarMotion,
|
|
10
|
+
useComponentState,
|
|
8
11
|
} from '@getcortexlabs/mavis-core/vue'
|
|
9
12
|
import { MButton } from './MButton.js'
|
|
10
13
|
import { MText } from './MText.js'
|
|
11
|
-
import { MColumn, MRow } from './layout.js'
|
|
14
|
+
import { MColumn, MRow, MBox } from './layout.js'
|
|
15
|
+
|
|
16
|
+
const CalendarDay = defineComponent({
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
props: { painted: Boolean },
|
|
19
|
+
setup(props, { attrs }) {
|
|
20
|
+
const { theme } = useMavisTheme()
|
|
21
|
+
const fill = useComponentState(() => ({
|
|
22
|
+
opacity: props.painted ? 1 : 0,
|
|
23
|
+
scale: props.painted ? 1 : 0.8,
|
|
24
|
+
}))
|
|
25
|
+
return () =>
|
|
26
|
+
h(MBox, { row: attrs.row, col: attrs.col }, () => [
|
|
27
|
+
h(MBox, {
|
|
28
|
+
width: '100%',
|
|
29
|
+
height: '100%',
|
|
30
|
+
radius: 'sm',
|
|
31
|
+
backgroundColor: theme.value.colors.primarySoft,
|
|
32
|
+
motionSurface: fill,
|
|
33
|
+
accessibilityHidden: true,
|
|
34
|
+
isUserInteractionEnabled: false,
|
|
35
|
+
}),
|
|
36
|
+
h(MButton, {
|
|
37
|
+
...attrs,
|
|
38
|
+
row: undefined,
|
|
39
|
+
col: undefined,
|
|
40
|
+
style: [attrs.style, { backgroundColor: 'transparent' }],
|
|
41
|
+
}),
|
|
42
|
+
])
|
|
43
|
+
},
|
|
44
|
+
})
|
|
12
45
|
|
|
13
46
|
/** @internal Natural-size native buttons; horizontal scrolling preserves large text and targets. */
|
|
14
47
|
export const DateCalendar = defineComponent({
|
|
@@ -18,6 +51,8 @@ export const DateCalendar = defineComponent({
|
|
|
18
51
|
setup(props, { emit }) {
|
|
19
52
|
const { theme } = useMavisTheme()
|
|
20
53
|
const calendar = useDateCalendar(props, (value) => emit('update:activeDate', value))
|
|
54
|
+
const presentation = useCalendarMotion(() => props.activeDate)
|
|
55
|
+
const motion = useMotionSurface(() => presentation)
|
|
21
56
|
return () => {
|
|
22
57
|
const { colors, radius } = theme.value
|
|
23
58
|
return h(
|
|
@@ -34,7 +69,7 @@ export const DateCalendar = defineComponent({
|
|
|
34
69
|
icon: 'chevron-left',
|
|
35
70
|
variant: 'ghost',
|
|
36
71
|
accessibilityLabel: calendar.words.value.previous,
|
|
37
|
-
disabled: !calendar.canPage(-1),
|
|
72
|
+
disabled: props.disabled || !calendar.canPage(-1),
|
|
38
73
|
onClick: () => calendar.page(-1),
|
|
39
74
|
}),
|
|
40
75
|
h(MText, {
|
|
@@ -47,7 +82,7 @@ export const DateCalendar = defineComponent({
|
|
|
47
82
|
icon: 'chevron-right',
|
|
48
83
|
variant: 'ghost',
|
|
49
84
|
accessibilityLabel: calendar.words.value.next,
|
|
50
|
-
disabled: !calendar.canPage(1),
|
|
85
|
+
disabled: props.disabled || !calendar.canPage(1),
|
|
51
86
|
onClick: () => calendar.page(1),
|
|
52
87
|
}),
|
|
53
88
|
],
|
|
@@ -57,6 +92,7 @@ export const DateCalendar = defineComponent({
|
|
|
57
92
|
h(
|
|
58
93
|
'GridLayout',
|
|
59
94
|
{
|
|
95
|
+
...motion,
|
|
60
96
|
columns: 'auto,auto,auto,auto,auto,auto,auto',
|
|
61
97
|
rows: Array.from(
|
|
62
98
|
{ length: calendar.cells.value.length / 7 + 1 },
|
|
@@ -73,13 +109,17 @@ export const DateCalendar = defineComponent({
|
|
|
73
109
|
variant: 'caption',
|
|
74
110
|
tone: 'muted',
|
|
75
111
|
accessibilityLabel: calendar.words.value.weekdays[weekday],
|
|
76
|
-
style: { minWidth:
|
|
112
|
+
style: { minWidth: 44, textAlignment: 'center', padding: 8 },
|
|
77
113
|
}),
|
|
78
114
|
),
|
|
79
115
|
...calendar.cells.value.map((date, index) => {
|
|
80
116
|
if (!date) return null
|
|
81
|
-
const selected =
|
|
82
|
-
|
|
117
|
+
const selected =
|
|
118
|
+
date === props.selected ||
|
|
119
|
+
date === props.rangeStart ||
|
|
120
|
+
date === props.rangeEnd
|
|
121
|
+
return h(CalendarDay, {
|
|
122
|
+
painted: selected || calendar.inRange(date),
|
|
83
123
|
key: date,
|
|
84
124
|
row: Math.floor(index / 7) + 1,
|
|
85
125
|
col: index % 7,
|
|
@@ -87,9 +127,9 @@ export const DateCalendar = defineComponent({
|
|
|
87
127
|
variant: 'ghost',
|
|
88
128
|
accessibilityLabel: calendarDayLabel(date, props.locale),
|
|
89
129
|
accessibilityValue: selected ? calendar.words.value.selected : '',
|
|
90
|
-
disabled: !calendar.available(date),
|
|
130
|
+
disabled: props.disabled || props.readonly || !calendar.available(date),
|
|
91
131
|
style: {
|
|
92
|
-
minWidth:
|
|
132
|
+
minWidth: 44,
|
|
93
133
|
minHeight: 48,
|
|
94
134
|
margin: 1,
|
|
95
135
|
paddingLeft: 6,
|
|
@@ -102,7 +142,8 @@ export const DateCalendar = defineComponent({
|
|
|
102
142
|
color: colors.text,
|
|
103
143
|
},
|
|
104
144
|
onClick: () => {
|
|
105
|
-
if (calendar.available(date))
|
|
145
|
+
if (!props.disabled && !props.readonly && calendar.available(date))
|
|
146
|
+
emit('select', date)
|
|
106
147
|
},
|
|
107
148
|
})
|
|
108
149
|
}),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useComponentContent } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import { defineComponent, h, mergeProps, onBeforeUnmount, watch } from 'nativescript-vue'
|
|
2
3
|
import type { EventData, View } from '@nativescript/core'
|
|
3
4
|
import { alertProps, alertEmits, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
@@ -16,6 +17,7 @@ export const MAlert = defineComponent({
|
|
|
16
17
|
emits: alertEmits,
|
|
17
18
|
setup(props, { attrs, slots, emit }) {
|
|
18
19
|
const { theme } = useMavisTheme()
|
|
20
|
+
const arrival = useComponentContent(() => props.title)
|
|
19
21
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
20
22
|
let content: View | undefined
|
|
21
23
|
let pending: ReturnType<typeof setTimeout> | undefined
|
|
@@ -83,6 +85,7 @@ export const MAlert = defineComponent({
|
|
|
83
85
|
{
|
|
84
86
|
width: 32,
|
|
85
87
|
height: 32,
|
|
88
|
+
motionSurface: arrival,
|
|
86
89
|
radius: 'sm',
|
|
87
90
|
shrink: 0,
|
|
88
91
|
backgroundColor: colors.elevated,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMotionSurface } from '../use-motion-surface.js'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
watch,
|
|
8
9
|
registerElement,
|
|
9
10
|
} from 'nativescript-vue'
|
|
10
|
-
import { avatarProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
11
|
+
import { avatarProps, useMavisTheme, useComponentContent } from '@getcortexlabs/mavis-core/vue'
|
|
11
12
|
import { avatarSizes, avatarInitials, iconGlyph, iconFontFamily } from '@getcortexlabs/mavis-core'
|
|
12
13
|
import type { ImageSource } from '@nativescript/core'
|
|
13
14
|
import { loadAvatarImage } from '../../native/avatar-image'
|
|
@@ -23,6 +24,8 @@ export const MAvatar = defineComponent({
|
|
|
23
24
|
props: avatarProps,
|
|
24
25
|
setup(props, { attrs }) {
|
|
25
26
|
const { theme } = useMavisTheme()
|
|
27
|
+
const reveal = useComponentContent()
|
|
28
|
+
const motion = useMotionSurface(() => reveal)
|
|
26
29
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
27
30
|
const image = shallowRef<ImageSource | null>(null)
|
|
28
31
|
let request = 0
|
|
@@ -70,6 +73,7 @@ export const MAvatar = defineComponent({
|
|
|
70
73
|
image.value
|
|
71
74
|
? [
|
|
72
75
|
h('Image', {
|
|
76
|
+
...motion,
|
|
73
77
|
imageSource: image.value,
|
|
74
78
|
stretch: 'aspectFill',
|
|
75
79
|
width: size,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, h, mergeProps } from 'nativescript-vue'
|
|
2
|
-
import { badgeProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
2
|
+
import { badgeProps, useMavisTheme, useComponentContent } from '@getcortexlabs/mavis-core/vue'
|
|
3
3
|
import { badgeColors } from '@getcortexlabs/mavis-core'
|
|
4
4
|
import { MText } from './MText.js'
|
|
5
5
|
|
|
@@ -9,12 +9,14 @@ export const MBadge = defineComponent({
|
|
|
9
9
|
props: badgeProps,
|
|
10
10
|
setup(props, { attrs }) {
|
|
11
11
|
const { theme } = useMavisTheme()
|
|
12
|
+
const content = useComponentContent(() => props.text, false)
|
|
12
13
|
return () =>
|
|
13
14
|
h(
|
|
14
15
|
MText,
|
|
15
16
|
mergeProps(attrs, {
|
|
16
17
|
id: props.id,
|
|
17
18
|
text: String(props.text),
|
|
19
|
+
motionSurface: content,
|
|
18
20
|
variant: 'caption',
|
|
19
21
|
accessibilityLabel: props.accessibilityLabel,
|
|
20
22
|
accessibilityHidden: props.accessibilityHidden,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useComponentLayout } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -30,6 +31,10 @@ const Combobox = defineComponent({
|
|
|
30
31
|
setup(props, { attrs, emit, expose }) {
|
|
31
32
|
useButtonAction()
|
|
32
33
|
const combo = useCombobox(props, emit)
|
|
34
|
+
const resultLayout = useComponentLayout(
|
|
35
|
+
() => combo.state.value.options.map((option) => option.value),
|
|
36
|
+
false,
|
|
37
|
+
)
|
|
33
38
|
const input = ref<InputHandle>()
|
|
34
39
|
let nativeEditor: TextField | undefined
|
|
35
40
|
let compositionTimer: ReturnType<typeof setTimeout> | undefined
|
|
@@ -188,7 +193,7 @@ const Combobox = defineComponent({
|
|
|
188
193
|
combo.open.value
|
|
189
194
|
? h(
|
|
190
195
|
MColumn,
|
|
191
|
-
{ gap: 'xs' },
|
|
196
|
+
{ gap: 'xs', motionRegion: resultLayout },
|
|
192
197
|
{
|
|
193
198
|
default: () => [
|
|
194
199
|
...state.options.map((option) =>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useComponentContent } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import { defineComponent, h, mergeProps, type SlotsType, type VNode } from 'nativescript-vue'
|
|
2
3
|
import { checkEmptyStateTitle } from '@getcortexlabs/mavis-core'
|
|
3
4
|
import { emptyStateProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
@@ -13,6 +14,7 @@ export const MEmptyState = defineComponent({
|
|
|
13
14
|
slots: Object as SlotsType<{ illustration?: () => VNode[]; actions?: () => VNode[] }>,
|
|
14
15
|
setup(props, { attrs, slots }) {
|
|
15
16
|
const { theme } = useMavisTheme()
|
|
17
|
+
const arrival = useComponentContent(() => props.title)
|
|
16
18
|
return () => {
|
|
17
19
|
checkEmptyStateTitle(props.title)
|
|
18
20
|
const { colors } = theme.value
|
|
@@ -24,6 +26,7 @@ export const MEmptyState = defineComponent({
|
|
|
24
26
|
{
|
|
25
27
|
width: size,
|
|
26
28
|
height: size,
|
|
29
|
+
motionSurface: arrival,
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
32
|
default: () => [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useComponentLayout } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -25,6 +26,7 @@ const FilePicker = defineComponent({
|
|
|
25
26
|
setup(props, { attrs, expose }) {
|
|
26
27
|
useButtonAction()
|
|
27
28
|
const state = shallowRef(props.selection.state)
|
|
29
|
+
const layout = useComponentLayout(() => state.value.items.map((item) => item.id))
|
|
28
30
|
const picker = createNativeFilePicker()
|
|
29
31
|
let chooseView: View | undefined
|
|
30
32
|
let loaded = false
|
|
@@ -87,6 +89,7 @@ const FilePicker = defineComponent({
|
|
|
87
89
|
MColumn,
|
|
88
90
|
mergeProps(attrs, {
|
|
89
91
|
gap: 'md',
|
|
92
|
+
motionRegion: layout,
|
|
90
93
|
onLoaded: () => {
|
|
91
94
|
loaded = true
|
|
92
95
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMotionRegion } from '../use-motion-region.js'
|
|
1
2
|
import {
|
|
2
3
|
Comment,
|
|
3
4
|
Fragment,
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
layoutDirection,
|
|
18
19
|
useLayoutShrink,
|
|
19
20
|
useMavisTheme,
|
|
21
|
+
useComponentLayout,
|
|
20
22
|
} from '@getcortexlabs/mavis-core/vue'
|
|
21
23
|
import { boxStyle } from '../props.js'
|
|
22
24
|
import { useNativeViewAttrs } from '../accessibility.js'
|
|
@@ -32,6 +34,17 @@ export const MGrid = defineComponent({
|
|
|
32
34
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
33
35
|
provide(layoutDirection, 'column')
|
|
34
36
|
const width = shallowRef<number>()
|
|
37
|
+
const automatic = useComponentLayout(
|
|
38
|
+
() =>
|
|
39
|
+
gridColumns(
|
|
40
|
+
props.columns,
|
|
41
|
+
props.minColumnWidth,
|
|
42
|
+
resolveSpace(theme.value, props.gap ?? 'none'),
|
|
43
|
+
width.value,
|
|
44
|
+
),
|
|
45
|
+
false,
|
|
46
|
+
)
|
|
47
|
+
const motion = useMotionRegion(() => props.motionRegion ?? automatic)
|
|
35
48
|
return () => {
|
|
36
49
|
const gap = resolveSpace(theme.value, props.gap ?? 'none')
|
|
37
50
|
const count = gridColumns(props.columns, props.minColumnWidth, gap, width.value)
|
|
@@ -71,6 +84,7 @@ export const MGrid = defineComponent({
|
|
|
71
84
|
h(
|
|
72
85
|
'GridLayout',
|
|
73
86
|
{
|
|
87
|
+
...motion,
|
|
74
88
|
columns: Array.from({ length: count }, () => '*').join(`,${gap},`),
|
|
75
89
|
rows: Array.from({ length: rows }, () => 'auto').join(`,${gap},`),
|
|
76
90
|
onLayoutChanged: (event: EventData) => {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { markRaw, onScopeDispose } from 'nativescript-vue'
|
|
2
|
+
import { createMotionSurface } from '@getcortexlabs/mavis-core/experimental'
|
|
3
|
+
import { componentMotion } from '@getcortexlabs/mavis-core'
|
|
1
4
|
import {
|
|
2
5
|
defineComponent,
|
|
3
6
|
h,
|
|
@@ -28,6 +31,12 @@ export const MImage = defineComponent({
|
|
|
28
31
|
},
|
|
29
32
|
setup(props, { attrs, emit }) {
|
|
30
33
|
const { theme } = useMavisTheme()
|
|
34
|
+
const reveal = markRaw(createMotionSurface())
|
|
35
|
+
onScopeDispose(
|
|
36
|
+
reveal.use((owner) => {
|
|
37
|
+
owner.animate({ opacity: [0, 1] }, componentMotion(theme.value, 'overlay'))
|
|
38
|
+
}),
|
|
39
|
+
)
|
|
31
40
|
const image = shallowRef<ImageSource | null>(null)
|
|
32
41
|
const status = ref<'loading' | 'ready' | 'error'>('loading')
|
|
33
42
|
const width = ref(typeof props.width === 'number' ? props.width : 0)
|
|
@@ -37,7 +46,7 @@ export const MImage = defineComponent({
|
|
|
37
46
|
committing: string | undefined,
|
|
38
47
|
currentImage: Image | undefined
|
|
39
48
|
const motion = useMotionSurface(
|
|
40
|
-
() => props.motionSurface,
|
|
49
|
+
() => props.motionSurface ?? reveal,
|
|
41
50
|
() => true,
|
|
42
51
|
() => false,
|
|
43
52
|
true,
|