@danxbot/ui 20.14.0 → 20.16.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.
@@ -1,7 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type { AutoScrollOptions, CrossDrop, DragStrings } from "../lib/dnd";
3
- import type { BoardColumnModel, BoardItemId, UseBoardOptions, UseBoardResult } from "../lib/board";
4
- import { type BoardReorderLabels } from "./board/context";
3
+ import type { BoardColumnModel, BoardItemId, BoardReorderLabels, UseBoardOptions, UseBoardResult } from "../lib/board";
5
4
  export interface BoardProps<T> extends UseBoardOptions<T> {
6
5
  /** Forwarded to `DragDrop` — announcement grammar, localisation. */
7
6
  strings?: Partial<DragStrings>;
@@ -1,4 +1,4 @@
1
- import type { BoardColumnId, BoardColumnModel, BoardItemId, BoardMoveRequest, BoardMoveVerdict } from "../../lib/board";
1
+ import type { BoardColumnId, BoardColumnModel, BoardItemId, BoardMoveRequest, BoardMoveVerdict, BoardReorderLabels } from "../../lib/board";
2
2
  import type { CrossDrop } from "../../lib/dnd";
3
3
  export declare const BoardCardSurfaceContext: import("react").Context<boolean>;
4
4
  /** `true` when an ancestor `BoardCardSurface` makes this whole card draggable. */
@@ -27,11 +27,6 @@ export interface BoardContextValue<T> {
27
27
  /** What a card dropped on another lane means — `Board`'s `crossLaneDrop`. */
28
28
  crossLaneDrop: CrossDrop;
29
29
  }
30
- /** The card menu's within-column items. DX-4575: a consumer that calls moving inside a list something else renames them. */
31
- export interface BoardReorderLabels {
32
- toTop: string;
33
- toBottom: string;
34
- }
35
30
  /** What the menu says when `Board` is given no `reorderLabels`. */
36
31
  export declare const DEFAULT_REORDER_LABELS: BoardReorderLabels;
37
32
  export interface BoardColumnContextValue {
@@ -113,9 +113,8 @@ export { DragDrop, DragDropContainer, DragDropItem, DragDropHandle, DragDropSurf
113
113
  export { KanbanBoard, type KanbanBoardProps, type KanbanLane, type KanbanMove, type KanbanRefusal, } from "./components/kanban/KanbanBoard";
114
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
- export type { BoardReorderLabels } from "./components/board/context";
117
116
  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, BoardMoveTarget, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, UseBoardOptions, } from "./lib/board";
117
+ export type { BoardAccessors, BoardColumnDef, BoardEdge, BoardColumnId, BoardColumnModel, BoardItemId, BoardMove, BoardMoveTarget, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, BoardReorderLabels, UseBoardOptions, } from "./lib/board";
119
118
  export { PagedWindowList, type PagedWindowItemPosition, type PagedWindowListProps, type PagedWindowStrings, } from "./components/PagedWindowList";
120
119
  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
120
  export type { MessageRole, MessagePart, TextPart, CodePart, ReasoningPart, ToolPart, ToolStatus, FilePart, ComponentPart, ChatFile, ChatMessage, RenderContext, PartRenderer, PartRenderers, ChatComponentRenderer, ChatComponents, } from "./components/chat/types";
@@ -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 NAMES NOTHING (DX-4583). It carries no position, so there is no
20
- * neighbour to anchor to: the anchor is empty and the server keeps the card's
21
- * own rank in the new lane.
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 placement field is set — a server's lane-move takes one — or none
30
- * for an empty destination:
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
- * None is set for an empty destination and for a lane move.
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
@@ -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, BoardMoveTarget, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, UseBoardOptions, } from "./types";
11
+ export type { BoardAccessors, BoardColumnDef, BoardEdge, BoardColumnId, BoardColumnModel, BoardItemId, BoardMove, BoardMoveTarget, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, BoardReorderLabels, 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. board-core.test.ts pins a concrete bulk
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
@@ -104,6 +104,21 @@ export interface BoardColumnDef {
104
104
  * move all obey it, and the menu stops offering the within-column items.
105
105
  */
106
106
  reorderLocked?: string;
107
+ /**
108
+ * DX-4589: the words for THIS column's card-menu items that move a card to
109
+ * the column's visual top and bottom, replacing the Board's `reorderLabels`
110
+ * (then the defaults) for this column only. Partial, so a column renames one
111
+ * and inherits the other. The items stay positional: `toTop` moves to the
112
+ * visual top (`index` 0, `edge: "top"`), whatever order the column is sorted
113
+ * in, so a column sorted lowest-priority-first words `toTop` as the move that
114
+ * LOWERS the card.
115
+ */
116
+ reorderLabels?: Partial<BoardReorderLabels>;
117
+ }
118
+ /** The card menu's within-column items. DX-4575: a consumer that calls moving inside a list something else renames them. */
119
+ export interface BoardReorderLabels {
120
+ toTop: string;
121
+ toBottom: string;
107
122
  }
108
123
  /**
109
124
  * Where a move lands beyond what is loaded. In a windowed column `to.index` can
@@ -136,7 +151,7 @@ export interface BoardMove {
136
151
  * about. It is what a board produces when a card is carried into another lane
137
152
  * and the consumer decided that a lane change is not also a reorder (`Board`'s
138
153
  * `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
154
+ * 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
155
  * that turns the option on cannot miss that there is no position to write.
141
156
  */
142
157
  export type BoardMoveTarget = {
@@ -204,6 +219,8 @@ export interface BoardColumnModel<T> {
204
219
  overWip: boolean;
205
220
  /** The definition's `reorderLocked` sentence; `undefined` when the column can be reordered. */
206
221
  reorderLocked: string | undefined;
222
+ /** The definition's `reorderLabels`; `undefined` when the column words the items as the Board does. */
223
+ reorderLabels: Partial<BoardReorderLabels> | undefined;
207
224
  }
208
225
  export interface UseBoardOptions<T> {
209
226
  items: readonly T[];
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "20.14.0",
3
+ "version": "20.16.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",