@getcortexlabs/mavis 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +7 -5
- package/dist/date-format.android.d.ts +5 -0
- package/dist/date-format.android.d.ts.map +1 -0
- package/dist/date-format.android.js +39 -0
- package/dist/date-format.android.js.map +1 -0
- package/dist/date-format.d.ts +3 -0
- package/dist/date-format.d.ts.map +1 -0
- package/dist/date-format.ios.d.ts +5 -0
- package/dist/date-format.ios.d.ts.map +1 -0
- package/dist/date-format.ios.js +29 -0
- package/dist/date-format.ios.js.map +1 -0
- package/dist/date-format.js +2 -0
- package/dist/date-format.js.map +1 -0
- package/dist/native/collection-motion.d.ts +5 -0
- package/dist/native/collection-motion.d.ts.map +1 -0
- package/dist/native/collection-motion.js +157 -0
- package/dist/native/collection-motion.js.map +1 -0
- package/dist/native/date-format.android.d.ts +5 -0
- package/dist/native/date-format.android.d.ts.map +1 -0
- package/dist/native/date-format.android.js +39 -0
- package/dist/native/date-format.android.js.map +1 -0
- package/dist/native/date-format.d.ts +6 -0
- package/dist/native/date-format.d.ts.map +1 -0
- package/dist/native/date-format.ios.d.ts +5 -0
- package/dist/native/date-format.ios.d.ts.map +1 -0
- package/dist/native/date-format.ios.js +29 -0
- package/dist/native/date-format.ios.js.map +1 -0
- package/dist/native/date-format.js +8 -0
- package/dist/native/date-format.js.map +1 -0
- package/dist/native/image-effects.d.ts +11 -0
- package/dist/native/image-effects.d.ts.map +1 -0
- package/dist/native/image-effects.js +61 -0
- package/dist/native/image-effects.js.map +1 -0
- package/dist/native/motion-region.d.ts.map +1 -1
- package/dist/native/motion-region.js +7 -2
- package/dist/native/motion-region.js.map +1 -1
- package/dist/native/motion-surface.d.ts +2 -2
- package/dist/native/motion-surface.d.ts.map +1 -1
- package/dist/native/motion-surface.js +44 -1
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/platform-motion.d.ts +5 -0
- package/dist/native/platform-motion.d.ts.map +1 -0
- package/dist/native/platform-motion.js +90 -0
- package/dist/native/platform-motion.js.map +1 -0
- package/dist/native/surface-effects.d.ts +4 -0
- package/dist/native/surface-effects.d.ts.map +1 -0
- package/dist/native/surface-effects.js +31 -0
- package/dist/native/surface-effects.js.map +1 -0
- package/dist/native/visual-effects.d.ts +5 -0
- package/dist/native/visual-effects.d.ts.map +1 -0
- package/dist/native/visual-effects.js +126 -0
- package/dist/native/visual-effects.js.map +1 -0
- package/dist/vue/components/DateCalendar.d.ts +1 -1
- package/dist/vue/components/LoadingDecoration.d.ts +116 -0
- package/dist/vue/components/LoadingDecoration.d.ts.map +1 -0
- package/dist/vue/components/LoadingDecoration.js +34 -0
- package/dist/vue/components/LoadingDecoration.js.map +1 -0
- package/dist/vue/components/MAlert.d.ts +1 -1
- package/dist/vue/components/MAvatar.d.ts +1 -1
- package/dist/vue/components/MButton.d.ts +32 -10
- package/dist/vue/components/MButton.d.ts.map +1 -1
- package/dist/vue/components/MButton.js +33 -5
- package/dist/vue/components/MButton.js.map +1 -1
- package/dist/vue/components/MCard.d.ts +4 -4
- package/dist/vue/components/MCard.d.ts.map +1 -1
- package/dist/vue/components/MCard.js +4 -3
- package/dist/vue/components/MCard.js.map +1 -1
- package/dist/vue/components/MChip.d.ts +1 -1
- package/dist/vue/components/MCombobox.d.ts +2 -2
- package/dist/vue/components/MDatePicker.d.ts +56 -8
- package/dist/vue/components/MDatePicker.d.ts.map +1 -1
- package/dist/vue/components/MDatePicker.js +4 -14
- package/dist/vue/components/MDatePicker.js.map +1 -1
- package/dist/vue/components/MDialog.d.ts +3 -0
- package/dist/vue/components/MDialog.d.ts.map +1 -1
- package/dist/vue/components/MEmptyState.d.ts +1 -1
- package/dist/vue/components/MGrid.d.ts +165 -0
- package/dist/vue/components/MGrid.d.ts.map +1 -0
- package/dist/vue/components/MGrid.js +52 -0
- package/dist/vue/components/MGrid.js.map +1 -0
- package/dist/vue/components/MIcon.d.ts +18 -0
- package/dist/vue/components/MIcon.d.ts.map +1 -1
- package/dist/vue/components/MIcon.js +13 -2
- package/dist/vue/components/MIcon.js.map +1 -1
- package/dist/vue/components/MImage.d.ts +57 -1
- package/dist/vue/components/MImage.d.ts.map +1 -1
- package/dist/vue/components/MImage.js +58 -3
- package/dist/vue/components/MImage.js.map +1 -1
- package/dist/vue/components/MInput.d.ts +6 -6
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MInput.js +15 -0
- package/dist/vue/components/MInput.js.map +1 -1
- package/dist/vue/components/MLink.d.ts +2 -2
- package/dist/vue/components/MLink.d.ts.map +1 -1
- package/dist/vue/components/MLink.js +6 -11
- package/dist/vue/components/MLink.js.map +1 -1
- package/dist/vue/components/MListItem.d.ts +1 -1
- package/dist/vue/components/MReveal.d.ts +9 -9
- package/dist/vue/components/MScreen.d.ts +11 -1
- package/dist/vue/components/MScreen.d.ts.map +1 -1
- package/dist/vue/components/MScreen.js +26 -4
- package/dist/vue/components/MScreen.js.map +1 -1
- package/dist/vue/components/MSelect.d.ts +1 -1
- package/dist/vue/components/MSheet.d.ts +13 -4
- package/dist/vue/components/MSheet.d.ts.map +1 -1
- package/dist/vue/components/MSkeleton.d.ts +12 -1
- package/dist/vue/components/MSkeleton.d.ts.map +1 -1
- package/dist/vue/components/MSkeleton.js +5 -3
- package/dist/vue/components/MSkeleton.js.map +1 -1
- package/dist/vue/components/MStack.d.ts +9 -9
- package/dist/vue/components/MText.d.ts +11 -0
- package/dist/vue/components/MText.d.ts.map +1 -1
- package/dist/vue/components/MText.js +3 -1
- package/dist/vue/components/MText.js.map +1 -1
- package/dist/vue/components/configurator.d.ts +3 -3
- package/dist/vue/components/layout.d.ts +30 -19
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +3 -1
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/index.d.ts +11 -11
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +12 -12
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/services.d.ts +16 -0
- package/dist/vue/services.d.ts.map +1 -0
- package/dist/vue/services.js +18 -0
- package/dist/vue/services.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 +31 -2
- package/dist/vue/use-motion-surface.js.map +1 -1
- package/package.json +15 -4
- package/src/date-format.ts +2 -0
- package/src/native/collection-motion.ts +166 -0
- package/src/native/date-format.android.ts +72 -0
- package/src/native/date-format.ios.ts +54 -0
- package/src/native/date-format.ts +17 -0
- package/src/native/image-effects.ts +71 -0
- package/src/native/motion-region.ts +7 -2
- package/src/native/motion-surface.ts +51 -2
- package/src/native/platform-motion.ts +103 -0
- package/src/native/surface-effects.ts +33 -0
- package/src/native/visual-effects.ts +147 -0
- package/src/vue/components/LoadingDecoration.ts +38 -0
- package/src/vue/components/MButton.ts +37 -4
- package/src/vue/components/MCard.ts +4 -2
- package/src/vue/components/MDatePicker.ts +3 -11
- package/src/vue/components/MGrid.ts +86 -0
- package/src/vue/components/MIcon.ts +14 -2
- package/src/vue/components/MImage.ts +66 -2
- package/src/vue/components/MInput.ts +14 -3
- package/src/vue/components/MLink.ts +12 -9
- package/src/vue/components/MScreen.ts +31 -3
- package/src/vue/components/MSkeleton.ts +5 -3
- package/src/vue/components/MText.ts +7 -0
- package/src/vue/components/layout.ts +3 -0
- package/src/vue/index.ts +63 -69
- package/src/vue/services.ts +32 -0
- package/src/vue/use-motion-surface.ts +32 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { type VNode } from 'nativescript-vue';
|
|
2
|
+
import './layout.js';
|
|
3
|
+
export declare const MGrid: import("nativescript-vue").DefineComponent<import("nativescript-vue").ExtractPropTypes<{
|
|
4
|
+
columns: {
|
|
5
|
+
type: NumberConstructor;
|
|
6
|
+
default: undefined;
|
|
7
|
+
};
|
|
8
|
+
minColumnWidth: {
|
|
9
|
+
type: NumberConstructor;
|
|
10
|
+
default: undefined;
|
|
11
|
+
};
|
|
12
|
+
gap: {
|
|
13
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
14
|
+
} & {
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
padding: {
|
|
18
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
19
|
+
} & {
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
paddingX: {
|
|
23
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
24
|
+
} & {
|
|
25
|
+
default: undefined;
|
|
26
|
+
};
|
|
27
|
+
paddingY: {
|
|
28
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
29
|
+
} & {
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
radius: {
|
|
33
|
+
type: import("nativescript-vue").PropType<number | import("@getcortexlabs/mavis-core").Radius>;
|
|
34
|
+
} & {
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
width: {
|
|
38
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
39
|
+
} & {
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
height: {
|
|
43
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
44
|
+
} & {
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
backgroundColor: {
|
|
48
|
+
type: import("nativescript-vue").PropType<string>;
|
|
49
|
+
};
|
|
50
|
+
grow: {
|
|
51
|
+
type: import("nativescript-vue").PropType<number>;
|
|
52
|
+
} & {
|
|
53
|
+
default: number;
|
|
54
|
+
};
|
|
55
|
+
shrink: {
|
|
56
|
+
type: import("nativescript-vue").PropType<number>;
|
|
57
|
+
} & {
|
|
58
|
+
default: undefined;
|
|
59
|
+
};
|
|
60
|
+
id: {
|
|
61
|
+
type: import("nativescript-vue").PropType<string>;
|
|
62
|
+
} & {
|
|
63
|
+
default: undefined;
|
|
64
|
+
};
|
|
65
|
+
accessibilityLabel: {
|
|
66
|
+
type: import("nativescript-vue").PropType<string>;
|
|
67
|
+
} & {
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
70
|
+
accessibilityHidden: {
|
|
71
|
+
type: import("nativescript-vue").PropType<boolean>;
|
|
72
|
+
} & {
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
}>, () => VNode<import("nativescript-vue").RendererNode, import("nativescript-vue").RendererElement, {
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}>, {}, {}, {}, import("nativescript-vue").ComponentOptionsMixin, import("nativescript-vue").ComponentOptionsMixin, {}, string, import("nativescript-vue").PublicProps, Readonly<import("nativescript-vue").ExtractPropTypes<{
|
|
78
|
+
columns: {
|
|
79
|
+
type: NumberConstructor;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
82
|
+
minColumnWidth: {
|
|
83
|
+
type: NumberConstructor;
|
|
84
|
+
default: undefined;
|
|
85
|
+
};
|
|
86
|
+
gap: {
|
|
87
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
88
|
+
} & {
|
|
89
|
+
default: undefined;
|
|
90
|
+
};
|
|
91
|
+
padding: {
|
|
92
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
93
|
+
} & {
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
paddingX: {
|
|
97
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
98
|
+
} & {
|
|
99
|
+
default: undefined;
|
|
100
|
+
};
|
|
101
|
+
paddingY: {
|
|
102
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Spacing>;
|
|
103
|
+
} & {
|
|
104
|
+
default: undefined;
|
|
105
|
+
};
|
|
106
|
+
radius: {
|
|
107
|
+
type: import("nativescript-vue").PropType<number | import("@getcortexlabs/mavis-core").Radius>;
|
|
108
|
+
} & {
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
width: {
|
|
112
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
113
|
+
} & {
|
|
114
|
+
default: undefined;
|
|
115
|
+
};
|
|
116
|
+
height: {
|
|
117
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").Dimension>;
|
|
118
|
+
} & {
|
|
119
|
+
default: undefined;
|
|
120
|
+
};
|
|
121
|
+
backgroundColor: {
|
|
122
|
+
type: import("nativescript-vue").PropType<string>;
|
|
123
|
+
};
|
|
124
|
+
grow: {
|
|
125
|
+
type: import("nativescript-vue").PropType<number>;
|
|
126
|
+
} & {
|
|
127
|
+
default: number;
|
|
128
|
+
};
|
|
129
|
+
shrink: {
|
|
130
|
+
type: import("nativescript-vue").PropType<number>;
|
|
131
|
+
} & {
|
|
132
|
+
default: undefined;
|
|
133
|
+
};
|
|
134
|
+
id: {
|
|
135
|
+
type: import("nativescript-vue").PropType<string>;
|
|
136
|
+
} & {
|
|
137
|
+
default: undefined;
|
|
138
|
+
};
|
|
139
|
+
accessibilityLabel: {
|
|
140
|
+
type: import("nativescript-vue").PropType<string>;
|
|
141
|
+
} & {
|
|
142
|
+
default: undefined;
|
|
143
|
+
};
|
|
144
|
+
accessibilityHidden: {
|
|
145
|
+
type: import("nativescript-vue").PropType<boolean>;
|
|
146
|
+
} & {
|
|
147
|
+
default: undefined;
|
|
148
|
+
};
|
|
149
|
+
}>> & Readonly<{}>, {
|
|
150
|
+
padding: import("@getcortexlabs/mavis-core").Spacing;
|
|
151
|
+
accessibilityHidden: boolean;
|
|
152
|
+
accessibilityLabel: string;
|
|
153
|
+
width: import("@getcortexlabs/mavis-core").Dimension;
|
|
154
|
+
height: import("@getcortexlabs/mavis-core").Dimension;
|
|
155
|
+
id: string;
|
|
156
|
+
radius: number | import("@getcortexlabs/mavis-core").Radius;
|
|
157
|
+
grow: number;
|
|
158
|
+
shrink: number;
|
|
159
|
+
paddingX: import("@getcortexlabs/mavis-core").Spacing;
|
|
160
|
+
paddingY: import("@getcortexlabs/mavis-core").Spacing;
|
|
161
|
+
gap: import("@getcortexlabs/mavis-core").Spacing;
|
|
162
|
+
columns: number;
|
|
163
|
+
minColumnWidth: number;
|
|
164
|
+
}, {}, {}, {}, string, import("nativescript-vue").ComponentProvideOptions, true, {}, any>;
|
|
165
|
+
//# sourceMappingURL=MGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MGrid.d.ts","sourceRoot":"","sources":["../../../src/vue/components/MGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,KAAK,EACX,MAAM,kBAAkB,CAAA;AAWzB,OAAO,aAAa,CAAA;AAEpB,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yFA6DhB,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Comment, Fragment, Text, createVNode, defineComponent, h, mergeProps, provide, shallowRef, } from 'nativescript-vue';
|
|
2
|
+
import { gridColumns, resolveSpace } from '@getcortexlabs/mavis-core';
|
|
3
|
+
import { gridProps, layoutDirection, useLayoutShrink, useMavisTheme, } from '@getcortexlabs/mavis-core/vue';
|
|
4
|
+
import { boxStyle } from '../props.js';
|
|
5
|
+
import { useNativeViewAttrs } from '../accessibility.js';
|
|
6
|
+
import './layout.js';
|
|
7
|
+
export const MGrid = defineComponent({
|
|
8
|
+
name: 'MGrid',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: gridProps,
|
|
11
|
+
setup(props, { attrs, slots }) {
|
|
12
|
+
const { theme } = useMavisTheme();
|
|
13
|
+
const shrink = useLayoutShrink();
|
|
14
|
+
const nativeAttrs = useNativeViewAttrs(props);
|
|
15
|
+
provide(layoutDirection, 'column');
|
|
16
|
+
const width = shallowRef();
|
|
17
|
+
return () => {
|
|
18
|
+
const gap = resolveSpace(theme.value, props.gap ?? 'none');
|
|
19
|
+
const count = gridColumns(props.columns, props.minColumnWidth, gap, width.value);
|
|
20
|
+
let index = 0;
|
|
21
|
+
// Keep fragment boundaries so independently keyed slot groups retain their identity.
|
|
22
|
+
const place = (nodes) => nodes.flatMap((child) => {
|
|
23
|
+
if (child.type === Fragment)
|
|
24
|
+
return [
|
|
25
|
+
createVNode(Fragment, { key: child.key ?? undefined }, place(child.children)),
|
|
26
|
+
];
|
|
27
|
+
if (child.type === Comment || (child.type === Text && !String(child.children).trim()))
|
|
28
|
+
return [];
|
|
29
|
+
const cell = index++;
|
|
30
|
+
return [
|
|
31
|
+
h('MavisBox', {
|
|
32
|
+
key: child.key ?? cell,
|
|
33
|
+
col: (cell % count) * 2,
|
|
34
|
+
row: Math.floor(cell / count) * 2,
|
|
35
|
+
}, [child]),
|
|
36
|
+
];
|
|
37
|
+
});
|
|
38
|
+
const children = place(slots.default?.() ?? []);
|
|
39
|
+
const rows = Math.ceil(index / count);
|
|
40
|
+
return h('MavisBox', mergeProps({ style: boxStyle(theme.value, props, shrink.value) }, nativeAttrs(), attrs), [
|
|
41
|
+
h('GridLayout', {
|
|
42
|
+
columns: Array.from({ length: count }, () => '*').join(`,${gap},`),
|
|
43
|
+
rows: Array.from({ length: rows }, () => 'auto').join(`,${gap},`),
|
|
44
|
+
onLayoutChanged: (event) => {
|
|
45
|
+
width.value = event.object.getActualSize().width;
|
|
46
|
+
},
|
|
47
|
+
}, children),
|
|
48
|
+
]);
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=MGrid.js.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oBACE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;oBAClE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;oBACjE,eAAe,EAAE,CAAC,KAAgB,EAAE,EAAE;wBACpC,KAAK,CAAC,KAAK,GAAI,KAAK,CAAC,MAAe,CAAC,aAAa,EAAE,CAAC,KAAK,CAAA;oBAC5D,CAAC;iBACF,EACD,QAAQ,CACT;aACF,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -4,6 +4,14 @@ export declare const MIcon: import("nativescript-vue").DefineComponent<import("n
|
|
|
4
4
|
} & {
|
|
5
5
|
default: undefined;
|
|
6
6
|
};
|
|
7
|
+
motionSurface: {
|
|
8
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core/experimental").MotionSurface>;
|
|
9
|
+
default: undefined;
|
|
10
|
+
};
|
|
11
|
+
systemName: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
default: undefined;
|
|
14
|
+
};
|
|
7
15
|
name: {
|
|
8
16
|
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").IconName>;
|
|
9
17
|
required: true;
|
|
@@ -30,6 +38,14 @@ export declare const MIcon: import("nativescript-vue").DefineComponent<import("n
|
|
|
30
38
|
} & {
|
|
31
39
|
default: undefined;
|
|
32
40
|
};
|
|
41
|
+
motionSurface: {
|
|
42
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core/experimental").MotionSurface>;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
systemName: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
default: undefined;
|
|
48
|
+
};
|
|
33
49
|
name: {
|
|
34
50
|
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core").IconName>;
|
|
35
51
|
required: true;
|
|
@@ -51,7 +67,9 @@ export declare const MIcon: import("nativescript-vue").DefineComponent<import("n
|
|
|
51
67
|
}>> & Readonly<{}>, {
|
|
52
68
|
id: string;
|
|
53
69
|
tone: keyof import("@getcortexlabs/mavis-core").Palette;
|
|
70
|
+
motionSurface: import("@getcortexlabs/mavis-core/experimental").MotionSurface;
|
|
54
71
|
label: string;
|
|
55
72
|
size: import("@getcortexlabs/mavis-core").IconSize;
|
|
73
|
+
systemName: string;
|
|
56
74
|
}, {}, {}, {}, string, import("nativescript-vue").ComponentProvideOptions, true, {}, any>;
|
|
57
75
|
//# sourceMappingURL=MIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MIcon.d.ts","sourceRoot":"","sources":["../../../src/vue/components/MIcon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MIcon.d.ts","sourceRoot":"","sources":["../../../src/vue/components/MIcon.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yFA2ChB,CAAA"}
|
|
@@ -2,6 +2,8 @@ import { defineComponent, h, mergeProps, registerElement } from 'nativescript-vu
|
|
|
2
2
|
import { iconProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue';
|
|
3
3
|
import { iconFontFamily, iconGlyph, resolveIconSize } from '@getcortexlabs/mavis-core';
|
|
4
4
|
import { MavisLabel } from '../../native/label';
|
|
5
|
+
import { isIOS } from '@nativescript/core';
|
|
6
|
+
import { useMotionSurface } from '../use-motion-surface.js';
|
|
5
7
|
registerElement('MavisIcon', () => MavisLabel);
|
|
6
8
|
export const MIcon = defineComponent({
|
|
7
9
|
name: 'MIcon',
|
|
@@ -9,11 +11,20 @@ export const MIcon = defineComponent({
|
|
|
9
11
|
props: iconProps,
|
|
10
12
|
setup(props, { attrs }) {
|
|
11
13
|
const { theme } = useMavisTheme();
|
|
14
|
+
const motion = useMotionSurface(() => props.motionSurface);
|
|
12
15
|
return () => {
|
|
13
16
|
const size = resolveIconSize(props.size);
|
|
14
|
-
return h('MavisIcon', mergeProps({
|
|
17
|
+
return h(props.systemName && isIOS ? 'Image' : 'MavisIcon', mergeProps({ onLoaded: motion.onLoaded, onUnloaded: motion.onUnloaded }, {
|
|
15
18
|
id: props.id,
|
|
16
|
-
|
|
19
|
+
key: props.systemName && isIOS ? props.systemName : 'glyph',
|
|
20
|
+
...(props.systemName && isIOS
|
|
21
|
+
? {
|
|
22
|
+
src: `sys://${props.systemName}`,
|
|
23
|
+
width: size,
|
|
24
|
+
height: size,
|
|
25
|
+
tintColor: theme.value.colors[props.tone],
|
|
26
|
+
}
|
|
27
|
+
: { text: iconGlyph(props.name) }),
|
|
17
28
|
textWrap: false,
|
|
18
29
|
accessible: Boolean(props.label),
|
|
19
30
|
accessibilityHidden: !props.label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MIcon.js","sourceRoot":"","sources":["../../../src/vue/components/MIcon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"MIcon.js","sourceRoot":"","sources":["../../../src/vue/components/MIcon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB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EAAE;wBAChC,KAAK,EAAE,IAAI;wBACX,MAAM,EAAE,IAAI;wBACZ,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;qBAC1C;oBACH,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpC,QAAQ,EAAE,KAAK;gBACf,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;gBAChC,mBAAmB,EAAE,CAAC,KAAK,CAAC,KAAK;gBACjC,iBAAiB,EAAE,OAAO;gBAC1B,kBAAkB,EAAE,KAAK,CAAC,KAAK;gBAC/B,KAAK,EAAE;oBACL,UAAU,EAAE,cAAc;oBAC1B,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;oBACrC,aAAa,EAAE,QAAQ;oBACvB,iBAAiB,EAAE,QAAQ;oBAC3B,UAAU,EAAE,CAAC;iBACd;aACF,EACD,KAAK,CACN,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const MImage: import("nativescript-vue").DefineComponent<import("nativescript-vue").ExtractPropTypes<{
|
|
2
|
+
motionSurface: {
|
|
3
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core/experimental").MotionSurface>;
|
|
4
|
+
default: undefined;
|
|
5
|
+
};
|
|
2
6
|
src: {
|
|
3
7
|
type: StringConstructor;
|
|
4
8
|
required: true;
|
|
@@ -81,12 +85,37 @@ export declare const MImage: import("nativescript-vue").DefineComponent<import("
|
|
|
81
85
|
} & {
|
|
82
86
|
default: undefined;
|
|
83
87
|
};
|
|
88
|
+
srcset: {
|
|
89
|
+
type: StringConstructor;
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
sizes: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
loading: {
|
|
97
|
+
type: import("nativescript-vue").PropType<"eager" | "lazy">;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
decoding: {
|
|
101
|
+
type: import("nativescript-vue").PropType<"async" | "sync" | "auto">;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
fetchpriority: {
|
|
105
|
+
type: import("nativescript-vue").PropType<"high" | "low" | "auto">;
|
|
106
|
+
default: undefined;
|
|
107
|
+
};
|
|
84
108
|
}>, () => import("nativescript-vue").VNode<import("nativescript-vue").RendererNode, import("nativescript-vue").RendererElement, {
|
|
85
109
|
[key: string]: any;
|
|
86
110
|
}>, {}, {}, {}, import("nativescript-vue").ComponentOptionsMixin, import("nativescript-vue").ComponentOptionsMixin, {
|
|
87
111
|
load: (_src: string) => true;
|
|
88
112
|
error: (_src: string) => true;
|
|
113
|
+
'update:src': (_src: string) => true;
|
|
89
114
|
}, string, import("nativescript-vue").PublicProps, Readonly<import("nativescript-vue").ExtractPropTypes<{
|
|
115
|
+
motionSurface: {
|
|
116
|
+
type: import("nativescript-vue").PropType<import("@getcortexlabs/mavis-core/experimental").MotionSurface>;
|
|
117
|
+
default: undefined;
|
|
118
|
+
};
|
|
90
119
|
src: {
|
|
91
120
|
type: StringConstructor;
|
|
92
121
|
required: true;
|
|
@@ -169,9 +198,30 @@ export declare const MImage: import("nativescript-vue").DefineComponent<import("
|
|
|
169
198
|
} & {
|
|
170
199
|
default: undefined;
|
|
171
200
|
};
|
|
201
|
+
srcset: {
|
|
202
|
+
type: StringConstructor;
|
|
203
|
+
default: undefined;
|
|
204
|
+
};
|
|
205
|
+
sizes: {
|
|
206
|
+
type: StringConstructor;
|
|
207
|
+
default: undefined;
|
|
208
|
+
};
|
|
209
|
+
loading: {
|
|
210
|
+
type: import("nativescript-vue").PropType<"eager" | "lazy">;
|
|
211
|
+
default: undefined;
|
|
212
|
+
};
|
|
213
|
+
decoding: {
|
|
214
|
+
type: import("nativescript-vue").PropType<"async" | "sync" | "auto">;
|
|
215
|
+
default: undefined;
|
|
216
|
+
};
|
|
217
|
+
fetchpriority: {
|
|
218
|
+
type: import("nativescript-vue").PropType<"high" | "low" | "auto">;
|
|
219
|
+
default: undefined;
|
|
220
|
+
};
|
|
172
221
|
}>> & Readonly<{
|
|
173
222
|
onError?: ((_src: string) => any) | undefined;
|
|
174
223
|
onLoad?: ((_src: string) => any) | undefined;
|
|
224
|
+
"onUpdate:src"?: ((_src: string) => any) | undefined;
|
|
175
225
|
}>, {
|
|
176
226
|
padding: import("@getcortexlabs/mavis-core").Spacing;
|
|
177
227
|
accessibilityHidden: boolean;
|
|
@@ -179,14 +229,20 @@ export declare const MImage: import("nativescript-vue").DefineComponent<import("
|
|
|
179
229
|
width: import("@getcortexlabs/mavis-core").Dimension;
|
|
180
230
|
height: import("@getcortexlabs/mavis-core").Dimension;
|
|
181
231
|
id: string;
|
|
232
|
+
radius: number | import("@getcortexlabs/mavis-core").Radius;
|
|
182
233
|
grow: number;
|
|
183
234
|
shrink: number;
|
|
235
|
+
motionSurface: import("@getcortexlabs/mavis-core/experimental").MotionSurface;
|
|
184
236
|
paddingX: import("@getcortexlabs/mavis-core").Spacing;
|
|
185
237
|
paddingY: import("@getcortexlabs/mavis-core").Spacing;
|
|
186
|
-
|
|
238
|
+
loading: "eager" | "lazy";
|
|
187
239
|
aspectRatio: number;
|
|
188
240
|
fit: "cover" | "contain";
|
|
189
241
|
loadingLabel: string;
|
|
190
242
|
errorLabel: string;
|
|
243
|
+
srcset: string;
|
|
244
|
+
sizes: string;
|
|
245
|
+
decoding: "auto" | "sync" | "async";
|
|
246
|
+
fetchpriority: "auto" | "high" | "low";
|
|
191
247
|
}, {}, {}, {}, string, import("nativescript-vue").ComponentProvideOptions, true, {}, any>;
|
|
192
248
|
//# sourceMappingURL=MImage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MImage.d.ts","sourceRoot":"","sources":["../../../src/vue/components/MImage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MImage.d.ts","sourceRoot":"","sources":["../../../src/vue/components/MImage.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKF,MAAM;kBACL,MAAM;yBACC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yFA0J7B,CAAA"}
|
|
@@ -1,20 +1,28 @@
|
|
|
1
|
-
import { defineComponent, h, mergeProps, onBeforeUnmount, ref, shallowRef, watch, } from 'nativescript-vue';
|
|
1
|
+
import { defineComponent, h, mergeProps, nextTick, onBeforeUnmount, ref, shallowRef, watch, } from 'nativescript-vue';
|
|
2
2
|
import { imageProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue';
|
|
3
3
|
import { resolveRadius } from '@getcortexlabs/mavis-core';
|
|
4
4
|
import { loadAvatarImage } from '../../native/avatar-image';
|
|
5
5
|
import { MBox } from './layout.js';
|
|
6
6
|
import { MText } from './MText.js';
|
|
7
|
+
import { useMotionSurface } from '../use-motion-surface.js';
|
|
8
|
+
import { registerMotionImage } from '../../native/image-effects.js';
|
|
7
9
|
export const MImage = defineComponent({
|
|
8
10
|
name: 'MImage',
|
|
9
11
|
inheritAttrs: false,
|
|
10
12
|
props: imageProps,
|
|
11
|
-
emits: {
|
|
13
|
+
emits: {
|
|
14
|
+
load: (_src) => true,
|
|
15
|
+
error: (_src) => true,
|
|
16
|
+
'update:src': (_src) => true,
|
|
17
|
+
},
|
|
12
18
|
setup(props, { attrs, emit }) {
|
|
13
19
|
const { theme } = useMavisTheme();
|
|
14
20
|
const image = shallowRef(null);
|
|
15
21
|
const status = ref('loading');
|
|
16
22
|
const width = ref(typeof props.width === 'number' ? props.width : 0);
|
|
17
23
|
let generation = 0, loaded = false;
|
|
24
|
+
let releaseImage, committing, currentImage;
|
|
25
|
+
const motion = useMotionSurface(() => props.motionSurface, () => true, () => false, true);
|
|
18
26
|
async function load() {
|
|
19
27
|
const current = ++generation, src = props.src;
|
|
20
28
|
image.value = null;
|
|
@@ -39,13 +47,21 @@ export const MImage = defineComponent({
|
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
function unload() {
|
|
50
|
+
motion.onUnloaded();
|
|
51
|
+
releaseImage?.();
|
|
52
|
+
releaseImage = undefined;
|
|
53
|
+
currentImage = undefined;
|
|
42
54
|
loaded = false;
|
|
43
55
|
generation++;
|
|
44
56
|
image.value = null;
|
|
45
57
|
}
|
|
46
58
|
watch(() => props.src, () => {
|
|
59
|
+
if (props.src === committing) {
|
|
60
|
+
committing = undefined;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
47
63
|
void load();
|
|
48
|
-
});
|
|
64
|
+
}, { flush: 'sync' });
|
|
49
65
|
onBeforeUnmount(unload);
|
|
50
66
|
return () => {
|
|
51
67
|
if (!Number.isFinite(props.aspectRatio) || props.aspectRatio <= 0)
|
|
@@ -53,6 +69,7 @@ export const MImage = defineComponent({
|
|
|
53
69
|
const radius = resolveRadius(theme.value, props.radius);
|
|
54
70
|
return h(MBox, mergeProps(attrs, {
|
|
55
71
|
...props,
|
|
72
|
+
motionSurface: undefined,
|
|
56
73
|
width: props.width ?? '100%',
|
|
57
74
|
height: props.height ?? width.value / props.aspectRatio,
|
|
58
75
|
backgroundColor: props.backgroundColor || theme.value.colors.elevated,
|
|
@@ -78,6 +95,7 @@ export const MImage = defineComponent({
|
|
|
78
95
|
}), () => image.value
|
|
79
96
|
? [
|
|
80
97
|
h('Image', {
|
|
98
|
+
key: generation,
|
|
81
99
|
imageSource: image.value,
|
|
82
100
|
width: '100%',
|
|
83
101
|
height: '100%',
|
|
@@ -85,6 +103,43 @@ export const MImage = defineComponent({
|
|
|
85
103
|
borderRadius: radius,
|
|
86
104
|
accessible: false,
|
|
87
105
|
accessibilityHidden: true,
|
|
106
|
+
onLoaded(event) {
|
|
107
|
+
const target = event.object, current = generation;
|
|
108
|
+
currentImage = target;
|
|
109
|
+
releaseImage?.();
|
|
110
|
+
releaseImage = registerMotionImage(target, {
|
|
111
|
+
current: () => loaded &&
|
|
112
|
+
current === generation &&
|
|
113
|
+
currentImage === target &&
|
|
114
|
+
target.isLoaded,
|
|
115
|
+
async commit(destination, prepared) {
|
|
116
|
+
if (!loaded || current !== generation)
|
|
117
|
+
return false;
|
|
118
|
+
const previous = image.value;
|
|
119
|
+
image.value = prepared ?? null;
|
|
120
|
+
committing = destination;
|
|
121
|
+
emit('update:src', destination);
|
|
122
|
+
await nextTick();
|
|
123
|
+
const accepted = loaded && current === generation && props.src === destination;
|
|
124
|
+
committing = undefined;
|
|
125
|
+
if (!accepted && current === generation) {
|
|
126
|
+
image.value = previous;
|
|
127
|
+
if (previous)
|
|
128
|
+
target.imageSource = previous;
|
|
129
|
+
}
|
|
130
|
+
return accepted;
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
motion.onLoaded(event);
|
|
134
|
+
},
|
|
135
|
+
onUnloaded(event) {
|
|
136
|
+
if (event.object !== currentImage)
|
|
137
|
+
return;
|
|
138
|
+
motion.onUnloaded();
|
|
139
|
+
releaseImage?.();
|
|
140
|
+
releaseImage = undefined;
|
|
141
|
+
currentImage = undefined;
|
|
142
|
+
},
|
|
88
143
|
}),
|
|
89
144
|
]
|
|
90
145
|
: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MImage.js","sourceRoot":"","sources":["../../../src/vue/components/MImage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,UAAU,EACV,e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