Transforms raw input data into fully-formed declarative UI specifications by orchestrating modular instruction blueprints across 0D, 1D, and 2D spatial dimensions with zero DOM overhead.
Select a UI component and simulate how sequential instructions mutate the target canvas spec in real-time.
// Base canvas specification ready...
{
"tagName": "table",
"attributes": { "class": "table table-striped table-hover" },
"children": []
}
Zero loops inside the engine. The runner acts as a pure coordinator, delegating data transformation directly to specialized mathematical dimension handlers.
Maps single scalar values, objects, or containers into declarative node templates. Ideal for cards, badges, and layout wrappers.
json-transformer-funcs-primitiveProjects a 1-dimensional array across an instruction template. Builds sequential siblings like colgroups, table headers, and list items.
json-transformer-funcs-one-dimension<col> and <th> specsComputes cross-product coordinates across rows and columns. Constructs complex 2D data grids, selects, and nested option sets.
json-transformer-funcs-two-dimensions<tbody>, <tr>, and <td>Whether you are rendering a data table, an interactive select box, a datalist auto-complete, or dynamic input form fields, the runner API remains completely uniform:
Runs identical instruction sequences across browsers and backend server runtimes.
Instructions live independently in declarative-instructions and can be shared across any renderer.
Powered by jsonpathly and json-write-path for blazing-fast tree assembly without GC spikes.
import runInstructions, { executeStep } from "json-renderers-run-instructions-steps";
import { spec } from "spec-repo";
// 1. Initialize clean base canvas template
const base = structuredClone(spec.tableSimple);
// 2. Execute blueprint instructions sequentially
const resultSpec = runInstructions({
instructions: [
"buildColgroup", // 1D: maps columns to <colgroup><col>
"buildHeader", // 1D: maps columns to <thead><th>
"buildBody" // 2D: maps rows x columns to <tbody><tr><td>
],
base,
data: {
columns: [
{ key: "id", label: "ID" },
{ key: "name", label: "Name" }
],
data: [
{ id: "101", name: "Alpha" },
{ id: "102", name: "Beta" }
]
},
showLog: true
});
console.log("Rendered JSON UI Spec:", resultSpec);