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)
This commit is contained in:
balibabu
2025-10-31 13:42:11 +08:00
committed by GitHub
parent 09dd786674
commit c8a82da722
34 changed files with 72 additions and 629 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -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;

View File

@ -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<TypeEditorProps> = ({
schema,

View File

@ -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<TypeEditorProps> = ({ schema, onChange }) => {
const t = useTranslation();

View File

@ -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;

View File

@ -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<TypeEditorProps> = ({
schema,

View File

@ -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';

View File

@ -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<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
);
}
export { Badge, badgeVariants };

View File

@ -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<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : 'button';
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
);
},
);
Button.displayName = 'Button';
export { Button, buttonVariants };

View File

@ -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<typeof DialogPrimitive.Overlay>,
ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 jsonjoy',
className,
)}
{...props}
/>
));
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const DialogContent = forwardRef<
ComponentRef<typeof DialogPrimitive.Content>,
ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => {
const dialogDescriptionId = useId();
return (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
className,
)}
aria-describedby={dialogDescriptionId}
{...props}
>
{children}
<DialogPrimitive.Description
id={dialogDescriptionId}
className="sr-only"
>
Dialog content
</DialogPrimitive.Description>
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
);
});
DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({
className,
...props
}: HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
'flex flex-col space-y-1.5 text-center sm:text-left',
className,
)}
{...props}
/>
);
DialogHeader.displayName = 'DialogHeader';
const DialogFooter = ({
className,
...props
}: HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
className,
)}
{...props}
/>
);
DialogFooter.displayName = 'DialogFooter';
const DialogTitle = forwardRef<
ComponentRef<typeof DialogPrimitive.Title>,
ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
'text-lg font-semibold leading-none tracking-tight',
className,
)}
{...props}
/>
));
DialogTitle.displayName = DialogPrimitive.Title.displayName;
const DialogDescription = forwardRef<
ComponentRef<typeof DialogPrimitive.Description>,
ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
));
DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
};

View File

@ -1,21 +0,0 @@
import { forwardRef, type ComponentProps } from 'react';
import { cn } from '../../lib/utils.ts';
const Input = forwardRef<HTMLInputElement, ComponentProps<'input'>>(
({ className, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(
'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
className,
)}
ref={ref}
{...props}
/>
);
},
);
Input.displayName = 'Input';
export { Input };

View File

@ -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<typeof LabelPrimitive.Root>,
ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
<LabelPrimitive.Root
ref={ref}
className={cn(labelVariants(), className)}
{...props}
/>
));
Label.displayName = LabelPrimitive.Root.displayName;
export { Label };

View File

@ -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<typeof SelectPrimitive.Trigger>,
ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Trigger
ref={ref}
className={cn(
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
className,
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDown className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
));
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
const SelectScrollUpButton = forwardRef<
ComponentRef<typeof SelectPrimitive.ScrollUpButton>,
ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollUpButton
ref={ref}
className={cn(
'flex cursor-default items-center justify-center py-1',
className,
)}
{...props}
>
<ChevronUp className="h-4 w-4" />
</SelectPrimitive.ScrollUpButton>
));
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
const SelectScrollDownButton = forwardRef<
ComponentRef<typeof SelectPrimitive.ScrollDownButton>,
ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollDownButton
ref={ref}
className={cn(
'flex cursor-default items-center justify-center py-1',
className,
)}
{...props}
>
<ChevronDown className="h-4 w-4" />
</SelectPrimitive.ScrollDownButton>
));
SelectScrollDownButton.displayName =
SelectPrimitive.ScrollDownButton.displayName;
const SelectContent = forwardRef<
ComponentRef<typeof SelectPrimitive.Content>,
ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
>(({ className, children, position = 'popper', ...props }, ref) => (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
ref={ref}
className={cn(
'relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
position === 'popper' &&
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
className,
'jsonjoy',
)}
position={position}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
'p-1',
position === 'popper' &&
'h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)',
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
));
SelectContent.displayName = SelectPrimitive.Content.displayName;
const SelectLabel = forwardRef<
ComponentRef<typeof SelectPrimitive.Label>,
ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Label
ref={ref}
className={cn('py-1.5 pl-8 pr-2 text-sm font-semibold', className)}
{...props}
/>
));
SelectLabel.displayName = SelectPrimitive.Label.displayName;
const SelectItem = forwardRef<
ComponentRef<typeof SelectPrimitive.Item>,
ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Item
ref={ref}
className={cn(
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50',
className,
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
));
SelectItem.displayName = SelectPrimitive.Item.displayName;
const SelectSeparator = forwardRef<
ComponentRef<typeof SelectPrimitive.Separator>,
ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Separator
ref={ref}
className={cn('-mx-1 my-1 h-px bg-muted', className)}
{...props}
/>
));
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
export {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectScrollDownButton,
SelectScrollUpButton,
SelectSeparator,
SelectTrigger,
SelectValue,
};

View File

@ -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<typeof SwitchPrimitives.Root>,
ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
>(({ className, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
className,
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',
)}
/>
</SwitchPrimitives.Root>
));
Switch.displayName = SwitchPrimitives.Root.displayName;
export { Switch };

View File

@ -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<typeof TabsPrimitive.List>,
ComponentPropsWithoutRef<typeof TabsPrimitive.List>
>(({ className, ...props }, ref) => (
<TabsPrimitive.List
ref={ref}
className={cn(
'inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground',
className,
)}
{...props}
/>
));
TabsList.displayName = TabsPrimitive.List.displayName;
const TabsTrigger = forwardRef<
ComponentRef<typeof TabsPrimitive.Trigger>,
ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Trigger
ref={ref}
className={cn(
'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs',
className,
)}
{...props}
/>
));
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
const TabsContent = forwardRef<
ComponentRef<typeof TabsPrimitive.Content>,
ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
>(({ className, ...props }, ref) => (
<TabsPrimitive.Content
ref={ref}
className={cn(
'mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
className,
)}
{...props}
/>
));
TabsContent.displayName = TabsPrimitive.Content.displayName;
export { Tabs, TabsContent, TabsList, TabsTrigger };

View File

@ -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<typeof TooltipPrimitive.Content>,
ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className,
)}
{...props}
/>
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };

View File

@ -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 };

View File

@ -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';

View File

@ -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;

View File

@ -1,4 +1,4 @@
import { asObjectSchema, type JSONSchema } from '../types/jsonSchema.ts';
import { asObjectSchema, type JSONSchema } from '../types/json-schema';
/**
* Merges two JSON schemas.

View File

@ -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));

View File

@ -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,

View File

@ -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({