From c8a82da722db67e64740e27f8eed9db1fcefb9b7 Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 31 Oct 2025 13:42:11 +0800 Subject: [PATCH] Feat: Rename the files in the jsonjoy-builder directory to lowercase. #10866 (#10908) ### What problem does this PR solve? Feat: Rename the files in the jsonjoy-builder directory to lowercase. #10866 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../{JsonValidator.tsx => json-validator.tsx} | 7 +- ...maInferencer.tsx => schema-inferencer.tsx} | 2 +- .../add-field-button.tsx} | 4 +- .../json-schema-editor.tsx} | 6 +- .../json-schema-visualizer.tsx} | 2 +- .../schema-field-list.tsx} | 6 +- .../schema-field.tsx} | 6 +- .../schema-property-editor.tsx} | 10 +- .../schema-type-selector.tsx} | 2 +- .../schema-visual-editor.tsx} | 10 +- .../type-dropdown.tsx} | 2 +- .../type-editor.tsx} | 14 +- .../types/array-editor.tsx} | 12 +- .../types/boolean-editor.tsx} | 6 +- .../types/number-editor.tsx} | 6 +- .../types/object-editor.tsx} | 12 +- .../types/string-editor.tsx} | 6 +- .../jsonjoy-builder/components/ui/badge.tsx | 36 ---- .../jsonjoy-builder/components/ui/button.tsx | 56 ------ .../jsonjoy-builder/components/ui/dialog.tsx | 136 --------------- .../jsonjoy-builder/components/ui/input.tsx | 21 --- .../jsonjoy-builder/components/ui/label.tsx | 28 --- .../jsonjoy-builder/components/ui/select.tsx | 163 ------------------ .../jsonjoy-builder/components/ui/switch.tsx | 31 ---- .../jsonjoy-builder/components/ui/tabs.tsx | 57 ------ .../jsonjoy-builder/components/ui/tooltip.tsx | 32 ---- .../jsonjoy-builder/hooks/use-monaco-theme.ts | 2 +- web/src/components/jsonjoy-builder/index.ts | 12 +- .../lib/{schemaEditor.ts => schema-editor.ts} | 4 +- .../jsonjoy-builder/lib/schema-inference.ts | 2 +- .../components/jsonjoy-builder/lib/utils.ts | 2 +- .../types/{jsonSchema.ts => json-schema.ts} | 0 .../jsonjoy-builder/types/validation.ts | 4 +- .../{jsonValidator.ts => json-validator.ts} | 2 +- 34 files changed, 72 insertions(+), 629 deletions(-) rename web/src/components/jsonjoy-builder/components/features/{JsonValidator.tsx => json-validator.tsx} (98%) rename web/src/components/jsonjoy-builder/components/features/{SchemaInferencer.tsx => schema-inferencer.tsx} (98%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/AddFieldButton.tsx => schema-editor/add-field-button.tsx} (98%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/JsonSchemaEditor.tsx => schema-editor/json-schema-editor.tsx} (96%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/JsonSchemaVisualizer.tsx => schema-editor/json-schema-visualizer.tsx} (98%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/SchemaFieldList.tsx => schema-editor/schema-field-list.tsx} (95%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/SchemaField.tsx => schema-editor/schema-field.tsx} (97%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/SchemaPropertyEditor.tsx => schema-editor/schema-property-editor.tsx} (97%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/SchemaTypeSelector.tsx => schema-editor/schema-type-selector.tsx} (97%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/SchemaVisualEditor.tsx => schema-editor/schema-visual-editor.tsx} (94%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/TypeDropdown.tsx => schema-editor/type-dropdown.tsx} (97%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/TypeEditor.tsx => schema-editor/type-editor.tsx} (82%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/types/ArrayEditor.tsx => schema-editor/types/array-editor.tsx} (96%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/types/BooleanEditor.tsx => schema-editor/types/boolean-editor.tsx} (94%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/types/NumberEditor.tsx => schema-editor/types/number-editor.tsx} (98%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/types/ObjectEditor.tsx => schema-editor/types/object-editor.tsx} (94%) rename web/src/components/jsonjoy-builder/components/{SchemaEditor/types/StringEditor.tsx => schema-editor/types/string-editor.tsx} (98%) delete mode 100644 web/src/components/jsonjoy-builder/components/ui/badge.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/button.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/dialog.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/input.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/label.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/select.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/switch.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/tabs.tsx delete mode 100644 web/src/components/jsonjoy-builder/components/ui/tooltip.tsx rename web/src/components/jsonjoy-builder/lib/{schemaEditor.ts => schema-editor.ts} (97%) rename web/src/components/jsonjoy-builder/types/{jsonSchema.ts => json-schema.ts} (100%) rename web/src/components/jsonjoy-builder/utils/{jsonValidator.ts => json-validator.ts} (99%) diff --git a/web/src/components/jsonjoy-builder/components/features/JsonValidator.tsx b/web/src/components/jsonjoy-builder/components/features/json-validator.tsx similarity index 98% rename from web/src/components/jsonjoy-builder/components/features/JsonValidator.tsx rename to web/src/components/jsonjoy-builder/components/features/json-validator.tsx index a22421788..01f319ee0 100644 --- a/web/src/components/jsonjoy-builder/components/features/JsonValidator.tsx +++ b/web/src/components/jsonjoy-builder/components/features/json-validator.tsx @@ -11,8 +11,11 @@ import type * as Monaco from 'monaco-editor'; import { useCallback, useEffect, useRef, useState } from 'react'; import { useMonacoTheme } from '../../hooks/use-monaco-theme'; import { formatTranslation, useTranslation } from '../../hooks/use-translation'; -import type { JSONSchema } from '../../types/jsonSchema'; -import { validateJson, type ValidationResult } from '../../utils/jsonValidator'; +import type { JSONSchema } from '../../types/json-schema'; +import { + validateJson, + type ValidationResult, +} from '../../utils/json-validator'; /** @public */ export interface JsonValidatorProps { diff --git a/web/src/components/jsonjoy-builder/components/features/SchemaInferencer.tsx b/web/src/components/jsonjoy-builder/components/features/schema-inferencer.tsx similarity index 98% rename from web/src/components/jsonjoy-builder/components/features/SchemaInferencer.tsx rename to web/src/components/jsonjoy-builder/components/features/schema-inferencer.tsx index 5c68b46b7..d97a5c09c 100644 --- a/web/src/components/jsonjoy-builder/components/features/SchemaInferencer.tsx +++ b/web/src/components/jsonjoy-builder/components/features/schema-inferencer.tsx @@ -13,7 +13,7 @@ import { useRef, useState } from 'react'; import { useMonacoTheme } from '../../hooks/use-monaco-theme'; import { useTranslation } from '../../hooks/use-translation'; import { createSchemaFromJson } from '../../lib/schema-inference'; -import type { JSONSchema } from '../../types/jsonSchema'; +import type { JSONSchema } from '../../types/json-schema'; /** @public */ export interface SchemaInferencerProps { diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/AddFieldButton.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/add-field-button.tsx similarity index 98% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/AddFieldButton.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/add-field-button.tsx index afe33b72a..b890fcec4 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/AddFieldButton.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/add-field-button.tsx @@ -18,8 +18,8 @@ import { import { CirclePlus, HelpCircle, Info } from 'lucide-react'; import { useId, useState, type FC, type FormEvent } from 'react'; import { useTranslation } from '../../hooks/use-translation'; -import type { NewField, SchemaType } from '../../types/jsonSchema'; -import SchemaTypeSelector from './SchemaTypeSelector'; +import type { NewField, SchemaType } from '../../types/json-schema'; +import SchemaTypeSelector from './schema-type-selector'; interface AddFieldButtonProps { onAddField: (field: NewField) => void; diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/JsonSchemaEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-editor.tsx similarity index 96% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/JsonSchemaEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/json-schema-editor.tsx index 477e0be02..4085dd071 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/JsonSchemaEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-editor.tsx @@ -8,9 +8,9 @@ import { } from 'react'; import { useTranslation } from '../../hooks/use-translation'; import { cn } from '../../lib/utils'; -import type { JSONSchema } from '../../types/jsonSchema'; -import JsonSchemaVisualizer from './JsonSchemaVisualizer'; -import SchemaVisualEditor from './SchemaVisualEditor'; +import type { JSONSchema } from '../../types/json-schema'; +import JsonSchemaVisualizer from './json-schema-visualizer'; +import SchemaVisualEditor from './schema-visual-editor'; /** @public */ export interface JsonSchemaEditorProps { diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/JsonSchemaVisualizer.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-visualizer.tsx similarity index 98% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/JsonSchemaVisualizer.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/json-schema-visualizer.tsx index 48cea9bf7..3e33da665 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/JsonSchemaVisualizer.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/json-schema-visualizer.tsx @@ -4,7 +4,7 @@ import { useRef, type FC } from 'react'; import { useMonacoTheme } from '../../hooks/use-monaco-theme'; import { useTranslation } from '../../hooks/use-translation'; import { cn } from '../../lib/utils'; -import type { JSONSchema } from '../../types/jsonSchema'; +import type { JSONSchema } from '../../types/json-schema'; /** @public */ export interface JsonSchemaVisualizerProps { diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaFieldList.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/schema-field-list.tsx similarity index 95% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaFieldList.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/schema-field-list.tsx index 8bc3f7bb7..94aaa523c 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaFieldList.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/schema-field-list.tsx @@ -1,14 +1,14 @@ import { useMemo, type FC } from 'react'; import { useTranslation } from '../../hooks/use-translation'; -import { getSchemaProperties } from '../../lib/schemaEditor'; +import { getSchemaProperties } from '../../lib/schema-editor'; import type { JSONSchema as JSONSchemaType, NewField, ObjectJSONSchema, SchemaType, -} from '../../types/jsonSchema'; +} from '../../types/json-schema'; import { buildValidationTree } from '../../types/validation'; -import SchemaPropertyEditor from './SchemaPropertyEditor'; +import SchemaPropertyEditor from './schema-property-editor'; interface SchemaFieldListProps { schema: JSONSchemaType; diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaField.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/schema-field.tsx similarity index 97% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaField.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/schema-field.tsx index e1c42ce79..d7155efd2 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaField.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/schema-field.tsx @@ -5,13 +5,13 @@ import type { NewField, ObjectJSONSchema, SchemaType, -} from '../../types/jsonSchema'; +} from '../../types/json-schema'; import { asObjectSchema, getSchemaDescription, withObjectSchema, -} from '../../types/jsonSchema'; -import SchemaPropertyEditor from './SchemaPropertyEditor'; +} from '../../types/json-schema'; +import SchemaPropertyEditor from './schema-property-editor'; // This component is now just a simple wrapper around SchemaPropertyEditor // to maintain backward compatibility during migration diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaPropertyEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/schema-property-editor.tsx similarity index 97% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaPropertyEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/schema-property-editor.tsx index c7f950b81..c821ab840 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaPropertyEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/schema-property-editor.tsx @@ -1,3 +1,4 @@ +import { Badge } from '@/components/ui/badge'; import { Input } from '@/components/ui/input'; import { ChevronDown, ChevronRight, X } from 'lucide-react'; import { useEffect, useState } from 'react'; @@ -7,16 +8,15 @@ import type { JSONSchema, ObjectJSONSchema, SchemaType, -} from '../../types/jsonSchema'; +} from '../../types/json-schema'; import { asObjectSchema, getSchemaDescription, withObjectSchema, -} from '../../types/jsonSchema'; +} from '../../types/json-schema'; import type { ValidationTreeNode } from '../../types/validation'; -import { Badge } from '../ui/badge'; -import TypeDropdown from './TypeDropdown'; -import TypeEditor from './TypeEditor'; +import TypeDropdown from './type-dropdown'; +import TypeEditor from './type-editor'; export interface SchemaPropertyEditorProps { name: string; diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaTypeSelector.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/schema-type-selector.tsx similarity index 97% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaTypeSelector.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/schema-type-selector.tsx index 25e06bf5f..7d7cc666e 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaTypeSelector.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/schema-type-selector.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react'; import { useTranslation } from '../../hooks/use-translation'; import type { Translation } from '../../i18n/translation-keys'; import { cn } from '../../lib/utils'; -import type { SchemaType } from '../../types/jsonSchema'; +import type { SchemaType } from '../../types/json-schema'; interface SchemaTypeSelectorProps { id?: string; diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaVisualEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/schema-visual-editor.tsx similarity index 94% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaVisualEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/schema-visual-editor.tsx index 1c353c07c..88bd76965 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/SchemaVisualEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/schema-visual-editor.tsx @@ -4,11 +4,11 @@ import { createFieldSchema, updateObjectProperty, updatePropertyRequired, -} from '../../lib/schemaEditor'; -import type { JSONSchema, NewField } from '../../types/jsonSchema'; -import { asObjectSchema, isBooleanSchema } from '../../types/jsonSchema'; -import AddFieldButton from './AddFieldButton'; -import SchemaFieldList from './SchemaFieldList'; +} from '../../lib/schema-editor'; +import type { JSONSchema, NewField } from '../../types/json-schema'; +import { asObjectSchema, isBooleanSchema } from '../../types/json-schema'; +import AddFieldButton from './add-field-button'; +import SchemaFieldList from './schema-field-list'; /** @public */ export interface SchemaVisualEditorProps { diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/TypeDropdown.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/type-dropdown.tsx similarity index 97% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/TypeDropdown.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/type-dropdown.tsx index 2960d67fb..15df232dd 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/TypeDropdown.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/type-dropdown.tsx @@ -2,7 +2,7 @@ import { Check, ChevronDown } from 'lucide-react'; import { useEffect, useRef, useState } from 'react'; import { useTranslation } from '../../hooks/use-translation'; import { cn, getTypeColor, getTypeLabel } from '../../lib/utils'; -import type { SchemaType } from '../../types/jsonSchema'; +import type { SchemaType } from '../../types/json-schema'; export interface TypeDropdownProps { value: SchemaType; diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/TypeEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/type-editor.tsx similarity index 82% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/TypeEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/type-editor.tsx index 0dee682ac..89e866a6f 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/TypeEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/type-editor.tsx @@ -1,18 +1,18 @@ import { lazy, Suspense } from 'react'; -import { withObjectSchema } from '../../types/jsonSchema'; import type { JSONSchema, ObjectJSONSchema, SchemaType, -} from '../../types/jsonSchema.ts'; +} from '../../types/json-schema'; +import { withObjectSchema } from '../../types/json-schema'; import type { ValidationTreeNode } from '../../types/validation'; // Lazy load specific type editors to avoid circular dependencies -const StringEditor = lazy(() => import('./types/StringEditor')); -const NumberEditor = lazy(() => import('./types/NumberEditor')); -const BooleanEditor = lazy(() => import('./types/BooleanEditor')); -const ObjectEditor = lazy(() => import('./types/ObjectEditor')); -const ArrayEditor = lazy(() => import('./types/ArrayEditor')); +const StringEditor = lazy(() => import('./types/string-editor')); +const NumberEditor = lazy(() => import('./types/number-editor')); +const BooleanEditor = lazy(() => import('./types/boolean-editor')); +const ObjectEditor = lazy(() => import('./types/object-editor')); +const ArrayEditor = lazy(() => import('./types/array-editor')); export interface TypeEditorProps { schema: JSONSchema; diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/ArrayEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/array-editor.tsx similarity index 96% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/types/ArrayEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/types/array-editor.tsx index c6c0dcf7e..c5ed75dec 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/ArrayEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/array-editor.tsx @@ -3,13 +3,13 @@ import { Label } from '@/components/ui/label'; import { Switch } from '@/components/ui/switch'; import { useId, useMemo, useState } from 'react'; import { useTranslation } from '../../../hooks/use-translation'; -import { getArrayItemsSchema } from '../../../lib/schemaEditor'; +import { getArrayItemsSchema } from '../../../lib/schema-editor'; import { cn } from '../../../lib/utils'; -import type { ObjectJSONSchema, SchemaType } from '../../../types/jsonSchema'; -import { isBooleanSchema, withObjectSchema } from '../../../types/jsonSchema'; -import TypeDropdown from '../TypeDropdown'; -import type { TypeEditorProps } from '../TypeEditor'; -import TypeEditor from '../TypeEditor'; +import type { ObjectJSONSchema, SchemaType } from '../../../types/json-schema'; +import { isBooleanSchema, withObjectSchema } from '../../../types/json-schema'; +import TypeDropdown from '../type-dropdown'; +import type { TypeEditorProps } from '../type-editor'; +import TypeEditor from '../type-editor'; const ArrayEditor: React.FC = ({ schema, diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/BooleanEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/boolean-editor.tsx similarity index 94% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/types/BooleanEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/types/boolean-editor.tsx index 9d0710b7f..989ad56f3 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/BooleanEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/boolean-editor.tsx @@ -2,9 +2,9 @@ import { Label } from '@/components/ui/label'; import { Switch } from '@/components/ui/switch'; import { useId } from 'react'; import { useTranslation } from '../../../hooks/use-translation'; -import type { ObjectJSONSchema } from '../../../types/jsonSchema'; -import { withObjectSchema } from '../../../types/jsonSchema'; -import type { TypeEditorProps } from '../TypeEditor'; +import type { ObjectJSONSchema } from '../../../types/json-schema'; +import { withObjectSchema } from '../../../types/json-schema'; +import type { TypeEditorProps } from '../type-editor'; const BooleanEditor: React.FC = ({ schema, onChange }) => { const t = useTranslation(); diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/NumberEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/number-editor.tsx similarity index 98% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/types/NumberEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/types/number-editor.tsx index c53a0918f..e48a9bae0 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/NumberEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/number-editor.tsx @@ -4,9 +4,9 @@ import { X } from 'lucide-react'; import { useId, useMemo, useState } from 'react'; import { useTranslation } from '../../../hooks/use-translation'; import { cn } from '../../../lib/utils'; -import type { ObjectJSONSchema } from '../../../types/jsonSchema'; -import { isBooleanSchema, withObjectSchema } from '../../../types/jsonSchema'; -import type { TypeEditorProps } from '../TypeEditor'; +import type { ObjectJSONSchema } from '../../../types/json-schema'; +import { isBooleanSchema, withObjectSchema } from '../../../types/json-schema'; +import type { TypeEditorProps } from '../type-editor'; interface NumberEditorProps extends TypeEditorProps { integer?: boolean; diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/ObjectEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/object-editor.tsx similarity index 94% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/types/ObjectEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/types/object-editor.tsx index 72191da71..7bb026229 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/ObjectEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/object-editor.tsx @@ -4,12 +4,12 @@ import { removeObjectProperty, updateObjectProperty, updatePropertyRequired, -} from '../../../lib/schemaEditor'; -import type { NewField, ObjectJSONSchema } from '../../../types/jsonSchema'; -import { asObjectSchema, isBooleanSchema } from '../../../types/jsonSchema'; -import AddFieldButton from '../AddFieldButton'; -import SchemaPropertyEditor from '../SchemaPropertyEditor'; -import type { TypeEditorProps } from '../TypeEditor'; +} from '../../../lib/schema-editor'; +import type { NewField, ObjectJSONSchema } from '../../../types/json-schema'; +import { asObjectSchema, isBooleanSchema } from '../../../types/json-schema'; +import AddFieldButton from '../add-field-button'; +import SchemaPropertyEditor from '../schema-property-editor'; +import type { TypeEditorProps } from '../type-editor'; const ObjectEditor: React.FC = ({ schema, diff --git a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/StringEditor.tsx b/web/src/components/jsonjoy-builder/components/schema-editor/types/string-editor.tsx similarity index 98% rename from web/src/components/jsonjoy-builder/components/SchemaEditor/types/StringEditor.tsx rename to web/src/components/jsonjoy-builder/components/schema-editor/types/string-editor.tsx index 62b8cee57..de06fdced 100644 --- a/web/src/components/jsonjoy-builder/components/SchemaEditor/types/StringEditor.tsx +++ b/web/src/components/jsonjoy-builder/components/schema-editor/types/string-editor.tsx @@ -11,9 +11,9 @@ import { X } from 'lucide-react'; import { useId, useMemo, useState } from 'react'; import { useTranslation } from '../../../hooks/use-translation'; import { cn } from '../../../lib/utils'; -import type { ObjectJSONSchema } from '../../../types/jsonSchema'; -import { isBooleanSchema, withObjectSchema } from '../../../types/jsonSchema'; -import type { TypeEditorProps } from '../TypeEditor'; +import type { ObjectJSONSchema } from '../../../types/json-schema'; +import { isBooleanSchema, withObjectSchema } from '../../../types/json-schema'; +import type { TypeEditorProps } from '../type-editor'; type Property = 'enum' | 'minLength' | 'maxLength' | 'pattern' | 'format'; diff --git a/web/src/components/jsonjoy-builder/components/ui/badge.tsx b/web/src/components/jsonjoy-builder/components/ui/badge.tsx deleted file mode 100644 index 36a7966d9..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/badge.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { cva, type VariantProps } from 'class-variance-authority'; - -import type { HTMLAttributes } from 'react'; -import { cn } from '../../lib/utils.ts'; - -const badgeVariants = cva( - 'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2', - { - variants: { - variant: { - default: - 'border-transparent bg-primary text-primary-foreground hover:bg-primary/80', - secondary: - 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80', - destructive: - 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80', - outline: 'text-foreground', - }, - }, - defaultVariants: { - variant: 'default', - }, - }, -); - -export interface BadgeProps - extends HTMLAttributes, - VariantProps {} - -function Badge({ className, variant, ...props }: BadgeProps) { - return ( -
- ); -} - -export { Badge, badgeVariants }; diff --git a/web/src/components/jsonjoy-builder/components/ui/button.tsx b/web/src/components/jsonjoy-builder/components/ui/button.tsx deleted file mode 100644 index 4b38f0557..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/button.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Slot } from '@radix-ui/react-slot'; -import { cva, type VariantProps } from 'class-variance-authority'; - -import { forwardRef, type ButtonHTMLAttributes } from 'react'; -import { cn } from '../../lib/utils.ts'; - -const buttonVariants = cva( - 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0', - { - variants: { - variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/90', - destructive: - 'bg-destructive text-destructive-foreground hover:bg-destructive/90', - outline: - 'border border-input bg-background hover:bg-accent hover:text-accent-foreground', - secondary: - 'bg-secondary text-secondary-foreground hover:bg-secondary/80', - ghost: 'hover:bg-accent hover:text-accent-foreground', - link: 'text-primary underline-offset-4 hover:underline', - }, - size: { - default: 'h-10 px-4 py-2', - sm: 'h-9 rounded-md px-3', - lg: 'h-11 rounded-md px-8', - icon: 'h-10 w-10', - }, - }, - defaultVariants: { - variant: 'default', - size: 'default', - }, - }, -); - -export interface ButtonProps - extends ButtonHTMLAttributes, - VariantProps { - asChild?: boolean; -} - -const Button = forwardRef( - ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : 'button'; - return ( - - ); - }, -); -Button.displayName = 'Button'; - -export { Button, buttonVariants }; diff --git a/web/src/components/jsonjoy-builder/components/ui/dialog.tsx b/web/src/components/jsonjoy-builder/components/ui/dialog.tsx deleted file mode 100644 index d2afb9c61..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/dialog.tsx +++ /dev/null @@ -1,136 +0,0 @@ -import * as DialogPrimitive from '@radix-ui/react-dialog'; -import { X } from 'lucide-react'; - -import { - forwardRef, - useId, - type ComponentPropsWithoutRef, - type ComponentRef, - type HTMLAttributes, -} from 'react'; -import { cn } from '../../lib/utils.ts'; - -const Dialog = DialogPrimitive.Root; - -const DialogTrigger = DialogPrimitive.Trigger; - -const DialogPortal = DialogPrimitive.Portal; - -const DialogClose = DialogPrimitive.Close; - -const DialogOverlay = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; - -const DialogContent = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => { - const dialogDescriptionId = useId(); - return ( - - - - {children} - - Dialog content - - - - Close - - - - ); -}); -DialogContent.displayName = DialogPrimitive.Content.displayName; - -const DialogHeader = ({ - className, - ...props -}: HTMLAttributes) => ( -
-); -DialogHeader.displayName = 'DialogHeader'; - -const DialogFooter = ({ - className, - ...props -}: HTMLAttributes) => ( -
-); -DialogFooter.displayName = 'DialogFooter'; - -const DialogTitle = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DialogTitle.displayName = DialogPrimitive.Title.displayName; - -const DialogDescription = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -DialogDescription.displayName = DialogPrimitive.Description.displayName; - -export { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogOverlay, - DialogPortal, - DialogTitle, - DialogTrigger, -}; diff --git a/web/src/components/jsonjoy-builder/components/ui/input.tsx b/web/src/components/jsonjoy-builder/components/ui/input.tsx deleted file mode 100644 index 41fc3c91d..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/input.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { forwardRef, type ComponentProps } from 'react'; -import { cn } from '../../lib/utils.ts'; - -const Input = forwardRef>( - ({ className, type, ...props }, ref) => { - return ( - - ); - }, -); -Input.displayName = 'Input'; - -export { Input }; diff --git a/web/src/components/jsonjoy-builder/components/ui/label.tsx b/web/src/components/jsonjoy-builder/components/ui/label.tsx deleted file mode 100644 index d610bd976..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/label.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as LabelPrimitive from '@radix-ui/react-label'; -import { cva, type VariantProps } from 'class-variance-authority'; - -import { - forwardRef, - type ComponentPropsWithoutRef, - type ComponentRef, -} from 'react'; -import { cn } from '../../lib/utils.ts'; - -const labelVariants = cva( - 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70', -); - -const Label = forwardRef< - ComponentRef, - ComponentPropsWithoutRef & - VariantProps ->(({ className, ...props }, ref) => ( - -)); -Label.displayName = LabelPrimitive.Root.displayName; - -export { Label }; diff --git a/web/src/components/jsonjoy-builder/components/ui/select.tsx b/web/src/components/jsonjoy-builder/components/ui/select.tsx deleted file mode 100644 index da0ba5a20..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/select.tsx +++ /dev/null @@ -1,163 +0,0 @@ -import * as SelectPrimitive from '@radix-ui/react-select'; -import { Check, ChevronDown, ChevronUp } from 'lucide-react'; - -import { - forwardRef, - type ComponentPropsWithoutRef, - type ComponentRef, -} from 'react'; -import { cn } from '../../lib/utils.ts'; - -const Select = SelectPrimitive.Root; - -const SelectGroup = SelectPrimitive.Group; - -const SelectValue = SelectPrimitive.Value; - -const SelectTrigger = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - span]:line-clamp-1', - className, - )} - {...props} - > - {children} - - - - -)); -SelectTrigger.displayName = SelectPrimitive.Trigger.displayName; - -const SelectScrollUpButton = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - -)); -SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName; - -const SelectScrollDownButton = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - -)); -SelectScrollDownButton.displayName = - SelectPrimitive.ScrollDownButton.displayName; - -const SelectContent = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, children, position = 'popper', ...props }, ref) => ( - - - - - {children} - - - - -)); -SelectContent.displayName = SelectPrimitive.Content.displayName; - -const SelectLabel = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -SelectLabel.displayName = SelectPrimitive.Label.displayName; - -const SelectItem = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - - - - - {children} - -)); -SelectItem.displayName = SelectPrimitive.Item.displayName; - -const SelectSeparator = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -SelectSeparator.displayName = SelectPrimitive.Separator.displayName; - -export { - Select, - SelectContent, - SelectGroup, - SelectItem, - SelectLabel, - SelectScrollDownButton, - SelectScrollUpButton, - SelectSeparator, - SelectTrigger, - SelectValue, -}; diff --git a/web/src/components/jsonjoy-builder/components/ui/switch.tsx b/web/src/components/jsonjoy-builder/components/ui/switch.tsx deleted file mode 100644 index 1e21a8d4a..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/switch.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import * as SwitchPrimitives from '@radix-ui/react-switch'; - -import { - forwardRef, - type ComponentPropsWithoutRef, - type ComponentRef, -} from 'react'; -import { cn } from '../../lib/utils.ts'; - -const Switch = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - -)); -Switch.displayName = SwitchPrimitives.Root.displayName; - -export { Switch }; diff --git a/web/src/components/jsonjoy-builder/components/ui/tabs.tsx b/web/src/components/jsonjoy-builder/components/ui/tabs.tsx deleted file mode 100644 index 217df3ab8..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/tabs.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import * as TabsPrimitive from '@radix-ui/react-tabs'; - -import { - forwardRef, - type ComponentPropsWithoutRef, - type ComponentRef, -} from 'react'; -import { cn } from '../../lib/utils.ts'; - -const Tabs = TabsPrimitive.Root; - -const TabsList = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -TabsList.displayName = TabsPrimitive.List.displayName; - -const TabsTrigger = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -TabsTrigger.displayName = TabsPrimitive.Trigger.displayName; - -const TabsContent = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -TabsContent.displayName = TabsPrimitive.Content.displayName; - -export { Tabs, TabsContent, TabsList, TabsTrigger }; diff --git a/web/src/components/jsonjoy-builder/components/ui/tooltip.tsx b/web/src/components/jsonjoy-builder/components/ui/tooltip.tsx deleted file mode 100644 index 6db6fab15..000000000 --- a/web/src/components/jsonjoy-builder/components/ui/tooltip.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import * as TooltipPrimitive from '@radix-ui/react-tooltip'; - -import { - forwardRef, - type ComponentPropsWithoutRef, - type ComponentRef, -} from 'react'; -import { cn } from '../../lib/utils.ts'; - -const TooltipProvider = TooltipPrimitive.Provider; - -const Tooltip = TooltipPrimitive.Root; - -const TooltipTrigger = TooltipPrimitive.Trigger; - -const TooltipContent = forwardRef< - ComponentRef, - ComponentPropsWithoutRef ->(({ className, sideOffset = 4, ...props }, ref) => ( - -)); -TooltipContent.displayName = TooltipPrimitive.Content.displayName; - -export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }; diff --git a/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.ts b/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.ts index c9ee4fe5f..3b805e939 100644 --- a/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.ts +++ b/web/src/components/jsonjoy-builder/hooks/use-monaco-theme.ts @@ -1,6 +1,6 @@ import type * as Monaco from 'monaco-editor'; import { useEffect, useState } from 'react'; -import type { JSONSchema } from '../types/jsonSchema.ts'; +import type { JSONSchema } from '../types/json-schema.js'; export interface MonacoEditorOptions { minimap?: { enabled: boolean }; diff --git a/web/src/components/jsonjoy-builder/index.ts b/web/src/components/jsonjoy-builder/index.ts index 22d7464a3..83ee3a804 100644 --- a/web/src/components/jsonjoy-builder/index.ts +++ b/web/src/components/jsonjoy-builder/index.ts @@ -3,21 +3,21 @@ import JsonSchemaEditor, { type JsonSchemaEditorProps, -} from './components/SchemaEditor/JsonSchemaEditor'; +} from './components/schema-editor/json-schema-editor'; import JsonSchemaVisualizer, { type JsonSchemaVisualizerProps, -} from './components/SchemaEditor/JsonSchemaVisualizer'; +} from './components/schema-editor/json-schema-visualizer'; import SchemaVisualEditor, { type SchemaVisualEditorProps, -} from './components/SchemaEditor/SchemaVisualEditor'; +} from './components/schema-editor/schema-visual-editor'; export * from './i18n/locales/de'; export * from './i18n/locales/en'; export * from './i18n/translation-context'; export * from './i18n/translation-keys'; -export * from './components/features/JsonValidator'; -export * from './components/features/SchemaInferencer'; +export * from './components/features/json-validator'; +export * from './components/features/schema-inferencer'; export { JsonSchemaEditor, @@ -28,4 +28,4 @@ export { type SchemaVisualEditorProps, }; -export type { JSONSchema, baseSchema } from './types/jsonSchema.ts'; +export type { JSONSchema, baseSchema } from './types/json-schema'; diff --git a/web/src/components/jsonjoy-builder/lib/schemaEditor.ts b/web/src/components/jsonjoy-builder/lib/schema-editor.ts similarity index 97% rename from web/src/components/jsonjoy-builder/lib/schemaEditor.ts rename to web/src/components/jsonjoy-builder/lib/schema-editor.ts index d9c637805..b2fd5d6e2 100644 --- a/web/src/components/jsonjoy-builder/lib/schemaEditor.ts +++ b/web/src/components/jsonjoy-builder/lib/schema-editor.ts @@ -2,8 +2,8 @@ import type { JSONSchema, NewField, ObjectJSONSchema, -} from '../types/jsonSchema.ts'; -import { isBooleanSchema, isObjectSchema } from '../types/jsonSchema.ts'; +} from '../types/json-schema'; +import { isBooleanSchema, isObjectSchema } from '../types/json-schema'; export type Property = { name: string; diff --git a/web/src/components/jsonjoy-builder/lib/schema-inference.ts b/web/src/components/jsonjoy-builder/lib/schema-inference.ts index d8c97e64b..cde22907e 100644 --- a/web/src/components/jsonjoy-builder/lib/schema-inference.ts +++ b/web/src/components/jsonjoy-builder/lib/schema-inference.ts @@ -1,4 +1,4 @@ -import { asObjectSchema, type JSONSchema } from '../types/jsonSchema.ts'; +import { asObjectSchema, type JSONSchema } from '../types/json-schema'; /** * Merges two JSON schemas. diff --git a/web/src/components/jsonjoy-builder/lib/utils.ts b/web/src/components/jsonjoy-builder/lib/utils.ts index 167761bca..a35868e3a 100644 --- a/web/src/components/jsonjoy-builder/lib/utils.ts +++ b/web/src/components/jsonjoy-builder/lib/utils.ts @@ -1,7 +1,7 @@ import { clsx, type ClassValue } from 'clsx'; import { twMerge } from 'tailwind-merge'; import type { Translation } from '../i18n/translation-keys.ts'; -import type { SchemaType } from '../types/jsonSchema.ts'; +import type { SchemaType } from '../types/json-schema'; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); diff --git a/web/src/components/jsonjoy-builder/types/jsonSchema.ts b/web/src/components/jsonjoy-builder/types/json-schema.ts similarity index 100% rename from web/src/components/jsonjoy-builder/types/jsonSchema.ts rename to web/src/components/jsonjoy-builder/types/json-schema.ts diff --git a/web/src/components/jsonjoy-builder/types/validation.ts b/web/src/components/jsonjoy-builder/types/validation.ts index dc89a7df0..76cefd8ea 100644 --- a/web/src/components/jsonjoy-builder/types/validation.ts +++ b/web/src/components/jsonjoy-builder/types/validation.ts @@ -1,6 +1,6 @@ import z from 'zod'; -import type { Translation } from '../i18n/translation-keys.ts'; -import { baseSchema, type JSONSchema } from './jsonSchema'; +import type { Translation } from '../i18n/translation-keys'; +import { baseSchema, type JSONSchema } from './json-schema'; function refineRangeConsistency( min: number | undefined, diff --git a/web/src/components/jsonjoy-builder/utils/jsonValidator.ts b/web/src/components/jsonjoy-builder/utils/json-validator.ts similarity index 99% rename from web/src/components/jsonjoy-builder/utils/jsonValidator.ts rename to web/src/components/jsonjoy-builder/utils/json-validator.ts index 3554e7cc8..9ddba0da1 100644 --- a/web/src/components/jsonjoy-builder/utils/jsonValidator.ts +++ b/web/src/components/jsonjoy-builder/utils/json-validator.ts @@ -1,6 +1,6 @@ import Ajv from 'ajv'; import addFormats from 'ajv-formats'; -import type { JSONSchema } from '../types/jsonSchema.ts'; +import type { JSONSchema } from '../types/json-schema.js'; // Initialize Ajv with all supported formats and meta-schemas const ajv = new Ajv({