@getcortexlabs/mavis-web 0.1.0-rc.15 → 0.1.0-rc.16
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 +4 -4
- package/dist/components/LoadingDecoration.d.ts +1 -1
- package/dist/components/MAccordion.d.ts +1 -1
- package/dist/components/MAlert.d.ts +1 -1
- package/dist/components/MButton.d.ts +7 -7
- package/dist/components/MCard.d.ts +16 -5
- package/dist/components/MCard.d.ts.map +1 -1
- package/dist/components/MCard.js +4 -2
- package/dist/components/MCard.js.map +1 -1
- package/dist/components/MCheckbox.d.ts +1 -1
- package/dist/components/MChip.d.ts +2 -2
- package/dist/components/MCombobox.d.ts +1 -1
- package/dist/components/MDatePicker.d.ts +104 -104
- package/dist/components/MDatePicker.d.ts.map +1 -1
- package/dist/components/MEmptyState.d.ts +2 -2
- package/dist/components/MFilePicker.d.ts +1 -1
- package/dist/components/MGrid.d.ts +1 -1
- package/dist/components/MImage.d.ts +1 -1
- package/dist/components/MImageViewer.d.ts.map +1 -1
- package/dist/components/MImageViewer.js +11 -2
- package/dist/components/MImageViewer.js.map +1 -1
- package/dist/components/MInput.d.ts +4 -4
- package/dist/components/MLink.d.ts +1 -1
- package/dist/components/MListItem.d.ts +1 -1
- package/dist/components/MPopover.d.ts +1 -1
- package/dist/components/MProgress.d.ts +1 -1
- package/dist/components/MRadioGroup.d.ts +1 -1
- package/dist/components/MReveal.d.ts +11 -11
- package/dist/components/MScreen.d.ts.map +1 -1
- package/dist/components/MScreen.js +2 -1
- package/dist/components/MScreen.js.map +1 -1
- package/dist/components/MSegmentedControl.d.ts +1 -1
- package/dist/components/MSelect.d.ts +1 -1
- package/dist/components/MSheet.d.ts +6 -6
- package/dist/components/MSheet.d.ts.map +1 -1
- package/dist/components/MSheet.js +2 -0
- package/dist/components/MSheet.js.map +1 -1
- package/dist/components/MSkeleton.d.ts +1 -1
- package/dist/components/MSkeleton.js +7 -7
- package/dist/components/MSkeleton.js.map +1 -1
- package/dist/components/MStack.d.ts +11 -11
- package/dist/components/MSwitch.d.ts +1 -1
- package/dist/components/MTabs.d.ts +1 -1
- package/dist/components/MText.d.ts +4 -4
- package/dist/components/MTimePicker.d.ts +40 -40
- package/dist/components/MTimePicker.d.ts.map +1 -1
- package/dist/components/MTooltip.d.ts +1 -1
- package/dist/components/advanced.d.ts +34 -34
- package/dist/components/configurator.d.ts +36 -36
- package/dist/components/creative.d.ts +21 -21
- package/dist/components/dashboard.d.ts +13 -13
- package/dist/components/discovery.d.ts +11 -11
- package/dist/components/interactive.d.ts +6 -6
- package/dist/components/layout.d.ts +34 -34
- package/dist/components/navigation.d.ts +4 -4
- package/dist/components/screen-components.d.ts +192 -21
- package/dist/components/screen-components.d.ts.map +1 -1
- package/dist/components/screen-components.js +3 -1
- package/dist/components/screen-components.js.map +1 -1
- package/dist/components/wayfinding.d.ts +10 -10
- package/dist/components/workflows.d.ts +3 -3
- package/dist/experimental.d.ts +1 -0
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +1 -0
- package/dist/experimental.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/semantic-content.d.ts +206 -0
- package/dist/semantic-content.d.ts.map +1 -0
- package/dist/semantic-content.js +134 -0
- package/dist/semantic-content.js.map +1 -0
- package/dist/sheet-motion.d.ts.map +1 -1
- package/dist/sheet-motion.js +4 -3
- package/dist/sheet-motion.js.map +1 -1
- package/dist/visual-effects.d.ts.map +1 -1
- package/dist/visual-effects.js +7 -1
- package/dist/visual-effects.js.map +1 -1
- package/package.json +3 -3
- package/src/components/MCard.ts +14 -2
- package/src/components/MImageViewer.ts +10 -2
- package/src/components/MScreen.ts +2 -0
- package/src/components/MSheet.ts +2 -0
- package/src/components/MSkeleton.ts +7 -7
- package/src/components/screen-components.ts +6 -0
- package/src/experimental.ts +2 -0
- package/src/index.ts +10 -0
- package/src/semantic-content.ts +159 -0
- package/src/sheet-motion.ts +3 -2
- package/src/visual-effects.ts +6 -2
|
@@ -5,6 +5,7 @@ import { fontFamily } from '@getcortexlabs/mavis-core'
|
|
|
5
5
|
import { defineComponent, h, mergeProps, provide } from 'vue'
|
|
6
6
|
import {
|
|
7
7
|
screenProps,
|
|
8
|
+
keyboardViewportOwner,
|
|
8
9
|
useMavisTheme,
|
|
9
10
|
layoutDirection,
|
|
10
11
|
viewAttrs,
|
|
@@ -21,6 +22,7 @@ export const MScreen = defineComponent({
|
|
|
21
22
|
const region = useMotionRegion(() => props.motionRegion)
|
|
22
23
|
const { theme } = useMavisTheme()
|
|
23
24
|
const appToast = useAppToastHost()
|
|
25
|
+
provide(keyboardViewportOwner, () => props.scroll)
|
|
24
26
|
const element = useScreenViewport(() => props.scroll)
|
|
25
27
|
useScrollMotion(
|
|
26
28
|
element,
|
package/src/components/MSheet.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { keyboardViewportOwner } from '@getcortexlabs/mavis-core/vue'
|
|
1
2
|
import {
|
|
2
3
|
defineComponent,
|
|
3
4
|
h,
|
|
@@ -41,6 +42,7 @@ const Sheet = defineComponent({
|
|
|
41
42
|
const { theme } = useMavisTheme()
|
|
42
43
|
const active = useCachedActivity()
|
|
43
44
|
provide(layoutDirection, 'column')
|
|
45
|
+
provide(keyboardViewportOwner, () => true)
|
|
44
46
|
const titleId = `m-sheet-${useId()}`
|
|
45
47
|
const dialog = ref<HTMLDialogElement>()
|
|
46
48
|
const panel = ref<HTMLElement>()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, mergeProps,
|
|
1
|
+
import { defineComponent, h, mergeProps, onMounted, ref, watch } from 'vue'
|
|
2
2
|
import { skeletonProps, useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
3
3
|
import { MBox } from './layout.js'
|
|
4
4
|
import { LoadingDecoration } from './LoadingDecoration.js'
|
|
@@ -14,17 +14,17 @@ export const MSkeleton = defineComponent({
|
|
|
14
14
|
hidden.value = document.hidden
|
|
15
15
|
}
|
|
16
16
|
onMounted(() => {
|
|
17
|
-
visibility()
|
|
18
17
|
watch(
|
|
19
|
-
() => props.effect,
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
() => props.effect === 'pulse' && props.animated,
|
|
19
|
+
(pulse, _, onCleanup) => {
|
|
20
|
+
if (!pulse) return
|
|
21
|
+
visibility()
|
|
22
|
+
document.addEventListener('visibilitychange', visibility)
|
|
23
|
+
onCleanup(() => document.removeEventListener('visibilitychange', visibility))
|
|
23
24
|
},
|
|
24
25
|
{ immediate: true },
|
|
25
26
|
)
|
|
26
27
|
})
|
|
27
|
-
onBeforeUnmount(() => document.removeEventListener('visibilitychange', visibility))
|
|
28
28
|
return () =>
|
|
29
29
|
h(
|
|
30
30
|
props.effect === 'shimmer' ? LoadingDecoration : MBox,
|
|
@@ -2,6 +2,7 @@ import { defineComponent, h, mergeProps, ref } from 'vue'
|
|
|
2
2
|
import {
|
|
3
3
|
createAnimatedText,
|
|
4
4
|
createComposer,
|
|
5
|
+
createEditorControls,
|
|
5
6
|
createSpeedDial,
|
|
6
7
|
createScrollComponents,
|
|
7
8
|
scrollFrameHostProps,
|
|
@@ -13,6 +14,7 @@ import { MCard } from './MCard.js'
|
|
|
13
14
|
import { MText } from './MText.js'
|
|
14
15
|
import { MInput } from './MInput.js'
|
|
15
16
|
import { MImage } from './MImage.js'
|
|
17
|
+
import { MAvatar } from './MAvatar.js'
|
|
16
18
|
import { MButton } from './MButton.js'
|
|
17
19
|
import { MChip } from './MChip.js'
|
|
18
20
|
import { MPopover } from './MPopover.js'
|
|
@@ -80,6 +82,10 @@ const ui = {
|
|
|
80
82
|
Frame,
|
|
81
83
|
}
|
|
82
84
|
export const MAnimatedText = createAnimatedText(MText)
|
|
85
|
+
export const { MTagInput, MAvatarGroup, MSearchBar } = createEditorControls(
|
|
86
|
+
{ ...ui, Avatar: MAvatar },
|
|
87
|
+
'web',
|
|
88
|
+
)
|
|
83
89
|
export const MComposer = createComposer(ui, 'web')
|
|
84
90
|
export const MSpeedDial = createSpeedDial(ui)
|
|
85
91
|
export const { MCollapsibleHeader, MRefreshControl } = createScrollComponents(ui, 'web')
|
package/src/experimental.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
MCollapsibleHeader,
|
|
28
28
|
MRefreshControl,
|
|
29
|
+
MTagInput,
|
|
30
|
+
MAvatarGroup,
|
|
31
|
+
MSearchBar,
|
|
29
32
|
MComposer,
|
|
30
33
|
MSpeedDial,
|
|
31
34
|
MPinInput,
|
|
@@ -119,6 +122,9 @@ export {
|
|
|
119
122
|
MMarquee,
|
|
120
123
|
MCollapsibleHeader,
|
|
121
124
|
MRefreshControl,
|
|
125
|
+
MTagInput,
|
|
126
|
+
MAvatarGroup,
|
|
127
|
+
MSearchBar,
|
|
122
128
|
MComposer,
|
|
123
129
|
MSpeedDial,
|
|
124
130
|
MPinInput,
|
|
@@ -207,6 +213,7 @@ export {
|
|
|
207
213
|
} from '@getcortexlabs/mavis-core/vue'
|
|
208
214
|
export type {
|
|
209
215
|
MavisThemeContext,
|
|
216
|
+
ThemePair,
|
|
210
217
|
MavisPlatform,
|
|
211
218
|
MavisPlatformTarget,
|
|
212
219
|
MavisPlatformContext,
|
|
@@ -249,6 +256,9 @@ export function createMavis(options: MavisOptions = {}) {
|
|
|
249
256
|
MMarquee,
|
|
250
257
|
MCollapsibleHeader,
|
|
251
258
|
MRefreshControl,
|
|
259
|
+
MTagInput,
|
|
260
|
+
MAvatarGroup,
|
|
261
|
+
MSearchBar,
|
|
252
262
|
MComposer,
|
|
253
263
|
MSpeedDial,
|
|
254
264
|
MPinInput,
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps, type PropType } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
actionEmits,
|
|
4
|
+
buttonProps,
|
|
5
|
+
linkEmits,
|
|
6
|
+
linkProps,
|
|
7
|
+
useButtonAction,
|
|
8
|
+
useNavigationOptions,
|
|
9
|
+
motionBoxProps,
|
|
10
|
+
} from '@getcortexlabs/mavis-core/vue'
|
|
11
|
+
import { useMotionRegion } from './motion-region.js'
|
|
12
|
+
import { useMotionSurface } from './use-motion-surface.js'
|
|
13
|
+
import { navigationAttrs } from './navigation.js'
|
|
14
|
+
import { webAttrs } from './style.js'
|
|
15
|
+
|
|
16
|
+
// Limit hosts to document structure. Actions and links own their interaction contracts.
|
|
17
|
+
const tags = [
|
|
18
|
+
'div',
|
|
19
|
+
'span',
|
|
20
|
+
'section',
|
|
21
|
+
'article',
|
|
22
|
+
'header',
|
|
23
|
+
'footer',
|
|
24
|
+
'aside',
|
|
25
|
+
'main',
|
|
26
|
+
'nav',
|
|
27
|
+
'h1',
|
|
28
|
+
'h2',
|
|
29
|
+
'h3',
|
|
30
|
+
'h4',
|
|
31
|
+
'h5',
|
|
32
|
+
'h6',
|
|
33
|
+
'p',
|
|
34
|
+
'strong',
|
|
35
|
+
'b',
|
|
36
|
+
'em',
|
|
37
|
+
'i',
|
|
38
|
+
'small',
|
|
39
|
+
'code',
|
|
40
|
+
'pre',
|
|
41
|
+
'blockquote',
|
|
42
|
+
'ol',
|
|
43
|
+
'ul',
|
|
44
|
+
'li',
|
|
45
|
+
'dl',
|
|
46
|
+
'dt',
|
|
47
|
+
'dd',
|
|
48
|
+
'figure',
|
|
49
|
+
'figcaption',
|
|
50
|
+
'form',
|
|
51
|
+
'table',
|
|
52
|
+
'caption',
|
|
53
|
+
'thead',
|
|
54
|
+
'tbody',
|
|
55
|
+
'tfoot',
|
|
56
|
+
'tr',
|
|
57
|
+
'th',
|
|
58
|
+
'td',
|
|
59
|
+
'br',
|
|
60
|
+
'hr',
|
|
61
|
+
'sup',
|
|
62
|
+
'sub',
|
|
63
|
+
'time',
|
|
64
|
+
'address',
|
|
65
|
+
'label',
|
|
66
|
+
'mark',
|
|
67
|
+
'cite',
|
|
68
|
+
] as const
|
|
69
|
+
type ContentTag = (typeof tags)[number]
|
|
70
|
+
|
|
71
|
+
/** A semantic host inside a Web motion region. Site CSS controls the formatting context. */
|
|
72
|
+
export const MWebElement = defineComponent({
|
|
73
|
+
name: 'MWebElement',
|
|
74
|
+
inheritAttrs: false,
|
|
75
|
+
props: {
|
|
76
|
+
as: { type: String as PropType<ContentTag>, default: 'div' },
|
|
77
|
+
motionRegion: motionBoxProps.motionRegion,
|
|
78
|
+
motionSurface: motionBoxProps.motionSurface,
|
|
79
|
+
},
|
|
80
|
+
setup(props, { attrs, slots }) {
|
|
81
|
+
const region = useMotionRegion(() => props.motionRegion)
|
|
82
|
+
const surface = useMotionSurface(() => props.motionSurface)
|
|
83
|
+
return () => {
|
|
84
|
+
if (!tags.includes(props.as)) throw new TypeError('Unsupported MWebElement tag')
|
|
85
|
+
return h(props.as, mergeProps(webAttrs(attrs), region, surface), slots.default?.())
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
/** CSS-styled form action with a rich visual label and an optional declared motion surface. */
|
|
91
|
+
export const MWebButton = defineComponent({
|
|
92
|
+
name: 'MWebButton',
|
|
93
|
+
inheritAttrs: false,
|
|
94
|
+
props: {
|
|
95
|
+
type: buttonProps.type,
|
|
96
|
+
name: buttonProps.name,
|
|
97
|
+
value: buttonProps.value,
|
|
98
|
+
form: buttonProps.form,
|
|
99
|
+
disabled: buttonProps.disabled,
|
|
100
|
+
loading: buttonProps.loading,
|
|
101
|
+
motionSurface: buttonProps.motionSurface,
|
|
102
|
+
accessibilityLabel: buttonProps.accessibilityLabel,
|
|
103
|
+
},
|
|
104
|
+
emits: { click: actionEmits.click },
|
|
105
|
+
setup(props, { attrs, slots, emit }) {
|
|
106
|
+
useButtonAction()
|
|
107
|
+
const enabled = () => !props.disabled && !props.loading
|
|
108
|
+
const surface = useMotionSurface(() => props.motionSurface)
|
|
109
|
+
return () =>
|
|
110
|
+
h(
|
|
111
|
+
'button',
|
|
112
|
+
mergeProps(surface, webAttrs(attrs), {
|
|
113
|
+
type: props.type,
|
|
114
|
+
name: props.name,
|
|
115
|
+
value: props.value,
|
|
116
|
+
form: props.form,
|
|
117
|
+
disabled: !enabled(),
|
|
118
|
+
'aria-label': props.accessibilityLabel ?? attrs['aria-label'],
|
|
119
|
+
'aria-busy': props.loading || undefined,
|
|
120
|
+
onClick: (event: MouseEvent) => {
|
|
121
|
+
if (enabled() && !event.defaultPrevented) emit('click')
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
slots.default?.(),
|
|
125
|
+
)
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
/** One real anchor, with the same destination, modifier and navigation rules as MLink. */
|
|
130
|
+
export const MWebLink = defineComponent({
|
|
131
|
+
name: 'MWebLink',
|
|
132
|
+
inheritAttrs: false,
|
|
133
|
+
props: {
|
|
134
|
+
href: linkProps.href,
|
|
135
|
+
target: linkProps.target,
|
|
136
|
+
rel: linkProps.rel,
|
|
137
|
+
navigate: linkProps.navigate,
|
|
138
|
+
disabled: linkProps.disabled,
|
|
139
|
+
accessibilityLabel: linkProps.accessibilityLabel,
|
|
140
|
+
},
|
|
141
|
+
emits: linkEmits,
|
|
142
|
+
setup(props, { attrs, slots, emit }) {
|
|
143
|
+
const navigation = useNavigationOptions(props)
|
|
144
|
+
return () =>
|
|
145
|
+
h(
|
|
146
|
+
'a',
|
|
147
|
+
mergeProps(webAttrs(attrs), {
|
|
148
|
+
'aria-label': props.accessibilityLabel ?? attrs['aria-label'],
|
|
149
|
+
...navigationAttrs(
|
|
150
|
+
navigation(),
|
|
151
|
+
props.disabled,
|
|
152
|
+
() => emit('click'),
|
|
153
|
+
(error) => emit('error', error),
|
|
154
|
+
),
|
|
155
|
+
}),
|
|
156
|
+
slots.default?.(),
|
|
157
|
+
)
|
|
158
|
+
},
|
|
159
|
+
})
|
package/src/sheet-motion.ts
CHANGED
|
@@ -52,6 +52,7 @@ export function sheetMotion(
|
|
|
52
52
|
if (disposed) return
|
|
53
53
|
open = true
|
|
54
54
|
settledClosed = false
|
|
55
|
+
if (sheet && JSON.stringify(options()) !== configuration) attach()
|
|
55
56
|
sheet?.open()
|
|
56
57
|
},
|
|
57
58
|
hide() {
|
|
@@ -63,10 +64,10 @@ export function sheetMotion(
|
|
|
63
64
|
else sheet.dismiss()
|
|
64
65
|
},
|
|
65
66
|
refresh() {
|
|
66
|
-
if (disposed || !sheet) return
|
|
67
|
+
if (disposed || !sheet || !open) return
|
|
67
68
|
if (JSON.stringify(options()) !== configuration) {
|
|
68
69
|
attach()
|
|
69
|
-
|
|
70
|
+
sheet!.open()
|
|
70
71
|
} else sheet.remeasure()
|
|
71
72
|
},
|
|
72
73
|
dispose() {
|
package/src/visual-effects.ts
CHANGED
|
@@ -82,8 +82,7 @@ export function webVisualEffects(
|
|
|
82
82
|
rollTo: (value, options) => owner.rollTo(text(), value, options),
|
|
83
83
|
circular() {
|
|
84
84
|
circles.get(target)?.dispose()
|
|
85
|
-
|
|
86
|
-
hidden = target.getAttribute('aria-hidden')
|
|
85
|
+
let inert: string | null, hidden: string | null
|
|
87
86
|
const visibility = target.style.visibility
|
|
88
87
|
let locked = false,
|
|
89
88
|
active: MotionPlayback | undefined,
|
|
@@ -103,6 +102,7 @@ export function webVisualEffects(
|
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
104
|
const run = (open: boolean, options: Parameters<MotionCircular['reveal']>[0] = {}) => {
|
|
105
|
+
if (disposed) throw new Error('The circular control was disposed or replaced.')
|
|
106
106
|
if (!open && target.contains(target.ownerDocument.activeElement))
|
|
107
107
|
throw new Error('Move focus outside the circular surface before conceal().')
|
|
108
108
|
// Jolt validates options before replacing the active circle.
|
|
@@ -114,6 +114,10 @@ export function webVisualEffects(
|
|
|
114
114
|
writtenVisibility = target.style.visibility
|
|
115
115
|
if (open) unlock()
|
|
116
116
|
else {
|
|
117
|
+
if (!locked) {
|
|
118
|
+
inert = target.getAttribute('inert')
|
|
119
|
+
hidden = target.getAttribute('aria-hidden')
|
|
120
|
+
}
|
|
117
121
|
locked = true
|
|
118
122
|
target.setAttribute('inert', '')
|
|
119
123
|
target.setAttribute('aria-hidden', 'true')
|