Types - SVG
API reference for ./io/svg on @huukhanhnguyen/types — the option and result records of @huukhanhnguyen/io's SVG reader/writer.
See the Guide for the package's role.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
BoundaryEdge
type
type BoundaryEdge
// = {
a: string;
b: string;
count: number;
used?: boolean;
}ProjectFn
type
type ProjectFn
// = (x: number, y: number, z: number) => [number, number]SceneSvgOptions
type
type SceneSvgOptions
// = {
/** World-space window (Y up). Defaults to the scene's XY bounds. */
viewBox?: {
x: number;
y: number;
width: number;
height: number;
};
/** Padding around auto-computed bounds, world units. Default 0. */
padding?: number;
/** Backdrop rectangle color; omitted → transparent. */
background?: string;
/** Face fill when no material resolves. Default "#888888". */
fill?: string;
/** Linework color when neither material nor layer resolves. Default "#222222". */
stroke?: string;
/** Linework width (world units) when the layer declares none. Default 1. */
strokeWidth?: number;
/** Point marker radius, world units. Default 2. */
pointRadius?: number;
/** Document asset lanes — the bodies for the NAMES entities reference. */
materials?: Material[];
layers?: Layer[];
/** Block definitions a `BlockEntity` places — SVG has no instancing, so
* `sceneToSvg` flattens them (the placement matrix composes into the
* projection). Absent, a placement draws nothing. */
definitions?: Map<string, BlockDefinition> | ReadonlyMap<string, BlockDefinition>;
}SvgArc
type
A circular arc in SVG user space (y-DOWN), angles in radians about center.
Declared here rather than beside its parser in scene's io/svgDialect.ts because every type is declared in the types package and there is no second place — the type-declaration-law gate caught it the moment it was written elsewhere.
type SvgArc
// = {
center: [number, number];
radius: number;
startAngle: number;
endAngle: number;
/** SVG sweep flag: true = increasing angle in the y-down frame. */
sweep: boolean;
}SvgLook
type
type SvgLook
// = {
defaultFill: string;
defaultStroke: string;
defaultStrokeWidth: number;
pointRadius: number;
materialColor: (name: string | undefined) => string | undefined;
layerOf: (name: string | undefined) => import("../evaluate/layer.js").Layer | undefined;
lineworkColor: (materialName: string | undefined, layerName: string | undefined, override?: import("../evaluate/savedView.js").ViewFilterOverride) => string;
strokeAttrs: (materialName: string | undefined, layerName: string | undefined, override?: import("../evaluate/savedView.js").ViewFilterOverride) => string;
}