schema-components 2.0.1 → 2.1.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/README.md +98 -1
- package/dist/SchemaComponent-B__6-5-E.d.mts +277 -0
- package/dist/SchemaComponent-BxzzsHsK.mjs +668 -0
- package/dist/adapter-ktQaheWB.d.mts +213 -0
- package/dist/constructorTypes-BdCiMS6e.d.mts +30 -0
- package/dist/core/adapter.d.mts +3 -213
- package/dist/core/adapter.mjs +33 -25
- package/dist/core/constraintHint.d.mts +1 -1
- package/dist/core/constraints.d.mts +2 -2
- package/dist/core/contexts.d.mts +71 -0
- package/dist/core/contexts.mjs +1 -0
- package/dist/core/diagnostics.d.mts +1 -1
- package/dist/core/errors.d.mts +1 -1
- package/dist/core/fieldOrder.d.mts +1 -1
- package/dist/{react → core}/fieldPath.d.mts +2 -2
- package/dist/{react → core}/fieldPath.mjs +3 -3
- package/dist/core/formats.d.mts +1 -1
- package/dist/core/guards.d.mts +2 -2
- package/dist/core/guards.mjs +2 -2
- package/dist/core/inferValue.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 +6 -6
- package/dist/core/normalise.mjs +1 -1
- package/dist/core/openapi30.d.mts +1 -1
- package/dist/core/openapi30.mjs +1 -1
- package/dist/core/ref.d.mts +1 -1
- package/dist/core/renderField.d.mts +147 -0
- package/dist/core/renderField.mjs +81 -0
- package/dist/core/renderer.d.mts +2 -199
- package/dist/core/swagger2.d.mts +1 -1
- package/dist/core/swagger2.mjs +1 -1
- package/dist/core/typeInference.d.mts +1 -981
- package/dist/core/types.d.mts +1 -1
- package/dist/core/unionMatch.d.mts +1 -1
- package/dist/core/uri.d.mts +2 -2
- package/dist/core/uri.mjs +2 -2
- package/dist/core/version.d.mts +1 -1
- package/dist/core/walkBuilders.d.mts +4 -4
- package/dist/core/walkBuilders.mjs +1 -1
- package/dist/core/walker.d.mts +1 -1
- package/dist/core/walker.mjs +3 -3
- package/dist/{errors-Dki7tji4.d.mts → errors-DbaI04x2.d.mts} +1 -1
- package/dist/html/a11y.d.mts +2 -2
- package/dist/html/html.d.mts +10 -8
- package/dist/html/renderToHtml.d.mts +5 -5
- package/dist/html/renderToHtml.mjs +45 -24
- package/dist/html/renderToHtmlStream.d.mts +5 -5
- package/dist/html/renderers.d.mts +1 -1
- package/dist/html/streamRenderers.d.mts +3 -3
- package/dist/{inferValue-PPXWJpbN.d.mts → inferValue-eAnh50EM.d.mts} +6 -6
- package/dist/lit/SchemaComponent.d.mts +125 -0
- package/dist/lit/SchemaComponent.mjs +2 -0
- package/dist/lit/SchemaField.d.mts +65 -0
- package/dist/lit/SchemaField.mjs +2 -0
- package/dist/lit/SchemaView.d.mts +14 -0
- package/dist/lit/SchemaView.mjs +2 -0
- package/dist/lit/constructorTypes.d.mts +2 -0
- package/dist/lit/constructorTypes.mjs +1 -0
- package/dist/lit/contexts.d.mts +78 -0
- package/dist/lit/contexts.mjs +238 -0
- package/dist/lit/defaultResolver.d.mts +33 -0
- package/dist/lit/defaultResolver.mjs +2 -0
- package/dist/lit/registry.d.mts +66 -0
- package/dist/lit/registry.mjs +2 -0
- package/dist/lit/renderers/baseElement.d.mts +131 -0
- package/dist/lit/renderers/baseElement.mjs +109 -0
- package/dist/lit/renderers/recordHelpers.d.mts +25 -0
- package/dist/lit/renderers/recordHelpers.mjs +55 -0
- package/dist/lit/renderers/scArray.d.mts +14 -0
- package/dist/lit/renderers/scArray.mjs +86 -0
- package/dist/lit/renderers/scBoolean.d.mts +15 -0
- package/dist/lit/renderers/scBoolean.mjs +47 -0
- package/dist/lit/renderers/scConditional.d.mts +23 -0
- package/dist/lit/renderers/scConditional.mjs +65 -0
- package/dist/lit/renderers/scDiscriminated.d.mts +23 -0
- package/dist/lit/renderers/scDiscriminated.mjs +138 -0
- package/dist/lit/renderers/scEnum.d.mts +16 -0
- package/dist/lit/renderers/scEnum.mjs +66 -0
- package/dist/lit/renderers/scFile.d.mts +15 -0
- package/dist/lit/renderers/scFile.mjs +53 -0
- package/dist/lit/renderers/scLiteralNullNever.d.mts +30 -0
- package/dist/lit/renderers/scLiteralNullNever.mjs +57 -0
- package/dist/lit/renderers/scNumber.d.mts +15 -0
- package/dist/lit/renderers/scNumber.mjs +64 -0
- package/dist/lit/renderers/scObject.d.mts +14 -0
- package/dist/lit/renderers/scObject.mjs +57 -0
- package/dist/lit/renderers/scRecord.d.mts +14 -0
- package/dist/lit/renderers/scRecord.mjs +112 -0
- package/dist/lit/renderers/scString.d.mts +19 -0
- package/dist/lit/renderers/scString.mjs +165 -0
- package/dist/lit/renderers/scTuple.d.mts +14 -0
- package/dist/lit/renderers/scTuple.mjs +58 -0
- package/dist/lit/renderers/scUnion.d.mts +14 -0
- package/dist/lit/renderers/scUnion.mjs +44 -0
- package/dist/lit/renderers/scUnknown.d.mts +15 -0
- package/dist/lit/renderers/scUnknown.mjs +45 -0
- package/dist/lit/ssr.d.mts +37 -0
- package/dist/lit/ssr.mjs +9565 -0
- package/dist/lit/types.d.mts +2 -0
- package/dist/lit/types.mjs +1 -0
- package/dist/lit/widget.d.mts +71 -0
- package/dist/lit/widget.mjs +87 -0
- package/dist/{normalise-DB-Xtjmn.mjs → normalise-BkePrJ4v.mjs} +6 -6
- package/dist/openapi/ApiCallbacks.d.mts +1 -1
- package/dist/openapi/ApiLinks.d.mts +1 -1
- package/dist/openapi/ApiResponseHeaders.d.mts +1 -1
- package/dist/openapi/ApiSecurity.d.mts +1 -1
- package/dist/openapi/components.d.mts +5 -5
- package/dist/openapi/components.mjs +1 -1
- package/dist/openapi/parser.d.mts +2 -2
- package/dist/openapi/resolve.d.mts +1 -1
- package/dist/openapi/resolve.mjs +1 -1
- package/dist/preact/SchemaComponent.d.mts +3 -0
- package/dist/preact/SchemaComponent.mjs +26 -0
- package/dist/preact/SchemaErrorBoundary.d.mts +2 -0
- package/dist/preact/SchemaErrorBoundary.mjs +20 -0
- package/dist/preact/SchemaView.d.mts +2 -0
- package/dist/preact/SchemaView.mjs +22 -0
- package/dist/preact/headless.d.mts +2 -0
- package/dist/preact/headless.mjs +18 -0
- package/dist/react/SchemaComponent.d.mts +3 -270
- package/dist/react/SchemaComponent.mjs +48 -39
- package/dist/react/SchemaErrorBoundary.mjs +7 -4
- package/dist/react/SchemaView.d.mts +11 -10
- package/dist/react/SchemaView.mjs +32 -29
- package/dist/react/a11y.d.mts +2 -2
- package/dist/react/fieldShell.d.mts +1 -1
- package/dist/react/headless.d.mts +1 -1
- package/dist/react/headlessRenderers.d.mts +2 -2
- package/dist/{ref-DdsbekXX.d.mts → ref-DWrQG1Er.d.mts} +1 -1
- package/dist/renderer-ab9E52Bp.d.mts +245 -0
- package/dist/solid/SchemaComponent.d.mts +136 -0
- package/dist/solid/SchemaComponent.mjs +391 -0
- package/dist/solid/SchemaErrorBoundary.d.mts +38 -0
- package/dist/solid/SchemaErrorBoundary.mjs +57 -0
- package/dist/solid/SchemaField.d.mts +40 -0
- package/dist/solid/SchemaField.mjs +113 -0
- package/dist/solid/SchemaView.d.mts +54 -0
- package/dist/solid/SchemaView.mjs +168 -0
- package/dist/solid/a11y.d.mts +70 -0
- package/dist/solid/a11y.mjs +71 -0
- package/dist/solid/contexts.d.mts +37 -0
- package/dist/solid/contexts.mjs +66 -0
- package/dist/solid/headless.d.mts +10 -0
- package/dist/solid/headless.mjs +27 -0
- package/dist/solid/renderers.d.mts +79 -0
- package/dist/solid/renderers.mjs +840 -0
- package/dist/solid/types.d.mts +90 -0
- package/dist/solid/types.mjs +1 -0
- package/dist/solid/widget.d.mts +29 -0
- package/dist/solid/widget.mjs +35 -0
- package/dist/themes/mantine.d.mts +1 -1
- package/dist/themes/mui.d.mts +1 -1
- package/dist/themes/radix.d.mts +1 -1
- package/dist/themes/shadcn.d.mts +1 -1
- package/dist/typeInference-Y8tNEQJk.d.mts +983 -0
- package/dist/types-BCy7K3nk.d.mts +125 -0
- package/package.json +71 -1
- package/src/svelte/SchemaComponent.svelte +427 -0
- package/src/svelte/SchemaErrorBoundary.svelte +66 -0
- package/src/svelte/SchemaField.svelte +216 -0
- package/src/svelte/SchemaProvider.svelte +46 -0
- package/src/svelte/SchemaView.svelte +244 -0
- package/src/svelte/a11y.ts +112 -0
- package/src/svelte/contexts.ts +79 -0
- package/src/svelte/dispatch.ts +267 -0
- package/src/svelte/headless.ts +73 -0
- package/src/svelte/headlessFns.ts +124 -0
- package/src/svelte/renderers/Array.svelte +98 -0
- package/src/svelte/renderers/Boolean.svelte +43 -0
- package/src/svelte/renderers/Conditional.svelte +67 -0
- package/src/svelte/renderers/DiscriminatedUnion.svelte +197 -0
- package/src/svelte/renderers/Enum.svelte +53 -0
- package/src/svelte/renderers/Fallback.svelte +24 -0
- package/src/svelte/renderers/File.svelte +46 -0
- package/src/svelte/renderers/Literal.svelte +29 -0
- package/src/svelte/renderers/Mount.svelte +24 -0
- package/src/svelte/renderers/Negation.svelte +35 -0
- package/src/svelte/renderers/Never.svelte +24 -0
- package/src/svelte/renderers/Null.svelte +19 -0
- package/src/svelte/renderers/Number.svelte +68 -0
- package/src/svelte/renderers/Object.svelte +74 -0
- package/src/svelte/renderers/Record.svelte +134 -0
- package/src/svelte/renderers/RecursionSentinel.svelte +27 -0
- package/src/svelte/renderers/String.svelte +152 -0
- package/src/svelte/renderers/Tuple.svelte +84 -0
- package/src/svelte/renderers/Union.svelte +49 -0
- package/src/svelte/renderers/Unknown.svelte +42 -0
- package/src/svelte/svelte-modules.d.ts +25 -0
- package/src/svelte/types.ts +238 -0
- package/src/svelte/widget.ts +62 -0
- /package/dist/{diagnostics-BTrm3O6J.d.mts → diagnostics-mftUZI7c.d.mts} +0 -0
- /package/dist/{limits-x4OiyJxh.d.mts → limits-Vv9hUbI_.d.mts} +0 -0
- /package/dist/{types-BrYbjC7_.d.mts → types-BBQaEPfE.d.mts} +0 -0
- /package/dist/{version-DL8U5RuA.d.mts → version-BEBx10ND.d.mts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//#region src/lit/widget.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Widget registry for the Lit adapter.
|
|
4
|
+
*
|
|
5
|
+
* Where the React adapter's widget registry stores function values
|
|
6
|
+
* (`(props: RenderProps) => unknown`), the Lit adapter stores Custom
|
|
7
|
+
* Element tag names — because every renderer override on the Web
|
|
8
|
+
* Components side IS a Custom Element. A schema field carrying
|
|
9
|
+
* `.meta({ component: "color-picker" })` is rendered by looking up
|
|
10
|
+
* the tag name registered against `"color-picker"` and emitting an
|
|
11
|
+
* instance of that element with the per-field props attached.
|
|
12
|
+
*
|
|
13
|
+
* Two scopes are supported:
|
|
14
|
+
*
|
|
15
|
+
* 1. **Global** — `registerLitWidget(name, tag)` writes to a module-level
|
|
16
|
+
* map shared by every `<schema-component>` in the document. Matches
|
|
17
|
+
* the React `registerWidget()` global default behaviour.
|
|
18
|
+
* 2. **Instance** — the `widgets` property on `<schema-component>` (a
|
|
19
|
+
* `LitWidgetMap` from `lit/contexts.ts`) overrides the global map
|
|
20
|
+
* for the wrapped subtree.
|
|
21
|
+
*
|
|
22
|
+
* Resolution order: instance widgets → global widgets → resolver →
|
|
23
|
+
* default Custom Element registry. The same order the React adapter
|
|
24
|
+
* implements; the only difference is the per-step lookup returns a
|
|
25
|
+
* tag name rather than a function value.
|
|
26
|
+
*
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Register a widget globally. The widget is resolved when a schema
|
|
31
|
+
* field has `.meta({ component: name })` and the rendered element is
|
|
32
|
+
* an instance of the matching Custom Element tag.
|
|
33
|
+
*
|
|
34
|
+
* `tag` must be a valid Custom Element name (containing a hyphen) and
|
|
35
|
+
* SHOULD be registered via `customElements.define` before any
|
|
36
|
+
* `<schema-component>` in the document instantiates the corresponding
|
|
37
|
+
* field — otherwise the browser emits an unupgraded element and the
|
|
38
|
+
* registered handler never runs.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { registerLitWidget } from "schema-components/lit/widget";
|
|
43
|
+
* import "./my-color-picker.ts"; // calls customElements.define("my-color-picker", ...)
|
|
44
|
+
*
|
|
45
|
+
* registerLitWidget("color-picker", "my-color-picker");
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param name - Widget hint name (matches `.meta({ component })`).
|
|
49
|
+
* @param tag - Custom Element tag name (e.g. `my-color-picker`).
|
|
50
|
+
*/
|
|
51
|
+
declare function registerLitWidget(name: string, tag: string): void;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a widget hint to a Custom Element tag name, considering
|
|
54
|
+
* instance widgets first and falling back to the global registry.
|
|
55
|
+
*
|
|
56
|
+
* @param name - Widget hint name from `.meta({ component })`.
|
|
57
|
+
* @param instanceWidgets - Optional instance-scoped overrides.
|
|
58
|
+
* @returns The Custom Element tag, or `undefined` when no widget is
|
|
59
|
+
* registered under `name` at either scope.
|
|
60
|
+
*/
|
|
61
|
+
declare function resolveLitWidget(name: string, instanceWidgets?: ReadonlyMap<string, string>): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Clear every globally registered widget. Intended for test isolation
|
|
64
|
+
* — `registerLitWidget` writes to module-level state, and that state
|
|
65
|
+
* leaks across test cases without an explicit reset.
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
declare function __clearGlobalLitWidgets(): void;
|
|
70
|
+
//#endregion
|
|
71
|
+
export { __clearGlobalLitWidgets, registerLitWidget, resolveLitWidget };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//#region src/lit/widget.ts
|
|
2
|
+
/**
|
|
3
|
+
* Widget registry for the Lit adapter.
|
|
4
|
+
*
|
|
5
|
+
* Where the React adapter's widget registry stores function values
|
|
6
|
+
* (`(props: RenderProps) => unknown`), the Lit adapter stores Custom
|
|
7
|
+
* Element tag names — because every renderer override on the Web
|
|
8
|
+
* Components side IS a Custom Element. A schema field carrying
|
|
9
|
+
* `.meta({ component: "color-picker" })` is rendered by looking up
|
|
10
|
+
* the tag name registered against `"color-picker"` and emitting an
|
|
11
|
+
* instance of that element with the per-field props attached.
|
|
12
|
+
*
|
|
13
|
+
* Two scopes are supported:
|
|
14
|
+
*
|
|
15
|
+
* 1. **Global** — `registerLitWidget(name, tag)` writes to a module-level
|
|
16
|
+
* map shared by every `<schema-component>` in the document. Matches
|
|
17
|
+
* the React `registerWidget()` global default behaviour.
|
|
18
|
+
* 2. **Instance** — the `widgets` property on `<schema-component>` (a
|
|
19
|
+
* `LitWidgetMap` from `lit/contexts.ts`) overrides the global map
|
|
20
|
+
* for the wrapped subtree.
|
|
21
|
+
*
|
|
22
|
+
* Resolution order: instance widgets → global widgets → resolver →
|
|
23
|
+
* default Custom Element registry. The same order the React adapter
|
|
24
|
+
* implements; the only difference is the per-step lookup returns a
|
|
25
|
+
* tag name rather than a function value.
|
|
26
|
+
*
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Global widget registry — `widget-name` → custom element tag name.
|
|
31
|
+
*
|
|
32
|
+
* Internal; consumers register via {@link registerLitWidget} and read
|
|
33
|
+
* via {@link resolveLitWidget} so the map shape can evolve without
|
|
34
|
+
* breaking callers.
|
|
35
|
+
*/
|
|
36
|
+
const globalLitWidgets = /* @__PURE__ */ new Map();
|
|
37
|
+
/**
|
|
38
|
+
* Register a widget globally. The widget is resolved when a schema
|
|
39
|
+
* field has `.meta({ component: name })` and the rendered element is
|
|
40
|
+
* an instance of the matching Custom Element tag.
|
|
41
|
+
*
|
|
42
|
+
* `tag` must be a valid Custom Element name (containing a hyphen) and
|
|
43
|
+
* SHOULD be registered via `customElements.define` before any
|
|
44
|
+
* `<schema-component>` in the document instantiates the corresponding
|
|
45
|
+
* field — otherwise the browser emits an unupgraded element and the
|
|
46
|
+
* registered handler never runs.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { registerLitWidget } from "schema-components/lit/widget";
|
|
51
|
+
* import "./my-color-picker.ts"; // calls customElements.define("my-color-picker", ...)
|
|
52
|
+
*
|
|
53
|
+
* registerLitWidget("color-picker", "my-color-picker");
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @param name - Widget hint name (matches `.meta({ component })`).
|
|
57
|
+
* @param tag - Custom Element tag name (e.g. `my-color-picker`).
|
|
58
|
+
*/
|
|
59
|
+
function registerLitWidget(name, tag) {
|
|
60
|
+
globalLitWidgets.set(name, tag);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve a widget hint to a Custom Element tag name, considering
|
|
64
|
+
* instance widgets first and falling back to the global registry.
|
|
65
|
+
*
|
|
66
|
+
* @param name - Widget hint name from `.meta({ component })`.
|
|
67
|
+
* @param instanceWidgets - Optional instance-scoped overrides.
|
|
68
|
+
* @returns The Custom Element tag, or `undefined` when no widget is
|
|
69
|
+
* registered under `name` at either scope.
|
|
70
|
+
*/
|
|
71
|
+
function resolveLitWidget(name, instanceWidgets) {
|
|
72
|
+
const instance = instanceWidgets?.get(name);
|
|
73
|
+
if (instance !== void 0) return instance;
|
|
74
|
+
return globalLitWidgets.get(name);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Clear every globally registered widget. Intended for test isolation
|
|
78
|
+
* — `registerLitWidget` writes to module-level state, and that state
|
|
79
|
+
* leaks across test cases without an explicit reset.
|
|
80
|
+
*
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
function __clearGlobalLitWidgets() {
|
|
84
|
+
globalLitWidgets.clear();
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { __clearGlobalLitWidgets, registerLitWidget, resolveLitWidget };
|
|
@@ -125,7 +125,7 @@ function compositeAlreadyAllowsNull(options) {
|
|
|
125
125
|
* values into each `oneOf`/`anyOf` option's discriminator property.
|
|
126
126
|
*
|
|
127
127
|
* In OpenAPI 3.0, `discriminator` is a sibling of `oneOf`/`anyOf`:
|
|
128
|
-
* discriminator: { propertyName: "type" }
|
|
128
|
+
* `discriminator: { propertyName: "type" }`
|
|
129
129
|
* The walker detects discriminated unions from `oneOf` + `const` on a
|
|
130
130
|
* property, so this normaliser injects the `const` values from the
|
|
131
131
|
* `mapping` or infers them from `$ref` fragment names.
|
|
@@ -1308,7 +1308,7 @@ function normaliseSwaggerHeader(header, diagnostics, pointer = "") {
|
|
|
1308
1308
|
* Deep-rewrite $ref strings in a normalised Swagger 2.0 document
|
|
1309
1309
|
* from Swagger 2.0 locations to OpenAPI 3.x locations using the
|
|
1310
1310
|
* shared {@link rewriteSwaggerRefPrefix} mapping. Mutates the object
|
|
1311
|
-
* in place
|
|
1311
|
+
* in place — called only on the fresh clone produced by
|
|
1312
1312
|
* normaliseSwagger2Document.
|
|
1313
1313
|
*/
|
|
1314
1314
|
function rewriteSwaggerRefs(node) {
|
|
@@ -1764,12 +1764,12 @@ function applyDraft04Translations(node, ctx) {
|
|
|
1764
1764
|
* single node.
|
|
1765
1765
|
*
|
|
1766
1766
|
* In Draft 04:
|
|
1767
|
-
* - `exclusiveMinimum: true` + `minimum: 5` → value must be
|
|
1768
|
-
* - `exclusiveMinimum: false` (or absent) + `minimum: 5` → value must be
|
|
1767
|
+
* - `exclusiveMinimum: true` + `minimum: 5` → value must be \> 5
|
|
1768
|
+
* - `exclusiveMinimum: false` (or absent) + `minimum: 5` → value must be \>= 5
|
|
1769
1769
|
*
|
|
1770
1770
|
* In Draft 06+:
|
|
1771
|
-
* - `exclusiveMinimum: 5` → value must be
|
|
1772
|
-
* - `minimum: 5` → value must be
|
|
1771
|
+
* - `exclusiveMinimum: 5` → value must be \> 5 (no separate `minimum`)
|
|
1772
|
+
* - `minimum: 5` → value must be \>= 5
|
|
1773
1773
|
*
|
|
1774
1774
|
* The transform converts boolean form to number form so the walker can
|
|
1775
1775
|
* treat `exclusiveMinimum`/`exclusiveMaximum` uniformly as numbers.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u as FieldOverride, w as SchemaMeta } from "../types-
|
|
2
|
-
import { r as DiagnosticSink } from "../diagnostics-
|
|
3
|
-
import { WidgetMap } from "../
|
|
4
|
-
import { InferParameterOverrides, InferRequestBodyFields, InferResponseFields,
|
|
1
|
+
import { u as FieldOverride, w as SchemaMeta } from "../types-BBQaEPfE.mjs";
|
|
2
|
+
import { r as DiagnosticSink } from "../diagnostics-mftUZI7c.mjs";
|
|
3
|
+
import { d as WidgetMap } from "../renderer-ab9E52Bp.mjs";
|
|
4
|
+
import { a as InferParameterOverrides, l as OpenAPIRequestBodyType, o as InferRequestBodyFields, s as InferResponseFields, u as OpenAPIResponseType } from "../typeInference-Y8tNEQJk.mjs";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
|
|
7
7
|
//#region src/openapi/components.d.ts
|
|
@@ -363,7 +363,7 @@ interface ApiResponseProps<Doc = unknown, Path extends PathKeysOf<Doc> = PathKey
|
|
|
363
363
|
* picked out of `schema` by `path`, `method`, and `status`.
|
|
364
364
|
*
|
|
365
365
|
* Status resolution follows the OpenAPI priority order: concrete code
|
|
366
|
-
* (e.g. `"200"`)
|
|
366
|
+
* (e.g. `"200"`) \> class wildcard (e.g. `"2XX"`) \> `"default"`. When
|
|
367
367
|
* `schema` is typed `as const`, `fields` autocomplete resolves from
|
|
368
368
|
* the response schema; pass `contentType` to narrow inference to a
|
|
369
369
|
* specific media type.
|
|
@@ -286,7 +286,7 @@ function ApiRequestBody({ schema: doc, path, method, value, onChange, meta, fiel
|
|
|
286
286
|
* picked out of `schema` by `path`, `method`, and `status`.
|
|
287
287
|
*
|
|
288
288
|
* Status resolution follows the OpenAPI priority order: concrete code
|
|
289
|
-
* (e.g. `"200"`)
|
|
289
|
+
* (e.g. `"200"`) \> class wildcard (e.g. `"2XX"`) \> `"default"`. When
|
|
290
290
|
* `schema` is typed `as const`, `fields` autocomplete resolves from
|
|
291
291
|
* the response schema; pass `contentType` to narrow inference to a
|
|
292
292
|
* specific media type.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as JsonObject } from "../types-
|
|
2
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
1
|
+
import { m as JsonObject } from "../types-BBQaEPfE.mjs";
|
|
2
|
+
import { i as DiagnosticsOptions } from "../diagnostics-mftUZI7c.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openapi/parser.d.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as DiagnosticsOptions } from "../diagnostics-
|
|
1
|
+
import { i as DiagnosticsOptions } from "../diagnostics-mftUZI7c.mjs";
|
|
2
2
|
import { OpenApiDocument, OperationInfo, ParameterInfo, RequestBodyInfo, ResponseInfo } from "./parser.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openapi/resolve.d.ts
|
package/dist/openapi/resolve.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import "../core/limits.mjs";
|
|
|
3
3
|
import { emitDiagnostic } from "../core/diagnostics.mjs";
|
|
4
4
|
import { isPrototypePollutingKey } from "../core/uri.mjs";
|
|
5
5
|
import { detectOpenApiVersion } from "../core/version.mjs";
|
|
6
|
-
import { o as normaliseOpenApiSchemas, r as documentContainsKeyword } from "../normalise-
|
|
6
|
+
import { o as normaliseOpenApiSchemas, r as documentContainsKeyword } from "../normalise-BkePrJ4v.mjs";
|
|
7
7
|
import { resolveRefChain } from "../core/refChain.mjs";
|
|
8
8
|
import { extractParameters, extractRequestBody, extractResponses, listAllOperations, parseOpenApiDocument } from "./parser.mjs";
|
|
9
9
|
//#region src/openapi/resolve.ts
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as InferredValue, i as InferredOutputValue, r as InferredInputValue, t as InferFields } from "../inferValue-eAnh50EM.mjs";
|
|
2
|
+
import { a as SchemaProvider, c as registerWidget, i as SchemaFieldProps, n as SchemaComponentProps, r as SchemaField, t as SchemaComponent } from "../SchemaComponent-B__6-5-E.mjs";
|
|
3
|
+
export { type InferFields, type InferredInputValue, type InferredOutputValue, type InferredValue, SchemaComponent, type SchemaComponentProps, SchemaField, type SchemaFieldProps, SchemaProvider, registerWidget };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SchemaComponent, SchemaField, SchemaProvider, registerWidget } from "../react/SchemaComponent.mjs";
|
|
2
|
+
//#region src/preact/SchemaComponent.ts
|
|
3
|
+
/**
|
|
4
|
+
* Preact entry point for `<SchemaComponent>`, `<SchemaProvider>`,
|
|
5
|
+
* `<SchemaField>` and `registerWidget`.
|
|
6
|
+
*
|
|
7
|
+
* Every export below is the React adapter export imported under the
|
|
8
|
+
* same name and re-exported. The Preact entry point works because the
|
|
9
|
+
* consumer aliases `react` to `preact/compat` in their bundler — see
|
|
10
|
+
* the "Preact support" section of the README for the alias config
|
|
11
|
+
* required in Vite, Next.js, and Node consumers. Without the alias,
|
|
12
|
+
* the React imports here resolve to the real React runtime, which
|
|
13
|
+
* defeats the purpose of importing from the Preact entry point.
|
|
14
|
+
*
|
|
15
|
+
* Implementation note: the renderer tree is intentionally identical to
|
|
16
|
+
* the React adapter. `preact/compat` translates React-style `onChange`
|
|
17
|
+
* to `onInput`, matching the "fires on every keystroke" semantics that
|
|
18
|
+
* the controlled inputs in `react/headlessRenderers.tsx` rely on.
|
|
19
|
+
*
|
|
20
|
+
* The `import` + plain `export { ... }` idiom below (rather than
|
|
21
|
+
* `export { ... } from`) is deliberate: the project's lint rules ban
|
|
22
|
+
* `export ... from` outside `index` files, so each binding is brought
|
|
23
|
+
* into local scope before being exported.
|
|
24
|
+
*/
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SchemaComponent, SchemaField, SchemaProvider, registerWidget };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SchemaErrorBoundary } from "../react/SchemaErrorBoundary.mjs";
|
|
2
|
+
//#region src/preact/SchemaErrorBoundary.ts
|
|
3
|
+
/**
|
|
4
|
+
* Preact entry point for `<SchemaErrorBoundary>`.
|
|
5
|
+
*
|
|
6
|
+
* The export is the React adapter export imported under the same name
|
|
7
|
+
* and re-exported. The Preact entry point works because the consumer
|
|
8
|
+
* aliases `react` to `preact/compat` in their bundler — see the
|
|
9
|
+
* "Preact support" section of the README for the alias config required
|
|
10
|
+
* in Vite, Next.js, and Node consumers. The class component relies on
|
|
11
|
+
* `componentDidCatch` / `getDerivedStateFromError`, both of which are
|
|
12
|
+
* provided by `preact/compat`.
|
|
13
|
+
*
|
|
14
|
+
* The `import` + plain `export { ... }` idiom below (rather than
|
|
15
|
+
* `export { ... } from`) is deliberate: the project's lint rules ban
|
|
16
|
+
* `export ... from` outside `index` files, so each binding is brought
|
|
17
|
+
* into local scope before being exported.
|
|
18
|
+
*/
|
|
19
|
+
//#endregion
|
|
20
|
+
export { SchemaErrorBoundary };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SchemaView } from "../react/SchemaView.mjs";
|
|
2
|
+
//#region src/preact/SchemaView.ts
|
|
3
|
+
/**
|
|
4
|
+
* Preact entry point for `<SchemaView>` — the read-only renderer.
|
|
5
|
+
*
|
|
6
|
+
* The export is the React adapter export imported under the same name
|
|
7
|
+
* and re-exported. The Preact entry point works because the consumer
|
|
8
|
+
* aliases `react` to `preact/compat` in their bundler — see the
|
|
9
|
+
* "Preact support" section of the README for the alias config required
|
|
10
|
+
* in Vite, Next.js, and Node consumers.
|
|
11
|
+
*
|
|
12
|
+
* Limitation: React Server Components is React-only. Under Preact,
|
|
13
|
+
* `<SchemaView>` runs as a client component and the zero-client-JS
|
|
14
|
+
* deployment story documented in the React README does not apply.
|
|
15
|
+
*
|
|
16
|
+
* The `import` + plain `export { ... }` idiom below (rather than
|
|
17
|
+
* `export { ... } from`) is deliberate: the project's lint rules ban
|
|
18
|
+
* `export ... from` outside `index` files, so each binding is brought
|
|
19
|
+
* into local scope before being exported.
|
|
20
|
+
*/
|
|
21
|
+
//#endregion
|
|
22
|
+
export { SchemaView };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { headlessResolver } from "../react/headless.mjs";
|
|
2
|
+
//#region src/preact/headless.ts
|
|
3
|
+
/**
|
|
4
|
+
* Preact entry point for the default headless `ComponentResolver`.
|
|
5
|
+
*
|
|
6
|
+
* The export is the React adapter export imported under the same name
|
|
7
|
+
* and re-exported. The Preact entry point works because the consumer
|
|
8
|
+
* aliases `react` to `preact/compat` in their bundler — see the
|
|
9
|
+
* "Preact support" section of the README for the alias config required
|
|
10
|
+
* in Vite, Next.js, and Node consumers.
|
|
11
|
+
*
|
|
12
|
+
* The `import` + plain `export { ... }` idiom below (rather than
|
|
13
|
+
* `export { ... } from`) is deliberate: the project's lint rules ban
|
|
14
|
+
* `export ... from` outside `index` files, so each binding is brought
|
|
15
|
+
* into local scope before being exported.
|
|
16
|
+
*/
|
|
17
|
+
//#endregion
|
|
18
|
+
export { headlessResolver };
|