1. The Problem with Monolithic UI Builders
In traditional web libraries, generating complex UI components (such as multi-column data tables, select option matrices, or interactive form sections) is usually tightly coupled to DOM creation APIs or huge monolithic functions. If you wanted to adjust the order of colgroups, headers, or body rows, you had to rewrite loop logic, manage mutable DOM element handles, and deal with browser side-effects.
When building high-throughput JSON renderers, having the runtime know what a "table" is creates architectural friction. What if tomorrow you want to render a dropdown, a datalist, or a mobile card list using the exact same step-by-step logic?
2. The 4 Generations of Evolution
The architecture of json-renderers-run-instructions-steps was refined across 4 clear evolutionary milestones:
Version 1 — The Monolithic Step Runner
The initial step-by-step experiment. It proved that sequentially applying instruction names was vastly superior to giant functions, but it contained defensive checking bloat, coupled blueprints, and rigid error catches.
Version 2 — The 4-Line executeStep Breakthrough
Stripped away all defensive check overhead. executeStep was reduced to a pure 4-line function: resolve instruction, dispatch dimension type, mutate destination path, and return result.
Version 3 — 2D Matrix Orchestration
Replaced custom matrix loops with json-transformer-funcs-two-dimensions (rowOnColumn and columnOnRow), establishing the tri-dimensional mathematical framework (0D, 1D, 2D).
Version 4 — Decoupled Blueprints
Achieved separation of concerns. Instruction definitions were extracted to declarative-instructions, while templates moved to declarative-spec.
Version 5 (v13) — Pure Orchestration Across Single & Multi (Current)
Split mixed blueprints into declarative-instructions-single and declarative-instructions-multi, removed the legacy monolithic catalog, and reduced executeStep.js to pure orchestration routing { type, key } descriptors into dedicated single/index.js and multi/index.js workers.
3. The 3D Spatial Mathematical Model
Every declarative UI element naturally lives in one of three mathematical spaces:
| Dimension | Nature | Engine Function | Example Output |
|---|---|---|---|
| 0D (Primitive) | Singular Object Mapping | applyTemplate |
Cards, Badges, Form Wrapper |
| 1D (Linear) | 1-Dimensional Array Projection | fromCollection |
Colgroups (<col>), Headers (<th>) |
| 2D (Matrix) | Cartesian Cross-Product (Row × Col) | rowOnColumn / columnOnRow |
Table Body (<tr><td>), Select Options |
Because of this clear mathematical separation, the step runner doesn't have a single nested loop. It simply reads the instruction's type and invokes the corresponding specialized transformer function.
4. Zero-DOM & Zero Garbage Collection Overhead
Traditional declarative frameworks often clone the entire component tree on each step to ensure immutability. When constructing a table of 500 rows and 20 columns, this leads to 10,000 intermediate nodes cloned multiple times, triggering heavy GC pauses.
json-renderers-run-instructions-steps achieves extreme performance by performing **deterministic in-place mutations** into pre-allocated branches of the canvas tree using json-write-path. The execution is synchronous, pure, and produces identical results every run without GC pressure.
5. The Canvas Contract: Why We Mandate base and Never baseKey
During the evolution between version 5 and 6, an experiment was conducted to pass baseKey (a string pointing to a catalog key) instead of the actual base specification object. At first glance, it seemed like a convenience — letting the runner look up the template itself.
However, this proved to be an architectural blunder that broke the foundational tenets of the system:
- Broken Multi-Task Pipeline: In
json-renderers-run-instructions, rendering is a staged pipeline. Stage 1 executes instruction steps; Stage 2 injects dynamic options (search bars, options dropdowns, serial numbers). Both stages MUST share and mutate the same in-flightbasecanvas. PassingbaseKeyforcedstepsto create its own isolated canvas, severing the pipeline. - Catalog Bleed & Bloat: Expecting
baseKeyforcedrun-instructions-stepsto bundle the entiredeclarative-speccatalog, bloating distribution files and preventing developers from passing custom AST structures. - Poisoning the Spec Catalog: If the runner mutated
spec[baseKey]directly, subsequent renders across the application inherited dirty state from previous executions.
With Version 7, the architecture is locked in: runInstructions receives base, mutates base in place, and returns base. Never pass baseKey.