@getcortexlabs/mavis-core 0.1.0-alpha.3 → 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 +2 -2
- package/dist/accordion.d.ts +17 -0
- package/dist/accordion.d.ts.map +1 -0
- package/dist/accordion.js +42 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.d.ts +21 -0
- package/dist/alert.d.ts.map +1 -0
- package/dist/alert.js +13 -0
- package/dist/alert.js.map +1 -0
- package/dist/avatar.d.ts +10 -0
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +11 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.d.ts +7 -0
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +11 -0
- package/dist/badge.js.map +1 -0
- package/dist/capabilities.d.ts +119 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +142 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/chip.d.ts +9 -0
- package/dist/chip.d.ts.map +1 -0
- package/dist/chip.js +16 -0
- package/dist/chip.js.map +1 -0
- package/dist/choice.d.ts +15 -0
- package/dist/choice.d.ts.map +1 -0
- package/dist/choice.js +27 -0
- package/dist/choice.js.map +1 -0
- package/dist/combobox.d.ts +42 -0
- package/dist/combobox.d.ts.map +1 -0
- package/dist/combobox.js +159 -0
- package/dist/combobox.js.map +1 -0
- package/dist/contracts.d.ts +1201 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +242 -0
- package/dist/contracts.js.map +1 -0
- package/dist/date.d.ts +96 -0
- package/dist/date.d.ts.map +1 -0
- package/dist/date.js +235 -0
- package/dist/date.js.map +1 -0
- package/dist/dialog.d.ts +4 -0
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +20 -0
- package/dist/dialog.js.map +1 -0
- package/dist/empty-state.d.ts +2 -0
- package/dist/empty-state.d.ts.map +1 -0
- package/dist/empty-state.js +5 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/experimental-regions.d.ts +142 -0
- package/dist/experimental-regions.d.ts.map +1 -0
- package/dist/experimental-regions.js +315 -0
- package/dist/experimental-regions.js.map +1 -0
- package/dist/experimental.d.ts +134 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +502 -0
- package/dist/experimental.js.map +1 -0
- package/dist/files.d.ts +87 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +328 -0
- package/dist/files.js.map +1 -0
- package/dist/form.d.ts +39 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +170 -0
- package/dist/form.js.map +1 -0
- package/dist/index.d.ts +38 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +10 -0
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +12 -0
- package/dist/input.js.map +1 -1
- package/dist/list-item.d.ts +3 -0
- package/dist/list-item.d.ts.map +1 -0
- package/dist/list-item.js +7 -0
- package/dist/list-item.js.map +1 -0
- package/dist/motion.d.ts +33 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +21 -0
- package/dist/motion.js.map +1 -0
- package/dist/navigation.d.ts +22 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/navigation.js +54 -0
- package/dist/navigation.js.map +1 -0
- package/dist/progress.d.ts +19 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +19 -0
- package/dist/progress.js.map +1 -0
- package/dist/segmented.d.ts +11 -0
- package/dist/segmented.d.ts.map +1 -0
- package/dist/segmented.js +30 -0
- package/dist/segmented.js.map +1 -0
- package/dist/sheet.d.ts +8 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +4 -3
- package/dist/sheet.js.map +1 -1
- package/dist/tabs.d.ts +11 -0
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +28 -0
- package/dist/tabs.js.map +1 -0
- package/dist/theme/themes.d.ts.map +1 -1
- package/dist/theme/themes.js +84 -11
- package/dist/theme/themes.js.map +1 -1
- package/dist/theme/types.d.ts +52 -1
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/typography.d.ts +10 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +90 -0
- package/dist/theme/typography.js.map +1 -0
- package/dist/toast.d.ts +43 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +228 -0
- package/dist/toast.js.map +1 -0
- package/dist/vue/button-content.d.ts +10 -0
- package/dist/vue/button-content.d.ts.map +1 -0
- package/dist/vue/button-content.js +54 -0
- package/dist/vue/button-content.js.map +1 -0
- package/dist/vue/cached-activity.d.ts +3 -0
- package/dist/vue/cached-activity.d.ts.map +1 -0
- package/dist/vue/cached-activity.js +13 -0
- package/dist/vue/cached-activity.js.map +1 -0
- package/dist/vue/combobox.d.ts +155 -0
- package/dist/vue/combobox.d.ts.map +1 -0
- package/dist/vue/combobox.js +195 -0
- package/dist/vue/combobox.js.map +1 -0
- package/dist/vue/component-props.d.ts +1989 -0
- package/dist/vue/component-props.d.ts.map +1 -0
- package/dist/vue/component-props.js +18 -0
- package/dist/vue/component-props.js.map +1 -0
- package/dist/vue/contracts.d.ts +18 -0
- package/dist/vue/contracts.d.ts.map +1 -0
- package/dist/vue/contracts.js +18 -0
- package/dist/vue/contracts.js.map +1 -0
- package/dist/vue/date-calendar.d.ts +64 -0
- package/dist/vue/date-calendar.d.ts.map +1 -0
- package/dist/vue/date-calendar.js +65 -0
- package/dist/vue/date-calendar.js.map +1 -0
- package/dist/vue/date-picker.d.ts +927 -0
- package/dist/vue/date-picker.d.ts.map +1 -0
- package/dist/vue/date-picker.js +319 -0
- package/dist/vue/date-picker.js.map +1 -0
- package/dist/vue/date-props.d.ts +254 -0
- package/dist/vue/date-props.d.ts.map +1 -0
- package/dist/vue/date-props.js +74 -0
- package/dist/vue/date-props.js.map +1 -0
- package/dist/vue/dialog.d.ts +21 -0
- package/dist/vue/dialog.d.ts.map +1 -0
- package/dist/vue/dialog.js +58 -0
- package/dist/vue/dialog.js.map +1 -0
- package/dist/vue/files.d.ts +53 -0
- package/dist/vue/files.d.ts.map +1 -0
- package/dist/vue/files.js +40 -0
- package/dist/vue/files.js.map +1 -0
- package/dist/vue/forms.d.ts +4 -0
- package/dist/vue/forms.d.ts.map +1 -0
- package/dist/vue/forms.js +15 -0
- package/dist/vue/forms.js.map +1 -0
- package/dist/vue/global-components.d.ts +129 -3
- package/dist/vue/global-components.d.ts.map +1 -1
- package/dist/vue/index.d.ts +28 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +24 -1
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/inline-content.d.ts +54 -0
- package/dist/vue/inline-content.d.ts.map +1 -0
- package/dist/vue/inline-content.js +64 -0
- package/dist/vue/inline-content.js.map +1 -0
- package/dist/vue/props.d.ts +2654 -637
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +228 -86
- package/dist/vue/props.js.map +1 -1
- package/dist/vue/theme-provider.d.ts +58 -0
- package/dist/vue/theme-provider.d.ts.map +1 -0
- package/dist/vue/theme-provider.js +69 -0
- package/dist/vue/theme-provider.js.map +1 -0
- package/dist/vue/theme.d.ts +962 -12
- package/dist/vue/theme.d.ts.map +1 -1
- package/dist/vue/theme.js +17 -7
- package/dist/vue/theme.js.map +1 -1
- package/dist/vue/toast.d.ts +29 -0
- package/dist/vue/toast.d.ts.map +1 -0
- package/dist/vue/toast.js +79 -0
- package/dist/vue/toast.js.map +1 -0
- package/dist/vue/workflow-props.d.ts +110 -0
- package/dist/vue/workflow-props.d.ts.map +1 -0
- package/dist/vue/workflow-props.js +37 -0
- package/dist/vue/workflow-props.js.map +1 -0
- package/dist/vue/workflows.d.ts +267 -0
- package/dist/vue/workflows.d.ts.map +1 -0
- package/dist/vue/workflows.js +200 -0
- package/dist/vue/workflows.js.map +1 -0
- package/package.json +5 -1
- package/src/accordion.ts +66 -0
- package/src/alert.ts +16 -0
- package/src/avatar.ts +11 -0
- package/src/badge.ts +11 -0
- package/src/capabilities.ts +145 -0
- package/src/chip.ts +20 -0
- package/src/choice.ts +41 -0
- package/src/combobox.ts +198 -0
- package/src/contracts.ts +295 -0
- package/src/date.ts +280 -0
- package/src/dialog.ts +20 -0
- package/src/empty-state.ts +4 -0
- package/src/experimental-regions.ts +463 -0
- package/src/experimental.ts +643 -0
- package/src/files.ts +408 -0
- package/src/form.ts +190 -0
- package/src/index.ts +64 -3
- package/src/input.ts +22 -0
- package/src/list-item.ts +5 -0
- package/src/motion.ts +22 -0
- package/src/navigation.ts +61 -0
- package/src/progress.ts +22 -0
- package/src/segmented.ts +39 -0
- package/src/sheet.ts +6 -3
- package/src/tabs.ts +35 -0
- package/src/theme/themes.ts +88 -11
- package/src/theme/types.ts +42 -1
- package/src/theme/typography.ts +84 -0
- package/src/toast.ts +249 -0
- package/src/vue/button-content.ts +60 -0
- package/src/vue/cached-activity.ts +13 -0
- package/src/vue/combobox.ts +238 -0
- package/src/vue/component-props.ts +24 -0
- package/src/vue/contracts.ts +33 -0
- package/src/vue/date-calendar.ts +76 -0
- package/src/vue/date-picker.ts +387 -0
- package/src/vue/date-props.ts +81 -0
- package/src/vue/dialog.ts +63 -0
- package/src/vue/files.ts +53 -0
- package/src/vue/forms.ts +20 -0
- package/src/vue/global-components.ts +120 -3
- package/src/vue/index.ts +46 -2
- package/src/vue/inline-content.ts +71 -0
- package/src/vue/props.ts +258 -95
- package/src/vue/theme-provider.ts +74 -0
- package/src/vue/theme.ts +17 -6
- package/src/vue/toast.ts +99 -0
- package/src/vue/workflow-props.ts +41 -0
- package/src/vue/workflows.ts +257 -0
|
@@ -1,15 +1,25 @@
|
|
|
1
|
+
import type { AccordionPanelProps } from '../accordion.js'
|
|
2
|
+
import type { TabPanelProps } from '../tabs.js'
|
|
3
|
+
import type { CivilDate, DateRange, DateRangeDraft, DateValidation } from '../date.js'
|
|
4
|
+
import type { ChoiceValue, ChoiceOption } from '../choice.js'
|
|
1
5
|
import type { DefineComponent } from '@vue/runtime-core'
|
|
2
|
-
import type { ComponentProps } from './props.js'
|
|
6
|
+
import type { ComponentProps } from './component-props.js'
|
|
7
|
+
import type { DialogCloseReason } from '../dialog.js'
|
|
3
8
|
import type { SheetCloseReason } from '../sheet.js'
|
|
9
|
+
import type { InputHandle } from '../input.js'
|
|
4
10
|
|
|
5
11
|
type Action = { onClick?: () => void }
|
|
6
12
|
type Model = { 'onUpdate:modelValue'?: (value: number) => void }
|
|
7
13
|
type InputEvents = {
|
|
14
|
+
onAction?: () => void
|
|
8
15
|
'onUpdate:modelValue'?: (value: string) => void
|
|
9
16
|
onFocus?: () => void
|
|
10
17
|
onBlur?: () => void
|
|
11
18
|
onSubmit?: (value: string) => void
|
|
12
19
|
}
|
|
20
|
+
|
|
21
|
+
/** Additional input attributes supplied by a renderer, without DOM dependencies in core. */
|
|
22
|
+
export interface InputPlatformAttributes {}
|
|
13
23
|
type SheetEvents = {
|
|
14
24
|
'onUpdate:open'?: (value: boolean) => void
|
|
15
25
|
onClose?: (reason: SheetCloseReason) => void
|
|
@@ -19,15 +29,122 @@ type SheetEvents = {
|
|
|
19
29
|
/** Template props come from the same declarations used by both renderers. */
|
|
20
30
|
declare module '@vue/runtime-core' {
|
|
21
31
|
export interface GlobalComponents {
|
|
32
|
+
MThemeProvider: typeof import('./theme-provider.js').MThemeProvider
|
|
33
|
+
MSpan: typeof import('./inline-content.js').MSpan
|
|
34
|
+
MDatePicker: DefineComponent<
|
|
35
|
+
ComponentProps['MDatePicker'] & {
|
|
36
|
+
'onUpdate:modelValue'?: (value: CivilDate | null) => void
|
|
37
|
+
'onUpdate:draft'?: (value: string) => void
|
|
38
|
+
onValidityChange?: (value: DateValidation) => void
|
|
39
|
+
onFocus?: () => void
|
|
40
|
+
onBlur?: () => void
|
|
41
|
+
},
|
|
42
|
+
InputHandle
|
|
43
|
+
>
|
|
44
|
+
MDateRangePicker: DefineComponent<
|
|
45
|
+
ComponentProps['MDateRangePicker'] & {
|
|
46
|
+
'onUpdate:modelValue'?: (value: DateRange) => void
|
|
47
|
+
'onUpdate:draft'?: (value: DateRangeDraft) => void
|
|
48
|
+
onValidityChange?: (value: DateValidation) => void
|
|
49
|
+
onFocus?: () => void
|
|
50
|
+
onBlur?: () => void
|
|
51
|
+
},
|
|
52
|
+
InputHandle
|
|
53
|
+
>
|
|
54
|
+
MCombobox: DefineComponent<
|
|
55
|
+
ComponentProps['MCombobox'] & {
|
|
56
|
+
'onUpdate:modelValue'?: (value: ChoiceValue | null) => void
|
|
57
|
+
'onUpdate:query'?: (value: string) => void
|
|
58
|
+
onSelect?: (value: ChoiceOption | null) => void
|
|
59
|
+
onFocus?: () => void
|
|
60
|
+
onBlur?: () => void
|
|
61
|
+
},
|
|
62
|
+
InputHandle
|
|
63
|
+
>
|
|
64
|
+
MFilePicker: DefineComponent<ComponentProps['MFilePicker'], InputHandle>
|
|
65
|
+
MFormGroup: DefineComponent<ComponentProps['MFormGroup']>
|
|
66
|
+
MFormErrors: DefineComponent<
|
|
67
|
+
ComponentProps['MFormErrors'] & { onFocus?: (field: string, focused: boolean) => void }
|
|
68
|
+
>
|
|
69
|
+
MSteps: DefineComponent<
|
|
70
|
+
ComponentProps['MSteps'] & { 'onUpdate:modelValue'?: (value: ChoiceValue) => void }
|
|
71
|
+
>
|
|
72
|
+
MPagination: DefineComponent<
|
|
73
|
+
ComponentProps['MPagination'] & { 'onUpdate:modelValue'?: (value: number) => void }
|
|
74
|
+
>
|
|
22
75
|
MScreen: DefineComponent<ComponentProps['MScreen']>
|
|
23
76
|
MRow: DefineComponent<ComponentProps['MRow']>
|
|
24
77
|
MColumn: DefineComponent<ComponentProps['MColumn']>
|
|
25
78
|
MBox: DefineComponent<ComponentProps['MBox']>
|
|
26
79
|
MCard: DefineComponent<ComponentProps['MCard'] & Action>
|
|
27
80
|
MText: DefineComponent<ComponentProps['MText']>
|
|
28
|
-
MButton: DefineComponent<ComponentProps['MButton'] & Action>
|
|
81
|
+
MButton: DefineComponent<ComponentProps['MButton'] & Action> & {
|
|
82
|
+
new (): {
|
|
83
|
+
$slots: { default?: () => unknown; leading?: () => unknown; trailing?: () => unknown }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
29
86
|
MSlider: DefineComponent<ComponentProps['MSlider'] & Model>
|
|
30
|
-
|
|
87
|
+
MSwitch: DefineComponent<
|
|
88
|
+
ComponentProps['MSwitch'] & { 'onUpdate:modelValue'?: (value: boolean) => void }
|
|
89
|
+
>
|
|
90
|
+
MCheckbox: DefineComponent<
|
|
91
|
+
ComponentProps['MCheckbox'] & {
|
|
92
|
+
'onUpdate:modelValue'?: (value: boolean) => void
|
|
93
|
+
'onUpdate:indeterminate'?: (value: boolean) => void
|
|
94
|
+
}
|
|
95
|
+
>
|
|
96
|
+
MRadioGroup: DefineComponent<
|
|
97
|
+
ComponentProps['MRadioGroup'] & { 'onUpdate:modelValue'?: (value: ChoiceValue) => void }
|
|
98
|
+
>
|
|
99
|
+
MInput: DefineComponent<
|
|
100
|
+
ComponentProps['MInput'] & InputEvents & InputPlatformAttributes,
|
|
101
|
+
InputHandle
|
|
102
|
+
>
|
|
103
|
+
MSelect: DefineComponent<
|
|
104
|
+
ComponentProps['MSelect'] & { 'onUpdate:modelValue'?: (value: ChoiceValue) => void }
|
|
105
|
+
>
|
|
106
|
+
MTabs: DefineComponent<
|
|
107
|
+
ComponentProps['MTabs'] & { 'onUpdate:modelValue'?: (value: ChoiceValue) => void }
|
|
108
|
+
> & {
|
|
109
|
+
new (): { $slots: { default?: (props: TabPanelProps) => unknown } }
|
|
110
|
+
}
|
|
111
|
+
MListItem: DefineComponent<ComponentProps['MListItem'] & Action> & {
|
|
112
|
+
new (): { $slots: { leading?: () => unknown; trailing?: () => unknown } }
|
|
113
|
+
}
|
|
114
|
+
MSeparator: DefineComponent<ComponentProps['MSeparator']>
|
|
115
|
+
MAvatar: DefineComponent<ComponentProps['MAvatar']>
|
|
116
|
+
MBadge: DefineComponent<ComponentProps['MBadge']>
|
|
117
|
+
MSkeleton: DefineComponent<ComponentProps['MSkeleton']>
|
|
118
|
+
MChip: DefineComponent<
|
|
119
|
+
ComponentProps['MChip'] & {
|
|
120
|
+
'onUpdate:modelValue'?: (value: boolean) => void
|
|
121
|
+
onRemove?: () => void
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
MEmptyState: DefineComponent<ComponentProps['MEmptyState']> & {
|
|
125
|
+
new (): { $slots: { illustration?: () => unknown; actions?: () => unknown } }
|
|
126
|
+
}
|
|
127
|
+
MProgress: DefineComponent<ComponentProps['MProgress']>
|
|
128
|
+
MAccordion: DefineComponent<
|
|
129
|
+
ComponentProps['MAccordion'] & { 'onUpdate:modelValue'?: (value: ChoiceValue[]) => void }
|
|
130
|
+
> & {
|
|
131
|
+
new (): { $slots: { default?: (props: AccordionPanelProps) => unknown } }
|
|
132
|
+
}
|
|
133
|
+
MSegmentedControl: DefineComponent<
|
|
134
|
+
ComponentProps['MSegmentedControl'] & { 'onUpdate:modelValue'?: (value: ChoiceValue) => void }
|
|
135
|
+
>
|
|
136
|
+
|
|
137
|
+
MAlert: DefineComponent<ComponentProps['MAlert'] & { onClose?: () => void }> & {
|
|
138
|
+
new (): { $slots: { actions?: () => unknown } }
|
|
139
|
+
}
|
|
140
|
+
MToast: DefineComponent<ComponentProps['MToast']>
|
|
141
|
+
MDialog: DefineComponent<
|
|
142
|
+
ComponentProps['MDialog'] & {
|
|
143
|
+
'onUpdate:open'?: (value: boolean) => void
|
|
144
|
+
onConfirm?: () => void
|
|
145
|
+
onClose?: (reason: DialogCloseReason) => void
|
|
146
|
+
}
|
|
147
|
+
>
|
|
31
148
|
MIcon: DefineComponent<ComponentProps['MIcon']>
|
|
32
149
|
MReveal: DefineComponent<ComponentProps['MReveal']>
|
|
33
150
|
MSheet: DefineComponent<ComponentProps['MSheet'] & SheetEvents>
|
package/src/vue/index.ts
CHANGED
|
@@ -9,8 +9,10 @@ export type {
|
|
|
9
9
|
export { layoutDirection, useDefaultShrink } from './layout-context.js'
|
|
10
10
|
export { textContent } from './text-content.js'
|
|
11
11
|
export type {} from './global-components.js'
|
|
12
|
+
export type { InputPlatformAttributes } from './global-components.js'
|
|
12
13
|
export {
|
|
13
14
|
boxProps,
|
|
15
|
+
motionBoxProps,
|
|
14
16
|
spacingProp,
|
|
15
17
|
rowProps,
|
|
16
18
|
columnProps,
|
|
@@ -19,15 +21,57 @@ export {
|
|
|
19
21
|
textProps,
|
|
20
22
|
sliderProps,
|
|
21
23
|
inputProps,
|
|
24
|
+
switchProps,
|
|
25
|
+
checkboxProps,
|
|
26
|
+
checkboxEmits,
|
|
27
|
+
radioGroupProps,
|
|
28
|
+
radioGroupEmits,
|
|
29
|
+
selectProps,
|
|
30
|
+
selectEmits,
|
|
31
|
+
switchEmits,
|
|
22
32
|
inputEmits,
|
|
23
33
|
iconProps,
|
|
24
34
|
screenProps,
|
|
25
35
|
revealProps,
|
|
26
36
|
sheetProps,
|
|
27
37
|
sheetEmits,
|
|
28
|
-
componentProps,
|
|
29
38
|
viewAttrs,
|
|
30
39
|
actionEmits,
|
|
31
40
|
sliderEmits,
|
|
32
41
|
} from './props.js'
|
|
33
|
-
export type { BoxProps,
|
|
42
|
+
export type { BoxProps, Align, Justify } from './props.js'
|
|
43
|
+
|
|
44
|
+
export { useToast, useToastHost, installAppToast, useAppToastHost } from './toast.js'
|
|
45
|
+
export { toastProps } from './props.js'
|
|
46
|
+
|
|
47
|
+
export { useDialogState } from './dialog.js'
|
|
48
|
+
export { dialogProps, dialogEmits } from './props.js'
|
|
49
|
+
|
|
50
|
+
export { tabsProps, tabsEmits } from './props.js'
|
|
51
|
+
|
|
52
|
+
export { listItemProps, separatorProps, avatarProps, badgeProps, skeletonProps } from './props.js'
|
|
53
|
+
|
|
54
|
+
export { progressProps, alertProps, alertEmits } from './props.js'
|
|
55
|
+
|
|
56
|
+
export { accordionProps, accordionEmits, segmentedProps, segmentedEmits } from './props.js'
|
|
57
|
+
|
|
58
|
+
export { chipProps, chipEmits, emptyStateProps } from './props.js'
|
|
59
|
+
|
|
60
|
+
export { MThemeProvider, themeProviderProps } from './theme-provider.js'
|
|
61
|
+
export { MSpan, inlineContent } from './inline-content.js'
|
|
62
|
+
export type { TextRun } from './inline-content.js'
|
|
63
|
+
export { spanProps } from './props.js'
|
|
64
|
+
|
|
65
|
+
export { useCachedActivity } from './cached-activity.js'
|
|
66
|
+
export { buttonContent, ButtonAdornment, useButtonAction } from './button-content.js'
|
|
67
|
+
|
|
68
|
+
export { componentProps } from './component-props.js'
|
|
69
|
+
export type { ComponentProps } from './component-props.js'
|
|
70
|
+
export * from './date-props.js'
|
|
71
|
+
export * from './date-picker.js'
|
|
72
|
+
export * from './date-calendar.js'
|
|
73
|
+
export * from './combobox.js'
|
|
74
|
+
export * from './files.js'
|
|
75
|
+
export * from './forms.js'
|
|
76
|
+
export * from './workflow-props.js'
|
|
77
|
+
export * from './workflows.js'
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Comment, Fragment, Text, defineComponent, type VNode } from '@vue/runtime-core'
|
|
2
|
+
import type { FontWeight, Palette } from '../theme/types.js'
|
|
3
|
+
import { validateWeight } from '../theme/typography.js'
|
|
4
|
+
import { spanProps } from './props.js'
|
|
5
|
+
|
|
6
|
+
export interface TextRun {
|
|
7
|
+
text: string
|
|
8
|
+
weight?: FontWeight
|
|
9
|
+
tone?: keyof Palette
|
|
10
|
+
strong?: boolean
|
|
11
|
+
italic?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A declarative text run, consumed by MText before native/DOM views are created. */
|
|
15
|
+
export const MSpan = defineComponent({
|
|
16
|
+
name: 'MSpan',
|
|
17
|
+
inheritAttrs: false,
|
|
18
|
+
props: spanProps,
|
|
19
|
+
setup(): () => null {
|
|
20
|
+
throw new TypeError('MSpan must be inside MText or another MSpan')
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export function inlineContent(
|
|
25
|
+
nodes: VNode[] = [],
|
|
26
|
+
inherited: Omit<TextRun, 'text'> = {},
|
|
27
|
+
): TextRun[] {
|
|
28
|
+
const runs: TextRun[] = []
|
|
29
|
+
for (const node of Array.isArray(nodes) ? nodes : [nodes]) {
|
|
30
|
+
if (typeof node === 'string' || typeof node === 'number') {
|
|
31
|
+
runs.push({ ...inherited, text: String(node) })
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
if (!node || typeof node === 'boolean') continue
|
|
35
|
+
if (node.type === Comment) continue
|
|
36
|
+
if (node.type === Text) {
|
|
37
|
+
runs.push({ ...inherited, text: String(node.children ?? '') })
|
|
38
|
+
} else if (node.type === Fragment) {
|
|
39
|
+
runs.push(...inlineContent(node.children as VNode[], inherited))
|
|
40
|
+
} else if (node.type === MSpan) {
|
|
41
|
+
const props = node.props ?? {}
|
|
42
|
+
for (const key of Object.keys(props)) {
|
|
43
|
+
if (!['text', 'weight', 'tone', 'emphasis', 'key'].includes(key)) {
|
|
44
|
+
throw new TypeError(`MSpan does not accept ${key}; use text, weight, tone or emphasis`)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (props.emphasis !== undefined && !['strong', 'em'].includes(props.emphasis))
|
|
48
|
+
throw new RangeError('Unknown text emphasis')
|
|
49
|
+
const next = { ...inherited }
|
|
50
|
+
if (props.emphasis === 'strong') {
|
|
51
|
+
next.strong = true
|
|
52
|
+
next.weight = 'bold'
|
|
53
|
+
}
|
|
54
|
+
if (props.emphasis === 'em') next.italic = true
|
|
55
|
+
if (props.weight !== undefined) next.weight = validateWeight(props.weight)
|
|
56
|
+
if (props.tone !== undefined) next.tone = props.tone
|
|
57
|
+
const children = node.children as { default?: () => VNode[] } | VNode[] | null
|
|
58
|
+
if (props.text !== undefined) runs.push({ ...next, text: String(props.text) })
|
|
59
|
+
else if (typeof node.children === 'string') runs.push({ ...next, text: node.children })
|
|
60
|
+
else
|
|
61
|
+
runs.push(
|
|
62
|
+
...inlineContent(Array.isArray(children) ? children : children?.default?.(), next),
|
|
63
|
+
)
|
|
64
|
+
} else {
|
|
65
|
+
throw new TypeError(
|
|
66
|
+
'MText accepts text and MSpan. Use a layout for views; links have a separate navigation contract.',
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return runs
|
|
71
|
+
}
|