@danxbot/ui 20.14.0 → 20.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.
- package/dist/index.js +6118 -6093
- package/dist/index.js.map +1 -1
- package/dist/types/lib/board/anchor.d.ts +17 -6
- package/dist/types/lib/board/move.d.ts +12 -2
- package/dist/types/lib/board/types.d.ts +1 -1
- package/dist/types/lib/dnd/announce.d.ts +4 -0
- package/dist/types/lib/dnd/cross-drop.d.ts +18 -0
- package/dist/types/lib/dnd/index.d.ts +1 -0
- package/dist/types/lib/dnd/session.d.ts +3 -1
- package/package.json +1 -1
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
* only at the end of the loaded run, where nothing is below, the card it lands
|
|
17
17
|
* directly below (`afterId`). An empty destination names nothing.
|
|
18
18
|
*
|
|
19
|
-
* A LANE MOVE
|
|
20
|
-
* neighbour to anchor to:
|
|
21
|
-
* own rank
|
|
19
|
+
* A LANE MOVE IS ITS OWN ANSWER (DX-4583). It carries no position, so there is
|
|
20
|
+
* no neighbour to anchor to, and `{ lane: true }` says so: the server changes
|
|
21
|
+
* the card's lane and keeps its own rank. That is not the empty anchor, which
|
|
22
|
+
* says "the destination has no cards, so this is the first".
|
|
22
23
|
*
|
|
23
24
|
* AN EDGE INTENT TRUMPS THE NEIGHBOURS. "Move to top" in a window that starts
|
|
24
25
|
* at card 221 means the top of the column, which no loaded neighbour can say,
|
|
@@ -26,30 +27,40 @@
|
|
|
26
27
|
*/
|
|
27
28
|
import type { BoardEdge, BoardItemId, BoardMove } from "./types";
|
|
28
29
|
/**
|
|
29
|
-
* EXACTLY ONE
|
|
30
|
-
*
|
|
30
|
+
* EXACTLY ONE field is set — a server's lane-move takes one — or none for an
|
|
31
|
+
* empty destination:
|
|
31
32
|
* beforeId the moved card lands directly above this loaded card
|
|
32
33
|
* afterId it lands directly below this one: only when it lands after the last
|
|
33
34
|
* loaded card, where nothing is below to name
|
|
34
35
|
* edge it goes to the very top or bottom of the whole column
|
|
35
|
-
*
|
|
36
|
+
* lane a lane move: no position at all, the card keeps its rank
|
|
37
|
+
* None is set for an empty destination.
|
|
36
38
|
*/
|
|
37
39
|
export type MoveAnchor = {
|
|
38
40
|
beforeId: BoardItemId;
|
|
39
41
|
afterId?: never;
|
|
40
42
|
edge?: never;
|
|
43
|
+
lane?: never;
|
|
41
44
|
} | {
|
|
42
45
|
afterId: BoardItemId;
|
|
43
46
|
beforeId?: never;
|
|
44
47
|
edge?: never;
|
|
48
|
+
lane?: never;
|
|
45
49
|
} | {
|
|
46
50
|
edge: BoardEdge;
|
|
47
51
|
beforeId?: never;
|
|
48
52
|
afterId?: never;
|
|
53
|
+
lane?: never;
|
|
49
54
|
} | {
|
|
55
|
+
lane: true;
|
|
50
56
|
beforeId?: never;
|
|
51
57
|
afterId?: never;
|
|
52
58
|
edge?: never;
|
|
59
|
+
} | {
|
|
60
|
+
beforeId?: never;
|
|
61
|
+
afterId?: never;
|
|
62
|
+
edge?: never;
|
|
63
|
+
lane?: never;
|
|
53
64
|
};
|
|
54
65
|
/**
|
|
55
66
|
* @param destinationItems the destination column's LOADED cards (the moved card
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
* WITH THE DRAGGED ITEM ALREADY REMOVED — has no obvious generalisation to N
|
|
67
67
|
* items removed from possibly-different columns at once, and `types.ts`
|
|
68
68
|
* does not pick one; that is this module's decision to make and document.
|
|
69
|
-
* THE RULE: every move's `to.index`, bulk or not, counts its destination
|
|
69
|
+
* THE RULE: every positional move's `to.index`, bulk or not, counts its destination
|
|
70
70
|
* column's items with EVERY item named ANYWHERE in the same request already
|
|
71
71
|
* removed — not just itself. For a single-move request that is identical to
|
|
72
72
|
* the engine's own rule (nothing else is being removed). For a bulk request
|
|
@@ -92,7 +92,10 @@
|
|
|
92
92
|
* order), each inserted at `to.index + (insertions already made into this
|
|
93
93
|
* column)`. That running offset is exactly what accounts for earlier
|
|
94
94
|
* insertions shifting the positions later ones land at, computed once
|
|
95
|
-
* instead of re-derived per move.
|
|
95
|
+
* instead of re-derived per move. A LANE MOVE (`to.lane`, DX-4583) has no
|
|
96
|
+
* index, so it takes no part in this pass: it neither leaves the residual nor
|
|
97
|
+
* is inserted, and the card stays where the consumer's order already holds it
|
|
98
|
+
* once the consumer has written its lane. board-core.test.ts pins a concrete bulk
|
|
96
99
|
* case where the naive sequential-splice answer and this one visibly differ,
|
|
97
100
|
* so the property is proven rather than incidentally true.
|
|
98
101
|
*
|
|
@@ -146,6 +149,13 @@ export declare function resolveMove<T>(context: ResolveMoveContext<T>, request:
|
|
|
146
149
|
* column membership on every subsequent `buildBoardModel` call, and
|
|
147
150
|
* `buildBoardModel` only ever reads WITHIN-column order.
|
|
148
151
|
*
|
|
152
|
+
* A LANE MOVE (`to.lane`, DX-4583) CHANGES MEMBERSHIP AND NOTHING ELSE. The
|
|
153
|
+
* card stays at its place in `items`, so it lands among the destination's cards
|
|
154
|
+
* where the consumer's own order puts it (its priority, its sort key). The
|
|
155
|
+
* consumer's lane write must already be made, because this function cannot make
|
|
156
|
+
* it: a lane move whose item still reports another lane throws, since the card
|
|
157
|
+
* would otherwise stay in its old lane without a sound.
|
|
158
|
+
*
|
|
149
159
|
* `to.edge` IS NOT APPLIED HERE. This arranges the cards it was given, and in a
|
|
150
160
|
* windowed column an edge move lands OUTSIDE the cards that are loaded — at the
|
|
151
161
|
* top or bottom of a list this function cannot see — so the index it would
|
|
@@ -136,7 +136,7 @@ export interface BoardMove {
|
|
|
136
136
|
* about. It is what a board produces when a card is carried into another lane
|
|
137
137
|
* and the consumer decided that a lane change is not also a reorder (`Board`'s
|
|
138
138
|
* `crossLaneDrop="lane"`): the card keeps whatever rank it already has in the
|
|
139
|
-
* consumer's data. Narrow on `to.lane` before reading `to.index`, so a consumer
|
|
139
|
+
* consumer's data, and `applyBoardMoves` leaves it where the consumer's order holds it. Narrow on `to.lane` before reading `to.index`, so a consumer
|
|
140
140
|
* that turns the option on cannot miss that there is no position to write.
|
|
141
141
|
*/
|
|
142
142
|
export type BoardMoveTarget = {
|
|
@@ -29,6 +29,10 @@ export interface DragStrings {
|
|
|
29
29
|
picked: (c: DragAnnouncementContext) => string;
|
|
30
30
|
moved: (c: DragAnnouncementContext) => string;
|
|
31
31
|
dropped: (c: DragAnnouncementContext) => string;
|
|
32
|
+
/** `moved`, for a card held over another container that takes it as a whole (`crossDrop: "lane"`): no position is spoken. */
|
|
33
|
+
movedToLane: (c: DragAnnouncementContext) => string;
|
|
34
|
+
/** `dropped`, for a card released over such a container. */
|
|
35
|
+
droppedInLane: (c: DragAnnouncementContext) => string;
|
|
32
36
|
/** Describes the item's ORIGINAL position — cancel is a restore, not a move. */
|
|
33
37
|
cancelled: (c: DragAnnouncementContext) => string;
|
|
34
38
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DX-4583: the one place that says what "a card dropped on another lane" means,
|
|
3
|
+
* so the drop, the highlight, the banner, the gap and the keyboard cannot drift
|
|
4
|
+
* into four spellings of the same predicate.
|
|
5
|
+
*/
|
|
6
|
+
import type { ContainerId, CrossDrop, DragState } from "./types";
|
|
7
|
+
/**
|
|
8
|
+
* True when a card carried from `from` into `to` lands there as a whole: the
|
|
9
|
+
* destination takes a lane drop and it is not the card's own container. A card
|
|
10
|
+
* carried inside its own container is always positional.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isLaneDrop(crossDrop: CrossDrop | undefined, from: ContainerId | null | undefined, to: ContainerId | null | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whose card is held over `container` right now: `"own"` when it was picked up
|
|
15
|
+
* from there, `"other"` when it came from another container, `null` when no card
|
|
16
|
+
* is held over it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function heldOver(state: DragState, container: ContainerId): "own" | "other" | null;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type { ContainerId, ContainerRect, ContainerRegistration, CrossDrop, DragAxis, DragCancelEvent, DragEndEvent, DragId, DragMode, DragPhase, DragSessionCallbacks, DragStartEvent, DragState, DropTarget, ItemRect, ItemRegistration, LayoutSnapshot, Point, } from "./types";
|
|
10
10
|
export { applyMove, containerAt, indexAt, isNoOp, measure, nearestContainer, remainingItems, resolveTarget, sameTarget, } from "./geometry";
|
|
11
|
+
export { heldOver, isLaneDrop } from "./cross-drop";
|
|
11
12
|
export { DragSession, type StartArgs } from "./session";
|
|
12
13
|
export { attachPointerSensor, attachSessionWindowListeners, type PointerActivation, type PointerSensorOptions, } from "./sensors/pointer";
|
|
13
14
|
export { attachKeyboardSensor, type KeyboardSensorOptions, } from "./sensors/keyboard";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContainerRegistration, DragId, DragMode, DragSessionCallbacks, DragState, ItemRegistration, LayoutSnapshot, Point } from "./types";
|
|
1
|
+
import type { ContainerRegistration, CrossDrop, DragId, DragMode, DragSessionCallbacks, DragState, ItemRegistration, LayoutSnapshot, Point } from "./types";
|
|
2
2
|
export interface StartArgs {
|
|
3
3
|
id: DragId;
|
|
4
4
|
mode: DragMode;
|
|
@@ -106,6 +106,8 @@ export declare class DragSession {
|
|
|
106
106
|
position: number;
|
|
107
107
|
total: number;
|
|
108
108
|
};
|
|
109
|
+
/** What a card carried in from another container means here — see `ContainerRegistration.crossDrop`. */
|
|
110
|
+
crossDropOf(container: string): CrossDrop | undefined;
|
|
109
111
|
/** How many items a container holds once the carried one is taken out. */
|
|
110
112
|
slotCount(container: string): number;
|
|
111
113
|
}
|