Types - Styles
API reference for ./evaluate/styles on @huukhanhnguyen/types.
See the Guide for the package's role.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
Style
type
Resolved styles[] record — the RESOLVED shape evaluateStyles() / collectStyleNodes() produce from an authored style node's expression args, consumed BY NAME via a view's viewStyle step.
type Style
// = {
name: string;
/** Viewport clear color, any CSS hex (`"#1a1a1a"`). */
background?: string;
/** Viewport display mode — SSOT applied by Viewport.applyStyle on every
* host (edit/embed/model). "realistic" switches to PBR tone mapping and
* is the ONLY mode that materializes emitting entities and the document's
* `settings.environment` into real renderer lights. "matcap" is self-lit form-reading (MeshMatcapMaterial).
* "shaded" is the CAD headlight rig. Absent = host may fill via
* applyStyle({ defaultShading }) only; never overridden when authored. */
shading?: "shaded" | "wireframe" | "realistic" | "matcap";
/** EV compensation on the 3D viewport's auto-exposure meter, realistic
* mode only — same as a camera's +/- exposure dial: 1 (default) trusts
* the meter as-is, 2 doubles the metered brightness, 0.5 halves it. */
exposure?: number;
}StyleCapabilities
type
What a style's shading STYLE can show — the SSOT both the model's validation (which style fields a shading permits — exposure requires "realistic") and packages/three's Viewport read, instead of scattered shading === "realistic" string comparisons. NOT a "view kind" concept — an orthographic (drawing) view referencing a "realistic" style is legal (a lit axonometric in the viewport, Revit precedent); the 2D paper pipeline structurally never reads a style at all, so plans stay immune with no extra rule needed.
type StyleCapabilities
// = {
/** Emitting entities (`EntityBase.emission`) and the document's
* `settings.environment` materialize into real renderer lights. */
lights: boolean;
/** Mesh materials render (their own color/texture) vs. flat line work only. */
materials: boolean;
exposure: boolean;
}