@getcortexlabs/mavis-core 0.1.0-alpha.4 → 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.
Files changed (117) hide show
  1. package/README.md +2 -2
  2. package/dist/capabilities.d.ts +119 -0
  3. package/dist/capabilities.d.ts.map +1 -0
  4. package/dist/capabilities.js +142 -0
  5. package/dist/capabilities.js.map +1 -0
  6. package/dist/combobox.d.ts +42 -0
  7. package/dist/combobox.d.ts.map +1 -0
  8. package/dist/combobox.js +159 -0
  9. package/dist/combobox.js.map +1 -0
  10. package/dist/contracts.d.ts +1201 -0
  11. package/dist/contracts.d.ts.map +1 -0
  12. package/dist/contracts.js +242 -0
  13. package/dist/contracts.js.map +1 -0
  14. package/dist/date.d.ts +96 -0
  15. package/dist/date.d.ts.map +1 -0
  16. package/dist/date.js +235 -0
  17. package/dist/date.js.map +1 -0
  18. package/dist/experimental-regions.d.ts +142 -0
  19. package/dist/experimental-regions.d.ts.map +1 -0
  20. package/dist/experimental-regions.js +315 -0
  21. package/dist/experimental-regions.js.map +1 -0
  22. package/dist/experimental.d.ts +13 -1
  23. package/dist/experimental.d.ts.map +1 -1
  24. package/dist/experimental.js +153 -23
  25. package/dist/experimental.js.map +1 -1
  26. package/dist/files.d.ts +87 -0
  27. package/dist/files.d.ts.map +1 -0
  28. package/dist/files.js +328 -0
  29. package/dist/files.js.map +1 -0
  30. package/dist/form.d.ts +39 -0
  31. package/dist/form.d.ts.map +1 -0
  32. package/dist/form.js +170 -0
  33. package/dist/form.js.map +1 -0
  34. package/dist/index.d.ts +9 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +7 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/navigation.d.ts +22 -0
  39. package/dist/navigation.d.ts.map +1 -0
  40. package/dist/navigation.js +54 -0
  41. package/dist/navigation.js.map +1 -0
  42. package/dist/vue/combobox.d.ts +155 -0
  43. package/dist/vue/combobox.d.ts.map +1 -0
  44. package/dist/vue/combobox.js +195 -0
  45. package/dist/vue/combobox.js.map +1 -0
  46. package/dist/vue/component-props.d.ts +1989 -0
  47. package/dist/vue/component-props.d.ts.map +1 -0
  48. package/dist/vue/component-props.js +18 -0
  49. package/dist/vue/component-props.js.map +1 -0
  50. package/dist/vue/contracts.d.ts +18 -0
  51. package/dist/vue/contracts.d.ts.map +1 -0
  52. package/dist/vue/contracts.js +18 -0
  53. package/dist/vue/contracts.js.map +1 -0
  54. package/dist/vue/date-calendar.d.ts +64 -0
  55. package/dist/vue/date-calendar.d.ts.map +1 -0
  56. package/dist/vue/date-calendar.js +65 -0
  57. package/dist/vue/date-calendar.js.map +1 -0
  58. package/dist/vue/date-picker.d.ts +927 -0
  59. package/dist/vue/date-picker.d.ts.map +1 -0
  60. package/dist/vue/date-picker.js +319 -0
  61. package/dist/vue/date-picker.js.map +1 -0
  62. package/dist/vue/date-props.d.ts +254 -0
  63. package/dist/vue/date-props.d.ts.map +1 -0
  64. package/dist/vue/date-props.js +74 -0
  65. package/dist/vue/date-props.js.map +1 -0
  66. package/dist/vue/files.d.ts +53 -0
  67. package/dist/vue/files.d.ts.map +1 -0
  68. package/dist/vue/files.js +40 -0
  69. package/dist/vue/files.js.map +1 -0
  70. package/dist/vue/forms.d.ts +4 -0
  71. package/dist/vue/forms.d.ts.map +1 -0
  72. package/dist/vue/forms.js +15 -0
  73. package/dist/vue/forms.js.map +1 -0
  74. package/dist/vue/global-components.d.ts +35 -2
  75. package/dist/vue/global-components.d.ts.map +1 -1
  76. package/dist/vue/index.d.ts +12 -2
  77. package/dist/vue/index.d.ts.map +1 -1
  78. package/dist/vue/index.js +10 -1
  79. package/dist/vue/index.js.map +1 -1
  80. package/dist/vue/inline-content.d.ts +3 -1
  81. package/dist/vue/inline-content.d.ts.map +1 -1
  82. package/dist/vue/props.d.ts +1026 -495
  83. package/dist/vue/props.d.ts.map +1 -1
  84. package/dist/vue/props.js +17 -118
  85. package/dist/vue/props.js.map +1 -1
  86. package/dist/vue/workflow-props.d.ts +110 -0
  87. package/dist/vue/workflow-props.d.ts.map +1 -0
  88. package/dist/vue/workflow-props.js +37 -0
  89. package/dist/vue/workflow-props.js.map +1 -0
  90. package/dist/vue/workflows.d.ts +267 -0
  91. package/dist/vue/workflows.d.ts.map +1 -0
  92. package/dist/vue/workflows.js +200 -0
  93. package/dist/vue/workflows.js.map +1 -0
  94. package/package.json +1 -1
  95. package/src/capabilities.ts +145 -0
  96. package/src/combobox.ts +198 -0
  97. package/src/contracts.ts +295 -0
  98. package/src/date.ts +280 -0
  99. package/src/experimental-regions.ts +463 -0
  100. package/src/experimental.ts +158 -16
  101. package/src/files.ts +408 -0
  102. package/src/form.ts +190 -0
  103. package/src/index.ts +17 -0
  104. package/src/navigation.ts +61 -0
  105. package/src/vue/combobox.ts +238 -0
  106. package/src/vue/component-props.ts +24 -0
  107. package/src/vue/contracts.ts +33 -0
  108. package/src/vue/date-calendar.ts +76 -0
  109. package/src/vue/date-picker.ts +387 -0
  110. package/src/vue/date-props.ts +81 -0
  111. package/src/vue/files.ts +53 -0
  112. package/src/vue/forms.ts +20 -0
  113. package/src/vue/global-components.ts +44 -2
  114. package/src/vue/index.ts +13 -2
  115. package/src/vue/props.ts +34 -130
  116. package/src/vue/workflow-props.ts +41 -0
  117. package/src/vue/workflows.ts +257 -0
@@ -0,0 +1,198 @@
1
+ import { choiceKey, validateChoices, type ChoiceOption, type ChoiceValue } from './choice.js'
2
+
3
+ /** The application owns networking, authentication and cancellation primitives. */
4
+ export interface ComboboxSearchContext {
5
+ readonly requestId: number
6
+ readonly limit: number
7
+ /** Register fetch.abort(), a timer cleanup, or another host cancellation callback. */
8
+ onCancel(cleanup: () => void): void
9
+ }
10
+ export type ComboboxSearch = (
11
+ query: string,
12
+ context: ComboboxSearchContext,
13
+ ) => Promise<readonly ChoiceOption[]>
14
+ export interface ComboboxSnapshot {
15
+ query: string
16
+ options: readonly ChoiceOption[]
17
+ }
18
+ export type ComboboxSearchStatus = 'idle' | 'debouncing' | 'loading' | 'success' | 'empty' | 'error'
19
+ export interface ComboboxSearchState {
20
+ readonly query: string
21
+ readonly status: ComboboxSearchStatus
22
+ readonly options: readonly ChoiceOption[]
23
+ readonly limited: boolean
24
+ }
25
+ export interface ComboboxSearchOptions {
26
+ search: ComboboxSearch
27
+ debounce?: number
28
+ minQueryLength?: number
29
+ maxResults?: number
30
+ initialResults?: ComboboxSnapshot
31
+ onChange?: (state: ComboboxSearchState) => void
32
+ }
33
+
34
+ export function validateComboboxPolicy(
35
+ debounce: number,
36
+ minQueryLength: number,
37
+ maxResults: number,
38
+ ) {
39
+ if (!Number.isInteger(debounce) || debounce < 0 || debounce > 60000)
40
+ throw new RangeError('Combobox debounce must be an integer from 0 to 60000 milliseconds.')
41
+ if (!Number.isInteger(minQueryLength) || minQueryLength < 0 || minQueryLength > 1000)
42
+ throw new RangeError('Combobox minQueryLength must be an integer from 0 to 1000.')
43
+ if (!Number.isInteger(maxResults) || maxResults < 1 || maxResults > 100)
44
+ throw new RangeError('Combobox maxResults must be an integer from 1 to 100.')
45
+ }
46
+
47
+ /** A single bounded result page. No request starts at construction, including during SSR. */
48
+ export function createComboboxSearch(config: ComboboxSearchOptions) {
49
+ const debounce = config.debounce ?? 200
50
+ const minQueryLength = config.minQueryLength ?? 1
51
+ const maxResults = config.maxResults ?? 50
52
+ validateComboboxPolicy(debounce, minQueryLength, maxResults)
53
+ let generation = 0
54
+ let disposed = false
55
+ let timer: ReturnType<typeof setTimeout> | undefined
56
+ let cleanups: (() => void)[] = []
57
+ let cached: ComboboxSearchState | undefined
58
+ function result(query: string, options: readonly ChoiceOption[]): ComboboxSearchState {
59
+ if (!Array.isArray(options)) throw new TypeError('Combobox search must return an array.')
60
+ validateChoices(options, null)
61
+ return Object.freeze({
62
+ query,
63
+ status: options.length ? 'success' : 'empty',
64
+ options: Object.freeze(
65
+ options.slice(0, maxResults).map((option) => Object.freeze({ ...option })),
66
+ ),
67
+ limited: options.length > maxResults,
68
+ })
69
+ }
70
+ let state: ComboboxSearchState = Object.freeze({
71
+ query: '',
72
+ status: 'idle',
73
+ options: [],
74
+ limited: false,
75
+ })
76
+ if (config.initialResults)
77
+ state = cached = result(config.initialResults.query, config.initialResults.options)
78
+ function publish(next: ComboboxSearchState) {
79
+ state = Object.freeze(next)
80
+ config.onChange?.(state)
81
+ }
82
+ function invalidate() {
83
+ generation++
84
+ clearTimeout(timer)
85
+ timer = undefined
86
+ const previous = cleanups
87
+ cleanups = []
88
+ // One host cleanup cannot prevent the remaining requests/resources from being cancelled.
89
+ for (const cleanup of previous) {
90
+ try {
91
+ cleanup()
92
+ } catch {
93
+ /* Host cancellation failures never revive a request. */
94
+ }
95
+ }
96
+ }
97
+ function cancel() {
98
+ invalidate()
99
+ if (!disposed && (state.status === 'loading' || state.status === 'debouncing'))
100
+ publish({ query: state.query, status: 'idle', options: [], limited: false })
101
+ }
102
+ function request(query: string, force = false) {
103
+ if (disposed) return
104
+ invalidate()
105
+ if (!force && cached?.query === query) {
106
+ publish(cached)
107
+ return
108
+ }
109
+ if (query.trim().length < minQueryLength) {
110
+ publish({ query, status: 'idle', options: [], limited: false })
111
+ return
112
+ }
113
+ const identity = generation
114
+ publish({
115
+ query,
116
+ status: debounce && !force ? 'debouncing' : 'loading',
117
+ options: [],
118
+ limited: false,
119
+ })
120
+ const run = async () => {
121
+ timer = undefined
122
+ if (disposed || identity !== generation) return
123
+ publish({ query, status: 'loading', options: [], limited: false })
124
+ try {
125
+ const options = await config.search(query, {
126
+ requestId: identity,
127
+ limit: maxResults,
128
+ onCancel(cleanup) {
129
+ if (disposed || identity !== generation) cleanup()
130
+ else cleanups.push(cleanup)
131
+ },
132
+ })
133
+ if (disposed || identity !== generation) return
134
+ const next = result(query, options)
135
+ cleanups = []
136
+ cached = next
137
+ publish(next)
138
+ } catch {
139
+ if (disposed || identity !== generation) return
140
+ cleanups = []
141
+ publish({ query, status: 'error', options: [], limited: false })
142
+ }
143
+ }
144
+ if (debounce && !force) timer = setTimeout(() => void run(), debounce)
145
+ else void run()
146
+ }
147
+ return {
148
+ get state() {
149
+ return state
150
+ },
151
+ request,
152
+ retry: () => request(state.query, true),
153
+ cancel,
154
+ dispose() {
155
+ if (disposed) return
156
+ disposed = true
157
+ invalidate()
158
+ cached = undefined
159
+ },
160
+ }
161
+ }
162
+
163
+ /** Highlight identity survives a page replacement only while its enabled option remains. */
164
+ export function comboboxHighlight(
165
+ options: readonly ChoiceOption[],
166
+ previous?: string,
167
+ ): string | undefined {
168
+ return options.some((option) => !option.disabled && choiceKey(option.value) === previous)
169
+ ? previous
170
+ : undefined
171
+ }
172
+ export function comboboxMove(
173
+ options: readonly ChoiceOption[],
174
+ previous: string | undefined,
175
+ direction: 1 | -1,
176
+ ) {
177
+ const available = options.filter((option) => !option.disabled)
178
+ if (!available.length) return undefined
179
+ const index = available.findIndex((option) => choiceKey(option.value) === previous)
180
+ const next =
181
+ index < 0
182
+ ? direction === 1
183
+ ? 0
184
+ : available.length - 1
185
+ : Math.max(0, Math.min(available.length - 1, index + direction))
186
+ return choiceKey(available[next]!.value)
187
+ }
188
+ export function comboboxSelected(
189
+ value: ChoiceValue | null,
190
+ options: readonly ChoiceOption[],
191
+ retained?: ChoiceOption | null,
192
+ ): ChoiceOption | undefined {
193
+ if (value === null) return undefined
194
+ return (
195
+ options.find((option) => option.value === value) ??
196
+ (retained?.value === value ? retained : undefined)
197
+ )
198
+ }
@@ -0,0 +1,295 @@
1
+ import type { MotionSurface, MotionRegion } from './experimental.js'
2
+ import type { Dimension } from './layout.js'
3
+ import type { InputAction, InputHandle } from './input.js'
4
+ import type { IconName } from './icon.js'
5
+ import type { FontWeight, Palette, Radius, Spacing } from './theme/types.js'
6
+
7
+ type PropertyKind = 'string' | 'number' | 'boolean' | 'object'
8
+ declare const propertyValue: unique symbol
9
+
10
+ /** Plain metadata; the symbol carries a TypeScript type and is never emitted. */
11
+ export interface Property<T = unknown> {
12
+ readonly kind: PropertyKind | readonly PropertyKind[]
13
+ readonly default?: T
14
+ readonly required?: boolean
15
+ readonly values?: readonly T[]
16
+ readonly token?: 'space' | 'radius' | 'palette' | 'fontWeight' | 'icon'
17
+ readonly units?: 'layout' | 'dimension'
18
+ readonly runtimeOnly?: boolean
19
+ readonly [propertyValue]?: T
20
+ }
21
+
22
+ function property<T>() {
23
+ return <const D extends Property<T>>(definition: D) => definition as D & Property<T>
24
+ }
25
+
26
+ export type PropertyValue<P> = P extends Property<infer T> ? T : never
27
+ export type ContractProps<P extends Record<string, Property>> = {
28
+ [K in keyof P as P[K] extends { required: true } ? K : never]: PropertyValue<P[K]>
29
+ } & {
30
+ [K in keyof P as P[K] extends { required: true } ? never : K]?: PropertyValue<P[K]>
31
+ }
32
+
33
+ const text = property<string>()
34
+ const number = property<number>()
35
+ const boolean = property<boolean>()
36
+ const optionalText = text({ kind: 'string', default: undefined })
37
+ const flag = boolean({ kind: 'boolean', default: false })
38
+
39
+ export const spacingProperty = property<Spacing>()({
40
+ kind: ['string', 'number'],
41
+ default: undefined,
42
+ token: 'space',
43
+ units: 'layout',
44
+ })
45
+ export const radiusProperty = property<Radius | number>()({
46
+ kind: ['string', 'number'],
47
+ default: undefined,
48
+ token: 'radius',
49
+ units: 'layout',
50
+ })
51
+ export const dimensionProperty = property<Dimension>()({
52
+ kind: ['number', 'string'],
53
+ default: undefined,
54
+ units: 'dimension',
55
+ })
56
+ export const weightProperty = property<FontWeight>()({
57
+ kind: 'string',
58
+ default: undefined,
59
+ token: 'fontWeight',
60
+ })
61
+ const icon = property<IconName>()({ kind: 'string', default: undefined, token: 'icon' })
62
+
63
+ export const viewContract = {
64
+ id: optionalText,
65
+ accessibilityLabel: optionalText,
66
+ accessibilityHidden: boolean({ kind: 'boolean', default: undefined }),
67
+ }
68
+ export const flexContract = {
69
+ grow: number({ kind: 'number', default: 0 }),
70
+ shrink: number({ kind: 'number', default: undefined }),
71
+ }
72
+ export const boxContract = {
73
+ ...viewContract,
74
+ ...flexContract,
75
+ padding: spacingProperty,
76
+ paddingX: spacingProperty,
77
+ paddingY: spacingProperty,
78
+ radius: radiusProperty,
79
+ width: dimensionProperty,
80
+ height: dimensionProperty,
81
+ backgroundColor: text({ kind: 'string' }),
82
+ }
83
+ export const motionBoxContract = {
84
+ ...boxContract,
85
+ motionRegion: property<MotionRegion>()({ kind: 'object', default: undefined, runtimeOnly: true }),
86
+ }
87
+ export type Align = 'start' | 'center' | 'end' | 'stretch'
88
+ export type Justify = 'start' | 'center' | 'end' | 'between' | 'around'
89
+ const layout = {
90
+ ...boxContract,
91
+ gap: spacingProperty,
92
+ justify: property<Justify>()({
93
+ kind: 'string',
94
+ values: ['start', 'center', 'end', 'between', 'around'],
95
+ default: 'start',
96
+ }),
97
+ wrap: flag,
98
+ }
99
+ export const rowContract = {
100
+ ...layout,
101
+ align: property<Align>()({
102
+ kind: 'string',
103
+ values: ['start', 'center', 'end', 'stretch'],
104
+ default: 'center',
105
+ }),
106
+ }
107
+ export const columnContract = {
108
+ ...layout,
109
+ align: property<Align>()({
110
+ kind: 'string',
111
+ values: ['start', 'center', 'end', 'stretch'],
112
+ default: 'stretch',
113
+ }),
114
+ }
115
+
116
+ export const buttonContract = {
117
+ motionSurface: property<MotionSurface>()({
118
+ kind: 'object',
119
+ default: undefined,
120
+ runtimeOnly: true,
121
+ }),
122
+ ...viewContract,
123
+ ...flexContract,
124
+ text: optionalText,
125
+ type: property<'button' | 'submit' | 'reset'>()({
126
+ kind: 'string',
127
+ values: ['button', 'submit', 'reset'],
128
+ default: 'button',
129
+ }),
130
+ name: optionalText,
131
+ value: optionalText,
132
+ form: optionalText,
133
+ variant: property<'primary' | 'secondary' | 'ghost'>()({
134
+ kind: 'string',
135
+ values: ['primary', 'secondary', 'ghost'],
136
+ default: 'primary',
137
+ }),
138
+ size: property<'sm' | 'md' | 'lg'>()({
139
+ kind: 'string',
140
+ values: ['sm', 'md', 'lg'],
141
+ default: 'md',
142
+ }),
143
+ disabled: flag,
144
+ loading: flag,
145
+ loadingText: text({ kind: 'string', default: 'Loading…' }),
146
+ icon,
147
+ trailingIcon: icon,
148
+ }
149
+
150
+ export const paletteTones: readonly (keyof Palette)[] = [
151
+ 'background',
152
+ 'surface',
153
+ 'elevated',
154
+ 'text',
155
+ 'muted',
156
+ 'primary',
157
+ 'onPrimary',
158
+ 'primarySoft',
159
+ 'accent',
160
+ 'onAccent',
161
+ 'accentSoft',
162
+ 'border',
163
+ 'warning',
164
+ 'success',
165
+ 'danger',
166
+ ]
167
+ export const textContract = {
168
+ weight: weightProperty,
169
+ ...viewContract,
170
+ ...flexContract,
171
+ text: optionalText,
172
+ as: property<'p' | 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>()({
173
+ kind: 'string',
174
+ values: ['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
175
+ default: 'p',
176
+ }),
177
+ variant: property<'display' | 'title' | 'heading' | 'body' | 'caption' | 'overline'>()({
178
+ kind: 'string',
179
+ values: ['display', 'title', 'heading', 'body', 'caption', 'overline'],
180
+ default: 'body',
181
+ }),
182
+ tone: property<keyof Palette>()({
183
+ kind: 'string',
184
+ values: paletteTones,
185
+ default: 'text',
186
+ token: 'palette',
187
+ }),
188
+ align: property<'left' | 'center' | 'right'>()({
189
+ kind: 'string',
190
+ values: ['left', 'center', 'right'],
191
+ default: 'left',
192
+ }),
193
+ wrap: boolean({ kind: 'boolean', default: true }),
194
+ }
195
+ export const inputContract = {
196
+ id: viewContract.id,
197
+ accessibilityHidden: viewContract.accessibilityHidden,
198
+ ...flexContract,
199
+ width: dimensionProperty,
200
+ modelValue: text({ kind: 'string', default: '' }),
201
+ label: text({ kind: 'string', required: true }),
202
+ placeholder: text({ kind: 'string', default: '' }),
203
+ helperText: text({ kind: 'string', default: '' }),
204
+ error: text({ kind: 'string', default: '' }),
205
+ type: property<'text' | 'email' | 'password' | 'tel' | 'url' | 'search'>()({
206
+ kind: 'string',
207
+ values: ['text', 'email', 'password', 'tel', 'url', 'search'],
208
+ default: 'text',
209
+ }),
210
+ name: optionalText,
211
+ autocomplete: optionalText,
212
+ required: flag,
213
+ inputmode: property<
214
+ 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'
215
+ >()({ kind: 'string', default: undefined }),
216
+ form: optionalText,
217
+ disabled: flag,
218
+ readonly: flag,
219
+ multiline: flag,
220
+ rows: number({ kind: 'number', default: 3 }),
221
+ maxLength: number({ kind: 'number', default: undefined }),
222
+ autocapitalize: property<'none' | 'sentences' | 'words' | 'characters'>()({
223
+ kind: 'string',
224
+ values: ['none', 'sentences', 'words', 'characters'],
225
+ default: undefined,
226
+ }),
227
+ autocorrect: boolean({ kind: 'boolean', default: undefined }),
228
+ returnKey: property<'done' | 'next' | 'go' | 'search' | 'send'>()({
229
+ kind: 'string',
230
+ values: ['done', 'next', 'go', 'search', 'send'],
231
+ default: 'done',
232
+ }),
233
+ trailingAction: property<InputAction>()({ kind: 'object', default: undefined }),
234
+ icon,
235
+ trailingIcon: icon,
236
+ }
237
+
238
+ /** Value changes are requests to the owner, not mutations of parent state. */
239
+ export interface InputEvents {
240
+ valueChange(value: string): void
241
+ submit(value: string): void
242
+ focus(): void
243
+ blur(): void
244
+ action(): void
245
+ }
246
+ export interface ButtonEvents {
247
+ activate(): void
248
+ }
249
+ export type TextInputHandle = InputHandle
250
+
251
+ export const componentContracts = {
252
+ MBox: { version: 1, props: motionBoxContract, slots: ['default'], events: {} },
253
+ MRow: { version: 1, props: rowContract, slots: ['default'], events: {} },
254
+ MColumn: { version: 1, props: columnContract, slots: ['default'], events: {} },
255
+ MText: { version: 1, props: textContract, slots: ['text', 'spans'], events: {} },
256
+ MButton: {
257
+ version: 1,
258
+ props: buttonContract,
259
+ slots: ['text', 'leading-decoration', 'trailing-decoration'],
260
+ events: { activate: 'none' },
261
+ },
262
+ MInput: {
263
+ version: 1,
264
+ props: inputContract,
265
+ slots: [],
266
+ events: {
267
+ valueChange: 'string',
268
+ submit: 'string',
269
+ focus: 'none',
270
+ blur: 'none',
271
+ action: 'none',
272
+ },
273
+ binding: { prop: 'modelValue', event: 'valueChange', owner: 'parent' },
274
+ handles: ['focus', 'blur'],
275
+ },
276
+ } as const
277
+
278
+ /** JSON-compatible descriptions; unset defaults remain distinct from no default. */
279
+ export function describeContract(name: keyof typeof componentContracts) {
280
+ const contract = componentContracts[name]
281
+ return {
282
+ ...contract,
283
+ props: Object.fromEntries(
284
+ Object.entries(contract.props).map(([name, definition]) => [
285
+ name,
286
+ {
287
+ ...definition,
288
+ ...('default' in definition && definition.default === undefined
289
+ ? { default: { unset: true } }
290
+ : {}),
291
+ },
292
+ ]),
293
+ ),
294
+ }
295
+ }