@frank/ad-template-renderer (0.1.0)
Published 2026-09-26 16:07:15 +10:00 by steve
Installation
@frank:registry=npm install @frank/ad-template-renderer@0.1.0"@frank/ad-template-renderer": "0.1.0"About this package
@frank/ad-template-renderer
The canonical deterministic renderer for final ad templates, ported unchanged
from packages/ad-template-renderer in the Blockwise repo. It renders an
AdTemplate from @frank/ad-template into feed (1080x1350) and story
(1080x1920) PNGs, fails closed when authored text cannot fit its box, and
produces a render audit receipt (pixel gates, perceptual duplicate-image
checks, text diagnostics) for the tool-run quality gate.
Public API (src/index.ts)
renderPlacement(input, placement),renderBoth(input)- render one or both placements.RenderInputcarriestemplate,imageValues,textValues,colourMap, optionalfontValues(font file -> bytes).TextPreflightError/TEXT_PREFLIGHT_ERROR_CODE- thrown when text cannot fit at the readability floor.auditTemplateArtifact(input)- full audit;AuditArtifactInputcarriesartifactBytes,assetsDir, optionalsourceBytes,runId,iteration.- Subpath
@frank/ad-template-renderer/text-layout:segmentGraphemes,measureTrackedTextWidth,wrapText,prepareTextLayout. - Bins:
ad-template-render(CLI render),ad-template-audit(CLI audit).
Config
No environment reads. Fonts the template declares by bare file name resolve
to fonts/adbuilder/ inside this package; callers override by passing
fontValues bytes. Asset files resolve against the caller-provided
assetsDir.
Usage
import { renderBoth } from "@frank/ad-template-renderer";
const [feed, story] = await renderBoth({ template, imageValues, textValues, colourMap });
Dependencies
Dependencies
| ID | Version |
|---|---|
| @frank/ad-template | 0.1.0 |
| @napi-rs/canvas | ^1.0.3 |
Development dependencies
| ID | Version |
|---|---|
| @types/node | ^22.0.0 |
| fabric | ^7.4.0 |
Details
2026-09-26 16:07:15 +10:00
Assets (1)
Versions (3)
View all
npm
75
2.2 MiB
ad-template-renderer-0.1.0.tgz
2.2 MiB