react-grid-layout 2.0.0 → 2.1.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.
Files changed (70) hide show
  1. package/README.md +97 -25
  2. package/css/styles.css +0 -1
  3. package/dist/{ResponsiveGridLayout-D6lFRE3f.d.mts → ResponsiveGridLayout-BkHF9YHa.d.mts} +10 -1
  4. package/dist/{ResponsiveGridLayout-CH4s0tKj.d.ts → ResponsiveGridLayout-CLn16-X3.d.ts} +10 -1
  5. package/dist/{calculate-CwYDW8na.d.mts → calculate-DsVTldEE.d.ts} +30 -2
  6. package/dist/{calculate-mgLpNJ5O.d.ts → calculate-DwbL1D06.d.mts} +30 -2
  7. package/dist/{chunk-4HNUMWQK.mjs → chunk-2O3ZME4Q.mjs} +178 -297
  8. package/dist/chunk-2O3ZME4Q.mjs.map +1 -0
  9. package/dist/chunk-526JND3R.mjs +3 -0
  10. package/dist/{chunk-ZWN22PS2.mjs.map → chunk-526JND3R.mjs.map} +1 -1
  11. package/dist/chunk-7ELO5FRW.js +4 -0
  12. package/dist/{chunk-PBQSHIID.js.map → chunk-7ELO5FRW.js.map} +1 -1
  13. package/dist/chunk-AWM66AWF.mjs +422 -0
  14. package/dist/chunk-AWM66AWF.mjs.map +1 -0
  15. package/dist/chunk-BJFPTW5Q.js +449 -0
  16. package/dist/chunk-BJFPTW5Q.js.map +1 -0
  17. package/dist/{chunk-3WO4SAYB.js → chunk-FN6MIZ24.js} +221 -345
  18. package/dist/chunk-FN6MIZ24.js.map +1 -0
  19. package/dist/{chunk-H5KMDLY3.js → chunk-GPZBANOK.js} +40 -39
  20. package/dist/chunk-GPZBANOK.js.map +1 -0
  21. package/dist/{chunk-ZCXE6SR5.mjs → chunk-LWF5EYMO.mjs} +4 -3
  22. package/dist/chunk-LWF5EYMO.mjs.map +1 -0
  23. package/dist/{chunk-R35HZZTA.mjs → chunk-MXXN7GUE.mjs} +170 -62
  24. package/dist/chunk-MXXN7GUE.mjs.map +1 -0
  25. package/dist/{chunk-BFTKGAP3.js → chunk-QRW3ND4U.js} +230 -122
  26. package/dist/chunk-QRW3ND4U.js.map +1 -0
  27. package/dist/core.d.mts +159 -6
  28. package/dist/core.d.ts +159 -6
  29. package/dist/core.js +141 -85
  30. package/dist/core.mjs +3 -3
  31. package/dist/extras.d.mts +133 -3
  32. package/dist/extras.d.ts +133 -3
  33. package/dist/extras.js +373 -2
  34. package/dist/extras.js.map +1 -1
  35. package/dist/extras.mjs +367 -2
  36. package/dist/extras.mjs.map +1 -1
  37. package/dist/index.d.mts +5 -5
  38. package/dist/index.d.ts +5 -5
  39. package/dist/index.js +64 -64
  40. package/dist/index.mjs +5 -5
  41. package/dist/legacy.d.mts +2 -2
  42. package/dist/legacy.d.ts +2 -2
  43. package/dist/legacy.js +26 -25
  44. package/dist/legacy.js.map +1 -1
  45. package/dist/legacy.mjs +16 -15
  46. package/dist/legacy.mjs.map +1 -1
  47. package/dist/{position-Dk2b4ZMS.d.ts → position-C8a5g6bb.d.mts} +11 -6
  48. package/dist/{position-BmN1z36J.d.mts → position-H8tBL91b.d.ts} +11 -6
  49. package/dist/react.d.mts +11 -5
  50. package/dist/react.d.ts +11 -5
  51. package/dist/react.js +38 -38
  52. package/dist/react.mjs +5 -5
  53. package/dist/{responsive-CJxefsYw.d.mts → responsive-BB5d98xz.d.mts} +1 -1
  54. package/dist/{responsive-C4L1ESlm.d.ts → responsive-BXI-GCXG.d.ts} +1 -1
  55. package/dist/{types-Cxf4nHNr.d.mts → types-CokovIMH.d.mts} +98 -4
  56. package/dist/{types-Cxf4nHNr.d.ts → types-CokovIMH.d.ts} +98 -4
  57. package/index-dev.js +16 -0
  58. package/package.json +2 -1
  59. package/dist/chunk-2KUHNJXF.mjs +0 -90
  60. package/dist/chunk-2KUHNJXF.mjs.map +0 -1
  61. package/dist/chunk-3WO4SAYB.js.map +0 -1
  62. package/dist/chunk-4HNUMWQK.mjs.map +0 -1
  63. package/dist/chunk-BFTKGAP3.js.map +0 -1
  64. package/dist/chunk-F6NQPYKT.js +0 -98
  65. package/dist/chunk-F6NQPYKT.js.map +0 -1
  66. package/dist/chunk-H5KMDLY3.js.map +0 -1
  67. package/dist/chunk-PBQSHIID.js +0 -4
  68. package/dist/chunk-R35HZZTA.mjs.map +0 -1
  69. package/dist/chunk-ZCXE6SR5.mjs.map +0 -1
  70. package/dist/chunk-ZWN22PS2.mjs +0 -3
@@ -1,5 +1,170 @@
1
1
  'use strict';
2
2
 
3
+ var chunkBJFPTW5Q_js = require('./chunk-BJFPTW5Q.js');
4
+
5
+ // src/core/constraints.ts
6
+ function clamp(value, min, max) {
7
+ return Math.max(min, Math.min(max, value));
8
+ }
9
+ var gridBounds = {
10
+ name: "gridBounds",
11
+ constrainPosition(item, x, y, { cols, maxRows }) {
12
+ return {
13
+ x: clamp(x, 0, Math.max(0, cols - item.w)),
14
+ y: clamp(y, 0, Math.max(0, maxRows - item.h))
15
+ };
16
+ },
17
+ constrainSize(item, w, h, handle, { cols, maxRows }) {
18
+ const maxW = handle === "w" || handle === "nw" || handle === "sw" ? item.x + item.w : cols - item.x;
19
+ const maxH = handle === "n" || handle === "nw" || handle === "ne" ? item.y + item.h : maxRows - item.y;
20
+ return {
21
+ w: clamp(w, 1, Math.max(1, maxW)),
22
+ h: clamp(h, 1, Math.max(1, maxH))
23
+ };
24
+ }
25
+ };
26
+ var minMaxSize = {
27
+ name: "minMaxSize",
28
+ constrainSize(item, w, h) {
29
+ return {
30
+ w: clamp(w, item.minW ?? 1, item.maxW ?? Infinity),
31
+ h: clamp(h, item.minH ?? 1, item.maxH ?? Infinity)
32
+ };
33
+ }
34
+ };
35
+ var containerBounds = {
36
+ name: "containerBounds",
37
+ constrainPosition(item, x, y, { cols, maxRows, containerHeight, rowHeight, margin }) {
38
+ const visibleRows = containerHeight > 0 ? Math.floor((containerHeight + margin[1]) / (rowHeight + margin[1])) : maxRows;
39
+ return {
40
+ x: clamp(x, 0, Math.max(0, cols - item.w)),
41
+ y: clamp(y, 0, Math.max(0, visibleRows - item.h))
42
+ };
43
+ }
44
+ };
45
+ var boundedX = {
46
+ name: "boundedX",
47
+ constrainPosition(item, x, y, { cols }) {
48
+ return {
49
+ x: clamp(x, 0, Math.max(0, cols - item.w)),
50
+ y
51
+ };
52
+ }
53
+ };
54
+ var boundedY = {
55
+ name: "boundedY",
56
+ constrainPosition(item, x, y, { maxRows }) {
57
+ return {
58
+ x,
59
+ y: clamp(y, 0, Math.max(0, maxRows - item.h))
60
+ };
61
+ }
62
+ };
63
+ function aspectRatio(ratio) {
64
+ return {
65
+ name: `aspectRatio(${ratio})`,
66
+ constrainSize(_item, w, _h, _handle, context) {
67
+ const { cols, containerWidth, rowHeight, margin } = context;
68
+ const colWidth = (containerWidth - margin[0] * (cols - 1)) / cols;
69
+ const pixelWidth = colWidth * w + margin[0] * Math.max(0, w - 1);
70
+ const pixelHeight = pixelWidth / ratio;
71
+ const h = Math.max(
72
+ 1,
73
+ Math.round((pixelHeight + margin[1]) / (rowHeight + margin[1]))
74
+ );
75
+ return { w, h };
76
+ }
77
+ };
78
+ }
79
+ function snapToGrid(stepX, stepY = stepX) {
80
+ if (stepX <= 0 || stepY <= 0) {
81
+ throw new Error(
82
+ `snapToGrid: step values must be positive (got stepX=${stepX}, stepY=${stepY})`
83
+ );
84
+ }
85
+ return {
86
+ name: `snapToGrid(${stepX}, ${stepY})`,
87
+ constrainPosition(_item, x, y) {
88
+ return {
89
+ x: Math.round(x / stepX) * stepX,
90
+ y: Math.round(y / stepY) * stepY
91
+ };
92
+ }
93
+ };
94
+ }
95
+ function minSize(minW, minH) {
96
+ return {
97
+ name: `minSize(${minW}, ${minH})`,
98
+ constrainSize(_item, w, h) {
99
+ return {
100
+ w: Math.max(minW, w),
101
+ h: Math.max(minH, h)
102
+ };
103
+ }
104
+ };
105
+ }
106
+ function maxSize(maxW, maxH) {
107
+ return {
108
+ name: `maxSize(${maxW}, ${maxH})`,
109
+ constrainSize(_item, w, h) {
110
+ return {
111
+ w: Math.min(maxW, w),
112
+ h: Math.min(maxH, h)
113
+ };
114
+ }
115
+ };
116
+ }
117
+ var defaultConstraints = [gridBounds, minMaxSize];
118
+ function applyPositionConstraints(constraints, item, x, y, context) {
119
+ let result = { x, y };
120
+ for (const constraint of constraints) {
121
+ if (constraint.constrainPosition) {
122
+ result = constraint.constrainPosition(item, result.x, result.y, context);
123
+ }
124
+ }
125
+ if (item.constraints) {
126
+ for (const constraint of item.constraints) {
127
+ if (constraint.constrainPosition) {
128
+ result = constraint.constrainPosition(
129
+ item,
130
+ result.x,
131
+ result.y,
132
+ context
133
+ );
134
+ }
135
+ }
136
+ }
137
+ return result;
138
+ }
139
+ function applySizeConstraints(constraints, item, w, h, handle, context) {
140
+ let result = { w, h };
141
+ for (const constraint of constraints) {
142
+ if (constraint.constrainSize) {
143
+ result = constraint.constrainSize(
144
+ item,
145
+ result.w,
146
+ result.h,
147
+ handle,
148
+ context
149
+ );
150
+ }
151
+ }
152
+ if (item.constraints) {
153
+ for (const constraint of item.constraints) {
154
+ if (constraint.constrainSize) {
155
+ result = constraint.constrainSize(
156
+ item,
157
+ result.w,
158
+ result.h,
159
+ handle,
160
+ context
161
+ );
162
+ }
163
+ }
164
+ }
165
+ return result;
166
+ }
167
+
3
168
  // src/core/position.ts
4
169
  function setTransform({
5
170
  top,
@@ -193,314 +358,28 @@ var defaultDropConfig = {
193
358
  defaultItem: { w: 1, h: 1 }
194
359
  };
195
360
 
196
- // src/core/collision.ts
197
- function collides(l1, l2) {
198
- if (l1.i === l2.i) return false;
199
- if (l1.x + l1.w <= l2.x) return false;
200
- if (l1.x >= l2.x + l2.w) return false;
201
- if (l1.y + l1.h <= l2.y) return false;
202
- if (l1.y >= l2.y + l2.h) return false;
203
- return true;
204
- }
205
- function getFirstCollision(layout, layoutItem) {
206
- for (let i = 0; i < layout.length; i++) {
207
- const item = layout[i];
208
- if (item !== void 0 && collides(item, layoutItem)) {
209
- return item;
210
- }
211
- }
212
- return void 0;
213
- }
214
- function getAllCollisions(layout, layoutItem) {
215
- return layout.filter((l) => collides(l, layoutItem));
216
- }
217
-
218
- // src/core/sort.ts
219
- function sortLayoutItems(layout, compactType) {
220
- if (compactType === "horizontal") {
221
- return sortLayoutItemsByColRow(layout);
222
- }
223
- if (compactType === "vertical") {
224
- return sortLayoutItemsByRowCol(layout);
225
- }
226
- return [...layout];
227
- }
228
- function sortLayoutItemsByRowCol(layout) {
229
- return [...layout].sort((a, b) => {
230
- if (a.y !== b.y) {
231
- return a.y - b.y;
232
- }
233
- return a.x - b.x;
234
- });
235
- }
236
- function sortLayoutItemsByColRow(layout) {
237
- return [...layout].sort((a, b) => {
238
- if (a.x !== b.x) {
239
- return a.x - b.x;
240
- }
241
- return a.y - b.y;
242
- });
243
- }
244
-
245
- // src/core/layout.ts
246
- function bottom(layout) {
247
- let max = 0;
248
- for (let i = 0; i < layout.length; i++) {
249
- const item = layout[i];
250
- if (item !== void 0) {
251
- const bottomY = item.y + item.h;
252
- if (bottomY > max) max = bottomY;
253
- }
254
- }
255
- return max;
256
- }
257
- function getLayoutItem(layout, id) {
258
- for (let i = 0; i < layout.length; i++) {
259
- const item = layout[i];
260
- if (item !== void 0 && item.i === id) {
261
- return item;
262
- }
263
- }
264
- return void 0;
265
- }
266
- function getStatics(layout) {
267
- return layout.filter((l) => l.static === true);
268
- }
269
- function cloneLayoutItem(layoutItem) {
270
- return {
271
- i: layoutItem.i,
272
- x: layoutItem.x,
273
- y: layoutItem.y,
274
- w: layoutItem.w,
275
- h: layoutItem.h,
276
- minW: layoutItem.minW,
277
- maxW: layoutItem.maxW,
278
- minH: layoutItem.minH,
279
- maxH: layoutItem.maxH,
280
- moved: Boolean(layoutItem.moved),
281
- static: Boolean(layoutItem.static),
282
- isDraggable: layoutItem.isDraggable,
283
- isResizable: layoutItem.isResizable,
284
- resizeHandles: layoutItem.resizeHandles,
285
- isBounded: layoutItem.isBounded
286
- };
287
- }
288
- function cloneLayout(layout) {
289
- const newLayout = new Array(layout.length);
290
- for (let i = 0; i < layout.length; i++) {
291
- const item = layout[i];
292
- if (item !== void 0) {
293
- newLayout[i] = cloneLayoutItem(item);
294
- }
295
- }
296
- return newLayout;
297
- }
298
- function modifyLayout(layout, layoutItem) {
299
- const newLayout = new Array(layout.length);
300
- for (let i = 0; i < layout.length; i++) {
301
- const item = layout[i];
302
- if (item !== void 0) {
303
- if (layoutItem.i === item.i) {
304
- newLayout[i] = layoutItem;
305
- } else {
306
- newLayout[i] = item;
307
- }
308
- }
309
- }
310
- return newLayout;
311
- }
312
- function withLayoutItem(layout, itemKey, cb) {
313
- let item = getLayoutItem(layout, itemKey);
314
- if (!item) {
315
- return [[...layout], null];
316
- }
317
- item = cb(cloneLayoutItem(item));
318
- const newLayout = modifyLayout(layout, item);
319
- return [newLayout, item];
320
- }
321
- function correctBounds(layout, bounds) {
322
- const collidesWith = getStatics(layout);
323
- for (let i = 0; i < layout.length; i++) {
324
- const l = layout[i];
325
- if (l === void 0) continue;
326
- if (l.x + l.w > bounds.cols) {
327
- l.x = bounds.cols - l.w;
328
- }
329
- if (l.x < 0) {
330
- l.x = 0;
331
- l.w = bounds.cols;
332
- }
333
- if (!l.static) {
334
- collidesWith.push(l);
335
- } else {
336
- while (getFirstCollision(collidesWith, l)) {
337
- l.y++;
338
- }
339
- }
340
- }
341
- return layout;
342
- }
343
- function moveElement(layout, l, x, y, isUserAction, preventCollision, compactType, cols, allowOverlap) {
344
- if (l.static && l.isDraggable !== true) {
345
- return [...layout];
346
- }
347
- if (l.y === y && l.x === x) {
348
- return [...layout];
349
- }
350
- const oldX = l.x;
351
- const oldY = l.y;
352
- if (typeof x === "number") l.x = x;
353
- if (typeof y === "number") l.y = y;
354
- l.moved = true;
355
- let sorted = sortLayoutItems(layout, compactType);
356
- const movingUp = compactType === "vertical" && typeof y === "number" ? oldY >= y : compactType === "horizontal" && typeof x === "number" ? oldX >= x : false;
357
- if (movingUp) {
358
- sorted = sorted.reverse();
359
- }
360
- const collisions = getAllCollisions(sorted, l);
361
- const hasCollisions = collisions.length > 0;
362
- if (hasCollisions && allowOverlap) {
363
- return cloneLayout(layout);
364
- }
365
- if (hasCollisions && preventCollision) {
366
- l.x = oldX;
367
- l.y = oldY;
368
- l.moved = false;
369
- return layout;
370
- }
371
- let resultLayout = [...layout];
372
- for (let i = 0; i < collisions.length; i++) {
373
- const collision = collisions[i];
374
- if (collision === void 0) continue;
375
- if (collision.moved) continue;
376
- if (collision.static) {
377
- resultLayout = moveElementAwayFromCollision(
378
- resultLayout,
379
- collision,
380
- l,
381
- isUserAction,
382
- compactType);
383
- } else {
384
- resultLayout = moveElementAwayFromCollision(
385
- resultLayout,
386
- l,
387
- collision,
388
- isUserAction,
389
- compactType);
390
- }
391
- }
392
- return resultLayout;
393
- }
394
- function moveElementAwayFromCollision(layout, collidesWith, itemToMove, isUserAction, compactType, cols) {
395
- const compactH = compactType === "horizontal";
396
- const compactV = compactType === "vertical";
397
- const preventCollision = collidesWith.static;
398
- if (isUserAction) {
399
- isUserAction = false;
400
- const fakeItem = {
401
- x: compactH ? Math.max(collidesWith.x - itemToMove.w, 0) : itemToMove.x,
402
- y: compactV ? Math.max(collidesWith.y - itemToMove.h, 0) : itemToMove.y,
403
- w: itemToMove.w,
404
- h: itemToMove.h,
405
- i: "-1"
406
- };
407
- const firstCollision = getFirstCollision(layout, fakeItem);
408
- const collisionNorth = firstCollision !== void 0 && firstCollision.y + firstCollision.h > collidesWith.y;
409
- const collisionWest = firstCollision !== void 0 && collidesWith.x + collidesWith.w > firstCollision.x;
410
- if (!firstCollision) {
411
- return moveElement(
412
- layout,
413
- itemToMove,
414
- compactH ? fakeItem.x : void 0,
415
- compactV ? fakeItem.y : void 0,
416
- isUserAction,
417
- preventCollision,
418
- compactType);
419
- }
420
- if (collisionNorth && compactV) {
421
- return moveElement(
422
- layout,
423
- itemToMove,
424
- void 0,
425
- itemToMove.y + 1,
426
- isUserAction,
427
- preventCollision,
428
- compactType);
429
- }
430
- if (collisionNorth && compactType === null) {
431
- collidesWith.y = itemToMove.y;
432
- itemToMove.y = itemToMove.y + itemToMove.h;
433
- return [...layout];
434
- }
435
- if (collisionWest && compactH) {
436
- return moveElement(
437
- layout,
438
- collidesWith,
439
- itemToMove.x,
440
- void 0,
441
- isUserAction,
442
- preventCollision,
443
- compactType);
444
- }
445
- }
446
- const newX = compactH ? itemToMove.x + 1 : void 0;
447
- const newY = compactV ? itemToMove.y + 1 : void 0;
448
- if (newX === void 0 && newY === void 0) {
449
- return [...layout];
450
- }
451
- return moveElement(
452
- layout,
453
- itemToMove,
454
- newX,
455
- newY,
456
- isUserAction,
457
- preventCollision,
458
- compactType);
459
- }
460
- function validateLayout(layout, contextName = "Layout") {
461
- const requiredProps = ["x", "y", "w", "h"];
462
- if (!Array.isArray(layout)) {
463
- throw new Error(`${contextName} must be an array!`);
464
- }
465
- for (let i = 0; i < layout.length; i++) {
466
- const item = layout[i];
467
- if (item === void 0) continue;
468
- for (const key of requiredProps) {
469
- const value = item[key];
470
- if (typeof value !== "number" || Number.isNaN(value)) {
471
- throw new Error(
472
- `ReactGridLayout: ${contextName}[${i}].${key} must be a number! Received: ${String(value)} (${typeof value})`
473
- );
474
- }
475
- }
476
- if (item.i !== void 0 && typeof item.i !== "string") {
477
- throw new Error(
478
- `ReactGridLayout: ${contextName}[${i}].i must be a string! Received: ${String(item.i)} (${typeof item.i})`
479
- );
480
- }
481
- }
482
- }
483
-
484
361
  // src/core/compact-compat.ts
485
362
  function getStatics2(layout) {
486
363
  return layout.filter((l) => l.static);
487
364
  }
488
365
  var heightWidth = { x: "w", y: "h" };
489
- function resolveCompactionCollision(layout, item, moveToCoord, axis) {
366
+ function resolveCompactionCollision(layout, item, moveToCoord, axis, hasStatics) {
490
367
  const sizeProp = heightWidth[axis];
491
368
  item[axis] += 1;
492
369
  const itemIndex = layout.findIndex((l) => l.i === item.i);
370
+ const layoutHasStatics = hasStatics ?? getStatics2(layout).length > 0;
493
371
  for (let i = itemIndex + 1; i < layout.length; i++) {
494
372
  const otherItem = layout[i];
495
373
  if (otherItem === void 0) continue;
496
374
  if (otherItem.static) continue;
497
- if (otherItem.y > item.y + item.h) break;
498
- if (collides(item, otherItem)) {
375
+ if (!layoutHasStatics && otherItem.y > item.y + item.h) break;
376
+ if (chunkBJFPTW5Q_js.collides(item, otherItem)) {
499
377
  resolveCompactionCollision(
500
378
  layout,
501
379
  otherItem,
502
380
  moveToCoord + item[sizeProp],
503
- axis
381
+ axis,
382
+ layoutHasStatics
504
383
  );
505
384
  }
506
385
  }
@@ -513,18 +392,18 @@ function compactItemInternal(compareWith, l, compactType, cols, fullLayout, allo
513
392
  if (typeof b === "number") {
514
393
  l.y = Math.min(b, l.y);
515
394
  } else {
516
- l.y = Math.min(bottom(compareWith), l.y);
395
+ l.y = Math.min(chunkBJFPTW5Q_js.bottom(compareWith), l.y);
517
396
  }
518
- while (l.y > 0 && !getFirstCollision(compareWith, l)) {
397
+ while (l.y > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
519
398
  l.y--;
520
399
  }
521
400
  } else if (compactH) {
522
- while (l.x > 0 && !getFirstCollision(compareWith, l)) {
401
+ while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
523
402
  l.x--;
524
403
  }
525
404
  }
526
405
  let collision;
527
- while ((collision = getFirstCollision(compareWith, l)) !== void 0 && !(compactType === null && allowOverlap)) {
406
+ while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0 && !(compactType === null && allowOverlap)) {
528
407
  if (compactH) {
529
408
  resolveCompactionCollision(fullLayout, l, collision.x + collision.w, "x");
530
409
  } else {
@@ -533,7 +412,7 @@ function compactItemInternal(compareWith, l, compactType, cols, fullLayout, allo
533
412
  if (compactH && l.x + l.w > cols) {
534
413
  l.x = cols - l.w;
535
414
  l.y++;
536
- while (l.x > 0 && !getFirstCollision(compareWith, l)) {
415
+ while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
537
416
  l.x--;
538
417
  }
539
418
  }
@@ -544,13 +423,13 @@ function compactItemInternal(compareWith, l, compactType, cols, fullLayout, allo
544
423
  }
545
424
  function compact(layout, compactType, cols, allowOverlap) {
546
425
  const compareWith = getStatics2(layout);
547
- let b = bottom(compareWith);
548
- const sorted = sortLayoutItems(layout, compactType);
426
+ let b = chunkBJFPTW5Q_js.bottom(compareWith);
427
+ const sorted = chunkBJFPTW5Q_js.sortLayoutItems(layout, compactType);
549
428
  const out = new Array(layout.length);
550
429
  for (let i = 0; i < sorted.length; i++) {
551
430
  const sortedItem = sorted[i];
552
431
  if (sortedItem === void 0) continue;
553
- let l = cloneLayoutItem(sortedItem);
432
+ let l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
554
433
  if (!l.static) {
555
434
  l = compactItemInternal(
556
435
  compareWith,
@@ -573,7 +452,7 @@ function compact(layout, compactType, cols, allowOverlap) {
573
452
  function compactItem(compareWith, l, compactType, cols, fullLayout, allowOverlap, maxY) {
574
453
  return compactItemInternal(
575
454
  compareWith,
576
- cloneLayoutItem(l),
455
+ chunkBJFPTW5Q_js.cloneLayoutItem(l),
577
456
  compactType,
578
457
  cols,
579
458
  fullLayout,
@@ -583,21 +462,23 @@ function compactItem(compareWith, l, compactType, cols, fullLayout, allowOverlap
583
462
  }
584
463
 
585
464
  // src/core/compactors.ts
586
- function resolveCompactionCollision2(layout, item, moveToCoord, axis) {
465
+ function resolveCompactionCollision2(layout, item, moveToCoord, axis, hasStatics) {
587
466
  const sizeProp = axis === "x" ? "w" : "h";
588
467
  item[axis] += 1;
589
468
  const itemIndex = layout.findIndex((l) => l.i === item.i);
469
+ const layoutHasStatics = hasStatics ?? chunkBJFPTW5Q_js.getStatics(layout).length > 0;
590
470
  for (let i = itemIndex + 1; i < layout.length; i++) {
591
471
  const otherItem = layout[i];
592
472
  if (otherItem === void 0) continue;
593
473
  if (otherItem.static) continue;
594
- if (otherItem.y > item.y + item.h) break;
595
- if (collides(item, otherItem)) {
474
+ if (!layoutHasStatics && otherItem.y > item.y + item.h) break;
475
+ if (chunkBJFPTW5Q_js.collides(item, otherItem)) {
596
476
  resolveCompactionCollision2(
597
477
  layout,
598
478
  otherItem,
599
479
  moveToCoord + item[sizeProp],
600
- axis
480
+ axis,
481
+ layoutHasStatics
601
482
  );
602
483
  }
603
484
  }
@@ -605,27 +486,27 @@ function resolveCompactionCollision2(layout, item, moveToCoord, axis) {
605
486
  }
606
487
  function compactItemVertical(compareWith, l, fullLayout, maxY) {
607
488
  l.y = Math.min(maxY, l.y);
608
- while (l.y > 0 && !getFirstCollision(compareWith, l)) {
489
+ while (l.y > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
609
490
  l.y--;
610
491
  }
611
492
  let collision;
612
- while ((collision = getFirstCollision(compareWith, l)) !== void 0) {
493
+ while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0) {
613
494
  resolveCompactionCollision2(fullLayout, l, collision.y + collision.h, "y");
614
495
  }
615
496
  l.y = Math.max(l.y, 0);
616
497
  return l;
617
498
  }
618
499
  function compactItemHorizontal(compareWith, l, cols, fullLayout) {
619
- while (l.x > 0 && !getFirstCollision(compareWith, l)) {
500
+ while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
620
501
  l.x--;
621
502
  }
622
503
  let collision;
623
- while ((collision = getFirstCollision(compareWith, l)) !== void 0) {
504
+ while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0) {
624
505
  resolveCompactionCollision2(fullLayout, l, collision.x + collision.w, "x");
625
506
  if (l.x + l.w > cols) {
626
507
  l.x = cols - l.w;
627
508
  l.y++;
628
- while (l.x > 0 && !getFirstCollision(compareWith, l)) {
509
+ while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
629
510
  l.x--;
630
511
  }
631
512
  }
@@ -637,14 +518,14 @@ var verticalCompactor = {
637
518
  type: "vertical",
638
519
  allowOverlap: false,
639
520
  compact(layout, _cols) {
640
- const compareWith = getStatics(layout);
641
- let maxY = bottom(compareWith);
642
- const sorted = sortLayoutItemsByRowCol(layout);
521
+ const compareWith = chunkBJFPTW5Q_js.getStatics(layout);
522
+ let maxY = chunkBJFPTW5Q_js.bottom(compareWith);
523
+ const sorted = chunkBJFPTW5Q_js.sortLayoutItemsByRowCol(layout);
643
524
  const out = new Array(layout.length);
644
525
  for (let i = 0; i < sorted.length; i++) {
645
526
  const sortedItem = sorted[i];
646
527
  if (sortedItem === void 0) continue;
647
- let l = cloneLayoutItem(sortedItem);
528
+ let l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
648
529
  if (!l.static) {
649
530
  l = compactItemVertical(compareWith, l, sorted, maxY);
650
531
  maxY = Math.max(maxY, l.y + l.h);
@@ -657,7 +538,7 @@ var verticalCompactor = {
657
538
  return out;
658
539
  },
659
540
  onMove(layout, item, x, y, _cols) {
660
- const newLayout = cloneLayout(layout);
541
+ const newLayout = chunkBJFPTW5Q_js.cloneLayout(layout);
661
542
  const movedItem = newLayout.find((l) => l.i === item.i);
662
543
  if (movedItem) {
663
544
  movedItem.x = x;
@@ -671,13 +552,13 @@ var horizontalCompactor = {
671
552
  type: "horizontal",
672
553
  allowOverlap: false,
673
554
  compact(layout, cols) {
674
- const compareWith = getStatics(layout);
675
- const sorted = sortLayoutItemsByColRow(layout);
555
+ const compareWith = chunkBJFPTW5Q_js.getStatics(layout);
556
+ const sorted = chunkBJFPTW5Q_js.sortLayoutItemsByColRow(layout);
676
557
  const out = new Array(layout.length);
677
558
  for (let i = 0; i < sorted.length; i++) {
678
559
  const sortedItem = sorted[i];
679
560
  if (sortedItem === void 0) continue;
680
- let l = cloneLayoutItem(sortedItem);
561
+ let l = chunkBJFPTW5Q_js.cloneLayoutItem(sortedItem);
681
562
  if (!l.static) {
682
563
  l = compactItemHorizontal(compareWith, l, cols, sorted);
683
564
  compareWith.push(l);
@@ -689,7 +570,7 @@ var horizontalCompactor = {
689
570
  return out;
690
571
  },
691
572
  onMove(layout, item, x, y, _cols) {
692
- const newLayout = cloneLayout(layout);
573
+ const newLayout = chunkBJFPTW5Q_js.cloneLayout(layout);
693
574
  const movedItem = newLayout.find((l) => l.i === item.i);
694
575
  if (movedItem) {
695
576
  movedItem.x = x;
@@ -703,10 +584,10 @@ var noCompactor = {
703
584
  type: null,
704
585
  allowOverlap: false,
705
586
  compact(layout, _cols) {
706
- return cloneLayout(layout);
587
+ return chunkBJFPTW5Q_js.cloneLayout(layout);
707
588
  },
708
589
  onMove(layout, item, x, y, _cols) {
709
- const newLayout = cloneLayout(layout);
590
+ const newLayout = chunkBJFPTW5Q_js.cloneLayout(layout);
710
591
  const movedItem = newLayout.find((l) => l.i === item.i);
711
592
  if (movedItem) {
712
593
  movedItem.x = x;
@@ -720,14 +601,14 @@ var verticalOverlapCompactor = {
720
601
  ...verticalCompactor,
721
602
  allowOverlap: true,
722
603
  compact(layout, _cols) {
723
- return cloneLayout(layout);
604
+ return chunkBJFPTW5Q_js.cloneLayout(layout);
724
605
  }
725
606
  };
726
607
  var horizontalOverlapCompactor = {
727
608
  ...horizontalCompactor,
728
609
  allowOverlap: true,
729
610
  compact(layout, _cols) {
730
- return cloneLayout(layout);
611
+ return chunkBJFPTW5Q_js.cloneLayout(layout);
731
612
  }
732
613
  };
733
614
  function getCompactor(compactType, allowOverlap = false, preventCollision = false) {
@@ -781,7 +662,7 @@ function getColsFromBreakpoint(breakpoint, cols) {
781
662
  function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBreakpoint, cols, compactType) {
782
663
  const existingLayout = layouts[breakpoint];
783
664
  if (existingLayout) {
784
- return cloneLayout(existingLayout);
665
+ return chunkBJFPTW5Q_js.cloneLayout(existingLayout);
785
666
  }
786
667
  let layout = layouts[lastBreakpoint];
787
668
  const breakpointsSorted = sortBreakpoints(breakpoints);
@@ -797,8 +678,8 @@ function findOrGenerateResponsiveLayout(layouts, breakpoints, breakpoint, lastBr
797
678
  break;
798
679
  }
799
680
  }
800
- const clonedLayout = cloneLayout(layout || []);
801
- return compact(correctBounds(clonedLayout, { cols }), compactType, cols);
681
+ const clonedLayout = chunkBJFPTW5Q_js.cloneLayout(layout || []);
682
+ return compact(chunkBJFPTW5Q_js.correctBounds(clonedLayout, { cols }), compactType, cols);
802
683
  }
803
684
  function getIndentationValue(value, breakpoint) {
804
685
  if (Array.isArray(value)) {
@@ -820,49 +701,44 @@ function getIndentationValue(value, breakpoint) {
820
701
  }
821
702
 
822
703
  exports.absoluteStrategy = absoluteStrategy;
823
- exports.bottom = bottom;
824
- exports.cloneLayout = cloneLayout;
825
- exports.cloneLayoutItem = cloneLayoutItem;
826
- exports.collides = collides;
704
+ exports.applyPositionConstraints = applyPositionConstraints;
705
+ exports.applySizeConstraints = applySizeConstraints;
706
+ exports.aspectRatio = aspectRatio;
707
+ exports.boundedX = boundedX;
708
+ exports.boundedY = boundedY;
827
709
  exports.compact = compact;
828
710
  exports.compactItem = compactItem;
829
711
  exports.compactItemHorizontal = compactItemHorizontal;
830
712
  exports.compactItemVertical = compactItemVertical;
831
- exports.correctBounds = correctBounds;
713
+ exports.containerBounds = containerBounds;
832
714
  exports.createScaledStrategy = createScaledStrategy;
715
+ exports.defaultConstraints = defaultConstraints;
833
716
  exports.defaultDragConfig = defaultDragConfig;
834
717
  exports.defaultDropConfig = defaultDropConfig;
835
718
  exports.defaultGridConfig = defaultGridConfig;
836
719
  exports.defaultPositionStrategy = defaultPositionStrategy;
837
720
  exports.defaultResizeConfig = defaultResizeConfig;
838
721
  exports.findOrGenerateResponsiveLayout = findOrGenerateResponsiveLayout;
839
- exports.getAllCollisions = getAllCollisions;
840
722
  exports.getBreakpointFromWidth = getBreakpointFromWidth;
841
723
  exports.getColsFromBreakpoint = getColsFromBreakpoint;
842
724
  exports.getCompactor = getCompactor;
843
- exports.getFirstCollision = getFirstCollision;
844
725
  exports.getIndentationValue = getIndentationValue;
845
- exports.getLayoutItem = getLayoutItem;
846
- exports.getStatics = getStatics;
726
+ exports.gridBounds = gridBounds;
847
727
  exports.horizontalCompactor = horizontalCompactor;
848
728
  exports.horizontalOverlapCompactor = horizontalOverlapCompactor;
849
- exports.modifyLayout = modifyLayout;
850
- exports.moveElement = moveElement;
851
- exports.moveElementAwayFromCollision = moveElementAwayFromCollision;
729
+ exports.maxSize = maxSize;
730
+ exports.minMaxSize = minMaxSize;
731
+ exports.minSize = minSize;
852
732
  exports.noCompactor = noCompactor;
853
733
  exports.perc = perc;
854
734
  exports.resizeItemInDirection = resizeItemInDirection;
855
735
  exports.resolveCompactionCollision = resolveCompactionCollision2;
856
736
  exports.setTopLeft = setTopLeft;
857
737
  exports.setTransform = setTransform;
738
+ exports.snapToGrid = snapToGrid;
858
739
  exports.sortBreakpoints = sortBreakpoints;
859
- exports.sortLayoutItems = sortLayoutItems;
860
- exports.sortLayoutItemsByColRow = sortLayoutItemsByColRow;
861
- exports.sortLayoutItemsByRowCol = sortLayoutItemsByRowCol;
862
740
  exports.transformStrategy = transformStrategy;
863
- exports.validateLayout = validateLayout;
864
741
  exports.verticalCompactor = verticalCompactor;
865
742
  exports.verticalOverlapCompactor = verticalOverlapCompactor;
866
- exports.withLayoutItem = withLayoutItem;
867
- //# sourceMappingURL=chunk-3WO4SAYB.js.map
868
- //# sourceMappingURL=chunk-3WO4SAYB.js.map
743
+ //# sourceMappingURL=chunk-FN6MIZ24.js.map
744
+ //# sourceMappingURL=chunk-FN6MIZ24.js.map