@formspec/constraints 0.1.0-alpha.27 → 0.1.0-alpha.29

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mike North
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -45,6 +45,14 @@ const form = formspec(field.text("name"), field.dynamicEnum("country", "countrie
45
45
  const result = validateFormSpecElements(form.elements, { constraints: resolved });
46
46
  ```
47
47
 
48
+ ## Browser Entry Point
49
+
50
+ Use `@formspec/constraints/browser` when you need validation in browser code and do not want the file-based config loader:
51
+
52
+ ```ts
53
+ import { loadConfigFromString, validateFormSpec } from "@formspec/constraints/browser";
54
+ ```
55
+
48
56
  ## Main Exports
49
57
 
50
58
  - `loadConfig`
@@ -56,4 +64,4 @@ const result = validateFormSpecElements(form.elements, { constraints: resolved }
56
64
 
57
65
  ## License
58
66
 
59
- UNLICENSED
67
+ This package is part of the FormSpec monorepo and is released under the MIT License. See [LICENSE](./LICENSE) for details.
@@ -63,6 +63,10 @@ export declare interface ArrayField<N extends string, Items extends readonly For
63
63
  readonly items: Items;
64
64
  /** Display label for the field */
65
65
  readonly label?: string;
66
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
67
+ readonly displayName?: string;
68
+ /** JSON-facing serialized name for the field. */
69
+ readonly apiName?: string;
66
70
  /** Whether this field is required for form submission */
67
71
  readonly required?: boolean;
68
72
  /** Minimum number of items required */
@@ -87,6 +91,10 @@ export declare interface BooleanField<N extends string> {
87
91
  readonly name: N;
88
92
  /** Display label for the field */
89
93
  readonly label?: string;
94
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
95
+ readonly displayName?: string;
96
+ /** JSON-facing serialized name for the field. */
97
+ readonly apiName?: string;
90
98
  /** Whether this field is required for form submission */
91
99
  readonly required?: boolean;
92
100
  }
@@ -208,6 +216,10 @@ export declare interface DynamicEnumField<N extends string, Source extends strin
208
216
  readonly source: Source;
209
217
  /** Display label for the field */
210
218
  readonly label?: string;
219
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
220
+ readonly displayName?: string;
221
+ /** JSON-facing serialized name for the field. */
222
+ readonly apiName?: string;
211
223
  /** Whether this field is required for form submission */
212
224
  readonly required?: boolean;
213
225
  /** Field names whose values are needed to fetch options */
@@ -232,6 +244,10 @@ export declare interface DynamicSchemaField<N extends string> {
232
244
  readonly schemaSource: string;
233
245
  /** Display label for the field */
234
246
  readonly label?: string;
247
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
248
+ readonly displayName?: string;
249
+ /** JSON-facing serialized name for the field. */
250
+ readonly apiName?: string;
235
251
  /** Whether this field is required for form submission */
236
252
  readonly required?: boolean;
237
253
  /** Field names whose values are needed to configure the schema */
@@ -618,6 +634,10 @@ export declare interface NumberField<N extends string> {
618
634
  readonly name: N;
619
635
  /** Display label for the field */
620
636
  readonly label?: string;
637
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
638
+ readonly displayName?: string;
639
+ /** JSON-facing serialized name for the field. */
640
+ readonly apiName?: string;
621
641
  /** Minimum allowed value */
622
642
  readonly min?: number;
623
643
  /** Maximum allowed value */
@@ -649,6 +669,10 @@ export declare interface ObjectField<N extends string, Properties extends readon
649
669
  readonly properties: Properties;
650
670
  /** Display label for the field */
651
671
  readonly label?: string;
672
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
673
+ readonly displayName?: string;
674
+ /** JSON-facing serialized name for the field. */
675
+ readonly apiName?: string;
652
676
  /** Whether this field is required for form submission */
653
677
  readonly required?: boolean;
654
678
  }
@@ -755,6 +779,10 @@ export declare interface StaticEnumField<N extends string, O extends readonly En
755
779
  readonly options: O;
756
780
  /** Display label for the field */
757
781
  readonly label?: string;
782
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
783
+ readonly displayName?: string;
784
+ /** JSON-facing serialized name for the field. */
785
+ readonly apiName?: string;
758
786
  /** Whether this field is required for form submission */
759
787
  readonly required?: boolean;
760
788
  }
@@ -781,6 +809,10 @@ export declare interface TextField<N extends string> {
781
809
  readonly name: N;
782
810
  /** Display label for the field */
783
811
  readonly label?: string;
812
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
813
+ readonly displayName?: string;
814
+ /** JSON-facing serialized name for the field. */
815
+ readonly apiName?: string;
784
816
  /** Placeholder text shown when field is empty */
785
817
  readonly placeholder?: string;
786
818
  /** Whether this field is required for form submission */
@@ -63,6 +63,10 @@ export declare interface ArrayField<N extends string, Items extends readonly For
63
63
  readonly items: Items;
64
64
  /** Display label for the field */
65
65
  readonly label?: string;
66
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
67
+ readonly displayName?: string;
68
+ /** JSON-facing serialized name for the field. */
69
+ readonly apiName?: string;
66
70
  /** Whether this field is required for form submission */
67
71
  readonly required?: boolean;
68
72
  /** Minimum number of items required */
@@ -87,6 +91,10 @@ export declare interface BooleanField<N extends string> {
87
91
  readonly name: N;
88
92
  /** Display label for the field */
89
93
  readonly label?: string;
94
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
95
+ readonly displayName?: string;
96
+ /** JSON-facing serialized name for the field. */
97
+ readonly apiName?: string;
90
98
  /** Whether this field is required for form submission */
91
99
  readonly required?: boolean;
92
100
  }
@@ -208,6 +216,10 @@ export declare interface DynamicEnumField<N extends string, Source extends strin
208
216
  readonly source: Source;
209
217
  /** Display label for the field */
210
218
  readonly label?: string;
219
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
220
+ readonly displayName?: string;
221
+ /** JSON-facing serialized name for the field. */
222
+ readonly apiName?: string;
211
223
  /** Whether this field is required for form submission */
212
224
  readonly required?: boolean;
213
225
  /** Field names whose values are needed to fetch options */
@@ -232,6 +244,10 @@ export declare interface DynamicSchemaField<N extends string> {
232
244
  readonly schemaSource: string;
233
245
  /** Display label for the field */
234
246
  readonly label?: string;
247
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
248
+ readonly displayName?: string;
249
+ /** JSON-facing serialized name for the field. */
250
+ readonly apiName?: string;
235
251
  /** Whether this field is required for form submission */
236
252
  readonly required?: boolean;
237
253
  /** Field names whose values are needed to configure the schema */
@@ -618,6 +634,10 @@ export declare interface NumberField<N extends string> {
618
634
  readonly name: N;
619
635
  /** Display label for the field */
620
636
  readonly label?: string;
637
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
638
+ readonly displayName?: string;
639
+ /** JSON-facing serialized name for the field. */
640
+ readonly apiName?: string;
621
641
  /** Minimum allowed value */
622
642
  readonly min?: number;
623
643
  /** Maximum allowed value */
@@ -649,6 +669,10 @@ export declare interface ObjectField<N extends string, Properties extends readon
649
669
  readonly properties: Properties;
650
670
  /** Display label for the field */
651
671
  readonly label?: string;
672
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
673
+ readonly displayName?: string;
674
+ /** JSON-facing serialized name for the field. */
675
+ readonly apiName?: string;
652
676
  /** Whether this field is required for form submission */
653
677
  readonly required?: boolean;
654
678
  }
@@ -755,6 +779,10 @@ export declare interface StaticEnumField<N extends string, O extends readonly En
755
779
  readonly options: O;
756
780
  /** Display label for the field */
757
781
  readonly label?: string;
782
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
783
+ readonly displayName?: string;
784
+ /** JSON-facing serialized name for the field. */
785
+ readonly apiName?: string;
758
786
  /** Whether this field is required for form submission */
759
787
  readonly required?: boolean;
760
788
  }
@@ -781,6 +809,10 @@ export declare interface TextField<N extends string> {
781
809
  readonly name: N;
782
810
  /** Display label for the field */
783
811
  readonly label?: string;
812
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
813
+ readonly displayName?: string;
814
+ /** JSON-facing serialized name for the field. */
815
+ readonly apiName?: string;
784
816
  /** Placeholder text shown when field is empty */
785
817
  readonly placeholder?: string;
786
818
  /** Whether this field is required for form submission */
@@ -63,6 +63,10 @@ export declare interface ArrayField<N extends string, Items extends readonly For
63
63
  readonly items: Items;
64
64
  /** Display label for the field */
65
65
  readonly label?: string;
66
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
67
+ readonly displayName?: string;
68
+ /** JSON-facing serialized name for the field. */
69
+ readonly apiName?: string;
66
70
  /** Whether this field is required for form submission */
67
71
  readonly required?: boolean;
68
72
  /** Minimum number of items required */
@@ -87,6 +91,10 @@ export declare interface BooleanField<N extends string> {
87
91
  readonly name: N;
88
92
  /** Display label for the field */
89
93
  readonly label?: string;
94
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
95
+ readonly displayName?: string;
96
+ /** JSON-facing serialized name for the field. */
97
+ readonly apiName?: string;
90
98
  /** Whether this field is required for form submission */
91
99
  readonly required?: boolean;
92
100
  }
@@ -208,6 +216,10 @@ export declare interface DynamicEnumField<N extends string, Source extends strin
208
216
  readonly source: Source;
209
217
  /** Display label for the field */
210
218
  readonly label?: string;
219
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
220
+ readonly displayName?: string;
221
+ /** JSON-facing serialized name for the field. */
222
+ readonly apiName?: string;
211
223
  /** Whether this field is required for form submission */
212
224
  readonly required?: boolean;
213
225
  /** Field names whose values are needed to fetch options */
@@ -232,6 +244,10 @@ export declare interface DynamicSchemaField<N extends string> {
232
244
  readonly schemaSource: string;
233
245
  /** Display label for the field */
234
246
  readonly label?: string;
247
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
248
+ readonly displayName?: string;
249
+ /** JSON-facing serialized name for the field. */
250
+ readonly apiName?: string;
235
251
  /** Whether this field is required for form submission */
236
252
  readonly required?: boolean;
237
253
  /** Field names whose values are needed to configure the schema */
@@ -618,6 +634,10 @@ export declare interface NumberField<N extends string> {
618
634
  readonly name: N;
619
635
  /** Display label for the field */
620
636
  readonly label?: string;
637
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
638
+ readonly displayName?: string;
639
+ /** JSON-facing serialized name for the field. */
640
+ readonly apiName?: string;
621
641
  /** Minimum allowed value */
622
642
  readonly min?: number;
623
643
  /** Maximum allowed value */
@@ -649,6 +669,10 @@ export declare interface ObjectField<N extends string, Properties extends readon
649
669
  readonly properties: Properties;
650
670
  /** Display label for the field */
651
671
  readonly label?: string;
672
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
673
+ readonly displayName?: string;
674
+ /** JSON-facing serialized name for the field. */
675
+ readonly apiName?: string;
652
676
  /** Whether this field is required for form submission */
653
677
  readonly required?: boolean;
654
678
  }
@@ -755,6 +779,10 @@ export declare interface StaticEnumField<N extends string, O extends readonly En
755
779
  readonly options: O;
756
780
  /** Display label for the field */
757
781
  readonly label?: string;
782
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
783
+ readonly displayName?: string;
784
+ /** JSON-facing serialized name for the field. */
785
+ readonly apiName?: string;
758
786
  /** Whether this field is required for form submission */
759
787
  readonly required?: boolean;
760
788
  }
@@ -781,6 +809,10 @@ export declare interface TextField<N extends string> {
781
809
  readonly name: N;
782
810
  /** Display label for the field */
783
811
  readonly label?: string;
812
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
813
+ readonly displayName?: string;
814
+ /** JSON-facing serialized name for the field. */
815
+ readonly apiName?: string;
784
816
  /** Placeholder text shown when field is empty */
785
817
  readonly placeholder?: string;
786
818
  /** Whether this field is required for form submission */
@@ -63,6 +63,10 @@ export declare interface ArrayField<N extends string, Items extends readonly For
63
63
  readonly items: Items;
64
64
  /** Display label for the field */
65
65
  readonly label?: string;
66
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
67
+ readonly displayName?: string;
68
+ /** JSON-facing serialized name for the field. */
69
+ readonly apiName?: string;
66
70
  /** Whether this field is required for form submission */
67
71
  readonly required?: boolean;
68
72
  /** Minimum number of items required */
@@ -87,6 +91,10 @@ export declare interface BooleanField<N extends string> {
87
91
  readonly name: N;
88
92
  /** Display label for the field */
89
93
  readonly label?: string;
94
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
95
+ readonly displayName?: string;
96
+ /** JSON-facing serialized name for the field. */
97
+ readonly apiName?: string;
90
98
  /** Whether this field is required for form submission */
91
99
  readonly required?: boolean;
92
100
  }
@@ -197,6 +205,10 @@ export declare interface DynamicEnumField<N extends string, Source extends strin
197
205
  readonly source: Source;
198
206
  /** Display label for the field */
199
207
  readonly label?: string;
208
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
209
+ readonly displayName?: string;
210
+ /** JSON-facing serialized name for the field. */
211
+ readonly apiName?: string;
200
212
  /** Whether this field is required for form submission */
201
213
  readonly required?: boolean;
202
214
  /** Field names whose values are needed to fetch options */
@@ -221,6 +233,10 @@ export declare interface DynamicSchemaField<N extends string> {
221
233
  readonly schemaSource: string;
222
234
  /** Display label for the field */
223
235
  readonly label?: string;
236
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
237
+ readonly displayName?: string;
238
+ /** JSON-facing serialized name for the field. */
239
+ readonly apiName?: string;
224
240
  /** Whether this field is required for form submission */
225
241
  readonly required?: boolean;
226
242
  /** Field names whose values are needed to configure the schema */
@@ -495,6 +511,10 @@ export declare interface NumberField<N extends string> {
495
511
  readonly name: N;
496
512
  /** Display label for the field */
497
513
  readonly label?: string;
514
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
515
+ readonly displayName?: string;
516
+ /** JSON-facing serialized name for the field. */
517
+ readonly apiName?: string;
498
518
  /** Minimum allowed value */
499
519
  readonly min?: number;
500
520
  /** Maximum allowed value */
@@ -526,6 +546,10 @@ export declare interface ObjectField<N extends string, Properties extends readon
526
546
  readonly properties: Properties;
527
547
  /** Display label for the field */
528
548
  readonly label?: string;
549
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
550
+ readonly displayName?: string;
551
+ /** JSON-facing serialized name for the field. */
552
+ readonly apiName?: string;
529
553
  /** Whether this field is required for form submission */
530
554
  readonly required?: boolean;
531
555
  }
@@ -632,6 +656,10 @@ export declare interface StaticEnumField<N extends string, O extends readonly En
632
656
  readonly options: O;
633
657
  /** Display label for the field */
634
658
  readonly label?: string;
659
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
660
+ readonly displayName?: string;
661
+ /** JSON-facing serialized name for the field. */
662
+ readonly apiName?: string;
635
663
  /** Whether this field is required for form submission */
636
664
  readonly required?: boolean;
637
665
  }
@@ -658,6 +686,10 @@ export declare interface TextField<N extends string> {
658
686
  readonly name: N;
659
687
  /** Display label for the field */
660
688
  readonly label?: string;
689
+ /** Canonical display name for the field. Alias of `label` in the chain DSL. */
690
+ readonly displayName?: string;
691
+ /** JSON-facing serialized name for the field. */
692
+ readonly apiName?: string;
661
693
  /** Placeholder text shown when field is empty */
662
694
  readonly placeholder?: string;
663
695
  /** Whether this field is required for form submission */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formspec/constraints",
3
- "version": "0.1.0-alpha.27",
3
+ "version": "0.1.0-alpha.29",
4
4
  "description": "Constraint validation for FormSpec - restrict features based on target environment capabilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -22,16 +22,17 @@
22
22
  "files": [
23
23
  "dist",
24
24
  "formspec.schema.json",
25
- "README.md"
25
+ "README.md",
26
+ "LICENSE"
26
27
  ],
27
28
  "dependencies": {
28
29
  "yaml": "^2.7.0",
29
- "@formspec/core": "0.1.0-alpha.27"
30
+ "@formspec/core": "0.1.0-alpha.29"
30
31
  },
31
32
  "devDependencies": {
32
33
  "tsd": "^0.31.0",
33
34
  "vitest": "^3.0.0",
34
- "@formspec/dsl": "0.1.0-alpha.27"
35
+ "@formspec/dsl": "0.1.0-alpha.29"
35
36
  },
36
37
  "tsd": {
37
38
  "directory": "src/__tests__"
@@ -46,7 +47,7 @@
46
47
  "jsonschema",
47
48
  "jsonforms"
48
49
  ],
49
- "license": "UNLICENSED",
50
+ "license": "MIT",
50
51
  "scripts": {
51
52
  "build": "tsup && tsc --emitDeclarationOnly && pnpm run api-extractor:local",
52
53
  "clean": "rm -rf dist temp",