@getcortexlabs/mavis 0.1.0-rc.13 → 0.1.0-rc.15
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/components/bindings.d.ts +14 -0
- package/dist/components/bindings.d.ts.map +1 -0
- package/dist/components/bindings.js +21 -0
- package/dist/components/bindings.js.map +1 -0
- package/dist/components/contracts.d.ts +28 -0
- package/dist/components/contracts.d.ts.map +1 -0
- package/dist/components/contracts.js +27 -0
- package/dist/components/contracts.js.map +1 -0
- package/dist/components/controller.d.ts +56 -0
- package/dist/components/controller.d.ts.map +1 -0
- package/dist/components/controller.js +508 -0
- package/dist/components/controller.js.map +1 -0
- package/dist/components/index.d.ts +53 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +95 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/style.d.ts +52 -0
- package/dist/components/style.d.ts.map +1 -0
- package/dist/components/style.js +68 -0
- package/dist/components/style.js.map +1 -0
- package/dist/components/theme.d.ts +12 -0
- package/dist/components/theme.d.ts.map +1 -0
- package/dist/components/theme.js +29 -0
- package/dist/components/theme.js.map +1 -0
- package/dist/native/box.ios.d.ts +1 -0
- package/dist/native/box.ios.d.ts.map +1 -1
- package/dist/native/box.ios.js +21 -1
- package/dist/native/box.ios.js.map +1 -1
- 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-binding.d.ts +11 -0
- package/dist/native/motion-binding.d.ts.map +1 -0
- package/dist/native/motion-binding.js +132 -0
- package/dist/native/motion-binding.js.map +1 -0
- 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 +40 -8
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/navigation.d.ts +4 -0
- package/dist/native/navigation.d.ts.map +1 -0
- package/dist/native/navigation.js +16 -0
- package/dist/native/navigation.js.map +1 -0
- package/dist/native/pointer-availability.d.ts +7 -0
- package/dist/native/pointer-availability.d.ts.map +1 -0
- package/dist/native/pointer-availability.js +43 -0
- package/dist/native/pointer-availability.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/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 +3 -3
- package/dist/vue/components/LoadingDecoration.d.ts +5 -5
- package/dist/vue/components/MAccordion.d.ts +3 -3
- package/dist/vue/components/MAlert.d.ts +4 -4
- package/dist/vue/components/MAvatar.d.ts +4 -4
- package/dist/vue/components/MBadge.d.ts +3 -3
- package/dist/vue/components/MButton.d.ts +20 -20
- package/dist/vue/components/MCard.d.ts +11 -11
- package/dist/vue/components/MCard.d.ts.map +1 -1
- package/dist/vue/components/MCard.js +3 -2
- package/dist/vue/components/MCard.js.map +1 -1
- package/dist/vue/components/MCheckbox.d.ts +3 -3
- package/dist/vue/components/MChip.d.ts +4 -4
- package/dist/vue/components/MCombobox.d.ts +5 -5
- package/dist/vue/components/MDatePicker.d.ts +96 -96
- package/dist/vue/components/MDatePicker.d.ts.map +1 -1
- package/dist/vue/components/MDialog.d.ts +3 -3
- package/dist/vue/components/MEmptyState.d.ts +3 -3
- package/dist/vue/components/MGrid.d.ts +7 -7
- 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 +2 -2
- package/dist/vue/components/MImage.d.ts +7 -7
- package/dist/vue/components/MImageCompare.d.ts +1 -1
- package/dist/vue/components/MInput.d.ts +22 -22
- package/dist/vue/components/MLink.d.ts +5 -5
- package/dist/vue/components/MListItem.d.ts +5 -5
- package/dist/vue/components/MPinInput.d.ts +1 -1
- package/dist/vue/components/MPopover.d.ts +3 -3
- package/dist/vue/components/MProgress.d.ts +5 -5
- package/dist/vue/components/MRadioGroup.d.ts +3 -3
- package/dist/vue/components/MRangeSlider.d.ts +1 -1
- package/dist/vue/components/MResizablePanels.d.ts +3 -3
- package/dist/vue/components/MReveal.d.ts +17 -17
- package/dist/vue/components/MScreen.d.ts +3 -3
- package/dist/vue/components/MScreen.d.ts.map +1 -1
- package/dist/vue/components/MScreen.js +11 -1
- package/dist/vue/components/MScreen.js.map +1 -1
- package/dist/vue/components/MSegmentedControl.d.ts +3 -3
- package/dist/vue/components/MSelect.d.ts +4 -4
- package/dist/vue/components/MSheet.d.ts +7 -7
- package/dist/vue/components/MSkeleton.d.ts +3 -3
- package/dist/vue/components/MSlider.d.ts +1 -1
- package/dist/vue/components/MStack.d.ts +19 -19
- package/dist/vue/components/MStack.d.ts.map +1 -1
- package/dist/vue/components/MStack.js +12 -2
- package/dist/vue/components/MStack.js.map +1 -1
- package/dist/vue/components/MSwitch.d.ts +3 -3
- package/dist/vue/components/MTabs.d.ts +3 -3
- package/dist/vue/components/MText.d.ts +8 -8
- package/dist/vue/components/MText.d.ts.map +1 -1
- package/dist/vue/components/MText.js +4 -1
- package/dist/vue/components/MText.js.map +1 -1
- 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 +2 -2
- 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 +185 -69
- 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 +45 -45
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +8 -2
- 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/screen-components.d.ts.map +1 -1
- package/dist/vue/components/screen-components.js +15 -0
- package/dist/vue/components/screen-components.js.map +1 -1
- package/dist/vue/components/wayfinding.d.ts +11 -11
- package/dist/vue/components/workflows.d.ts +5 -5
- package/dist/vue/layout-context.d.ts +4 -0
- package/dist/vue/layout-context.d.ts.map +1 -0
- package/dist/vue/layout-context.js +3 -0
- package/dist/vue/layout-context.js.map +1 -0
- package/dist/vue/navigation.d.ts +1 -3
- package/dist/vue/navigation.d.ts.map +1 -1
- package/dist/vue/navigation.js +1 -15
- package/dist/vue/navigation.js.map +1 -1
- package/dist/vue/screen-overlay.d.ts +9 -0
- package/dist/vue/screen-overlay.d.ts.map +1 -0
- package/dist/vue/screen-overlay.js +17 -0
- package/dist/vue/screen-overlay.js.map +1 -0
- package/dist/vue/use-motion-surface.d.ts +2 -3
- package/dist/vue/use-motion-surface.d.ts.map +1 -1
- package/dist/vue/use-motion-surface.js +9 -134
- package/dist/vue/use-motion-surface.js.map +1 -1
- package/package.json +8 -4
- package/platforms/android/java/com/mavis/ui/Box.java +31 -0
- package/src/components/bindings.ts +32 -0
- package/src/components/contracts.ts +60 -0
- package/src/components/controller.ts +542 -0
- package/src/components/index.ts +136 -0
- package/src/components/style.ts +84 -0
- package/src/components/theme.ts +25 -0
- package/src/native/box.ios.ts +31 -1
- package/src/native/flex-layout.ios.ts +4 -0
- package/src/native/motion-binding.ts +143 -0
- package/src/native/motion-region.ts +1 -0
- package/src/native/motion-surface.ts +41 -8
- package/src/native/navigation.ts +15 -0
- package/src/native/pointer-availability.ts +44 -0
- package/src/native/scroll-motion.ts +60 -19
- package/src/native/section-scroll.ts +16 -6
- package/src/vue/card-input.ts +44 -0
- package/src/vue/components/MCard.ts +4 -3
- package/src/vue/components/MGrid.ts +10 -1
- package/src/vue/components/MScreen.ts +12 -1
- package/src/vue/components/MStack.ts +17 -2
- package/src/vue/components/MText.ts +4 -1
- package/src/vue/components/MVirtualList.ts +104 -78
- package/src/vue/components/dashboard.ts +192 -69
- package/src/vue/components/layout.ts +8 -0
- package/src/vue/components/screen-components.ts +14 -0
- package/src/vue/layout-context.ts +4 -0
- package/src/vue/navigation.ts +1 -15
- package/src/vue/screen-overlay.ts +20 -0
- package/src/vue/use-motion-surface.ts +10 -137
|
@@ -75,8 +75,8 @@ export declare const MNavigationRail: import("nativescript-vue").DefineComponent
|
|
|
75
75
|
modelValue: import("@getcortexlabs/mavis-core").ChoiceValue | null;
|
|
76
76
|
expandLabel: string;
|
|
77
77
|
collapseLabel: string;
|
|
78
|
-
collapsible: boolean;
|
|
79
78
|
collapsed: boolean;
|
|
79
|
+
collapsible: boolean;
|
|
80
80
|
currentLabel: string;
|
|
81
81
|
}, {}, {}, {}, string, import("nativescript-vue").ComponentProvideOptions, true, {}, any>, MBreadcrumb: import("nativescript-vue").DefineComponent<import("nativescript-vue").ExtractPropTypes<{
|
|
82
82
|
id: StringConstructor;
|
|
@@ -321,15 +321,15 @@ export declare const MChart: import("nativescript-vue").DefineComponent<import("
|
|
|
321
321
|
disabled: boolean;
|
|
322
322
|
modelValue: import("@getcortexlabs/mavis-core").ChartSelection | null;
|
|
323
323
|
height: number;
|
|
324
|
-
clearLabel: string;
|
|
325
324
|
emptyLabel: string;
|
|
326
|
-
|
|
325
|
+
categoryLabel: string;
|
|
326
|
+
clearLabel: string;
|
|
327
327
|
hiddenSeries: readonly import("@getcortexlabs/mavis-core").ChoiceValue[];
|
|
328
|
-
showData: boolean;
|
|
329
|
-
showDataLabel: string;
|
|
330
328
|
hideDataLabel: string;
|
|
331
|
-
|
|
329
|
+
missingLabel: string;
|
|
332
330
|
seriesLabel: string;
|
|
331
|
+
showData: boolean;
|
|
332
|
+
showDataLabel: string;
|
|
333
333
|
}, {}, {}, {}, string, import("nativescript-vue").ComponentProvideOptions, true, {}, any>;
|
|
334
334
|
export declare const MCommandPalette: import("nativescript-vue").DefineComponent<import("nativescript-vue").ExtractPropTypes<{
|
|
335
335
|
id: StringConstructor;
|
|
@@ -427,15 +427,15 @@ export declare const MCommandPalette: import("nativescript-vue").DefineComponent
|
|
|
427
427
|
"onUpdate:open"?: ((_value: boolean) => any) | undefined;
|
|
428
428
|
}>, {
|
|
429
429
|
disabled: boolean;
|
|
430
|
+
closeLabel: string;
|
|
430
431
|
loading: boolean;
|
|
431
|
-
|
|
432
|
+
shortcut: boolean;
|
|
433
|
+
emptyLabel: string;
|
|
432
434
|
placeholder: string;
|
|
435
|
+
query: string;
|
|
433
436
|
loadingLabel: string;
|
|
434
|
-
searchLabel: string;
|
|
435
|
-
emptyLabel: string;
|
|
436
437
|
open: boolean;
|
|
437
|
-
closeLabel: string;
|
|
438
|
-
shortcut: boolean;
|
|
439
438
|
returnFocus: import("@getcortexlabs/mavis-core").SheetReturnFocus;
|
|
439
|
+
searchLabel: string;
|
|
440
440
|
}, {}, {}, {}, string, import("nativescript-vue").ComponentProvideOptions, true, {}, any>;
|
|
441
441
|
//# sourceMappingURL=wayfinding.d.ts.map
|
|
@@ -120,8 +120,8 @@ export declare const MFormGroup: import("nativescript-vue").DefineComponent<impo
|
|
|
120
120
|
"onUpdate:modelValue"?: ((_value: import("@getcortexlabs/mavis-core").ChoiceValue) => any) | undefined;
|
|
121
121
|
}>, {
|
|
122
122
|
disabled: boolean;
|
|
123
|
-
loading: boolean;
|
|
124
123
|
modelValue: import("@getcortexlabs/mavis-core").ChoiceValue | null;
|
|
124
|
+
loading: boolean;
|
|
125
125
|
errorLabel: string;
|
|
126
126
|
currentLabel: string;
|
|
127
127
|
completeLabel: string;
|
|
@@ -236,16 +236,16 @@ export declare const MFormGroup: import("nativescript-vue").DefineComponent<impo
|
|
|
236
236
|
}>, {
|
|
237
237
|
label: string;
|
|
238
238
|
disabled: boolean;
|
|
239
|
-
loading: boolean;
|
|
240
239
|
modelValue: number;
|
|
240
|
+
loading: boolean;
|
|
241
241
|
emptyLabel: string;
|
|
242
|
-
previousLabel: string;
|
|
243
242
|
nextLabel: string;
|
|
243
|
+
previousLabel: string;
|
|
244
244
|
currentLabel: string;
|
|
245
|
+
invalidPageLabel: string;
|
|
246
|
+
pageLabel: string;
|
|
245
247
|
pageSize: number;
|
|
246
248
|
siblingCount: number;
|
|
247
|
-
pageLabel: string;
|
|
248
249
|
statusText: string;
|
|
249
|
-
invalidPageLabel: string;
|
|
250
250
|
}, {}, {}, {}, string, import("nativescript-vue").ComponentProvideOptions, true, {}, any>;
|
|
251
251
|
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-context.d.ts","sourceRoot":"","sources":["../../src/vue/layout-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,sFAAsF;AACtF,eAAO,MAAM,QAAQ,EAAE,YAAY,CAAC,OAAO,CAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-context.js","sourceRoot":"","sources":["../../src/vue/layout-context.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAA0B,MAAM,CAAC,gBAAgB,CAAC,CAAA"}
|
package/dist/vue/navigation.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function nativeDestination(options: NavigationOptions): string;
|
|
3
|
-
export declare function navigateNative(options: NavigationOptions): Promise<void>;
|
|
1
|
+
export { nativeDestination, navigateNative } from '../native/navigation.js';
|
|
4
2
|
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/vue/navigation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/vue/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/vue/navigation.js
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { linkDestination } from '@getcortexlabs/mavis-core';
|
|
3
|
-
export function nativeDestination(options) {
|
|
4
|
-
const href = linkDestination(options.href);
|
|
5
|
-
if (!options.navigate && !/^[a-z][a-z\d+.-]*:/i.test(href))
|
|
6
|
-
throw new TypeError('Native navigation needs a navigate handler for in-app destinations.');
|
|
7
|
-
return href;
|
|
8
|
-
}
|
|
9
|
-
export async function navigateNative(options) {
|
|
10
|
-
const href = nativeDestination(options);
|
|
11
|
-
if (options.navigate)
|
|
12
|
-
await options.navigate(href);
|
|
13
|
-
else if (!(await Utils.openUrl(href)))
|
|
14
|
-
throw new Error(`The system could not open ${href}.`);
|
|
15
|
-
}
|
|
1
|
+
export { nativeDestination, navigateNative } from '../native/navigation.js';
|
|
16
2
|
//# sourceMappingURL=navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/vue/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/vue/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type InjectionKey } from 'nativescript-vue';
|
|
2
|
+
/** Only the screen's decorative slot inherits this; modal and toast hosts do not. */
|
|
3
|
+
export declare const screenOverlay: InjectionKey<boolean>;
|
|
4
|
+
export declare function useOverlayLayout(): (attrs: Record<string, unknown>) => {
|
|
5
|
+
isPassThroughParentEnabled?: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
isPassThroughParentEnabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=screen-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-overlay.d.ts","sourceRoot":"","sources":["../../src/vue/screen-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE5D,qFAAqF;AACrF,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,OAAO,CAAiC,CAAA;AAEjF,wBAAgB,gBAAgB,KAEtB,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;EAYvC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { inject } from 'nativescript-vue';
|
|
2
|
+
/** Only the screen's decorative slot inherits this; modal and toast hosts do not. */
|
|
3
|
+
export const screenOverlay = Symbol('mavis.screenOverlay');
|
|
4
|
+
export function useOverlayLayout() {
|
|
5
|
+
const overlay = inject(screenOverlay, false);
|
|
6
|
+
return (attrs) => {
|
|
7
|
+
if (!overlay)
|
|
8
|
+
return {};
|
|
9
|
+
const style = attrs.style;
|
|
10
|
+
// Explicit native gestures and the Web's pointer opt-in keep interactive
|
|
11
|
+
// layers usable. Plain nested layouts let their empty area pass through.
|
|
12
|
+
const interactive = style?.pointerEvents === 'auto' ||
|
|
13
|
+
['onTap', 'onTouch', 'onPan', 'onLongPress', 'onDoubleTap', 'onSwipe'].some((name) => attrs[name]);
|
|
14
|
+
return { isPassThroughParentEnabled: !interactive };
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=screen-overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-overlay.js","sourceRoot":"","sources":["../../src/vue/screen-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,kBAAkB,CAAA;AAE5D,qFAAqF;AACrF,MAAM,CAAC,MAAM,aAAa,GAA0B,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEjF,MAAM,UAAU,gBAAgB;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;IAC5C,OAAO,CAAC,KAA8B,EAAE,EAAE;QACxC,IAAI,CAAC,OAAO;YAAE,OAAO,EAAE,CAAA;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,KAA+C,CAAA;QACnE,yEAAyE;QACzE,yEAAyE;QACzE,MAAM,WAAW,GACf,KAAK,EAAE,aAAa,KAAK,MAAM;YAC/B,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,IAAI,CACzE,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CACtB,CAAA;QACH,OAAO,EAAE,0BAA0B,EAAE,CAAC,WAAW,EAAE,CAAA;IACrD,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type MotionSurface } from '@getcortexlabs/mavis-core/experimental';
|
|
1
|
+
import type { MotionSurface } from '@getcortexlabs/mavis-core/experimental';
|
|
3
2
|
export declare function useMotionSurface(surface: () => MotionSurface | undefined, enabled?: () => boolean, plainText?: () => boolean, afterLayout?: boolean): {
|
|
4
3
|
allowsActivation: () => boolean;
|
|
5
|
-
onLoaded(event: EventData)
|
|
4
|
+
onLoaded: (event: import("@nativescript/core").EventData) => void;
|
|
6
5
|
onUnloaded: () => void;
|
|
7
6
|
};
|
|
8
7
|
//# sourceMappingURL=use-motion-surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-motion-surface.d.ts","sourceRoot":"","sources":["../../src/vue/use-motion-surface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-motion-surface.d.ts","sourceRoot":"","sources":["../../src/vue/use-motion-surface.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAI3E,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,aAAa,GAAG,SAAS,EACxC,OAAO,GAAE,MAAM,OAAoB,EACnC,SAAS,GAAE,MAAM,OAAqB,EACtC,WAAW,UAAQ;;;;EAapB"}
|
|
@@ -1,143 +1,18 @@
|
|
|
1
|
-
import { Utils, isAndroid } from '@nativescript/core';
|
|
2
1
|
import { inject, onBeforeUnmount, watch } from 'nativescript-vue';
|
|
3
|
-
import {
|
|
4
|
-
import { bindMotionSurface, motionChannels, motionKeyframes, } from '@getcortexlabs/mavis-core/experimental';
|
|
5
|
-
import { nativeContinuousSurface } from '../native/motion-surface.js';
|
|
6
|
-
import { nativeMotionOwner } from '../native/motion-owner.js';
|
|
2
|
+
import { createNativeMotionSurface } from '../native/motion-binding.js';
|
|
7
3
|
import { perspectiveKey } from './perspective.js';
|
|
8
|
-
import { takeShadow } from '../native/moved-shadow.js';
|
|
9
4
|
export function useMotionSurface(surface, enabled = () => true, plainText = () => false, afterLayout = false) {
|
|
10
|
-
let view;
|
|
11
|
-
let unbind;
|
|
12
|
-
let offPreference;
|
|
13
|
-
let continuous;
|
|
14
|
-
const active = new Map();
|
|
15
|
-
let layoutView;
|
|
16
|
-
let layoutQueued = false;
|
|
17
5
|
const perspective = inject(perspectiveKey, undefined);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const depth = perspective?.();
|
|
21
|
-
if (flat && (depth === undefined || flat.view !== view)) {
|
|
22
|
-
flat.view.perspective = flat.perspective;
|
|
23
|
-
flat = undefined;
|
|
24
|
-
}
|
|
25
|
-
if (!view || depth === undefined || !unbind)
|
|
26
|
-
return;
|
|
27
|
-
flat ??= { view, perspective: view.perspective };
|
|
28
|
-
// Core multiplies by the density for Android's camera distance, whose unit is not the
|
|
29
|
-
// CSS distance. This is the factor that draws the same projection as iOS and the Web.
|
|
30
|
-
view.perspective = isAndroid ? depth * Utils.layout.getDisplayDensity() * Math.sqrt(5) : depth;
|
|
31
|
-
};
|
|
32
|
-
const clearLayout = () => {
|
|
33
|
-
layoutView?.off('layoutChanged', laidOut);
|
|
34
|
-
layoutView = undefined;
|
|
35
|
-
};
|
|
36
|
-
const release = () => {
|
|
37
|
-
unbind?.();
|
|
38
|
-
unbind = undefined;
|
|
39
|
-
continuous = undefined;
|
|
40
|
-
offPreference?.();
|
|
41
|
-
offPreference = undefined;
|
|
42
|
-
for (const handle of active.keys())
|
|
43
|
-
handle.stop();
|
|
44
|
-
active.clear();
|
|
45
|
-
project();
|
|
46
|
-
};
|
|
47
|
-
const bind = () => {
|
|
48
|
-
release();
|
|
49
|
-
const target = view;
|
|
50
|
-
const reference = surface();
|
|
51
|
-
if (!target || !reference)
|
|
52
|
-
return;
|
|
53
|
-
if (afterLayout &&
|
|
54
|
-
(!target.isLayoutValid ||
|
|
55
|
-
target.getActualSize().width <= 0 ||
|
|
56
|
-
target.getActualSize().height <= 0)) {
|
|
57
|
-
if (layoutView !== target) {
|
|
58
|
-
clearLayout();
|
|
59
|
-
layoutView = target;
|
|
60
|
-
target.on('layoutChanged', laidOut);
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
clearLayout();
|
|
65
|
-
continuous = nativeContinuousSurface(target, enabled, plainText);
|
|
66
|
-
unbind = bindMotionSurface(reference, nativeMotionOwner({
|
|
67
|
-
...continuous.adapter,
|
|
68
|
-
animate(values, options) {
|
|
69
|
-
continuous?.interrupt(motionChannels(values));
|
|
70
|
-
const handle = animate(target, motionKeyframes(values), options);
|
|
71
|
-
takeShadow(target, values);
|
|
72
|
-
active.set(handle, values);
|
|
73
|
-
void handle.finished.then(() => active.delete(handle));
|
|
74
|
-
return handle;
|
|
75
|
-
},
|
|
76
|
-
set: (values) => {
|
|
77
|
-
continuous?.interrupt(Object.keys(values));
|
|
78
|
-
// Jolt on Android leaves the path's translationY on the view when a path still in
|
|
79
|
-
// flight is replaced by a zero-duration set (rafaelaugustos/jolt#479).
|
|
80
|
-
if (isAndroid && ('x' in values || 'y' in values || 'rotate' in values))
|
|
81
|
-
for (const [handle, frames] of active)
|
|
82
|
-
if (frames.path)
|
|
83
|
-
handle.stop();
|
|
84
|
-
const handle = animate(target, values, { duration: 0 });
|
|
85
|
-
takeShadow(target, values);
|
|
86
|
-
return handle;
|
|
87
|
-
},
|
|
88
|
-
}, target));
|
|
89
|
-
project();
|
|
90
|
-
offPreference = onReducedMotion((reduced) => {
|
|
91
|
-
if (!reduced)
|
|
92
|
-
return;
|
|
93
|
-
// Set only spatial channels: opacity and shadow paint can keep their timelines.
|
|
94
|
-
const values = {};
|
|
95
|
-
for (const frames of active.values()) {
|
|
96
|
-
if (frames.path)
|
|
97
|
-
Object.assign(values, {
|
|
98
|
-
x: frames.path.end.x,
|
|
99
|
-
y: frames.path.end.y,
|
|
100
|
-
...(frames.orient ? { rotate: frames.path.end.rotate } : {}),
|
|
101
|
-
});
|
|
102
|
-
for (const [property, value] of Object.entries(frames)) {
|
|
103
|
-
if (property === 'opacity' || property.startsWith('shadow'))
|
|
104
|
-
continue;
|
|
105
|
-
const final = Array.isArray(value) ? value.at(-1) : value;
|
|
106
|
-
if (typeof final === 'number')
|
|
107
|
-
values[property] = final;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (Object.keys(values).length)
|
|
111
|
-
set(target, values);
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
const laidOut = () => {
|
|
115
|
-
if (layoutQueued)
|
|
116
|
-
return;
|
|
117
|
-
layoutQueued = true;
|
|
118
|
-
void Promise.resolve().then(() => {
|
|
119
|
-
layoutQueued = false;
|
|
120
|
-
if (view)
|
|
121
|
-
bind();
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
const unloaded = () => {
|
|
125
|
-
clearLayout();
|
|
126
|
-
release();
|
|
127
|
-
view = undefined;
|
|
128
|
-
};
|
|
129
|
-
watch(surface, bind, { flush: 'post' });
|
|
6
|
+
const binding = createNativeMotionSurface(surface, enabled, plainText, afterLayout, perspective);
|
|
7
|
+
watch(surface, binding.refresh, { flush: 'post' });
|
|
130
8
|
if (perspective)
|
|
131
|
-
watch(perspective,
|
|
132
|
-
watch(enabled,
|
|
133
|
-
onBeforeUnmount(
|
|
9
|
+
watch(perspective, binding.refreshPerspective, { flush: 'post' });
|
|
10
|
+
watch(enabled, binding.refreshEnabled, { flush: 'sync' });
|
|
11
|
+
onBeforeUnmount(binding.onUnloaded);
|
|
134
12
|
return {
|
|
135
|
-
allowsActivation:
|
|
136
|
-
onLoaded
|
|
137
|
-
|
|
138
|
-
bind();
|
|
139
|
-
},
|
|
140
|
-
onUnloaded: unloaded,
|
|
13
|
+
allowsActivation: binding.allowsActivation,
|
|
14
|
+
onLoaded: binding.onLoaded,
|
|
15
|
+
onUnloaded: binding.onUnloaded,
|
|
141
16
|
};
|
|
142
17
|
}
|
|
143
18
|
//# sourceMappingURL=use-motion-surface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-motion-surface.js","sourceRoot":"","sources":["../../src/vue/use-motion-surface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"use-motion-surface.js","sourceRoot":"","sources":["../../src/vue/use-motion-surface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAEjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,MAAM,UAAU,gBAAgB,CAC9B,OAAwC,EACxC,UAAyB,GAAG,EAAE,CAAC,IAAI,EACnC,YAA2B,GAAG,EAAE,CAAC,KAAK,EACtC,WAAW,GAAG,KAAK;IAEnB,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;IACrD,MAAM,OAAO,GAAG,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAA;IAChG,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IAClD,IAAI,WAAW;QAAE,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IAClF,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IACzD,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACnC,OAAO;QACL,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getcortexlabs/mavis",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
4
|
-
"description": "Mavis UI foundations
|
|
3
|
+
"version": "0.1.0-rc.15",
|
|
4
|
+
"description": "Mavis UI foundations and direct NativeScript framework integrations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"./dist/vue/components/layout.js",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"./date-format": {
|
|
28
28
|
"types": "./dist/date-format.d.ts",
|
|
29
29
|
"default": "./dist/date-format.js"
|
|
30
|
+
},
|
|
31
|
+
"./native": {
|
|
32
|
+
"types": "./dist/components/index.d.ts",
|
|
33
|
+
"default": "./dist/components/index.js"
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
"files": [
|
|
@@ -43,7 +47,7 @@
|
|
|
43
47
|
},
|
|
44
48
|
"peerDependencies": {
|
|
45
49
|
"@nativescript/core": "^9.1.3",
|
|
46
|
-
"@rafaelaugusto/jolt": "^0.1.0-rc.
|
|
50
|
+
"@rafaelaugusto/jolt": "^0.1.0-rc.17",
|
|
47
51
|
"nativescript-vue": "^3.1.3"
|
|
48
52
|
},
|
|
49
53
|
"peerDependenciesMeta": {
|
|
@@ -52,7 +56,7 @@
|
|
|
52
56
|
}
|
|
53
57
|
},
|
|
54
58
|
"dependencies": {
|
|
55
|
-
"@getcortexlabs/mavis-core": "0.1.0-rc.
|
|
59
|
+
"@getcortexlabs/mavis-core": "0.1.0-rc.15"
|
|
56
60
|
},
|
|
57
61
|
"nativescript": {
|
|
58
62
|
"platforms": {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.mavis.ui;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
|
+
import android.view.Gravity;
|
|
5
|
+
import android.view.View;
|
|
4
6
|
import android.view.ViewGroup;
|
|
5
7
|
import org.nativescript.widgets.CommonLayoutParams;
|
|
6
8
|
import org.nativescript.widgets.GridLayout;
|
|
@@ -13,6 +15,35 @@ public class Box extends GridLayout implements MeasureMemo.Owner {
|
|
|
13
15
|
super(context);
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
@Override
|
|
19
|
+
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
|
20
|
+
// Core interprets FILL plus a declared size as CENTER. Keep grid's own
|
|
21
|
+
// inset/margin handling, but anchor fixed layers like the Web's one cell.
|
|
22
|
+
int[] gravity = new int[getChildCount()];
|
|
23
|
+
for (int i = 0; i < getChildCount(); i++) {
|
|
24
|
+
View child = getChildAt(i);
|
|
25
|
+
CommonLayoutParams params = (CommonLayoutParams) child.getLayoutParams();
|
|
26
|
+
gravity[i] = params.gravity;
|
|
27
|
+
int value = params.gravity == -1 ? Gravity.FILL : params.gravity;
|
|
28
|
+
if ((params.width >= 0 || params.widthPercent > 0)
|
|
29
|
+
&& (value & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {
|
|
30
|
+
value = (value & ~Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.LEFT;
|
|
31
|
+
}
|
|
32
|
+
if ((params.height >= 0 || params.heightPercent > 0)
|
|
33
|
+
&& (value & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) {
|
|
34
|
+
value = (value & ~Gravity.VERTICAL_GRAVITY_MASK) | Gravity.TOP;
|
|
35
|
+
}
|
|
36
|
+
params.gravity = value;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
super.onLayout(changed, left, top, right, bottom);
|
|
40
|
+
} finally {
|
|
41
|
+
for (int i = 0; i < gravity.length; i++) {
|
|
42
|
+
((CommonLayoutParams) getChildAt(i).getLayoutParams()).gravity = gravity[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
16
47
|
@Override
|
|
17
48
|
public int memoWidthSpec() {
|
|
18
49
|
return memo.receivedWidthSpec();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { NativeComponentEvents } from './contracts.js'
|
|
2
|
+
|
|
3
|
+
/** Framework-specific event syntax maps to these semantic callbacks. */
|
|
4
|
+
export interface ComponentCallbacks {
|
|
5
|
+
onClick?(): void
|
|
6
|
+
onError?(error: unknown): void
|
|
7
|
+
onValueChange?(value: string): void
|
|
8
|
+
onSubmit?(value: string): void
|
|
9
|
+
onFocus?(): void
|
|
10
|
+
onBlur?(): void
|
|
11
|
+
onAction?(): void
|
|
12
|
+
}
|
|
13
|
+
export function componentEvents(props: ComponentCallbacks): NativeComponentEvents {
|
|
14
|
+
return {
|
|
15
|
+
activate: props.onClick,
|
|
16
|
+
error: props.onError,
|
|
17
|
+
valueChange: props.onValueChange,
|
|
18
|
+
submit: props.onSubmit,
|
|
19
|
+
focus: props.onFocus,
|
|
20
|
+
blur: props.onBlur,
|
|
21
|
+
action: props.onAction,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function plainComponentText(value: unknown): string {
|
|
26
|
+
if (value === null || value === undefined || typeof value === 'boolean') return ''
|
|
27
|
+
if (typeof value === 'string' || typeof value === 'number') return String(value)
|
|
28
|
+
if (Array.isArray(value)) return value.map(plainComponentText).join('')
|
|
29
|
+
throw new TypeError(
|
|
30
|
+
'This foundation text slot accepts text. Use the text prop for computed content.',
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { componentContracts, type ContractProps } from '@getcortexlabs/mavis-core'
|
|
2
|
+
import type { MavisThemeScope } from './theme.js'
|
|
3
|
+
|
|
4
|
+
export type NativeComponentName = keyof typeof componentContracts
|
|
5
|
+
export type NativeComponentProps<N extends NativeComponentName> = ContractProps<
|
|
6
|
+
(typeof componentContracts)[N]['props']
|
|
7
|
+
>
|
|
8
|
+
export type MBoxProps = NativeComponentProps<'MBox'>
|
|
9
|
+
export type MRowProps = NativeComponentProps<'MRow'>
|
|
10
|
+
export type MColumnProps = NativeComponentProps<'MColumn'>
|
|
11
|
+
export type MTextProps = NativeComponentProps<'MText'>
|
|
12
|
+
export type MButtonProps = NativeComponentProps<'MButton'>
|
|
13
|
+
export type MInputProps = NativeComponentProps<'MInput'>
|
|
14
|
+
|
|
15
|
+
export interface NativeComponentEvents {
|
|
16
|
+
activate?(): void
|
|
17
|
+
error?(error: unknown): void
|
|
18
|
+
valueChange?(value: string): void
|
|
19
|
+
submit?(value: string): void
|
|
20
|
+
focus?(): void
|
|
21
|
+
blur?(): void
|
|
22
|
+
action?(): void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface NativeComponentOptions {
|
|
26
|
+
theme?: MavisThemeScope
|
|
27
|
+
events?: NativeComponentEvents
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function componentDefaults<N extends NativeComponentName>(name: N) {
|
|
31
|
+
return Object.fromEntries(
|
|
32
|
+
Object.entries(componentContracts[name].props).map(([key, definition]) => [
|
|
33
|
+
key,
|
|
34
|
+
'default' in definition ? definition.default : undefined,
|
|
35
|
+
]),
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function normalizeComponentProps<N extends NativeComponentName>(
|
|
40
|
+
name: N,
|
|
41
|
+
props: NativeComponentProps<N>,
|
|
42
|
+
) {
|
|
43
|
+
const result = componentDefaults(name)
|
|
44
|
+
for (const [key, definition] of Object.entries(componentContracts[name].props)) {
|
|
45
|
+
const value = (props as Record<string, unknown>)[key]
|
|
46
|
+
if (value !== undefined) result[key] = value
|
|
47
|
+
if (result[key] === undefined) {
|
|
48
|
+
if ('required' in definition && definition.required)
|
|
49
|
+
throw new TypeError(`${name}.${key} is required`)
|
|
50
|
+
continue
|
|
51
|
+
}
|
|
52
|
+
const kinds: readonly string[] =
|
|
53
|
+
typeof definition.kind === 'string' ? [definition.kind] : definition.kind
|
|
54
|
+
if (!kinds.includes(typeof result[key]))
|
|
55
|
+
throw new TypeError(`${name}.${key} must be ${kinds.join(' or ')}`)
|
|
56
|
+
if ('values' in definition && !(definition.values as readonly unknown[]).includes(result[key]))
|
|
57
|
+
throw new RangeError(`Invalid ${name}.${key}: ${String(result[key])}`)
|
|
58
|
+
}
|
|
59
|
+
return result as Required<NativeComponentProps<N>>
|
|
60
|
+
}
|