react-grid-layout 2.0.0 → 2.1.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 (70) hide show
  1. package/README.md +117 -28
  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-526JND3R.mjs +3 -0
  8. package/dist/{chunk-ZWN22PS2.mjs.map → chunk-526JND3R.mjs.map} +1 -1
  9. package/dist/chunk-7ELO5FRW.js +4 -0
  10. package/dist/{chunk-PBQSHIID.js.map → chunk-7ELO5FRW.js.map} +1 -1
  11. package/dist/chunk-AWM66AWF.mjs +422 -0
  12. package/dist/chunk-AWM66AWF.mjs.map +1 -0
  13. package/dist/chunk-BJFPTW5Q.js +449 -0
  14. package/dist/chunk-BJFPTW5Q.js.map +1 -0
  15. package/dist/{chunk-4HNUMWQK.mjs → chunk-FLITZMQC.mjs} +198 -311
  16. package/dist/chunk-FLITZMQC.mjs.map +1 -0
  17. package/dist/{chunk-ZCXE6SR5.mjs → chunk-LIKX67MZ.mjs} +7 -5
  18. package/dist/chunk-LIKX67MZ.mjs.map +1 -0
  19. package/dist/{chunk-R35HZZTA.mjs → chunk-PLWMASMX.mjs} +208 -90
  20. package/dist/chunk-PLWMASMX.mjs.map +1 -0
  21. package/dist/{chunk-BFTKGAP3.js → chunk-RB2IKK5B.js} +260 -142
  22. package/dist/chunk-RB2IKK5B.js.map +1 -0
  23. package/dist/{chunk-3WO4SAYB.js → chunk-WWS3M5Y3.js} +238 -355
  24. package/dist/chunk-WWS3M5Y3.js.map +1 -0
  25. package/dist/{chunk-H5KMDLY3.js → chunk-YQQYHEEG.js} +43 -41
  26. package/dist/chunk-YQQYHEEG.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 +145 -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-CXNzFxI0.d.mts} +18 -7
  48. package/dist/{position-BmN1z36J.d.mts → position-Dk0FRWA9.d.ts} +18 -7
  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 +5 -3
  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
package/dist/core.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { L as Layout, C as CompactType, a as LayoutItem } from './types-Cxf4nHNr.mjs';
2
- export { A as ArrayElement, B as Breakpoint, n as BreakpointCols, b as Breakpoints, c as Compactor, p as DeepPartial, k as DragConfig, h as DragOverEvent, m as DropConfig, D as DroppingPosition, E as EventCallback, j as GridConfig, G as GridDragEvent, e as GridResizeEvent, M as Mutable, o as OnBreakpointChangeCallback, O as OnLayoutChangeCallback, f as PartialPosition, P as Position, i as PositionStrategy, g as ReactDraggableCallbackData, l as ResizeConfig, d as ResizeHandleAxis, R as ResponsiveLayouts, S as Size, r as defaultDragConfig, t as defaultDropConfig, q as defaultGridConfig, s as defaultResizeConfig } from './types-Cxf4nHNr.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-CJxefsYw.mjs';
4
- export { z as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, t as compactItemHorizontal, q as compactItemVertical, k as correctBounds, A as createScaledStrategy, B 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, u as perc, x as resizeItemInDirection, r as resolveCompactionCollision, f as setTopLeft, s as setTransform, y as transformStrategy, v as validateLayout, e as verticalCompactor, o as verticalOverlapCompactor, w as withLayoutItem } from './position-BmN1z36J.mjs';
5
- export { d as GridCellConfig, G as GridCellDimensions, P as PositionParams, h as calcGridCellDimensions, e as calcGridColWidth, c as calcGridItemPosition, f as calcGridItemWHPx, b as calcWH, a as calcXY, g as clamp } from './calculate-CwYDW8na.mjs';
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
6
 
7
7
  /**
8
8
  * Legacy compaction API - backwards compatibility layer.
@@ -30,4 +30,157 @@ declare function compact(layout: Layout, compactType: CompactType, cols: number,
30
30
  */
31
31
  declare function compactItem(compareWith: Layout, l: LayoutItem, compactType: CompactType, cols: number, fullLayout: Layout, allowOverlap: boolean | undefined, maxY: number | undefined): LayoutItem;
32
32
 
33
- export { CompactType, Layout, LayoutItem, compact, compactItem };
33
+ /**
34
+ * Pluggable layout constraints for react-grid-layout v2
35
+ *
36
+ * Constraints control position and size limits during drag/resize operations.
37
+ * They are composable, tree-shakeable, and can be applied at grid or item level.
38
+ */
39
+
40
+ /**
41
+ * Grid boundary constraint.
42
+ *
43
+ * Ensures items stay within the grid bounds (0 to cols-w for x, 0 to maxRows-h for y).
44
+ * This is the default position constraint.
45
+ */
46
+ declare const gridBounds: LayoutConstraint;
47
+ /**
48
+ * Min/max size constraint.
49
+ *
50
+ * Enforces per-item minW/maxW/minH/maxH properties.
51
+ * This is applied by default after gridBounds.
52
+ */
53
+ declare const minMaxSize: LayoutConstraint;
54
+ /**
55
+ * Container bounds constraint.
56
+ *
57
+ * Constrains items to stay within the visible container.
58
+ * Use this as a replacement for the legacy `isBounded` prop.
59
+ *
60
+ * Unlike gridBounds which uses maxRows (which may be Infinity),
61
+ * this constraint calculates visible rows from the actual container height.
62
+ * Falls back to maxRows if containerHeight is 0 (auto-height grids).
63
+ */
64
+ declare const containerBounds: LayoutConstraint;
65
+ /**
66
+ * Bounded X constraint.
67
+ *
68
+ * Only constrains horizontal position (x-axis).
69
+ * Items can move freely in the vertical direction.
70
+ */
71
+ declare const boundedX: LayoutConstraint;
72
+ /**
73
+ * Bounded Y constraint.
74
+ *
75
+ * Only constrains vertical position (y-axis).
76
+ * Items can move freely in the horizontal direction.
77
+ */
78
+ declare const boundedY: LayoutConstraint;
79
+ /**
80
+ * Create an aspect ratio constraint.
81
+ *
82
+ * Maintains a fixed width-to-height ratio **in pixels** during resize operations.
83
+ * Accounts for the different pixel sizes of grid columns vs rows.
84
+ *
85
+ * @param ratio - Width-to-height ratio (e.g., 16/9 for widescreen, 1 for square)
86
+ * @returns A constraint that enforces the aspect ratio
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * // 16:9 aspect ratio (actual pixel proportions)
91
+ * const layout = [
92
+ * { i: 'video', x: 0, y: 0, w: 4, h: 2, constraints: [aspectRatio(16/9)] }
93
+ * ];
94
+ *
95
+ * // Square items (in pixels, not grid units)
96
+ * <GridLayout constraints={[gridBounds, minMaxSize, aspectRatio(1)]} />
97
+ * ```
98
+ */
99
+ declare function aspectRatio(ratio: number): LayoutConstraint;
100
+ /**
101
+ * Create a snap-to-grid constraint.
102
+ *
103
+ * Snaps positions to multiples of the specified step values.
104
+ * Useful for aligning items to a coarser grid.
105
+ *
106
+ * @param stepX - Horizontal snap step in grid units
107
+ * @param stepY - Vertical snap step in grid units (defaults to stepX)
108
+ * @returns A constraint that snaps positions to the grid
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * // Snap to every 2 grid units
113
+ * <GridLayout constraints={[snapToGrid(2), gridBounds]} />
114
+ *
115
+ * // Different horizontal and vertical snap
116
+ * <GridLayout constraints={[snapToGrid(2, 3), gridBounds]} />
117
+ * ```
118
+ */
119
+ declare function snapToGrid(stepX: number, stepY?: number): LayoutConstraint;
120
+ /**
121
+ * Create a minimum size constraint.
122
+ *
123
+ * Sets minimum width and height for all items using this constraint.
124
+ * Useful for grid-wide minimums without setting minW/minH on each item.
125
+ *
126
+ * @param minW - Minimum width in grid units
127
+ * @param minH - Minimum height in grid units
128
+ * @returns A constraint that enforces minimum size
129
+ */
130
+ declare function minSize(minW: number, minH: number): LayoutConstraint;
131
+ /**
132
+ * Create a maximum size constraint.
133
+ *
134
+ * Sets maximum width and height for all items using this constraint.
135
+ * Useful for grid-wide maximums without setting maxW/maxH on each item.
136
+ *
137
+ * @param maxW - Maximum width in grid units
138
+ * @param maxH - Maximum height in grid units
139
+ * @returns A constraint that enforces maximum size
140
+ */
141
+ declare function maxSize(maxW: number, maxH: number): LayoutConstraint;
142
+ /**
143
+ * Default constraints applied when none are specified.
144
+ *
145
+ * Includes:
146
+ * - gridBounds: Keep items within the grid
147
+ * - minMaxSize: Respect per-item min/max constraints
148
+ */
149
+ declare const defaultConstraints: LayoutConstraint[];
150
+ /**
151
+ * Apply position constraints to a proposed position.
152
+ *
153
+ * Constraints are applied in array order, allowing composition.
154
+ * Grid-level constraints are applied first, then per-item constraints.
155
+ *
156
+ * @param constraints - Array of constraints to apply
157
+ * @param item - The layout item being positioned
158
+ * @param x - Proposed x position
159
+ * @param y - Proposed y position
160
+ * @param context - Grid context (cols, maxRows, etc.)
161
+ * @returns Constrained position
162
+ */
163
+ declare function applyPositionConstraints(constraints: LayoutConstraint[], item: LayoutItem, x: number, y: number, context: ConstraintContext): {
164
+ x: number;
165
+ y: number;
166
+ };
167
+ /**
168
+ * Apply size constraints to a proposed size.
169
+ *
170
+ * Constraints are applied in array order, allowing composition.
171
+ * Grid-level constraints are applied first, then per-item constraints.
172
+ *
173
+ * @param constraints - Array of constraints to apply
174
+ * @param item - The layout item being resized
175
+ * @param w - Proposed width
176
+ * @param h - Proposed height
177
+ * @param handle - Which resize handle is being used
178
+ * @param context - Grid context (cols, maxRows, etc.)
179
+ * @returns Constrained size
180
+ */
181
+ declare function applySizeConstraints(constraints: LayoutConstraint[], item: LayoutItem, w: number, h: number, handle: ResizeHandleAxis, context: ConstraintContext): {
182
+ w: number;
183
+ h: number;
184
+ };
185
+
186
+ export { CompactType, ConstraintContext, Layout, LayoutConstraint, LayoutItem, ResizeHandleAxis, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, compact, compactItem, containerBounds, defaultConstraints, gridBounds, maxSize, minMaxSize, minSize, snapToGrid };
package/dist/core.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { L as Layout, C as CompactType, a as LayoutItem } from './types-Cxf4nHNr.js';
2
- export { A as ArrayElement, B as Breakpoint, n as BreakpointCols, b as Breakpoints, c as Compactor, p as DeepPartial, k as DragConfig, h as DragOverEvent, m as DropConfig, D as DroppingPosition, E as EventCallback, j as GridConfig, G as GridDragEvent, e as GridResizeEvent, M as Mutable, o as OnBreakpointChangeCallback, O as OnLayoutChangeCallback, f as PartialPosition, P as Position, i as PositionStrategy, g as ReactDraggableCallbackData, l as ResizeConfig, d as ResizeHandleAxis, R as ResponsiveLayouts, S as Size, r as defaultDragConfig, t as defaultDropConfig, q as defaultGridConfig, s as defaultResizeConfig } from './types-Cxf4nHNr.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-C4L1ESlm.js';
4
- export { z as absoluteStrategy, b as bottom, c as cloneLayout, a as cloneLayoutItem, t as compactItemHorizontal, q as compactItemVertical, k as correctBounds, A as createScaledStrategy, B 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, u as perc, x as resizeItemInDirection, r as resolveCompactionCollision, f as setTopLeft, s as setTransform, y as transformStrategy, v as validateLayout, e as verticalCompactor, o as verticalOverlapCompactor, w as withLayoutItem } from './position-Dk2b4ZMS.js';
5
- export { d as GridCellConfig, G as GridCellDimensions, P as PositionParams, h as calcGridCellDimensions, e as calcGridColWidth, c as calcGridItemPosition, f as calcGridItemWHPx, b as calcWH, a as calcXY, g as clamp } from './calculate-mgLpNJ5O.js';
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
6
 
7
7
  /**
8
8
  * Legacy compaction API - backwards compatibility layer.
@@ -30,4 +30,157 @@ declare function compact(layout: Layout, compactType: CompactType, cols: number,
30
30
  */
31
31
  declare function compactItem(compareWith: Layout, l: LayoutItem, compactType: CompactType, cols: number, fullLayout: Layout, allowOverlap: boolean | undefined, maxY: number | undefined): LayoutItem;
32
32
 
33
- export { CompactType, Layout, LayoutItem, compact, compactItem };
33
+ /**
34
+ * Pluggable layout constraints for react-grid-layout v2
35
+ *
36
+ * Constraints control position and size limits during drag/resize operations.
37
+ * They are composable, tree-shakeable, and can be applied at grid or item level.
38
+ */
39
+
40
+ /**
41
+ * Grid boundary constraint.
42
+ *
43
+ * Ensures items stay within the grid bounds (0 to cols-w for x, 0 to maxRows-h for y).
44
+ * This is the default position constraint.
45
+ */
46
+ declare const gridBounds: LayoutConstraint;
47
+ /**
48
+ * Min/max size constraint.
49
+ *
50
+ * Enforces per-item minW/maxW/minH/maxH properties.
51
+ * This is applied by default after gridBounds.
52
+ */
53
+ declare const minMaxSize: LayoutConstraint;
54
+ /**
55
+ * Container bounds constraint.
56
+ *
57
+ * Constrains items to stay within the visible container.
58
+ * Use this as a replacement for the legacy `isBounded` prop.
59
+ *
60
+ * Unlike gridBounds which uses maxRows (which may be Infinity),
61
+ * this constraint calculates visible rows from the actual container height.
62
+ * Falls back to maxRows if containerHeight is 0 (auto-height grids).
63
+ */
64
+ declare const containerBounds: LayoutConstraint;
65
+ /**
66
+ * Bounded X constraint.
67
+ *
68
+ * Only constrains horizontal position (x-axis).
69
+ * Items can move freely in the vertical direction.
70
+ */
71
+ declare const boundedX: LayoutConstraint;
72
+ /**
73
+ * Bounded Y constraint.
74
+ *
75
+ * Only constrains vertical position (y-axis).
76
+ * Items can move freely in the horizontal direction.
77
+ */
78
+ declare const boundedY: LayoutConstraint;
79
+ /**
80
+ * Create an aspect ratio constraint.
81
+ *
82
+ * Maintains a fixed width-to-height ratio **in pixels** during resize operations.
83
+ * Accounts for the different pixel sizes of grid columns vs rows.
84
+ *
85
+ * @param ratio - Width-to-height ratio (e.g., 16/9 for widescreen, 1 for square)
86
+ * @returns A constraint that enforces the aspect ratio
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * // 16:9 aspect ratio (actual pixel proportions)
91
+ * const layout = [
92
+ * { i: 'video', x: 0, y: 0, w: 4, h: 2, constraints: [aspectRatio(16/9)] }
93
+ * ];
94
+ *
95
+ * // Square items (in pixels, not grid units)
96
+ * <GridLayout constraints={[gridBounds, minMaxSize, aspectRatio(1)]} />
97
+ * ```
98
+ */
99
+ declare function aspectRatio(ratio: number): LayoutConstraint;
100
+ /**
101
+ * Create a snap-to-grid constraint.
102
+ *
103
+ * Snaps positions to multiples of the specified step values.
104
+ * Useful for aligning items to a coarser grid.
105
+ *
106
+ * @param stepX - Horizontal snap step in grid units
107
+ * @param stepY - Vertical snap step in grid units (defaults to stepX)
108
+ * @returns A constraint that snaps positions to the grid
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * // Snap to every 2 grid units
113
+ * <GridLayout constraints={[snapToGrid(2), gridBounds]} />
114
+ *
115
+ * // Different horizontal and vertical snap
116
+ * <GridLayout constraints={[snapToGrid(2, 3), gridBounds]} />
117
+ * ```
118
+ */
119
+ declare function snapToGrid(stepX: number, stepY?: number): LayoutConstraint;
120
+ /**
121
+ * Create a minimum size constraint.
122
+ *
123
+ * Sets minimum width and height for all items using this constraint.
124
+ * Useful for grid-wide minimums without setting minW/minH on each item.
125
+ *
126
+ * @param minW - Minimum width in grid units
127
+ * @param minH - Minimum height in grid units
128
+ * @returns A constraint that enforces minimum size
129
+ */
130
+ declare function minSize(minW: number, minH: number): LayoutConstraint;
131
+ /**
132
+ * Create a maximum size constraint.
133
+ *
134
+ * Sets maximum width and height for all items using this constraint.
135
+ * Useful for grid-wide maximums without setting maxW/maxH on each item.
136
+ *
137
+ * @param maxW - Maximum width in grid units
138
+ * @param maxH - Maximum height in grid units
139
+ * @returns A constraint that enforces maximum size
140
+ */
141
+ declare function maxSize(maxW: number, maxH: number): LayoutConstraint;
142
+ /**
143
+ * Default constraints applied when none are specified.
144
+ *
145
+ * Includes:
146
+ * - gridBounds: Keep items within the grid
147
+ * - minMaxSize: Respect per-item min/max constraints
148
+ */
149
+ declare const defaultConstraints: LayoutConstraint[];
150
+ /**
151
+ * Apply position constraints to a proposed position.
152
+ *
153
+ * Constraints are applied in array order, allowing composition.
154
+ * Grid-level constraints are applied first, then per-item constraints.
155
+ *
156
+ * @param constraints - Array of constraints to apply
157
+ * @param item - The layout item being positioned
158
+ * @param x - Proposed x position
159
+ * @param y - Proposed y position
160
+ * @param context - Grid context (cols, maxRows, etc.)
161
+ * @returns Constrained position
162
+ */
163
+ declare function applyPositionConstraints(constraints: LayoutConstraint[], item: LayoutItem, x: number, y: number, context: ConstraintContext): {
164
+ x: number;
165
+ y: number;
166
+ };
167
+ /**
168
+ * Apply size constraints to a proposed size.
169
+ *
170
+ * Constraints are applied in array order, allowing composition.
171
+ * Grid-level constraints are applied first, then per-item constraints.
172
+ *
173
+ * @param constraints - Array of constraints to apply
174
+ * @param item - The layout item being resized
175
+ * @param w - Proposed width
176
+ * @param h - Proposed height
177
+ * @param handle - Which resize handle is being used
178
+ * @param context - Grid context (cols, maxRows, etc.)
179
+ * @returns Constrained size
180
+ */
181
+ declare function applySizeConstraints(constraints: LayoutConstraint[], item: LayoutItem, w: number, h: number, handle: ResizeHandleAxis, context: ConstraintContext): {
182
+ w: number;
183
+ h: number;
184
+ };
185
+
186
+ export { CompactType, ConstraintContext, Layout, LayoutConstraint, LayoutItem, ResizeHandleAxis, applyPositionConstraints, applySizeConstraints, aspectRatio, boundedX, boundedY, compact, compactItem, containerBounds, defaultConstraints, gridBounds, maxSize, minMaxSize, minSize, snapToGrid };