Model - Assets
API reference for src/validate/assets, src/document/assets on @huukhanhnguyen/model, reachable from ..
See the Guide for the ModelJSON / evaluate pipeline.
API reference
Signatures are generated from the live package .d.ts - not hand-written.
annotationStyleErrors
function
annotationStyleErrors(model: ModelJSON): RegistryError[]indexByName
function
Index resolved by-name records (materials / layers / styles) for lookup. FIRST match wins, in lane order — the one by-name resolution law. A duplicate LITERAL name is a validation error, but a name produced by an expression is unchecked and can still collide at evaluate time; every consumer must then agree on which record it means, and Material.get's .find already decided that answer. (A plain new Map(list.map(...)) quietly says LAST — that disagreement is what this replaces.)
indexByName(records: readonly T[] | undefined): Map<string, T>layerErrors
function
Hard validation for the layers[] node lane.
layerErrors(model: ModelJSON): RegistryError[]materialErrors
function
Hard validation for the materials[] node lane.
materialErrors(model: ModelJSON): RegistryError[]materialReferenceErrors
function
Soft diagnostics: applyMaterial literal names missing from materials[]. Does NOT block Model.fromJSON — renderer falls back to default gray.
materialReferenceErrors(model: ModelJSON): RegistryError[]nodeKeyErrors
function
Model-wide node-key uniqueness for the root lanes.
A key names THE VALUE AT ITS NODE and every expression in a porous lane resolves bare identifiers against ONE flat namespace built from keyedNodes() — root parameters plus root operations, nested container children included. Two nodes claiming one key therefore have no meaning: keyedNodes() is depth-first first-wins, so the second node is silently unreachable, and BaseCollection.add renames a same-list sibling out from under the references that were written against it. The authoring path (setKey/generateKey) has always refused a taken name; a hand-written or machine-generated document could not, and loaded anyway.
Hard error (dev stage — no stored corpus to migrate). The isolated lanes (a component's own body, a texture chain, a sheet's ad hoc operations) each get a FRESH collection per resolve, so their keys are local and are not checked here.
nodeKeyErrors(model: ModelJSON): RegistryError[]styleErrors
function
Hard validation for the styles[] node lane.
styleErrors(model: ModelJSON): RegistryError[]styleReferenceErrors
function
Soft diagnostics: a viewStyle step's literal name missing from styles[]. Does NOT block Model.fromJSON — the viewport just skips applying anything special (same "renderer already falls back" reasoning as materialReferenceErrors).
styleReferenceErrors(model: ModelJSON): RegistryError[]textStyleErrors
function
textStyleErrors(model: ModelJSON): RegistryError[]