Skip to Content
Bear documentation

model

Import from bear/engine/model.

Interfaces

ConstraintReport

Defined in: bear/engine/model.ts:50

What every solver constraint reports, whatever stated it: one shape, so printConstraints prints a new constraint source without a case for it. Solve describes each constraint the way its author would write it.

Extended by

Properties

PropertyModifierTypeDescription
derived?readonlybooleanTrue when value was filled in by solve rather than authored.
eq?readonlyEqGroup-
labelreadonlystring"@A → W.start along x", "J1.start on H1.seat along y".
max?readonlynumber-
measured?readonlynumber-
min?readonlynumber-
nodereadonlyTreeNode-
priorityreadonlyDimPriority-
value?readonlynumberThe stated value: a dim's, or 0 for the gap between an anchor and its plane.

Model

Defined in: bear/engine/model.ts:37

The materializer's owning handle. Consumers only need ModelView.

Extends

Properties

PropertyModifierTypeDescriptionInherited from
constraintsreadonlyreadonly ResolvedConstraint[]Every constraint the solver saw, dims first, with its measured value.ModelView.constraints
diagnosticsreadonlyreadonly Diagnostic[]Findings from collection, relations and solve, at the fixed point only.ModelView.diagnostics
edgesreadonlyreadonly Edge[]The relationship edges, resolved against the finished tree.ModelView.edges
elementNodesreadonlyReadonlyMap<BearElement<object>, TreeNode>The collected identity of JSX handles, including transparent assemblies.ModelView.elementNodes
geometryreadonlyReadonlyMap<TreeNode, Geometry>Every geometry part's solid, built once after convergence. See geometryOf.ModelView.geometry
passesreadonlynumberHow many collect → solve passes the fixed point took.ModelView.passes
treereadonlyTreeNode-ModelView.tree

Methods

dispose()
dispose(): void;

Defined in: bear/engine/model.ts:42

Free the solids in geometry. Whoever called materialize() owns the model and disposes it when done; the geometry is unusable afterward.

Returns

void


ModelView

Defined in: bear/engine/model.ts:20

What materialize() returns: the tree plus every fact about it that is not a property of one node. Consumers reach into it through functions that take the result (q(result), treeToScene(result), printTree(result), printConstraints(result), logDiagnostics(result)), so the shape here is a contract with those functions, not with model code.

Extended by

Properties

PropertyModifierTypeDescription
constraintsreadonlyreadonly ResolvedConstraint[]Every constraint the solver saw, dims first, with its measured value.
diagnosticsreadonlyreadonly Diagnostic[]Findings from collection, relations and solve, at the fixed point only.
edgesreadonlyreadonly Edge[]The relationship edges, resolved against the finished tree.
elementNodesreadonlyReadonlyMap<BearElement<object>, TreeNode>The collected identity of JSX handles, including transparent assemblies.
geometryreadonlyReadonlyMap<TreeNode, Geometry>Every geometry part's solid, built once after convergence. See geometryOf.
passesreadonlynumberHow many collect → solve passes the fixed point took.
treereadonlyTreeNode-

ResolvedAttachment

Defined in: bear/engine/model.ts:75

One plane of an attachment (Lowerer.attach): the anchor's gap to it.

Extends

Properties

PropertyModifierTypeDescriptionInherited from
anchorreadonlystring--
derived?readonlybooleanTrue when value was filled in by solve rather than authored.ConstraintReport.derived
eq?readonlyEqGroup-ConstraintReport.eq
kindreadonly"attachment"--
labelreadonlystring"@A → W.start along x", "J1.start on H1.seat along y".ConstraintReport.label
max?readonlynumber-ConstraintReport.max
measured?readonlynumber-ConstraintReport.measured
min?readonlynumber-ConstraintReport.min
nodereadonlyTreeNode-ConstraintReport.node
priorityreadonlyDimPriority-ConstraintReport.priority
targetreadonlystringThe target as the author named it ("H1.seat", "P1").-
value?readonlynumberThe stated value: a dim's, or 0 for the gap between an anchor and its plane.ConstraintReport.value

Type Aliases

ResolvedConstraint

type ResolvedConstraint = 
  | ResolvedDim
  | ResolvedAttachment;

Defined in: bear/engine/model.ts:82


ResolvedDim

type ResolvedDim = EffectiveDim & ConstraintReport & object;

Defined in: bear/engine/model.ts:66

A dim's effective intent together with the construction node that authored it.

Type Declaration

NameTypeDescription
fromPlane?WorldPlaneThe world plane each endpoint resolved to. Absent when it did not resolve.
kind"dim"-
toPlane?WorldPlane-

Functions

isModel()

function isModel(value): value is ModelView;

Defined in: bear/engine/model.ts:84

Parameters

ParameterType
valueunknown

Returns

value is ModelView

On this page