/** * Connectors of a composed page's decoration (#1056, DESIGN §12.3): the * lines of a tree diagram, an org chart, a timeline, a flow chart, laid * between the final boxes of the frames they join and painted as a * `VDTDesignPathBlock`. * * Pure geometry: the boxes come in (sheet px), the outline and the end * marks go out. Routing: * - `straight`: one segment from end to end; * - `elbow`: across, along, across again between two sides that face the * same way or each other (the middle run `trunk` of the way), an L * between a side and one across it; * - `tree`: a trunk from the parent (`from`) to a bar `trunk` of the way to * the nearest child, the bar over the children's points (and the * parent's when it stands outside them), one drop to each child; a child * whose point is on the bar's line has none. * A bend is rounded by `radius` (a quarter circle as a cubic), held to what * the segments beside it leave. */ import type { ConnectorEnd, Dimension, LineCap, ResolvedDesignConnectorElement } from '../types.js'; import type { VDTPathCommand, VDTPathMarker } from '../vdt.js'; import type { ResolvedPathPrimitive } from './layout.js'; export interface ConnectorRect { x: number; y: number; width: number; height: number; } type Side = 'top' | 'bottom' | 'left' | 'right'; /** Line width of a connector that sets none: 0.75 pt. */ export declare const DEFAULT_CONNECTOR_WIDTH: Dimension; /** A cap's size against the line width when `capSize` is not set. */ export declare const DEFAULT_CAP_SIZE_PER_WIDTH = 3; export declare const CONNECTOR_ROUTINGS: readonly ["straight", "elbow", "tree"]; export declare const CONNECTOR_CAPS: readonly ["none", "dot", "arrow", "ring", "bar"]; export declare const CONNECTOR_SIDES: readonly ["top", "bottom", "left", "right", "start", "end"]; /** How a label's leader runs (#1057). */ export declare const LEADER_ROUTINGS: readonly ["straight", "elbow"]; /** An opacity as written (#1079): a finite number held in 0…1, else * undefined (opaque). */ export declare function opacityOf(v: unknown): number | undefined; /** The side of `a` that faces `b`: the axis with the wider clear gap * between the two (a tie goes to the vertical one), else, for boxes that * overlap on both axes, the axis their centres are further apart on. */ export declare function facingSide(a: ConnectorRect, b: ConnectorRect): Side; export interface Pt { x: number; y: number; } /** The commands of a polyline, each bend rounded by `radius` (held to half * a segment between two bends, the whole of an end segment). */ export declare function polylineCommands(points: readonly Pt[], radius: number): VDTPathCommand[]; /** An end of a polyline marked with a cap: the mark, and the line pulled * back inside an arrowhead, to a ring's edge, to a bar (see * {@link capInset}). `which`: 0 the first point, 1 the last. `widthPx`: * the line's width, the stroke of a ring or a bar. */ export declare function capEnd(points: Pt[], which: 0 | 1, cap: LineCap, size: number, color: string, marks: VDTPathMarker[], widthPx?: number): void; /** One end ready to be laid: its box and what it asks of the side. */ export interface ConnectorEndBox { name: string; box: ConnectorRect; end: ConnectorEnd; } export interface ConnectorLayoutOptions { dpi: number; /** The page's lines start on the right (`start` / `end` sides, `at` along * a horizontal side). */ startRight: boolean; } /** Whether a connector is painted over the frames (#1076): its `over` * when it is a boolean, else whether an end as written (`from`, any `to`) * names a picture's `anchor`, a point inside a frame that would cover a * line painted under it. Read from the element, not from the ends the * page keeps, so a dropped end does not change the layer. */ export declare function connectorPaintsOver(el: Pick): boolean; /** The outline and marks of `el` between `from` and `to` (every end that * the page has, in order), or undefined when nothing is left to draw. */ export declare function layoutConnector(el: ResolvedDesignConnectorElement, from: ConnectorEndBox, to: readonly ConnectorEndBox[], opts: ConnectorLayoutOptions): ResolvedPathPrimitive | undefined; export {}; //# sourceMappingURL=connector.d.ts.map