1. Data Table Renderer (Table Simple)
A 3-step sequential pipeline: buildColgroup (1D) sets up widths, buildHeader (1D) produces columns & headers, and buildBody (2D) computes row × column cells into <tbody>.
import runInstructions from "json-renderers-run-instructions-steps";
import { spec } from "spec-repo";
const base = structuredClone(spec.tableSimple);
const result = runInstructions({
instructions: ["buildColgroup", "buildHeader", "buildBody"],
base,
data: { columns, data },
showLog: true
});
[
"buildColgroup", // 1D: maps columns -> table.colgroup.children (<col>)
"buildHeader", // 1D: maps columns -> table.thead.tr.children (<th>)
"buildBody" // 2D: maps rows x columns -> table.tbody.children (<tr><td>)
]
{
"tagName": "table",
"attributes": { "class": "table" },
"children": [
{ "tagName": "colgroup", "children": [ { "tagName": "col" }, { "tagName": "col" } ] },
{ "tagName": "thead", "children": [ { "tagName": "tr", "children": [ { "tagName": "th", "innerText": "ID" } ] } ] },
{ "tagName": "tbody", "children": [ { "tagName": "tr", "children": [ { "tagName": "td", "innerText": "1" } ] } ] }
]
}
2. Dropdown Select Element (Select Base)
Uses buildSelectWithOptions with columnOnRow to map data rows to <option> tags containing value identifiers and display text.
const base = structuredClone(spec.selectBase);
const result = runInstructions({
instructions: ["buildSelectWithOptions"],
base,
data: { columns, data },
showLog: true
});
3. HTML5 DataList Autocomplete
Executes buildDataListWithOptions to populate native <datalist> containers with instant suggestions for bound search inputs.
const base = structuredClone(spec.dataListSimple);
const result = runInstructions({
instructions: ["buildDataListWithOptions"],
base,
data: { columns, data }
});
4. Interactive Form Fields (Form Simple)
Interpolates field names, types, and labels into standard Bootstrap-styled form controls with labels and validation rules using buildFormField.
const base = structuredClone(spec.formSimple);
const result = runInstructions({
instructions: ["buildFormField"],
base,
data: { columns, data }
});