@getcortexlabs/mavis 0.1.0-alpha.6 → 0.1.0-alpha.7
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/motion-owner.d.ts.map +1 -1
- package/dist/native/motion-owner.js +1 -0
- package/dist/native/motion-owner.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 +11 -1
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/press.d.ts +2 -0
- package/dist/native/press.d.ts.map +1 -1
- package/dist/native/press.js +6 -0
- package/dist/native/press.js.map +1 -1
- package/dist/vue/components/ChoiceControl.d.ts.map +1 -1
- package/dist/vue/components/ChoiceControl.js +20 -5
- package/dist/vue/components/ChoiceControl.js.map +1 -1
- package/dist/vue/components/DateCalendar.d.ts +3 -3
- package/dist/vue/components/MAlert.d.ts +1 -1
- package/dist/vue/components/MBadge.d.ts +1 -1
- package/dist/vue/components/MButton.d.ts +6 -6
- package/dist/vue/components/MCard.d.ts +5 -5
- package/dist/vue/components/MChip.d.ts +3 -3
- package/dist/vue/components/MDatePicker.d.ts +16 -16
- package/dist/vue/components/MDialog.d.ts +1 -1
- package/dist/vue/components/MEmptyState.d.ts +2 -2
- package/dist/vue/components/MFilePicker.d.ts +2 -2
- package/dist/vue/components/MIcon.d.ts +1 -1
- package/dist/vue/components/MImage.d.ts +192 -0
- package/dist/vue/components/MImage.d.ts.map +1 -0
- package/dist/vue/components/MImage.js +102 -0
- package/dist/vue/components/MImage.js.map +1 -0
- package/dist/vue/components/MInput.d.ts +2 -2
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MInput.js +9 -5
- package/dist/vue/components/MInput.js.map +1 -1
- package/dist/vue/components/MLink.d.ts +1 -1
- package/dist/vue/components/MProgress.d.ts +2 -2
- package/dist/vue/components/MReveal.d.ts +3 -3
- package/dist/vue/components/MSkeleton.d.ts +1 -1
- package/dist/vue/components/MStack.d.ts +3 -3
- package/dist/vue/components/MSwitch.d.ts.map +1 -1
- package/dist/vue/components/MSwitch.js +13 -3
- package/dist/vue/components/MSwitch.js.map +1 -1
- package/dist/vue/components/MText.d.ts +4 -4
- package/dist/vue/components/configurator.d.ts +541 -0
- package/dist/vue/components/configurator.d.ts.map +1 -0
- package/dist/vue/components/configurator.js +24 -0
- package/dist/vue/components/configurator.js.map +1 -0
- package/dist/vue/components/layout.d.ts +8 -8
- package/dist/vue/components/workflows.d.ts +1 -1
- package/dist/vue/index.d.ts +3 -1
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +6 -1
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/use-choice-paint.d.ts +9 -0
- package/dist/vue/use-choice-paint.d.ts.map +1 -0
- package/dist/vue/use-choice-paint.js +32 -0
- package/dist/vue/use-choice-paint.js.map +1 -0
- package/package.json +3 -3
- package/src/native/motion-owner.ts +1 -0
- package/src/native/motion-surface.ts +12 -1
- package/src/native/press.ts +6 -0
- package/src/vue/components/ChoiceControl.ts +25 -5
- package/src/vue/components/MImage.ts +117 -0
- package/src/vue/components/MInput.ts +9 -5
- package/src/vue/components/MSwitch.ts +16 -3
- package/src/vue/components/configurator.ts +27 -0
- package/src/vue/index.ts +8 -0
- package/src/vue/use-choice-paint.ts +39 -0
- package/dist/vue/reveal-motion.d.ts +0 -13
- package/dist/vue/reveal-motion.d.ts.map +0 -1
- package/dist/vue/reveal-motion.js +0 -58
- package/dist/vue/reveal-motion.js.map +0 -1
package/dist/vue/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MNumberInput, MMultiSelect } from './components/configurator.js';
|
|
2
|
+
import { MImage } from './components/MImage.js';
|
|
1
3
|
import { MStack } from './components/MStack.js';
|
|
2
4
|
import { MLink } from './components/MLink.js';
|
|
3
5
|
import { MDatePicker, MDateRangePicker } from './components/MDatePicker.js';
|
|
@@ -35,7 +37,7 @@ import { MIcon } from './components/MIcon.js';
|
|
|
35
37
|
import { MReveal } from './components/MReveal.js';
|
|
36
38
|
import { MSheet } from './components/MSheet.js';
|
|
37
39
|
import { systemBackKey } from './system-back.js';
|
|
38
|
-
export { MThemeProvider, MSpan, MScreen, MBox, MRow, MColumn, MStack, MLink, MCard, MText, MButton, MSlider, MSwitch, MCheckbox, MRadioGroup, MSelect, MToast, MDialog, MTabs, MSkeleton, MChip, MEmptyState, MProgress, MAccordion, MSegmentedControl, MAlert, MListItem, MSeparator, MAvatar, MBadge, MInput, MIcon, MReveal, MSheet, MDatePicker, MDateRangePicker, MCombobox, MFilePicker, MFormGroup, MFormErrors, MSteps, MPagination, };
|
|
40
|
+
export { MThemeProvider, MSpan, MScreen, MBox, MRow, MColumn, MStack, MLink, MCard, MText, MButton, MSlider, MSwitch, MCheckbox, MRadioGroup, MSelect, MToast, MDialog, MTabs, MSkeleton, MChip, MEmptyState, MProgress, MAccordion, MSegmentedControl, MAlert, MListItem, MSeparator, MAvatar, MBadge, MInput, MIcon, MReveal, MSheet, MDatePicker, MDateRangePicker, MNumberInput, MMultiSelect, MImage, MCombobox, MFilePicker, MFormGroup, MFormErrors, MSteps, MPagination, };
|
|
39
41
|
export { useMavisTheme, useToast, useFormController, useFormField, useFileSelection, } from '@getcortexlabs/mavis-core/vue';
|
|
40
42
|
/** Create one plugin per application; `system` appearance follows the device. Vue also resolves MButton as <m-button>. */
|
|
41
43
|
export function createMavis(options = {}) {
|
|
@@ -84,6 +86,9 @@ export function createMavis(options = {}) {
|
|
|
84
86
|
MSheet,
|
|
85
87
|
MDatePicker,
|
|
86
88
|
MDateRangePicker,
|
|
89
|
+
MNumberInput,
|
|
90
|
+
MMultiSelect,
|
|
91
|
+
MImage,
|
|
87
92
|
MCombobox,
|
|
88
93
|
MFilePicker,
|
|
89
94
|
MFormGroup,
|
package/dist/vue/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":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IAAI,MAAM,CAAC,OAAO,CAAC;gBAC7C,cAAc;gBACd,KAAK;gBACL,OAAO;gBACP,IAAI;gBACJ,IAAI;gBACJ,OAAO;gBACP,MAAM;gBACN,KAAK;gBACL,KAAK;gBACL,KAAK;gBACL,OAAO;gBACP,OAAO;gBACP,OAAO;gBACP,SAAS;gBACT,WAAW;gBACX,OAAO;gBACP,MAAM;gBACN,OAAO;gBACP,KAAK;gBACL,SAAS;gBACT,KAAK;gBACL,WAAW;gBACX,SAAS;gBACT,UAAU;gBACV,iBAAiB;gBACjB,MAAM;gBACN,SAAS;gBACT,UAAU;gBACV,OAAO;gBACP,MAAM;gBACN,MAAM;gBACN,KAAK;gBACL,OAAO;gBACP,MAAM;gBACN,WAAW;gBACX,gBAAgB;gBAChB,YAAY;gBACZ,YAAY;gBACZ,MAAM;gBACN,SAAS;gBACT,WAAW;gBACX,UAAU;gBACV,WAAW;gBACX,MAAM;gBACN,WAAW;aACZ,CAAC,EAAE,CAAC;gBACH,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;YAChC,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC;AAED,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Ref } from 'nativescript-vue';
|
|
2
|
+
import type { EventData } from '@nativescript/core';
|
|
3
|
+
import { type ChoicePaint, type MavisTheme } from '@getcortexlabs/mavis-core';
|
|
4
|
+
export declare function useChoicePaint(paint: () => ChoicePaint, theme: Readonly<Ref<Readonly<MavisTheme>>>): {
|
|
5
|
+
style: ChoicePaint;
|
|
6
|
+
onLoaded: (event: EventData) => void;
|
|
7
|
+
onUnloaded: () => void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=use-choice-paint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-choice-paint.d.ts","sourceRoot":"","sources":["../../src/vue/use-choice-paint.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,oBAAoB,CAAA;AAEzD,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAE3F,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,WAAW,EACxB,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;;sBAwBtB,SAAS;;EAO9B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { onBeforeUnmount, watch } from 'nativescript-vue';
|
|
2
|
+
import { animate } from '@rafaelaugusto/jolt';
|
|
3
|
+
import { choiceMotion } from '@getcortexlabs/mavis-core';
|
|
4
|
+
export function useChoicePaint(paint, theme) {
|
|
5
|
+
const initial = paint();
|
|
6
|
+
let target;
|
|
7
|
+
let playback;
|
|
8
|
+
function update(instant = false) {
|
|
9
|
+
if (!target?.isLoaded)
|
|
10
|
+
return;
|
|
11
|
+
const previous = playback;
|
|
12
|
+
playback = animate(target, paint(), instant ? { duration: 0 } : choiceMotion(theme.value));
|
|
13
|
+
previous?.stop();
|
|
14
|
+
}
|
|
15
|
+
function unload() {
|
|
16
|
+
playback?.stop();
|
|
17
|
+
playback = undefined;
|
|
18
|
+
target = undefined;
|
|
19
|
+
}
|
|
20
|
+
watch(() => [paint(), theme.value.motion], () => update(), { deep: true, flush: 'post' });
|
|
21
|
+
onBeforeUnmount(unload);
|
|
22
|
+
return {
|
|
23
|
+
style: initial,
|
|
24
|
+
onLoaded: (event) => {
|
|
25
|
+
unload();
|
|
26
|
+
target = event.object;
|
|
27
|
+
update(true);
|
|
28
|
+
},
|
|
29
|
+
onUnloaded: unload,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=use-choice-paint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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K,CAAC,MAAc,CAAA;YAC7B,MAAM,CAAC,IAAI,CAAC,CAAA;QACd,CAAC;QACD,UAAU,EAAE,MAAM;KACnB,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getcortexlabs/mavis",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"description": "Mavis UI foundations for NativeScript, with a Vue integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@nativescript/core": "^9.1.3",
|
|
35
|
-
"@rafaelaugusto/jolt": "^0.1.0-rc.
|
|
35
|
+
"@rafaelaugusto/jolt": "^0.1.0-rc.9",
|
|
36
36
|
"nativescript-vue": "^3.1.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@getcortexlabs/mavis-core": "0.1.0-alpha.
|
|
44
|
+
"@getcortexlabs/mavis-core": "0.1.0-alpha.7"
|
|
45
45
|
},
|
|
46
46
|
"nativescript": {
|
|
47
47
|
"platforms": {
|
|
@@ -29,6 +29,7 @@ export function nativeMotionOwner(
|
|
|
29
29
|
result.motionValue && ((...args) => child.add(result.motionValue!(...args))),
|
|
30
30
|
springValue:
|
|
31
31
|
result.springValue && ((...args) => child.add(result.springValue!(...args))),
|
|
32
|
+
mapColor: result.mapColor && ((...args) => child.add(result.mapColor!(...args))),
|
|
32
33
|
map: result.map && ((...args) => child.add(result.map!(...args))),
|
|
33
34
|
bind: result.bind && ((...args) => child.add(result.bind!(...args))),
|
|
34
35
|
drag: result.drag && ((...args) => child.add(result.drag!(...args))),
|
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
|
|
21
21
|
export function nativeContinuousSurface(target: View, enabled: () => boolean) {
|
|
22
22
|
const sources = new WeakMap<object, DerivedValue>()
|
|
23
|
+
const colorSources = new WeakMap<object, import('@rafaelaugusto/jolt').DerivedColor>()
|
|
23
24
|
const refreshes = new Set<() => void>()
|
|
24
25
|
const scrolls = new Set<ReturnType<typeof nativeScrollMotion>>()
|
|
25
26
|
const interrupt = (properties: readonly string[]) => {
|
|
@@ -37,6 +38,7 @@ export function nativeContinuousSurface(target: View, enabled: () => boolean) {
|
|
|
37
38
|
| 'bind'
|
|
38
39
|
| 'drag'
|
|
39
40
|
| 'map'
|
|
41
|
+
| 'mapColor'
|
|
40
42
|
| 'refresh'
|
|
41
43
|
| 'scrollLinked'
|
|
42
44
|
| 'pointerFollow'
|
|
@@ -81,6 +83,12 @@ export function nativeContinuousSurface(target: View, enabled: () => boolean) {
|
|
|
81
83
|
sources.set(value, mapped)
|
|
82
84
|
return value
|
|
83
85
|
},
|
|
86
|
+
mapColor(source, input, output) {
|
|
87
|
+
const mapped = sources.get(source)!.to(input, output)
|
|
88
|
+
const value = { get: () => mapped.get().hex, dispose() {} }
|
|
89
|
+
colorSources.set(value, mapped)
|
|
90
|
+
return value
|
|
91
|
+
},
|
|
84
92
|
animateValue(value, frames, options) {
|
|
85
93
|
const source = sources.get(value)
|
|
86
94
|
if (!source) throw new TypeError('Use a mutable native motion value.')
|
|
@@ -134,7 +142,10 @@ export function nativeContinuousSurface(target: View, enabled: () => boolean) {
|
|
|
134
142
|
const dispose = bind(
|
|
135
143
|
target,
|
|
136
144
|
Object.fromEntries(
|
|
137
|
-
Object.entries(values).map(([key, value]) => [
|
|
145
|
+
Object.entries(values).map(([key, value]) => [
|
|
146
|
+
key,
|
|
147
|
+
colorSources.get(value) ?? sources.get(value)!,
|
|
148
|
+
]),
|
|
138
149
|
),
|
|
139
150
|
)
|
|
140
151
|
return { dispose }
|
package/src/native/press.ts
CHANGED
|
@@ -2,6 +2,11 @@ import type { EventData, TouchGestureEventData, View } from '@nativescript/core'
|
|
|
2
2
|
import { animate, stop, onReducedMotion } from '@rafaelaugusto/jolt'
|
|
3
3
|
import { pressMotion, type MotionTheme } from '@getcortexlabs/mavis-core'
|
|
4
4
|
|
|
5
|
+
const pressCallbacks = new WeakSet<Function>()
|
|
6
|
+
/** Internal diagnostics distinguish animation input from a control's own touch behavior. */
|
|
7
|
+
export function isPressFeedbackCallback(callback: unknown) {
|
|
8
|
+
return typeof callback === 'function' && pressCallbacks.has(callback)
|
|
9
|
+
}
|
|
5
10
|
let nextLayer = 0
|
|
6
11
|
|
|
7
12
|
/** Press multiplies the app's scale; releasing it removes only that contribution. */
|
|
@@ -41,6 +46,7 @@ export function attachPressFeedback(view: View, scale: number | Readonly<MotionT
|
|
|
41
46
|
animate(view, motion[pressed ? 'pressed' : 'released'][0], { duration: 0, layer })
|
|
42
47
|
}
|
|
43
48
|
})
|
|
49
|
+
pressCallbacks.add(onTouch)
|
|
44
50
|
view.on('touch', onTouch)
|
|
45
51
|
view.on('unloaded', remove)
|
|
46
52
|
return Object.assign(remove, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useChoicePaint } from '../use-choice-paint.js'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -27,7 +28,21 @@ export const ChoiceControl = defineComponent({
|
|
|
27
28
|
setup(props, { attrs, emit }) {
|
|
28
29
|
const { theme } = useMavisTheme()
|
|
29
30
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
31
|
+
const paint = useChoicePaint(
|
|
32
|
+
() => ({
|
|
33
|
+
borderColor:
|
|
34
|
+
props.modelValue || props.indeterminate
|
|
35
|
+
? theme.value.colors.primary
|
|
36
|
+
: theme.value.colors.muted,
|
|
37
|
+
backgroundColor:
|
|
38
|
+
!props.radio && (props.modelValue || props.indeterminate)
|
|
39
|
+
? theme.value.colors.primary
|
|
40
|
+
: 'transparent',
|
|
41
|
+
}),
|
|
42
|
+
theme,
|
|
43
|
+
)
|
|
30
44
|
const focused = ref(false)
|
|
45
|
+
let touchView: View | undefined
|
|
31
46
|
let mark: View | undefined
|
|
32
47
|
let motion: ReturnType<typeof animate> | undefined
|
|
33
48
|
let observer: ReturnType<typeof observeCheckbox> | undefined
|
|
@@ -41,6 +56,8 @@ export const ChoiceControl = defineComponent({
|
|
|
41
56
|
}
|
|
42
57
|
}
|
|
43
58
|
function unload() {
|
|
59
|
+
touchView?.off('touch', touch)
|
|
60
|
+
touchView = undefined
|
|
44
61
|
restore()
|
|
45
62
|
observer?.dispose()
|
|
46
63
|
observer = undefined
|
|
@@ -60,8 +77,9 @@ export const ChoiceControl = defineComponent({
|
|
|
60
77
|
{ flush: 'post' },
|
|
61
78
|
)
|
|
62
79
|
|
|
63
|
-
function touch(
|
|
64
|
-
|
|
80
|
+
function touch(data: EventData) {
|
|
81
|
+
const event = data as TouchGestureEventData
|
|
82
|
+
if (!mark || props.disabled || !props.pressFeedback) return
|
|
65
83
|
if (!['down', 'up', 'cancel'].includes(event.action)) return
|
|
66
84
|
motion?.stop()
|
|
67
85
|
const scale = event.action === 'down' ? 0.9 : 1
|
|
@@ -123,9 +141,10 @@ export const ChoiceControl = defineComponent({
|
|
|
123
141
|
onTap: () => {
|
|
124
142
|
if (!props.disabled) emit('activate')
|
|
125
143
|
},
|
|
126
|
-
onTouch: props.pressFeedback ? touch : undefined,
|
|
127
144
|
onLoaded: (event: EventData) => {
|
|
128
145
|
unload()
|
|
146
|
+
touchView = event.object as View
|
|
147
|
+
touchView.on('touch', touch)
|
|
129
148
|
observer = observeCheckbox(event.object as View, (value) => {
|
|
130
149
|
focused.value = value
|
|
131
150
|
})
|
|
@@ -154,14 +173,15 @@ export const ChoiceControl = defineComponent({
|
|
|
154
173
|
accessibilityHidden: true,
|
|
155
174
|
style: {
|
|
156
175
|
borderWidth: 2,
|
|
157
|
-
|
|
158
|
-
backgroundColor: !props.radio && selected ? colors.primary : 'transparent',
|
|
176
|
+
...paint.style,
|
|
159
177
|
},
|
|
160
178
|
onLoaded: (event: EventData) => {
|
|
161
179
|
mark = event.object as View
|
|
180
|
+
paint.onLoaded(event)
|
|
162
181
|
},
|
|
163
182
|
onUnloaded: () => {
|
|
164
183
|
restore()
|
|
184
|
+
paint.onUnloaded()
|
|
165
185
|
mark = undefined
|
|
166
186
|
},
|
|
167
187
|
},
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineComponent,
|
|
3
|
+
h,
|
|
4
|
+
mergeProps,
|
|
5
|
+
onBeforeUnmount,
|
|
6
|
+
ref,
|
|
7
|
+
shallowRef,
|
|
8
|
+
watch,
|
|
9
|
+
} from 'nativescript-vue'
|
|
10
|
+
import type { EventData, View, ImageSource } from '@nativescript/core'
|
|
11
|
+
import { imageProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
12
|
+
import { resolveRadius } from '@getcortexlabs/mavis-core'
|
|
13
|
+
import { loadAvatarImage } from '../../native/avatar-image'
|
|
14
|
+
import { MBox } from './layout.js'
|
|
15
|
+
import { MText } from './MText.js'
|
|
16
|
+
|
|
17
|
+
export const MImage = defineComponent({
|
|
18
|
+
name: 'MImage',
|
|
19
|
+
inheritAttrs: false,
|
|
20
|
+
props: imageProps,
|
|
21
|
+
emits: { load: (_src: string) => true, error: (_src: string) => true },
|
|
22
|
+
setup(props, { attrs, emit }) {
|
|
23
|
+
const { theme } = useMavisTheme()
|
|
24
|
+
const image = shallowRef<ImageSource | null>(null)
|
|
25
|
+
const status = ref<'loading' | 'ready' | 'error'>('loading')
|
|
26
|
+
const width = ref(typeof props.width === 'number' ? props.width : 0)
|
|
27
|
+
let generation = 0,
|
|
28
|
+
loaded = false
|
|
29
|
+
async function load() {
|
|
30
|
+
const current = ++generation,
|
|
31
|
+
src = props.src
|
|
32
|
+
image.value = null
|
|
33
|
+
status.value = src.trim() ? 'loading' : 'error'
|
|
34
|
+
if (!loaded || !src.trim()) return
|
|
35
|
+
try {
|
|
36
|
+
const result = await loadAvatarImage(src.trim())
|
|
37
|
+
if (current !== generation || !loaded) return
|
|
38
|
+
if (!result || result.width <= 0 || result.height <= 0)
|
|
39
|
+
throw new Error('Image could not be decoded.')
|
|
40
|
+
image.value = result
|
|
41
|
+
status.value = 'ready'
|
|
42
|
+
emit('load', src)
|
|
43
|
+
} catch {
|
|
44
|
+
if (current !== generation || !loaded) return
|
|
45
|
+
status.value = 'error'
|
|
46
|
+
emit('error', src)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function unload() {
|
|
50
|
+
loaded = false
|
|
51
|
+
generation++
|
|
52
|
+
image.value = null
|
|
53
|
+
}
|
|
54
|
+
watch(
|
|
55
|
+
() => props.src,
|
|
56
|
+
() => {
|
|
57
|
+
void load()
|
|
58
|
+
},
|
|
59
|
+
)
|
|
60
|
+
onBeforeUnmount(unload)
|
|
61
|
+
return () => {
|
|
62
|
+
if (!Number.isFinite(props.aspectRatio) || props.aspectRatio <= 0)
|
|
63
|
+
throw new RangeError('aspectRatio must be finite and positive.')
|
|
64
|
+
const radius = resolveRadius(theme.value, props.radius)
|
|
65
|
+
return h(
|
|
66
|
+
MBox,
|
|
67
|
+
mergeProps(attrs, {
|
|
68
|
+
...props,
|
|
69
|
+
width: props.width ?? '100%',
|
|
70
|
+
height: props.height ?? width.value / props.aspectRatio,
|
|
71
|
+
backgroundColor: props.backgroundColor || theme.value.colors.elevated,
|
|
72
|
+
accessible: Boolean(props.alt),
|
|
73
|
+
accessibilityRole: 'image',
|
|
74
|
+
accessibilityLabel: props.alt,
|
|
75
|
+
accessibilityHint:
|
|
76
|
+
status.value === 'ready'
|
|
77
|
+
? ''
|
|
78
|
+
: status.value === 'error'
|
|
79
|
+
? props.errorLabel
|
|
80
|
+
: props.loadingLabel,
|
|
81
|
+
accessibilityHidden: props.accessibilityHidden || !props.alt,
|
|
82
|
+
onLoaded: () => {
|
|
83
|
+
loaded = true
|
|
84
|
+
void load()
|
|
85
|
+
},
|
|
86
|
+
onUnloaded: unload,
|
|
87
|
+
onLayoutChanged: (event: EventData) => {
|
|
88
|
+
const next = (event.object as View).getActualSize().width
|
|
89
|
+
if (next > 0 && Math.abs(next - width.value) > 0.1) width.value = next
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
() =>
|
|
93
|
+
image.value
|
|
94
|
+
? [
|
|
95
|
+
h('Image', {
|
|
96
|
+
imageSource: image.value,
|
|
97
|
+
width: '100%',
|
|
98
|
+
height: '100%',
|
|
99
|
+
stretch: props.fit === 'cover' ? 'aspectFill' : 'aspectFit',
|
|
100
|
+
borderRadius: radius,
|
|
101
|
+
accessible: false,
|
|
102
|
+
accessibilityHidden: true,
|
|
103
|
+
}),
|
|
104
|
+
]
|
|
105
|
+
: [
|
|
106
|
+
h(MText, {
|
|
107
|
+
text: status.value === 'error' ? props.errorLabel : props.loadingLabel,
|
|
108
|
+
tone: 'muted',
|
|
109
|
+
variant: 'caption',
|
|
110
|
+
accessibilityHidden: true,
|
|
111
|
+
style: { textAlignment: 'center', verticalAlignment: 'middle', padding: 16 },
|
|
112
|
+
}),
|
|
113
|
+
],
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
})
|
|
@@ -158,11 +158,15 @@ const Input = defineComponent({
|
|
|
158
158
|
returnKeyType: props.returnKey,
|
|
159
159
|
}),
|
|
160
160
|
keyboardType:
|
|
161
|
-
props.
|
|
162
|
-
? '
|
|
163
|
-
:
|
|
164
|
-
?
|
|
165
|
-
:
|
|
161
|
+
props.inputmode === 'decimal'
|
|
162
|
+
? 'decimal'
|
|
163
|
+
: props.inputmode === 'numeric'
|
|
164
|
+
? 'number'
|
|
165
|
+
: props.type === 'tel'
|
|
166
|
+
? 'phone'
|
|
167
|
+
: ['email', 'url'].includes(props.type)
|
|
168
|
+
? props.type
|
|
169
|
+
: undefined,
|
|
166
170
|
autocapitalizationType: capitalize === 'characters' ? 'allcharacters' : capitalize,
|
|
167
171
|
autocorrect: props.autocorrect ?? text,
|
|
168
172
|
maxLength: props.maxLength ?? Infinity,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useChoicePaint } from '../use-choice-paint.js'
|
|
1
2
|
import { isAndroid } from '@nativescript/core'
|
|
2
3
|
import { defineComponent, h, mergeProps, nextTick, onBeforeUnmount } from 'nativescript-vue'
|
|
3
4
|
import type {
|
|
@@ -26,6 +27,12 @@ export const MSwitch = defineComponent({
|
|
|
26
27
|
useButtonAction()
|
|
27
28
|
const { theme } = useMavisTheme()
|
|
28
29
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
30
|
+
const paint = useChoicePaint(
|
|
31
|
+
() => ({
|
|
32
|
+
backgroundColor: isAndroid ? theme.value.colors.primarySoft : theme.value.colors.primary,
|
|
33
|
+
}),
|
|
34
|
+
theme,
|
|
35
|
+
)
|
|
29
36
|
const feedback = usePressFeedback(() => !props.disabled, theme)
|
|
30
37
|
let control: Switch | undefined
|
|
31
38
|
let restoring = false
|
|
@@ -40,7 +47,8 @@ export const MSwitch = defineComponent({
|
|
|
40
47
|
start = undefined
|
|
41
48
|
verticalDrag = false
|
|
42
49
|
}
|
|
43
|
-
function touch(
|
|
50
|
+
function touch(data: EventData) {
|
|
51
|
+
const event = data as TouchGestureEventData
|
|
44
52
|
if (event.action === 'down') {
|
|
45
53
|
resetTouch()
|
|
46
54
|
start = { x: event.getX(), y: event.getY() }
|
|
@@ -62,6 +70,8 @@ export const MSwitch = defineComponent({
|
|
|
62
70
|
|
|
63
71
|
function release() {
|
|
64
72
|
resetTouch()
|
|
73
|
+
control?.off('touch', touch)
|
|
74
|
+
paint.onUnloaded()
|
|
65
75
|
control = undefined
|
|
66
76
|
revision++
|
|
67
77
|
}
|
|
@@ -153,6 +163,8 @@ export const MSwitch = defineComponent({
|
|
|
153
163
|
accessibilityHint: props.helperText || undefined,
|
|
154
164
|
// Android's thumb extends beyond the narrow track: a light
|
|
155
165
|
// thumb disappears against a light settings surface.
|
|
166
|
+
style: paint.style,
|
|
167
|
+
// Switch.color is a platform thumb tint, not Jolt's text-color channel.
|
|
156
168
|
color: isAndroid
|
|
157
169
|
? props.modelValue
|
|
158
170
|
? colors.primary
|
|
@@ -160,13 +172,14 @@ export const MSwitch = defineComponent({
|
|
|
160
172
|
: props.modelValue
|
|
161
173
|
? colors.onPrimary
|
|
162
174
|
: colors.surface,
|
|
163
|
-
backgroundColor: isAndroid ? colors.primarySoft : colors.primary,
|
|
164
175
|
offBackgroundColor: isAndroid ? colors.border : colors.muted,
|
|
165
176
|
margin: 0,
|
|
166
|
-
onTouch: touch,
|
|
167
177
|
onCheckedChange: change,
|
|
168
178
|
onLoaded: (event: EventData) => {
|
|
179
|
+
release()
|
|
169
180
|
control = event.object as Switch
|
|
181
|
+
control.on('touch', touch)
|
|
182
|
+
paint.onLoaded(event)
|
|
170
183
|
// A retained page can unload before a pending restoration.
|
|
171
184
|
restoring = true
|
|
172
185
|
try {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Utils, type View } from '@nativescript/core'
|
|
2
|
+
import { createConfiguratorControls } from '@getcortexlabs/mavis-core/vue'
|
|
3
|
+
import { MText } from './MText.js'
|
|
4
|
+
import { MButton } from './MButton.js'
|
|
5
|
+
import { MInput } from './MInput.js'
|
|
6
|
+
import { MChip } from './MChip.js'
|
|
7
|
+
import { MCheckbox } from './MCheckbox.js'
|
|
8
|
+
import { MSheet } from './MSheet.js'
|
|
9
|
+
import { MColumn, MRow } from './layout.js'
|
|
10
|
+
|
|
11
|
+
export const { MNumberInput, MMultiSelect } = createConfiguratorControls(
|
|
12
|
+
{
|
|
13
|
+
Column: MColumn,
|
|
14
|
+
Row: MRow,
|
|
15
|
+
Text: MText,
|
|
16
|
+
Button: MButton,
|
|
17
|
+
Input: MInput,
|
|
18
|
+
Chip: MChip,
|
|
19
|
+
Checkbox: MCheckbox,
|
|
20
|
+
Sheet: MSheet,
|
|
21
|
+
focusTrigger: (component) => {
|
|
22
|
+
Utils.dismissKeyboard()
|
|
23
|
+
;(component as { $el?: { nativeView?: View } } | undefined)?.$el?.nativeView?.focus()
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
'native',
|
|
27
|
+
)
|
package/src/vue/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MNumberInput, MMultiSelect } from './components/configurator.js'
|
|
2
|
+
import { MImage } from './components/MImage.js'
|
|
1
3
|
import { MStack } from './components/MStack.js'
|
|
2
4
|
import { MLink } from './components/MLink.js'
|
|
3
5
|
import { MDatePicker, MDateRangePicker } from './components/MDatePicker.js'
|
|
@@ -81,6 +83,9 @@ export {
|
|
|
81
83
|
MSheet,
|
|
82
84
|
MDatePicker,
|
|
83
85
|
MDateRangePicker,
|
|
86
|
+
MNumberInput,
|
|
87
|
+
MMultiSelect,
|
|
88
|
+
MImage,
|
|
84
89
|
MCombobox,
|
|
85
90
|
MFilePicker,
|
|
86
91
|
MFormGroup,
|
|
@@ -159,6 +164,9 @@ export function createMavis(options: MavisOptions = {}) {
|
|
|
159
164
|
MSheet,
|
|
160
165
|
MDatePicker,
|
|
161
166
|
MDateRangePicker,
|
|
167
|
+
MNumberInput,
|
|
168
|
+
MMultiSelect,
|
|
169
|
+
MImage,
|
|
162
170
|
MCombobox,
|
|
163
171
|
MFilePicker,
|
|
164
172
|
MFormGroup,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { onBeforeUnmount, watch, type Ref } from 'nativescript-vue'
|
|
2
|
+
import type { EventData, View } from '@nativescript/core'
|
|
3
|
+
import { animate } from '@rafaelaugusto/jolt'
|
|
4
|
+
import { choiceMotion, type ChoicePaint, type MavisTheme } from '@getcortexlabs/mavis-core'
|
|
5
|
+
|
|
6
|
+
export function useChoicePaint(
|
|
7
|
+
paint: () => ChoicePaint,
|
|
8
|
+
theme: Readonly<Ref<Readonly<MavisTheme>>>,
|
|
9
|
+
) {
|
|
10
|
+
const initial = paint()
|
|
11
|
+
let target: View | undefined
|
|
12
|
+
let playback: ReturnType<typeof animate> | undefined
|
|
13
|
+
function update(instant = false) {
|
|
14
|
+
if (!target?.isLoaded) return
|
|
15
|
+
const previous = playback
|
|
16
|
+
playback = animate(target, paint(), instant ? { duration: 0 } : choiceMotion(theme.value))
|
|
17
|
+
previous?.stop()
|
|
18
|
+
}
|
|
19
|
+
function unload() {
|
|
20
|
+
playback?.stop()
|
|
21
|
+
playback = undefined
|
|
22
|
+
target = undefined
|
|
23
|
+
}
|
|
24
|
+
watch(
|
|
25
|
+
() => [paint(), theme.value.motion],
|
|
26
|
+
() => update(),
|
|
27
|
+
{ deep: true, flush: 'post' },
|
|
28
|
+
)
|
|
29
|
+
onBeforeUnmount(unload)
|
|
30
|
+
return {
|
|
31
|
+
style: initial,
|
|
32
|
+
onLoaded: (event: EventData) => {
|
|
33
|
+
unload()
|
|
34
|
+
target = event.object as View
|
|
35
|
+
update(true)
|
|
36
|
+
},
|
|
37
|
+
onUnloaded: unload,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { View } from '@nativescript/core';
|
|
2
|
-
type Element = {
|
|
3
|
-
nativeView: View;
|
|
4
|
-
};
|
|
5
|
-
/** Each transition owns its completion; an interrupted leave cannot finish a new entry. */
|
|
6
|
-
export declare function useRevealMotion(): {
|
|
7
|
-
onEnter: (element: Element, done: () => void) => void;
|
|
8
|
-
onLeave: (element: Element, done: () => void) => void;
|
|
9
|
-
onEnterCancelled: ({ nativeView: view }: Element) => void;
|
|
10
|
-
onLeaveCancelled: ({ nativeView: view }: Element) => void;
|
|
11
|
-
};
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=reveal-motion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reveal-motion.d.ts","sourceRoot":"","sources":["../../src/vue/reveal-motion.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAI9C,KAAK,OAAO,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,CAAA;AAEnC,2FAA2F;AAC3F,wBAAgB,eAAe;uBAcuB,OAAO,QAAQ,MAAM,IAAI;uBAAzB,OAAO,QAAQ,MAAM,IAAI;6CAPvC,OAAO;6CAAP,OAAO;EA+C9C"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { onBeforeUnmount } from 'nativescript-vue';
|
|
2
|
-
import { useMavisTheme } from '@getcortexlabs/mavis-core/vue';
|
|
3
|
-
import { animate, set, onReducedMotion } from '@rafaelaugusto/jolt';
|
|
4
|
-
import { motionRecipe } from '@getcortexlabs/mavis-core';
|
|
5
|
-
/** Each transition owns its completion; an interrupted leave cannot finish a new entry. */
|
|
6
|
-
export function useRevealMotion() {
|
|
7
|
-
const { theme } = useMavisTheme();
|
|
8
|
-
const entered = new WeakSet();
|
|
9
|
-
const active = new Map();
|
|
10
|
-
const cancel = ({ nativeView: view }) => {
|
|
11
|
-
const operation = active.get(view);
|
|
12
|
-
if (!operation)
|
|
13
|
-
return;
|
|
14
|
-
active.delete(view);
|
|
15
|
-
operation.remove();
|
|
16
|
-
operation.handle.stop();
|
|
17
|
-
};
|
|
18
|
-
const run = (phase) => (element, done) => {
|
|
19
|
-
const recipe = motionRecipe(theme.value, phase === 'enter' ? 'enter' : 'exit');
|
|
20
|
-
const view = element.nativeView;
|
|
21
|
-
cancel(element);
|
|
22
|
-
if (phase === 'enter' && !entered.has(view)) {
|
|
23
|
-
entered.add(view);
|
|
24
|
-
set(view, { opacity: 0, y: theme.value.motion.enterOffset });
|
|
25
|
-
}
|
|
26
|
-
const handle = animate(view, phase === 'enter' ? { opacity: 1, y: 0 } : { opacity: 0 }, recipe.transition);
|
|
27
|
-
const unloaded = () => cancel(element);
|
|
28
|
-
const operation = { handle, phase, remove: () => view.off('unloaded', unloaded) };
|
|
29
|
-
active.set(view, operation);
|
|
30
|
-
view.on('unloaded', unloaded);
|
|
31
|
-
void handle.finished.then(() => {
|
|
32
|
-
if (active.get(view) !== operation)
|
|
33
|
-
return;
|
|
34
|
-
active.delete(view);
|
|
35
|
-
operation.remove();
|
|
36
|
-
done();
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
const offPreference = onReducedMotion((reduced) => {
|
|
40
|
-
if (reduced)
|
|
41
|
-
for (const [view, operation] of active) {
|
|
42
|
-
if (operation.phase === 'enter')
|
|
43
|
-
set(view, { y: 0 });
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
onBeforeUnmount(() => {
|
|
47
|
-
offPreference();
|
|
48
|
-
for (const view of active.keys())
|
|
49
|
-
cancel({ nativeView: view });
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
onEnter: run('enter'),
|
|
53
|
-
onLeave: run('leave'),
|
|
54
|
-
onEnterCancelled: cancel,
|
|
55
|
-
onLeaveCancelled: cancel,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=reveal-motion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reveal-motion.js","sourceRoot":"","sources":["../../src/vue/reveal-motion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAIxD,2FAA2F;AAC3F,MAAM,UAAU,eAAe;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,EAAE,CAAA;IACjC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAQ,CAAA;IACnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAGnB,CAAA;IACH,MAAM,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAW,EAAE,EAAE;QAC/C,MAAM,SAAS,GAAG,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