|
| 1 | +/** |
| 2 | + * The percentage of the maximum resize distance that will be clamped. |
| 3 | + * |
| 4 | + */ |
| 5 | +export declare const MINIMUM_REDISTRIBUTION_SIZE_THRESHOLD = 0.15; |
| 6 | +/** |
| 7 | + * Threshold from panel edge that is considered a split vs drop action. |
| 8 | + */ |
| 9 | +export declare const SPLIT_EDGE_TOLERANCE = 0.25; |
| 10 | +/** |
| 11 | + * Tolerance threshold for considering two grid track positions as identical. |
| 12 | + * |
| 13 | + * When collecting and deduplicating track positions, any positions closer than |
| 14 | + * this value are treated as the same position to avoid redundant grid tracks. |
| 15 | + */ |
| 16 | +export declare const GRID_TRACK_COLLAPSE_TOLERANCE = 0.001; |
| 17 | +/** |
| 18 | + * The overlay default behavior. |
| 19 | + */ |
| 20 | +export declare const OVERLAY_DEFAULT: OverlayMode; |
| 21 | +/** |
| 22 | + * The overlay behavior type. |
| 23 | + */ |
| 24 | +export type OverlayMode = "grid" | "absolute" | "interactive"; |
| 25 | +/** |
| 26 | + * The representation of a CSS grid, in JSON form. |
| 27 | + */ |
| 28 | +export type Layout = SplitLayout | TabLayout; |
| 29 | +/** |
| 30 | + * The orientation (of a `SplitPanel`). |
| 31 | + */ |
| 32 | +export type Orientation = "horizontal" | "vertical"; |
| 33 | +/** |
| 34 | + * A logical rectange in percent-coordinates (of a (1, 1) square). |
| 35 | + */ |
| 36 | +export interface ViewWindow { |
| 37 | + row_start: number; |
| 38 | + row_end: number; |
| 39 | + col_start: number; |
| 40 | + col_end: number; |
| 41 | +} |
| 42 | +/** |
| 43 | + * A split panel that divides space among multiple child layouts |
| 44 | + * . |
| 45 | + * Child panels are arranged either horizontally (side by side) or vertically |
| 46 | + * (stacked), via the `orientation` property `"horizzontal"` and `"vertical"` |
| 47 | + * (respectively). |
| 48 | + */ |
| 49 | +export interface SplitLayout { |
| 50 | + type: "split-panel"; |
| 51 | + children: Layout[]; |
| 52 | + sizes: number[]; |
| 53 | + orientation: Orientation; |
| 54 | +} |
| 55 | +/** |
| 56 | + * A leaf panel node that contains a single named child element. |
| 57 | + */ |
| 58 | +export interface TabLayout { |
| 59 | + type: "child-panel"; |
| 60 | + child: string[]; |
| 61 | + selected?: number; |
| 62 | +} |
| 63 | +/** |
| 64 | + * Represents a draggable divider between two panels in the layout. |
| 65 | + * |
| 66 | + * Used for hit detection. |
| 67 | + */ |
| 68 | +export interface LayoutDivider { |
| 69 | + path: number[]; |
| 70 | + view_window: ViewWindow; |
| 71 | + type: Orientation; |
| 72 | +} |
| 73 | +/** |
| 74 | + * Represents a panel location result from hit detection. |
| 75 | + * |
| 76 | + * Contains both the panel identifier and its grid position in relative units. |
| 77 | + * The generic parameter `T` allows DOM-only properties (e.g. `DOMRect`) to be |
| 78 | + * shared in this cross-platform module. |
| 79 | + */ |
| 80 | +export interface LayoutPath<T = undefined> { |
| 81 | + type: "layout-path"; |
| 82 | + slot: string; |
| 83 | + panel: TabLayout; |
| 84 | + path: number[]; |
| 85 | + view_window: ViewWindow; |
| 86 | + column_offset: number; |
| 87 | + row_offset: number; |
| 88 | + orientation: Orientation; |
| 89 | + is_edge: boolean; |
| 90 | + box: T; |
| 91 | +} |
| 92 | +/** |
| 93 | + * Recursively iterates over all child panel names in the layout tree, yielding |
| 94 | + * panel names in depth-first order. |
| 95 | + * |
| 96 | + * @param panel - The layout tree to iterate over |
| 97 | + * @returns Generator yielding child panel names |
| 98 | + */ |
| 99 | +export declare function iter_panel_children(panel: Layout): Generator<string>; |
| 100 | +/** |
| 101 | + * An empty `Layout` with no panels. |
| 102 | + */ |
| 103 | +export declare const EMPTY_PANEL: Layout; |
0 commit comments