@formspec/build 0.1.0-alpha.12 → 0.1.0-alpha.13

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=guards.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/guards.test.ts"],"names":[],"mappings":""}
package/dist/browser.cjs CHANGED
@@ -114,11 +114,40 @@ function canonicalizeField(field) {
114
114
  }
115
115
  function canonicalizeTextField(field) {
116
116
  const type = { kind: "primitive", primitiveKind: "string" };
117
+ const constraints = [];
118
+ if (field.minLength !== void 0) {
119
+ const c = {
120
+ kind: "constraint",
121
+ constraintKind: "minLength",
122
+ value: field.minLength,
123
+ provenance: CHAIN_DSL_PROVENANCE
124
+ };
125
+ constraints.push(c);
126
+ }
127
+ if (field.maxLength !== void 0) {
128
+ const c = {
129
+ kind: "constraint",
130
+ constraintKind: "maxLength",
131
+ value: field.maxLength,
132
+ provenance: CHAIN_DSL_PROVENANCE
133
+ };
134
+ constraints.push(c);
135
+ }
136
+ if (field.pattern !== void 0) {
137
+ const c = {
138
+ kind: "constraint",
139
+ constraintKind: "pattern",
140
+ pattern: field.pattern,
141
+ provenance: CHAIN_DSL_PROVENANCE
142
+ };
143
+ constraints.push(c);
144
+ }
117
145
  return buildFieldNode(
118
146
  field.name,
119
147
  type,
120
148
  field.required,
121
- buildAnnotations(field.label, field.placeholder)
149
+ buildAnnotations(field.label, field.placeholder),
150
+ constraints
122
151
  );
123
152
  }
124
153
  function canonicalizeNumberField(field) {
@@ -142,6 +171,15 @@ function canonicalizeNumberField(field) {
142
171
  };
143
172
  constraints.push(c);
144
173
  }
174
+ if (field.multipleOf !== void 0) {
175
+ const c = {
176
+ kind: "constraint",
177
+ constraintKind: "multipleOf",
178
+ value: field.multipleOf,
179
+ provenance: CHAIN_DSL_PROVENANCE
180
+ };
181
+ constraints.push(c);
182
+ }
145
183
  return buildFieldNode(
146
184
  field.name,
147
185
  type,