@getcortexlabs/mavis 0.1.0-rc.11.1 → 0.1.0-rc.12.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.
Files changed (98) hide show
  1. package/README.md +5 -5
  2. package/dist/native/date-format.android.d.ts +4 -0
  3. package/dist/native/date-format.android.d.ts.map +1 -1
  4. package/dist/native/date-format.android.js +20 -0
  5. package/dist/native/date-format.android.js.map +1 -1
  6. package/dist/native/date-format.d.ts +3 -0
  7. package/dist/native/date-format.d.ts.map +1 -1
  8. package/dist/native/date-format.ios.d.ts +4 -0
  9. package/dist/native/date-format.ios.d.ts.map +1 -1
  10. package/dist/native/date-format.ios.js +18 -0
  11. package/dist/native/date-format.ios.js.map +1 -1
  12. package/dist/native/date-format.js +3 -0
  13. package/dist/native/date-format.js.map +1 -1
  14. package/dist/native/image-crop-common.d.ts +5 -0
  15. package/dist/native/image-crop-common.d.ts.map +1 -0
  16. package/dist/native/image-crop-common.js +36 -0
  17. package/dist/native/image-crop-common.js.map +1 -0
  18. package/dist/native/image-crop.android.d.ts +3 -0
  19. package/dist/native/image-crop.android.d.ts.map +1 -0
  20. package/dist/native/image-crop.android.js +92 -0
  21. package/dist/native/image-crop.android.js.map +1 -0
  22. package/dist/native/image-crop.d.ts +3 -0
  23. package/dist/native/image-crop.d.ts.map +1 -0
  24. package/dist/native/image-crop.ios.d.ts +3 -0
  25. package/dist/native/image-crop.ios.d.ts.map +1 -0
  26. package/dist/native/image-crop.ios.js +68 -0
  27. package/dist/native/image-crop.ios.js.map +1 -0
  28. package/dist/native/image-crop.js +4 -0
  29. package/dist/native/image-crop.js.map +1 -0
  30. package/dist/vue/components/DateCalendar.d.ts +1 -1
  31. package/dist/vue/components/MAccordion.d.ts +1 -1
  32. package/dist/vue/components/MButton.d.ts +5 -5
  33. package/dist/vue/components/MCard.d.ts +1 -1
  34. package/dist/vue/components/MChip.d.ts +2 -2
  35. package/dist/vue/components/MCombobox.d.ts +3 -3
  36. package/dist/vue/components/MDatePicker.d.ts +16 -16
  37. package/dist/vue/components/MDialog.d.ts +3 -3
  38. package/dist/vue/components/MEmptyState.d.ts +1 -1
  39. package/dist/vue/components/MFilePicker.d.ts +3 -3
  40. package/dist/vue/components/MImageCompare.d.ts +1 -1
  41. package/dist/vue/components/MImageViewer.d.ts +5 -5
  42. package/dist/vue/components/MInput.d.ts +3 -3
  43. package/dist/vue/components/MListItem.d.ts +1 -1
  44. package/dist/vue/components/MPinInput.d.ts +57 -0
  45. package/dist/vue/components/MPinInput.d.ts.map +1 -0
  46. package/dist/vue/components/MPinInput.js +128 -0
  47. package/dist/vue/components/MPinInput.js.map +1 -0
  48. package/dist/vue/components/MPopover.d.ts +1 -1
  49. package/dist/vue/components/MPopover.d.ts.map +1 -1
  50. package/dist/vue/components/MPopover.js +23 -11
  51. package/dist/vue/components/MPopover.js.map +1 -1
  52. package/dist/vue/components/MProgress.d.ts +1 -1
  53. package/dist/vue/components/MRangeSlider.d.ts +1 -1
  54. package/dist/vue/components/MResizablePanels.d.ts +3 -3
  55. package/dist/vue/components/MSelect.d.ts +1 -1
  56. package/dist/vue/components/MTimePicker.d.ts +12 -12
  57. package/dist/vue/components/MTooltip.d.ts +1 -1
  58. package/dist/vue/components/advanced.d.ts +850 -0
  59. package/dist/vue/components/advanced.d.ts.map +1 -0
  60. package/dist/vue/components/advanced.js +214 -0
  61. package/dist/vue/components/advanced.js.map +1 -0
  62. package/dist/vue/components/configurator.d.ts +7 -7
  63. package/dist/vue/components/creative.d.ts +614 -0
  64. package/dist/vue/components/creative.d.ts.map +1 -0
  65. package/dist/vue/components/creative.js +185 -0
  66. package/dist/vue/components/creative.js.map +1 -0
  67. package/dist/vue/components/dashboard.d.ts +474 -0
  68. package/dist/vue/components/dashboard.d.ts.map +1 -0
  69. package/dist/vue/components/dashboard.js +193 -0
  70. package/dist/vue/components/dashboard.js.map +1 -0
  71. package/dist/vue/components/discovery.d.ts +3 -3
  72. package/dist/vue/components/interactive.d.ts +1 -1
  73. package/dist/vue/components/navigation.d.ts +3 -3
  74. package/dist/vue/components/screen-components.d.ts +502 -0
  75. package/dist/vue/components/screen-components.d.ts.map +1 -0
  76. package/dist/vue/components/screen-components.js +46 -0
  77. package/dist/vue/components/screen-components.js.map +1 -0
  78. package/dist/vue/components/wayfinding.d.ts +6 -6
  79. package/dist/vue/components/workflows.d.ts +3 -3
  80. package/dist/vue/index.d.ts +5 -1
  81. package/dist/vue/index.d.ts.map +1 -1
  82. package/dist/vue/index.js +30 -1
  83. package/dist/vue/index.js.map +1 -1
  84. package/package.json +3 -3
  85. package/src/native/date-format.android.ts +22 -0
  86. package/src/native/date-format.ios.ts +22 -0
  87. package/src/native/date-format.ts +7 -0
  88. package/src/native/image-crop-common.ts +46 -0
  89. package/src/native/image-crop.android.ts +140 -0
  90. package/src/native/image-crop.ios.ts +94 -0
  91. package/src/native/image-crop.ts +4 -0
  92. package/src/vue/components/MPinInput.ts +145 -0
  93. package/src/vue/components/MPopover.ts +20 -11
  94. package/src/vue/components/advanced.ts +263 -0
  95. package/src/vue/components/creative.ts +246 -0
  96. package/src/vue/components/dashboard.ts +249 -0
  97. package/src/vue/components/screen-components.ts +61 -0
  98. package/src/vue/index.ts +84 -0
@@ -0,0 +1,249 @@
1
+ import {
2
+ defineComponent,
3
+ h,
4
+ inject,
5
+ markRaw,
6
+ mergeProps,
7
+ onBeforeUnmount,
8
+ onDeactivated,
9
+ onScopeDispose,
10
+ watch,
11
+ } from 'nativescript-vue'
12
+ import {
13
+ Application,
14
+ type View,
15
+ type EventData,
16
+ type PanGestureEventData,
17
+ } from '@nativescript/core'
18
+ import { notifyAccessibilityLayout } from '../../native/accessibility-layout'
19
+ import { reducedMotion, onReducedMotion } from '@rafaelaugusto/jolt'
20
+ import {
21
+ createDashboardShape,
22
+ createDonutChart,
23
+ createSparkline,
24
+ createDashboardEffects,
25
+ createKanban,
26
+ dashboardEnvironmentProps,
27
+ dashboardPlotProps,
28
+ kanbanRegistryKey,
29
+ kanbanZoneProps,
30
+ kanbanDragProps,
31
+ } from '@getcortexlabs/mavis-core/vue'
32
+ import { createMotionSurface } from '@getcortexlabs/mavis-core/experimental'
33
+ import { MBox, MColumn, MRow } from './layout.js'
34
+ import { MStack } from './MStack.js'
35
+ import { MText } from './MText.js'
36
+ import { MButton } from './MButton.js'
37
+ import { MNumberFlow } from './interactive.js'
38
+ import { MMenu } from './navigation.js'
39
+
40
+ const Fallback = defineComponent({
41
+ setup: () => () => h('GridLayout', { accessible: false, isUserInteractionEnabled: false }),
42
+ })
43
+ const Environment = defineComponent({
44
+ inheritAttrs: false,
45
+ props: dashboardEnvironmentProps,
46
+ emits: ['environment'],
47
+ setup(_props, { attrs, slots, emit }) {
48
+ let attached = false,
49
+ suspended = false,
50
+ release = () => {}
51
+ const update = () =>
52
+ emit('environment', { reduced: reducedMotion(), paused: !attached || suspended })
53
+ const suspend = () => {
54
+ suspended = true
55
+ update()
56
+ },
57
+ resume = () => {
58
+ suspended = false
59
+ update()
60
+ }
61
+ function detach() {
62
+ attached = false
63
+ release()
64
+ release = () => {}
65
+ Application.off(Application.suspendEvent, suspend)
66
+ Application.off(Application.resumeEvent, resume)
67
+ update()
68
+ }
69
+ function attach() {
70
+ if (attached) return
71
+ attached = true
72
+ release = onReducedMotion(update)
73
+ Application.on(Application.suspendEvent, suspend)
74
+ Application.on(Application.resumeEvent, resume)
75
+ update()
76
+ }
77
+ onBeforeUnmount(detach)
78
+ onDeactivated(detach)
79
+ return () =>
80
+ h(
81
+ 'GridLayout',
82
+ mergeProps(attrs, { width: '100%', onLoaded: attach, onUnloaded: detach }),
83
+ slots.default?.(),
84
+ )
85
+ },
86
+ })
87
+ function rect(view?: View) {
88
+ if (!view?.isLoaded) return
89
+ const p = view.getLocationOnScreen(),
90
+ size = view.getActualSize()
91
+ return p ? { ...p, ...size } : undefined
92
+ }
93
+ const Zone = defineComponent({
94
+ inheritAttrs: false,
95
+ props: kanbanZoneProps,
96
+ setup(props, { attrs, slots }) {
97
+ const registry = inject(kanbanRegistryKey)!
98
+ let view: View | undefined
99
+ onBeforeUnmount(() => registry.zones.delete(props.column))
100
+ return () =>
101
+ h(
102
+ 'GridLayout',
103
+ mergeProps(attrs, {
104
+ onLoaded: (e: EventData) => {
105
+ view = e.object as View
106
+ registry.zones.set(props.column, () => rect(view))
107
+ },
108
+ onUnloaded: () => {
109
+ view = undefined
110
+ registry.zones.delete(props.column)
111
+ },
112
+ }),
113
+ slots.default?.(),
114
+ )
115
+ },
116
+ })
117
+ const Drag = defineComponent({
118
+ inheritAttrs: false,
119
+ props: kanbanDragProps,
120
+ setup(props, { attrs, slots }) {
121
+ const registry = inject(kanbanRegistryKey)!,
122
+ surface = markRaw(createMotionSurface())
123
+ let view: View | undefined,
124
+ anchor: ReturnType<typeof rect>,
125
+ dragging = false
126
+ function end(commit = false) {
127
+ const was = dragging
128
+ dragging = false
129
+ if (surface.available) {
130
+ if (props.animated && !commit)
131
+ surface.animate({ x: 0, y: 0, scale: 1 }, { type: 'spring', duration: 280, bounce: 0.12 })
132
+ else surface.set({ x: 0, y: 0, scale: 1 })
133
+ }
134
+ if (view) view.style.zIndex = 0
135
+ if (was) registry.finish(commit)
136
+ }
137
+ const cancel = () => end(false)
138
+ onBeforeUnmount(() => {
139
+ cancel()
140
+ registry.cards.delete(props.cardId)
141
+ registry.focus.delete(props.cardId)
142
+ })
143
+ onDeactivated(cancel)
144
+ onScopeDispose(surface.use(() => cancel))
145
+ watch(
146
+ () => props.disabled,
147
+ (value) => {
148
+ if (value) cancel()
149
+ },
150
+ )
151
+ return () =>
152
+ h(
153
+ 'GridLayout',
154
+ mergeProps(attrs, {
155
+ onLoaded: (e: EventData) => {
156
+ view = e.object as View
157
+ registry.cards.set(props.cardId, () => rect(view))
158
+ registry.focus.set(props.cardId, () => {
159
+ if (view) notifyAccessibilityLayout(view)
160
+ })
161
+ },
162
+ onUnloaded: () => {
163
+ cancel()
164
+ view = undefined
165
+ registry.cards.delete(props.cardId)
166
+ registry.focus.delete(props.cardId)
167
+ },
168
+ }),
169
+ [
170
+ h(MBox, { motionSurface: surface }, () =>
171
+ h(MColumn, { gap: 'xs' }, () => [
172
+ h(
173
+ MBox,
174
+ {
175
+ height: 36,
176
+ accessibilityHidden: true,
177
+ accessibilityLabel: props.label,
178
+ opacity: props.disabled ? 0.4 : 0.65,
179
+ onPan: (e: PanGestureEventData) => {
180
+ if (props.disabled) return
181
+ if (e.state === 1) {
182
+ anchor = rect(view)
183
+ dragging = registry.begin(props.cardId, cancel)
184
+ if (dragging && view) view.style.zIndex = 20
185
+ }
186
+ if (e.state === 2 && dragging && surface.available) {
187
+ const current = rect(view)
188
+ surface.set({
189
+ x: e.deltaX + (anchor && current ? anchor.x - current.x : 0),
190
+ y: e.deltaY + (anchor && current ? anchor.y - current.y : 0),
191
+ scale: 1.02,
192
+ })
193
+ registry.move(e.deltaX, e.deltaY)
194
+ }
195
+ if (e.state === 3) end(true)
196
+ if (e.state === 4) cancel()
197
+ },
198
+ },
199
+ () => h(MText, { text: '⠿', textAlignment: 'center' }),
200
+ ),
201
+ ...(slots.default?.() ?? []),
202
+ ]),
203
+ ),
204
+ ],
205
+ )
206
+ },
207
+ })
208
+ const Plot = defineComponent({
209
+ inheritAttrs: false,
210
+ props: dashboardPlotProps,
211
+ emits: ['width'],
212
+ setup(props, { attrs, slots, emit }) {
213
+ const measure = (event: EventData) =>
214
+ emit('width', (event.object as View).getActualSize().width)
215
+ return () =>
216
+ h(
217
+ 'GridLayout',
218
+ mergeProps(attrs, {
219
+ height: props.height,
220
+ width: '100%',
221
+ clipToBounds: true,
222
+ accessible: false,
223
+ isUserInteractionEnabled: false,
224
+ onLoaded: measure,
225
+ onLayoutChanged: measure,
226
+ }),
227
+ slots.default?.(),
228
+ )
229
+ },
230
+ })
231
+ const ui = {
232
+ Box: MBox,
233
+ Column: MColumn,
234
+ Row: MRow,
235
+ Stack: MStack,
236
+ Text: MText,
237
+ Button: MButton,
238
+ NumberFlow: MNumberFlow,
239
+ Shape: createDashboardShape(MBox, Fallback, 'native'),
240
+ Environment,
241
+ Plot,
242
+ }
243
+ export const MDonutChart = createDonutChart(ui, 'native')
244
+ export const MSparkline = createSparkline(ui, 'native')
245
+ export const { MGradientBackground, MParticleField, MConfetti } = createDashboardEffects(
246
+ ui,
247
+ 'native',
248
+ )
249
+ export const MKanban = createKanban({ ...ui, Zone, Drag, Menu: MMenu }, 'native')
@@ -0,0 +1,61 @@
1
+ import { defineComponent, h, mergeProps, registerElement } from 'nativescript-vue'
2
+ import { ScrollHeaderSurface } from '@rafaelaugusto/jolt'
3
+ import {
4
+ createAnimatedText,
5
+ createComposer,
6
+ createSpeedDial,
7
+ createScrollComponents,
8
+ scrollFrameHostProps,
9
+ } from '@getcortexlabs/mavis-core/vue'
10
+ import { useMotionRegion } from '../use-motion-region.js'
11
+ import { useScrollMotion } from '../use-scroll-motion.js'
12
+ import { MBox, MColumn, MRow } from './layout.js'
13
+ import { MCard } from './MCard.js'
14
+ import { MText } from './MText.js'
15
+ import { MInput } from './MInput.js'
16
+ import { MImage } from './MImage.js'
17
+ import { MButton } from './MButton.js'
18
+ import { MChip } from './MChip.js'
19
+ import { MPopover } from './MPopover.js'
20
+
21
+ registerElement('MavisRefreshFrame', () => ScrollHeaderSurface, { viewFlags: 4 })
22
+ const Frame = defineComponent({
23
+ name: 'MScrollFrameHost',
24
+ inheritAttrs: false,
25
+ props: scrollFrameHostProps,
26
+ setup(props, { attrs, slots }) {
27
+ const motion = useMotionRegion(() => props.region)
28
+ const scroll = useScrollMotion(() => props.source)
29
+ return () =>
30
+ h(
31
+ 'MavisRefreshFrame',
32
+ mergeProps(attrs, motion, { height: props.height, clipToBounds: true }),
33
+ [
34
+ h(
35
+ 'ScrollView',
36
+ { ...scroll, accessibilityLabel: props.label, iosOverflowSafeArea: false },
37
+ [h('StackLayout', { paddingTop: 0 }, slots.default?.())],
38
+ ),
39
+ slots.overlay?.(),
40
+ ],
41
+ )
42
+ },
43
+ })
44
+ const ui = {
45
+ Box: MBox,
46
+ Card: MCard,
47
+ Column: MColumn,
48
+ Row: MRow,
49
+ Text: MText,
50
+ Input: MInput,
51
+ Button: MButton,
52
+ Chip: MChip,
53
+ Image: MImage,
54
+ Popover: MPopover,
55
+ Frame,
56
+ }
57
+ export const MAnimatedText = createAnimatedText(MText)
58
+ export const MComposer = createComposer(ui, 'native')
59
+ export const MSpeedDial = createSpeedDial(ui)
60
+ export const { MCollapsibleHeader, MRefreshControl } = createScrollComponents(ui, 'native')
61
+ export { MPinInput } from './MPinInput.js'
package/src/vue/index.ts CHANGED
@@ -1,3 +1,36 @@
1
+ import {
2
+ MTreeSelect,
3
+ MMasonry,
4
+ MHeatmap,
5
+ MImageCropper,
6
+ MScheduler,
7
+ MNotificationCenter,
8
+ } from './components/advanced.js'
9
+ import {
10
+ MKanban,
11
+ MDonutChart,
12
+ MSparkline,
13
+ MGradientBackground,
14
+ MParticleField,
15
+ MConfetti,
16
+ } from './components/dashboard.js'
17
+ import {
18
+ MColorPicker,
19
+ MSwipeDeck,
20
+ MGauge,
21
+ MTour,
22
+ MTourTarget,
23
+ MTransferList,
24
+ MMarquee,
25
+ } from './components/creative.js'
26
+ import {
27
+ MCollapsibleHeader,
28
+ MRefreshControl,
29
+ MComposer,
30
+ MSpeedDial,
31
+ MPinInput,
32
+ MAnimatedText,
33
+ } from './components/screen-components.js'
1
34
  import {
2
35
  MImageViewer,
3
36
  MNumberFlow,
@@ -65,6 +98,31 @@ import { MSheet } from './components/MSheet.js'
65
98
  import type { ClaimSystemBack, SystemBackClaimant } from './system-back.js'
66
99
 
67
100
  export {
101
+ MTreeSelect,
102
+ MMasonry,
103
+ MHeatmap,
104
+ MImageCropper,
105
+ MScheduler,
106
+ MNotificationCenter,
107
+ MKanban,
108
+ MDonutChart,
109
+ MSparkline,
110
+ MGradientBackground,
111
+ MParticleField,
112
+ MConfetti,
113
+ MColorPicker,
114
+ MSwipeDeck,
115
+ MGauge,
116
+ MTour,
117
+ MTourTarget,
118
+ MTransferList,
119
+ MMarquee,
120
+ MCollapsibleHeader,
121
+ MRefreshControl,
122
+ MComposer,
123
+ MSpeedDial,
124
+ MPinInput,
125
+ MAnimatedText,
68
126
  MImageViewer,
69
127
  MNumberFlow,
70
128
  MSortableList,
@@ -172,6 +230,32 @@ export function createMavis(options: MavisOptions = {}) {
172
230
  if (components === false) return
173
231
  for (const [name, component] of Object.entries(
174
232
  components ?? {
233
+ MTreeSelect,
234
+ MMasonry,
235
+ MHeatmap,
236
+ MImageCropper,
237
+ MScheduler,
238
+ MNotificationCenter,
239
+ MKanban,
240
+ MDonutChart,
241
+ MSparkline,
242
+ MGradientBackground,
243
+ MParticleField,
244
+ MConfetti,
245
+ MColorPicker,
246
+ MSwipeDeck,
247
+ MGauge,
248
+ MTour,
249
+ MTourTarget,
250
+ MTransferList,
251
+ MMarquee,
252
+ MCollapsibleHeader,
253
+ MRefreshControl,
254
+ MComposer,
255
+ MSpeedDial,
256
+ MPinInput,
257
+ MAnimatedText,
258
+
175
259
  MImageViewer,
176
260
  MNumberFlow,
177
261
  MSortableList,