schema-components 1.12.11 → 1.13.0

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 (63) hide show
  1. package/README.md +31 -0
  2. package/dist/core/adapter.d.mts +1 -1
  3. package/dist/core/adapter.mjs +37 -8
  4. package/dist/core/constraints.d.mts +16 -0
  5. package/dist/core/constraints.mjs +138 -0
  6. package/dist/core/merge.d.mts +32 -0
  7. package/dist/core/merge.mjs +96 -0
  8. package/dist/core/normalise.d.mts +40 -0
  9. package/dist/core/normalise.mjs +171 -0
  10. package/dist/core/openapi30.d.mts +38 -0
  11. package/dist/core/openapi30.mjs +223 -0
  12. package/dist/core/ref.d.mts +25 -0
  13. package/dist/core/ref.mjs +86 -0
  14. package/dist/core/renderer.d.mts +2 -2
  15. package/dist/core/renderer.mjs +8 -0
  16. package/dist/core/swagger2.d.mts +10 -0
  17. package/dist/core/swagger2.mjs +294 -0
  18. package/dist/core/typeInference.d.mts +2 -0
  19. package/dist/core/typeInference.mjs +1 -0
  20. package/dist/core/types.d.mts +2 -3
  21. package/dist/core/types.mjs +55 -2
  22. package/dist/core/version.d.mts +2 -0
  23. package/dist/core/version.mjs +79 -0
  24. package/dist/core/walkBuilders.d.mts +52 -0
  25. package/dist/core/walkBuilders.mjs +152 -0
  26. package/dist/core/walker.d.mts +3 -10
  27. package/dist/core/walker.mjs +143 -231
  28. package/dist/html/a11y.d.mts +5 -4
  29. package/dist/html/renderToHtml.d.mts +3 -3
  30. package/dist/html/renderToHtml.mjs +23 -379
  31. package/dist/html/renderToHtmlStream.d.mts +29 -47
  32. package/dist/html/renderToHtmlStream.mjs +33 -305
  33. package/dist/html/renderers.d.mts +14 -0
  34. package/dist/html/renderers.mjs +406 -0
  35. package/dist/html/streamRenderers.d.mts +13 -0
  36. package/dist/html/streamRenderers.mjs +243 -0
  37. package/dist/openapi/components.d.mts +2 -1
  38. package/dist/openapi/parser.d.mts +59 -2
  39. package/dist/openapi/parser.mjs +189 -8
  40. package/dist/react/SchemaComponent.d.mts +4 -2
  41. package/dist/react/SchemaComponent.mjs +39 -85
  42. package/dist/react/SchemaView.d.mts +2 -1
  43. package/dist/react/SchemaView.mjs +21 -9
  44. package/dist/react/fieldPath.d.mts +20 -0
  45. package/dist/react/fieldPath.mjs +81 -0
  46. package/dist/react/headless.d.mts +2 -4
  47. package/dist/react/headless.mjs +3 -492
  48. package/dist/react/headlessRenderers.d.mts +23 -0
  49. package/dist/react/headlessRenderers.mjs +507 -0
  50. package/dist/renderer-DseHeliw.d.mts +160 -0
  51. package/dist/themes/mantine.d.mts +1 -1
  52. package/dist/themes/mantine.mjs +2 -1
  53. package/dist/themes/mui.d.mts +1 -1
  54. package/dist/themes/mui.mjs +2 -1
  55. package/dist/themes/radix.d.mts +1 -1
  56. package/dist/themes/radix.mjs +2 -1
  57. package/dist/themes/shadcn.d.mts +1 -1
  58. package/dist/themes/shadcn.mjs +10 -6
  59. package/dist/typeInference-CRPqVwKu.d.mts +299 -0
  60. package/dist/types-ag2jYLqQ.d.mts +261 -0
  61. package/dist/version-CLchheaH.d.mts +40 -0
  62. package/package.json +1 -1
  63. package/dist/types-BJzEgJdX.d.mts +0 -335
@@ -1,186 +1,9 @@
1
1
  import { isObject } from "./guards.mjs";
2
- import { resolveEditability } from "./types.mjs";
2
+ import { resolveRef } from "./ref.mjs";
3
+ import { extractArrayConstraints, extractObjectConstraints, stripInapplicableConstraints } from "./constraints.mjs";
4
+ import { detectDiscriminated, mergeAllOf, normaliseAnyOf } from "./merge.mjs";
5
+ import { buildBase, buildBooleanField, buildFileField, buildNullField, buildNumberField, buildStringField, buildUnknownField, extractChildOverride, extractSchemaMetaFields, getArray, getObject, getString, isPrimitive, walkDependentRequiredMap, walkSubSchemaMap, withoutKeys } from "./walkBuilders.mjs";
3
6
  //#region src/core/walker.ts
4
- function getString(obj, key) {
5
- const value = obj[key];
6
- return typeof value === "string" ? value : void 0;
7
- }
8
- function getNumber(obj, key) {
9
- const value = obj[key];
10
- return typeof value === "number" ? value : void 0;
11
- }
12
- function getArray(obj, key) {
13
- const value = obj[key];
14
- return Array.isArray(value) ? value : void 0;
15
- }
16
- function getObject(obj, key) {
17
- const value = obj[key];
18
- return isObject(value) ? value : void 0;
19
- }
20
- const MAX_REF_DEPTH = 10;
21
- function resolveRef(schema, rootDocument, visited) {
22
- const ref = getString(schema, "$ref");
23
- if (ref === void 0) return schema;
24
- if (visited.has(ref)) return { type: "unknown" };
25
- if (visited.size >= MAX_REF_DEPTH) return { type: "unknown" };
26
- const resolved = dereference(ref, rootDocument);
27
- if (resolved === void 0) return { type: "unknown" };
28
- const nextVisited = new Set(visited);
29
- nextVisited.add(ref);
30
- return resolveRef(resolved, rootDocument, nextVisited);
31
- }
32
- function dereference(ref, root) {
33
- if (ref === "#") return root;
34
- if (!ref.startsWith("#/")) return void 0;
35
- const parts = ref.slice(2).split("/");
36
- if (parts.length === 1 && parts[0] === "") return root;
37
- let current = root;
38
- for (const part of parts) {
39
- if (!isObject(current)) return void 0;
40
- const decoded = part.replace(/~1/g, "/").replace(/~0/g, "~");
41
- current = current[decoded];
42
- }
43
- return isObject(current) ? current : void 0;
44
- }
45
- /**
46
- * Merge multiple JSON Schema objects from allOf into one.
47
- * Merges: properties, required, meta fields, and constraints.
48
- */
49
- function mergeAllOf(schemas) {
50
- const merged = {};
51
- const properties = {};
52
- const required = [];
53
- for (const entry of schemas) {
54
- if (!isObject(entry)) continue;
55
- const props = getObject(entry, "properties");
56
- if (props !== void 0) for (const [key, value] of Object.entries(props)) properties[key] = value;
57
- const req = getArray(entry, "required");
58
- if (req !== void 0) {
59
- for (const r of req) if (typeof r === "string" && !required.includes(r)) required.push(r);
60
- }
61
- for (const [key, value] of Object.entries(entry)) {
62
- if (key === "properties" || key === "required" || key === "allOf" || key === "type") continue;
63
- if (!(key in merged)) merged[key] = value;
64
- }
65
- if (!("type" in merged)) {
66
- const type = getString(entry, "type");
67
- if (type !== void 0) merged.type = type;
68
- }
69
- }
70
- if (Object.keys(properties).length > 0) merged.properties = properties;
71
- if (required.length > 0) merged.required = required;
72
- return merged;
73
- }
74
- /**
75
- * Detect `anyOf: [T, { type: "null" }]` → nullable T.
76
- * Returns the non-null schema and a nullable flag.
77
- */
78
- function normaliseAnyOf(options) {
79
- if (options.length !== 2) return void 0;
80
- let inner;
81
- let hasNull = false;
82
- for (const opt of options) {
83
- if (!isObject(opt)) return void 0;
84
- if (opt.type === "null") hasNull = true;
85
- else inner = opt;
86
- }
87
- if (!hasNull || inner === void 0) return void 0;
88
- return {
89
- inner,
90
- isNullable: true
91
- };
92
- }
93
- /**
94
- * Detect oneOf where every option is an object with a property
95
- * that has a `const` value → discriminated union.
96
- */
97
- function detectDiscriminated(options) {
98
- if (options.length === 0) return void 0;
99
- let discriminator;
100
- for (const opt of options) {
101
- if (!isObject(opt)) return void 0;
102
- const props = getObject(opt, "properties");
103
- if (props === void 0) return void 0;
104
- let foundKey;
105
- for (const [key, value] of Object.entries(props)) if (isObject(value) && "const" in value) {
106
- foundKey = key;
107
- break;
108
- }
109
- if (foundKey === void 0) return void 0;
110
- if (discriminator === void 0) discriminator = foundKey;
111
- else if (discriminator !== foundKey) return;
112
- }
113
- if (discriminator === void 0) return void 0;
114
- return {
115
- options: options.filter(isObject),
116
- discriminator
117
- };
118
- }
119
- const META_KEYWORDS = new Set([
120
- "readOnly",
121
- "writeOnly",
122
- "description",
123
- "title",
124
- "deprecated",
125
- "default",
126
- "component",
127
- "example",
128
- "examples"
129
- ]);
130
- function extractMetaFromJson(schema) {
131
- const meta = {};
132
- for (const [key, value] of Object.entries(schema)) if (META_KEYWORDS.has(key)) meta[key] = value;
133
- return meta;
134
- }
135
- function extractConstraintsFromJson(schema) {
136
- const constraints = {};
137
- const minLength = getNumber(schema, "minLength");
138
- if (minLength !== void 0) constraints.minLength = minLength;
139
- const maxLength = getNumber(schema, "maxLength");
140
- if (maxLength !== void 0) constraints.maxLength = maxLength;
141
- const minimum = getNumber(schema, "minimum");
142
- if (minimum !== void 0) constraints.minimum = minimum;
143
- const maximum = getNumber(schema, "maximum");
144
- if (maximum !== void 0) constraints.maximum = maximum;
145
- const pattern = getString(schema, "pattern");
146
- if (pattern !== void 0) constraints.pattern = pattern;
147
- const format = getString(schema, "format");
148
- if (format !== void 0) constraints.format = format;
149
- const minItems = getNumber(schema, "minItems");
150
- if (minItems !== void 0) constraints.minItems = minItems;
151
- const maxItems = getNumber(schema, "maxItems");
152
- if (maxItems !== void 0) constraints.maxItems = maxItems;
153
- if (format === "binary") {
154
- const contentMediaType = getString(schema, "contentMediaType");
155
- if (contentMediaType !== void 0) constraints.mimeTypes = [contentMediaType];
156
- }
157
- return constraints;
158
- }
159
- const OVERRIDE_META_KEYS = new Set([
160
- "readOnly",
161
- "writeOnly",
162
- "description",
163
- "title",
164
- "deprecated",
165
- "component",
166
- "visible",
167
- "order"
168
- ]);
169
- function extractSchemaMetaFields(overrides) {
170
- if (overrides === void 0) return void 0;
171
- const meta = {};
172
- for (const key of Object.keys(overrides)) if (OVERRIDE_META_KEYS.has(key)) meta[key] = overrides[key];
173
- return Object.keys(meta).length > 0 ? meta : void 0;
174
- }
175
- function extractChildOverride(overrides, key) {
176
- if (overrides === void 0) return void 0;
177
- const child = overrides[key];
178
- if (child === void 0 || child === null) return void 0;
179
- if (typeof child !== "object" || Array.isArray(child)) return void 0;
180
- const result = {};
181
- for (const [k, v] of Object.entries(child)) result[k] = v;
182
- return Object.keys(result).length > 0 ? result : void 0;
183
- }
184
7
  function walk(schema, options = {}) {
185
8
  const { componentMeta, rootMeta, fieldOverrides, rootDocument } = options;
186
9
  if (!isObject(schema)) return {
@@ -235,56 +58,118 @@ function walkNode(schema, ctx) {
235
58
  Object.assign(placeholder, result);
236
59
  return placeholder;
237
60
  }
61
+ const ifSchema = getObject(schema, "if");
62
+ if (ifSchema !== void 0) {
63
+ const base = buildBase(withoutKeys(schema, [
64
+ "if",
65
+ "then",
66
+ "else"
67
+ ]), ctx);
68
+ const thenSchema = getObject(schema, "then");
69
+ const elseSchema = getObject(schema, "else");
70
+ const conditional = {
71
+ ...base,
72
+ type: "conditional",
73
+ constraints: {},
74
+ ifClause: walkNode(ifSchema, ctx)
75
+ };
76
+ if (thenSchema !== void 0) conditional.thenClause = walkNode(thenSchema, ctx);
77
+ if (elseSchema !== void 0) conditional.elseClause = walkNode(elseSchema, ctx);
78
+ return conditional;
79
+ }
80
+ const notSchema = getObject(schema, "not");
81
+ if (notSchema !== void 0) return {
82
+ ...buildBase(withoutKeys(schema, ["not"]), ctx),
83
+ type: "negation",
84
+ constraints: {},
85
+ negated: walkNode(notSchema, ctx)
86
+ };
238
87
  const enumValues = getArray(schema, "enum");
239
88
  if (enumValues !== void 0) return walkEnum(schema, enumValues, ctx);
240
89
  if ("const" in schema) return walkLiteral(schema, ctx);
241
90
  const type = getString(schema, "type");
242
- if (type === void 0) return buildField(schema, "unknown", ctx);
91
+ const typeArray = getArray(schema, "type");
92
+ if (type === void 0 && typeArray !== void 0) {
93
+ const nonNullTypes = typeArray.filter((t) => typeof t === "string" && t !== "null");
94
+ const hasNull = typeArray.includes("null");
95
+ if (nonNullTypes.length === 0) return buildNullField(schema, ctx);
96
+ if (nonNullTypes.length === 1) {
97
+ const walkCtx = hasNull ? {
98
+ ...ctx,
99
+ isNullable: true
100
+ } : ctx;
101
+ const singleType = nonNullTypes[0];
102
+ if (singleType === void 0) return buildUnknownField(schema, ctx);
103
+ return walkNode({
104
+ ...stripInapplicableConstraints(schema, singleType),
105
+ type: singleType
106
+ }, walkCtx);
107
+ }
108
+ const options = nonNullTypes.map((t) => ({
109
+ ...stripInapplicableConstraints(schema, t),
110
+ type: t
111
+ }));
112
+ if (hasNull) return walkUnion([...options, { type: "null" }], {
113
+ ...ctx,
114
+ isNullable: true
115
+ });
116
+ return walkUnion(options, ctx);
117
+ }
118
+ if (type === void 0) return buildUnknownField(schema, ctx);
243
119
  if (type === "string") return walkString(schema, ctx);
244
120
  if (type === "number" || type === "integer") return walkNumber(schema, ctx);
245
121
  if (type === "boolean") return walkBoolean(schema, ctx);
246
- if (type === "null") return buildField(schema, "null", ctx);
122
+ if (type === "null") return buildNullField(schema, ctx);
247
123
  if (type === "object") {
248
124
  const properties = getObject(schema, "properties");
249
125
  if (properties !== void 0) return walkObject(schema, properties, ctx);
250
126
  const additionalProps = getObject(schema, "additionalProperties");
251
127
  if (additionalProps !== void 0) return walkRecord(schema, additionalProps, ctx);
252
- return buildField(schema, "object", ctx);
128
+ return {
129
+ ...buildBase(schema, ctx),
130
+ type: "object",
131
+ constraints: extractObjectConstraints(schema),
132
+ fields: {},
133
+ requiredFields: []
134
+ };
253
135
  }
254
136
  if (type === "array") return walkArray(schema, ctx);
255
- return buildField(schema, "unknown", ctx);
137
+ return buildUnknownField(schema, ctx);
256
138
  }
257
139
  function walkString(schema, ctx) {
258
- if (getString(schema, "format") === "binary") return buildField(schema, "file", ctx);
259
- return buildField(schema, "string", ctx);
140
+ if (getString(schema, "format") === "binary") return buildFileField(schema, ctx);
141
+ return buildStringField(schema, ctx);
260
142
  }
261
143
  function walkNumber(schema, ctx) {
262
- return buildField(schema, "number", ctx);
144
+ return buildNumberField(schema, ctx);
263
145
  }
264
146
  function walkBoolean(schema, ctx) {
265
- return buildField(schema, "boolean", ctx);
147
+ return buildBooleanField(schema, ctx);
266
148
  }
267
149
  function walkEnum(schema, enumValues, ctx) {
268
150
  return {
269
- ...buildField(schema, "enum", ctx),
270
- enumValues: enumValues.filter((v) => typeof v === "string")
151
+ ...buildBase(schema, ctx),
152
+ type: "enum",
153
+ constraints: {},
154
+ enumValues: enumValues.filter((v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean" || v === null)
271
155
  };
272
156
  }
273
157
  function walkLiteral(schema, ctx) {
274
158
  const constValue = schema.const;
275
159
  const values = isPrimitive(constValue) ? [constValue] : [];
276
160
  return {
277
- ...buildField(schema, "literal", ctx),
161
+ ...buildBase(schema, ctx),
162
+ type: "literal",
163
+ constraints: {},
278
164
  literalValues: values
279
165
  };
280
166
  }
281
167
  function walkObject(schema, properties, ctx) {
282
- const base = buildField(schema, "object", ctx);
283
- const required = getArray(schema, "required");
168
+ const requiredFields = getArray(schema, "required")?.filter((r) => typeof r === "string") ?? [];
284
169
  const fields = {};
285
170
  for (const [key, propSchema] of Object.entries(properties)) {
286
171
  const childOverride = extractChildOverride(ctx.fieldOverrides, key);
287
- const isRequired = required?.includes(key) === true;
172
+ const isRequired = requiredFields.includes(key);
288
173
  const childCtx = {
289
174
  ...ctx,
290
175
  fieldOverrides: childOverride,
@@ -300,13 +185,41 @@ function walkObject(schema, properties, ctx) {
300
185
  constraints: {}
301
186
  };
302
187
  }
188
+ const patternProps = getObject(schema, "patternProperties");
189
+ const walkedPatternProps = patternProps !== void 0 ? walkSubSchemaMap(patternProps, walkNode, ctx) : void 0;
190
+ let additionalPropertiesClosed;
191
+ let additionalPropertiesSchema;
192
+ const additionalProps = schema.additionalProperties;
193
+ if (additionalProps === false) additionalPropertiesClosed = true;
194
+ else if (isObject(additionalProps)) additionalPropertiesSchema = walkNode(additionalProps, ctx);
195
+ const depSchemas = getObject(schema, "dependentSchemas");
196
+ const walkedDepSchemas = depSchemas !== void 0 ? walkSubSchemaMap(depSchemas, walkNode, ctx) : void 0;
197
+ const depReq = getObject(schema, "dependentRequired");
198
+ const walkedDepReq = depReq !== void 0 ? walkDependentRequiredMap(depReq) : void 0;
199
+ let unevaluatedProperties;
200
+ let unevaluatedPropertiesClosed;
201
+ const unevalProps = schema.unevaluatedProperties;
202
+ if (unevalProps === false) unevaluatedPropertiesClosed = true;
203
+ else if (isObject(unevalProps)) unevaluatedProperties = walkNode(unevalProps, ctx);
204
+ const propertyNamesSchema = getObject(schema, "propertyNames");
205
+ const walkedPropertyNames = propertyNamesSchema !== void 0 ? walkNode(propertyNamesSchema, ctx) : void 0;
303
206
  return {
304
- ...base,
305
- fields
207
+ ...buildBase(schema, ctx),
208
+ type: "object",
209
+ constraints: extractObjectConstraints(schema),
210
+ fields,
211
+ requiredFields,
212
+ ...walkedPatternProps !== void 0 && Object.keys(walkedPatternProps).length > 0 ? { patternProperties: walkedPatternProps } : {},
213
+ ...additionalPropertiesClosed ? { additionalPropertiesClosed } : {},
214
+ ...additionalPropertiesSchema !== void 0 ? { additionalPropertiesSchema } : {},
215
+ ...walkedDepSchemas !== void 0 && Object.keys(walkedDepSchemas).length > 0 ? { dependentSchemas: walkedDepSchemas } : {},
216
+ ...walkedDepReq !== void 0 && Object.keys(walkedDepReq).length > 0 ? { dependentRequired: walkedDepReq } : {},
217
+ ...unevaluatedProperties !== void 0 ? { unevaluatedProperties } : {},
218
+ ...unevaluatedPropertiesClosed ? { unevaluatedPropertiesClosed } : {},
219
+ ...walkedPropertyNames !== void 0 ? { propertyNames: walkedPropertyNames } : {}
306
220
  };
307
221
  }
308
222
  function walkRecord(schema, valueSchema, ctx) {
309
- const base = buildField(schema, "record", ctx);
310
223
  const propertyNames = getObject(schema, "propertyNames");
311
224
  const keyType = propertyNames !== void 0 ? walkNode(propertyNames, ctx) : {
312
225
  type: "string",
@@ -316,30 +229,53 @@ function walkRecord(schema, valueSchema, ctx) {
316
229
  };
317
230
  const valueType = walkNode(valueSchema, ctx);
318
231
  return {
319
- ...base,
232
+ ...buildBase(schema, ctx),
233
+ type: "record",
234
+ constraints: extractObjectConstraints(schema),
320
235
  keyType,
321
236
  valueType
322
237
  };
323
238
  }
324
239
  function walkArray(schema, ctx) {
325
- const base = buildField(schema, "array", ctx);
240
+ const prefixItems = getArray(schema, "prefixItems");
241
+ if (prefixItems !== void 0) {
242
+ const walkedItems = prefixItems.filter(isObject).map((item) => walkNode(item, ctx));
243
+ return {
244
+ ...buildBase(schema, ctx),
245
+ type: "tuple",
246
+ constraints: extractArrayConstraints(schema),
247
+ prefixItems: walkedItems
248
+ };
249
+ }
250
+ const unevaluatedItemsSchema = getObject(schema, "unevaluatedItems");
251
+ const walkedUnevaluatedItems = unevaluatedItemsSchema !== void 0 ? walkNode(unevaluatedItemsSchema, ctx) : void 0;
326
252
  const items = getObject(schema, "items");
327
253
  if (items !== void 0) {
328
254
  const elementOverride = extractChildOverride(ctx.fieldOverrides, "[]");
329
255
  return {
330
- ...base,
256
+ ...buildBase(schema, ctx),
257
+ type: "array",
258
+ constraints: extractArrayConstraints(schema),
331
259
  element: walkNode(items, {
332
260
  ...ctx,
333
261
  fieldOverrides: elementOverride
334
- })
262
+ }),
263
+ ...walkedUnevaluatedItems !== void 0 ? { unevaluatedItems: walkedUnevaluatedItems } : {}
335
264
  };
336
265
  }
337
- return base;
266
+ return {
267
+ ...buildBase(schema, ctx),
268
+ type: "array",
269
+ constraints: extractArrayConstraints(schema),
270
+ ...walkedUnevaluatedItems !== void 0 ? { unevaluatedItems: walkedUnevaluatedItems } : {}
271
+ };
338
272
  }
339
273
  function walkUnion(options, ctx) {
340
274
  const optionsArray = options.filter(isObject);
341
275
  return {
342
- ...buildField({}, "union", ctx),
276
+ ...buildBase({}, ctx),
277
+ type: "union",
278
+ constraints: {},
343
279
  options: optionsArray.map((opt) => walkNode(opt, {
344
280
  ...ctx,
345
281
  fieldOverrides: void 0
@@ -348,7 +284,9 @@ function walkUnion(options, ctx) {
348
284
  }
349
285
  function walkDiscriminatedUnion(discriminated, ctx) {
350
286
  return {
351
- ...buildField({}, "discriminatedUnion", ctx),
287
+ ...buildBase({}, ctx),
288
+ type: "discriminatedUnion",
289
+ constraints: {},
352
290
  options: discriminated.options.map((opt) => walkNode(opt, {
353
291
  ...ctx,
354
292
  fieldOverrides: void 0
@@ -356,31 +294,5 @@ function walkDiscriminatedUnion(discriminated, ctx) {
356
294
  discriminator: discriminated.discriminator
357
295
  };
358
296
  }
359
- function buildField(schema, type, ctx) {
360
- const propertyMeta = extractMetaFromJson(schema);
361
- const overrideMeta = extractSchemaMetaFields(ctx.fieldOverrides);
362
- const mergedMeta = {
363
- ...propertyMeta,
364
- ...overrideMeta
365
- };
366
- const defaultValue = "default" in schema ? schema.default : void 0;
367
- const editability = resolveEditability(mergedMeta, ctx.componentMeta, ctx.rootMeta);
368
- if ((overrideMeta !== void 0 && ("readOnly" in overrideMeta || "writeOnly" in overrideMeta) || Boolean(propertyMeta.readOnly) || Boolean(propertyMeta.writeOnly)) && ctx.componentMeta !== void 0) ctx = {
369
- ...ctx,
370
- componentMeta: void 0
371
- };
372
- return {
373
- type,
374
- editability,
375
- meta: mergedMeta,
376
- isOptional: ctx.isOptional,
377
- isNullable: ctx.isNullable,
378
- defaultValue: defaultValue ?? ctx.defaultValue,
379
- constraints: extractConstraintsFromJson(schema)
380
- };
381
- }
382
- function isPrimitive(value) {
383
- return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null;
384
- }
385
297
  //#endregion
386
298
  export { walk };
@@ -1,4 +1,5 @@
1
- import { _ as WalkedField, n as FieldConstraints } from "../types-BJzEgJdX.mjs";
1
+ import { j as WalkedField } from "../types-ag2jYLqQ.mjs";
2
+ import { t as AllConstraints } from "../renderer-DseHeliw.mjs";
2
3
  import { HtmlAttributes, HtmlNode } from "./html.mjs";
3
4
 
4
5
  //#region src/html/a11y.d.ts
@@ -14,7 +15,7 @@ declare function buildHintId(inputId: string): string;
14
15
  * Build a human-readable constraint description string.
15
16
  * Returns undefined if no constraints are present.
16
17
  */
17
- declare function constraintHint(c: FieldConstraints): string | undefined;
18
+ declare function constraintHint(c: AllConstraints): string | undefined;
18
19
  /**
19
20
  * Build `aria-required` attribute for required fields.
20
21
  * Returns an object to spread into `h()` attributes, or empty object.
@@ -24,7 +25,7 @@ declare function ariaRequiredAttrs(tree: WalkedField): Pick<HtmlAttributes, "ari
24
25
  * Build `aria-describedby` attribute pointing to the constraint hint element.
25
26
  * Only present when constraints exist.
26
27
  */
27
- declare function ariaDescribedByAttrs(inputId: string, constraints: FieldConstraints): Pick<HtmlAttributes, "aria-describedby"> | undefined;
28
+ declare function ariaDescribedByAttrs(inputId: string, constraints: AllConstraints): Pick<HtmlAttributes, "aria-describedby"> | undefined;
28
29
  /**
29
30
  * Build `aria-readonly` attribute for read-only presentation.
30
31
  */
@@ -37,7 +38,7 @@ declare function ariaLabelAttrs(description: unknown): Pick<HtmlAttributes, "ari
37
38
  * Build a `<small class="sc-hint">` element for constraint hints.
38
39
  * Returns undefined if no constraints are present.
39
40
  */
40
- declare function buildHintElement(inputId: string, constraints: FieldConstraints): HtmlNode;
41
+ declare function buildHintElement(inputId: string, constraints: AllConstraints): HtmlNode;
41
42
  /**
42
43
  * Build the required-field asterisk indicator for labels.
43
44
  * Returns undefined if the field is optional.
@@ -1,4 +1,5 @@
1
- import { C as HtmlResolver, S as HtmlRenderProps, m as SchemaMeta, x as HtmlRenderFunction } from "../types-BJzEgJdX.mjs";
1
+ import { w as SchemaMeta } from "../types-ag2jYLqQ.mjs";
2
+ import { o as HtmlResolver } from "../renderer-DseHeliw.mjs";
2
3
 
3
4
  //#region src/html/renderToHtml.d.ts
4
5
  interface RenderToHtmlOptions {
@@ -19,7 +20,6 @@ interface RenderToHtmlOptions {
19
20
  /** Custom HTML resolver. Falls back to defaultHtmlResolver. */
20
21
  resolver?: HtmlResolver;
21
22
  }
22
- declare const defaultHtmlResolver: HtmlResolver;
23
23
  /**
24
24
  * Render a schema to an HTML string.
25
25
  *
@@ -29,4 +29,4 @@ declare const defaultHtmlResolver: HtmlResolver;
29
29
  */
30
30
  declare function renderToHtml(schema: unknown, options?: RenderToHtmlOptions): string;
31
31
  //#endregion
32
- export { type HtmlRenderFunction, type HtmlRenderProps, type HtmlResolver, RenderToHtmlOptions, defaultHtmlResolver, renderToHtml };
32
+ export { RenderToHtmlOptions, renderToHtml };