Import these from @grafloria/renderer.
HTML_LAYER_CLASS
tsconst HTML_LAYER_CLASS: "grafloria-html-layer"
INSTANCE_ATTR
data-grafloria-instance — the renderer's CSS scope, mirrored onto the root.
tsconst INSTANCE_ATTR: "data-grafloria-instance"
PORT_SIDES
tsconst PORT_SIDES: readonly ["top", "right", "bottom", "left"]
ROOT_CLASS
The DOM skeleton of a mounted diagram — ONE definition, used by both halves.
The server (renderToStaticSVG) emits this markup as a string; the client
(createDiagram) builds the identical structure with createElement, or
ADOPTS the server's when hydrating. Any divergence between the two — a class
name, a style declaration, an attribute — is a hydration mismatch, so both
paths read the constants from here rather than each spelling them out.
The HTML layer holds nodes that render as framework components (React
portals, slotted templates). It carries the camera as a CSS transform so it
stays registered with the SVG layer, and is pointer-events: none so it does
not eat clicks meant for the SVG underneath — each mounted node host turns
pointer events back on for itself.
tsconst ROOT_CLASS: "grafloria-diagram-root"
ROOT_STYLE
tsconst ROOT_STYLE: "position:relative;width:100%;height:100%;overflow:hidden"
SVG_LAYER_CLASS
tsconst SVG_LAYER_CLASS: "grafloria-svg-layer"
SVG_LAYER_STYLE
tsconst SVG_LAYER_STYLE: "position:absolute;top:0;left:0;width:100%;height:100%"
Was this page helpful?