@banclo/jsonforms-core
v0.0.4
Published
Core logic, types, and state management for JSON Form Builder.
Readme
@banclo/jsonforms-core
Core logic, types, and state management for JSON Form Builder.
Installation
npm install @banclo/jsonforms-core
# or
pnpm add @banclo/jsonforms-coreWhat's Included
State Management (Pinia Stores)
useBuilderStore— Main store managing theSchemaNodetree, selection, drag state, and JSON/UI schema generationuseHistoryStore— Undo/redo history trackinguseClipboardStore— Copy/paste operations on schema nodes
Component Registry
useComponentRegistry— Singleton registry for component manifestsbuiltinManifests— Built-in controls (string, number, boolean, date, select, etc.) and layouts (horizontal, vertical, group, categorization)ComponentManifest— Interface for registering custom components with property schemas, defaults, and placement rules
Tree Operations
addElement/removeElement/moveElement/updateElement— Immutable tree operations on theSchemaNodetreefindNode/findParent/walkTree/flattenTree— Tree traversal utilities
Schema Generation
generateJsonSchema— Converts the node tree into a JSON SchemagenerateUiSchema— Converts the node tree into a JSON Forms UI Schema
Basic Usage
import { createPinia } from 'pinia'
import { useBuilderStore, useComponentRegistry } from '@banclo/jsonforms-core'
const pinia = createPinia()
const store = useBuilderStore(pinia)
const registry = useComponentRegistry()
// Add a node
store.addNode({ nodeType: 'control', controlType: 'string-control' })
// Get generated schemas
const jsonSchema = store.jsonSchema
const uiSchema = store.uiSchemaLicense
MIT
