@danxbot/ui 20.13.2 → 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 +7684 -7614
- package/dist/index.js.map +1 -1
- package/dist/types/components/Board.d.ts +19 -2
- package/dist/types/components/DragDrop.d.ts +11 -2
- package/dist/types/components/board/context.d.ts +3 -0
- package/dist/types/components/board/recipe.d.ts +3 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/lib/board/anchor.d.ts +18 -2
- package/dist/types/lib/board/index.d.ts +1 -1
- package/dist/types/lib/board/move.d.ts +12 -2
- package/dist/types/lib/board/types.d.ts +23 -5
- package/dist/types/lib/dnd/announce.d.ts +10 -0
- package/dist/types/lib/dnd/cross-drop.d.ts +18 -0
- package/dist/types/lib/dnd/index.d.ts +2 -1
- package/dist/types/lib/dnd/session.d.ts +3 -1
- package/dist/types/lib/dnd/types.d.ts +12 -0
- package/dist/types/lib/dnd/use-drag.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { AutoScrollOptions, DragStrings } from "../lib/dnd";
|
|
2
|
+
import type { AutoScrollOptions, CrossDrop, DragStrings } from "../lib/dnd";
|
|
3
3
|
import type { BoardColumnModel, BoardItemId, UseBoardOptions, UseBoardResult } from "../lib/board";
|
|
4
4
|
import { type BoardReorderLabels } from "./board/context";
|
|
5
5
|
export interface BoardProps<T> extends UseBoardOptions<T> {
|
|
@@ -11,6 +11,23 @@ export interface BoardProps<T> extends UseBoardOptions<T> {
|
|
|
11
11
|
* "Move to bottom".
|
|
12
12
|
*/
|
|
13
13
|
reorderLabels?: Partial<BoardReorderLabels>;
|
|
14
|
+
/**
|
|
15
|
+
* DX-4583: what dropping a card on ANOTHER lane means.
|
|
16
|
+
*
|
|
17
|
+
* `"position"` (the default) is a drop at a place: the lane's cards part, a
|
|
18
|
+
* marker shows the slot, and the `BoardMove` carries that `index`.
|
|
19
|
+
*
|
|
20
|
+
* `"lane"` is a lane change and nothing else, for a board whose lanes are
|
|
21
|
+
* ordered by something a drop cannot set (a rank the card already has): the
|
|
22
|
+
* whole lane is highlighted, no marker shows and no card moves, and the
|
|
23
|
+
* `BoardMove` is `{ columnId, lane: true }` with no position. The card menu's
|
|
24
|
+
* "Move to <lane>" items send the same move, and the live region says the lane
|
|
25
|
+
* rather than a position. Inside the card's own lane a drag is still a
|
|
26
|
+
* positional drop either way. Whether a drag is over "another lane" is read
|
|
27
|
+
* from the drag session's own `from.container` and `over.container`, never
|
|
28
|
+
* from card counts.
|
|
29
|
+
*/
|
|
30
|
+
crossLaneDrop?: CrossDrop;
|
|
14
31
|
/** Forwarded to `DragDrop` — see its own doc; cannot be turned off. */
|
|
15
32
|
autoScroll?: AutoScrollOptions;
|
|
16
33
|
className?: string;
|
|
@@ -49,7 +66,7 @@ export interface BoardProps<T> extends UseBoardOptions<T> {
|
|
|
49
66
|
* returns. */
|
|
50
67
|
children: (board: UseBoardResult<T>) => ReactNode;
|
|
51
68
|
}
|
|
52
|
-
export declare function Board<T>({ items, columns, accessors, validateMove, onMove, selection, strings, reorderLabels, autoScroll, className, columnsClassName, renderDragging, children, }: BoardProps<T>): import("react").JSX.Element;
|
|
69
|
+
export declare function Board<T>({ items, columns, accessors, validateMove, onMove, selection, strings, reorderLabels, crossLaneDrop, autoScroll, className, columnsClassName, renderDragging, children, }: BoardProps<T>): import("react").JSX.Element;
|
|
53
70
|
export interface BoardCardSurfaceProps {
|
|
54
71
|
className?: string;
|
|
55
72
|
children?: ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type AutoScrollOptions, type ContainerId, type DragAxis, type DragId, type DragSessionCallbacks, type DragStrings } from "../lib/dnd";
|
|
2
|
+
import { type AutoScrollOptions, type ContainerId, type CrossDrop, type DragAxis, type DragId, type DragSessionCallbacks, type DragStrings } from "../lib/dnd";
|
|
3
3
|
export interface DragDropProps extends DragSessionCallbacks {
|
|
4
4
|
/** Override any subset of the announcement grammar — localisation, or a domain noun. */
|
|
5
5
|
strings?: Partial<DragStrings>;
|
|
@@ -46,10 +46,19 @@ export interface DragDropContainerProps {
|
|
|
46
46
|
offset?: number;
|
|
47
47
|
/** The whole list's length, counting the carried item when it lives here. See `offset`. */
|
|
48
48
|
total?: number;
|
|
49
|
+
/**
|
|
50
|
+
* DX-4583: what a card carried in from ANOTHER container means here.
|
|
51
|
+
* `"position"` (the default) lands it at an index, siblings parting and a
|
|
52
|
+
* marker showing where. `"lane"` lands it in this container as a whole: no gap
|
|
53
|
+
* opens and no marker shows, because there is no position to show — the
|
|
54
|
+
* consumer decides what the drop writes (see `Board`'s `crossLaneDrop`). A
|
|
55
|
+
* card carried inside its own container is always positional.
|
|
56
|
+
*/
|
|
57
|
+
crossDrop?: CrossDrop;
|
|
49
58
|
className?: string;
|
|
50
59
|
children?: ReactNode;
|
|
51
60
|
}
|
|
52
|
-
export declare function DragDropContainer({ id, label, axis, offset, total, className, children, }: DragDropContainerProps): import("react").JSX.Element;
|
|
61
|
+
export declare function DragDropContainer({ id, label, axis, offset, total, crossDrop, className, children, }: DragDropContainerProps): import("react").JSX.Element;
|
|
53
62
|
export interface DragDropItemProps {
|
|
54
63
|
id: DragId;
|
|
55
64
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BoardColumnId, BoardColumnModel, BoardItemId, BoardMoveRequest, BoardMoveVerdict } from "../../lib/board";
|
|
2
|
+
import type { CrossDrop } from "../../lib/dnd";
|
|
2
3
|
export declare const BoardCardSurfaceContext: import("react").Context<boolean>;
|
|
3
4
|
/** `true` when an ancestor `BoardCardSurface` makes this whole card draggable. */
|
|
4
5
|
export declare function useBoardCardIsDragSource(): boolean;
|
|
@@ -23,6 +24,8 @@ export interface BoardContextValue<T> {
|
|
|
23
24
|
requestMove: (request: BoardMoveRequest) => BoardMoveVerdict;
|
|
24
25
|
/** The words for the card menu's within-column items (`Board`'s `reorderLabels`). */
|
|
25
26
|
reorderLabels: BoardReorderLabels;
|
|
27
|
+
/** What a card dropped on another lane means — `Board`'s `crossLaneDrop`. */
|
|
28
|
+
crossLaneDrop: CrossDrop;
|
|
26
29
|
}
|
|
27
30
|
/** The card menu's within-column items. DX-4575: a consumer that calls moving inside a list something else renames them. */
|
|
28
31
|
export interface BoardReorderLabels {
|
|
@@ -28,6 +28,7 @@ export declare const board: import("tailwind-variants").TVReturnType<{
|
|
|
28
28
|
handleCluster: string;
|
|
29
29
|
menuTrigger: string[];
|
|
30
30
|
reorderLocked: string[];
|
|
31
|
+
laneDrop: string[];
|
|
31
32
|
rejection: string[];
|
|
32
33
|
}, undefined, {
|
|
33
34
|
overWip: {
|
|
@@ -59,6 +60,7 @@ export declare const board: import("tailwind-variants").TVReturnType<{
|
|
|
59
60
|
handleCluster: string;
|
|
60
61
|
menuTrigger: string[];
|
|
61
62
|
reorderLocked: string[];
|
|
63
|
+
laneDrop: string[];
|
|
62
64
|
rejection: string[];
|
|
63
65
|
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
64
66
|
overWip: {
|
|
@@ -90,5 +92,6 @@ export declare const board: import("tailwind-variants").TVReturnType<{
|
|
|
90
92
|
handleCluster: string;
|
|
91
93
|
menuTrigger: string[];
|
|
92
94
|
reorderLocked: string[];
|
|
95
|
+
laneDrop: string[];
|
|
93
96
|
rejection: string[];
|
|
94
97
|
}>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -111,11 +111,11 @@ export { tokenize, listLanguages, resolveLanguage, defineGrammar, registerGramma
|
|
|
111
111
|
export { parseMarkdown, MarkdownNodes, sanitizeHref, type MdNode, type MdInline, type MdCodeRenderer, } from "./lib/syntax/markdown";
|
|
112
112
|
export { DragDrop, DragDropContainer, DragDropItem, DragDropHandle, DragDropSurface, type DragDropProps, type DragDropContainerProps, type DragDropItemProps, type DragDropHandleProps, type DragDropSurfaceProps, } from "./components/DragDrop";
|
|
113
113
|
export { KanbanBoard, type KanbanBoardProps, type KanbanLane, type KanbanMove, type KanbanRefusal, } from "./components/kanban/KanbanBoard";
|
|
114
|
-
export { DEFAULT_DRAG_STRINGS, DRAG_INSTRUCTIONS_ID, DragInstructions, DragLiveRegion, DragSession, DragSessionProvider, applyMove, attachAutoScroll, attachKeyboardSensor, attachPointerSensor, attachSessionWindowListeners, isNoOp, resolveTarget, sameTarget, scrollVelocity, useCreateDragSession, useDragAnnouncements, useDragSession, useDragState, useDragLive, useDraggable, useDropContainer, type ContainerId, type DragAxis, type DragCancelEvent, type DragEndEvent, type DragId, type DragMode, type DragPhase, type DragSessionCallbacks, type DragStartEvent, type DragState, type AutoScrollOptions, type DragAnnouncementContext, type DragAnnouncementOptions, type DragAnnouncements, type DragInstructionsProps, type DragLiveRegionProps, type DragStrings, type DropTarget, type KeyboardSensorOptions, type PointerActivation, } from "./lib/dnd";
|
|
114
|
+
export { DEFAULT_DRAG_STRINGS, DRAG_INSTRUCTIONS_ID, DragInstructions, DragLiveRegion, DragSession, DragSessionProvider, applyMove, attachAutoScroll, attachKeyboardSensor, attachPointerSensor, attachSessionWindowListeners, isNoOp, resolveTarget, sameTarget, scrollVelocity, useCreateDragSession, useDragAnnouncements, useDragSession, useDragState, useDragLive, useDraggable, useDropContainer, type ContainerId, type CrossDrop, type DragAxis, type DragCancelEvent, type DragEndEvent, type DragId, type DragMode, type DragPhase, type DragSessionCallbacks, type DragStartEvent, type DragState, type AutoScrollOptions, type DragAnnouncementContext, type DragAnnouncementOptions, type DragAnnouncements, type DragInstructionsProps, type DragLiveRegionProps, type DragStrings, type DropTarget, type KeyboardSensorOptions, type PointerActivation, } from "./lib/dnd";
|
|
115
115
|
export { Board, BoardColumn, BoardCard, BoardCardSurface, type BoardProps, type BoardColumnProps, type BoardCardProps, type BoardCardSurfaceProps, } from "./components/Board";
|
|
116
116
|
export type { BoardReorderLabels } from "./components/board/context";
|
|
117
117
|
export { buildBoardModel, resolveMove, applyBoardMoves, useBoard, moveAnchor, columnLength, positionInColumn, type BoardModel, type MoveAnchor, type UseBoardResult, } from "./lib/board";
|
|
118
|
-
export type { BoardAccessors, BoardColumnDef, BoardEdge, BoardColumnId, BoardColumnModel, BoardItemId, BoardMove, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, UseBoardOptions, } from "./lib/board";
|
|
118
|
+
export type { BoardAccessors, BoardColumnDef, BoardEdge, BoardColumnId, BoardColumnModel, BoardItemId, BoardMove, BoardMoveTarget, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, UseBoardOptions, } from "./lib/board";
|
|
119
119
|
export { PagedWindowList, type PagedWindowItemPosition, type PagedWindowListProps, type PagedWindowStrings, } from "./components/PagedWindowList";
|
|
120
120
|
export { PagedWindowStore, usePagedWindow, windowPageNumbers, type LoadCount, type LoadPage, type LoadPageContext, type PageResponse, type PageSnapshot, type PageStatus, type PagedWindow, type PagedWindowMode, type PagedWindowOptions, type PagedWindowSnapshot, type UsePagedWindowOptions, } from "./lib/paged-window";
|
|
121
121
|
export type { MessageRole, MessagePart, TextPart, CodePart, ReasoningPart, ToolPart, ToolStatus, FilePart, ComponentPart, ChatFile, ChatMessage, RenderContext, PartRenderer, PartRenderers, ChatComponentRenderer, ChatComponents, } from "./components/chat/types";
|
|
@@ -16,35 +16,51 @@
|
|
|
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 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".
|
|
23
|
+
*
|
|
19
24
|
* AN EDGE INTENT TRUMPS THE NEIGHBOURS. "Move to top" in a window that starts
|
|
20
25
|
* at card 221 means the top of the column, which no loaded neighbour can say,
|
|
21
26
|
* so the anchor carries the edge and no ids.
|
|
22
27
|
*/
|
|
23
28
|
import type { BoardEdge, BoardItemId, BoardMove } from "./types";
|
|
24
29
|
/**
|
|
25
|
-
* EXACTLY ONE
|
|
26
|
-
*
|
|
30
|
+
* EXACTLY ONE field is set — a server's lane-move takes one — or none for an
|
|
31
|
+
* empty destination:
|
|
27
32
|
* beforeId the moved card lands directly above this loaded card
|
|
28
33
|
* afterId it lands directly below this one: only when it lands after the last
|
|
29
34
|
* loaded card, where nothing is below to name
|
|
30
35
|
* edge it goes to the very top or bottom of the whole column
|
|
36
|
+
* lane a lane move: no position at all, the card keeps its rank
|
|
37
|
+
* None is set for an empty destination.
|
|
31
38
|
*/
|
|
32
39
|
export type MoveAnchor = {
|
|
33
40
|
beforeId: BoardItemId;
|
|
34
41
|
afterId?: never;
|
|
35
42
|
edge?: never;
|
|
43
|
+
lane?: never;
|
|
36
44
|
} | {
|
|
37
45
|
afterId: BoardItemId;
|
|
38
46
|
beforeId?: never;
|
|
39
47
|
edge?: never;
|
|
48
|
+
lane?: never;
|
|
40
49
|
} | {
|
|
41
50
|
edge: BoardEdge;
|
|
42
51
|
beforeId?: never;
|
|
43
52
|
afterId?: never;
|
|
53
|
+
lane?: never;
|
|
54
|
+
} | {
|
|
55
|
+
lane: true;
|
|
56
|
+
beforeId?: never;
|
|
57
|
+
afterId?: never;
|
|
58
|
+
edge?: never;
|
|
44
59
|
} | {
|
|
45
60
|
beforeId?: never;
|
|
46
61
|
afterId?: never;
|
|
47
62
|
edge?: never;
|
|
63
|
+
lane?: never;
|
|
48
64
|
};
|
|
49
65
|
/**
|
|
50
66
|
* @param destinationItems the destination column's LOADED cards (the moved card
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* NOT wired into the package's top-level `src/index.ts` — that barrel is
|
|
9
9
|
* owned by the contract's author, not this agent (see this round's brief).
|
|
10
10
|
*/
|
|
11
|
-
export type { BoardAccessors, BoardColumnDef, BoardEdge, BoardColumnId, BoardColumnModel, BoardItemId, BoardMove, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, UseBoardOptions, } from "./types";
|
|
11
|
+
export type { BoardAccessors, BoardColumnDef, BoardEdge, BoardColumnId, BoardColumnModel, BoardItemId, BoardMove, BoardMoveTarget, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, UseBoardOptions, } from "./types";
|
|
12
12
|
export { buildBoardModel, type BoardModel } from "./model";
|
|
13
13
|
export { moveAnchor, type MoveAnchor } from "./anchor";
|
|
14
14
|
export { columnLength, positionInColumn } from "./position";
|
|
@@ -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
|
|
@@ -126,12 +126,30 @@ export interface BoardMove {
|
|
|
126
126
|
columnId: BoardColumnId;
|
|
127
127
|
index: number;
|
|
128
128
|
};
|
|
129
|
-
to:
|
|
130
|
-
columnId: BoardColumnId;
|
|
131
|
-
index: number;
|
|
132
|
-
edge?: BoardEdge;
|
|
133
|
-
};
|
|
129
|
+
to: BoardMoveTarget;
|
|
134
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Where a move lands: a place in the destination (`index`, and optionally the
|
|
133
|
+
* `edge` it stands for), or only the destination (`lane: true`).
|
|
134
|
+
*
|
|
135
|
+
* DX-4583: a lane move names no position, so it has no `index` to be wrong
|
|
136
|
+
* about. It is what a board produces when a card is carried into another lane
|
|
137
|
+
* and the consumer decided that a lane change is not also a reorder (`Board`'s
|
|
138
|
+
* `crossLaneDrop="lane"`): the card keeps whatever rank it already has in the
|
|
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
|
+
* that turns the option on cannot miss that there is no position to write.
|
|
141
|
+
*/
|
|
142
|
+
export type BoardMoveTarget = {
|
|
143
|
+
columnId: BoardColumnId;
|
|
144
|
+
index: number;
|
|
145
|
+
edge?: BoardEdge;
|
|
146
|
+
lane?: never;
|
|
147
|
+
} | {
|
|
148
|
+
columnId: BoardColumnId;
|
|
149
|
+
lane: true;
|
|
150
|
+
index?: never;
|
|
151
|
+
edge?: never;
|
|
152
|
+
};
|
|
135
153
|
/**
|
|
136
154
|
* Which input produced the move. Kept on the request rather than inferred
|
|
137
155
|
* downstream because the three that are not `"pointer"` are the ones with no
|
|
@@ -6,6 +6,12 @@ export interface DragAnnouncementContext {
|
|
|
6
6
|
/** `labelOf(id)` if supplied, otherwise the id — which is at least speakable. */
|
|
7
7
|
label: string;
|
|
8
8
|
container: ContainerId;
|
|
9
|
+
/**
|
|
10
|
+
* DX-4583: the container the card was picked up from. A message whose
|
|
11
|
+
* `container` differs from it describes a card in another container, which is
|
|
12
|
+
* the case where a consumer may mean "this lane" and no position at all.
|
|
13
|
+
*/
|
|
14
|
+
from: ContainerId;
|
|
9
15
|
containerLabel: string;
|
|
10
16
|
/** 1-based, as spoken, in the WHOLE container — a windowed container reports its real offset and length (DX-4540). */
|
|
11
17
|
position: number;
|
|
@@ -23,6 +29,10 @@ export interface DragStrings {
|
|
|
23
29
|
picked: (c: DragAnnouncementContext) => string;
|
|
24
30
|
moved: (c: DragAnnouncementContext) => string;
|
|
25
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;
|
|
26
36
|
/** Describes the item's ORIGINAL position — cancel is a restore, not a move. */
|
|
27
37
|
cancelled: (c: DragAnnouncementContext) => string;
|
|
28
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;
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* delete, and esbuild does; that is exactly how this project once shipped an
|
|
7
7
|
* empty icon registry (CAV-11).
|
|
8
8
|
*/
|
|
9
|
-
export type { ContainerId, ContainerRect, ContainerRegistration, DragAxis, DragCancelEvent, DragEndEvent, DragId, DragMode, DragPhase, DragSessionCallbacks, DragStartEvent, DragState, DropTarget, ItemRect, ItemRegistration, LayoutSnapshot, Point, } from "./types";
|
|
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
|
}
|
|
@@ -104,7 +104,17 @@ export interface ContainerRegistration {
|
|
|
104
104
|
offset?: number;
|
|
105
105
|
/** The whole list's length, the carried item counted in it when it lives here. See `offset`. */
|
|
106
106
|
total?: number;
|
|
107
|
+
/**
|
|
108
|
+
* DX-4583: what a card carried in from ANOTHER container means here. Absent or
|
|
109
|
+
* `"position"`, it lands at an index: siblings part and a marker shows where.
|
|
110
|
+
* `"lane"`, it lands in the container as a whole and no index is meant: no gap
|
|
111
|
+
* opens, no marker shows, and the consumer decides what the drop writes. A
|
|
112
|
+
* card carried inside its own container is always positional.
|
|
113
|
+
*/
|
|
114
|
+
crossDrop?: CrossDrop;
|
|
107
115
|
}
|
|
116
|
+
/** See `ContainerRegistration.crossDrop`. */
|
|
117
|
+
export type CrossDrop = "position" | "lane";
|
|
108
118
|
/** One item's measured box, taken at snapshot time. */
|
|
109
119
|
export interface ItemRect {
|
|
110
120
|
id: DragId;
|
|
@@ -115,6 +125,8 @@ export interface ItemRect {
|
|
|
115
125
|
export interface ContainerRect {
|
|
116
126
|
id: ContainerId;
|
|
117
127
|
axis: DragAxis;
|
|
128
|
+
/** Copied from the registration — see `ContainerRegistration.crossDrop`. */
|
|
129
|
+
crossDrop?: CrossDrop;
|
|
118
130
|
rect: DOMRect;
|
|
119
131
|
}
|
|
120
132
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DragSession } from "./session";
|
|
2
2
|
import type { PointerActivation } from "./sensors/pointer";
|
|
3
|
-
import type { ContainerId, DragAxis, DragId, DragSessionCallbacks, DragState } from "./types";
|
|
3
|
+
import type { ContainerId, CrossDrop, DragAxis, DragId, DragSessionCallbacks, DragState } from "./types";
|
|
4
4
|
export declare const DragSessionProvider: import("react").Provider<DragSession | null>;
|
|
5
5
|
export declare function useDragSession(component: string): DragSession;
|
|
6
6
|
/**
|
|
@@ -59,6 +59,8 @@ export interface UseDropContainerOptions {
|
|
|
59
59
|
offset?: number;
|
|
60
60
|
/** See `ContainerRegistration.total` — a windowed container's whole length. */
|
|
61
61
|
total?: number;
|
|
62
|
+
/** See `ContainerRegistration.crossDrop`. */
|
|
63
|
+
crossDrop?: CrossDrop;
|
|
62
64
|
}
|
|
63
65
|
export interface UseDropContainerResult {
|
|
64
66
|
setContainerRef: (el: HTMLElement | null) => void;
|