@mintplayer/web-components 2.13.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +15 -0
  2. package/badge/src/styles/badge.styles.d.ts +2 -0
  3. package/chunks/install-light-styles-DbCAGFOC.mjs +209 -0
  4. package/chunks/{mp-datatable-GmKqaN8y.mjs → mp-datatable-UJI8E73X.mjs} +484 -476
  5. package/chunks/{mp-splitter-LszuRDbR.mjs → mp-splitter-Ckn1kN4v.mjs} +33 -19
  6. package/chunks/{mp-treeview-tkWu28iF.mjs → mp-treeview-C8iltDbq.mjs} +61 -63
  7. package/datatable/index.mjs +2 -2
  8. package/datatable/src/components/mp-datatable.d.ts +9 -1
  9. package/datatable/src/index.d.ts +1 -1
  10. package/datatable/src/styles/datatable.light.styles.d.ts +2 -0
  11. package/datatable/src/styles/index.d.ts +1 -1
  12. package/dock/index.mjs +917 -921
  13. package/dock/src/components/mint-dock-manager.element.d.ts +16 -42
  14. package/dock/src/core/geometry.d.ts +36 -0
  15. package/dock/src/core/index.d.ts +6 -0
  16. package/dock/src/core/intersection-sizing.d.ts +83 -0
  17. package/dock/src/core/layout-tree.d.ts +105 -0
  18. package/dock/src/core/resize.d.ts +83 -0
  19. package/dock/src/core/sizes.d.ts +31 -0
  20. package/dock/src/core/types.d.ts +58 -0
  21. package/file-manager/index.mjs +31 -30
  22. package/file-manager/src/components/mp-file-manager.d.ts +2 -0
  23. package/light-dom/index.d.ts +1 -0
  24. package/light-dom/index.mjs +11 -0
  25. package/light-dom/src/index.d.ts +2 -0
  26. package/light-dom/src/install-light-styles.d.ts +25 -0
  27. package/light-dom/src/scoped-html.d.ts +26 -0
  28. package/navbar/index.mjs +71 -44
  29. package/navbar/src/components/mp-navbar.d.ts +17 -1
  30. package/package.json +5 -1
  31. package/query-builder/index.mjs +1472 -2651
  32. package/query-builder/src/index.d.ts +4 -0
  33. package/query-builder/src/mp-query-builder.element.d.ts +1 -1
  34. package/query-builder/src/mp-query-builder.light.styles.d.ts +2 -0
  35. package/query-builder/src/mp-query-condition.element.d.ts +1 -1
  36. package/query-builder/src/mp-query-condition.light.styles.d.ts +2 -0
  37. package/query-builder/src/mp-query-group.element.d.ts +1 -1
  38. package/query-builder/src/mp-query-group.light.styles.d.ts +2 -0
  39. package/query-builder/src/mp-query-subquery.element.d.ts +1 -1
  40. package/query-builder/src/mp-query-subquery.light.styles.d.ts +2 -0
  41. package/ribbon/index.mjs +7 -3
  42. package/ribbon/src/mp-quick-access-toolbar.element.d.ts +11 -0
  43. package/splitter/index.mjs +1 -1
  44. package/splitter/src/state/splitter-state.d.ts +9 -0
  45. package/tree-select/index.mjs +60 -58
  46. package/tree-select/src/components/mp-tree-select.d.ts +1 -1
  47. package/tree-select/src/index.d.ts +1 -1
  48. package/tree-select/src/styles/index.d.ts +1 -1
  49. package/tree-select/src/styles/tree-select.light.styles.d.ts +2 -0
  50. package/treeview/index.mjs +3 -3
  51. package/treeview/src/components/mp-treeview.d.ts +1 -1
  52. package/treeview/src/index.d.ts +1 -1
  53. package/treeview/src/styles/index.d.ts +1 -1
  54. package/treeview/src/styles/treeview.light.styles.d.ts +2 -0
@@ -53,10 +53,7 @@ export declare class MintDockManagerElement extends LitElement {
53
53
  private lastDragPointerPosition;
54
54
  private cornerSnapXTargets;
55
55
  private cornerSnapYTargets;
56
- private showSnapMarkers;
57
56
  debugLayoutIntegrity: boolean;
58
- private renderSnapMarkersForCorner;
59
- private clearSnapMarkers;
60
57
  private pendingDragEndTimeout;
61
58
  private previousSplitSizes;
62
59
  constructor();
@@ -110,6 +107,16 @@ export declare class MintDockManagerElement extends LitElement {
110
107
  private handleCornerResizeMove;
111
108
  private endCornerResize;
112
109
  private onIntersectionDoubleClick;
110
+ /**
111
+ * Push normalized weights into the matching `<mp-splitter>` as pixel sizes.
112
+ * The splitter's panel wrappers live in its shadow DOM, so direct flex
113
+ * mutation is not an option.
114
+ *
115
+ * Returns without writing when the splitter has no measured size — which is
116
+ * every case under jsdom, and is why the double-click logic above had to move
117
+ * out of this method's shadow to become testable.
118
+ */
119
+ private pushSizesToSplitter;
113
120
  private beginFloatingDrag;
114
121
  /** The percent-of-host size of the dimension a handle drives (width for
115
122
  * horizontal/corner handles, height for pure-vertical ones). */
@@ -126,10 +133,14 @@ export declare class MintDockManagerElement extends LitElement {
126
133
  private endFloatingDrag;
127
134
  private updateFloatingDragDropTarget;
128
135
  private handleFloatingResizeMove;
136
+ /**
137
+ * Commit resolved bounds to both the DOM and the layout. Written directly
138
+ * rather than through a re-render: a resize runs once per pointer move, and
139
+ * tearing the wrapper down would drop the pointer capture mid-gesture.
140
+ */
141
+ private applyFloatingBounds;
129
142
  private endFloatingResize;
130
- private getFloatingPaneZIndex;
131
143
  private getHostSize;
132
- private clampBoundsToHost;
133
144
  private updateFloatingPanePositions;
134
145
  private promoteFloatingPane;
135
146
  private getFloatingWrapper;
@@ -213,7 +224,6 @@ export declare class MintDockManagerElement extends LitElement {
213
224
  private updateDraggedFloatingPositionFromPoint;
214
225
  private updatePaneDragDropTargetFromPoint;
215
226
  private isPointerOverSourceHeader;
216
- private isPointWithinBounds;
217
227
  private ensureHeaderDragPlaceholder;
218
228
  private updateHeaderDragPlaceholderPosition;
219
229
  private clearHeaderDragPlaceholder;
@@ -232,9 +242,6 @@ export declare class MintDockManagerElement extends LitElement {
232
242
  private scheduleDeferredDragEnd;
233
243
  private handleDrop;
234
244
  private handleFloatingStackDrop;
235
- private insertWeight;
236
- private removePaneFromStack;
237
- private findParentSplit;
238
245
  private computeDropZone;
239
246
  private extractDropZoneFromEvent;
240
247
  private handleDragPointerUpCommon;
@@ -247,23 +254,7 @@ export declare class MintDockManagerElement extends LitElement {
247
254
  private findStackAtPoint;
248
255
  private findStackInTargets;
249
256
  private activatePane;
250
- private getNodeAtPath;
251
- private resolveSplitNode;
252
- private replaceNodeInTree;
253
- private dockNodeBeside;
254
- private forEachStack;
255
- private findStackContainingPane;
256
- private findFirstPaneName;
257
- private collectFloatingPaneMetadata;
258
- private collectPaneNames;
259
- private normalizeFloatingLayout;
260
- private formatPath;
261
257
  private splitterLayerKey;
262
- private clonePath;
263
- private parsePath;
264
- private pathsEqual;
265
- private isOrIsAncestorOf;
266
- private countPanesInTree;
267
258
  private resolveStackLocation;
268
259
  private removePaneFromLocation;
269
260
  private addPaneToLocation;
@@ -334,22 +325,6 @@ export declare class MintDockManagerElement extends LitElement {
334
325
  */
335
326
  private closeFloatingPane;
336
327
  private removePaneFromFloating;
337
- private normalizeSizesArray;
338
- private normalizeSplitNode;
339
- /**
340
- * Bottom-up layout sanitizer. Returns a normalized version of `node` where:
341
- * - Empty stacks (panes.length === 0) are dropped (returned as null).
342
- * - A stack's `activePane` is repaired if it no longer references one of `panes`.
343
- * - Splits whose direction matches a child split are flattened, with sizes
344
- * combined multiplicatively so the resulting on-screen pixel layout is
345
- * identical to the pre-merge one.
346
- * - Splits with 0 children become null. Splits with 1 child are unwrapped.
347
- *
348
- * Idempotent: passing the result back through this method yields the same
349
- * structure. Mutates the input tree in place but only returns nodes that
350
- * remain part of the layout.
351
- */
352
- private normalizeLayoutNode;
353
328
  /**
354
329
  * Apply `normalizeLayoutNode` to `rootLayout` and every floating window's
355
330
  * root, drop floating windows whose root collapses to null, and repair
@@ -368,6 +343,5 @@ export declare class MintDockManagerElement extends LitElement {
368
343
  */
369
344
  private verifyProjectionSlots;
370
345
  private dispatchLayoutChanged;
371
- private cloneLayoutNode;
372
346
  private cloneFloatingArray;
373
347
  }
@@ -0,0 +1,36 @@
1
+ import { DockFloatingPaneBounds, DockFloatingStackLayout } from '../types/dock-layout';
2
+ /**
3
+ * The arithmetic behind floating windows. Pulled out of the element because it
4
+ * is the part of the dock that jsdom can never exercise through the DOM —
5
+ * every rect there is zero — while being exactly the part where an off-by-one
6
+ * puts a window half off-screen.
7
+ */
8
+ /**
9
+ * The bounds a floating window may actually occupy inside a host of the given
10
+ * size: never wider or taller than the host, never past its right or bottom
11
+ * edge, never at a negative offset.
12
+ *
13
+ * An unmeasured host (either dimension zero) returns the intent unchanged.
14
+ * Clamping against zero would collapse every window to a point during the first
15
+ * frame, before the ResizeObserver has reported a size — and the next render
16
+ * clamps correctly anyway.
17
+ */
18
+ export declare function clampBoundsToHost(intent: DockFloatingPaneBounds, host: {
19
+ width: number;
20
+ height: number;
21
+ }): DockFloatingPaneBounds;
22
+ /** Hit test, edges inclusive. */
23
+ export declare function isPointWithinBounds(bounds: {
24
+ left: number;
25
+ right: number;
26
+ top: number;
27
+ bottom: number;
28
+ }, x: number, y: number): boolean;
29
+ /**
30
+ * Stacking order for floating window `index`.
31
+ *
32
+ * A consumer-supplied `zIndex` wins so an app can pin a window above the rest;
33
+ * otherwise later windows sit above earlier ones. A non-finite override falls
34
+ * back rather than producing a `z-index: NaN` that the browser drops silently.
35
+ */
36
+ export declare function floatingZIndex(floating: DockFloatingStackLayout | undefined, index: number): number;
@@ -0,0 +1,6 @@
1
+ export * from './geometry';
2
+ export * from './intersection-sizing';
3
+ export * from './layout-tree';
4
+ export * from './resize';
5
+ export * from './sizes';
6
+ export * from './types';
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Double-clicking an intersection handle toggles between "equalize the panes
3
+ * adjacent to every divider that crosses here" and "put back what was there
4
+ * before". This module owns that decision; the element owns the layout tree and
5
+ * the DOM.
6
+ *
7
+ * The split matters because the decision is the part worth testing and the part
8
+ * that was previously unreachable: it lived inside a method whose only other
9
+ * job was writing measured pixel sizes into `<mp-splitter>`, which made the
10
+ * whole thing look like geometry. It is not — the toggle reads and writes
11
+ * normalized weights and never consults a rect.
12
+ *
13
+ * `planIntersectionResize` returns writes **in call order rather than one per
14
+ * path**. Two pairs crossing the same split legitimately compound, and the
15
+ * element re-pushes to the splitter after each write; collapsing them would
16
+ * change how often `setPanelSizes` is called.
17
+ */
18
+ /** One divider crossing: a horizontal split and a vertical split, each by path and divider index. */
19
+ export interface IntersectionPair {
20
+ h: {
21
+ pathStr: string;
22
+ index: number;
23
+ };
24
+ v: {
25
+ pathStr: string;
26
+ index: number;
27
+ };
28
+ }
29
+ /**
30
+ * What the caller knows about a split node, without exposing the node itself.
31
+ * `sizes` is undefined for a split that has never been given explicit weights —
32
+ * such a split is still equalized, but there is nothing about it worth
33
+ * remembering, since restoring an implicit even split is imperceptible.
34
+ */
35
+ export interface SplitSizes {
36
+ sizes: number[] | undefined;
37
+ childCount: number;
38
+ }
39
+ export interface IntersectionResizePlan {
40
+ /** Ordered: apply each in turn, pushing to the splitter after each, as the element did inline. */
41
+ writes: Array<{
42
+ pathStr: string;
43
+ sizes: number[];
44
+ }>;
45
+ /** Sizes to remember so the next double-click can restore them. Empty when restoring. */
46
+ remember: Array<{
47
+ pathStr: string;
48
+ sizes: number[];
49
+ }>;
50
+ /** True when this double-click consumed the stored sizes and they should be dropped. */
51
+ clearStored: boolean;
52
+ }
53
+ /**
54
+ * Recover the crossing pairs a handle describes.
55
+ *
56
+ * `data-pairs` is the real channel; `data-key` is the single-crossing fallback
57
+ * written by handles that predate it, encoded as `<hPath>:<hIndex>|<vPath>:<vIndex>`.
58
+ * Paths themselves contain `:` separators, so the index is split off at the LAST
59
+ * colon, not the first.
60
+ *
61
+ * Malformed input yields an empty array rather than throwing — a handle with a
62
+ * corrupt dataset should do nothing, not break the element.
63
+ */
64
+ export declare function parseIntersectionPairs(pairsRaw: string | undefined, keyRaw: string | undefined): IntersectionPair[];
65
+ /**
66
+ * Give the two panes either side of `index` an equal share of the space they
67
+ * currently occupy between them, then renormalize the whole row so the weights
68
+ * still sum to 1. Returns the input untouched when the pair has no space to
69
+ * share — halving zero is not an improvement.
70
+ */
71
+ export declare function equalizeAtDivider(sizes: number[], index: number): number[];
72
+ /**
73
+ * Decide what a double-click on this intersection should do.
74
+ *
75
+ * Restore wins whenever *any* split touched by these pairs has stored sizes —
76
+ * one remembered split is enough to make the gesture a restore, and a restore
77
+ * puts back every stored split, not only the ones under this handle. That is
78
+ * deliberate: the stored map is a single undo step for the whole layout.
79
+ *
80
+ * `lookup` returns null for a path that is not a split node, which is how a
81
+ * stale handle left over from a layout change is ignored.
82
+ */
83
+ export declare function planIntersectionResize(pairs: readonly IntersectionPair[], stored: ReadonlyMap<string, number[]>, lookup: (pathStr: string) => SplitSizes | null): IntersectionResizePlan;
@@ -0,0 +1,105 @@
1
+ import { DockFloatingStackLayout, DockLayoutNode, DockSplitNode, DockStackNode } from '../types/dock-layout';
2
+ import { DockPath, DropZone } from './types';
3
+ /**
4
+ * The dock's layout is a tree of splits and stacks, and every drag, drop, close
5
+ * and resize is a transformation of that tree. This module is that algebra,
6
+ * with no DOM in it: the element renders whatever the tree says, so any bug
7
+ * here shows up as a layout that is wrong rather than as an error.
8
+ *
9
+ * Two conventions run through all of it. **A path is a walk of child indices**
10
+ * from a root, so `[]` is the root itself and `[1, 0]` is the first child of the
11
+ * second. And **node identity is by reference**, not by value — two stacks with
12
+ * the same pane list are different nodes, which is what lets a drag move one of
13
+ * two identical-looking stacks.
14
+ */
15
+ /** The node at `path`, or null if the walk leaves the tree. */
16
+ export declare function getNodeAtPath(root: DockLayoutNode | null, path: number[]): DockLayoutNode | null;
17
+ /**
18
+ * The split that directly contains `child`, and the index it sits at.
19
+ *
20
+ * Returns null for the root itself: the root has no parent, and a caller that
21
+ * needs to replace it has to write the new root rather than splice a child.
22
+ */
23
+ export declare function findParentSplit(node: DockLayoutNode | null, child: DockLayoutNode): {
24
+ parent: DockSplitNode;
25
+ index: number;
26
+ } | null;
27
+ /**
28
+ * Swap `target` for `replacement` and return the (possibly new) root.
29
+ *
30
+ * The return value matters: replacing the root cannot be done by mutation, so
31
+ * the replacement itself comes back and the caller must assign it. A target
32
+ * that is not in the tree leaves the root untouched rather than throwing —
33
+ * a drag whose source vanished mid-gesture is a normal event, not an error.
34
+ */
35
+ export declare function replaceNodeInTree(root: DockLayoutNode | null, target: DockLayoutNode, replacement: DockLayoutNode): DockLayoutNode | null;
36
+ /**
37
+ * Place `newNode` next to `targetNode` on the side `zone` names.
38
+ *
39
+ * Two cases, and choosing the wrong one is what produces a tree that renders
40
+ * correctly today and degenerates after a few drags. When the target's parent
41
+ * already runs along the needed axis the newcomer is spliced in as a sibling,
42
+ * keeping the split flat. Only when the axis differs is a new split introduced
43
+ * around the target.
44
+ */
45
+ export declare function dockNodeBeside(root: DockLayoutNode | null, targetNode: DockStackNode, newNode: DockLayoutNode, zone: DropZone): DockLayoutNode | null;
46
+ /** Visit every stack in document order, with the path that reaches it. */
47
+ export declare function forEachStack(node: DockLayoutNode | null, visitor: (stack: DockStackNode, path: number[]) => void, path?: number[]): void;
48
+ /** The first stack whose tab list contains `pane`. */
49
+ export declare function findStackContainingPane(node: DockLayoutNode | null, pane: string): DockStackNode | null;
50
+ /**
51
+ * A pane to surface when one must be chosen for the user — the first stack's
52
+ * active tab, or its first tab when the active one is stale.
53
+ */
54
+ export declare function findFirstPaneName(node: DockLayoutNode | null): string | null;
55
+ /** Every pane name in the tree, in document order, duplicates included. */
56
+ export declare function collectPaneNames(node: DockLayoutNode | null): string[];
57
+ /**
58
+ * Drop `pane` from `stack`, repairing the active tab, and report whether the
59
+ * stack is now empty (which is the caller's cue to normalize the tree that
60
+ * contains it — this function cannot reach it).
61
+ */
62
+ export declare function removePaneFromStack(stack: DockStackNode, pane: string): boolean;
63
+ /**
64
+ * Bottom-up layout sanitizer. Returns a normalized version of `node` where:
65
+ * - Empty stacks (panes.length === 0) are dropped (returned as null).
66
+ * - A stack's `activePane` is repaired if it no longer references one of `panes`.
67
+ * - Splits whose direction matches a child split are flattened, with sizes
68
+ * combined multiplicatively so the resulting on-screen pixel layout is
69
+ * identical to the pre-merge one.
70
+ * - Splits with 0 children become null. Splits with 1 child are unwrapped.
71
+ *
72
+ * Idempotent: passing the result back through this function yields the same
73
+ * structure. Mutates the input tree in place but only returns nodes that
74
+ * remain part of the layout.
75
+ */
76
+ export declare function normalizeLayoutNode(node: DockLayoutNode | null): DockLayoutNode | null;
77
+ /**
78
+ * A structural copy, so a layout handed in by a consumer is never mutated by a
79
+ * later drag and a snapshot handed out never changes underneath them. The
80
+ * layout is plain JSON by construction, which is what makes the cheap
81
+ * round-trip valid here.
82
+ */
83
+ export declare function cloneLayoutNode(layout: DockLayoutNode): DockLayoutNode;
84
+ export declare function cloneLayoutNode(layout: DockLayoutNode | null): DockLayoutNode | null;
85
+ /** How many panes a subtree holds. A stack contributes its pane count; a split, the sum of its children. */
86
+ export declare function countPanesInTree(node: DockLayoutNode | null): number;
87
+ /**
88
+ * The split node a path addresses, in whichever layer the path names, or null
89
+ * when the path leaves the tree or lands on a stack.
90
+ *
91
+ * Returning null rather than throwing is what makes a stale `data-path` on a
92
+ * handle harmless: the layout changed under it, the lookup misses, and the
93
+ * gesture does nothing.
94
+ */
95
+ export declare function resolveSplitNode(path: DockPath, rootLayout: DockLayoutNode | null, floatingLayouts: readonly DockFloatingStackLayout[]): DockSplitNode | null;
96
+ /**
97
+ * Give a floating window a complete, finite set of bounds and a detached root.
98
+ *
99
+ * Every field is defended because floating layouts arrive from the `layout`
100
+ * attribute, i.e. from JSON a consumer wrote: a missing `bounds`, a NaN left
101
+ * from a bad parse, or a window sized to nothing would each render an
102
+ * unusable window rather than fail loudly. The minimums (160x120) are the
103
+ * smallest size at which a window's chrome is still operable.
104
+ */
105
+ export declare function normalizeFloatingLayout(layout: DockFloatingStackLayout): DockFloatingStackLayout;
@@ -0,0 +1,83 @@
1
+ import { DockFloatingPaneBounds } from '../types/dock-layout';
2
+ /**
3
+ * The arithmetic of every resize gesture in the dock, separated from the events
4
+ * that drive it.
5
+ *
6
+ * It is here for a reason beyond testability. Each of these is reached from
7
+ * **two** input paths — a pointer drag and a keyboard arrow — and the two used
8
+ * to carry their own copy of the maths. Two implementations of one rule is a
9
+ * bug waiting for someone to fix only one of them, and it is invisible while it
10
+ * lasts because a mouse user and a keyboard user rarely compare notes.
11
+ */
12
+ /** Which edges of a floating window a resize handle drives. */
13
+ export interface FloatingResizeEdges {
14
+ horizontal: 'left' | 'right' | 'none';
15
+ vertical: 'top' | 'bottom' | 'none';
16
+ }
17
+ /** Smallest usable floating window, in CSS pixels. */
18
+ export declare const FLOATING_MIN_WIDTH = 192;
19
+ export declare const FLOATING_MIN_HEIGHT = 128;
20
+ /**
21
+ * The bounds a floating window takes after dragging its handle by `delta` from
22
+ * `start`.
23
+ *
24
+ * `delta` is expressed as the movement of the HANDLE, not as growth of the
25
+ * window, and that is what lets a keyboard arrow reuse it unchanged: one press
26
+ * of an arrow is `step` pixels of handle movement in that direction. Whether
27
+ * the window grows or shrinks then follows from which edge the handle drives,
28
+ * decided once, below, instead of once per input path.
29
+ *
30
+ * The two anchoring cases are the substance. Dragging a `right`/`bottom` edge
31
+ * leaves the opposite edge where it is and grows the size; dragging a
32
+ * `left`/`top` edge has to move the origin as well, and the window is capped so
33
+ * that origin never crosses zero — otherwise a fast drag past the edge would
34
+ * put the title bar off-screen, where it cannot be grabbed back.
35
+ */
36
+ export declare function resizeFloatingBounds(start: DockFloatingPaneBounds, edges: FloatingResizeEdges, delta: {
37
+ x: number;
38
+ y: number;
39
+ }, host: {
40
+ width: number;
41
+ height: number;
42
+ }): DockFloatingPaneBounds;
43
+ /**
44
+ * The nearest of the conventional layout ratios, in pixels.
45
+ *
46
+ * Unconditional: it snaps to whichever ratio is closest with no tolerance,
47
+ * because it only runs while the user is *holding a modifier to ask for it*.
48
+ * A tolerance there would make the modifier do nothing for most of the track.
49
+ */
50
+ export declare function snapToRatio(value: number, total: number): number;
51
+ /**
52
+ * `value` pulled onto the nearest target within `tolerance`, or left alone.
53
+ *
54
+ * This is the opposite case from `snapToRatio`: it runs on every pointer move
55
+ * without being asked, so it must do nothing unless the user is already close
56
+ * to an alignment they plausibly meant.
57
+ */
58
+ export declare function snapToNearestTarget(value: number, targets: readonly number[], tolerance: number): number;
59
+ /**
60
+ * How a pair of adjacent panels divides its combined track after the divider
61
+ * between them moves by `delta`.
62
+ *
63
+ * The pair's total is conserved — a splitter moves a boundary, it does not
64
+ * resize the container — and each side keeps at least `minSize`, so a divider
65
+ * dragged to the end leaves a grabbable sliver instead of a panel of zero width
66
+ * that can never be dragged back.
67
+ */
68
+ export declare function resizePair(beforeSize: number, afterSize: number, delta: number, minSize: number, snap?: boolean): {
69
+ before: number;
70
+ after: number;
71
+ };
72
+ /**
73
+ * Where a dragged tab would land in a header, given the horizontal midpoint of
74
+ * each tab that is a candidate target.
75
+ *
76
+ * `draggedCenter` is the midpoint of the placeholder currently occupying the
77
+ * strip, and the bias it triggers is the fix for a real flicker: without it, a
78
+ * tab dragged rightwards reaches the next tab's midpoint while the placeholder
79
+ * is still on the left of it, so the insert point oscillates between two values
80
+ * over a couple of pixels. Nudging the midpoint of every tab *right* of the
81
+ * placeholder outward adds the hysteresis that stops it.
82
+ */
83
+ export declare function headerInsertIndex(midpoints: readonly number[], clientX: number, draggedCenter: number | null, rightBias?: number): number;
@@ -0,0 +1,31 @@
1
+ import { DockSplitNode } from '../types/dock-layout';
2
+ /**
3
+ * Split weights. A `DockSplitNode.sizes` array is authored as free-form flex
4
+ * weights — a consumer may write `[1, 2]`, `[30, 70]`, or nothing at all — and
5
+ * everything downstream (rendering, resizing, insertion, flattening) assumes a
6
+ * normalized array of fractions that sums to 1 and has exactly one entry per
7
+ * child. These functions are the single place that assumption is established.
8
+ */
9
+ /**
10
+ * Fractions summing to 1, one per child.
11
+ *
12
+ * Every way the input can be unusable resolves to an equal split rather than an
13
+ * error: a missing array, a stale one whose length no longer matches the
14
+ * children, all-zero or all-negative weights, `NaN` from a bad parse. That is
15
+ * deliberate — a layout is user data that arrives from `JSON.parse` of an
16
+ * attribute, and a split that throws would take the whole dock down over a
17
+ * cosmetic detail.
18
+ */
19
+ export declare function normalizeSizesArray(sizes: number[] | undefined, count: number): number[];
20
+ /** Normalize a split's own weights in place. */
21
+ export declare function normalizeSplitNode(split: DockSplitNode): void;
22
+ /**
23
+ * Weights after inserting a new child at `index`, where `totalChildren` already
24
+ * counts the newcomer.
25
+ *
26
+ * The newcomer takes an equal share (`1 / totalChildren`) and the existing
27
+ * children keep their *relative* proportions inside what is left — so inserting
28
+ * into a 70/30 split gives 47/23 alongside the new 33, not 33/33/33. Anything
29
+ * else would silently re-balance a layout the user had arranged.
30
+ */
31
+ export declare function insertWeight(sizes: number[] | undefined, index: number, totalChildren: number): number[];
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Vocabulary shared by the dock's pure layout core and the element that
3
+ * renders it. These are data-only: nothing here knows about the DOM.
4
+ */
5
+ /**
6
+ * Where a node lives. The docked tree is addressed by the child indices walked
7
+ * from the root; a floating window is addressed by its index in the floating
8
+ * array plus the same walk inside that window's own root.
9
+ */
10
+ export type DockPath = {
11
+ type: 'docked';
12
+ segments: number[];
13
+ } | {
14
+ type: 'floating';
15
+ index: number;
16
+ segments: number[];
17
+ };
18
+ /** Which side of a stack a dropped pane lands on; `center` means "same stack". */
19
+ export type DropZone = 'center' | 'left' | 'right' | 'top' | 'bottom';
20
+ /**
21
+ * The identity a path takes in the rendered tree's `data-path` attributes.
22
+ *
23
+ * It is the join between the two halves of the dock: a pointer drop reads this
24
+ * string off the hovered element and a keyboard drop carries it in its
25
+ * candidate list, so both must resolve to the same node. Docked paths are
26
+ * `d:` + slash-joined segments, floating ones `f:<index>` plus the same suffix.
27
+ */
28
+ export declare function formatPath(path: DockPath): string;
29
+ /**
30
+ * The inverse of {@link formatPath}: read a `data-path` attribute back into a
31
+ * path.
32
+ *
33
+ * The empty string is a VALID path, not a missing one — the root splitter is
34
+ * tagged `data-path=""`, which is what the raw join of an empty segment array
35
+ * produces. Only `null`/`undefined` means "no path", and conflating the two
36
+ * makes every drop onto the root resolve to nothing.
37
+ *
38
+ * Anything it cannot parse is dropped rather than becoming `NaN`: a segment
39
+ * list containing `NaN` would index into the tree as `undefined` and silently
40
+ * resolve to the wrong node.
41
+ */
42
+ export declare function parsePath(path: string | null | undefined): DockPath | null;
43
+ /** Two paths address the same node. */
44
+ export declare function pathsEqual(a: DockPath, b: DockPath): boolean;
45
+ /** A copy that shares no array with the original, so callers can hold onto it across a mutation. */
46
+ export declare function clonePath(path: DockPath): DockPath;
47
+ /**
48
+ * `ancestor` addresses `descendant` or something containing it.
49
+ *
50
+ * Reflexive by design: a path is its own ancestor. The dock uses this to refuse
51
+ * a drop into the subtree being dragged, and dropping a node onto itself has to
52
+ * be refused by the same test as dropping it into its own child.
53
+ *
54
+ * Paths in different layers are never related, even when their segments match —
55
+ * `f:0/[1]` and `f:1/[1]` are different windows, and a docked path is never an
56
+ * ancestor of a floating one.
57
+ */
58
+ export declare function isOrIsAncestorOf(ancestor: DockPath, descendant: DockPath): boolean;