@formspec/core 0.1.0-alpha.0 → 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 ADDED
@@ -0,0 +1,111 @@
1
+ # @formspec/core
2
+
3
+ Core type definitions for the FormSpec library.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @formspec/core
9
+ # or
10
+ pnpm add @formspec/core
11
+ ```
12
+
13
+ > **Note:** Most users should install the `formspec` umbrella package instead, which re-exports everything from this package.
14
+
15
+ ## Requirements
16
+
17
+ This package is ESM-only and requires:
18
+
19
+ ```json
20
+ // package.json
21
+ {
22
+ "type": "module"
23
+ }
24
+ ```
25
+
26
+ ```json
27
+ // tsconfig.json
28
+ {
29
+ "compilerOptions": {
30
+ "module": "NodeNext",
31
+ "moduleResolution": "NodeNext"
32
+ }
33
+ }
34
+ ```
35
+
36
+ ## Overview
37
+
38
+ This package provides the foundational types used throughout the FormSpec ecosystem:
39
+
40
+ - **Form element types**: `TextField`, `NumberField`, `BooleanField`, `StaticEnumField`, `DynamicEnumField`, `ArrayField`, `ObjectField`
41
+ - **Structural types**: `Group`, `Conditional`, `FormElement`, `FormSpec`
42
+ - **State types**: `FieldState`, `FormState`, `Validity`
43
+ - **Data source types**: `DataSourceRegistry`, `DataSourceOption`, `FetchOptionsResponse`
44
+ - **Predicate types**: `EqualsPredicate`, `Predicate`
45
+
46
+ ## Usage
47
+
48
+ ```typescript
49
+ import type {
50
+ FormSpec,
51
+ FormElement,
52
+ TextField,
53
+ NumberField,
54
+ AnyField,
55
+ Group,
56
+ Conditional,
57
+ } from "@formspec/core";
58
+
59
+ // Type guard for field elements
60
+ function isField(element: FormElement): element is AnyField {
61
+ return element._type === "field";
62
+ }
63
+
64
+ // Process form elements
65
+ function processForm(form: FormSpec<readonly FormElement[]>) {
66
+ for (const element of form.elements) {
67
+ if (isField(element)) {
68
+ console.log(`Field: ${element.name} (${element._field})`);
69
+ } else if (element._type === "group") {
70
+ console.log(`Group: ${element.label}`);
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ## Type Reference
77
+
78
+ ### Field Types
79
+
80
+ | Type | Description |
81
+ | -------------------- | ------------------------------------------- |
82
+ | `TextField` | Text input field |
83
+ | `NumberField` | Numeric input field |
84
+ | `BooleanField` | Boolean/checkbox field |
85
+ | `StaticEnumField` | Dropdown with static options |
86
+ | `DynamicEnumField` | Dropdown with dynamic options from resolver |
87
+ | `DynamicSchemaField` | Field with dynamic schema from resolver |
88
+ | `ArrayField` | Array of nested elements |
89
+ | `ObjectField` | Nested object with child fields |
90
+ | `AnyField` | Union of all field types |
91
+
92
+ ### Structural Types
93
+
94
+ | Type | Description |
95
+ | ------------- | ------------------------------------------- |
96
+ | `Group` | Groups related fields with a label |
97
+ | `Conditional` | Shows fields based on predicate |
98
+ | `FormElement` | Union of `AnyField`, `Group`, `Conditional` |
99
+ | `FormSpec<E>` | Complete form specification |
100
+
101
+ ### State Types
102
+
103
+ | Type | Description |
104
+ | --------------- | ----------------------------------- |
105
+ | `Validity` | `"valid"`, `"invalid"`, `"unknown"` |
106
+ | `FieldState<T>` | Runtime state of a single field |
107
+ | `FormState<S>` | Runtime state of entire form |
108
+
109
+ ## License
110
+
111
+ UNLICENSED
package/dist/core.d.ts ADDED
@@ -0,0 +1,431 @@
1
+ /**
2
+ * `@formspec/core` - Core type definitions for FormSpec
3
+ *
4
+ * This package provides the foundational types used throughout the FormSpec ecosystem:
5
+ * - Form element types (fields, groups, conditionals)
6
+ * - Field and form state types
7
+ * - Data source registry for dynamic enums
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+
12
+ /**
13
+ * Union of all field types.
14
+ */
15
+ export declare type AnyField = TextField<string> | NumberField<string> | BooleanField<string> | StaticEnumField<string, readonly EnumOptionValue[]> | DynamicEnumField<string, string> | DynamicSchemaField<string> | ArrayField<string, readonly FormElement[]> | ObjectField<string, readonly FormElement[]>;
16
+
17
+ /**
18
+ * An array field containing repeating items.
19
+ *
20
+ * Use this for lists of values (e.g., multiple addresses, line items).
21
+ *
22
+ * @typeParam N - The field name (string literal type)
23
+ * @typeParam Items - The form elements that define each array item
24
+ */
25
+ export declare interface ArrayField<N extends string, Items extends readonly FormElement[]> {
26
+ /** Type discriminator for form elements */
27
+ readonly _type: "field";
28
+ /** Field type discriminator - identifies this as an array field */
29
+ readonly _field: "array";
30
+ /** Unique field identifier used as the schema key */
31
+ readonly name: N;
32
+ /** Form elements that define the schema for each array item */
33
+ readonly items: Items;
34
+ /** Display label for the field */
35
+ readonly label?: string;
36
+ /** Whether this field is required for form submission */
37
+ readonly required?: boolean;
38
+ /** Minimum number of items required */
39
+ readonly minItems?: number;
40
+ /** Maximum number of items allowed */
41
+ readonly maxItems?: number;
42
+ }
43
+
44
+ /**
45
+ * A boolean checkbox field.
46
+ *
47
+ * @typeParam N - The field name (string literal type)
48
+ */
49
+ export declare interface BooleanField<N extends string> {
50
+ /** Type discriminator for form elements */
51
+ readonly _type: "field";
52
+ /** Field type discriminator - identifies this as a boolean field */
53
+ readonly _field: "boolean";
54
+ /** Unique field identifier used as the schema key */
55
+ readonly name: N;
56
+ /** Display label for the field */
57
+ readonly label?: string;
58
+ /** Whether this field is required for form submission */
59
+ readonly required?: boolean;
60
+ }
61
+
62
+ /**
63
+ * A conditional wrapper that shows/hides elements based on another field's value.
64
+ *
65
+ * @typeParam FieldName - The field to check
66
+ * @typeParam Value - The value that triggers the condition
67
+ * @typeParam Elements - Tuple of contained form elements
68
+ */
69
+ export declare interface Conditional<FieldName extends string, Value, Elements extends readonly FormElement[]> {
70
+ /** Type discriminator - identifies this as a conditional element */
71
+ readonly _type: "conditional";
72
+ /** Name of the field whose value determines visibility */
73
+ readonly field: FieldName;
74
+ /** Value that triggers the condition (shows nested elements) */
75
+ readonly value: Value;
76
+ /** Form elements shown when condition is met */
77
+ readonly elements: Elements;
78
+ }
79
+
80
+ /**
81
+ * Constraint decorator names that are valid as TSDoc tags, mapped to
82
+ * their expected value type for parsing.
83
+ *
84
+ * Both `@formspec/build` (schema generation) and `@formspec/eslint-plugin`
85
+ * (lint-time validation) import this to determine which JSDoc tags to
86
+ * recognize and how to parse their values.
87
+ */
88
+ export declare const CONSTRAINT_TAG_DEFINITIONS: {
89
+ readonly Minimum: "number";
90
+ readonly Maximum: "number";
91
+ readonly ExclusiveMinimum: "number";
92
+ readonly ExclusiveMaximum: "number";
93
+ readonly MinLength: "number";
94
+ readonly MaxLength: "number";
95
+ readonly Pattern: "string";
96
+ readonly EnumOptions: "json";
97
+ };
98
+
99
+ /** Type of a constraint tag name. */
100
+ export declare type ConstraintTagName = keyof typeof CONSTRAINT_TAG_DEFINITIONS;
101
+
102
+ /**
103
+ * Creates initial field state with default values.
104
+ *
105
+ * @typeParam T - The value type of the field
106
+ * @param value - The initial value for the field
107
+ * @returns Initial field state
108
+ */
109
+ export declare function createInitialFieldState<T>(value: T): FieldState<T>;
110
+
111
+ /**
112
+ * A single option returned by a data source resolver.
113
+ *
114
+ * @typeParam T - The data type for additional option metadata
115
+ */
116
+ export declare interface DataSourceOption<T = unknown> {
117
+ /** The value stored when this option is selected */
118
+ readonly value: string;
119
+ /** The display label for this option */
120
+ readonly label: string;
121
+ /** Optional additional data associated with this option */
122
+ readonly data?: T;
123
+ }
124
+
125
+ /**
126
+ * Registry for dynamic data sources.
127
+ *
128
+ * Extend this interface via module augmentation to register your data sources:
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * declare module "@formspec/core" {
133
+ * interface DataSourceRegistry {
134
+ * countries: { id: string; code: string; name: string };
135
+ * templates: { id: string; name: string; category: string };
136
+ * }
137
+ * }
138
+ * ```
139
+ */
140
+ export declare interface DataSourceRegistry {
141
+ }
142
+
143
+ /**
144
+ * Gets the value type for a registered data source.
145
+ *
146
+ * If the source has an `id` property, that becomes the value type.
147
+ * Otherwise, defaults to `string`.
148
+ */
149
+ export declare type DataSourceValueType<Source extends string> = Source extends keyof DataSourceRegistry ? DataSourceRegistry[Source] extends {
150
+ id: infer ID;
151
+ } ? ID : string : string;
152
+
153
+ /**
154
+ * A field with dynamic enum options (fetched from a data source at runtime).
155
+ *
156
+ * @typeParam N - The field name (string literal type)
157
+ * @typeParam Source - The data source key (from DataSourceRegistry)
158
+ */
159
+ export declare interface DynamicEnumField<N extends string, Source extends string> {
160
+ /** Type discriminator for form elements */
161
+ readonly _type: "field";
162
+ /** Field type discriminator - identifies this as a dynamic enum field */
163
+ readonly _field: "dynamic_enum";
164
+ /** Unique field identifier used as the schema key */
165
+ readonly name: N;
166
+ /** Data source key for fetching options at runtime */
167
+ readonly source: Source;
168
+ /** Display label for the field */
169
+ readonly label?: string;
170
+ /** Whether this field is required for form submission */
171
+ readonly required?: boolean;
172
+ /** Field names whose values are needed to fetch options */
173
+ readonly params?: readonly string[];
174
+ }
175
+
176
+ /**
177
+ * A field that loads its schema dynamically (e.g., from an extension).
178
+ *
179
+ * @typeParam N - The field name (string literal type)
180
+ */
181
+ export declare interface DynamicSchemaField<N extends string> {
182
+ /** Type discriminator for form elements */
183
+ readonly _type: "field";
184
+ /** Field type discriminator - identifies this as a dynamic schema field */
185
+ readonly _field: "dynamic_schema";
186
+ /** Unique field identifier used as the schema key */
187
+ readonly name: N;
188
+ /** Identifier for the schema source */
189
+ readonly schemaSource: string;
190
+ /** Display label for the field */
191
+ readonly label?: string;
192
+ /** Whether this field is required for form submission */
193
+ readonly required?: boolean;
194
+ }
195
+
196
+ /**
197
+ * An enum option with a separate ID and display label.
198
+ *
199
+ * Use this when the stored value (id) should differ from the display text (label).
200
+ */
201
+ export declare interface EnumOption {
202
+ readonly id: string;
203
+ readonly label: string;
204
+ }
205
+
206
+ /**
207
+ * Valid enum option types: either plain strings or objects with id/label.
208
+ */
209
+ export declare type EnumOptionValue = string | EnumOption;
210
+
211
+ /**
212
+ * Predicate types for conditional logic.
213
+ *
214
+ * Predicates are used with `when()` to define conditions in a readable way.
215
+ */
216
+ /**
217
+ * An equality predicate that checks if a field equals a specific value.
218
+ *
219
+ * @typeParam K - The field name to check
220
+ * @typeParam V - The value to compare against
221
+ */
222
+ export declare interface EqualsPredicate<K extends string, V> {
223
+ /** Predicate type discriminator */
224
+ readonly _predicate: "equals";
225
+ /** Name of the field to check */
226
+ readonly field: K;
227
+ /** Value that the field must equal */
228
+ readonly value: V;
229
+ }
230
+
231
+ /**
232
+ * Response from a data source resolver function.
233
+ *
234
+ * @typeParam T - The data type for option metadata
235
+ */
236
+ export declare interface FetchOptionsResponse<T = unknown> {
237
+ /** The available options */
238
+ readonly options: readonly DataSourceOption<T>[];
239
+ /** Validity state of the fetch operation */
240
+ readonly validity: "valid" | "invalid" | "unknown";
241
+ /** Optional message (e.g., error description) */
242
+ readonly message?: string;
243
+ }
244
+
245
+ /**
246
+ * Represents the runtime state of a single form field.
247
+ *
248
+ * @typeParam T - The value type of the field
249
+ */
250
+ export declare interface FieldState<T> {
251
+ /** Current value of the field */
252
+ readonly value: T;
253
+ /** Whether the field has been modified by the user */
254
+ readonly dirty: boolean;
255
+ /** Whether the field has been focused and blurred */
256
+ readonly touched: boolean;
257
+ /** Current validity state */
258
+ readonly validity: Validity;
259
+ /** Validation error messages, if any */
260
+ readonly errors: readonly string[];
261
+ }
262
+
263
+ /**
264
+ * Union of all form element types (fields and structural elements).
265
+ */
266
+ export declare type FormElement = AnyField | Group<readonly FormElement[]> | Conditional<string, unknown, readonly FormElement[]>;
267
+
268
+ /**
269
+ * A complete form specification.
270
+ *
271
+ * @typeParam Elements - Tuple of top-level form elements
272
+ */
273
+ export declare interface FormSpec<Elements extends readonly FormElement[]> {
274
+ /** Top-level form elements */
275
+ readonly elements: Elements;
276
+ }
277
+
278
+ /** Names of all built-in FormSpec decorators. */
279
+ export declare const FORMSPEC_DECORATOR_NAMES: readonly ["Field", "Group", "ShowWhen", "EnumOptions", "Minimum", "Maximum", "ExclusiveMinimum", "ExclusiveMaximum", "MinLength", "MaxLength", "Pattern"];
280
+
281
+ /** Type of a FormSpec decorator name. */
282
+ export declare type FormSpecDecoratorName = (typeof FORMSPEC_DECORATOR_NAMES)[number];
283
+
284
+ /**
285
+ * Represents the runtime state of an entire form.
286
+ *
287
+ * @typeParam Schema - The form schema type (maps field names to value types)
288
+ */
289
+ export declare interface FormState<Schema extends Record<string, unknown>> {
290
+ /** State for each field, keyed by field name */
291
+ readonly fields: {
292
+ readonly [K in keyof Schema]: FieldState<Schema[K]>;
293
+ };
294
+ /** Whether any field has been modified */
295
+ readonly dirty: boolean;
296
+ /** Whether the form is currently being submitted */
297
+ readonly submitting: boolean;
298
+ /** Overall form validity (derived from all field validities) */
299
+ readonly validity: Validity;
300
+ }
301
+
302
+ /**
303
+ * A visual grouping of form elements.
304
+ *
305
+ * Groups provide visual organization and can be rendered as fieldsets or sections.
306
+ *
307
+ * @typeParam Elements - Tuple of contained form elements
308
+ */
309
+ export declare interface Group<Elements extends readonly FormElement[]> {
310
+ /** Type discriminator - identifies this as a group element */
311
+ readonly _type: "group";
312
+ /** Display label for the group */
313
+ readonly label: string;
314
+ /** Form elements contained within this group */
315
+ readonly elements: Elements;
316
+ }
317
+
318
+ /**
319
+ * A numeric input field.
320
+ *
321
+ * @typeParam N - The field name (string literal type)
322
+ */
323
+ export declare interface NumberField<N extends string> {
324
+ /** Type discriminator for form elements */
325
+ readonly _type: "field";
326
+ /** Field type discriminator - identifies this as a number field */
327
+ readonly _field: "number";
328
+ /** Unique field identifier used as the schema key */
329
+ readonly name: N;
330
+ /** Display label for the field */
331
+ readonly label?: string;
332
+ /** Minimum allowed value */
333
+ readonly min?: number;
334
+ /** Maximum allowed value */
335
+ readonly max?: number;
336
+ /** Whether this field is required for form submission */
337
+ readonly required?: boolean;
338
+ }
339
+
340
+ /**
341
+ * An object field containing nested properties.
342
+ *
343
+ * Use this for grouping related fields under a single key in the schema.
344
+ *
345
+ * @typeParam N - The field name (string literal type)
346
+ * @typeParam Properties - The form elements that define the object's properties
347
+ */
348
+ export declare interface ObjectField<N extends string, Properties extends readonly FormElement[]> {
349
+ /** Type discriminator for form elements */
350
+ readonly _type: "field";
351
+ /** Field type discriminator - identifies this as an object field */
352
+ readonly _field: "object";
353
+ /** Unique field identifier used as the schema key */
354
+ readonly name: N;
355
+ /** Form elements that define the properties of this object */
356
+ readonly properties: Properties;
357
+ /** Display label for the field */
358
+ readonly label?: string;
359
+ /** Whether this field is required for form submission */
360
+ readonly required?: boolean;
361
+ }
362
+
363
+ /**
364
+ * Union of all predicate types.
365
+ *
366
+ * Currently only supports equality, but can be extended with:
367
+ * - `OneOfPredicate` - field value is one of several options
368
+ * - `NotPredicate` - negation of another predicate
369
+ * - `AndPredicate` / `OrPredicate` - logical combinations
370
+ */
371
+ export declare type Predicate<K extends string = string, V = unknown> = EqualsPredicate<K, V>;
372
+
373
+ /**
374
+ * A field with static enum options (known at compile time).
375
+ *
376
+ * Options can be plain strings or objects with `id` and `label` properties.
377
+ *
378
+ * @typeParam N - The field name (string literal type)
379
+ * @typeParam O - Tuple of option values (strings or EnumOption objects)
380
+ */
381
+ export declare interface StaticEnumField<N extends string, O extends readonly EnumOptionValue[]> {
382
+ /** Type discriminator for form elements */
383
+ readonly _type: "field";
384
+ /** Field type discriminator - identifies this as an enum field */
385
+ readonly _field: "enum";
386
+ /** Unique field identifier used as the schema key */
387
+ readonly name: N;
388
+ /** Array of allowed option values */
389
+ readonly options: O;
390
+ /** Display label for the field */
391
+ readonly label?: string;
392
+ /** Whether this field is required for form submission */
393
+ readonly required?: boolean;
394
+ }
395
+
396
+ /**
397
+ * Form element type definitions.
398
+ *
399
+ * These types define the structure of form specifications.
400
+ * The structure IS the definition - nesting implies layout and conditional logic.
401
+ */
402
+ /**
403
+ * A text input field.
404
+ *
405
+ * @typeParam N - The field name (string literal type)
406
+ */
407
+ export declare interface TextField<N extends string> {
408
+ /** Type discriminator for form elements */
409
+ readonly _type: "field";
410
+ /** Field type discriminator - identifies this as a text field */
411
+ readonly _field: "text";
412
+ /** Unique field identifier used as the schema key */
413
+ readonly name: N;
414
+ /** Display label for the field */
415
+ readonly label?: string;
416
+ /** Placeholder text shown when field is empty */
417
+ readonly placeholder?: string;
418
+ /** Whether this field is required for form submission */
419
+ readonly required?: boolean;
420
+ }
421
+
422
+ /**
423
+ * Represents the validity state of a field or form.
424
+ *
425
+ * - `"valid"` - All validations pass
426
+ * - `"invalid"` - One or more validations failed
427
+ * - `"unknown"` - Validation state not yet determined (e.g., async validation pending)
428
+ */
429
+ export declare type Validity = "valid" | "invalid" | "unknown";
430
+
431
+ export { }
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@
8
8
  *
9
9
  * @packageDocumentation
10
10
  */
11
- export type { Validity, FieldState, FormState, DataSourceRegistry, DataSourceOption, FetchOptionsResponse, DataSourceValueType, TextField, NumberField, BooleanField, StaticEnumField, DynamicEnumField, DynamicSchemaField, ArrayField, ObjectField, AnyField, Group, Conditional, FormElement, FormSpec, EqualsPredicate, Predicate, } from "./types/index.js";
12
- export { createInitialFieldState } from "./types/index.js";
11
+ export type { Validity, FieldState, FormState, DataSourceRegistry, DataSourceOption, FetchOptionsResponse, DataSourceValueType, TextField, NumberField, BooleanField, EnumOption, EnumOptionValue, StaticEnumField, DynamicEnumField, DynamicSchemaField, ArrayField, ObjectField, AnyField, Group, Conditional, FormElement, FormSpec, EqualsPredicate, Predicate, FormSpecDecoratorName, ConstraintTagName, } from "./types/index.js";
12
+ export { createInitialFieldState, FORMSPEC_DECORATOR_NAMES, CONSTRAINT_TAG_DEFINITIONS, } from "./types/index.js";
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EAEV,QAAQ,EAGR,UAAU,EAGV,SAAS,EAGT,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EAGnB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EAGR,eAAe,EACf,SAAS,GACV,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EAEV,QAAQ,EAGR,UAAU,EAGV,SAAS,EAGT,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EAGnB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EACX,QAAQ,EAGR,eAAe,EACf,SAAS,EAGT,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -9,5 +9,5 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
  // Re-export functions
12
- export { createInitialFieldState } from "./types/index.js";
12
+ export { createInitialFieldState, FORMSPEC_DECORATOR_NAMES, CONSTRAINT_TAG_DEFINITIONS, } from "./types/index.js";
13
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAuCH,sBAAsB;AACtB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA6CH,sBAAsB;AACtB,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../src/types/data-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,kBAAkB;CAElC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC3C,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,OAAO;IAC/C,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjD,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAEnD,iDAAiD;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,MAAM,IACnD,MAAM,SAAS,MAAM,kBAAkB,GACnC,kBAAkB,CAAC,MAAM,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GACjD,EAAE,GACF,MAAM,GACR,MAAM,CAAC"}
1
+ {"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../src/types/data-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,kBAAkB;CAElC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC3C,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,wCAAwC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,OAAO;IAC/C,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjD,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAEnD,iDAAiD;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,MAAM,IAAI,MAAM,SAAS,MAAM,kBAAkB,GAC5F,kBAAkB,CAAC,MAAM,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GACjD,EAAE,GACF,MAAM,GACR,MAAM,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Canonical set of FormSpec decorator names.
3
+ *
4
+ * This is the single source of truth for which decorators FormSpec recognizes.
5
+ * Both `@formspec/eslint-plugin` and `@formspec/build` import from here.
6
+ */
7
+ /** Names of all built-in FormSpec decorators. */
8
+ export declare const FORMSPEC_DECORATOR_NAMES: readonly ["Field", "Group", "ShowWhen", "EnumOptions", "Minimum", "Maximum", "ExclusiveMinimum", "ExclusiveMaximum", "MinLength", "MaxLength", "Pattern"];
9
+ /** Type of a FormSpec decorator name. */
10
+ export type FormSpecDecoratorName = (typeof FORMSPEC_DECORATOR_NAMES)[number];
11
+ /**
12
+ * Constraint decorator names that are valid as TSDoc tags, mapped to
13
+ * their expected value type for parsing.
14
+ *
15
+ * Both `@formspec/build` (schema generation) and `@formspec/eslint-plugin`
16
+ * (lint-time validation) import this to determine which JSDoc tags to
17
+ * recognize and how to parse their values.
18
+ */
19
+ export declare const CONSTRAINT_TAG_DEFINITIONS: {
20
+ readonly Minimum: "number";
21
+ readonly Maximum: "number";
22
+ readonly ExclusiveMinimum: "number";
23
+ readonly ExclusiveMaximum: "number";
24
+ readonly MinLength: "number";
25
+ readonly MaxLength: "number";
26
+ readonly Pattern: "string";
27
+ readonly EnumOptions: "json";
28
+ };
29
+ /** Type of a constraint tag name. */
30
+ export type ConstraintTagName = keyof typeof CONSTRAINT_TAG_DEFINITIONS;
31
+ //# sourceMappingURL=decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/types/decorators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iDAAiD;AACjD,eAAO,MAAM,wBAAwB,2JAY3B,CAAC;AAEX,yCAAyC;AACzC,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;CAS7B,CAAC;AAEX,qCAAqC;AACrC,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,0BAA0B,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Canonical set of FormSpec decorator names.
3
+ *
4
+ * This is the single source of truth for which decorators FormSpec recognizes.
5
+ * Both `@formspec/eslint-plugin` and `@formspec/build` import from here.
6
+ */
7
+ /** Names of all built-in FormSpec decorators. */
8
+ export const FORMSPEC_DECORATOR_NAMES = [
9
+ "Field",
10
+ "Group",
11
+ "ShowWhen",
12
+ "EnumOptions",
13
+ "Minimum",
14
+ "Maximum",
15
+ "ExclusiveMinimum",
16
+ "ExclusiveMaximum",
17
+ "MinLength",
18
+ "MaxLength",
19
+ "Pattern",
20
+ ];
21
+ /**
22
+ * Constraint decorator names that are valid as TSDoc tags, mapped to
23
+ * their expected value type for parsing.
24
+ *
25
+ * Both `@formspec/build` (schema generation) and `@formspec/eslint-plugin`
26
+ * (lint-time validation) import this to determine which JSDoc tags to
27
+ * recognize and how to parse their values.
28
+ */
29
+ export const CONSTRAINT_TAG_DEFINITIONS = {
30
+ Minimum: "number",
31
+ Maximum: "number",
32
+ ExclusiveMinimum: "number",
33
+ ExclusiveMaximum: "number",
34
+ MinLength: "number",
35
+ MaxLength: "number",
36
+ Pattern: "string",
37
+ EnumOptions: "json",
38
+ };
39
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/types/decorators.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,iDAAiD;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,OAAO;IACP,OAAO;IACP,UAAU;IACV,aAAa;IACb,SAAS;IACT,SAAS;IACT,kBAAkB;IAClB,kBAAkB;IAClB,WAAW;IACX,WAAW;IACX,SAAS;CACD,CAAC;AAKX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,QAAQ;IACjB,gBAAgB,EAAE,QAAQ;IAC1B,gBAAgB,EAAE,QAAQ;IAC1B,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,QAAQ;IACnB,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,MAAM;CACX,CAAC"}
@@ -61,13 +61,28 @@ export interface BooleanField<N extends string> {
61
61
  /** Whether this field is required for form submission */
62
62
  readonly required?: boolean;
63
63
  }
64
+ /**
65
+ * An enum option with a separate ID and display label.
66
+ *
67
+ * Use this when the stored value (id) should differ from the display text (label).
68
+ */
69
+ export interface EnumOption {
70
+ readonly id: string;
71
+ readonly label: string;
72
+ }
73
+ /**
74
+ * Valid enum option types: either plain strings or objects with id/label.
75
+ */
76
+ export type EnumOptionValue = string | EnumOption;
64
77
  /**
65
78
  * A field with static enum options (known at compile time).
66
79
  *
80
+ * Options can be plain strings or objects with `id` and `label` properties.
81
+ *
67
82
  * @typeParam N - The field name (string literal type)
68
- * @typeParam O - Tuple of option string literals
83
+ * @typeParam O - Tuple of option values (strings or EnumOption objects)
69
84
  */
70
- export interface StaticEnumField<N extends string, O extends readonly string[]> {
85
+ export interface StaticEnumField<N extends string, O extends readonly EnumOptionValue[]> {
71
86
  /** Type discriminator for form elements */
72
87
  readonly _type: "field";
73
88
  /** Field type discriminator - identifies this as an enum field */
@@ -173,7 +188,7 @@ export interface ObjectField<N extends string, Properties extends readonly FormE
173
188
  /**
174
189
  * Union of all field types.
175
190
  */
176
- export type AnyField = TextField<string> | NumberField<string> | BooleanField<string> | StaticEnumField<string, readonly string[]> | DynamicEnumField<string, string> | DynamicSchemaField<string> | ArrayField<string, readonly FormElement[]> | ObjectField<string, readonly FormElement[]>;
191
+ export type AnyField = TextField<string> | NumberField<string> | BooleanField<string> | StaticEnumField<string, readonly EnumOptionValue[]> | DynamicEnumField<string, string> | DynamicSchemaField<string> | ArrayField<string, readonly FormElement[]> | ObjectField<string, readonly FormElement[]>;
177
192
  /**
178
193
  * A visual grouping of form elements.
179
194
  *
@@ -1 +1 @@
1
- {"version":3,"file":"elements.d.ts","sourceRoot":"","sources":["../../src/types/elements.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;GAIG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,MAAM;IACzC,2CAA2C;IAC3C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,kCAAkC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;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Q,GACR,KAAK,CAAC,SAAS,WAAW,EAAE,CAAC,GAC7B,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC,CAAC;AAMzD;;;;GAIG;AACH,MAAM,WAAW,QAAQ,CAAC,QAAQ,SAAS,SAAS,WAAW,EAAE;IAC/D,8BAA8B;IAC9B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B"}
@@ -3,6 +3,8 @@ export type { FieldState } from "./field-state.js";
3
3
  export { createInitialFieldState } from "./field-state.js";
4
4
  export type { FormState } from "./form-state.js";
5
5
  export type { DataSourceRegistry, DataSourceOption, FetchOptionsResponse, DataSourceValueType, } from "./data-source.js";
6
- export type { TextField, NumberField, BooleanField, StaticEnumField, DynamicEnumField, DynamicSchemaField, ArrayField, ObjectField, AnyField, Group, Conditional, FormElement, FormSpec, } from "./elements.js";
6
+ export type { TextField, NumberField, BooleanField, EnumOption, EnumOptionValue, StaticEnumField, DynamicEnumField, DynamicSchemaField, ArrayField, ObjectField, AnyField, Group, Conditional, FormElement, FormSpec, } from "./elements.js";
7
7
  export type { EqualsPredicate, Predicate } from "./predicate.js";
8
+ export { FORMSPEC_DECORATOR_NAMES, CONSTRAINT_TAG_DEFINITIONS } from "./decorators.js";
9
+ export type { FormSpecDecoratorName, ConstraintTagName } from "./decorators.js";
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EACX,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EACX,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AACvF,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  // Re-export all types from the types directory
2
2
  export { createInitialFieldState } from "./field-state.js";
3
+ export { FORMSPEC_DECORATOR_NAMES, CONSTRAINT_TAG_DEFINITIONS } from "./decorators.js";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAK/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAK/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AA+B3D,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formspec/core",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.0-alpha.10",
4
4
  "description": "Core utilities for formspec",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,7 +12,8 @@
12
12
  }
13
13
  },
14
14
  "files": [
15
- "dist"
15
+ "dist",
16
+ "README.md"
16
17
  ],
17
18
  "publishConfig": {
18
19
  "access": "public"
@@ -20,7 +21,7 @@
20
21
  "keywords": [],
21
22
  "license": "UNLICENSED",
22
23
  "scripts": {
23
- "build": "tsc",
24
+ "build": "tsc && api-extractor run --local",
24
25
  "clean": "rm -rf dist temp",
25
26
  "typecheck": "tsc --noEmit",
26
27
  "api-extractor": "api-extractor run",