@n-uf/docking 26.11.56 → 26.11.57
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/CHANGELOG.md +38 -0
- package/dist/{chunk-FSNFXRYM.js → chunk-JBKUC72Z.js} +236 -146
- package/dist/chunk-JBKUC72Z.js.map +1 -0
- package/dist/{drag-CbIEY9Zm.d.ts → drag-CyrphFye.d.ts} +55 -11
- package/dist/index.d.ts +8 -5
- package/dist/index.js +3 -1
- package/dist/testing.d.ts +4 -4
- package/dist/testing.js +2 -2
- package/dist/testing.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-FSNFXRYM.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Size, Rect, Target, Point } from '@n-uf/placement';
|
|
1
|
+
import { Side, Size, Rect, Target, Point, Axis } from '@n-uf/placement';
|
|
2
2
|
import { CrossLimits, StackForm, StackFormKind, StackFit, StackNote } from '@n-uf/placement/stack';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -12,8 +12,7 @@ import { CrossLimits, StackForm, StackFormKind, StackFit, StackNote } from '@n-u
|
|
|
12
12
|
|
|
13
13
|
/** The host's kinds of item, such as "panel" and "group". An edge takes only the kinds it lists. */
|
|
14
14
|
type Kind = string;
|
|
15
|
-
|
|
16
|
-
type Side = "top" | "right" | "bottom" | "left";
|
|
15
|
+
|
|
17
16
|
declare const SIDES: readonly Side[];
|
|
18
17
|
/** Where an item sits along its edge: packed from the start, centered in the spare length, or packed from the end. */
|
|
19
18
|
type Zone = "start" | "center" | "end";
|
|
@@ -404,6 +403,45 @@ interface DockFloat {
|
|
|
404
403
|
type KeepClear = Rect & {
|
|
405
404
|
readonly for?: "all" | "floats";
|
|
406
405
|
};
|
|
406
|
+
/**
|
|
407
|
+
* A region of the layout a keep-clear rect can be anchored to: `"content"` is `DockLayout.content`, what the cut leaves
|
|
408
|
+
* for the pages (not `lanes()`' float content).
|
|
409
|
+
*/
|
|
410
|
+
type KeepClearRegion = "content";
|
|
411
|
+
/**
|
|
412
|
+
* A keep-clear rect anchored to a region of the layout ({@link KeepClearRegion}): `size` px deep at the region's `side`,
|
|
413
|
+
* along its whole length, clamped to the region (an empty region gives no rect). `solve` resolves it once the edges
|
|
414
|
+
* and the content are final, before the floats, and writes it to `DockLayout.keepClear` with its `id`, so it moves with
|
|
415
|
+
* the content a drop opens or closes (an overlay strip a host draws at the content's right edge). Nothing that sizes
|
|
416
|
+
* the content reads it. A declaration, like `pushable`: `readDockState` takes it from `base`, `storeDockState` never
|
|
417
|
+
* writes it. A rect that truly lies in stage coordinates stays a {@link KeepClear}.
|
|
418
|
+
*/
|
|
419
|
+
interface AnchoredKeepClear {
|
|
420
|
+
readonly region: KeepClearRegion;
|
|
421
|
+
readonly side: Side;
|
|
422
|
+
/** How deep it is, px, from `side` into the region. */
|
|
423
|
+
readonly size: number;
|
|
424
|
+
/** Who keeps clear of it, as for {@link KeepClear}. */
|
|
425
|
+
readonly for: "all" | "floats";
|
|
426
|
+
/** The host's name for it: it comes back on its `DockLayout.keepClear` entry. */
|
|
427
|
+
readonly id?: string;
|
|
428
|
+
/**
|
|
429
|
+
* The least region it applies in, px: while the region as solved is narrower than `width` or shorter than `height`
|
|
430
|
+
* (each optional), the entry is inactive: it keeps nothing clear and is absent from `DockLayout.keepClear`, so a host
|
|
431
|
+
* draws its overlay exactly when the entry is there. Read once the content is final, like the rest of the entry.
|
|
432
|
+
*/
|
|
433
|
+
readonly minRegion?: {
|
|
434
|
+
readonly width?: number;
|
|
435
|
+
readonly height?: number;
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
/** An anchored keep-clear rect as laid out (`DockLayout.keepClear`). */
|
|
439
|
+
interface DockKeepClearLayout {
|
|
440
|
+
/** Stage px, inside its region. */
|
|
441
|
+
readonly rect: Rect;
|
|
442
|
+
readonly for: "all" | "floats";
|
|
443
|
+
readonly id?: string;
|
|
444
|
+
}
|
|
407
445
|
interface DockState {
|
|
408
446
|
/** The window's inner rect. */
|
|
409
447
|
readonly stage: Rect;
|
|
@@ -415,9 +453,11 @@ interface DockState {
|
|
|
415
453
|
readonly floatKinds: readonly Kind[];
|
|
416
454
|
/**
|
|
417
455
|
* Rects the state keeps clear of (a title the host draws itself, a status line): by default floats and drop targets
|
|
418
|
-
* both; an entry with `for: "floats"` (a spine drawn over a column) only floats. See {@link KeepClear}.
|
|
456
|
+
* both; an entry with `for: "floats"` (a spine drawn over a column) only floats. See {@link KeepClear}. An entry
|
|
457
|
+
* with a `region` is anchored to the layout ({@link AnchoredKeepClear}): `solve` resolves it into
|
|
458
|
+
* `DockLayout.keepClear`, and every reader takes it from the layout it names.
|
|
419
459
|
*/
|
|
420
|
-
readonly keepClear?: readonly KeepClear[];
|
|
460
|
+
readonly keepClear?: readonly (KeepClear | AnchoredKeepClear)[];
|
|
421
461
|
/** Spots where a release cancels: `targets` gives a `none` target over each. */
|
|
422
462
|
readonly blocked?: readonly Rect[];
|
|
423
463
|
/** Per side (left, right): what a new column is made from. A side without one gets no new columns. */
|
|
@@ -723,6 +763,12 @@ interface DockLayout {
|
|
|
723
763
|
* every column can fold into its rail. A host shows its narrow fallback (one panel over the content) while it is `false`.
|
|
724
764
|
*/
|
|
725
765
|
readonly columnRoom?: boolean;
|
|
766
|
+
/**
|
|
767
|
+
* The state's anchored keep-clear rects ({@link AnchoredKeepClear}) resolved in this layout, in the state's order, each
|
|
768
|
+
* with its `id`; one whose region is empty has none. Only with a state that declares one: a state with fixed rects
|
|
769
|
+
* only has no `keepClear` here. A host draws an anchored strip from it.
|
|
770
|
+
*/
|
|
771
|
+
readonly keepClear?: readonly DockKeepClearLayout[];
|
|
726
772
|
readonly notes: readonly DockNote[];
|
|
727
773
|
}
|
|
728
774
|
interface SolveOptions {
|
|
@@ -1293,7 +1339,7 @@ interface DockLane {
|
|
|
1293
1339
|
readonly id: string;
|
|
1294
1340
|
readonly rect: Rect;
|
|
1295
1341
|
/** The axis its spots run along. */
|
|
1296
|
-
readonly axis:
|
|
1342
|
+
readonly axis: Axis;
|
|
1297
1343
|
readonly spots: readonly DockSpot[];
|
|
1298
1344
|
readonly refused: readonly LaneRefusal[];
|
|
1299
1345
|
/**
|
|
@@ -1443,8 +1489,6 @@ interface DockAfter extends DropResult {
|
|
|
1443
1489
|
/** A spot's: its lane's spots with their stretches cut in `layout` (along a held lane, the spot ranges as drawn). */
|
|
1444
1490
|
readonly spots?: readonly DockSpot[];
|
|
1445
1491
|
}
|
|
1446
|
-
/** A place guide as a frame draws it: a lane's mark in the layout its guide stands for. */
|
|
1447
|
-
type DockGuide = DockLaneMark;
|
|
1448
1492
|
/** One lane a frame shows guides for, with the held place its guide stands for (`@n-uf/motion/drag`'s `LandingGuideRef`). */
|
|
1449
1493
|
interface DockGuideRef {
|
|
1450
1494
|
readonly lane: string;
|
|
@@ -1487,8 +1531,8 @@ interface DockDrag {
|
|
|
1487
1531
|
* commits. A null held place is rest. A host that draws no room for a spot (a mode that never makes one) passes room false.
|
|
1488
1532
|
*/
|
|
1489
1533
|
shown(frame: Pick<DockGuideFrame, "held" | "room">): DockLayout;
|
|
1490
|
-
/** The guides of a frame, cut in `shown(frame)`: each lane's marks from the held place it names, the Near lane's winning where they meet. */
|
|
1491
|
-
guides(frame: DockGuideFrame):
|
|
1534
|
+
/** The guides of a frame (a lane's marks as the frame draws them), cut in `shown(frame)`: each lane's marks from the held place it names, the Near lane's winning where they meet. */
|
|
1535
|
+
guides(frame: DockGuideFrame): DockLaneMark[];
|
|
1492
1536
|
}
|
|
1493
1537
|
/**
|
|
1494
1538
|
* The drag of `dragged` in `state`: `lanes()`'s regions as seen, and `after(held)`, THE layout of each held place. The
|
|
@@ -1498,4 +1542,4 @@ interface DockDrag {
|
|
|
1498
1542
|
*/
|
|
1499
1543
|
declare function dockDrag(state: DockState, dragged: string, options?: DockLaneOptions): DockDrag;
|
|
1500
1544
|
|
|
1501
|
-
export { type
|
|
1545
|
+
export { type KeepClearRegion as $, type AnchoredKeepClear as A, type DockMark as B, type ColumnPlace as C, type DockItem as D, type DockNote as E, type FloatAnchorAt as F, type DockNoteCode as G, type DockPlace as H, type DockRailLayout as I, type DockRegions as J, type Kind as K, type DockSpot as L, type DockStateRead as M, type DropPlace as N, type Orient as O, type DropResult as P, EDGE_ROOM_HOLD as Q, type RailMode as R, type SolveOptions as S, type EmptyLanes as T, FLOAT_ANCHORS as U, type FloatAnchorOffset as V, type FloatPlace as W, type FloatResize as X, HATCH_EDGE as Y, type ZoneAccepts as Z, HATCH_END as _, type FloatAnchor as a, type LaneRefusal as a0, type LaneSlide as a1, type Place as a2, RAIL_MODES as a3, RAIL_STRIP_MIN as a4, RAIL_VISIBILITIES as a5, type RailDropPolicy as a6, type RailPlace as a7, type RailSpec as a8, type RailVisibility as a9, readDockState as aA, resizeEdge as aB, resizeFloat as aC, setRailMode as aD, setSide as aE, storeDockState as aF, type ResizeEdges as aa, type ResizeLimit as ab, SIDES as ac, SPOT_PITCH as ad, type StoredDockState as ae, type StoredDockStateEdge as af, type StoredDockStateFloat as ag, type StoredDockStateItem as ah, ZONES as ai, canFold as aj, closeItem as ak, dockDrag as al, dockHome as am, fitResize as an, floatAt as ao, foldItem as ap, homeFor as aq, keepItem as ar, lanes as as, liftItem as at, markUsed as au, mergeSideColumns as av, moveTo as aw, openItem as ax, orientFloat as ay, raiseFloat as az, type Zone as b, type DockState as c, type KeepClear as d, type DockEdge as e, type DockLayout as f, type DockRefusal as g, type DockDropOptions as h, type DockDrop as i, type ColumnTemplate as j, DEFAULT_FLOAT_SIZE as k, DEFAULT_HIT_BAND as l, DEFAULT_RAIL_MAGNET as m, DEFAULT_STRIP as n, type DockAfter as o, type DockDrag as p, type DockEdgeLayout as q, type DockFloat as r, type DockGuideFrame as s, type DockGuideRef as t, type DockHeld as u, type DockItemLayout as v, type DockKeepClearLayout as w, type DockLane as x, type DockLaneMark as y, type DockLaneOptions as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as
|
|
2
|
-
export { C as ColumnPlace, j as ColumnTemplate, k as DEFAULT_FLOAT_SIZE, l as DEFAULT_HIT_BAND, m as DEFAULT_RAIL_MAGNET, n as DEFAULT_STRIP, o as DockAfter, p as DockDrag, q as DockEdgeLayout, r as DockFloat, s as
|
|
3
|
-
import { Size, Point, Rect, Target } from '@n-uf/placement';
|
|
1
|
+
import { F as FloatAnchorAt, a as FloatAnchor, D as DockItem, K as Kind, Z as ZoneAccepts, b as Zone, O as Orient, c as DockState, d as KeepClear, A as AnchoredKeepClear, e as DockEdge, R as RailMode, S as SolveOptions, f as DockLayout, g as DockRefusal, h as DockDropOptions, i as DockDrop } from './drag-CyrphFye.js';
|
|
2
|
+
export { C as ColumnPlace, j as ColumnTemplate, k as DEFAULT_FLOAT_SIZE, l as DEFAULT_HIT_BAND, m as DEFAULT_RAIL_MAGNET, n as DEFAULT_STRIP, o as DockAfter, p as DockDrag, q as DockEdgeLayout, r as DockFloat, s as DockGuideFrame, t as DockGuideRef, u as DockHeld, v as DockItemLayout, w as DockKeepClearLayout, x as DockLane, y as DockLaneMark, z as DockLaneOptions, B as DockMark, E as DockNote, G as DockNoteCode, H as DockPlace, I as DockRailLayout, J as DockRegions, L as DockSpot, M as DockStateRead, N as DropPlace, P as DropResult, Q as EDGE_ROOM_HOLD, T as EmptyLanes, U as FLOAT_ANCHORS, V as FloatAnchorOffset, W as FloatPlace, X as FloatResize, Y as HATCH_EDGE, _ as HATCH_END, $ as KeepClearRegion, a0 as LaneRefusal, a1 as LaneSlide, a2 as Place, a3 as RAIL_MODES, a4 as RAIL_STRIP_MIN, a5 as RAIL_VISIBILITIES, a6 as RailDropPolicy, a7 as RailPlace, a8 as RailSpec, a9 as RailVisibility, aa as ResizeEdges, ab as ResizeLimit, ac as SIDES, ad as SPOT_PITCH, ae as StoredDockState, af as StoredDockStateEdge, ag as StoredDockStateFloat, ah as StoredDockStateItem, ai as ZONES, aj as canFold, ak as closeItem, al as dockDrag, am as dockHome, an as fitResize, ao as floatAt, ap as foldItem, aq as homeFor, ar as keepItem, as as lanes, at as liftItem, au as markUsed, av as mergeSideColumns, aw as moveTo, ax as openItem, ay as orientFloat, az as raiseFloat, aA as readDockState, aB as resizeEdge, aC as resizeFloat, aD as setRailMode, aE as setSide, aF as storeDockState } from './drag-CyrphFye.js';
|
|
3
|
+
import { Size, Point, Rect, Side, Target } from '@n-uf/placement';
|
|
4
|
+
export { Axis, Side } from '@n-uf/placement';
|
|
4
5
|
import '@n-uf/placement/stack';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -38,6 +39,8 @@ declare const zonesTaking: (edge: ZoneDecl, kind: Kind) => Zone[];
|
|
|
38
39
|
declare const edgeTakes: (edge: ZoneDecl, kind: Kind) => boolean;
|
|
39
40
|
/** How the rails of `side` show their items (`DockState.railModes`, default `"titles"`); top and bottom have no rails. */
|
|
40
41
|
declare const railModeOf: (state: DockState, side: Side) => RailMode;
|
|
42
|
+
/** Whether a keep-clear entry is anchored to a region of the layout (`AnchoredKeepClear`), not a fixed rect. */
|
|
43
|
+
declare const isAnchoredKeepClear: (c: KeepClear | AnchoredKeepClear) => c is AnchoredKeepClear;
|
|
41
44
|
/**
|
|
42
45
|
* The zone `item` lies in on `edge`: its own (`align`) where the edge takes its kind there, else the first zone that
|
|
43
46
|
* does; one the edge takes nowhere, in its own. A fixed item lies in its own where the edge has that zone (`zones`),
|
|
@@ -168,7 +171,7 @@ declare function reservedRect(state: DockState, l: DockLayout, id: string): Rect
|
|
|
168
171
|
* `column:<side>` (a side's column lines) and `rail:<side>` (its rail): `virtualEdgeId`.
|
|
169
172
|
*/
|
|
170
173
|
|
|
171
|
-
type ColumnSide = "left" | "right"
|
|
174
|
+
type ColumnSide = Extract<Side, "left" | "right">;
|
|
172
175
|
/** A `DropPlace`, as much of it as an id reads (this module imports no more of the state, so `solve` may use it). */
|
|
173
176
|
type PlaceLike = {
|
|
174
177
|
readonly kind: "gap";
|
|
@@ -338,4 +341,4 @@ declare function refusalTargets(list: readonly DockRefusal[]): DockRefusalTarget
|
|
|
338
341
|
*/
|
|
339
342
|
declare function stops(state: DockState, dragged: string, options?: DockDropOptions): DockDrop[];
|
|
340
343
|
|
|
341
|
-
export { type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, Kind, Orient, RailMode,
|
|
344
|
+
export { AnchoredKeepClear, type DockDivider, DockDrop, DockDropOptions, DockEdge, DockItem, DockLayout, DockRefusal, type DockRefusalTarget, DockState, FloatAnchor, FloatAnchorAt, KeepClear, Kind, Orient, RailMode, SolveOptions, type TargetIdParts, Zone, ZoneAccepts, anchorName, declaresFloatSizes, dividers, edgeTakes, floatOrientOf, floatSizeOf, heldRect, isAnchoredKeepClear, isOutsideSideBar, isSideBar, isSideColumn, namesZone, parseTargetId, placeTargetId, railModeOf, refusalTargets, refusals, reservedRect, resetBetween, resetLengths, resizeBetween, solve, stops, targetId, targets, virtualEdgeId, zoneIn, zoneTakes, zonesTaking };
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
foldItem,
|
|
29
29
|
heldRect,
|
|
30
30
|
homeFor,
|
|
31
|
+
isAnchoredKeepClear,
|
|
31
32
|
isOutsideSideBar,
|
|
32
33
|
isSideBar,
|
|
33
34
|
isSideColumn,
|
|
@@ -64,7 +65,7 @@ import {
|
|
|
64
65
|
zoneIn,
|
|
65
66
|
zoneTakes,
|
|
66
67
|
zonesTaking
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-JBKUC72Z.js";
|
|
68
69
|
export {
|
|
69
70
|
DEFAULT_FLOAT_SIZE,
|
|
70
71
|
DEFAULT_HIT_BAND,
|
|
@@ -95,6 +96,7 @@ export {
|
|
|
95
96
|
foldItem,
|
|
96
97
|
heldRect,
|
|
97
98
|
homeFor,
|
|
99
|
+
isAnchoredKeepClear,
|
|
98
100
|
isOutsideSideBar,
|
|
99
101
|
isSideBar,
|
|
100
102
|
isSideColumn,
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Point, Rect } from '@n-uf/placement';
|
|
1
|
+
import { Point, Rect, Side } from '@n-uf/placement';
|
|
2
2
|
import { StackFormKind } from '@n-uf/placement/stack';
|
|
3
|
-
import { c as DockState,
|
|
3
|
+
import { c as DockState, N as DropPlace, f as DockLayout, ae as StoredDockState, b as Zone, G as DockNoteCode, i as DockDrop, g as DockRefusal, z as DockLaneOptions, u as DockHeld, t as DockGuideRef, J as DockRegions, L as DockSpot } from './drag-CyrphFye.js';
|
|
4
4
|
import { LandingGeometry, LandingRegions } from '@n-uf/motion/drag';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -125,8 +125,8 @@ interface LayoutExpect {
|
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* What a page's DOM must be. The elements are the session's: `data-drag-session="<kind>"` on the root during a drag
|
|
128
|
-
* only, `[data-drag-slot][data-drag-target]` for the slot (the attribute holds the target's id
|
|
129
|
-
*
|
|
128
|
+
* only, `[data-drag-slot][data-drag-target]` for the slot (the attribute holds the target's id; a landing draws that one
|
|
129
|
+
* mark, so a page shows no `[data-drag-marker]` insertion line beside it), `[data-drag-held]` for the held item, `[data-drag-refusal]` for a refusal shown at the pointer
|
|
130
130
|
* ("Can't go here", never a mark over the refused place; the attribute holds the refusal's id). A drawn item's element is found by `item`: the host's
|
|
131
131
|
* `itemSelector(id)`, by default `[data-dock-item="<id>"]` (a rect check reads it).
|
|
132
132
|
*/
|
package/dist/testing.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
stops,
|
|
19
19
|
storeDockState,
|
|
20
20
|
targets
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JBKUC72Z.js";
|
|
22
22
|
|
|
23
23
|
// src/testing/rows-docking.ts
|
|
24
24
|
import { rect as r } from "@n-uf/placement";
|
|
@@ -414,7 +414,7 @@ var DOCKING_ROWS = [
|
|
|
414
414
|
expectDom: [
|
|
415
415
|
{ at: 2, attr: { "data-drag-session": "panel" }, note: "the root says a panel is dragged" },
|
|
416
416
|
{ at: 2, select: "[data-drag-slot][data-drag-target]", count: 1, attr: { "data-drag-target": "gap:column:start:0" }, note: "one slot, on the top gap" },
|
|
417
|
-
{ at: 2, select: "[data-drag-marker]", count:
|
|
417
|
+
{ at: 2, select: "[data-drag-marker]", count: 0, note: "no insertion line beside it: a gap landing draws one mark, the slot" },
|
|
418
418
|
{ at: 2, select: "[data-drag-held]", count: 1, note: "the held item" },
|
|
419
419
|
{ at: 3, attr: { "data-drag-session": null }, note: "the session ends with the drop" },
|
|
420
420
|
{ at: 3, select: "[data-drag-slot]", count: 0, note: "no slot after the drop" }
|