Skip to content
Shapemetry

@huukhanhnguyen/model / schema/vocabulary/types

schema/vocabulary/types

ThemeColorFamily

ThemeColorFamily = typeof THEME_COLOR_FAMILIES[number]


TypeCategory

TypeCategory = "data" | "record" | "value"

Three roles for a type-table entry:

  • data — stream payloads (curve/brep/point-cloud/block/annotation/…) and the stream union (objectData).
  • record — lane-resolved records and chain step values (material, layer, style, table, view, texture, …). Formerly misnamed namespace (those entries are not expression namespaces).
  • value — scalars / geometry values / expression-language types that parameters and args carry.

TypeDef

TypeDef = { attributes?: Record<string, unknown>; category: TypeCategory; coerce?: (value, context) => unknown; color: ThemeColorFamily; name: string; note?: string; shape?: string; }

attributes?

optional attributes?: Record<string, unknown>

Opaque frontend metadata (control hint etc.) — engine never reads it.

category

category: TypeCategory

coerce?

optional coerce?: (value, context) => unknown

Optional coercion hook the arg coercer runs for values of this type (e.g. font: registered name → FontData from the Store). Stripped from the serializable catalog.

Parameters

value

unknown

context
store?

unknown

Returns

unknown

color

color: ThemeColorFamily

name

name: string

note?

optional note?: string

shape?

optional shape?: string


THEME_COLOR_FAMILIES

const THEME_COLOR_FAMILIES: readonly ["primary", "secondary", "info", "success", "warning", "attention", "error", "danger", "highlight", "neutral"]


TYPE_REGISTRY

const TYPE_REGISTRY: ({ category: TypeCategory; color: "info"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "success"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "warning"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "primary"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "secondary"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "attention"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "danger"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "highlight"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "neutral"; name: string; note: string; shape: string; } | { category: TypeCategory; color: "error"; name: string; note: string; shape: string; })[]


bareTypeName()

bareTypeName(raw, opts?): string

Strip one (possibly annotated) arg type to its base name: removes the [] array suffix and any (…) annotation — "curveData[]" → "curveData", "length(mm)" → "length". THE one parser for this; callers that need union handling split on | first and map over the branches.

The dataAliases option encodes an INTENTIONAL divergence between the two call sites: with it set, the bare value-type names curve/face map to their scene-data types — ArgumentNode's runtime coercion dispatch wants that (a NurbsCurve value fills a curveData slot via asShapes). The Registry's arg-type validation passes NO aliases: it checks declared names against this type registry, where curve/face/point are their own registered value types — aliasing there would mis-validate a legitimately declared curve arg.

Parameters

raw

string

opts?

dataAliases?

boolean

Returns

string

Last updated: 📖 3 min readEdit on GitHub