@wordpress/grid 0.11.0 → 0.13.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.
- package/build/dashboard-grid/grid-item.cjs +10 -8
- package/build/dashboard-grid/grid-item.cjs.map +1 -1
- package/build/dashboard-grid/index.cjs +20 -18
- package/build/dashboard-grid/index.cjs.map +1 -1
- package/build/dashboard-lanes/index.cjs +19 -17
- package/build/dashboard-lanes/index.cjs.map +1 -1
- package/build/dashboard-lanes/lane-placement.cjs +1 -1
- package/build/dashboard-lanes/lanes-item.cjs +10 -8
- package/build/dashboard-lanes/lanes-item.cjs.map +1 -1
- package/build/dashboard-lanes/use-lane-placement.cjs.map +1 -1
- package/build/shared/grid-overlay.cjs +16 -14
- package/build/shared/grid-overlay.cjs.map +1 -1
- package/build/shared/resize-handle.cjs +9 -7
- package/build/shared/resize-handle.cjs.map +1 -1
- package/build/shared/resize-snap.cjs +1 -1
- package/build/shared/use-item-exit-animation.cjs.map +1 -1
- package/build/shared/use-layout-shift-animation.cjs.map +1 -1
- package/build-module/dashboard-grid/index.mjs +11 -11
- package/build-module/dashboard-grid/index.mjs.map +1 -1
- package/build-module/dashboard-lanes/index.mjs +10 -10
- package/build-module/dashboard-lanes/index.mjs.map +1 -1
- package/build-module/dashboard-lanes/lane-placement.mjs +1 -1
- package/build-module/shared/grid-overlay.mjs +7 -7
- package/build-module/shared/grid-overlay.mjs.map +1 -1
- package/build-module/shared/resize-snap.mjs +1 -1
- package/build-module/shared/use-layout-shift-animation.mjs.map +1 -1
- package/package.json +14 -12
- package/src/dashboard-grid/{grid.module.css → grid.module.scss} +10 -19
- package/src/dashboard-grid/index.tsx +1 -1
- package/src/dashboard-lanes/index.tsx +2 -2
- package/src/dashboard-lanes/{lanes.module.css → lanes.module.scss} +10 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["createDashboardDragDropAnimation","styles","forwardRef","useState","useRef","useResizeObserver","useMergeRefs","useMemo","resolveColumnCount","gridSpanToPixelSize","useSpanBounds","useResizePixelLimits","clampSpan","useLanePlacement","isValidElement","cloneElement","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","useEvent","arrayMoveWithPinned","GridOverlay","getLayoutFingerprint","getPlacementFingerprint","useLayoutShiftAnimation","useItemExitAnimation","DndContext","SortableContext","layoutAnimationStyles","LanesItem","ItemExitOverlay","DragOverlay"],"sources":["../../../style-runtime/src/index.ts","../../src/shared/layout-shift-animation.module.css","../../src/dashboard-lanes/lanes.module.css","../../src/dashboard-lanes/index.tsx"],"sourcesContent":["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(\"5d10111ab0\", \".c68bb75eb6bf717a__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){.c68bb75eb6bf717a__layout-animating [data-wp-grid-item-key]{transition:none}}\");\n}\nexport default {\"layout-animating\":\"c68bb75eb6bf717a__layout-animating\"};\n","import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"6b5b6b8d59\", \"._279d14c775dbbe7a__lanes{column-gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));display:grid-lanes;position:relative;row-gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px))}@supports not (display:grid-lanes){._279d14c775dbbe7a__lanes{display:grid;grid-auto-flow:dense;grid-auto-rows:var(--wp-grid-lane-row-unit,4px);row-gap:0}}.cf1a25111e009cff__drag-preview-frame{--_wp-grid-elevation-xs:0 1px 1px rgba(0,0,0,.03),0 1px 2px rgba(0,0,0,.02),0 3px 3px rgba(0,0,0,.02),0 4px 4px rgba(0,0,0,.01);--_wp-grid-elevation-md:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);border-radius:var(--wp-grid-drag-preview-radius,0);box-shadow:var(--_wp-grid-elevation-md);cursor:grabbing;height:100%;pointer-events:none}._1670330318f73437__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){.cf1a25111e009cff__drag-preview-frame{animation:c44ad0dc1d6b976a__wp-grid-drag-preview-shadow-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}._1670330318f73437__drag-preview-frame__lift{animation:dba9b43a556bb015__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 c44ad0dc1d6b976a__wp-grid-drag-preview-shadow-enter{0%{box-shadow:var(--_wp-grid-elevation-xs)}to{box-shadow:var(--_wp-grid-elevation-md)}}@keyframes dba9b43a556bb015__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){.cf1a25111e009cff__drag-preview-frame._44fd9c611b434255__is-exiting{animation:_5f907efa9ff8caac__wp-grid-drag-preview-shadow-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}.cf1a25111e009cff__drag-preview-frame._44fd9c611b434255__is-exiting ._1670330318f73437__drag-preview-frame__lift{animation:a91293ba67737ef7__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 _5f907efa9ff8caac__wp-grid-drag-preview-shadow-exit{0%{box-shadow:var(--_wp-grid-elevation-md)}to{box-shadow:var(--_wp-grid-elevation-xs)}}@keyframes a91293ba67737ef7__wp-grid-drag-preview-scale-exit{0%{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}to{transform:scale(1)}}}.cf1a25111e009cff__drag-preview-frame._44fd9c611b434255__is-exiting{box-shadow:var(--_wp-grid-elevation-xs)}.cf1a25111e009cff__drag-preview-frame._44fd9c611b434255__is-exiting ._1670330318f73437__drag-preview-frame__lift{transform:scale(1)}@media (prefers-reduced-motion:reduce){.cf1a25111e009cff__drag-preview-frame{box-shadow:var(--_wp-grid-elevation-md)}._1670330318f73437__drag-preview-frame__lift{transform:none}.cf1a25111e009cff__drag-preview-frame._44fd9c611b434255__is-exiting{box-shadow:var(--_wp-grid-elevation-xs);transition:none}.cf1a25111e009cff__drag-preview-frame._44fd9c611b434255__is-exiting ._1670330318f73437__drag-preview-frame__lift{transition:none}}\");\n}\nexport default {\"lanes\":\"_279d14c775dbbe7a__lanes\",\"drag-preview-frame\":\"cf1a25111e009cff__drag-preview-frame\",\"drag-preview-frame__lift\":\"_1670330318f73437__drag-preview-frame__lift\",\"wp-grid-drag-preview-shadow-enter\":\"c44ad0dc1d6b976a__wp-grid-drag-preview-shadow-enter\",\"wp-grid-drag-preview-scale-enter\":\"dba9b43a556bb015__wp-grid-drag-preview-scale-enter\",\"is-exiting\":\"_44fd9c611b434255__is-exiting\",\"wp-grid-drag-preview-shadow-exit\":\"_5f907efa9ff8caac__wp-grid-drag-preview-shadow-exit\",\"wp-grid-drag-preview-scale-exit\":\"a91293ba67737ef7__wp-grid-drag-preview-scale-exit\"};\n","import {\n\tDndContext,\n\tDragOverlay,\n\tKeyboardSensor,\n\tPointerSensor,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core';\nimport {\n\tSortableContext,\n\tsortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport type { DragMoveEvent, DragStartEvent } from '@dnd-kit/core';\nimport clsx from 'clsx';\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';\nimport { LanesItem } from './lanes-item';\nimport { useLanePlacement } from './use-lane-placement';\nimport { arrayMoveWithPinned } from '../shared/array-move-with-pinned';\nimport { resolveColumnCount } from '../shared/column-policy';\nimport { GridOverlay } from '../shared/grid-overlay';\nimport { clampSpan, gridSpanToPixelSize } from '../shared/resize-snap';\nimport { useResizePixelLimits, useSpanBounds } from '../shared/use-span-bounds';\nimport layoutAnimationStyles from '../shared/layout-shift-animation.module.css';\nimport { ItemExitOverlay } from '../shared/item-exit-overlay';\nimport {\n\tgetLayoutFingerprint,\n\tgetPlacementFingerprint,\n\tuseLayoutShiftAnimation,\n} from '../shared/use-layout-shift-animation';\nimport { useItemExitAnimation } from '../shared/use-item-exit-animation';\nimport type { DashboardLanesLayoutItem, DashboardLanesProps } 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 './lanes.module.css';\n\nconst dashboardDragDropAnimation = createDashboardDragDropAnimation(\n\tstyles[ 'drag-preview-frame' ],\n\tstyles[ 'is-exiting' ]\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 lane 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\nconst NO_SORT_STRATEGY = () => null;\n\n/**\n * Masonry-style surface aligned with `display: grid-lanes`. Items\n * declare a column span; heights are driven by content; placement\n * follows the source-ordered, shortest-lane algorithm with\n * `flow-tolerance` tiebreaking.\n *\n * On browsers that support `display: grid-lanes` natively, the\n * component emits the spec's CSS and lets the engine handle layout.\n * Otherwise, `useLanePlacement` measures item heights and assigns\n * explicit `grid-column-start` / `grid-row-start` values that\n * approximate the same result inside CSS Grid.\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 surface without\n * explicit placement and fall through the lanes auto-flow.\n *\n * @example\n * ```jsx\n * <DashboardLanes\n * layout={ [\n * { key: 'a' },\n * { key: 'b', width: 2 },\n * { key: 'c' },\n * ] }\n * columns={ 3 }\n * editMode\n * onChangeLayout={ setLayout }\n * >\n * <Tile key=\"a\">A</Tile>\n * <Tile key=\"b\">B</Tile>\n * <Tile key=\"c\">C</Tile>\n * </DashboardLanes>\n * ```\n *\n * @param props Component props.\n * @param ref Forwarded to the surface's root `<div>`.\n */\nexport const DashboardLanes = forwardRef< HTMLDivElement, DashboardLanesProps >(\n\tfunction UnforwardedDashboardLanes( 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\tflowTolerance = 16,\n\t\t\trowUnit = 4,\n\t\t\tminColumnWidth,\n\t\t\titemLimits,\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\n\t\tconst [ temporaryLayout, setTemporaryLayout ] = useState<\n\t\t\tDashboardLanesLayoutItem[] | undefined\n\t\t>();\n\t\tconst [ activeId, setActiveId ] = useState< string | null >( null );\n\t\tconst [ isResizing, setIsResizing ] = useState( false );\n\t\tconst [ resizeSnapPreview, setResizeSnapPreview ] = useState< {\n\t\t\tid: string;\n\t\t\tsnap: ResizeSnapSize;\n\t\t} | null >( null );\n\t\tconst latestLayoutRef = useRef<\n\t\t\tDashboardLanesLayoutItem[] | undefined\n\t\t>( undefined );\n\t\tconst lastReorderCursorRef = useRef< {\n\t\t\tx: number;\n\t\t\ty: number;\n\t\t} | null >( null );\n\t\tconst resizeBaselineRef = useRef< number | 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 [ container, setContainer ] = useState< HTMLDivElement | null >(\n\t\t\tnull\n\t\t);\n\t\tconst [ containerWidth, setContainerWidth ] = 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}\n\t\t);\n\t\tconst mergedRootRef = useMergeRefs( [\n\t\t\tsetContainer,\n\t\t\tresizeObserverRef,\n\t\t\tref,\n\t\t] );\n\n\t\t// Measure synchronously before paint and snapshot the computed\n\t\t// `column-gap` so the placement math tracks the design-system\n\t\t// token under any density.\n\t\tuseLayoutEffect( () => {\n\t\t\tif ( ! container ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { width } = container.getBoundingClientRect();\n\t\t\tif ( width > 0 ) {\n\t\t\t\tsetContainerWidth( width );\n\t\t\t}\n\t\t\tconst parsed = Number.parseFloat(\n\t\t\t\twindow.getComputedStyle( container ).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}, [ container ] );\n\t\tconst effectiveColumns = useMemo(\n\t\t\t() =>\n\t\t\t\tresolveColumnCount(\n\t\t\t\t\t{ columns, minColumnWidth },\n\t\t\t\t\tcontainerWidth,\n\t\t\t\t\tgapPx,\n\t\t\t\t\tDEFAULT_COLUMNS\n\t\t\t\t),\n\t\t\t[ minColumnWidth, gapPx, containerWidth, columns ]\n\t\t);\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\n\t\t// Height limits do not apply: lane heights are content-driven.\n\t\tconst widthBoundsByKey = useSpanBounds(\n\t\t\titemLimits,\n\t\t\tcolumnWidth,\n\t\t\tgapPx,\n\t\t\tnull,\n\t\t\teffectiveColumns\n\t\t);\n\t\tconst resizeLimitsByKey = useResizePixelLimits(\n\t\t\twidthBoundsByKey,\n\t\t\tcolumnWidth,\n\t\t\tgapPx,\n\t\t\tnull\n\t\t);\n\n\t\tconst layoutMap = useMemo( () => {\n\t\t\tconst map = new Map< string, DashboardLanesLayoutItem >();\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 for the children walk (see grid.tsx).\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\n\t\t// is unchanged (avoids invalidating SortableContext).\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// Span each item renders at: the stored width clamped to the lane\n\t\t// count and to the item's width bounds. Placement, the resize\n\t\t// baseline, and the commit check all read it, so a gesture starts\n\t\t// from the span on screen and commits nothing until it leaves it.\n\t\tconst renderedSpanByKey = useMemo( () => {\n\t\t\tconst map = new Map< string, number >();\n\t\t\tfor ( const [ key, item ] of layoutMap ) {\n\t\t\t\tconst span =\n\t\t\t\t\ttypeof item.width === 'number'\n\t\t\t\t\t\t? Math.max(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tMath.min( item.width, effectiveColumns )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: 1;\n\t\t\t\tconst bounds = widthBoundsByKey.get( key );\n\t\t\t\tmap.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbounds\n\t\t\t\t\t\t? clampSpan( span, bounds.minWidth, bounds.maxWidth )\n\t\t\t\t\t\t: span\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn map;\n\t\t}, [ layoutMap, effectiveColumns, widthBoundsByKey ] );\n\n\t\t// Placement input for the hook: each item with its rendered span\n\t\t// in source (sorted) order. `lane` forwards the optional explicit\n\t\t// pin from the layout item; the algorithm clamps out-of-range\n\t\t// values, so no surface-level guard is needed.\n\t\tconst placementItems = useMemo( () => {\n\t\t\treturn items.map( ( key ) => ( {\n\t\t\t\tkey,\n\t\t\t\tspan: renderedSpanByKey.get( key ) ?? 1,\n\t\t\t\tlane: layoutMap.get( key )?.lane,\n\t\t\t} ) );\n\t\t}, [ items, layoutMap, renderedSpanByKey ] );\n\n\t\tconst { itemStyles } = useLanePlacement( container, {\n\t\t\titems: placementItems,\n\t\t\tlanes: effectiveColumns,\n\t\t\tgap: gapPx,\n\t\t\tflowTolerance,\n\t\t\trowUnit,\n\t\t} );\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\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 as {\n\t\t\t\t\t\tactionableArea?: React.ReactNode;\n\t\t\t\t\t};\n\t\t\t\t\tconst stripped =\n\t\t\t\t\t\tactionableArea !== undefined\n\t\t\t\t\t\t\t? cloneElement(\n\t\t\t\t\t\t\t\t\tchild as React.ReactElement< {\n\t\t\t\t\t\t\t\t\t\tactionableArea?: React.ReactNode;\n\t\t\t\t\t\t\t\t\t} >,\n\t\t\t\t\t\t\t\t\t{ actionableArea: undefined }\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: ( child as React.ReactElement );\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\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\t\t\tconst activeRect = active.rect.current.translated;\n\t\t\tif ( ! activeRect ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst activeCenterX = activeRect.left + activeRect.width / 2;\n\t\t\tconst activeCenterY = activeRect.top + activeRect.height / 2;\n\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\t// Non-draggable items are pinned: they hold their index while\n\t\t\t// the others reorder around them.\n\t\t\tconst updatedItems = arrayMoveWithPinned(\n\t\t\t\titems,\n\t\t\t\tcurrentIndex,\n\t\t\t\tnewIndex,\n\t\t\t\t( key ) => layoutMap.get( key )?.draggable === false\n\t\t\t);\n\t\t\tif (\n\t\t\t\tupdatedItems.every( ( key, index ) => key === items[ index ] )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Build a key→index lookup so the .map below is O(n)\n\t\t\t// instead of O(n²) from per-item `indexOf` calls.\n\t\t\tconst orderByKey = new Map< string, number >();\n\t\t\tupdatedItems.forEach( ( key, index ) => {\n\t\t\t\torderByKey.set( key, index );\n\t\t\t} );\n\t\t\tconst updatedLayout = activeLayout.map( ( item ) => ( {\n\t\t\t\t...item,\n\t\t\t\torder: orderByKey.get( item.key ) ?? 0,\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\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\t\t\tif ( ! isResizing ) {\n\t\t\t\tsetIsResizing( true );\n\t\t\t}\n\n\t\t\tconst relativeDelta = Math.round(\n\t\t\t\tdelta.width / ( columnWidth + gapPx )\n\t\t\t);\n\n\t\t\tif ( resizeBaselineRef.current === null ) {\n\t\t\t\tresizeBaselineRef.current = renderedSpanByKey.get( id ) ?? 1;\n\t\t\t}\n\t\t\tconst baseline = resizeBaselineRef.current;\n\t\t\tconst bounds = widthBoundsByKey.get( id );\n\t\t\tconst newWidth = clampSpan(\n\t\t\t\tbaseline + relativeDelta,\n\t\t\t\tbounds?.minWidth ?? 1,\n\t\t\t\tbounds?.maxWidth ?? effectiveColumns\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\t1,\n\t\t\t\t\tcolumnWidth,\n\t\t\t\t\tgapPx,\n\t\t\t\t\tnull\n\t\t\t\t),\n\t\t\t} );\n\n\t\t\t// Bail when the snap target matches the span staged for commit,\n\t\t\t// or the rendered span while nothing is staged.\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 currentWidth =\n\t\t\t\tpendingItem?.width ?? renderedSpanByKey.get( id );\n\t\t\tif ( currentWidth === newWidth ) {\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 ? { ...item, width: newWidth } : 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\tconst interacting = activeId !== null || isResizing;\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. Lanes are content-driven vertically, so\n\t\t// the overlay mirrors columns only. Rendered unconditionally so\n\t\t// it can cross-fade on edit-mode toggles (`isActive` drives the\n\t\t// transition); memoized so drag/resize re-renders skip it.\n\t\tconst Overlay = renderGridOverlay ?? GridOverlay;\n\t\tconst gridOverlay = useMemo(\n\t\t\t() => (\n\t\t\t\t<Overlay columns={ effectiveColumns } isActive={ editMode } />\n\t\t\t),\n\t\t\t[ Overlay, editMode, effectiveColumns ]\n\t\t);\n\n\t\tconst layoutFingerprint = useMemo( () => {\n\t\t\tconst layoutSig = getLayoutFingerprint( activeLayout );\n\t\t\tconst placementSig = getPlacementFingerprint( itemStyles );\n\t\t\treturn `${ layoutSig }\\0${ placementSig }`;\n\t\t}, [ activeLayout, itemStyles ] );\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,\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,\n\t\t\tenabled: editMode,\n\t\t\tlayoutKeys,\n\t\t\tgetPositionsBeforeLastChange,\n\t\t\tchildrenCacheRef,\n\t\t} );\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<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={ mergedRootRef }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tstyles.lanes,\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{\n\t\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\t\tgridTemplateColumns: `repeat(${ effectiveColumns }, minmax(0, 1fr))`,\n\t\t\t\t\t\t\t\t// `column-gap` and `row-gap` are set in\n\t\t\t\t\t\t\t\t// `lanes.module.css` from the\n\t\t\t\t\t\t\t\t// design-system gap token, with an\n\t\t\t\t\t\t\t\t// `@supports` block that zeroes `row-gap`\n\t\t\t\t\t\t\t\t// in polyfill mode (the skyline already\n\t\t\t\t\t\t\t\t// encodes vertical spacing in each tile's\n\t\t\t\t\t\t\t\t// `top`). Driving the toggle from CSS\n\t\t\t\t\t\t\t\t// keeps SSR and client output identical\n\t\t\t\t\t\t\t\t// regardless of native support.\n\t\t\t\t\t\t\t\t'--wp-grid-lane-row-unit': `${ Math.max(\n\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\trowUnit\n\t\t\t\t\t\t\t\t) }px`,\n\t\t\t\t\t\t\t} as React.CSSProperties\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\tconst child = childrenMap.get( id );\n\t\t\t\t\t\t\tif ( ! child ) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst limitsPx = resizeLimitsByKey.get( id );\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LanesItem\n\t\t\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t\t\titemKey={ id }\n\t\t\t\t\t\t\t\t\tplacementStyle={\n\t\t\t\t\t\t\t\t\t\titemStyles.get( id ) ?? {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisabled={ ! editMode }\n\t\t\t\t\t\t\t\t\tdraggable={\n\t\t\t\t\t\t\t\t\t\tlayoutMap.get( id )?.draggable !== false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tresizable={\n\t\t\t\t\t\t\t\t\t\tlayoutMap.get( id )?.resizable !== false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tinteracting={ interacting }\n\t\t\t\t\t\t\t\t\tdragging={ activeId !== null }\n\t\t\t\t\t\t\t\t\tonResize={ handleResize }\n\t\t\t\t\t\t\t\t\tonResizeEnd={ persistTemporaryLayout }\n\t\t\t\t\t\t\t\t\tresizeSnapPreview={\n\t\t\t\t\t\t\t\t\t\tresizeSnapPreview?.id === id\n\t\t\t\t\t\t\t\t\t\t\t? resizeSnapPreview.snap\n\t\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tminResizeWidthPx={\n\t\t\t\t\t\t\t\t\t\tlimitsPx?.minWidthPx ?? minResizeWidthPx\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmaxResizeWidthPx={ limitsPx?.maxWidthPx }\n\t\t\t\t\t\t\t\t\tactionableArea={ actionableAreaMap.get(\n\t\t\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\trenderResizeHandle={ renderResizeHandle }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ child }\n\t\t\t\t\t\t\t\t</LanesItem>\n\t\t\t\t\t\t\t);\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\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CACF;;AAEd,CACD"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["createDashboardDragDropAnimation","styles","forwardRef","useState","useRef","useResizeObserver","useMergeRefs","useLayoutEffect","useMemo","resolveColumnCount","gridSpanToPixelSize","useSpanBounds","useResizePixelLimits","clampSpan","useLanePlacement","Children","isValidElement","cloneElement","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","useEvent","arrayMoveWithPinned","GridOverlay","getLayoutFingerprint","getPlacementFingerprint","useLayoutShiftAnimation","useItemExitAnimation","DndContext","SortableContext","clsx","layoutAnimationStyles","LanesItem","ItemExitOverlay","DragOverlay"],"sources":["../../../style-runtime/src/index.ts","../../src/shared/layout-shift-animation.module.css","../../src/dashboard-lanes/lanes.module.scss","../../src/dashboard-lanes/index.tsx"],"sourcesContent":["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(\"5d10111ab0\", \".c68bb75eb6bf717a__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){.c68bb75eb6bf717a__layout-animating [data-wp-grid-item-key]{transition:none}}\");\n}\nexport default {\"layout-animating\":\"c68bb75eb6bf717a__layout-animating\"};\n","import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"25b095c2e7\", \"._23779dfdf51c5e50__lanes{column-gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));display:grid-lanes;position:relative;row-gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px))}@supports not (display:grid-lanes){._23779dfdf51c5e50__lanes{display:grid;grid-auto-flow:dense;grid-auto-rows:var(--wp-grid-lane-row-unit,4px);row-gap:0}}.d7e03cc9b910fc7e__drag-preview-frame{border-radius:var(--wp-grid-drag-preview-radius,0);box-shadow:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02);cursor:grabbing;height:100%;pointer-events:none}._4425b9a6fa30579d__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){.d7e03cc9b910fc7e__drag-preview-frame{animation:ff9e5dccc1f34f49__wp-grid-drag-preview-shadow-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}._4425b9a6fa30579d__drag-preview-frame__lift{animation:_2592bed08e4f30e4__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 ff9e5dccc1f34f49__wp-grid-drag-preview-shadow-enter{0%{box-shadow:0 1px 1px rgba(0,0,0,.03),0 1px 2px rgba(0,0,0,.02),0 3px 3px rgba(0,0,0,.02),0 4px 4px rgba(0,0,0,.01)}to{box-shadow:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02)}}@keyframes _2592bed08e4f30e4__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){.d7e03cc9b910fc7e__drag-preview-frame._6348e3778fd237bf__is-exiting{animation:_4eb7799009ff2eea__wp-grid-drag-preview-shadow-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}.d7e03cc9b910fc7e__drag-preview-frame._6348e3778fd237bf__is-exiting ._4425b9a6fa30579d__drag-preview-frame__lift{animation:_58b3144e745d3a6e__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 _4eb7799009ff2eea__wp-grid-drag-preview-shadow-exit{0%{box-shadow:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02)}to{box-shadow:0 1px 1px rgba(0,0,0,.03),0 1px 2px rgba(0,0,0,.02),0 3px 3px rgba(0,0,0,.02),0 4px 4px rgba(0,0,0,.01)}}@keyframes _58b3144e745d3a6e__wp-grid-drag-preview-scale-exit{0%{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}to{transform:scale(1)}}}.d7e03cc9b910fc7e__drag-preview-frame._6348e3778fd237bf__is-exiting{box-shadow:0 1px 1px rgba(0,0,0,.03),0 1px 2px rgba(0,0,0,.02),0 3px 3px rgba(0,0,0,.02),0 4px 4px rgba(0,0,0,.01)}.d7e03cc9b910fc7e__drag-preview-frame._6348e3778fd237bf__is-exiting ._4425b9a6fa30579d__drag-preview-frame__lift{transform:scale(1)}@media (prefers-reduced-motion:reduce){.d7e03cc9b910fc7e__drag-preview-frame{box-shadow:0 2px 3px rgba(0,0,0,.05),0 4px 5px rgba(0,0,0,.04),0 12px 12px rgba(0,0,0,.03),0 16px 16px rgba(0,0,0,.02)}._4425b9a6fa30579d__drag-preview-frame__lift{transform:none}.d7e03cc9b910fc7e__drag-preview-frame._6348e3778fd237bf__is-exiting{box-shadow:0 1px 1px rgba(0,0,0,.03),0 1px 2px rgba(0,0,0,.02),0 3px 3px rgba(0,0,0,.02),0 4px 4px rgba(0,0,0,.01);transition:none}.d7e03cc9b910fc7e__drag-preview-frame._6348e3778fd237bf__is-exiting ._4425b9a6fa30579d__drag-preview-frame__lift{transition:none}}\");\n}\nexport default {\"lanes\":\"_23779dfdf51c5e50__lanes\",\"drag-preview-frame\":\"d7e03cc9b910fc7e__drag-preview-frame\",\"drag-preview-frame__lift\":\"_4425b9a6fa30579d__drag-preview-frame__lift\",\"wp-grid-drag-preview-shadow-enter\":\"ff9e5dccc1f34f49__wp-grid-drag-preview-shadow-enter\",\"wp-grid-drag-preview-scale-enter\":\"_2592bed08e4f30e4__wp-grid-drag-preview-scale-enter\",\"is-exiting\":\"_6348e3778fd237bf__is-exiting\",\"wp-grid-drag-preview-shadow-exit\":\"_4eb7799009ff2eea__wp-grid-drag-preview-shadow-exit\",\"wp-grid-drag-preview-scale-exit\":\"_58b3144e745d3a6e__wp-grid-drag-preview-scale-exit\"};\n","import {\n\tDndContext,\n\tDragOverlay,\n\tKeyboardSensor,\n\tPointerSensor,\n\tuseSensor,\n\tuseSensors,\n} from '@dnd-kit/core';\nimport {\n\tSortableContext,\n\tsortableKeyboardCoordinates,\n} from '@dnd-kit/sortable';\nimport type { DragMoveEvent, DragStartEvent } from '@dnd-kit/core';\nimport clsx from 'clsx';\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';\nimport { LanesItem } from './lanes-item';\nimport { useLanePlacement } from './use-lane-placement';\nimport { arrayMoveWithPinned } from '../shared/array-move-with-pinned';\nimport { resolveColumnCount } from '../shared/column-policy';\nimport { GridOverlay } from '../shared/grid-overlay';\nimport { clampSpan, gridSpanToPixelSize } from '../shared/resize-snap';\nimport { useResizePixelLimits, useSpanBounds } from '../shared/use-span-bounds';\nimport layoutAnimationStyles from '../shared/layout-shift-animation.module.css';\nimport { ItemExitOverlay } from '../shared/item-exit-overlay';\nimport {\n\tgetLayoutFingerprint,\n\tgetPlacementFingerprint,\n\tuseLayoutShiftAnimation,\n} from '../shared/use-layout-shift-animation';\nimport { useItemExitAnimation } from '../shared/use-item-exit-animation';\nimport type { DashboardLanesLayoutItem, DashboardLanesProps } 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 './lanes.module.scss';\n\nconst dashboardDragDropAnimation = createDashboardDragDropAnimation(\n\tstyles[ 'drag-preview-frame' ],\n\tstyles[ 'is-exiting' ]\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 lane 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\nconst NO_SORT_STRATEGY = () => null;\n\n/**\n * Masonry-style surface aligned with `display: grid-lanes`. Items\n * declare a column span; heights are driven by content; placement\n * follows the source-ordered, shortest-lane algorithm with\n * `flow-tolerance` tiebreaking.\n *\n * On browsers that support `display: grid-lanes` natively, the\n * component emits the spec's CSS and lets the engine handle layout.\n * Otherwise, `useLanePlacement` measures item heights and assigns\n * explicit `grid-column-start` / `grid-row-start` values that\n * approximate the same result inside CSS Grid.\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 surface without\n * explicit placement and fall through the lanes auto-flow.\n *\n * @example\n * ```jsx\n * <DashboardLanes\n * layout={ [\n * { key: 'a' },\n * { key: 'b', width: 2 },\n * { key: 'c' },\n * ] }\n * columns={ 3 }\n * editMode\n * onChangeLayout={ setLayout }\n * >\n * <Tile key=\"a\">A</Tile>\n * <Tile key=\"b\">B</Tile>\n * <Tile key=\"c\">C</Tile>\n * </DashboardLanes>\n * ```\n *\n * @param props Component props.\n * @param ref Forwarded to the surface's root `<div>`.\n */\nexport const DashboardLanes = forwardRef< HTMLDivElement, DashboardLanesProps >(\n\tfunction UnforwardedDashboardLanes( 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\tflowTolerance = 16,\n\t\t\trowUnit = 4,\n\t\t\tminColumnWidth,\n\t\t\titemLimits,\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\n\t\tconst [ temporaryLayout, setTemporaryLayout ] = useState<\n\t\t\tDashboardLanesLayoutItem[] | undefined\n\t\t>();\n\t\tconst [ activeId, setActiveId ] = useState< string | null >( null );\n\t\tconst [ isResizing, setIsResizing ] = useState( false );\n\t\tconst [ resizeSnapPreview, setResizeSnapPreview ] = useState< {\n\t\t\tid: string;\n\t\t\tsnap: ResizeSnapSize;\n\t\t} | null >( null );\n\t\tconst latestLayoutRef = useRef<\n\t\t\tDashboardLanesLayoutItem[] | undefined\n\t\t>( undefined );\n\t\tconst lastReorderCursorRef = useRef< {\n\t\t\tx: number;\n\t\t\ty: number;\n\t\t} | null >( null );\n\t\tconst resizeBaselineRef = useRef< number | 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 [ container, setContainer ] = useState< HTMLDivElement | null >(\n\t\t\tnull\n\t\t);\n\t\tconst [ containerWidth, setContainerWidth ] = 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}\n\t\t);\n\t\tconst mergedRootRef = useMergeRefs( [\n\t\t\tsetContainer,\n\t\t\tresizeObserverRef,\n\t\t\tref,\n\t\t] );\n\n\t\t// Measure synchronously before paint and snapshot the computed\n\t\t// `column-gap` so the placement math tracks the design-system\n\t\t// token under any density.\n\t\tuseLayoutEffect( () => {\n\t\t\tif ( ! container ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { width } = container.getBoundingClientRect();\n\t\t\tif ( width > 0 ) {\n\t\t\t\tsetContainerWidth( width );\n\t\t\t}\n\t\t\tconst parsed = Number.parseFloat(\n\t\t\t\twindow.getComputedStyle( container ).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}, [ container ] );\n\t\tconst effectiveColumns = useMemo(\n\t\t\t() =>\n\t\t\t\tresolveColumnCount(\n\t\t\t\t\t{ columns, minColumnWidth },\n\t\t\t\t\tcontainerWidth,\n\t\t\t\t\tgapPx,\n\t\t\t\t\tDEFAULT_COLUMNS\n\t\t\t\t),\n\t\t\t[ minColumnWidth, gapPx, containerWidth, columns ]\n\t\t);\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\n\t\t// Height limits do not apply: lane heights are content-driven.\n\t\tconst widthBoundsByKey = useSpanBounds(\n\t\t\titemLimits,\n\t\t\tcolumnWidth,\n\t\t\tgapPx,\n\t\t\tnull,\n\t\t\teffectiveColumns\n\t\t);\n\t\tconst resizeLimitsByKey = useResizePixelLimits(\n\t\t\twidthBoundsByKey,\n\t\t\tcolumnWidth,\n\t\t\tgapPx,\n\t\t\tnull\n\t\t);\n\n\t\tconst layoutMap = useMemo( () => {\n\t\t\tconst map = new Map< string, DashboardLanesLayoutItem >();\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 for the children walk (see grid.tsx).\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\n\t\t// is unchanged (avoids invalidating SortableContext).\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// Span each item renders at: the stored width clamped to the lane\n\t\t// count and to the item's width bounds. Placement, the resize\n\t\t// baseline, and the commit check all read it, so a gesture starts\n\t\t// from the span on screen and commits nothing until it leaves it.\n\t\tconst renderedSpanByKey = useMemo( () => {\n\t\t\tconst map = new Map< string, number >();\n\t\t\tfor ( const [ key, item ] of layoutMap ) {\n\t\t\t\tconst span =\n\t\t\t\t\ttypeof item.width === 'number'\n\t\t\t\t\t\t? Math.max(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tMath.min( item.width, effectiveColumns )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: 1;\n\t\t\t\tconst bounds = widthBoundsByKey.get( key );\n\t\t\t\tmap.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbounds\n\t\t\t\t\t\t? clampSpan( span, bounds.minWidth, bounds.maxWidth )\n\t\t\t\t\t\t: span\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn map;\n\t\t}, [ layoutMap, effectiveColumns, widthBoundsByKey ] );\n\n\t\t// Placement input for the hook: each item with its rendered span\n\t\t// in source (sorted) order. `lane` forwards the optional explicit\n\t\t// pin from the layout item; the algorithm clamps out-of-range\n\t\t// values, so no surface-level guard is needed.\n\t\tconst placementItems = useMemo( () => {\n\t\t\treturn items.map( ( key ) => ( {\n\t\t\t\tkey,\n\t\t\t\tspan: renderedSpanByKey.get( key ) ?? 1,\n\t\t\t\tlane: layoutMap.get( key )?.lane,\n\t\t\t} ) );\n\t\t}, [ items, layoutMap, renderedSpanByKey ] );\n\n\t\tconst { itemStyles } = useLanePlacement( container, {\n\t\t\titems: placementItems,\n\t\t\tlanes: effectiveColumns,\n\t\t\tgap: gapPx,\n\t\t\tflowTolerance,\n\t\t\trowUnit,\n\t\t} );\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\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 as {\n\t\t\t\t\t\tactionableArea?: React.ReactNode;\n\t\t\t\t\t};\n\t\t\t\t\tconst stripped =\n\t\t\t\t\t\tactionableArea !== undefined\n\t\t\t\t\t\t\t? cloneElement(\n\t\t\t\t\t\t\t\t\tchild as React.ReactElement< {\n\t\t\t\t\t\t\t\t\t\tactionableArea?: React.ReactNode;\n\t\t\t\t\t\t\t\t\t} >,\n\t\t\t\t\t\t\t\t\t{ actionableArea: undefined }\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: ( child as React.ReactElement );\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\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\t\t\tconst activeRect = active.rect.current.translated;\n\t\t\tif ( ! activeRect ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst activeCenterX = activeRect.left + activeRect.width / 2;\n\t\t\tconst activeCenterY = activeRect.top + activeRect.height / 2;\n\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\t// Non-draggable items are pinned: they hold their index while\n\t\t\t// the others reorder around them.\n\t\t\tconst updatedItems = arrayMoveWithPinned(\n\t\t\t\titems,\n\t\t\t\tcurrentIndex,\n\t\t\t\tnewIndex,\n\t\t\t\t( key ) => layoutMap.get( key )?.draggable === false\n\t\t\t);\n\t\t\tif (\n\t\t\t\tupdatedItems.every( ( key, index ) => key === items[ index ] )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Build a key→index lookup so the .map below is O(n)\n\t\t\t// instead of O(n²) from per-item `indexOf` calls.\n\t\t\tconst orderByKey = new Map< string, number >();\n\t\t\tupdatedItems.forEach( ( key, index ) => {\n\t\t\t\torderByKey.set( key, index );\n\t\t\t} );\n\t\t\tconst updatedLayout = activeLayout.map( ( item ) => ( {\n\t\t\t\t...item,\n\t\t\t\torder: orderByKey.get( item.key ) ?? 0,\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\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\t\t\tif ( ! isResizing ) {\n\t\t\t\tsetIsResizing( true );\n\t\t\t}\n\n\t\t\tconst relativeDelta = Math.round(\n\t\t\t\tdelta.width / ( columnWidth + gapPx )\n\t\t\t);\n\n\t\t\tif ( resizeBaselineRef.current === null ) {\n\t\t\t\tresizeBaselineRef.current = renderedSpanByKey.get( id ) ?? 1;\n\t\t\t}\n\t\t\tconst baseline = resizeBaselineRef.current;\n\t\t\tconst bounds = widthBoundsByKey.get( id );\n\t\t\tconst newWidth = clampSpan(\n\t\t\t\tbaseline + relativeDelta,\n\t\t\t\tbounds?.minWidth ?? 1,\n\t\t\t\tbounds?.maxWidth ?? effectiveColumns\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\t1,\n\t\t\t\t\tcolumnWidth,\n\t\t\t\t\tgapPx,\n\t\t\t\t\tnull\n\t\t\t\t),\n\t\t\t} );\n\n\t\t\t// Bail when the snap target matches the span staged for commit,\n\t\t\t// or the rendered span while nothing is staged.\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 currentWidth =\n\t\t\t\tpendingItem?.width ?? renderedSpanByKey.get( id );\n\t\t\tif ( currentWidth === newWidth ) {\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 ? { ...item, width: newWidth } : 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\tconst interacting = activeId !== null || isResizing;\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. Lanes are content-driven vertically, so\n\t\t// the overlay mirrors columns only. Rendered unconditionally so\n\t\t// it can cross-fade on edit-mode toggles (`isActive` drives the\n\t\t// transition); memoized so drag/resize re-renders skip it.\n\t\tconst Overlay = renderGridOverlay ?? GridOverlay;\n\t\tconst gridOverlay = useMemo(\n\t\t\t() => (\n\t\t\t\t<Overlay columns={ effectiveColumns } isActive={ editMode } />\n\t\t\t),\n\t\t\t[ Overlay, editMode, effectiveColumns ]\n\t\t);\n\n\t\tconst layoutFingerprint = useMemo( () => {\n\t\t\tconst layoutSig = getLayoutFingerprint( activeLayout );\n\t\t\tconst placementSig = getPlacementFingerprint( itemStyles );\n\t\t\treturn `${ layoutSig }\\0${ placementSig }`;\n\t\t}, [ activeLayout, itemStyles ] );\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,\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,\n\t\t\tenabled: editMode,\n\t\t\tlayoutKeys,\n\t\t\tgetPositionsBeforeLastChange,\n\t\t\tchildrenCacheRef,\n\t\t} );\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<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={ mergedRootRef }\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\tstyles.lanes,\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{\n\t\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\t\tgridTemplateColumns: `repeat(${ effectiveColumns }, minmax(0, 1fr))`,\n\t\t\t\t\t\t\t\t// `column-gap` and `row-gap` are set in\n\t\t\t\t\t\t\t\t// `lanes.module.scss` from the\n\t\t\t\t\t\t\t\t// design-system gap token, with an\n\t\t\t\t\t\t\t\t// `@supports` block that zeroes `row-gap`\n\t\t\t\t\t\t\t\t// in polyfill mode (the skyline already\n\t\t\t\t\t\t\t\t// encodes vertical spacing in each tile's\n\t\t\t\t\t\t\t\t// `top`). Driving the toggle from CSS\n\t\t\t\t\t\t\t\t// keeps SSR and client output identical\n\t\t\t\t\t\t\t\t// regardless of native support.\n\t\t\t\t\t\t\t\t'--wp-grid-lane-row-unit': `${ Math.max(\n\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\trowUnit\n\t\t\t\t\t\t\t\t) }px`,\n\t\t\t\t\t\t\t} as React.CSSProperties\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\tconst child = childrenMap.get( id );\n\t\t\t\t\t\t\tif ( ! child ) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst limitsPx = resizeLimitsByKey.get( id );\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<LanesItem\n\t\t\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\t\t\titemKey={ id }\n\t\t\t\t\t\t\t\t\tplacementStyle={\n\t\t\t\t\t\t\t\t\t\titemStyles.get( id ) ?? {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdisabled={ ! editMode }\n\t\t\t\t\t\t\t\t\tdraggable={\n\t\t\t\t\t\t\t\t\t\tlayoutMap.get( id )?.draggable !== false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tresizable={\n\t\t\t\t\t\t\t\t\t\tlayoutMap.get( id )?.resizable !== false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tinteracting={ interacting }\n\t\t\t\t\t\t\t\t\tdragging={ activeId !== null }\n\t\t\t\t\t\t\t\t\tonResize={ handleResize }\n\t\t\t\t\t\t\t\t\tonResizeEnd={ persistTemporaryLayout }\n\t\t\t\t\t\t\t\t\tresizeSnapPreview={\n\t\t\t\t\t\t\t\t\t\tresizeSnapPreview?.id === id\n\t\t\t\t\t\t\t\t\t\t\t? resizeSnapPreview.snap\n\t\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tminResizeWidthPx={\n\t\t\t\t\t\t\t\t\t\tlimitsPx?.minWidthPx ?? minResizeWidthPx\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmaxResizeWidthPx={ limitsPx?.maxWidthPx }\n\t\t\t\t\t\t\t\t\tactionableArea={ actionableAreaMap.get(\n\t\t\t\t\t\t\t\t\t\tid\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\trenderResizeHandle={ renderResizeHandle }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ child }\n\t\t\t\t\t\t\t\t</LanesItem>\n\t\t\t\t\t\t\t);\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;;;;;;;;AAU7B,SAAS,aAAa;CACrB,MAAM,cAAc;CAEpB,IAAK,YAAY,kBAChB,OAAO,YAAY;CAGpB,YAAY,mBAAmB;EAC9B,2BAAW,IAAI,IAAI;EACnB,wBAAQ,IAAI,IAAI;EAChB,gCAAgB,IAAI,QAAQ;CAC7B;CAEA,IAAK,OAAO,aAAa,aACxB,iBAAkB,QAAS;CAG5B,OAAO,YAAY;AACpB;;;;;;;;;AAUA,SAAS,0BACR,gBACA,MACU;CACV,IAAK,CAAE,eAAe,MAC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CAAC;OAE1B,UAAW,CAAE;OACb,WACC,UAAU,IAAK,EAAG,CAAC,EAAE,cAAc;OAEpC,WACC,UAAU,IAAK,EAAG,CAAC,EAAE,cAAc;OAEtB;OACd,UAAW,aAAa;OACxB,UAAW;OACX,aAAc;OACd,mBACC,mBAAmB,OAAO,KACvB,kBAAkB,OAClB;OAEJ,kBACC,UAAU,cAAc;OAEzB,kBAAmB,UAAU;OAC7B,gBAAiB,kBAAkB,IAClC,EACD;OACqB;OAEnB,UAAA;MACQ,GA/BJ,EA+BI;KAEb,CAAE;KACA;KACA,aAAa,KAAO,EAAE,KAAK,MAAM,YAClC,iBAAA,GAAA,kBAAA,IAAA,CAACC,gCAAAA,iBAAD;MAEC,SAAU;MACH;MACP,sBAAuB,iBAAkB,GAAI;MAE3C,UAAA;KACc,GANV,WAAY,KAMF,CAChB;IACE;;EACW,CAAA,GACjB,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,aAAD;GAAa,eAAgB;GAC1B,UAAA;EACU,CAAA,CACF;;AAEd,CACD"}
|
|
@@ -56,7 +56,7 @@ function computeLanePlacements(input) {
|
|
|
56
56
|
for (const item of autoItems) {
|
|
57
57
|
const span = clampSpan(item.span, lanes);
|
|
58
58
|
let bestLane = 0;
|
|
59
|
-
let bestBaseline =
|
|
59
|
+
let bestBaseline = 1e400;
|
|
60
60
|
for (let candidate = 0; candidate <= lanes - span; candidate++) {
|
|
61
61
|
const baseline = maxBaselineAcross(laneBottoms, candidate, span);
|
|
62
62
|
if (bestBaseline - baseline > tolerance) {
|
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -26,15 +28,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let _dnd_kit_sortable = require("@dnd-kit/sortable");
|
|
28
30
|
let clsx = require("clsx");
|
|
29
|
-
clsx = __toESM(clsx);
|
|
30
31
|
let _wordpress_element = require("@wordpress/element");
|
|
31
32
|
let _wordpress_compose = require("@wordpress/compose");
|
|
32
33
|
let _wordpress_react_inert_value = require("@wordpress/react-inert-value");
|
|
33
34
|
let ___shared_resize_handle_tsx = require("../shared/resize-handle.cjs");
|
|
34
|
-
___shared_resize_handle_tsx = __toESM(___shared_resize_handle_tsx);
|
|
35
35
|
let ___shared_resize_snap_ts = require("../shared/resize-snap.cjs");
|
|
36
36
|
let ___shared_grid_item_key_ts = require("../shared/grid-item-key.cjs");
|
|
37
37
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
clsx = __toESM(clsx);
|
|
39
|
+
___shared_resize_handle_tsx = __toESM(___shared_resize_handle_tsx);
|
|
38
40
|
// packages/style-runtime/src/index.ts
|
|
39
41
|
const STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
40
42
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lanes-item.cjs","names":["useState","useRef","useSortable","useMergeRefs","styles","clampResizeDelta","GRID_ITEM_DATA_KEY","actionableAreaStyles","inertValue","ResizeHandle"],"sources":["../../../style-runtime/src/index.ts","../../src/shared/actionable-area-slot.module.css","../../src/dashboard-lanes/lanes-item.module.css","../../src/dashboard-lanes/lanes-item.tsx"],"sourcesContent":["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(\"36a7a084ce\", \"._0a2b470abcf47e5b__actionable-area-slot{opacity:1}@media (prefers-reduced-motion:no-preference){._0a2b470abcf47e5b__actionable-area-slot{transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}[data-wp-grid-resizing] ._0a2b470abcf47e5b__actionable-area-slot{opacity:0;pointer-events:none}\");\n}\nexport default {\"actionable-area-slot\":\"_0a2b470abcf47e5b__actionable-area-slot\"};\n","import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"0fa64ddd95\", \"._31c3cc93e2ae64fa__item{position:relative}._3f7297c1fa9fef39__item-content{height:100%;position:relative}.e1dfe63167e7d0b8__is-resizing{overflow:visible;z-index:1}.e1dfe63167e7d0b8__is-resizing ._3f7297c1fa9fef39__item-content{overflow:visible;position:relative;z-index:2}._28d819356520d8d1__is-dragging{pointer-events:none}[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{border-radius:var(--wp-grid-placeholder-radius,0)}@media not (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{animation:ad99d2d1d0017024__wp-grid-item-placeholder-in 0ms linear var(--wpds-motion-duration-sm,.1s) forwards;opacity:1;outline-color:transparent;outline-style:var(--wp-grid-placeholder-outline-style,dashed);outline-width:0}@keyframes ad99d2d1d0017024__wp-grid-item-placeholder-in{to{opacity:var(--wp-grid-placeholder-opacity,.4);outline-color:var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));outline-width:var(--wpds-border-width-sm,2px)}}}@media (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{opacity:var(--wp-grid-placeholder-opacity,.4);outline:var(--wpds-border-width-sm,2px) var(--wp-grid-placeholder-outline-style,dashed) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)))}}@media (forced-colors:active){[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{--wp-grid-placeholder-outline-color:Highlight}}._126192ec000c65e5__preview-overlay{background:transparent;border:var(--wpds-border-width-sm,2px) var(--wp-grid-resize-preview-outline-style,solid) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));box-sizing:border-box;inset-inline-start:0;pointer-events:none;position:absolute;top:0;z-index:0}@media (forced-colors:active){._126192ec000c65e5__preview-overlay{border-color:Highlight}}\");\n}\nexport default {\"item\":\"_31c3cc93e2ae64fa__item\",\"item-content\":\"_3f7297c1fa9fef39__item-content\",\"is-resizing\":\"e1dfe63167e7d0b8__is-resizing\",\"is-dragging\":\"_28d819356520d8d1__is-dragging\",\"wp-grid-item-placeholder-in\":\"ad99d2d1d0017024__wp-grid-item-placeholder-in\",\"preview-overlay\":\"_126192ec000c65e5__preview-overlay\"};\n","import { useSortable } from '@dnd-kit/sortable';\nimport clsx from 'clsx';\nimport { useState, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { inertValue } from '@wordpress/react-inert-value';\nimport actionableAreaStyles from '../shared/actionable-area-slot.module.css';\nimport ResizeHandle from '../shared/resize-handle';\nimport { clampResizeDelta, type ResizeSnapSize } from '../shared/resize-snap';\nimport { GRID_ITEM_DATA_KEY } from '../shared/grid-item-key';\nimport type { ResizeDelta, ResizeHandleRenderProps } from '../shared/types';\nimport styles from './lanes-item.module.css';\n\nfunction getItemCursor(\n\tdisabled: boolean,\n\tinteracting: boolean\n): React.CSSProperties[ 'cursor' ] {\n\tif ( disabled ) {\n\t\treturn 'default';\n\t}\n\tif ( interacting ) {\n\t\treturn undefined;\n\t}\n\treturn 'grab';\n}\n\n/**\n * Props for the internal `<LanesItem />` wrapper.\n */\nexport type LanesItemProps = {\n\t/**\n\t * Item key. Forwarded to dnd-kit and emitted as the\n\t * `data-wp-grid-item-key` attribute the hook reads to map measured DOM\n\t * nodes back to logical items.\n\t */\n\titemKey: string;\n\n\t/**\n\t * Inline placement style produced by `useLanePlacement`. On native\n\t * (`display: grid-lanes`), only `gridColumn: span N`. While\n\t * polyfilling, also `gridColumnStart` / `gridRowStart` /\n\t * `gridRowEnd: span N`.\n\t */\n\tplacementStyle: React.CSSProperties;\n\n\t/**\n\t * Whether drag and resize interactions are disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the item can be dragged. Combined with `disabled`.\n\t *\n\t * @default true\n\t */\n\tdraggable?: boolean;\n\n\t/**\n\t * Whether the item can be resized. Combined with `disabled`.\n\t *\n\t * @default true\n\t */\n\tresizable?: boolean;\n\n\t/**\n\t * Whether any tile in the surface is currently being dragged or\n\t * resized. Drives the drag activator cursor.\n\t */\n\tinteracting?: boolean;\n\n\t/**\n\t * Whether a tile drag is in progress. Mutes each tile's\n\t * `actionableArea` with `inert` so hovers on other tiles' controls\n\t * do not steal the gesture.\n\t *\n\t * @default false\n\t */\n\tdragging?: boolean;\n\n\tchildren: React.ReactNode;\n\n\tactionableArea?: React.ReactNode;\n\n\tonResize: ( id: string, delta: ResizeDelta ) => void;\n\n\t/**\n\t * Snapped column span in pixels for the resize-preview outline.\n\t */\n\tresizeSnapPreview?: ResizeSnapSize | null;\n\n\t/**\n\t * Minimum tile width while resizing, in pixels (one column track).\n\t */\n\tminResizeWidthPx: number;\n\n\t/**\n\t * Maximum tile width while resizing, in pixels. Omitted when the\n\t * item declares no width limit.\n\t */\n\tmaxResizeWidthPx?: number;\n\n\tonResizeEnd: () => void;\n\n\trenderResizeHandle?: React.ComponentType< ResizeHandleRenderProps >;\n};\n\nexport function LanesItem( {\n\titemKey,\n\tplacementStyle,\n\tdisabled = false,\n\tdraggable = true,\n\tresizable = true,\n\tinteracting = false,\n\tchildren,\n\tactionableArea = null,\n\tonResize,\n\tonResizeEnd,\n\tresizeSnapPreview = null,\n\tminResizeWidthPx,\n\tmaxResizeWidthPx,\n\trenderResizeHandle,\n\tdragging = false,\n}: LanesItemProps ) {\n\tconst [ resizeDelta, setResizeDelta ] = useState< ResizeDelta | null >(\n\t\tnull\n\t);\n\tconst [ initialContentSize, setInitialContentSize ] = useState< {\n\t\twidth: number;\n\t\theight: number;\n\t} | null >( null );\n\tconst itemRef = useRef< HTMLDivElement >( null );\n\tconst contentRef = useRef< HTMLDivElement >( null );\n\n\tconst dragDisabled = disabled || ! draggable;\n\tconst resizeDisabled = disabled || ! resizable;\n\tconst {\n\t\tattributes,\n\t\tlisteners,\n\t\tsetNodeRef,\n\t\tsetActivatorNodeRef,\n\t\tisDragging,\n\t} = useSortable( {\n\t\tid: itemKey,\n\t\tdisabled: dragDisabled,\n\t} );\n\tconst mergedRef = useMergeRefs( [ itemRef, setNodeRef ] );\n\tconst contentMergedRef = useMergeRefs( [ contentRef ] );\n\n\tconst style: React.CSSProperties = {\n\t\t...placementStyle,\n\t\talignSelf: 'start',\n\t};\n\n\tconst isResizing = resizeDelta !== null;\n\tconst itemClassName = clsx(\n\t\tstyles.item,\n\t\tisDragging && styles[ 'is-dragging' ],\n\t\tisResizing && styles[ 'is-resizing' ]\n\t);\n\n\tconst handleResize = ( delta: ResizeDelta ) => {\n\t\tconst contentNode = contentRef.current;\n\t\tlet baselineSize = initialContentSize;\n\t\tif ( contentNode && ! baselineSize ) {\n\t\t\tconst { width, height } = contentNode.getBoundingClientRect();\n\t\t\tbaselineSize = { width, height };\n\t\t\tsetInitialContentSize( baselineSize );\n\t\t}\n\t\tlet clamped: ResizeDelta = { width: delta.width, height: 0 };\n\t\tif ( baselineSize ) {\n\t\t\tclamped = clampResizeDelta(\n\t\t\t\tclamped,\n\t\t\t\tbaselineSize,\n\t\t\t\t{ width: minResizeWidthPx },\n\t\t\t\t{ width: maxResizeWidthPx }\n\t\t\t);\n\t\t}\n\t\tsetResizeDelta( clamped );\n\t\tonResize( itemKey, clamped );\n\t};\n\n\tconst handleResizeEnd = () => {\n\t\tsetResizeDelta( null );\n\t\tsetInitialContentSize( null );\n\t\tonResizeEnd();\n\t};\n\n\tconst continuousContentStyle: React.CSSProperties | undefined =\n\t\tresizeDelta && initialContentSize\n\t\t\t? {\n\t\t\t\t\twidth: initialContentSize.width + resizeDelta.width,\n\t\t\t\t}\n\t\t\t: undefined;\n\n\tconst previewOverlay = resizeSnapPreview ? (\n\t\t<div\n\t\t\tclassName={ styles[ 'preview-overlay' ] }\n\t\t\tstyle={ {\n\t\t\t\twidth: resizeSnapPreview.widthPx,\n\t\t\t\theight: resizeSnapPreview.heightPx ?? '100%',\n\t\t\t} }\n\t\t/>\n\t) : null;\n\n\treturn (\n\t\t<div\n\t\t\tref={ mergedRef }\n\t\t\tclassName={ itemClassName }\n\t\t\tstyle={ style }\n\t\t\t{ ...{ [ GRID_ITEM_DATA_KEY ]: itemKey } }\n\t\t\tdata-wp-grid-item-resizing={ isResizing || undefined }\n\t\t>\n\t\t\t{ actionableArea ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ actionableAreaStyles[ 'actionable-area-slot' ] }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={ { display: 'contents' } }\n\t\t\t\t\t\tinert={ inertValue( dragging ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ actionableArea }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : null }\n\n\t\t\t<div\n\t\t\t\tref={ setActivatorNodeRef }\n\t\t\t\t{ ...( dragDisabled ? {} : attributes ) }\n\t\t\t\t{ ...listeners }\n\t\t\t\tstyle={ {\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcursor: getItemCursor( dragDisabled, interacting ),\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tref={ contentMergedRef }\n\t\t\t\t\tclassName={ styles[ 'item-content' ] }\n\t\t\t\t\tstyle={ continuousContentStyle }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t\t{ ! resizeDisabled && (\n\t\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\t\titemId={ itemKey }\n\t\t\t\t\t\t\tverticalResizable={ false }\n\t\t\t\t\t\t\tonResize={ handleResize }\n\t\t\t\t\t\t\tonResizeEnd={ handleResizeEnd }\n\t\t\t\t\t\t\trenderResizeHandle={ renderResizeHandle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t{ previewOverlay }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;;;;;;;;AAU7B,SAAS,aAAa;CACrB,MAAM,cAAc;CAEpB,IAAK,YAAY,kBAChB,OAAO,YAAY;CAGpB,YAAY,mBAAmB;EAC9B,2BAAW,IAAI,IAAI;EACnB,wBAAQ,IAAI,IAAI;EAChB,gCAAgB,IAAI,QAAQ;CAC7B;CAEA,IAAK,OAAO,aAAa,aACxB,iBAAkB,QAAS;CAG5B,OAAO,YAAY;AACpB;;;;;;;;;AAUA,SAAS,0BACR,gBACA,MACU;CACV,IAAK,CAAE,eAAe,MACrB,OAAO;CAGR,KAAM,MAAM,SAAS,eAAe,KAAK,iBACxC,SAAU,qBAAsB,EACjC,GACC,IAAK,MAAM,aAAc,oBAAqB,MAAM,MACnD,OAAO;CAIT,OAAO;AACR;;;;;;;;;AAUA,SAAS,YAAa,gBAA0B,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QAAQ,cAAe,cAAc,WAAY;GAClD;GAPD,UAAA,CASC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IACC,KAAM;IACN,WAAYJ,0BAAQ;IACpB,OAAQ;IAHT,UAAA,CAKG,UACA,CAAE,kBACH,iBAAA,GAAA,kBAAA,IAAA,CAACK,4BAAAA,SAAD;KACC,QAAS;KACT,mBAAoB;KACpB,UAAW;KACX,aAAc;KACO;IACrB,CAAA,CAEE;GACH,CAAA,GAAA,cACE;EACD,CAAA,CAAA;;AAEP"}
|
|
1
|
+
{"version":3,"file":"lanes-item.cjs","names":["useState","useRef","useSortable","useMergeRefs","clsx","styles","clampResizeDelta","GRID_ITEM_DATA_KEY","actionableAreaStyles","inertValue","ResizeHandle"],"sources":["../../../style-runtime/src/index.ts","../../src/shared/actionable-area-slot.module.css","../../src/dashboard-lanes/lanes-item.module.css","../../src/dashboard-lanes/lanes-item.tsx"],"sourcesContent":["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(\"36a7a084ce\", \"._0a2b470abcf47e5b__actionable-area-slot{opacity:1}@media (prefers-reduced-motion:no-preference){._0a2b470abcf47e5b__actionable-area-slot{transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}[data-wp-grid-resizing] ._0a2b470abcf47e5b__actionable-area-slot{opacity:0;pointer-events:none}\");\n}\nexport default {\"actionable-area-slot\":\"_0a2b470abcf47e5b__actionable-area-slot\"};\n","import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"0fa64ddd95\", \"._31c3cc93e2ae64fa__item{position:relative}._3f7297c1fa9fef39__item-content{height:100%;position:relative}.e1dfe63167e7d0b8__is-resizing{overflow:visible;z-index:1}.e1dfe63167e7d0b8__is-resizing ._3f7297c1fa9fef39__item-content{overflow:visible;position:relative;z-index:2}._28d819356520d8d1__is-dragging{pointer-events:none}[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{border-radius:var(--wp-grid-placeholder-radius,0)}@media not (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{animation:ad99d2d1d0017024__wp-grid-item-placeholder-in 0ms linear var(--wpds-motion-duration-sm,.1s) forwards;opacity:1;outline-color:transparent;outline-style:var(--wp-grid-placeholder-outline-style,dashed);outline-width:0}@keyframes ad99d2d1d0017024__wp-grid-item-placeholder-in{to{opacity:var(--wp-grid-placeholder-opacity,.4);outline-color:var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));outline-width:var(--wpds-border-width-sm,2px)}}}@media (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{opacity:var(--wp-grid-placeholder-opacity,.4);outline:var(--wpds-border-width-sm,2px) var(--wp-grid-placeholder-outline-style,dashed) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)))}}@media (forced-colors:active){[data-wp-grid-dragging] ._28d819356520d8d1__is-dragging{--wp-grid-placeholder-outline-color:Highlight}}._126192ec000c65e5__preview-overlay{background:transparent;border:var(--wpds-border-width-sm,2px) var(--wp-grid-resize-preview-outline-style,solid) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));box-sizing:border-box;inset-inline-start:0;pointer-events:none;position:absolute;top:0;z-index:0}@media (forced-colors:active){._126192ec000c65e5__preview-overlay{border-color:Highlight}}\");\n}\nexport default {\"item\":\"_31c3cc93e2ae64fa__item\",\"item-content\":\"_3f7297c1fa9fef39__item-content\",\"is-resizing\":\"e1dfe63167e7d0b8__is-resizing\",\"is-dragging\":\"_28d819356520d8d1__is-dragging\",\"wp-grid-item-placeholder-in\":\"ad99d2d1d0017024__wp-grid-item-placeholder-in\",\"preview-overlay\":\"_126192ec000c65e5__preview-overlay\"};\n","import { useSortable } from '@dnd-kit/sortable';\nimport clsx from 'clsx';\nimport { useState, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { inertValue } from '@wordpress/react-inert-value';\nimport actionableAreaStyles from '../shared/actionable-area-slot.module.css';\nimport ResizeHandle from '../shared/resize-handle';\nimport { clampResizeDelta, type ResizeSnapSize } from '../shared/resize-snap';\nimport { GRID_ITEM_DATA_KEY } from '../shared/grid-item-key';\nimport type { ResizeDelta, ResizeHandleRenderProps } from '../shared/types';\nimport styles from './lanes-item.module.css';\n\nfunction getItemCursor(\n\tdisabled: boolean,\n\tinteracting: boolean\n): React.CSSProperties[ 'cursor' ] {\n\tif ( disabled ) {\n\t\treturn 'default';\n\t}\n\tif ( interacting ) {\n\t\treturn undefined;\n\t}\n\treturn 'grab';\n}\n\n/**\n * Props for the internal `<LanesItem />` wrapper.\n */\nexport type LanesItemProps = {\n\t/**\n\t * Item key. Forwarded to dnd-kit and emitted as the\n\t * `data-wp-grid-item-key` attribute the hook reads to map measured DOM\n\t * nodes back to logical items.\n\t */\n\titemKey: string;\n\n\t/**\n\t * Inline placement style produced by `useLanePlacement`. On native\n\t * (`display: grid-lanes`), only `gridColumn: span N`. While\n\t * polyfilling, also `gridColumnStart` / `gridRowStart` /\n\t * `gridRowEnd: span N`.\n\t */\n\tplacementStyle: React.CSSProperties;\n\n\t/**\n\t * Whether drag and resize interactions are disabled.\n\t */\n\tdisabled?: boolean;\n\n\t/**\n\t * Whether the item can be dragged. Combined with `disabled`.\n\t *\n\t * @default true\n\t */\n\tdraggable?: boolean;\n\n\t/**\n\t * Whether the item can be resized. Combined with `disabled`.\n\t *\n\t * @default true\n\t */\n\tresizable?: boolean;\n\n\t/**\n\t * Whether any tile in the surface is currently being dragged or\n\t * resized. Drives the drag activator cursor.\n\t */\n\tinteracting?: boolean;\n\n\t/**\n\t * Whether a tile drag is in progress. Mutes each tile's\n\t * `actionableArea` with `inert` so hovers on other tiles' controls\n\t * do not steal the gesture.\n\t *\n\t * @default false\n\t */\n\tdragging?: boolean;\n\n\tchildren: React.ReactNode;\n\n\tactionableArea?: React.ReactNode;\n\n\tonResize: ( id: string, delta: ResizeDelta ) => void;\n\n\t/**\n\t * Snapped column span in pixels for the resize-preview outline.\n\t */\n\tresizeSnapPreview?: ResizeSnapSize | null;\n\n\t/**\n\t * Minimum tile width while resizing, in pixels (one column track).\n\t */\n\tminResizeWidthPx: number;\n\n\t/**\n\t * Maximum tile width while resizing, in pixels. Omitted when the\n\t * item declares no width limit.\n\t */\n\tmaxResizeWidthPx?: number;\n\n\tonResizeEnd: () => void;\n\n\trenderResizeHandle?: React.ComponentType< ResizeHandleRenderProps >;\n};\n\nexport function LanesItem( {\n\titemKey,\n\tplacementStyle,\n\tdisabled = false,\n\tdraggable = true,\n\tresizable = true,\n\tinteracting = false,\n\tchildren,\n\tactionableArea = null,\n\tonResize,\n\tonResizeEnd,\n\tresizeSnapPreview = null,\n\tminResizeWidthPx,\n\tmaxResizeWidthPx,\n\trenderResizeHandle,\n\tdragging = false,\n}: LanesItemProps ) {\n\tconst [ resizeDelta, setResizeDelta ] = useState< ResizeDelta | null >(\n\t\tnull\n\t);\n\tconst [ initialContentSize, setInitialContentSize ] = useState< {\n\t\twidth: number;\n\t\theight: number;\n\t} | null >( null );\n\tconst itemRef = useRef< HTMLDivElement >( null );\n\tconst contentRef = useRef< HTMLDivElement >( null );\n\n\tconst dragDisabled = disabled || ! draggable;\n\tconst resizeDisabled = disabled || ! resizable;\n\tconst {\n\t\tattributes,\n\t\tlisteners,\n\t\tsetNodeRef,\n\t\tsetActivatorNodeRef,\n\t\tisDragging,\n\t} = useSortable( {\n\t\tid: itemKey,\n\t\tdisabled: dragDisabled,\n\t} );\n\tconst mergedRef = useMergeRefs( [ itemRef, setNodeRef ] );\n\tconst contentMergedRef = useMergeRefs( [ contentRef ] );\n\n\tconst style: React.CSSProperties = {\n\t\t...placementStyle,\n\t\talignSelf: 'start',\n\t};\n\n\tconst isResizing = resizeDelta !== null;\n\tconst itemClassName = clsx(\n\t\tstyles.item,\n\t\tisDragging && styles[ 'is-dragging' ],\n\t\tisResizing && styles[ 'is-resizing' ]\n\t);\n\n\tconst handleResize = ( delta: ResizeDelta ) => {\n\t\tconst contentNode = contentRef.current;\n\t\tlet baselineSize = initialContentSize;\n\t\tif ( contentNode && ! baselineSize ) {\n\t\t\tconst { width, height } = contentNode.getBoundingClientRect();\n\t\t\tbaselineSize = { width, height };\n\t\t\tsetInitialContentSize( baselineSize );\n\t\t}\n\t\tlet clamped: ResizeDelta = { width: delta.width, height: 0 };\n\t\tif ( baselineSize ) {\n\t\t\tclamped = clampResizeDelta(\n\t\t\t\tclamped,\n\t\t\t\tbaselineSize,\n\t\t\t\t{ width: minResizeWidthPx },\n\t\t\t\t{ width: maxResizeWidthPx }\n\t\t\t);\n\t\t}\n\t\tsetResizeDelta( clamped );\n\t\tonResize( itemKey, clamped );\n\t};\n\n\tconst handleResizeEnd = () => {\n\t\tsetResizeDelta( null );\n\t\tsetInitialContentSize( null );\n\t\tonResizeEnd();\n\t};\n\n\tconst continuousContentStyle: React.CSSProperties | undefined =\n\t\tresizeDelta && initialContentSize\n\t\t\t? {\n\t\t\t\t\twidth: initialContentSize.width + resizeDelta.width,\n\t\t\t\t}\n\t\t\t: undefined;\n\n\tconst previewOverlay = resizeSnapPreview ? (\n\t\t<div\n\t\t\tclassName={ styles[ 'preview-overlay' ] }\n\t\t\tstyle={ {\n\t\t\t\twidth: resizeSnapPreview.widthPx,\n\t\t\t\theight: resizeSnapPreview.heightPx ?? '100%',\n\t\t\t} }\n\t\t/>\n\t) : null;\n\n\treturn (\n\t\t<div\n\t\t\tref={ mergedRef }\n\t\t\tclassName={ itemClassName }\n\t\t\tstyle={ style }\n\t\t\t{ ...{ [ GRID_ITEM_DATA_KEY ]: itemKey } }\n\t\t\tdata-wp-grid-item-resizing={ isResizing || undefined }\n\t\t>\n\t\t\t{ actionableArea ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ actionableAreaStyles[ 'actionable-area-slot' ] }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={ { display: 'contents' } }\n\t\t\t\t\t\tinert={ inertValue( dragging ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ actionableArea }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : null }\n\n\t\t\t<div\n\t\t\t\tref={ setActivatorNodeRef }\n\t\t\t\t{ ...( dragDisabled ? {} : attributes ) }\n\t\t\t\t{ ...listeners }\n\t\t\t\tstyle={ {\n\t\t\t\t\theight: '100%',\n\t\t\t\t\tcursor: getItemCursor( dragDisabled, interacting ),\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tref={ contentMergedRef }\n\t\t\t\t\tclassName={ styles[ 'item-content' ] }\n\t\t\t\t\tstyle={ continuousContentStyle }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t\t{ ! resizeDisabled && (\n\t\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\t\titemId={ itemKey }\n\t\t\t\t\t\t\tverticalResizable={ false }\n\t\t\t\t\t\t\tonResize={ handleResize }\n\t\t\t\t\t\t\tonResizeEnd={ handleResizeEnd }\n\t\t\t\t\t\t\trenderResizeHandle={ renderResizeHandle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t{ previewOverlay }\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;;;;;;;;AAU7B,SAAS,a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kBAAA,KAAA,CAAC,OAAD;EACC,KAAM;EACN,WAAY;EACJ;GACCE,2BAAAA,qBAAsB;EAC/B,8BAA6B,cAAc,KAAA;EAL5C,UAAA,CAOG,iBACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GACC,WAAYC,oCAAsB;GAElC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACC,OAAQ,EAAE,SAAS,WAAW;IAC9B,QAAA,GAAQC,6BAAAA,WAAAA,CAAY,QAAS;IAE3B,UAAA;GACE,CAAA;EACD,CAAA,IACF,MAEJ,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GACC,KAAM;GACN,GAAO,eAAe,CAAC,IAAI;GAC3B,GAAK;GACL,OAAQ;IACP,QAAQ;IACR,QAAQ,cAAe,cAAc,WAAY;GAClD;GAPD,UAAA,CASC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IACC,KAAM;IACN,WAAYJ,0BAAQ;IACpB,OAAQ;IAHT,UAAA,CAKG,UACA,CAAE,kBACH,iBAAA,GAAA,kBAAA,IAAA,CAACK,4BAAAA,SAAD;KACC,QAAS;KACT,mBAAoB;KACpB,UAAW;KACX,aAAc;KACO;IACrB,CAAA,CAEE;GACH,CAAA,GAAA,cACE;EACD,CAAA,CAAA;;AAEP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-lane-placement.cjs","names":["useState","useMemo","computeLanePlacements","GRID_ITEM_DATA_KEY"],"sources":["../../src/dashboard-lanes/use-lane-placement.ts"],"sourcesContent":["import { useState, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { computeLanePlacements } from './lane-placement';\nimport { GRID_ITEM_DATA_KEY } from '../shared/grid-item-key';\n\nconst DEFAULT_ROW_UNIT = 4;\n\nfunction supportsGridLanes(): boolean {\n\tif ( typeof CSS === 'undefined' || ! CSS.supports ) {\n\t\treturn false;\n\t}\n\treturn CSS.supports( 'display', 'grid-lanes' );\n}\n\nfunction clampSpan( span: number | undefined ): number {\n\tif ( typeof span !== 'number' || ! Number.isFinite( span ) ) {\n\t\treturn 1;\n\t}\n\treturn Math.max( 1, Math.floor( span ) );\n}\n\n/**\n * Logical item passed to the hook. The renderer is responsible for\n * mounting a DOM node with `data-wp-grid-item-key={ item.key }` for each\n * entry; the hook will measure that node and produce inline styles.\n */\nexport type LaneItemInput = {\n\tkey: string;\n\tspan?: number;\n\tlane?: number;\n};\n\nexport type UseLanePlacementInput = {\n\titems: ReadonlyArray< LaneItemInput >;\n\tlanes: number;\n\tgap: number;\n\tflowTolerance: number;\n\t/**\n\t * Snap unit for `grid-row-start` / `grid-row-end: span N` math.\n\t * Smaller values produce sharper placement at the cost of more\n\t * implicit rows. Defaults to 4 (px).\n\t */\n\trowUnit?: number;\n};\n\nexport type UseLanePlacementResult = {\n\t/**\n\t * Inline styles to apply to each item, keyed by item key. On\n\t * native (`display: grid-lanes`), entries carry only\n\t * `gridColumn: span N`; the browser handles row placement. While\n\t * polyfilling, entries also carry explicit `grid-column-start` /\n\t * `grid-row-*` values.\n\t */\n\titemStyles: Map< string, React.CSSProperties >;\n\n\t/**\n\t * `false` when the host browser supports `display: grid-lanes`\n\t * natively. The hook avoids mounting any observers in that case.\n\t */\n\tisPolyfilled: boolean;\n};\n\n/**\n * Hook that measures item heights and resolves their placement when\n * `display: grid-lanes` is unavailable, falling through to a no-op\n * pass when the host browser supports the feature natively.\n *\n * Usage from the renderer:\n *\n * ```tsx\n * const [ container, setContainer ] = useState< HTMLDivElement | null >( null );\n * const { itemStyles } = useLanePlacement( container, {\n * items: layout,\n * lanes: columns,\n * gap: gapPx,\n * flowTolerance: 16,\n * } );\n *\n * return (\n * <div ref={ setContainer } style={ { display: 'grid-lanes', ... } }>\n * { items.map( ( item ) => (\n * <div\n * key={ item.key }\n * data-wp-grid-item-key={ item.key }\n * style={ itemStyles.get( item.key ) }\n * >\n * { ... }\n * </div>\n * ) ) }\n * </div>\n * );\n * ```\n *\n * @param container HTMLElement (or null pre-mount) hosting the items.\n * @param input Logical items, lane count, gap, and tuning.\n * @return Per-item styles plus the `isPolyfilled` flag.\n */\nexport function useLanePlacement(\n\tcontainer: HTMLElement | null,\n\tinput: UseLanePlacementInput\n): UseLanePlacementResult {\n\t// Detect once at mount. SSR returns `true` (CSS undefined); the\n\t// client-first render returns the real value. Either path produces\n\t// the same DOM until the polyfill effect runs (both emit\n\t// span-only styles), so there is no hydration mismatch.\n\tconst [ isPolyfilled ] = useState( () => ! supportsGridLanes() );\n\n\tconst [ itemStyles, setItemStyles ] = useState<\n\t\tMap< string, React.CSSProperties >\n\t>( () => new Map() );\n\n\t// Native pass-through: items only need their column span; the\n\t// browser handles row placement. Memoized so a stable items\n\t// array yields a stable Map identity.\n\tconst nativeStyles = useMemo( () => {\n\t\tconst map = new Map< string, React.CSSProperties >();\n\t\tfor ( const item of input.items ) {\n\t\t\tmap.set( item.key, {\n\t\t\t\tgridColumn: `span ${ clampSpan( item.span ) }`,\n\t\t\t} );\n\t\t}\n\t\treturn map;\n\t}, [ input.items ] );\n\n\t// Stable signature of items for deps. Keys, spans, and explicit\n\t// lanes are the only fields that influence observer wiring or\n\t// placement, so we hash exactly those.\n\tconst itemsSignature = useMemo( () => {\n\t\treturn input.items\n\t\t\t.map(\n\t\t\t\t( item ) =>\n\t\t\t\t\t`${ item.key }/${ item.span ?? 1 }/${ item.lane ?? '' }`\n\t\t\t)\n\t\t\t.join( '\\0' );\n\t}, [ input.items ] );\n\n\t// Stable array identity while placement-relevant fields match\n\t// `itemsSignature`, so the layout effect is not torn down on every\n\t// parent re-render that passes a fresh `items` reference.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps -- `itemsSignature` encodes keys/spans/lanes; `input.items` reference often changes without placement changes.\n\tconst itemsForPlacement = useMemo( () => input.items, [ itemsSignature ] );\n\n\tconst { lanes, gap, flowTolerance, rowUnit } = input;\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! isPolyfilled || ! container ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( typeof ResizeObserver === 'undefined' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst heights = new Map< string, number >();\n\t\tconst observed = new Set< Element >();\n\t\tlet cancelled = false;\n\t\tlet rafId: number | null = null;\n\n\t\tconst recompute = () => {\n\t\t\tif ( rafId !== null || cancelled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// One layout per frame even when ResizeObserver and\n\t\t\t// MutationObserver fire in the same tick.\n\t\t\trafId = requestAnimationFrame( () => {\n\t\t\t\trafId = null;\n\t\t\t\tif ( cancelled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst itemsWithHeight = itemsForPlacement.map( ( item ) => ( {\n\t\t\t\t\tkey: item.key,\n\t\t\t\t\tspan: clampSpan( item.span ),\n\t\t\t\t\tlane: item.lane,\n\t\t\t\t\theight: heights.get( item.key ) ?? 0,\n\t\t\t\t} ) );\n\t\t\t\tconst result = computeLanePlacements( {\n\t\t\t\t\titems: itemsWithHeight,\n\t\t\t\t\tlanes,\n\t\t\t\t\tgap,\n\t\t\t\t\tflowTolerance,\n\t\t\t\t} );\n\t\t\t\tconst effectiveRowUnit = Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\trowUnit ?? DEFAULT_ROW_UNIT\n\t\t\t\t);\n\t\t\t\tconst next = new Map< string, React.CSSProperties >();\n\t\t\t\tfor ( const item of itemsForPlacement ) {\n\t\t\t\t\tconst placement = result.placements.get( item.key );\n\t\t\t\t\tif ( ! placement ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst height = heights.get( item.key ) ?? 0;\n\t\t\t\t\tconst rowStart =\n\t\t\t\t\t\tMath.floor( placement.top / effectiveRowUnit ) + 1;\n\t\t\t\t\tconst rowSpan = Math.max(\n\t\t\t\t\t\t1,\n\t\t\t\t\t\tMath.ceil( height / effectiveRowUnit )\n\t\t\t\t\t);\n\t\t\t\t\tnext.set( item.key, {\n\t\t\t\t\t\tgridColumnStart: placement.lane + 1,\n\t\t\t\t\t\tgridColumnEnd: `span ${ placement.span }`,\n\t\t\t\t\t\tgridRowStart: rowStart,\n\t\t\t\t\t\tgridRowEnd: `span ${ rowSpan }`,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tsetItemStyles( next );\n\t\t\t} );\n\t\t};\n\n\t\tconst resizeObserver = new ResizeObserver( ( entries ) => {\n\t\t\tlet changed = false;\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst key = ( entry.target as HTMLElement ).getAttribute(\n\t\t\t\t\tGRID_ITEM_DATA_KEY\n\t\t\t\t);\n\t\t\t\tif ( ! key ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst newHeight = entry.contentRect.height;\n\t\t\t\tif ( heights.get( key ) !== newHeight ) {\n\t\t\t\t\theights.set( key, newHeight );\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( changed ) {\n\t\t\t\trecompute();\n\t\t\t}\n\t\t} );\n\n\t\tconst refreshObserved = () => {\n\t\t\tconst current = container.querySelectorAll(\n\t\t\t\t`[${ GRID_ITEM_DATA_KEY }]`\n\t\t\t);\n\t\t\tfor ( const element of current ) {\n\t\t\t\tif ( ! observed.has( element ) ) {\n\t\t\t\t\tobserved.add( element );\n\t\t\t\t\tresizeObserver.observe( element );\n\t\t\t\t\tconst key = element.getAttribute( GRID_ITEM_DATA_KEY );\n\t\t\t\t\tif ( key ) {\n\t\t\t\t\t\tconst rect = (\n\t\t\t\t\t\t\telement as HTMLElement\n\t\t\t\t\t\t ).getBoundingClientRect();\n\t\t\t\t\t\theights.set( key, rect.height );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor ( const element of observed ) {\n\t\t\t\tif ( ! container.contains( element ) ) {\n\t\t\t\t\tresizeObserver.unobserve( element );\n\t\t\t\t\tobserved.delete( element );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Children may mount, unmount, or change `data-wp-grid-item-key`\n\t\t// after the container exists (drag reorders, additions). The\n\t\t// mutation observer keeps the observed set in sync.\n\t\tconst mutationObserver =\n\t\t\ttypeof MutationObserver !== 'undefined'\n\t\t\t\t? new MutationObserver( () => {\n\t\t\t\t\t\trefreshObserved();\n\t\t\t\t\t\trecompute();\n\t\t\t\t\t} )\n\t\t\t\t: null;\n\t\tif ( mutationObserver ) {\n\t\t\tmutationObserver.observe( container, {\n\t\t\t\tchildList: true,\n\t\t\t\tsubtree: true,\n\t\t\t\tattributes: true,\n\t\t\t\tattributeFilter: [ GRID_ITEM_DATA_KEY ],\n\t\t\t} );\n\t\t}\n\n\t\trefreshObserved();\n\t\trecompute();\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t\tif ( rafId !== null ) {\n\t\t\t\tcancelAnimationFrame( rafId );\n\t\t\t}\n\t\t\tresizeObserver.disconnect();\n\t\t\tmutationObserver?.disconnect();\n\t\t};\n\t}, [\n\t\tcontainer,\n\t\tisPolyfilled,\n\t\tlanes,\n\t\tgap,\n\t\tflowTolerance,\n\t\trowUnit,\n\t\titemsForPlacement,\n\t] );\n\n\tif ( ! isPolyfilled ) {\n\t\treturn { itemStyles: nativeStyles, isPolyfilled: false };\n\t}\n\tif ( itemStyles.size === 0 ) {\n\t\t// Pre-measurement frame: emit native-shape styles so items\n\t\t// appear in their default span rather than collapsing to 1\n\t\t// column at the top-left.\n\t\treturn {\n\t\t\titemStyles: nativeStyles as Map< string, React.CSSProperties >,\n\t\t\tisPolyfilled: true,\n\t\t};\n\t}\n\treturn { itemStyles, isPolyfilled: true };\n}\n"],"mappings":";;;;;;;;;AAIA,MAAM,mBAAmB;AAEzB,SAAS,oBAA6B;CACrC,IAAK,OAAO,QAAQ,eAAe,CAAE,IAAI,UACxC,OAAO;CAER,OAAO,IAAI,SAAU,WAAW,YAAa;AAC9C;AAEA,SAAS,UAAW,MAAmC;CACtD,IAAK,OAAO,SAAS,YAAY,CAAE,OAAO,SAAU,IAAK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;IACtB,eAAe,QAAS,OAAQ;IAChC,MAAM,MAAM,QAAQ,aAAcA,2BAAAA,kBAAmB;IACrD,IAAK,KAAM;KACV,MAAM,OACL,QACE,sBAAsB;KACzB,QAAQ,IAAK,KAAK,KAAK,MAAO;IAC/B;GACD;GAED,KAAM,MAAM,WAAW,UACtB,IAAK,CAAE,UAAU,SAAU,OAAQ,GAAI;IACtC,eAAe,UAAW,OAAQ;IAClC,SAAS,OAAQ,OAAQ;GAC1B;EAEF;EAKA,MAAM,mBACL,OAAO,qBAAqB,cACzB,IAAI,uBAAwB;GAC5B,gBAAgB;GAChB,UAAU;EACX,CAAE,IACD;EACJ,IAAK,kBACJ,iBAAiB,QAAS,WAAW;GACpC,WAAW;GACX,SAAS;GACT,YAAY;GACZ,iBAAiB,CAAEA,2BAAAA,kBAAmB;EACvC,CAAE;EAGH,gBAAgB;EAChB,UAAU;EAEV,aAAa;GACZ,YAAY;GACZ,IAAK,UAAU,MACd,qBAAsB,KAAM;GAE7B,eAAe,WAAW;GAC1B,kBAAkB,WAAW;EAC9B;CACD,GAAG;EACF;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAE;CAEF,IAAK,CAAE,cACN,OAAO;EAAE,YAAY;EAAc,cAAc;CAAM;CAExD,IAAK,WAAW,SAAS,GAIxB,OAAO;EACN,YAAY;EACZ,cAAc;CACf;CAED,OAAO;EAAE;EAAY,cAAc;CAAK;AACzC"}
|
|
1
|
+
{"version":3,"file":"use-lane-placement.cjs","names":["useState","useMemo","useLayoutEffect","computeLanePlacements","GRID_ITEM_DATA_KEY"],"sources":["../../src/dashboard-lanes/use-lane-placement.ts"],"sourcesContent":["import { useState, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { computeLanePlacements } from './lane-placement';\nimport { GRID_ITEM_DATA_KEY } from '../shared/grid-item-key';\n\nconst DEFAULT_ROW_UNIT = 4;\n\nfunction supportsGridLanes(): boolean {\n\tif ( typeof CSS === 'undefined' || ! CSS.supports ) {\n\t\treturn false;\n\t}\n\treturn CSS.supports( 'display', 'grid-lanes' );\n}\n\nfunction clampSpan( span: number | undefined ): number {\n\tif ( typeof span !== 'number' || ! Number.isFinite( span ) ) {\n\t\treturn 1;\n\t}\n\treturn Math.max( 1, Math.floor( span ) );\n}\n\n/**\n * Logical item passed to the hook. The renderer is responsible for\n * mounting a DOM node with `data-wp-grid-item-key={ item.key }` for each\n * entry; the hook will measure that node and produce inline styles.\n */\nexport type LaneItemInput = {\n\tkey: string;\n\tspan?: number;\n\tlane?: number;\n};\n\nexport type UseLanePlacementInput = {\n\titems: ReadonlyArray< LaneItemInput >;\n\tlanes: number;\n\tgap: number;\n\tflowTolerance: number;\n\t/**\n\t * Snap unit for `grid-row-start` / `grid-row-end: span N` math.\n\t * Smaller values produce sharper placement at the cost of more\n\t * implicit rows. Defaults to 4 (px).\n\t */\n\trowUnit?: number;\n};\n\nexport type UseLanePlacementResult = {\n\t/**\n\t * Inline styles to apply to each item, keyed by item key. On\n\t * native (`display: grid-lanes`), entries carry only\n\t * `gridColumn: span N`; the browser handles row placement. While\n\t * polyfilling, entries also carry explicit `grid-column-start` /\n\t * `grid-row-*` values.\n\t */\n\titemStyles: Map< string, React.CSSProperties >;\n\n\t/**\n\t * `false` when the host browser supports `display: grid-lanes`\n\t * natively. The hook avoids mounting any observers in that case.\n\t */\n\tisPolyfilled: boolean;\n};\n\n/**\n * Hook that measures item heights and resolves their placement when\n * `display: grid-lanes` is unavailable, falling through to a no-op\n * pass when the host browser supports the feature natively.\n *\n * Usage from the renderer:\n *\n * ```tsx\n * const [ container, setContainer ] = useState< HTMLDivElement | null >( null );\n * const { itemStyles } = useLanePlacement( container, {\n * items: layout,\n * lanes: columns,\n * gap: gapPx,\n * flowTolerance: 16,\n * } );\n *\n * return (\n * <div ref={ setContainer } style={ { display: 'grid-lanes', ... } }>\n * { items.map( ( item ) => (\n * <div\n * key={ item.key }\n * data-wp-grid-item-key={ item.key }\n * style={ itemStyles.get( item.key ) }\n * >\n * { ... }\n * </div>\n * ) ) }\n * </div>\n * );\n * ```\n *\n * @param container HTMLElement (or null pre-mount) hosting the items.\n * @param input Logical items, lane count, gap, and tuning.\n * @return Per-item styles plus the `isPolyfilled` flag.\n */\nexport function useLanePlacement(\n\tcontainer: HTMLElement | null,\n\tinput: UseLanePlacementInput\n): UseLanePlacementResult {\n\t// Detect once at mount. SSR returns `true` (CSS undefined); the\n\t// client-first render returns the real value. Either path produces\n\t// the same DOM until the polyfill effect runs (both emit\n\t// span-only styles), so there is no hydration mismatch.\n\tconst [ isPolyfilled ] = useState( () => ! supportsGridLanes() );\n\n\tconst [ itemStyles, setItemStyles ] = useState<\n\t\tMap< string, React.CSSProperties >\n\t>( () => new Map() );\n\n\t// Native pass-through: items only need their column span; the\n\t// browser handles row placement. Memoized so a stable items\n\t// array yields a stable Map identity.\n\tconst nativeStyles = useMemo( () => {\n\t\tconst map = new Map< string, React.CSSProperties >();\n\t\tfor ( const item of input.items ) {\n\t\t\tmap.set( item.key, {\n\t\t\t\tgridColumn: `span ${ clampSpan( item.span ) }`,\n\t\t\t} );\n\t\t}\n\t\treturn map;\n\t}, [ input.items ] );\n\n\t// Stable signature of items for deps. Keys, spans, and explicit\n\t// lanes are the only fields that influence observer wiring or\n\t// placement, so we hash exactly those.\n\tconst itemsSignature = useMemo( () => {\n\t\treturn input.items\n\t\t\t.map(\n\t\t\t\t( item ) =>\n\t\t\t\t\t`${ item.key }/${ item.span ?? 1 }/${ item.lane ?? '' }`\n\t\t\t)\n\t\t\t.join( '\\0' );\n\t}, [ input.items ] );\n\n\t// Stable array identity while placement-relevant fields match\n\t// `itemsSignature`, so the layout effect is not torn down on every\n\t// parent re-render that passes a fresh `items` reference.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps -- `itemsSignature` encodes keys/spans/lanes; `input.items` reference often changes without placement changes.\n\tconst itemsForPlacement = useMemo( () => input.items, [ itemsSignature ] );\n\n\tconst { lanes, gap, flowTolerance, rowUnit } = input;\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! isPolyfilled || ! container ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( typeof ResizeObserver === 'undefined' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst heights = new Map< string, number >();\n\t\tconst observed = new Set< Element >();\n\t\tlet cancelled = false;\n\t\tlet rafId: number | null = null;\n\n\t\tconst recompute = () => {\n\t\t\tif ( rafId !== null || cancelled ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// One layout per frame even when ResizeObserver and\n\t\t\t// MutationObserver fire in the same tick.\n\t\t\trafId = requestAnimationFrame( () => {\n\t\t\t\trafId = null;\n\t\t\t\tif ( cancelled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst itemsWithHeight = itemsForPlacement.map( ( item ) => ( {\n\t\t\t\t\tkey: item.key,\n\t\t\t\t\tspan: clampSpan( item.span ),\n\t\t\t\t\tlane: item.lane,\n\t\t\t\t\theight: heights.get( item.key ) ?? 0,\n\t\t\t\t} ) );\n\t\t\t\tconst result = computeLanePlacements( {\n\t\t\t\t\titems: itemsWithHeight,\n\t\t\t\t\tlanes,\n\t\t\t\t\tgap,\n\t\t\t\t\tflowTolerance,\n\t\t\t\t} );\n\t\t\t\tconst effectiveRowUnit = Math.max(\n\t\t\t\t\t1,\n\t\t\t\t\trowUnit ?? DEFAULT_ROW_UNIT\n\t\t\t\t);\n\t\t\t\tconst next = new Map< string, React.CSSProperties >();\n\t\t\t\tfor ( const item of itemsForPlacement ) {\n\t\t\t\t\tconst placement = result.placements.get( item.key );\n\t\t\t\t\tif ( ! placement ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst height = heights.get( item.key ) ?? 0;\n\t\t\t\t\tconst rowStart =\n\t\t\t\t\t\tMath.floor( placement.top / effectiveRowUnit ) + 1;\n\t\t\t\t\tconst rowSpan = Math.max(\n\t\t\t\t\t\t1,\n\t\t\t\t\t\tMath.ceil( height / effectiveRowUnit )\n\t\t\t\t\t);\n\t\t\t\t\tnext.set( item.key, {\n\t\t\t\t\t\tgridColumnStart: placement.lane + 1,\n\t\t\t\t\t\tgridColumnEnd: `span ${ placement.span }`,\n\t\t\t\t\t\tgridRowStart: rowStart,\n\t\t\t\t\t\tgridRowEnd: `span ${ rowSpan }`,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tsetItemStyles( next );\n\t\t\t} );\n\t\t};\n\n\t\tconst resizeObserver = new ResizeObserver( ( entries ) => {\n\t\t\tlet changed = false;\n\t\t\tfor ( const entry of entries ) {\n\t\t\t\tconst key = ( entry.target as HTMLElement ).getAttribute(\n\t\t\t\t\tGRID_ITEM_DATA_KEY\n\t\t\t\t);\n\t\t\t\tif ( ! key ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst newHeight = entry.contentRect.height;\n\t\t\t\tif ( heights.get( key ) !== newHeight ) {\n\t\t\t\t\theights.set( key, newHeight );\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( changed ) {\n\t\t\t\trecompute();\n\t\t\t}\n\t\t} );\n\n\t\tconst refreshObserved = () => {\n\t\t\tconst current = container.querySelectorAll(\n\t\t\t\t`[${ GRID_ITEM_DATA_KEY }]`\n\t\t\t);\n\t\t\tfor ( const element of current ) {\n\t\t\t\tif ( ! observed.has( element ) ) {\n\t\t\t\t\tobserved.add( element );\n\t\t\t\t\tresizeObserver.observe( element );\n\t\t\t\t\tconst key = element.getAttribute( GRID_ITEM_DATA_KEY );\n\t\t\t\t\tif ( key ) {\n\t\t\t\t\t\tconst rect = (\n\t\t\t\t\t\t\telement as HTMLElement\n\t\t\t\t\t\t ).getBoundingClientRect();\n\t\t\t\t\t\theights.set( key, rect.height );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor ( const element of observed ) {\n\t\t\t\tif ( ! container.contains( element ) ) {\n\t\t\t\t\tresizeObserver.unobserve( element );\n\t\t\t\t\tobserved.delete( element );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// Children may mount, unmount, or change `data-wp-grid-item-key`\n\t\t// after the container exists (drag reorders, additions). The\n\t\t// mutation observer keeps the observed set in sync.\n\t\tconst mutationObserver =\n\t\t\ttypeof MutationObserver !== 'undefined'\n\t\t\t\t? new MutationObserver( () => {\n\t\t\t\t\t\trefreshObserved();\n\t\t\t\t\t\trecompute();\n\t\t\t\t\t} )\n\t\t\t\t: null;\n\t\tif ( mutationObserver ) {\n\t\t\tmutationObserver.observe( container, {\n\t\t\t\tchildList: true,\n\t\t\t\tsubtree: true,\n\t\t\t\tattributes: true,\n\t\t\t\tattributeFilter: [ GRID_ITEM_DATA_KEY ],\n\t\t\t} );\n\t\t}\n\n\t\trefreshObserved();\n\t\trecompute();\n\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t\tif ( rafId !== null ) {\n\t\t\t\tcancelAnimationFrame( rafId );\n\t\t\t}\n\t\t\tresizeObserver.disconnect();\n\t\t\tmutationObserver?.disconnect();\n\t\t};\n\t}, [\n\t\tcontainer,\n\t\tisPolyfilled,\n\t\tlanes,\n\t\tgap,\n\t\tflowTolerance,\n\t\trowUnit,\n\t\titemsForPlacement,\n\t] );\n\n\tif ( ! isPolyfilled ) {\n\t\treturn { itemStyles: nativeStyles, isPolyfilled: false };\n\t}\n\tif ( itemStyles.size === 0 ) {\n\t\t// Pre-measurement frame: emit native-shape styles so items\n\t\t// appear in their default span rather than collapsing to 1\n\t\t// column at the top-left.\n\t\treturn {\n\t\t\titemStyles: nativeStyles as Map< string, React.CSSProperties >,\n\t\t\tisPolyfilled: true,\n\t\t};\n\t}\n\treturn { itemStyles, isPolyfilled: true };\n}\n"],"mappings":";;;;;;;;;AAIA,MAAM,mBAAmB;AAEzB,SAAS,oBAA6B;CACrC,IAAK,OAAO,QAAQ,eAAe,CAAE,IAAI,UACxC,OAAO;CAER,OAAO,IAAI,SAAU,WAAW,YAAa;AAC9C;AAEA,SAAS,UAAW,MAA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B,IAAK,CAAE,SAAS,IAAK,OAAQ,GAAI;IAChC,SAAS,IAAK,OAAQ;IACtB,eAAe,QAAS,OAAQ;IAChC,MAAM,MAAM,QAAQ,aAAcA,2BAAAA,kBAAmB;IACrD,IAAK,KAAM;KACV,MAAM,OACL,QACE,sBAAsB;KACzB,QAAQ,IAAK,KAAK,KAAK,MAAO;IAC/B;GACD;GAED,KAAM,MAAM,WAAW,UACtB,IAAK,CAAE,UAAU,SAAU,OAAQ,GAAI;IACtC,eAAe,UAAW,OAAQ;IAClC,SAAS,OAAQ,OAAQ;GAC1B;EAEF;EAKA,MAAM,mBACL,OAAO,qBAAqB,cACzB,IAAI,uBAAwB;GAC5B,gBAAgB;GAChB,UAAU;EACX,CAAE,IACD;EACJ,IAAK,kBACJ,iBAAiB,QAAS,WAAW;GACpC,WAAW;GACX,SAAS;GACT,YAAY;GACZ,iBAAiB,CAAEA,2BAAAA,kBAAmB;EACvC,CAAE;EAGH,gBAAgB;EAChB,UAAU;EAEV,aAAa;GACZ,YAAY;GACZ,IAAK,UAAU,MACd,qBAAsB,KAAM;GAE7B,eAAe,WAAW;GAC1B,kBAAkB,WAAW;EAC9B;CACD,GAAG;EACF;EACA;EACA;EACA;EACA;EACA;EACA;CACD,CAAE;CAEF,IAAK,CAAE,cACN,OAAO;EAAE,YAAY;EAAc,cAAc;CAAM;CAExD,IAAK,WAAW,SAAS,GAIxB,OAAO;EACN,YAAY;EACZ,cAAc;CACf;CAED,OAAO;EAAE;EAAY,cAAc;CAAK;AACzC"}
|
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -25,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
27
|
enumerable: true
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let clsx = require("clsx");
|
|
28
|
-
clsx = __toESM(clsx);
|
|
29
30
|
let _wordpress_element = require("@wordpress/element");
|
|
30
31
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
clsx = __toESM(clsx);
|
|
31
33
|
// packages/style-runtime/src/index.ts
|
|
32
34
|
const STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
33
35
|
/**
|
|
@@ -131,14 +133,14 @@ function registerStyle(hash, css) {
|
|
|
131
133
|
for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
|
|
132
134
|
}
|
|
133
135
|
// packages/grid/src/shared/grid-overlay.module.css
|
|
134
|
-
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("
|
|
136
|
+
if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("06dd759fcf", "._4a216a8093440aa5__overlay{display:grid;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));inset:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden}._4a216a8093440aa5__overlay.f70300e01495372e__is-active{opacity:1;visibility:visible}@media not (prefers-reduced-motion){._4a216a8093440aa5__overlay.f70300e01495372e__is-active .df4f340583099149__row,._4a216a8093440aa5__overlay.f70300e01495372e__is-active:not(.b4be0dcd9c079b20__has-rows) ._159bdd76b978aeed__column{animation:a54d5a1d4fb5af08__grid-overlay-tile-in var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)) both;animation-delay:calc(var(--wp-grid-overlay-wave-delay-step, 28ms)*(var(--wp-grid-overlay-column-index, 0) + var(--wp-grid-overlay-row-index, 0)));opacity:0;transform:scale(.64)}@keyframes a54d5a1d4fb5af08__grid-overlay-tile-in{to{opacity:1;transform:scale(1)}}._4a216a8093440aa5__overlay:not(.f70300e01495372e__is-active){transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._4a216a8093440aa5__overlay:not(.f70300e01495372e__is-active) ._159bdd76b978aeed__column,._4a216a8093440aa5__overlay:not(.f70300e01495372e__is-active) .df4f340583099149__row{animation:none;transform:none}}@media (prefers-reduced-motion:reduce){._4a216a8093440aa5__overlay{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._4a216a8093440aa5__overlay.f70300e01495372e__is-active{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear 0s}}._159bdd76b978aeed__column{display:flex;flex-direction:column;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));min-width:0}.df4f340583099149__row{background-color:var(--wp-grid-overlay-tile-bg,var(--wpds-color-background-surface-neutral-weak,#f3f3f3));border-radius:var(--wpds-border-radius-lg,8px);box-sizing:border-box;flex:0 0 var(--wp-grid-overlay-row-height);height:var(--wp-grid-overlay-row-height)}");
|
|
135
137
|
var grid_overlay_module_default = {
|
|
136
|
-
"overlay": "
|
|
137
|
-
"is-active": "
|
|
138
|
-
"row": "
|
|
139
|
-
"has-rows": "
|
|
140
|
-
"column": "
|
|
141
|
-
"grid-overlay-tile-in": "
|
|
138
|
+
"overlay": "_4a216a8093440aa5__overlay",
|
|
139
|
+
"is-active": "f70300e01495372e__is-active",
|
|
140
|
+
"row": "df4f340583099149__row",
|
|
141
|
+
"has-rows": "b4be0dcd9c079b20__has-rows",
|
|
142
|
+
"column": "_159bdd76b978aeed__column",
|
|
143
|
+
"grid-overlay-tile-in": "a54d5a1d4fb5af08__grid-overlay-tile-in"
|
|
142
144
|
};
|
|
143
145
|
// packages/grid/src/shared/grid-overlay.tsx
|
|
144
146
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-overlay.cjs","names":["useState","styles"],"sources":["../../../style-runtime/src/index.ts","../../src/shared/grid-overlay.module.css","../../src/shared/grid-overlay.tsx"],"sourcesContent":["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(\"6403454dc5\", \"._25129ed7a26e7e13__overlay{display:grid;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));inset:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden}._25129ed7a26e7e13__overlay.b8aeff13d321f688__is-active{opacity:1;visibility:visible}@media not (prefers-reduced-motion){._25129ed7a26e7e13__overlay.b8aeff13d321f688__is-active ._77f7aa6e64d3f582__row,._25129ed7a26e7e13__overlay.b8aeff13d321f688__is-active:not(.d45f40be6bbfcbd1__has-rows) ._79f01d1ba6c72aa8__column{animation:b17f75714e3dfcc2__grid-overlay-tile-in var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)) both;animation-delay:calc(var(--wp-grid-overlay-wave-delay-step, 28ms)*(var(--wp-grid-overlay-column-index, 0) + var(--wp-grid-overlay-row-index, 0)));opacity:0;transform:scale(.64)}@keyframes b17f75714e3dfcc2__grid-overlay-tile-in{to{opacity:1;transform:scale(1)}}._25129ed7a26e7e13__overlay:not(.b8aeff13d321f688__is-active){transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._25129ed7a26e7e13__overlay:not(.b8aeff13d321f688__is-active) ._77f7aa6e64d3f582__row,._25129ed7a26e7e13__overlay:not(.b8aeff13d321f688__is-active) ._79f01d1ba6c72aa8__column{animation:none;transform:none}}@media (prefers-reduced-motion:reduce){._25129ed7a26e7e13__overlay{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._25129ed7a26e7e13__overlay.b8aeff13d321f688__is-active{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear 0s}}._79f01d1ba6c72aa8__column{display:flex;flex-direction:column;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));min-width:0}._77f7aa6e64d3f582__row{background-color:var(--wp-grid-overlay-tile-bg,var(--wpds-color-background-surface-neutral-weak,#f4f4f4));border-radius:var(--wpds-border-radius-lg,8px);box-sizing:border-box;flex:0 0 var(--wp-grid-overlay-row-height);height:var(--wp-grid-overlay-row-height)}\");\n}\nexport default {\"overlay\":\"_25129ed7a26e7e13__overlay\",\"is-active\":\"b8aeff13d321f688__is-active\",\"row\":\"_77f7aa6e64d3f582__row\",\"has-rows\":\"d45f40be6bbfcbd1__has-rows\",\"column\":\"_79f01d1ba6c72aa8__column\",\"grid-overlay-tile-in\":\"b17f75714e3dfcc2__grid-overlay-tile-in\"};\n","import clsx from 'clsx';\nimport { useEffect, useState } from '@wordpress/element';\nimport type { GridOverlayRenderProps } from './types';\nimport styles from './grid-overlay.module.css';\n\n/**\n * Default edit-mode overlay: one column per track, each holding `rows`\n * row-marker tiles when `rowHeight` is uniform. Used by both surfaces\n * and replaceable via `renderGridOverlay`. Reveals with a diagonal\n * wave on activate and releases paint cost while inactive.\n *\n * @param props Render props supplied by the surface.\n * @param props.columns Column tracks to mirror.\n * @param props.rowHeight Uniform row height in pixels; omitted for\n * content-sized rows, which skip row markers.\n * @param props.rows Row tracks per column; omitted when unknown.\n * @param props.isActive When `false`, the overlay fades out.\n */\nexport function GridOverlay( {\n\tcolumns,\n\trowHeight,\n\trows,\n\tisActive,\n}: GridOverlayRenderProps ) {\n\tconst showRows =\n\t\ttypeof rowHeight === 'number' && typeof rows === 'number' && rows > 0;\n\t// Bump the key when edit mode activates so CSS animations restart on\n\t// each enter (the overlay stays mounted across toggles).\n\tconst [ waveKey, setWaveKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tif ( isActive ) {\n\t\t\tsetWaveKey( ( key ) => key + 1 );\n\t\t}\n\t}, [ isActive ] );\n\tconst style: React.CSSProperties = {\n\t\tgridTemplateColumns: `repeat(${ columns }, minmax(0, 1fr))`,\n\t\t...( showRows\n\t\t\t? ( {\n\t\t\t\t\t'--wp-grid-overlay-row-height': `${ rowHeight }px`,\n\t\t\t\t} as React.CSSProperties )\n\t\t\t: {} ),\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tkey={ waveKey }\n\t\t\taria-hidden\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles.overlay,\n\t\t\t\tisActive && styles[ 'is-active' ],\n\t\t\t\tshowRows && styles[ 'has-rows' ]\n\t\t\t) }\n\t\t\tstyle={ style }\n\t\t>\n\t\t\t{ Array.from( { length: columns }, ( _column, columnIndex ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\tclassName={ styles.column }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'--wp-grid-overlay-column-index': columnIndex,\n\t\t\t\t\t\t\t'--wp-grid-overlay-row-index': 0,\n\t\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ showRows &&\n\t\t\t\t\t\tArray.from( { length: rows }, ( _row, rowIndex ) => (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey={ rowIndex }\n\t\t\t\t\t\t\t\tclassName={ styles.row }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'--wp-grid-overlay-row-index': rowIndex,\n\t\t\t\t\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;;;;;;;;AAU7B,SAAS,aAAa;CACrB,MAAM,cAAc;CAEpB,IAAK,YAAY,kBAChB,OAAO,YAAY;CAGpB,YAAY,mBAAmB;EAC9B,2BAAW,IAAI,IAAI;EACnB,wBAAQ,IAAI,IAAI;EAChB,gCAAgB,IAAI,QAAQ;CAC7B;CAEA,IAAK,OAAO,aAAa,aACxB,iBAAkB,QAAS;CAG5B,OAAO,YAAY;AACpB;;;;;;;;;AAUA,SAAS,0BACR,gBACA,MACU;CACV,IAAK,CAAE,eAAe,MACrB,OAAO;CAGR,KAAM,MAAM,SAAS,eAAe,KAAK,iBACxC,SAAU,qBAAsB,EACjC,GACC,IAAK,MAAM,aAAc,oBAAqB,MAAM,MACnD,OAAO;CAIT,OAAO;AACR;;;;;;;;;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;CAC3E,IAAK,CAAE,eAAe,MACrB;CAGD,MAAM,UAAU,WAAW;CAC3B,IAAI,iBAAiB,QAAQ,eAAe,IAAK,cAAe;CAEh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AgB,YAAa,EAC5B,SACA,WACA,MACA,YAC2B;CAC3B,MAAM,WACL,OAAO,cAAc,YAAY,OAAO,SAAS,YAAY,OAAO;CAGrE,MAAM,CAAE,SAAS,eAAA,GAAeA,mBAAAA,SAAAA,CAAU,CAAE;CAC5C,CAAA,GAAA,mBAAA,UAAA,OAAiB;EAChB,IAAK,UACJ,YAAc,QAAS,MAAM,CAAE;CAEjC,GAAG,CAAE,QAAS,CAAE;CAChB,MAAM,QAA6B;EAClC,qBAAqB,UAAW,QAAS;EACzC,GAAK,WACA,EACF,gCAAgC,GAAI,UAAW,IAChD,IACC,CAAC;CACL;CAEA,OACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAEC,eAAA;EACA,YAAA,GAAY,KAAA,QAAA,CACXC,4BAAO,SACP,YAAYA,4BAAQ,cACpB,YAAYA,4BAAQ,WACrB;EACQ;EAEN,UAAA,MAAM,KAAM,EAAE,QAAQ,QAAQ,IAAK,SAAS,gBAC7C,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAEC,WAAYA,4BAAO;GACnB,OACC;IACC,kCAAkC;IAClC,+BAA+B;GAChC;GAGC,UAAA,YACD,MAAM,KAAM,EAAE,QAAQ,KAAK,IAAK,MAAM,aACrC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAEC,WAAYA,4BAAO;IACnB,OACC,EACC,+BAA+B,SAChC;GAED,GAPM,QAON,CACA;EACC,GArBE,WAqBF,CACJ;CACE,GAlCE,OAkCF;AAEP"}
|
|
1
|
+
{"version":3,"file":"grid-overlay.cjs","names":["useState","useEffect","clsx","styles"],"sources":["../../../style-runtime/src/index.ts","../../src/shared/grid-overlay.module.css","../../src/shared/grid-overlay.tsx"],"sourcesContent":["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(\"06dd759fcf\", \"._4a216a8093440aa5__overlay{display:grid;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));inset:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden}._4a216a8093440aa5__overlay.f70300e01495372e__is-active{opacity:1;visibility:visible}@media not (prefers-reduced-motion){._4a216a8093440aa5__overlay.f70300e01495372e__is-active .df4f340583099149__row,._4a216a8093440aa5__overlay.f70300e01495372e__is-active:not(.b4be0dcd9c079b20__has-rows) ._159bdd76b978aeed__column{animation:a54d5a1d4fb5af08__grid-overlay-tile-in var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)) both;animation-delay:calc(var(--wp-grid-overlay-wave-delay-step, 28ms)*(var(--wp-grid-overlay-column-index, 0) + var(--wp-grid-overlay-row-index, 0)));opacity:0;transform:scale(.64)}@keyframes a54d5a1d4fb5af08__grid-overlay-tile-in{to{opacity:1;transform:scale(1)}}._4a216a8093440aa5__overlay:not(.f70300e01495372e__is-active){transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._4a216a8093440aa5__overlay:not(.f70300e01495372e__is-active) ._159bdd76b978aeed__column,._4a216a8093440aa5__overlay:not(.f70300e01495372e__is-active) .df4f340583099149__row{animation:none;transform:none}}@media (prefers-reduced-motion:reduce){._4a216a8093440aa5__overlay{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._4a216a8093440aa5__overlay.f70300e01495372e__is-active{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear 0s}}._159bdd76b978aeed__column{display:flex;flex-direction:column;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));min-width:0}.df4f340583099149__row{background-color:var(--wp-grid-overlay-tile-bg,var(--wpds-color-background-surface-neutral-weak,#f3f3f3));border-radius:var(--wpds-border-radius-lg,8px);box-sizing:border-box;flex:0 0 var(--wp-grid-overlay-row-height);height:var(--wp-grid-overlay-row-height)}\");\n}\nexport default {\"overlay\":\"_4a216a8093440aa5__overlay\",\"is-active\":\"f70300e01495372e__is-active\",\"row\":\"df4f340583099149__row\",\"has-rows\":\"b4be0dcd9c079b20__has-rows\",\"column\":\"_159bdd76b978aeed__column\",\"grid-overlay-tile-in\":\"a54d5a1d4fb5af08__grid-overlay-tile-in\"};\n","import clsx from 'clsx';\nimport { useEffect, useState } from '@wordpress/element';\nimport type { GridOverlayRenderProps } from './types';\nimport styles from './grid-overlay.module.css';\n\n/**\n * Default edit-mode overlay: one column per track, each holding `rows`\n * row-marker tiles when `rowHeight` is uniform. Used by both surfaces\n * and replaceable via `renderGridOverlay`. Reveals with a diagonal\n * wave on activate and releases paint cost while inactive.\n *\n * @param props Render props supplied by the surface.\n * @param props.columns Column tracks to mirror.\n * @param props.rowHeight Uniform row height in pixels; omitted for\n * content-sized rows, which skip row markers.\n * @param props.rows Row tracks per column; omitted when unknown.\n * @param props.isActive When `false`, the overlay fades out.\n */\nexport function GridOverlay( {\n\tcolumns,\n\trowHeight,\n\trows,\n\tisActive,\n}: GridOverlayRenderProps ) {\n\tconst showRows =\n\t\ttypeof rowHeight === 'number' && typeof rows === 'number' && rows > 0;\n\t// Bump the key when edit mode activates so CSS animations restart on\n\t// each enter (the overlay stays mounted across toggles).\n\tconst [ waveKey, setWaveKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tif ( isActive ) {\n\t\t\tsetWaveKey( ( key ) => key + 1 );\n\t\t}\n\t}, [ isActive ] );\n\tconst style: React.CSSProperties = {\n\t\tgridTemplateColumns: `repeat(${ columns }, minmax(0, 1fr))`,\n\t\t...( showRows\n\t\t\t? ( {\n\t\t\t\t\t'--wp-grid-overlay-row-height': `${ rowHeight }px`,\n\t\t\t\t} as React.CSSProperties )\n\t\t\t: {} ),\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tkey={ waveKey }\n\t\t\taria-hidden\n\t\t\tclassName={ clsx(\n\t\t\t\tstyles.overlay,\n\t\t\t\tisActive && styles[ 'is-active' ],\n\t\t\t\tshowRows && styles[ 'has-rows' ]\n\t\t\t) }\n\t\t\tstyle={ style }\n\t\t>\n\t\t\t{ Array.from( { length: columns }, ( _column, columnIndex ) => (\n\t\t\t\t<div\n\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\tclassName={ styles.column }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'--wp-grid-overlay-column-index': columnIndex,\n\t\t\t\t\t\t\t'--wp-grid-overlay-row-index': 0,\n\t\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ showRows &&\n\t\t\t\t\t\tArray.from( { length: rows }, ( _row, rowIndex ) => (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tkey={ rowIndex }\n\t\t\t\t\t\t\t\tclassName={ styles.row }\n\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'--wp-grid-overlay-row-index': rowIndex,\n\t\t\t\t\t\t\t\t\t} as React.CSSProperties\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t</div>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,uBAAuB;;;;;;;;;AAU7B,SAAS,aAAa;CACrB,MAAM,cAAc;CAEpB,IAAK,YAAY,kBAChB,OAAO,YAAY;CAGpB,YAAY,mBA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BAA+B;GAChC;GAGC,UAAA,YACD,MAAM,KAAM,EAAE,QAAQ,KAAK,IAAK,MAAM,aACrC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAEC,WAAYA,4BAAO;IACnB,OACC,EACC,+BAA+B,SAChC;GAED,GAPM,QAON,CACA;EACC,GArBE,WAqBF,CACJ;CACE,GAlCE,OAkCF;AAEP"}
|
|
@@ -11,12 +11,14 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
15
|
-
key
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
+
desc = __getOwnPropDesc(from, key);
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: desc && desc.get && !desc.configurable ? desc.get : () => from[key],
|
|
19
|
+
enumerable: !desc || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
20
22
|
}
|
|
21
23
|
return to;
|
|
22
24
|
};
|
|
@@ -26,10 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
28
|
}) : target, mod));
|
|
27
29
|
let _dnd_kit_core = require("@dnd-kit/core");
|
|
28
30
|
let clsx = require("clsx");
|
|
29
|
-
clsx = __toESM(clsx);
|
|
30
31
|
let _wordpress_element = require("@wordpress/element");
|
|
31
32
|
let _wordpress_compose = require("@wordpress/compose");
|
|
32
33
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
clsx = __toESM(clsx);
|
|
33
35
|
// packages/style-runtime/src/index.ts
|
|
34
36
|
const STYLE_HASH_ATTRIBUTE = "data-wp-hash";
|
|
35
37
|
/**
|