Skip to content
Shapemetry

@huukhanhnguyen/model / core/laneFields

core/laneFields

evalBoolean()

evalBoolean(value, context, namespaces?, field?): boolean | undefined

Boolean field — expression evaluates to boolean/number/string, coerced. Shared with materials.ts (doubleSided).

ABSENT (no arg, or a blank one) is the only reading that means "use the field's default". An expression the author WROTE and this cannot read is a different statement, and it used to return the same undefined: both callers test !== undefined, so labels: "nope" and doubleSided: "nope" rendered exactly as if the field had never been authored. A value that evaluates to a non-coercible type (an object, null) is the same failure — the author asked for something this cannot answer.

Parameters

value

string | undefined

context

EvalContext

namespaces?

Record<string, unknown>

field?

string = "boolean field"

Returns

boolean | undefined


evalNumber()

evalNumber(value, context, namespaces?, field?): number | undefined

Numeric field: literal number, or an expression string → number. Shared with materials.ts/layers.ts — same expression-field law.

ABSENT (no arg, or a blank one) is the only reading that means "use the field's default". An expression the author WROTE and this cannot read, or that evaluates to a non-number, used to return the same undefined — so fov: "nope" rendered exactly as if the field had never been authored.

Parameters

value

string | number | undefined

context

EvalContext

namespaces?

Record<string, unknown>

field?

string = "number field"

Returns

number | undefined


evalPoint()

evalPoint(value, context, namespaces?, field?): Point | undefined

Point field: literal [x,y,z], or an expression string → [x,y,z]. Shared with materials.ts/layers.ts. Same ABSENT-vs-unreadable law as evalNumber.

Parameters

value

string | [number, number, number] | undefined

context

EvalContext

namespaces?

Record<string, unknown>

field?

string = "point field"

Returns

Point | undefined


evalText()

evalText(value, context, namespaces?): string | undefined

Text field (color/layer/glyph) — the VALUE LAW: expression-first, literal fallback ("'#334155'" evaluates, a bare "#334155" IS the literal; a param reference evaluates live). Shared with materials.ts.

Parameters

value

string | undefined

context

EvalContext

namespaces?

Record<string, unknown>

Returns

string | undefined


evaluateExpression()

evaluateExpression(input, context, namespaces?): unknown

Parameters

input

string

context

EvalContext

namespaces?

Record<string, unknown>

Returns

unknown


laneParameterContext()

laneParameterContext(scope): EvalContext

Parameters

scope

nodes?

unknown

Returns

EvalContext

Last updated: 📖 2 min readEdit on GitHub