@getcortexlabs/mavis 0.1.0-alpha.4 → 0.1.0-alpha.5
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/files.d.ts +4 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +3 -0
- package/dist/files.js.map +1 -0
- package/dist/native/combobox-editor.android.d.ts +3 -0
- package/dist/native/combobox-editor.android.d.ts.map +1 -0
- package/dist/native/combobox-editor.android.js +5 -0
- package/dist/native/combobox-editor.android.js.map +1 -0
- package/dist/native/combobox-editor.d.ts +4 -0
- package/dist/native/combobox-editor.d.ts.map +1 -0
- package/dist/native/combobox-editor.js +5 -0
- package/dist/native/combobox-editor.js.map +1 -0
- package/dist/native/file-access.d.ts +23 -0
- package/dist/native/file-access.d.ts.map +1 -0
- package/dist/native/file-access.js +55 -0
- package/dist/native/file-access.js.map +1 -0
- package/dist/native/file-picker.android.d.ts +3 -0
- package/dist/native/file-picker.android.d.ts.map +1 -0
- package/dist/native/file-picker.android.js +147 -0
- package/dist/native/file-picker.android.js.map +1 -0
- package/dist/native/file-picker.d.ts +4 -0
- package/dist/native/file-picker.d.ts.map +1 -0
- package/dist/native/file-picker.ios.d.ts +3 -0
- package/dist/native/file-picker.ios.d.ts.map +1 -0
- package/dist/native/file-picker.ios.js +152 -0
- package/dist/native/file-picker.ios.js.map +1 -0
- package/dist/native/file-picker.js +7 -0
- package/dist/native/file-picker.js.map +1 -0
- package/dist/native/motion-owner.d.ts +5 -0
- package/dist/native/motion-owner.d.ts.map +1 -0
- package/dist/native/motion-owner.js +53 -0
- package/dist/native/motion-owner.js.map +1 -0
- package/dist/native/motion-region.d.ts +6 -0
- package/dist/native/motion-region.d.ts.map +1 -0
- package/dist/native/motion-region.js +199 -0
- package/dist/native/motion-region.js.map +1 -0
- 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 +18 -0
- package/dist/native/motion-surface.js.map +1 -1
- package/dist/native/scroll-motion.d.ts +1 -0
- package/dist/native/scroll-motion.d.ts.map +1 -1
- package/dist/native/scroll-motion.js +6 -0
- package/dist/native/scroll-motion.js.map +1 -1
- package/dist/vue/components/ChoiceControl.d.ts +21 -11
- package/dist/vue/components/ChoiceControl.d.ts.map +1 -1
- package/dist/vue/components/DateCalendar.d.ts +94 -0
- package/dist/vue/components/DateCalendar.d.ts.map +1 -0
- package/dist/vue/components/DateCalendar.js +96 -0
- package/dist/vue/components/DateCalendar.js.map +1 -0
- package/dist/vue/components/MAccordion.d.ts +19 -9
- package/dist/vue/components/MAccordion.d.ts.map +1 -1
- package/dist/vue/components/MAlert.d.ts +21 -11
- package/dist/vue/components/MAlert.d.ts.map +1 -1
- package/dist/vue/components/MAvatar.d.ts +12 -6
- package/dist/vue/components/MAvatar.d.ts.map +1 -1
- package/dist/vue/components/MBadge.d.ts +13 -7
- package/dist/vue/components/MBadge.d.ts.map +1 -1
- package/dist/vue/components/MButton.d.ts +81 -39
- package/dist/vue/components/MButton.d.ts.map +1 -1
- package/dist/vue/components/MCard.d.ts +46 -18
- package/dist/vue/components/MCard.d.ts.map +1 -1
- package/dist/vue/components/MCheckbox.d.ts +20 -10
- package/dist/vue/components/MCheckbox.d.ts.map +1 -1
- package/dist/vue/components/MChip.d.ts +23 -13
- package/dist/vue/components/MChip.d.ts.map +1 -1
- package/dist/vue/components/MCombobox.d.ts +279 -0
- package/dist/vue/components/MCombobox.d.ts.map +1 -0
- package/dist/vue/components/MCombobox.js +234 -0
- package/dist/vue/components/MCombobox.js.map +1 -0
- package/dist/vue/components/MDatePicker.d.ts +1254 -0
- package/dist/vue/components/MDatePicker.d.ts.map +1 -0
- package/dist/vue/components/MDatePicker.js +35 -0
- package/dist/vue/components/MDatePicker.js.map +1 -0
- package/dist/vue/components/MDialog.d.ts +7 -5
- package/dist/vue/components/MDialog.d.ts.map +1 -1
- package/dist/vue/components/MEmptyState.d.ts +20 -10
- package/dist/vue/components/MEmptyState.d.ts.map +1 -1
- package/dist/vue/components/MFilePicker.d.ts +112 -0
- package/dist/vue/components/MFilePicker.d.ts.map +1 -0
- package/dist/vue/components/MFilePicker.js +196 -0
- package/dist/vue/components/MFilePicker.js.map +1 -0
- package/dist/vue/components/MIcon.d.ts +5 -3
- package/dist/vue/components/MIcon.d.ts.map +1 -1
- package/dist/vue/components/MInput.d.ts +131 -59
- package/dist/vue/components/MInput.d.ts.map +1 -1
- package/dist/vue/components/MListItem.d.ts +24 -12
- package/dist/vue/components/MListItem.d.ts.map +1 -1
- package/dist/vue/components/MProgress.d.ts +19 -9
- package/dist/vue/components/MProgress.d.ts.map +1 -1
- package/dist/vue/components/MRadioGroup.d.ts +19 -9
- package/dist/vue/components/MRadioGroup.d.ts.map +1 -1
- package/dist/vue/components/MReveal.d.ts +73 -37
- package/dist/vue/components/MReveal.d.ts.map +1 -1
- package/dist/vue/components/MScreen.d.ts +12 -6
- package/dist/vue/components/MScreen.d.ts.map +1 -1
- package/dist/vue/components/MSegmentedControl.d.ts +19 -9
- package/dist/vue/components/MSegmentedControl.d.ts.map +1 -1
- package/dist/vue/components/MSelect.d.ts +21 -11
- package/dist/vue/components/MSelect.d.ts.map +1 -1
- package/dist/vue/components/MSeparator.d.ts +4 -2
- package/dist/vue/components/MSeparator.d.ts.map +1 -1
- package/dist/vue/components/MSheet.d.ts +19 -13
- package/dist/vue/components/MSheet.d.ts.map +1 -1
- package/dist/vue/components/MSkeleton.d.ts +17 -9
- package/dist/vue/components/MSkeleton.d.ts.map +1 -1
- package/dist/vue/components/MSlider.d.ts +9 -5
- package/dist/vue/components/MSlider.d.ts.map +1 -1
- package/dist/vue/components/MSwitch.d.ts +19 -9
- package/dist/vue/components/MSwitch.d.ts.map +1 -1
- package/dist/vue/components/MTabs.d.ts +19 -9
- package/dist/vue/components/MTabs.d.ts.map +1 -1
- package/dist/vue/components/MText.d.ts +46 -30
- package/dist/vue/components/MText.d.ts.map +1 -1
- package/dist/vue/components/layout.d.ts +200 -91
- package/dist/vue/components/layout.d.ts.map +1 -1
- package/dist/vue/components/layout.js +6 -4
- package/dist/vue/components/layout.js.map +1 -1
- package/dist/vue/components/workflows.d.ts +251 -0
- package/dist/vue/components/workflows.d.ts.map +1 -0
- package/dist/vue/components/workflows.js +35 -0
- package/dist/vue/components/workflows.js.map +1 -0
- package/dist/vue/index.d.ts +7 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +15 -2
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/use-motion-region.d.ts +7 -0
- package/dist/vue/use-motion-region.d.ts.map +1 -0
- package/dist/vue/use-motion-region.js +28 -0
- package/dist/vue/use-motion-region.js.map +1 -0
- package/dist/vue/use-motion-surface.d.ts.map +1 -1
- package/dist/vue/use-motion-surface.js +3 -2
- package/dist/vue/use-motion-surface.js.map +1 -1
- package/package.json +3 -3
- package/src/files.ts +3 -0
- package/src/native/combobox-editor.android.ts +11 -0
- package/src/native/combobox-editor.ts +6 -0
- package/src/native/file-access.ts +71 -0
- package/src/native/file-picker.android.ts +191 -0
- package/src/native/file-picker.ios.ts +230 -0
- package/src/native/file-picker.ts +8 -0
- package/src/native/motion-owner.ts +59 -0
- package/src/native/motion-region.ts +213 -0
- package/src/native/motion-surface.ts +26 -1
- package/src/native/scroll-motion.ts +5 -0
- package/src/vue/components/DateCalendar.ts +117 -0
- package/src/vue/components/MCombobox.ts +257 -0
- package/src/vue/components/MDatePicker.ts +33 -0
- package/src/vue/components/MFilePicker.ts +226 -0
- package/src/vue/components/layout.ts +6 -3
- package/src/vue/components/workflows.ts +38 -0
- package/src/vue/index.ts +29 -1
- package/src/vue/use-motion-region.ts +29 -0
- package/src/vue/use-motion-surface.ts +21 -14
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
4
|
useMavisTheme,
|
|
5
5
|
layoutDirection,
|
|
6
6
|
useDefaultShrink,
|
|
7
|
+
motionBoxProps,
|
|
7
8
|
} from '@getcortexlabs/mavis-core/vue'
|
|
8
9
|
import { defineComponent, h, mergeProps, provide, registerElement } from 'nativescript-vue'
|
|
9
10
|
import { resolveSpace } from '@getcortexlabs/mavis-core'
|
|
10
|
-
import {
|
|
11
|
+
import { boxStyle } from '../props.js'
|
|
11
12
|
import { MavisFlexLayout } from '../../native/flex-layout'
|
|
12
13
|
import { MavisBox } from '../../native/box'
|
|
13
14
|
import { useNativeViewAttrs } from '../accessibility.js'
|
|
15
|
+
import { useMotionRegion } from '../use-motion-region.js'
|
|
14
16
|
|
|
15
17
|
export type { Align, Justify } from '@getcortexlabs/mavis-core/vue'
|
|
16
18
|
|
|
@@ -74,15 +76,16 @@ export const MColumn = createLayout('MColumn', 'column')
|
|
|
74
76
|
export const MBox = defineComponent({
|
|
75
77
|
name: 'MBox',
|
|
76
78
|
inheritAttrs: false,
|
|
77
|
-
props:
|
|
79
|
+
props: motionBoxProps,
|
|
78
80
|
setup(props, { attrs, slots }) {
|
|
81
|
+
const region = useMotionRegion(() => props.motionRegion)
|
|
79
82
|
const { theme } = useMavisTheme()
|
|
80
83
|
const nativeAttrs = useNativeViewAttrs(props)
|
|
81
84
|
const shrink = useDefaultShrink()
|
|
82
85
|
return () =>
|
|
83
86
|
h(
|
|
84
87
|
'MavisBox',
|
|
85
|
-
mergeProps({ style: boxStyle(theme.value, props, shrink) }, nativeAttrs(), attrs),
|
|
88
|
+
mergeProps({ style: boxStyle(theme.value, props, shrink) }, nativeAttrs(), attrs, region),
|
|
86
89
|
slots.default?.(),
|
|
87
90
|
)
|
|
88
91
|
},
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createWorkflows } from '@getcortexlabs/mavis-core/vue'
|
|
2
|
+
import { MColumn, MRow } from './layout.js'
|
|
3
|
+
import { MText } from './MText.js'
|
|
4
|
+
import { MButton } from './MButton.js'
|
|
5
|
+
|
|
6
|
+
import { isAndroid, type View } from '@nativescript/core'
|
|
7
|
+
|
|
8
|
+
function focused(root: View): View | undefined {
|
|
9
|
+
if (isAndroid ? root.android?.isFocused() : root.ios?.isFirstResponder) return root
|
|
10
|
+
let match: View | undefined
|
|
11
|
+
root.eachChildView((child) => {
|
|
12
|
+
match = focused(child)
|
|
13
|
+
return !match
|
|
14
|
+
})
|
|
15
|
+
return match
|
|
16
|
+
}
|
|
17
|
+
function preserveFocus(instance: unknown, currentId: string) {
|
|
18
|
+
const root = (instance as { $el?: { nativeView?: View } } | undefined)?.$el?.nativeView
|
|
19
|
+
const previous = root && focused(root)
|
|
20
|
+
if (!root || !previous) return () => {}
|
|
21
|
+
return () => {
|
|
22
|
+
if (!root.isLoaded || (previous.isLoaded && previous.isEnabled)) return
|
|
23
|
+
const page = root.page
|
|
24
|
+
if (
|
|
25
|
+
!page ||
|
|
26
|
+
page.frame?.currentPage !== page ||
|
|
27
|
+
(!isAndroid && page.ios?.presentedViewController)
|
|
28
|
+
)
|
|
29
|
+
return
|
|
30
|
+
const active = focused(page)
|
|
31
|
+
if (!active || active === previous) root.getViewById<View>(currentId)?.focus()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const { MFormGroup, MFormErrors, MSteps, MPagination } = createWorkflows(
|
|
36
|
+
{ Column: MColumn, Row: MRow, Text: MText, Button: MButton, preserveFocus },
|
|
37
|
+
'native',
|
|
38
|
+
)
|
package/src/vue/index.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { MDatePicker, MDateRangePicker } from './components/MDatePicker.js'
|
|
2
|
+
import { MCombobox } from './components/MCombobox.js'
|
|
3
|
+
import { MFilePicker } from './components/MFilePicker.js'
|
|
4
|
+
import { MFormGroup, MFormErrors, MSteps, MPagination } from './components/workflows.js'
|
|
1
5
|
import { MChip } from './components/MChip.js'
|
|
2
6
|
import { MEmptyState } from './components/MEmptyState.js'
|
|
3
7
|
import type { App } from 'nativescript-vue'
|
|
@@ -71,8 +75,22 @@ export {
|
|
|
71
75
|
MIcon,
|
|
72
76
|
MReveal,
|
|
73
77
|
MSheet,
|
|
78
|
+
MDatePicker,
|
|
79
|
+
MDateRangePicker,
|
|
80
|
+
MCombobox,
|
|
81
|
+
MFilePicker,
|
|
82
|
+
MFormGroup,
|
|
83
|
+
MFormErrors,
|
|
84
|
+
MSteps,
|
|
85
|
+
MPagination,
|
|
74
86
|
}
|
|
75
|
-
export {
|
|
87
|
+
export {
|
|
88
|
+
useMavisTheme,
|
|
89
|
+
useToast,
|
|
90
|
+
useFormController,
|
|
91
|
+
useFormField,
|
|
92
|
+
useFileSelection,
|
|
93
|
+
} from '@getcortexlabs/mavis-core/vue'
|
|
76
94
|
export type {
|
|
77
95
|
MavisThemeContext,
|
|
78
96
|
Appearance,
|
|
@@ -133,9 +151,19 @@ export function createMavis(options: MavisOptions = {}) {
|
|
|
133
151
|
MIcon,
|
|
134
152
|
MReveal,
|
|
135
153
|
MSheet,
|
|
154
|
+
MDatePicker,
|
|
155
|
+
MDateRangePicker,
|
|
156
|
+
MCombobox,
|
|
157
|
+
MFilePicker,
|
|
158
|
+
MFormGroup,
|
|
159
|
+
MFormErrors,
|
|
160
|
+
MSteps,
|
|
161
|
+
MPagination,
|
|
136
162
|
})) {
|
|
137
163
|
app.component(name, component)
|
|
138
164
|
}
|
|
139
165
|
},
|
|
140
166
|
}
|
|
141
167
|
}
|
|
168
|
+
|
|
169
|
+
export * from '../files.js'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { onBeforeUnmount, watch } from 'nativescript-vue'
|
|
2
|
+
import type { EventData, View } from '@nativescript/core'
|
|
3
|
+
import type { MotionRegion } from '@getcortexlabs/mavis-core/experimental'
|
|
4
|
+
import { attachNativeMotionRegion } from '../native/motion-region.js'
|
|
5
|
+
|
|
6
|
+
export function useMotionRegion(reference: () => MotionRegion | undefined) {
|
|
7
|
+
let target: View | undefined, release: (() => void) | undefined
|
|
8
|
+
const clear = () => {
|
|
9
|
+
release?.()
|
|
10
|
+
release = undefined
|
|
11
|
+
}
|
|
12
|
+
const attach = () => {
|
|
13
|
+
clear()
|
|
14
|
+
const region = reference()
|
|
15
|
+
if (region && target?.isLoaded) release = attachNativeMotionRegion(region, target)
|
|
16
|
+
}
|
|
17
|
+
watch(reference, attach, { flush: 'post' })
|
|
18
|
+
onBeforeUnmount(clear)
|
|
19
|
+
return {
|
|
20
|
+
onLoaded(event: EventData) {
|
|
21
|
+
target = event.object as View
|
|
22
|
+
attach()
|
|
23
|
+
},
|
|
24
|
+
onUnloaded() {
|
|
25
|
+
clear()
|
|
26
|
+
target = undefined
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type MotionSurface,
|
|
8
8
|
} from '@getcortexlabs/mavis-core/experimental'
|
|
9
9
|
import { nativeContinuousSurface } from '../native/motion-surface.js'
|
|
10
|
+
import { nativeMotionOwner } from '../native/motion-owner.js'
|
|
10
11
|
|
|
11
12
|
export function useMotionSurface(
|
|
12
13
|
surface: () => MotionSurface | undefined,
|
|
@@ -32,20 +33,26 @@ export function useMotionSurface(
|
|
|
32
33
|
const reference = surface()
|
|
33
34
|
if (!target || !reference) return
|
|
34
35
|
continuous = nativeContinuousSurface(target, enabled)
|
|
35
|
-
unbind = bindMotionSurface(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
unbind = bindMotionSurface(
|
|
37
|
+
reference,
|
|
38
|
+
nativeMotionOwner(
|
|
39
|
+
{
|
|
40
|
+
...continuous.adapter,
|
|
41
|
+
animate(values, options) {
|
|
42
|
+
continuous?.interrupt(Object.keys(values))
|
|
43
|
+
const handle = animate(target, values, options)
|
|
44
|
+
active.set(handle, values)
|
|
45
|
+
void handle.finished.then(() => active.delete(handle))
|
|
46
|
+
return handle
|
|
47
|
+
},
|
|
48
|
+
set: (values) => {
|
|
49
|
+
continuous?.interrupt(Object.keys(values))
|
|
50
|
+
return animate(target, values, { duration: 0 })
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
target,
|
|
54
|
+
),
|
|
55
|
+
)
|
|
49
56
|
offPreference = onReducedMotion((reduced) => {
|
|
50
57
|
if (!reduced) return
|
|
51
58
|
// Set only spatial channels: opacity can keep its existing timeline.
|