@getcortexlabs/mavis 0.1.0-alpha.8 → 0.1.0-rc.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/date-format.d.ts +3 -0
- package/dist/date-format.d.ts.map +1 -0
- package/dist/date-format.js +2 -0
- package/dist/date-format.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/motion-region.d.ts +1 -0
- package/dist/native/motion-region.d.ts.map +1 -1
- package/dist/native/motion-region.js +8 -1
- package/dist/native/motion-region.js.map +1 -1
- package/dist/native/motion-surface.d.ts +1 -1
- package/dist/native/motion-surface.d.ts.map +1 -1
- package/dist/native/motion-surface.js +17 -1
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/number-flow-format.android.d.ts +3 -0
- package/dist/native/number-flow-format.android.d.ts.map +1 -0
- package/dist/native/number-flow-format.android.js +27 -0
- package/dist/native/number-flow-format.android.js.map +1 -0
- package/dist/native/number-flow-format.d.ts +4 -0
- package/dist/native/number-flow-format.d.ts.map +1 -0
- package/dist/native/number-flow-format.ios.d.ts +3 -0
- package/dist/native/number-flow-format.ios.d.ts.map +1 -0
- package/dist/native/number-flow-format.ios.js +24 -0
- package/dist/native/number-flow-format.ios.js.map +1 -0
- package/dist/native/number-flow-format.js +5 -0
- package/dist/native/number-flow-format.js.map +1 -0
- package/dist/native/section-scroll.d.ts +9 -0
- package/dist/native/section-scroll.d.ts.map +1 -0
- package/dist/native/section-scroll.js +69 -0
- package/dist/native/section-scroll.js.map +1 -0
- package/dist/native/segmented.d.ts.map +1 -1
- package/dist/native/segmented.js +4 -3
- package/dist/native/segmented.js.map +1 -1
- package/dist/vue/animated-number.d.ts +6 -0
- package/dist/vue/animated-number.d.ts.map +1 -0
- package/dist/vue/animated-number.js +52 -0
- package/dist/vue/animated-number.js.map +1 -0
- package/dist/vue/component-width.d.ts +7 -0
- package/dist/vue/component-width.d.ts.map +1 -0
- package/dist/vue/component-width.js +29 -0
- package/dist/vue/component-width.js.map +1 -0
- package/dist/vue/components/ChartPlot.d.ts +66 -0
- package/dist/vue/components/ChartPlot.d.ts.map +1 -0
- package/dist/vue/components/ChartPlot.js +236 -0
- package/dist/vue/components/ChartPlot.js.map +1 -0
- package/dist/vue/components/ChoiceControl.d.ts +3 -0
- package/dist/vue/components/ChoiceControl.d.ts.map +1 -1
- package/dist/vue/components/ChoiceControl.js +29 -22
- package/dist/vue/components/ChoiceControl.js.map +1 -1
- package/dist/vue/components/DateCalendar.d.ts +17 -2
- package/dist/vue/components/DateCalendar.d.ts.map +1 -1
- package/dist/vue/components/DateCalendar.js +45 -10
- package/dist/vue/components/DateCalendar.js.map +1 -1
- package/dist/vue/components/LoadingDecoration.d.ts +1 -1
- package/dist/vue/components/MAccordion.d.ts +1 -1
- package/dist/vue/components/MAlert.d.ts +3 -3
- package/dist/vue/components/MAlert.d.ts.map +1 -1
- package/dist/vue/components/MAlert.js +3 -0
- package/dist/vue/components/MAlert.js.map +1 -1
- package/dist/vue/components/MAvatar.d.ts +1 -1
- package/dist/vue/components/MAvatar.d.ts.map +1 -1
- package/dist/vue/components/MAvatar.js +5 -1
- package/dist/vue/components/MAvatar.js.map +1 -1
- package/dist/vue/components/MBadge.d.ts +1 -1
- package/dist/vue/components/MBadge.d.ts.map +1 -1
- package/dist/vue/components/MBadge.js +3 -1
- package/dist/vue/components/MBadge.js.map +1 -1
- package/dist/vue/components/MButton.d.ts +6 -6
- package/dist/vue/components/MButton.d.ts.map +1 -1
- package/dist/vue/components/MButton.js +4 -3
- package/dist/vue/components/MButton.js.map +1 -1
- package/dist/vue/components/MCard.d.ts +3 -3
- 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 +2 -2
- package/dist/vue/components/MCombobox.d.ts +3 -3
- package/dist/vue/components/MCombobox.d.ts.map +1 -1
- package/dist/vue/components/MCombobox.js +3 -1
- package/dist/vue/components/MCombobox.js.map +1 -1
- package/dist/vue/components/MDatePicker.d.ts +72 -24
- 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 -3
- package/dist/vue/components/MEmptyState.d.ts +2 -2
- package/dist/vue/components/MEmptyState.d.ts.map +1 -1
- package/dist/vue/components/MEmptyState.js +3 -0
- package/dist/vue/components/MEmptyState.js.map +1 -1
- package/dist/vue/components/MFilePicker.d.ts +4 -4
- package/dist/vue/components/MFilePicker.d.ts.map +1 -1
- package/dist/vue/components/MFilePicker.js +3 -0
- package/dist/vue/components/MFilePicker.js.map +1 -1
- package/dist/vue/components/MGrid.d.ts +176 -0
- package/dist/vue/components/MGrid.d.ts.map +1 -0
- package/dist/vue/components/MGrid.js +56 -0
- package/dist/vue/components/MGrid.js.map +1 -0
- package/dist/vue/components/MIcon.d.ts +3 -3
- package/dist/vue/components/MImage.d.ts +47 -2
- package/dist/vue/components/MImage.d.ts.map +1 -1
- package/dist/vue/components/MImage.js +8 -1
- package/dist/vue/components/MImage.js.map +1 -1
- package/dist/vue/components/MImageCompare.d.ts +92 -0
- package/dist/vue/components/MImageCompare.d.ts.map +1 -0
- package/dist/vue/components/MImageCompare.js +138 -0
- package/dist/vue/components/MImageCompare.js.map +1 -0
- package/dist/vue/components/MImageViewer.d.ts +121 -0
- package/dist/vue/components/MImageViewer.d.ts.map +1 -0
- package/dist/vue/components/MImageViewer.js +444 -0
- package/dist/vue/components/MImageViewer.js.map +1 -0
- package/dist/vue/components/MInput.d.ts +6 -6
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MInput.js +18 -0
- package/dist/vue/components/MInput.js.map +1 -1
- 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/MPopover.d.ts +106 -0
- package/dist/vue/components/MPopover.d.ts.map +1 -0
- package/dist/vue/components/MPopover.js +247 -0
- package/dist/vue/components/MPopover.js.map +1 -0
- package/dist/vue/components/MProgress.d.ts +3 -3
- package/dist/vue/components/MProgress.d.ts.map +1 -1
- package/dist/vue/components/MProgress.js +5 -2
- package/dist/vue/components/MProgress.js.map +1 -1
- package/dist/vue/components/MRangeSlider.d.ts +105 -0
- package/dist/vue/components/MRangeSlider.d.ts.map +1 -0
- package/dist/vue/components/MRangeSlider.js +134 -0
- package/dist/vue/components/MRangeSlider.js.map +1 -0
- package/dist/vue/components/MResizablePanels.d.ts +137 -0
- package/dist/vue/components/MResizablePanels.d.ts.map +1 -0
- package/dist/vue/components/MResizablePanels.js +148 -0
- package/dist/vue/components/MResizablePanels.js.map +1 -0
- package/dist/vue/components/MReveal.d.ts +11 -11
- package/dist/vue/components/MSelect.d.ts +1 -1
- package/dist/vue/components/MSheet.d.ts +14 -5
- package/dist/vue/components/MSheet.d.ts.map +1 -1
- package/dist/vue/components/MStack.d.ts +22 -11
- package/dist/vue/components/MStack.d.ts.map +1 -1
- package/dist/vue/components/MStack.js +6 -1
- package/dist/vue/components/MStack.js.map +1 -1
- package/dist/vue/components/MTabs.d.ts.map +1 -1
- package/dist/vue/components/MTabs.js +6 -5
- package/dist/vue/components/MTabs.js.map +1 -1
- package/dist/vue/components/MText.d.ts +4 -4
- package/dist/vue/components/MTimePicker.d.ts +655 -0
- package/dist/vue/components/MTimePicker.d.ts.map +1 -0
- package/dist/vue/components/MTimePicker.js +50 -0
- package/dist/vue/components/MTimePicker.js.map +1 -0
- package/dist/vue/components/MTooltip.d.ts +65 -0
- package/dist/vue/components/MTooltip.d.ts.map +1 -0
- package/dist/vue/components/MTooltip.js +35 -0
- package/dist/vue/components/MTooltip.js.map +1 -0
- package/dist/vue/components/MVirtualList.d.ts +3 -0
- package/dist/vue/components/MVirtualList.d.ts.map +1 -0
- package/dist/vue/components/MVirtualList.js +106 -0
- package/dist/vue/components/MVirtualList.js.map +1 -0
- package/dist/vue/components/MotionRows.d.ts +15 -0
- package/dist/vue/components/MotionRows.d.ts.map +1 -0
- package/dist/vue/components/MotionRows.js +12 -0
- package/dist/vue/components/MotionRows.js.map +1 -0
- package/dist/vue/components/configurator.d.ts +5 -5
- package/dist/vue/components/discovery.d.ts +282 -0
- package/dist/vue/components/discovery.d.ts.map +1 -0
- package/dist/vue/components/discovery.js +65 -0
- package/dist/vue/components/discovery.js.map +1 -0
- package/dist/vue/components/interactive.d.ts +164 -0
- package/dist/vue/components/interactive.d.ts.map +1 -0
- package/dist/vue/components/interactive.js +33 -0
- package/dist/vue/components/interactive.js.map +1 -0
- package/dist/vue/components/layout.d.ts +47 -25
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +2 -1
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/components/navigation.d.ts +225 -0
- package/dist/vue/components/navigation.d.ts.map +1 -0
- package/dist/vue/components/navigation.js +16 -0
- package/dist/vue/components/navigation.js.map +1 -0
- package/dist/vue/components/wayfinding.d.ts +441 -0
- package/dist/vue/components/wayfinding.d.ts.map +1 -0
- package/dist/vue/components/wayfinding.js +39 -0
- package/dist/vue/components/wayfinding.js.map +1 -0
- package/dist/vue/components/workflows.d.ts +2 -2
- package/dist/vue/index.d.ts +22 -12
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +47 -12
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/router-navigation.d.ts +25 -0
- package/dist/vue/router-navigation.d.ts.map +1 -0
- package/dist/vue/router-navigation.js +15 -0
- package/dist/vue/router-navigation.js.map +1 -0
- package/dist/vue/services.d.ts +16 -0
- package/dist/vue/services.d.ts.map +1 -0
- package/dist/vue/services.js +23 -0
- package/dist/vue/services.js.map +1 -0
- package/package.json +16 -5
- package/src/date-format.ts +2 -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/motion-region.ts +14 -1
- package/src/native/motion-surface.ts +24 -1
- package/src/native/number-flow-format.android.ts +61 -0
- package/src/native/number-flow-format.ios.ts +40 -0
- package/src/native/number-flow-format.ts +9 -0
- package/src/native/section-scroll.ts +81 -0
- package/src/native/segmented.ts +4 -3
- package/src/vue/animated-number.ts +57 -0
- package/src/vue/component-width.ts +34 -0
- package/src/vue/components/ChartPlot.ts +267 -0
- package/src/vue/components/ChoiceControl.ts +32 -25
- package/src/vue/components/DateCalendar.ts +50 -9
- package/src/vue/components/MAlert.ts +3 -0
- package/src/vue/components/MAvatar.ts +5 -1
- package/src/vue/components/MBadge.ts +3 -1
- package/src/vue/components/MButton.ts +4 -2
- package/src/vue/components/MCard.ts +4 -2
- package/src/vue/components/MCombobox.ts +6 -1
- package/src/vue/components/MDatePicker.ts +3 -11
- package/src/vue/components/MEmptyState.ts +3 -0
- package/src/vue/components/MFilePicker.ts +3 -0
- package/src/vue/components/MGrid.ts +100 -0
- package/src/vue/components/MImage.ts +10 -1
- package/src/vue/components/MImageCompare.ts +162 -0
- package/src/vue/components/MImageViewer.ts +489 -0
- package/src/vue/components/MInput.ts +17 -3
- package/src/vue/components/MLink.ts +12 -9
- package/src/vue/components/MPopover.ts +305 -0
- package/src/vue/components/MProgress.ts +8 -2
- package/src/vue/components/MRangeSlider.ts +157 -0
- package/src/vue/components/MResizablePanels.ts +180 -0
- package/src/vue/components/MStack.ts +6 -0
- package/src/vue/components/MTabs.ts +10 -4
- package/src/vue/components/MTimePicker.ts +57 -0
- package/src/vue/components/MTooltip.ts +39 -0
- package/src/vue/components/MVirtualList.ts +140 -0
- package/src/vue/components/MotionRows.ts +17 -0
- package/src/vue/components/discovery.ts +91 -0
- package/src/vue/components/interactive.ts +43 -0
- package/src/vue/components/layout.ts +2 -0
- package/src/vue/components/navigation.ts +19 -0
- package/src/vue/components/wayfinding.ts +48 -0
- package/src/vue/index.ts +142 -69
- package/src/vue/router-navigation.ts +39 -0
- package/src/vue/services.ts +39 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMotionSurface } from '../use-motion-surface.js'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
watch,
|
|
8
9
|
registerElement,
|
|
9
10
|
} from 'nativescript-vue'
|
|
10
|
-
import { avatarProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
11
|
+
import { avatarProps, useMavisTheme, useComponentContent } from '@getcortexlabs/mavis-core/vue'
|
|
11
12
|
import { avatarSizes, avatarInitials, iconGlyph, iconFontFamily } from '@getcortexlabs/mavis-core'
|
|
12
13
|
import type { ImageSource } from '@nativescript/core'
|
|
13
14
|
import { loadAvatarImage } from '../../native/avatar-image'
|
|
@@ -23,6 +24,8 @@ export const MAvatar = defineComponent({
|
|
|
23
24
|
props: avatarProps,
|
|
24
25
|
setup(props, { attrs }) {
|
|
25
26
|
const { theme } = useMavisTheme()
|
|
27
|
+
const reveal = useComponentContent()
|
|
28
|
+
const motion = useMotionSurface(() => reveal)
|
|
26
29
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
27
30
|
const image = shallowRef<ImageSource | null>(null)
|
|
28
31
|
let request = 0
|
|
@@ -70,6 +73,7 @@ export const MAvatar = defineComponent({
|
|
|
70
73
|
image.value
|
|
71
74
|
? [
|
|
72
75
|
h('Image', {
|
|
76
|
+
...motion,
|
|
73
77
|
imageSource: image.value,
|
|
74
78
|
stretch: 'aspectFill',
|
|
75
79
|
width: size,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, h, mergeProps } from 'nativescript-vue'
|
|
2
|
-
import { badgeProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
2
|
+
import { badgeProps, useMavisTheme, useComponentContent } from '@getcortexlabs/mavis-core/vue'
|
|
3
3
|
import { badgeColors } from '@getcortexlabs/mavis-core'
|
|
4
4
|
import { MText } from './MText.js'
|
|
5
5
|
|
|
@@ -9,12 +9,14 @@ export const MBadge = defineComponent({
|
|
|
9
9
|
props: badgeProps,
|
|
10
10
|
setup(props, { attrs }) {
|
|
11
11
|
const { theme } = useMavisTheme()
|
|
12
|
+
const content = useComponentContent(() => props.text, false)
|
|
12
13
|
return () =>
|
|
13
14
|
h(
|
|
14
15
|
MText,
|
|
15
16
|
mergeProps(attrs, {
|
|
16
17
|
id: props.id,
|
|
17
18
|
text: String(props.text),
|
|
19
|
+
motionSurface: content,
|
|
18
20
|
variant: 'caption',
|
|
19
21
|
accessibilityLabel: props.accessibilityLabel,
|
|
20
22
|
accessibilityHidden: props.accessibilityHidden,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
buttonContent,
|
|
21
21
|
ButtonAdornment,
|
|
22
22
|
useMavisTheme,
|
|
23
|
+
useNavigationOptions,
|
|
23
24
|
actionEmits,
|
|
24
25
|
textContent,
|
|
25
26
|
useLayoutShrink,
|
|
@@ -58,6 +59,7 @@ export const MButton = defineComponent({
|
|
|
58
59
|
setup(props, { attrs, slots, emit }) {
|
|
59
60
|
useButtonAction()
|
|
60
61
|
const { theme } = useMavisTheme()
|
|
62
|
+
const navigation = useNavigationOptions(props)
|
|
61
63
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
62
64
|
const shrink = useLayoutShrink()
|
|
63
65
|
const enabled = () => !props.disabled && !props.loading
|
|
@@ -76,7 +78,7 @@ export const MButton = defineComponent({
|
|
|
76
78
|
if (!enabled() || !allowsActivation()) return
|
|
77
79
|
emit('click')
|
|
78
80
|
if (props.href !== undefined)
|
|
79
|
-
void navigateNative(
|
|
81
|
+
void navigateNative(navigation()).catch((error) => emit('error', error))
|
|
80
82
|
}
|
|
81
83
|
return () => {
|
|
82
84
|
if (
|
|
@@ -91,7 +93,7 @@ export const MButton = defineComponent({
|
|
|
91
93
|
throw new TypeError(
|
|
92
94
|
'A reorder handle requires a plain-text MButton without navigation or adornments.',
|
|
93
95
|
)
|
|
94
|
-
if (props.href !== undefined) nativeDestination(
|
|
96
|
+
if (props.href !== undefined) nativeDestination(navigation())
|
|
95
97
|
const { colors, control, radius } = theme.value
|
|
96
98
|
const tokens = theme.value.components.button
|
|
97
99
|
const family = fontFamily(
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useButtonAction,
|
|
7
7
|
cardProps,
|
|
8
8
|
useMavisTheme,
|
|
9
|
+
useNavigationOptions,
|
|
9
10
|
actionEmits,
|
|
10
11
|
} from '@getcortexlabs/mavis-core/vue'
|
|
11
12
|
import { MColumn } from './layout.js'
|
|
@@ -20,6 +21,7 @@ export const MCard = defineComponent({
|
|
|
20
21
|
setup(props, { attrs, slots, emit }) {
|
|
21
22
|
useButtonAction(() => props.interactive || props.href !== undefined)
|
|
22
23
|
const { theme } = useMavisTheme()
|
|
24
|
+
const navigation = useNavigationOptions(props)
|
|
23
25
|
const enabled = () => (props.interactive || props.href !== undefined) && !props.disabled
|
|
24
26
|
const lifecycle = usePressFeedback(enabled, theme)
|
|
25
27
|
const { allowsActivation, ...surface } = useMotionSurface(
|
|
@@ -39,7 +41,7 @@ export const MCard = defineComponent({
|
|
|
39
41
|
...layout
|
|
40
42
|
} = props
|
|
41
43
|
const interactive = action || href !== undefined
|
|
42
|
-
if (href !== undefined) nativeDestination(
|
|
44
|
+
if (href !== undefined) nativeDestination(navigation())
|
|
43
45
|
const tokens = theme.value.components.card
|
|
44
46
|
layout.padding ??= tokens.padding
|
|
45
47
|
layout.radius ??= tokens.radius
|
|
@@ -71,7 +73,7 @@ export const MCard = defineComponent({
|
|
|
71
73
|
if (enabled() && allowsActivation()) {
|
|
72
74
|
emit('click')
|
|
73
75
|
if (href !== undefined)
|
|
74
|
-
void navigateNative(
|
|
76
|
+
void navigateNative(navigation()).catch((error) => emit('error', error))
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
: undefined,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useComponentLayout } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -30,6 +31,10 @@ const Combobox = defineComponent({
|
|
|
30
31
|
setup(props, { attrs, emit, expose }) {
|
|
31
32
|
useButtonAction()
|
|
32
33
|
const combo = useCombobox(props, emit)
|
|
34
|
+
const resultLayout = useComponentLayout(
|
|
35
|
+
() => combo.state.value.options.map((option) => option.value),
|
|
36
|
+
false,
|
|
37
|
+
)
|
|
33
38
|
const input = ref<InputHandle>()
|
|
34
39
|
let nativeEditor: TextField | undefined
|
|
35
40
|
let compositionTimer: ReturnType<typeof setTimeout> | undefined
|
|
@@ -188,7 +193,7 @@ const Combobox = defineComponent({
|
|
|
188
193
|
combo.open.value
|
|
189
194
|
? h(
|
|
190
195
|
MColumn,
|
|
191
|
-
{ gap: 'xs' },
|
|
196
|
+
{ gap: 'xs', motionRegion: resultLayout },
|
|
192
197
|
{
|
|
193
198
|
default: () => [
|
|
194
199
|
...state.options.map((option) =>
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { Utils
|
|
1
|
+
import { Utils } from '@nativescript/core'
|
|
2
2
|
import { createDatePickers } from '@getcortexlabs/mavis-core/vue'
|
|
3
3
|
import { MInput } from './MInput.js'
|
|
4
4
|
import { MButton } from './MButton.js'
|
|
5
5
|
import { MColumn, MRow } from './layout.js'
|
|
6
6
|
import { MSheet } from './MSheet.js'
|
|
7
7
|
import { DateCalendar } from './DateCalendar.js'
|
|
8
|
-
import { notifyAccessibilityLayout } from '../../native/accessibility-layout'
|
|
9
8
|
|
|
10
9
|
function focusOpener(opener: unknown) {
|
|
11
|
-
|
|
12
|
-
view?.focus()
|
|
10
|
+
;(opener as { focusAction?: () => void } | undefined)?.focusAction?.()
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
export const { MDatePicker, MDateRangePicker } = createDatePickers({
|
|
@@ -23,11 +21,5 @@ export const { MDatePicker, MDateRangePicker } = createDatePickers({
|
|
|
23
21
|
Utils.dismissKeyboard()
|
|
24
22
|
focusOpener(opener)
|
|
25
23
|
},
|
|
26
|
-
afterClose:
|
|
27
|
-
const view = (opener as { $el?: { nativeView?: View } } | undefined)?.$el?.nativeView
|
|
28
|
-
if (!view?.isLoaded) return
|
|
29
|
-
view.focus()
|
|
30
|
-
if (isAndroid) view.android.performAccessibilityAction(64, null)
|
|
31
|
-
else notifyAccessibilityLayout(view)
|
|
32
|
-
},
|
|
24
|
+
afterClose: focusOpener,
|
|
33
25
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useComponentContent } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import { defineComponent, h, mergeProps, type SlotsType, type VNode } from 'nativescript-vue'
|
|
2
3
|
import { checkEmptyStateTitle } from '@getcortexlabs/mavis-core'
|
|
3
4
|
import { emptyStateProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
@@ -13,6 +14,7 @@ export const MEmptyState = defineComponent({
|
|
|
13
14
|
slots: Object as SlotsType<{ illustration?: () => VNode[]; actions?: () => VNode[] }>,
|
|
14
15
|
setup(props, { attrs, slots }) {
|
|
15
16
|
const { theme } = useMavisTheme()
|
|
17
|
+
const arrival = useComponentContent(() => props.title)
|
|
16
18
|
return () => {
|
|
17
19
|
checkEmptyStateTitle(props.title)
|
|
18
20
|
const { colors } = theme.value
|
|
@@ -24,6 +26,7 @@ export const MEmptyState = defineComponent({
|
|
|
24
26
|
{
|
|
25
27
|
width: size,
|
|
26
28
|
height: size,
|
|
29
|
+
motionSurface: arrival,
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
32
|
default: () => [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useComponentLayout } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -25,6 +26,7 @@ const FilePicker = defineComponent({
|
|
|
25
26
|
setup(props, { attrs, expose }) {
|
|
26
27
|
useButtonAction()
|
|
27
28
|
const state = shallowRef(props.selection.state)
|
|
29
|
+
const layout = useComponentLayout(() => state.value.items.map((item) => item.id))
|
|
28
30
|
const picker = createNativeFilePicker()
|
|
29
31
|
let chooseView: View | undefined
|
|
30
32
|
let loaded = false
|
|
@@ -87,6 +89,7 @@ const FilePicker = defineComponent({
|
|
|
87
89
|
MColumn,
|
|
88
90
|
mergeProps(attrs, {
|
|
89
91
|
gap: 'md',
|
|
92
|
+
motionRegion: layout,
|
|
90
93
|
onLoaded: () => {
|
|
91
94
|
loaded = true
|
|
92
95
|
},
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useMotionRegion } from '../use-motion-region.js'
|
|
2
|
+
import {
|
|
3
|
+
Comment,
|
|
4
|
+
Fragment,
|
|
5
|
+
Text,
|
|
6
|
+
createVNode,
|
|
7
|
+
defineComponent,
|
|
8
|
+
h,
|
|
9
|
+
mergeProps,
|
|
10
|
+
provide,
|
|
11
|
+
shallowRef,
|
|
12
|
+
type VNode,
|
|
13
|
+
} from 'nativescript-vue'
|
|
14
|
+
import type { EventData, View } from '@nativescript/core'
|
|
15
|
+
import { gridColumns, resolveSpace } from '@getcortexlabs/mavis-core'
|
|
16
|
+
import {
|
|
17
|
+
gridProps,
|
|
18
|
+
layoutDirection,
|
|
19
|
+
useLayoutShrink,
|
|
20
|
+
useMavisTheme,
|
|
21
|
+
useComponentLayout,
|
|
22
|
+
} from '@getcortexlabs/mavis-core/vue'
|
|
23
|
+
import { boxStyle } from '../props.js'
|
|
24
|
+
import { useNativeViewAttrs } from '../accessibility.js'
|
|
25
|
+
import './layout.js'
|
|
26
|
+
|
|
27
|
+
export const MGrid = defineComponent({
|
|
28
|
+
name: 'MGrid',
|
|
29
|
+
inheritAttrs: false,
|
|
30
|
+
props: gridProps,
|
|
31
|
+
setup(props, { attrs, slots }) {
|
|
32
|
+
const { theme } = useMavisTheme()
|
|
33
|
+
const shrink = useLayoutShrink()
|
|
34
|
+
const nativeAttrs = useNativeViewAttrs(props)
|
|
35
|
+
provide(layoutDirection, 'column')
|
|
36
|
+
const width = shallowRef<number>()
|
|
37
|
+
const automatic = useComponentLayout(
|
|
38
|
+
() =>
|
|
39
|
+
gridColumns(
|
|
40
|
+
props.columns,
|
|
41
|
+
props.minColumnWidth,
|
|
42
|
+
resolveSpace(theme.value, props.gap ?? 'none'),
|
|
43
|
+
width.value,
|
|
44
|
+
),
|
|
45
|
+
false,
|
|
46
|
+
)
|
|
47
|
+
const motion = useMotionRegion(() => props.motionRegion ?? automatic)
|
|
48
|
+
return () => {
|
|
49
|
+
const gap = resolveSpace(theme.value, props.gap ?? 'none')
|
|
50
|
+
const count = gridColumns(props.columns, props.minColumnWidth, gap, width.value)
|
|
51
|
+
let index = 0
|
|
52
|
+
// Keep fragment boundaries so independently keyed slot groups retain their identity.
|
|
53
|
+
const place = (nodes: VNode[]): VNode[] =>
|
|
54
|
+
nodes.flatMap((child) => {
|
|
55
|
+
if (child.type === Fragment)
|
|
56
|
+
return [
|
|
57
|
+
createVNode(
|
|
58
|
+
Fragment,
|
|
59
|
+
{ key: child.key ?? undefined },
|
|
60
|
+
place(child.children as VNode[]),
|
|
61
|
+
),
|
|
62
|
+
]
|
|
63
|
+
if (child.type === Comment || (child.type === Text && !String(child.children).trim()))
|
|
64
|
+
return []
|
|
65
|
+
const cell = index++
|
|
66
|
+
return [
|
|
67
|
+
h(
|
|
68
|
+
'MavisBox',
|
|
69
|
+
{
|
|
70
|
+
key: child.key ?? cell,
|
|
71
|
+
col: (cell % count) * 2,
|
|
72
|
+
row: Math.floor(cell / count) * 2,
|
|
73
|
+
},
|
|
74
|
+
[child],
|
|
75
|
+
),
|
|
76
|
+
]
|
|
77
|
+
})
|
|
78
|
+
const children = place(slots.default?.() ?? [])
|
|
79
|
+
const rows = Math.ceil(index / count)
|
|
80
|
+
return h(
|
|
81
|
+
'MavisBox',
|
|
82
|
+
mergeProps({ style: boxStyle(theme.value, props, shrink.value) }, nativeAttrs(), attrs),
|
|
83
|
+
[
|
|
84
|
+
h(
|
|
85
|
+
'GridLayout',
|
|
86
|
+
{
|
|
87
|
+
...motion,
|
|
88
|
+
columns: Array.from({ length: count }, () => '*').join(`,${gap},`),
|
|
89
|
+
rows: Array.from({ length: rows }, () => 'auto').join(`,${gap},`),
|
|
90
|
+
onLayoutChanged: (event: EventData) => {
|
|
91
|
+
width.value = (event.object as View).getActualSize().width
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
children,
|
|
95
|
+
),
|
|
96
|
+
],
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
})
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { markRaw, onScopeDispose } from 'nativescript-vue'
|
|
2
|
+
import { createMotionSurface } from '@getcortexlabs/mavis-core/experimental'
|
|
3
|
+
import { componentMotion } from '@getcortexlabs/mavis-core'
|
|
1
4
|
import {
|
|
2
5
|
defineComponent,
|
|
3
6
|
h,
|
|
@@ -28,6 +31,12 @@ export const MImage = defineComponent({
|
|
|
28
31
|
},
|
|
29
32
|
setup(props, { attrs, emit }) {
|
|
30
33
|
const { theme } = useMavisTheme()
|
|
34
|
+
const reveal = markRaw(createMotionSurface())
|
|
35
|
+
onScopeDispose(
|
|
36
|
+
reveal.use((owner) => {
|
|
37
|
+
owner.animate({ opacity: [0, 1] }, componentMotion(theme.value, 'overlay'))
|
|
38
|
+
}),
|
|
39
|
+
)
|
|
31
40
|
const image = shallowRef<ImageSource | null>(null)
|
|
32
41
|
const status = ref<'loading' | 'ready' | 'error'>('loading')
|
|
33
42
|
const width = ref(typeof props.width === 'number' ? props.width : 0)
|
|
@@ -37,7 +46,7 @@ export const MImage = defineComponent({
|
|
|
37
46
|
committing: string | undefined,
|
|
38
47
|
currentImage: Image | undefined
|
|
39
48
|
const motion = useMotionSurface(
|
|
40
|
-
() => props.motionSurface,
|
|
49
|
+
() => props.motionSurface ?? reveal,
|
|
41
50
|
() => true,
|
|
42
51
|
() => false,
|
|
43
52
|
true,
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps, ref, watch } from 'nativescript-vue'
|
|
2
|
+
import type { EventData, PanGestureEventData, View } from '@nativescript/core'
|
|
3
|
+
import { finiteRange, positiveSize } from '@getcortexlabs/mavis-core'
|
|
4
|
+
import { imageCompareProps, usePartition, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
5
|
+
import { useAnimatedNumber } from '../animated-number.js'
|
|
6
|
+
import { MColumn, MBox } from './layout.js'
|
|
7
|
+
import { MImage } from './MImage.js'
|
|
8
|
+
import { MText } from './MText.js'
|
|
9
|
+
import { MSlider } from './MSlider.js'
|
|
10
|
+
|
|
11
|
+
export const MImageCompare = defineComponent({
|
|
12
|
+
name: 'MImageCompare',
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: imageCompareProps,
|
|
15
|
+
emits: { 'update:modelValue': (_value: number) => true },
|
|
16
|
+
setup(props, { attrs, emit }) {
|
|
17
|
+
const { theme } = useMavisTheme()
|
|
18
|
+
const width = ref(300)
|
|
19
|
+
const state = usePartition(
|
|
20
|
+
() => finiteRange(props.modelValue, 0, 100),
|
|
21
|
+
() => ({ min: 0, max: 100, step: props.step, disabled: props.disabled }),
|
|
22
|
+
(value) => emit('update:modelValue', value),
|
|
23
|
+
)
|
|
24
|
+
const motion = useAnimatedNumber(
|
|
25
|
+
() => state.canonical.value,
|
|
26
|
+
() => state.dragging.value,
|
|
27
|
+
)
|
|
28
|
+
let origin = 50
|
|
29
|
+
watch(
|
|
30
|
+
() => props.orientation,
|
|
31
|
+
() => state.cancel(),
|
|
32
|
+
)
|
|
33
|
+
return () => {
|
|
34
|
+
const vertical = props.orientation === 'vertical',
|
|
35
|
+
height = width.value / positiveSize(props.aspectRatio, 'aspectRatio'),
|
|
36
|
+
ratio = finiteRange(motion.shown.value, 0, 100) / 100
|
|
37
|
+
return h(MColumn, mergeProps(attrs, { gap: 'sm' }), () => [
|
|
38
|
+
h(
|
|
39
|
+
'GridLayout',
|
|
40
|
+
{
|
|
41
|
+
onLoaded: motion.onLoaded,
|
|
42
|
+
onUnloaded: motion.onUnloaded,
|
|
43
|
+
height,
|
|
44
|
+
borderRadius: 16,
|
|
45
|
+
clipToBounds: true,
|
|
46
|
+
onLayoutChanged: (event: EventData) => {
|
|
47
|
+
const next = (event.object as View).getActualSize().width
|
|
48
|
+
if (next > 0 && next !== width.value) {
|
|
49
|
+
state.cancel()
|
|
50
|
+
width.value = next
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
[
|
|
55
|
+
h(MImage, {
|
|
56
|
+
src: props.after,
|
|
57
|
+
alt: props.afterLabel,
|
|
58
|
+
aspectRatio: props.aspectRatio,
|
|
59
|
+
width: width.value,
|
|
60
|
+
height,
|
|
61
|
+
radius: 'none',
|
|
62
|
+
}),
|
|
63
|
+
h(
|
|
64
|
+
'GridLayout',
|
|
65
|
+
{
|
|
66
|
+
width: vertical ? width.value : ratio * width.value,
|
|
67
|
+
height: vertical ? ratio * height : height,
|
|
68
|
+
horizontalAlignment: 'left',
|
|
69
|
+
verticalAlignment: 'top',
|
|
70
|
+
clipToBounds: true,
|
|
71
|
+
},
|
|
72
|
+
[
|
|
73
|
+
h(MImage, {
|
|
74
|
+
src: props.before,
|
|
75
|
+
alt: props.beforeLabel,
|
|
76
|
+
aspectRatio: props.aspectRatio,
|
|
77
|
+
width: width.value,
|
|
78
|
+
height,
|
|
79
|
+
radius: 'none',
|
|
80
|
+
horizontalAlignment: 'left',
|
|
81
|
+
verticalAlignment: 'top',
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
84
|
+
),
|
|
85
|
+
h('AbsoluteLayout', { accessibilityHidden: true }, [
|
|
86
|
+
h(MBox, {
|
|
87
|
+
left: vertical ? 0 : width.value * ratio - 1,
|
|
88
|
+
top: vertical ? height * ratio - 1 : 0,
|
|
89
|
+
width: vertical ? width.value : 2,
|
|
90
|
+
height: vertical ? 2 : height,
|
|
91
|
+
backgroundColor: '#ffffff',
|
|
92
|
+
}),
|
|
93
|
+
h(
|
|
94
|
+
MBox,
|
|
95
|
+
{
|
|
96
|
+
left: (vertical ? width.value / 2 : width.value * ratio) - 22,
|
|
97
|
+
top: (vertical ? height * ratio : height / 2) - 22,
|
|
98
|
+
width: 44,
|
|
99
|
+
height: 44,
|
|
100
|
+
radius: 'full',
|
|
101
|
+
backgroundColor: theme.value.colors.surface,
|
|
102
|
+
},
|
|
103
|
+
() =>
|
|
104
|
+
h(MText, {
|
|
105
|
+
text: vertical ? '↕' : '↔',
|
|
106
|
+
align: 'center',
|
|
107
|
+
variant: 'heading',
|
|
108
|
+
verticalAlignment: 'middle',
|
|
109
|
+
}),
|
|
110
|
+
),
|
|
111
|
+
]),
|
|
112
|
+
h(MBox, {
|
|
113
|
+
accessibilityHidden: true,
|
|
114
|
+
backgroundColor: '#00000000',
|
|
115
|
+
onPan: (event: PanGestureEventData) => {
|
|
116
|
+
if (props.disabled) return
|
|
117
|
+
if (event.state === 1) {
|
|
118
|
+
if (state.begin()) origin = state.canonical.value
|
|
119
|
+
}
|
|
120
|
+
if (event.state === 2 && state.dragging.value)
|
|
121
|
+
state.update(
|
|
122
|
+
origin + (vertical ? event.deltaY / height : event.deltaX / width.value) * 100,
|
|
123
|
+
)
|
|
124
|
+
if (event.state === 3) state.end()
|
|
125
|
+
if (event.state === 4) state.cancel()
|
|
126
|
+
},
|
|
127
|
+
}),
|
|
128
|
+
h(MText, {
|
|
129
|
+
text: props.beforeLabel,
|
|
130
|
+
variant: 'caption',
|
|
131
|
+
padding: theme.value.space.sm,
|
|
132
|
+
backgroundColor: theme.value.colors.surface,
|
|
133
|
+
horizontalAlignment: 'left',
|
|
134
|
+
verticalAlignment: 'top',
|
|
135
|
+
margin: 12,
|
|
136
|
+
isUserInteractionEnabled: false,
|
|
137
|
+
}),
|
|
138
|
+
h(MText, {
|
|
139
|
+
text: props.afterLabel,
|
|
140
|
+
variant: 'caption',
|
|
141
|
+
padding: theme.value.space.sm,
|
|
142
|
+
backgroundColor: theme.value.colors.surface,
|
|
143
|
+
horizontalAlignment: 'right',
|
|
144
|
+
verticalAlignment: vertical ? 'bottom' : 'top',
|
|
145
|
+
margin: 12,
|
|
146
|
+
isUserInteractionEnabled: false,
|
|
147
|
+
}),
|
|
148
|
+
],
|
|
149
|
+
),
|
|
150
|
+
h(MSlider, {
|
|
151
|
+
label: props.label,
|
|
152
|
+
modelValue: state.canonical.value,
|
|
153
|
+
min: 0,
|
|
154
|
+
max: 100,
|
|
155
|
+
step: props.step,
|
|
156
|
+
disabled: props.disabled,
|
|
157
|
+
'onUpdate:modelValue': state.update,
|
|
158
|
+
}),
|
|
159
|
+
])
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
})
|