@mintplayer/web-components 2.13.0 → 2.14.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.
- package/chunks/{mp-splitter-LszuRDbR.mjs → mp-splitter-Ckn1kN4v.mjs} +33 -19
- package/dock/index.mjs +841 -830
- package/dock/src/components/mint-dock-manager.element.d.ts +6 -34
- package/dock/src/core/geometry.d.ts +36 -0
- package/dock/src/core/index.d.ts +5 -0
- package/dock/src/core/layout-tree.d.ts +84 -0
- package/dock/src/core/resize.d.ts +83 -0
- package/dock/src/core/sizes.d.ts +31 -0
- package/dock/src/core/types.d.ts +44 -0
- package/file-manager/index.mjs +1 -1
- package/navbar/index.mjs +71 -44
- package/navbar/src/components/mp-navbar.d.ts +17 -1
- package/package.json +1 -1
- package/ribbon/index.mjs +7 -3
- package/ribbon/src/mp-quick-access-toolbar.element.d.ts +11 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/state/splitter-state.d.ts +9 -0
|
@@ -126,10 +126,14 @@ export declare class MintDockManagerElement extends LitElement {
|
|
|
126
126
|
private endFloatingDrag;
|
|
127
127
|
private updateFloatingDragDropTarget;
|
|
128
128
|
private handleFloatingResizeMove;
|
|
129
|
+
/**
|
|
130
|
+
* Commit resolved bounds to both the DOM and the layout. Written directly
|
|
131
|
+
* rather than through a re-render: a resize runs once per pointer move, and
|
|
132
|
+
* tearing the wrapper down would drop the pointer capture mid-gesture.
|
|
133
|
+
*/
|
|
134
|
+
private applyFloatingBounds;
|
|
129
135
|
private endFloatingResize;
|
|
130
|
-
private getFloatingPaneZIndex;
|
|
131
136
|
private getHostSize;
|
|
132
|
-
private clampBoundsToHost;
|
|
133
137
|
private updateFloatingPanePositions;
|
|
134
138
|
private promoteFloatingPane;
|
|
135
139
|
private getFloatingWrapper;
|
|
@@ -213,7 +217,6 @@ export declare class MintDockManagerElement extends LitElement {
|
|
|
213
217
|
private updateDraggedFloatingPositionFromPoint;
|
|
214
218
|
private updatePaneDragDropTargetFromPoint;
|
|
215
219
|
private isPointerOverSourceHeader;
|
|
216
|
-
private isPointWithinBounds;
|
|
217
220
|
private ensureHeaderDragPlaceholder;
|
|
218
221
|
private updateHeaderDragPlaceholderPosition;
|
|
219
222
|
private clearHeaderDragPlaceholder;
|
|
@@ -232,9 +235,6 @@ export declare class MintDockManagerElement extends LitElement {
|
|
|
232
235
|
private scheduleDeferredDragEnd;
|
|
233
236
|
private handleDrop;
|
|
234
237
|
private handleFloatingStackDrop;
|
|
235
|
-
private insertWeight;
|
|
236
|
-
private removePaneFromStack;
|
|
237
|
-
private findParentSplit;
|
|
238
238
|
private computeDropZone;
|
|
239
239
|
private extractDropZoneFromEvent;
|
|
240
240
|
private handleDragPointerUpCommon;
|
|
@@ -247,21 +247,10 @@ export declare class MintDockManagerElement extends LitElement {
|
|
|
247
247
|
private findStackAtPoint;
|
|
248
248
|
private findStackInTargets;
|
|
249
249
|
private activatePane;
|
|
250
|
-
private getNodeAtPath;
|
|
251
250
|
private resolveSplitNode;
|
|
252
|
-
private replaceNodeInTree;
|
|
253
|
-
private dockNodeBeside;
|
|
254
|
-
private forEachStack;
|
|
255
|
-
private findStackContainingPane;
|
|
256
|
-
private findFirstPaneName;
|
|
257
|
-
private collectFloatingPaneMetadata;
|
|
258
|
-
private collectPaneNames;
|
|
259
251
|
private normalizeFloatingLayout;
|
|
260
|
-
private formatPath;
|
|
261
252
|
private splitterLayerKey;
|
|
262
253
|
private clonePath;
|
|
263
|
-
private parsePath;
|
|
264
|
-
private pathsEqual;
|
|
265
254
|
private isOrIsAncestorOf;
|
|
266
255
|
private countPanesInTree;
|
|
267
256
|
private resolveStackLocation;
|
|
@@ -334,22 +323,6 @@ export declare class MintDockManagerElement extends LitElement {
|
|
|
334
323
|
*/
|
|
335
324
|
private closeFloatingPane;
|
|
336
325
|
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
326
|
/**
|
|
354
327
|
* Apply `normalizeLayoutNode` to `rootLayout` and every floating window's
|
|
355
328
|
* root, drop floating windows whose root collapses to null, and repair
|
|
@@ -368,6 +341,5 @@ export declare class MintDockManagerElement extends LitElement {
|
|
|
368
341
|
*/
|
|
369
342
|
private verifyProjectionSlots;
|
|
370
343
|
private dispatchLayoutChanged;
|
|
371
|
-
private cloneLayoutNode;
|
|
372
344
|
private cloneFloatingArray;
|
|
373
345
|
}
|
|
@@ -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,84 @@
|
|
|
1
|
+
import { DockLayoutNode, DockSplitNode, DockStackNode } from '../types/dock-layout';
|
|
2
|
+
import { 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;
|
|
@@ -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,44 @@
|
|
|
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;
|
package/file-manager/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { repeat as y } from "lit/directives/repeat.js";
|
|
|
6
6
|
import { unsafeHTML as u } from "lit/directives/unsafe-html.js";
|
|
7
7
|
import { createRef as $, ref as x } from "lit/directives/ref.js";
|
|
8
8
|
import { styleMap as C } from "lit/directives/style-map.js";
|
|
9
|
-
import "../chunks/mp-splitter-
|
|
9
|
+
import "../chunks/mp-splitter-Ckn1kN4v.mjs";
|
|
10
10
|
import "../chunks/mp-treeview-tkWu28iF.mjs";
|
|
11
11
|
import "../chunks/mp-datatable-GmKqaN8y.mjs";
|
|
12
12
|
const k = g(`:host {
|
package/navbar/index.mjs
CHANGED
|
@@ -1076,10 +1076,10 @@ class r extends d {
|
|
|
1076
1076
|
return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
|
|
1077
1077
|
}
|
|
1078
1078
|
connectedCallback() {
|
|
1079
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#
|
|
1079
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#b(this.getAttribute("breakpoint")), this.addEventListener("click", this.#o);
|
|
1080
1080
|
}
|
|
1081
1081
|
disconnectedCallback() {
|
|
1082
|
-
super.disconnectedCallback(), this.removeEventListener("click", this.#
|
|
1082
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.#o);
|
|
1083
1083
|
}
|
|
1084
1084
|
/**
|
|
1085
1085
|
* Clicking a navigation link (an `<a href>` — a routerLink renders one) should
|
|
@@ -1088,7 +1088,7 @@ class r extends d {
|
|
|
1088
1088
|
* (excluded), so opening a dropdown doesn't collapse the bar. Collapsing in
|
|
1089
1089
|
* wide mode is a no-op (the collapse is always shown there).
|
|
1090
1090
|
*/
|
|
1091
|
-
#
|
|
1091
|
+
#o = (a) => {
|
|
1092
1092
|
a.composedPath().find(
|
|
1093
1093
|
(t) => t instanceof HTMLAnchorElement && t.hasAttribute("href") && !t.classList.contains("dropdown-toggle")
|
|
1094
1094
|
) && (this.querySelectorAll("mp-navbar-dropdown").forEach(
|
|
@@ -1096,14 +1096,14 @@ class r extends d {
|
|
|
1096
1096
|
), this.toggle(!1));
|
|
1097
1097
|
};
|
|
1098
1098
|
attributeChangedCallback(a, e, t) {
|
|
1099
|
-
super.attributeChangedCallback(a, e, t), a === "color" ? this.#
|
|
1099
|
+
super.attributeChangedCallback(a, e, t), a === "color" ? this.#n(t) : a === "breakpoint" ? this.#b(t) : a === "expanded" ? this.#s(t !== null) : a === "aria-label" && this.requestUpdate();
|
|
1100
1100
|
}
|
|
1101
1101
|
/** Solid colors need `data-bs-theme` for text/link contrast; adaptive names inherit the page theme. */
|
|
1102
|
-
#
|
|
1103
|
-
const e = this.#
|
|
1102
|
+
#n(a) {
|
|
1103
|
+
const e = this.#r(a);
|
|
1104
1104
|
e ? this.setAttribute("data-bs-theme", e) : this.getAttribute("data-bs-theme") && this.removeAttribute("data-bs-theme");
|
|
1105
1105
|
}
|
|
1106
|
-
#
|
|
1106
|
+
#r(a) {
|
|
1107
1107
|
return a ? a === "light" || a === "white" ? "light" : a === "body" || a === "transparent" || a.startsWith("body-") ? null : "dark" : null;
|
|
1108
1108
|
}
|
|
1109
1109
|
/** min-width px for each Bootstrap breakpoint (xs = always collapsed → 0). */
|
|
@@ -1122,19 +1122,46 @@ class r extends d {
|
|
|
1122
1122
|
* inherit THROUGH shadow boundaries, so `mp-navbar-dropdown` reads the px in JS
|
|
1123
1123
|
* (matchMedia gate) without any DI/context.
|
|
1124
1124
|
*/
|
|
1125
|
-
#
|
|
1125
|
+
#b(a) {
|
|
1126
1126
|
const e = a ?? "md", t = r.#i[e] ?? 768;
|
|
1127
1127
|
this.setAttribute("data-breakpoint", e), this.style.setProperty("--mp-navbar-breakpoint", `${t}px`);
|
|
1128
1128
|
}
|
|
1129
1129
|
get #t() {
|
|
1130
1130
|
return this.renderRoot?.querySelector(".navbar-toggle") ?? null;
|
|
1131
1131
|
}
|
|
1132
|
+
/**
|
|
1133
|
+
* A programmatic write that arrives before the shadow tree exists. The
|
|
1134
|
+
* checkbox IS the state, so there is nowhere to put the value until it has
|
|
1135
|
+
* rendered, and `render()` deliberately does not bind `checked` (re-rendering
|
|
1136
|
+
* must never clobber what the user toggled). Held here and applied in
|
|
1137
|
+
* `firstUpdated`.
|
|
1138
|
+
*/
|
|
1139
|
+
#e = null;
|
|
1132
1140
|
/** Whether the collapse is (visually) expanded — the toggle's checked state. */
|
|
1133
1141
|
get expanded() {
|
|
1134
|
-
return this.#t?.checked ?? this.hasAttribute("expanded");
|
|
1142
|
+
return this.#t?.checked ?? this.#e ?? this.hasAttribute("expanded");
|
|
1135
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Accepts the empty string as ON, the way an HTML boolean attribute does.
|
|
1146
|
+
*
|
|
1147
|
+
* This is not defensive coding — it is the only reason `expanded` works
|
|
1148
|
+
* outside vanilla usage. The React and Vue wrappers both lower a `true` to
|
|
1149
|
+
* the attribute *shape* `''` (the DSD chrome and the no-JS CSS select on
|
|
1150
|
+
* attributes, and only an attribute is serialised by SSR), but both
|
|
1151
|
+
* frameworks route any name they find on the element's prototype through the
|
|
1152
|
+
* PROPERTY instead — and `''` is falsy in JavaScript, so the property setter
|
|
1153
|
+
* used to close the navbar when asked to open it. `expanded` was a silent
|
|
1154
|
+
* no-op in two of the three frameworks.
|
|
1155
|
+
*
|
|
1156
|
+
* Programmatic writes do not emit `expandedchange`: setting the state is the
|
|
1157
|
+
* consumer's own act, not a change to announce back to them. That matches
|
|
1158
|
+
* the `expanded` ATTRIBUTE path, which has always been silent.
|
|
1159
|
+
*/
|
|
1136
1160
|
set expanded(a) {
|
|
1137
|
-
this
|
|
1161
|
+
this.#s(a === "" ? !0 : !!a);
|
|
1162
|
+
}
|
|
1163
|
+
#s(a) {
|
|
1164
|
+
this.#t ? this.#a(a, !1) : this.#e = a;
|
|
1138
1165
|
}
|
|
1139
1166
|
/**
|
|
1140
1167
|
* The single write path for the collapse state: checkbox + `aria-expanded`
|
|
@@ -1142,25 +1169,25 @@ class r extends d {
|
|
|
1142
1169
|
* dismiss-on-navigate) don't fire the checkbox's `change` event, so syncing
|
|
1143
1170
|
* aria only there left `aria-expanded` stale after every programmatic close.
|
|
1144
1171
|
*/
|
|
1145
|
-
#
|
|
1172
|
+
#a(a, e = !0) {
|
|
1146
1173
|
const t = this.#t;
|
|
1147
|
-
t && (t.checked = a, t.setAttribute("aria-expanded", String(a)), e && this.#
|
|
1174
|
+
t && (t.checked = a, t.setAttribute("aria-expanded", String(a)), e && this.#v(a));
|
|
1148
1175
|
}
|
|
1149
1176
|
/** Programmatically open/close the collapse. */
|
|
1150
1177
|
toggle(a) {
|
|
1151
|
-
this.#
|
|
1178
|
+
this.#a(a ?? !(this.#t?.checked ?? !1));
|
|
1152
1179
|
}
|
|
1153
1180
|
firstUpdated() {
|
|
1154
1181
|
const a = this.#t;
|
|
1155
|
-
a && (a.setAttribute("role", "button"), a.setAttribute("aria-expanded", String(a.checked)));
|
|
1182
|
+
a && (a.setAttribute("role", "button"), this.#e !== null ? (this.#a(this.#e, !1), this.#e = null) : a.setAttribute("aria-expanded", String(a.checked)));
|
|
1156
1183
|
}
|
|
1157
|
-
#
|
|
1158
|
-
this.#
|
|
1184
|
+
#l = () => {
|
|
1185
|
+
this.#a(this.#t?.checked ?? !1);
|
|
1159
1186
|
};
|
|
1160
|
-
#
|
|
1187
|
+
#d = (a) => {
|
|
1161
1188
|
a.key === "Enter" && (a.preventDefault(), this.toggle());
|
|
1162
1189
|
};
|
|
1163
|
-
#
|
|
1190
|
+
#v(a) {
|
|
1164
1191
|
this.dispatchEvent(
|
|
1165
1192
|
new CustomEvent("expandedchange", {
|
|
1166
1193
|
detail: { expanded: a },
|
|
@@ -1184,8 +1211,8 @@ class r extends d {
|
|
|
1184
1211
|
class="navbar-toggle"
|
|
1185
1212
|
aria-label="Toggle navigation"
|
|
1186
1213
|
aria-controls="navbar-collapse"
|
|
1187
|
-
@change=${this.#
|
|
1188
|
-
@keydown=${this.#
|
|
1214
|
+
@change=${this.#l}
|
|
1215
|
+
@keydown=${this.#d}
|
|
1189
1216
|
/>
|
|
1190
1217
|
<label for="mp-navbar-toggle" class="navbar-toggler" part="toggler" aria-hidden="true">
|
|
1191
1218
|
<slot name="toggler">
|
|
@@ -1243,9 +1270,9 @@ class s extends i {
|
|
|
1243
1270
|
static get observedAttributes() {
|
|
1244
1271
|
return [...super.observedAttributes ?? [], "data-open", "data-menu-open"];
|
|
1245
1272
|
}
|
|
1246
|
-
#
|
|
1247
|
-
#a = null;
|
|
1273
|
+
#o = !1;
|
|
1248
1274
|
#n = null;
|
|
1275
|
+
#r = null;
|
|
1249
1276
|
/** Open via either path — inline (`data-open`) or overlay (`data-menu-open`). */
|
|
1250
1277
|
get #i() {
|
|
1251
1278
|
return this.hasAttribute("data-open") || this.hasAttribute("data-menu-open");
|
|
@@ -1254,7 +1281,7 @@ class s extends i {
|
|
|
1254
1281
|
super.attributeChangedCallback(a, e, t), (a === "data-open" || a === "data-menu-open") && this.requestUpdate();
|
|
1255
1282
|
}
|
|
1256
1283
|
/** min-width px per Bootstrap breakpoint — mirrors mp-navbar's map. */
|
|
1257
|
-
static #
|
|
1284
|
+
static #b = {
|
|
1258
1285
|
xs: 0,
|
|
1259
1286
|
sm: 576,
|
|
1260
1287
|
md: 768,
|
|
@@ -1264,16 +1291,16 @@ class s extends i {
|
|
|
1264
1291
|
};
|
|
1265
1292
|
/** Wide mode = at/above the navbar breakpoint (matchMedia). Small/no-JS = false. */
|
|
1266
1293
|
get #t() {
|
|
1267
|
-
return this.#
|
|
1294
|
+
return this.#r?.matches ?? !1;
|
|
1268
1295
|
}
|
|
1269
1296
|
connectedCallback() {
|
|
1270
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.#
|
|
1297
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.#o = !!this.closest("mp-dropdown-menu");
|
|
1271
1298
|
const a = this.closest("mp-navbar")?.getAttribute("breakpoint") ?? "md";
|
|
1272
1299
|
if (this.setAttribute("data-expand", a), typeof window < "u" && window.matchMedia) {
|
|
1273
|
-
const e = s.#
|
|
1274
|
-
this.#
|
|
1300
|
+
const e = s.#b[a] ?? 768;
|
|
1301
|
+
this.#r = window.matchMedia(`(min-width: ${e}px)`), this.#r.addEventListener("change", this.#e);
|
|
1275
1302
|
}
|
|
1276
|
-
this.addEventListener("keydown", this.#
|
|
1303
|
+
this.addEventListener("keydown", this.#p), this.#o && (this.setAttribute("data-submenu", ""), this.#n = new v(this, {
|
|
1277
1304
|
anchor: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1278
1305
|
trigger: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1279
1306
|
// The default-slotted panel: `<mp-dropdown-menu>` directly (React/Vue), or a
|
|
@@ -1290,29 +1317,29 @@ class s extends i {
|
|
|
1290
1317
|
}));
|
|
1291
1318
|
}
|
|
1292
1319
|
disconnectedCallback() {
|
|
1293
|
-
super.disconnectedCallback(), this.removeEventListener("keydown", this.#
|
|
1320
|
+
super.disconnectedCallback(), this.removeEventListener("keydown", this.#p), document.removeEventListener("mousedown", this.#l, !0), this.#r?.removeEventListener("change", this.#e);
|
|
1294
1321
|
}
|
|
1295
1322
|
// Resize crossed the breakpoint: close any open panel so state doesn't leak
|
|
1296
1323
|
// across the inline↔overlay switch (the CSS + #toggle re-resolve on next open).
|
|
1297
|
-
#
|
|
1298
|
-
this.#
|
|
1324
|
+
#e = () => {
|
|
1325
|
+
this.#n?.close(), this.#a(!1);
|
|
1299
1326
|
};
|
|
1300
|
-
get #
|
|
1327
|
+
get #s() {
|
|
1301
1328
|
return this.hasAttribute("data-open");
|
|
1302
1329
|
}
|
|
1303
|
-
#
|
|
1304
|
-
a !== this.#
|
|
1330
|
+
#a(a) {
|
|
1331
|
+
a !== this.#s && (this.toggleAttribute("data-open", a), a ? document.addEventListener("mousedown", this.#l, !0) : document.removeEventListener("mousedown", this.#l, !0));
|
|
1305
1332
|
}
|
|
1306
|
-
#
|
|
1307
|
-
a.composedPath().includes(this) || this.#
|
|
1333
|
+
#l = (a) => {
|
|
1334
|
+
a.composedPath().includes(this) || this.#a(!1);
|
|
1308
1335
|
};
|
|
1309
|
-
#
|
|
1310
|
-
this.#
|
|
1336
|
+
#d() {
|
|
1337
|
+
this.#o && this.#t && this.#n ? this.#n.toggle() : this.#a(!this.#s);
|
|
1311
1338
|
}
|
|
1312
1339
|
/** Close the dropdown (both the overlay and the inline paths). Public so the
|
|
1313
1340
|
* parent `mp-navbar` can dismiss every dropdown when a nav link is clicked. */
|
|
1314
1341
|
close() {
|
|
1315
|
-
this.#
|
|
1342
|
+
this.#n?.close(), this.#a(!1);
|
|
1316
1343
|
}
|
|
1317
1344
|
/**
|
|
1318
1345
|
* Toggle on MOUSEDOWN, not click — the whole gesture must resolve at press
|
|
@@ -1325,17 +1352,17 @@ class s extends i {
|
|
|
1325
1352
|
* is yanked out mid-gesture), and the dropdown silently fails to open.
|
|
1326
1353
|
* No preventDefault: it would suppress focus moving to the trigger.
|
|
1327
1354
|
*/
|
|
1328
|
-
#
|
|
1329
|
-
this.#
|
|
1355
|
+
#v = () => {
|
|
1356
|
+
this.#d();
|
|
1330
1357
|
};
|
|
1331
1358
|
#c = (a) => {
|
|
1332
|
-
a.key === "Enter" || a.key === " " || a.key === "Spacebar" ? (a.preventDefault(), this.#
|
|
1359
|
+
a.key === "Enter" || a.key === " " || a.key === "Spacebar" ? (a.preventDefault(), this.#d()) : a.key === "ArrowDown" && (a.preventDefault(), this.#i || this.#d(), this.#g());
|
|
1333
1360
|
};
|
|
1334
1361
|
/** Escape closes the INNERMOST open dropdown and returns focus to its
|
|
1335
1362
|
* trigger — fires for the shadow trigger and slotted menu content alike
|
|
1336
1363
|
* (keydown is composed). Closed hosts let the event bubble to an open
|
|
1337
1364
|
* ancestor, so nested submenus unwind one level per press. */
|
|
1338
|
-
#
|
|
1365
|
+
#p = (a) => {
|
|
1339
1366
|
a.key !== "Escape" || !this.#i || (a.stopPropagation(), this.close(), this.renderRoot?.querySelector(".dropdown-toggle")?.focus());
|
|
1340
1367
|
};
|
|
1341
1368
|
/** Move focus to the first item control of the slotted menu (this menu's own
|
|
@@ -1355,7 +1382,7 @@ class s extends i {
|
|
|
1355
1382
|
tabindex="0"
|
|
1356
1383
|
aria-haspopup="menu"
|
|
1357
1384
|
aria-expanded=${this.#i ? "true" : "false"}
|
|
1358
|
-
@mousedown=${this.#
|
|
1385
|
+
@mousedown=${this.#v}
|
|
1359
1386
|
@keydown=${this.#c}
|
|
1360
1387
|
><slot name="label"></slot></a>
|
|
1361
1388
|
<slot></slot>
|
|
@@ -45,7 +45,23 @@ export declare class MpNavbar extends LitElement {
|
|
|
45
45
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
46
46
|
/** Whether the collapse is (visually) expanded — the toggle's checked state. */
|
|
47
47
|
get expanded(): boolean;
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Accepts the empty string as ON, the way an HTML boolean attribute does.
|
|
50
|
+
*
|
|
51
|
+
* This is not defensive coding — it is the only reason `expanded` works
|
|
52
|
+
* outside vanilla usage. The React and Vue wrappers both lower a `true` to
|
|
53
|
+
* the attribute *shape* `''` (the DSD chrome and the no-JS CSS select on
|
|
54
|
+
* attributes, and only an attribute is serialised by SSR), but both
|
|
55
|
+
* frameworks route any name they find on the element's prototype through the
|
|
56
|
+
* PROPERTY instead — and `''` is falsy in JavaScript, so the property setter
|
|
57
|
+
* used to close the navbar when asked to open it. `expanded` was a silent
|
|
58
|
+
* no-op in two of the three frameworks.
|
|
59
|
+
*
|
|
60
|
+
* Programmatic writes do not emit `expandedchange`: setting the state is the
|
|
61
|
+
* consumer's own act, not a change to announce back to them. That matches
|
|
62
|
+
* the `expanded` ATTRIBUTE path, which has always been silent.
|
|
63
|
+
*/
|
|
64
|
+
set expanded(v: boolean | '');
|
|
49
65
|
/** Programmatically open/close the collapse. */
|
|
50
66
|
toggle(force?: boolean): void;
|
|
51
67
|
protected firstUpdated(): void;
|