LayoutDiagnostic and layoutDiagnostic
import { LayoutDiagnostic, layoutDiagnostic } from "@pibbl/core";LayoutDiagnostic is the runtime error class for contextual layout failures.
layoutDiagnostic(input) constructs the same error. Both expose component,
property, supplied value, algorithm, and optional constraints, preserving a
useful diagnostic when public geometry or style validation fails.
throw layoutDiagnostic({ property: "width", value: -1, reason: "must be nonnegative",});Its LayoutDiagnosticInput and LayoutDiagnosticContext types belong to the Layout type reference.
API details from source
Section titled “API details from source”
LayoutDiagnostic
Section titled “LayoutDiagnostic”A layout validation error carrying the affected property and component context.
class LayoutDiagnostic extends ErrorRelated API: LayoutDiagnostic.
See also
Section titled “See also”View source — packages/core/src/lib/style/diagnostics.ts:51
Properties and methods
Section titled “Properties and methods”
component
readonly component: stringComponent identity or diagnostic name associated with this value. See LayoutDiagnostic .
property
readonly property: stringName of the affected input property. See LayoutDiagnostic.
suppliedValue
readonly suppliedValue: unknownThe original value that failed validation. See LayoutDiagnostic.
algorithm
readonly algorithm: stringName of the layout algorithm producing this diagnostic or resolution. See LayoutDiagnostic.
constraints
readonly constraints: Readonly<Constraints> | undefinedRelated API: Constraints.
Sizing limits and available dimensions for this operation. See Constraints.
layoutDiagnostic
Section titled “layoutDiagnostic”Creates a structured layout error from a validation failure and its component context.
layoutDiagnostic: (input: LayoutDiagnosticInput) => LayoutDiagnosticRelated API: layoutDiagnostic, LayoutDiagnosticInput, LayoutDiagnostic.
Parameters
Section titled “Parameters”input— Diagnostic code, message, property, and layout context. See LayoutDiagnosticInput .
Returns
Section titled “Returns”A structured layout diagnostic. See LayoutDiagnostic.
See also
Section titled “See also”View source — packages/core/src/lib/style/diagnostics.ts:102
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Drawing, layout, and effects companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Box resolution: Resolve padding, percentages, and a constrained box with typed diagnostics. Plain source
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.