@getcortexlabs/mavis-core 0.1.0-alpha.4 → 0.1.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/README.md +2 -2
  2. package/dist/app-icons.d.ts +27 -0
  3. package/dist/app-icons.d.ts.map +1 -0
  4. package/dist/app-icons.js +42 -0
  5. package/dist/app-icons.js.map +1 -0
  6. package/dist/capabilities.d.ts +119 -0
  7. package/dist/capabilities.d.ts.map +1 -0
  8. package/dist/capabilities.js +144 -0
  9. package/dist/capabilities.js.map +1 -0
  10. package/dist/combobox.d.ts +42 -0
  11. package/dist/combobox.d.ts.map +1 -0
  12. package/dist/combobox.js +159 -0
  13. package/dist/combobox.js.map +1 -0
  14. package/dist/contracts.d.ts +1261 -0
  15. package/dist/contracts.d.ts.map +1 -0
  16. package/dist/contracts.js +249 -0
  17. package/dist/contracts.js.map +1 -0
  18. package/dist/date.d.ts +96 -0
  19. package/dist/date.d.ts.map +1 -0
  20. package/dist/date.js +235 -0
  21. package/dist/date.js.map +1 -0
  22. package/dist/experimental-playback.d.ts +63 -0
  23. package/dist/experimental-playback.d.ts.map +1 -0
  24. package/dist/experimental-playback.js +46 -0
  25. package/dist/experimental-playback.js.map +1 -0
  26. package/dist/experimental-regions.d.ts +154 -0
  27. package/dist/experimental-regions.d.ts.map +1 -0
  28. package/dist/experimental-regions.js +440 -0
  29. package/dist/experimental-regions.js.map +1 -0
  30. package/dist/experimental.d.ts +42 -3
  31. package/dist/experimental.d.ts.map +1 -1
  32. package/dist/experimental.js +200 -30
  33. package/dist/experimental.js.map +1 -1
  34. package/dist/files.d.ts +87 -0
  35. package/dist/files.d.ts.map +1 -0
  36. package/dist/files.js +328 -0
  37. package/dist/files.js.map +1 -0
  38. package/dist/form.d.ts +39 -0
  39. package/dist/form.d.ts.map +1 -0
  40. package/dist/form.js +170 -0
  41. package/dist/form.js.map +1 -0
  42. package/dist/index.d.ts +14 -2
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +11 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/link.d.ts +12 -0
  47. package/dist/link.d.ts.map +1 -0
  48. package/dist/link.js +19 -0
  49. package/dist/link.js.map +1 -0
  50. package/dist/motion.d.ts +29 -4
  51. package/dist/motion.d.ts.map +1 -1
  52. package/dist/motion.js +55 -3
  53. package/dist/motion.js.map +1 -1
  54. package/dist/navigation.d.ts +22 -0
  55. package/dist/navigation.d.ts.map +1 -0
  56. package/dist/navigation.js +54 -0
  57. package/dist/navigation.js.map +1 -0
  58. package/dist/responsive.d.ts +18 -0
  59. package/dist/responsive.d.ts.map +1 -0
  60. package/dist/responsive.js +35 -0
  61. package/dist/responsive.js.map +1 -0
  62. package/dist/theme/themes.js +3 -3
  63. package/dist/theme/themes.js.map +1 -1
  64. package/dist/theme/types.d.ts +12 -3
  65. package/dist/theme/types.d.ts.map +1 -1
  66. package/dist/vue/combobox.d.ts +155 -0
  67. package/dist/vue/combobox.d.ts.map +1 -0
  68. package/dist/vue/combobox.js +195 -0
  69. package/dist/vue/combobox.js.map +1 -0
  70. package/dist/vue/component-props.d.ts +2176 -0
  71. package/dist/vue/component-props.d.ts.map +1 -0
  72. package/dist/vue/component-props.js +18 -0
  73. package/dist/vue/component-props.js.map +1 -0
  74. package/dist/vue/contracts.d.ts +18 -0
  75. package/dist/vue/contracts.d.ts.map +1 -0
  76. package/dist/vue/contracts.js +24 -0
  77. package/dist/vue/contracts.js.map +1 -0
  78. package/dist/vue/date-calendar.d.ts +64 -0
  79. package/dist/vue/date-calendar.d.ts.map +1 -0
  80. package/dist/vue/date-calendar.js +65 -0
  81. package/dist/vue/date-calendar.js.map +1 -0
  82. package/dist/vue/date-picker.d.ts +965 -0
  83. package/dist/vue/date-picker.d.ts.map +1 -0
  84. package/dist/vue/date-picker.js +341 -0
  85. package/dist/vue/date-picker.js.map +1 -0
  86. package/dist/vue/date-props.d.ts +263 -0
  87. package/dist/vue/date-props.d.ts.map +1 -0
  88. package/dist/vue/date-props.js +77 -0
  89. package/dist/vue/date-props.js.map +1 -0
  90. package/dist/vue/files.d.ts +53 -0
  91. package/dist/vue/files.d.ts.map +1 -0
  92. package/dist/vue/files.js +40 -0
  93. package/dist/vue/files.js.map +1 -0
  94. package/dist/vue/forms.d.ts +4 -0
  95. package/dist/vue/forms.d.ts.map +1 -0
  96. package/dist/vue/forms.js +15 -0
  97. package/dist/vue/forms.js.map +1 -0
  98. package/dist/vue/global-components.d.ts +40 -2
  99. package/dist/vue/global-components.d.ts.map +1 -1
  100. package/dist/vue/index.d.ts +15 -3
  101. package/dist/vue/index.d.ts.map +1 -1
  102. package/dist/vue/index.js +12 -2
  103. package/dist/vue/index.js.map +1 -1
  104. package/dist/vue/inline-content.d.ts +3 -1
  105. package/dist/vue/inline-content.d.ts.map +1 -1
  106. package/dist/vue/layout-context.d.ts +4 -2
  107. package/dist/vue/layout-context.d.ts.map +1 -1
  108. package/dist/vue/layout-context.js +7 -2
  109. package/dist/vue/layout-context.js.map +1 -1
  110. package/dist/vue/props.d.ts +1392 -496
  111. package/dist/vue/props.d.ts.map +1 -1
  112. package/dist/vue/props.js +39 -116
  113. package/dist/vue/props.js.map +1 -1
  114. package/dist/vue/reveal-state.d.ts +18 -0
  115. package/dist/vue/reveal-state.d.ts.map +1 -0
  116. package/dist/vue/reveal-state.js +76 -0
  117. package/dist/vue/reveal-state.js.map +1 -0
  118. package/dist/vue/theme.d.ts +42 -0
  119. package/dist/vue/theme.d.ts.map +1 -1
  120. package/dist/vue/workflow-props.d.ts +110 -0
  121. package/dist/vue/workflow-props.d.ts.map +1 -0
  122. package/dist/vue/workflow-props.js +37 -0
  123. package/dist/vue/workflow-props.js.map +1 -0
  124. package/dist/vue/workflows.d.ts +267 -0
  125. package/dist/vue/workflows.d.ts.map +1 -0
  126. package/dist/vue/workflows.js +200 -0
  127. package/dist/vue/workflows.js.map +1 -0
  128. package/package.json +1 -1
  129. package/src/app-icons.ts +57 -0
  130. package/src/capabilities.ts +147 -0
  131. package/src/combobox.ts +198 -0
  132. package/src/contracts.ts +305 -0
  133. package/src/date.ts +280 -0
  134. package/src/experimental-playback.ts +115 -0
  135. package/src/experimental-regions.ts +614 -0
  136. package/src/experimental.ts +239 -25
  137. package/src/files.ts +408 -0
  138. package/src/form.ts +190 -0
  139. package/src/index.ts +23 -1
  140. package/src/link.ts +28 -0
  141. package/src/motion.ts +61 -3
  142. package/src/navigation.ts +61 -0
  143. package/src/responsive.ts +61 -0
  144. package/src/theme/themes.ts +3 -3
  145. package/src/theme/types.ts +13 -1
  146. package/src/vue/combobox.ts +238 -0
  147. package/src/vue/component-props.ts +24 -0
  148. package/src/vue/contracts.ts +39 -0
  149. package/src/vue/date-calendar.ts +76 -0
  150. package/src/vue/date-picker.ts +414 -0
  151. package/src/vue/date-props.ts +84 -0
  152. package/src/vue/files.ts +53 -0
  153. package/src/vue/forms.ts +20 -0
  154. package/src/vue/global-components.ts +49 -3
  155. package/src/vue/index.ts +19 -3
  156. package/src/vue/layout-context.ts +10 -3
  157. package/src/vue/props.ts +57 -127
  158. package/src/vue/reveal-state.ts +83 -0
  159. package/src/vue/workflow-props.ts +41 -0
  160. package/src/vue/workflows.ts +257 -0
@@ -0,0 +1,37 @@
1
+ export const formGroupProps = {
2
+ label: { type: String, required: true },
3
+ description: { type: String, default: '' },
4
+ id: { type: String, default: undefined },
5
+ };
6
+ export const formErrorsProps = {
7
+ form: { type: Object, required: true },
8
+ title: { type: String, default: 'Review these fields' },
9
+ announce: Boolean,
10
+ };
11
+ export const stepsProps = {
12
+ steps: { type: Array, required: true },
13
+ modelValue: { type: [String, Number], default: null },
14
+ label: { type: String, required: true },
15
+ disabled: Boolean,
16
+ loading: Boolean,
17
+ currentLabel: { type: String, default: 'Current' },
18
+ completeLabel: { type: String, default: 'Complete' },
19
+ errorLabel: { type: String, default: 'Needs attention' },
20
+ };
21
+ export const paginationProps = {
22
+ modelValue: { type: Number, default: 1 },
23
+ total: { type: Number, required: true },
24
+ pageSize: { type: Number, default: 20 },
25
+ siblingCount: { type: Number, default: 1 },
26
+ label: { type: String, default: 'Result pages' },
27
+ previousLabel: { type: String, default: 'Previous' },
28
+ nextLabel: { type: String, default: 'Next' },
29
+ pageLabel: { type: String, default: 'Page' },
30
+ currentLabel: { type: String, default: 'Current' },
31
+ statusText: { type: String, default: '' },
32
+ emptyLabel: { type: String, default: 'No results' },
33
+ invalidPageLabel: { type: String, default: 'This page is no longer available.' },
34
+ loading: Boolean,
35
+ disabled: Boolean,
36
+ };
37
+ //# sourceMappingURL=workflow-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-props.js","sourceRoot":"","sources":["../../src/vue/workflow-props.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAa,EAAE;IAChD,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1C,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE;CACzC,CAAA;AACD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,EAAE,IAAI,EAAE,MAAkC,EAAE,QAAQ,EAAE,IAAa,EAAE;IAC3E,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE;IACvD,QAAQ,EAAE,OAAO;CAClB,CAAA;AACD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAwC,EAAE,QAAQ,EAAE,IAAa,EAAE;IAClF,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiC,EAAE,OAAO,EAAE,IAAI,EAAE;IACrF,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAa,EAA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,EAAE,OAAO;CAClB,CAAA"}
@@ -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
+ completeLabel: string;
140
+ errorLabel: 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,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAU1C,6FAA6F;AAC7F,MAAM,UAAU,eAAe,CAAC,EAAc,EAAE,QAA0B;IACxE,MAAM,UAAU,GAAG,eAAe,CAAC;QACjC,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE,KA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AAO;gCAC7D,EAAE,EAAE,GAAG,EAAE,SAAS,IAAI,CAAC,IAAI,EAAE;gCAC7B,QAAQ,EAAE,KAAK,CAAC,QAAQ;gCACxB,OAAO,EAAE,KAAK,CAAC,OAAO;gCACtB,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;gCAC9B,GAAG,CAAC,QAAQ,KAAK,KAAK;oCACpB,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAAE;oCACzE,CAAC,CAAC,EAAE,CAAC;gCACP,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;6BAClC,CAAC,CACP;wBACD,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE;4BACX,OAAO,EAAE,WAAW;4BACpB,IAAI,EAAE,KAAK,CAAC,SAAS;4BACrB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;4BAC/C,OAAO,EAAE,KAAK,CAAC,OAAO;4BACtB,WAAW,EAAE,KAAK,CAAC,SAAS;4BAC5B,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;yBACnC,CAAC;qBACH,CAAC;iBACH,CACF,CAAA;YACH,CAAC,CAAA;QACH,CAAC;KACF,CAAC,CAAA;IACF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,CAAA;AACzD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getcortexlabs/mavis-core",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.6",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Shared Mavis themes and component contracts.",
@@ -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>