@getcortexlabs/mavis-core 0.1.0-alpha.1 → 0.1.0-alpha.10
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/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/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 +132 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +168 -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-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/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/collections.d.ts +46 -0
- package/dist/collections.d.ts.map +1 -0
- package/dist/collections.js +48 -0
- package/dist/collections.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 +1321 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +268 -0
- package/dist/contracts.js.map +1 -0
- package/dist/date-input.d.ts +10 -0
- package/dist/date-input.d.ts.map +1 -0
- package/dist/date-input.js +58 -0
- package/dist/date-input.js.map +1 -0
- package/dist/date-time.d.ts +19 -0
- package/dist/date-time.d.ts.map +1 -0
- package/dist/date-time.js +27 -0
- package/dist/date-time.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 +21 -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-collections.d.ts +82 -0
- package/dist/experimental-collections.d.ts.map +1 -0
- package/dist/experimental-collections.js +8 -0
- package/dist/experimental-collections.js.map +1 -0
- package/dist/experimental-effects.d.ts +107 -0
- package/dist/experimental-effects.d.ts.map +1 -0
- package/dist/experimental-effects.js +24 -0
- package/dist/experimental-effects.js.map +1 -0
- package/dist/experimental-platforms.d.ts +94 -0
- package/dist/experimental-platforms.d.ts.map +1 -0
- package/dist/experimental-platforms.js +2 -0
- package/dist/experimental-platforms.js.map +1 -0
- 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 +179 -0
- package/dist/experimental-regions.d.ts.map +1 -0
- package/dist/experimental-regions.js +554 -0
- package/dist/experimental-regions.js.map +1 -0
- package/dist/experimental-sensors.d.ts +42 -0
- package/dist/experimental-sensors.d.ts.map +1 -0
- package/dist/experimental-sensors.js +2 -0
- package/dist/experimental-sensors.js.map +1 -0
- package/dist/experimental-surfaces.d.ts +127 -0
- package/dist/experimental-surfaces.d.ts.map +1 -0
- package/dist/experimental-surfaces.js +2 -0
- package/dist/experimental-surfaces.js.map +1 -0
- package/dist/experimental.d.ts +197 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +855 -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/grid.d.ts +3 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +16 -0
- package/dist/grid.js.map +1 -0
- package/dist/icon.d.ts +15 -0
- package/dist/icon.d.ts.map +1 -0
- package/dist/icon.js +28 -0
- package/dist/icon.js.map +1 -0
- package/dist/icons.d.ts +2002 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +2003 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +56 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -1
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +14 -0
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +12 -0
- package/dist/input.js.map +1 -1
- package/dist/link.d.ts +36 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +60 -0
- package/dist/link.js.map +1 -0
- 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 +58 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +73 -0
- package/dist/motion.js.map +1 -0
- 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/navigation-transition.d.ts +10 -0
- package/dist/navigation-transition.d.ts.map +1 -0
- package/dist/navigation-transition.js +10 -0
- package/dist/navigation-transition.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/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/popover.d.ts +17 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +19 -0
- package/dist/popover.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/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/section-scroll.d.ts +14 -0
- package/dist/section-scroll.d.ts.map +1 -0
- package/dist/section-scroll.js +28 -0
- package/dist/section-scroll.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 +19 -0
- package/dist/sheet.d.ts.map +1 -0
- package/dist/sheet.js +15 -0
- package/dist/sheet.js.map +1 -0
- 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 +85 -12
- package/dist/theme/themes.js.map +1 -1
- package/dist/theme/types.d.ts +64 -4
- 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/time.d.ts +34 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/time.js +78 -0
- package/dist/time.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 +2853 -0
- package/dist/vue/component-props.d.ts.map +1 -0
- package/dist/vue/component-props.js +29 -0
- package/dist/vue/component-props.js.map +1 -0
- package/dist/vue/configurator-props.d.ts +277 -0
- package/dist/vue/configurator-props.d.ts.map +1 -0
- package/dist/vue/configurator-props.js +63 -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 +18 -0
- package/dist/vue/contracts.d.ts.map +1 -0
- package/dist/vue/contracts.js +24 -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 +1000 -0
- package/dist/vue/date-picker.d.ts.map +1 -0
- package/dist/vue/date-picker.js +334 -0
- package/dist/vue/date-picker.js.map +1 -0
- package/dist/vue/date-props.d.ts +272 -0
- package/dist/vue/date-props.d.ts.map +1 -0
- package/dist/vue/date-props.js +78 -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 +198 -3
- package/dist/vue/global-components.d.ts.map +1 -1
- package/dist/vue/index.d.ts +44 -4
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +36 -2
- 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/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/list-motion.d.ts +7 -0
- package/dist/vue/list-motion.d.ts.map +1 -0
- package/dist/vue/list-motion.js +28 -0
- package/dist/vue/list-motion.js.map +1 -0
- package/dist/vue/loading-effect.d.ts +7 -0
- package/dist/vue/loading-effect.d.ts.map +1 -0
- package/dist/vue/loading-effect.js +32 -0
- package/dist/vue/loading-effect.js.map +1 -0
- package/dist/vue/menu.d.ts +122 -0
- package/dist/vue/menu.d.ts.map +1 -0
- package/dist/vue/menu.js +79 -0
- package/dist/vue/menu.js.map +1 -0
- package/dist/vue/navigation-controls.d.ts +124 -0
- package/dist/vue/navigation-controls.d.ts.map +1 -0
- package/dist/vue/navigation-controls.js +117 -0
- package/dist/vue/navigation-controls.js.map +1 -0
- package/dist/vue/navigation-props.d.ts +283 -0
- package/dist/vue/navigation-props.d.ts.map +1 -0
- package/dist/vue/navigation-props.js +82 -0
- package/dist/vue/navigation-props.js.map +1 -0
- package/dist/vue/navigation.d.ts +7 -0
- package/dist/vue/navigation.d.ts.map +1 -0
- package/dist/vue/navigation.js +15 -0
- package/dist/vue/navigation.js.map +1 -0
- package/dist/vue/platform.d.ts +37 -0
- package/dist/vue/platform.d.ts.map +1 -0
- package/dist/vue/platform.js +46 -0
- package/dist/vue/platform.js.map +1 -0
- package/dist/vue/props.d.ts +3326 -510
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +314 -83
- 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-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 +1029 -19
- package/dist/vue/theme.d.ts.map +1 -1
- package/dist/vue/theme.js +47 -2
- package/dist/vue/theme.js.map +1 -1
- package/dist/vue/time-picker.d.ts +488 -0
- package/dist/vue/time-picker.d.ts.map +1 -0
- package/dist/vue/time-picker.js +190 -0
- package/dist/vue/time-picker.js.map +1 -0
- 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/virtual-list.d.ts +26 -0
- package/dist/vue/virtual-list.d.ts.map +1 -0
- package/dist/vue/virtual-list.js +2 -0
- package/dist/vue/virtual-list.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/app-icons.ts +57 -0
- package/src/avatar.ts +11 -0
- package/src/badge.ts +11 -0
- package/src/capabilities.ts +171 -0
- package/src/chip.ts +20 -0
- package/src/choice-motion.ts +12 -0
- package/src/choice.ts +41 -0
- package/src/collections.ts +87 -0
- package/src/combobox.ts +198 -0
- package/src/contracts.ts +324 -0
- package/src/date-input.ts +87 -0
- package/src/date-time.ts +37 -0
- package/src/date.ts +280 -0
- package/src/dialog.ts +22 -0
- package/src/empty-state.ts +4 -0
- package/src/experimental-collections.ts +87 -0
- package/src/experimental-effects.ts +146 -0
- package/src/experimental-platforms.ts +96 -0
- package/src/experimental-playback.ts +115 -0
- package/src/experimental-regions.ts +777 -0
- package/src/experimental-sensors.ts +50 -0
- package/src/experimental-surfaces.ts +124 -0
- package/src/experimental.ts +1102 -0
- package/src/files.ts +408 -0
- package/src/form.ts +190 -0
- package/src/grid.ts +19 -0
- package/src/icon.ts +30 -0
- package/src/icons.ts +2002 -0
- package/src/index.ts +88 -2
- package/src/input.ts +27 -0
- package/src/link.ts +91 -0
- package/src/list-item.ts +5 -0
- package/src/motion.ts +80 -0
- package/src/multi-select.ts +30 -0
- package/src/navigation-transition.ts +14 -0
- package/src/navigation.ts +61 -0
- package/src/number-input.ts +80 -0
- package/src/popover.ts +38 -0
- package/src/progress.ts +22 -0
- package/src/responsive.ts +61 -0
- package/src/section-scroll.ts +46 -0
- package/src/segmented.ts +39 -0
- package/src/sheet.ts +31 -0
- package/src/tabs.ts +35 -0
- package/src/theme/themes.ts +89 -12
- package/src/theme/types.ts +55 -2
- package/src/theme/typography.ts +84 -0
- package/src/time.ts +83 -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 +42 -0
- package/src/vue/configurator-props.ts +67 -0
- package/src/vue/configurator.ts +350 -0
- package/src/vue/contracts.ts +39 -0
- package/src/vue/date-calendar.ts +76 -0
- package/src/vue/date-picker.ts +410 -0
- package/src/vue/date-props.ts +86 -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 +182 -4
- package/src/vue/index.ts +84 -4
- package/src/vue/inline-content.ts +71 -0
- package/src/vue/layout-context.ts +10 -3
- package/src/vue/list-motion.ts +31 -0
- package/src/vue/loading-effect.ts +44 -0
- package/src/vue/menu.ts +100 -0
- package/src/vue/navigation-controls.ts +138 -0
- package/src/vue/navigation-props.ts +87 -0
- package/src/vue/navigation.ts +16 -0
- package/src/vue/platform.ts +73 -0
- package/src/vue/props.ts +348 -96
- package/src/vue/reveal-state.ts +83 -0
- package/src/vue/theme-provider.ts +74 -0
- package/src/vue/theme.ts +65 -3
- package/src/vue/time-picker.ts +227 -0
- package/src/vue/toast.ts +99 -0
- package/src/vue/virtual-list.ts +28 -0
- package/src/vue/workflow-props.ts +41 -0
- package/src/vue/workflows.ts +257 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { type Component } from '@vue/runtime-core';
|
|
2
|
+
import { type ChoiceValue } from '../choice.js';
|
|
3
|
+
interface Primitives {
|
|
4
|
+
Column: Component;
|
|
5
|
+
Row: Component;
|
|
6
|
+
Text: Component;
|
|
7
|
+
Button: Component;
|
|
8
|
+
preserveFocus?: (root: unknown, currentId: string) => () => void;
|
|
9
|
+
}
|
|
10
|
+
/** Composed controls share behavior; each supplied primitive owns its platform rendering. */
|
|
11
|
+
export declare function createWorkflows(ui: Primitives, platform: 'web' | 'native'): {
|
|
12
|
+
MFormGroup: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<{
|
|
13
|
+
label: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
description: {
|
|
18
|
+
type: StringConstructor;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
id: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
25
|
+
}>, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
}>, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
|
|
28
|
+
label: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
description: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
id: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
}>> & Readonly<{}>, {
|
|
41
|
+
id: string;
|
|
42
|
+
description: string;
|
|
43
|
+
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
|
|
44
|
+
MFormErrors: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<{
|
|
45
|
+
form: {
|
|
46
|
+
type: import("@vue/runtime-core").PropType<import("../form.js").FormController>;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
title: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
default: string;
|
|
52
|
+
};
|
|
53
|
+
announce: BooleanConstructor;
|
|
54
|
+
}>, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
55
|
+
[key: string]: any;
|
|
56
|
+
}> | null, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
|
|
57
|
+
focus: (_field: string, _focused: boolean) => true;
|
|
58
|
+
}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
|
|
59
|
+
form: {
|
|
60
|
+
type: import("@vue/runtime-core").PropType<import("../form.js").FormController>;
|
|
61
|
+
required: true;
|
|
62
|
+
};
|
|
63
|
+
title: {
|
|
64
|
+
type: StringConstructor;
|
|
65
|
+
default: string;
|
|
66
|
+
};
|
|
67
|
+
announce: BooleanConstructor;
|
|
68
|
+
}>> & Readonly<{
|
|
69
|
+
onFocus?: ((_field: string, _focused: boolean) => any) | undefined;
|
|
70
|
+
}>, {
|
|
71
|
+
title: string;
|
|
72
|
+
announce: boolean;
|
|
73
|
+
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
|
|
74
|
+
MSteps: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<{
|
|
75
|
+
steps: {
|
|
76
|
+
type: import("@vue/runtime-core").PropType<readonly import("../navigation.js").StepOption[]>;
|
|
77
|
+
required: true;
|
|
78
|
+
};
|
|
79
|
+
modelValue: {
|
|
80
|
+
type: import("@vue/runtime-core").PropType<ChoiceValue | null>;
|
|
81
|
+
default: null;
|
|
82
|
+
};
|
|
83
|
+
label: {
|
|
84
|
+
type: StringConstructor;
|
|
85
|
+
required: true;
|
|
86
|
+
};
|
|
87
|
+
disabled: BooleanConstructor;
|
|
88
|
+
loading: BooleanConstructor;
|
|
89
|
+
currentLabel: {
|
|
90
|
+
type: StringConstructor;
|
|
91
|
+
default: string;
|
|
92
|
+
};
|
|
93
|
+
completeLabel: {
|
|
94
|
+
type: StringConstructor;
|
|
95
|
+
default: string;
|
|
96
|
+
};
|
|
97
|
+
errorLabel: {
|
|
98
|
+
type: StringConstructor;
|
|
99
|
+
default: string;
|
|
100
|
+
};
|
|
101
|
+
}>, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
102
|
+
[key: string]: any;
|
|
103
|
+
}>, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
|
|
104
|
+
'update:modelValue': (_value: ChoiceValue) => true;
|
|
105
|
+
}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
|
|
106
|
+
steps: {
|
|
107
|
+
type: import("@vue/runtime-core").PropType<readonly import("../navigation.js").StepOption[]>;
|
|
108
|
+
required: true;
|
|
109
|
+
};
|
|
110
|
+
modelValue: {
|
|
111
|
+
type: import("@vue/runtime-core").PropType<ChoiceValue | null>;
|
|
112
|
+
default: null;
|
|
113
|
+
};
|
|
114
|
+
label: {
|
|
115
|
+
type: StringConstructor;
|
|
116
|
+
required: true;
|
|
117
|
+
};
|
|
118
|
+
disabled: BooleanConstructor;
|
|
119
|
+
loading: BooleanConstructor;
|
|
120
|
+
currentLabel: {
|
|
121
|
+
type: StringConstructor;
|
|
122
|
+
default: string;
|
|
123
|
+
};
|
|
124
|
+
completeLabel: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
default: string;
|
|
127
|
+
};
|
|
128
|
+
errorLabel: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
default: string;
|
|
131
|
+
};
|
|
132
|
+
}>> & Readonly<{
|
|
133
|
+
"onUpdate:modelValue"?: ((_value: ChoiceValue) => any) | undefined;
|
|
134
|
+
}>, {
|
|
135
|
+
loading: boolean;
|
|
136
|
+
disabled: boolean;
|
|
137
|
+
modelValue: ChoiceValue | null;
|
|
138
|
+
currentLabel: string;
|
|
139
|
+
errorLabel: string;
|
|
140
|
+
completeLabel: string;
|
|
141
|
+
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
|
|
142
|
+
MPagination: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<{
|
|
143
|
+
modelValue: {
|
|
144
|
+
type: NumberConstructor;
|
|
145
|
+
default: number;
|
|
146
|
+
};
|
|
147
|
+
total: {
|
|
148
|
+
type: NumberConstructor;
|
|
149
|
+
required: true;
|
|
150
|
+
};
|
|
151
|
+
pageSize: {
|
|
152
|
+
type: NumberConstructor;
|
|
153
|
+
default: number;
|
|
154
|
+
};
|
|
155
|
+
siblingCount: {
|
|
156
|
+
type: NumberConstructor;
|
|
157
|
+
default: number;
|
|
158
|
+
};
|
|
159
|
+
label: {
|
|
160
|
+
type: StringConstructor;
|
|
161
|
+
default: string;
|
|
162
|
+
};
|
|
163
|
+
previousLabel: {
|
|
164
|
+
type: StringConstructor;
|
|
165
|
+
default: string;
|
|
166
|
+
};
|
|
167
|
+
nextLabel: {
|
|
168
|
+
type: StringConstructor;
|
|
169
|
+
default: string;
|
|
170
|
+
};
|
|
171
|
+
pageLabel: {
|
|
172
|
+
type: StringConstructor;
|
|
173
|
+
default: string;
|
|
174
|
+
};
|
|
175
|
+
currentLabel: {
|
|
176
|
+
type: StringConstructor;
|
|
177
|
+
default: string;
|
|
178
|
+
};
|
|
179
|
+
statusText: {
|
|
180
|
+
type: StringConstructor;
|
|
181
|
+
default: string;
|
|
182
|
+
};
|
|
183
|
+
emptyLabel: {
|
|
184
|
+
type: StringConstructor;
|
|
185
|
+
default: string;
|
|
186
|
+
};
|
|
187
|
+
invalidPageLabel: {
|
|
188
|
+
type: StringConstructor;
|
|
189
|
+
default: string;
|
|
190
|
+
};
|
|
191
|
+
loading: BooleanConstructor;
|
|
192
|
+
disabled: BooleanConstructor;
|
|
193
|
+
}>, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
|
|
194
|
+
[key: string]: any;
|
|
195
|
+
}>, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
|
|
196
|
+
'update:modelValue': (_page: number) => true;
|
|
197
|
+
}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
|
|
198
|
+
modelValue: {
|
|
199
|
+
type: NumberConstructor;
|
|
200
|
+
default: number;
|
|
201
|
+
};
|
|
202
|
+
total: {
|
|
203
|
+
type: NumberConstructor;
|
|
204
|
+
required: true;
|
|
205
|
+
};
|
|
206
|
+
pageSize: {
|
|
207
|
+
type: NumberConstructor;
|
|
208
|
+
default: number;
|
|
209
|
+
};
|
|
210
|
+
siblingCount: {
|
|
211
|
+
type: NumberConstructor;
|
|
212
|
+
default: number;
|
|
213
|
+
};
|
|
214
|
+
label: {
|
|
215
|
+
type: StringConstructor;
|
|
216
|
+
default: string;
|
|
217
|
+
};
|
|
218
|
+
previousLabel: {
|
|
219
|
+
type: StringConstructor;
|
|
220
|
+
default: string;
|
|
221
|
+
};
|
|
222
|
+
nextLabel: {
|
|
223
|
+
type: StringConstructor;
|
|
224
|
+
default: string;
|
|
225
|
+
};
|
|
226
|
+
pageLabel: {
|
|
227
|
+
type: StringConstructor;
|
|
228
|
+
default: string;
|
|
229
|
+
};
|
|
230
|
+
currentLabel: {
|
|
231
|
+
type: StringConstructor;
|
|
232
|
+
default: string;
|
|
233
|
+
};
|
|
234
|
+
statusText: {
|
|
235
|
+
type: StringConstructor;
|
|
236
|
+
default: string;
|
|
237
|
+
};
|
|
238
|
+
emptyLabel: {
|
|
239
|
+
type: StringConstructor;
|
|
240
|
+
default: string;
|
|
241
|
+
};
|
|
242
|
+
invalidPageLabel: {
|
|
243
|
+
type: StringConstructor;
|
|
244
|
+
default: string;
|
|
245
|
+
};
|
|
246
|
+
loading: BooleanConstructor;
|
|
247
|
+
disabled: BooleanConstructor;
|
|
248
|
+
}>> & Readonly<{
|
|
249
|
+
"onUpdate:modelValue"?: ((_page: number) => any) | undefined;
|
|
250
|
+
}>, {
|
|
251
|
+
label: string;
|
|
252
|
+
loading: boolean;
|
|
253
|
+
disabled: boolean;
|
|
254
|
+
modelValue: number;
|
|
255
|
+
emptyLabel: string;
|
|
256
|
+
currentLabel: string;
|
|
257
|
+
pageSize: number;
|
|
258
|
+
siblingCount: number;
|
|
259
|
+
previousLabel: string;
|
|
260
|
+
nextLabel: string;
|
|
261
|
+
pageLabel: string;
|
|
262
|
+
statusText: string;
|
|
263
|
+
invalidPageLabel: string;
|
|
264
|
+
}, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
|
|
265
|
+
};
|
|
266
|
+
export {};
|
|
267
|
+
//# sourceMappingURL=workflows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/vue/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAK1D,UAAU,UAAU;IAClB,MAAM,EAAE,SAAS,CAAA;IACjB,GAAG,EAAE,SAAS,CAAA;IACd,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,EAAE,SAAS,CAAA;IACjB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,IAAI,CAAA;CACjE;AAED,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,GAAG,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsC7C,MAAM,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAuDX,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAuDZ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiF/C"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { defineComponent, h, mergeProps, shallowRef, watch, onScopeDispose, onBeforeUpdate, onUpdated, nextTick, useId, } from '@vue/runtime-core';
|
|
2
|
+
import { choiceKey } from '../choice.js';
|
|
3
|
+
import { pagination, validateSteps } from '../navigation.js';
|
|
4
|
+
import { formErrorsProps, formGroupProps, stepsProps, paginationProps } from './workflow-props.js';
|
|
5
|
+
import { useMavisTheme } from './theme.js';
|
|
6
|
+
/** Composed controls share behavior; each supplied primitive owns its platform rendering. */
|
|
7
|
+
export function createWorkflows(ui, platform) {
|
|
8
|
+
const MFormGroup = defineComponent({
|
|
9
|
+
name: 'MFormGroup',
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: formGroupProps,
|
|
12
|
+
setup(props, { attrs, slots }) {
|
|
13
|
+
const generatedId = `m-form-group-${useId()}`;
|
|
14
|
+
return () => {
|
|
15
|
+
if (!props.label.trim())
|
|
16
|
+
throw new TypeError('Form groups require a visible label.');
|
|
17
|
+
const id = props.id ?? generatedId;
|
|
18
|
+
return h(ui.Column, mergeProps({ gap: 'md', id }, attrs, platform === 'web'
|
|
19
|
+
? {
|
|
20
|
+
role: 'group',
|
|
21
|
+
'aria-labelledby': `${id}-label`,
|
|
22
|
+
'aria-describedby': props.description ? `${id}-description` : undefined,
|
|
23
|
+
}
|
|
24
|
+
: {}), () => [
|
|
25
|
+
h(ui.Text, { id: `${id}-label`, as: 'h2', variant: 'heading', text: props.label }),
|
|
26
|
+
props.description
|
|
27
|
+
? h(ui.Text, { id: `${id}-description`, tone: 'muted', text: props.description })
|
|
28
|
+
: null,
|
|
29
|
+
slots.default?.(),
|
|
30
|
+
]);
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const MFormErrors = defineComponent({
|
|
35
|
+
name: 'MFormErrors',
|
|
36
|
+
inheritAttrs: false,
|
|
37
|
+
props: formErrorsProps,
|
|
38
|
+
emits: { focus: (_field, _focused) => true },
|
|
39
|
+
setup(props, { attrs, emit }) {
|
|
40
|
+
const { theme } = useMavisTheme();
|
|
41
|
+
const id = `m-form-errors-${useId()}`;
|
|
42
|
+
const revision = shallowRef(0);
|
|
43
|
+
let release;
|
|
44
|
+
watch(() => props.form, (form) => {
|
|
45
|
+
release?.();
|
|
46
|
+
release = form.subscribe(() => {
|
|
47
|
+
revision.value++;
|
|
48
|
+
});
|
|
49
|
+
revision.value++;
|
|
50
|
+
}, { immediate: true });
|
|
51
|
+
onScopeDispose(() => release?.());
|
|
52
|
+
return () => {
|
|
53
|
+
void revision.value;
|
|
54
|
+
const { errors } = props.form.state;
|
|
55
|
+
if (!errors.length)
|
|
56
|
+
return null;
|
|
57
|
+
return h(ui.Column, mergeProps({ gap: 'sm', padding: 'md', radius: 'md', backgroundColor: theme.value.colors.surface }, attrs, platform === 'web'
|
|
58
|
+
? { role: props.announce ? 'alert' : 'region', 'aria-labelledby': id }
|
|
59
|
+
: {}), () => [
|
|
60
|
+
h(ui.Text, { id, as: 'h2', variant: 'heading', tone: 'danger', text: props.title }),
|
|
61
|
+
...errors.map((error, index) => h(ui.Button, {
|
|
62
|
+
key: `${error.field}:${index}`,
|
|
63
|
+
variant: 'ghost',
|
|
64
|
+
disabled: !props.form.has(error.field),
|
|
65
|
+
text: props.form.label(error.field)
|
|
66
|
+
? `${props.form.label(error.field)}: ${error.message}`
|
|
67
|
+
: error.message,
|
|
68
|
+
onClick: async () => {
|
|
69
|
+
emit('focus', error.field, await props.form.focusError(error.field));
|
|
70
|
+
},
|
|
71
|
+
})),
|
|
72
|
+
]);
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const MSteps = defineComponent({
|
|
77
|
+
name: 'MSteps',
|
|
78
|
+
inheritAttrs: false,
|
|
79
|
+
props: stepsProps,
|
|
80
|
+
emits: { 'update:modelValue': (_value) => true },
|
|
81
|
+
setup(props, { attrs, emit }) {
|
|
82
|
+
return () => {
|
|
83
|
+
if (!props.label.trim())
|
|
84
|
+
throw new TypeError('Steps require a navigation label.');
|
|
85
|
+
validateSteps(props.steps, props.modelValue);
|
|
86
|
+
return h(ui.Row, mergeProps({ gap: 'sm', wrap: true }, attrs, platform === 'web' ? { role: 'navigation', 'aria-label': props.label } : {}), () => props.steps.map((step, index) => {
|
|
87
|
+
const current = step.value === props.modelValue;
|
|
88
|
+
const status = [
|
|
89
|
+
current ? props.currentLabel : '',
|
|
90
|
+
step.status === 'error'
|
|
91
|
+
? props.errorLabel
|
|
92
|
+
: step.status === 'complete'
|
|
93
|
+
? props.completeLabel
|
|
94
|
+
: '',
|
|
95
|
+
]
|
|
96
|
+
.filter(Boolean)
|
|
97
|
+
.join(' · ');
|
|
98
|
+
return h(ui.Column, { key: choiceKey(step.value), gap: 'xs', grow: 1 }, () => [
|
|
99
|
+
h(ui.Button, {
|
|
100
|
+
text: `${index + 1}. ${step.label}`,
|
|
101
|
+
variant: current ? 'primary' : 'secondary',
|
|
102
|
+
disabled: props.disabled || step.disabled || (props.loading && !current),
|
|
103
|
+
loading: props.loading && current,
|
|
104
|
+
accessibilityLabel: `${index + 1}. ${step.label}${status ? `. ${status}` : ''}`,
|
|
105
|
+
...(platform === 'web' ? { 'aria-current': current ? 'step' : undefined } : {}),
|
|
106
|
+
onClick: () => {
|
|
107
|
+
if (!props.disabled && !props.loading && !step.disabled && !current)
|
|
108
|
+
emit('update:modelValue', step.value);
|
|
109
|
+
},
|
|
110
|
+
}),
|
|
111
|
+
status
|
|
112
|
+
? h(ui.Text, {
|
|
113
|
+
variant: 'caption',
|
|
114
|
+
tone: step.status === 'error' ? 'danger' : 'muted',
|
|
115
|
+
text: status,
|
|
116
|
+
})
|
|
117
|
+
: null,
|
|
118
|
+
]);
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
const MPagination = defineComponent({
|
|
124
|
+
name: 'MPagination',
|
|
125
|
+
inheritAttrs: false,
|
|
126
|
+
props: paginationProps,
|
|
127
|
+
emits: { 'update:modelValue': (_page) => true },
|
|
128
|
+
setup(props, { attrs, emit }) {
|
|
129
|
+
const root = shallowRef();
|
|
130
|
+
const id = `m-pagination-${useId()}`;
|
|
131
|
+
let restore = () => { };
|
|
132
|
+
onBeforeUpdate(() => {
|
|
133
|
+
restore = ui.preserveFocus?.(root.value, `${id}-page-${props.modelValue}`) ?? (() => { });
|
|
134
|
+
});
|
|
135
|
+
onUpdated(() => {
|
|
136
|
+
const apply = restore;
|
|
137
|
+
void nextTick(apply);
|
|
138
|
+
});
|
|
139
|
+
const request = (page) => {
|
|
140
|
+
if (page !== null && page !== props.modelValue && !props.disabled && !props.loading)
|
|
141
|
+
emit('update:modelValue', page);
|
|
142
|
+
};
|
|
143
|
+
return () => {
|
|
144
|
+
if (!props.label.trim())
|
|
145
|
+
throw new TypeError('Pagination requires a navigation label.');
|
|
146
|
+
const state = pagination(props.total, props.pageSize, props.modelValue, props.siblingCount);
|
|
147
|
+
return h(ui.Column, mergeProps({ gap: 'sm', ref: root }, attrs, platform === 'web' ? { role: 'navigation', 'aria-label': props.label } : {}), () => [
|
|
148
|
+
props.statusText
|
|
149
|
+
? h(ui.Text, {
|
|
150
|
+
text: props.statusText,
|
|
151
|
+
variant: 'caption',
|
|
152
|
+
tone: 'muted',
|
|
153
|
+
...(platform === 'web'
|
|
154
|
+
? { role: 'status', 'aria-live': 'polite', 'aria-atomic': 'true' }
|
|
155
|
+
: { accessibilityLiveRegion: 'polite' }),
|
|
156
|
+
})
|
|
157
|
+
: null,
|
|
158
|
+
state.count === 0 ? h(ui.Text, { tone: 'muted', text: props.emptyLabel }) : null,
|
|
159
|
+
state.outOfRange ? h(ui.Text, { tone: 'danger', text: props.invalidPageLabel }) : null,
|
|
160
|
+
h(ui.Row, { gap: 'sm', wrap: true }, () => [
|
|
161
|
+
h(ui.Button, {
|
|
162
|
+
variant: 'secondary',
|
|
163
|
+
text: props.previousLabel,
|
|
164
|
+
disabled: props.disabled || state.previous === null,
|
|
165
|
+
loading: props.loading,
|
|
166
|
+
loadingText: props.previousLabel,
|
|
167
|
+
onClick: () => request(state.previous),
|
|
168
|
+
}),
|
|
169
|
+
...state.items.map((item) => item.kind === 'gap'
|
|
170
|
+
? h(ui.Text, { key: item.key, text: '…', accessibilityHidden: true })
|
|
171
|
+
: h(ui.Button, {
|
|
172
|
+
key: item.page,
|
|
173
|
+
text: String(item.page),
|
|
174
|
+
accessibilityLabel: `${props.pageLabel} ${item.page}${platform === 'native' && item.page === props.modelValue ? `. ${props.currentLabel}` : ''}`,
|
|
175
|
+
variant: item.page === props.modelValue ? 'primary' : 'ghost',
|
|
176
|
+
id: `${id}-page-${item.page}`,
|
|
177
|
+
disabled: props.disabled,
|
|
178
|
+
loading: props.loading,
|
|
179
|
+
loadingText: String(item.page),
|
|
180
|
+
...(platform === 'web'
|
|
181
|
+
? { 'aria-current': item.page === props.modelValue ? 'page' : undefined }
|
|
182
|
+
: {}),
|
|
183
|
+
onClick: () => request(item.page),
|
|
184
|
+
})),
|
|
185
|
+
h(ui.Button, {
|
|
186
|
+
variant: 'secondary',
|
|
187
|
+
text: props.nextLabel,
|
|
188
|
+
disabled: props.disabled || state.next === null,
|
|
189
|
+
loading: props.loading,
|
|
190
|
+
loadingText: props.nextLabel,
|
|
191
|
+
onClick: () => request(state.next),
|
|
192
|
+
}),
|
|
193
|
+
]),
|
|
194
|
+
]);
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
return { MFormGroup, MFormErrors, MSteps, MPagination };
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=workflows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../../src/vue/workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,UAAU,EACV,UAAU,EACV,KAAK,EACL,cAAc,EACd,cAAc,EACd,SAAS,EACT,QAAQ,EACR,KAAK,GAEN,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,SAAS,EAAoB,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,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json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getcortexlabs/mavis-core",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Shared Mavis themes and component contracts.",
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"./vue": {
|
|
13
13
|
"types": "./dist/vue/index.d.ts",
|
|
14
14
|
"default": "./dist/vue/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./experimental": {
|
|
17
|
+
"types": "./dist/experimental.d.ts",
|
|
18
|
+
"default": "./dist/experimental.js"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"files": [
|
package/src/accordion.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isChoiceValue, type ChoiceValue } from './choice.js'
|
|
2
|
+
import type { IconName } from './icon.js'
|
|
3
|
+
|
|
4
|
+
export interface AccordionItem {
|
|
5
|
+
value: ChoiceValue
|
|
6
|
+
title: string
|
|
7
|
+
description?: string
|
|
8
|
+
icon?: IconName
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
}
|
|
11
|
+
export interface AccordionPanelProps {
|
|
12
|
+
item: AccordionItem
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function validateAccordion(
|
|
16
|
+
items: readonly AccordionItem[],
|
|
17
|
+
expanded: readonly ChoiceValue[],
|
|
18
|
+
multiple: boolean,
|
|
19
|
+
label: string,
|
|
20
|
+
expandedLabel: string,
|
|
21
|
+
collapsedLabel: string,
|
|
22
|
+
) {
|
|
23
|
+
for (const [name, text] of Object.entries({ label, expandedLabel, collapsedLabel })) {
|
|
24
|
+
if (typeof text !== 'string' || !text.trim())
|
|
25
|
+
throw new TypeError(`Accordion ${name} must be a non-empty string.`)
|
|
26
|
+
}
|
|
27
|
+
const seen = new Set<ChoiceValue>()
|
|
28
|
+
for (const item of items) {
|
|
29
|
+
if (!item || !isChoiceValue(item.value) || typeof item.title !== 'string' || !item.title.trim())
|
|
30
|
+
throw new TypeError('Each accordion item needs a string/finite number value and a title.')
|
|
31
|
+
if (seen.has(item.value)) throw new RangeError(`Duplicate accordion item: ${item.value}`)
|
|
32
|
+
seen.add(item.value)
|
|
33
|
+
}
|
|
34
|
+
if (!Array.isArray(expanded) || expanded.some((value) => !isChoiceValue(value)))
|
|
35
|
+
throw new TypeError('Accordion modelValue must be an array of string/finite number values.')
|
|
36
|
+
if (new Set(expanded).size !== expanded.length)
|
|
37
|
+
throw new RangeError('Accordion expanded values must be unique.')
|
|
38
|
+
if (!multiple && expanded.length > 1)
|
|
39
|
+
throw new RangeError('Accordion allows at most one expanded value unless multiple is true.')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The caller applies the returned array; the input is never mutated. */
|
|
43
|
+
export function toggleAccordion(
|
|
44
|
+
item: AccordionItem,
|
|
45
|
+
expanded: readonly ChoiceValue[],
|
|
46
|
+
multiple: boolean,
|
|
47
|
+
disabled = false,
|
|
48
|
+
): ChoiceValue[] | undefined {
|
|
49
|
+
if (disabled || item.disabled) return
|
|
50
|
+
if (expanded.includes(item.value)) return expanded.filter((value) => value !== item.value)
|
|
51
|
+
return multiple ? [...expanded, item.value] : [item.value]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function accordionFocusTarget(
|
|
55
|
+
items: readonly AccordionItem[],
|
|
56
|
+
value: ChoiceValue,
|
|
57
|
+
key: string,
|
|
58
|
+
): AccordionItem | undefined {
|
|
59
|
+
const enabled = items.filter((item) => !item.disabled)
|
|
60
|
+
if (key === 'Home') return enabled[0]
|
|
61
|
+
if (key === 'End') return enabled[enabled.length - 1]
|
|
62
|
+
if (key !== 'ArrowDown' && key !== 'ArrowUp') return
|
|
63
|
+
const index = enabled.findIndex((item) => item.value === value)
|
|
64
|
+
const step = key === 'ArrowDown' ? 1 : -1
|
|
65
|
+
return enabled[(index + step + enabled.length) % enabled.length]
|
|
66
|
+
}
|
package/src/alert.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IconName } from './icon.js'
|
|
2
|
+
|
|
3
|
+
export type AlertTone = 'info' | 'success' | 'warning' | 'error'
|
|
4
|
+
export const alertAppearance = {
|
|
5
|
+
info: { icon: 'info', tone: 'accent' },
|
|
6
|
+
success: { icon: 'circle-check', tone: 'success' },
|
|
7
|
+
warning: { icon: 'triangle-alert', tone: 'warning' },
|
|
8
|
+
error: { icon: 'circle-alert', tone: 'danger' },
|
|
9
|
+
} as const satisfies Record<AlertTone, { icon: IconName; tone: string }>
|
|
10
|
+
|
|
11
|
+
export function checkAlertLabels(title: string, dismissible: boolean, closeLabel: string) {
|
|
12
|
+
if (typeof title !== 'string' || !title.trim())
|
|
13
|
+
throw new TypeError('Alert title must be a non-empty string')
|
|
14
|
+
if (dismissible && (typeof closeLabel !== 'string' || !closeLabel.trim()))
|
|
15
|
+
throw new TypeError('A dismissible Alert needs a non-empty closeLabel')
|
|
16
|
+
}
|
package/src/app-icons.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface AppIconChoice {
|
|
2
|
+
id: string
|
|
3
|
+
label: string
|
|
4
|
+
}
|
|
5
|
+
export interface AppIconAdapter {
|
|
6
|
+
supported(): boolean
|
|
7
|
+
current(): string | undefined
|
|
8
|
+
select(id: string): Promise<void>
|
|
9
|
+
}
|
|
10
|
+
export class AppIconError extends Error {
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly code: 'unsupported' | 'configuration' | 'unknown-icon' | 'platform',
|
|
13
|
+
message: string,
|
|
14
|
+
options?: ErrorOptions,
|
|
15
|
+
) {
|
|
16
|
+
super(message, options)
|
|
17
|
+
this.name = 'AppIconError'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The OS stores selection. Requests are serialized; a rejected request does not block later ones. */
|
|
22
|
+
export function createAppIconController(
|
|
23
|
+
choices: readonly AppIconChoice[],
|
|
24
|
+
primary: string,
|
|
25
|
+
adapter: AppIconAdapter,
|
|
26
|
+
) {
|
|
27
|
+
const ids = new Set<string>()
|
|
28
|
+
for (const choice of choices) {
|
|
29
|
+
if (!choice.id.trim() || !choice.label.trim() || ids.has(choice.id))
|
|
30
|
+
throw new AppIconError('configuration', 'App icons need unique IDs and visible labels.')
|
|
31
|
+
ids.add(choice.id)
|
|
32
|
+
}
|
|
33
|
+
if (!ids.has(primary))
|
|
34
|
+
throw new AppIconError('configuration', 'The primary icon must be configured.')
|
|
35
|
+
let pending = Promise.resolve()
|
|
36
|
+
const select = (id: string): Promise<void> => {
|
|
37
|
+
if (!ids.has(id))
|
|
38
|
+
return Promise.reject(new AppIconError('unknown-icon', `Unknown app icon: ${id}`))
|
|
39
|
+
const task = pending.then(async () => {
|
|
40
|
+
if (!adapter.supported())
|
|
41
|
+
throw new AppIconError('unsupported', 'This runtime cannot change its launcher icon.')
|
|
42
|
+
if (adapter.current() === id) return
|
|
43
|
+
await adapter.select(id)
|
|
44
|
+
})
|
|
45
|
+
pending = task.catch(() => {})
|
|
46
|
+
return task
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
choices: Object.freeze(choices.map((choice) => Object.freeze({ ...choice }))),
|
|
50
|
+
primary,
|
|
51
|
+
supported: () => adapter.supported(),
|
|
52
|
+
current: () => adapter.current(),
|
|
53
|
+
select,
|
|
54
|
+
reset: () => select(primary),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export type AppIconController = ReturnType<typeof createAppIconController>
|
package/src/avatar.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const avatarSizes = { sm: 32, md: 48, lg: 64, xl: 96 } as const
|
|
2
|
+
export type AvatarSize = keyof typeof avatarSizes
|
|
3
|
+
|
|
4
|
+
/** First and last words, normalized before extracting Unicode code points. */
|
|
5
|
+
export function avatarInitials(name: string): string {
|
|
6
|
+
const words = name.trim().normalize('NFC').split(/\s+/).filter(Boolean)
|
|
7
|
+
if (!words.length) return ''
|
|
8
|
+
const first = Array.from(words[0]!)[0]!
|
|
9
|
+
const last = words.length > 1 ? Array.from(words.at(-1)!)[0]! : ''
|
|
10
|
+
return (first + last).toUpperCase()
|
|
11
|
+
}
|