/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** The viewport edge an out-of-view endpoint lies beyond. */ export type RibbonOff = "above" | "below"; /** Width of the dashed slot an end past the window lands in (px). */ export declare const RIBBON_SLOT_W = 40; /** The dashed slot at a window edge an off-window end lands in — as tall as * its element draws, {@link RIBBON_SLOT_W} wide, open toward the edge. */ export interface RibbonEdgeSlot { /** The plot edge it opens onto. */ x: number; y: number; h: number; side: "left" | "right"; } /** One ribbon endpoint — the run bar's rect, in the rows' own px. */ export interface RibbonEnd { leftX: number; rightX: number; top: number; bottom: number; /** * Set when the endpoint's row is out of view: the rect sits at that * viewport edge (its `top` ON the top edge, or its `bottom` ON the bottom * edge) and the ribbon meets the edge with a stub pointing toward the row. */ off?: RibbonOff | undefined; /** Where the link meets the element, down the page: its port where links share the end (`ports.ts`); its centre line when left out. */ port?: number | undefined; /** * The row the element is on, from its top to its bottom, its rule * included: where a loopback into it runs its lane — on the rule on its * source-facing side. Left out, the lane runs halfway between the bars. */ row?: { readonly top: number; readonly bottom: number; } | undefined; } /** What a host that lays bands out for its links gives a route (`lanes.ts`). */ export interface RibbonRouteOptions { /** A loopback's lane, down the page: its track's centre in the band its rule opens into. */ readonly lane?: number | undefined; /** Where a one-row link's caption, or an S's, is centred down the page: its track's centre, or the band its riser crosses. */ readonly caption?: number | undefined; } /** * Which of the grammar's figures a link draws: the metro-`s`, the `loop`back, * a one-row `feed` or `runoff`, a `stub` toward an end out of view, or the * `band` across the view between two. */ export type RibbonRoute = "s" | "loop" | "feed" | "runoff" | "stub" | "band"; /** A routed link: centerline `stroke` (stroked at `width`, its weight), the * arrowheads, where its caption's text is centred, and the figure it draws. */ export interface RibbonPath { route: RibbonRoute; stroke: string; /** The arrowhead at the ribbon's end: into the destination's start, or — * the destination out of view — the stub pointing toward it. */ head: string; /** The stub where the ribbon enters the view — an arrowhead pointing * toward the out-of-view source; empty while the source is in view. */ tail: string; width: number; lx: number; ly: number; anchor: "start" | "middle" | "end"; } /** The corner every link turns at, before its clamp (px): what a line a host draws beside the links turns at too. */ export declare const RIBBON_CORNER = 8; /** * How far before its destination's start a forward link's riser stands with a * full corner: the head, the run-out into it and the corner (27px, `Allocation * Spec.md` §11) — where a line a host draws toward the same rows rises too. */ export declare const RIBBON_RISER: number; /** The plot's two edges, which nothing of a link crosses — not into the * gutter, the canvas's first column, nor past the plot's end. */ export interface RibbonBounds { left: number; right: number; } /** * A rounded orthogonal polyline as path data: straight runs between the * points, each corner turned at radius `r`, clamped to half of either run * beside it. Consecutive points share an x or a y; a point that turns * nothing is passed straight through. * * @param points - The polyline's points, in order * @param r - The corner radius, before its clamp * @returns The path data */ export declare function rounded(points: readonly (readonly [number, number])[], r: number): string; /** * Route one link from the source run's END to the destination run's * BEGINNING — see the module doc for the case grammar. * * @param from - The source run's rect (out of view: at the edge it lies beyond) * @param to - The destination run's rect (the same) * @param weight - The link's weight: its stroke's width (`ribbonWeight`) * @param bounds - The plot's edges, which nothing of the link crosses; left out, none * @param options - Its planned lane and caption, where its host lays bands out for them; left out, the route's own * @returns The link's paths and caption anchor */ export declare function routeRibbon(from: RibbonEnd, to: RibbonEnd, weight: number, bounds?: RibbonBounds, options?: RibbonRouteOptions): RibbonPath; /** * Whether a link between two rows draws the metro-S: its destination starts * far enough past its source's end for a head, two run-outs and the least gap * (34px). Else it is a loopback. What a host that plans its links' lanes asks * before it routes them (`lanes.ts`). * * @param sourceEnd - The source's end, across the page * @param destinationStart - The destination's start, across the page * @returns Whether it is an S */ export declare function ribbonForward(sourceEnd: number, destinationStart: number): boolean; /** * Where a loopback's two risers stand across the page, at their full corner: * its exit's, past the source's end, and its entry's, before the destination's * start. Its lane runs between them — what a band's tracks are ordered by, so * no riser crosses another link's lane (`lanes.ts`). * * @param sourceEnd - The source's end, across the page * @param destinationStart - The destination's start, across the page * @returns The two risers' x */ export declare function loopRisers(sourceEnd: number, destinationStart: number): { exit: number; entry: number; }; //# sourceMappingURL=geometry.d.ts.map