@snapgridjs/react 0.4.0 → 0.6.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.d.cts CHANGED
@@ -1,153 +1,9 @@
1
+ import { DragConfig, DragConfig as DragConfig$1, DragSourceInfo, DragSourceInfo as DragSourceInfo$1, DropConfig, DropConfig as DropConfig$1, GridController, GridDropData, GridEventCallback, GridEventCallback as GridEventCallback$1, RESIZE_HANDLE_ATTR, ResizeConfig, ResizeConfig as ResizeConfig$1, SnapMoveContext, SnapMoveEvent, snapMove } from "@snapgridjs/dnd";
1
2
  import { CSSProperties, ReactNode } from "react";
2
- import { Modifiers, Sensors } from "@dnd-kit/abstract";
3
- import { DragDropManager, Feedback, KeyboardSensor, PointerSensor } from "@dnd-kit/dom";
4
- import { BreakpointCols, BreakpointCols as BreakpointCols$1, Breakpoints, Breakpoints as Breakpoints$1, CompactType, Compactor, Compactor as Compactor$1, DragSession, GridConfig, GridConfig as GridConfig$1, Layout, Layout as Layout$1, LayoutItem, LayoutItem as LayoutItem$1, PositionParams, PositionParams as PositionParams$1, ResizeHandleAxis, ResizeHandleAxis as ResizeHandleAxis$1, ResponsiveLayouts, ResponsiveLayouts as ResponsiveLayouts$1, getCompactor, horizontalCompactor, noCompactor, verticalCompactor } from "@snapgridjs/core";
3
+ import { BreakpointCols, BreakpointCols as BreakpointCols$1, Breakpoints, Breakpoints as Breakpoints$1, CompactType, Compactor, Compactor as Compactor$1, GridConfig, GridConfig as GridConfig$1, Layout, Layout as Layout$1, LayoutItem, LayoutItem as LayoutItem$1, PositionParams, ResizeHandleAxis, ResizeHandleAxis as ResizeHandleAxis$1, ResponsiveLayouts, ResponsiveLayouts as ResponsiveLayouts$1, defaultGridConfig, getCompactor, horizontalCompactor, insertItemWithCompactor, noCompactor, removeItemWithCompactor, toPositionParams, verticalCompactor } from "@snapgridjs/core";
5
4
  import { DragOverlay, useDraggable, useDroppable } from "@dnd-kit/react";
5
+ import { Feedback, KeyboardSensor, PointerSensor } from "@dnd-kit/dom";
6
6
 
7
- //#region src/controller/GridController.d.ts
8
- /**
9
- * Per-grid configuration the container host writes to the controller each render
10
- * (during render, so items that resolve this controller by `group` read fresh
11
- * config on the same pass). Replaces the fields the old GridContext exposed.
12
- */
13
- interface GridControllerConfig {
14
- positionParams: PositionParams$1;
15
- gridConfig: GridConfig$1;
16
- width: number;
17
- autoSize: boolean;
18
- itemSensors: Sensors;
19
- itemModifiers: Modifiers;
20
- isItemDraggable: (id: string) => boolean;
21
- isItemResizable: (id: string) => boolean;
22
- resizeHandlesFor: (id: string) => readonly ResizeHandleAxis$1[];
23
- /** Report the container element (used to map a pointer to a cell on receive). */
24
- setContainerElement: (element: Element | null) => void;
25
- }
26
- interface ItemSnapshot {
27
- item: LayoutItem$1 | undefined;
28
- isDragging: boolean;
29
- hidden: boolean;
30
- }
31
- interface ResizeSnapshot {
32
- isResizing: boolean;
33
- }
34
- /**
35
- * Live per-grid drag/resize state as a plain observable: the provider writes
36
- * (`setSession`/`setKeyboard`/`setCommitted`), hooks subscribe to just their own
37
- * slice via `useSyncExternalStore`. Value-cached snapshots mean a drag re-renders
38
- * only the tiles whose slice changed, not the whole subtree (the old
39
- * context-value model re-rendered every tile every frame).
40
- */
41
- declare class GridController {
42
- #private;
43
- id: string;
44
- config: GridControllerConfig | null;
45
- /** The dnd-kit manager this grid is registered with (set by useInstance). */
46
- manager: DragDropManager | undefined;
47
- constructor(id: string, committed?: Layout$1, manager?: DragDropManager);
48
- /** Replace the per-grid config (called by the container host during render). */
49
- setConfig(config: GridControllerConfig): void;
50
- /**
51
- * Re-point this grid's id. The container host syncs it (during render, before
52
- * the droppable/group read it) when the controlled `id` prop changes, so the
53
- * returned `group`, the droppable id, and the registry key never drift apart.
54
- */
55
- setId(id: string): void;
56
- register: () => void;
57
- subscribe: (listener: () => void) => (() => void);
58
- /**
59
- * Sync the committed layout from the controlled `layout` prop. Called during
60
- * the provider's render, so it must NOT notify — emitting here would update
61
- * subscribed GridItems mid-render (a React "setState while rendering" error).
62
- * No notify is needed: a `layout` prop change already re-renders the whole
63
- * provider subtree, so every GridItem re-reads its snapshot on that pass.
64
- */
65
- setCommitted(layout: Layout$1): void;
66
- setSession(next: DragSession | null): void;
67
- getSession(): DragSession | null;
68
- /** Record whether the active drag is keyboard-driven (drives `hidden`). */
69
- setKeyboard(value: boolean): void;
70
- itemSnapshot: (id: string) => ItemSnapshot;
71
- placeholderSnapshot: () => LayoutItem$1 | null;
72
- resizeSnapshot: (itemId: string) => ResizeSnapshot;
73
- renderedSnapshot: () => Layout$1;
74
- /** A stable index for `id` (see {@link GridController.#indexById}). */
75
- itemIndex(id: string): number;
76
- }
77
- //#endregion
78
- //#region src/types.d.ts
79
- /**
80
- * Drag behaviour configuration (mirrors react-grid-layout v2's `dragConfig`).
81
- * The interaction itself is driven by dnd-kit.
82
- */
83
- interface DragConfig {
84
- /** Whether items can be dragged. @default true */
85
- enabled?: boolean;
86
- /** Keep the dragged item within the grid container bounds. @default false */
87
- bounded?: boolean;
88
- /** CSS selector for a drag handle inside each item. */
89
- handle?: string;
90
- /** CSS selector for regions that should cancel a drag. */
91
- cancel?: string;
92
- /** Pixels the pointer must move before a drag starts. @default 3 */
93
- threshold?: number;
94
- /**
95
- * snapgrid extra: snap the dragged tile itself to grid cells while dragging.
96
- * When `false` (the default, matching react-grid-layout) the tile follows the
97
- * pointer smoothly and only the placeholder snaps.
98
- */
99
- snapToGrid?: boolean;
100
- }
101
- /**
102
- * Resize behaviour configuration (mirrors react-grid-layout v2's `resizeConfig`).
103
- */
104
- interface ResizeConfig {
105
- /** Whether items can be resized. @default true */
106
- enabled?: boolean;
107
- /** Which handles to show on each item (item-level `resizeHandles` overrides). @default ['se'] */
108
- handles?: ResizeHandleAxis$1[];
109
- }
110
- /** Minimal source shape passed to a {@link DropConfig.accept} predicate. */
111
- interface DragSourceInfo {
112
- id: string | number;
113
- type?: unknown;
114
- data?: unknown;
115
- }
116
- /**
117
- * Accept arbitrary (non-grid) dnd-kit draggables dropped into the grid. The
118
- * external draggable should carry `data.snapGridDrop = { i?, w?, h? }` to control
119
- * the inserted item's id/size; otherwise `defaultItem` is used. On drop the grid
120
- * fires `onDrop(layout, item, event)` rather than `onLayoutChange`.
121
- *
122
- * Requires the grid and the external draggable to share one provider
123
- * (e.g. both inside a `<SnapGridGroup>`).
124
- */
125
- interface DropConfig {
126
- /** Accept external draggables. @default false */
127
- enabled?: boolean;
128
- /** Default size for a dropped item when the source omits `snapGridDrop`. @default { w: 1, h: 1 } */
129
- defaultItem?: {
130
- w: number;
131
- h: number;
132
- };
133
- /** Restrict which external sources are accepted. @default accept any non-grid draggable */
134
- accept?: (source: DragSourceInfo) => boolean;
135
- }
136
- /** The `data.snapGridDrop` payload an external draggable carries to drop into a grid. */
137
- interface GridDropData {
138
- /** Id for the inserted item (a unique one is generated if omitted). */
139
- i?: string;
140
- /** Width in grid units. */
141
- w?: number;
142
- /** Height in grid units. */
143
- h?: number;
144
- }
145
- /**
146
- * react-grid-layout-compatible lifecycle callback.
147
- * `(layout, oldItem, newItem, placeholder, event, node)`
148
- */
149
- type GridEventCallback = (layout: Layout$1, oldItem: LayoutItem$1 | null, newItem: LayoutItem$1 | null, placeholder: LayoutItem$1 | null, event: Event | null, node: HTMLElement | null) => void;
150
- //#endregion
151
7
  //#region src/hooks/useGridController.d.ts
152
8
  /** Options the grid host ({@link useGridContainer}) feeds the controller. */
153
9
  interface UseGridControllerOptions {
@@ -159,19 +15,26 @@ interface UseGridControllerOptions {
159
15
  layout: Layout$1;
160
16
  onLayoutChange?: (layout: Layout$1) => void;
161
17
  gridConfig?: Partial<GridConfig$1>;
162
- dragConfig?: DragConfig;
163
- resizeConfig?: ResizeConfig;
164
- dropConfig?: DropConfig;
18
+ dragConfig?: DragConfig$1;
19
+ resizeConfig?: ResizeConfig$1;
20
+ dropConfig?: DropConfig$1;
21
+ /**
22
+ * Accept additional (non-grid) dnd-kit draggables as drop targets — e.g. a
23
+ * `useSortable` card from a sibling list, for interop. Extends the built-in
24
+ * acceptance (grid tiles + `snapGridDrop` externals); the ancestry guard still
25
+ * applies. You drive the actual receive in your own `onDragOver` with `snapMove`.
26
+ */
27
+ accept?: (source: DragSourceInfo$1) => boolean;
165
28
  compactor?: Compactor$1;
166
29
  isDraggable?: boolean;
167
30
  isResizable?: boolean;
168
31
  autoSize?: boolean;
169
- onDragStart?: GridEventCallback;
170
- onDrag?: GridEventCallback;
171
- onDragStop?: GridEventCallback;
172
- onResizeStart?: GridEventCallback;
173
- onResize?: GridEventCallback;
174
- onResizeStop?: GridEventCallback;
32
+ onDragStart?: GridEventCallback$1;
33
+ onDrag?: GridEventCallback$1;
34
+ onDragStop?: GridEventCallback$1;
35
+ onResizeStart?: GridEventCallback$1;
36
+ onResize?: GridEventCallback$1;
37
+ onResizeStop?: GridEventCallback$1;
175
38
  onDrop?: (layout: Layout$1, item: LayoutItem$1, event: Event | null) => void;
176
39
  }
177
40
  //#endregion
@@ -229,10 +92,18 @@ interface UseGridItemResult {
229
92
  * element you render — you own the tag, className, content, and cosmetic styling.
230
93
  *
231
94
  * The dragged tile floats itself via dnd-kit's default feedback (no `<DragOverlay>`):
232
- * the active tile renders at its committed origin so the float offset composes, and
233
- * reflow is animated on the compositor via the Web Animations API — both so it stays
234
- * smooth in Safari, where the float's popover top-layer repaint would jank a
235
- * CSS-transition reflow.
95
+ * the active tile renders at its committed origin and dnd-kit's float follows the
96
+ * pointer from there, while reflow is animated on the compositor via the Web
97
+ * Animations API (a FLIP) — both so it stays smooth in Safari, where the float's
98
+ * popover top-layer repaint would jank a CSS-transition reflow.
99
+ *
100
+ * Tiles are positioned with `left`/`top` (not `transform`). dnd-kit's self-float
101
+ * measures the source element's rect ignoring transforms and re-applies its current
102
+ * transform each frame; a transform-positioned tile leans on that, but the
103
+ * compensation is lost the instant the dragged element is swapped for a foreign one
104
+ * mid-drag (grid → sortable interop — the tile becomes a flow card), which would
105
+ * make the float jump by the tile's grid offset. Plain left/top has nothing to lose
106
+ * on the swap, matching how dnd-kit's own flow-positioned sortables hand off cleanly.
236
107
  */
237
108
  declare function useGridItem(id: string, group: string): UseGridItemResult;
238
109
  //#endregion
@@ -250,10 +121,6 @@ interface GridPlaceholderInfo {
250
121
  */
251
122
  declare function useGridPlaceholder(group: string): GridPlaceholderInfo | null;
252
123
  //#endregion
253
- //#region src/hooks/dndShared.d.ts
254
- /** Marker attribute placed on resize-handle elements. */
255
- declare const RESIZE_HANDLE_ATTR = "data-snapgrid-resize-handle";
256
- //#endregion
257
124
  //#region src/hooks/useGridResizeHandle.d.ts
258
125
  interface UseGridResizeHandleResult {
259
126
  /** Attach to your resize-handle element. */
@@ -359,8 +226,8 @@ interface ResponsiveGridLayoutProps {
359
226
  margin?: [number, number];
360
227
  containerPadding?: [number, number] | null;
361
228
  compactor?: Compactor$1;
362
- dragConfig?: DragConfig;
363
- resizeConfig?: ResizeConfig;
229
+ dragConfig?: DragConfig$1;
230
+ resizeConfig?: ResizeConfig$1;
364
231
  isDraggable?: boolean;
365
232
  isResizable?: boolean;
366
233
  autoSize?: boolean;
@@ -447,5 +314,5 @@ interface UseContainerWidthResult {
447
314
  */
448
315
  declare function useContainerWidth(options?: UseContainerWidthOptions): UseContainerWidthResult;
449
316
  //#endregion
450
- export { type BreakpointCols, type Breakpoints, type CompactType, type Compactor, DEFAULT_BREAKPOINTS, DEFAULT_BREAKPOINT_COLS, type DragConfig, DragOverlay, type DragSourceInfo, type DropConfig, Feedback, type GridConfig, type GridContainerProps, type GridDropData, type GridEventCallback, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GridPlaceholder, type GridPlaceholderInfo, type GridPlaceholderProps, KeyboardSensor, type Layout, type LayoutItem, PointerSensor, type PositionParams, type ResizeConfig, type ResizeHandleAxis, ResponsiveGridLayout, type ResponsiveGridLayoutProps, type ResponsiveLayouts, SnapGridGroup, type UseContainerWidthOptions, type UseContainerWidthResult, type UseGridContainerResult, type UseGridControllerOptions, type UseGridItemResult, type UseGridResizeHandleResult, type UseResponsiveLayoutOptions, type UseResponsiveLayoutResult, getCompactor, horizontalCompactor, noCompactor, useContainerWidth, useDraggable, useDroppable, useGridContainer, useGridItem, useGridPlaceholder, useGridResizeHandle, useResponsiveLayout, verticalCompactor };
317
+ export { type BreakpointCols, type Breakpoints, type CompactType, type Compactor, DEFAULT_BREAKPOINTS, DEFAULT_BREAKPOINT_COLS, type DragConfig, DragOverlay, type DragSourceInfo, type DropConfig, Feedback, type GridConfig, type GridContainerProps, type GridDropData, type GridEventCallback, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GridPlaceholder, type GridPlaceholderInfo, type GridPlaceholderProps, KeyboardSensor, type Layout, type LayoutItem, PointerSensor, type PositionParams, type ResizeConfig, type ResizeHandleAxis, ResponsiveGridLayout, type ResponsiveGridLayoutProps, type ResponsiveLayouts, SnapGridGroup, type SnapMoveContext, type SnapMoveEvent, type UseContainerWidthOptions, type UseContainerWidthResult, type UseGridContainerResult, type UseGridControllerOptions, type UseGridItemResult, type UseGridResizeHandleResult, type UseResponsiveLayoutOptions, type UseResponsiveLayoutResult, defaultGridConfig, getCompactor, horizontalCompactor, insertItemWithCompactor, noCompactor, removeItemWithCompactor, snapMove, toPositionParams, useContainerWidth, useDraggable, useDroppable, useGridContainer, useGridItem, useGridPlaceholder, useGridResizeHandle, useResponsiveLayout, verticalCompactor };
451
318
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/controller/GridController.ts","../src/types.ts","../src/hooks/useGridController.ts","../src/hooks/useGridContainer.ts","../src/hooks/useGridItem.ts","../src/hooks/useGridPlaceholder.ts","../src/hooks/dndShared.ts","../src/hooks/useGridResizeHandle.ts","../src/hooks/useResponsiveLayout.ts","../src/components/GridLayout.tsx","../src/components/ResponsiveGridLayout.tsx","../src/components/GridItem.tsx","../src/components/GridPlaceholder.tsx","../src/hooks/useContainerWidth.ts"],"mappings":";;;;;;;;;;;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AAA,+BAAoB,GAAA,CAAA,OAAA;;;UCnBhE,wBAAA;;EAEf,YAAY;AAAA;AAAA,UAGG,uBAAA;;EAEf,KAAA;EbCe;EaCf,OAAA;;EAEA,YAAA,GAAe,OAAA,EAAS,WAAW;AAAA;;;;;iBAOrB,iBAAA,CAAkB,OAAA,GAAS,wBAAA,GAAgC,uBAAuB"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/hooks/useGridController.ts","../src/hooks/useGridContainer.ts","../src/hooks/useGridItem.ts","../src/hooks/useGridPlaceholder.ts","../src/hooks/useGridResizeHandle.ts","../src/hooks/useResponsiveLayout.ts","../src/components/GridLayout.tsx","../src/components/ResponsiveGridLayout.tsx","../src/components/GridItem.tsx","../src/components/GridPlaceholder.tsx","../src/hooks/useContainerWidth.ts"],"mappings":";;;;;;;;UAmCiB,wBAAA;;EAEf,EAAA;;EAEA,KAAA;EAJuC;EAMvC,MAAA,EAAQ,QAAA;EACR,cAAA,IAAkB,MAAA,EAAQ,QAAA;EAC1B,UAAA,GAAa,OAAA,CAAQ,YAAA;EACrB,UAAA,GAAa,YAAA;EACb,YAAA,GAAe,cAAA;EACf,UAAA,GAAa,YAAA;EADE;;;;;;EAQf,MAAA,IAAU,MAAA,EAAQ,gBAAA;EAClB,SAAA,GAAY,WAAA;EACZ,WAAA;EACA,WAAA;EACA,QAAA;EACA,WAAA,GAAc,mBAAA;EACd,MAAA,GAAS,mBAAA;EACT,UAAA,GAAa,mBAAA;EACb,aAAA,GAAgB,mBAAA;EAChB,QAAA,GAAW,mBAAA;EACX,YAAA,GAAe,mBAAA;EACf,MAAA,IAAU,MAAA,EAAQ,QAAA,EAAQ,IAAA,EAAM,YAAA,EAAY,KAAA,EAAO,KAAA;AAAA;;;UCrDpC,kBAAA;;EAEf,GAAA,GAAM,OAAA,EAAS,OAAA;;EAEf,KAAA,EAAO,aAAa;EDoBmB;EClBvC,kBAAA;AAAA;AAAA,UAGe,sBAAA;EDuBM;ECrBrB,cAAA,E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Ef,KAAA;;EAEA,SAAA;;EAEA,KAAA,GAAQ,aAAa;AAAA;;;;;;iBAiBP,eAAA,CAAA;EAAkB,KAAA;EAAO,SAAA;EAAW;AAAA,GAAS,oBAAA,+BAAoB,GAAA,CAAA,OAAA;;;UCnBhE,wBAAA;;EAEf,YAAY;AAAA;AAAA,UAGG,uBAAA;;EAEf,KAAA;EVoBe;EUlBf,OAAA;;EAEA,YAAA,GAAe,OAAA,EAAS,WAAW;AAAA;;;;;iBAOrB,iBAAA,CAAkB,OAAA,GAAS,wBAAA,GAAgC,uBAAuB"}
package/dist/index.d.mts CHANGED
@@ -1,153 +1,9 @@
1
1
  import { DragOverlay, useDraggable, useDroppable } from "@dnd-kit/react";
2
- import { BreakpointCols, BreakpointCols as BreakpointCols$1, Breakpoints, Breakpoints as Breakpoints$1, CompactType, Compactor, Compactor as Compactor$1, DragSession, GridConfig, GridConfig as GridConfig$1, Layout, Layout as Layout$1, LayoutItem, LayoutItem as LayoutItem$1, PositionParams, PositionParams as PositionParams$1, ResizeHandleAxis, ResizeHandleAxis as ResizeHandleAxis$1, ResponsiveLayouts, ResponsiveLayouts as ResponsiveLayouts$1, getCompactor, horizontalCompactor, noCompactor, verticalCompactor } from "@snapgridjs/core";
2
+ import { BreakpointCols, BreakpointCols as BreakpointCols$1, Breakpoints, Breakpoints as Breakpoints$1, CompactType, Compactor, Compactor as Compactor$1, GridConfig, GridConfig as GridConfig$1, Layout, Layout as Layout$1, LayoutItem, LayoutItem as LayoutItem$1, PositionParams, ResizeHandleAxis, ResizeHandleAxis as ResizeHandleAxis$1, ResponsiveLayouts, ResponsiveLayouts as ResponsiveLayouts$1, defaultGridConfig, getCompactor, horizontalCompactor, insertItemWithCompactor, noCompactor, removeItemWithCompactor, toPositionParams, verticalCompactor } from "@snapgridjs/core";
3
+ import { DragConfig, DragConfig as DragConfig$1, DragSourceInfo, DragSourceInfo as DragSourceInfo$1, DropConfig, DropConfig as DropConfig$1, GridController, GridDropData, GridEventCallback, GridEventCallback as GridEventCallback$1, RESIZE_HANDLE_ATTR, ResizeConfig, ResizeConfig as ResizeConfig$1, SnapMoveContext, SnapMoveEvent, snapMove } from "@snapgridjs/dnd";
3
4
  import { CSSProperties, ReactNode } from "react";
4
- import { Modifiers, Sensors } from "@dnd-kit/abstract";
5
- import { DragDropManager, Feedback, Feedback as Feedback$1, KeyboardSensor, PointerSensor } from "@dnd-kit/dom";
5
+ import { Feedback, KeyboardSensor, PointerSensor } from "@dnd-kit/dom";
6
6
 
7
- //#region src/controller/GridController.d.ts
8
- /**
9
- * Per-grid configuration the container host writes to the controller each render
10
- * (during render, so items that resolve this controller by `group` read fresh
11
- * config on the same pass). Replaces the fields the old GridContext exposed.
12
- */
13
- interface GridControllerConfig {
14
- positionParams: PositionParams$1;
15
- gridConfig: GridConfig$1;
16
- width: number;
17
- autoSize: boolean;
18
- itemSensors: Sensors;
19
- itemModifiers: Modifiers;
20
- isItemDraggable: (id: string) => boolean;
21
- isItemResizable: (id: string) => boolean;
22
- resizeHandlesFor: (id: string) => readonly ResizeHandleAxis$1[];
23
- /** Report the container element (used to map a pointer to a cell on receive). */
24
- setContainerElement: (element: Element | null) => void;
25
- }
26
- interface ItemSnapshot {
27
- item: LayoutItem$1 | undefined;
28
- isDragging: boolean;
29
- hidden: boolean;
30
- }
31
- interface ResizeSnapshot {
32
- isResizing: boolean;
33
- }
34
- /**
35
- * Live per-grid drag/resize state as a plain observable: the provider writes
36
- * (`setSession`/`setKeyboard`/`setCommitted`), hooks subscribe to just their own
37
- * slice via `useSyncExternalStore`. Value-cached snapshots mean a drag re-renders
38
- * only the tiles whose slice changed, not the whole subtree (the old
39
- * context-value model re-rendered every tile every frame).
40
- */
41
- declare class GridController {
42
- #private;
43
- id: string;
44
- config: GridControllerConfig | null;
45
- /** The dnd-kit manager this grid is registered with (set by useInstance). */
46
- manager: DragDropManager | undefined;
47
- constructor(id: string, committed?: Layout$1, manager?: DragDropManager);
48
- /** Replace the per-grid config (called by the container host during render). */
49
- setConfig(config: GridControllerConfig): void;
50
- /**
51
- * Re-point this grid's id. The container host syncs it (during render, before
52
- * the droppable/group read it) when the controlled `id` prop changes, so the
53
- * returned `group`, the droppable id, and the registry key never drift apart.
54
- */
55
- setId(id: string): void;
56
- register: () => void;
57
- subscribe: (listener: () => void) => (() => void);
58
- /**
59
- * Sync the committed layout from the controlled `layout` prop. Called during
60
- * the provider's render, so it must NOT notify — emitting here would update
61
- * subscribed GridItems mid-render (a React "setState while rendering" error).
62
- * No notify is needed: a `layout` prop change already re-renders the whole
63
- * provider subtree, so every GridItem re-reads its snapshot on that pass.
64
- */
65
- setCommitted(layout: Layout$1): void;
66
- setSession(next: DragSession | null): void;
67
- getSession(): DragSession | null;
68
- /** Record whether the active drag is keyboard-driven (drives `hidden`). */
69
- setKeyboard(value: boolean): void;
70
- itemSnapshot: (id: string) => ItemSnapshot;
71
- placeholderSnapshot: () => LayoutItem$1 | null;
72
- resizeSnapshot: (itemId: string) => ResizeSnapshot;
73
- renderedSnapshot: () => Layout$1;
74
- /** A stable index for `id` (see {@link GridController.#indexById}). */
75
- itemIndex(id: string): number;
76
- }
77
- //#endregion
78
- //#region src/types.d.ts
79
- /**
80
- * Drag behaviour configuration (mirrors react-grid-layout v2's `dragConfig`).
81
- * The interaction itself is driven by dnd-kit.
82
- */
83
- interface DragConfig {
84
- /** Whether items can be dragged. @default true */
85
- enabled?: boolean;
86
- /** Keep the dragged item within the grid container bounds. @default false */
87
- bounded?: boolean;
88
- /** CSS selector for a drag handle inside each item. */
89
- handle?: string;
90
- /** CSS selector for regions that should cancel a drag. */
91
- cancel?: string;
92
- /** Pixels the pointer must move before a drag starts. @default 3 */
93
- threshold?: number;
94
- /**
95
- * snapgrid extra: snap the dragged tile itself to grid cells while dragging.
96
- * When `false` (the default, matching react-grid-layout) the tile follows the
97
- * pointer smoothly and only the placeholder snaps.
98
- */
99
- snapToGrid?: boolean;
100
- }
101
- /**
102
- * Resize behaviour configuration (mirrors react-grid-layout v2's `resizeConfig`).
103
- */
104
- interface ResizeConfig {
105
- /** Whether items can be resized. @default true */
106
- enabled?: boolean;
107
- /** Which handles to show on each item (item-level `resizeHandles` overrides). @default ['se'] */
108
- handles?: ResizeHandleAxis$1[];
109
- }
110
- /** Minimal source shape passed to a {@link DropConfig.accept} predicate. */
111
- interface DragSourceInfo {
112
- id: string | number;
113
- type?: unknown;
114
- data?: unknown;
115
- }
116
- /**
117
- * Accept arbitrary (non-grid) dnd-kit draggables dropped into the grid. The
118
- * external draggable should carry `data.snapGridDrop = { i?, w?, h? }` to control
119
- * the inserted item's id/size; otherwise `defaultItem` is used. On drop the grid
120
- * fires `onDrop(layout, item, event)` rather than `onLayoutChange`.
121
- *
122
- * Requires the grid and the external draggable to share one provider
123
- * (e.g. both inside a `<SnapGridGroup>`).
124
- */
125
- interface DropConfig {
126
- /** Accept external draggables. @default false */
127
- enabled?: boolean;
128
- /** Default size for a dropped item when the source omits `snapGridDrop`. @default { w: 1, h: 1 } */
129
- defaultItem?: {
130
- w: number;
131
- h: number;
132
- };
133
- /** Restrict which external sources are accepted. @default accept any non-grid draggable */
134
- accept?: (source: DragSourceInfo) => boolean;
135
- }
136
- /** The `data.snapGridDrop` payload an external draggable carries to drop into a grid. */
137
- interface GridDropData {
138
- /** Id for the inserted item (a unique one is generated if omitted). */
139
- i?: string;
140
- /** Width in grid units. */
141
- w?: number;
142
- /** Height in grid units. */
143
- h?: number;
144
- }
145
- /**
146
- * react-grid-layout-compatible lifecycle callback.
147
- * `(layout, oldItem, newItem, placeholder, event, node)`
148
- */
149
- type GridEventCallback = (layout: Layout$1, oldItem: LayoutItem$1 | null, newItem: LayoutItem$1 | null, placeholder: LayoutItem$1 | null, event: Event | null, node: HTMLElement | null) => void;
150
- //#endregion
151
7
  //#region src/hooks/useGridController.d.ts
152
8
  /** Options the grid host ({@link useGridContainer}) feeds the controller. */
153
9
  interface UseGridControllerOptions {
@@ -159,19 +15,26 @@ interface UseGridControllerOptions {
159
15
  layout: Layout$1;
160
16
  onLayoutChange?: (layout: Layout$1) => void;
161
17
  gridConfig?: Partial<GridConfig$1>;
162
- dragConfig?: DragConfig;
163
- resizeConfig?: ResizeConfig;
164
- dropConfig?: DropConfig;
18
+ dragConfig?: DragConfig$1;
19
+ resizeConfig?: ResizeConfig$1;
20
+ dropConfig?: DropConfig$1;
21
+ /**
22
+ * Accept additional (non-grid) dnd-kit draggables as drop targets — e.g. a
23
+ * `useSortable` card from a sibling list, for interop. Extends the built-in
24
+ * acceptance (grid tiles + `snapGridDrop` externals); the ancestry guard still
25
+ * applies. You drive the actual receive in your own `onDragOver` with `snapMove`.
26
+ */
27
+ accept?: (source: DragSourceInfo$1) => boolean;
165
28
  compactor?: Compactor$1;
166
29
  isDraggable?: boolean;
167
30
  isResizable?: boolean;
168
31
  autoSize?: boolean;
169
- onDragStart?: GridEventCallback;
170
- onDrag?: GridEventCallback;
171
- onDragStop?: GridEventCallback;
172
- onResizeStart?: GridEventCallback;
173
- onResize?: GridEventCallback;
174
- onResizeStop?: GridEventCallback;
32
+ onDragStart?: GridEventCallback$1;
33
+ onDrag?: GridEventCallback$1;
34
+ onDragStop?: GridEventCallback$1;
35
+ onResizeStart?: GridEventCallback$1;
36
+ onResize?: GridEventCallback$1;
37
+ onResizeStop?: GridEventCallback$1;
175
38
  onDrop?: (layout: Layout$1, item: LayoutItem$1, event: Event | null) => void;
176
39
  }
177
40
  //#endregion
@@ -229,10 +92,18 @@ interface UseGridItemResult {
229
92
  * element you render — you own the tag, className, content, and cosmetic styling.
230
93
  *
231
94
  * The dragged tile floats itself via dnd-kit's default feedback (no `<DragOverlay>`):
232
- * the active tile renders at its committed origin so the float offset composes, and
233
- * reflow is animated on the compositor via the Web Animations API — both so it stays
234
- * smooth in Safari, where the float's popover top-layer repaint would jank a
235
- * CSS-transition reflow.
95
+ * the active tile renders at its committed origin and dnd-kit's float follows the
96
+ * pointer from there, while reflow is animated on the compositor via the Web
97
+ * Animations API (a FLIP) — both so it stays smooth in Safari, where the float's
98
+ * popover top-layer repaint would jank a CSS-transition reflow.
99
+ *
100
+ * Tiles are positioned with `left`/`top` (not `transform`). dnd-kit's self-float
101
+ * measures the source element's rect ignoring transforms and re-applies its current
102
+ * transform each frame; a transform-positioned tile leans on that, but the
103
+ * compensation is lost the instant the dragged element is swapped for a foreign one
104
+ * mid-drag (grid → sortable interop — the tile becomes a flow card), which would
105
+ * make the float jump by the tile's grid offset. Plain left/top has nothing to lose
106
+ * on the swap, matching how dnd-kit's own flow-positioned sortables hand off cleanly.
236
107
  */
237
108
  declare function useGridItem(id: string, group: string): UseGridItemResult;
238
109
  //#endregion
@@ -250,10 +121,6 @@ interface GridPlaceholderInfo {
250
121
  */
251
122
  declare function useGridPlaceholder(group: string): GridPlaceholderInfo | null;
252
123
  //#endregion
253
- //#region src/hooks/dndShared.d.ts
254
- /** Marker attribute placed on resize-handle elements. */
255
- declare const RESIZE_HANDLE_ATTR = "data-snapgrid-resize-handle";
256
- //#endregion
257
124
  //#region src/hooks/useGridResizeHandle.d.ts
258
125
  interface UseGridResizeHandleResult {
259
126
  /** Attach to your resize-handle element. */
@@ -359,8 +226,8 @@ interface ResponsiveGridLayoutProps {
359
226
  margin?: [number, number];
360
227
  containerPadding?: [number, number] | null;
361
228
  compactor?: Compactor$1;
362
- dragConfig?: DragConfig;
363
- resizeConfig?: ResizeConfig;
229
+ dragConfig?: DragConfig$1;
230
+ resizeConfig?: ResizeConfig$1;
364
231
  isDraggable?: boolean;
365
232
  isResizable?: boolean;
366
233
  autoSize?: boolean;
@@ -447,5 +314,5 @@ interface UseContainerWidthResult {
447
314
  */
448
315
  declare function useContainerWidth(options?: UseContainerWidthOptions): UseContainerWidthResult;
449
316
  //#endregion
450
- export { type BreakpointCols, type Breakpoints, type CompactType, type Compactor, DEFAULT_BREAKPOINTS, DEFAULT_BREAKPOINT_COLS, type DragConfig, DragOverlay, type DragSourceInfo, type DropConfig, Feedback, type GridConfig, type GridContainerProps, type GridDropData, type GridEventCallback, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GridPlaceholder, type GridPlaceholderInfo, type GridPlaceholderProps, KeyboardSensor, type Layout, type LayoutItem, PointerSensor, type PositionParams, type ResizeConfig, type ResizeHandleAxis, ResponsiveGridLayout, type ResponsiveGridLayoutProps, type ResponsiveLayouts, SnapGridGroup, type UseContainerWidthOptions, type UseContainerWidthResult, type UseGridContainerResult, type UseGridControllerOptions, type UseGridItemResult, type UseGridResizeHandleResult, type UseResponsiveLayoutOptions, type UseResponsiveLayoutResult, getCompactor, horizontalCompactor, noCompactor, useContainerWidth, useDraggable, useDroppable, useGridContainer, useGridItem, useGridPlaceholder, useGridResizeHandle, useResponsiveLayout, verticalCompactor };
317
+ export { type BreakpointCols, type Breakpoints, type CompactType, type Compactor, DEFAULT_BREAKPOINTS, DEFAULT_BREAKPOINT_COLS, type DragConfig, DragOverlay, type DragSourceInfo, type DropConfig, Feedback, type GridConfig, type GridContainerProps, type GridDropData, type GridEventCallback, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GridPlaceholder, type GridPlaceholderInfo, type GridPlaceholderProps, KeyboardSensor, type Layout, type LayoutItem, PointerSensor, type PositionParams, type ResizeConfig, type ResizeHandleAxis, ResponsiveGridLayout, type ResponsiveGridLayoutProps, type ResponsiveLayouts, SnapGridGroup, type SnapMoveContext, type SnapMoveEvent, type UseContainerWidthOptions, type UseContainerWidthResult, type UseGridContainerResult, type UseGridControllerOptions, type UseGridItemResult, type UseGridResizeHandleResult, type UseResponsiveLayoutOptions, type UseResponsiveLayoutResult, defaultGridConfig, getCompactor, horizontalCompactor, insertItemWithCompactor, noCompactor, removeItemWithCompactor, snapMove, toPositionParams, useContainerWidth, useDraggable, useDroppable, useGridContainer, useGridItem, useGridPlaceholder, useGridResizeHandle, useResponsiveLayout, verticalCompactor };
451
318
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/controller/GridController.ts","../src/types.ts","../src/hooks/useGridController.ts","../src/hooks/useGridContainer.ts","../src/hooks/useGridItem.ts","../src/hooks/useGridPlaceholder.ts","../src/hooks/dndShared.ts","../src/hooks/useGridResizeHandle.ts","../src/hooks/useResponsiveLayout.ts","../src/components/GridLayout.tsx","../src/components/ResponsiveGridLayout.tsx","../src/components/GridItem.tsx","../src/components/GridPlaceholder.tsx","../src/hooks/useContainerWidth.ts"],"mappings":";;;;;;;;;;;AAgBA;UAAiB,oBAAA;EACf,cAAA,EAAgB,gBAAA;EAChB,UAAA,EAAY,YAAA;EACZ,KAAA;EACA,QAAA;EACA,WAAA,EAAa,OAAA;EACb,aAAA,EAAe,SAAA;EACf,eAAA,GAAkB,EAAA;EAClB,eAAA,GAAkB,EAAA;EAClB,gBAAA,GAAmB,EAAA,sBAAwB,kBAAA;EAR3C;EAUA,mBAAA,GAAsB,OAAA,EAAS,OAAA;AAAA;AAAA,UAGhB,YAAA;EACf,IAAA,EAAM,YAAU;EAChB,UAAA;EAKA,MAAA;AAAA;AAAA,UAGe,cAAA;EACf,UAAU;AAAA;;;;;;;;cAoBC,cAAA;EAAA;EACX,EAAA;EASA,MAAA,EAAQ,oBAAA;EAzCO;EA8Df,OAAA,EAAS,eAAA;cAEG,EAAA,UAAY,SAAA,GAAW,QAAA,EAAa,OAAA,GAAU,eAAA;EA/D1C;EAsEhB,SAAA,CAAU,MAAA,EAAQ,oBAAA;EAtEZ;;;;AAMA;EAyEN,KAAA,CAAM,EAAA;EAQN,QAAA;EAEA,SAAA,GAAa,QAAA;EA/EH;AAAA;AAoBZ;;;;;EA2FE,YAAA,CAAa,MAAA,EAAQ,QAAA;EAWrB,UAAA,CAAW,IAAA,EAAM,WAAA;EAKjB,UAAA,CAAA,GAAc,WAAA;EAhBO;EAqBrB,WAAA,CAAY,KAAA;EAMZ,YAAA,GAAgB,EAAA,aAAa,YAAA;EAkB7B,mBAAA,QAA0B,YAAA;EAS1B,cAAA,GAAkB,MAAA,aAAiB,cAAA;EASnC,gBAAA,QAAuB,QA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A;EAAU,SAAA;EAAW;AAAA,GAAS,aAAA,+BAAa,GAAA,CAAA,OAAA;AAAA,cAqBjE,QAAA,kBAAQ,mBAAA,QAAA,YAAA;;;UChGJ,oBAAA;;EAEf,KAAA;;EAEA,SAAA;;EAEA,KAAA,GAAQ,aAAa;AAAA;;;;;;iBAiBP,eAAA,CAAA;EAAkB,KAAA;EAAO,SAAA;EAAW;AAAA,GAAS,oBAAA,+BAAoB,GAAA,CAAA,OAAA;;;UCnBhE,wBAAA;;EAEf,YAAY;AAAA;AAAA,UAGG,uBAAA;;EAEf,KAAA;EbCe;EaCf,OAAA;;EAEA,YAAA,GAAe,OAAA,EAAS,WAAW;AAAA;;;;;iBAOrB,iBAAA,CAAkB,OAAA,GAAS,wBAAA,GAAgC,uBAAuB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/hooks/useGridController.ts","../src/hooks/useGridContainer.ts","../src/hooks/useGridItem.ts","../src/hooks/useGridPlaceholder.ts","../src/hooks/useGridResizeHandle.ts","../src/hooks/useResponsiveLayout.ts","../src/components/GridLayout.tsx","../src/components/ResponsiveGridLayout.tsx","../src/components/GridItem.tsx","../src/components/GridPlaceholder.tsx","../src/hooks/useContainerWidth.ts"],"mappings":";;;;;;;;UAmCiB,wBAAA;;EAEf,EAAA;;EAEA,KAAA;EAJuC;EAMvC,MAAA,EAAQ,QAAA;EACR,cAAA,IAAkB,MAAA,EAAQ,QAAA;EAC1B,UAAA,GAAa,OAAA,CAAQ,YAAA;EACrB,UAAA,GAAa,YAAA;EACb,YAAA,GAAe,cAAA;EACf,UAAA,GAAa,YAAA;EADE;;;;;;EAQf,MAAA,IAAU,MAAA,EAAQ,gBAAA;EAClB,SAAA,GAAY,WAAA;EACZ,WAAA;EACA,WAAA;EACA,QAAA;EACA,WAAA,GAAc,mBAAA;EACd,MAAA,GAAS,mBAAA;EACT,UAAA,GAAa,mBAAA;EACb,aAAA,GAAgB,mBAAA;EAChB,QAAA,GAAW,mBAAA;EACX,YA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