@tyx1703/json-schema-editor-visual 1.0.0 → 1.0.1

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -7
  3. package/package.json +2 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 YanxinTang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,13 +2,6 @@
2
2
 
3
3
  A React component for visually editing JSON Schema.
4
4
 
5
- ## Peer Dependencies
6
-
7
- - `react` ^18 or ^19
8
- - `react-dom` ^18 or ^19
9
- - `antd` ^5 or ^6
10
- - `@ant-design/icons` ^5 or ^6
11
-
12
5
  ## Install
13
6
 
14
7
  ```bash
@@ -96,6 +89,80 @@ The component defaults to Chinese (`zh_CN`) when the antd locale starts with `zh
96
89
  | `format` | `Format` | `[]` | Custom format options (`{ name: string; title?: string }[]`) |
97
90
  | `mock` | `MockSource` | — | Mock data source; when provided, a mock column appears (`{ name: string; mock: string }[]`) |
98
91
 
92
+ ## Migrating from json-schema-editor-visual
93
+
94
+ This is a fork of [Open-Federation/json-schema-editor-visual](https://github.com/Open-Federation/json-schema-editor-visual) with a redesigned API.
95
+
96
+ ### Install
97
+
98
+ ```bash
99
+ # old
100
+ npm install json-schema-editor-visual
101
+
102
+ # new
103
+ pnpm add @tyx1703/json-schema-editor-visual
104
+ ```
105
+
106
+ ### Factory function → Component
107
+
108
+ ```jsx
109
+ // old
110
+ const schemaEditor = require('json-schema-editor-visual/dist/main.js');
111
+ const SchemaEditor = schemaEditor({ lang: 'zh_CN' });
112
+
113
+ // new
114
+ import JsonSchemaEditorVisual from '@tyx1703/json-schema-editor-visual';
115
+ ```
116
+
117
+ ### Locale via ConfigProvider
118
+
119
+ ```jsx
120
+ // old
121
+ const SchemaEditor = schemaEditor({ lang: 'zh_CN' });
122
+
123
+ // new
124
+ import { ConfigProvider } from 'antd';
125
+ import zhCN from 'antd/locale/zh_CN';
126
+
127
+ <ConfigProvider locale={zhCN}>
128
+ <JsonSchemaEditorVisual />
129
+ </ConfigProvider>;
130
+ ```
131
+
132
+ ### Mock & Format → Props
133
+
134
+ ```jsx
135
+ // old
136
+ const SchemaEditor = schemaEditor({ mock: MOCK, format: FORMAT });
137
+
138
+ // new
139
+ <JsonSchemaEditorVisual mock={MOCK} format={FORMAT} />;
140
+ ```
141
+
142
+ ### CSS — no longer needed
143
+
144
+ ```jsx
145
+ // old — required
146
+ import 'antd/dist/antd.css';
147
+ require('json-schema-editor-visual/dist/main.css');
148
+
149
+ // new — nothing to import
150
+ ```
151
+
152
+ ### Breaking changes summary
153
+
154
+ | Change | Old | New |
155
+ | ------------- | ------------------------------ | ------------------------------------ |
156
+ | Package name | `json-schema-editor-visual` | `@tyx1703/json-schema-editor-visual` |
157
+ | Export | Factory `schemaEditor(config)` | Direct component |
158
+ | Locale | `{ lang: 'zh_CN' }` | antd `ConfigProvider` |
159
+ | Mock / Format | Factory options | Component props |
160
+ | CSS import | Manual `main.css` | Not needed |
161
+ | React | >=16.9.0 | ^18 or ^19 |
162
+ | antd | 4 | ^5 or ^6 |
163
+ | Editor | Ace | Monaco |
164
+ | Model API | `Model.schema` | Removed |
165
+
99
166
  ## Development
100
167
 
101
168
  This project is a pnpm monorepo.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tyx1703/json-schema-editor-visual",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A React component for visually editing JSON Schema",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,6 +30,7 @@
30
30
  "LICENSE"
31
31
  ],
32
32
  "scripts": {
33
+ "prepack": "node ../../scripts/prepare-package.mjs",
33
34
  "build": "rslib",
34
35
  "build:test": "cross-env NODE_ENV='test' rslib",
35
36
  "dev": "rslib --watch",