import { BrandContext, ContentItem, ContentType, StyleProps } from '../schema/index.ts'; import { Strings } from './i18n'; /** * Styling in this builder is per *kind*, not per item: one heading's color is * every heading's color. There's no per-item override anywhere in the UI, so an * author who styles the field they clicked is styling all of its siblings too, * and the form stays coherent by construction. * * The groups below are the units that carry a style. They're written into each * matching item's `styleProps` (the renderer only ever reads per-item values), * which is why a group edit fans out across the form's items. */ export interface StyleGroup { id: 'heading' | 'text' | 'submit' | 'input'; /** Every type one swatch writes to. */ types: ContentType[]; /** Only the controls the renderer actually honors for this group. */ controls: { size?: boolean; /** A separate size for the placeholder — only fields have one. */ placeholderSize?: boolean; color?: boolean; background?: boolean; align?: boolean; width?: boolean; }; /** Shown when the value is unset — i.e. what the renderer falls back to. */ sizePlaceholder: string; colorPlaceholder: string; bgPlaceholder?: string; /** Percent shown when the width is unset, i.e. the layout's own default. */ widthPlaceholder?: string; /** The group's name, resolved late so it follows the builder language. */ title: (t: Strings) => string; } /** * The style groups, in the order the Design tab lists them. `brand` only feeds * the submit button's placeholders: clearing its fill falls back to the * business's primary color when the host passed one, and to black otherwise. */ export declare function styleGroups(brand: BrandContext): StyleGroup[]; /** * The group a single item belongs to, for the design controls shown next to its * settings. `spacer` and `hidden` paint nothing, and an `html` block carries its * own styling in the markup, so none of them has a group and the design block is * left out for them. */ export declare function styleGroupFor(type: ContentType, brand: BrandContext): StyleGroup | undefined; /** Writes `patch` into every item of `types` — this is the fan-out. */ export declare function applyStyle(items: ContentItem[], types: ContentType[], patch: Partial): ContentItem[]; /** * Reads a group's value back for the controls: the first matching item that has * one set. They're written together, so any one of them speaks for the group. */ export declare function readStyle(items: ContentItem[], types: ContentType[], key: K): StyleProps[K] | undefined; /** * The style a new item should arrive wearing: whatever its kind already wears * on this form. * * A group's style is not stored anywhere on the form — it lives fanned out * across the items it applies to, which is fine for every item that was there * when the control was touched and nothing at all for the next one added. A * field dropped in after the design was set came out at the renderer's defaults * beside its identically-typed neighbours, and the author had to go and set the * same numbers over again. * * Only the controls the group actually offers are carried over, so a value the * panel can no longer set (an older form's field width) stays where it is * instead of being copied onto everything added from here on. */ export declare function styleForNewItem(items: ContentItem[], type: ContentType): StyleProps | undefined;