@danxbot/ui 20.13.1 → 20.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.
@@ -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
  }>>;
@@ -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,6 +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.
22
+ *
19
23
  * AN EDGE INTENT TRUMPS THE NEIGHBOURS. "Move to top" in a window that starts
20
24
  * at card 221 means the top of the column, which no loaded neighbour can say,
21
25
  * so the anchor carries the edge and no ids.
@@ -28,6 +32,7 @@ import type { BoardEdge, BoardItemId, BoardMove } from "./types";
28
32
  * afterId it lands directly below this one: only when it lands after the last
29
33
  * loaded card, where nothing is below to name
30
34
  * 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.
31
36
  */
32
37
  export type MoveAnchor = {
33
38
  beforeId: BoardItemId;
@@ -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";
@@ -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. 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;
@@ -6,7 +6,7 @@
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
11
  export { DragSession, type StartArgs } from "./session";
12
12
  export { attachPointerSensor, attachSessionWindowListeners, type PointerActivation, type PointerSensorOptions, } from "./sensors/pointer";
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "20.13.1",
3
+ "version": "20.14.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",