Intrinsic sizing contracts
Typecheck paired intrinsic sizes, baseline results, and fit-content sizing values.
APIs demonstrated
Section titled “APIs demonstrated”- fitContent from
@pibbl/core - BaselineMeasureInput from
@pibbl/core - BaselinesResult from
@pibbl/core - FitContent from
@pibbl/core - FlexMargin from
@pibbl/core - IntrinsicAxisConstraints from
@pibbl/core - IntrinsicConstraints from
@pibbl/core - IntrinsicMeasureInput from
@pibbl/core - IntrinsicSizesResult from
@pibbl/core - SizingKeyword from
@pibbl/core - SizingLength from
@pibbl/core
Complete example
Section titled “Complete example”Plain source. This example demonstrates a type-level or host-specific contract; it is checked with TypeScript rather than presented as an animated preview.
import { fitContent, type BaselineMeasureInput, type BaselinesResult, type FitContent, type FlexMargin, type IntrinsicAxisConstraints, type IntrinsicConstraints, type IntrinsicMeasureInput, type IntrinsicSizesResult, type SizingKeyword, type SizingLength, type SystemStyle,} from "@pibbl/core";
const width: IntrinsicAxisConstraints = { kind: "bounded", min: 0, max: 240 };const constraints: IntrinsicConstraints = { width, height: { kind: "unbounded", min: 0 },};const bound: FitContent = fitContent(120);const keyword: SizingKeyword = "max-content";const length: SizingLength = bound;const margin: FlexMargin = "auto";const intrinsic: IntrinsicSizesResult = { status: "measured", minContent: { width: 40, height: 18 }, maxContent: { width: 120, height: 18 },};const baselines: BaselinesResult = { status: "measured", first: 14, last: 14 };type TextIntrinsicInput = IntrinsicMeasureInput<{ text: string }, SystemStyle>;type TextBaselineInput = BaselineMeasureInput<{ text: string }, SystemStyle>;const summary: [ IntrinsicConstraints, SizingKeyword, SizingLength, FlexMargin, IntrinsicSizesResult, BaselinesResult,] = [constraints, keyword, length, margin, intrinsic, baselines];void (summary as unknown as TextIntrinsicInput | TextBaselineInput);Usage notes
Section titled “Usage notes”- Uses the public intrinsic and sizing contracts without relying on runtime internals.
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision a1dcf8e. ALPHA — NOT FOR PRODUCTION USE.