schema-components 1.23.0 → 1.26.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.
- package/dist/adapter-MiEFkRVV.d.mts +172 -0
- package/dist/core/adapter.d.mts +2 -141
- package/dist/core/adapter.mjs +39 -5
- package/dist/core/constraints.d.mts +1 -1
- package/dist/core/diagnostics.d.mts +1 -1
- package/dist/core/errors.d.mts +1 -1
- package/dist/core/formats.d.mts +1 -1
- package/dist/core/limits.d.mts +1 -1
- package/dist/core/merge.d.mts +1 -1
- package/dist/core/normalise.d.mts +2 -2
- package/dist/core/ref.d.mts +1 -1
- package/dist/core/ref.mjs +4 -5
- package/dist/core/renderer.d.mts +1 -1
- package/dist/core/swagger2.d.mts +1 -1
- package/dist/core/typeInference.d.mts +1 -1
- package/dist/core/version.d.mts +1 -1
- package/dist/core/walkBuilders.d.mts +2 -2
- package/dist/{diagnostics-BS2kaUyE.d.mts → diagnostics-Cbwak-ZX.d.mts} +1 -1
- package/dist/html/a11y.d.mts +1 -1
- package/dist/html/renderToHtml.d.mts +1 -1
- package/dist/html/renderToHtmlStream.d.mts +1 -1
- package/dist/html/renderers.d.mts +6 -17
- package/dist/html/renderers.mjs +5 -16
- package/dist/html/streamRenderers.d.mts +2 -2
- package/dist/openapi/components.d.mts +1 -1
- package/dist/openapi/components.mjs +2 -2
- package/dist/openapi/parser.d.mts +13 -4
- package/dist/openapi/parser.mjs +59 -33
- package/dist/openapi/resolve.d.mts +1 -1
- package/dist/openapi/resolve.mjs +2 -2
- package/dist/react/SchemaComponent.d.mts +74 -64
- package/dist/react/SchemaComponent.mjs +23 -31
- package/dist/react/SchemaView.d.mts +24 -20
- package/dist/react/SchemaView.mjs +6 -3
- package/dist/react/headless.d.mts +1 -1
- package/dist/react/headlessRenderers.d.mts +1 -1
- package/dist/react/headlessRenderers.mjs +1 -1
- package/dist/{ref-DjLEKa_E.d.mts → ref-TdeMfaV_.d.mts} +1 -1
- package/dist/themes/mantine.d.mts +1 -1
- package/dist/themes/mui.d.mts +1 -1
- package/dist/themes/mui.mjs +1 -1
- package/dist/themes/radix.d.mts +1 -1
- package/dist/themes/shadcn.d.mts +1 -1
- package/package.json +6 -2
- /package/dist/{errors-g_MCTQel.d.mts → errors-DQSIK4n1.d.mts} +0 -0
- /package/dist/{limits-Cw5QZND8.d.mts → limits-DJhgx5Ay.d.mts} +0 -0
- /package/dist/{renderer-CXJ8y0qw.d.mts → renderer-Ul9taFYp.d.mts} +0 -0
- /package/dist/{version-BFTVLsdb.d.mts → version-ZzL5R6cS.d.mts} +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { m as JsonObject, w as SchemaMeta } from "./types-BTB73MB8.mjs";
|
|
2
|
+
import { i as DiagnosticsOptions } from "./diagnostics-Cbwak-ZX.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/adapter.d.ts
|
|
5
|
+
type SchemaInput = Record<string, unknown>;
|
|
6
|
+
type SchemaKind = "zod4" | "zod3" | "jsonSchema" | "openapi" | "unsupported-schema-lib";
|
|
7
|
+
/**
|
|
8
|
+
* Classify the input schema by its structural markers.
|
|
9
|
+
*
|
|
10
|
+
* - `zod4` — has a `_zod` marker (further validation that `_zod.def` is a
|
|
11
|
+
* non-null object happens inside `normaliseZod4`).
|
|
12
|
+
* - `zod3` — has `_def` and no `_zod`. The `typeName` field is no longer
|
|
13
|
+
* required: any `_def` without `_zod` is treated as a probable Zod 3
|
|
14
|
+
* schema. Third-party libraries that expose `_def` without `_zod` are
|
|
15
|
+
* nearly always Zod 3 forks; surfacing the migration message is the
|
|
16
|
+
* correct response.
|
|
17
|
+
* - `openapi` — has `openapi` or `swagger` at the root.
|
|
18
|
+
* - `unsupported-schema-lib` — has `parse` and `safeParse` callables but
|
|
19
|
+
* no `_zod` and no `_def` marker. This catches Standard Schema
|
|
20
|
+
* implementations (valibot, arktype, etc.) that would otherwise flow
|
|
21
|
+
* through as "malformed JSON Schema".
|
|
22
|
+
* - `jsonSchema` — fallback for anything that does not match the above.
|
|
23
|
+
*/
|
|
24
|
+
declare function detectSchemaKind(input: unknown): SchemaKind;
|
|
25
|
+
/**
|
|
26
|
+
* Wraps z.toJSONSchema() for a runtime-validated Zod schema.
|
|
27
|
+
*
|
|
28
|
+
* The _zod guard in normaliseZod4 has confirmed this is a valid Zod schema,
|
|
29
|
+
* but TypeScript cannot represent "has _zod.def" as the $ZodType parameter
|
|
30
|
+
* that z.toJSONSchema expects. This is the library boundary equivalent of
|
|
31
|
+
* object → Record<string, unknown> — the type mismatch is genuinely unavoidable.
|
|
32
|
+
*
|
|
33
|
+
* # Options
|
|
34
|
+
*
|
|
35
|
+
* `z.toJSONSchema` is invoked with an explicit options object rather than
|
|
36
|
+
* Zod's defaults so the conversion contract is pinned and stable:
|
|
37
|
+
*
|
|
38
|
+
* - `target: "draft-2020-12"` — matches the walker's draft target.
|
|
39
|
+
* - `unrepresentable: "throw"` — keeps the unrepresentable-type rules in
|
|
40
|
+
* the classifier table firing instead of silently emitting `{}`.
|
|
41
|
+
* - `cycles: "ref"` — converts cyclic graphs into $ref pairs rather than
|
|
42
|
+
* throwing. Cycles in user schemas surface through the walker's $ref
|
|
43
|
+
* resolution rather than the adapter.
|
|
44
|
+
* - `io` — selects which side of every transform / pipe / codec is
|
|
45
|
+
* converted. Defaults to `"output"` (the OUTPUT side); pass `"input"`
|
|
46
|
+
* to render the INPUT side instead. The input side is invisible to
|
|
47
|
+
* the converted schema when `io: "output"` is in force, even though
|
|
48
|
+
* `safeParse` on the same Zod schema consumes the input shape. For
|
|
49
|
+
* transforms this divergence is fatal and the call throws via
|
|
50
|
+
* `Transforms cannot be represented`; for `z.codec(...)` the call
|
|
51
|
+
* succeeds but only the selected side is rendered. Consumers receive
|
|
52
|
+
* a `zod-codec-output-only` diagnostic in the codec case so the
|
|
53
|
+
* asymmetry is visible — see `screenPreConversion`.
|
|
54
|
+
*
|
|
55
|
+
* # Error classification
|
|
56
|
+
*
|
|
57
|
+
* Any exception thrown by z.toJSONSchema is classified into a
|
|
58
|
+
* SchemaNormalisationError so the caller does not have to re-parse error
|
|
59
|
+
* message strings. The classification covers:
|
|
60
|
+
*
|
|
61
|
+
* - Nested Zod 3 schemas inside a Zod 4 tree → zod3-unsupported.
|
|
62
|
+
* Detected structurally (presence of `_def.typeName` markers anywhere
|
|
63
|
+
* in the schema tree) so the check works across V8, JavaScriptCore,
|
|
64
|
+
* and SpiderMonkey, none of which agree on the wording of
|
|
65
|
+
* "Cannot read properties of undefined".
|
|
66
|
+
* - Transforms → zod-transform-unsupported. This also catches `z.codec(…)`
|
|
67
|
+
* because Zod implements codecs as a pipe + transform internally, so
|
|
68
|
+
* they trip the same processor when round-tripping is forced. (Plain
|
|
69
|
+
* `z.toJSONSchema(codec)` itself does NOT throw because Zod picks one
|
|
70
|
+
* side of the codec; the static rejection in `typeInference.ts` is the
|
|
71
|
+
* compile-time guard.)
|
|
72
|
+
* - Dynamic catch values whose handler throws → zod-type-unrepresentable
|
|
73
|
+
* with zodType "dynamic-catch".
|
|
74
|
+
* - Unrepresentable types — bigint, date, map, set, symbol, function, custom,
|
|
75
|
+
* undefined, void, NaN, and the literal-only forms `z.literal(undefined)`
|
|
76
|
+
* ("undefined-literal") and `z.literal(<bigint>)` ("bigint-literal") →
|
|
77
|
+
* zod-type-unrepresentable.
|
|
78
|
+
* - The catch-all "Non-representable type encountered: <type>" fallback Zod
|
|
79
|
+
* emits for any new schema kind without a registered processor →
|
|
80
|
+
* zod-type-unrepresentable with zodType set to the offending def.type.
|
|
81
|
+
* - Cycle detected (`cycles: "throw"`) → zod-cycle-detected.
|
|
82
|
+
* - Duplicate schema id → zod-duplicate-id.
|
|
83
|
+
* - "Unprocessed schema. This is a bug in Zod." → zod-conversion-bug.
|
|
84
|
+
* - "Error converting schema to JSON." → zod-conversion-failed (explicit
|
|
85
|
+
* classification rather than the generic fallback so the contract test
|
|
86
|
+
* protects the prefix from drift).
|
|
87
|
+
* - Anything else → zod-conversion-failed.
|
|
88
|
+
*
|
|
89
|
+
* The original error is preserved on each classified error via the `cause`
|
|
90
|
+
* field so consumers can still inspect the Zod stack trace.
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* IO side passed to {@link callToJsonSchema}. 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.
|
|
99
|
+
*/
|
|
100
|
+
type SchemaIoSide = "input" | "output";
|
|
101
|
+
/**
|
|
102
|
+
* True when `value` is a Zod schema implemented as a codec
|
|
103
|
+
* (`z.codec(...)`). Detection looks for the `$ZodCodec` marker on the
|
|
104
|
+
* schema's `_zod.traits` Set — the same structural check used by Zod
|
|
105
|
+
* itself in `to-json-schema.ts`'s `isTransforming` helper.
|
|
106
|
+
*
|
|
107
|
+
* Promoted from a duplicated local helper in `react/SchemaComponent.tsx`
|
|
108
|
+
* so the validation boundary inside `runValidation` can branch on
|
|
109
|
+
* codec-vs-not-codec without re-implementing the trait check. The
|
|
110
|
+
* shared helper anchors a single source of truth for codec detection:
|
|
111
|
+
* any future change to Zod's trait naming flows through here, not
|
|
112
|
+
* through two parallel copies.
|
|
113
|
+
*
|
|
114
|
+
* Returns `false` for non-objects, plain JSON Schema inputs, OpenAPI
|
|
115
|
+
* documents, or Zod schemas of any other kind. This is structural
|
|
116
|
+
* rather than nominal — a Zod 4 codec produced by any path that ends
|
|
117
|
+
* up tagging `_zod.traits` with `$ZodCodec` is recognised, including
|
|
118
|
+
* schemas wrapped by user-defined helpers.
|
|
119
|
+
*/
|
|
120
|
+
declare function isCodecSchema(value: unknown): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Exposed for unit testing — lets the contract test enumerate every rule's
|
|
123
|
+
* `prefix` value and assert mutual non-prefixing.
|
|
124
|
+
*/
|
|
125
|
+
declare const __CLASSIFIER_RULES_FOR_TEST: readonly {
|
|
126
|
+
readonly prefix: string;
|
|
127
|
+
}[];
|
|
128
|
+
interface NormalisedSchema {
|
|
129
|
+
/** JSON Schema object — the authoritative schema for rendering. */
|
|
130
|
+
jsonSchema: JsonObject;
|
|
131
|
+
/** Original Zod schema, if input was Zod. Used for validation. */
|
|
132
|
+
zodSchema?: unknown;
|
|
133
|
+
/** Root-level metadata. */
|
|
134
|
+
rootMeta: SchemaMeta | undefined;
|
|
135
|
+
/** The root document for $ref resolution. */
|
|
136
|
+
rootDocument: JsonObject;
|
|
137
|
+
}
|
|
138
|
+
interface NormaliseOptions {
|
|
139
|
+
/** Diagnostics channel for surfacing silent fallbacks. */
|
|
140
|
+
diagnostics?: DiagnosticsOptions;
|
|
141
|
+
/**
|
|
142
|
+
* Side of every transform / pipe / codec to render. Defaults to
|
|
143
|
+
* `"output"`, matching `z.toJSONSchema`'s default and the
|
|
144
|
+
* historic behaviour of the adapter. Passing `"input"` flips the
|
|
145
|
+
* conversion so consumers rendering the input shape of a
|
|
146
|
+
* `z.codec(...)` chain receive that side instead of the output
|
|
147
|
+
* side. Only the Zod 4 branch consults this option — JSON Schema
|
|
148
|
+
* and OpenAPI inputs are already a single canonical shape.
|
|
149
|
+
*/
|
|
150
|
+
io?: SchemaIoSide;
|
|
151
|
+
}
|
|
152
|
+
declare function normaliseSchema(input: unknown, ref?: string, options?: NormaliseOptions): NormalisedSchema;
|
|
153
|
+
/**
|
|
154
|
+
* Surface root-level metadata from the JSON Schema into the `rootMeta`
|
|
155
|
+
* shape consumed by the walker. Pulls `readOnly`, `writeOnly`,
|
|
156
|
+
* `description`, `title`, `deprecated`, `examples`, and `default`
|
|
157
|
+
* directly from the schema root.
|
|
158
|
+
*
|
|
159
|
+
* `examples` is forwarded only when present as an array (per JSON Schema
|
|
160
|
+
* Draft 2020-12 — Draft 04's `example` singular is normalised upstream).
|
|
161
|
+
* `default` is forwarded for any value the schema declares (any JSON
|
|
162
|
+
* value, including `null` and `false`); the presence check uses `in`
|
|
163
|
+
* so a literal `false` or `null` default is preserved.
|
|
164
|
+
*
|
|
165
|
+
* `examples` and `default` ride on the `[key: string]: unknown` index
|
|
166
|
+
* signature of {@link SchemaMeta}. They are not declared as named fields
|
|
167
|
+
* on `SchemaMeta` because that type lives in `types.ts` and is shared
|
|
168
|
+
* with the walker; the index signature is the agreed extension point.
|
|
169
|
+
*/
|
|
170
|
+
declare function extractRootMetaFromJson(jsonSchema: JsonObject): SchemaMeta | undefined;
|
|
171
|
+
//#endregion
|
|
172
|
+
export { SchemaKind as a, extractRootMetaFromJson as c, SchemaIoSide as i, isCodecSchema as l, NormalisedSchema as n, __CLASSIFIER_RULES_FOR_TEST as o, SchemaInput as r, detectSchemaKind as s, NormaliseOptions as t, normaliseSchema as u };
|
package/dist/core/adapter.d.mts
CHANGED
|
@@ -1,142 +1,3 @@
|
|
|
1
1
|
import { m as JsonObject, w as SchemaMeta } from "../types-BTB73MB8.mjs";
|
|
2
|
-
import { i as
|
|
3
|
-
|
|
4
|
-
//#region src/core/adapter.d.ts
|
|
5
|
-
type SchemaInput = Record<string, unknown>;
|
|
6
|
-
type SchemaKind = "zod4" | "zod3" | "jsonSchema" | "openapi" | "unsupported-schema-lib";
|
|
7
|
-
/**
|
|
8
|
-
* Classify the input schema by its structural markers.
|
|
9
|
-
*
|
|
10
|
-
* - `zod4` — has a `_zod` marker (further validation that `_zod.def` is a
|
|
11
|
-
* non-null object happens inside `normaliseZod4`).
|
|
12
|
-
* - `zod3` — has `_def` and no `_zod`. The `typeName` field is no longer
|
|
13
|
-
* required: any `_def` without `_zod` is treated as a probable Zod 3
|
|
14
|
-
* schema. Third-party libraries that expose `_def` without `_zod` are
|
|
15
|
-
* nearly always Zod 3 forks; surfacing the migration message is the
|
|
16
|
-
* correct response.
|
|
17
|
-
* - `openapi` — has `openapi` or `swagger` at the root.
|
|
18
|
-
* - `unsupported-schema-lib` — has `parse` and `safeParse` callables but
|
|
19
|
-
* no `_zod` and no `_def` marker. This catches Standard Schema
|
|
20
|
-
* implementations (valibot, arktype, etc.) that would otherwise flow
|
|
21
|
-
* through as "malformed JSON Schema".
|
|
22
|
-
* - `jsonSchema` — fallback for anything that does not match the above.
|
|
23
|
-
*/
|
|
24
|
-
declare function detectSchemaKind(input: unknown): SchemaKind;
|
|
25
|
-
/**
|
|
26
|
-
* Wraps z.toJSONSchema() for a runtime-validated Zod schema.
|
|
27
|
-
*
|
|
28
|
-
* The _zod guard in normaliseZod4 has confirmed this is a valid Zod schema,
|
|
29
|
-
* but TypeScript cannot represent "has _zod.def" as the $ZodType parameter
|
|
30
|
-
* that z.toJSONSchema expects. This is the library boundary equivalent of
|
|
31
|
-
* object → Record<string, unknown> — the type mismatch is genuinely unavoidable.
|
|
32
|
-
*
|
|
33
|
-
* # Options
|
|
34
|
-
*
|
|
35
|
-
* `z.toJSONSchema` is invoked with an explicit options object rather than
|
|
36
|
-
* Zod's defaults so the conversion contract is pinned and stable:
|
|
37
|
-
*
|
|
38
|
-
* - `target: "draft-2020-12"` — matches the walker's draft target.
|
|
39
|
-
* - `unrepresentable: "throw"` — keeps the unrepresentable-type rules in
|
|
40
|
-
* the classifier table firing instead of silently emitting `{}`.
|
|
41
|
-
* - `cycles: "ref"` — converts cyclic graphs into $ref pairs rather than
|
|
42
|
-
* throwing. Cycles in user schemas surface through the walker's $ref
|
|
43
|
-
* resolution rather than the adapter.
|
|
44
|
-
* - `io` — selects which side of every transform / pipe / codec is
|
|
45
|
-
* converted. Defaults to `"output"` (the OUTPUT side); pass `"input"`
|
|
46
|
-
* to render the INPUT side instead. The input side is invisible to
|
|
47
|
-
* the converted schema when `io: "output"` is in force, even though
|
|
48
|
-
* `safeParse` on the same Zod schema consumes the input shape. For
|
|
49
|
-
* transforms this divergence is fatal and the call throws via
|
|
50
|
-
* `Transforms cannot be represented`; for `z.codec(...)` the call
|
|
51
|
-
* succeeds but only the selected side is rendered. Consumers receive
|
|
52
|
-
* a `zod-codec-output-only` diagnostic in the codec case so the
|
|
53
|
-
* asymmetry is visible — see `screenPreConversion`.
|
|
54
|
-
*
|
|
55
|
-
* # Error classification
|
|
56
|
-
*
|
|
57
|
-
* Any exception thrown by z.toJSONSchema is classified into a
|
|
58
|
-
* SchemaNormalisationError so the caller does not have to re-parse error
|
|
59
|
-
* message strings. The classification covers:
|
|
60
|
-
*
|
|
61
|
-
* - Nested Zod 3 schemas inside a Zod 4 tree → zod3-unsupported.
|
|
62
|
-
* Detected structurally (presence of `_def.typeName` markers anywhere
|
|
63
|
-
* in the schema tree) so the check works across V8, JavaScriptCore,
|
|
64
|
-
* and SpiderMonkey, none of which agree on the wording of
|
|
65
|
-
* "Cannot read properties of undefined".
|
|
66
|
-
* - Transforms → zod-transform-unsupported. This also catches `z.codec(…)`
|
|
67
|
-
* because Zod implements codecs as a pipe + transform internally, so
|
|
68
|
-
* they trip the same processor when round-tripping is forced. (Plain
|
|
69
|
-
* `z.toJSONSchema(codec)` itself does NOT throw because Zod picks one
|
|
70
|
-
* side of the codec; the static rejection in `typeInference.ts` is the
|
|
71
|
-
* compile-time guard.)
|
|
72
|
-
* - Dynamic catch values whose handler throws → zod-type-unrepresentable
|
|
73
|
-
* with zodType "dynamic-catch".
|
|
74
|
-
* - Unrepresentable types — bigint, date, map, set, symbol, function, custom,
|
|
75
|
-
* undefined, void, NaN, and the literal-only forms `z.literal(undefined)`
|
|
76
|
-
* ("undefined-literal") and `z.literal(<bigint>)` ("bigint-literal") →
|
|
77
|
-
* zod-type-unrepresentable.
|
|
78
|
-
* - The catch-all "Non-representable type encountered: <type>" fallback Zod
|
|
79
|
-
* emits for any new schema kind without a registered processor →
|
|
80
|
-
* zod-type-unrepresentable with zodType set to the offending def.type.
|
|
81
|
-
* - Cycle detected (`cycles: "throw"`) → zod-cycle-detected.
|
|
82
|
-
* - Duplicate schema id → zod-duplicate-id.
|
|
83
|
-
* - "Unprocessed schema. This is a bug in Zod." → zod-conversion-bug.
|
|
84
|
-
* - "Error converting schema to JSON." → zod-conversion-failed (explicit
|
|
85
|
-
* classification rather than the generic fallback so the contract test
|
|
86
|
-
* protects the prefix from drift).
|
|
87
|
-
* - Anything else → zod-conversion-failed.
|
|
88
|
-
*
|
|
89
|
-
* The original error is preserved on each classified error via the `cause`
|
|
90
|
-
* field so consumers can still inspect the Zod stack trace.
|
|
91
|
-
*/
|
|
92
|
-
/**
|
|
93
|
-
* IO side passed to {@link callToJsonSchema}. 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.
|
|
99
|
-
*/
|
|
100
|
-
type SchemaIoSide = "input" | "output";
|
|
101
|
-
/**
|
|
102
|
-
* Exposed for unit testing — lets the contract test enumerate every rule's
|
|
103
|
-
* `prefix` value and assert mutual non-prefixing.
|
|
104
|
-
*/
|
|
105
|
-
declare const __CLASSIFIER_RULES_FOR_TEST: readonly {
|
|
106
|
-
readonly prefix: string;
|
|
107
|
-
}[];
|
|
108
|
-
interface NormalisedSchema {
|
|
109
|
-
/** JSON Schema object — the authoritative schema for rendering. */
|
|
110
|
-
jsonSchema: JsonObject;
|
|
111
|
-
/** Original Zod schema, if input was Zod. Used for validation. */
|
|
112
|
-
zodSchema?: unknown;
|
|
113
|
-
/** Root-level metadata. */
|
|
114
|
-
rootMeta: SchemaMeta | undefined;
|
|
115
|
-
/** The root document for $ref resolution. */
|
|
116
|
-
rootDocument: JsonObject;
|
|
117
|
-
}
|
|
118
|
-
interface NormaliseOptions {
|
|
119
|
-
/** Diagnostics channel for surfacing silent fallbacks. */
|
|
120
|
-
diagnostics?: DiagnosticsOptions;
|
|
121
|
-
}
|
|
122
|
-
declare function normaliseSchema(input: unknown, ref?: string, options?: NormaliseOptions): NormalisedSchema;
|
|
123
|
-
/**
|
|
124
|
-
* Surface root-level metadata from the JSON Schema into the `rootMeta`
|
|
125
|
-
* shape consumed by the walker. Pulls `readOnly`, `writeOnly`,
|
|
126
|
-
* `description`, `title`, `deprecated`, `examples`, and `default`
|
|
127
|
-
* directly from the schema root.
|
|
128
|
-
*
|
|
129
|
-
* `examples` is forwarded only when present as an array (per JSON Schema
|
|
130
|
-
* Draft 2020-12 — Draft 04's `example` singular is normalised upstream).
|
|
131
|
-
* `default` is forwarded for any value the schema declares (any JSON
|
|
132
|
-
* value, including `null` and `false`); the presence check uses `in`
|
|
133
|
-
* so a literal `false` or `null` default is preserved.
|
|
134
|
-
*
|
|
135
|
-
* `examples` and `default` ride on the `[key: string]: unknown` index
|
|
136
|
-
* signature of {@link SchemaMeta}. They are not declared as named fields
|
|
137
|
-
* on `SchemaMeta` because that type lives in `types.ts` and is shared
|
|
138
|
-
* with the walker; the index signature is the agreed extension point.
|
|
139
|
-
*/
|
|
140
|
-
declare function extractRootMetaFromJson(jsonSchema: JsonObject): SchemaMeta | undefined;
|
|
141
|
-
//#endregion
|
|
142
|
-
export { type JsonObject, NormaliseOptions, NormalisedSchema, SchemaInput, SchemaIoSide, SchemaKind, type SchemaMeta, __CLASSIFIER_RULES_FOR_TEST, detectSchemaKind, extractRootMetaFromJson, normaliseSchema };
|
|
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-MiEFkRVV.mjs";
|
|
3
|
+
export { JsonObject, NormaliseOptions, NormalisedSchema, SchemaInput, SchemaIoSide, SchemaKind, SchemaMeta, __CLASSIFIER_RULES_FOR_TEST, detectSchemaKind, extractRootMetaFromJson, isCodecSchema, normaliseSchema };
|
package/dist/core/adapter.mjs
CHANGED
|
@@ -80,6 +80,15 @@ function extractStandardSchemaVendor(input) {
|
|
|
80
80
|
const vendor = getProperty(getProperty(input, "~standard"), "vendor");
|
|
81
81
|
return typeof vendor === "string" && vendor.length > 0 ? vendor : void 0;
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* The `io` parameter is propagated by `normaliseSchema` →
|
|
85
|
+
* `normaliseZod4` so the renderer can select between the OUTPUT side
|
|
86
|
+
* (default — historic behaviour) and the INPUT side of every
|
|
87
|
+
* transform / pipe / codec. Pinning the option here lets the
|
|
88
|
+
* consumer-facing `<SchemaComponent io="…">` and
|
|
89
|
+
* `<SchemaView io="…">` props decide a single conversion direction
|
|
90
|
+
* for the whole tree without a fork at every Zod call site.
|
|
91
|
+
*/
|
|
83
92
|
function callToJsonSchema(schema, io = "output") {
|
|
84
93
|
try {
|
|
85
94
|
return z.toJSONSchema(schema, {
|
|
@@ -282,6 +291,30 @@ function hasTrait(zod, traitName) {
|
|
|
282
291
|
return false;
|
|
283
292
|
}
|
|
284
293
|
/**
|
|
294
|
+
* True when `value` is a Zod schema implemented as a codec
|
|
295
|
+
* (`z.codec(...)`). Detection looks for the `$ZodCodec` marker on the
|
|
296
|
+
* schema's `_zod.traits` Set — the same structural check used by Zod
|
|
297
|
+
* itself in `to-json-schema.ts`'s `isTransforming` helper.
|
|
298
|
+
*
|
|
299
|
+
* Promoted from a duplicated local helper in `react/SchemaComponent.tsx`
|
|
300
|
+
* so the validation boundary inside `runValidation` can branch on
|
|
301
|
+
* codec-vs-not-codec without re-implementing the trait check. The
|
|
302
|
+
* shared helper anchors a single source of truth for codec detection:
|
|
303
|
+
* any future change to Zod's trait naming flows through here, not
|
|
304
|
+
* through two parallel copies.
|
|
305
|
+
*
|
|
306
|
+
* Returns `false` for non-objects, plain JSON Schema inputs, OpenAPI
|
|
307
|
+
* documents, or Zod schemas of any other kind. This is structural
|
|
308
|
+
* rather than nominal — a Zod 4 codec produced by any path that ends
|
|
309
|
+
* up tagging `_zod.traits` with `$ZodCodec` is recognised, including
|
|
310
|
+
* schemas wrapped by user-defined helpers.
|
|
311
|
+
*/
|
|
312
|
+
function isCodecSchema(value) {
|
|
313
|
+
const zod = getProperty(value, "_zod");
|
|
314
|
+
if (!isObject(zod)) return false;
|
|
315
|
+
return hasTrait(zod, "$ZodCodec");
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
285
318
|
* Type guard narrowing `unknown` to a zero-argument function returning
|
|
286
319
|
* `unknown`. The narrowing is genuinely structural: `typeof === "function"`
|
|
287
320
|
* at runtime is exactly the membership test we want, and Zod has no
|
|
@@ -593,7 +626,8 @@ function classifyZodConversionError(err, schema) {
|
|
|
593
626
|
const __CLASSIFIER_RULES_FOR_TEST = CLASSIFIER_RULES;
|
|
594
627
|
function normaliseSchema(input, ref, options) {
|
|
595
628
|
const usesDiagnostics = options?.diagnostics !== void 0;
|
|
596
|
-
const
|
|
629
|
+
const nonDefaultIo = options?.io !== void 0 && options.io !== "output";
|
|
630
|
+
const cacheEligible = ref === void 0 && isObject(input) && !usesDiagnostics && !nonDefaultIo;
|
|
597
631
|
if (cacheEligible) {
|
|
598
632
|
const cached = schemaCache.get(input);
|
|
599
633
|
if (cached !== void 0) return cached;
|
|
@@ -602,7 +636,7 @@ function normaliseSchema(input, ref, options) {
|
|
|
602
636
|
let result;
|
|
603
637
|
switch (kind) {
|
|
604
638
|
case "zod4":
|
|
605
|
-
result = normaliseZod4(input, options?.diagnostics);
|
|
639
|
+
result = normaliseZod4(input, options?.diagnostics, options?.io);
|
|
606
640
|
break;
|
|
607
641
|
case "zod3":
|
|
608
642
|
result = normaliseZod3(input);
|
|
@@ -623,12 +657,12 @@ function normaliseSchema(input, ref, options) {
|
|
|
623
657
|
if (cacheEligible) schemaCache.set(input, result);
|
|
624
658
|
return result;
|
|
625
659
|
}
|
|
626
|
-
function normaliseZod4(input, diagnostics) {
|
|
660
|
+
function normaliseZod4(input, diagnostics, io) {
|
|
627
661
|
const zod = getProperty(input, "_zod");
|
|
628
662
|
if (!isObject(zod)) throw new SchemaNormalisationError("Input is not a valid Zod 4 schema: `_zod` is present but is not an object. schema-components expected a Zod 4 schema produced by the `zod` package version 4 or later. See the Zod 4 migration guide at https://zod.dev/v4/migration or run: pnpm add zod@^4", input, "unsupported-schema");
|
|
629
663
|
if (!isObject(getProperty(zod, "def"))) throw new SchemaNormalisationError("Input is not a valid Zod 4 schema: `_zod.def` is missing or not an object. schema-components expected a Zod 4 schema produced by the `zod` package version 4 or later. See the Zod 4 migration guide at https://zod.dev/v4/migration or run: pnpm add zod@^4", input, "unsupported-schema");
|
|
630
664
|
screenPreConversion(input, diagnostics);
|
|
631
|
-
const jsonSchema = callToJsonSchema(input);
|
|
665
|
+
const jsonSchema = callToJsonSchema(input, io);
|
|
632
666
|
if (!isObject(jsonSchema)) throw new SchemaNormalisationError("z.toJSONSchema() did not produce an object", input, "invalid-zod");
|
|
633
667
|
return {
|
|
634
668
|
jsonSchema,
|
|
@@ -780,4 +814,4 @@ function extractRootMetaFromJson(jsonSchema) {
|
|
|
780
814
|
return Object.keys(meta).length > 0 ? meta : void 0;
|
|
781
815
|
}
|
|
782
816
|
//#endregion
|
|
783
|
-
export { __CLASSIFIER_RULES_FOR_TEST, detectSchemaKind, extractRootMetaFromJson, normaliseSchema };
|
|
817
|
+
export { __CLASSIFIER_RULES_FOR_TEST, detectSchemaKind, extractRootMetaFromJson, isCodecSchema, normaliseSchema };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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-
|
|
2
|
+
import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/constraints.d.ts
|
|
5
5
|
declare function extractStringConstraints(schema: Record<string, unknown>, diagnostics?: DiagnosticsOptions, pointer?: string): StringConstraints;
|
|
@@ -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-
|
|
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";
|
|
2
2
|
export { Diagnostic, DiagnosticCode, DiagnosticSink, DiagnosticsOptions, appendPointer, emitDiagnostic };
|
package/dist/core/errors.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as SchemaRenderError, n as SchemaFieldError, r as SchemaNormalisationError, t as SchemaError } from "../errors-
|
|
1
|
+
import { i as SchemaRenderError, n as SchemaFieldError, r as SchemaNormalisationError, t as SchemaError } from "../errors-DQSIK4n1.mjs";
|
|
2
2
|
export { SchemaError, SchemaFieldError, SchemaNormalisationError, SchemaRenderError };
|
package/dist/core/formats.d.mts
CHANGED
package/dist/core/limits.d.mts
CHANGED
|
@@ -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-
|
|
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";
|
|
2
2
|
export { MAX_PATH_ITEM_REF_HOPS, MAX_REF_DEPTH, MAX_RENDER_DEPTH, MaxRefDepth };
|
package/dist/core/merge.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
2
|
-
import { i as OpenApiVersionInfo, r as JsonSchemaDraft } from "../version-
|
|
1
|
+
import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
|
|
2
|
+
import { i as OpenApiVersionInfo, r as JsonSchemaDraft } from "../version-ZzL5R6cS.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/normalise.d.ts
|
|
5
5
|
type NodeTransform = (node: Record<string, unknown>) => Record<string, unknown>;
|
package/dist/core/ref.d.mts
CHANGED
|
@@ -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-
|
|
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";
|
|
2
2
|
export { ExternalResolver, RECURSIVE_ANCHOR_SENTINEL, RefOptions, countDistinctRefs, dereference, findAnchor, resolveRef };
|
package/dist/core/ref.mjs
CHANGED
|
@@ -24,11 +24,10 @@ const RECURSIVE_ANCHOR_SENTINEL = "__recursive__";
|
|
|
24
24
|
* `false` → `{ not: {} }` (never-valid schema)
|
|
25
25
|
*
|
|
26
26
|
* Used by {@link resolveRef} so callers that expect an object schema
|
|
27
|
-
* can continue without per-call-site boolean handling.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* ref
|
|
31
|
-
* translation and surface the boolean directly.
|
|
27
|
+
* can continue without per-call-site boolean handling. The walker's
|
|
28
|
+
* sub-schema dispatch (`walkSubSchema`) handles booleans natively at
|
|
29
|
+
* non-root positions; this translation covers the degenerate case
|
|
30
|
+
* where a top-level `$ref` resolves to a boolean schema.
|
|
32
31
|
*/
|
|
33
32
|
function booleanSchemaToObject(value) {
|
|
34
33
|
if (value) return {};
|
package/dist/core/renderer.d.mts
CHANGED
|
@@ -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-
|
|
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";
|
|
2
2
|
export { AllConstraints, BaseFieldProps, ComponentResolver, HtmlRenderFunction, HtmlRenderProps, HtmlResolver, RESOLVER_KEYS, RenderFunction, RenderProps, buildRenderProps, getHtmlRenderFn, getRenderFunction, mergeHtmlResolvers, mergeResolvers, typeToKey };
|
package/dist/core/swagger2.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as FieldOverrides, u as FieldOverride } from "../types-BTB73MB8.mjs";
|
|
2
|
-
import { i as MaxRefDepth } from "../limits-
|
|
2
|
+
import { i as MaxRefDepth } from "../limits-DJhgx5Ay.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
5
5
|
//#region src/core/typeInference.d.ts
|
package/dist/core/version.d.mts
CHANGED
|
@@ -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-
|
|
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";
|
|
2
2
|
export { InferredDraft, JsonSchemaDialectInfo, JsonSchemaDraft, OpenApiVersionInfo, detectJsonSchemaDraft, detectOpenApiVersion, inferJsonSchemaDraft, inferJsonSchemaDraftWithReason, isOpenApi30, isOpenApi31, isSwagger2, matchJsonSchemaDraftUri, readJsonSchemaDialect };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { A as UnknownField, D as StringField, b as NumberField, c as FieldBase, j as WalkedField, o as Editability, p as FileField, r as BooleanField, v as NullField, w as SchemaMeta } from "../types-BTB73MB8.mjs";
|
|
2
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
3
|
-
import { t as ExternalResolver } from "../ref-
|
|
2
|
+
import { i as DiagnosticsOptions } from "../diagnostics-Cbwak-ZX.mjs";
|
|
3
|
+
import { t as ExternalResolver } from "../ref-TdeMfaV_.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/core/walkBuilders.d.ts
|
|
6
6
|
declare function getString(obj: Record<string, unknown>, key: string): string | undefined;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Machine-readable codes identifying each class of diagnostic.
|
|
17
17
|
* Stable across releases — consumers can pattern-match on these.
|
|
18
18
|
*/
|
|
19
|
-
type DiagnosticCode = "allof-conflict" | "assumed-draft" | "bare-exclusive-bound" | "conditional-fallback" | "cross-schema-relative-ref-unsupported" | "cyclic-path-item-ref" | "dependencies-conflict" | "dependent-required-invalid" | "depth-exceeded" | "discriminator-inconsistent" | "divisible-by-conflict" | "doc-not-object" | "dropped-swagger-feature" | "duplicate-body-parameter" | "duplicate-operation-id" | "dynamic-ref-degraded" | "enum-value-filtered" | "external-ref" | "invalid-const" | "invalid-id-fragment" | "keyword-out-of-draft" | "legacy-dependencies-split" | "legacy-dependencies-split-2019" | "non-json-media-type-fallback" | "parameter-missing-schema" | "path-item-ref-too-deep" | "path-webhook-name-collision" | "pattern-invalid" | "prototype-polluting-property" | "recursive-anchor-collision" | "relative-ref-resolved" | "required-non-string" | "schema-allof-incompatible" | "swagger-collection-format-dropped" | "swagger-cyclic-parameter-ref" | "swagger-invalid-file-parameter" | "swagger-malformed-oauth-flow" | "swagger-missing-consumes" | "swagger-missing-host" | "type-mismatch" | "type-negation-fallback" | "unknown-format" | "unknown-json-schema-dialect" | "unknown-keyword" | "unknown-openapi-version" | "unknown-parameter-location" | "unknown-security-scheme-type" | "unresolved-ref" | "unsupported-type" | "zod-codec-nested-output-only" | "zod-codec-output-only" | "zod-preprocess-output-only" | "zod-promise-nested-unwrap";
|
|
19
|
+
type DiagnosticCode = "allof-conflict" | "assumed-draft" | "bare-exclusive-bound" | "conditional-fallback" | "cross-schema-relative-ref-unsupported" | "cyclic-header-ref" | "cyclic-link-ref" | "cyclic-parameter-ref" | "cyclic-path-item-ref" | "dependencies-conflict" | "dependent-required-invalid" | "depth-exceeded" | "discriminator-inconsistent" | "divisible-by-conflict" | "doc-not-object" | "dropped-swagger-feature" | "header-ref-too-deep" | "duplicate-body-parameter" | "duplicate-operation-id" | "dynamic-ref-degraded" | "enum-value-filtered" | "external-ref" | "invalid-const" | "invalid-id-fragment" | "keyword-out-of-draft" | "link-ref-too-deep" | "legacy-dependencies-split" | "legacy-dependencies-split-2019" | "non-json-media-type-fallback" | "parameter-missing-schema" | "parameter-ref-too-deep" | "path-item-ref-too-deep" | "path-webhook-name-collision" | "pattern-invalid" | "prototype-polluting-property" | "recursive-anchor-collision" | "relative-ref-resolved" | "required-non-string" | "schema-allof-incompatible" | "swagger-collection-format-dropped" | "swagger-cyclic-parameter-ref" | "swagger-invalid-file-parameter" | "swagger-malformed-oauth-flow" | "swagger-missing-consumes" | "swagger-missing-host" | "type-mismatch" | "type-negation-fallback" | "unknown-format" | "unknown-json-schema-dialect" | "unknown-keyword" | "unknown-openapi-version" | "unknown-parameter-location" | "unknown-security-scheme-type" | "unresolved-ref" | "unsupported-type" | "zod-codec-nested-output-only" | "zod-codec-output-only" | "zod-preprocess-output-only" | "zod-promise-nested-unwrap";
|
|
20
20
|
/**
|
|
21
21
|
* A single diagnostic emitted during schema processing.
|
|
22
22
|
*/
|
package/dist/html/a11y.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as WalkedField } from "../types-BTB73MB8.mjs";
|
|
2
|
-
import { t as AllConstraints } from "../renderer-
|
|
2
|
+
import { t as AllConstraints } from "../renderer-Ul9taFYp.mjs";
|
|
3
3
|
import { HtmlAttributes, HtmlNode } from "./html.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/html/a11y.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dateInputType } from "../core/formats.mjs";
|
|
2
|
-
import { o as HtmlResolver } from "../renderer-
|
|
2
|
+
import { o as HtmlResolver } from "../renderer-Ul9taFYp.mjs";
|
|
3
3
|
import { matchUnionOption } from "../core/unionMatch.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/html/renderers.d.ts
|
|
@@ -9,16 +9,11 @@ import { matchUnionOption } from "../core/unionMatch.mjs";
|
|
|
9
9
|
* `aria-controls`, `aria-labelledby`, and `htmlFor` references resolve
|
|
10
10
|
* consistently across the React, sync-HTML, and streaming-HTML outputs.
|
|
11
11
|
*
|
|
12
|
-
* The wrapper tolerates an empty path here (returning `sc-`)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* structured form.
|
|
18
|
-
*
|
|
19
|
-
* TODO(round7-integration): once `renderToHtml` always threads a stable
|
|
20
|
-
* root path (e.g. `"$"`) into the leaf renderers, drop this wrapper and
|
|
21
|
-
* call `fieldDomId` directly so the throw fires as designed.
|
|
12
|
+
* The wrapper tolerates an empty path here (returning `sc-`) so that
|
|
13
|
+
* a leaf renderer at the schema root — `renderToHtml(z.string())` — has
|
|
14
|
+
* a usable id without throwing. Container renderers always thread a
|
|
15
|
+
* non-empty path through `renderChild`, so the empty-id fallback can
|
|
16
|
+
* never produce sibling collisions inside a structured form.
|
|
22
17
|
*/
|
|
23
18
|
declare function fieldId(path: string): string;
|
|
24
19
|
/**
|
|
@@ -32,17 +27,11 @@ declare function fieldId(path: string): string;
|
|
|
32
27
|
* Exported because `streamRenderers.ts` needs to derive identical ids
|
|
33
28
|
* — the panel id on the `<div role="tabpanel">` must match the
|
|
34
29
|
* `aria-controls` on every tab regardless of which pipeline rendered it.
|
|
35
|
-
*
|
|
36
|
-
* TODO(round7-integration): drop the empty-path branch once `renderToHtml`
|
|
37
|
-
* threads a stable root path so `panelIdFor` can be called directly.
|
|
38
30
|
*/
|
|
39
31
|
declare function panelId(path: string): string;
|
|
40
32
|
/**
|
|
41
33
|
* Tab id for tab `i` within a discriminated union at `path`. Mirror of
|
|
42
34
|
* `panelId` above — see its comment.
|
|
43
|
-
*
|
|
44
|
-
* TODO(round7-integration): drop the empty-path branch once `renderToHtml`
|
|
45
|
-
* threads a stable root path so `tabIdFor` can be called directly.
|
|
46
35
|
*/
|
|
47
36
|
declare function tabId(path: string, i: number): string;
|
|
48
37
|
declare const defaultHtmlResolver: HtmlResolver;
|