Skip to content

resolveBox

Read as Markdown

import { resolveBox, type Constraints } from "@pibbl/core";

resolveBox(style, constraints, context?) resolves public BoxStyle into a ResolvedBoxStyle with border and content boxes. It applies min/max lengths, padding, and finite constraint validation, and raises LayoutDiagnostic for impossible or indefinite inputs.

const constraints: Constraints = {
minWidth: 0,
maxWidth: 320,
minHeight: 0,
maxHeight: 240,
};
const box = resolveBox({ width: "50%", padding: 12 }, constraints);

It accepts Constraints and is a public layout helper, not a retained layout engine.

Resolves declared box sizing and padding into border and content boxes under parent constraints.

resolveBox: (style: Readonly<BoxStyle>, constraints: Readonly<Constraints>, context?: Readonly<LayoutDiagnosticContext>) => ResolvedBoxStyle

Related API: resolveBox, BoxStyle, Constraints, LayoutDiagnosticContext, ResolvedBoxStyle.

  • style — Declared box sizing and edge properties. See BoxStyle.

  • constraints — Available dimensions used to resolve percentages and constraints. See Constraints .

  • context — Component and property context for diagnostic messages. See LayoutDiagnosticContext .

Resolved box dimensions and edge values. See ResolvedBoxStyle.

BoxStyle

Constraints

LayoutDiagnosticContext

ResolvedBoxStyle

View source — packages/core/src/lib/layout/box.ts:25

Read the Authoring, signals, and lifecycle companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.