import type * as Template from './serial-types'; import { DecomposedTransform } from '../util/layout.js'; /** * Builders that assemble complete Bluepic Serial element property-bags with * correct defaults (sourced from real serials). Geometry/paint come from the * IDML converter; everything else is filled so the output is render-ready. */ /** A fill/stroke paint: hex color (with alpha), a gradient, or none. */ export type Paint = string | Template.Elements.Gradient | null; /** Set the element's CSS mix-blend-mode (null/'normal' = no-op). */ export declare function applyBlendMode(element: Template.Element, mode: string | null): void; /** The object shape Bluepic's renderer expects for `filter.dropShadow` (see * bluepic-core SvgFilter): offset is polar — dx = sin(rotation°)·distance, * dy = cos(rotation°)·distance — with `blur` = stdDeviation, `color` a CSS * color, `opacity` 0..1, and `quality` a render hint. */ export type DropShadowValue = { rotation: number; distance: number; color: string; opacity: number; blur: number; quality: number; }; /** Set the drop-shadow filter on an already-built element (no-op when null). */ export declare function applyDropShadow(element: Template.Element, shadow: DropShadowValue | null): void; /** An identity serial transform — used to neutralise a child before its parent group * takes over the (frame) transform, so the transform is applied exactly once. */ export declare function identityTransform(): Template.Transform; /** * Add (dx, dy) to a built element's translate. Transform values are always * bare-number expression sources (see serialTransform/num), so they round-trip * through Number(). Used to bake a dissolved wrapper group's translation into * its children. */ export declare function shiftElementTranslate(element: Template.Element, dx: number, dy: number): void; export type Box = { x: number; y: number; width: number; height: number; }; export type SurfaceInput = { fill?: Paint; stroke?: Paint; strokeWidth?: number; strokeAlignment?: 'inside' | 'center' | 'outside'; radius?: [number, number, number, number]; opacity?: number; }; export declare function makeRectangle(id: string, box: Box, radius: [number, number, number, number], transform: DecomposedTransform, surface: SurfaceInput): Template.Elements.Rectangle; /** * A rectangle iterated once per line of a target text element — the "Bauchbinde" * highlight bar behind each line, reconstructed from InDesign's thick offset * underline. It binds to `.lines[i]` (exposed `{x, y, width, height}`), * so it tracks the text's wrap/line count live and, as a sibling under the same * (frame) group transform, rotates/scales with the text exactly as InDesign does. * * The bar's centre sits on `baseline + underlineOffset` (baseline = line top + * ascent) and its height = the underline weight. When the caller measured the font * ascent (`ascent` given), that's baked into a constant; without a canvas it falls * back to `0.8·lines[i].height` (the render-time font-bounding proportion). * * Horizontal: `pad` insets each side. When `leftAnchorX` is given (left-aligned text), * the bar's LEFT edge is pinned to that constant frame-left (minus pad) instead of the * per-line text start — so every line's bar shares one clean left edge, matching InDesign, * regardless of differing per-line font sizes/leading spaces. The right edge still tracks * the line's text end (+pad). When null (centre/right), the bar hugs the line box ±pad. */ export declare function makeLineBackgroundRectangle(id: string, targetTextId: string, opts: { fill: Paint; weight: number; offset: number; ascent: number | null; pad: number; leftAnchorX: number | null; }): Template.Elements.Rectangle; /** * InDesign paragraph shading (`ParagraphShadingOn`) — a fill drawn behind the WHOLE * paragraph, spanning the text frame's width from the first line's top to the last * line's bottom. Reconstructed as an iterated rectangle bound to `.lines[i]`: * one full-height tile per rendered line (contiguous line boxes tile into a solid * block), so it tracks the text's live wrap/line-count exactly like the Bauchbinde bar. * * Horizontal: static frame span (`box.x + leftOffset` .. width - left - right offsets), * matching InDesign's default column-width shading (not the per-line text width). * Vertical: each tile is the line's own box (`lines[i].y`, height `lines[i].height`); * `topOffset`/`bottomOffset` extend the FIRST/LAST tile beyond the line box (i===0 / * i===last), reproducing the Ascent/Descent origins' outset. */ export declare function makeParagraphShadingRectangle(id: string, targetTextId: string, box: { x: number; width: number; }, opts: { fill: Paint; topOffset: number; bottomOffset: number; leftOffset: number; rightOffset: number; }): Template.Elements.Rectangle; /** * InDesign paragraph rule (`RuleAbove`/`RuleBelow`) — a colored line above the FIRST line * or below the LAST line of a paragraph, spanning the column width. A single (non-iterated) * rectangle bound to the relevant line so it tracks the text's live position/line count. * * Vertical: relative to that line's baseline (`line.y + ascent`). Above sits with its bottom * at the baseline (top = baseline − offset − weight); below sits with its top at the baseline * (top = baseline + offset) — matching InDesign's default (offset 0) rule placement. */ export declare function makeParagraphRuleRectangle(id: string, targetTextId: string, box: { x: number; width: number; }, opts: { fill: Paint; weight: number; offset: number; ascent: number; position: 'above' | 'below'; }): Template.Elements.Rectangle; /** Circle/ellipse — radius accepts [rx, ry]. x/y is the bbox top-left (pos [0,0]). */ export declare function makeCircle(id: string, box: Box, transform: DecomposedTransform, surface: SurfaceInput): Template.Elements.Circle; export type PathFeature = { type: 'move'; x: number; y: number; } | { type: 'line'; x: number; y: number; } | { type: 'cubic-bezier'; c1x: number; c1y: number; c2x: number; c2y: number; x: number; y: number; } | { type: 'close'; }; export declare function makePath(id: string, features: PathFeature[], transform: DecomposedTransform, surface: SurfaceInput): Template.Elements.Path; export type SerialImageValue = { src: string; crop: { top: number; left: number; width: number; height: number; } | null; cropMode: 'cover' | 'contain' | 'stretch'; innerAlign: string; mirrorX: boolean; mirrorY: boolean; innerRotate: number; /** Pixel size the `crop` is expressed in (the asset's intrinsic size at convert time). * Lets a consumer that resizes the asset rescale the crop by finalSize/natural. The * renderer ignores these; an editor interaction (ensureImageValue) drops them. */ naturalWidth?: number; naturalHeight?: number; }; export declare function makeImage(id: string, box: Box, radius: [number, number, number, number], image: SerialImageValue, transform: DecomposedTransform, surface: SurfaceInput): Template.Elements.Image; export type RichTextRun = { text: string; format: Record; }; /** The core line-box models a Text element's `bounding` may select. */ export type TextBounding = 'font' | 'actual' | 'actual-outer' | 'fontSize'; export type TextInput = { box: Box; textMode: 'plaintext' | 'richtext'; text: string; richText: RichTextRun[]; fontFamily: string; fontSize: number; fontWeight: number; fontStyle: string; lineHeight: number; letterSpacing: number; textAlign: number; justifyText: boolean; verticalAlign: number; uppercase?: boolean; textDecoration?: string; hyphenate?: boolean; hyphenationLanguage?: string; horizontalScale?: number; bounding?: TextBounding; autoLinebreaks: boolean; fill: Paint; stroke?: Paint; strokeWidth?: number; opacity?: number; }; export declare function makeText(id: string, input: TextInput, transform: DecomposedTransform): Template.Elements.Text; export declare function makeGroup(id: string, children: Template.Element[], transform: DecomposedTransform, opacity?: number): Template.Elements.Group; export declare function makeMask(id: string, content: Template.Element[], maskShapes: Template.Element[], transform: DecomposedTransform, opacity?: number, surface?: SurfaceInput, surfaceRegion?: 'bbox' | 'shape'): Template.Elements.Mask; /** An empty render-ready Serial of the given canvas size. */ export declare function emptySerial(width: number, height: number, context: Template.Element[], fonts?: Template.Font[]): Template.Serial; //# sourceMappingURL=builders.d.ts.map