schema-components 1.28.2 → 1.29.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 (81) hide show
  1. package/dist/{adapter-DqlAnZ_w.d.mts → adapter-DcWi4XXn.d.mts} +60 -9
  2. package/dist/core/adapter.d.mts +2 -2
  3. package/dist/core/adapter.mjs +20 -1
  4. package/dist/core/constraints.d.mts +34 -2
  5. package/dist/core/constraints.mjs +32 -0
  6. package/dist/core/cssClasses.d.mts +1 -0
  7. package/dist/core/diagnostics.d.mts +1 -1
  8. package/dist/core/errors.d.mts +1 -1
  9. package/dist/core/errors.mjs +22 -12
  10. package/dist/core/fieldOrder.d.mts +1 -1
  11. package/dist/core/formats.d.mts +7 -1
  12. package/dist/core/formats.mjs +6 -0
  13. package/dist/core/limits.d.mts +1 -1
  14. package/dist/core/limits.mjs +1 -0
  15. package/dist/core/merge.d.mts +11 -1
  16. package/dist/core/normalise.d.mts +17 -2
  17. package/dist/core/openapiConstants.d.mts +1 -0
  18. package/dist/core/ref.d.mts +1 -1
  19. package/dist/core/renderer.d.mts +1 -1
  20. package/dist/core/renderer.mjs +5 -0
  21. package/dist/core/swagger2.d.mts +1 -1
  22. package/dist/core/typeInference.d.mts +2 -2
  23. package/dist/core/types.d.mts +1 -1
  24. package/dist/core/types.mjs +17 -0
  25. package/dist/core/unionMatch.d.mts +1 -1
  26. package/dist/core/version.d.mts +1 -1
  27. package/dist/core/walkBuilders.d.mts +48 -3
  28. package/dist/core/walkBuilders.mjs +30 -0
  29. package/dist/core/walker.d.mts +14 -1
  30. package/dist/core/walker.mjs +13 -0
  31. package/dist/{diagnostics-Cbwak-ZX.d.mts → diagnostics-ByEzkjrA.d.mts} +8 -0
  32. package/dist/{errors-DQSIK4n1.d.mts → errors-D8JndRwI.d.mts} +23 -13
  33. package/dist/html/a11y.d.mts +2 -2
  34. package/dist/html/html.d.mts +11 -0
  35. package/dist/html/html.mjs +11 -0
  36. package/dist/html/renderToHtml.d.mts +25 -5
  37. package/dist/html/renderToHtml.mjs +18 -3
  38. package/dist/html/renderToHtmlStream.d.mts +41 -9
  39. package/dist/html/renderToHtmlStream.mjs +32 -7
  40. package/dist/html/renderers.d.mts +7 -1
  41. package/dist/html/renderers.mjs +6 -0
  42. package/dist/html/streamRenderers.d.mts +31 -3
  43. package/dist/html/streamRenderers.mjs +28 -0
  44. package/dist/{limits-DJhgx5Ay.d.mts → limits-DswmqWuy.d.mts} +1 -0
  45. package/dist/openapi/ApiCallbacks.d.mts +13 -1
  46. package/dist/openapi/ApiCallbacks.mjs +7 -0
  47. package/dist/openapi/ApiLinks.d.mts +13 -1
  48. package/dist/openapi/ApiLinks.mjs +7 -0
  49. package/dist/openapi/ApiResponseHeaders.d.mts +13 -1
  50. package/dist/openapi/ApiResponseHeaders.mjs +7 -0
  51. package/dist/openapi/ApiSecurity.d.mts +14 -1
  52. package/dist/openapi/ApiSecurity.mjs +8 -0
  53. package/dist/openapi/components.d.mts +96 -12
  54. package/dist/openapi/components.mjs +71 -2
  55. package/dist/openapi/parser.d.mts +129 -2
  56. package/dist/openapi/parser.mjs +72 -0
  57. package/dist/openapi/resolve.d.mts +7 -1
  58. package/dist/react/SchemaComponent.d.mts +84 -6
  59. package/dist/react/SchemaComponent.mjs +62 -1
  60. package/dist/react/SchemaErrorBoundary.d.mts +18 -1
  61. package/dist/react/SchemaErrorBoundary.mjs +13 -1
  62. package/dist/react/SchemaView.d.mts +32 -8
  63. package/dist/react/SchemaView.mjs +20 -5
  64. package/dist/react/a11y.d.mts +1 -1
  65. package/dist/react/fieldPath.d.mts +1 -1
  66. package/dist/react/headless.d.mts +1 -1
  67. package/dist/react/headlessRenderers.d.mts +13 -2
  68. package/dist/react/headlessRenderers.mjs +12 -1
  69. package/dist/{ref-TdeMfaV_.d.mts → ref-CPh8rKQ3.d.mts} +1 -1
  70. package/dist/{renderer-Ul9taFYp.d.mts → renderer-OaOz-n6-.d.mts} +17 -1
  71. package/dist/themes/mantine.d.mts +29 -3
  72. package/dist/themes/mantine.mjs +28 -2
  73. package/dist/themes/mui.d.mts +29 -2
  74. package/dist/themes/mui.mjs +29 -2
  75. package/dist/themes/radix.d.mts +40 -3
  76. package/dist/themes/radix.mjs +39 -2
  77. package/dist/themes/shadcn.d.mts +22 -1
  78. package/dist/themes/shadcn.mjs +21 -0
  79. package/dist/{types-BTB73MB8.d.mts → types-C2Ay1FEh.d.mts} +23 -0
  80. package/dist/{version-ZzL5R6cS.d.mts → version-DL8U5RuA.d.mts} +6 -0
  81. package/package.json +5 -1
@@ -1,11 +1,28 @@
1
- import { m as JsonObject, w as SchemaMeta } from "./types-BTB73MB8.mjs";
2
- import { i as DiagnosticsOptions } from "./diagnostics-Cbwak-ZX.mjs";
1
+ import { m as JsonObject, w as SchemaMeta } from "./types-C2Ay1FEh.mjs";
2
+ import { i as DiagnosticsOptions } from "./diagnostics-ByEzkjrA.mjs";
3
3
 
4
4
  //#region src/core/adapter.d.ts
5
+ /**
6
+ * Permissive input alias accepted by {@link normaliseSchema}. Every
7
+ * supported source (Zod 4 schema, plain JSON Schema, OpenAPI document)
8
+ * is reachable through `Record<string, unknown>`, so consumers can
9
+ * accept the union without committing to a specific shape at the API
10
+ * boundary.
11
+ *
12
+ * @group Adapter
13
+ */
5
14
  type SchemaInput = Record<string, unknown>;
15
+ /**
16
+ * Classification produced by {@link detectSchemaKind} when inspecting a
17
+ * runtime schema input.
18
+ *
19
+ * @group Adapter
20
+ */
6
21
  type SchemaKind = "zod4" | "zod3" | "jsonSchema" | "openapi" | "unsupported-schema-lib";
7
22
  /**
8
- * Classify the input schema by its structural markers.
23
+ * Classify a runtime schema input by structural markers — Zod 4, Zod 3,
24
+ * OpenAPI document, plain JSON Schema, or an unsupported third-party
25
+ * schema library.
9
26
  *
10
27
  * - `zod4` — has a `_zod` marker (further validation that `_zod.def` is a
11
28
  * non-null object happens inside `normaliseZod4`).
@@ -20,6 +37,8 @@ type SchemaKind = "zod4" | "zod3" | "jsonSchema" | "openapi" | "unsupported-sche
20
37
  * implementations (valibot, arktype, etc.) that would otherwise flow
21
38
  * through as "malformed JSON Schema".
22
39
  * - `jsonSchema` — fallback for anything that does not match the above.
40
+ *
41
+ * @group Adapter
23
42
  */
24
43
  declare function detectSchemaKind(input: unknown): SchemaKind;
25
44
  /**
@@ -90,12 +109,16 @@ declare function detectSchemaKind(input: unknown): SchemaKind;
90
109
  * field so consumers can still inspect the Zod stack trace.
91
110
  */
92
111
  /**
93
- * IO side passed to the internal `callToJsonSchema` helper. The Zod runtime accepts
94
- * `"input" | "output"` for the corresponding `io` option on
95
- * `z.toJSONSchema`. Defaults to `"output"` everywhere in the adapter
96
- * pipeline; the parameter exists so a future renderer or component
97
- * (currently SchemaComponent see TODO below) can request the input
98
- * side without forking the helper.
112
+ * Direction of the Zod transform / pipe / codec that
113
+ * {@link normaliseSchema} should surface to the renderer.
114
+ *
115
+ * - `"output"` (default) the server-facing side of every transform,
116
+ * matching `z.toJSONSchema`'s default and the historic adapter
117
+ * behaviour.
118
+ * - `"input"` — the client-facing side; flips a `z.codec(...)` chain
119
+ * so consumers can render its input shape.
120
+ *
121
+ * @group Adapter
99
122
  */
100
123
  type SchemaIoSide = "input" | "output";
101
124
  /**
@@ -125,6 +148,14 @@ declare function isCodecSchema(value: unknown): boolean;
125
148
  declare const __CLASSIFIER_RULES_FOR_TEST: readonly {
126
149
  readonly prefix: string;
127
150
  }[];
151
+ /**
152
+ * Result of {@link normaliseSchema}. Carries the canonical Draft 2020-12
153
+ * JSON Schema the walker consumes, the optional original Zod schema
154
+ * (used for validation), and the resolved root document so cross-document
155
+ * `$ref`s can be dereferenced downstream.
156
+ *
157
+ * @group Adapter
158
+ */
128
159
  interface NormalisedSchema {
129
160
  /** JSON Schema object — the authoritative schema for rendering. */
130
161
  jsonSchema: JsonObject;
@@ -135,6 +166,11 @@ interface NormalisedSchema {
135
166
  /** The root document for $ref resolution. */
136
167
  rootDocument: JsonObject;
137
168
  }
169
+ /**
170
+ * Options accepted by {@link normaliseSchema}.
171
+ *
172
+ * @group Adapter
173
+ */
138
174
  interface NormaliseOptions {
139
175
  /** Diagnostics channel for surfacing silent fallbacks. */
140
176
  diagnostics?: DiagnosticsOptions;
@@ -149,6 +185,21 @@ interface NormaliseOptions {
149
185
  */
150
186
  io?: SchemaIoSide;
151
187
  }
188
+ /**
189
+ * Normalise any supported schema input — Zod 4 schema, plain JSON
190
+ * Schema (any draft), Swagger 2.0, OpenAPI 3.0 or 3.1 document — into
191
+ * a canonical Draft 2020-12 {@link NormalisedSchema} the walker can
192
+ * consume.
193
+ *
194
+ * Dispatches on {@link detectSchemaKind}, applies the appropriate
195
+ * version normaliser, and returns the JSON Schema alongside the
196
+ * original Zod schema (for validation) and the resolved root document
197
+ * (for cross-document `$ref` resolution). Throws
198
+ * `SchemaNormalisationError` for unsupported inputs (Zod 3, valibot,
199
+ * arktype, codec or other unrepresentable Zod types).
200
+ *
201
+ * @group Adapter
202
+ */
152
203
  declare function normaliseSchema(input: unknown, ref?: string, options?: NormaliseOptions): NormalisedSchema;
153
204
  /**
154
205
  * Surface root-level metadata from the JSON Schema into the `rootMeta`
@@ -1,3 +1,3 @@
1
- import { m as JsonObject, w as SchemaMeta } from "../types-BTB73MB8.mjs";
2
- import { a as SchemaKind, c as extractRootMetaFromJson, i as SchemaIoSide, l as isCodecSchema, n as NormalisedSchema, o as __CLASSIFIER_RULES_FOR_TEST, r as SchemaInput, s as detectSchemaKind, t as NormaliseOptions, u as normaliseSchema } from "../adapter-DqlAnZ_w.mjs";
1
+ import { m as JsonObject, w as SchemaMeta } from "../types-C2Ay1FEh.mjs";
2
+ import { a as SchemaKind, c as extractRootMetaFromJson, i as SchemaIoSide, l as isCodecSchema, n as NormalisedSchema, o as __CLASSIFIER_RULES_FOR_TEST, r as SchemaInput, s as detectSchemaKind, t as NormaliseOptions, u as normaliseSchema } from "../adapter-DcWi4XXn.mjs";
3
3
  export { JsonObject, NormaliseOptions, NormalisedSchema, SchemaInput, SchemaIoSide, SchemaKind, SchemaMeta, __CLASSIFIER_RULES_FOR_TEST, detectSchemaKind, extractRootMetaFromJson, isCodecSchema, normaliseSchema };
@@ -20,7 +20,9 @@ import { z } from "zod";
20
20
  */
21
21
  const schemaCache = /* @__PURE__ */ new WeakMap();
22
22
  /**
23
- * Classify the input schema by its structural markers.
23
+ * Classify a runtime schema input by structural markers — Zod 4, Zod 3,
24
+ * OpenAPI document, plain JSON Schema, or an unsupported third-party
25
+ * schema library.
24
26
  *
25
27
  * - `zod4` — has a `_zod` marker (further validation that `_zod.def` is a
26
28
  * non-null object happens inside `normaliseZod4`).
@@ -35,6 +37,8 @@ const schemaCache = /* @__PURE__ */ new WeakMap();
35
37
  * implementations (valibot, arktype, etc.) that would otherwise flow
36
38
  * through as "malformed JSON Schema".
37
39
  * - `jsonSchema` — fallback for anything that does not match the above.
40
+ *
41
+ * @group Adapter
38
42
  */
39
43
  function detectSchemaKind(input) {
40
44
  if (hasProperty(input, "_zod")) return "zod4";
@@ -624,6 +628,21 @@ function classifyZodConversionError(err, schema) {
624
628
  * `prefix` value and assert mutual non-prefixing.
625
629
  */
626
630
  const __CLASSIFIER_RULES_FOR_TEST = CLASSIFIER_RULES;
631
+ /**
632
+ * Normalise any supported schema input — Zod 4 schema, plain JSON
633
+ * Schema (any draft), Swagger 2.0, OpenAPI 3.0 or 3.1 document — into
634
+ * a canonical Draft 2020-12 {@link NormalisedSchema} the walker can
635
+ * consume.
636
+ *
637
+ * Dispatches on {@link detectSchemaKind}, applies the appropriate
638
+ * version normaliser, and returns the JSON Schema alongside the
639
+ * original Zod schema (for validation) and the resolved root document
640
+ * (for cross-document `$ref` resolution). Throws
641
+ * `SchemaNormalisationError` for unsupported inputs (Zod 3, valibot,
642
+ * arktype, codec or other unrepresentable Zod types).
643
+ *
644
+ * @group Adapter
645
+ */
627
646
  function normaliseSchema(input, ref, options) {
628
647
  const usesDiagnostics = options?.diagnostics !== void 0;
629
648
  const nonDefaultIo = options?.io !== void 0 && options.io !== "output";
@@ -1,11 +1,43 @@
1
- import { E as StringConstraints, f as FileConstraints, t as ArrayConstraints, x as ObjectConstraints, y as NumberConstraints } from "../types-BTB73MB8.mjs";
2
- import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
1
+ import { E as StringConstraints, f as FileConstraints, t as ArrayConstraints, x as ObjectConstraints, y as NumberConstraints } from "../types-C2Ay1FEh.mjs";
2
+ import { i as DiagnosticsOptions } from "../diagnostics-ByEzkjrA.mjs";
3
3
 
4
4
  //#region src/core/constraints.d.ts
5
+ /**
6
+ * Read the JSON Schema string constraint keywords (`minLength`,
7
+ * `maxLength`, `pattern`, `format`, `contentEncoding`,
8
+ * `contentMediaType`) from a schema node and return them in the
9
+ * `StringConstraints` shape consumed by string field renderers.
10
+ * Emits an `unknown-format` diagnostic for unrecognised `format`
11
+ * values.
12
+ */
5
13
  declare function extractStringConstraints(schema: Record<string, unknown>, diagnostics?: DiagnosticsOptions, pointer?: string): StringConstraints;
14
+ /**
15
+ * Read the JSON Schema number constraint keywords (`minimum`,
16
+ * `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf`)
17
+ * from a schema node and return them in the `NumberConstraints` shape
18
+ * consumed by number field renderers.
19
+ */
6
20
  declare function extractNumberConstraints(schema: Record<string, unknown>): NumberConstraints;
21
+ /**
22
+ * Read the JSON Schema array constraint keywords (`minItems`,
23
+ * `maxItems`, `uniqueItems`, `minContains`, `maxContains`) from a
24
+ * schema node and return them in the `ArrayConstraints` shape. The
25
+ * `contains` and `unevaluatedItems` sub-schemas are walked separately
26
+ * and surfaced on the `ArrayField` / `TupleField` directly rather
27
+ * than as raw constraints.
28
+ */
7
29
  declare function extractArrayConstraints(schema: Record<string, unknown>): ArrayConstraints;
30
+ /**
31
+ * Read the JSON Schema object constraint keywords (`minProperties`,
32
+ * `maxProperties`) from a schema node and return them in the
33
+ * `ObjectConstraints` shape.
34
+ */
8
35
  declare function extractObjectConstraints(schema: Record<string, unknown>): ObjectConstraints;
36
+ /**
37
+ * Read the JSON Schema file constraints from a schema node — currently
38
+ * just `contentMediaType`, which surfaces as the single-entry
39
+ * `mimeTypes` array on `FileConstraints`.
40
+ */
9
41
  declare function extractFileConstraints(schema: Record<string, unknown>): FileConstraints;
10
42
  /**
11
43
  * Return a copy of the schema with constraint keywords that don't apply
@@ -9,6 +9,14 @@ function getNumber(obj, key) {
9
9
  const value = obj[key];
10
10
  return typeof value === "number" ? value : void 0;
11
11
  }
12
+ /**
13
+ * Read the JSON Schema string constraint keywords (`minLength`,
14
+ * `maxLength`, `pattern`, `format`, `contentEncoding`,
15
+ * `contentMediaType`) from a schema node and return them in the
16
+ * `StringConstraints` shape consumed by string field renderers.
17
+ * Emits an `unknown-format` diagnostic for unrecognised `format`
18
+ * values.
19
+ */
12
20
  function extractStringConstraints(schema, diagnostics, pointer = "") {
13
21
  const c = {};
14
22
  const minLength = getNumber(schema, "minLength");
@@ -35,6 +43,12 @@ function extractStringConstraints(schema, diagnostics, pointer = "") {
35
43
  if (contentMediaType !== void 0) c.contentMediaType = contentMediaType;
36
44
  return c;
37
45
  }
46
+ /**
47
+ * Read the JSON Schema number constraint keywords (`minimum`,
48
+ * `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf`)
49
+ * from a schema node and return them in the `NumberConstraints` shape
50
+ * consumed by number field renderers.
51
+ */
38
52
  function extractNumberConstraints(schema) {
39
53
  const c = {};
40
54
  const minimum = getNumber(schema, "minimum");
@@ -49,6 +63,14 @@ function extractNumberConstraints(schema) {
49
63
  if (multipleOf !== void 0) c.multipleOf = multipleOf;
50
64
  return c;
51
65
  }
66
+ /**
67
+ * Read the JSON Schema array constraint keywords (`minItems`,
68
+ * `maxItems`, `uniqueItems`, `minContains`, `maxContains`) from a
69
+ * schema node and return them in the `ArrayConstraints` shape. The
70
+ * `contains` and `unevaluatedItems` sub-schemas are walked separately
71
+ * and surfaced on the `ArrayField` / `TupleField` directly rather
72
+ * than as raw constraints.
73
+ */
52
74
  function extractArrayConstraints(schema) {
53
75
  const c = {};
54
76
  const minItems = getNumber(schema, "minItems");
@@ -62,6 +84,11 @@ function extractArrayConstraints(schema) {
62
84
  if (maxContains !== void 0) c.maxContains = maxContains;
63
85
  return c;
64
86
  }
87
+ /**
88
+ * Read the JSON Schema object constraint keywords (`minProperties`,
89
+ * `maxProperties`) from a schema node and return them in the
90
+ * `ObjectConstraints` shape.
91
+ */
65
92
  function extractObjectConstraints(schema) {
66
93
  const c = {};
67
94
  const minProperties = getNumber(schema, "minProperties");
@@ -70,6 +97,11 @@ function extractObjectConstraints(schema) {
70
97
  if (maxProperties !== void 0) c.maxProperties = maxProperties;
71
98
  return c;
72
99
  }
100
+ /**
101
+ * Read the JSON Schema file constraints from a schema node — currently
102
+ * just `contentMediaType`, which surfaces as the single-entry
103
+ * `mimeTypes` array on `FileConstraints`.
104
+ */
73
105
  function extractFileConstraints(schema) {
74
106
  const c = {};
75
107
  const contentMediaType = getString(schema, "contentMediaType");
@@ -47,6 +47,7 @@ declare const SC_CLASSES: {
47
47
  readonly never: "sc-never";
48
48
  readonly recursive: "sc-recursive";
49
49
  };
50
+ /** Stable string-literal key into the canonical {@link SC_CLASSES} map. */
50
51
  type ScClassKey = keyof typeof SC_CLASSES;
51
52
  //#endregion
52
53
  export { ELLIPSIS, EM_DASH, SC_CLASSES, SC_ID_PREFIX, ScClassKey };
@@ -1,2 +1,2 @@
1
- import { a as appendPointer, i as DiagnosticsOptions, n as DiagnosticCode, o as emitDiagnostic, r as DiagnosticSink, t as Diagnostic } from "../diagnostics-Cbwak-ZX.mjs";
1
+ import { a as appendPointer, i as DiagnosticsOptions, n as DiagnosticCode, o as emitDiagnostic, r as DiagnosticSink, t as Diagnostic } from "../diagnostics-ByEzkjrA.mjs";
2
2
  export { Diagnostic, DiagnosticCode, DiagnosticSink, DiagnosticsOptions, appendPointer, emitDiagnostic };
@@ -1,2 +1,2 @@
1
- import { i as SchemaRenderError, n as SchemaFieldError, r as SchemaNormalisationError, t as SchemaError } from "../errors-DQSIK4n1.mjs";
1
+ import { i as SchemaRenderError, n as SchemaFieldError, r as SchemaNormalisationError, t as SchemaError } from "../errors-D8JndRwI.mjs";
2
2
  export { SchemaError, SchemaFieldError, SchemaNormalisationError, SchemaRenderError };
@@ -1,12 +1,15 @@
1
1
  //#region src/core/errors.ts
2
2
  /**
3
- * Base class for all schema-components errors.
4
- * Catch this to handle any library error uniformly.
3
+ * Base class for every schema-components error. Catch this to handle
4
+ * any library error uniformly.
5
5
  *
6
- * Forwards the optional `cause` to the native ES2022 `Error` constructor so
7
- * `error.cause` is wired up by the runtime and rendered correctly by
8
- * `util.inspect` ("Caused by: ..."). Subclasses that need a typed `cause`
9
- * field still get it via the platform's own `Error.cause` getter.
6
+ * Forwards the optional `cause` to the native ES2022 `Error` constructor
7
+ * so `error.cause` is wired up by the runtime and rendered correctly by
8
+ * `util.inspect` ("Caused by: ..."). Subclasses that need a typed
9
+ * `cause` field still get it via the platform's own `Error.cause`
10
+ * getter.
11
+ *
12
+ * @group Errors
10
13
  */
11
14
  var SchemaError = class extends Error {
12
15
  /** The schema input that caused the error. */
@@ -21,7 +24,12 @@ var SchemaError = class extends Error {
21
24
  * The adapter failed to convert the input schema to JSON Schema.
22
25
  *
23
26
  * Causes: invalid Zod schema, Zod 3 schema (unsupported), malformed
24
- * JSON Schema, missing OpenAPI ref, unsupported ref format.
27
+ * JSON Schema, missing OpenAPI ref, unsupported ref format,
28
+ * unrepresentable Zod types, conversion bugs, cycles, and duplicate
29
+ * ids. The `kind` field carries the precise classification — see the
30
+ * union declaration below.
31
+ *
32
+ * @group Errors
25
33
  */
26
34
  var SchemaNormalisationError = class extends SchemaError {
27
35
  kind;
@@ -38,9 +46,10 @@ var SchemaNormalisationError = class extends SchemaError {
38
46
  }
39
47
  };
40
48
  /**
41
- * A theme adapter's render function threw during rendering.
49
+ * A theme adapter's render function threw during rendering. The
50
+ * original error is preserved on `cause`.
42
51
  *
43
- * The `cause` is the original error from the render function.
52
+ * @group Errors
44
53
  */
45
54
  var SchemaRenderError = class extends SchemaError {
46
55
  /**
@@ -56,10 +65,11 @@ var SchemaRenderError = class extends SchemaError {
56
65
  }
57
66
  };
58
67
  /**
59
- * A field path couldn't be resolved against the walked schema tree.
68
+ * A field path could not be resolved against the walked schema tree.
69
+ * Produced by `<SchemaField>` when the `path` prop does not match any
70
+ * field in the schema.
60
71
  *
61
- * This is produced by `<SchemaField>` when the `path` prop doesn't
62
- * match any field in the schema.
72
+ * @group Errors
63
73
  */
64
74
  var SchemaFieldError = class extends SchemaError {
65
75
  /** The unresolvable dot-separated path. */
@@ -1,4 +1,4 @@
1
- import { j as WalkedField } from "../types-BTB73MB8.mjs";
1
+ import { j as WalkedField } from "../types-C2Ay1FEh.mjs";
2
2
 
3
3
  //#region src/core/fieldOrder.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
1
+ import { i as DiagnosticsOptions } from "../diagnostics-ByEzkjrA.mjs";
2
2
 
3
3
  //#region src/core/formats.d.ts
4
4
  /**
@@ -52,6 +52,12 @@ type FormatValidator = RegExp | ((value: string) => boolean);
52
52
  * directly. Used by the URI safety helpers for mailto address checks.
53
53
  */
54
54
  declare const EMAIL_FORMAT_PATTERN: RegExp;
55
+ /**
56
+ * Map of recognised JSON Schema string `format` values to RegExp
57
+ * patterns. Consumed by `extractStringConstraints` to derive a
58
+ * client-side `formatPattern` for renderers, and by
59
+ * {@link validateFormat} for runtime checks.
60
+ */
55
61
  declare const FORMAT_PATTERNS: Readonly<Record<string, RegExp>>;
56
62
  /**
57
63
  * Validate a string value against format constraints.
@@ -51,6 +51,12 @@ function dateInputType(format) {
51
51
  * directly. Used by the URI safety helpers for mailto address checks.
52
52
  */
53
53
  const EMAIL_FORMAT_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
54
+ /**
55
+ * Map of recognised JSON Schema string `format` values to RegExp
56
+ * patterns. Consumed by `extractStringConstraints` to derive a
57
+ * client-side `formatPattern` for renderers, and by
58
+ * {@link validateFormat} for runtime checks.
59
+ */
54
60
  const FORMAT_PATTERNS = {
55
61
  uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
56
62
  email: EMAIL_FORMAT_PATTERN,
@@ -1,2 +1,2 @@
1
- import { i as MaxRefDepth, n as MAX_REF_DEPTH, r as MAX_RENDER_DEPTH, t as MAX_PATH_ITEM_REF_HOPS } from "../limits-DJhgx5Ay.mjs";
1
+ import { i as MaxRefDepth, n as MAX_REF_DEPTH, r as MAX_RENDER_DEPTH, t as MAX_PATH_ITEM_REF_HOPS } from "../limits-DswmqWuy.mjs";
2
2
  export { MAX_PATH_ITEM_REF_HOPS, MAX_REF_DEPTH, MAX_RENDER_DEPTH, MaxRefDepth };
@@ -12,6 +12,7 @@
12
12
  * — the only safe response to a cyclic walked-field graph.
13
13
  */
14
14
  const MAX_RENDER_DEPTH = 10;
15
+ /** Runtime constant matching the type-level {@link MaxRefDepth} bound. */
15
16
  const MAX_REF_DEPTH = 64;
16
17
  /**
17
18
  * Maximum number of `$ref` hops permitted when walking a chain of
@@ -1,4 +1,4 @@
1
- import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
1
+ import { i as DiagnosticsOptions } from "../diagnostics-ByEzkjrA.mjs";
2
2
 
3
3
  //#region src/core/merge.d.ts
4
4
  /**
@@ -45,6 +45,11 @@ declare function mergeRefSiblings(referencer: Record<string, unknown>, resolvedM
45
45
  * inputs that cannot represent a schema; skip them as before.
46
46
  */
47
47
  declare function mergeAllOf(schemas: unknown[], diagnostics?: DiagnosticsOptions, pointer?: string): Record<string, unknown> | false;
48
+ /**
49
+ * Result returned by {@link normaliseAnyOf} when an `anyOf` schema
50
+ * collapses to a nullable shape: the non-null branch and the nullable
51
+ * flag.
52
+ */
48
53
  interface NormalisedAnyOf {
49
54
  inner: Record<string, unknown>;
50
55
  isNullable: boolean;
@@ -54,6 +59,11 @@ interface NormalisedAnyOf {
54
59
  * Returns the non-null schema and a nullable flag.
55
60
  */
56
61
  declare function normaliseAnyOf(options: unknown[]): NormalisedAnyOf | undefined;
62
+ /**
63
+ * Result returned by {@link detectDiscriminated} when a `oneOf` schema
64
+ * is structurally a discriminated union: the option schemas plus the
65
+ * shared property name carrying the const discriminator.
66
+ */
57
67
  interface Discriminated {
58
68
  options: Record<string, unknown>[];
59
69
  discriminator: string;
@@ -1,7 +1,15 @@
1
- import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
2
- import { i as OpenApiVersionInfo, r as JsonSchemaDraft } from "../version-ZzL5R6cS.mjs";
1
+ import { i as DiagnosticsOptions } from "../diagnostics-ByEzkjrA.mjs";
2
+ import { i as OpenApiVersionInfo, r as JsonSchemaDraft } from "../version-DL8U5RuA.mjs";
3
3
 
4
4
  //#region src/core/normalise.d.ts
5
+ /**
6
+ * Per-node transform applied by {@link deepNormalise} when no
7
+ * diagnostics context needs to be threaded — see
8
+ * {@link NodeTransformWithContext} for the variant used by the JSON
9
+ * Schema normalisation path.
10
+ *
11
+ * @group Adapter
12
+ */
5
13
  type NodeTransform = (node: Record<string, unknown>) => Record<string, unknown>;
6
14
  /**
7
15
  * Deep-normalise a JSON Schema object by applying a per-node transform
@@ -43,6 +51,13 @@ interface NodeContext {
43
51
  documentHasRecursiveAnchor: boolean;
44
52
  declaredDraft: JsonSchemaDraft | undefined;
45
53
  }
54
+ /**
55
+ * Per-node transform applied by {@link deepNormaliseWithContext}.
56
+ * Receives the supplied {@link NodeContext} alongside the node so
57
+ * draft-specific rewrites can emit diagnostics with accurate pointers.
58
+ *
59
+ * @group Adapter
60
+ */
46
61
  type NodeTransformWithContext = (node: Record<string, unknown>, ctx: NodeContext) => Record<string, unknown>;
47
62
  /**
48
63
  * Deep-normalise a JSON Schema object, threading a context (diagnostics
@@ -12,6 +12,7 @@
12
12
  * Spec: https://spec.openapis.org/oas/v3.1.1#path-item-object
13
13
  */
14
14
  declare const HTTP_METHODS: readonly ["get", "put", "post", "delete", "options", "head", "patch", "trace"];
15
+ /** Canonical OpenAPI 3.x HTTP method literal, derived from {@link HTTP_METHODS}. */
15
16
  type HttpMethod = (typeof HTTP_METHODS)[number];
16
17
  /**
17
18
  * Swagger 2.0 omits `trace` — the keyword was introduced in OpenAPI 3.0.
@@ -1,2 +1,2 @@
1
- import { a as dereference, i as countDistinctRefs, n as RECURSIVE_ANCHOR_SENTINEL, o as findAnchor, r as RefOptions, s as resolveRef, t as ExternalResolver } from "../ref-TdeMfaV_.mjs";
1
+ import { a as dereference, i as countDistinctRefs, n as RECURSIVE_ANCHOR_SENTINEL, o as findAnchor, r as RefOptions, s as resolveRef, t as ExternalResolver } from "../ref-CPh8rKQ3.mjs";
2
2
  export { ExternalResolver, RECURSIVE_ANCHOR_SENTINEL, RefOptions, countDistinctRefs, dereference, findAnchor, resolveRef };
@@ -1,2 +1,2 @@
1
- import { a as HtmlRenderProps, c as RenderFunction, d as getHtmlRenderFn, f as getRenderFunction, h as typeToKey, i as HtmlRenderFunction, l as RenderProps, m as mergeResolvers, n as BaseFieldProps, o as HtmlResolver, p as mergeHtmlResolvers, r as ComponentResolver, s as RESOLVER_KEYS, t as AllConstraints, u as buildRenderProps } from "../renderer-Ul9taFYp.mjs";
1
+ import { a as HtmlRenderProps, c as RenderFunction, d as getHtmlRenderFn, f as getRenderFunction, h as typeToKey, i as HtmlRenderFunction, l as RenderProps, m as mergeResolvers, n as BaseFieldProps, o as HtmlResolver, p as mergeHtmlResolvers, r as ComponentResolver, s as RESOLVER_KEYS, t as AllConstraints, u as buildRenderProps } from "../renderer-OaOz-n6-.mjs";
2
2
  export { AllConstraints, BaseFieldProps, ComponentResolver, HtmlRenderFunction, HtmlRenderProps, HtmlResolver, RESOLVER_KEYS, RenderFunction, RenderProps, buildRenderProps, getHtmlRenderFn, getRenderFunction, mergeHtmlResolvers, mergeResolvers, typeToKey };
@@ -29,6 +29,11 @@ function buildRenderProps(tree, value, onChange, renderChild, path) {
29
29
  if (tree.examples !== void 0) props.examples = tree.examples;
30
30
  return props;
31
31
  }
32
+ /**
33
+ * Canonical list of resolver keys, one per {@link WalkedField} variant.
34
+ * Iterated by the resolver merge helpers so adding a new key here is the
35
+ * single point of change when a new field variant is introduced.
36
+ */
32
37
  const RESOLVER_KEYS = [
33
38
  "string",
34
39
  "number",
@@ -1,4 +1,4 @@
1
- import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
1
+ import { i as DiagnosticsOptions } from "../diagnostics-ByEzkjrA.mjs";
2
2
  import { NodeTransform } from "./normalise.mjs";
3
3
 
4
4
  //#region src/core/swagger2.d.ts
@@ -1,5 +1,5 @@
1
- import { d as FieldOverrides, u as FieldOverride } from "../types-BTB73MB8.mjs";
2
- import { i as MaxRefDepth } from "../limits-DJhgx5Ay.mjs";
1
+ import { d as FieldOverrides, u as FieldOverride } from "../types-C2Ay1FEh.mjs";
2
+ import { i as MaxRefDepth } from "../limits-DswmqWuy.mjs";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/core/typeInference.d.ts
@@ -1,2 +1,2 @@
1
- import { A as UnknownField, B as isNeverField, C as RecordField, D as StringField, E as StringConstraints, F as isDiscriminatedUnionField, G as isStringField, H as isNumberField, I as isEnumField, J as isUnknownField, K as isTupleField, L as isFileField, M as isArrayField, N as isBooleanField, O as TupleField, P as isConditionalField, R as isLiteralField, S as ObjectField, T as SchemaType, U as isObjectField, V as isNullField, W as isRecordField, Y as resolveEditability, _ as NeverField, a as DiscriminatedUnionField, b as NumberField, c as FieldBase, d as FieldOverrides, f as FileConstraints, g as NegationField, h as LiteralField, i as ConditionalField, j as WalkedField, k as UnionField, l as FieldConstraints, m as JsonObject, n as ArrayField, o as Editability, p as FileField, q as isUnionField, r as BooleanField, s as EnumField, t as ArrayConstraints, u as FieldOverride, v as NullField, w as SchemaMeta, x as ObjectConstraints, y as NumberConstraints, z as isNegationField } from "../types-BTB73MB8.mjs";
1
+ import { A as UnknownField, B as isNeverField, C as RecordField, D as StringField, E as StringConstraints, F as isDiscriminatedUnionField, G as isStringField, H as isNumberField, I as isEnumField, J as isUnknownField, K as isTupleField, L as isFileField, M as isArrayField, N as isBooleanField, O as TupleField, P as isConditionalField, R as isLiteralField, S as ObjectField, T as SchemaType, U as isObjectField, V as isNullField, W as isRecordField, Y as resolveEditability, _ as NeverField, a as DiscriminatedUnionField, b as NumberField, c as FieldBase, d as FieldOverrides, f as FileConstraints, g as NegationField, h as LiteralField, i as ConditionalField, j as WalkedField, k as UnionField, l as FieldConstraints, m as JsonObject, n as ArrayField, o as Editability, p as FileField, q as isUnionField, r as BooleanField, s as EnumField, t as ArrayConstraints, u as FieldOverride, v as NullField, w as SchemaMeta, x as ObjectConstraints, y as NumberConstraints, z as isNegationField } from "../types-C2Ay1FEh.mjs";
2
2
  export { ArrayConstraints, ArrayField, BooleanField, ConditionalField, DiscriminatedUnionField, Editability, EnumField, FieldBase, FieldConstraints, FieldOverride, FieldOverrides, FileConstraints, FileField, JsonObject, LiteralField, NegationField, NeverField, NullField, NumberConstraints, NumberField, ObjectConstraints, ObjectField, RecordField, SchemaMeta, SchemaType, StringConstraints, StringField, TupleField, UnionField, UnknownField, WalkedField, isArrayField, isBooleanField, isConditionalField, isDiscriminatedUnionField, isEnumField, isFileField, isLiteralField, isNegationField, isNeverField, isNullField, isNumberField, isObjectField, isRecordField, isStringField, isTupleField, isUnionField, isUnknownField, resolveEditability };
@@ -38,54 +38,71 @@ function resolveEditability(propertyMeta, componentMeta, rootMeta) {
38
38
  function isField(field, t) {
39
39
  return field.type === t;
40
40
  }
41
+ /** Type guard: narrows a `WalkedField` to its `string` variant. */
41
42
  function isStringField(field) {
42
43
  return isField(field, "string");
43
44
  }
45
+ /** Type guard: narrows a `WalkedField` to its `number` variant. */
44
46
  function isNumberField(field) {
45
47
  return isField(field, "number");
46
48
  }
49
+ /** Type guard: narrows a `WalkedField` to its `boolean` variant. */
47
50
  function isBooleanField(field) {
48
51
  return isField(field, "boolean");
49
52
  }
53
+ /** Type guard: narrows a `WalkedField` to its `null` variant. */
50
54
  function isNullField(field) {
51
55
  return isField(field, "null");
52
56
  }
57
+ /** Type guard: narrows a `WalkedField` to its `enum` variant. */
53
58
  function isEnumField(field) {
54
59
  return isField(field, "enum");
55
60
  }
61
+ /** Type guard: narrows a `WalkedField` to its `literal` variant. */
56
62
  function isLiteralField(field) {
57
63
  return isField(field, "literal");
58
64
  }
65
+ /** Type guard: narrows a `WalkedField` to its `object` variant. */
59
66
  function isObjectField(field) {
60
67
  return isField(field, "object");
61
68
  }
69
+ /** Type guard: narrows a `WalkedField` to its `array` variant. */
62
70
  function isArrayField(field) {
63
71
  return isField(field, "array");
64
72
  }
73
+ /** Type guard: narrows a `WalkedField` to its `tuple` variant. */
65
74
  function isTupleField(field) {
66
75
  return isField(field, "tuple");
67
76
  }
77
+ /** Type guard: narrows a `WalkedField` to its `record` variant. */
68
78
  function isRecordField(field) {
69
79
  return isField(field, "record");
70
80
  }
81
+ /** Type guard: narrows a `WalkedField` to its plain `union` variant. */
71
82
  function isUnionField(field) {
72
83
  return isField(field, "union");
73
84
  }
85
+ /** Type guard: narrows a `WalkedField` to its `discriminatedUnion` variant. */
74
86
  function isDiscriminatedUnionField(field) {
75
87
  return isField(field, "discriminatedUnion");
76
88
  }
89
+ /** Type guard: narrows a `WalkedField` to its `conditional` (if/then/else) variant. */
77
90
  function isConditionalField(field) {
78
91
  return isField(field, "conditional");
79
92
  }
93
+ /** Type guard: narrows a `WalkedField` to its `negation` (`not`) variant. */
80
94
  function isNegationField(field) {
81
95
  return isField(field, "negation");
82
96
  }
97
+ /** Type guard: narrows a `WalkedField` to its `file` variant. */
83
98
  function isFileField(field) {
84
99
  return isField(field, "file");
85
100
  }
101
+ /** Type guard: narrows a `WalkedField` to its `never` variant (false schema). */
86
102
  function isNeverField(field) {
87
103
  return isField(field, "never");
88
104
  }
105
+ /** Type guard: narrows a `WalkedField` to its `unknown` variant (permissive). */
89
106
  function isUnknownField(field) {
90
107
  return isField(field, "unknown");
91
108
  }
@@ -1,4 +1,4 @@
1
- import { j as WalkedField } from "../types-BTB73MB8.mjs";
1
+ import { j as WalkedField } from "../types-C2Ay1FEh.mjs";
2
2
 
3
3
  //#region src/core/unionMatch.d.ts
4
4
  /**
@@ -1,2 +1,2 @@
1
- import { a as detectJsonSchemaDraft, c as inferJsonSchemaDraftWithReason, d as isSwagger2, f as matchJsonSchemaDraftUri, i as OpenApiVersionInfo, l as isOpenApi30, n as JsonSchemaDialectInfo, o as detectOpenApiVersion, p as readJsonSchemaDialect, r as JsonSchemaDraft, s as inferJsonSchemaDraft, t as InferredDraft, u as isOpenApi31 } from "../version-ZzL5R6cS.mjs";
1
+ import { a as detectJsonSchemaDraft, c as inferJsonSchemaDraftWithReason, d as isSwagger2, f as matchJsonSchemaDraftUri, i as OpenApiVersionInfo, l as isOpenApi30, n as JsonSchemaDialectInfo, o as detectOpenApiVersion, p as readJsonSchemaDialect, r as JsonSchemaDraft, s as inferJsonSchemaDraft, t as InferredDraft, u as isOpenApi31 } from "../version-DL8U5RuA.mjs";
2
2
  export { InferredDraft, JsonSchemaDialectInfo, JsonSchemaDraft, OpenApiVersionInfo, detectJsonSchemaDraft, detectOpenApiVersion, inferJsonSchemaDraft, inferJsonSchemaDraftWithReason, isOpenApi30, isOpenApi31, isSwagger2, matchJsonSchemaDraftUri, readJsonSchemaDialect };