import { defineRegistry, useBoundProp } from "@json-render/react"; import { catalog } from "./catalog"; export const { registry, handlers } = defineRegistry(catalog, { components: { Stack: ({ props, children }) => (
{children}
), Card: ({ props, children }) => (
{props.title && (

{props.title}

)}
{children}
), Text: ({ props }) => ( {String(props.content ?? "")} ), Button: ({ props, emit }) => ( ), Input: ({ props, bindings }) => { const [value, setValue] = useBoundProp(props.value ?? undefined, bindings?.value); return ( setValue(e.target.value)} style={{ padding: "8px 12px", fontSize: "14px", border: "1px solid var(--border)", borderRadius: "6px", outline: "none", backgroundColor: "var(--bg-surface)", color: "var(--text)", }} /> ); }, }, actions: { increment: async (params, setState) => { if (!params) return; const path = params.statePath; const key = path.replace(/^\//, ""); setState((prev) => ({ ...prev, [key]: ((prev[key] as number) ?? 0) + 1, })); }, logCountry: async (params) => { if (!params) return; console.log("logCountry:", params.country); }, }, });