@ht-rnd/json-schema-editor 2.0.2 → 2.0.4
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 +9 -7
- package/dist/lib/main.es.js +3751 -3512
- package/dist/lib/main.umd.js +18 -18
- package/dist/types/index.d.ts +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ A powerful **headless** JSON Schema editor for React. Build fully customized edi
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **
|
|
9
|
+
- **Multi-Draft Support** - Draft-07, 2019-09, and 2020-12 with automatic detection via `$schema` URI
|
|
10
10
|
- **All Types** - string, number, integer, boolean, object, array, $ref
|
|
11
11
|
- **Nested Schemas** - Unlimited depth for objects and arrays
|
|
12
|
-
- **$defs Support** - Reusable definitions with `$ref
|
|
13
|
-
- **Validation** - AJV-powered real-time validation
|
|
12
|
+
- **$defs / definitions Support** - Reusable definitions with `$ref`; emits the correct key per draft
|
|
13
|
+
- **Validation** - AJV-powered real-time draft-aware validation
|
|
14
14
|
- **Combinators** - allOf, anyOf, oneOf, not
|
|
15
15
|
- **TypeScript** - Full type safety
|
|
16
16
|
- **Headless** - Zero UI dependencies in core
|
|
@@ -87,17 +87,18 @@ Main hook for editor state management.
|
|
|
87
87
|
{
|
|
88
88
|
// State
|
|
89
89
|
schema: JSONSchema;
|
|
90
|
-
errors:
|
|
90
|
+
errors: SchemaError[] | null; // null when valid
|
|
91
91
|
fields: FieldItem[];
|
|
92
92
|
definitions: DefinitionItem[];
|
|
93
93
|
form: UseFormReturn;
|
|
94
94
|
settingsState: { isOpen: boolean; fieldPath: string | null };
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
// Actions
|
|
97
97
|
addField: () => void;
|
|
98
98
|
removeField: (index: number) => void;
|
|
99
99
|
addDefinition: () => void;
|
|
100
100
|
removeDefinition: (index: number) => void;
|
|
101
|
+
updateReferences: (oldKey: string, newKey: string | null) => void; // update $ref strings when a definition key changes
|
|
101
102
|
openSettings: (path: string) => void;
|
|
102
103
|
closeSettings: () => void;
|
|
103
104
|
handleTypeChange: (path: string, type: string) => void;
|
|
@@ -114,7 +115,8 @@ Main hook for editor state management.
|
|
|
114
115
|
| `defaultValue` | `JSONSchema` | - | Initial schema to load |
|
|
115
116
|
| `onChange` | `(schema) => void` | - | Callback on schema change |
|
|
116
117
|
| `readOnly` | `boolean` | `false` | View-only mode |
|
|
117
|
-
| `showOutput` | `boolean` | `true` | Show/hide JSON output |
|
|
118
|
+
| `showOutput` | `boolean` | `true` | Show/hide JSON output panel |
|
|
119
|
+
| `defaultOutputCollapsed` | `boolean` | `false` | Start the JSON output panel collapsed |
|
|
118
120
|
| `className` | `string` | - | Additional CSS classes |
|
|
119
121
|
|
|
120
122
|
### Exports
|
|
@@ -126,7 +128,7 @@ export { useJsonSchemaEditor } from "@ht-rnd/json-schema-editor";
|
|
|
126
128
|
// Types
|
|
127
129
|
export type { JSONSchema, FieldItem, DefinitionItem, UseJsonSchemaEditorReturn };
|
|
128
130
|
|
|
129
|
-
// Utilities
|
|
131
|
+
// Utilities (all draft-aware: select AJV instance / emit correct defs key based on $schema)
|
|
130
132
|
export { validateSchema, formToSchema, schemaToForm };
|
|
131
133
|
|
|
132
134
|
// Constants
|