json-schema-builder-react 0.0.1 → 0.0.3

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,8 @@
1
+ /**
2
+ * Open a file picker and read a JSON file
3
+ */
4
+ export declare const importJsonFile: () => Promise<any>;
5
+ /**
6
+ * Download a JSON object as a file
7
+ */
8
+ export declare const downloadJsonFile: (data: any, filename?: string) => void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generate a unique ID for properties
3
+ * Uses timestamp and random number for uniqueness
4
+ *
5
+ * @example
6
+ * generatePropertyId() // "1699632000000-0.123456789"
7
+ */
8
+ export declare const generatePropertyId: () => string;
@@ -0,0 +1,6 @@
1
+ import type { PropertyData, SchemaMetadata } from "@/types/schema";
2
+ import { JSONSchema7 } from "json-schema";
3
+ /**
4
+ * Generate a JSON Schema from property definitions
5
+ */
6
+ export declare const generateSchema: (properties: PropertyData[], metadata?: SchemaMetadata, includeMetadata?: boolean) => JSONSchema7;
@@ -0,0 +1,14 @@
1
+ import { JSONSchema7 } from "json-schema";
2
+ import type { PropertyData, SchemaMetadata } from "@/types/schema";
3
+ export interface ParsedSchema {
4
+ properties: PropertyData[];
5
+ metadata?: SchemaMetadata;
6
+ }
7
+ /**
8
+ * Parse a JSON Schema into PropertyData array
9
+ */
10
+ export declare const parseSchema: (schema: JSONSchema7) => ParsedSchema;
11
+ /**
12
+ * Recursively parse properties from a JSON Schema
13
+ */
14
+ export declare const parseProperties: (props: Record<string, JSONSchema7 | boolean>, requiredList?: string[]) => PropertyData[];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Convert a string to snake_case format
3
+ * Removes special characters and replaces spaces with underscores
4
+ *
5
+ * @example
6
+ * toSnakeCase("User Name") // "user_name"
7
+ * toSnakeCase("First Name!") // "first_name"
8
+ */
9
+ export declare const toSnakeCase: (str: string) => string;
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,30 @@
1
+ import type { JSONSchema7TypeName } from "json-schema";
2
+ export type PropertyType = JSONSchema7TypeName | "file";
3
+ /**
4
+ * Internal UI representation of a JSON Schema property
5
+ * This extends JSONSchema7 with additional metadata needed for the builder UI
6
+ */
7
+ export interface PropertyData {
8
+ id: string;
9
+ key: string;
10
+ required: boolean;
11
+ type: PropertyType;
12
+ title?: string;
13
+ description?: string;
14
+ minLength?: number;
15
+ maxLength?: number;
16
+ pattern?: string;
17
+ enum?: string[];
18
+ minimum?: number;
19
+ maximum?: number;
20
+ minItems?: number;
21
+ maxItems?: number;
22
+ uniqueItems?: boolean;
23
+ items?: PropertyData;
24
+ children?: PropertyData[];
25
+ }
26
+ export interface SchemaMetadata {
27
+ title: string;
28
+ description: string;
29
+ version: string;
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-schema-builder-react",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "A React component library for building and editing JSON schemas visually",
5
5
  "type": "module",
6
6
  "license": "MIT",