Skip to Content
Bear documentation

types

Import from bear/engine/types.

Interfaces

AncestorNode

Defined in: bear/engine/types.ts:281

Minimal ancestor-chain shape every node satisfies structurally. Helpers that only walk upward (context lookup, world transforms) accept this.

Extended by

Properties

PropertyModifierType
context?readonlyContextMap
parentreadonlyAncestorNode | null
transform?readonlyTransformMatrix

AssemblyNode

Defined in: bear/engine/types.ts:336

An assembly. Publishes the reference planes its refs prop states and spans its children; an empty assembly has no extents.

Extends

  • TreeNodeBase<P>

Type Parameters

Type ParameterDefault type
PRecord<string, unknown>

Properties

PropertyModifierTypeDescriptionOverridesInherited from
assembliesreadonlyreadonly AssemblyFn<Record<string, unknown>>[]Assembly components whose expansion produced this node, innermost first. Assemblies are transparent (they create no nodes of their own), so this is how a node remembers which components it came from; q(Wall) matches against it.-TreeNodeBase.assemblies
authoredSegmentreadonlystringThe authored name before sibling FQN deduplication renamed it.-TreeNodeBase.authoredSegment
childrenreadonlyreadonly TreeNode<Record<string, unknown>>[]--TreeNodeBase.children
context?readonlyContextMapContext values provided by this node for descendant lookup. Set from the context prop during collection. Descendants call getContext(node, ctx) to walk the ancestor chain.-TreeNodeBase.context
extents?readonlyReferenceExtents---
fqnreadonlystring--TreeNodeBase.fqn
kindreadonly"assembly"-TreeNodeBase.kind-
model?readonlyModelViewThe model this node landed in, set when materialize() seals the converged tree. Graph hops from a bare node read its edges here. Absent on a tree that was only collected (a pass that did not converge, or collect() called directly).-TreeNodeBase.model
parentreadonlyTreeNode<Record<string, unknown>> | null--TreeNodeBase.parent
propsreadonlyReadonly<P>--TreeNodeBase.props
refsreadonlyReadonly<Record<string, Surface>>---
relationDeclsreadonlyreadonly RelationDecl[]Relation declarations this element authored, landed at collect and resolved into the model's edges at the end of the pass.-TreeNodeBase.relationDecls
resolvedreadonlyResolvedRefs--TreeNodeBase.resolved
rides?readonlyReadonly<Record<string, string>>The solvable anchor each of this node's refs rides, by ref key, when it is not the enclosing solvable's first anchor: a span's end plane rides end. From the rides prop. A dim to a ref moves the anchor the ref rides.-TreeNodeBase.rides
sourcereadonlyreadonly SourceLocation[]Call sites that produced this node, innermost first: the node's own JSX expression, then each enclosing element on the collection path (assembly call sites included, even though assemblies create no nodes). Empty when the code was compiled without call-site emission.-TreeNodeBase.source
transformreadonlyTransformMatrixLocal to the parent: authored, placed from connections, or identity.-TreeNodeBase.transform
typereadonlyPartDef<any>--TreeNodeBase.type

BearElement

Defined in: bear/engine/types.ts:555

What createElement returns — a lightweight description of what to build. P is the part's props; a bare BearElement is an element of any part.

Type Parameters

Type ParameterDefault type
P extends objectobject

Properties

PropertyTypeDescription
childrenBearElement<object>[]-
propsP & ElementProps-
source?SourceLocationJSX call site, present when compiled with dev JSX (jsxDEV).
type| string | symbol | PartDef<any, string, string> | AssemblyFn<any>-

ConstructionNode

Defined in: bear/engine/types.ts:348

A construction node carries constraint intent (dims, chains), no geometry. Its Ref props stay symbolic for solve.

Extends

  • TreeNodeBase<P>

Type Parameters

Type ParameterDefault type
PRecord<string, unknown>

Properties

PropertyModifierTypeDescriptionOverridesInherited from
assembliesreadonlyreadonly AssemblyFn<Record<string, unknown>>[]Assembly components whose expansion produced this node, innermost first. Assemblies are transparent (they create no nodes of their own), so this is how a node remembers which components it came from; q(Wall) matches against it.-TreeNodeBase.assemblies
authoredSegmentreadonlystringThe authored name before sibling FQN deduplication renamed it.-TreeNodeBase.authoredSegment
childrenreadonlyreadonly TreeNode<Record<string, unknown>>[]--TreeNodeBase.children
context?readonlyContextMapContext values provided by this node for descendant lookup. Set from the context prop during collection. Descendants call getContext(node, ctx) to walk the ancestor chain.-TreeNodeBase.context
extents?readonlyundefined---
fqnreadonlystring--TreeNodeBase.fqn
kindreadonly"construction"-TreeNodeBase.kind-
model?readonlyModelViewThe model this node landed in, set when materialize() seals the converged tree. Graph hops from a bare node read its edges here. Absent on a tree that was only collected (a pass that did not converge, or collect() called directly).-TreeNodeBase.model
parentreadonlyTreeNode<Record<string, unknown>> | null--TreeNodeBase.parent
propsreadonlyReadonly<P>--TreeNodeBase.props
refs?readonlyundefined---
relationDeclsreadonlyreadonly RelationDecl[]Relation declarations this element authored, landed at collect and resolved into the model's edges at the end of the pass.-TreeNodeBase.relationDecls
resolvedreadonlyResolvedRefs--TreeNodeBase.resolved
rides?readonlyReadonly<Record<string, string>>The solvable anchor each of this node's refs rides, by ref key, when it is not the enclosing solvable's first anchor: a span's end plane rides end. From the rides prop. A dim to a ref moves the anchor the ref rides.-TreeNodeBase.rides
sourcereadonlyreadonly SourceLocation[]Call sites that produced this node, innermost first: the node's own JSX expression, then each enclosing element on the collection path (assembly call sites included, even though assemblies create no nodes). Empty when the code was compiled without call-site emission.-TreeNodeBase.source
transformreadonlyTransformMatrixLocal to the parent: authored, placed from connections, or identity.-TreeNodeBase.transform
typereadonlyPartDef<any>--TreeNodeBase.type

Diagnostic

Defined in: bear/engine/types.ts:149

A non-fatal problem found by a phase, about the node it names. Plain data (no node reference) so it serializes across the sandbox boundary.

Properties

PropertyTypeDescription
blockedBy?readonly string[]Unavailable inputs responsible for this finding, when all are blocked by a failed build.
fqnstringThe node the finding is about.
messagestring-
related?readonly (readonly SourceLocation[])[]Call sites of related elements (e.g. the conflicting dims).
severity"error" | "warning"-
sourcereadonly SourceLocation[]Call sites of the element that produced this diagnostic.

EffectiveDim

Defined in: bear/engine/types.ts:167

A dim's fully resolved intent, produced by solve (see ResolvedDim on the model). Nothing re-derives chain inheritance. Lengths are project units.

Properties

PropertyTypeDescription
derived?booleanTrue when value was filled in by solve rather than authored.
direction"y" | "x" | "z"-
eq?EqGroupEq-group token identity, if any.
fromstring | Ref-
fromLabelstringHuman-readable endpoint names ("@A", "W.coreExt"), resolved by solve.
max?number-
measured?numberThe measured span between the resolved planes, when both resolved.
min?number-
priority"required" | "strong"-
tostring | Ref-
toLabelstring-
value?numberAuthored value; for a valueless chain link, solve fills in the measured span.

ElementProps

Defined in: bear/engine/types.ts:535

The props the engine reads on any element, whatever its part.

Extends

Extended by

Properties

PropertyTypeDescriptionInherited from
bearsOn?RelationPropValue-RelationProps.bearsOn
carries?RelationPropValue-RelationProps.carries
context?ContextMapContext values this element provides to its descendants.-
cutBy?RelationPropValue-RelationProps.cutBy
cuts?RelationPropValue-RelationProps.cuts
fastenedTo?RelationPropValue-RelationProps.fastenedTo
fedBy?RelationPropValue-RelationProps.fedBy
feeds?RelationPropValue-RelationProps.feeds
hosts?HostedChildrenCollect typed member declarations before building host-owned children.-
label?string--
name?stringFQN segment for this element. Falls back to label, then the part name.-
refs?Readonly<Record<string, Surface>>Named reference planes this element publishes, in its local frame.-
rides?Readonly<Record<string, string>>The solvable anchor a published ref rides, by ref key. See NodeBase.rides.-
transform?TransformMatrixThis element's pose in its parent frame.-

EqGroup

Defined in: bear/engine/types.ts:102

Identity token for an equality group. Dims sharing a token are constrained pairwise equal with no authored value.

Properties

PropertyModifierType
[EQ_GROUP]readonlytrue
label?readonlystring

Geometry

Defined in: bear/engine/types.ts:408

A part's solid and how to shade it, built once per model for consumers.

A solid made of several materials tags each source solid with its own Manifold original ID (reserveIDs, asOriginal) and maps that ID in materials. Unions and cuts keep each triangle's ID, so the table holds through them. material shades every triangle whose ID has no entry.

Properties

PropertyType
manifold?Manifold
material?MaterialDescriptor
materials?Readonly<Record<number, MaterialDescriptor>>

GeometryNode

Defined in: bear/engine/types.ts:324

A part. Its size is type.extents(props); a part that declares no extents has none. Its solid lives on the model (geometryOf). Publishes the planes its type.planes(props) states, beyond the six box faces every part has.

Extends

  • TreeNodeBase<P>

Type Parameters

Type ParameterDefault type
PRecord<string, unknown>

Properties

PropertyModifierTypeDescriptionOverridesInherited from
assembliesreadonlyreadonly AssemblyFn<Record<string, unknown>>[]Assembly components whose expansion produced this node, innermost first. Assemblies are transparent (they create no nodes of their own), so this is how a node remembers which components it came from; q(Wall) matches against it.-TreeNodeBase.assemblies
authoredSegmentreadonlystringThe authored name before sibling FQN deduplication renamed it.-TreeNodeBase.authoredSegment
childrenreadonlyreadonly TreeNode<Record<string, unknown>>[]--TreeNodeBase.children
context?readonlyContextMapContext values provided by this node for descendant lookup. Set from the context prop during collection. Descendants call getContext(node, ctx) to walk the ancestor chain.-TreeNodeBase.context
extents?readonlyReferenceExtents---
fqnreadonlystring--TreeNodeBase.fqn
kindreadonly"geometry"-TreeNodeBase.kind-
model?readonlyModelViewThe model this node landed in, set when materialize() seals the converged tree. Graph hops from a bare node read its edges here. Absent on a tree that was only collected (a pass that did not converge, or collect() called directly).-TreeNodeBase.model
parentreadonlyTreeNode<Record<string, unknown>> | null--TreeNodeBase.parent
propsreadonlyReadonly<P>--TreeNodeBase.props
refs?readonlyReadonly<Record<string, Surface>>---
relationDeclsreadonlyreadonly RelationDecl[]Relation declarations this element authored, landed at collect and resolved into the model's edges at the end of the pass.-TreeNodeBase.relationDecls
resolvedreadonlyResolvedRefs--TreeNodeBase.resolved
rides?readonlyReadonly<Record<string, string>>The solvable anchor each of this node's refs rides, by ref key, when it is not the enclosing solvable's first anchor: a span's end plane rides end. From the rides prop. A dim to a ref moves the anchor the ref rides.-TreeNodeBase.rides
sourcereadonlyreadonly SourceLocation[]Call sites that produced this node, innermost first: the node's own JSX expression, then each enclosing element on the collection path (assembly call sites included, even though assemblies create no nodes). Empty when the code was compiled without call-site emission.-TreeNodeBase.source
transformreadonlyTransformMatrixLocal to the parent: authored, placed from connections, or identity.-TreeNodeBase.transform
typereadonlyPartDef<any>--TreeNodeBase.type

MaterialDescriptor

Defined in: bear/engine/types.ts:34

Lightweight POJO describing a material. Maps directly to MeshStandardMaterial properties. Actual Three.js material instantiation is handled by the 3D consumer.

Properties

PropertyTypeDescription
color?number-
map?TextureRef-
metalness?number-
normalMap?TextureRef-
opacity?number1 (the default) is opaque; glass is less.
roughness?number-

NamedNode

Defined in: bear/engine/types.ts:291

Structural node shape for scoped name resolution: ancestry, identity, and a named subtree.

Extends

Properties

PropertyModifierTypeOverridesInherited from
authoredSegmentreadonlystring--
childrenreadonlyreadonly NamedNode[]--
context?readonlyContextMap-AncestorNode.context
extents?readonlyReferenceExtents--
fqnreadonlystring--
kindreadonlyNodeKind--
parentreadonlyNamedNode | nullAncestorNode.parent-
refs?readonlyReadonly<Record<string, Surface>>--
rides?readonlyReadonly<Record<string, string>>--
transform?readonlyTransformMatrix-AncestorNode.transform

NodeBase

Defined in: bear/engine/types.ts:215

What collection decides about a node's identity.

Type Parameters

Type ParameterDefault type
PRecord<string, unknown>

Properties

PropertyModifierTypeDescription
assembliesreadonlyreadonly AssemblyFn<Record<string, unknown>>[]Assembly components whose expansion produced this node, innermost first. Assemblies are transparent (they create no nodes of their own), so this is how a node remembers which components it came from; q(Wall) matches against it.
authoredSegmentreadonlystringThe authored name before sibling FQN deduplication renamed it.
context?readonlyContextMapContext values provided by this node for descendant lookup. Set from the context prop during collection. Descendants call getContext(node, ctx) to walk the ancestor chain.
fqnreadonlystring-
kindreadonlyNodeKind-
model?readonlyModelViewThe model this node landed in, set when materialize() seals the converged tree. Graph hops from a bare node read its edges here. Absent on a tree that was only collected (a pass that did not converge, or collect() called directly).
propsreadonlyReadonly<P>-
relationDeclsreadonlyreadonly RelationDecl[]Relation declarations this element authored, landed at collect and resolved into the model's edges at the end of the pass.
rides?readonlyReadonly<Record<string, string>>The solvable anchor each of this node's refs rides, by ref key, when it is not the enclosing solvable's first anchor: a span's end plane rides end. From the rides prop. A dim to a ref moves the anchor the ref rides.
sourcereadonlyreadonly SourceLocation[]Call sites that produced this node, innermost first: the node's own JSX expression, then each enclosing element on the collection path (assembly call sites included, even though assemblies create no nodes). Empty when the code was compiled without call-site emission.
typereadonlyPartDef<any>-

PartDef()

Defined in: bear/engine/types.ts:518

A part definition created by part().

The call signature exists for JSX compatibility — TypeScript requires JSX element types to be callable. At runtime, the JSX transform calls jsx(type, props) rather than type(props).

Extends

Type Parameters

Type ParameterDefault type
P extends objectRecord<string, unknown>
Roles extends stringstring
Refs extends stringstring
PartDef(props): BearElement<P>;

Defined in: bear/engine/types.ts:523

A part definition created by part().

The call signature exists for JSX compatibility — TypeScript requires JSX element types to be callable. At runtime, the JSX transform calls jsx(type, props) rather than type(props).

Parameters

ParameterType
propsP & ElementProps

Returns

BearElement<P>

Properties

PropertyTypeDescriptionInherited from
[BEAR_PART]true--
bom?BomDefBOM aggregation metadata. If omitted, defaults to { unit: "ea" }.PartSpec.bom
check?(roles, node) => readonly string[]Physical fit against the resolved roles, read in the same frame place gets. Each returned string becomes a warning on the node, so a connector that does not suit its members says so instead of rendering a plausible lie. Runs whether or not place did.PartSpec.check
columns?(node, geometry) => PartColumn[]Generate specification columns for the parts list.PartSpec.columns
connects?Record<Roles, ConnectRole>Connection roles: each key is a prop accepting a relation target, lowered through the role's registered relation spelling. Role props stay on the node (unlike global relation props), so Ref targets resolve when the node is collected. See ConnectRole in relations.ts.PartSpec.connects
divisionstringCSI MasterFormat division code (e.g. "06 16 00").PartSpec.division
drawing?(node) => DrawingHintsProvide drawing hints for 2D representation in architectural drawings.PartSpec.drawing
extents?(props, resolved) => BoxThe part's bounding box in its local frame, from its props alone (resolved holds the Surfaces its Ref props name).PartSpec.extents
geometry?(props, resolved, loaded?) => GeometryThe part's solid and material, from its props and what load fetched. Defaults to the extents box, unshaded. Synchronous: the materialize that calls it owns every handle it makes.PartSpec.geometry
hosted?Hosted<P>A part that sits in a host: the faces it reads and the planes that pose it (mate.ts).PartSpec.hosted
kindNodeKind--
load?(props) => Promise<Manifold | undefined>Fetch the solid this part is made from (a cached mesh). Awaited for the converged tree before any geometry is built, so geometry can stay synchronous; resolves to a handle the caller owns.PartSpec.load
loadKey?(props) => stringWhat load reads from the props. Props with the same key are one shape: loaded once, shared between instances and kept across builds (shapes.ts). Without it every instance loads its own solid.PartSpec.loadKey
panelSize?(props) => readonly [number, number]Stock face dimensions in project units (U, V), before clipping to a placement.PartSpec.panelSize
place?(roles, node) => TransformMatrixDerive the part's pose in its parent frame from its resolved connection roles (given in that same frame). Runs when the part is collected and nothing authored a transform; a throw becomes a diagnostic.PartSpec.place
planes?(props, resolved) => Readonly<Record<Refs, Surface>>The named reference planes a geometry part publishes, in its local frame, keyed by the names in refs (a hanger's seat, a tee's ports). The six box faces need no entry.PartSpec.planes
refs?readonly Refs[]Named refs this part publishes (e.g. ["top"], ["ext", "int"]).PartSpec.refs

PartSpec

Defined in: bear/engine/types.ts:430

What a part definition declares, defined once: PartDef is a built one and part()'s PartDefInput is the authoring shape, both extending this.

Everything a part knows about itself is a function of its props. extents is the one the engine consumes (default reference faces, assembly spans, connector roles); geometry is for consumers that need a solid.

Roles and Refs are the part's interface contract, stated in its type: a PartDef<P, "header" | "joist", "seat"> is a part whose connects has exactly those roles, whose place/check read exactly those roles, and whose planes publishes exactly those names. An assembly can then demand the contract rather than the vendor (see JoistHangerPart in blueprints/connectors/types.ts), and a part missing a role is a compile error at the site that builds it.

Extended by

Type Parameters

Type ParameterDefault type
PRecord<string, unknown>
Roles extends stringstring
Refs extends stringstring

Properties

PropertyTypeDescription
bom?BomDefBOM aggregation metadata. If omitted, defaults to { unit: "ea" }.
check?(roles, node) => readonly string[]Physical fit against the resolved roles, read in the same frame place gets. Each returned string becomes a warning on the node, so a connector that does not suit its members says so instead of rendering a plausible lie. Runs whether or not place did.
columns?(node, geometry) => PartColumn[]Generate specification columns for the parts list.
connects?Record<Roles, ConnectRole>Connection roles: each key is a prop accepting a relation target, lowered through the role's registered relation spelling. Role props stay on the node (unlike global relation props), so Ref targets resolve when the node is collected. See ConnectRole in relations.ts.
divisionstringCSI MasterFormat division code (e.g. "06 16 00").
drawing?(node) => DrawingHintsProvide drawing hints for 2D representation in architectural drawings.
extents?(props, resolved) => BoxThe part's bounding box in its local frame, from its props alone (resolved holds the Surfaces its Ref props name).
geometry?(props, resolved, loaded?) => GeometryThe part's solid and material, from its props and what load fetched. Defaults to the extents box, unshaded. Synchronous: the materialize that calls it owns every handle it makes.
hosted?Hosted<P>A part that sits in a host: the faces it reads and the planes that pose it (mate.ts).
load?(props) => Promise<Manifold | undefined>Fetch the solid this part is made from (a cached mesh). Awaited for the converged tree before any geometry is built, so geometry can stay synchronous; resolves to a handle the caller owns.
loadKey?(props) => stringWhat load reads from the props. Props with the same key are one shape: loaded once, shared between instances and kept across builds (shapes.ts). Without it every instance loads its own solid.
panelSize?(props) => readonly [number, number]Stock face dimensions in project units (U, V), before clipping to a placement.
place?(roles, node) => TransformMatrixDerive the part's pose in its parent frame from its resolved connection roles (given in that same frame). Runs when the part is collected and nothing authored a transform; a throw becomes a diagnostic.
planes?(props, resolved) => Readonly<Record<Refs, Surface>>The named reference planes a geometry part publishes, in its local frame, keyed by the names in refs (a hanger's seat, a tee's ports). The six box faces need no entry.
refs?readonly Refs[]Named refs this part publishes (e.g. ["top"], ["ext", "int"]).

SourceLocation

Defined in: bear/engine/types.ts:208

A JSX call site, injected by the compiler's dev JSX transform. Line and column are 1-based, in the original (pre-compile) source.

Properties

PropertyType
columnNumbernumber
fileNamestring
lineNumbernumber

Type Aliases

AssemblyFn

type AssemblyFn<P> = (props) => BearElement;

Defined in: bear/engine/types.ts:532

An assembly function — like React's FC<P>. Generic over props; defaults to Record<string, unknown>.

Type Parameters

Type ParameterDefault type
PRecord<string, unknown>

Parameters

ParameterType
propsP

Returns

BearElement


ContextMap

type ContextMap = Map<symbol, unknown>;

Defined in: bear/engine/types.ts:19

A map of context values keyed by unique symbols from BearContext objects.


ErasedProps

type ErasedProps = Readonly<Record<string, unknown>> & ElementProps;

Defined in: bear/engine/types.ts:565

Props with the part's own erased: the bag the engine's phases iterate.


NodeKind

type NodeKind = "geometry" | "assembly" | "construction";

Defined in: bear/engine/types.ts:192

Discriminant for node types.


Ref

type Ref = object;

Defined in: bear/engine/types.ts:65

A lightweight pointer to a named reference plane on another element. Faces are the common kind of ref; centerlines and other construction planes use the same mechanism. Resolved during collection.

Properties

PropertyModifierType
[BEAR_REF]readonlytrue
keyreadonlystring
sourcereadonlyBearElement

ResolvedRefs

type ResolvedRefs = Readonly<Record<string, Surface>>;

Defined in: bear/engine/types.ts:307

Prop keys whose JSX value was a Ref, resolved to Surfaces in the node's parent frame when collected. Props themselves are frozen and never mutated; consumers read resolved values from here.


TextureRef

type TextureRef = 
  | {
  filename: string;
  source: "bucket";
}
  | {
  options?: ImageTransformOptions;
  source: "project";
  uri: string;
};

Defined in: bear/engine/types.ts:25

Texture reference — a lightweight pointer to a texture asset. Actual loading is deferred to the 3D consumer.


TreeNode

type TreeNode<P> = 
  | GeometryNode<P>
  | AssemblyNode<P>
| ConstructionNode<P>;

Defined in: bear/engine/types.ts:357

A node of the model: geometry, assembly, or construction.

Type Parameters

Type ParameterDefault type
PRecord<string, unknown>

Variables

BEAR_PART

const BEAR_PART: typeof BEAR_PART;

Defined in: bear/engine/types.ts:45

Marker symbol for part defs.


BEAR_REF

const BEAR_REF: typeof BEAR_REF;

Defined in: bear/engine/types.ts:58

Marker symbol for references.


EQ_GROUP

const EQ_GROUP: typeof EQ_GROUP;

Defined in: bear/engine/types.ts:96

Marker symbol for eq-group tokens.

Functions

elementProps()

function elementProps(element): ErasedProps;

Defined in: bear/engine/types.ts:568

An element's props, erased.

Parameters

ParameterType
elementBearElement

Returns

ErasedProps


getRef()

function getRef(element, key): Ref;

Defined in: bear/engine/types.ts:81

Extract a named Ref from an element.

Parameters

ParameterType
elementBearElement
keystring

Returns

Ref


isAssemblyNode()

function isAssemblyNode<N>(node): node is N & { kind: "assembly" };

Defined in: bear/engine/types.ts:374

Narrow a node to its assembly variant.

Type Parameters

Type Parameter
N extends object

Parameters

ParameterType
nodeN

Returns

node is N & { kind: "assembly" }


isConstructionNode()

function isConstructionNode<N>(node): node is N & { kind: "construction" };

Defined in: bear/engine/types.ts:381

Narrow a node to its construction variant.

Type Parameters

Type Parameter
N extends object

Parameters

ParameterType
nodeN

Returns

node is N & { kind: "construction" }


isEqGroup()

function isEqGroup(value): value is EqGroup;

Defined in: bear/engine/types.ts:107

Parameters

ParameterType
valueunknown

Returns

value is EqGroup


isGeometryNode()

function isGeometryNode<N>(node): node is N & { kind: "geometry" };

Defined in: bear/engine/types.ts:367

Narrow a node to its geometry variant.

Type Parameters

Type Parameter
N extends object

Parameters

ParameterType
nodeN

Returns

node is N & { kind: "geometry" }


isPartDef()

function isPartDef(type): type is PartDef<Record<string, unknown>, string, string>;

Defined in: bear/engine/types.ts:48

Narrow an element type to a PartDef (vs assembly function / host element).

Parameters

ParameterType
typeunknown

Returns

type is PartDef<Record<string, unknown>, string, string>


isRef()

function isRef(value): value is Ref;

Defined in: bear/engine/types.ts:71

Parameters

ParameterType
valueunknown

Returns

value is Ref


resolvedSurface()

function resolvedSurface(node, key): Surface | undefined;

Defined in: bear/engine/types.ts:120

Read a prop that may be authored as a Ref (resolved during collection into node.resolved) or directly as a Surface. Returns undefined when neither.

Parameters

ParameterType
node{ props: object; resolved?: Readonly<Record<string, Surface>>; }
node.propsobject
node.resolved?Readonly<Record<string, Surface>>
keystring

Returns

Surface | undefined


segmentOf()

function segmentOf(node): string;

Defined in: bear/engine/types.ts:270

A node's FQN segment, after sibling deduplication renamed it (J@16-2). A segment may itself contain dots (Wall.001 from an IFC import, J@70.5 from a position label), so it comes off the parent's FQN: splitting an FQN on "." reports 5 for J@70.5.

Parameters

ParameterType
node{ fqn: string; parent: | { fqn: string; } | null; }
node.fqnstring
node.parent| { fqn: string; } | null

Returns

string


walkNodes()

function walkNodes<N>(node, visit): void;

Defined in: bear/engine/types.ts:388

Depth-first pre-order walk over a node tree.

Type Parameters

Type Parameter
N extends object

Parameters

ParameterType
nodeN
visit(node) => void

Returns

void

On this page