@wordpress/grid 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE.md +788 -0
  3. package/README.md +534 -0
  4. package/build/dashboard-grid/grid-item.cjs +308 -0
  5. package/build/dashboard-grid/grid-item.cjs.map +7 -0
  6. package/build/dashboard-grid/index.cjs +591 -0
  7. package/build/dashboard-grid/index.cjs.map +7 -0
  8. package/build/dashboard-grid/resolve-fill-widths.cjs +189 -0
  9. package/build/dashboard-grid/resolve-fill-widths.cjs.map +7 -0
  10. package/build/dashboard-grid/types.cjs +19 -0
  11. package/build/dashboard-grid/types.cjs.map +7 -0
  12. package/build/dashboard-lanes/index.cjs +558 -0
  13. package/build/dashboard-lanes/index.cjs.map +7 -0
  14. package/build/dashboard-lanes/lane-placement.cjs +110 -0
  15. package/build/dashboard-lanes/lane-placement.cjs.map +7 -0
  16. package/build/dashboard-lanes/lanes-item.cjs +295 -0
  17. package/build/dashboard-lanes/lanes-item.cjs.map +7 -0
  18. package/build/dashboard-lanes/types.cjs +19 -0
  19. package/build/dashboard-lanes/types.cjs.map +7 -0
  20. package/build/dashboard-lanes/use-lane-placement.cjs +206 -0
  21. package/build/dashboard-lanes/use-lane-placement.cjs.map +7 -0
  22. package/build/index.cjs +34 -0
  23. package/build/index.cjs.map +7 -0
  24. package/build/shared/drag-overlay-drop-animation.cjs +70 -0
  25. package/build/shared/drag-overlay-drop-animation.cjs.map +7 -0
  26. package/build/shared/grid-item-key.cjs +31 -0
  27. package/build/shared/grid-item-key.cjs.map +7 -0
  28. package/build/shared/grid-overlay.cjs +187 -0
  29. package/build/shared/grid-overlay.cjs.map +7 -0
  30. package/build/shared/item-exit-overlay.cjs +150 -0
  31. package/build/shared/item-exit-overlay.cjs.map +7 -0
  32. package/build/shared/resize-handle.cjs +224 -0
  33. package/build/shared/resize-handle.cjs.map +7 -0
  34. package/build/shared/resize-snap.cjs +47 -0
  35. package/build/shared/resize-snap.cjs.map +7 -0
  36. package/build/shared/types.cjs +19 -0
  37. package/build/shared/types.cjs.map +7 -0
  38. package/build/shared/use-item-exit-animation.cjs +148 -0
  39. package/build/shared/use-item-exit-animation.cjs.map +7 -0
  40. package/build/shared/use-layout-shift-animation.cjs +167 -0
  41. package/build/shared/use-layout-shift-animation.cjs.map +7 -0
  42. package/build-module/dashboard-grid/grid-item.mjs +273 -0
  43. package/build-module/dashboard-grid/grid-item.mjs.map +7 -0
  44. package/build-module/dashboard-grid/index.mjs +579 -0
  45. package/build-module/dashboard-grid/index.mjs.map +7 -0
  46. package/build-module/dashboard-grid/resolve-fill-widths.mjs +164 -0
  47. package/build-module/dashboard-grid/resolve-fill-widths.mjs.map +7 -0
  48. package/build-module/dashboard-grid/types.mjs +1 -0
  49. package/build-module/dashboard-grid/types.mjs.map +7 -0
  50. package/build-module/dashboard-lanes/index.mjs +547 -0
  51. package/build-module/dashboard-lanes/index.mjs.map +7 -0
  52. package/build-module/dashboard-lanes/lane-placement.mjs +85 -0
  53. package/build-module/dashboard-lanes/lane-placement.mjs.map +7 -0
  54. package/build-module/dashboard-lanes/lanes-item.mjs +260 -0
  55. package/build-module/dashboard-lanes/lanes-item.mjs.map +7 -0
  56. package/build-module/dashboard-lanes/types.mjs +1 -0
  57. package/build-module/dashboard-lanes/types.mjs.map +7 -0
  58. package/build-module/dashboard-lanes/use-lane-placement.mjs +181 -0
  59. package/build-module/dashboard-lanes/use-lane-placement.mjs.map +7 -0
  60. package/build-module/index.mjs +8 -0
  61. package/build-module/index.mjs.map +7 -0
  62. package/build-module/shared/drag-overlay-drop-animation.mjs +47 -0
  63. package/build-module/shared/drag-overlay-drop-animation.mjs.map +7 -0
  64. package/build-module/shared/grid-item-key.mjs +6 -0
  65. package/build-module/shared/grid-item-key.mjs.map +7 -0
  66. package/build-module/shared/grid-overlay.mjs +152 -0
  67. package/build-module/shared/grid-overlay.mjs.map +7 -0
  68. package/build-module/shared/item-exit-overlay.mjs +125 -0
  69. package/build-module/shared/item-exit-overlay.mjs.map +7 -0
  70. package/build-module/shared/resize-handle.mjs +193 -0
  71. package/build-module/shared/resize-handle.mjs.map +7 -0
  72. package/build-module/shared/resize-snap.mjs +21 -0
  73. package/build-module/shared/resize-snap.mjs.map +7 -0
  74. package/build-module/shared/types.mjs +1 -0
  75. package/build-module/shared/types.mjs.map +7 -0
  76. package/build-module/shared/use-item-exit-animation.mjs +128 -0
  77. package/build-module/shared/use-item-exit-animation.mjs.map +7 -0
  78. package/build-module/shared/use-layout-shift-animation.mjs +140 -0
  79. package/build-module/shared/use-layout-shift-animation.mjs.map +7 -0
  80. package/build-types/dashboard-grid/grid-item.d.ts +3 -0
  81. package/build-types/dashboard-grid/grid-item.d.ts.map +1 -0
  82. package/build-types/dashboard-grid/index.d.ts +35 -0
  83. package/build-types/dashboard-grid/index.d.ts.map +1 -0
  84. package/build-types/dashboard-grid/resolve-fill-widths.d.ts +26 -0
  85. package/build-types/dashboard-grid/resolve-fill-widths.d.ts.map +1 -0
  86. package/build-types/dashboard-grid/stories/index.story.d.ts +98 -0
  87. package/build-types/dashboard-grid/stories/index.story.d.ts.map +1 -0
  88. package/build-types/dashboard-grid/types.d.ts +232 -0
  89. package/build-types/dashboard-grid/types.d.ts.map +1 -0
  90. package/build-types/dashboard-lanes/index.d.ts +40 -0
  91. package/build-types/dashboard-lanes/index.d.ts.map +1 -0
  92. package/build-types/dashboard-lanes/lane-placement.d.ts +126 -0
  93. package/build-types/dashboard-lanes/lane-placement.d.ts.map +1 -0
  94. package/build-types/dashboard-lanes/lanes-item.d.ts +52 -0
  95. package/build-types/dashboard-lanes/lanes-item.d.ts.map +1 -0
  96. package/build-types/dashboard-lanes/stories/index.story.d.ts +64 -0
  97. package/build-types/dashboard-lanes/stories/index.story.d.ts.map +1 -0
  98. package/build-types/dashboard-lanes/types.d.ts +151 -0
  99. package/build-types/dashboard-lanes/types.d.ts.map +1 -0
  100. package/build-types/dashboard-lanes/use-lane-placement.d.ts +74 -0
  101. package/build-types/dashboard-lanes/use-lane-placement.d.ts.map +1 -0
  102. package/build-types/index.d.ts +6 -0
  103. package/build-types/index.d.ts.map +1 -0
  104. package/build-types/shared/drag-overlay-drop-animation.d.ts +13 -0
  105. package/build-types/shared/drag-overlay-drop-animation.d.ts.map +1 -0
  106. package/build-types/shared/grid-item-key.d.ts +6 -0
  107. package/build-types/shared/grid-item-key.d.ts.map +1 -0
  108. package/build-types/shared/grid-overlay.d.ts +19 -0
  109. package/build-types/shared/grid-overlay.d.ts.map +1 -0
  110. package/build-types/shared/item-exit-overlay.d.ts +20 -0
  111. package/build-types/shared/item-exit-overlay.d.ts.map +1 -0
  112. package/build-types/shared/resize-handle.d.ts +23 -0
  113. package/build-types/shared/resize-handle.d.ts.map +1 -0
  114. package/build-types/shared/resize-snap.d.ts +41 -0
  115. package/build-types/shared/resize-snap.d.ts.map +1 -0
  116. package/build-types/shared/types.d.ts +144 -0
  117. package/build-types/shared/types.d.ts.map +1 -0
  118. package/build-types/shared/use-item-exit-animation.d.ts +37 -0
  119. package/build-types/shared/use-item-exit-animation.d.ts.map +1 -0
  120. package/build-types/shared/use-layout-shift-animation.d.ts +77 -0
  121. package/build-types/shared/use-layout-shift-animation.d.ts.map +1 -0
  122. package/package.json +80 -0
  123. package/src/dashboard-grid/grid-item.module.css +94 -0
  124. package/src/dashboard-grid/grid-item.tsx +205 -0
  125. package/src/dashboard-grid/grid.module.css +134 -0
  126. package/src/dashboard-grid/index.tsx +713 -0
  127. package/src/dashboard-grid/resolve-fill-widths.ts +224 -0
  128. package/src/dashboard-grid/stories/index.story.tsx +930 -0
  129. package/src/dashboard-grid/test/keyboard-activation.test.tsx +76 -0
  130. package/src/dashboard-grid/test/resolve-fill-widths.test.ts +250 -0
  131. package/src/dashboard-grid/types.ts +271 -0
  132. package/src/dashboard-lanes/index.tsx +629 -0
  133. package/src/dashboard-lanes/lane-placement.ts +245 -0
  134. package/src/dashboard-lanes/lanes-item.module.css +93 -0
  135. package/src/dashboard-lanes/lanes-item.tsx +236 -0
  136. package/src/dashboard-lanes/lanes.module.css +152 -0
  137. package/src/dashboard-lanes/stories/index.story.tsx +518 -0
  138. package/src/dashboard-lanes/test/keyboard-activation.test.tsx +71 -0
  139. package/src/dashboard-lanes/test/lane-placement.test.ts +442 -0
  140. package/src/dashboard-lanes/test/use-lane-placement.test.tsx +358 -0
  141. package/src/dashboard-lanes/types.ts +176 -0
  142. package/src/dashboard-lanes/use-lane-placement.ts +313 -0
  143. package/src/index.ts +17 -0
  144. package/src/shared/actionable-area-slot.module.css +16 -0
  145. package/src/shared/drag-overlay-drop-animation.ts +66 -0
  146. package/src/shared/grid-item-key.ts +5 -0
  147. package/src/shared/grid-overlay.module.css +82 -0
  148. package/src/shared/grid-overlay.tsx +93 -0
  149. package/src/shared/item-exit-animation.module.css +49 -0
  150. package/src/shared/item-exit-overlay.tsx +57 -0
  151. package/src/shared/layout-shift-animation.module.css +16 -0
  152. package/src/shared/resize-handle.module.css +88 -0
  153. package/src/shared/resize-handle.tsx +163 -0
  154. package/src/shared/resize-snap.ts +63 -0
  155. package/src/shared/test/resize-snap.test.ts +35 -0
  156. package/src/shared/types.ts +164 -0
  157. package/src/shared/use-item-exit-animation.ts +199 -0
  158. package/src/shared/use-layout-shift-animation.ts +284 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dashboard-grid/index.tsx", "../../../style-runtime/src/index.ts", "../../src/shared/layout-shift-animation.module.css", "../../src/dashboard-grid/grid.module.css"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tDndContext,\n\tDragOverlay,\n\tKeyboardSensor,\n\tPointerSensor,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core';\nimport {\n\tarrayMove,\n\tSortableContext,\n\tsortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport type { DragMoveEvent, DragStartEvent } from '@dnd-kit/core';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useResizeObserver, useEvent, useMergeRefs } from '@wordpress/compose';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tChildren,\n\tcloneElement,\n\tisValidElement,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { GridItem } from './grid-item';\nimport { GridOverlay } from '../shared/grid-overlay';\nimport { gridSpanToPixelSize } from '../shared/resize-snap';\nimport layoutAnimationStyles from '../shared/layout-shift-animation.module.css';\nimport { ItemExitOverlay } from '../shared/item-exit-overlay';\nimport {\n\tgetLayoutFingerprint,\n\tuseLayoutShiftAnimation,\n} from '../shared/use-layout-shift-animation';\nimport { useItemExitAnimation } from '../shared/use-item-exit-animation';\nimport { resolveFillWidths } from './resolve-fill-widths';\nimport type { DashboardGridLayoutItem, DashboardGridProps } from './types';\nimport type { ResizeSnapSize } from '../shared/resize-snap';\nimport type { ResizeDelta } from '../shared/types';\nimport { createDashboardDragDropAnimation } from '../shared/drag-overlay-drop-animation';\nimport styles from './grid.module.css';\n\nconst dashboardDragDropAnimation = createDashboardDragDropAnimation(\n\tstyles[ 'drag-preview-frame' ],\n\tstyles.dragPreviewFrameExiting\n);\n\n// Fallback gap in pixels for math that runs before the computed gap\n// can be read from the DOM. Matches the `'xl'` step the surface\n// resolves to in CSS (`--wpds-dimension-gap-xl`); the next layout\n// effect overwrites this with the actual computed value.\nconst FALLBACK_GAP_PX = 24;\n\n// Default column cap when no explicit `columns` or `minColumnWidth` is\n// supplied. Layered semantics: `columns` acts as a cap and\n// `minColumnWidth` as a per-tile floor; if neither is set we still\n// need a finite count to render against.\nconst DEFAULT_COLUMNS = 6;\n\n// Reorder is driven by `temporaryLayout` + CSS Grid, not by dnd-kit\n// transforms. Hoist the no-op strategy outside the component so its\n// reference is stable across renders — passing a fresh `() => null`\n// to `<SortableContext>` updates its context value and triggers all\n// `useSortable` subscribers to re-render every frame.\nconst NO_SORT_STRATEGY = () => null;\n\n/**\n * 2D packed dashboard grid with drag-to-reorder and resize handles.\n * Supports fixed-column and responsive modes, `number | 'fill' | 'full'`\n * widths, and multi-row tiles.\n *\n * Each child's `key` must match an entry in the `layout` array;\n * children without a match render at the end of the grid without\n * explicit placement and fall through CSS Grid's auto-flow.\n *\n * @example\n * ```jsx\n * const layout = [\n * { key: 'a', width: 2 },\n * { key: 'b', width: 'fill' },\n * { key: 'c', width: 'full' },\n * ];\n *\n * <DashboardGrid\n * layout={ layout }\n * columns={ 6 }\n * editMode\n * onChangeLayout={ setLayout }\n * >\n * <div key=\"a\">A</div>\n * <div key=\"b\">B</div>\n * <div key=\"c\">C</div>\n * </DashboardGrid>\n * ```\n *\n * @param props Component props.\n * @param ref Forwarded to the grid's root `<div>`.\n */\nexport const DashboardGrid = forwardRef< HTMLDivElement, DashboardGridProps >(\n\tfunction DashboardGrid( props, ref ) {\n\t\tconst {\n\t\t\tlayout,\n\t\t\tcolumns,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tstyle,\n\t\t\trowHeight = 'auto',\n\t\t\tminColumnWidth,\n\t\t\teditMode = false,\n\t\t\tonChangeLayout,\n\t\t\tonPreviewLayout,\n\t\t\trenderResizeHandle,\n\t\t\trenderDragPreview,\n\t\t\trenderGridOverlay,\n\t\t\t...divProps\n\t\t} = props;\n\t\t// Preview layout applied during drag/resize before committing.\n\t\tconst [ temporaryLayout, setTemporaryLayout ] = useState<\n\t\t\tDashboardGridLayoutItem[] | undefined\n\t\t>();\n\t\t// Drives `<DragOverlay>` content while a drag is in progress.\n\t\tconst [ activeId, setActiveId ] = useState< string | null >( null );\n\t\t// True while any tile is being resized. Combined with `activeId`,\n\t\t// it drives the grid-wide `inert` flag on actionable areas so\n\t\t// hovering over another tile's buttons can't steal the gesture.\n\t\tconst [ isResizing, setIsResizing ] = useState( false );\n\t\t// Snapped span in pixels for the resize-preview outline on the\n\t\t// active tile. The tile content follows the cursor continuously;\n\t\t// this preview shows the grid size that will commit on release.\n\t\tconst [ resizeSnapPreview, setResizeSnapPreview ] = useState< {\n\t\t\tid: string;\n\t\t\tsnap: ResizeSnapSize;\n\t\t} | null >( null );\n\t\t// Mirror of `temporaryLayout` read synchronously on drag end —\n\t\t// the state update from `handleDragMove` may still be batched.\n\t\tconst latestLayoutRef = useRef<\n\t\t\tDashboardGridLayoutItem[] | undefined\n\t\t>();\n\t\t// Cursor center at the last applied reorder. Used to skip the\n\t\t// cascade of re-measured `onDragMove` events after a layout\n\t\t// change, when the cursor has not actually moved.\n\t\tconst lastReorderCursorRef = useRef< {\n\t\t\tx: number;\n\t\t\ty: number;\n\t\t} | null >( null );\n\t\t// Width/height snapshot at the start of a resize session. The\n\t\t// resize handle reports `delta` absolute from the gesture start,\n\t\t// so the baseline must stay frozen — reading from the already\n\t\t// mutated `activeLayout` would compound the delta each frame.\n\t\tconst resizeBaselineRef = useRef< {\n\t\t\twidth: number;\n\t\t\theight: number;\n\t\t} | null >( null );\n\t\tconst captureLayoutSnapshotRef = useRef< () => void >( () => {} );\n\t\tconst childrenCacheRef = useRef< Map< string, React.ReactElement > >(\n\t\t\tnew Map()\n\t\t);\n\t\tconst activeLayout = temporaryLayout ?? layout;\n\n\t\tconst [ gridRoot, setGridRoot ] = useState< HTMLDivElement | null >(\n\t\t\tnull\n\t\t);\n\t\tconst [ containerWidth, setContainerWidth ] = useState( 0 );\n\t\tconst [ containerHeight, setContainerHeight ] = useState( 0 );\n\t\tconst [ gapPx, setGapPx ] = useState( FALLBACK_GAP_PX );\n\t\tconst resizeObserverRef = useResizeObserver(\n\t\t\t( [ { contentRect } ] ) => {\n\t\t\t\tsetContainerWidth( contentRect.width );\n\t\t\t\tsetContainerHeight( contentRect.height );\n\t\t\t}\n\t\t);\n\t\tconst mergedGridRef = useMergeRefs( [\n\t\t\tsetGridRoot,\n\t\t\tresizeObserverRef,\n\t\t\tref,\n\t\t] );\n\n\t\t// Measure before paint to avoid a single-column flash in\n\t\t// responsive mode; `useResizeObserver` delivers async. The\n\t\t// computed `column-gap` is read from the resolved CSS so the\n\t\t// math tracks the design-system token under any density.\n\t\tuseLayoutEffect( () => {\n\t\t\tif ( ! gridRoot ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { width, height } = gridRoot.getBoundingClientRect();\n\t\t\tif ( width > 0 ) {\n\t\t\t\tsetContainerWidth( width );\n\t\t\t}\n\t\t\tif ( height > 0 ) {\n\t\t\t\tsetContainerHeight( height );\n\t\t\t}\n\t\t\tconst parsed = Number.parseFloat(\n\t\t\t\twindow.getComputedStyle( gridRoot ).columnGap\n\t\t\t);\n\t\t\tif ( Number.isFinite( parsed ) && parsed > 0 ) {\n\t\t\t\tsetGapPx( parsed );\n\t\t\t}\n\t\t}, [ gridRoot ] );\n\t\tconst effectiveColumns = useMemo( () => {\n\t\t\tif ( ! minColumnWidth ) {\n\t\t\t\treturn columns ?? DEFAULT_COLUMNS;\n\t\t\t}\n\n\t\t\tconst totalWidthPerColumn = minColumnWidth + gapPx;\n\t\t\tconst maxFit = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.floor( ( containerWidth + gapPx ) / totalWidthPerColumn )\n\t\t\t);\n\t\t\treturn columns !== undefined ? Math.min( columns, maxFit ) : maxFit;\n\t\t}, [ minColumnWidth, gapPx, containerWidth, columns ] );\n\t\tconst columnWidth =\n\t\t\t( containerWidth - ( effectiveColumns - 1 ) * gapPx ) /\n\t\t\teffectiveColumns;\n\t\tconst minResizeWidthPx = gridSpanToPixelSize(\n\t\t\t1,\n\t\t\t1,\n\t\t\tcolumnWidth,\n\t\t\tgapPx,\n\t\t\tnull\n\t\t).widthPx;\n\t\tconst rowHeightPx = typeof rowHeight === 'number' ? rowHeight : null;\n\t\tconst minResizeHeightPx =\n\t\t\trowHeightPx === null\n\t\t\t\t? undefined\n\t\t\t\t: gridSpanToPixelSize( 1, 1, columnWidth, gapPx, rowHeightPx )\n\t\t\t\t\t\t.heightPx ?? undefined;\n\n\t\tconst layoutMap = useMemo( () => {\n\t\t\tconst map = new Map< string, DashboardGridLayoutItem >();\n\t\t\tactiveLayout.forEach( ( item ) => map.set( item.key, item ) );\n\t\t\treturn map;\n\t\t}, [ activeLayout ] );\n\n\t\t// Stable-identity key set, preserved across renders whenever the\n\t\t// *contents* of the key set are unchanged — even if the consumer\n\t\t// passes a fresh `layout` array reference (common when `layout`\n\t\t// is derived inline from state). Without this, downstream memos\n\t\t// would invalidate on every parent re-render and the children\n\t\t// walk skip during gestures wouldn't hold.\n\t\tconst layoutKeys = useMemo(\n\t\t\t() => new Set( layout.map( ( item ) => item.key ) ),\n\t\t\t[ layout ]\n\t\t);\n\n\t\t// Sorted item keys, identity-stable when the resulting sequence is\n\t\t// unchanged. Avoids producing a fresh `items` array on every parent\n\t\t// re-render so `<SortableContext>` doesn't update its context value\n\t\t// and notify every `useSortable` subscriber unnecessarily.\n\t\tconst sortedItems = useMemo(\n\t\t\t() =>\n\t\t\t\tactiveLayout\n\t\t\t\t\t.map( ( item, index ) => ( { item, index } ) )\n\t\t\t\t\t.sort(\n\t\t\t\t\t\t( a, b ) =>\n\t\t\t\t\t\t\t( a.item.order ?? a.index ) -\n\t\t\t\t\t\t\t( b.item.order ?? b.index )\n\t\t\t\t\t)\n\t\t\t\t\t.map( ( { item } ) => item.key ),\n\t\t\t[ activeLayout ]\n\t\t);\n\t\tconst items = sortedItems;\n\n\t\t// Resolve `width: 'fill'` items to concrete column spans.\n\t\tconst resolvedItemMap = useMemo( () => {\n\t\t\tconst fillWidths = resolveFillWidths(\n\t\t\t\titems,\n\t\t\t\tlayoutMap,\n\t\t\t\teffectiveColumns\n\t\t\t);\n\t\t\tif ( fillWidths.size === 0 ) {\n\t\t\t\treturn layoutMap;\n\t\t\t}\n\t\t\tconst map = new Map< string, DashboardGridLayoutItem >();\n\t\t\tfor ( const [ key, item ] of layoutMap ) {\n\t\t\t\tconst fillW = fillWidths.get( key );\n\t\t\t\tmap.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tfillW !== undefined ? { ...item, width: fillW } : item\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn map;\n\t\t}, [ items, layoutMap, effectiveColumns ] );\n\n\t\tconst [ childrenMap, actionableAreaMap, remaining, renderedByKey ] =\n\t\t\tuseMemo( () => {\n\t\t\t\tconst childMap = new Map< string, React.ReactElement >();\n\t\t\t\tconst actionableMap = new Map< string, React.ReactNode >();\n\t\t\t\tconst rest: React.ReactNode[] = [];\n\t\t\t\tconst byKey = new Map< string, React.ReactElement >();\n\n\t\t\t\tChildren.forEach( children, ( child ) => {\n\t\t\t\t\tif ( ! isValidElement( child ) ) {\n\t\t\t\t\t\trest.push( child );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst key = child.key?.toString();\n\t\t\t\t\tif ( ! key ) {\n\t\t\t\t\t\trest.push( child );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Strip `actionableArea` so it does not leak to the DOM;\n\t\t\t\t\t// the grid lifts it to a slot separately.\n\t\t\t\t\tconst { actionableArea } = child.props;\n\t\t\t\t\tconst stripped =\n\t\t\t\t\t\tactionableArea !== undefined\n\t\t\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\t\t\tactionableArea: undefined,\n\t\t\t\t\t\t\t } )\n\t\t\t\t\t\t\t: child;\n\n\t\t\t\t\tbyKey.set( key, stripped );\n\n\t\t\t\t\tif ( layoutKeys.has( key ) ) {\n\t\t\t\t\t\tif ( actionableArea !== undefined ) {\n\t\t\t\t\t\t\tactionableMap.set( key, actionableArea );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchildMap.set( key, stripped );\n\t\t\t\t\t} else {\n\t\t\t\t\t\trest.push( child );\n\t\t\t\t\t}\n\t\t\t\t} );\n\n\t\t\t\treturn [ childMap, actionableMap, rest, byKey ];\n\t\t\t}, [ children, layoutKeys ] );\n\n\t\t// Persist the latest rendered children so a removed tile's content\n\t\t// is still available for its exit overlay. Filled from an effect so a\n\t\t// discarded render never writes to the cache.\n\t\tuseLayoutEffect( () => {\n\t\t\tfor ( const [ key, child ] of renderedByKey ) {\n\t\t\t\tchildrenCacheRef.current.set( key, child );\n\t\t\t}\n\t\t}, [ renderedByKey ] );\n\n\t\tconst sensors = useSensors(\n\t\t\tuseSensor( PointerSensor ),\n\t\t\tuseSensor( KeyboardSensor, {\n\t\t\t\tcoordinateGetter: sortableKeyboardCoordinates,\n\t\t\t} )\n\t\t);\n\n\t\tconst handleDragStart = useEvent( ( event: DragStartEvent ) => {\n\t\t\tsetActiveId( String( event.active.id ) );\n\t\t\tlastReorderCursorRef.current = null;\n\t\t} );\n\n\t\tconst handleDragCancel = useEvent( () => {\n\t\t\tsetActiveId( null );\n\t\t\tlatestLayoutRef.current = undefined;\n\t\t\tlastReorderCursorRef.current = null;\n\t\t\tresizeBaselineRef.current = null;\n\t\t\tsetIsResizing( false );\n\t\t\tsetResizeSnapPreview( null );\n\t\t\tsetTemporaryLayout( undefined );\n\t\t} );\n\n\t\t// Re-evaluate the insertion slot on every pointer move, not\n\t\t// just when `over.id` changes — otherwise a \"swap back\" with\n\t\t// the cursor still on the same tile would never fire.\n\t\tconst handleDragMove = useEvent( ( event: DragMoveEvent ) => {\n\t\t\tconst { active, over } = event;\n\t\t\tif ( ! over || active.id === over.id ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst activeRect = active.rect.current.translated;\n\t\t\tif ( ! activeRect ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst activeCenterX = activeRect.left + activeRect.width / 2;\n\t\t\tconst activeCenterY = activeRect.top + activeRect.height / 2;\n\n\t\t\t// Skip re-measured events after a layout change: require\n\t\t\t// meaningful cursor movement between reorders.\n\t\t\tconst lastCursor = lastReorderCursorRef.current;\n\t\t\tif ( lastCursor ) {\n\t\t\t\tconst dx = activeCenterX - lastCursor.x;\n\t\t\t\tconst dy = activeCenterY - lastCursor.y;\n\t\t\t\tif ( dx * dx + dy * dy < 100 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst overCenterX = over.rect.left + over.rect.width / 2;\n\t\t\tconst insertAfter = activeCenterX > overCenterX;\n\n\t\t\tconst currentIndex = items.indexOf( String( active.id ) );\n\t\t\tconst overIndex = items.indexOf( String( over.id ) );\n\t\t\tlet newIndex: number;\n\t\t\tif ( insertAfter ) {\n\t\t\t\tnewIndex = currentIndex > overIndex ? overIndex + 1 : overIndex;\n\t\t\t} else {\n\t\t\t\tnewIndex = currentIndex > overIndex ? overIndex : overIndex - 1;\n\t\t\t}\n\t\t\tnewIndex = Math.max( 0, Math.min( newIndex, items.length - 1 ) );\n\n\t\t\tif ( newIndex === currentIndex ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst updatedItems = arrayMove( items, currentIndex, newIndex );\n\t\t\tconst updatedLayout = activeLayout.map( ( item ) => ( {\n\t\t\t\t...item,\n\t\t\t\torder: updatedItems.indexOf( item.key ),\n\t\t\t} ) );\n\n\t\t\tlastReorderCursorRef.current = {\n\t\t\t\tx: activeCenterX,\n\t\t\t\ty: activeCenterY,\n\t\t\t};\n\t\t\tlatestLayoutRef.current = updatedLayout;\n\t\t\tcaptureLayoutSnapshotRef.current();\n\t\t\tsetTemporaryLayout( updatedLayout );\n\t\t\tonPreviewLayout?.( updatedLayout );\n\t\t} );\n\n\t\t// Commit the latest temporary layout and clear local state.\n\t\t// Reads from the ref to bypass React's state batching.\n\t\tconst persistTemporaryLayout = useEvent( () => {\n\t\t\tconst latest = latestLayoutRef.current;\n\t\t\tlatestLayoutRef.current = undefined;\n\t\t\tresizeBaselineRef.current = null;\n\t\t\tsetIsResizing( false );\n\t\t\tsetResizeSnapPreview( null );\n\t\t\tif ( ! onChangeLayout || ! latest ) {\n\t\t\t\tsetTemporaryLayout( undefined );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonChangeLayout( latest );\n\t\t\tsetTemporaryLayout( undefined );\n\t\t} );\n\n\t\tconst handleResize = useEvent( ( id: string, delta: ResizeDelta ) => {\n\t\t\tif ( ! editMode ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! isResizing ) {\n\t\t\t\tsetIsResizing( true );\n\t\t\t}\n\n\t\t\tconst relativeDelta = {\n\t\t\t\twidth: Math.round( delta.width / ( columnWidth + gapPx ) ),\n\t\t\t\theight:\n\t\t\t\t\trowHeight === 'auto'\n\t\t\t\t\t\t? 0\n\t\t\t\t\t\t: Math.round( delta.height / ( rowHeight + gapPx ) ),\n\t\t\t};\n\n\t\t\t// Snapshot the baseline once at gesture start. The handle's\n\t\t\t// `delta` is absolute from the gesture start, so summing it\n\t\t\t// with the live (already mutated) `activeLayout` width would\n\t\t\t// compound and oscillate — and stepping back through the\n\t\t\t// zero-delta zone would never restore the original size.\n\t\t\tif ( ! resizeBaselineRef.current ) {\n\t\t\t\tconst baseItem = activeLayout.find(\n\t\t\t\t\t( item ) => item.key === id\n\t\t\t\t);\n\t\t\t\tconst resolvedItem = resolvedItemMap.get( id );\n\t\t\t\t// `'fill'`/`'full'` resize from the rendered span\n\t\t\t\t// and convert to a numeric width.\n\t\t\t\tlet baseWidth: number;\n\t\t\t\tif ( baseItem?.width === 'full' ) {\n\t\t\t\t\tbaseWidth = effectiveColumns;\n\t\t\t\t} else if ( baseItem?.width === 'fill' ) {\n\t\t\t\t\tbaseWidth =\n\t\t\t\t\t\ttypeof resolvedItem?.width === 'number'\n\t\t\t\t\t\t\t? resolvedItem.width\n\t\t\t\t\t\t\t: 1;\n\t\t\t\t} else {\n\t\t\t\t\tbaseWidth = baseItem?.width ?? 1;\n\t\t\t\t}\n\t\t\t\tresizeBaselineRef.current = {\n\t\t\t\t\twidth: baseWidth,\n\t\t\t\t\theight: baseItem?.height ?? 1,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst baseline = resizeBaselineRef.current;\n\t\t\tconst newWidth = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.min(\n\t\t\t\t\tbaseline.width + relativeDelta.width,\n\t\t\t\t\teffectiveColumns\n\t\t\t\t)\n\t\t\t);\n\t\t\tconst newHeight = Math.max(\n\t\t\t\t1,\n\t\t\t\tbaseline.height + relativeDelta.height\n\t\t\t);\n\n\t\t\tsetResizeSnapPreview( {\n\t\t\t\tid,\n\t\t\t\tsnap: gridSpanToPixelSize(\n\t\t\t\t\tnewWidth,\n\t\t\t\t\tnewHeight,\n\t\t\t\t\tcolumnWidth,\n\t\t\t\t\tgapPx,\n\t\t\t\t\trowHeightPx\n\t\t\t\t),\n\t\t\t} );\n\n\t\t\t// Bail when the snapped size matches the layout already\n\t\t\t// staged for commit. The tile still tracks the cursor\n\t\t\t// continuously; only the preview outline and pending commit\n\t\t\t// need updating when the snap target changes.\n\t\t\tconst pendingItem = latestLayoutRef.current?.find(\n\t\t\t\t( item ) => item.key === id\n\t\t\t);\n\t\t\tconst currentItem =\n\t\t\t\tpendingItem ?? activeLayout.find( ( item ) => item.key === id );\n\t\t\tif (\n\t\t\t\tcurrentItem &&\n\t\t\t\tcurrentItem.width === newWidth &&\n\t\t\t\t( currentItem.height ?? 1 ) === newHeight\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst updatedLayout = activeLayout.map( ( item ) =>\n\t\t\t\titem.key === id\n\t\t\t\t\t? { ...item, width: newWidth, height: newHeight }\n\t\t\t\t\t: item\n\t\t\t);\n\n\t\t\tlatestLayoutRef.current = updatedLayout;\n\t\t\tcaptureLayoutSnapshotRef.current();\n\t\t\tsetTemporaryLayout( updatedLayout );\n\t\t\tonPreviewLayout?.( updatedLayout );\n\t\t} );\n\n\t\t// Drag-overlay clone composition: the surface always wraps with a\n\t\t// thin functional frame (lift, cursor, pointer pass-through). When\n\t\t// `renderDragPreview` is supplied, the consumer's wrapper sits\n\t\t// inside the frame around the cloned children; otherwise the\n\t\t// cloned children render directly so any persistent chrome on\n\t\t// them carries through unchanged.\n\t\tconst activeClone = activeId ? childrenMap.get( activeId ) : null;\n\t\tconst DragPreview = renderDragPreview;\n\t\tconst dragOverlayContent =\n\t\t\tactiveId && activeClone ? (\n\t\t\t\t<div className={ styles[ 'drag-preview-frame' ] }>\n\t\t\t\t\t<div className={ styles[ 'drag-preview-frame__lift' ] }>\n\t\t\t\t\t\t{ DragPreview ? (\n\t\t\t\t\t\t\t<DragPreview itemId={ activeId }>\n\t\t\t\t\t\t\t\t{ activeClone }\n\t\t\t\t\t\t\t</DragPreview>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tactiveClone\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : null;\n\n\t\t// Edit-mode background. Rendered unconditionally so it can\n\t\t// cross-fade on edit-mode toggles (`isActive` drives the\n\t\t// transition); memoized so drag/resize re-renders skip it while\n\t\t// inputs are stable. A numeric `rowHeight` adds row markers;\n\t\t// `'auto'` collapses to `undefined` and omits them.\n\t\tconst Overlay = renderGridOverlay ?? GridOverlay;\n\t\tconst overlayRowHeight =\n\t\t\ttypeof rowHeight === 'number' ? rowHeight : undefined;\n\t\tconst overlayRows = useMemo( () => {\n\t\t\tif ( overlayRowHeight === undefined || containerHeight <= 0 ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst rowTile = overlayRowHeight + gapPx;\n\t\t\treturn Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.floor( ( containerHeight + gapPx ) / rowTile )\n\t\t\t);\n\t\t}, [ overlayRowHeight, containerHeight, gapPx ] );\n\t\tconst gridOverlay = useMemo(\n\t\t\t() => (\n\t\t\t\t<Overlay\n\t\t\t\t\tcolumns={ effectiveColumns }\n\t\t\t\t\trowHeight={ overlayRowHeight }\n\t\t\t\t\trows={ overlayRows }\n\t\t\t\t\tisActive={ editMode }\n\t\t\t\t/>\n\t\t\t),\n\t\t\t[\n\t\t\t\tOverlay,\n\t\t\t\teditMode,\n\t\t\t\teffectiveColumns,\n\t\t\t\toverlayRowHeight,\n\t\t\t\toverlayRows,\n\t\t\t]\n\t\t);\n\n\t\tconst layoutFingerprint = useMemo(\n\t\t\t() => getLayoutFingerprint( [ ...resolvedItemMap.values() ] ),\n\t\t\t[ resolvedItemMap ]\n\t\t);\n\t\tconst excludeLayoutAnimationKey =\n\t\t\tactiveId ?? ( isResizing ? resizeSnapPreview?.id : null );\n\t\tconst { captureLayoutSnapshot, getPositionsBeforeLastChange } =\n\t\t\tuseLayoutShiftAnimation( {\n\t\t\t\tcontainer: gridRoot,\n\t\t\t\tenabled: editMode,\n\t\t\t\tlayoutFingerprint,\n\t\t\t\texcludeItemKey: excludeLayoutAnimationKey,\n\t\t\t} );\n\t\tconst { exitingItems, clearExitingItem } = useItemExitAnimation( {\n\t\t\tcontainer: gridRoot,\n\t\t\tenabled: editMode,\n\t\t\tlayoutKeys,\n\t\t\tgetPositionsBeforeLastChange,\n\t\t\tchildrenCacheRef,\n\t\t} );\n\t\t// Transform transitions on tiles for FLIP (drag, resize, removal).\n\t\tconst layoutAnimating = editMode;\n\t\tuseLayoutEffect( () => {\n\t\t\tcaptureLayoutSnapshotRef.current = captureLayoutSnapshot;\n\t\t}, [ captureLayoutSnapshot ] );\n\n\t\treturn (\n\t\t\t<DndContext\n\t\t\t\tsensors={ sensors }\n\t\t\t\tonDragStart={ handleDragStart }\n\t\t\t\tonDragCancel={ handleDragCancel }\n\t\t\t\tonDragMove={ handleDragMove }\n\t\t\t\tonDragEnd={ () => {\n\t\t\t\t\tpersistTemporaryLayout();\n\t\t\t\t\tlastReorderCursorRef.current = null;\n\t\t\t\t\tsetActiveId( null );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ /* No-op strategy: reorder comes from `temporaryLayout`\n\t\t\t\t + CSS Grid, not dnd-kit transforms. */ }\n\t\t\t\t<SortableContext items={ items } strategy={ NO_SORT_STRATEGY }>\n\t\t\t\t\t<div\n\t\t\t\t\t\t{ ...divProps }\n\t\t\t\t\t\tref={ mergedGridRef }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tstyles.grid,\n\t\t\t\t\t\t\tlayoutAnimating &&\n\t\t\t\t\t\t\t\tlayoutAnimationStyles[ 'layout-animating' ],\n\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tdata-wp-grid-dragging={ activeId || undefined }\n\t\t\t\t\t\tdata-wp-grid-resizing={ isResizing || undefined }\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tgridTemplateColumns: `repeat(${ effectiveColumns }, minmax(0, 1fr))`,\n\t\t\t\t\t\t\tgridAutoRows: rowHeight,\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ gridOverlay }\n\t\t\t\t\t\t{ items.map( ( id ) => (\n\t\t\t\t\t\t\t<GridItem\n\t\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t\titem={\n\t\t\t\t\t\t\t\t\tresolvedItemMap.get(\n\t\t\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t\t\t) as DashboardGridLayoutItem\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmaxColumns={ effectiveColumns }\n\t\t\t\t\t\t\t\tdisabled={ ! editMode }\n\t\t\t\t\t\t\t\tverticalResizable={ rowHeight !== 'auto' }\n\t\t\t\t\t\t\t\tinteracting={ activeId !== null || isResizing }\n\t\t\t\t\t\t\t\tdragging={ activeId !== null }\n\t\t\t\t\t\t\t\tonResize={ handleResize }\n\t\t\t\t\t\t\t\tonResizeEnd={ persistTemporaryLayout }\n\t\t\t\t\t\t\t\tresizeSnapPreview={\n\t\t\t\t\t\t\t\t\tresizeSnapPreview?.id === id\n\t\t\t\t\t\t\t\t\t\t? resizeSnapPreview.snap\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tminResizeWidthPx={ minResizeWidthPx }\n\t\t\t\t\t\t\t\tminResizeHeightPx={ minResizeHeightPx }\n\t\t\t\t\t\t\t\tactionableArea={ actionableAreaMap.get( id ) }\n\t\t\t\t\t\t\t\trenderResizeHandle={ renderResizeHandle }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ childrenMap.get( id ) }\n\t\t\t\t\t\t\t</GridItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t{ remaining }\n\t\t\t\t\t\t{ exitingItems.map( ( { key, rect, child } ) => (\n\t\t\t\t\t\t\t<ItemExitOverlay\n\t\t\t\t\t\t\t\tkey={ `exiting-${ key }` }\n\t\t\t\t\t\t\t\titemKey={ key }\n\t\t\t\t\t\t\t\trect={ rect }\n\t\t\t\t\t\t\t\tonAnimationEnd={ () => clearExitingItem( key ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ child }\n\t\t\t\t\t\t\t</ItemExitOverlay>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</div>\n\t\t\t\t</SortableContext>\n\t\t\t\t<DragOverlay dropAnimation={ dashboardDragDropAnimation }>\n\t\t\t\t\t{ dragOverlayContent }\n\t\t\t\t</DragOverlay>\n\t\t\t</DndContext>\n\t\t);\n\t}\n);\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"9e5573e51f\", \"._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}@media (prefers-reduced-motion:reduce){._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:none}}\");\n}\nexport default {\"layout-animating\":\"_2db63116caa90ae9__layout-animating\"};\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"52d51e7d5c\", \"._960c435c33759f46__grid{display:grid;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));position:relative}._48e8cd4225dcb813__drag-preview-frame{border-radius:var(--wp-grid-drag-preview-radius,0);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);cursor:grabbing;height:100%;pointer-events:none}._4b471bf24f891d2d__drag-preview-frame__lift{height:100%;transform:scale(var(--wp-grid-drag-preview-scale,1.05));transform-origin:center}@media not (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame{animation:_08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}._4b471bf24f891d2d__drag-preview-frame__lift{animation:_8aaeb335436989f9__wp-grid-drag-preview-scale-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}}@media not (prefers-reduced-motion:reduce){@keyframes _08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter{0%{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}to{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}}@keyframes _8aaeb335436989f9__wp-grid-drag-preview-scale-enter{0%{transform:scale(1)}to{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}}}@media not (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{animation:a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{animation:_234ccad5c20d49f8__wp-grid-drag-preview-scale-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}@keyframes a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit{0%{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}to{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}}@keyframes _234ccad5c20d49f8__wp-grid-drag-preview-scale-exit{0%{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}to{transform:scale(1)}}}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{transform:scale(1)}@media (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}._4b471bf24f891d2d__drag-preview-frame__lift{transform:none}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003);transition:none}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{transition:none}}\");\n}\nexport default {\"grid\":\"_960c435c33759f46__grid\",\"drag-preview-frame\":\"_48e8cd4225dcb813__drag-preview-frame\",\"drag-preview-frame__lift\":\"_4b471bf24f891d2d__drag-preview-frame__lift\",\"wp-grid-drag-preview-shadow-enter\":\"_08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter\",\"wp-grid-drag-preview-scale-enter\":\"_8aaeb335436989f9__wp-grid-drag-preview-scale-enter\",\"dragPreviewFrameExiting\":\"_66b0aefb2bc02eb9__dragPreviewFrameExiting\",\"wp-grid-drag-preview-shadow-exit\":\"a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit\",\"wp-grid-drag-preview-scale-exit\":\"_234ccad5c20d49f8__wp-grid-drag-preview-scale-exit\"};\n"],
5
+ "mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAEP,OAAO,UAAU;AAKjB,SAAS,mBAAmB,UAAU,oBAAoB;AAC1D;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,2BAA2B;;;AC7BpC,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAU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AAA,kBAAC;AAAA;AAAA,oBAEA,SAAU;AAAA,oBACV;AAAA,oBACA,gBAAiB,MAAM,iBAAkB,GAAI;AAAA,oBAE3C;AAAA;AAAA,kBALI,WAAY,GAAI;AAAA,gBAMvB,CACC;AAAA;AAAA;AAAA,UACH,GACD;AAAA,UACA,oBAAC,eAAY,eAAgB,4BAC1B,8BACH;AAAA;AAAA;AAAA,IACD;AAAA,EAEF;AACD;",
6
+ "names": ["DashboardGrid"]
7
+ }
@@ -0,0 +1,164 @@
1
+ // packages/grid/src/dashboard-grid/resolve-fill-widths.ts
2
+ function resolveFillWidths(sortedKeys, layoutMap, maxColumns) {
3
+ const resolved = /* @__PURE__ */ new Map();
4
+ const n = sortedKeys.length;
5
+ const items = new Array(n);
6
+ const widths = new Array(n);
7
+ const heights = new Array(n);
8
+ let hasFill = false;
9
+ let hasMultiRow = false;
10
+ let totalRows = 0;
11
+ for (let i = 0; i < n; i++) {
12
+ const item = layoutMap.get(sortedKeys[i]);
13
+ items[i] = item;
14
+ widths[i] = item && typeof item.width === "number" ? Math.min(item.width, maxColumns) : 1;
15
+ const h = Math.max(1, Math.floor(item?.height ?? 1));
16
+ heights[i] = h;
17
+ if (item?.width === "fill") {
18
+ hasFill = true;
19
+ }
20
+ if (h > 1) {
21
+ hasMultiRow = true;
22
+ }
23
+ totalRows += h;
24
+ }
25
+ if (!hasFill) {
26
+ return resolved;
27
+ }
28
+ if (!hasMultiRow) {
29
+ let currentCol = 0;
30
+ for (let i = 0; i < n; i++) {
31
+ const item = items[i];
32
+ if (!item) {
33
+ continue;
34
+ }
35
+ if (item.width === "full") {
36
+ currentCol = 0;
37
+ continue;
38
+ }
39
+ if (item.width === "fill") {
40
+ let reserved = 0;
41
+ for (let j = i + 1; j < n; j++) {
42
+ const next = items[j];
43
+ if (!next || next.width === "full" || next.width === "fill") {
44
+ break;
45
+ }
46
+ const nextW = widths[j];
47
+ if (currentCol + 1 + reserved + nextW <= maxColumns) {
48
+ reserved += nextW;
49
+ } else {
50
+ break;
51
+ }
52
+ }
53
+ const fillCols = Math.max(
54
+ 1,
55
+ maxColumns - currentCol - reserved
56
+ );
57
+ resolved.set(item.key, fillCols);
58
+ currentCol += fillCols;
59
+ } else {
60
+ const w = widths[i];
61
+ if (currentCol + w > maxColumns) {
62
+ currentCol = 0;
63
+ }
64
+ currentCol += w;
65
+ }
66
+ if (currentCol >= maxColumns) {
67
+ currentCol = 0;
68
+ }
69
+ }
70
+ return resolved;
71
+ }
72
+ const rowOccupancy = new Array(maxColumns).fill(0);
73
+ let cursorRow = 0;
74
+ let cursorCol = 0;
75
+ for (let i = 0; i < n; i++) {
76
+ const item = items[i];
77
+ if (!item) {
78
+ continue;
79
+ }
80
+ const h = heights[i];
81
+ if (item.width === "full") {
82
+ let r2 = cursorRow;
83
+ for (let c2 = 0; c2 < maxColumns; c2++) {
84
+ if (rowOccupancy[c2] > r2) {
85
+ r2 = rowOccupancy[c2];
86
+ }
87
+ }
88
+ for (let c2 = 0; c2 < maxColumns; c2++) {
89
+ rowOccupancy[c2] = r2 + h;
90
+ }
91
+ cursorRow = r2 + h;
92
+ cursorCol = 0;
93
+ continue;
94
+ }
95
+ if (item.width === "fill") {
96
+ let r2 = cursorRow;
97
+ let c2 = cursorCol;
98
+ scan: for (; r2 <= totalRows; r2++) {
99
+ const start = r2 === cursorRow ? cursorCol : 0;
100
+ for (c2 = start; c2 < maxColumns; c2++) {
101
+ if (rowOccupancy[c2] <= r2) {
102
+ break scan;
103
+ }
104
+ }
105
+ }
106
+ const fillStartRow = r2;
107
+ const fillStartCol = c2;
108
+ let runLength = 0;
109
+ while (fillStartCol + runLength < maxColumns && rowOccupancy[fillStartCol + runLength] <= fillStartRow) {
110
+ runLength++;
111
+ }
112
+ let reserved = 0;
113
+ for (let j = i + 1; j < n; j++) {
114
+ const next = items[j];
115
+ if (!next || next.width === "full" || next.width === "fill") {
116
+ break;
117
+ }
118
+ const nextW = widths[j];
119
+ if (1 + reserved + nextW <= runLength) {
120
+ reserved += nextW;
121
+ } else {
122
+ break;
123
+ }
124
+ }
125
+ const fillCols = Math.max(1, runLength - reserved);
126
+ resolved.set(item.key, fillCols);
127
+ for (let k = 0; k < fillCols; k++) {
128
+ rowOccupancy[fillStartCol + k] = fillStartRow + h;
129
+ }
130
+ cursorRow = fillStartRow;
131
+ cursorCol = fillStartCol + fillCols;
132
+ continue;
133
+ }
134
+ const w = widths[i];
135
+ let r = cursorRow;
136
+ let c = cursorCol;
137
+ place: for (; r <= totalRows; r++) {
138
+ c = r === cursorRow ? cursorCol : 0;
139
+ while (c + w <= maxColumns) {
140
+ let blocked = -1;
141
+ for (let k = 0; k < w; k++) {
142
+ if (rowOccupancy[c + k] > r) {
143
+ blocked = c + k;
144
+ break;
145
+ }
146
+ }
147
+ if (blocked === -1) {
148
+ break place;
149
+ }
150
+ c = blocked + 1;
151
+ }
152
+ }
153
+ for (let k = 0; k < w; k++) {
154
+ rowOccupancy[c + k] = r + h;
155
+ }
156
+ cursorRow = r;
157
+ cursorCol = c + w;
158
+ }
159
+ return resolved;
160
+ }
161
+ export {
162
+ resolveFillWidths
163
+ };
164
+ //# sourceMappingURL=resolve-fill-widths.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dashboard-grid/resolve-fill-widths.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { DashboardGridLayoutItem } from './types';\n\n/**\n * Resolves items with `width: 'fill'` by computing how many columns they\n * should span. Simulates CSS Grid's row-sparse auto-flow placement so the\n * resolved span matches the free run that CSS Grid will actually use.\n *\n * Two paths:\n * - Fast path (no `height > 1` items): single-row column tracker, O(n).\n * Each fixed item between two fills is visited at most once by a fill's\n * look-ahead.\n * - Multi-row path (any item with `height > 1`): per-column skyline that\n * tracks shadow occupation of tall tiles. Placement scans rows in\n * row-major order, so worst-case cost depends on both columns and rows\n * scanned (rows bounded by the sum of item heights), not only on\n * `maxColumns`.\n *\n * @param sortedKeys - Item keys in display order.\n * @param layoutMap - Map of key to DashboardGridLayoutItem.\n * @param maxColumns - Total columns in the grid.\n * @return Map of fill item keys to their resolved column spans.\n */\nexport function resolveFillWidths(\n\tsortedKeys: string[],\n\tlayoutMap: Map< string, DashboardGridLayoutItem >,\n\tmaxColumns: number\n): Map< string, number > {\n\tconst resolved = new Map< string, number >();\n\tconst n = sortedKeys.length;\n\n\t// Pre-extract items, clamp widths and heights, detect which path to take.\n\tconst items = new Array< DashboardGridLayoutItem | undefined >( n );\n\tconst widths = new Array< number >( n );\n\tconst heights = new Array< number >( n );\n\tlet hasFill = false;\n\tlet hasMultiRow = false;\n\tlet totalRows = 0;\n\n\tfor ( let i = 0; i < n; i++ ) {\n\t\tconst item = layoutMap.get( sortedKeys[ i ] );\n\t\titems[ i ] = item;\n\t\twidths[ i ] =\n\t\t\titem && typeof item.width === 'number'\n\t\t\t\t? Math.min( item.width, maxColumns )\n\t\t\t\t: 1;\n\t\t// Clamp to a positive integer so `0`, fractional, or negative\n\t\t// values match the `|| 1` defaulting used in GridItem styles.\n\t\tconst h = Math.max( 1, Math.floor( item?.height ?? 1 ) );\n\t\theights[ i ] = h;\n\t\tif ( item?.width === 'fill' ) {\n\t\t\thasFill = true;\n\t\t}\n\t\tif ( h > 1 ) {\n\t\t\thasMultiRow = true;\n\t\t}\n\t\ttotalRows += h;\n\t}\n\n\tif ( ! hasFill ) {\n\t\treturn resolved;\n\t}\n\n\tif ( ! hasMultiRow ) {\n\t\tlet currentCol = 0;\n\n\t\tfor ( let i = 0; i < n; i++ ) {\n\t\t\tconst item = items[ i ];\n\t\t\tif ( ! item ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ( item.width === 'full' ) {\n\t\t\t\tcurrentCol = 0;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ( item.width === 'fill' ) {\n\t\t\t\tlet reserved = 0;\n\t\t\t\tfor ( let j = i + 1; j < n; j++ ) {\n\t\t\t\t\tconst next = items[ j ];\n\t\t\t\t\tif (\n\t\t\t\t\t\t! next ||\n\t\t\t\t\t\tnext.width === 'full' ||\n\t\t\t\t\t\tnext.width === 'fill'\n\t\t\t\t\t) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tconst nextW = widths[ j ];\n\t\t\t\t\tif ( currentCol + 1 + reserved + nextW <= maxColumns ) {\n\t\t\t\t\t\treserved += nextW;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst fillCols = Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\tmaxColumns - currentCol - reserved\n\t\t\t\t);\n\t\t\t\tresolved.set( item.key, fillCols );\n\t\t\t\tcurrentCol += fillCols;\n\t\t\t} else {\n\t\t\t\tconst w = widths[ i ];\n\t\t\t\tif ( currentCol + w > maxColumns ) {\n\t\t\t\t\tcurrentCol = 0;\n\t\t\t\t}\n\t\t\t\tcurrentCol += w;\n\t\t\t}\n\n\t\t\tif ( currentCol >= maxColumns ) {\n\t\t\t\tcurrentCol = 0;\n\t\t\t}\n\t\t}\n\n\t\treturn resolved;\n\t}\n\n\t// `rowOccupancy[ col ]` is the index of the next free row at that\n\t// column; rows below it are taken by previously placed items. This\n\t// captures the \"shadow\" of tall tiles into the rows they span.\n\tconst rowOccupancy = new Array< number >( maxColumns ).fill( 0 );\n\tlet cursorRow = 0;\n\tlet cursorCol = 0;\n\n\tfor ( let i = 0; i < n; i++ ) {\n\t\tconst item = items[ i ];\n\t\tif ( ! item ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst h = heights[ i ];\n\n\t\tif ( item.width === 'full' ) {\n\t\t\tlet r = cursorRow;\n\t\t\tfor ( let c = 0; c < maxColumns; c++ ) {\n\t\t\t\tif ( rowOccupancy[ c ] > r ) {\n\t\t\t\t\tr = rowOccupancy[ c ];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor ( let c = 0; c < maxColumns; c++ ) {\n\t\t\t\trowOccupancy[ c ] = r + h;\n\t\t\t}\n\t\t\tcursorRow = r + h;\n\t\t\tcursorCol = 0;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( item.width === 'fill' ) {\n\t\t\tlet r = cursorRow;\n\t\t\tlet c = cursorCol;\n\t\t\tscan: for ( ; r <= totalRows; r++ ) {\n\t\t\t\tconst start = r === cursorRow ? cursorCol : 0;\n\t\t\t\tfor ( c = start; c < maxColumns; c++ ) {\n\t\t\t\t\tif ( rowOccupancy[ c ] <= r ) {\n\t\t\t\t\t\tbreak scan;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst fillStartRow = r;\n\t\t\tconst fillStartCol = c;\n\t\t\tlet runLength = 0;\n\t\t\twhile (\n\t\t\t\tfillStartCol + runLength < maxColumns &&\n\t\t\t\trowOccupancy[ fillStartCol + runLength ] <= fillStartRow\n\t\t\t) {\n\t\t\t\trunLength++;\n\t\t\t}\n\t\t\tlet reserved = 0;\n\t\t\tfor ( let j = i + 1; j < n; j++ ) {\n\t\t\t\tconst next = items[ j ];\n\t\t\t\tif (\n\t\t\t\t\t! next ||\n\t\t\t\t\tnext.width === 'full' ||\n\t\t\t\t\tnext.width === 'fill'\n\t\t\t\t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst nextW = widths[ j ];\n\t\t\t\tif ( 1 + reserved + nextW <= runLength ) {\n\t\t\t\t\treserved += nextW;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst fillCols = Math.max( 1, runLength - reserved );\n\t\t\tresolved.set( item.key, fillCols );\n\t\t\tfor ( let k = 0; k < fillCols; k++ ) {\n\t\t\t\trowOccupancy[ fillStartCol + k ] = fillStartRow + h;\n\t\t\t}\n\t\t\tcursorRow = fillStartRow;\n\t\t\tcursorCol = fillStartCol + fillCols;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst w = widths[ i ];\n\t\tlet r = cursorRow;\n\t\tlet c = cursorCol;\n\t\tplace: for ( ; r <= totalRows; r++ ) {\n\t\t\tc = r === cursorRow ? cursorCol : 0;\n\t\t\twhile ( c + w <= maxColumns ) {\n\t\t\t\tlet blocked = -1;\n\t\t\t\tfor ( let k = 0; k < w; k++ ) {\n\t\t\t\t\tif ( rowOccupancy[ c + k ] > r ) {\n\t\t\t\t\t\tblocked = c + k;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( blocked === -1 ) {\n\t\t\t\t\tbreak place;\n\t\t\t\t}\n\t\t\t\tc = blocked + 1;\n\t\t\t}\n\t\t}\n\t\tfor ( let k = 0; k < w; k++ ) {\n\t\t\trowOccupancy[ c + k ] = r + h;\n\t\t}\n\t\tcursorRow = r;\n\t\tcursorCol = c + w;\n\t}\n\n\treturn resolved;\n}\n"],
5
+ "mappings": ";AAyBO,SAAS,kBACf,YACA,WACA,YACwB;AACxB,QAAM,WAAW,oBAAI,IAAsB;AAC3C,QAAM,IAAI,WAAW;AAGrB,QAAM,QAAQ,IAAI,MAA8C,CAAE;AAClE,QAAM,SAAS,IAAI,MAAiB,CAAE;AACtC,QAAM,UAAU,IAAI,MAAiB,CAAE;AACvC,MAAI,UAAU;AACd,MAAI,cAAc;AAClB,MAAI,YAAY;AAEhB,WAAU,IAAI,GAAG,IAAI,GAAG,KAAM;AAC7B,UAAM,OAAO,UAAU,IAAK,WAAY,CAAE,CAAE;AAC5C,UAAO,CAAE,IAAI;AACb,WAAQ,CAAE,IACT,QAAQ,OAAO,KAAK,UAAU,WAC3B,KAAK,IAAK,KAAK,OAAO,UAAW,IACjC;AAGJ,UAAM,IAAI,KAAK,IAAK,GAAG,KAAK,MAAO,MAAM,UAAU,CAAE,CAAE;AACvD,YAAS,CAAE,IAAI;AACf,QAAK,MAAM,UAAU,QAAS;AAC7B,gBAAU;AAAA,IACX;AACA,QAAK,IAAI,GAAI;AACZ,oBAAc;AAAA,IACf;AACA,iBAAa;AAAA,EACd;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I,IAAI;AACR,UAAO,QAAQ,KAAK,WAAW,KAAM;AACpC,UAAI,MAAM,YAAY,YAAY;AAClC,aAAQ,IAAI,KAAK,YAAa;AAC7B,YAAI,UAAU;AACd,iBAAU,IAAI,GAAG,IAAI,GAAG,KAAM;AAC7B,cAAK,aAAc,IAAI,CAAE,IAAI,GAAI;AAChC,sBAAU,IAAI;AACd;AAAA,UACD;AAAA,QACD;AACA,YAAK,YAAY,IAAK;AACrB,gBAAM;AAAA,QACP;AACA,YAAI,UAAU;AAAA,MACf;AAAA,IACD;AACA,aAAU,IAAI,GAAG,IAAI,GAAG,KAAM;AAC7B,mBAAc,IAAI,CAAE,IAAI,IAAI;AAAA,IAC7B;AACA,gBAAY;AACZ,gBAAY,IAAI;AAAA,EACjB;AAEA,SAAO;AACR;",
6
+ "names": ["r", "c"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }