export type WidgetSize = 'small' | 'medium' | 'large' | 'full'; /** A widget to place: either a bare ID (defaults to medium) or an ID with an explicit size. */ export type AutoLayoutItem = string | { id: string; size?: WidgetSize; }; export declare function heightForWidget(widget: { type?: string; config?: { settings?: { markdown?: { text?: string; }; }; }; }): number; export interface LayoutEntry { i: string; x: number; y: number; w: number; h: number; moved: boolean; static: boolean; } export interface Layouts { xs: LayoutEntry[]; sm: LayoutEntry[]; md: LayoutEntry[]; lg: LayoutEntry[]; xl: LayoutEntry[]; } /** Compute all five breakpoints from an ordered widget list. */ export declare function computeAutoLayout(items: AutoLayoutItem[], /** Rows per widget id, from `heightForWidget`. Anything unlisted keeps the default height. */ heights?: Record): Layouts; /** The five responsive breakpoints the API requires, every one as a non-null array. */ export declare const BREAKPOINTS: readonly ["xs", "sm", "md", "lg", "xl"]; export type Breakpoint = (typeof BREAKPOINTS)[number]; /** * Place the widgets that no breakpoint entry covers, below the ones that are already placed. * * A board's layout is replaced wholesale on write, so filling one in means carrying every existing * entry through untouched and appending to it. Nothing already placed is moved, resized or removed: * appending below the lowest occupied row is what a person adding a widget to their own board would * do, which is what makes this safe to run against a board somebody laid out by hand. * * Missing widgets are placed per breakpoint, since a board can be laid out at one breakpoint and not * another, and the appended set is the union — a widget with a place at every breakpoint is left * entirely alone. */ export declare function appendMissingLayouts(existing: Record | undefined, widgetIds: string[], /** Rows per widget id, from `heightForWidget`. Anything unlisted keeps the default height. */ heights?: Record): { layouts: Layouts; appended: string[]; }; /** * Is the board's layout nothing but this module's own arithmetic? * * Appending is safe but ugly: a widget that arrives alone has nothing to share a row with, so a * board built one create at a time comes out a single-column stack (measured on a live 3-widget * board). Re-packing it would fix that, and re-packing a layout somebody arranged would destroy * their work — so the two cases have to be told apart, and no board records who placed what. * * What is recoverable is whether the layout could have come from here: `computeAutoLayout` is * deterministic from the widget order and the heights, so the layout the server would have produced * for the widgets currently placed can be recomputed and compared. An exact match means nobody has * arranged anything and the grid is the server's to replace; one differing coordinate means a person * or an agent chose something, and appending is the only safe move. * * A `static` or `moved` flag set true is human evidence of the same kind — this module only ever * writes them false, so a true one came from somebody dragging or pinning the widget. * * Each breakpoint is judged on its own placed set, since a board can be arranged at one breakpoint * and untouched at another; an empty breakpoint is trivially owned. */ export declare function isServerOwnedLayout(existing: Record | undefined, widgetIds: string[], /** Rows per widget id, from `heightForWidget`. Anything unlisted keeps the default height. */ heights?: Record): boolean; interface GridRect { i: string; x: number; y: number; w: number; h: number; } /** * Widgets that sit on top of each other in the grid, at any breakpoint. * * Hand-packed `layouts` are easy to get wrong and the API accepts any arrangement, so two widgets * can occupy the same cells and one is drawn over the other. `autoLayout` cannot produce this; * a hand-built or imported board can. * * Every breakpoint provided is scanned, not just `lg`: each one is an independent arrangement, and * a collision on the phone layout is exactly as invisible to the caller as one on the desktop * layout. A pair that collides at several breakpoints is one mistake and is reported once — the * caller fixes the pair, not the breakpoint. */ export declare function overlappingWidgets(layouts: Partial> | undefined): string[][]; export {}; //# sourceMappingURL=dashboard-layout.d.ts.map