@getcortexlabs/mavis-core 0.1.0-alpha.5 → 0.1.0-alpha.7
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/dist/app-icons.d.ts +27 -0
- package/dist/app-icons.d.ts.map +1 -0
- package/dist/app-icons.js +42 -0
- package/dist/app-icons.js.map +1 -0
- package/dist/capabilities.d.ts +7 -7
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +9 -4
- package/dist/capabilities.js.map +1 -1
- package/dist/choice-motion.d.ts +14 -0
- package/dist/choice-motion.d.ts.map +1 -0
- package/dist/choice-motion.js +5 -0
- package/dist/choice-motion.js.map +1 -0
- package/dist/contracts.d.ts +61 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +8 -1
- package/dist/contracts.js.map +1 -1
- package/dist/experimental-playback.d.ts +63 -0
- package/dist/experimental-playback.d.ts.map +1 -0
- package/dist/experimental-playback.js +46 -0
- package/dist/experimental-playback.js.map +1 -0
- package/dist/experimental-regions.d.ts +12 -0
- package/dist/experimental-regions.d.ts.map +1 -1
- package/dist/experimental-regions.js +125 -0
- package/dist/experimental-regions.js.map +1 -1
- package/dist/experimental.d.ts +38 -4
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +70 -11
- package/dist/experimental.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/link.d.ts +12 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +19 -0
- package/dist/link.js.map +1 -0
- package/dist/motion.d.ts +29 -4
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +55 -3
- package/dist/motion.js.map +1 -1
- package/dist/multi-select.d.ts +4 -0
- package/dist/multi-select.d.ts.map +1 -0
- package/dist/multi-select.js +23 -0
- package/dist/multi-select.js.map +1 -0
- package/dist/number-input.d.ts +21 -0
- package/dist/number-input.d.ts.map +1 -0
- package/dist/number-input.js +63 -0
- package/dist/number-input.js.map +1 -0
- package/dist/responsive.d.ts +18 -0
- package/dist/responsive.d.ts.map +1 -0
- package/dist/responsive.js +35 -0
- package/dist/responsive.js.map +1 -0
- package/dist/theme/themes.js +3 -3
- package/dist/theme/themes.js.map +1 -1
- package/dist/theme/types.d.ts +12 -3
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/vue/component-props.d.ts +434 -0
- package/dist/vue/component-props.d.ts.map +1 -1
- package/dist/vue/component-props.js +4 -0
- package/dist/vue/component-props.js.map +1 -1
- package/dist/vue/configurator-props.d.ts +251 -0
- package/dist/vue/configurator-props.d.ts.map +1 -0
- package/dist/vue/configurator-props.js +56 -0
- package/dist/vue/configurator-props.js.map +1 -0
- package/dist/vue/configurator.d.ts +403 -0
- package/dist/vue/configurator.d.ts.map +1 -0
- package/dist/vue/configurator.js +287 -0
- package/dist/vue/configurator.js.map +1 -0
- package/dist/vue/contracts.d.ts.map +1 -1
- package/dist/vue/contracts.js +7 -1
- package/dist/vue/contracts.js.map +1 -1
- package/dist/vue/date-picker.d.ts +50 -12
- package/dist/vue/date-picker.d.ts.map +1 -1
- package/dist/vue/date-picker.js +28 -6
- package/dist/vue/date-picker.js.map +1 -1
- package/dist/vue/date-props.d.ts +9 -0
- package/dist/vue/date-props.d.ts.map +1 -1
- package/dist/vue/date-props.js +3 -0
- package/dist/vue/date-props.js.map +1 -1
- package/dist/vue/global-components.d.ts +19 -0
- package/dist/vue/global-components.d.ts.map +1 -1
- package/dist/vue/index.d.ts +6 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +5 -2
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/layout-context.d.ts +4 -2
- package/dist/vue/layout-context.d.ts.map +1 -1
- package/dist/vue/layout-context.js +7 -2
- package/dist/vue/layout-context.js.map +1 -1
- package/dist/vue/props.d.ts +365 -0
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +25 -1
- package/dist/vue/props.js.map +1 -1
- package/dist/vue/reveal-state.d.ts +18 -0
- package/dist/vue/reveal-state.d.ts.map +1 -0
- package/dist/vue/reveal-state.js +76 -0
- package/dist/vue/reveal-state.js.map +1 -0
- package/dist/vue/theme.d.ts +42 -0
- package/dist/vue/theme.d.ts.map +1 -1
- package/dist/vue/workflows.d.ts +1 -1
- package/package.json +1 -1
- package/src/app-icons.ts +57 -0
- package/src/capabilities.ts +9 -4
- package/src/choice-motion.ts +12 -0
- package/src/contracts.ts +12 -2
- package/src/experimental-playback.ts +115 -0
- package/src/experimental-regions.ts +151 -0
- package/src/experimental.ts +139 -21
- package/src/index.ts +10 -1
- package/src/link.ts +28 -0
- package/src/motion.ts +61 -3
- package/src/multi-select.ts +30 -0
- package/src/number-input.ts +80 -0
- package/src/responsive.ts +61 -0
- package/src/theme/themes.ts +3 -3
- package/src/theme/types.ts +13 -1
- package/src/vue/component-props.ts +4 -0
- package/src/vue/configurator-props.ts +59 -0
- package/src/vue/configurator.ts +350 -0
- package/src/vue/contracts.ts +7 -1
- package/src/vue/date-picker.ts +33 -6
- package/src/vue/date-props.ts +3 -0
- package/src/vue/global-components.ts +21 -1
- package/src/vue/index.ts +9 -1
- package/src/vue/layout-context.ts +10 -3
- package/src/vue/props.ts +27 -1
- package/src/vue/reveal-state.ts +83 -0
package/src/vue/props.ts
CHANGED
|
@@ -24,6 +24,9 @@ import type { SheetName } from '../sheet.js'
|
|
|
24
24
|
import { dialogCloseReasons, type DialogCloseReason } from '../dialog.js'
|
|
25
25
|
import type { ExtractPropTypes, ExtractPublicPropTypes, PropType } from '@vue/runtime-core'
|
|
26
26
|
import type { Palette, Elevation } from '../theme/types.js'
|
|
27
|
+
import type { LinkNavigate } from '../link.js'
|
|
28
|
+
import { navigationContract } from '../contracts.js'
|
|
29
|
+
import type { StackResponsive } from '../responsive.js'
|
|
27
30
|
import { isChoiceValue, type ChoiceValue, type ChoiceOption } from '../choice.js'
|
|
28
31
|
import type { ToastController } from '../toast.js'
|
|
29
32
|
import { iconSizes, type IconName, type IconSize } from '../icon.js'
|
|
@@ -53,6 +56,21 @@ export function viewAttrs(props: ExtractPropTypes<typeof viewProps>) {
|
|
|
53
56
|
export const flexProps = vueProps(flexContract)
|
|
54
57
|
export const boxProps = vueProps(boxContract)
|
|
55
58
|
export const motionBoxProps = vueProps(motionBoxContract)
|
|
59
|
+
export const linkProps = {
|
|
60
|
+
...viewProps,
|
|
61
|
+
...flexProps,
|
|
62
|
+
href: { type: String, required: true as const },
|
|
63
|
+
text: { type: String, default: undefined },
|
|
64
|
+
navigate: { type: Function as PropType<LinkNavigate>, default: undefined },
|
|
65
|
+
target: choice(['_self', '_blank'] as const, '_self'),
|
|
66
|
+
rel: { type: String, default: undefined },
|
|
67
|
+
disabled: Boolean,
|
|
68
|
+
inline: Boolean,
|
|
69
|
+
}
|
|
70
|
+
export const linkEmits = {
|
|
71
|
+
click: () => true,
|
|
72
|
+
error: (_error: unknown) => true,
|
|
73
|
+
}
|
|
56
74
|
export const listItemProps = {
|
|
57
75
|
...viewProps,
|
|
58
76
|
...flexProps,
|
|
@@ -151,7 +169,13 @@ export const skeletonProps = {
|
|
|
151
169
|
}
|
|
152
170
|
export const rowProps = vueProps(rowContract)
|
|
153
171
|
export const columnProps = vueProps(columnContract)
|
|
172
|
+
export const stackProps = {
|
|
173
|
+
...columnProps,
|
|
174
|
+
direction: choice(['row', 'column'] as const, 'column'),
|
|
175
|
+
responsive: { type: [Object, Array] as PropType<StackResponsive>, default: undefined },
|
|
176
|
+
}
|
|
154
177
|
export const cardProps = {
|
|
178
|
+
...vueProps(navigationContract),
|
|
155
179
|
motionSurface: { type: Object as PropType<MotionSurface>, default: undefined },
|
|
156
180
|
...boxProps,
|
|
157
181
|
padding: spacingProp,
|
|
@@ -332,13 +356,15 @@ export const sheetEmits = {
|
|
|
332
356
|
close: (reason: SheetCloseReason) => sheetCloseReasons.includes(reason),
|
|
333
357
|
opened: () => true,
|
|
334
358
|
}
|
|
335
|
-
export const actionEmits = { click: () => true }
|
|
359
|
+
export const actionEmits = { click: () => true, error: (_error: unknown) => true }
|
|
336
360
|
export const sliderEmits = { 'update:modelValue': (value: number) => Number.isFinite(value) }
|
|
337
361
|
|
|
338
362
|
export const componentProps = {
|
|
339
363
|
MScreen: screenProps,
|
|
340
364
|
MRow: rowProps,
|
|
341
365
|
MColumn: columnProps,
|
|
366
|
+
MStack: stackProps,
|
|
367
|
+
MLink: linkProps,
|
|
342
368
|
MBox: motionBoxProps,
|
|
343
369
|
MCard: cardProps,
|
|
344
370
|
MText: textProps,
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { onBeforeUnmount, ref, watch } from '@vue/runtime-core'
|
|
2
|
+
|
|
3
|
+
export interface RevealHost {
|
|
4
|
+
animate(open: boolean, fromClosed: boolean): { finished: Promise<boolean>; stop(): void }
|
|
5
|
+
interactive(enabled: boolean): void
|
|
6
|
+
captureFocus(): void
|
|
7
|
+
restoreFocus(): void
|
|
8
|
+
release(): void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Presence outlives a closing animation. Reversal updates the same mounted subtree. */
|
|
12
|
+
export function useRevealState(show: () => boolean) {
|
|
13
|
+
const present = ref(show())
|
|
14
|
+
const phase = ref<'open' | 'opening' | 'closing' | 'closed'>(show() ? 'open' : 'closed')
|
|
15
|
+
let host: RevealHost | undefined
|
|
16
|
+
let playback: ReturnType<RevealHost['animate']> | undefined
|
|
17
|
+
let revision = 0
|
|
18
|
+
let fresh = false
|
|
19
|
+
const settle = (open: boolean) => {
|
|
20
|
+
phase.value = open ? 'open' : 'closed'
|
|
21
|
+
present.value = open
|
|
22
|
+
}
|
|
23
|
+
function run(open: boolean) {
|
|
24
|
+
if (!host) return
|
|
25
|
+
const current = ++revision
|
|
26
|
+
if (open) host.captureFocus()
|
|
27
|
+
else host.restoreFocus()
|
|
28
|
+
host.interactive(open)
|
|
29
|
+
// Starting a new Jolt operation hands the current trajectory to its successor.
|
|
30
|
+
playback = host.animate(open, fresh)
|
|
31
|
+
fresh = false
|
|
32
|
+
return playback.finished.then(
|
|
33
|
+
() => {
|
|
34
|
+
if (current === revision) {
|
|
35
|
+
playback = undefined
|
|
36
|
+
settle(open)
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
(error) => {
|
|
40
|
+
if (current === revision) {
|
|
41
|
+
playback = undefined
|
|
42
|
+
settle(open)
|
|
43
|
+
}
|
|
44
|
+
throw error
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
watch(
|
|
49
|
+
show,
|
|
50
|
+
(open) => {
|
|
51
|
+
const wasPresent = present.value
|
|
52
|
+
fresh = open && !wasPresent
|
|
53
|
+
if (open) present.value = true
|
|
54
|
+
phase.value = open ? 'opening' : 'closing'
|
|
55
|
+
if (host) return run(open)
|
|
56
|
+
else if (!open) settle(false)
|
|
57
|
+
},
|
|
58
|
+
{ flush: 'pre' },
|
|
59
|
+
)
|
|
60
|
+
const detach = () => {
|
|
61
|
+
revision++
|
|
62
|
+
playback?.stop()
|
|
63
|
+
playback = undefined
|
|
64
|
+
host?.release()
|
|
65
|
+
host = undefined
|
|
66
|
+
settle(show())
|
|
67
|
+
}
|
|
68
|
+
onBeforeUnmount(detach)
|
|
69
|
+
return {
|
|
70
|
+
present,
|
|
71
|
+
phase,
|
|
72
|
+
detach,
|
|
73
|
+
attach(next: RevealHost) {
|
|
74
|
+
revision++
|
|
75
|
+
playback?.stop()
|
|
76
|
+
playback = undefined
|
|
77
|
+
host?.release()
|
|
78
|
+
host = next
|
|
79
|
+
if (phase.value === 'opening' || phase.value === 'closing') return run(show())
|
|
80
|
+
else host.interactive(show())
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
}
|