schema-components 3.0.0 → 3.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schema-components",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "React components that render UI from Zod schemas, JSON Schema, and OpenAPI documents",
5
5
  "type": "module",
6
6
  "exports": {
@@ -41,7 +41,7 @@
41
41
  constraint Vue, Solid, and React impose on shared mutable
42
42
  state and is documented in the package README.
43
43
  -->
44
- <script lang="ts" generics="T = unknown, Ref extends string | undefined = undefined">
44
+ <script lang="ts" generics="T = unknown, SchemaRef extends string | undefined = undefined">
45
45
  import { z } from "zod";
46
46
  import { walk } from "../core/walker.ts";
47
47
  import type { WalkOptions } from "../core/walkBuilders.ts";
@@ -78,13 +78,13 @@
78
78
  /** Zod 4, JSON Schema, or OpenAPI document. */
79
79
  schema: T;
80
80
  /** OpenAPI ref string, e.g. "#/components/schemas/User". */
81
- schemaRef?: Ref;
81
+ schemaRef?: SchemaRef;
82
82
  /** Direction (`"output"` / `"input"`) for codec / transform schemas. */
83
83
  io?: SchemaIoSide;
84
84
  /** Current value to render. */
85
- value?: InferSchemaValue<T, Ref, "output">;
85
+ value?: InferSchemaValue<T, SchemaRef, "output">;
86
86
  /** Called when the value changes. */
87
- onChange?: (value: InferSchemaValue<T, Ref, "output">) => void;
87
+ onChange?: (value: InferSchemaValue<T, SchemaRef, "output">) => void;
88
88
  /** Run `safeParse` / `safeEncode` on change. */
89
89
  validate?: boolean;
90
90
  /** Called with the ZodError on validation failure. */
@@ -96,7 +96,7 @@
96
96
  /** When true, any diagnostic becomes a thrown error. */
97
97
  strict?: boolean;
98
98
  /** Per-field meta overrides. */
99
- fields?: InferFields<T, Ref>;
99
+ fields?: InferFields<T, SchemaRef>;
100
100
  /** Meta overrides applied to the root schema. */
101
101
  meta?: SchemaMeta;
102
102
  /** Convenience: sets readOnly on all fields. */
@@ -234,7 +234,7 @@
234
234
  // contravariant assignment cannot be proven by
235
235
  // TypeScript and is the same pattern used in
236
236
  // `react/SchemaComponent.tsx`.
237
- onChange(nextValue as InferSchemaValue<T, Ref, "output">);
237
+ onChange(nextValue as InferSchemaValue<T, SchemaRef, "output">);
238
238
  }
239
239
  }
240
240
 
@@ -7,7 +7,7 @@
7
7
  fields inside bespoke layouts when `<SchemaComponent>` would
8
8
  render too much.
9
9
  -->
10
- <script lang="ts" generics="T = unknown, Ref extends string | undefined = undefined">
10
+ <script lang="ts" generics="T = unknown, SchemaRef extends string | undefined = undefined">
11
11
  import { walk } from "../core/walker.ts";
12
12
  import type { WalkOptions } from "../core/walkBuilders.ts";
13
13
  import {
@@ -40,7 +40,7 @@
40
40
  /** The schema to extract the field from. */
41
41
  schema: T;
42
42
  /** OpenAPI ref string. */
43
- schemaRef?: Ref;
43
+ schemaRef?: SchemaRef;
44
44
  /** Direction (`"output"` / `"input"`) for codec / transform schemas. */
45
45
  io?: SchemaIoSide;
46
46
  /** Current value of the root schema. */
@@ -20,7 +20,7 @@
20
20
  - No global widget lookup — Svelte SSR mustn't read
21
21
  module-level mutable state.
22
22
  -->
23
- <script lang="ts" generics="T = unknown, Ref extends string | undefined = undefined">
23
+ <script lang="ts" generics="T = unknown, SchemaRef extends string | undefined = undefined">
24
24
  import { walk } from "../core/walker.ts";
25
25
  import type { WalkOptions } from "../core/walkBuilders.ts";
26
26
  import {
@@ -51,10 +51,10 @@
51
51
 
52
52
  interface Props {
53
53
  schema: T;
54
- schemaRef?: Ref;
54
+ schemaRef?: SchemaRef;
55
55
  io?: SchemaIoSide;
56
- value?: InferredValue<T, Ref, undefined, "output">;
57
- fields?: InferFields<T, Ref>;
56
+ value?: InferredValue<T, SchemaRef, undefined, "output">;
57
+ fields?: InferFields<T, SchemaRef>;
58
58
  meta?: SchemaMeta;
59
59
  description?: string;
60
60
  /** Theme resolver — Svelte SSR has no context fallthrough, pass explicitly. */