Import these from @grafloria/renderer.
Constants
AVG_CHAR_WIDTH_EM
The average glyph advance, as a fraction of font-size.
THE SAME CONSTANT LabelRenderer.estimateTextWidth uses. It is a rough mean for
proportional Latin text — and it being rough is fine, because the renderer sizes
label backgrounds with it too. What matters is that the two AGREE: a bbox derived
from a different estimate than the one that placed the text would crop labels the
renderer thought it had left room for.
tsconst AVG_CHAR_WIDTH_EM: 0.6
DEFAULT_CUSTOM_NODE_TIMEOUT
Default bound on waiting for an async painter. See ExportOptions.customNodeTimeout.
tsconst DEFAULT_CUSTOM_NODE_TIMEOUT: 5000
DEFAULT_MAX_OUTPUT_SIZE
The default cap on an exported raster's pixel size, per side.
tsconst DEFAULT_MAX_OUTPUT_SIZE: 4000
EXPORT_IGNORE_ATTRIBUTE
The opt-out: an element marked data-grafloria-export="ignore" is on screen but not in
the file — interaction chrome a canvas draws inside a host (the Angular canvas's port
handles), or a card's own buttons. Its whole subtree is skipped.
tsconst EXPORT_IGNORE_ATTRIBUTE: "data-grafloria-export"
GRAFLORIA_MODEL_KEY
The PNG text-chunk keyword, and the SVG element name.
NOT grafloria-diagram: that is already the CSS class on the exported root
(class="grafloria-diagram"), so "does this file carry a model?" would answer YES for
every export we have ever produced.
tsconst GRAFLORIA_MODEL_KEY: "grafloria-model"
GRAFLORIA_NS
The XML namespace the embedded model lives in.
tsconst GRAFLORIA_NS: "https://grafloria.dev/ns/diagram"
IMAGE_NOT_INLINED_WARNING
Companion caveat from resolveImageHref — same lifecycle as {@link IMAGE_PDF_WARNING}.
tsconst IMAGE_NOT_INLINED_WARNING: string
IMAGE_PDF_WARNING
The capture-time verdict on an external image, EXPORTED because the async export path
revises it: await export(…) fetches external URLs (environment fetch, then
ExportOptions.assetFetcher) and STRIPS this warning from any capture whose images it
embedded — see stripResolvedImageWarnings. The synchronous entry points cannot fetch,
so for them this text is the whole truth, and it names the way out.
tsconst IMAGE_PDF_WARNING: string
nodeWorldBounds
World bounds of a node — the rect both the culler and the capture work in.
tsconst nodeWorldBounds: (node: NodeModel) => Rectangle
SVG_XMLNS
tsconst SVG_XMLNS: "http://www.w3.org/2000/svg"
utf8
UTF-8, implemented rather than borrowed.
TextEncoder/TextDecoder are NOT reliably global: they are absent in jsdom (which
is what the renderer's own tests run in) and were late to Node. Sniffing for them and
falling back would give two code paths that can disagree about a surrogate pair — in a
module whose entire job is lossless bytes. So: one path, always, everywhere.
tsconst utf8: { encode(text: string): Uint8Array<ArrayBufferLike>; decode(bytes: Uint8Array<ArrayBufferLike>): string; }
XML_DECLARATION
The XML prolog. Required by strict XML parsers and by most SVG→PDF toolchains.
tsconst XML_DECLARATION: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
Was this page helpful?