Skip to content
Shapemetry

Model - Builtin params

API reference for src/schema/vocabulary/builtinParams 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.

BuiltinParamDef

type

One lane-builtin parameter's seeding record. NOT an ArgDef (schema/registry.ts): an ArgDef describes an arg EXPRESSION on a method (default is optional expression text), while this is a lane's reserved parameter key whose default is a required literal VALUE (number|string) and whose identity is the record key, not a key field.

type BuiltinParamDef
// = {
    /** Value used when the lane entry declares no parameter with this key. */
    default: number | string;
    /** A TYPE_REGISTRY name — the value method a declaration should use. */
    type: string;
    tooltip: string;
}

builtinParamExpression

function

The authored EXPRESSION a seeder writes for a builtin's default — a string builtin is quoted (scale seeds as "'auto'"), a number stringifies.

builtinParamExpression(def: BuiltinParamDef): string

BuiltinParamLane

type

type BuiltinParamLane
// = keyof typeof LANE_BUILTIN_PARAMS

builtinParamValues

function

{ paperWidth: 420, … } — the defaults alone, for the lane that wants a plain value record (and for resolveLaneBuiltins to layer overrides on).

builtinParamValues(table: T): BuiltinValues<T>

BuiltinValues

type

The default VALUES of one lane's table, each key keeping the LITERAL type it was declared with (wrap: "repeat", paperWidth: 420). NOT a duplicate of ResolvedBuiltins — this is the PRE-resolution shape (literal defaults).

type BuiltinValues
// = {
    -readonly [K in keyof T]: T[K] extends {
        default: infer D;
    } ? D : never;
}

LANE_BUILTIN_PARAMS

const

const LANE_BUILTIN_PARAMS: { /** A texture chain's external contract: tile size in mm, output pixels, * and the sampling triple. DECLARING a key is what activates it — an * undeclared `wrap`/`filter`/`uvSet` keeps the default REPEAT + LINEAR + * TEXCOORD_0, and undeclared tile mm leave the material record's own * fallback in charge. */ readonly textures: { readonly lengthX: { readonly default: 1000

laneParamLiterals

function

Primary-arg LITERAL values from a parameters[] lane (a number, or an unquoted/quoted string literal). Expressions that are not plain literals are skipped: the three builtin resolvers are registry-free by design, so full parametric paper size goes through a host that can evaluate.

laneParamLiterals(parameters: (Operation | Container)[] | undefined): Record<string, unknown>

ResolvedBuiltins

type

Same keys after resolution, widened to what a declaration may carry — the defaults are literals, a resolved value is any number/string. NOT a duplicate of BuiltinValues — this is the POST-resolution shape (widened).

type ResolvedBuiltins
// = {
    -readonly [K in keyof T]: T[K] extends {
        default: infer D;
    } ? (D extends string ? string : D extends number ? number : D) : never;
}

resolveLaneBuiltins

function

THE resolution law, implemented once: a builtin keeps its default unless the entry's own parameters[] declares that key with a finite literal of the same JS type. A lane that WIDENS a builtin's type (a sheet scale declared as the number 50 against the string default 'auto') or that needs a range guard on top (paper must be positive; a 0 mm margin is legal) does that at its own call site — the shared law stays one rule.

resolveLaneBuiltins(table: T, parameters: (Operation | Container)[] | undefined): ResolvedBuiltins<T>
Last updated: 📖 2 min readEdit on GitHub