@genetik/schema
v0.0.2
Published
Block types, config (JSON Schema), slots, and reference modes for the Genetik JSON-driven UI ecosystem.
Readme
@genetik/schema
Block types, config (JSON Schema), slots, and reference modes for the Genetik JSON-driven UI ecosystem.
Install
pnpm add @genetik/schemaUsage
import {
createSchema,
registerBlockType,
getBlockType,
validateConfig,
} from "@genetik/schema";
const schema = createSchema({ version: "1.0.0" });
registerBlockType(schema, {
id: "text",
configSchema: { type: "object", properties: { content: { type: "string" } }, required: ["content"] },
slots: [],
});
const result = validateConfig(schema, "text", { content: "Hello" });
// result.valid === trueSee the docs or apps/docs/docs/packages/schema.md in the repo for full API and concepts.
Scripts
pnpm build- Build with tsdown (ESM + CJS + types)pnpm test- Run testspnpm check-types- TypeScript checkpnpm lint- ESLint
