Files

3.5 KiB

Fixed spacing

Spacing belongs to the selected template and shared component recipe. For faithful reconstruction of an approved mockup, C27's controlled adjustments allow the project to declare revised content-area spacing in a project-owned shared style/recipe. Its values remain fixed within the affected type/variant and scope. Content callers provide content and whole-container bounds/placement; they do not choose gap values, padding, checking thresholds or one-off variants. If content does not fit, reflow it, choose another supported whole layout/capacity policy or revise the shared recipe under C27, then check container and page overflow. Do not tighten or loosen spacing separately for an instance.

The external style declares spacing.policy: "fixed", caller_overrides: false and named roles. Each role has a kind (gap or padding) and a path array pointing to its authoritative numeric value in the same style. Values stay external; the generic Skill does not prescribe a template's palette, geometry or organization. A role can point to an existing component field, so values are not duplicated. Padding may be a scalar, [vertical,horizontal] or [top,right,bottom,left].

The template owner supplies the default role names and values; the active shared recipe fixes which roles apply to each relationship. Under C27, put revised values in a declared project-owned recipe/style input consumed by the builder, with explicit units and regular integer/fixed-step values, rather than editing the locked template or injecting caller overrides. Rebuild and inspect all affected instances for actual container/page overflow. Project-local adjustments do not modify the published template. A shared template-owner change is a versioned template/recipe change and triggers affected validation. An older template without the spacing section can use supported fixed bindings to its existing fields; absent fields are reported, never filled with guessed numeric defaults.

resolve_spacing(style, role) returns the declared scalar or normalized four-sided padding. check_spacing(boxes, checks, *, style) accepts only roles:

checks = [
    {"id": "body-gap", "kind": "gap", "a": "heading", "b": "body",
     "axis": "y", "role": "heading_body"},
    {"id": "padding", "kind": "padding", "outer": "frame", "inner": "usable",
     "role": "text_padding"},
]
issues = check_spacing(boxes, checks, style=style)

The checker rejects caller-supplied minimum, expected or override numbers. Both too-small and too-large distances violate a fixed relationship. A padding relationship compares the full usable inner rectangle against its outer frame; it does not require text to occupy every pixel or fill the bottom of a container. Line-height slots and content height remain derived from complete text.

text_block.py automatically records and checks its fixed text padding and paragraph gaps in spacing_contract. Callers cannot alter those values through content data. The same rules apply after a content/width change and to every instance of the type/variant.

The checker measures the active style's declared layout geometry and does not load a project override automatically. Actual glyph ink, optical clearances, clipping, mathematical layout and decorative contacts still require the current render. A declared shared adjustment still needs the two-level overflow review; changing a value merely to disguise a font/layout failure or box equality does not establish visual acceptance.