@treenity/react 3.0.6 → 3.0.8
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.
- package/dist/AclEditor.js +3 -3
- package/dist/ActionCards.js +5 -5
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +16 -6
- package/dist/App.js.map +1 -1
- package/dist/CLAUDE.md +16 -0
- package/dist/ComponentSection.js +4 -4
- package/dist/ComponentSection.js.map +1 -1
- package/dist/ErrorBoundary.js +1 -1
- package/dist/Inspector.js +9 -9
- package/dist/Inspector.js.map +1 -1
- package/dist/Login.js +4 -4
- package/dist/NodeEditor.d.ts.map +1 -1
- package/dist/NodeEditor.js +10 -9
- package/dist/NodeEditor.js.map +1 -1
- package/dist/Tree.js +3 -3
- package/dist/ViewPage.js +1 -1
- package/dist/bind/engine.js +2 -2
- package/dist/bind/hook.js +2 -2
- package/dist/components/ConfirmDialog.js +1 -1
- package/dist/components/ConfirmPopover.js +2 -2
- package/dist/components/PathBreadcrumb.js +1 -1
- package/dist/components/lib/utils.ts.bak +6 -0
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +2 -2
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/dialog.js +2 -2
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/form-field.js +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/pagination.js +2 -2
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/resizable.js +1 -1
- package/dist/components/ui/scroll-area.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/toggle-group.js +2 -2
- package/dist/components/ui/toggle.js +1 -1
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/context/index.js +2 -2
- package/dist/load-client.d.ts +1 -0
- package/dist/load-client.d.ts.map +1 -1
- package/dist/load-client.js +1 -0
- package/dist/load-client.js.map +1 -1
- package/dist/mod-errors.d.ts +5 -0
- package/dist/mod-errors.d.ts.map +1 -0
- package/dist/mod-errors.js +12 -0
- package/dist/mod-errors.js.map +1 -0
- package/dist/mods/editor-ui/CLAUDE.md +3 -0
- package/dist/mods/editor-ui/DraftTextarea.d.ts +8 -0
- package/dist/mods/editor-ui/DraftTextarea.d.ts.map +1 -0
- package/dist/mods/editor-ui/DraftTextarea.js +23 -0
- package/dist/mods/editor-ui/DraftTextarea.js.map +1 -0
- package/dist/mods/editor-ui/FieldLabel.js +2 -2
- package/dist/mods/editor-ui/default-edit.js +3 -3
- package/dist/mods/editor-ui/default-view.js +4 -4
- package/dist/mods/editor-ui/dir-view.js +2 -2
- package/dist/mods/editor-ui/empty-placeholder.js +2 -2
- package/dist/mods/editor-ui/form-field.js +5 -5
- package/dist/mods/editor-ui/form-field.js.map +1 -1
- package/dist/mods/editor-ui/form-fields.d.ts.map +1 -1
- package/dist/mods/editor-ui/form-fields.js +17 -16
- package/dist/mods/editor-ui/form-fields.js.map +1 -1
- package/dist/mods/editor-ui/layout-view.js +2 -2
- package/dist/mods/editor-ui/list-items.js +1 -1
- package/dist/mods/editor-ui/node-utils.js +1 -1
- package/dist/mods/editor-ui/node-utils.js.map +1 -1
- package/dist/mods/editor-ui/type-picker.js +5 -5
- package/dist/mods/treenity/CLAUDE.md +7 -0
- package/dist/mods/treenity/groups/index.js +3 -3
- package/dist/mods/treenity/preview.js +2 -2
- package/dist/mods/treenity/ref-view.js +3 -3
- package/package.json +4 -4
- package/src/App.tsx +10 -0
- package/src/ComponentSection.tsx +1 -1
- package/src/Inspector.tsx +2 -2
- package/src/NodeEditor.tsx +3 -2
- package/src/load-client.ts +2 -0
- package/src/mod-errors.ts +14 -0
- package/src/mods/editor-ui/DraftTextarea.tsx +42 -0
- package/src/mods/editor-ui/form-field.tsx +4 -4
- package/src/mods/editor-ui/form-fields.tsx +11 -10
- package/src/mods/editor-ui/node-utils.ts +1 -1
- package/vite-plugin-treenity.ts +21 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
3
|
-
import { Button } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
4
|
import { XIcon } from 'lucide-react';
|
|
5
5
|
import { Dialog as DialogPrimitive } from 'radix-ui';
|
|
6
6
|
function Dialog({ ...props }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import { Drawer as DrawerPrimitive } from 'vaul';
|
|
4
4
|
function Drawer({ ...props }) {
|
|
5
5
|
return _jsx(DrawerPrimitive.Root, { "data-slot": "drawer", ...props });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
|
|
5
5
|
import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui';
|
|
6
6
|
function DropdownMenu({ ...props }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// Adaptive form field — label left when content is short, label on top when tall
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { useLayoutEffect, useRef, useState } from 'react';
|
|
5
5
|
const STACK_THRESHOLD = 48; // px — above this, label goes on top
|
|
6
6
|
export function FormField({ label, labelClass, className, children }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
const Input = forwardRef(({ className, type, ...props }, ref) => (_jsx("input", { type: type, className: cn('flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', className), ref: ref, ...props })));
|
|
5
5
|
Input.displayName = 'Input';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import { Label as LabelPrimitive } from 'radix-ui';
|
|
4
4
|
function Label({ className, ...props }) {
|
|
5
5
|
return (_jsx(LabelPrimitive.Root, { "data-slot": "label", className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className), ...props }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
3
|
-
import { buttonVariants } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
|
+
import { buttonVariants } from './button.js';
|
|
4
4
|
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react';
|
|
5
5
|
function Pagination({ className, ...props }) {
|
|
6
6
|
return (_jsx("nav", { role: "navigation", "aria-label": "pagination", "data-slot": "pagination", className: cn("mx-auto flex w-full justify-center", className), ...props }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import { Popover as PopoverPrimitive } from 'radix-ui';
|
|
4
4
|
function Popover({ ...props }) {
|
|
5
5
|
return _jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { Progress as ProgressPrimitive } from 'radix-ui';
|
|
5
5
|
function Progress({ className, value, ...props }) {
|
|
6
6
|
return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className), ...props, children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", className: "bg-primary h-full w-full flex-1 transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
4
4
|
function ResizablePanelGroup({ className, ...props }) {
|
|
5
5
|
return (_jsx(ResizablePrimitive.Group, { "data-slot": "resizable-panel-group", className: cn("flex h-full w-full data-[panel-group-direction=vertical]:flex-col", className), ...props }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import { ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
|
|
4
4
|
function ScrollArea({ className, children, ...props }) {
|
|
5
5
|
return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn("relative", className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { "data-slot": "scroll-area-viewport", className: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1", children: children }), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
|
|
5
5
|
import { Select as SelectPrimitive } from 'radix-ui';
|
|
6
6
|
function Select({ ...props }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { Separator as SeparatorPrimitive } from 'radix-ui';
|
|
5
5
|
function Separator({ className, orientation = "horizontal", decorative = true, ...props }) {
|
|
6
6
|
return (_jsx(SeparatorPrimitive.Root, { "data-slot": "separator", decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className), ...props }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import { XIcon } from 'lucide-react';
|
|
4
4
|
import { Dialog as SheetPrimitive } from 'radix-ui';
|
|
5
5
|
function Sheet({ ...props }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
function Skeleton({ className, ...props }) {
|
|
4
4
|
return (_jsx("div", { "data-slot": "skeleton", className: cn("animate-pulse rounded-md bg-accent", className), ...props }));
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
function Slider({ className, defaultValue, value, min = 0, max = 100, ...props }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { Switch as SwitchPrimitive } from 'radix-ui';
|
|
5
5
|
function Switch({ className, size = "default", ...props }) {
|
|
6
6
|
return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", "data-size": size, className: cn("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0") }) }));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
function Table({ className, ...props }) {
|
|
5
5
|
return (_jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) }));
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
4
|
import { Tabs as TabsPrimitive } from 'radix-ui';
|
|
5
5
|
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from '../lib/utils.js';
|
|
3
3
|
function Textarea({ className, ...props }) {
|
|
4
4
|
return (_jsx("textarea", { "data-slot": "textarea", className: cn("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 max-h-64 overflow-y-auto w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", className), ...props }));
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
4
|
-
import { toggleVariants } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
import { toggleVariants } from './toggle.js';
|
|
5
5
|
import { ToggleGroup as ToggleGroupPrimitive } from 'radix-ui';
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
const ToggleGroupContext = React.createContext({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import { Toggle as TogglePrimitive } from 'radix-ui';
|
|
6
6
|
const toggleVariants = cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
4
|
import { Tooltip as TooltipPrimitive } from 'radix-ui';
|
|
5
5
|
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
6
6
|
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props }));
|
package/dist/context/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
// Treenity React Binding — Layer 2
|
|
3
3
|
// <Render> + <RenderContext> + <NodeProvider>
|
|
4
4
|
// Depends on: core (resolve), React
|
|
5
|
-
import { execute } from '
|
|
6
|
-
import { $key, $node } from '
|
|
5
|
+
import { execute } from '../hooks.js';
|
|
6
|
+
import { $key, $node } from '../symbols.js';
|
|
7
7
|
import { hasMissResolver, resolve, resolveExact, subscribeRegistry, } from '@treenity/core';
|
|
8
8
|
import { createContext, createElement, useContext, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
// ── Tree context (rendering context string) ──
|
package/dist/load-client.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-client.d.ts","sourceRoot":"","sources":["../src/load-client.ts"],"names":[],"mappings":"AAIA,OAAO,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"load-client.d.ts","sourceRoot":"","sources":["../src/load-client.ts"],"names":[],"mappings":"AAIA,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/load-client.js
CHANGED
package/dist/load-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-client.js","sourceRoot":"","sources":["../src/load-client.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,yDAAyD;AACzD,6EAA6E;AAC7E,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,OAAO,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"load-client.js","sourceRoot":"","sources":["../src/load-client.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,yDAAyD;AACzD,6EAA6E;AAC7E,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Dynamic import wrapper — catches failures and records them */
|
|
2
|
+
export declare function loadMod(name: string, load: () => Promise<unknown>): Promise<unknown>;
|
|
3
|
+
/** Mods that failed to load: name → error message */
|
|
4
|
+
export declare function getModErrors(): Map<string, string>;
|
|
5
|
+
//# sourceMappingURL=mod-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-errors.d.ts","sourceRoot":"","sources":["../src/mod-errors.ts"],"names":[],"mappings":"AAIA,iEAAiE;AACjE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAKpF;AAED,qDAAqD;AACrD,wBAAgB,YAAY,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAmB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Mod load error tracking — shared between barrel, vite plugin virtual module, and App UI
|
|
2
|
+
const errors = (globalThis.__treenityModErrors ??= new Map());
|
|
3
|
+
/** Dynamic import wrapper — catches failures and records them */
|
|
4
|
+
export function loadMod(name, load) {
|
|
5
|
+
return load().catch((e) => {
|
|
6
|
+
errors.set(name, e.message);
|
|
7
|
+
console.warn(`[treenity] mod ${name} skipped:`, e.message);
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
/** Mods that failed to load: name → error message */
|
|
11
|
+
export function getModErrors() { return errors; }
|
|
12
|
+
//# sourceMappingURL=mod-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod-errors.js","sourceRoot":"","sources":["../src/mod-errors.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,MAAM,MAAM,GAAwB,CAAE,UAAsC,CAAC,mBAAmB,KAAK,IAAI,GAAG,EAAE,CAAwB,CAAC;AAEvI,iEAAiE;AACjE,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,IAA4B;IAChE,OAAO,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;QAC/B,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,kBAAkB,IAAI,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,YAAY,KAA0B,OAAO,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Textarea } from '#components/ui/textarea';
|
|
2
|
+
type Props = Omit<React.ComponentProps<typeof Textarea>, 'value' | 'defaultValue' | 'onChange'> & {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (text: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const DraftTextarea: import("react").ForwardRefExoticComponent<Omit<Props, "ref"> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=DraftTextarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraftTextarea.d.ts","sourceRoot":"","sources":["../../../src/mods/editor-ui/DraftTextarea.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC,GAAG;IAChG,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,eAAO,MAAM,aAAa,oHA8BzB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Uncontrolled textarea that preserves cursor position during external re-renders.
|
|
3
|
+
// Uses ref + defaultValue so React never touches the DOM value while user is editing.
|
|
4
|
+
import { Textarea } from '../../components/ui/textarea.js';
|
|
5
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
6
|
+
export const DraftTextarea = forwardRef(({ value, onChange, ...props }, fwd) => {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
const editing = useRef(false);
|
|
9
|
+
useImperativeHandle(fwd, () => ref.current);
|
|
10
|
+
// Sync external value into DOM only when not focused
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!editing.current && ref.current && ref.current.value !== value) {
|
|
13
|
+
ref.current.value = value;
|
|
14
|
+
}
|
|
15
|
+
}, [value]);
|
|
16
|
+
return (_jsx(Textarea, { ref: ref, defaultValue: value, onFocus: () => { editing.current = true; }, onBlur: () => {
|
|
17
|
+
editing.current = false;
|
|
18
|
+
if (ref.current && ref.current.value !== value) {
|
|
19
|
+
ref.current.value = value;
|
|
20
|
+
}
|
|
21
|
+
}, onChange: (e) => onChange(e.target.value), ...props }));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=DraftTextarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraftTextarea.js","sourceRoot":"","sources":["../../../src/mods/editor-ui/DraftTextarea.tsx"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,sFAAsF;AAEtF,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAO3E,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CACrC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACrC,MAAM,GAAG,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9B,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,OAAQ,CAAC,CAAC;IAE7C,qDAAqD;IACrD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YACnE,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;QAC5B,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,KAAC,QAAQ,IACP,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,KAAK,EACnB,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,EAC1C,MAAM,EAAE,GAAG,EAAE;YACX,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;YACxB,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;gBAC/C,GAAG,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;YAC5B,CAAC;QACH,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KACrC,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// FieldLabel — interactive label for Inspector fields
|
|
3
3
|
// Click → dropdown menu (value/$ref/$map + copy/clear), drop target for tree nodes
|
|
4
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '
|
|
5
|
-
import { Input } from '
|
|
4
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '../../components/ui/dropdown-menu.js';
|
|
5
|
+
import { Input } from '../../components/ui/input.js';
|
|
6
6
|
import { isRef } from '@treenity/core';
|
|
7
7
|
import { useState } from 'react';
|
|
8
8
|
function getFieldMode(v) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Checkbox } from '
|
|
3
|
-
import { Input } from '
|
|
4
|
-
import { useSchema } from '
|
|
2
|
+
import { Checkbox } from '../../components/ui/checkbox.js';
|
|
3
|
+
import { Input } from '../../components/ui/input.js';
|
|
4
|
+
import { useSchema } from '../../schema-loader.js';
|
|
5
5
|
import { isRef, register, resolve } from '@treenity/core';
|
|
6
6
|
import { createElement } from 'react';
|
|
7
7
|
import { FieldLabel, RefEditor } from './FieldLabel';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import './editor-ui.css';
|
|
3
|
-
import { Button } from '
|
|
4
|
-
import { Render, RenderContext } from '
|
|
5
|
-
import { useChildren } from '
|
|
6
|
-
import { trpc } from '
|
|
3
|
+
import { Button } from '../../components/ui/button.js';
|
|
4
|
+
import { Render, RenderContext } from '../../context.js';
|
|
5
|
+
import { useChildren } from '../../hooks.js';
|
|
6
|
+
import { trpc } from '../../trpc.js';
|
|
7
7
|
import { register } from '@treenity/core';
|
|
8
8
|
import { useCallback, useState } from 'react';
|
|
9
9
|
import { EmptyNodePlaceholder } from './empty-placeholder';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Render, RenderContext } from '
|
|
3
|
-
import { useChildren } from '
|
|
2
|
+
import { Render, RenderContext } from '../../context.js';
|
|
3
|
+
import { useChildren } from '../../hooks.js';
|
|
4
4
|
const STATUS_COLORS = {
|
|
5
5
|
draft: ['var(--accent-subtle, #1a2a3a)', 'var(--accent)'],
|
|
6
6
|
published: ['#1a2e1a', '#4c8'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from '
|
|
3
|
-
import { set } from '
|
|
2
|
+
import { Button } from '../../components/ui/button.js';
|
|
3
|
+
import { set } from '../../hooks.js';
|
|
4
4
|
import { Plus } from 'lucide-react';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { TypePicker } from './type-picker';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from '
|
|
3
|
-
import { Input } from '
|
|
4
|
-
import {
|
|
2
|
+
import { Button } from '../../components/ui/button.js';
|
|
3
|
+
import { Input } from '../../components/ui/input.js';
|
|
4
|
+
import { DraftTextarea } from './DraftTextarea.js';
|
|
5
5
|
import { isRef, resolveExact } from '@treenity/core';
|
|
6
6
|
import { createElement, useState } from 'react';
|
|
7
7
|
import { FieldLabel, RefEditor } from './FieldLabel';
|
|
@@ -46,9 +46,9 @@ export function StringArrayField({ value, onChange, }) {
|
|
|
46
46
|
const [input, setInput] = useState('');
|
|
47
47
|
const isStrings = value.every((v) => typeof v === 'string');
|
|
48
48
|
if (!isStrings) {
|
|
49
|
-
return (_jsx(
|
|
49
|
+
return (_jsx(DraftTextarea, { className: "min-h-16 text-xs font-mono", value: JSON.stringify(value, null, 2), onChange: (text) => {
|
|
50
50
|
try {
|
|
51
|
-
onChange(JSON.parse(
|
|
51
|
+
onChange(JSON.parse(text));
|
|
52
52
|
}
|
|
53
53
|
catch {
|
|
54
54
|
/* typing */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../src/mods/editor-ui/form-field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../src/mods/editor-ui/form-field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,WAQC,EACD,IAA6B,EAC7B,OAAiF;IAEjF,IAAI,CAAC,WAAW,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEnC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,UAAU,GAAG,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;IAE/E,+EAA+E;IAC/E,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,aAAa,GAAG,WAAW,CAAC,QAAQ;YACxC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACtE,OAAO,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C;oBACnD,QAAQ,CAAC,EAAE,CAAC,CAAC;gBACf,CAAC,GACD,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-fields.d.ts","sourceRoot":"","sources":["../../../src/mods/editor-ui/form-fields.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-fields.d.ts","sourceRoot":"","sources":["../../../src/mods/editor-ui/form-fields.tsx"],"names":[],"mappings":"AA8fA,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,2CAsH1E;AAuPD,wBAAgB,kBAAkB,SAKjC"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
// react:form handlers — editable fields for inspector panel
|
|
3
|
-
import * as cache from '
|
|
4
|
-
import { tree as clientStore } from '
|
|
3
|
+
import * as cache from '../../cache.js';
|
|
4
|
+
import { tree as clientStore } from '../../client.js';
|
|
5
5
|
// react view handlers — readOnly display for same types
|
|
6
6
|
// Covers: string, text, textarea, number, integer, boolean, array, object, image, uri, url, select, timestamp, path
|
|
7
|
-
import { Button } from '
|
|
8
|
-
import { Input } from '
|
|
9
|
-
import { Popover, PopoverContent, PopoverTrigger } from '
|
|
10
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '
|
|
11
|
-
import { Switch } from '
|
|
12
|
-
import { Textarea } from '
|
|
13
|
-
import {
|
|
7
|
+
import { Button } from '../../components/ui/button.js';
|
|
8
|
+
import { Input } from '../../components/ui/input.js';
|
|
9
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../components/ui/popover.js';
|
|
10
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../components/ui/select.js';
|
|
11
|
+
import { Switch } from '../../components/ui/switch.js';
|
|
12
|
+
import { Textarea } from '../../components/ui/textarea.js';
|
|
13
|
+
import { DraftTextarea } from './DraftTextarea.js';
|
|
14
|
+
import { useSchema } from '../../schema-loader.js';
|
|
14
15
|
import { register, resolve as resolveHandler } from '@treenity/core';
|
|
15
16
|
import dayjs from 'dayjs';
|
|
16
17
|
import { X } from 'lucide-react';
|
|
@@ -107,10 +108,10 @@ function ObjectForm({ value, onChange }) {
|
|
|
107
108
|
setMode('json');
|
|
108
109
|
}, children: "JSON" })] }));
|
|
109
110
|
if (mode === 'json') {
|
|
110
|
-
return (_jsxs("div", { className: "rounded border border-border/50 bg-muted/30 p-2", children: [modeToggle, _jsx(
|
|
111
|
-
setJsonDraft(
|
|
111
|
+
return (_jsxs("div", { className: "rounded border border-border/50 bg-muted/30 p-2", children: [modeToggle, _jsx(DraftTextarea, { className: `text-[11px] min-h-[60px] ${jsonError ? 'border-destructive' : ''}`, value: jsonDraft, onChange: (text) => {
|
|
112
|
+
setJsonDraft(text);
|
|
112
113
|
try {
|
|
113
|
-
const parsed = JSON.parse(
|
|
114
|
+
const parsed = JSON.parse(text);
|
|
114
115
|
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
|
115
116
|
emit(parsed);
|
|
116
117
|
setJsonError(false);
|
|
@@ -124,9 +125,9 @@ function ObjectForm({ value, onChange }) {
|
|
|
124
125
|
}
|
|
125
126
|
} })] }));
|
|
126
127
|
}
|
|
127
|
-
return (_jsxs("div", { className: "rounded border border-border/50 bg-muted/30 p-2", children: [modeToggle, entries.length > 0 && (_jsx("div", { className: "space-y-1 mb-1.5", children: entries.map(([k, v]) => (_jsxs("div", { className: "flex gap-1.5 items-start group", children: [_jsx("span", { className: "text-[11px] font-mono text-muted-foreground pt-[5px] min-w-[50px] truncate shrink-0", children: k }), typeof v === 'boolean' ? (_jsx(Switch, { className: "mt-1", checked: v, onCheckedChange: (checked) => emit({ ...obj, [k]: checked }) })) : typeof v === 'number' ? (_jsx(Input, { type: "number", className: "h-7 text-[11px] flex-1 min-w-0", value: String(v), onChange: (e) => emit({ ...obj, [k]: Number(e.target.value) }) })) : typeof v === 'string' ? (_jsx(Input, { className: "h-7 text-[11px] flex-1 min-w-0", value: v, onChange: (e) => emit({ ...obj, [k]: e.target.value }) })) : (_jsx(
|
|
128
|
+
return (_jsxs("div", { className: "rounded border border-border/50 bg-muted/30 p-2", children: [modeToggle, entries.length > 0 && (_jsx("div", { className: "space-y-1 mb-1.5", children: entries.map(([k, v]) => (_jsxs("div", { className: "flex gap-1.5 items-start group", children: [_jsx("span", { className: "text-[11px] font-mono text-muted-foreground pt-[5px] min-w-[50px] truncate shrink-0", children: k }), typeof v === 'boolean' ? (_jsx(Switch, { className: "mt-1", checked: v, onCheckedChange: (checked) => emit({ ...obj, [k]: checked }) })) : typeof v === 'number' ? (_jsx(Input, { type: "number", className: "h-7 text-[11px] flex-1 min-w-0", value: String(v), onChange: (e) => emit({ ...obj, [k]: Number(e.target.value) }) })) : typeof v === 'string' ? (_jsx(Input, { className: "h-7 text-[11px] flex-1 min-w-0", value: v, onChange: (e) => emit({ ...obj, [k]: e.target.value }) })) : (_jsx(DraftTextarea, { className: "flex-1 min-w-0 text-[11px] font-mono min-h-[40px]", value: JSON.stringify(v, null, 2), onChange: (text) => {
|
|
128
129
|
try {
|
|
129
|
-
emit({ ...obj, [k]: JSON.parse(
|
|
130
|
+
emit({ ...obj, [k]: JSON.parse(text) });
|
|
130
131
|
}
|
|
131
132
|
catch {
|
|
132
133
|
/* typing */
|
|
@@ -172,9 +173,9 @@ function ArrayForm({ value, onChange }) {
|
|
|
172
173
|
return (_jsxs("div", { className: "rounded border border-border/50 bg-muted/30 p-2 space-y-1", children: [arr.map((item, i) => (_jsxs("div", { className: "flex gap-1 items-center group", children: [_jsx(Input, { type: "number", className: "h-7 text-[11px] flex-1", value: String(item ?? 0), onChange: (e) => emit(arr.map((v, j) => (j === i ? Number(e.target.value) : v))) }), _jsx(Button, { variant: "ghost", size: "icon", type: "button", className: "h-5 w-5 p-0 text-muted-foreground/30 opacity-0 group-hover:opacity-100 hover:text-destructive transition-opacity", onClick: () => emit(arr.filter((_, j) => j !== i)), children: _jsx(X, { className: "h-3 w-3" }) })] }, i))), _jsx(Button, { variant: "ghost", size: "sm", type: "button", className: "h-6 px-2 text-[10px] text-muted-foreground hover:text-foreground", onClick: () => emit([...arr, 0]), children: "+ add" })] }));
|
|
173
174
|
}
|
|
174
175
|
// object/other — textarea fallback
|
|
175
|
-
return (_jsx(
|
|
176
|
+
return (_jsx(DraftTextarea, { value: JSON.stringify(arr, null, 2), onChange: (text) => {
|
|
176
177
|
try {
|
|
177
|
-
emit(JSON.parse(
|
|
178
|
+
emit(JSON.parse(text));
|
|
178
179
|
}
|
|
179
180
|
catch {
|
|
180
181
|
/* let user keep typing */
|