@ht-rnd/json-schema-editor 1.0.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.
@@ -0,0 +1,120 @@
1
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
2
+ import { z } from 'zod';
3
+
4
+ declare const baseSchema: z.ZodObject<{
5
+ type: z.ZodOptional<z.ZodEnum<["string", "number", "integer", "boolean", "object", "array"]>>;
6
+ title: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodOptional<z.ZodString>;
8
+ default: z.ZodOptional<z.ZodAny>;
9
+ minimum: z.ZodOptional<z.ZodNumber>;
10
+ maximum: z.ZodOptional<z.ZodNumber>;
11
+ exclusiveMin: z.ZodOptional<z.ZodNumber>;
12
+ exclusiveMax: z.ZodOptional<z.ZodNumber>;
13
+ multipleOf: z.ZodOptional<z.ZodNumber>;
14
+ minLength: z.ZodOptional<z.ZodNumber>;
15
+ maxLength: z.ZodOptional<z.ZodNumber>;
16
+ minContains: z.ZodOptional<z.ZodNumber>;
17
+ maxContains: z.ZodOptional<z.ZodNumber>;
18
+ minProperties: z.ZodOptional<z.ZodNumber>;
19
+ maxProperties: z.ZodOptional<z.ZodNumber>;
20
+ isModifiable: z.ZodOptional<z.ZodBoolean>;
21
+ "x-modifiable": z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
22
+ pattern: z.ZodOptional<z.ZodString>;
23
+ format: z.ZodOptional<z.ZodString>;
24
+ minItems: z.ZodOptional<z.ZodNumber>;
25
+ maxItems: z.ZodOptional<z.ZodNumber>;
26
+ uniqueItems: z.ZodOptional<z.ZodBoolean>;
27
+ enum: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
28
+ $id: z.ZodOptional<z.ZodString>;
29
+ $schema: z.ZodOptional<z.ZodString>;
30
+ }, "strip", z.ZodTypeAny, {
31
+ type?: "string" | "number" | "boolean" | "object" | "integer" | "array" | undefined;
32
+ title?: string | undefined;
33
+ description?: string | undefined;
34
+ default?: any;
35
+ minimum?: number | undefined;
36
+ maximum?: number | undefined;
37
+ exclusiveMin?: number | undefined;
38
+ exclusiveMax?: number | undefined;
39
+ multipleOf?: number | undefined;
40
+ minLength?: number | undefined;
41
+ maxLength?: number | undefined;
42
+ minContains?: number | undefined;
43
+ maxContains?: number | undefined;
44
+ minProperties?: number | undefined;
45
+ maxProperties?: number | undefined;
46
+ isModifiable?: boolean | undefined;
47
+ "x-modifiable"?: string[] | undefined;
48
+ pattern?: string | undefined;
49
+ format?: string | undefined;
50
+ minItems?: number | undefined;
51
+ maxItems?: number | undefined;
52
+ uniqueItems?: boolean | undefined;
53
+ enum?: any[] | undefined;
54
+ $id?: string | undefined;
55
+ $schema?: string | undefined;
56
+ }, {
57
+ type?: "string" | "number" | "boolean" | "object" | "integer" | "array" | undefined;
58
+ title?: string | undefined;
59
+ description?: string | undefined;
60
+ default?: any;
61
+ minimum?: number | undefined;
62
+ maximum?: number | undefined;
63
+ exclusiveMin?: number | undefined;
64
+ exclusiveMax?: number | undefined;
65
+ multipleOf?: number | undefined;
66
+ minLength?: number | undefined;
67
+ maxLength?: number | undefined;
68
+ minContains?: number | undefined;
69
+ maxContains?: number | undefined;
70
+ minProperties?: number | undefined;
71
+ maxProperties?: number | undefined;
72
+ isModifiable?: boolean | undefined;
73
+ "x-modifiable"?: string[] | undefined;
74
+ pattern?: string | undefined;
75
+ format?: string | undefined;
76
+ minItems?: number | undefined;
77
+ maxItems?: number | undefined;
78
+ uniqueItems?: boolean | undefined;
79
+ enum?: any[] | undefined;
80
+ $id?: string | undefined;
81
+ $schema?: string | undefined;
82
+ }>;
83
+
84
+ declare type JSONSchema = z.infer<typeof baseSchema> & {
85
+ properties?: {
86
+ [key: string]: JSONSchema;
87
+ };
88
+ items?: JSONSchema | JSONSchema[];
89
+ required?: string[];
90
+ };
91
+
92
+ export declare const JsonSchemaEditor: ({ rootType, readOnly, theme, styles, onChange, defaultValue, }: JsonSchemaEditorProps) => JSX_2.Element;
93
+
94
+ declare interface JsonSchemaEditorProps {
95
+ rootType: "object" | "array";
96
+ readOnly: boolean;
97
+ theme: "dark" | "light";
98
+ styles?: Styles;
99
+ onChange?: (schema: JSONSchema) => void;
100
+ defaultValue?: JSONSchema;
101
+ }
102
+
103
+ declare interface Styles {
104
+ output: {
105
+ position: "top" | "bottom" | "left" | "right";
106
+ showJson: boolean;
107
+ width: "sm" | "md" | "lg" | "full";
108
+ height: "sm" | "md" | "lg" | "full";
109
+ };
110
+ form: {
111
+ width: "sm" | "md" | "lg" | "full";
112
+ height: "sm" | "md" | "lg" | "full";
113
+ };
114
+ settings: {
115
+ width: "sm" | "md" | "lg" | "full";
116
+ };
117
+ spacing: "sm" | "md" | "lg";
118
+ }
119
+
120
+ export { }
@@ -0,0 +1 @@
1
+ export { JsonSchemaEditor } from './components/features/JsonSchemaEditor';
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@ht-rnd/json-schema-editor",
3
+ "version": "1.0.0",
4
+ "license": "Apache-2.0",
5
+ "keywords": [
6
+ "json-schema",
7
+ "json-schema-editor"
8
+ ],
9
+ "type": "module",
10
+ "main": "./dist/lib/main.umd.js",
11
+ "module": "./dist/lib/main.es.js",
12
+ "types": "./dist/types/lib/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/types/lib/index.d.ts",
19
+ "import": "./dist/lib/main.es.js",
20
+ "require": "./dist/lib/main.umd.js"
21
+ }
22
+ },
23
+ "scripts": {
24
+ "dev": "vite",
25
+ "build": "tsc && vite build",
26
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
27
+ "preview": "vite preview"
28
+ },
29
+ "dependencies": {
30
+ "@hookform/resolvers": "^5.2.2",
31
+ "@radix-ui/react-alert-dialog": "^1.1.15",
32
+ "@radix-ui/react-checkbox": "^1.3.3",
33
+ "@radix-ui/react-dialog": "^1.1.15",
34
+ "@radix-ui/react-label": "^2.1.0",
35
+ "@radix-ui/react-popover": "^1.1.15",
36
+ "@radix-ui/react-radio-group": "^1.3.8",
37
+ "@radix-ui/react-select": "^2.2.6",
38
+ "@radix-ui/react-separator": "^1.1.7",
39
+ "@radix-ui/react-slot": "^1.2.3",
40
+ "@radix-ui/react-tooltip": "^1.2.8",
41
+ "@tailwindcss/vite": "^4.1.13",
42
+ "ajv": "^8.17.1",
43
+ "ajv-formats": "^3.0.1",
44
+ "class-variance-authority": "^0.7.1",
45
+ "clsx": "^2.1.1",
46
+ "lucide-react": "^0.525.0",
47
+ "nanoid": "^5.1.6",
48
+ "react": "^18.3.1",
49
+ "react-dom": "^18.3.1",
50
+ "react-hook-form": "^7.62.0",
51
+ "react-router-dom": "^7.7.0",
52
+ "tailwind-merge": "^3.3.1",
53
+ "vite-plugin-dts": "^4.5.4",
54
+ "zod": "^3.25.76"
55
+ },
56
+ "devDependencies": {
57
+ "@eslint/js": "^9.21.0",
58
+ "@types/node": "^22.14.0",
59
+ "@types/react": "^18.3.3",
60
+ "@types/react-dom": "^18.3.0",
61
+ "@vitejs/plugin-react": "^4.7.0",
62
+ "autoprefixer": "^10.4.0",
63
+ "eslint": "^9.21.0",
64
+ "eslint-plugin-react-hooks": "^5.1.0",
65
+ "eslint-plugin-react-refresh": "^0.4.19",
66
+ "globals": "^15.15.0",
67
+ "postcss": "^8.4.0",
68
+ "tailwindcss": "^3.4.18",
69
+ "tailwindcss-animate": "^1.0.7",
70
+ "typescript": "~5.7.2",
71
+ "typescript-eslint": "^8.24.1",
72
+ "vite": "^6.2.0"
73
+ }
74
+ }