@cisri/json-schema-editor 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.
@@ -1,12 +1,4 @@
1
- export type JsonSchemaType = 'object' | 'array' | 'string' | 'number' | 'boolean' | 'integer';
2
- export interface JsonSchema {
3
- type?: JsonSchemaType;
4
- title?: string;
5
- description?: string;
6
- properties?: Record<string, JsonSchema>;
7
- required?: string[];
8
- items?: JsonSchema;
9
- }
1
+ import type { JsonSchema } from '@cisri/json-schema-core';
10
2
  export interface JsonSchemaEditorProps {
11
3
  value: JsonSchema;
12
4
  onChange: (value: JsonSchema) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema-editor.d.ts","sourceRoot":"","sources":["../src/json-schema-editor.tsx"],"names":[],"mappings":"AAuBA,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6fD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,GACV,EAAE,qBAAqB,+BAkUvB"}
1
+ {"version":3,"file":"json-schema-editor.d.ts","sourceRoot":"","sources":["../src/json-schema-editor.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,yBAAyB,CAAC;AAW1E,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6VD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,GACV,EAAE,qBAAqB,+BA4UvB"}
@@ -0,0 +1,24 @@
1
+ import type { JsonSchema, JsonSchemaType } from '@cisri/json-schema-core';
2
+ export type { JsonSchema, JsonSchemaType };
3
+ export interface SchemaField {
4
+ id: string;
5
+ name: string;
6
+ type: JsonSchemaType;
7
+ required: boolean;
8
+ description?: string;
9
+ schema: JsonSchema;
10
+ children: SchemaField[];
11
+ expanded: boolean;
12
+ isArrayItem?: boolean;
13
+ isRoot?: boolean;
14
+ }
15
+ export declare function generateId(): string;
16
+ export declare function resetIdCounter(): void;
17
+ export declare function defaultChildrenForType(type: JsonSchemaType): SchemaField[];
18
+ export declare function buildField(name: string, schema: JsonSchema, requiredSet: Set<string>, isArrayItem?: boolean, isRoot?: boolean): SchemaField;
19
+ export declare function schemaToFields(schema: JsonSchema): SchemaField[];
20
+ export declare function buildEmptyField(): SchemaField;
21
+ export declare function ensureAtLeastOneField(fields: SchemaField[]): SchemaField[];
22
+ export declare function fieldsToSchema(fields: SchemaField[]): JsonSchema;
23
+ export declare function fieldToSchema(field: SchemaField): JsonSchema;
24
+ //# sourceMappingURL=schema-utils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 +1,6 @@
1
1
  {
2
2
  "name": "@cisri/json-schema-editor",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "JSON Schema editor business component based on shadcn/ui",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,51 +21,37 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
- "@cisri/core": "1.0.0"
24
+ "@cisri/core": "1.0.0",
25
+ "@cisri/json-schema-core": "1.0.0",
26
+ "@cisri/shadcn": "1.0.0"
25
27
  },
26
28
  "peerDependencies": {
27
29
  "react": "^18.0.0 || ^19.0.0",
28
30
  "react-dom": "^18.0.0 || ^19.0.0",
29
- "@radix-ui/react-checkbox": "^1.0.0",
30
- "@radix-ui/react-select": "^2.0.0",
31
- "@radix-ui/react-slot": "^1.0.0",
32
- "class-variance-authority": "^0.7.0",
33
- "clsx": "^2.0.0",
34
- "lucide-react": "^0.300.0",
35
- "tailwind-merge": "^2.0.0"
31
+ "lucide-react": "^0.300.0"
36
32
  },
37
33
  "peerDependenciesMeta": {
38
- "@radix-ui/react-checkbox": {
39
- "optional": true
40
- },
41
- "@radix-ui/react-select": {
42
- "optional": true
43
- },
44
- "@radix-ui/react-slot": {
45
- "optional": true
46
- },
47
- "class-variance-authority": {
48
- "optional": true
49
- },
50
- "clsx": {
51
- "optional": true
52
- },
53
34
  "lucide-react": {
54
- "optional": true
55
- },
56
- "tailwind-merge": {
57
- "optional": true
35
+ "optional": false
58
36
  }
59
37
  },
60
38
  "devDependencies": {
39
+ "@testing-library/jest-dom": "^6.4.0",
40
+ "@testing-library/react": "^15.0.0",
41
+ "@testing-library/user-event": "^14.5.0",
61
42
  "@types/react": "^18.3.0",
62
43
  "@types/react-dom": "^18.3.0",
44
+ "jsdom": "^24.0.0",
63
45
  "react": "^18.3.1",
64
46
  "react-dom": "^18.3.1",
65
47
  "typescript": "^5.4.5",
66
- "vite": "^5.2.11"
48
+ "vite": "^5.2.11",
49
+ "vitest": "^1.6.0",
50
+ "@vitejs/plugin-react": "^4.2.0"
67
51
  },
68
52
  "scripts": {
69
- "build": "tsc && vite build"
53
+ "build": "tsc && vite build",
54
+ "test": "vitest run",
55
+ "test:watch": "vitest"
70
56
  }
71
57
  }
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import { type VariantProps } from 'class-variance-authority';
3
- declare const buttonVariants: (props?: ({
4
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
5
- size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
- export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
- asChild?: boolean;
9
- }
10
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
- export { Button, buttonVariants };
12
- //# sourceMappingURL=button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,cAAc;;;8EA2BnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,MAAM,uFAWX,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
- declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
- export { Checkbox };
5
- //# sourceMappingURL=checkbox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/ui/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AAI9D,QAAA,MAAM,QAAQ,iKAkBZ,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
3
- }
4
- declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
5
- export { Input };
6
- //# sourceMappingURL=input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/ui/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;CAAG;AAElF,QAAA,MAAM,KAAK,qFAcV,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import * as SelectPrimitive from '@radix-ui/react-select';
3
- declare const Select: React.FC<SelectPrimitive.SelectProps>;
4
- declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
5
- declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
6
- declare const SelectTrigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
7
- declare const SelectContent: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
- declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
- export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectItem, };
10
- //# sourceMappingURL=select.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/ui/select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D,QAAA,MAAM,MAAM,uCAAuB,CAAC;AACpC,QAAA,MAAM,WAAW,yGAAwB,CAAC;AAC1C,QAAA,MAAM,WAAW,0GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,oKAiBjB,CAAC;AAGH,QAAA,MAAM,aAAa,8JA2BjB,CAAC;AAGH,QAAA,MAAM,UAAU,2JAmBd,CAAC;AAGH,OAAO,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,GACX,CAAC"}
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
3
- declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
4
- declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
5
- declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
6
- declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
7
- declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
8
- declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
9
- declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
10
- export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
11
- //# sourceMappingURL=table.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/ui/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,QAAA,MAAM,KAAK,iHAWT,CAAC;AAGH,QAAA,MAAM,WAAW,+HAKf,CAAC;AAGH,QAAA,MAAM,SAAS,+HASb,CAAC;AAGH,QAAA,MAAM,WAAW,+HAYf,CAAC;AAGH,QAAA,MAAM,QAAQ,uHAYZ,CAAC;AAGH,QAAA,MAAM,SAAS,2HAYb,CAAC;AAGH,QAAA,MAAM,SAAS,2HAYb,CAAC;AAGH,QAAA,MAAM,YAAY,+HAShB,CAAC;AAGH,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC"}
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
3
- }
4
- declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
5
- export { Textarea };
6
- //# sourceMappingURL=textarea.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/ui/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC;CAAG;AAE9D,QAAA,MAAM,QAAQ,2FAab,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,CAAC"}