react-grid-layout 2.2.0 → 2.2.1

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.
Files changed (59) hide show
  1. package/README.md +14 -55
  2. package/dist/{ResponsiveGridLayout-BkHF9YHa.d.mts → ResponsiveGridLayout-DqK__izz.d.mts} +1 -1
  3. package/dist/{ResponsiveGridLayout-CLn16-X3.d.ts → ResponsiveGridLayout-MbDNfJ8M.d.ts} +1 -1
  4. package/dist/{calculate-DsVTldEE.d.ts → calculate-9RxGrt-U.d.ts} +1 -1
  5. package/dist/{calculate-DwbL1D06.d.mts → calculate-FbCWy8x1.d.mts} +1 -1
  6. package/dist/{chunk-2TEFHZC4.js → chunk-2DDROKB2.js} +10 -153
  7. package/dist/chunk-2DDROKB2.js.map +1 -0
  8. package/dist/{chunk-NQUM7RXX.js → chunk-3CEWSUXL.js} +52 -46
  9. package/dist/chunk-3CEWSUXL.js.map +1 -0
  10. package/dist/{chunk-OWK47QTG.mjs → chunk-AZ6K3JIJ.mjs} +22 -16
  11. package/dist/chunk-AZ6K3JIJ.mjs.map +1 -0
  12. package/dist/chunk-PBQSHIID.js +4 -0
  13. package/dist/{chunk-7ELO5FRW.js.map → chunk-PBQSHIID.js.map} +1 -1
  14. package/dist/{chunk-43GDBEG4.js → chunk-QGXQSZII.js} +34 -39
  15. package/dist/chunk-QGXQSZII.js.map +1 -0
  16. package/dist/{chunk-OH26KG7Y.mjs → chunk-XYPIYYYQ.mjs} +12 -153
  17. package/dist/chunk-XYPIYYYQ.mjs.map +1 -0
  18. package/dist/{chunk-MUNIXYTV.mjs → chunk-YFVX5RDK.mjs} +27 -32
  19. package/dist/chunk-YFVX5RDK.mjs.map +1 -0
  20. package/dist/chunk-ZWN22PS2.mjs +3 -0
  21. package/dist/{chunk-526JND3R.mjs.map → chunk-ZWN22PS2.mjs.map} +1 -1
  22. package/dist/core.d.mts +6 -32
  23. package/dist/core.d.ts +6 -32
  24. package/dist/core.js +41 -49
  25. package/dist/core.mjs +2 -2
  26. package/dist/extras.d.mts +2 -2
  27. package/dist/extras.d.ts +2 -2
  28. package/dist/extras.js +0 -72
  29. package/dist/extras.js.map +1 -1
  30. package/dist/extras.mjs +0 -72
  31. package/dist/extras.mjs.map +1 -1
  32. package/dist/index.d.mts +5 -5
  33. package/dist/index.d.ts +5 -5
  34. package/dist/index.js +24 -24
  35. package/dist/index.mjs +4 -4
  36. package/dist/legacy.d.mts +2 -2
  37. package/dist/legacy.d.ts +2 -2
  38. package/dist/legacy.js +13 -13
  39. package/dist/legacy.mjs +2 -2
  40. package/dist/{position-CXNzFxI0.d.mts → position-CetgOHhD.d.mts} +1 -1
  41. package/dist/{position-Dk0FRWA9.d.ts → position-DhZqWO1-.d.ts} +1 -1
  42. package/dist/react.d.mts +11 -14
  43. package/dist/react.d.ts +11 -14
  44. package/dist/react.js +18 -18
  45. package/dist/react.mjs +4 -4
  46. package/dist/{responsive-BB5d98xz.d.mts → responsive-DLRtE8v8.d.ts} +3 -3
  47. package/dist/{responsive-BXI-GCXG.d.ts → responsive-T0N0GmBB.d.mts} +3 -3
  48. package/dist/{types-CokovIMH.d.mts → types-BiXsdXr7.d.mts} +5 -16
  49. package/dist/{types-CokovIMH.d.ts → types-BiXsdXr7.d.ts} +5 -16
  50. package/index-dev.js +2 -3
  51. package/package.json +1 -1
  52. package/dist/chunk-2TEFHZC4.js.map +0 -1
  53. package/dist/chunk-43GDBEG4.js.map +0 -1
  54. package/dist/chunk-526JND3R.mjs +0 -3
  55. package/dist/chunk-7ELO5FRW.js +0 -4
  56. package/dist/chunk-MUNIXYTV.mjs.map +0 -1
  57. package/dist/chunk-NQUM7RXX.js.map +0 -1
  58. package/dist/chunk-OH26KG7Y.mjs.map +0 -1
  59. package/dist/chunk-OWK47QTG.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { getCompactor, compact, sortBreakpoints, getBreakpointFromWidth, getColsFromBreakpoint, findOrGenerateResponsiveLayout } from './chunk-OH26KG7Y.mjs';
1
+ import { verticalCompactor, sortBreakpoints, getBreakpointFromWidth, getColsFromBreakpoint, findOrGenerateResponsiveLayout } from './chunk-XYPIYYYQ.mjs';
2
2
  import { correctBounds, cloneLayout, getLayoutItem, cloneLayoutItem, moveElement, bottom } from './chunk-AWM66AWF.mjs';
3
3
  import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
4
4
  import { deepEqual } from 'fast-equals';
@@ -51,19 +51,14 @@ function useGridLayout(options) {
51
51
  const {
52
52
  layout: propsLayout,
53
53
  cols,
54
- compactType = "vertical",
55
- allowOverlap = false,
56
54
  preventCollision = false,
57
- onLayoutChange
55
+ onLayoutChange,
56
+ compactor = verticalCompactor
58
57
  } = options;
59
- const compactor = useMemo(
60
- () => getCompactor(compactType, allowOverlap),
61
- [compactType, allowOverlap]
62
- );
63
58
  const isDraggingRef = useRef(false);
64
59
  const [layout, setLayoutState] = useState(() => {
65
60
  const corrected = correctBounds(cloneLayout(propsLayout), { cols });
66
- return compact(corrected, compactType, cols, allowOverlap);
61
+ return compactor.compact(corrected, cols);
67
62
  });
68
63
  const [dragState, setDragState] = useState({
69
64
  activeDrag: null,
@@ -83,10 +78,10 @@ function useGridLayout(options) {
83
78
  const setLayout = useCallback(
84
79
  (newLayout) => {
85
80
  const corrected = correctBounds(cloneLayout(newLayout), { cols });
86
- const compacted = compact(corrected, compactType, cols, allowOverlap);
81
+ const compacted = compactor.compact(corrected, cols);
87
82
  setLayoutState(compacted);
88
83
  },
89
- [cols, compactType, allowOverlap]
84
+ [cols, compactor]
90
85
  );
91
86
  useEffect(() => {
92
87
  if (isDraggingRef.current) return;
@@ -137,14 +132,14 @@ function useGridLayout(options) {
137
132
  true,
138
133
  // isUserAction
139
134
  preventCollision,
140
- compactType,
135
+ compactor.type,
141
136
  cols,
142
- allowOverlap
137
+ compactor.allowOverlap
143
138
  );
144
- const compacted = allowOverlap ? newLayout : compact(newLayout, compactType, cols);
139
+ const compacted = compactor.compact(newLayout, cols);
145
140
  setLayoutState(compacted);
146
141
  },
147
- [layout, cols, compactType, preventCollision, allowOverlap]
142
+ [layout, cols, compactor, preventCollision]
148
143
  );
149
144
  const onDragStop = useCallback(
150
145
  (itemId, x, y) => {
@@ -157,11 +152,11 @@ function useGridLayout(options) {
157
152
  y,
158
153
  true,
159
154
  preventCollision,
160
- compactType,
155
+ compactor.type,
161
156
  cols,
162
- allowOverlap
157
+ compactor.allowOverlap
163
158
  );
164
- const compacted = compact(newLayout, compactType, cols, allowOverlap);
159
+ const compacted = compactor.compact(newLayout, cols);
165
160
  isDraggingRef.current = false;
166
161
  setDragState({
167
162
  activeDrag: null,
@@ -170,7 +165,7 @@ function useGridLayout(options) {
170
165
  });
171
166
  setLayoutState(compacted);
172
167
  },
173
- [layout, cols, compactType, preventCollision, allowOverlap]
168
+ [layout, cols, compactor, preventCollision]
174
169
  );
175
170
  const onResizeStart = useCallback(
176
171
  (itemId) => {
@@ -201,10 +196,10 @@ function useGridLayout(options) {
201
196
  return item;
202
197
  });
203
198
  const corrected = correctBounds(newLayout, { cols });
204
- const compacted = compact(corrected, compactType, cols, allowOverlap);
199
+ const compacted = compactor.compact(corrected, cols);
205
200
  setLayoutState(compacted);
206
201
  },
207
- [layout, cols, compactType, allowOverlap]
202
+ [layout, cols, compactor]
208
203
  );
209
204
  const onResizeStop = useCallback(
210
205
  (itemId, w, h) => {
@@ -223,7 +218,7 @@ function useGridLayout(options) {
223
218
  if (!existingItem) {
224
219
  const newLayout = [...layout, droppingItem];
225
220
  const corrected = correctBounds(newLayout, { cols });
226
- const compacted = compact(corrected, compactType, cols, allowOverlap);
221
+ const compacted = compactor.compact(corrected, cols);
227
222
  setLayoutState(compacted);
228
223
  }
229
224
  setDropState({
@@ -232,7 +227,7 @@ function useGridLayout(options) {
232
227
  droppingPosition: position
233
228
  });
234
229
  },
235
- [layout, cols, compactType, allowOverlap]
230
+ [layout, cols, compactor]
236
231
  );
237
232
  const onDropDragLeave = useCallback(() => {
238
233
  const newLayout = layout.filter((item) => item.i !== "__dropping-elem__");
@@ -255,14 +250,14 @@ function useGridLayout(options) {
255
250
  return item;
256
251
  });
257
252
  const corrected = correctBounds(newLayout, { cols });
258
- const compacted = compact(corrected, compactType, cols, allowOverlap);
253
+ const compacted = compactor.compact(corrected, cols);
259
254
  setLayoutState(compacted);
260
255
  setDropState({
261
256
  droppingDOMNode: null,
262
257
  droppingPosition: null
263
258
  });
264
259
  },
265
- [layout, cols, compactType, allowOverlap]
260
+ [layout, cols, compactor]
266
261
  );
267
262
  const containerHeight = useMemo(() => bottom(layout), [layout]);
268
263
  const isInteracting = dragState.activeDrag !== null || resizeState.resizing || dropState.droppingPosition !== null;
@@ -306,7 +301,7 @@ function useResponsiveLayout(options) {
306
301
  breakpoints = DEFAULT_BREAKPOINTS,
307
302
  cols: colsConfig = DEFAULT_COLS,
308
303
  layouts: propsLayouts = {},
309
- compactType = "vertical",
304
+ compactor = verticalCompactor,
310
305
  onBreakpointChange,
311
306
  onLayoutChange,
312
307
  onWidthChange
@@ -348,9 +343,9 @@ function useResponsiveLayout(options) {
348
343
  breakpoint,
349
344
  prevBreakpointRef.current,
350
345
  cols,
351
- compactType
346
+ compactor
352
347
  );
353
- }, [layouts, breakpoints, breakpoint, cols, compactType]);
348
+ }, [layouts, breakpoints, breakpoint, cols, compactor]);
354
349
  const setLayoutForBreakpoint = useCallback((bp, newLayout) => {
355
350
  setLayoutsState((prev) => ({
356
351
  ...prev,
@@ -380,7 +375,7 @@ function useResponsiveLayout(options) {
380
375
  newBreakpoint,
381
376
  breakpoint,
382
377
  newCols,
383
- compactType
378
+ compactor
384
379
  );
385
380
  const updatedLayouts = {
386
381
  ...layouts,
@@ -398,7 +393,7 @@ function useResponsiveLayout(options) {
398
393
  colsConfig,
399
394
  breakpoint,
400
395
  layouts,
401
- compactType,
396
+ compactor,
402
397
  onBreakpointChange,
403
398
  onWidthChange
404
399
  ]);
@@ -426,5 +421,5 @@ function useResponsiveLayout(options) {
426
421
  }
427
422
 
428
423
  export { DEFAULT_BREAKPOINTS, DEFAULT_COLS, useContainerWidth, useGridLayout, useResponsiveLayout };
429
- //# sourceMappingURL=chunk-MUNIXYTV.mjs.map
430
- //# sourceMappingURL=chunk-MUNIXYTV.mjs.map
424
+ //# sourceMappingURL=chunk-YFVX5RDK.mjs.map
425
+ //# sourceMappingURL=chunk-YFVX5RDK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/hooks/useContainerWidth.ts","../src/react/hooks/useGridLayout.ts","../src/react/hooks/useResponsiveLayout.ts"],"names":["useRef","useState","useCallback","useEffect","useMemo","layout","deepEqual"],"mappings":";;;;;AAsEO,SAAS,iBAAA,CACd,OAAA,GAAoC,EAAC,EACZ;AACzB,EAAA,MAAM,EAAE,kBAAA,GAAqB,KAAA,EAAO,YAAA,GAAe,MAAK,GAAI,OAAA;AAE5D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,YAAY,CAAA;AAC/C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,QAAA,CAAS,CAAC,kBAAkB,CAAA;AAC1D,EAAA,MAAM,YAAA,GAAe,OAA8B,IAAI,CAAA;AACvD,EAAA,MAAM,WAAA,GAAc,OAA8B,IAAI,CAAA;AAEtD,EAAA,MAAM,YAAA,GAAe,YAAY,MAAM;AACrC,IAAA,MAAM,OAAO,YAAA,CAAa,OAAA;AAC1B,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,MAAM,WAAW,IAAA,CAAK,WAAA;AACtB,MAAA,QAAA,CAAS,QAAQ,CAAA;AACjB,MAAA,IAAI,CAAC,OAAA,EAAS;AACZ,QAAA,UAAA,CAAW,IAAI,CAAA;AAAA,MACjB;AAAA,IACF;AAAA,EACF,CAAA,EAAG,CAAC,OAAO,CAAC,CAAA;AAEZ,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,OAAO,YAAA,CAAa,OAAA;AAC1B,IAAA,IAAI,CAAC,IAAA,EA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ACA;AAAA,GACD,CAAA;AAGD,EAAAA,UAAU,MAAM;AACd,IAAA,IAAI,CAACG,SAAAA,CAAU,YAAA,EAAc,mBAAA,CAAoB,OAAO,CAAA,EAAG;AACzD,MAAA,UAAA,CAAW,YAAY,CAAA;AACvB,MAAA,mBAAA,CAAoB,OAAA,GAAU,YAAA;AAAA,IAChC;AAAA,EACF,CAAA,EAAG,CAAC,YAAA,EAAc,UAAU,CAAC,CAAA;AAG7B,EAAAH,UAAU,MAAM;AACd,IAAA,IAAI,CAACG,SAAAA,CAAU,OAAA,EAAS,cAAA,CAAe,OAAO,CAAA,EAAG;AAC/C,MAAA,cAAA,CAAe,OAAA,GAAU,OAAA;AACzB,MAAA,cAAA,GAAiB,QAAQ,OAAO,CAAA;AAAA,IAClC;AAAA,EACF,CAAA,EAAG,CAAC,MAAA,EAAQ,OAAA,EAAS,cAAc,CAAC,CAAA;AAEpC,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,IAAA;AAAA,IACA,sBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-YFVX5RDK.mjs","sourcesContent":["/**\n * useContainerWidth hook\n *\n * Observes container width using ResizeObserver and provides\n * reactive width updates for responsive layouts.\n */\n\nimport {\n useState,\n useEffect,\n useRef,\n useCallback,\n type RefObject\n} from \"react\";\n\nexport interface UseContainerWidthOptions {\n /**\n * If true, delays initial render until width is measured.\n * Useful for SSR or when you need accurate initial measurements.\n */\n measureBeforeMount?: boolean;\n\n /**\n * Initial width to use before measurement.\n * Defaults to 1280.\n */\n initialWidth?: number;\n}\n\nexport interface UseContainerWidthResult {\n /**\n * Current container width in pixels.\n */\n width: number;\n\n /**\n * Whether the container has been measured at least once.\n */\n mounted: boolean;\n\n /**\n * Ref to attach to the container element.\n */\n containerRef: RefObject<HTMLDivElement | null>;\n\n /**\n * Manually trigger a width measurement.\n * Useful when the container size might change without a resize event.\n */\n measureWidth: () => void;\n}\n\n/**\n * Hook to observe and track container width.\n *\n * Replaces the WidthProvider HOC with a more composable approach.\n *\n * @example\n * ```tsx\n * function MyGrid() {\n * const { width, containerRef, mounted } = useContainerWidth();\n *\n * return (\n * <div ref={containerRef}>\n * {mounted && <GridLayout width={width} {...props} />}\n * </div>\n * );\n * }\n * ```\n */\nexport function useContainerWidth(\n options: UseContainerWidthOptions = {}\n): UseContainerWidthResult {\n const { measureBeforeMount = false, initialWidth = 1280 } = options;\n\n const [width, setWidth] = useState(initialWidth);\n const [mounted, setMounted] = useState(!measureBeforeMount);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const measureWidth = useCallback(() => {\n const node = containerRef.current;\n if (node) {\n const newWidth = node.offsetWidth;\n setWidth(newWidth);\n if (!mounted) {\n setMounted(true);\n }\n }\n }, [mounted]);\n\n useEffect(() => {\n const node = containerRef.current;\n if (!node) return;\n\n // Initial measurement\n measureWidth();\n\n // Set up ResizeObserver\n if (typeof ResizeObserver !== \"undefined\") {\n observerRef.current = new ResizeObserver(entries => {\n const entry = entries[0];\n if (entry) {\n // Use contentRect.width for consistent measurements\n const newWidth = entry.contentRect.width;\n setWidth(newWidth);\n }\n });\n\n observerRef.current.observe(node);\n }\n\n return () => {\n if (observerRef.current) {\n observerRef.current.disconnect();\n observerRef.current = null;\n }\n };\n }, [measureWidth]);\n\n return {\n width,\n mounted,\n containerRef,\n measureWidth\n };\n}\n\nexport default useContainerWidth;\n","/**\n * useGridLayout hook\n *\n * Core hook for managing grid layout state, including drag, resize, and drop operations.\n * This extracts the state management logic from ReactGridLayout into a reusable hook.\n */\n\nimport { useState, useCallback, useMemo, useRef, useEffect } from \"react\";\nimport { deepEqual } from \"fast-equals\";\nimport type {\n Layout,\n LayoutItem,\n DroppingPosition,\n Compactor,\n Mutable\n} from \"../../core/types.js\";\nimport {\n cloneLayout,\n cloneLayoutItem,\n moveElement,\n correctBounds,\n bottom,\n getLayoutItem\n} from \"../../core/layout.js\";\nimport { verticalCompactor } from \"../../core/compactors.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface DragState {\n /** Currently dragging item placeholder */\n activeDrag: LayoutItem | null;\n /** Original item before drag started */\n oldDragItem: LayoutItem | null;\n /** Layout before drag started */\n oldLayout: Layout | null;\n}\n\nexport interface ResizeState {\n /** Whether a resize is in progress */\n resizing: boolean;\n /** Original item before resize started */\n oldResizeItem: LayoutItem | null;\n /** Layout before resize started */\n oldLayout: Layout | null;\n}\n\nexport interface DropState {\n /** DOM node for the dropping placeholder */\n droppingDOMNode: React.ReactElement | null;\n /** Current drop position */\n droppingPosition: DroppingPosition | null;\n}\n\nexport interface UseGridLayoutOptions {\n /** Initial layout */\n layout: Layout;\n /** Number of columns */\n cols: number;\n /** Prevent collisions when moving items */\n preventCollision?: boolean;\n /** Called when layout changes */\n onLayoutChange?: (layout: Layout) => void;\n /** Compactor for layout compaction (default: verticalCompactor) */\n compactor?: Compactor;\n}\n\nexport interface UseGridLayoutResult {\n /** Current layout */\n layout: Layout;\n /** Set layout directly */\n setLayout: (layout: Layout) => void;\n /** Drag state */\n dragState: DragState;\n /** Resize state */\n resizeState: ResizeState;\n /** Drop state */\n dropState: DropState;\n /** Start dragging an item */\n onDragStart: (itemId: string, x: number, y: number) => LayoutItem | null;\n /** Update drag position */\n onDrag: (itemId: string, x: number, y: number) => void;\n /** Stop dragging */\n onDragStop: (itemId: string, x: number, y: number) => void;\n /** Start resizing an item */\n onResizeStart: (itemId: string) => LayoutItem | null;\n /** Update resize dimensions */\n onResize: (\n itemId: string,\n w: number,\n h: number,\n x?: number,\n y?: number\n ) => void;\n /** Stop resizing */\n onResizeStop: (itemId: string, w: number, h: number) => void;\n /** Start dropping (external drag-in) */\n onDropDragOver: (\n droppingItem: LayoutItem,\n position: DroppingPosition\n ) => void;\n /** Update drop position */\n onDropDragLeave: () => void;\n /** Complete drop */\n onDrop: (droppingItem: LayoutItem) => void;\n /** Container height in rows */\n containerHeight: number;\n /** Whether any drag/resize is active */\n isInteracting: boolean;\n /** Get the compactor being used */\n compactor: Compactor;\n}\n\n// ============================================================================\n// Hook Implementation\n// ============================================================================\n\n/**\n * Hook for managing grid layout state.\n *\n * Handles all layout state including drag, resize, and drop operations.\n * Uses immutable updates and provides callbacks for all interactions.\n *\n * @example\n * ```tsx\n * function MyGrid() {\n * const {\n * layout,\n * onDragStart,\n * onDrag,\n * onDragStop,\n * containerHeight\n * } = useGridLayout({\n * layout: initialLayout,\n * cols: 12\n * });\n *\n * return (\n * <div style={{ height: containerHeight }}>\n * {layout.map(item => (\n * <GridItem\n * key={item.i}\n * {...item}\n * onDragStart={() => onDragStart(item.i, item.x, item.y)}\n * />\n * ))}\n * </div>\n * );\n * }\n * ```\n */\nexport function useGridLayout(\n options: UseGridLayoutOptions\n): UseGridLayoutResult {\n const {\n layout: propsLayout,\n cols,\n preventCollision = false,\n onLayoutChange,\n compactor = verticalCompactor\n } = options;\n\n // Track if we're currently dragging to block prop updates\n const isDraggingRef = useRef(false);\n\n // Initialize layout with compaction using the compactor\n const [layout, setLayoutState] = useState<Layout>(() => {\n const corrected = correctBounds(cloneLayout(propsLayout), { cols });\n return compactor.compact(corrected, cols);\n });\n\n // Drag state\n const [dragState, setDragState] = useState<DragState>({\n activeDrag: null,\n oldDragItem: null,\n oldLayout: null\n });\n\n // Resize state\n const [resizeState, setResizeState] = useState<ResizeState>({\n resizing: false,\n oldResizeItem: null,\n oldLayout: null\n });\n\n // Drop state\n const [dropState, setDropState] = useState<DropState>({\n droppingDOMNode: null,\n droppingPosition: null\n });\n\n // Track previous layout for change detection\n const prevLayoutRef = useRef<Layout>(layout);\n\n // Set layout with optional compaction - use compactor.compact() (#2213)\n const setLayout = useCallback(\n (newLayout: Layout) => {\n const corrected = correctBounds(cloneLayout(newLayout), { cols });\n const compacted = compactor.compact(corrected, cols);\n setLayoutState(compacted);\n },\n [cols, compactor]\n );\n\n // Sync layout from props when not dragging\n useEffect(() => {\n if (isDraggingRef.current) return;\n\n if (!deepEqual(propsLayout, prevLayoutRef.current)) {\n setLayout(propsLayout);\n }\n }, [propsLayout, setLayout]);\n\n // Notify layout changes\n useEffect(() => {\n if (!deepEqual(layout, prevLayoutRef.current)) {\n prevLayoutRef.current = layout;\n onLayoutChange?.(layout);\n }\n }, [layout, onLayoutChange]);\n\n // ============================================================================\n // Drag Handlers\n // ============================================================================\n\n const onDragStart = useCallback(\n (itemId: string, x: number, y: number): LayoutItem | null => {\n const item = getLayoutItem(layout, itemId);\n if (!item) return null;\n\n isDraggingRef.current = true;\n\n const placeholder: LayoutItem = {\n ...cloneLayoutItem(item),\n x,\n y,\n static: false,\n moved: false\n };\n\n setDragState({\n activeDrag: placeholder,\n oldDragItem: cloneLayoutItem(item),\n oldLayout: cloneLayout(layout)\n });\n\n return placeholder;\n },\n [layout]\n );\n\n const onDrag = useCallback(\n (itemId: string, x: number, y: number) => {\n const item = getLayoutItem(layout, itemId);\n if (!item) return;\n\n // Update placeholder position\n setDragState(prev => ({\n ...prev,\n activeDrag: prev.activeDrag ? { ...prev.activeDrag, x, y } : null\n }));\n\n // Move element and update layout\n const newLayout = moveElement(\n layout,\n item,\n x,\n y,\n true, // isUserAction\n preventCollision,\n compactor.type,\n cols,\n compactor.allowOverlap\n );\n\n // Compact layout - use compactor.compact() (#2213)\n const compacted = compactor.compact(newLayout, cols);\n\n setLayoutState(compacted);\n },\n [layout, cols, compactor, preventCollision]\n );\n\n const onDragStop = useCallback(\n (itemId: string, x: number, y: number) => {\n const item = getLayoutItem(layout, itemId);\n if (!item) return;\n\n // Final move\n const newLayout = moveElement(\n layout,\n item,\n x,\n y,\n true,\n preventCollision,\n compactor.type,\n cols,\n compactor.allowOverlap\n );\n\n // Compact and finalize - use compactor.compact() (#2213)\n const compacted = compactor.compact(newLayout, cols);\n\n isDraggingRef.current = false;\n\n setDragState({\n activeDrag: null,\n oldDragItem: null,\n oldLayout: null\n });\n\n setLayoutState(compacted);\n },\n [layout, cols, compactor, preventCollision]\n );\n\n // ============================================================================\n // Resize Handlers\n // ============================================================================\n\n const onResizeStart = useCallback(\n (itemId: string): LayoutItem | null => {\n const item = getLayoutItem(layout, itemId);\n if (!item) return null;\n\n setResizeState({\n resizing: true,\n oldResizeItem: cloneLayoutItem(item),\n oldLayout: cloneLayout(layout)\n });\n\n return item;\n },\n [layout]\n );\n\n const onResize = useCallback(\n (itemId: string, w: number, h: number, x?: number, y?: number) => {\n const newLayout = layout.map(item => {\n if (item.i === itemId) {\n const updated: LayoutItem = {\n ...item,\n w,\n h\n };\n if (x !== undefined) (updated as Mutable<LayoutItem>).x = x;\n if (y !== undefined) (updated as Mutable<LayoutItem>).y = y;\n return updated;\n }\n return item;\n });\n\n // Correct bounds and compact - use compactor.compact() (#2213)\n const corrected = correctBounds(newLayout, { cols });\n const compacted = compactor.compact(corrected, cols);\n\n setLayoutState(compacted);\n },\n [layout, cols, compactor]\n );\n\n const onResizeStop = useCallback(\n (itemId: string, w: number, h: number) => {\n // Apply final resize\n onResize(itemId, w, h);\n\n setResizeState({\n resizing: false,\n oldResizeItem: null,\n oldLayout: null\n });\n },\n [onResize]\n );\n\n // ============================================================================\n // Drop Handlers\n // ============================================================================\n\n const onDropDragOver = useCallback(\n (droppingItem: LayoutItem, position: DroppingPosition) => {\n // Check if item already exists in layout\n const existingItem = getLayoutItem(layout, droppingItem.i);\n\n if (!existingItem) {\n // Add dropping item to layout - use compactor.compact() (#2213)\n const newLayout = [...layout, droppingItem];\n const corrected = correctBounds(newLayout, { cols });\n const compacted = compactor.compact(corrected, cols);\n setLayoutState(compacted);\n }\n\n setDropState({\n droppingDOMNode: null, // Will be set by component\n droppingPosition: position\n });\n },\n [layout, cols, compactor]\n );\n\n const onDropDragLeave = useCallback(() => {\n // Remove dropping placeholder from layout\n const newLayout = layout.filter(item => item.i !== \"__dropping-elem__\");\n setLayoutState(newLayout);\n\n setDropState({\n droppingDOMNode: null,\n droppingPosition: null\n });\n }, [layout]);\n\n const onDrop = useCallback(\n (droppingItem: LayoutItem) => {\n // Replace placeholder with actual item\n const newLayout = layout.map(item => {\n if (item.i === \"__dropping-elem__\") {\n return {\n ...item,\n i: droppingItem.i,\n static: false\n };\n }\n return item;\n });\n\n // Use compactor.compact() (#2213)\n const corrected = correctBounds(newLayout, { cols });\n const compacted = compactor.compact(corrected, cols);\n setLayoutState(compacted);\n\n setDropState({\n droppingDOMNode: null,\n droppingPosition: null\n });\n },\n [layout, cols, compactor]\n );\n\n // ============================================================================\n // Computed Values\n // ============================================================================\n\n const containerHeight = useMemo(() => bottom(layout), [layout]);\n\n const isInteracting =\n dragState.activeDrag !== null ||\n resizeState.resizing ||\n dropState.droppingPosition !== null;\n\n return {\n layout,\n setLayout,\n dragState,\n resizeState,\n dropState,\n onDragStart,\n onDrag,\n onDragStop,\n onResizeStart,\n onResize,\n onResizeStop,\n onDropDragOver,\n onDropDragLeave,\n onDrop,\n containerHeight,\n isInteracting,\n compactor\n };\n}\n\nexport default useGridLayout;\n","/**\n * useResponsiveLayout hook\n *\n * Manages responsive breakpoints and layout generation for different screen sizes.\n * Extracts state management from ResponsiveReactGridLayout into a reusable hook.\n */\n\nimport { useState, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { deepEqual } from \"fast-equals\";\nimport type {\n Layout,\n Breakpoint,\n Breakpoints,\n ResponsiveLayouts,\n Compactor\n} from \"../../core/types.js\";\nimport { cloneLayout } from \"../../core/layout.js\";\nimport {\n getBreakpointFromWidth,\n getColsFromBreakpoint,\n findOrGenerateResponsiveLayout,\n sortBreakpoints\n} from \"../../core/responsive.js\";\nimport { verticalCompactor } from \"../../core/compactors.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Default breakpoint names */\nexport type DefaultBreakpoints = \"lg\" | \"md\" | \"sm\" | \"xs\" | \"xxs\";\n\n/** Default breakpoint widths */\nexport const DEFAULT_BREAKPOINTS: Breakpoints<DefaultBreakpoints> = {\n lg: 1200,\n md: 996,\n sm: 768,\n xs: 480,\n xxs: 0\n};\n\n/** Default column counts per breakpoint */\nexport const DEFAULT_COLS: Breakpoints<DefaultBreakpoints> = {\n lg: 12,\n md: 10,\n sm: 6,\n xs: 4,\n xxs: 2\n};\n\nexport interface UseResponsiveLayoutOptions<\n B extends Breakpoint = DefaultBreakpoints\n> {\n /** Current container width */\n width: number;\n /** Breakpoint definitions (name → min-width) */\n breakpoints?: Breakpoints<B>;\n /** Column counts per breakpoint */\n cols?: Breakpoints<B>;\n /** Layouts for each breakpoint */\n layouts?: ResponsiveLayouts<B>;\n /** Compactor for layout compaction (default: verticalCompactor) */\n compactor?: Compactor;\n /** Called when breakpoint changes */\n onBreakpointChange?: (newBreakpoint: B, cols: number) => void;\n /** Called when layout changes */\n onLayoutChange?: (layout: Layout, layouts: ResponsiveLayouts<B>) => void;\n /** Called when width changes */\n onWidthChange?: (\n width: number,\n margin: readonly [number, number],\n cols: number,\n containerPadding: readonly [number, number] | null\n ) => void;\n}\n\nexport interface UseResponsiveLayoutResult<\n B extends Breakpoint = DefaultBreakpoints\n> {\n /** Current layout for the active breakpoint */\n layout: Layout;\n /** All layouts by breakpoint */\n layouts: ResponsiveLayouts<B>;\n /** Current active breakpoint */\n breakpoint: B;\n /** Column count for the current breakpoint */\n cols: number;\n /** Update layouts for a specific breakpoint */\n setLayoutForBreakpoint: (breakpoint: B, layout: Layout) => void;\n /** Update all layouts */\n setLayouts: (layouts: ResponsiveLayouts<B>) => void;\n /** Sorted array of breakpoint names (smallest to largest) */\n sortedBreakpoints: B[];\n}\n\n// ============================================================================\n// Hook Implementation\n// ============================================================================\n\n/**\n * Hook for managing responsive grid layouts.\n *\n * Automatically selects the appropriate layout based on container width\n * and generates layouts for new breakpoints from existing ones.\n *\n * @example\n * ```tsx\n * function MyResponsiveGrid() {\n * const { width, containerRef } = useContainerWidth();\n * const { layout, breakpoint, cols } = useResponsiveLayout({\n * width,\n * layouts: {\n * lg: [...],\n * md: [...],\n * sm: [...]\n * }\n * });\n *\n * return (\n * <div ref={containerRef}>\n * <GridLayout\n * width={width}\n * cols={cols}\n * layout={layout}\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function useResponsiveLayout<B extends Breakpoint = DefaultBreakpoints>(\n options: UseResponsiveLayoutOptions<B>\n): UseResponsiveLayoutResult<B> {\n const {\n width,\n breakpoints = DEFAULT_BREAKPOINTS as unknown as Breakpoints<B>,\n cols: colsConfig = DEFAULT_COLS as unknown as Breakpoints<B>,\n layouts: propsLayouts = {} as ResponsiveLayouts<B>,\n compactor = verticalCompactor,\n onBreakpointChange,\n onLayoutChange,\n onWidthChange\n } = options;\n\n // Sorted breakpoints for consistent ordering\n const sortedBreakpoints = useMemo(\n () => sortBreakpoints(breakpoints),\n [breakpoints]\n );\n\n // Calculate initial breakpoint and cols\n const initialBreakpoint = useMemo(\n () => getBreakpointFromWidth(breakpoints, width),\n // Only calculate on mount, not on width changes\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const initialCols = useMemo(\n () => getColsFromBreakpoint(initialBreakpoint, colsConfig),\n [initialBreakpoint, colsConfig]\n );\n\n // State\n const [breakpoint, setBreakpoint] = useState<B>(initialBreakpoint);\n const [cols, setCols] = useState<number>(initialCols);\n const [layouts, setLayoutsState] = useState<ResponsiveLayouts<B>>(() => {\n // Clone initial layouts\n const cloned = {} as ResponsiveLayouts<B>;\n for (const bp of sortedBreakpoints) {\n const layout = propsLayouts[bp];\n if (layout) {\n (cloned as Record<B, Layout>)[bp] = cloneLayout(layout);\n }\n }\n return cloned;\n });\n\n // Track previous values for change detection\n const prevWidthRef = useRef(width);\n const prevBreakpointRef = useRef(breakpoint);\n // Separate refs for props vs state to prevent infinite loops (#2202)\n // When using inline objects for layouts prop, we need to compare props to props\n // and state to state, not mix them up.\n const prevPropsLayoutsRef = useRef(propsLayouts);\n const prevLayoutsRef = useRef(layouts);\n\n // Current layout for the active breakpoint - use compactor (#2213)\n const layout = useMemo(() => {\n return findOrGenerateResponsiveLayout(\n layouts,\n breakpoints,\n breakpoint,\n prevBreakpointRef.current,\n cols,\n compactor\n );\n }, [layouts, breakpoints, breakpoint, cols, compactor]);\n\n // Set layout for a specific breakpoint\n const setLayoutForBreakpoint = useCallback((bp: B, newLayout: Layout) => {\n setLayoutsState((prev: ResponsiveLayouts<B>) => ({\n ...prev,\n [bp]: cloneLayout(newLayout)\n }));\n }, []);\n\n // Set all layouts\n const setLayouts = useCallback((newLayouts: ResponsiveLayouts<B>) => {\n const cloned = {} as ResponsiveLayouts<B>;\n for (const bp of Object.keys(newLayouts) as B[]) {\n const layoutForBp = newLayouts[bp];\n if (layoutForBp) {\n (cloned as Record<B, Layout>)[bp] = cloneLayout(layoutForBp);\n }\n }\n setLayoutsState(cloned);\n }, []);\n\n // Handle width changes\n useEffect(() => {\n if (prevWidthRef.current === width) return;\n prevWidthRef.current = width;\n\n // Determine new breakpoint\n const newBreakpoint = getBreakpointFromWidth(breakpoints, width);\n const newCols = getColsFromBreakpoint(newBreakpoint, colsConfig);\n\n // Notify width change\n onWidthChange?.(width, [10, 10], newCols, null);\n\n // Check if breakpoint changed\n if (newBreakpoint !== breakpoint) {\n // Generate layout for new breakpoint\n // Use compactor (#2213)\n const newLayout = findOrGenerateResponsiveLayout(\n layouts,\n breakpoints,\n newBreakpoint,\n breakpoint,\n newCols,\n compactor\n );\n\n // Update layouts with the new breakpoint layout\n const updatedLayouts: ResponsiveLayouts<B> = {\n ...layouts,\n [newBreakpoint]: newLayout\n };\n\n setLayoutsState(updatedLayouts);\n setBreakpoint(newBreakpoint);\n setCols(newCols);\n\n // Notify breakpoint change\n onBreakpointChange?.(newBreakpoint, newCols);\n\n prevBreakpointRef.current = newBreakpoint;\n }\n }, [\n width,\n breakpoints,\n colsConfig,\n breakpoint,\n layouts,\n compactor,\n onBreakpointChange,\n onWidthChange\n ]);\n\n // Sync with prop layouts when they change\n useEffect(() => {\n if (!deepEqual(propsLayouts, prevPropsLayoutsRef.current)) {\n setLayouts(propsLayouts);\n prevPropsLayoutsRef.current = propsLayouts;\n }\n }, [propsLayouts, setLayouts]);\n\n // Notify layout changes\n useEffect(() => {\n if (!deepEqual(layouts, prevLayoutsRef.current)) {\n prevLayoutsRef.current = layouts;\n onLayoutChange?.(layout, layouts);\n }\n }, [layout, layouts, onLayoutChange]);\n\n return {\n layout,\n layouts,\n breakpoint,\n cols,\n setLayoutForBreakpoint,\n setLayouts,\n sortedBreakpoints\n };\n}\n\nexport default useResponsiveLayout;\n"]}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chunk-ZWN22PS2.mjs.map
3
+ //# sourceMappingURL=chunk-ZWN22PS2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-526JND3R.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-ZWN22PS2.mjs"}
package/dist/core.d.mts CHANGED
@@ -1,34 +1,8 @@
1
- import { L as Layout, C as CompactType, a as LayoutItem, f as LayoutConstraint, g as ConstraintContext, d as ResizeHandleAxis } from './types-CokovIMH.mjs';
2
- export { A as ArrayElement, B as Breakpoint, p as BreakpointCols, b as Breakpoints, c as Compactor, r as DeepPartial, m as DragConfig, j as DragOverEvent, o as DropConfig, D as DroppingPosition, E as EventCallback, l as GridConfig, G as GridDragEvent, e as GridResizeEvent, M as Mutable, q as OnBreakpointChangeCallback, O as OnLayoutChangeCallback, h as PartialPosition, P as Position, k as PositionStrategy, i as ReactDraggableCallbackData, n as ResizeConfig, R as ResponsiveLayouts, S as Size, t as defaultDragConfig, v as defaultDropConfig, s as defaultGridConfig, u as defaultResizeConfig } from './types-CokovIMH.mjs';
3
- export { c as collides, h as findOrGenerateResponsiveLayout, a as getAllCollisions, e as getBreakpointFromWidth, f as getColsFromBreakpoint, g as getFirstCollision, j as getIndentationValue, i as sortBreakpoints, s as sortLayoutItems, d as sortLayoutItemsByColRow, b as sortLayoutItemsByRowCol } from './responsive-BB5d98xz.mjs';
4
- export { A as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, u as compactItemHorizontal, t as compactItemVertical, k as correctBounds, B as createScaledStrategy, C as defaultPositionStrategy, d as getCompactor, g as getLayoutItem, i as getStatics, h as horizontalCompactor, p as horizontalOverlapCompactor, j as modifyLayout, m as moveElement, l as moveElementAwayFromCollision, n as noCompactor, q as noOverlapCompactor, x as perc, y as resizeItemInDirection, r as resolveCompactionCollision, f as setTopLeft, s as setTransform, z as transformStrategy, v as validateLayout, e as verticalCompactor, o as verticalOverlapCompactor, w as withLayoutItem } from './position-CXNzFxI0.mjs';
5
- export { d as GridCellConfig, G as GridCellDimensions, P as PositionParams, j as calcGridCellDimensions, e as calcGridColWidth, c as calcGridItemPosition, f as calcGridItemWHPx, b as calcWH, h as calcWHRaw, a as calcXY, g as calcXYRaw, i as clamp } from './calculate-DwbL1D06.mjs';
6
-
7
- /**
8
- * Legacy compaction API - backwards compatibility layer.
9
- *
10
- * This file implements the exact v1 compaction algorithm for backwards compatibility.
11
- * The algorithm matches lib/utils.js compact/compactItem functions exactly.
12
- */
13
-
14
- /**
15
- * Compact a layout by removing gaps between items.
16
- *
17
- * This is the exact algorithm from lib/utils.js compact function.
18
- *
19
- * @param layout - Layout to compact
20
- * @param compactType - 'vertical', 'horizontal', or null
21
- * @param cols - Number of columns in the grid
22
- * @param allowOverlap - If true, overlapping is allowed
23
- * @returns Compacted layout
24
- */
25
- declare function compact(layout: Layout, compactType: CompactType, cols: number, allowOverlap?: boolean): LayoutItem[];
26
- /**
27
- * Compact a single item within the layout.
28
- *
29
- * @deprecated Use compact() instead, which handles the full layout.
30
- */
31
- declare function compactItem(compareWith: Layout, l: LayoutItem, compactType: CompactType, cols: number, fullLayout: Layout, allowOverlap: boolean | undefined, maxY: number | undefined): LayoutItem;
1
+ import { f as LayoutConstraint, a as LayoutItem, g as ConstraintContext, d as ResizeHandleAxis } from './types-BiXsdXr7.mjs';
2
+ export { A as ArrayElement, B as Breakpoint, p as BreakpointCols, b as Breakpoints, C as CompactType, c as Compactor, r as DeepPartial, m as DragConfig, j as DragOverEvent, o as DropConfig, D as DroppingPosition, E as EventCallback, l as GridConfig, G as GridDragEvent, e as GridResizeEvent, L as Layout, M as Mutable, q as OnBreakpointChangeCallback, O as OnLayoutChangeCallback, h as PartialPosition, P as Position, k as PositionStrategy, i as ReactDraggableCallbackData, n as ResizeConfig, R as ResponsiveLayouts, S as Size, t as defaultDragConfig, v as defaultDropConfig, s as defaultGridConfig, u as defaultResizeConfig } from './types-BiXsdXr7.mjs';
3
+ export { c as collides, h as findOrGenerateResponsiveLayout, a as getAllCollisions, e as getBreakpointFromWidth, f as getColsFromBreakpoint, g as getFirstCollision, j as getIndentationValue, i as sortBreakpoints, s as sortLayoutItems, d as sortLayoutItemsByColRow, b as sortLayoutItemsByRowCol } from './responsive-T0N0GmBB.mjs';
4
+ export { A as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, u as compactItemHorizontal, t as compactItemVertical, k as correctBounds, B as createScaledStrategy, C as defaultPositionStrategy, d as getCompactor, g as getLayoutItem, i as getStatics, h as horizontalCompactor, p as horizontalOverlapCompactor, j as modifyLayout, m as moveElement, l as moveElementAwayFromCollision, n as noCompactor, q as noOverlapCompactor, x as perc, y as resizeItemInDirection, r as resolveCompactionCollision, f as setTopLeft, s as setTransform, z as transformStrategy, v as validateLayout, e as verticalCompactor, o as verticalOverlapCompactor, w as withLayoutItem } from './position-CetgOHhD.mjs';
5
+ export { d as GridCellConfig, G as GridCellDimensions, P as PositionParams, j as calcGridCellDimensions, e as calcGridColWidth, c as calcGridItemPosition, f as calcGridItemWHPx, b as calcWH, h as calcWHRaw, a as calcXY, g as calcXYRaw, i as clamp } from './calculate-FbCWy8x1.mjs';
32
6
 
33
7
  /**
34
8
  * Pluggable layout constraints for react-grid-layout v2
@@ -183,4 +157,4 @@ declare function applySizeConstraints(constraints: LayoutConstraint[], item: Lay
183
157
  h: number;
184
158
  };
185
159
 
186
- export { CompactType, ConstraintContext, Layout, LayoutConstraint, LayoutItem, ResizeHandleAxis, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, compact, compactItem, containerBounds, defaultConstraints, gridBounds, maxSize, minMaxSize, minSize, snapToGrid };
160
+ export { ConstraintContext, LayoutConstraint, LayoutItem, ResizeHandleAxis, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, containerBounds, defaultConstraints, gridBounds, maxSize, minMaxSize, minSize, snapToGrid };
package/dist/core.d.ts CHANGED
@@ -1,34 +1,8 @@
1
- import { L as Layout, C as CompactType, a as LayoutItem, f as LayoutConstraint, g as ConstraintContext, d as ResizeHandleAxis } from './types-CokovIMH.js';
2
- export { A as ArrayElement, B as Breakpoint, p as BreakpointCols, b as Breakpoints, c as Compactor, r as DeepPartial, m as DragConfig, j as DragOverEvent, o as DropConfig, D as DroppingPosition, E as EventCallback, l as GridConfig, G as GridDragEvent, e as GridResizeEvent, M as Mutable, q as OnBreakpointChangeCallback, O as OnLayoutChangeCallback, h as PartialPosition, P as Position, k as PositionStrategy, i as ReactDraggableCallbackData, n as ResizeConfig, R as ResponsiveLayouts, S as Size, t as defaultDragConfig, v as defaultDropConfig, s as defaultGridConfig, u as defaultResizeConfig } from './types-CokovIMH.js';
3
- export { c as collides, h as findOrGenerateResponsiveLayout, a as getAllCollisions, e as getBreakpointFromWidth, f as getColsFromBreakpoint, g as getFirstCollision, j as getIndentationValue, i as sortBreakpoints, s as sortLayoutItems, d as sortLayoutItemsByColRow, b as sortLayoutItemsByRowCol } from './responsive-BXI-GCXG.js';
4
- export { A as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, u as compactItemHorizontal, t as compactItemVertical, k as correctBounds, B as createScaledStrategy, C as defaultPositionStrategy, d as getCompactor, g as getLayoutItem, i as getStatics, h as horizontalCompactor, p as horizontalOverlapCompactor, j as modifyLayout, m as moveElement, l as moveElementAwayFromCollision, n as noCompactor, q as noOverlapCompactor, x as perc, y as resizeItemInDirection, r as resolveCompactionCollision, f as setTopLeft, s as setTransform, z as transformStrategy, v as validateLayout, e as verticalCompactor, o as verticalOverlapCompactor, w as withLayoutItem } from './position-Dk0FRWA9.js';
5
- export { d as GridCellConfig, G as GridCellDimensions, P as PositionParams, j as calcGridCellDimensions, e as calcGridColWidth, c as calcGridItemPosition, f as calcGridItemWHPx, b as calcWH, h as calcWHRaw, a as calcXY, g as calcXYRaw, i as clamp } from './calculate-DsVTldEE.js';
6
-
7
- /**
8
- * Legacy compaction API - backwards compatibility layer.
9
- *
10
- * This file implements the exact v1 compaction algorithm for backwards compatibility.
11
- * The algorithm matches lib/utils.js compact/compactItem functions exactly.
12
- */
13
-
14
- /**
15
- * Compact a layout by removing gaps between items.
16
- *
17
- * This is the exact algorithm from lib/utils.js compact function.
18
- *
19
- * @param layout - Layout to compact
20
- * @param compactType - 'vertical', 'horizontal', or null
21
- * @param cols - Number of columns in the grid
22
- * @param allowOverlap - If true, overlapping is allowed
23
- * @returns Compacted layout
24
- */
25
- declare function compact(layout: Layout, compactType: CompactType, cols: number, allowOverlap?: boolean): LayoutItem[];
26
- /**
27
- * Compact a single item within the layout.
28
- *
29
- * @deprecated Use compact() instead, which handles the full layout.
30
- */
31
- declare function compactItem(compareWith: Layout, l: LayoutItem, compactType: CompactType, cols: number, fullLayout: Layout, allowOverlap: boolean | undefined, maxY: number | undefined): LayoutItem;
1
+ import { f as LayoutConstraint, a as LayoutItem, g as ConstraintContext, d as ResizeHandleAxis } from './types-BiXsdXr7.js';
2
+ export { A as ArrayElement, B as Breakpoint, p as BreakpointCols, b as Breakpoints, C as CompactType, c as Compactor, r as DeepPartial, m as DragConfig, j as DragOverEvent, o as DropConfig, D as DroppingPosition, E as EventCallback, l as GridConfig, G as GridDragEvent, e as GridResizeEvent, L as Layout, M as Mutable, q as OnBreakpointChangeCallback, O as OnLayoutChangeCallback, h as PartialPosition, P as Position, k as PositionStrategy, i as ReactDraggableCallbackData, n as ResizeConfig, R as ResponsiveLayouts, S as Size, t as defaultDragConfig, v as defaultDropConfig, s as defaultGridConfig, u as defaultResizeConfig } from './types-BiXsdXr7.js';
3
+ export { c as collides, h as findOrGenerateResponsiveLayout, a as getAllCollisions, e as getBreakpointFromWidth, f as getColsFromBreakpoint, g as getFirstCollision, j as getIndentationValue, i as sortBreakpoints, s as sortLayoutItems, d as sortLayoutItemsByColRow, b as sortLayoutItemsByRowCol } from './responsive-DLRtE8v8.js';
4
+ export { A as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, u as compactItemHorizontal, t as compactItemVertical, k as correctBounds, B as createScaledStrategy, C as defaultPositionStrategy, d as getCompactor, g as getLayoutItem, i as getStatics, h as horizontalCompactor, p as horizontalOverlapCompactor, j as modifyLayout, m as moveElement, l as moveElementAwayFromCollision, n as noCompactor, q as noOverlapCompactor, x as perc, y as resizeItemInDirection, r as resolveCompactionCollision, f as setTopLeft, s as setTransform, z as transformStrategy, v as validateLayout, e as verticalCompactor, o as verticalOverlapCompactor, w as withLayoutItem } from './position-DhZqWO1-.js';
5
+ export { d as GridCellConfig, G as GridCellDimensions, P as PositionParams, j as calcGridCellDimensions, e as calcGridColWidth, c as calcGridItemPosition, f as calcGridItemWHPx, b as calcWH, h as calcWHRaw, a as calcXY, g as calcXYRaw, i as clamp } from './calculate-9RxGrt-U.js';
32
6
 
33
7
  /**
34
8
  * Pluggable layout constraints for react-grid-layout v2
@@ -183,4 +157,4 @@ declare function applySizeConstraints(constraints: LayoutConstraint[], item: Lay
183
157
  h: number;
184
158
  };
185
159
 
186
- export { CompactType, ConstraintContext, Layout, LayoutConstraint, LayoutItem, ResizeHandleAxis, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, compact, compactItem, containerBounds, defaultConstraints, gridBounds, maxSize, minMaxSize, minSize, snapToGrid };
160
+ export { ConstraintContext, LayoutConstraint, LayoutItem, ResizeHandleAxis, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, containerBounds, defaultConstraints, gridBounds, maxSize, minMaxSize, minSize, snapToGrid };
package/dist/core.js CHANGED
@@ -1,174 +1,166 @@
1
1
  'use strict';
2
2
 
3
- require('./chunk-7ELO5FRW.js');
4
- var chunk2TEFHZC4_js = require('./chunk-2TEFHZC4.js');
3
+ require('./chunk-PBQSHIID.js');
4
+ var chunk2DDROKB2_js = require('./chunk-2DDROKB2.js');
5
5
  var chunkBJFPTW5Q_js = require('./chunk-BJFPTW5Q.js');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "absoluteStrategy", {
10
10
  enumerable: true,
11
- get: function () { return chunk2TEFHZC4_js.absoluteStrategy; }
11
+ get: function () { return chunk2DDROKB2_js.absoluteStrategy; }
12
12
  });
13
13
  Object.defineProperty(exports, "applyPositionConstraints", {
14
14
  enumerable: true,
15
- get: function () { return chunk2TEFHZC4_js.applyPositionConstraints; }
15
+ get: function () { return chunk2DDROKB2_js.applyPositionConstraints; }
16
16
  });
17
17
  Object.defineProperty(exports, "applySizeConstraints", {
18
18
  enumerable: true,
19
- get: function () { return chunk2TEFHZC4_js.applySizeConstraints; }
19
+ get: function () { return chunk2DDROKB2_js.applySizeConstraints; }
20
20
  });
21
21
  Object.defineProperty(exports, "aspectRatio", {
22
22
  enumerable: true,
23
- get: function () { return chunk2TEFHZC4_js.aspectRatio; }
23
+ get: function () { return chunk2DDROKB2_js.aspectRatio; }
24
24
  });
25
25
  Object.defineProperty(exports, "boundedX", {
26
26
  enumerable: true,
27
- get: function () { return chunk2TEFHZC4_js.boundedX; }
27
+ get: function () { return chunk2DDROKB2_js.boundedX; }
28
28
  });
29
29
  Object.defineProperty(exports, "boundedY", {
30
30
  enumerable: true,
31
- get: function () { return chunk2TEFHZC4_js.boundedY; }
32
- });
33
- Object.defineProperty(exports, "compact", {
34
- enumerable: true,
35
- get: function () { return chunk2TEFHZC4_js.compact; }
36
- });
37
- Object.defineProperty(exports, "compactItem", {
38
- enumerable: true,
39
- get: function () { return chunk2TEFHZC4_js.compactItem; }
31
+ get: function () { return chunk2DDROKB2_js.boundedY; }
40
32
  });
41
33
  Object.defineProperty(exports, "compactItemHorizontal", {
42
34
  enumerable: true,
43
- get: function () { return chunk2TEFHZC4_js.compactItemHorizontal; }
35
+ get: function () { return chunk2DDROKB2_js.compactItemHorizontal; }
44
36
  });
45
37
  Object.defineProperty(exports, "compactItemVertical", {
46
38
  enumerable: true,
47
- get: function () { return chunk2TEFHZC4_js.compactItemVertical; }
39
+ get: function () { return chunk2DDROKB2_js.compactItemVertical; }
48
40
  });
49
41
  Object.defineProperty(exports, "containerBounds", {
50
42
  enumerable: true,
51
- get: function () { return chunk2TEFHZC4_js.containerBounds; }
43
+ get: function () { return chunk2DDROKB2_js.containerBounds; }
52
44
  });
53
45
  Object.defineProperty(exports, "createScaledStrategy", {
54
46
  enumerable: true,
55
- get: function () { return chunk2TEFHZC4_js.createScaledStrategy; }
47
+ get: function () { return chunk2DDROKB2_js.createScaledStrategy; }
56
48
  });
57
49
  Object.defineProperty(exports, "defaultConstraints", {
58
50
  enumerable: true,
59
- get: function () { return chunk2TEFHZC4_js.defaultConstraints; }
51
+ get: function () { return chunk2DDROKB2_js.defaultConstraints; }
60
52
  });
61
53
  Object.defineProperty(exports, "defaultDragConfig", {
62
54
  enumerable: true,
63
- get: function () { return chunk2TEFHZC4_js.defaultDragConfig; }
55
+ get: function () { return chunk2DDROKB2_js.defaultDragConfig; }
64
56
  });
65
57
  Object.defineProperty(exports, "defaultDropConfig", {
66
58
  enumerable: true,
67
- get: function () { return chunk2TEFHZC4_js.defaultDropConfig; }
59
+ get: function () { return chunk2DDROKB2_js.defaultDropConfig; }
68
60
  });
69
61
  Object.defineProperty(exports, "defaultGridConfig", {
70
62
  enumerable: true,
71
- get: function () { return chunk2TEFHZC4_js.defaultGridConfig; }
63
+ get: function () { return chunk2DDROKB2_js.defaultGridConfig; }
72
64
  });
73
65
  Object.defineProperty(exports, "defaultPositionStrategy", {
74
66
  enumerable: true,
75
- get: function () { return chunk2TEFHZC4_js.defaultPositionStrategy; }
67
+ get: function () { return chunk2DDROKB2_js.defaultPositionStrategy; }
76
68
  });
77
69
  Object.defineProperty(exports, "defaultResizeConfig", {
78
70
  enumerable: true,
79
- get: function () { return chunk2TEFHZC4_js.defaultResizeConfig; }
71
+ get: function () { return chunk2DDROKB2_js.defaultResizeConfig; }
80
72
  });
81
73
  Object.defineProperty(exports, "findOrGenerateResponsiveLayout", {
82
74
  enumerable: true,
83
- get: function () { return chunk2TEFHZC4_js.findOrGenerateResponsiveLayout; }
75
+ get: function () { return chunk2DDROKB2_js.findOrGenerateResponsiveLayout; }
84
76
  });
85
77
  Object.defineProperty(exports, "getBreakpointFromWidth", {
86
78
  enumerable: true,
87
- get: function () { return chunk2TEFHZC4_js.getBreakpointFromWidth; }
79
+ get: function () { return chunk2DDROKB2_js.getBreakpointFromWidth; }
88
80
  });
89
81
  Object.defineProperty(exports, "getColsFromBreakpoint", {
90
82
  enumerable: true,
91
- get: function () { return chunk2TEFHZC4_js.getColsFromBreakpoint; }
83
+ get: function () { return chunk2DDROKB2_js.getColsFromBreakpoint; }
92
84
  });
93
85
  Object.defineProperty(exports, "getCompactor", {
94
86
  enumerable: true,
95
- get: function () { return chunk2TEFHZC4_js.getCompactor; }
87
+ get: function () { return chunk2DDROKB2_js.getCompactor; }
96
88
  });
97
89
  Object.defineProperty(exports, "getIndentationValue", {
98
90
  enumerable: true,
99
- get: function () { return chunk2TEFHZC4_js.getIndentationValue; }
91
+ get: function () { return chunk2DDROKB2_js.getIndentationValue; }
100
92
  });
101
93
  Object.defineProperty(exports, "gridBounds", {
102
94
  enumerable: true,
103
- get: function () { return chunk2TEFHZC4_js.gridBounds; }
95
+ get: function () { return chunk2DDROKB2_js.gridBounds; }
104
96
  });
105
97
  Object.defineProperty(exports, "horizontalCompactor", {
106
98
  enumerable: true,
107
- get: function () { return chunk2TEFHZC4_js.horizontalCompactor; }
99
+ get: function () { return chunk2DDROKB2_js.horizontalCompactor; }
108
100
  });
109
101
  Object.defineProperty(exports, "horizontalOverlapCompactor", {
110
102
  enumerable: true,
111
- get: function () { return chunk2TEFHZC4_js.horizontalOverlapCompactor; }
103
+ get: function () { return chunk2DDROKB2_js.horizontalOverlapCompactor; }
112
104
  });
113
105
  Object.defineProperty(exports, "maxSize", {
114
106
  enumerable: true,
115
- get: function () { return chunk2TEFHZC4_js.maxSize; }
107
+ get: function () { return chunk2DDROKB2_js.maxSize; }
116
108
  });
117
109
  Object.defineProperty(exports, "minMaxSize", {
118
110
  enumerable: true,
119
- get: function () { return chunk2TEFHZC4_js.minMaxSize; }
111
+ get: function () { return chunk2DDROKB2_js.minMaxSize; }
120
112
  });
121
113
  Object.defineProperty(exports, "minSize", {
122
114
  enumerable: true,
123
- get: function () { return chunk2TEFHZC4_js.minSize; }
115
+ get: function () { return chunk2DDROKB2_js.minSize; }
124
116
  });
125
117
  Object.defineProperty(exports, "noCompactor", {
126
118
  enumerable: true,
127
- get: function () { return chunk2TEFHZC4_js.noCompactor; }
119
+ get: function () { return chunk2DDROKB2_js.noCompactor; }
128
120
  });
129
121
  Object.defineProperty(exports, "noOverlapCompactor", {
130
122
  enumerable: true,
131
- get: function () { return chunk2TEFHZC4_js.noOverlapCompactor; }
123
+ get: function () { return chunk2DDROKB2_js.noOverlapCompactor; }
132
124
  });
133
125
  Object.defineProperty(exports, "perc", {
134
126
  enumerable: true,
135
- get: function () { return chunk2TEFHZC4_js.perc; }
127
+ get: function () { return chunk2DDROKB2_js.perc; }
136
128
  });
137
129
  Object.defineProperty(exports, "resizeItemInDirection", {
138
130
  enumerable: true,
139
- get: function () { return chunk2TEFHZC4_js.resizeItemInDirection; }
131
+ get: function () { return chunk2DDROKB2_js.resizeItemInDirection; }
140
132
  });
141
133
  Object.defineProperty(exports, "resolveCompactionCollision", {
142
134
  enumerable: true,
143
- get: function () { return chunk2TEFHZC4_js.resolveCompactionCollision; }
135
+ get: function () { return chunk2DDROKB2_js.resolveCompactionCollision; }
144
136
  });
145
137
  Object.defineProperty(exports, "setTopLeft", {
146
138
  enumerable: true,
147
- get: function () { return chunk2TEFHZC4_js.setTopLeft; }
139
+ get: function () { return chunk2DDROKB2_js.setTopLeft; }
148
140
  });
149
141
  Object.defineProperty(exports, "setTransform", {
150
142
  enumerable: true,
151
- get: function () { return chunk2TEFHZC4_js.setTransform; }
143
+ get: function () { return chunk2DDROKB2_js.setTransform; }
152
144
  });
153
145
  Object.defineProperty(exports, "snapToGrid", {
154
146
  enumerable: true,
155
- get: function () { return chunk2TEFHZC4_js.snapToGrid; }
147
+ get: function () { return chunk2DDROKB2_js.snapToGrid; }
156
148
  });
157
149
  Object.defineProperty(exports, "sortBreakpoints", {
158
150
  enumerable: true,
159
- get: function () { return chunk2TEFHZC4_js.sortBreakpoints; }
151
+ get: function () { return chunk2DDROKB2_js.sortBreakpoints; }
160
152
  });
161
153
  Object.defineProperty(exports, "transformStrategy", {
162
154
  enumerable: true,
163
- get: function () { return chunk2TEFHZC4_js.transformStrategy; }
155
+ get: function () { return chunk2DDROKB2_js.transformStrategy; }
164
156
  });
165
157
  Object.defineProperty(exports, "verticalCompactor", {
166
158
  enumerable: true,
167
- get: function () { return chunk2TEFHZC4_js.verticalCompactor; }
159
+ get: function () { return chunk2DDROKB2_js.verticalCompactor; }
168
160
  });
169
161
  Object.defineProperty(exports, "verticalOverlapCompactor", {
170
162
  enumerable: true,
171
- get: function () { return chunk2TEFHZC4_js.verticalOverlapCompactor; }
163
+ get: function () { return chunk2DDROKB2_js.verticalOverlapCompactor; }
172
164
  });
173
165
  Object.defineProperty(exports, "bottom", {
174
166
  enumerable: true,
package/dist/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import './chunk-526JND3R.mjs';
2
- export { absoluteStrategy, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, compact, compactItem, compactItemHorizontal, compactItemVertical, containerBounds, createScaledStrategy, defaultConstraints, defaultDragConfig, defaultDropConfig, defaultGridConfig, defaultPositionStrategy, defaultResizeConfig, findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, getCompactor, getIndentationValue, gridBounds, horizontalCompactor, horizontalOverlapCompactor, maxSize, minMaxSize, minSize, noCompactor, noOverlapCompactor, perc, resizeItemInDirection, resolveCompactionCollision, setTopLeft, setTransform, snapToGrid, sortBreakpoints, transformStrategy, verticalCompactor, verticalOverlapCompactor } from './chunk-OH26KG7Y.mjs';
1
+ import './chunk-ZWN22PS2.mjs';
2
+ export { absoluteStrategy, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, compactItemHorizontal, compactItemVertical, containerBounds, createScaledStrategy, defaultConstraints, defaultDragConfig, defaultDropConfig, defaultGridConfig, defaultPositionStrategy, defaultResizeConfig, findOrGenerateResponsiveLayout, getBreakpointFromWidth, getColsFromBreakpoint, getCompactor, getIndentationValue, gridBounds, horizontalCompactor, horizontalOverlapCompactor, maxSize, minMaxSize, minSize, noCompactor, noOverlapCompactor, perc, resizeItemInDirection, resolveCompactionCollision, setTopLeft, setTransform, snapToGrid, sortBreakpoints, transformStrategy, verticalCompactor, verticalOverlapCompactor } from './chunk-XYPIYYYQ.mjs';
3
3
  export { bottom, calcGridCellDimensions, calcGridColWidth, calcGridItemPosition, calcGridItemWHPx, calcWH, calcWHRaw, calcXY, calcXYRaw, clamp, cloneLayout, cloneLayoutItem, collides, correctBounds, getAllCollisions, getFirstCollision, getLayoutItem, getStatics, modifyLayout, moveElement, moveElementAwayFromCollision, sortLayoutItems, sortLayoutItemsByColRow, sortLayoutItemsByRowCol, validateLayout, withLayoutItem } from './chunk-AWM66AWF.mjs';
4
4
  //# sourceMappingURL=core.mjs.map
5
5
  //# sourceMappingURL=core.mjs.map
package/dist/extras.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { d as GridCellConfig } from './calculate-DwbL1D06.mjs';
3
- import { c as Compactor } from './types-CokovIMH.mjs';
2
+ import { d as GridCellConfig } from './calculate-FbCWy8x1.mjs';
3
+ import { c as Compactor } from './types-BiXsdXr7.mjs';
4
4
 
5
5
  /**
6
6
  * GridBackground component
package/dist/extras.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { d as GridCellConfig } from './calculate-DsVTldEE.js';
3
- import { c as Compactor } from './types-CokovIMH.js';
2
+ import { d as GridCellConfig } from './calculate-9RxGrt-U.js';
3
+ import { c as Compactor } from './types-BiXsdXr7.js';
4
4
 
5
5
  /**
6
6
  * GridBackground component