react-grid-layout 2.1.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.
- package/README.md +20 -3
- package/dist/{chunk-2O3ZME4Q.mjs → chunk-FLITZMQC.mjs} +23 -17
- package/dist/chunk-FLITZMQC.mjs.map +1 -0
- package/dist/{chunk-LWF5EYMO.mjs → chunk-LIKX67MZ.mjs} +6 -5
- package/dist/chunk-LIKX67MZ.mjs.map +1 -0
- package/dist/{chunk-MXXN7GUE.mjs → chunk-PLWMASMX.mjs} +41 -31
- package/dist/chunk-PLWMASMX.mjs.map +1 -0
- package/dist/{chunk-QRW3ND4U.js → chunk-RB2IKK5B.js} +77 -67
- package/dist/chunk-RB2IKK5B.js.map +1 -0
- package/dist/{chunk-FN6MIZ24.js → chunk-WWS3M5Y3.js} +23 -16
- package/dist/chunk-WWS3M5Y3.js.map +1 -0
- package/dist/{chunk-GPZBANOK.js → chunk-YQQYHEEG.js} +21 -20
- package/dist/chunk-YQQYHEEG.js.map +1 -0
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +45 -41
- package/dist/core.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -23
- package/dist/index.mjs +3 -3
- package/dist/legacy.js +13 -13
- package/dist/legacy.mjs +2 -2
- package/dist/{position-C8a5g6bb.d.mts → position-CXNzFxI0.d.mts} +7 -1
- package/dist/{position-H8tBL91b.d.ts → position-Dk0FRWA9.d.ts} +7 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +17 -17
- package/dist/react.mjs +3 -3
- package/package.json +4 -3
- package/dist/chunk-2O3ZME4Q.mjs.map +0 -1
- package/dist/chunk-FN6MIZ24.js.map +0 -1
- package/dist/chunk-GPZBANOK.js.map +0 -1
- package/dist/chunk-LWF5EYMO.mjs.map +0 -1
- package/dist/chunk-MXXN7GUE.mjs.map +0 -1
- package/dist/chunk-QRW3ND4U.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/components/GridItem.tsx","../src/react/components/GridLayout.tsx","../src/react/components/ResponsiveGridLayout.tsx"],"names":["defaultConstraints","useState","useRef","useMemo","useCallback","pos","setTransform","setTopLeft","perc","calcXYRaw","applyPositionConstraints","calcGridItemWHPx","clamp","calcGridColWidth","resizeHandle","resizeItemInDirection","calcWHRaw","applySizeConstraints","calcGridItemPosition","useEffect","React","clsx","jsx","Resizable","DraggableCore","cloneLayoutItem","bottom","correctBounds","compact","defaultPositionStrategy","defaultGridConfig","defaultDragConfig","defaultResizeConfig","defaultDropConfig","getCompactor","deepEqual","getLayoutItem","moveElement","withLayoutItem","getAllCollisions","calcXY","jsxs","noop","synchronizeLayoutWithChildren","getBreakpointFromWidth","getColsFromBreakpoint","findOrGenerateResponsiveLayout","cloneLayout","currentMargin","getIndentationValue"],"mappings":";;;;;;;;;;;;;;;;AA4LO,SAAS,SAAS,KAAA,EAAoC;AAC3D,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,IAAA;AAAA,IACA,cAAA;AAAA,IACA,MAAA;AAAA,IACA,gBAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA,EAAQ,QAAA;AAAA,IACR,gBAAA,GAAmB,IAAA;AAAA,IACnB,cAAA,GAAiB,KAAA;AAAA,IACjB,cAAA,GAAiB,CAAA;AAAA,IACjB,gBAAA;AAAA,IACA,SAAA,GAAY,EAAA;AAAA,IACZ,KAAA;AAAA,IACA,MAAA,GAAS,EAAA;AAAA,IACT,MAAA,GAAS,EAAA;AAAA,IACT,CAAA;AAAA,IACA,CAAA;AAAA,IACA,CAAA;AAAA,IACA,CAAA;AAAA,IACA,IAAA,GAAO,CAAA;AAAA,IACP,IAAA,GAAO,QAAA;AAAA,IACP,IAAA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ACA,SAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA,EAAQ,aAAA;AAAA,MACR,gBAAA,EAAkB;AAAA,KACpB,CAAA;AAAA,IACA,CAAC,IAAA,EAAM,SAAA,EAAW,OAAA,EAAS,eAAe,uBAAuB;AAAA,GACnE;AAEA,EAAA,uBACEmB,cAAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACE,GAAG,SAAA;AAAA,MACJ,KAAA;AAAA,MACA,UAAA;AAAA,MACA,SAAA;AAAA,MACA,cAAA,EAAgB,kBAAA;AAAA,MAChB,MAAA,EAAQ,eAAA;AAAA,MAEP;AAAA;AAAA,GACH;AAEJ","file":"chunk-RB2IKK5B.js","sourcesContent":["/**\n * GridItem component\n *\n * An individual item within a grid layout. Handles dragging and resizing.\n */\n\nimport React, {\n useRef,\n useState,\n useCallback,\n useEffect,\n useMemo,\n type ReactElement,\n type CSSProperties\n} from \"react\";\nimport { DraggableCore, type DraggableEventHandler } from \"react-draggable\";\nimport { Resizable } from \"react-resizable\";\nimport clsx from \"clsx\";\n\nimport type {\n Position,\n DroppingPosition,\n ResizeHandleAxis,\n GridDragEvent,\n GridResizeEvent,\n LayoutConstraint,\n ConstraintContext,\n Layout,\n LayoutItem as LayoutItemType\n} from \"../../core/types.js\";\nimport type { PositionParams } from \"../../core/calculate.js\";\nimport {\n calcGridItemPosition,\n calcGridItemWHPx,\n calcGridColWidth,\n calcXYRaw,\n calcWHRaw,\n clamp\n} from \"../../core/calculate.js\";\nimport {\n applyPositionConstraints,\n applySizeConstraints,\n defaultConstraints\n} from \"../../core/constraints.js\";\nimport {\n setTransform,\n setTopLeft,\n perc,\n resizeItemInDirection\n} from \"../../core/position.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\ntype PartialPosition = { top: number; left: number };\n\nexport type GridItemCallback<Data extends GridDragEvent | GridResizeEvent> = (\n i: string,\n w: number,\n h: number,\n data: Data\n) => void;\n\nexport type ResizeHandle =\n | ReactElement\n | ((\n resizeHandleAxis: ResizeHandleAxis,\n ref: React.Ref<HTMLElement>\n ) => ReactElement);\n\n// Internal callback data type with typed handle\ninterface ResizeCallbackData {\n node: HTMLElement;\n size: { width: number; height: number };\n handle: ResizeHandleAxis;\n}\n\n// react-resizable callback type (handle is string)\ntype ReactResizableCallback = (\n e: React.SyntheticEvent,\n data: {\n node: HTMLElement;\n size: { width: number; height: number };\n handle: string;\n }\n) => void;\n\nexport interface GridItemProps {\n /** Child element to render */\n children: ReactElement;\n /** Number of columns in the grid */\n cols: number;\n /** Width of the container in pixels */\n containerWidth: number;\n /** Margin between items [x, y] */\n margin: readonly [number, number];\n /** Padding inside the container [x, y] */\n containerPadding: readonly [number, number];\n /** Height of each row in pixels */\n rowHeight: number;\n /** Maximum number of rows */\n maxRows: number;\n /** Whether the item can be dragged */\n isDraggable: boolean;\n /** Whether the item can be resized */\n isResizable: boolean;\n /** Whether the item is bounded within the container */\n isBounded: boolean;\n /** Whether the item is static (can't be moved/resized) */\n static?: boolean;\n /** Use CSS transforms instead of top/left */\n useCSSTransforms?: boolean;\n /** Use percentage widths for server rendering */\n usePercentages?: boolean;\n /** Scale factor for transforms */\n transformScale?: number;\n /** Current position of a dropping element */\n droppingPosition?: DroppingPosition;\n\n /** Additional class name */\n className?: string;\n /** Additional styles */\n style?: CSSProperties;\n\n /** CSS selector for draggable handle */\n handle?: string;\n /** CSS selector for cancel handle */\n cancel?: string;\n\n /** X position in grid units */\n x: number;\n /** Y position in grid units */\n y: number;\n /** Width in grid units */\n w: number;\n /** Height in grid units */\n h: number;\n\n /** Minimum width in grid units */\n minW?: number;\n /** Maximum width in grid units */\n maxW?: number;\n /** Minimum height in grid units */\n minH?: number;\n /** Maximum height in grid units */\n maxH?: number;\n\n /** Unique identifier */\n i: string;\n\n /** Which resize handles to show */\n resizeHandles?: ResizeHandleAxis[];\n /** Custom resize handle */\n resizeHandle?: ResizeHandle;\n\n /** Layout constraints for position/size limiting */\n constraints?: LayoutConstraint[];\n\n /** The layout item data (for per-item constraints) */\n layoutItem?: LayoutItemType;\n\n /** Current layout (for constraint context) */\n layout?: Layout;\n\n /** Called when drag starts */\n onDragStart?: GridItemCallback<GridDragEvent>;\n /** Called during drag */\n onDrag?: GridItemCallback<GridDragEvent>;\n /** Called when drag stops */\n onDragStop?: GridItemCallback<GridDragEvent>;\n /** Called when resize starts */\n onResizeStart?: GridItemCallback<GridResizeEvent>;\n /** Called during resize */\n onResize?: GridItemCallback<GridResizeEvent>;\n /** Called when resize stops */\n onResizeStop?: GridItemCallback<GridResizeEvent>;\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * GridItem - An individual item within a grid layout.\n *\n * Wraps a child element with drag and resize functionality.\n */\nexport function GridItem(props: GridItemProps): ReactElement {\n const {\n children,\n cols,\n containerWidth,\n margin,\n containerPadding,\n rowHeight,\n maxRows,\n isDraggable,\n isResizable,\n isBounded,\n static: isStatic,\n useCSSTransforms = true,\n usePercentages = false,\n transformScale = 1,\n droppingPosition,\n className = \"\",\n style,\n handle = \"\",\n cancel = \"\",\n x,\n y,\n w,\n h,\n minW = 1,\n maxW = Infinity,\n minH = 1,\n maxH = Infinity,\n i,\n resizeHandles,\n resizeHandle,\n constraints = defaultConstraints,\n layoutItem,\n layout = [],\n onDragStart: onDragStartProp,\n onDrag: onDragProp,\n onDragStop: onDragStopProp,\n onResizeStart: onResizeStartProp,\n onResize: onResizeProp,\n onResizeStop: onResizeStopProp\n } = props;\n\n // State\n const [dragging, setDragging] = useState(false);\n const [resizing, setResizing] = useState(false);\n\n // Refs for position tracking (avoid state for React 18 batching)\n const elementRef = useRef<HTMLDivElement>(null);\n const dragPositionRef = useRef<PartialPosition>({ left: 0, top: 0 });\n const resizePositionRef = useRef<Position>({\n top: 0,\n left: 0,\n width: 0,\n height: 0\n });\n\n // Previous dropping position for comparison\n const prevDroppingPositionRef = useRef<DroppingPosition | undefined>(\n undefined\n );\n\n // Position parameters\n const positionParams: PositionParams = useMemo(\n () => ({\n cols,\n containerPadding: containerPadding as [number, number],\n containerWidth,\n margin: margin as [number, number],\n maxRows,\n rowHeight\n }),\n [cols, containerPadding, containerWidth, margin, maxRows, rowHeight]\n );\n\n // Constraint context for applying constraints\n const constraintContext: ConstraintContext = useMemo(\n () => ({\n cols,\n maxRows,\n containerWidth,\n containerHeight: 0, // Auto-height grids don't have a fixed container height\n rowHeight,\n margin,\n layout\n }),\n [cols, maxRows, containerWidth, rowHeight, margin, layout]\n );\n\n // Effective layout item (use provided or create from props)\n const effectiveLayoutItem: LayoutItemType = useMemo(\n () =>\n layoutItem ?? {\n i,\n x,\n y,\n w,\n h,\n minW,\n maxW,\n minH,\n maxH\n },\n [layoutItem, i, x, y, w, h, minW, maxW, minH, maxH]\n );\n\n // ============================================================================\n // Style Creation\n // ============================================================================\n\n const createStyle = useCallback(\n (pos: Position): CSSProperties => {\n if (useCSSTransforms) {\n return setTransform(pos) as CSSProperties;\n }\n\n const styleObj = setTopLeft(pos) as CSSProperties;\n\n if (usePercentages) {\n return {\n ...styleObj,\n left: perc(pos.left / containerWidth),\n width: perc(pos.width / containerWidth)\n };\n }\n\n return styleObj;\n },\n [useCSSTransforms, usePercentages, containerWidth]\n );\n\n // ============================================================================\n // Drag Handlers\n // ============================================================================\n\n const onDragStart: DraggableEventHandler = useCallback(\n (e, { node }) => {\n if (!onDragStartProp) return;\n\n const { offsetParent } = node;\n if (!offsetParent) return;\n\n const parentRect = offsetParent.getBoundingClientRect();\n const clientRect = node.getBoundingClientRect();\n\n const cLeft = clientRect.left / transformScale;\n const pLeft = parentRect.left / transformScale;\n const cTop = clientRect.top / transformScale;\n const pTop = parentRect.top / transformScale;\n\n const newPosition: PartialPosition = {\n left: cLeft - pLeft + offsetParent.scrollLeft,\n top: cTop - pTop + offsetParent.scrollTop\n };\n\n dragPositionRef.current = newPosition;\n setDragging(true);\n\n // Calculate raw position and apply constraints\n const rawPos = calcXYRaw(\n positionParams,\n newPosition.top,\n newPosition.left\n );\n const { x: newX, y: newY } = applyPositionConstraints(\n constraints,\n effectiveLayoutItem,\n rawPos.x,\n rawPos.y,\n constraintContext\n );\n\n onDragStartProp(i, newX, newY, {\n e: e as unknown as Event,\n node,\n newPosition\n });\n },\n [\n onDragStartProp,\n transformScale,\n positionParams,\n constraints,\n effectiveLayoutItem,\n constraintContext,\n i\n ]\n );\n\n const onDrag: DraggableEventHandler = useCallback(\n (e, { node, deltaX, deltaY }) => {\n if (!onDragProp || !dragging) return;\n\n let top = dragPositionRef.current.top + deltaY;\n let left = dragPositionRef.current.left + deltaX;\n\n // Pixel-level boundary calculations (isBounded affects pixel position)\n if (isBounded) {\n const { offsetParent } = node;\n if (offsetParent) {\n const bottomBoundary =\n offsetParent.clientHeight -\n calcGridItemWHPx(h, rowHeight, margin[1]);\n top = clamp(top, 0, bottomBoundary);\n\n const colWidth = calcGridColWidth(positionParams);\n const rightBoundary =\n containerWidth - calcGridItemWHPx(w, colWidth, margin[0]);\n left = clamp(left, 0, rightBoundary);\n }\n }\n\n const newPosition: PartialPosition = { top, left };\n dragPositionRef.current = newPosition;\n\n // Calculate raw position and apply constraints\n const rawPos = calcXYRaw(positionParams, top, left);\n const { x: newX, y: newY } = applyPositionConstraints(\n constraints,\n effectiveLayoutItem,\n rawPos.x,\n rawPos.y,\n constraintContext\n );\n\n onDragProp(i, newX, newY, {\n e: e as unknown as Event,\n node,\n newPosition\n });\n },\n [\n onDragProp,\n dragging,\n isBounded,\n h,\n rowHeight,\n margin,\n positionParams,\n containerWidth,\n w,\n i,\n constraints,\n effectiveLayoutItem,\n constraintContext\n ]\n );\n\n const onDragStop: DraggableEventHandler = useCallback(\n (e, { node }) => {\n if (!onDragStopProp || !dragging) return;\n\n const { left, top } = dragPositionRef.current;\n const newPosition: PartialPosition = { top, left };\n\n setDragging(false);\n dragPositionRef.current = { left: 0, top: 0 };\n\n // Calculate raw position and apply constraints\n const rawPos = calcXYRaw(positionParams, top, left);\n const { x: newX, y: newY } = applyPositionConstraints(\n constraints,\n effectiveLayoutItem,\n rawPos.x,\n rawPos.y,\n constraintContext\n );\n\n onDragStopProp(i, newX, newY, {\n e: e as unknown as Event,\n node,\n newPosition\n });\n },\n [\n onDragStopProp,\n dragging,\n positionParams,\n constraints,\n effectiveLayoutItem,\n constraintContext,\n i\n ]\n );\n\n // ============================================================================\n // Resize Handlers\n // ============================================================================\n\n const onResizeHandler = useCallback(\n (\n e: React.SyntheticEvent,\n { node, size, handle: resizeHandle }: ResizeCallbackData,\n position: Position,\n handlerName: \"onResizeStart\" | \"onResize\" | \"onResizeStop\"\n ) => {\n const handler =\n handlerName === \"onResizeStart\"\n ? onResizeStartProp\n : handlerName === \"onResize\"\n ? onResizeProp\n : onResizeStopProp;\n\n if (!handler) return;\n\n // Sizing based on resize direction\n let updatedSize: Position;\n if (node) {\n updatedSize = resizeItemInDirection(\n resizeHandle,\n position,\n size as Position,\n containerWidth\n );\n } else {\n updatedSize = {\n ...size,\n top: position.top,\n left: position.left\n } as Position;\n }\n\n resizePositionRef.current = updatedSize;\n\n // Calculate raw grid dimensions and apply constraints\n const rawSize = calcWHRaw(\n positionParams,\n updatedSize.width,\n updatedSize.height\n );\n const { w: newW, h: newH } = applySizeConstraints(\n constraints,\n effectiveLayoutItem,\n rawSize.w,\n rawSize.h,\n resizeHandle,\n constraintContext\n );\n\n handler(i, newW, newH, {\n e: e.nativeEvent,\n node,\n size: updatedSize,\n handle: resizeHandle\n });\n },\n [\n onResizeStartProp,\n onResizeProp,\n onResizeStopProp,\n containerWidth,\n positionParams,\n x,\n y,\n i,\n constraints,\n effectiveLayoutItem,\n constraintContext\n ]\n );\n\n const handleResizeStart: ReactResizableCallback = useCallback(\n (e, data) => {\n setResizing(true);\n const pos = calcGridItemPosition(positionParams, x, y, w, h);\n const typedData: ResizeCallbackData = {\n ...data,\n handle: data.handle as ResizeHandleAxis\n };\n onResizeHandler(e, typedData, pos, \"onResizeStart\");\n },\n [onResizeHandler, positionParams, x, y, w, h]\n );\n\n const handleResize: ReactResizableCallback = useCallback(\n (e, data) => {\n const pos = calcGridItemPosition(positionParams, x, y, w, h);\n const typedData: ResizeCallbackData = {\n ...data,\n handle: data.handle as ResizeHandleAxis\n };\n onResizeHandler(e, typedData, pos, \"onResize\");\n },\n [onResizeHandler, positionParams, x, y, w, h]\n );\n\n const handleResizeStop: ReactResizableCallback = useCallback(\n (e, data) => {\n setResizing(false);\n resizePositionRef.current = { top: 0, left: 0, width: 0, height: 0 };\n const pos = calcGridItemPosition(positionParams, x, y, w, h);\n const typedData: ResizeCallbackData = {\n ...data,\n handle: data.handle as ResizeHandleAxis\n };\n onResizeHandler(e, typedData, pos, \"onResizeStop\");\n },\n [onResizeHandler, positionParams, x, y, w, h]\n );\n\n // ============================================================================\n // Dropping Item Support\n // ============================================================================\n\n useEffect(() => {\n if (!droppingPosition) return;\n\n const node = elementRef.current;\n if (!node) return;\n\n const prevDroppingPosition = prevDroppingPositionRef.current || {\n left: 0,\n top: 0\n };\n\n const shouldDrag =\n dragging &&\n (droppingPosition.left !== prevDroppingPosition.left ||\n droppingPosition.top !== prevDroppingPosition.top);\n\n if (!dragging) {\n // Start drag - simulate the draggable callback data\n const fakeData = {\n node,\n deltaX: droppingPosition.left,\n deltaY: droppingPosition.top,\n lastX: 0,\n lastY: 0,\n x: droppingPosition.left,\n y: droppingPosition.top\n };\n onDragStart(droppingPosition.e as unknown as MouseEvent, fakeData);\n } else if (shouldDrag) {\n // Continue drag\n const deltaX = droppingPosition.left - dragPositionRef.current.left;\n const deltaY = droppingPosition.top - dragPositionRef.current.top;\n\n const fakeData = {\n node,\n deltaX,\n deltaY,\n lastX: dragPositionRef.current.left,\n lastY: dragPositionRef.current.top,\n x: droppingPosition.left,\n y: droppingPosition.top\n };\n onDrag(droppingPosition.e as unknown as MouseEvent, fakeData);\n }\n\n prevDroppingPositionRef.current = droppingPosition;\n }, [droppingPosition, dragging, onDragStart, onDrag]);\n\n // ============================================================================\n // Render\n // ============================================================================\n\n const pos = calcGridItemPosition(\n positionParams,\n x,\n y,\n w,\n h,\n dragging ? dragPositionRef.current : null,\n resizing ? resizePositionRef.current : null\n );\n\n const child = React.Children.only(children);\n\n // Calculate constraints for resizing\n // Note: We use wide-open constraints for react-resizable and let our pluggable\n // constraint system handle the actual limits. This allows constraints to be\n // fully controllable via the constraints prop.\n const minGridUnit = calcGridItemPosition(positionParams, 0, 0, 1, 1);\n const minConstraints: [number, number] = [\n minGridUnit.width,\n minGridUnit.height\n ];\n const maxConstraints: [number, number] = [Infinity, Infinity];\n\n // Get child props safely\n const childProps = (child as ReactElement<Record<string, unknown>>).props;\n const childClassName = childProps[\"className\"] as string | undefined;\n const childStyle = childProps[\"style\"] as CSSProperties | undefined;\n\n // Create the child element with updated props\n let newChild: ReactElement = React.cloneElement(child, {\n ref: elementRef,\n className: clsx(\"react-grid-item\", childClassName, className, {\n static: isStatic,\n resizing,\n \"react-draggable\": isDraggable,\n \"react-draggable-dragging\": dragging,\n dropping: Boolean(droppingPosition),\n cssTransforms: useCSSTransforms\n }),\n style: {\n ...style,\n ...childStyle,\n ...createStyle(pos)\n }\n } as Record<string, unknown>);\n\n // Wrap with Resizable\n // Cast resizeHandle to match react-resizable's expected type (string instead of ResizeHandleAxis)\n const resizableHandle = resizeHandle as\n | ReactElement\n | ((axis: string, ref: React.Ref<HTMLElement>) => ReactElement)\n | undefined;\n\n newChild = (\n <Resizable\n draggableOpts={{ disabled: !isResizable }}\n className={isResizable ? undefined : \"react-resizable-hide\"}\n width={pos.width}\n height={pos.height}\n minConstraints={minConstraints}\n maxConstraints={maxConstraints}\n onResizeStart={handleResizeStart}\n onResize={handleResize}\n onResizeStop={handleResizeStop}\n transformScale={transformScale}\n resizeHandles={resizeHandles}\n handle={resizableHandle}\n >\n {newChild}\n </Resizable>\n );\n\n // Wrap with DraggableCore\n newChild = (\n <DraggableCore\n disabled={!isDraggable}\n onStart={onDragStart}\n onDrag={onDrag}\n onStop={onDragStop}\n handle={handle}\n cancel={\".react-resizable-handle\" + (cancel ? \",\" + cancel : \"\")}\n scale={transformScale}\n nodeRef={elementRef}\n >\n {newChild}\n </DraggableCore>\n );\n\n return newChild;\n}\n\nexport default GridItem;\n","/**\n * GridLayout component\n *\n * A reactive, fluid grid layout with draggable, resizable components.\n */\n\nimport React, {\n useState,\n useCallback,\n useEffect,\n useRef,\n useMemo,\n type ReactElement,\n type CSSProperties,\n type DragEvent as ReactDragEvent\n} from \"react\";\nimport { deepEqual } from \"fast-equals\";\nimport clsx from \"clsx\";\n\nimport type {\n Layout,\n LayoutItem,\n CompactType,\n DroppingPosition,\n GridDragEvent,\n GridResizeEvent,\n Mutable,\n GridConfig,\n DragConfig,\n ResizeConfig,\n DropConfig,\n PositionStrategy,\n Compactor,\n LayoutConstraint\n} from \"../../core/types.js\";\nimport {\n defaultGridConfig,\n defaultDragConfig,\n defaultResizeConfig,\n defaultDropConfig\n} from \"../../core/types.js\";\nimport type { PositionParams } from \"../../core/calculate.js\";\nimport {\n bottom,\n cloneLayoutItem,\n getLayoutItem,\n moveElement,\n withLayoutItem,\n correctBounds\n} from \"../../core/layout.js\";\nimport { getAllCollisions } from \"../../core/collision.js\";\nimport { compact } from \"../../core/compact-compat.js\";\nimport { getCompactor } from \"../../core/compactors.js\";\nimport {\n calcXY,\n calcGridColWidth,\n calcGridItemWHPx\n} from \"../../core/calculate.js\";\nimport { defaultPositionStrategy } from \"../../core/position.js\";\nimport { defaultConstraints } from \"../../core/constraints.js\";\n\nimport { GridItem, type ResizeHandle } from \"./GridItem.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type EventCallback = (\n layout: Layout,\n oldItem: LayoutItem | null,\n newItem: LayoutItem | null,\n placeholder: LayoutItem | null,\n event: Event,\n element?: HTMLElement\n) => void;\n\nexport interface GridLayoutProps {\n // ===========================================================================\n // Required Props\n // ===========================================================================\n\n /** Child elements to render in the grid */\n children: React.ReactNode;\n\n /** Width of the container in pixels */\n width: number;\n\n // ===========================================================================\n // Composable Configuration Interfaces (v2 API)\n // ===========================================================================\n\n /**\n * Grid measurement configuration.\n * @see GridConfig\n */\n gridConfig?: Partial<GridConfig>;\n\n /**\n * Drag behavior configuration.\n * @see DragConfig\n */\n dragConfig?: Partial<DragConfig>;\n\n /**\n * Resize behavior configuration.\n * @see ResizeConfig\n */\n resizeConfig?: Partial<ResizeConfig>;\n\n /**\n * External drop configuration.\n * @see DropConfig\n */\n dropConfig?: Partial<DropConfig>;\n\n /**\n * CSS positioning strategy.\n * Use transformStrategy (default), absoluteStrategy, or createScaledStrategy(scale).\n * @see PositionStrategy\n */\n positionStrategy?: PositionStrategy;\n\n /**\n * Layout compaction strategy.\n * Use verticalCompactor (default), horizontalCompactor, or noCompactor.\n * @see Compactor\n */\n compactor?: Compactor;\n\n /**\n * Layout constraints for position and size limiting.\n * Applied during drag/resize operations.\n * Default: [gridBounds, minMaxSize]\n * @see LayoutConstraint\n */\n constraints?: LayoutConstraint[];\n\n // ===========================================================================\n // Layout Data\n // ===========================================================================\n\n /** Layout definition */\n layout?: Layout;\n\n /** Item to use when dropping from outside */\n droppingItem?: LayoutItem;\n\n // ===========================================================================\n // Container Props\n // ===========================================================================\n\n /** Whether to auto-size the container height */\n autoSize?: boolean;\n\n /** Additional class name */\n className?: string;\n\n /** Additional styles */\n style?: CSSProperties;\n\n /** Ref to the container element */\n innerRef?: React.Ref<HTMLDivElement>;\n\n // ===========================================================================\n // Callbacks\n // ===========================================================================\n\n /** Called when layout changes */\n onLayoutChange?: (layout: Layout) => void;\n\n /** Called when drag starts */\n onDragStart?: EventCallback;\n\n /** Called during drag */\n onDrag?: EventCallback;\n\n /** Called when drag stops */\n onDragStop?: EventCallback;\n\n /** Called when resize starts */\n onResizeStart?: EventCallback;\n\n /** Called during resize */\n onResize?: EventCallback;\n\n /** Called when resize stops */\n onResizeStop?: EventCallback;\n\n /** Called when an item is dropped from outside */\n onDrop?: (layout: Layout, item: LayoutItem | undefined, e: Event) => void;\n\n /** Called when dragging over the grid */\n onDropDragOver?: (\n e: ReactDragEvent\n ) =>\n | { w?: number; h?: number; dragOffsetX?: number; dragOffsetY?: number }\n | false\n | void;\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\nconst noop = () => {};\n\nconst layoutClassName = \"react-grid-layout\";\n\n// Check for Firefox\nlet isFirefox = false;\ntry {\n isFirefox = /firefox/i.test(navigator.userAgent);\n} catch {\n /* Ignore */\n}\n\n/**\n * Compare children arrays for equality\n */\nfunction childrenEqual(a: React.ReactNode, b: React.ReactNode): boolean {\n const aArr = React.Children.toArray(a);\n const bArr = React.Children.toArray(b);\n\n if (aArr.length !== bArr.length) return false;\n\n for (let i = 0; i < aArr.length; i++) {\n const aChild = aArr[i] as ReactElement;\n const bChild = bArr[i] as ReactElement;\n if (aChild?.key !== bChild?.key) return false;\n }\n\n return true;\n}\n\n/**\n * Synchronize layout with children\n */\nfunction synchronizeLayoutWithChildren(\n initialLayout: Layout,\n children: React.ReactNode,\n cols: number,\n compactType: CompactType,\n allowOverlap: boolean\n): Layout {\n const layout: LayoutItem[] = [];\n const childKeys = new Set<string>();\n\n React.Children.forEach(children, child => {\n if (!React.isValidElement(child) || child.key === null) return;\n const key = String(child.key);\n childKeys.add(key);\n\n // Find existing layout item\n const existingItem = initialLayout.find(l => l.i === key);\n\n if (existingItem) {\n layout.push(cloneLayoutItem(existingItem));\n } else {\n // Create new layout item from child data-grid prop\n const childProps = child.props as { \"data-grid\"?: Partial<LayoutItem> };\n const dataGrid = childProps[\"data-grid\"];\n\n if (dataGrid) {\n layout.push({\n i: key,\n x: dataGrid.x ?? 0,\n y: dataGrid.y ?? 0,\n w: dataGrid.w ?? 1,\n h: dataGrid.h ?? 1,\n minW: dataGrid.minW,\n maxW: dataGrid.maxW,\n minH: dataGrid.minH,\n maxH: dataGrid.maxH,\n static: dataGrid.static,\n isDraggable: dataGrid.isDraggable,\n isResizable: dataGrid.isResizable,\n resizeHandles: dataGrid.resizeHandles,\n isBounded: dataGrid.isBounded\n });\n } else {\n // Create default layout item\n layout.push({\n i: key,\n x: 0,\n y: bottom(layout),\n w: 1,\n h: 1\n });\n }\n }\n });\n\n // Correct bounds and compact\n const corrected = correctBounds(layout, { cols });\n return compact(corrected, compactType, cols, allowOverlap);\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * GridLayout - A reactive, fluid grid layout with draggable, resizable components.\n */\nexport function GridLayout(props: GridLayoutProps): ReactElement {\n const {\n // Required\n children,\n width,\n\n // Composable config interfaces\n gridConfig: gridConfigProp,\n dragConfig: dragConfigProp,\n resizeConfig: resizeConfigProp,\n dropConfig: dropConfigProp,\n positionStrategy = defaultPositionStrategy,\n compactor: compactorProp,\n constraints = defaultConstraints,\n\n // Layout data\n layout: propsLayout = [],\n droppingItem: droppingItemProp,\n\n // Container props\n autoSize = true,\n className = \"\",\n style = {},\n innerRef,\n\n // Callbacks\n onLayoutChange = noop,\n onDragStart: onDragStartProp = noop,\n onDrag: onDragProp = noop,\n onDragStop: onDragStopProp = noop,\n onResizeStart: onResizeStartProp = noop,\n onResize: onResizeProp = noop,\n onResizeStop: onResizeStopProp = noop,\n onDrop: onDropProp = noop,\n onDropDragOver: onDropDragOverProp = noop\n } = props;\n\n // Resolve config interfaces with defaults\n const gridConfig: GridConfig = useMemo(\n () => ({ ...defaultGridConfig, ...gridConfigProp }),\n [gridConfigProp]\n );\n const dragConfig: DragConfig = useMemo(\n () => ({ ...defaultDragConfig, ...dragConfigProp }),\n [dragConfigProp]\n );\n const resizeConfig: ResizeConfig = useMemo(\n () => ({ ...defaultResizeConfig, ...resizeConfigProp }),\n [resizeConfigProp]\n );\n const dropConfig: DropConfig = useMemo(\n () => ({ ...defaultDropConfig, ...dropConfigProp }),\n [dropConfigProp]\n );\n\n // Destructure resolved configs for convenience\n const { cols, rowHeight, maxRows, margin, containerPadding } = gridConfig;\n const {\n enabled: isDraggable,\n bounded: isBounded,\n handle: draggableHandle,\n cancel: draggableCancel\n } = dragConfig;\n const {\n enabled: isResizable,\n handles: resizeHandles,\n handleComponent: resizeHandle\n } = resizeConfig;\n const { enabled: isDroppable, defaultItem: defaultDropItem } = dropConfig;\n\n // Get compactor (use provided or get from type)\n const compactor = compactorProp ?? getCompactor(\"vertical\");\n const compactType = compactor.type;\n const allowOverlap = compactor.allowOverlap;\n const preventCollision = compactor.preventCollision ?? false;\n\n // Resolve dropping item - memoized to avoid unstable reference in useCallback dependencies\n const droppingItem = useMemo(\n () =>\n droppingItemProp ?? {\n i: \"__dropping-elem__\",\n ...defaultDropItem\n },\n [droppingItemProp, defaultDropItem]\n );\n\n // Position strategy values\n const useCSSTransforms = positionStrategy.type === \"transform\";\n const transformScale = positionStrategy.scale;\n\n const effectiveContainerPadding = containerPadding ?? margin;\n\n // State\n const [mounted, setMounted] = useState(false);\n const [layout, setLayout] = useState<Layout>(() =>\n synchronizeLayoutWithChildren(\n propsLayout,\n children,\n cols,\n compactType,\n allowOverlap\n )\n );\n const [activeDrag, setActiveDrag] = useState<LayoutItem | null>(null);\n const [resizing, setResizing] = useState(false);\n const [droppingDOMNode, setDroppingDOMNode] = useState<ReactElement | null>(\n null\n );\n const [droppingPosition, setDroppingPosition] = useState<\n DroppingPosition | undefined\n >();\n\n // Refs for tracking previous state\n const oldDragItemRef = useRef<LayoutItem | null>(null);\n const oldResizeItemRef = useRef<LayoutItem | null>(null);\n const oldLayoutRef = useRef<Layout | null>(null);\n const dragEnterCounterRef = useRef(0);\n const prevLayoutRef = useRef<Layout>(layout);\n const prevPropsLayoutRef = useRef<Layout>(propsLayout);\n const prevChildrenRef = useRef<React.ReactNode>(children);\n const prevCompactTypeRef = useRef<CompactType>(compactType);\n\n // Ref to current layout - Critical for preventing infinite update loops (#2204).\n // This allows callbacks to access the latest layout without including `layout`\n // in dependency arrays, which would cause callbacks to be recreated on every\n // layout change and trigger infinite re-renders via GridItem's useEffect.\n const layoutRef = useRef<Layout>(layout);\n layoutRef.current = layout;\n\n // Mount effect - call onLayoutChange with initial layout if it differs from props\n useEffect(() => {\n setMounted(true);\n // Possibly call back with layout on mount. This should be done after correcting the layout width\n // to ensure we don't rerender with the wrong width.\n if (!deepEqual(layout, propsLayout)) {\n onLayoutChange(layout);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []); // Only run on mount\n\n // Sync layout from props\n useEffect(() => {\n if (activeDrag) return; // Don't update during drag\n if (droppingDOMNode) return; // Don't update during drop from outside\n\n const layoutChanged = !deepEqual(propsLayout, prevPropsLayoutRef.current);\n const childrenChanged = !childrenEqual(children, prevChildrenRef.current);\n const compactTypeChanged = compactType !== prevCompactTypeRef.current;\n\n if (layoutChanged || childrenChanged || compactTypeChanged) {\n const baseLayout = layoutChanged ? propsLayout : layout;\n const newLayout = synchronizeLayoutWithChildren(\n baseLayout,\n children,\n cols,\n compactType,\n allowOverlap\n );\n setLayout(newLayout);\n }\n\n prevPropsLayoutRef.current = propsLayout;\n prevChildrenRef.current = children;\n prevCompactTypeRef.current = compactType;\n }, [\n propsLayout,\n children,\n cols,\n compactType,\n allowOverlap,\n activeDrag,\n droppingDOMNode,\n layout\n ]);\n\n // Layout change callback\n useEffect(() => {\n if (!activeDrag && !deepEqual(layout, prevLayoutRef.current)) {\n prevLayoutRef.current = layout;\n onLayoutChange(layout);\n }\n }, [layout, activeDrag, onLayoutChange]);\n\n // ============================================================================\n // Container Height\n // ============================================================================\n\n const containerHeight = useMemo((): string | undefined => {\n if (!autoSize) return undefined;\n const nbRow = bottom(layout);\n const containerPaddingY = effectiveContainerPadding[1];\n return (\n nbRow * rowHeight + (nbRow - 1) * margin[1] + containerPaddingY * 2 + \"px\"\n );\n }, [autoSize, layout, rowHeight, margin, effectiveContainerPadding]);\n\n // ============================================================================\n // Drag Handlers\n // ============================================================================\n\n const onDragStart = useCallback(\n (i: string, _x: number, _y: number, data: GridDragEvent) => {\n const currentLayout = layoutRef.current;\n const l = getLayoutItem(currentLayout, i);\n if (!l) return;\n\n const placeholder: LayoutItem = {\n w: l.w,\n h: l.h,\n x: l.x,\n y: l.y,\n i\n };\n\n oldDragItemRef.current = cloneLayoutItem(l);\n oldLayoutRef.current = currentLayout;\n setActiveDrag(placeholder);\n\n onDragStartProp(currentLayout, l, l, null, data.e, data.node);\n },\n [onDragStartProp]\n );\n\n const onDrag = useCallback(\n (i: string, x: number, y: number, data: GridDragEvent) => {\n const currentLayout = layoutRef.current;\n const oldDragItem = oldDragItemRef.current;\n const l = getLayoutItem(currentLayout, i);\n if (!l) return;\n\n const placeholder: LayoutItem = {\n w: l.w,\n h: l.h,\n x: l.x,\n y: l.y,\n i\n };\n\n // Move the element\n const newLayout = moveElement(\n currentLayout,\n l,\n x,\n y,\n true,\n preventCollision,\n compactType,\n cols,\n allowOverlap\n );\n\n onDragProp(newLayout, oldDragItem, l, placeholder, data.e, data.node);\n\n setLayout(\n allowOverlap ? newLayout : compact(newLayout, compactType, cols)\n );\n setActiveDrag(placeholder);\n },\n [preventCollision, compactType, cols, allowOverlap, onDragProp]\n );\n\n const onDragStop = useCallback(\n (i: string, x: number, y: number, data: GridDragEvent) => {\n if (!activeDrag) return;\n\n const currentLayout = layoutRef.current;\n const oldDragItem = oldDragItemRef.current;\n const l = getLayoutItem(currentLayout, i);\n if (!l) return;\n\n const newLayout = moveElement(\n currentLayout,\n l,\n x,\n y,\n true,\n preventCollision,\n compactType,\n cols,\n allowOverlap\n );\n\n const finalLayout = allowOverlap\n ? newLayout\n : compact(newLayout, compactType, cols);\n\n onDragStopProp(finalLayout, oldDragItem, l, null, data.e, data.node);\n\n const oldLayout = oldLayoutRef.current;\n oldDragItemRef.current = null;\n oldLayoutRef.current = null;\n setActiveDrag(null);\n setLayout(finalLayout);\n\n if (oldLayout && !deepEqual(oldLayout, finalLayout)) {\n onLayoutChange(finalLayout);\n }\n },\n [\n activeDrag,\n preventCollision,\n compactType,\n cols,\n allowOverlap,\n onDragStopProp,\n onLayoutChange\n ]\n );\n\n // ============================================================================\n // Resize Handlers\n // ============================================================================\n\n const onResizeStart = useCallback(\n (i: string, _w: number, _h: number, data: GridResizeEvent) => {\n const currentLayout = layoutRef.current;\n const l = getLayoutItem(currentLayout, i);\n if (!l) return;\n\n oldResizeItemRef.current = cloneLayoutItem(l);\n oldLayoutRef.current = currentLayout;\n setResizing(true);\n\n onResizeStartProp(currentLayout, l, l, null, data.e, data.node);\n },\n [onResizeStartProp]\n );\n\n const onResize = useCallback(\n (i: string, w: number, h: number, data: GridResizeEvent) => {\n const currentLayout = layoutRef.current;\n const oldResizeItem = oldResizeItemRef.current;\n const { handle } = data;\n\n let shouldMoveItem = false;\n let newX: number | undefined;\n let newY: number | undefined;\n\n const [newLayout, l] = withLayoutItem(currentLayout, i, item => {\n newX = item.x;\n newY = item.y;\n\n // Handle corner/edge resizing that affects position\n if ([\"sw\", \"w\", \"nw\", \"n\", \"ne\"].includes(handle)) {\n if ([\"sw\", \"nw\", \"w\"].includes(handle)) {\n newX = item.x + (item.w - w);\n w = item.x !== newX && newX < 0 ? item.w : w;\n newX = newX < 0 ? 0 : newX;\n }\n\n if ([\"ne\", \"n\", \"nw\"].includes(handle)) {\n newY = item.y + (item.h - h);\n h = item.y !== newY && newY < 0 ? item.h : h;\n newY = newY < 0 ? 0 : newY;\n }\n\n shouldMoveItem = true;\n }\n\n // Check for collisions if preventCollision is enabled\n if (preventCollision && !allowOverlap) {\n const collisions = getAllCollisions(currentLayout, {\n ...item,\n w,\n h,\n x: newX ?? item.x,\n y: newY ?? item.y\n }).filter(layoutItem => layoutItem.i !== item.i);\n\n if (collisions.length > 0) {\n newY = item.y;\n h = item.h;\n newX = item.x;\n w = item.w;\n shouldMoveItem = false;\n }\n }\n\n (item as Mutable<LayoutItem>).w = w;\n (item as Mutable<LayoutItem>).h = h;\n\n return item;\n });\n\n if (!l) return;\n\n let finalLayout = newLayout;\n if (shouldMoveItem && newX !== undefined && newY !== undefined) {\n finalLayout = moveElement(\n newLayout,\n l,\n newX,\n newY,\n true,\n preventCollision,\n compactType,\n cols,\n allowOverlap\n );\n }\n\n const placeholder: LayoutItem = {\n w: l.w,\n h: l.h,\n x: l.x,\n y: l.y,\n i,\n static: true\n };\n\n onResizeProp(\n finalLayout,\n oldResizeItem,\n l,\n placeholder,\n data.e,\n data.node\n );\n\n setLayout(\n allowOverlap ? finalLayout : compact(finalLayout, compactType, cols)\n );\n setActiveDrag(placeholder);\n },\n [preventCollision, allowOverlap, compactType, cols, onResizeProp]\n );\n\n const onResizeStop = useCallback(\n (i: string, _w: number, _h: number, data: GridResizeEvent) => {\n const currentLayout = layoutRef.current;\n const oldResizeItem = oldResizeItemRef.current;\n const l = getLayoutItem(currentLayout, i);\n\n const finalLayout = allowOverlap\n ? currentLayout\n : compact(currentLayout, compactType, cols);\n\n onResizeStopProp(\n finalLayout,\n oldResizeItem,\n l ?? null,\n null,\n data.e,\n data.node\n );\n\n const oldLayout = oldLayoutRef.current;\n oldResizeItemRef.current = null;\n oldLayoutRef.current = null;\n setActiveDrag(null);\n setResizing(false);\n setLayout(finalLayout);\n\n if (oldLayout && !deepEqual(oldLayout, finalLayout)) {\n onLayoutChange(finalLayout);\n }\n },\n [allowOverlap, compactType, cols, onResizeStopProp, onLayoutChange]\n );\n\n // ============================================================================\n // Drop Handlers\n // ============================================================================\n\n const removeDroppingPlaceholder = useCallback(() => {\n const currentLayout = layoutRef.current;\n const newLayout = compact(\n currentLayout.filter(l => l.i !== droppingItem.i),\n compactType,\n cols,\n allowOverlap\n );\n\n setLayout(newLayout);\n setDroppingDOMNode(null);\n setActiveDrag(null);\n setDroppingPosition(undefined);\n }, [droppingItem.i, compactType, cols, allowOverlap]);\n\n const handleDragOver = useCallback(\n (e: ReactDragEvent): void | false => {\n e.preventDefault();\n e.stopPropagation();\n\n // Firefox hack\n if (\n isFirefox &&\n !(e.nativeEvent.target as HTMLElement)?.classList.contains(\n layoutClassName\n )\n ) {\n return false;\n }\n\n // Extract dragOffsetX from result, or use empty object if void/undefined\n const rawResult = onDropDragOverProp(e);\n if (rawResult === false) {\n if (droppingDOMNode) {\n removeDroppingPlaceholder();\n }\n return false;\n }\n const {\n dragOffsetX = 0,\n dragOffsetY = 0,\n ...onDragOverResult\n } = rawResult ?? {};\n\n const finalDroppingItem = { ...droppingItem, ...onDragOverResult };\n const gridRect = e.currentTarget.getBoundingClientRect();\n\n // Calculate position params for proper column width calculation\n const positionParams: PositionParams = {\n cols,\n margin: margin as [number, number],\n maxRows,\n rowHeight,\n containerWidth: width,\n containerPadding: effectiveContainerPadding as [number, number]\n };\n\n // Calculate actual column width accounting for margins and padding\n const actualColWidth = calcGridColWidth(positionParams);\n\n // Calculate item dimensions in pixels including margins between cells\n const itemPixelWidth = calcGridItemWHPx(\n finalDroppingItem.w,\n actualColWidth,\n (margin as [number, number])[0]\n );\n const itemPixelHeight = calcGridItemWHPx(\n finalDroppingItem.h,\n rowHeight,\n (margin as [number, number])[1]\n );\n\n // Center the dropping item by offsetting by half its size\n const itemCenterOffsetX = itemPixelWidth / 2;\n const itemCenterOffsetY = itemPixelHeight / 2;\n\n // Calculate mouse position relative to grid, accounting for drag offset and item centering\n const rawGridX =\n e.clientX - gridRect.left + dragOffsetX - itemCenterOffsetX;\n const rawGridY =\n e.clientY - gridRect.top + dragOffsetY - itemCenterOffsetY;\n\n // Clamp to prevent negative positions (calcXY handles upper bound clamping)\n const clampedGridX = Math.max(0, rawGridX);\n const clampedGridY = Math.max(0, rawGridY);\n\n const newDroppingPosition: DroppingPosition = {\n left: clampedGridX / transformScale,\n top: clampedGridY / transformScale,\n e: e.nativeEvent\n };\n\n if (!droppingDOMNode) {\n const calculatedPosition = calcXY(\n positionParams,\n clampedGridY,\n clampedGridX,\n finalDroppingItem.w,\n finalDroppingItem.h\n );\n\n setDroppingDOMNode(<div key={finalDroppingItem.i} />);\n setDroppingPosition(newDroppingPosition);\n setLayout([\n ...layoutRef.current,\n {\n ...finalDroppingItem,\n x: calculatedPosition.x,\n y: calculatedPosition.y,\n static: false,\n isDraggable: true\n }\n ]);\n } else if (droppingPosition) {\n const shouldUpdate =\n droppingPosition.left !== newDroppingPosition.left ||\n droppingPosition.top !== newDroppingPosition.top;\n if (shouldUpdate) {\n setDroppingPosition(newDroppingPosition);\n }\n }\n },\n [\n droppingDOMNode,\n droppingPosition,\n droppingItem,\n onDropDragOverProp,\n removeDroppingPlaceholder,\n transformScale,\n cols,\n margin,\n maxRows,\n rowHeight,\n width,\n effectiveContainerPadding\n ]\n );\n\n const handleDragLeave = useCallback(\n (e: ReactDragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n dragEnterCounterRef.current--;\n\n if (dragEnterCounterRef.current === 0) {\n removeDroppingPlaceholder();\n }\n },\n [removeDroppingPlaceholder]\n );\n\n const handleDragEnter = useCallback((e: ReactDragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n dragEnterCounterRef.current++;\n }, []);\n\n const handleDrop = useCallback(\n (e: ReactDragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const currentLayout = layoutRef.current;\n const item = currentLayout.find(l => l.i === droppingItem.i);\n dragEnterCounterRef.current = 0;\n removeDroppingPlaceholder();\n onDropProp(currentLayout, item, e.nativeEvent);\n },\n [droppingItem.i, removeDroppingPlaceholder, onDropProp]\n );\n\n // ============================================================================\n // Render Helpers\n // ============================================================================\n\n const processGridItem = useCallback(\n (\n child: ReactElement,\n isDroppingItem?: boolean\n ): ReactElement | null | undefined => {\n if (!child || !child.key) return null;\n\n const l = getLayoutItem(layout, String(child.key));\n if (!l) return null;\n\n const draggable =\n typeof l.isDraggable === \"boolean\"\n ? l.isDraggable\n : !l.static && isDraggable;\n const resizable =\n typeof l.isResizable === \"boolean\"\n ? l.isResizable\n : !l.static && isResizable;\n const resizeHandlesOptions = l.resizeHandles || [...resizeHandles];\n const bounded = draggable && isBounded && l.isBounded !== false;\n\n // Cast resize handle to expected type (function signature is compatible)\n const resizeHandleElement = resizeHandle as ResizeHandle | undefined;\n\n return (\n <GridItem\n key={l.i}\n containerWidth={width}\n cols={cols}\n margin={margin}\n containerPadding={effectiveContainerPadding}\n maxRows={maxRows}\n rowHeight={rowHeight}\n cancel={draggableCancel}\n handle={draggableHandle}\n onDragStart={onDragStart}\n onDrag={onDrag}\n onDragStop={onDragStop}\n onResizeStart={onResizeStart}\n onResize={onResize}\n onResizeStop={onResizeStop}\n isDraggable={draggable}\n isResizable={resizable}\n isBounded={bounded}\n useCSSTransforms={useCSSTransforms && mounted}\n usePercentages={!mounted}\n transformScale={transformScale}\n w={l.w}\n h={l.h}\n x={l.x}\n y={l.y}\n i={l.i}\n minH={l.minH}\n minW={l.minW}\n maxH={l.maxH}\n maxW={l.maxW}\n static={l.static}\n droppingPosition={isDroppingItem ? droppingPosition : undefined}\n resizeHandles={resizeHandlesOptions}\n resizeHandle={resizeHandleElement}\n constraints={constraints}\n layoutItem={l}\n layout={layout}\n >\n {child}\n </GridItem>\n );\n },\n [\n layout,\n width,\n cols,\n margin,\n effectiveContainerPadding,\n maxRows,\n rowHeight,\n draggableCancel,\n draggableHandle,\n onDragStart,\n onDrag,\n onDragStop,\n onResizeStart,\n onResize,\n onResizeStop,\n isDraggable,\n isResizable,\n isBounded,\n useCSSTransforms,\n mounted,\n transformScale,\n droppingPosition,\n resizeHandles,\n resizeHandle,\n constraints\n ]\n );\n\n const renderPlaceholder = (): ReactElement | null => {\n if (!activeDrag) return null;\n\n return (\n <GridItem\n w={activeDrag.w}\n h={activeDrag.h}\n x={activeDrag.x}\n y={activeDrag.y}\n i={activeDrag.i}\n className={`react-grid-placeholder ${resizing ? \"placeholder-resizing\" : \"\"}`}\n containerWidth={width}\n cols={cols}\n margin={margin}\n containerPadding={effectiveContainerPadding}\n maxRows={maxRows}\n rowHeight={rowHeight}\n isDraggable={false}\n isResizable={false}\n isBounded={false}\n useCSSTransforms={useCSSTransforms}\n transformScale={transformScale}\n constraints={constraints}\n layout={layout}\n >\n <div />\n </GridItem>\n );\n };\n\n // ============================================================================\n // Render\n // ============================================================================\n\n const mergedClassName = clsx(layoutClassName, className);\n const mergedStyle: CSSProperties = {\n height: containerHeight,\n ...style\n };\n\n return (\n <div\n ref={innerRef}\n className={mergedClassName}\n style={mergedStyle}\n onDrop={isDroppable ? handleDrop : undefined}\n onDragLeave={isDroppable ? handleDragLeave : undefined}\n onDragEnter={isDroppable ? handleDragEnter : undefined}\n onDragOver={isDroppable ? handleDragOver : undefined}\n >\n {React.Children.map(children, child => {\n if (!React.isValidElement(child)) return null;\n return processGridItem(child);\n })}\n {isDroppable && droppingDOMNode && processGridItem(droppingDOMNode, true)}\n {renderPlaceholder()}\n </div>\n );\n}\n\nexport default GridLayout;\n","/**\n * ResponsiveGridLayout component\n *\n * A responsive grid layout that automatically adjusts to container width.\n */\n\nimport React, {\n useState,\n useEffect,\n useRef,\n useMemo,\n useCallback,\n type ReactElement\n} from \"react\";\nimport { deepEqual } from \"fast-equals\";\n\nimport type {\n Layout,\n LayoutItem,\n Breakpoint,\n Breakpoints,\n ResponsiveLayouts,\n CompactType,\n Compactor\n} from \"../../core/types.js\";\nimport { cloneLayout, correctBounds } from \"../../core/layout.js\";\nimport {\n getBreakpointFromWidth,\n getColsFromBreakpoint,\n findOrGenerateResponsiveLayout,\n getIndentationValue\n} from \"../../core/responsive.js\";\nimport { compact } from \"../../core/compact-compat.js\";\nimport { getCompactor } from \"../../core/compactors.js\";\nimport { bottom } from \"../../core/layout.js\";\n\nimport { GridLayout, type GridLayoutProps } from \"./GridLayout.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ResponsiveGridLayoutProps<\n B extends Breakpoint = string\n> extends Omit<GridLayoutProps, \"gridConfig\" | \"layout\" | \"onLayoutChange\"> {\n /** Current breakpoint (optional, auto-detected from width) */\n breakpoint?: B;\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 /** Row height (default: 150) */\n rowHeight?: number;\n /** Maximum rows (default: Infinity) */\n maxRows?: number;\n /** Margin between items - can be fixed or per-breakpoint */\n margin?:\n | readonly [number, number]\n | Partial<Record<B, readonly [number, number]>>;\n /** Container padding - can be fixed or per-breakpoint */\n containerPadding?:\n | readonly [number, number]\n | Partial<Record<B, readonly [number, number] | null>>\n | null;\n /** Compactor for layout compaction */\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 containerWidth: number,\n margin: readonly [number, number],\n cols: number,\n containerPadding: readonly [number, number] | null\n ) => void;\n}\n\n// ============================================================================\n// Default Values\n// ============================================================================\n\nconst DEFAULT_BREAKPOINTS: Breakpoints<string> = {\n lg: 1200,\n md: 996,\n sm: 768,\n xs: 480,\n xxs: 0\n};\n\nconst DEFAULT_COLS: Breakpoints<string> = {\n lg: 12,\n md: 10,\n sm: 6,\n xs: 4,\n xxs: 2\n};\n\nconst noop = () => {};\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Synchronize layout with children\n */\nfunction synchronizeLayoutWithChildren(\n initialLayout: Layout,\n children: React.ReactNode,\n cols: number,\n compactType: CompactType,\n allowOverlap: boolean\n): Layout {\n const layout: LayoutItem[] = [];\n\n React.Children.forEach(children, child => {\n if (!React.isValidElement(child) || child.key === null) return;\n const key = String(child.key);\n\n // Find existing layout item\n const existingItem = initialLayout.find(l => l.i === key);\n\n if (existingItem) {\n layout.push({\n ...existingItem,\n i: key\n });\n } else {\n // Create new layout item from child data-grid prop\n const childProps = child.props as { \"data-grid\"?: Partial<LayoutItem> };\n const dataGrid = childProps[\"data-grid\"];\n\n if (dataGrid) {\n layout.push({\n i: key,\n x: dataGrid.x ?? 0,\n y: dataGrid.y ?? 0,\n w: dataGrid.w ?? 1,\n h: dataGrid.h ?? 1,\n minW: dataGrid.minW,\n maxW: dataGrid.maxW,\n minH: dataGrid.minH,\n maxH: dataGrid.maxH,\n static: dataGrid.static,\n isDraggable: dataGrid.isDraggable,\n isResizable: dataGrid.isResizable,\n resizeHandles: dataGrid.resizeHandles,\n isBounded: dataGrid.isBounded\n });\n } else {\n // Create default layout item\n layout.push({\n i: key,\n x: 0,\n y: bottom(layout),\n w: 1,\n h: 1\n });\n }\n }\n });\n\n // Correct bounds and compact\n const corrected = correctBounds(layout, { cols });\n return compact(corrected, compactType, cols, allowOverlap);\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * ResponsiveGridLayout - A responsive grid layout that adjusts to container width.\n */\nexport function ResponsiveGridLayout<B extends Breakpoint = string>(\n props: ResponsiveGridLayoutProps<B>\n): ReactElement {\n const {\n children,\n width,\n breakpoint: propBreakpoint,\n breakpoints = DEFAULT_BREAKPOINTS as Breakpoints<B>,\n cols: colsConfig = DEFAULT_COLS as Breakpoints<B>,\n layouts: propsLayouts = {} as ResponsiveLayouts<B>,\n rowHeight = 150,\n maxRows = Infinity,\n margin: propMargin = [10, 10] as readonly [number, number],\n containerPadding: propContainerPadding = null,\n compactor: compactorProp,\n onBreakpointChange = noop,\n onLayoutChange = noop,\n onWidthChange = noop,\n ...restProps\n } = props;\n\n // Get compactor (use provided or default to vertical)\n const compactor = compactorProp ?? getCompactor(\"vertical\");\n const compactType = compactor.type;\n const allowOverlap = compactor.allowOverlap;\n\n // Calculate initial state\n const initialBreakpoint = useMemo(() => {\n return propBreakpoint ?? getBreakpointFromWidth(breakpoints, width);\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const initialCols = useMemo(() => {\n return getColsFromBreakpoint(initialBreakpoint, colsConfig);\n }, [initialBreakpoint, colsConfig]);\n\n const initialLayout = useMemo(() => {\n return findOrGenerateResponsiveLayout(\n propsLayouts,\n breakpoints,\n initialBreakpoint,\n initialBreakpoint,\n initialCols,\n compactType\n );\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n // State\n const [breakpoint, setBreakpoint] = useState<B>(initialBreakpoint);\n const [cols, setCols] = useState<number>(initialCols);\n const [layout, setLayout] = useState<Layout>(initialLayout);\n const [layouts, setLayouts] = useState<ResponsiveLayouts<B>>(propsLayouts);\n\n // Refs for tracking changes\n const prevWidthRef = useRef(width);\n const prevBreakpointRef = useRef(propBreakpoint);\n const prevBreakpointsRef = useRef(breakpoints);\n const prevColsRef = useRef(colsConfig);\n const prevLayoutsRef = useRef(propsLayouts);\n const prevCompactTypeRef = useRef(compactType);\n\n // Ref to always have current layouts value (avoids stale closure in callbacks)\n const layoutsRef = useRef(layouts);\n\n // Keep layoutsRef in sync with layouts state\n useEffect(() => {\n layoutsRef.current = layouts;\n }, [layouts]);\n\n // Derive layout synchronously from props during render (not in useEffect which runs after render)\n // This prevents the timing issue where GridLayout sees children before the layout is updated\n const derivedLayout: Layout | null = useMemo(() => {\n if (!deepEqual(propsLayouts, prevLayoutsRef.current)) {\n // Props changed, derive new layout synchronously\n return findOrGenerateResponsiveLayout(\n propsLayouts,\n breakpoints,\n breakpoint,\n breakpoint,\n cols,\n compactType\n );\n }\n return null; // No change needed\n }, [propsLayouts, breakpoints, breakpoint, cols, compactType]);\n\n // The effective layout to pass to GridLayout - use derived if available, else state\n const effectiveLayout = derivedLayout ?? layout;\n\n // Update state and refs in effect (for consistency on future renders)\n useEffect(() => {\n if (derivedLayout !== null) {\n setLayout(derivedLayout);\n setLayouts(propsLayouts);\n layoutsRef.current = propsLayouts;\n prevLayoutsRef.current = propsLayouts;\n }\n }, [derivedLayout, propsLayouts]);\n\n // Handle compactType changes\n useEffect(() => {\n if (compactType !== prevCompactTypeRef.current) {\n // Re-compact the current layout with the new compactType\n // Use effectiveLayout to avoid stale data when layouts are being synced\n const newLayout = compact(\n cloneLayout(effectiveLayout),\n compactType,\n cols,\n allowOverlap\n );\n const newLayouts = {\n ...layoutsRef.current,\n [breakpoint]: newLayout\n } as ResponsiveLayouts<B>;\n\n setLayout(newLayout);\n setLayouts(newLayouts);\n layoutsRef.current = newLayouts;\n onLayoutChange(newLayout, newLayouts);\n prevCompactTypeRef.current = compactType;\n }\n }, [\n compactType,\n effectiveLayout,\n cols,\n allowOverlap,\n breakpoint,\n onLayoutChange\n ]);\n\n // Handle width changes\n useEffect(() => {\n const widthChanged = width !== prevWidthRef.current;\n const breakpointPropChanged = propBreakpoint !== prevBreakpointRef.current;\n const breakpointsChanged = !deepEqual(\n breakpoints,\n prevBreakpointsRef.current\n );\n const colsChanged = !deepEqual(colsConfig, prevColsRef.current);\n\n if (\n widthChanged ||\n breakpointPropChanged ||\n breakpointsChanged ||\n colsChanged\n ) {\n const newBreakpoint =\n propBreakpoint ?? getBreakpointFromWidth(breakpoints, width);\n const newCols = getColsFromBreakpoint(newBreakpoint, colsConfig);\n const lastBreakpoint = breakpoint;\n\n // Breakpoint change\n if (\n lastBreakpoint !== newBreakpoint ||\n breakpointsChanged ||\n colsChanged\n ) {\n const newLayouts = { ...layoutsRef.current } as ResponsiveLayouts<B>;\n\n // Preserve current layout if not in new layouts\n if (!newLayouts[lastBreakpoint]) {\n (newLayouts as Record<B, Layout>)[lastBreakpoint] =\n cloneLayout(layout);\n }\n\n // Find or generate new layout\n let newLayout = findOrGenerateResponsiveLayout(\n newLayouts,\n breakpoints,\n newBreakpoint,\n lastBreakpoint,\n newCols,\n compactType\n );\n\n // Sync with children\n newLayout = synchronizeLayoutWithChildren(\n newLayout,\n children,\n newCols,\n compactType,\n allowOverlap\n );\n\n // Store new layout\n (newLayouts as Record<B, Layout>)[newBreakpoint] = newLayout;\n\n // Update state\n setBreakpoint(newBreakpoint);\n setCols(newCols);\n setLayout(newLayout);\n setLayouts(newLayouts);\n layoutsRef.current = newLayouts;\n\n // Callbacks\n onBreakpointChange(newBreakpoint, newCols);\n onLayoutChange(newLayout, newLayouts);\n }\n\n // Get margin and padding for callback\n const currentMargin = getIndentationValue(\n propMargin as Parameters<typeof getIndentationValue>[0],\n newBreakpoint\n );\n const currentPadding = propContainerPadding\n ? getIndentationValue(\n propContainerPadding as Parameters<typeof getIndentationValue>[0],\n newBreakpoint\n )\n : null;\n\n // Width change callback\n onWidthChange(width, currentMargin, newCols, currentPadding);\n\n // Update refs\n prevWidthRef.current = width;\n prevBreakpointRef.current = propBreakpoint;\n prevBreakpointsRef.current = breakpoints;\n prevColsRef.current = colsConfig;\n }\n }, [\n width,\n propBreakpoint,\n breakpoints,\n colsConfig,\n breakpoint,\n cols,\n layout,\n children,\n compactType,\n allowOverlap,\n propMargin,\n propContainerPadding,\n onBreakpointChange,\n onLayoutChange,\n onWidthChange\n ]);\n\n // Handle layout change from GridLayout\n const handleLayoutChange = useCallback(\n (newLayout: Layout) => {\n // Use layoutsRef.current to avoid stale closure issues\n const currentLayouts = layoutsRef.current;\n const newLayouts = {\n ...currentLayouts,\n [breakpoint]: newLayout\n } as ResponsiveLayouts<B>;\n\n setLayout(newLayout);\n setLayouts(newLayouts);\n layoutsRef.current = newLayouts;\n onLayoutChange(newLayout, newLayouts);\n },\n [breakpoint, onLayoutChange]\n );\n\n // Get margin and padding for current breakpoint\n const currentMargin = useMemo(() => {\n return getIndentationValue(\n propMargin as Parameters<typeof getIndentationValue>[0],\n breakpoint\n );\n }, [propMargin, breakpoint]);\n\n const currentContainerPadding = useMemo(() => {\n if (propContainerPadding === null) return null;\n return getIndentationValue(\n propContainerPadding as Parameters<typeof getIndentationValue>[0],\n breakpoint\n );\n }, [propContainerPadding, breakpoint]);\n\n // Build grid config for current breakpoint\n const gridConfig = useMemo(\n () => ({\n cols,\n rowHeight,\n maxRows,\n margin: currentMargin,\n containerPadding: currentContainerPadding\n }),\n [cols, rowHeight, maxRows, currentMargin, currentContainerPadding]\n );\n\n return (\n <GridLayout\n {...restProps}\n width={width}\n gridConfig={gridConfig}\n compactor={compactor}\n onLayoutChange={handleLayoutChange}\n layout={effectiveLayout}\n >\n {children}\n </GridLayout>\n );\n}\n\nexport default ResponsiveGridLayout;\n"]}
|
|
@@ -388,22 +388,24 @@ function resolveCompactionCollision(layout, item, moveToCoord, axis, hasStatics)
|
|
|
388
388
|
function compactItemInternal(compareWith, l, compactType, cols, fullLayout, allowOverlap, b) {
|
|
389
389
|
const compactV = compactType === "vertical";
|
|
390
390
|
const compactH = compactType === "horizontal";
|
|
391
|
-
if (
|
|
392
|
-
if (
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
l.y
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
l.x
|
|
391
|
+
if (!allowOverlap) {
|
|
392
|
+
if (compactV) {
|
|
393
|
+
if (typeof b === "number") {
|
|
394
|
+
l.y = Math.min(b, l.y);
|
|
395
|
+
} else {
|
|
396
|
+
l.y = Math.min(chunkBJFPTW5Q_js.bottom(compareWith), l.y);
|
|
397
|
+
}
|
|
398
|
+
while (l.y > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
399
|
+
l.y--;
|
|
400
|
+
}
|
|
401
|
+
} else if (compactH) {
|
|
402
|
+
while (l.x > 0 && !chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) {
|
|
403
|
+
l.x--;
|
|
404
|
+
}
|
|
403
405
|
}
|
|
404
406
|
}
|
|
405
407
|
let collision;
|
|
406
|
-
while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0 && !
|
|
408
|
+
while ((collision = chunkBJFPTW5Q_js.getFirstCollision(compareWith, l)) !== void 0 && !allowOverlap) {
|
|
407
409
|
if (compactH) {
|
|
408
410
|
resolveCompactionCollision(fullLayout, l, collision.x + collision.w, "x");
|
|
409
411
|
} else {
|
|
@@ -611,13 +613,17 @@ var horizontalOverlapCompactor = {
|
|
|
611
613
|
return chunkBJFPTW5Q_js.cloneLayout(layout);
|
|
612
614
|
}
|
|
613
615
|
};
|
|
616
|
+
var noOverlapCompactor = {
|
|
617
|
+
...noCompactor,
|
|
618
|
+
allowOverlap: true
|
|
619
|
+
};
|
|
614
620
|
function getCompactor(compactType, allowOverlap = false, preventCollision = false) {
|
|
615
621
|
let baseCompactor;
|
|
616
622
|
if (allowOverlap) {
|
|
617
623
|
if (compactType === "vertical") baseCompactor = verticalOverlapCompactor;
|
|
618
624
|
else if (compactType === "horizontal")
|
|
619
625
|
baseCompactor = horizontalOverlapCompactor;
|
|
620
|
-
else baseCompactor =
|
|
626
|
+
else baseCompactor = noOverlapCompactor;
|
|
621
627
|
} else {
|
|
622
628
|
if (compactType === "vertical") baseCompactor = verticalCompactor;
|
|
623
629
|
else if (compactType === "horizontal") baseCompactor = horizontalCompactor;
|
|
@@ -730,6 +736,7 @@ exports.maxSize = maxSize;
|
|
|
730
736
|
exports.minMaxSize = minMaxSize;
|
|
731
737
|
exports.minSize = minSize;
|
|
732
738
|
exports.noCompactor = noCompactor;
|
|
739
|
+
exports.noOverlapCompactor = noOverlapCompactor;
|
|
733
740
|
exports.perc = perc;
|
|
734
741
|
exports.resizeItemInDirection = resizeItemInDirection;
|
|
735
742
|
exports.resolveCompactionCollision = resolveCompactionCollision2;
|
|
@@ -740,5 +747,5 @@ exports.sortBreakpoints = sortBreakpoints;
|
|
|
740
747
|
exports.transformStrategy = transformStrategy;
|
|
741
748
|
exports.verticalCompactor = verticalCompactor;
|
|
742
749
|
exports.verticalOverlapCompactor = verticalOverlapCompactor;
|
|
743
|
-
//# sourceMappingURL=chunk-
|
|
744
|
-
//# sourceMappingURL=chunk-
|
|
750
|
+
//# sourceMappingURL=chunk-WWS3M5Y3.js.map
|
|
751
|
+
//# sourceMappingURL=chunk-WWS3M5Y3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/constraints.ts","../src/core/position.ts","../src/core/types.ts","../src/core/compact-compat.ts","../src/core/compactors.ts","../src/core/responsive.ts"],"names":["getStatics","collides","bottom","getFirstCollision","sortLayoutItems","cloneLayoutItem","resolveCompactionCollision","sortLayoutItemsByRowCol","cloneLayout","sortLayoutItemsByColRow","correctBounds"],"mappings":";;;;;AAqBA,SAAS,KAAA,CAAM,KAAA,EAAe,GAAA,EAAa,GAAA,EAAqB;AAC9D,EAAA,OAAO,KAAK,GAAA,CAAI,GA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,GAAeA,4BAAA,CAAY,MAAA,IAAU,EAAE,CAAA;AAG7C,EAAA,OAAO,OAAA,CAAQE,+BAAc,YAAA,EAAc,EAAE,MAAM,CAAA,EAAG,aAAa,IAAI,CAAA;AACzE;AAoBO,SAAS,mBAAA,CACd,OACA,UAAA,EAC2B;AAE3B,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,OAAO,KAAA;AAAA,EACT;AAGA,EAAA,MAAM,aAAA,GAAgB,KAAA;AACtB,EAAA,MAAM,eAAA,GAAkB,cAAc,UAAU,CAAA;AAChD,EAAA,IAAI,oBAAoB,MAAA,EAAW;AACjC,IAAA,OAAO,eAAA;AAAA,EACT;AAGA,EAAA,MAAM,IAAA,GAAO,MAAA,CAAO,IAAA,CAAK,aAAa,CAAA;AACtC,EAAA,KAAA,MAAW,OAAO,IAAA,EAAM;AACtB,IAAA,MAAM,CAAA,GAAI,cAAc,GAAG,CAAA;AAC3B,IAAA,IAAI,MAAM,MAAA,EAAW;AACnB,MAAA,OAAO,CAAA;AAAA,IACT;AAAA,EACF;AAGA,EAAA,OAAO,CAAC,IAAI,EAAE,CAAA;AAChB","file":"chunk-WWS3M5Y3.js","sourcesContent":["/**\n * Pluggable layout constraints for react-grid-layout v2\n *\n * Constraints control position and size limits during drag/resize operations.\n * They are composable, tree-shakeable, and can be applied at grid or item level.\n */\n\nimport type {\n LayoutItem,\n LayoutConstraint,\n ConstraintContext,\n ResizeHandleAxis\n} from \"./types.js\";\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Clamp a value between min and max bounds.\n */\nfunction clamp(value: number, min: number, max: number): number {\n return Math.max(min, Math.min(max, value));\n}\n\n// ============================================================================\n// Built-in Constraints\n// ============================================================================\n\n/**\n * Grid boundary constraint.\n *\n * Ensures items stay within the grid bounds (0 to cols-w for x, 0 to maxRows-h for y).\n * This is the default position constraint.\n */\nexport const gridBounds: LayoutConstraint = {\n name: \"gridBounds\",\n\n constrainPosition(\n item: LayoutItem,\n x: number,\n y: number,\n { cols, maxRows }: ConstraintContext\n ): { x: number; y: number } {\n return {\n x: clamp(x, 0, Math.max(0, cols - item.w)),\n y: clamp(y, 0, Math.max(0, maxRows - item.h))\n };\n },\n\n constrainSize(\n item: LayoutItem,\n w: number,\n h: number,\n handle: ResizeHandleAxis,\n { cols, maxRows }: ConstraintContext\n ): { w: number; h: number } {\n // For west-side resizes (w, nw, sw), max width is limited by the right edge position\n // because the item expands leftward (x decreases as w increases)\n const maxW =\n handle === \"w\" || handle === \"nw\" || handle === \"sw\"\n ? item.x + item.w // right edge = x + w, can expand left to x=0\n : cols - item.x; // can expand right to cols\n\n // For north-side resizes (n, nw, ne), max height is limited by the bottom edge position\n // because the item expands upward (y decreases as h increases)\n const maxH =\n handle === \"n\" || handle === \"nw\" || handle === \"ne\"\n ? item.y + item.h // bottom edge = y + h, can expand up to y=0\n : maxRows - item.y; // can expand down to maxRows\n\n return {\n w: clamp(w, 1, Math.max(1, maxW)),\n h: clamp(h, 1, Math.max(1, maxH))\n };\n }\n};\n\n/**\n * Min/max size constraint.\n *\n * Enforces per-item minW/maxW/minH/maxH properties.\n * This is applied by default after gridBounds.\n */\nexport const minMaxSize: LayoutConstraint = {\n name: \"minMaxSize\",\n\n constrainSize(\n item: LayoutItem,\n w: number,\n h: number\n ): { w: number; h: number } {\n return {\n w: clamp(w, item.minW ?? 1, item.maxW ?? Infinity),\n h: clamp(h, item.minH ?? 1, item.maxH ?? Infinity)\n };\n }\n};\n\n/**\n * Container bounds constraint.\n *\n * Constrains items to stay within the visible container.\n * Use this as a replacement for the legacy `isBounded` prop.\n *\n * Unlike gridBounds which uses maxRows (which may be Infinity),\n * this constraint calculates visible rows from the actual container height.\n * Falls back to maxRows if containerHeight is 0 (auto-height grids).\n */\nexport const containerBounds: LayoutConstraint = {\n name: \"containerBounds\",\n\n constrainPosition(\n item: LayoutItem,\n x: number,\n y: number,\n { cols, maxRows, containerHeight, rowHeight, margin }: ConstraintContext\n ): { x: number; y: number } {\n // Calculate visible rows from container height\n // Formula: containerHeight = rows * rowHeight + (rows - 1) * margin\n // Solving: rows = (containerHeight + margin) / (rowHeight + margin)\n const visibleRows =\n containerHeight > 0\n ? Math.floor((containerHeight + margin[1]) / (rowHeight + margin[1]))\n : maxRows;\n\n return {\n x: clamp(x, 0, Math.max(0, cols - item.w)),\n y: clamp(y, 0, Math.max(0, visibleRows - item.h))\n };\n }\n};\n\n/**\n * Bounded X constraint.\n *\n * Only constrains horizontal position (x-axis).\n * Items can move freely in the vertical direction.\n */\nexport const boundedX: LayoutConstraint = {\n name: \"boundedX\",\n\n constrainPosition(\n item: LayoutItem,\n x: number,\n y: number,\n { cols }: ConstraintContext\n ): { x: number; y: number } {\n return {\n x: clamp(x, 0, Math.max(0, cols - item.w)),\n y\n };\n }\n};\n\n/**\n * Bounded Y constraint.\n *\n * Only constrains vertical position (y-axis).\n * Items can move freely in the horizontal direction.\n */\nexport const boundedY: LayoutConstraint = {\n name: \"boundedY\",\n\n constrainPosition(\n item: LayoutItem,\n x: number,\n y: number,\n { maxRows }: ConstraintContext\n ): { x: number; y: number } {\n return {\n x,\n y: clamp(y, 0, Math.max(0, maxRows - item.h))\n };\n }\n};\n\n// ============================================================================\n// Constraint Factories\n// ============================================================================\n\n/**\n * Create an aspect ratio constraint.\n *\n * Maintains a fixed width-to-height ratio **in pixels** during resize operations.\n * Accounts for the different pixel sizes of grid columns vs rows.\n *\n * @param ratio - Width-to-height ratio (e.g., 16/9 for widescreen, 1 for square)\n * @returns A constraint that enforces the aspect ratio\n *\n * @example\n * ```typescript\n * // 16:9 aspect ratio (actual pixel proportions)\n * const layout = [\n * { i: 'video', x: 0, y: 0, w: 4, h: 2, constraints: [aspectRatio(16/9)] }\n * ];\n *\n * // Square items (in pixels, not grid units)\n * <GridLayout constraints={[gridBounds, minMaxSize, aspectRatio(1)]} />\n * ```\n */\nexport function aspectRatio(ratio: number): LayoutConstraint {\n return {\n name: `aspectRatio(${ratio})`,\n\n constrainSize(\n _item: LayoutItem,\n w: number,\n _h: number,\n _handle: ResizeHandleAxis,\n context: ConstraintContext\n ): { w: number; h: number } {\n const { cols, containerWidth, rowHeight, margin } = context;\n // Calculate column width in pixels\n // colWidth = (containerWidth - margin[0] * (cols - 1)) / cols\n // Note: simplified formula assumes no container padding\n const colWidth = (containerWidth - margin[0] * (cols - 1)) / cols;\n\n // Calculate pixel width of the item\n // pixelWidth = colWidth * w + margin[0] * (w - 1)\n const pixelWidth = colWidth * w + margin[0] * Math.max(0, w - 1);\n\n // Calculate required pixel height for aspect ratio\n const pixelHeight = pixelWidth / ratio;\n\n // Convert pixel height back to grid units\n // pixelHeight = rowHeight * h + margin[1] * (h - 1)\n // Solving for h:\n // pixelHeight = h * (rowHeight + margin[1]) - margin[1]\n // h = (pixelHeight + margin[1]) / (rowHeight + margin[1])\n const h = Math.max(\n 1,\n Math.round((pixelHeight + margin[1]) / (rowHeight + margin[1]))\n );\n\n return { w, h };\n }\n };\n}\n\n/**\n * Create a snap-to-grid constraint.\n *\n * Snaps positions to multiples of the specified step values.\n * Useful for aligning items to a coarser grid.\n *\n * @param stepX - Horizontal snap step in grid units\n * @param stepY - Vertical snap step in grid units (defaults to stepX)\n * @returns A constraint that snaps positions to the grid\n *\n * @example\n * ```typescript\n * // Snap to every 2 grid units\n * <GridLayout constraints={[snapToGrid(2), gridBounds]} />\n *\n * // Different horizontal and vertical snap\n * <GridLayout constraints={[snapToGrid(2, 3), gridBounds]} />\n * ```\n */\nexport function snapToGrid(\n stepX: number,\n stepY: number = stepX\n): LayoutConstraint {\n // Validate step values to prevent division by zero or invalid snapping\n if (stepX <= 0 || stepY <= 0) {\n throw new Error(\n `snapToGrid: step values must be positive (got stepX=${stepX}, stepY=${stepY})`\n );\n }\n\n return {\n name: `snapToGrid(${stepX}, ${stepY})`,\n\n constrainPosition(\n _item: LayoutItem,\n x: number,\n y: number\n ): { x: number; y: number } {\n return {\n x: Math.round(x / stepX) * stepX,\n y: Math.round(y / stepY) * stepY\n };\n }\n };\n}\n\n/**\n * Create a minimum size constraint.\n *\n * Sets minimum width and height for all items using this constraint.\n * Useful for grid-wide minimums without setting minW/minH on each item.\n *\n * @param minW - Minimum width in grid units\n * @param minH - Minimum height in grid units\n * @returns A constraint that enforces minimum size\n */\nexport function minSize(minW: number, minH: number): LayoutConstraint {\n return {\n name: `minSize(${minW}, ${minH})`,\n\n constrainSize(\n _item: LayoutItem,\n w: number,\n h: number\n ): { w: number; h: number } {\n return {\n w: Math.max(minW, w),\n h: Math.max(minH, h)\n };\n }\n };\n}\n\n/**\n * Create a maximum size constraint.\n *\n * Sets maximum width and height for all items using this constraint.\n * Useful for grid-wide maximums without setting maxW/maxH on each item.\n *\n * @param maxW - Maximum width in grid units\n * @param maxH - Maximum height in grid units\n * @returns A constraint that enforces maximum size\n */\nexport function maxSize(maxW: number, maxH: number): LayoutConstraint {\n return {\n name: `maxSize(${maxW}, ${maxH})`,\n\n constrainSize(\n _item: LayoutItem,\n w: number,\n h: number\n ): { w: number; h: number } {\n return {\n w: Math.min(maxW, w),\n h: Math.min(maxH, h)\n };\n }\n };\n}\n\n// ============================================================================\n// Default Constraints\n// ============================================================================\n\n/**\n * Default constraints applied when none are specified.\n *\n * Includes:\n * - gridBounds: Keep items within the grid\n * - minMaxSize: Respect per-item min/max constraints\n */\nexport const defaultConstraints: LayoutConstraint[] = [gridBounds, minMaxSize];\n\n// ============================================================================\n// Constraint Application Functions\n// ============================================================================\n\n/**\n * Apply position constraints to a proposed position.\n *\n * Constraints are applied in array order, allowing composition.\n * Grid-level constraints are applied first, then per-item constraints.\n *\n * @param constraints - Array of constraints to apply\n * @param item - The layout item being positioned\n * @param x - Proposed x position\n * @param y - Proposed y position\n * @param context - Grid context (cols, maxRows, etc.)\n * @returns Constrained position\n */\nexport function applyPositionConstraints(\n constraints: LayoutConstraint[],\n item: LayoutItem,\n x: number,\n y: number,\n context: ConstraintContext\n): { x: number; y: number } {\n let result = { x, y };\n\n // Apply grid-level constraints\n for (const constraint of constraints) {\n if (constraint.constrainPosition) {\n result = constraint.constrainPosition(item, result.x, result.y, context);\n }\n }\n\n // Apply per-item constraints\n if (item.constraints) {\n for (const constraint of item.constraints) {\n if (constraint.constrainPosition) {\n result = constraint.constrainPosition(\n item,\n result.x,\n result.y,\n context\n );\n }\n }\n }\n\n return result;\n}\n\n/**\n * Apply size constraints to a proposed size.\n *\n * Constraints are applied in array order, allowing composition.\n * Grid-level constraints are applied first, then per-item constraints.\n *\n * @param constraints - Array of constraints to apply\n * @param item - The layout item being resized\n * @param w - Proposed width\n * @param h - Proposed height\n * @param handle - Which resize handle is being used\n * @param context - Grid context (cols, maxRows, etc.)\n * @returns Constrained size\n */\nexport function applySizeConstraints(\n constraints: LayoutConstraint[],\n item: LayoutItem,\n w: number,\n h: number,\n handle: ResizeHandleAxis,\n context: ConstraintContext\n): { w: number; h: number } {\n let result = { w, h };\n\n // Apply grid-level constraints\n for (const constraint of constraints) {\n if (constraint.constrainSize) {\n result = constraint.constrainSize(\n item,\n result.w,\n result.h,\n handle,\n context\n );\n }\n }\n\n // Apply per-item constraints\n if (item.constraints) {\n for (const constraint of item.constraints) {\n if (constraint.constrainSize) {\n result = constraint.constrainSize(\n item,\n result.w,\n result.h,\n handle,\n context\n );\n }\n }\n }\n\n return result;\n}\n","/**\n * Position calculation utilities.\n *\n * These functions convert between grid units and pixel positions,\n * and generate CSS styles for grid items.\n */\n\nimport type {\n Position,\n PartialPosition,\n ResizeHandleAxis,\n PositionStrategy\n} from \"./types.js\";\n\n// ============================================================================\n// CSS Style Generation\n// ============================================================================\n\n/**\n * Generate CSS transform-based positioning styles.\n *\n * Using transforms is more performant than top/left positioning\n * because it doesn't trigger layout recalculations.\n *\n * @param position - Position in pixels\n * @returns CSS style object\n */\nexport function setTransform({\n top,\n left,\n width,\n height\n}: Position): Record<string, string> {\n const translate = `translate(${left}px,${top}px)`;\n return {\n transform: translate,\n WebkitTransform: translate,\n MozTransform: translate,\n msTransform: translate,\n OTransform: translate,\n width: `${width}px`,\n height: `${height}px`,\n position: \"absolute\"\n };\n}\n\n/**\n * Generate CSS top/left positioning styles.\n *\n * Use this when transforms are not suitable (e.g., for printing\n * or when transform causes issues with child elements).\n *\n * @param position - Position in pixels\n * @returns CSS style object\n */\nexport function setTopLeft({\n top,\n left,\n width,\n height\n}: Position): Record<string, string> {\n return {\n top: `${top}px`,\n left: `${left}px`,\n width: `${width}px`,\n height: `${height}px`,\n position: \"absolute\"\n };\n}\n\n/**\n * Convert a number to a percentage string.\n *\n * @param num - Number to convert (0-1 range typically)\n * @returns Percentage string (e.g., \"50%\")\n */\nexport function perc(num: number): string {\n return num * 100 + \"%\";\n}\n\n// ============================================================================\n// Resize Direction Handling\n// ============================================================================\n\n/**\n * Constrain width to not overflow container.\n */\nfunction constrainWidth(\n left: number,\n currentWidth: number,\n newWidth: number,\n containerWidth: number\n): number {\n return left + newWidth > containerWidth ? currentWidth : newWidth;\n}\n\n/**\n * Constrain height to not go above container (negative top).\n */\nfunction constrainHeight(\n top: number,\n currentHeight: number,\n newHeight: number\n): number {\n return top < 0 ? currentHeight : newHeight;\n}\n\n/**\n * Constrain left to not be negative.\n */\nfunction constrainLeft(left: number): number {\n return Math.max(0, left);\n}\n\n/**\n * Constrain top to not be negative.\n */\nfunction constrainTop(top: number): number {\n return Math.max(0, top);\n}\n\n// Direction handlers\ntype ResizeHandler = (\n currentSize: Position,\n newSize: Position,\n containerWidth: number\n) => Position;\n\nconst resizeNorth: ResizeHandler = (currentSize, newSize, _containerWidth) => {\n const { left, height, width } = newSize;\n const top = currentSize.top - (height - currentSize.height);\n\n return {\n left,\n width,\n height: constrainHeight(top, currentSize.height, height),\n top: constrainTop(top)\n };\n};\n\nconst resizeEast: ResizeHandler = (currentSize, newSize, containerWidth) => {\n const { top, left, height, width } = newSize;\n return {\n top,\n height,\n width: constrainWidth(\n currentSize.left,\n currentSize.width,\n width,\n containerWidth\n ),\n left: constrainLeft(left)\n };\n};\n\nconst resizeWest: ResizeHandler = (currentSize, newSize, _containerWidth) => {\n const { top, height, width } = newSize;\n const left = currentSize.left + currentSize.width - width;\n\n if (left < 0) {\n return {\n height,\n width: currentSize.left + currentSize.width,\n top: constrainTop(top),\n left: 0\n };\n }\n\n return {\n height,\n width,\n top: constrainTop(top),\n left\n };\n};\n\nconst resizeSouth: ResizeHandler = (currentSize, newSize, _containerWidth) => {\n const { top, left, height, width } = newSize;\n return {\n width,\n left,\n height: constrainHeight(top, currentSize.height, height),\n top: constrainTop(top)\n };\n};\n\n// Compound directions (corners)\nconst resizeNorthEast: ResizeHandler = (currentSize, newSize, containerWidth) =>\n resizeNorth(\n currentSize,\n resizeEast(currentSize, newSize, containerWidth),\n containerWidth\n );\n\nconst resizeNorthWest: ResizeHandler = (currentSize, newSize, containerWidth) =>\n resizeNorth(\n currentSize,\n resizeWest(currentSize, newSize, containerWidth),\n containerWidth\n );\n\nconst resizeSouthEast: ResizeHandler = (currentSize, newSize, containerWidth) =>\n resizeSouth(\n currentSize,\n resizeEast(currentSize, newSize, containerWidth),\n containerWidth\n );\n\nconst resizeSouthWest: ResizeHandler = (currentSize, newSize, containerWidth) =>\n resizeSouth(\n currentSize,\n resizeWest(currentSize, newSize, containerWidth),\n containerWidth\n );\n\nconst resizeHandlerMap: Record<ResizeHandleAxis, ResizeHandler> = {\n n: resizeNorth,\n ne: resizeNorthEast,\n e: resizeEast,\n se: resizeSouthEast,\n s: resizeSouth,\n sw: resizeSouthWest,\n w: resizeWest,\n nw: resizeNorthWest\n};\n\n/**\n * Resize an item in a specific direction, clamping to container bounds.\n *\n * This handles the complex logic of resizing from different edges/corners,\n * ensuring the item doesn't overflow the container.\n *\n * @param direction - Which edge/corner is being dragged\n * @param currentSize - Current position and size\n * @param newSize - Requested new position and size\n * @param containerWidth - Width of the container\n * @returns Constrained position and size\n */\nexport function resizeItemInDirection(\n direction: ResizeHandleAxis,\n currentSize: Position,\n newSize: Position,\n containerWidth: number\n): Position {\n const handler = resizeHandlerMap[direction];\n\n // Fallback if direction not found (shouldn't happen with proper types)\n if (!handler) {\n return newSize;\n }\n\n return handler(currentSize, { ...currentSize, ...newSize }, containerWidth);\n}\n\n// ============================================================================\n// Position Strategies (v2 Composable Interface)\n// ============================================================================\n\n/**\n * CSS transform-based positioning strategy.\n *\n * Uses CSS transforms for positioning, which is more performant\n * as it doesn't trigger layout recalculations.\n *\n * This is the default strategy.\n */\nexport const transformStrategy: PositionStrategy = {\n type: \"transform\",\n scale: 1,\n\n calcStyle(pos: Position): React.CSSProperties {\n return setTransform(pos) as React.CSSProperties;\n },\n\n calcDragPosition(\n clientX: number,\n clientY: number,\n offsetX: number,\n offsetY: number\n ): PartialPosition {\n return {\n left: clientX - offsetX,\n top: clientY - offsetY\n };\n }\n};\n\n/**\n * Absolute (top/left) positioning strategy.\n *\n * Uses CSS top/left for positioning. Use this when CSS transforms\n * cause issues (e.g., printing, certain child element positioning).\n */\nexport const absoluteStrategy: PositionStrategy = {\n type: \"absolute\",\n scale: 1,\n\n calcStyle(pos: Position): React.CSSProperties {\n return setTopLeft(pos) as React.CSSProperties;\n },\n\n calcDragPosition(\n clientX: number,\n clientY: number,\n offsetX: number,\n offsetY: number\n ): PartialPosition {\n return {\n left: clientX - offsetX,\n top: clientY - offsetY\n };\n }\n};\n\n/**\n * Create a scaled transform strategy.\n *\n * Use this when the grid container is inside a scaled element\n * (e.g., `transform: scale(0.5)`). The scale factor adjusts\n * drag/resize calculations to account for the parent transform.\n *\n * @param scale - Scale factor (e.g., 0.5 for half size)\n * @returns Position strategy with scaled calculations\n *\n * @example\n * ```tsx\n * <div style={{ transform: 'scale(0.5)' }}>\n * <GridLayout positionStrategy={createScaledStrategy(0.5)} />\n * </div>\n * ```\n */\nexport function createScaledStrategy(scale: number): PositionStrategy {\n return {\n type: \"transform\",\n scale,\n\n calcStyle(pos: Position): React.CSSProperties {\n return setTransform(pos) as React.CSSProperties;\n },\n\n calcDragPosition(\n clientX: number,\n clientY: number,\n offsetX: number,\n offsetY: number\n ): PartialPosition {\n return {\n left: (clientX - offsetX) / scale,\n top: (clientY - offsetY) / scale\n };\n }\n };\n}\n\n/** Default position strategy (transform-based) */\nexport const defaultPositionStrategy = transformStrategy;\n","/**\n * Core types for react-grid-layout v2\n *\n * These types are framework-agnostic and define the data structures\n * used by the layout algorithms.\n */\n\n// ============================================================================\n// Resize Handle Types\n// ============================================================================\n\n/**\n * Axis identifiers for resize handles.\n * - Cardinal: 'n', 's', 'e', 'w' (north, south, east, west)\n * - Diagonal: 'ne', 'nw', 'se', 'sw'\n */\nexport type ResizeHandleAxis =\n | \"s\"\n | \"w\"\n | \"e\"\n | \"n\"\n | \"sw\"\n | \"nw\"\n | \"se\"\n | \"ne\";\n\n// ============================================================================\n// Layout Item Types\n// ============================================================================\n\n/**\n * A single item in the grid layout.\n *\n * Position (x, y) is in grid units, not pixels.\n * Size (w, h) is in grid units.\n */\nexport interface LayoutItem {\n /** Unique identifier for this item */\n i: string;\n\n /** X position in grid units (0-indexed from left) */\n x: number;\n\n /** Y position in grid units (0-indexed from top) */\n y: number;\n\n /** Width in grid units */\n w: number;\n\n /** Height in grid units */\n h: number;\n\n /** Minimum width in grid units */\n minW?: number;\n\n /** Minimum height in grid units */\n minH?: number;\n\n /** Maximum width in grid units */\n maxW?: number;\n\n /** Maximum height in grid units */\n maxH?: number;\n\n /**\n * If true, item cannot be dragged or resized, and other items\n * will move around it during compaction.\n */\n static?: boolean;\n\n /**\n * If false, item cannot be dragged (but may still be resizable).\n * Overrides grid-level isDraggable for this item.\n */\n isDraggable?: boolean;\n\n /**\n * If false, item cannot be resized (but may still be draggable).\n * Overrides grid-level isResizable for this item.\n */\n isResizable?: boolean;\n\n /**\n * Which resize handles to show for this item.\n * Overrides grid-level resizeHandles for this item.\n */\n resizeHandles?: ResizeHandleAxis[];\n\n /**\n * If true, item is constrained to the grid container bounds.\n * Overrides grid-level isBounded for this item.\n */\n isBounded?: boolean;\n\n /**\n * Internal flag set during drag/resize operations to indicate\n * the item has moved from its original position.\n * @internal\n */\n moved?: boolean;\n\n /**\n * Per-item layout constraints.\n * Applied in addition to grid-level constraints.\n */\n constraints?: LayoutConstraint[];\n}\n\n/**\n * A layout is a readonly array of layout items.\n * Layouts should be treated as immutable.\n */\nexport type Layout = readonly LayoutItem[];\n\n// ============================================================================\n// Position & Size Types\n// ============================================================================\n\n/**\n * Pixel position and size of an element.\n */\nexport interface Position {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/**\n * Partial position (just coordinates, no size).\n */\nexport interface PartialPosition {\n left: number;\n top: number;\n}\n\n/**\n * Size in pixels.\n */\nexport interface Size {\n width: number;\n height: number;\n}\n\n/**\n * Position when dropping an external element onto the grid.\n */\nexport interface DroppingPosition {\n left: number;\n top: number;\n e: Event;\n}\n\n// ============================================================================\n// Event Types\n// ============================================================================\n\n/**\n * Data provided by react-draggable during drag operations.\n */\nexport interface ReactDraggableCallbackData {\n node: HTMLElement;\n x?: number;\n y?: number;\n deltaX: number;\n deltaY: number;\n lastX?: number;\n lastY?: number;\n}\n\n/**\n * Grid-level drag event data.\n */\nexport interface GridDragEvent {\n e: Event;\n node: HTMLElement;\n newPosition: PartialPosition;\n}\n\n/**\n * Grid-level resize event data.\n */\nexport interface GridResizeEvent {\n e: Event;\n node: HTMLElement;\n size: Size;\n handle: ResizeHandleAxis;\n}\n\n/**\n * Drag-over event with layer coordinates.\n */\nexport interface DragOverEvent extends MouseEvent {\n nativeEvent: Event & {\n layerX: number;\n layerY: number;\n };\n}\n\n// ============================================================================\n// Compaction Types\n// ============================================================================\n\n/**\n * Type of compaction to apply to the layout.\n * - 'vertical': Items compact upward (default)\n * - 'horizontal': Items compact leftward\n * - 'wrap': Items arranged in wrapped-paragraph style (like words in text)\n * - null: No compaction (free-form positioning)\n */\nexport type CompactType = \"horizontal\" | \"vertical\" | \"wrap\" | null;\n\n// ============================================================================\n// Callback Types\n// ============================================================================\n\n/**\n * Standard callback signature for layout change events.\n *\n * @param layout - The current layout after the change\n * @param oldItem - The item before the change (null if not applicable)\n * @param newItem - The item after the change (null if not applicable)\n * @param placeholder - The placeholder item during drag/resize (null at start)\n * @param event - The DOM event that triggered the change\n * @param element - The DOM element being manipulated (null if not applicable)\n */\nexport type EventCallback = (\n layout: Layout,\n oldItem: LayoutItem | null,\n newItem: LayoutItem | null,\n placeholder: LayoutItem | null,\n event: Event,\n element: HTMLElement | null\n) => void;\n\n/**\n * Callback when layout changes for any reason.\n */\nexport type OnLayoutChangeCallback = (layout: Layout) => void;\n\n// ============================================================================\n// Composable Interfaces (v2 API)\n// ============================================================================\n\n/**\n * Interface for layout compaction strategies.\n *\n * Implement this interface to create custom compaction algorithms.\n *\n * @example\n * ```typescript\n * const myCompactor: Compactor = {\n * type: 'vertical',\n * allowOverlap: false,\n * compact(layout, cols) {\n * // Custom compaction logic\n * return compactedLayout;\n * },\n * onMove(layout, item, x, y, cols) {\n * // Handle item movement\n * return updatedLayout;\n * }\n * };\n * ```\n */\nexport interface Compactor {\n /** Compaction type identifier */\n readonly type: CompactType;\n\n /**\n * Whether items can overlap (stack on top of each other).\n *\n * When true:\n * - Items can be placed on top of other items\n * - Dragging into another item does NOT push it away\n * - Compaction is skipped after drag/resize\n */\n readonly allowOverlap: boolean;\n\n /**\n * Whether to block movement that would cause collision.\n *\n * When true (and allowOverlap is false):\n * - Dragging into another item is blocked (item snaps back)\n * - Other items are NOT pushed away\n * - Only affects drag/resize, not compaction\n *\n * Has no effect when allowOverlap is true.\n */\n readonly preventCollision?: boolean;\n\n /**\n * Compact the layout.\n *\n * @param layout - The layout to compact\n * @param cols - Number of columns in the grid\n * @returns The compacted layout\n */\n compact(layout: Layout, cols: number): Layout;\n\n /**\n * Handle item movement, returning the updated layout.\n *\n * @param layout - Current layout\n * @param item - The item being moved\n * @param x - New x position\n * @param y - New y position\n * @param cols - Number of columns\n * @returns Updated layout after the move\n */\n onMove(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n cols: number\n ): Layout;\n}\n\n/**\n * Interface for CSS positioning strategies.\n *\n * Implement this interface to customize how items are positioned in the DOM.\n * Built-in strategies: transformStrategy, absoluteStrategy.\n *\n * @example\n * ```typescript\n * // Use transform-based positioning (default, better performance)\n * <GridLayout positionStrategy={transformStrategy} />\n *\n * // Use top/left positioning (for environments where transforms cause issues)\n * <GridLayout positionStrategy={absoluteStrategy} />\n *\n * // Use scaled transforms (for scaled containers)\n * <GridLayout positionStrategy={createScaledStrategy(0.5)} />\n * ```\n */\nexport interface PositionStrategy {\n /** Strategy type identifier */\n readonly type: \"transform\" | \"absolute\";\n\n /** Scale factor for drag/resize calculations */\n readonly scale: number;\n\n /**\n * Convert pixel position to CSS style object.\n *\n * @param pos - Position in pixels\n * @returns CSS properties for positioning the element\n */\n calcStyle(pos: Position): React.CSSProperties;\n\n /**\n * Calculate position during drag operations, accounting for transforms and scale.\n *\n * @param clientX - Mouse client X position\n * @param clientY - Mouse client Y position\n * @param offsetX - Offset from element origin X\n * @param offsetY - Offset from element origin Y\n * @returns Adjusted left/top position\n */\n calcDragPosition(\n clientX: number,\n clientY: number,\n offsetX: number,\n offsetY: number\n ): PartialPosition;\n}\n\n// ============================================================================\n// Layout Constraint Types\n// ============================================================================\n\n/**\n * Context provided to constraint functions during drag/resize operations.\n */\nexport interface ConstraintContext {\n /** Number of columns in the grid */\n cols: number;\n\n /** Maximum number of rows (Infinity if unbounded) */\n maxRows: number;\n\n /** Container width in pixels */\n containerWidth: number;\n\n /** Container height in pixels (may be 0 if auto-height) */\n containerHeight: number;\n\n /** Row height in pixels */\n rowHeight: number;\n\n /** Margin between items [x, y] in pixels */\n margin: readonly [number, number];\n\n /** Current layout state */\n layout: Layout;\n}\n\n/**\n * Interface for layout constraints.\n *\n * Implement this interface to create custom position/size constraints.\n * Built-in constraints: gridBounds, minMaxSize, containerBounds, boundedX, boundedY.\n *\n * @example\n * ```typescript\n * // Grid-level constraints\n * <GridLayout constraints={[gridBounds, minMaxSize, aspectRatio(16/9)]} />\n *\n * // Per-item constraints\n * const layout = [\n * { i: 'video', x: 0, y: 0, w: 4, h: 2, constraints: [aspectRatio(16/9)] }\n * ];\n * ```\n */\nexport interface LayoutConstraint {\n /** Constraint identifier for debugging */\n readonly name: string;\n\n /**\n * Constrain position during drag operations.\n * Called after grid unit conversion, before layout update.\n *\n * @param item - The item being dragged\n * @param x - Proposed x position in grid units\n * @param y - Proposed y position in grid units\n * @param context - Grid context (cols, maxRows, etc.)\n * @returns Constrained x, y position\n */\n constrainPosition?(\n item: LayoutItem,\n x: number,\n y: number,\n context: ConstraintContext\n ): { x: number; y: number };\n\n /**\n * Constrain size during resize operations.\n * Called after grid unit conversion, before layout update.\n *\n * @param item - The item being resized\n * @param w - Proposed width in grid units\n * @param h - Proposed height in grid units\n * @param handle - Which resize handle is being used\n * @param context - Grid context (cols, maxRows, etc.)\n * @returns Constrained w, h size\n */\n constrainSize?(\n item: LayoutItem,\n w: number,\n h: number,\n handle: ResizeHandleAxis,\n context: ConstraintContext\n ): { w: number; h: number };\n}\n\n// ============================================================================\n// Grid Configuration Types (v2 Composable Interfaces)\n// ============================================================================\n\n/**\n * Grid measurement configuration.\n * Groups all grid metrics (columns, row height, margins).\n */\nexport interface GridConfig {\n /** Number of columns in the grid (default: 12) */\n cols: number;\n\n /** Height of a single row in pixels (default: 150) */\n rowHeight: number;\n\n /** [horizontal, vertical] margin between items in pixels (default: [10, 10]) */\n margin: readonly [number, number];\n\n /** [horizontal, vertical] padding inside the container (default: null, uses margin) */\n containerPadding: readonly [number, number] | null;\n\n /** Maximum number of rows (default: Infinity) */\n maxRows: number;\n}\n\n/** Default grid configuration */\nexport const defaultGridConfig: GridConfig = {\n cols: 12,\n rowHeight: 150,\n margin: [10, 10],\n containerPadding: null,\n maxRows: Infinity\n};\n\n/**\n * Drag behavior configuration.\n * Groups all drag-related settings.\n */\nexport interface DragConfig {\n /** Whether items can be dragged (default: true) */\n enabled: boolean;\n\n /** Whether items are bounded to the container (default: false) */\n bounded: boolean;\n\n /** CSS selector for drag handle (e.g., '.drag-handle') */\n handle?: string;\n\n /** CSS selector for elements that should not trigger drag */\n cancel?: string;\n\n /**\n * Minimum pixels to move before drag starts.\n * Helps distinguish click from drag (fixes #1341, #1401).\n * @default 3\n */\n threshold: number;\n}\n\n/** Default drag configuration */\nexport const defaultDragConfig: DragConfig = {\n enabled: true,\n bounded: false,\n threshold: 3\n};\n\n/**\n * Resize behavior configuration.\n * Groups all resize-related settings.\n */\nexport interface ResizeConfig {\n /** Whether items can be resized (default: true) */\n enabled: boolean;\n\n /** Which resize handles to show (default: ['se']) */\n handles: readonly ResizeHandleAxis[];\n\n /**\n * Custom resize handle component.\n * Can be a React node or a function that receives the axis.\n */\n handleComponent?:\n | React.ReactNode\n | ((\n axis: ResizeHandleAxis,\n ref: React.Ref<HTMLElement>\n ) => React.ReactNode);\n}\n\n/** Default resize configuration */\nexport const defaultResizeConfig: ResizeConfig = {\n enabled: true,\n handles: [\"se\"]\n};\n\n/**\n * Drop configuration (for dropping external elements).\n * Groups all drop-related settings.\n */\nexport interface DropConfig {\n /** Whether external elements can be dropped on the grid (default: false) */\n enabled: boolean;\n\n /** Default size for dropped items (default: { w: 1, h: 1 }) */\n defaultItem: { w: number; h: number };\n\n /**\n * Called when dragging over the grid.\n * Return dimensions to override defaultItem, or false to reject the drop.\n * Can also return dragOffsetX/dragOffsetY to specify cursor offset for centering.\n */\n onDragOver?: (\n e: DragEvent\n ) =>\n | { w?: number; h?: number; dragOffsetX?: number; dragOffsetY?: number }\n | false\n | void;\n}\n\n/** Default drop configuration */\nexport const defaultDropConfig: DropConfig = {\n enabled: false,\n defaultItem: { w: 1, h: 1 }\n};\n\n// ============================================================================\n// Responsive Types\n// ============================================================================\n\n/**\n * Breakpoint name (e.g., 'lg', 'md', 'sm', 'xs', 'xxs').\n */\nexport type Breakpoint = string;\n\n/**\n * Map of breakpoint name to pixel width.\n * Generic type B allows custom breakpoint strings.\n */\nexport type Breakpoints<B extends Breakpoint = Breakpoint> = Record<B, number>;\n\n/**\n * Map of breakpoint name to number of columns.\n * Generic type B allows custom breakpoint strings.\n */\nexport type BreakpointCols<B extends Breakpoint = Breakpoint> = Record<\n B,\n number\n>;\n\n/**\n * Map of breakpoint name to layout.\n * Generic type B allows custom breakpoint strings.\n */\nexport type ResponsiveLayouts<B extends Breakpoint = Breakpoint> = Partial<\n Record<B, Layout>\n>;\n\n/**\n * Callback when breakpoint changes.\n */\nexport type OnBreakpointChangeCallback<B extends Breakpoint = Breakpoint> = (\n newBreakpoint: B,\n cols: number\n) => void;\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\n/**\n * Makes all properties in T mutable (removes readonly).\n */\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\n/**\n * Deep partial - all properties and nested properties are optional.\n */\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n\n/**\n * Extract the element type from an array type.\n */\nexport type ArrayElement<T> = T extends readonly (infer U)[] ? U : never;\n","/**\n * Legacy compaction API - backwards compatibility layer.\n *\n * This file implements the exact v1 compaction algorithm for backwards compatibility.\n * The algorithm matches lib/utils.js compact/compactItem functions exactly.\n */\n\nimport type { CompactType, Layout, LayoutItem, Mutable } from \"./types.js\";\nimport { cloneLayoutItem, bottom } from \"./layout.js\";\nimport { getFirstCollision, collides } from \"./collision.js\";\nimport { sortLayoutItems } from \"./sort.js\";\n\n// ============================================================================\n// Helper Functions\n// ============================================================================\n\n/**\n * Get all static items from a layout\n */\nfunction getStatics(layout: Layout): LayoutItem[] {\n return layout.filter(l => l.static);\n}\n\nconst heightWidth: { x: \"w\"; y: \"h\" } = { x: \"w\", y: \"h\" };\n\n/**\n * Before moving item down/right, check if movement will cause collisions\n * and move those items first. This is the recursive collision resolver.\n */\nfunction resolveCompactionCollision(\n layout: Layout,\n item: LayoutItem,\n moveToCoord: number,\n axis: \"x\" | \"y\",\n hasStatics?: boolean\n): void {\n const sizeProp = heightWidth[axis];\n (item as Mutable<LayoutItem>)[axis] += 1;\n\n const itemIndex = layout.findIndex(l => l.i === item.i);\n\n // Calculate hasStatics once if not provided\n const layoutHasStatics = hasStatics ?? getStatics(layout).length > 0;\n\n // Go through each item we collide with\n for (let i = itemIndex + 1; i < layout.length; i++) {\n const otherItem = layout[i];\n if (otherItem === undefined) continue;\n\n // Ignore static items\n if (otherItem.static) continue;\n\n // Optimization: we can break early if we know we're past this element\n // We can do this because it's a sorted layout - but only if there are\n // no static items, which can be scattered throughout and affect ordering.\n if (!layoutHasStatics && otherItem.y > item.y + item.h) break;\n\n if (collides(item, otherItem)) {\n resolveCompactionCollision(\n layout,\n otherItem,\n moveToCoord + item[sizeProp],\n axis,\n layoutHasStatics\n );\n }\n }\n\n (item as Mutable<LayoutItem>)[axis] = moveToCoord;\n}\n\n/**\n * Compact a single item in the layout.\n *\n * This is the exact algorithm from lib/utils.js compactItem.\n */\nfunction compactItemInternal(\n compareWith: Layout,\n l: LayoutItem,\n compactType: CompactType,\n cols: number,\n fullLayout: Layout,\n allowOverlap: boolean | undefined,\n b: number | undefined\n): LayoutItem {\n const compactV = compactType === \"vertical\";\n const compactH = compactType === \"horizontal\";\n\n // When allowOverlap is true, skip all compaction movement.\n // Items stay where they are placed.\n if (!allowOverlap) {\n if (compactV) {\n // Bottom 'y' possible is the bottom of the layout.\n // This allows you to do nice stuff like specify {y: Infinity}\n if (typeof b === \"number\") {\n (l as Mutable<LayoutItem>).y = Math.min(b, l.y);\n } else {\n (l as Mutable<LayoutItem>).y = Math.min(bottom(compareWith), l.y);\n }\n // Move the element up as far as it can go without colliding.\n while (l.y > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).y--;\n }\n } else if (compactH) {\n // Move the element left as far as it can go without colliding.\n while (l.x > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).x--;\n }\n }\n }\n\n // Move it down/right, and keep moving if it's colliding.\n let collision: LayoutItem | undefined;\n // When allowOverlap is true, skip collision resolution entirely.\n while (\n (collision = getFirstCollision(compareWith, l)) !== undefined &&\n !allowOverlap\n ) {\n if (compactH) {\n resolveCompactionCollision(fullLayout, l, collision.x + collision.w, \"x\");\n } else {\n resolveCompactionCollision(fullLayout, l, collision.y + collision.h, \"y\");\n }\n\n // Since we can't grow without bounds horizontally, if we've overflown,\n // let's move it down and try again.\n if (compactH && l.x + l.w > cols) {\n (l as Mutable<LayoutItem>).x = cols - l.w;\n (l as Mutable<LayoutItem>).y++;\n // Also move element as left as we can\n while (l.x > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).x--;\n }\n }\n }\n\n // Ensure that there are no negative positions\n (l as Mutable<LayoutItem>).y = Math.max(l.y, 0);\n (l as Mutable<LayoutItem>).x = Math.max(l.x, 0);\n\n return l;\n}\n\n// ============================================================================\n// Public API\n// ============================================================================\n\n/**\n * Compact a layout by removing gaps between items.\n *\n * This is the exact algorithm from lib/utils.js compact function.\n *\n * @param layout - Layout to compact\n * @param compactType - 'vertical', 'horizontal', or null\n * @param cols - Number of columns in the grid\n * @param allowOverlap - If true, overlapping is allowed\n * @returns Compacted layout\n */\nexport function compact(\n layout: Layout,\n compactType: CompactType,\n cols: number,\n allowOverlap?: boolean\n): LayoutItem[] {\n // Statics go in the compareWith array right away so items flow around them.\n const compareWith = getStatics(layout);\n // We keep track of the bottom position.\n let b = bottom(compareWith);\n // We go through the items by row and column (or col and row for horizontal).\n const sorted = sortLayoutItems(layout, compactType);\n // Holding for new items.\n const out: LayoutItem[] = new Array(layout.length);\n\n for (let i = 0; i < sorted.length; i++) {\n const sortedItem = sorted[i];\n if (sortedItem === undefined) continue;\n\n let l = cloneLayoutItem(sortedItem);\n\n // Don't move static elements\n if (!l.static) {\n l = compactItemInternal(\n compareWith,\n l,\n compactType,\n cols,\n sorted,\n allowOverlap,\n b\n );\n b = Math.max(b, l.y + l.h);\n\n // Add to comparison array. We only collide with items before this one.\n // Statics are already in this array.\n compareWith.push(l);\n }\n\n // Add to output array to make sure they still come out in the right order.\n const originalIndex = layout.indexOf(sortedItem);\n out[originalIndex] = l;\n\n // Clear moved flag, if it exists.\n (l as Mutable<LayoutItem>).moved = false;\n }\n\n return out;\n}\n\n/**\n * Compact a single item within the layout.\n *\n * @deprecated Use compact() instead, which handles the full layout.\n */\nexport function compactItem(\n compareWith: Layout,\n l: LayoutItem,\n compactType: CompactType,\n cols: number,\n fullLayout: Layout,\n allowOverlap: boolean | undefined,\n maxY: number | undefined\n): LayoutItem {\n return compactItemInternal(\n compareWith,\n cloneLayoutItem(l),\n compactType,\n cols,\n fullLayout,\n allowOverlap,\n maxY\n );\n}\n","/**\n * Compactor implementations.\n *\n * Compactors are pluggable strategies for removing gaps between grid items.\n * Use the Compactor interface to create custom compaction algorithms.\n */\n\nimport type {\n Compactor,\n CompactType,\n Layout,\n LayoutItem,\n Mutable\n} from \"./types.js\";\nimport { getFirstCollision } from \"./collision.js\";\nimport { sortLayoutItemsByRowCol, sortLayoutItemsByColRow } from \"./sort.js\";\nimport { bottom, cloneLayoutItem, getStatics, cloneLayout } from \"./layout.js\";\nimport { collides } from \"./collision.js\";\n\n// ============================================================================\n// Helpers for Custom Compactors\n// ============================================================================\n\n/**\n * Resolve a compaction collision by moving items.\n *\n * Before moving an item to a position, checks if that movement would\n * cause collisions and recursively moves those items first.\n *\n * Useful for implementing custom compactors.\n *\n * @param layout - Full layout (must be sorted for optimization)\n * @param item - Item being moved (will be mutated)\n * @param moveToCoord - Target coordinate\n * @param axis - Which axis to move on ('x' or 'y')\n * @param hasStatics - Whether layout contains static items (disables early break optimization)\n */\nexport function resolveCompactionCollision(\n layout: Layout,\n item: LayoutItem,\n moveToCoord: number,\n axis: \"x\" | \"y\",\n hasStatics?: boolean\n): void {\n const sizeProp = axis === \"x\" ? \"w\" : \"h\";\n\n // Temporarily increment position to check for collisions\n (item as Mutable<LayoutItem>)[axis] += 1;\n\n const itemIndex = layout.findIndex(l => l.i === item.i);\n\n // Calculate hasStatics once if not provided (for backwards compat)\n const layoutHasStatics = hasStatics ?? getStatics(layout).length > 0;\n\n for (let i = itemIndex + 1; i < layout.length; i++) {\n const otherItem = layout[i];\n if (otherItem === undefined) continue;\n if (otherItem.static) continue;\n // Optimization: break early if past this element, but only if no statics\n // are present. Static items can be scattered throughout the layout,\n // so we can't assume sort order guarantees no more collisions.\n if (!layoutHasStatics && otherItem.y > item.y + item.h) break;\n\n if (collides(item, otherItem)) {\n resolveCompactionCollision(\n layout,\n otherItem,\n moveToCoord + item[sizeProp],\n axis,\n layoutHasStatics\n );\n }\n }\n\n (item as Mutable<LayoutItem>)[axis] = moveToCoord;\n}\n\n/**\n * Compact a single item vertically (move up).\n *\n * Moves the item as far up as possible without colliding.\n * Useful for implementing custom vertical compactors.\n *\n * @param compareWith - Items to check for collisions\n * @param l - Item to compact (will be mutated)\n * @param fullLayout - Full layout for collision resolution\n * @param maxY - Maximum Y to start from\n * @returns The compacted item\n */\nexport function compactItemVertical(\n compareWith: Layout,\n l: LayoutItem,\n fullLayout: Layout,\n maxY: number\n): LayoutItem {\n // Limit Y to the current bottom\n (l as Mutable<LayoutItem>).y = Math.min(maxY, l.y);\n\n // Move up as far as possible\n while (l.y > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).y--;\n }\n\n // Resolve collisions by moving down\n let collision: LayoutItem | undefined;\n while ((collision = getFirstCollision(compareWith, l)) !== undefined) {\n resolveCompactionCollision(fullLayout, l, collision.y + collision.h, \"y\");\n }\n\n (l as Mutable<LayoutItem>).y = Math.max(l.y, 0);\n return l;\n}\n\n/**\n * Compact a single item horizontally (move left).\n *\n * Moves the item as far left as possible without colliding.\n * Wraps to the next row if it overflows.\n * Useful for implementing custom horizontal compactors.\n *\n * @param compareWith - Items to check for collisions\n * @param l - Item to compact (will be mutated)\n * @param cols - Number of columns in the grid\n * @param fullLayout - Full layout for collision resolution\n * @returns The compacted item\n */\nexport function compactItemHorizontal(\n compareWith: Layout,\n l: LayoutItem,\n cols: number,\n fullLayout: Layout\n): LayoutItem {\n // Move left as far as possible\n while (l.x > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).x--;\n }\n\n // Resolve collisions\n let collision: LayoutItem | undefined;\n while ((collision = getFirstCollision(compareWith, l)) !== undefined) {\n resolveCompactionCollision(fullLayout, l, collision.x + collision.w, \"x\");\n\n // Horizontal overflow: wrap to next row\n if (l.x + l.w > cols) {\n (l as Mutable<LayoutItem>).x = cols - l.w;\n (l as Mutable<LayoutItem>).y++;\n\n while (l.x > 0 && !getFirstCollision(compareWith, l)) {\n (l as Mutable<LayoutItem>).x--;\n }\n }\n }\n\n (l as Mutable<LayoutItem>).x = Math.max(l.x, 0);\n return l;\n}\n\n// ============================================================================\n// Vertical Compactor\n// ============================================================================\n\n/**\n * Vertical compactor - moves items up to fill gaps.\n *\n * Items are sorted by row then column, and each item is moved\n * as far up as possible without overlapping other items.\n *\n * This is the default compaction mode for react-grid-layout.\n */\nexport const verticalCompactor: Compactor = {\n type: \"vertical\",\n allowOverlap: false,\n\n compact(layout: Layout, _cols: number): Layout {\n const compareWith = getStatics(layout);\n let maxY = bottom(compareWith);\n const sorted = sortLayoutItemsByRowCol(layout);\n const out: LayoutItem[] = new Array(layout.length);\n\n for (let i = 0; i < sorted.length; i++) {\n const sortedItem = sorted[i];\n if (sortedItem === undefined) continue;\n\n let l = cloneLayoutItem(sortedItem);\n\n if (!l.static) {\n l = compactItemVertical(compareWith, l, sorted, maxY);\n maxY = Math.max(maxY, l.y + l.h);\n compareWith.push(l);\n }\n\n const originalIndex = layout.indexOf(sortedItem);\n out[originalIndex] = l;\n l.moved = false;\n }\n\n return out;\n },\n\n onMove(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n _cols: number\n ): Layout {\n // Simple move - compact() will be called after\n const newLayout = cloneLayout(layout);\n const movedItem = newLayout.find(l => l.i === item.i);\n if (movedItem) {\n movedItem.x = x;\n movedItem.y = y;\n movedItem.moved = true;\n }\n return newLayout;\n }\n};\n\n// ============================================================================\n// Horizontal Compactor\n// ============================================================================\n\n/**\n * Horizontal compactor - moves items left to fill gaps.\n *\n * Items are sorted by column then row, and each item is moved\n * as far left as possible without overlapping other items.\n */\nexport const horizontalCompactor: Compactor = {\n type: \"horizontal\",\n allowOverlap: false,\n\n compact(layout: Layout, cols: number): Layout {\n const compareWith = getStatics(layout);\n const sorted = sortLayoutItemsByColRow(layout);\n const out: LayoutItem[] = new Array(layout.length);\n\n for (let i = 0; i < sorted.length; i++) {\n const sortedItem = sorted[i];\n if (sortedItem === undefined) continue;\n\n let l = cloneLayoutItem(sortedItem);\n\n if (!l.static) {\n l = compactItemHorizontal(compareWith, l, cols, sorted);\n compareWith.push(l);\n }\n\n const originalIndex = layout.indexOf(sortedItem);\n out[originalIndex] = l;\n l.moved = false;\n }\n\n return out;\n },\n\n onMove(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n _cols: number\n ): Layout {\n const newLayout = cloneLayout(layout);\n const movedItem = newLayout.find(l => l.i === item.i);\n if (movedItem) {\n movedItem.x = x;\n movedItem.y = y;\n movedItem.moved = true;\n }\n return newLayout;\n }\n};\n\n// ============================================================================\n// No Compaction\n// ============================================================================\n\n/**\n * No compaction - items stay where placed.\n *\n * Use this for free-form layouts where items can be placed anywhere.\n * Items will not automatically move to fill gaps.\n */\nexport const noCompactor: Compactor = {\n type: null,\n allowOverlap: false,\n\n compact(layout: Layout, _cols: number): Layout {\n // No compaction - just clone to maintain immutability\n return cloneLayout(layout);\n },\n\n onMove(\n layout: Layout,\n item: LayoutItem,\n x: number,\n y: number,\n _cols: number\n ): Layout {\n const newLayout = cloneLayout(layout);\n const movedItem = newLayout.find(l => l.i === item.i);\n if (movedItem) {\n movedItem.x = x;\n movedItem.y = y;\n movedItem.moved = true;\n }\n return newLayout;\n }\n};\n\n// ============================================================================\n// Overlap-Allowing Variants\n// ============================================================================\n\n/**\n * Vertical compactor that allows overlapping items.\n *\n * Items compact upward but are allowed to overlap each other.\n * Useful for layered layouts or when collision detection is handled externally.\n */\nexport const verticalOverlapCompactor: Compactor = {\n ...verticalCompactor,\n allowOverlap: true,\n\n compact(layout: Layout, _cols: number): Layout {\n // With overlap allowed, just clone without moving\n return cloneLayout(layout);\n }\n};\n\n/**\n * Horizontal compactor that allows overlapping items.\n */\nexport const horizontalOverlapCompactor: Compactor = {\n ...horizontalCompactor,\n allowOverlap: true,\n\n compact(layout: Layout, _cols: number): Layout {\n return cloneLayout(layout);\n }\n};\n\n/**\n * No compaction, with overlapping allowed.\n *\n * Items stay where placed and can overlap each other.\n */\nexport const noOverlapCompactor: Compactor = {\n ...noCompactor,\n allowOverlap: true\n};\n\n// ============================================================================\n// Factory Function\n// ============================================================================\n\n/**\n * Get a compactor by type.\n *\n * This is a convenience function for backwards compatibility with the\n * string-based compactType API.\n *\n * Note: For 'wrap' mode, import `wrapCompactor` from 'react-grid-layout/extras'\n * and pass it directly to the `compactor` prop. This function returns\n * `noCompactor` for 'wrap' type since the wrap compactor is tree-shakeable.\n *\n * @param compactType - 'vertical', 'horizontal', 'wrap', or null\n * @param allowOverlap - Whether to allow overlapping items\n * @returns The appropriate Compactor\n */\nexport function getCompactor(\n compactType: CompactType,\n allowOverlap: boolean = false,\n preventCollision: boolean = false\n): Compactor {\n let baseCompactor: Compactor;\n\n if (allowOverlap) {\n if (compactType === \"vertical\") baseCompactor = verticalOverlapCompactor;\n else if (compactType === \"horizontal\")\n baseCompactor = horizontalOverlapCompactor;\n else baseCompactor = noOverlapCompactor;\n } else {\n if (compactType === \"vertical\") baseCompactor = verticalCompactor;\n else if (compactType === \"horizontal\") baseCompactor = horizontalCompactor;\n // For 'wrap' and null, use noCompactor\n // Users wanting wrap mode should import wrapCompactor from extras\n else baseCompactor = noCompactor;\n }\n\n // Return with preventCollision if specified\n if (preventCollision) {\n return { ...baseCompactor, preventCollision };\n }\n return baseCompactor;\n}\n","/**\n * Responsive layout utilities.\n *\n * Functions for handling responsive breakpoints and layout generation.\n */\n\nimport type {\n Breakpoint,\n Breakpoints,\n CompactType,\n Layout,\n ResponsiveLayouts\n} from \"./types.js\";\nimport { cloneLayout, correctBounds } from \"./layout.js\";\nimport { compact } from \"./compact-compat.js\";\n\n// ============================================================================\n// Breakpoint Utilities\n// ============================================================================\n\n/**\n * Sort breakpoints by width (ascending).\n *\n * Returns an array of breakpoint names sorted from smallest to largest.\n * E.g., ['xxs', 'xs', 'sm', 'md', 'lg']\n *\n * @param breakpoints - Map of breakpoint names to widths\n * @returns Sorted array of breakpoint names\n */\nexport function sortBreakpoints<B extends Breakpoint>(\n breakpoints: Breakpoints<B>\n): B[] {\n const keys = Object.keys(breakpoints) as B[];\n return keys.sort((a, b) => breakpoints[a] - breakpoints[b]);\n}\n\n/**\n * Get the active breakpoint for a given width.\n *\n * Returns the highest breakpoint that is valid for the width (width > breakpoint).\n *\n * @param breakpoints - Map of breakpoint names to widths\n * @param width - Container width in pixels\n * @returns Active breakpoint name\n */\nexport function getBreakpointFromWidth<B extends Breakpoint>(\n breakpoints: Breakpoints<B>,\n width: number\n): B {\n const sorted = sortBreakpoints(breakpoints);\n let matching = sorted[0];\n\n if (matching === undefined) {\n throw new Error(\"No breakpoints defined\");\n }\n\n for (let i = 1; i < sorted.length; i++) {\n const breakpointName = sorted[i];\n if (breakpointName === undefined) continue;\n\n const breakpointWidth = breakpoints[breakpointName];\n if (width > breakpointWidth) {\n matching = breakpointName;\n }\n }\n\n return matching;\n}\n\n/**\n * Get the column count for a breakpoint.\n *\n * @param breakpoint - Breakpoint name\n * @param cols - Map of breakpoint names to column counts\n * @returns Number of columns for the breakpoint\n * @throws Error if breakpoint is not defined in cols\n */\nexport function getColsFromBreakpoint<B extends Breakpoint>(\n breakpoint: B,\n cols: Breakpoints<B>\n): number {\n const colCount = cols[breakpoint];\n if (colCount === undefined) {\n throw new Error(\n `ResponsiveReactGridLayout: \\`cols\\` entry for breakpoint ${String(breakpoint)} is missing!`\n );\n }\n return colCount;\n}\n\n// ============================================================================\n// Layout Generation\n// ============================================================================\n\n/**\n * Find or generate a layout for a breakpoint.\n *\n * If a layout exists for the breakpoint, returns a clone.\n * Otherwise, generates a new layout from the nearest larger breakpoint.\n *\n * @param layouts - Existing layouts by breakpoint\n * @param breakpoints - Breakpoint definitions\n * @param breakpoint - Target breakpoint\n * @param lastBreakpoint - Previous breakpoint (for fallback)\n * @param cols - Column count for the target breakpoint\n * @param compactType - Compaction type\n * @returns Layout for the breakpoint\n */\nexport function findOrGenerateResponsiveLayout<B extends Breakpoint>(\n layouts: ResponsiveLayouts<B>,\n breakpoints: Breakpoints<B>,\n breakpoint: B,\n lastBreakpoint: B,\n cols: number,\n compactType: CompactType\n): Layout {\n // If it already exists, just return it\n const existingLayout = layouts[breakpoint];\n if (existingLayout) {\n return cloneLayout(existingLayout);\n }\n\n // Find or generate the next layout\n let layout = layouts[lastBreakpoint];\n\n // Look for layouts at larger breakpoints\n const breakpointsSorted = sortBreakpoints(breakpoints);\n const breakpointsAbove = breakpointsSorted.slice(\n breakpointsSorted.indexOf(breakpoint)\n );\n\n for (let i = 0; i < breakpointsAbove.length; i++) {\n const b = breakpointsAbove[i];\n if (b === undefined) continue;\n\n const layoutForBreakpoint = layouts[b];\n if (layoutForBreakpoint) {\n layout = layoutForBreakpoint;\n break;\n }\n }\n\n // Clone layout so we don't modify existing items\n const clonedLayout = cloneLayout(layout || []);\n\n // Correct bounds and compact\n return compact(correctBounds(clonedLayout, { cols }), compactType, cols);\n}\n\n// ============================================================================\n// Margin/Padding Helpers\n// ============================================================================\n\ntype IndentationValue<B extends Breakpoint> =\n | readonly [number, number]\n | Partial<Record<B, readonly [number, number]>>;\n\n/**\n * Get margin or padding value for a breakpoint.\n *\n * Supports both fixed values ([x, y]) and breakpoint-specific values\n * ({ lg: [x, y], md: [x, y], ... }).\n *\n * @param value - Fixed value or breakpoint-specific map\n * @param breakpoint - Current breakpoint\n * @returns Margin/padding tuple [x, y]\n */\nexport function getIndentationValue<B extends Breakpoint>(\n value: IndentationValue<B>,\n breakpoint: B\n): readonly [number, number] {\n // If it's a tuple (array), return it directly\n if (Array.isArray(value)) {\n return value as readonly [number, number];\n }\n\n // It's a breakpoint map - find the value\n const breakpointMap = value as Partial<Record<B, readonly [number, number]>>;\n const breakpointValue = breakpointMap[breakpoint];\n if (breakpointValue !== undefined) {\n return breakpointValue;\n }\n\n // Fallback to first defined value\n const keys = Object.keys(breakpointMap) as B[];\n for (const key of keys) {\n const v = breakpointMap[key];\n if (v !== undefined) {\n return v;\n }\n }\n\n // Default fallback\n return [10, 10];\n}\n"]}
|