import { defineRegistry } 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, emit }) => ( emit("change")} style={{ padding: "8px 12px", fontSize: "14px", border: "1px solid #d0d0d0", borderRadius: "6px", outline: "none", }} /> ), }, 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); }, }, });