@getcortexlabs/mavis 0.1.0-rc.12.2 → 0.1.0-rc.14
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 +5 -5
- package/dist/native/flex-layout.ios.d.ts.map +1 -1
- package/dist/native/flex-layout.ios.js +4 -0
- package/dist/native/flex-layout.ios.js.map +1 -1
- package/dist/native/motion-region.d.ts.map +1 -1
- package/dist/native/motion-region.js +1 -0
- 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 +55 -14
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/moved-shadow.d.ts +5 -0
- package/dist/native/moved-shadow.d.ts.map +1 -0
- package/dist/native/moved-shadow.js +23 -0
- package/dist/native/moved-shadow.js.map +1 -0
- package/dist/native/scroll-motion.d.ts +1 -1
- package/dist/native/scroll-motion.d.ts.map +1 -1
- package/dist/native/scroll-motion.js +55 -16
- package/dist/native/scroll-motion.js.map +1 -1
- package/dist/native/section-scroll.d.ts +1 -1
- package/dist/native/section-scroll.d.ts.map +1 -1
- package/dist/native/section-scroll.js +19 -6
- package/dist/native/section-scroll.js.map +1 -1
- package/dist/native/visual-effects.d.ts.map +1 -1
- package/dist/native/visual-effects.js +5 -0
- package/dist/native/visual-effects.js.map +1 -1
- package/dist/vue/card-input.d.ts +4 -0
- package/dist/vue/card-input.d.ts.map +1 -0
- package/dist/vue/card-input.js +37 -0
- package/dist/vue/card-input.js.map +1 -0
- package/dist/vue/components/ChoiceControl.d.ts +1 -1
- package/dist/vue/components/DateCalendar.d.ts +1 -1
- package/dist/vue/components/MButton.d.ts +6 -6
- package/dist/vue/components/MCard.d.ts.map +1 -1
- package/dist/vue/components/MCard.js +29 -8
- package/dist/vue/components/MCard.js.map +1 -1
- package/dist/vue/components/MChip.d.ts +1 -1
- package/dist/vue/components/MDatePicker.d.ts +96 -96
- package/dist/vue/components/MDatePicker.d.ts.map +1 -1
- package/dist/vue/components/MEmptyState.d.ts +1 -1
- package/dist/vue/components/MInput.d.ts +4 -4
- package/dist/vue/components/MPopover.d.ts +1 -1
- package/dist/vue/components/MProgress.d.ts +1 -1
- package/dist/vue/components/MRangeSlider.d.ts +2 -2
- package/dist/vue/components/MResizablePanels.d.ts +1 -1
- package/dist/vue/components/MReveal.d.ts +8 -8
- package/dist/vue/components/MSheet.d.ts +4 -4
- package/dist/vue/components/MSlider.d.ts +1 -1
- package/dist/vue/components/MStack.d.ts +8 -8
- package/dist/vue/components/MTimePicker.d.ts +40 -40
- package/dist/vue/components/MTimePicker.d.ts.map +1 -1
- package/dist/vue/components/MTooltip.d.ts +1 -1
- package/dist/vue/components/MVirtualList.d.ts.map +1 -1
- package/dist/vue/components/MVirtualList.js +88 -67
- package/dist/vue/components/MVirtualList.js.map +1 -1
- package/dist/vue/components/advanced.d.ts +34 -34
- package/dist/vue/components/configurator.d.ts +33 -33
- package/dist/vue/components/creative.d.ts +20 -20
- package/dist/vue/components/dashboard.d.ts +12 -12
- package/dist/vue/components/dashboard.d.ts.map +1 -1
- package/dist/vue/components/dashboard.js +167 -66
- package/dist/vue/components/dashboard.js.map +1 -1
- package/dist/vue/components/discovery.d.ts +10 -10
- package/dist/vue/components/interactive.d.ts +6 -6
- package/dist/vue/components/layout.d.ts +27 -16
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +3 -0
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/components/navigation.d.ts +4 -4
- package/dist/vue/components/screen-components.d.ts +23 -23
- package/dist/vue/components/wayfinding.d.ts +11 -11
- package/dist/vue/components/workflows.d.ts +5 -5
- package/dist/vue/perspective.d.ts +4 -0
- package/dist/vue/perspective.d.ts.map +1 -0
- package/dist/vue/perspective.js +3 -0
- package/dist/vue/perspective.js.map +1 -0
- package/dist/vue/use-motion-surface.d.ts +1 -1
- package/dist/vue/use-motion-surface.d.ts.map +1 -1
- package/dist/vue/use-motion-surface.js +40 -8
- package/dist/vue/use-motion-surface.js.map +1 -1
- package/package.json +3 -3
- package/src/native/flex-layout.ios.ts +4 -0
- package/src/native/motion-region.ts +1 -0
- package/src/native/motion-surface.ts +58 -13
- package/src/native/moved-shadow.ts +22 -0
- package/src/native/scroll-motion.ts +60 -19
- package/src/native/section-scroll.ts +16 -6
- package/src/native/visual-effects.ts +5 -0
- package/src/vue/card-input.ts +44 -0
- package/src/vue/components/MCard.ts +35 -9
- package/src/vue/components/MVirtualList.ts +104 -78
- package/src/vue/components/dashboard.ts +173 -68
- package/src/vue/components/layout.ts +3 -0
- package/src/vue/perspective.ts +4 -0
- package/src/vue/use-motion-surface.ts +39 -8
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { onBeforeUnmount, watch } from 'nativescript-vue'
|
|
1
|
+
import { Utils, isAndroid, type EventData, type View } from '@nativescript/core'
|
|
2
|
+
import { inject, onBeforeUnmount, watch } from 'nativescript-vue'
|
|
3
3
|
import { animate, set, onReducedMotion } from '@rafaelaugusto/jolt'
|
|
4
4
|
import {
|
|
5
5
|
bindMotionSurface,
|
|
6
|
+
motionChannels,
|
|
7
|
+
motionKeyframes,
|
|
6
8
|
type MotionFrames,
|
|
7
9
|
type MotionSurface,
|
|
8
10
|
} from '@getcortexlabs/mavis-core/experimental'
|
|
9
11
|
import { nativeContinuousSurface } from '../native/motion-surface.js'
|
|
10
12
|
import { nativeMotionOwner } from '../native/motion-owner.js'
|
|
13
|
+
import { perspectiveKey } from './perspective.js'
|
|
14
|
+
import { takeShadow } from '../native/moved-shadow.js'
|
|
11
15
|
|
|
12
16
|
export function useMotionSurface(
|
|
13
17
|
surface: () => MotionSurface | undefined,
|
|
@@ -22,6 +26,20 @@ export function useMotionSurface(
|
|
|
22
26
|
const active = new Map<ReturnType<typeof animate>, MotionFrames>()
|
|
23
27
|
let layoutView: View | undefined
|
|
24
28
|
let layoutQueued = false
|
|
29
|
+
const perspective = inject(perspectiveKey, undefined)
|
|
30
|
+
let flat: { view: View; perspective: number } | undefined
|
|
31
|
+
const project = () => {
|
|
32
|
+
const depth = perspective?.()
|
|
33
|
+
if (flat && (depth === undefined || flat.view !== view)) {
|
|
34
|
+
flat.view.perspective = flat.perspective
|
|
35
|
+
flat = undefined
|
|
36
|
+
}
|
|
37
|
+
if (!view || depth === undefined || !unbind) return
|
|
38
|
+
flat ??= { view, perspective: view.perspective }
|
|
39
|
+
// Core multiplies by the density for Android's camera distance, whose unit is not the
|
|
40
|
+
// CSS distance. This is the factor that draws the same projection as iOS and the Web.
|
|
41
|
+
view.perspective = isAndroid ? depth * Utils.layout.getDisplayDensity() * Math.sqrt(5) : depth
|
|
42
|
+
}
|
|
25
43
|
const clearLayout = () => {
|
|
26
44
|
layoutView?.off('layoutChanged', laidOut)
|
|
27
45
|
layoutView = undefined
|
|
@@ -34,6 +52,7 @@ export function useMotionSurface(
|
|
|
34
52
|
offPreference = undefined
|
|
35
53
|
for (const handle of active.keys()) handle.stop()
|
|
36
54
|
active.clear()
|
|
55
|
+
project()
|
|
37
56
|
}
|
|
38
57
|
const bind = () => {
|
|
39
58
|
release()
|
|
@@ -61,30 +80,41 @@ export function useMotionSurface(
|
|
|
61
80
|
{
|
|
62
81
|
...continuous.adapter,
|
|
63
82
|
animate(values, options) {
|
|
64
|
-
continuous?.interrupt(
|
|
65
|
-
const handle = animate(target, values, options)
|
|
83
|
+
continuous?.interrupt(motionChannels(values))
|
|
84
|
+
const handle = animate(target, motionKeyframes(values), options)
|
|
85
|
+
takeShadow(target, values)
|
|
66
86
|
active.set(handle, values)
|
|
67
87
|
void handle.finished.then(() => active.delete(handle))
|
|
68
88
|
return handle
|
|
69
89
|
},
|
|
70
90
|
set: (values) => {
|
|
71
91
|
continuous?.interrupt(Object.keys(values))
|
|
72
|
-
|
|
92
|
+
const handle = animate(target, values, { duration: 0 })
|
|
93
|
+
takeShadow(target, values)
|
|
94
|
+
return handle
|
|
73
95
|
},
|
|
74
96
|
},
|
|
75
97
|
target,
|
|
76
98
|
),
|
|
77
99
|
)
|
|
100
|
+
project()
|
|
78
101
|
offPreference = onReducedMotion((reduced) => {
|
|
79
102
|
if (!reduced) return
|
|
80
|
-
// Set only spatial channels: opacity can keep
|
|
103
|
+
// Set only spatial channels: opacity and shadow paint can keep their timelines.
|
|
81
104
|
const values: Record<string, number> = {}
|
|
82
|
-
for (const frames of active.values())
|
|
105
|
+
for (const frames of active.values()) {
|
|
106
|
+
if (frames.path)
|
|
107
|
+
Object.assign(values, {
|
|
108
|
+
x: frames.path.end.x,
|
|
109
|
+
y: frames.path.end.y,
|
|
110
|
+
...(frames.orient ? { rotate: frames.path.end.rotate } : {}),
|
|
111
|
+
})
|
|
83
112
|
for (const [property, value] of Object.entries(frames)) {
|
|
84
|
-
if (property === 'opacity') continue
|
|
113
|
+
if (property === 'opacity' || property.startsWith('shadow')) continue
|
|
85
114
|
const final = Array.isArray(value) ? value.at(-1) : value
|
|
86
115
|
if (typeof final === 'number') values[property] = final
|
|
87
116
|
}
|
|
117
|
+
}
|
|
88
118
|
if (Object.keys(values).length) set(target, values)
|
|
89
119
|
})
|
|
90
120
|
}
|
|
@@ -102,6 +132,7 @@ export function useMotionSurface(
|
|
|
102
132
|
view = undefined
|
|
103
133
|
}
|
|
104
134
|
watch(surface, bind, { flush: 'post' })
|
|
135
|
+
if (perspective) watch(perspective, project, { flush: 'post' })
|
|
105
136
|
watch(enabled, () => continuous?.refresh(), { flush: 'sync' })
|
|
106
137
|
onBeforeUnmount(unloaded)
|
|
107
138
|
return {
|