@wordpress/grid 0.6.0 → 0.7.1-next.v.202608281122.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/CHANGELOG.md +14 -0
- package/README.md +44 -1
- package/build/dashboard-grid/grid-item.cjs +21 -7
- package/build/dashboard-grid/grid-item.cjs.map +2 -2
- package/build/dashboard-grid/index.cjs +107 -45
- package/build/dashboard-grid/index.cjs.map +2 -2
- package/build/dashboard-grid/resolve-fill-widths.cjs +68 -50
- package/build/dashboard-grid/resolve-fill-widths.cjs.map +2 -2
- package/build/dashboard-grid/types.cjs.map +1 -1
- package/build/dashboard-lanes/index.cjs +59 -17
- package/build/dashboard-lanes/index.cjs.map +2 -2
- package/build/dashboard-lanes/lanes-item.cjs +14 -6
- package/build/dashboard-lanes/lanes-item.cjs.map +2 -2
- package/build/dashboard-lanes/types.cjs.map +1 -1
- package/build/index.cjs.map +1 -1
- package/build/shared/array-move-with-pinned.cjs +49 -0
- package/build/shared/array-move-with-pinned.cjs.map +7 -0
- package/build/shared/resize-snap.cjs +91 -5
- package/build/shared/resize-snap.cjs.map +2 -2
- package/build/shared/types.cjs.map +1 -1
- package/build/shared/use-span-bounds.cjs +85 -0
- package/build/shared/use-span-bounds.cjs.map +7 -0
- package/build-module/dashboard-grid/grid-item.mjs +21 -7
- package/build-module/dashboard-grid/grid-item.mjs.map +2 -2
- package/build-module/dashboard-grid/index.mjs +108 -47
- package/build-module/dashboard-grid/index.mjs.map +2 -2
- package/build-module/dashboard-grid/resolve-fill-widths.mjs +68 -50
- package/build-module/dashboard-grid/resolve-fill-widths.mjs.map +2 -2
- package/build-module/dashboard-lanes/index.mjs +60 -19
- package/build-module/dashboard-lanes/index.mjs.map +2 -2
- package/build-module/dashboard-lanes/lanes-item.mjs +14 -6
- package/build-module/dashboard-lanes/lanes-item.mjs.map +2 -2
- package/build-module/index.mjs.map +1 -1
- package/build-module/shared/array-move-with-pinned.mjs +24 -0
- package/build-module/shared/array-move-with-pinned.mjs.map +7 -0
- package/build-module/shared/resize-snap.mjs +87 -4
- package/build-module/shared/resize-snap.mjs.map +2 -2
- package/build-module/shared/use-span-bounds.mjs +62 -0
- package/build-module/shared/use-span-bounds.mjs.map +7 -0
- package/build-types/dashboard-grid/grid-item.d.ts +1 -1
- package/build-types/dashboard-grid/grid-item.d.ts.map +1 -1
- package/build-types/dashboard-grid/index.d.ts.map +1 -1
- package/build-types/dashboard-grid/resolve-fill-widths.d.ts +12 -1
- package/build-types/dashboard-grid/resolve-fill-widths.d.ts.map +1 -1
- package/build-types/dashboard-grid/types.d.ts +43 -1
- package/build-types/dashboard-grid/types.d.ts.map +1 -1
- package/build-types/dashboard-lanes/index.d.ts.map +1 -1
- package/build-types/dashboard-lanes/lanes-item.d.ts +18 -1
- package/build-types/dashboard-lanes/lanes-item.d.ts.map +1 -1
- package/build-types/dashboard-lanes/types.d.ts +20 -1
- package/build-types/dashboard-lanes/types.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/shared/array-move-with-pinned.d.ts +13 -0
- package/build-types/shared/array-move-with-pinned.d.ts.map +1 -0
- package/build-types/shared/resize-snap.d.ts +65 -2
- package/build-types/shared/resize-snap.d.ts.map +1 -1
- package/build-types/shared/types.d.ts +31 -0
- package/build-types/shared/types.d.ts.map +1 -1
- package/build-types/shared/use-span-bounds.d.ts +29 -0
- package/build-types/shared/use-span-bounds.d.ts.map +1 -0
- package/package.json +7 -8
- package/src/dashboard-grid/grid-item.tsx +21 -7
- package/src/dashboard-grid/index.tsx +154 -57
- package/src/dashboard-grid/resolve-fill-widths.ts +85 -62
- package/src/dashboard-grid/stories/index.story.tsx +154 -0
- package/src/dashboard-grid/test/item-interactions.test.tsx +63 -0
- package/src/dashboard-grid/test/item-limits.test.tsx +147 -0
- package/src/dashboard-grid/test/resolve-fill-widths.test.ts +158 -0
- package/src/dashboard-grid/types.ts +50 -0
- package/src/dashboard-lanes/index.tsx +86 -24
- package/src/dashboard-lanes/lanes-item.tsx +34 -6
- package/src/dashboard-lanes/stories/index.story.tsx +119 -0
- package/src/dashboard-lanes/test/item-interactions.test.tsx +63 -0
- package/src/dashboard-lanes/test/item-limits.test.tsx +140 -0
- package/src/dashboard-lanes/types.ts +23 -0
- package/src/index.ts +2 -0
- package/src/shared/array-move-with-pinned.ts +36 -0
- package/src/shared/resize-snap.ts +161 -5
- package/src/shared/test/array-move-with-pinned.test.ts +39 -0
- package/src/shared/test/resize-snap.test.ts +170 -2
- package/src/shared/test/use-span-bounds.test.ts +104 -0
- package/src/shared/types.ts +35 -0
- package/src/shared/use-span-bounds.ts +99 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/grid/src/shared/array-move-with-pinned.ts
|
|
21
|
+
var array_move_with_pinned_exports = {};
|
|
22
|
+
__export(array_move_with_pinned_exports, {
|
|
23
|
+
arrayMoveWithPinned: () => arrayMoveWithPinned
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(array_move_with_pinned_exports);
|
|
26
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
27
|
+
function arrayMoveWithPinned(items, from, to, isPinned) {
|
|
28
|
+
const pinned = new Set(items.filter(isPinned));
|
|
29
|
+
if (pinned.size === 0) {
|
|
30
|
+
return (0, import_sortable.arrayMove)(items, from, to);
|
|
31
|
+
}
|
|
32
|
+
const free = (0, import_sortable.arrayMove)(items, from, to).filter(
|
|
33
|
+
(item) => !pinned.has(item)
|
|
34
|
+
);
|
|
35
|
+
let nextFree = 0;
|
|
36
|
+
return items.map((item) => {
|
|
37
|
+
if (pinned.has(item)) {
|
|
38
|
+
return item;
|
|
39
|
+
}
|
|
40
|
+
const next = free[nextFree];
|
|
41
|
+
nextFree += 1;
|
|
42
|
+
return next;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
arrayMoveWithPinned
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=array-move-with-pinned.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/shared/array-move-with-pinned.ts"],
|
|
4
|
+
"sourcesContent": ["import { arrayMove } from '@dnd-kit/sortable';\n\n/**\n * Moves the item at `from` to `to` while pinned items hold their index:\n * the free items reorder among the remaining slots. Moving a pinned item\n * is a no-op.\n *\n * @param items Items in display order.\n * @param from Index of the moved item.\n * @param to Target index.\n * @param isPinned Whether an item holds its index.\n * @return The reordered items.\n */\nexport function arrayMoveWithPinned< T >(\n\titems: T[],\n\tfrom: number,\n\tto: number,\n\tisPinned: ( item: T ) => boolean\n): T[] {\n\tconst pinned = new Set( items.filter( isPinned ) );\n\tif ( pinned.size === 0 ) {\n\t\treturn arrayMove( items, from, to );\n\t}\n\tconst free = arrayMove( items, from, to ).filter(\n\t\t( item ) => ! pinned.has( item )\n\t);\n\tlet nextFree = 0;\n\treturn items.map( ( item ) => {\n\t\tif ( pinned.has( item ) ) {\n\t\t\treturn item;\n\t\t}\n\t\tconst next = free[ nextFree ];\n\t\tnextFree += 1;\n\t\treturn next;\n\t} );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0B;AAanB,SAAS,oBACf,OACA,MACA,IACA,UACM;AACN,QAAM,SAAS,IAAI,IAAK,MAAM,OAAQ,QAAS,CAAE;AACjD,MAAK,OAAO,SAAS,GAAI;AACxB,eAAO,2BAAW,OAAO,MAAM,EAAG;AAAA,EACnC;AACA,QAAM,WAAO,2BAAW,OAAO,MAAM,EAAG,EAAE;AAAA,IACzC,CAAE,SAAU,CAAE,OAAO,IAAK,IAAK;AAAA,EAChC;AACA,MAAI,WAAW;AACf,SAAO,MAAM,IAAK,CAAE,SAAU;AAC7B,QAAK,OAAO,IAAK,IAAK,GAAI;AACzB,aAAO;AAAA,IACR;AACA,UAAM,OAAO,KAAM,QAAS;AAC5B,gBAAY;AACZ,WAAO;AAAA,EACR,CAAE;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -21,17 +21,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var resize_snap_exports = {};
|
|
22
22
|
__export(resize_snap_exports, {
|
|
23
23
|
clampResizeDelta: () => clampResizeDelta,
|
|
24
|
-
|
|
24
|
+
clampSpan: () => clampSpan,
|
|
25
|
+
gridSpanToPixelSize: () => gridSpanToPixelSize,
|
|
26
|
+
pixelLimitsToSpanBounds: () => pixelLimitsToSpanBounds,
|
|
27
|
+
spanBoundsToPixelLimits: () => spanBoundsToPixelLimits
|
|
25
28
|
});
|
|
26
29
|
module.exports = __toCommonJS(resize_snap_exports);
|
|
27
|
-
function clampResizeDelta(delta, initialSize, minSize) {
|
|
30
|
+
function clampResizeDelta(delta, initialSize, minSize, maxSize) {
|
|
28
31
|
const maxShrinkWidth = initialSize.width - minSize.width;
|
|
29
|
-
|
|
32
|
+
let width = Math.max(delta.width, -maxShrinkWidth);
|
|
33
|
+
if (maxSize?.width !== void 0) {
|
|
34
|
+
width = Math.min(width, maxSize.width - initialSize.width);
|
|
35
|
+
}
|
|
30
36
|
if (minSize.height === void 0) {
|
|
31
37
|
return { ...delta, width };
|
|
32
38
|
}
|
|
33
39
|
const maxShrinkHeight = initialSize.height - minSize.height;
|
|
34
|
-
|
|
40
|
+
let height = Math.max(delta.height, -maxShrinkHeight);
|
|
41
|
+
if (maxSize?.height !== void 0) {
|
|
42
|
+
height = Math.min(height, maxSize.height - initialSize.height);
|
|
43
|
+
}
|
|
35
44
|
return { width, height };
|
|
36
45
|
}
|
|
37
46
|
function gridSpanToPixelSize(columnSpan, rowSpan, columnWidth, gapPx, rowHeightPx) {
|
|
@@ -39,9 +48,86 @@ function gridSpanToPixelSize(columnSpan, rowSpan, columnWidth, gapPx, rowHeightP
|
|
|
39
48
|
const heightPx = rowHeightPx === null ? null : rowSpan * rowHeightPx + (rowSpan - 1) * gapPx;
|
|
40
49
|
return { widthPx, heightPx };
|
|
41
50
|
}
|
|
51
|
+
function pixelLimitsToSpanBounds(limits, columnWidth, gapPx, rowHeightPx, maxColumns) {
|
|
52
|
+
let minWidth = 1;
|
|
53
|
+
let maxWidth = maxColumns;
|
|
54
|
+
if (columnWidth > 0) {
|
|
55
|
+
const columnTrack = columnWidth + gapPx;
|
|
56
|
+
if (limits.minWidth) {
|
|
57
|
+
minWidth = Math.min(
|
|
58
|
+
Math.max(
|
|
59
|
+
1,
|
|
60
|
+
Math.ceil((limits.minWidth + gapPx) / columnTrack)
|
|
61
|
+
),
|
|
62
|
+
maxColumns
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (limits.maxWidth) {
|
|
66
|
+
maxWidth = Math.min(
|
|
67
|
+
Math.max(
|
|
68
|
+
1,
|
|
69
|
+
Math.floor((limits.maxWidth + gapPx) / columnTrack)
|
|
70
|
+
),
|
|
71
|
+
maxColumns
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let minHeight = 1;
|
|
76
|
+
let maxHeight = Infinity;
|
|
77
|
+
if (rowHeightPx !== null && rowHeightPx > 0) {
|
|
78
|
+
const rowTrack = rowHeightPx + gapPx;
|
|
79
|
+
if (limits.minHeight) {
|
|
80
|
+
minHeight = Math.max(
|
|
81
|
+
1,
|
|
82
|
+
Math.ceil((limits.minHeight + gapPx) / rowTrack)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
if (limits.maxHeight) {
|
|
86
|
+
maxHeight = Math.max(
|
|
87
|
+
1,
|
|
88
|
+
Math.floor((limits.maxHeight + gapPx) / rowTrack)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
minWidth,
|
|
94
|
+
minHeight,
|
|
95
|
+
maxWidth: Math.max(maxWidth, minWidth),
|
|
96
|
+
maxHeight: Math.max(maxHeight, minHeight)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function clampSpan(span, min, max) {
|
|
100
|
+
return Math.min(Math.max(span, min), max);
|
|
101
|
+
}
|
|
102
|
+
function spanBoundsToPixelLimits(bounds, columnWidth, gapPx, rowHeightPx) {
|
|
103
|
+
const min = gridSpanToPixelSize(
|
|
104
|
+
bounds.minWidth,
|
|
105
|
+
bounds.minHeight,
|
|
106
|
+
columnWidth,
|
|
107
|
+
gapPx,
|
|
108
|
+
rowHeightPx
|
|
109
|
+
);
|
|
110
|
+
const hasMaxHeight = Number.isFinite(bounds.maxHeight);
|
|
111
|
+
const max = gridSpanToPixelSize(
|
|
112
|
+
bounds.maxWidth,
|
|
113
|
+
hasMaxHeight ? bounds.maxHeight : 1,
|
|
114
|
+
columnWidth,
|
|
115
|
+
gapPx,
|
|
116
|
+
hasMaxHeight ? rowHeightPx : null
|
|
117
|
+
);
|
|
118
|
+
return {
|
|
119
|
+
minWidthPx: min.widthPx,
|
|
120
|
+
minHeightPx: min.heightPx,
|
|
121
|
+
maxWidthPx: max.widthPx,
|
|
122
|
+
maxHeightPx: max.heightPx
|
|
123
|
+
};
|
|
124
|
+
}
|
|
42
125
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
126
|
0 && (module.exports = {
|
|
44
127
|
clampResizeDelta,
|
|
45
|
-
|
|
128
|
+
clampSpan,
|
|
129
|
+
gridSpanToPixelSize,
|
|
130
|
+
pixelLimitsToSpanBounds,
|
|
131
|
+
spanBoundsToPixelLimits
|
|
46
132
|
});
|
|
47
133
|
//# sourceMappingURL=resize-snap.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shared/resize-snap.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ResizeDelta } from './types';\n\n/**\n * Pixel dimensions for the snapped resize preview outline.\n */\nexport type ResizeSnapSize = {\n\twidthPx: number;\n\t/** When `null`, the preview spans the item's content height (lanes). */\n\theightPx: number | null;\n};\n\n/**\n * Clamps a resize delta so the tile cannot shrink below the given\n * minimum
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import type { GridItemLimits, ResizeDelta } from './types';\n\n/**\n * Pixel dimensions for the snapped resize preview outline.\n */\nexport type ResizeSnapSize = {\n\twidthPx: number;\n\t/** When `null`, the preview spans the item's content height (lanes). */\n\theightPx: number | null;\n};\n\n/**\n * Clamps a resize delta so the tile cannot shrink below the given\n * minimum size, nor grow past the given maximum when one applies.\n *\n * @param delta Cursor offset from the gesture start in pixels.\n * @param initialSize Size captured at gesture start.\n * @param initialSize.width Initial width in pixels.\n * @param initialSize.height Initial height in pixels.\n * @param minSize Minimum tile size in pixels.\n * @param minSize.width Minimum width in pixels.\n * @param minSize.height Minimum height in pixels, when vertical resize applies.\n * @param maxSize Maximum tile size in pixels, when one applies.\n * @param maxSize.width Maximum width in pixels.\n * @param maxSize.height Maximum height in pixels, when vertical resize applies.\n */\nexport function clampResizeDelta(\n\tdelta: ResizeDelta,\n\tinitialSize: { width: number; height: number },\n\tminSize: { width: number; height?: number },\n\tmaxSize?: { width?: number; height?: number }\n): ResizeDelta {\n\tconst maxShrinkWidth = initialSize.width - minSize.width;\n\tlet width = Math.max( delta.width, -maxShrinkWidth );\n\tif ( maxSize?.width !== undefined ) {\n\t\twidth = Math.min( width, maxSize.width - initialSize.width );\n\t}\n\tif ( minSize.height === undefined ) {\n\t\treturn { ...delta, width };\n\t}\n\tconst maxShrinkHeight = initialSize.height - minSize.height;\n\tlet height = Math.max( delta.height, -maxShrinkHeight );\n\tif ( maxSize?.height !== undefined ) {\n\t\theight = Math.min( height, maxSize.height - initialSize.height );\n\t}\n\treturn { width, height };\n}\n\n/**\n * Converts grid spans to pixel width/height for the resize-preview\n * outline, using the same track math the surface uses for placement.\n *\n * @param columnSpan Number of columns the snap target spans.\n * @param rowSpan Number of rows the snap target spans.\n * @param columnWidth Width of one column track in pixels.\n * @param gapPx Gap between tracks in pixels.\n * @param rowHeightPx Row track height in pixels, or `null` when rows\n * are content-sized.\n */\nexport function gridSpanToPixelSize(\n\tcolumnSpan: number,\n\trowSpan: number,\n\tcolumnWidth: number,\n\tgapPx: number,\n\trowHeightPx: number | null\n): ResizeSnapSize {\n\tconst widthPx = columnSpan * columnWidth + ( columnSpan - 1 ) * gapPx;\n\tconst heightPx =\n\t\trowHeightPx === null\n\t\t\t? null\n\t\t\t: rowSpan * rowHeightPx + ( rowSpan - 1 ) * gapPx;\n\treturn { widthPx, heightPx };\n}\n\n/**\n * Span bounds derived from per-item pixel limits, in whole tracks.\n * Maximums are concrete: an undeclared width maximum resolves to the\n * column count, an undeclared or inapplicable height maximum to\n * `Infinity`.\n */\nexport type SpanBounds = {\n\tminWidth: number;\n\tminHeight: number;\n\tmaxWidth: number;\n\tmaxHeight: number;\n};\n\n/**\n * Converts per-item pixel limits to span bounds with the track math of\n * `gridSpanToPixelSize`. Minimums round up, maximums round down, every\n * bound stays at one track or more, and a minimum wins over a smaller\n * maximum. Width bounds saturate at the column count; height bounds\n * resolve to `1`/`Infinity` when rows are content-sized.\n *\n * @param limits Size limits in pixels.\n * @param columnWidth Width of one column track in pixels.\n * @param gapPx Gap between tracks in pixels.\n * @param rowHeightPx Row track height in pixels, or `null` when rows\n * are content-sized.\n * @param maxColumns Number of column tracks in the surface.\n */\nexport function pixelLimitsToSpanBounds(\n\tlimits: GridItemLimits,\n\tcolumnWidth: number,\n\tgapPx: number,\n\trowHeightPx: number | null,\n\tmaxColumns: number\n): SpanBounds {\n\tlet minWidth = 1;\n\tlet maxWidth = maxColumns;\n\tif ( columnWidth > 0 ) {\n\t\tconst columnTrack = columnWidth + gapPx;\n\t\tif ( limits.minWidth ) {\n\t\t\tminWidth = Math.min(\n\t\t\t\tMath.max(\n\t\t\t\t\t1,\n\t\t\t\t\tMath.ceil( ( limits.minWidth + gapPx ) / columnTrack )\n\t\t\t\t),\n\t\t\t\tmaxColumns\n\t\t\t);\n\t\t}\n\t\tif ( limits.maxWidth ) {\n\t\t\tmaxWidth = Math.min(\n\t\t\t\tMath.max(\n\t\t\t\t\t1,\n\t\t\t\t\tMath.floor( ( limits.maxWidth + gapPx ) / columnTrack )\n\t\t\t\t),\n\t\t\t\tmaxColumns\n\t\t\t);\n\t\t}\n\t}\n\n\tlet minHeight = 1;\n\tlet maxHeight = Infinity;\n\tif ( rowHeightPx !== null && rowHeightPx > 0 ) {\n\t\tconst rowTrack = rowHeightPx + gapPx;\n\t\tif ( limits.minHeight ) {\n\t\t\tminHeight = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.ceil( ( limits.minHeight + gapPx ) / rowTrack )\n\t\t\t);\n\t\t}\n\t\tif ( limits.maxHeight ) {\n\t\t\tmaxHeight = Math.max(\n\t\t\t\t1,\n\t\t\t\tMath.floor( ( limits.maxHeight + gapPx ) / rowTrack )\n\t\t\t);\n\t\t}\n\t}\n\n\treturn {\n\t\tminWidth,\n\t\tminHeight,\n\t\tmaxWidth: Math.max( maxWidth, minWidth ),\n\t\tmaxHeight: Math.max( maxHeight, minHeight ),\n\t};\n}\n\n/**\n * Clamps a span to the inclusive `[ min, max ]` range.\n *\n * @param span Span in tracks.\n * @param min Lowest allowed span.\n * @param max Highest allowed span.\n */\nexport function clampSpan( span: number, min: number, max: number ): number {\n\treturn Math.min( Math.max( span, min ), max );\n}\n\n/**\n * Pixel limits for the resize gesture, derived from span bounds.\n * Heights are `null` when rows are content-sized or the height\n * bound is open.\n */\nexport type ResizePixelLimits = {\n\tminWidthPx: number;\n\tminHeightPx: number | null;\n\tmaxWidthPx: number;\n\tmaxHeightPx: number | null;\n};\n\n/**\n * Converts span bounds back to pixel limits for the resize gesture,\n * using the same track math as `gridSpanToPixelSize`.\n *\n * @param bounds Span bounds in whole tracks.\n * @param columnWidth Width of one column track in pixels.\n * @param gapPx Gap between tracks in pixels.\n * @param rowHeightPx Row track height in pixels, or `null` when rows\n * are content-sized.\n */\nexport function spanBoundsToPixelLimits(\n\tbounds: SpanBounds,\n\tcolumnWidth: number,\n\tgapPx: number,\n\trowHeightPx: number | null\n): ResizePixelLimits {\n\tconst min = gridSpanToPixelSize(\n\t\tbounds.minWidth,\n\t\tbounds.minHeight,\n\t\tcolumnWidth,\n\t\tgapPx,\n\t\trowHeightPx\n\t);\n\tconst hasMaxHeight = Number.isFinite( bounds.maxHeight );\n\tconst max = gridSpanToPixelSize(\n\t\tbounds.maxWidth,\n\t\thasMaxHeight ? bounds.maxHeight : 1,\n\t\tcolumnWidth,\n\t\tgapPx,\n\t\thasMaxHeight ? rowHeightPx : null\n\t);\n\treturn {\n\t\tminWidthPx: min.widthPx,\n\t\tminHeightPx: min.heightPx,\n\t\tmaxWidthPx: max.widthPx,\n\t\tmaxHeightPx: max.heightPx,\n\t};\n}\n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esContent": ["import type { useDraggable } from '@dnd-kit/core';\n\n// `useDraggable`'s `listeners` and `attributes` types are not exported\n// from `@dnd-kit/core`'s public surface, so derive them from the hook\n// itself rather than via a deep import.\ntype DraggableBindings = ReturnType< typeof useDraggable >;\n\n/**\n * Cursor offset reported by the resize handle, in pixels relative to\n * the gesture start. Width and height are independent so the surface\n * can step columns and rows separately.\n */\nexport type ResizeDelta = {\n\twidth: number;\n\theight: number;\n};\n\n/**\n * Props received by a custom resize handle component. Spread `listeners`\n * and `attributes` onto the element that should respond to the gesture,\n * and assign `ref` to the same element so dnd-kit can track it.\n */\nexport interface ResizeHandleRenderProps {\n\t/**\n\t * Ref callback to attach to the gesture-bearing element.\n\t */\n\tref: DraggableBindings[ 'setNodeRef' ];\n\n\t/**\n\t * Pointer/keyboard event listeners that initiate the drag.\n\t */\n\tlisteners: DraggableBindings[ 'listeners' ];\n\n\t/**\n\t * Accessibility and dnd-kit attributes (role, aria-*, tabIndex…).\n\t */\n\tattributes: DraggableBindings[ 'attributes' ];\n\n\t/**\n\t * Whether vertical resizing is allowed for this tile. Useful for\n\t * adapting the cursor or visual cue.\n\t */\n\tverticalResizable: boolean;\n\n\t/**\n\t * True while the user is actively dragging this handle. Use it to\n\t * swap colors, icons, or transforms during the gesture.\n\t */\n\tisResizing: boolean;\n\n\t/**\n\t * Owning item's `key`. Available so consumers can render per-tile\n\t * content if needed.\n\t */\n\titemId?: string;\n}\n\n/**\n * Props received by a custom drag-preview component. The surface mounts\n * the component inside `<DragOverlay>` and supplies the active tile's\n * cloned children plus its `key`. The component is responsible for the\n * visual chrome of the dragged clone (shadow, radius, padding); the\n * surface keeps a thin functional wrapper around it that owns the lift\n * cue, the cursor, and pointer pass-through during the gesture.\n */\nexport interface DragPreviewRenderProps {\n\t/**\n\t * The cloned tile content the surface mounts inside the\n\t * `<DragOverlay>` portal. Render it where the visual wrapper\n\t * expects the tile body.\n\t */\n\tchildren: React.ReactNode;\n\n\t/**\n\t * Owning tile's `key`. Useful when the visual chrome needs to\n\t * vary by which tile is being dragged.\n\t */\n\titemId: string;\n}\n\n/**\n * Props received by a custom grid overlay component. The overlay\n * paints behind the tiles in edit mode to visualize the column tracks\n * and (when `rowHeight` is defined) the row tracks. Receives a\n * snapshot of the surface's resolved layout parameters so the visual\n * can reproduce the tracks pixel-accurately without re-deriving them.\n *\n * Reused by both `DashboardGrid` and `DashboardLanes`: lanes pass no\n * `rowHeight` because heights are content-driven.\n */\nexport interface GridOverlayRenderProps {\n\t/**\n\t * Number of column tracks in the active surface. In responsive\n\t * mode (`minColumnWidth`), this is the count derived from the\n\t * container width, not the prop value.\n\t */\n\tcolumns: number;\n\n\t/**\n\t * Row height in pixels for surfaces with uniform rows. Omitted on\n\t * surfaces with content-driven heights (lanes) or when row height\n\t * is `'auto'`; in those cases row markers are omitted.\n\t */\n\trowHeight?: number;\n\n\t/**\n\t * Number of row tracks to mirror in each column. Derived from the\n\t * grid container height when `rowHeight` is numeric; omitted when\n\t * row height is unknown.\n\t */\n\trows?: number;\n\n\t/**\n\t * Whether the overlay should be visible. Surfaces render the\n\t * overlay even when `false` so the implementation can transition\n\t * opacity in and out; while `false`, the overlay must hide itself\n\t * (and ideally release paint cost via `visibility: hidden` or an\n\t * equivalent).\n\t */\n\tisActive: boolean;\n}\n\n/**\n * Props for the internal `<ResizeHandle />` wrapper.\n */\nexport interface ResizeHandleProps {\n\t/**\n\t * Owning item's `key`. Forwarded as `data.itemId` on the draggable\n\t * so the parent can correlate the gesture with a tile if needed.\n\t */\n\titemId?: string;\n\n\t/**\n\t * Whether the handle should track vertical movement. When false,\n\t * the handle still appears but only emits horizontal deltas, and\n\t * the cursor is constrained to the column resize axis.\n\t *\n\t * @default true\n\t */\n\tverticalResizable?: boolean;\n\n\t/**\n\t * Callback fired while the handle is being dragged. Receives the\n\t * cursor offset from the gesture start in pixels.\n\t */\n\tonResize?: ( delta: ResizeDelta ) => void;\n\n\t/**\n\t * Callback fired when the gesture ends.\n\t */\n\tonResizeEnd?: () => void;\n\n\t/**\n\t * Component that overrides the default corner triangle with a\n\t * custom element. Receives gesture wiring (`ref`, `listeners`,\n\t * `attributes`) plus context. The surface keeps ownership of the\n\t * `<DndContext>` and the throttled delta loop; consumers are only\n\t * responsible for the visual.\n\t */\n\trenderResizeHandle?: React.ComponentType< ResizeHandleRenderProps >;\n}\n"],
|
|
4
|
+
"sourcesContent": ["import type { useDraggable } from '@dnd-kit/core';\n\n// `useDraggable`'s `listeners` and `attributes` types are not exported\n// from `@dnd-kit/core`'s public surface, so derive them from the hook\n// itself rather than via a deep import.\ntype DraggableBindings = ReturnType< typeof useDraggable >;\n\n/**\n * Cursor offset reported by the resize handle, in pixels relative to\n * the gesture start. Width and height are independent so the surface\n * can step columns and rows separately.\n */\nexport type ResizeDelta = {\n\twidth: number;\n\theight: number;\n};\n\n/**\n * Props received by a custom resize handle component. Spread `listeners`\n * and `attributes` onto the element that should respond to the gesture,\n * and assign `ref` to the same element so dnd-kit can track it.\n */\nexport interface ResizeHandleRenderProps {\n\t/**\n\t * Ref callback to attach to the gesture-bearing element.\n\t */\n\tref: DraggableBindings[ 'setNodeRef' ];\n\n\t/**\n\t * Pointer/keyboard event listeners that initiate the drag.\n\t */\n\tlisteners: DraggableBindings[ 'listeners' ];\n\n\t/**\n\t * Accessibility and dnd-kit attributes (role, aria-*, tabIndex…).\n\t */\n\tattributes: DraggableBindings[ 'attributes' ];\n\n\t/**\n\t * Whether vertical resizing is allowed for this tile. Useful for\n\t * adapting the cursor or visual cue.\n\t */\n\tverticalResizable: boolean;\n\n\t/**\n\t * True while the user is actively dragging this handle. Use it to\n\t * swap colors, icons, or transforms during the gesture.\n\t */\n\tisResizing: boolean;\n\n\t/**\n\t * Owning item's `key`. Available so consumers can render per-tile\n\t * content if needed.\n\t */\n\titemId?: string;\n}\n\n/**\n * Props received by a custom drag-preview component. The surface mounts\n * the component inside `<DragOverlay>` and supplies the active tile's\n * cloned children plus its `key`. The component is responsible for the\n * visual chrome of the dragged clone (shadow, radius, padding); the\n * surface keeps a thin functional wrapper around it that owns the lift\n * cue, the cursor, and pointer pass-through during the gesture.\n */\nexport interface DragPreviewRenderProps {\n\t/**\n\t * The cloned tile content the surface mounts inside the\n\t * `<DragOverlay>` portal. Render it where the visual wrapper\n\t * expects the tile body.\n\t */\n\tchildren: React.ReactNode;\n\n\t/**\n\t * Owning tile's `key`. Useful when the visual chrome needs to\n\t * vary by which tile is being dragged.\n\t */\n\titemId: string;\n}\n\n/**\n * Props received by a custom grid overlay component. The overlay\n * paints behind the tiles in edit mode to visualize the column tracks\n * and (when `rowHeight` is defined) the row tracks. Receives a\n * snapshot of the surface's resolved layout parameters so the visual\n * can reproduce the tracks pixel-accurately without re-deriving them.\n *\n * Reused by both `DashboardGrid` and `DashboardLanes`: lanes pass no\n * `rowHeight` because heights are content-driven.\n */\nexport interface GridOverlayRenderProps {\n\t/**\n\t * Number of column tracks in the active surface. In responsive\n\t * mode (`minColumnWidth`), this is the count derived from the\n\t * container width, not the prop value.\n\t */\n\tcolumns: number;\n\n\t/**\n\t * Row height in pixels for surfaces with uniform rows. Omitted on\n\t * surfaces with content-driven heights (lanes) or when row height\n\t * is `'auto'`; in those cases row markers are omitted.\n\t */\n\trowHeight?: number;\n\n\t/**\n\t * Number of row tracks to mirror in each column. Derived from the\n\t * grid container height when `rowHeight` is numeric; omitted when\n\t * row height is unknown.\n\t */\n\trows?: number;\n\n\t/**\n\t * Whether the overlay should be visible. Surfaces render the\n\t * overlay even when `false` so the implementation can transition\n\t * opacity in and out; while `false`, the overlay must hide itself\n\t * (and ideally release paint cost via `visibility: hidden` or an\n\t * equivalent).\n\t */\n\tisActive: boolean;\n}\n\n/**\n * Props for the internal `<ResizeHandle />` wrapper.\n */\nexport interface ResizeHandleProps {\n\t/**\n\t * Owning item's `key`. Forwarded as `data.itemId` on the draggable\n\t * so the parent can correlate the gesture with a tile if needed.\n\t */\n\titemId?: string;\n\n\t/**\n\t * Whether the handle should track vertical movement. When false,\n\t * the handle still appears but only emits horizontal deltas, and\n\t * the cursor is constrained to the column resize axis.\n\t *\n\t * @default true\n\t */\n\tverticalResizable?: boolean;\n\n\t/**\n\t * Callback fired while the handle is being dragged. Receives the\n\t * cursor offset from the gesture start in pixels.\n\t */\n\tonResize?: ( delta: ResizeDelta ) => void;\n\n\t/**\n\t * Callback fired when the gesture ends.\n\t */\n\tonResizeEnd?: () => void;\n\n\t/**\n\t * Component that overrides the default corner triangle with a\n\t * custom element. Receives gesture wiring (`ref`, `listeners`,\n\t * `attributes`) plus context. The surface keeps ownership of the\n\t * `<DndContext>` and the throttled delta loop; consumers are only\n\t * responsible for the visual.\n\t */\n\trenderResizeHandle?: React.ComponentType< ResizeHandleRenderProps >;\n}\n\n/**\n * Per-item width limits, in pixels. Surfaces quantize each limit to\n * whole tracks (minimums round up, maximums round down), bound rendered\n * spans and resize gestures at the result, and never write it into the\n * layout. A quantized minimum wins over a smaller quantized maximum.\n */\nexport type GridItemWidthLimits = {\n\t/**\n\t * Minimum tile width in pixels.\n\t */\n\tminWidth?: number;\n\n\t/**\n\t * Maximum tile width in pixels.\n\t */\n\tmaxWidth?: number;\n};\n\n/**\n * Per-item size limits on both axes, in pixels, for surfaces with row\n * tracks. Height limits quantize against the row track when `rowHeight`\n * is numeric and stay open otherwise.\n */\nexport type GridItemLimits = GridItemWidthLimits & {\n\t/**\n\t * Minimum tile height in pixels.\n\t */\n\tminHeight?: number;\n\n\t/**\n\t * Maximum tile height in pixels.\n\t */\n\tmaxHeight?: number;\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/grid/src/shared/use-span-bounds.ts
|
|
21
|
+
var use_span_bounds_exports = {};
|
|
22
|
+
__export(use_span_bounds_exports, {
|
|
23
|
+
useResizePixelLimits: () => useResizePixelLimits,
|
|
24
|
+
useSpanBounds: () => useSpanBounds
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(use_span_bounds_exports);
|
|
27
|
+
var import_element = require("@wordpress/element");
|
|
28
|
+
var import_resize_snap = require("./resize-snap.cjs");
|
|
29
|
+
var NO_BOUNDS = /* @__PURE__ */ new Map();
|
|
30
|
+
var NO_LIMITS = /* @__PURE__ */ new Map();
|
|
31
|
+
function useSpanBounds(itemLimits, columnWidth, gapPx, rowHeightPx, maxColumns) {
|
|
32
|
+
const computed = (0, import_element.useMemo)(() => {
|
|
33
|
+
if (!itemLimits) {
|
|
34
|
+
return NO_BOUNDS;
|
|
35
|
+
}
|
|
36
|
+
const map = /* @__PURE__ */ new Map();
|
|
37
|
+
for (const [key, limits] of Object.entries(itemLimits)) {
|
|
38
|
+
map.set(
|
|
39
|
+
key,
|
|
40
|
+
(0, import_resize_snap.pixelLimitsToSpanBounds)(
|
|
41
|
+
limits,
|
|
42
|
+
columnWidth,
|
|
43
|
+
gapPx,
|
|
44
|
+
rowHeightPx,
|
|
45
|
+
maxColumns
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return map;
|
|
50
|
+
}, [itemLimits, columnWidth, gapPx, rowHeightPx, maxColumns]);
|
|
51
|
+
const signature = (0, import_element.useMemo)(() => {
|
|
52
|
+
let value = "";
|
|
53
|
+
for (const [key, bounds] of computed) {
|
|
54
|
+
value += `${key}:${bounds.minWidth}:${bounds.minHeight}:${bounds.maxWidth}:${bounds.maxHeight}|`;
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}, [computed]);
|
|
58
|
+
return (0, import_element.useMemo)(() => computed, [signature]);
|
|
59
|
+
}
|
|
60
|
+
function useResizePixelLimits(spanBounds, columnWidth, gapPx, rowHeightPx) {
|
|
61
|
+
return (0, import_element.useMemo)(() => {
|
|
62
|
+
if (spanBounds.size === 0) {
|
|
63
|
+
return NO_LIMITS;
|
|
64
|
+
}
|
|
65
|
+
const map = /* @__PURE__ */ new Map();
|
|
66
|
+
for (const [key, bounds] of spanBounds) {
|
|
67
|
+
map.set(
|
|
68
|
+
key,
|
|
69
|
+
(0, import_resize_snap.spanBoundsToPixelLimits)(
|
|
70
|
+
bounds,
|
|
71
|
+
columnWidth,
|
|
72
|
+
gapPx,
|
|
73
|
+
rowHeightPx
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return map;
|
|
78
|
+
}, [spanBounds, columnWidth, gapPx, rowHeightPx]);
|
|
79
|
+
}
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
useResizePixelLimits,
|
|
83
|
+
useSpanBounds
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=use-span-bounds.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/shared/use-span-bounds.ts"],
|
|
4
|
+
"sourcesContent": ["import { useMemo } from '@wordpress/element';\nimport {\n\tpixelLimitsToSpanBounds,\n\tspanBoundsToPixelLimits,\n} from './resize-snap';\nimport type { ResizePixelLimits, SpanBounds } from './resize-snap';\nimport type { GridItemLimits } from './types';\n\nconst NO_BOUNDS: ReadonlyMap< string, SpanBounds > = new Map();\nconst NO_LIMITS: ReadonlyMap< string, ResizePixelLimits > = new Map();\n\n/**\n * Quantizes per-item pixel limits to span bounds for the current\n * geometry. The map keeps its identity while every bound is unchanged,\n * so container width ticks and fresh `itemLimits` objects do not\n * invalidate the layout memos or the sortable context downstream.\n *\n * @param itemLimits Per-item pixel limits, keyed by layout item key.\n * @param columnWidth Width of one column track in pixels.\n * @param gapPx Gap between tracks in pixels.\n * @param rowHeightPx Row track height in pixels, or `null` when rows\n * are content-sized.\n * @param maxColumns Number of column tracks in the surface.\n */\nexport function useSpanBounds(\n\titemLimits: Record< string, GridItemLimits > | undefined,\n\tcolumnWidth: number,\n\tgapPx: number,\n\trowHeightPx: number | null,\n\tmaxColumns: number\n): ReadonlyMap< string, SpanBounds > {\n\tconst computed = useMemo( () => {\n\t\tif ( ! itemLimits ) {\n\t\t\treturn NO_BOUNDS;\n\t\t}\n\t\tconst map = new Map< string, SpanBounds >();\n\t\tfor ( const [ key, limits ] of Object.entries( itemLimits ) ) {\n\t\t\tmap.set(\n\t\t\t\tkey,\n\t\t\t\tpixelLimitsToSpanBounds(\n\t\t\t\t\tlimits,\n\t\t\t\t\tcolumnWidth,\n\t\t\t\t\tgapPx,\n\t\t\t\t\trowHeightPx,\n\t\t\t\t\tmaxColumns\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\treturn map;\n\t}, [ itemLimits, columnWidth, gapPx, rowHeightPx, maxColumns ] );\n\n\tconst signature = useMemo( () => {\n\t\tlet value = '';\n\t\tfor ( const [ key, bounds ] of computed ) {\n\t\t\tvalue += `${ key }:${ bounds.minWidth }:${ bounds.minHeight }:${ bounds.maxWidth }:${ bounds.maxHeight }|`;\n\t\t}\n\t\treturn value;\n\t}, [ computed ] );\n\n\t// eslint-disable-next-line react-hooks/exhaustive-deps -- `signature` encodes every bound; `computed` changes identity on geometry ticks that leave the bounds unchanged.\n\treturn useMemo( () => computed, [ signature ] );\n}\n\n/**\n * Pixel limits for the resize gesture of every bounded item. Tracks\n * the continuous geometry, but only recomputes when it changes, not on\n * every gesture frame.\n *\n * @param spanBounds Span bounds per item key.\n * @param columnWidth Width of one column track in pixels.\n * @param gapPx Gap between tracks in pixels.\n * @param rowHeightPx Row track height in pixels, or `null` when rows\n * are content-sized.\n */\nexport function useResizePixelLimits(\n\tspanBounds: ReadonlyMap< string, SpanBounds >,\n\tcolumnWidth: number,\n\tgapPx: number,\n\trowHeightPx: number | null\n): ReadonlyMap< string, ResizePixelLimits > {\n\treturn useMemo( () => {\n\t\tif ( spanBounds.size === 0 ) {\n\t\t\treturn NO_LIMITS;\n\t\t}\n\t\tconst map = new Map< string, ResizePixelLimits >();\n\t\tfor ( const [ key, bounds ] of spanBounds ) {\n\t\t\tmap.set(\n\t\t\t\tkey,\n\t\t\t\tspanBoundsToPixelLimits(\n\t\t\t\t\tbounds,\n\t\t\t\t\tcolumnWidth,\n\t\t\t\t\tgapPx,\n\t\t\t\t\trowHeightPx\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t\treturn map;\n\t}, [ spanBounds, columnWidth, gapPx, rowHeightPx ] );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AACxB,yBAGO;AAIP,IAAM,YAA+C,oBAAI,IAAI;AAC7D,IAAM,YAAsD,oBAAI,IAAI;AAe7D,SAAS,cACf,YACA,aACA,OACA,aACA,YACoC;AACpC,QAAM,eAAW,wBAAS,MAAM;AAC/B,QAAK,CAAE,YAAa;AACnB,aAAO;AAAA,IACR;AACA,UAAM,MAAM,oBAAI,IAA0B;AAC1C,eAAY,CAAE,KAAK,MAAO,KAAK,OAAO,QAAS,UAAW,GAAI;AAC7D,UAAI;AAAA,QACH;AAAA,YACA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR,GAAG,CAAE,YAAY,aAAa,OAAO,aAAa,UAAW,CAAE;AAE/D,QAAM,gBAAY,wBAAS,MAAM;AAChC,QAAI,QAAQ;AACZ,eAAY,CAAE,KAAK,MAAO,KAAK,UAAW;AACzC,eAAS,GAAI,GAAI,IAAK,OAAO,QAAS,IAAK,OAAO,SAAU,IAAK,OAAO,QAAS,IAAK,OAAO,SAAU;AAAA,IACxG;AACA,WAAO;AAAA,EACR,GAAG,CAAE,QAAS,CAAE;AAGhB,aAAO,wBAAS,MAAM,UAAU,CAAE,SAAU,CAAE;AAC/C;AAaO,SAAS,qBACf,YACA,aACA,OACA,aAC2C;AAC3C,aAAO,wBAAS,MAAM;AACrB,QAAK,WAAW,SAAS,GAAI;AAC5B,aAAO;AAAA,IACR;AACA,UAAM,MAAM,oBAAI,IAAiC;AACjD,eAAY,CAAE,KAAK,MAAO,KAAK,YAAa;AAC3C,UAAI;AAAA,QACH;AAAA,YACA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR,GAAG,CAAE,YAAY,aAAa,OAAO,WAAY,CAAE;AACpD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -118,6 +118,8 @@ function GridItem({
|
|
|
118
118
|
item,
|
|
119
119
|
maxColumns,
|
|
120
120
|
disabled = false,
|
|
121
|
+
draggable = true,
|
|
122
|
+
resizable = true,
|
|
121
123
|
verticalResizable = true,
|
|
122
124
|
interacting = false,
|
|
123
125
|
dragging = false,
|
|
@@ -128,6 +130,8 @@ function GridItem({
|
|
|
128
130
|
resizeSnapPreview = null,
|
|
129
131
|
minResizeWidthPx,
|
|
130
132
|
minResizeHeightPx,
|
|
133
|
+
maxResizeWidthPx,
|
|
134
|
+
maxResizeHeightPx,
|
|
131
135
|
renderResizeHandle
|
|
132
136
|
}) {
|
|
133
137
|
const [resizeDelta, setResizeDelta] = useState(
|
|
@@ -136,6 +140,8 @@ function GridItem({
|
|
|
136
140
|
const [initialContentSize, setInitialContentSize] = useState(null);
|
|
137
141
|
const itemRef = useRef(null);
|
|
138
142
|
const contentRef = useRef(null);
|
|
143
|
+
const dragDisabled = disabled || !draggable;
|
|
144
|
+
const resizeDisabled = disabled || !resizable;
|
|
139
145
|
const {
|
|
140
146
|
attributes,
|
|
141
147
|
listeners,
|
|
@@ -144,7 +150,7 @@ function GridItem({
|
|
|
144
150
|
isDragging
|
|
145
151
|
} = useSortable({
|
|
146
152
|
id: item.key,
|
|
147
|
-
disabled
|
|
153
|
+
disabled: dragDisabled
|
|
148
154
|
});
|
|
149
155
|
const mergedRef = useMergeRefs([itemRef, setNodeRef]);
|
|
150
156
|
const contentMergedRef = useMergeRefs([contentRef]);
|
|
@@ -174,10 +180,18 @@ function GridItem({
|
|
|
174
180
|
height: verticalResizable ? delta.height : 0
|
|
175
181
|
};
|
|
176
182
|
if (baselineSize) {
|
|
177
|
-
clamped = clampResizeDelta(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
clamped = clampResizeDelta(
|
|
184
|
+
clamped,
|
|
185
|
+
baselineSize,
|
|
186
|
+
{
|
|
187
|
+
width: minResizeWidthPx,
|
|
188
|
+
height: verticalResizable ? minResizeHeightPx : void 0
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
width: maxResizeWidthPx,
|
|
192
|
+
height: verticalResizable ? maxResizeHeightPx : void 0
|
|
193
|
+
}
|
|
194
|
+
);
|
|
181
195
|
}
|
|
182
196
|
setResizeDelta(clamped);
|
|
183
197
|
onResize(item.key, clamped);
|
|
@@ -223,7 +237,7 @@ function GridItem({
|
|
|
223
237
|
...listeners,
|
|
224
238
|
style: {
|
|
225
239
|
height: "100%",
|
|
226
|
-
cursor: getItemCursor(
|
|
240
|
+
cursor: getItemCursor(dragDisabled, interacting)
|
|
227
241
|
},
|
|
228
242
|
children: [
|
|
229
243
|
/* @__PURE__ */ jsxs(
|
|
@@ -234,7 +248,7 @@ function GridItem({
|
|
|
234
248
|
style: continuousContentStyle,
|
|
235
249
|
children: [
|
|
236
250
|
children,
|
|
237
|
-
!
|
|
251
|
+
!resizeDisabled && /* @__PURE__ */ jsx(
|
|
238
252
|
ResizeHandle,
|
|
239
253
|
{
|
|
240
254
|
itemId: item.key,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dashboard-grid/grid-item.tsx", "../../../style-runtime/src/index.ts", "../../src/shared/actionable-area-slot.module.css", "../../src/dashboard-grid/grid-item.module.css"],
|
|
4
|
-
"sourcesContent": ["import { useSortable } from '@dnd-kit/sortable';\nimport clsx from 'clsx';\nimport { useState, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport actionableAreaStyles from '../shared/actionable-area-slot.module.css';\nimport { GRID_ITEM_DATA_KEY } from '../shared/grid-item-key';\nimport ResizeHandle from '../shared/resize-handle';\nimport { clampResizeDelta, type ResizeSnapSize } from '../shared/resize-snap';\nimport type { ResizeDelta } from '../shared/types';\nimport type { GridItemProps } from './types';\nimport styles from './grid-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\n\tif ( interacting ) {\n\t\treturn undefined;\n\t}\n\n\treturn 'grab';\n}\n\nexport function GridItem( {\n\titem,\n\tmaxColumns,\n\tdisabled = false,\n\tverticalResizable = true,\n\tinteracting = false,\n\tdragging = false,\n\tchildren,\n\tactionableArea = null,\n\tonResize,\n\tonResizeEnd,\n\tresizeSnapPreview = null,\n\tminResizeWidthPx,\n\tminResizeHeightPx,\n\trenderResizeHandle,\n}: GridItemProps ) {\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\tconst {\n\t\tattributes,\n\t\tlisteners,\n\t\tsetNodeRef,\n\t\tsetActivatorNodeRef,\n\t\tisDragging,\n\t} = useSortable( {\n\t\tid: item.key,\n\t\tdisabled,\n\t} );\n\tconst mergedRef = useMergeRefs( [ itemRef, setNodeRef ] );\n\tconst contentMergedRef = useMergeRefs( [ contentRef ] );\n\t/*\n\t * With `<DragOverlay>` handling the cursor-following clone, the\n\t * sortable item stays put in its grid cell and acts as a\n\t * placeholder. No `transform` is applied here — applying one\n\t * would double-move the placeholder alongside the overlay.\n\t */\n\tconst style = {\n\t\tgridColumnEnd: `span ${\n\t\t\titem.width === 'full'\n\t\t\t\t? maxColumns\n\t\t\t\t: Math.min(\n\t\t\t\t\t\ttypeof item.width === 'number' ? item.width : 1,\n\t\t\t\t\t\tmaxColumns\n\t\t\t\t )\n\t\t}`,\n\t\tgridRowEnd: `span ${ item.height || 1 }`,\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 = {\n\t\t\twidth: delta.width,\n\t\t\theight: verticalResizable ? delta.height : 0,\n\t\t};\n\t\tif ( baselineSize ) {\n\t\t\tclamped = clampResizeDelta( clamped, baselineSize, {\n\t\t\t\twidth: minResizeWidthPx,\n\t\t\t\theight: verticalResizable ? minResizeHeightPx : undefined,\n\t\t\t} );\n\t\t}\n\t\tsetResizeDelta( clamped );\n\t\tonResize( item.key, 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\theight: verticalResizable\n\t\t\t\t\t\t? initialContentSize.height + resizeDelta.height\n\t\t\t\t\t\t: undefined,\n\t\t\t }\n\t\t\t: undefined;\n\n\tconst previewOverlay = resizeSnapPreview ? (\n\t\t<SnapPreviewOverlay snap={ resizeSnapPreview } />\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 ]: item.key } }\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\t{ ...( dragging ? { inert: '' } : {} ) }\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{ ...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( disabled, 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{ ! disabled && (\n\t\t\t\t\t\t<ResizeHandle\n\t\t\t\t\t\t\titemId={ item.key }\n\t\t\t\t\t\t\tverticalResizable={ verticalResizable }\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\nfunction SnapPreviewOverlay( { snap }: { snap: ResizeSnapSize } ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ styles[ 'preview-overlay' ] }\n\t\t\tstyle={ {\n\t\t\t\twidth: snap.widthPx,\n\t\t\t\theight: snap.heightPx ?? '100%',\n\t\t\t} }\n\t\t/>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"ac1094954c\", \"._1c54fe8165d3023e__actionable-area-slot{opacity:1}@media (prefers-reduced-motion:no-preference){._1c54fe8165d3023e__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] ._1c54fe8165d3023e__actionable-area-slot{opacity:0;pointer-events:none}\");\n}\nexport default {\"actionable-area-slot\":\"_1c54fe8165d3023e__actionable-area-slot\"};\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"62860ded21\", \"._5d1abcb332a18701__item{position:relative}._54de57c12d3ce67e__item-content{height:100%;position:relative}._3e086aa073b9bbd9__is-resizing{overflow:visible;z-index:1}._3e086aa073b9bbd9__is-resizing ._54de57c12d3ce67e__item-content{overflow:visible;position:relative;z-index:2}._81d4e1a6c979f1e4__is-dragging{pointer-events:none}[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{border-radius:var(--wp-grid-placeholder-radius,0)}@media not (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{animation:_0447be8a7068a873__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 _0447be8a7068a873__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] ._81d4e1a6c979f1e4__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] ._81d4e1a6c979f1e4__is-dragging{--wp-grid-placeholder-outline-color:Highlight}}._2028fc095dbc5cb2__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)));border-radius:var(--wp-grid-placeholder-radius,0);box-sizing:border-box;inset-inline-start:0;pointer-events:none;position:absolute;top:0;z-index:0}@media (forced-colors:active){._2028fc095dbc5cb2__preview-overlay{border-color:Highlight}}\");\n}\nexport default {\"item\":\"_5d1abcb332a18701__item\",\"item-content\":\"_54de57c12d3ce67e__item-content\",\"is-resizing\":\"_3e086aa073b9bbd9__is-resizing\",\"is-dragging\":\"_81d4e1a6c979f1e4__is-dragging\",\"wp-grid-item-placeholder-in\":\"_0447be8a7068a873__wp-grid-item-placeholder-in\",\"preview-overlay\":\"_2028fc095dbc5cb2__preview-overlay\"};\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,mBAAmB;AAC5B,OAAO,UAAU;AACjB,SAAS,UAAU,cAAc;AACjC,SAAS,oBAAoB;;;ACO7B,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;AAC3E,MAAK,CAAE,eAAe,MAAO;AAC5B;AAAA,EACD;AAEA,QAAM,UAAU,WAAW;AAC3B,MAAI,iBAAiB,QAAQ,eAAe,IAAK,cAAe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CAAyC;;;AFChF,SAAS,0BAA0B;AACnC,OAAO,kBAAkB;AACzB,SAAS,wBAA6C;;;AGNtD,IAAI,OAAO,YAAY,eAAe,QAAQ,IAAI,aAAa,QAAQ;AACtE,gBAAc,cAAc,q/DAAq/D;AAClhE;AACA,IAAO,oBAAQ,EAAC,QAAO,2BAA0B,gBAAe,mCAAkC,eAAc,kCAAiC,eAAc,kCAAiC,+BAA8B,kDAAiD,mBAAkB,qCAAoC;;;
|
|
4
|
+
"sourcesContent": ["import { useSortable } from '@dnd-kit/sortable';\nimport clsx from 'clsx';\nimport { useState, useRef } from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\nimport actionableAreaStyles from '../shared/actionable-area-slot.module.css';\nimport { GRID_ITEM_DATA_KEY } from '../shared/grid-item-key';\nimport ResizeHandle from '../shared/resize-handle';\nimport { clampResizeDelta, type ResizeSnapSize } from '../shared/resize-snap';\nimport type { ResizeDelta } from '../shared/types';\nimport type { GridItemProps } from './types';\nimport styles from './grid-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\n\tif ( interacting ) {\n\t\treturn undefined;\n\t}\n\n\treturn 'grab';\n}\n\nexport function GridItem( {\n\titem,\n\tmaxColumns,\n\tdisabled = false,\n\tdraggable = true,\n\tresizable = true,\n\tverticalResizable = true,\n\tinteracting = false,\n\tdragging = false,\n\tchildren,\n\tactionableArea = null,\n\tonResize,\n\tonResizeEnd,\n\tresizeSnapPreview = null,\n\tminResizeWidthPx,\n\tminResizeHeightPx,\n\tmaxResizeWidthPx,\n\tmaxResizeHeightPx,\n\trenderResizeHandle,\n}: GridItemProps ) {\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\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: item.key,\n\t\tdisabled: dragDisabled,\n\t} );\n\tconst mergedRef = useMergeRefs( [ itemRef, setNodeRef ] );\n\tconst contentMergedRef = useMergeRefs( [ contentRef ] );\n\t/*\n\t * With `<DragOverlay>` handling the cursor-following clone, the\n\t * sortable item stays put in its grid cell and acts as a\n\t * placeholder. No `transform` is applied here — applying one\n\t * would double-move the placeholder alongside the overlay.\n\t */\n\tconst style = {\n\t\tgridColumnEnd: `span ${\n\t\t\titem.width === 'full'\n\t\t\t\t? maxColumns\n\t\t\t\t: Math.min(\n\t\t\t\t\t\ttypeof item.width === 'number' ? item.width : 1,\n\t\t\t\t\t\tmaxColumns\n\t\t\t\t )\n\t\t}`,\n\t\tgridRowEnd: `span ${ item.height || 1 }`,\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 = {\n\t\t\twidth: delta.width,\n\t\t\theight: verticalResizable ? delta.height : 0,\n\t\t};\n\t\tif ( baselineSize ) {\n\t\t\tclamped = clampResizeDelta(\n\t\t\t\tclamped,\n\t\t\t\tbaselineSize,\n\t\t\t\t{\n\t\t\t\t\twidth: minResizeWidthPx,\n\t\t\t\t\theight: verticalResizable ? minResizeHeightPx : undefined,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\twidth: maxResizeWidthPx,\n\t\t\t\t\theight: verticalResizable ? maxResizeHeightPx : undefined,\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t\tsetResizeDelta( clamped );\n\t\tonResize( item.key, 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\theight: verticalResizable\n\t\t\t\t\t\t? initialContentSize.height + resizeDelta.height\n\t\t\t\t\t\t: undefined,\n\t\t\t }\n\t\t\t: undefined;\n\n\tconst previewOverlay = resizeSnapPreview ? (\n\t\t<SnapPreviewOverlay snap={ resizeSnapPreview } />\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 ]: item.key } }\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\t{ ...( dragging ? { inert: '' } : {} ) }\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{ ...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={ item.key }\n\t\t\t\t\t\t\tverticalResizable={ verticalResizable }\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\nfunction SnapPreviewOverlay( { snap }: { snap: ResizeSnapSize } ) {\n\treturn (\n\t\t<div\n\t\t\tclassName={ styles[ 'preview-overlay' ] }\n\t\t\tstyle={ {\n\t\t\t\twidth: snap.widthPx,\n\t\t\t\theight: snap.heightPx ?? '100%',\n\t\t\t} }\n\t\t/>\n\t);\n}\n", "type GlobalScopeWithStyleRuntime = typeof globalThis & {\n\t// This global is shared by separately bundled copies of this package.\n\t// Keep its shape backward compatible after release.\n\t__wpStyleRuntime?: {\n\t\tdocuments: Map< Document, number >;\n\t\tstyles: Map< string, string >;\n\t\tinjectedStyles: WeakMap< Document, Set< string > >;\n\t};\n};\n\nconst STYLE_HASH_ATTRIBUTE = 'data-wp-hash';\n\n/**\n * Returns the shared style runtime registry.\n *\n * The registry is stored on `globalThis` so separately bundled copies of this\n * package can coordinate through the same document and style maps.\n *\n * @return The shared runtime registry.\n */\nfunction getRuntime() {\n\tconst globalScope = globalThis as GlobalScopeWithStyleRuntime;\n\n\tif ( globalScope.__wpStyleRuntime ) {\n\t\treturn globalScope.__wpStyleRuntime;\n\t}\n\n\tglobalScope.__wpStyleRuntime = {\n\t\tdocuments: new Map(),\n\t\tstyles: new Map(),\n\t\tinjectedStyles: new WeakMap(),\n\t};\n\n\tif ( typeof document !== 'undefined' ) {\n\t\tregisterDocument( document );\n\t}\n\n\treturn globalScope.__wpStyleRuntime;\n}\n\n/**\n * Checks whether a document already contains a style tag for a hash.\n *\n * @param targetDocument Document to inspect.\n * @param hash Stable hash for the transformed CSS.\n *\n * @return Whether the style hash already exists in the document.\n */\nfunction documentContainsStyleHash(\n\ttargetDocument: Document,\n\thash: string\n): boolean {\n\tif ( ! targetDocument.head ) {\n\t\treturn false;\n\t}\n\n\tfor ( const style of targetDocument.head.querySelectorAll(\n\t\t`style[${ STYLE_HASH_ATTRIBUTE }]`\n\t) ) {\n\t\tif ( style.getAttribute( STYLE_HASH_ATTRIBUTE ) === hash ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Injects a registered style into a document, unless that document already\n * contains a style tag for the same hash.\n *\n * @param targetDocument Document to inject the style into.\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nfunction injectStyle( targetDocument: Document, hash: string, css: string ) {\n\tif ( ! targetDocument.head ) {\n\t\treturn;\n\t}\n\n\tconst runtime = getRuntime();\n\tlet injectedStyles = runtime.injectedStyles.get( targetDocument );\n\n\tif ( ! injectedStyles ) {\n\t\tinjectedStyles = new Set();\n\t\truntime.injectedStyles.set( targetDocument, injectedStyles );\n\t}\n\n\tif ( injectedStyles.has( hash ) ) {\n\t\treturn;\n\t}\n\n\t// Older generated CSS module output can still inject matching style tags\n\t// after this document's cache is created, so keep the DOM as the fallback\n\t// source of truth on cache misses.\n\tif ( documentContainsStyleHash( targetDocument, hash ) ) {\n\t\tinjectedStyles.add( hash );\n\t\treturn;\n\t}\n\n\tconst style = targetDocument.createElement( 'style' );\n\tstyle.setAttribute( STYLE_HASH_ATTRIBUTE, hash );\n\tstyle.appendChild( targetDocument.createTextNode( css ) );\n\ttargetDocument.head.appendChild( style );\n\tinjectedStyles.add( hash );\n}\n\n/**\n * Registers a document as a style injection target.\n *\n * Existing registered styles are replayed into the document immediately.\n * Documents are reference-counted so multiple providers can safely register the\n * same document without one cleanup removing it while another registration is\n * still active.\n *\n * @param targetDocument Document to receive registered styles.\n * @return Cleanup function that unregisters this document registration.\n */\nexport function registerDocument( targetDocument: Document ) {\n\tconst runtime = getRuntime();\n\n\truntime.documents.set(\n\t\ttargetDocument,\n\t\t( runtime.documents.get( targetDocument ) ?? 0 ) + 1\n\t);\n\n\tfor ( const [ hash, css ] of runtime.styles ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n\n\treturn () => {\n\t\tconst count = runtime.documents.get( targetDocument );\n\n\t\tif ( count === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( count <= 1 ) {\n\t\t\truntime.documents.delete( targetDocument );\n\t\t\treturn;\n\t\t}\n\n\t\truntime.documents.set( targetDocument, count - 1 );\n\t};\n}\n\n/**\n * Registers a style and injects it into all registered documents.\n *\n * The hash is used as the deduplication key, so calling this repeatedly with\n * the same hash will not add duplicate style tags to a document.\n * Registered styles are retained for the lifetime of the page so they can be\n * replayed into documents that are registered later.\n *\n * @param hash Stable hash for the transformed CSS.\n * @param css CSS text to inject.\n */\nexport function registerStyle( hash: string, css: string ) {\n\tconst runtime = getRuntime();\n\n\truntime.styles.set( hash, css );\n\n\tfor ( const targetDocument of runtime.documents.keys() ) {\n\t\tinjectStyle( targetDocument, hash, css );\n\t}\n}\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"ac1094954c\", \"._1c54fe8165d3023e__actionable-area-slot{opacity:1}@media (prefers-reduced-motion:no-preference){._1c54fe8165d3023e__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] ._1c54fe8165d3023e__actionable-area-slot{opacity:0;pointer-events:none}\");\n}\nexport default {\"actionable-area-slot\":\"_1c54fe8165d3023e__actionable-area-slot\"};\n", "import { registerStyle } from '@wordpress/style-runtime';\nif (typeof process === 'undefined' || process.env.NODE_ENV !== 'test') {\n\tregisterStyle(\"62860ded21\", \"._5d1abcb332a18701__item{position:relative}._54de57c12d3ce67e__item-content{height:100%;position:relative}._3e086aa073b9bbd9__is-resizing{overflow:visible;z-index:1}._3e086aa073b9bbd9__is-resizing ._54de57c12d3ce67e__item-content{overflow:visible;position:relative;z-index:2}._81d4e1a6c979f1e4__is-dragging{pointer-events:none}[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{border-radius:var(--wp-grid-placeholder-radius,0)}@media not (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{animation:_0447be8a7068a873__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 _0447be8a7068a873__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] ._81d4e1a6c979f1e4__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] ._81d4e1a6c979f1e4__is-dragging{--wp-grid-placeholder-outline-color:Highlight}}._2028fc095dbc5cb2__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)));border-radius:var(--wp-grid-placeholder-radius,0);box-sizing:border-box;inset-inline-start:0;pointer-events:none;position:absolute;top:0;z-index:0}@media (forced-colors:active){._2028fc095dbc5cb2__preview-overlay{border-color:Highlight}}\");\n}\nexport default {\"item\":\"_5d1abcb332a18701__item\",\"item-content\":\"_54de57c12d3ce67e__item-content\",\"is-resizing\":\"_3e086aa073b9bbd9__is-resizing\",\"is-dragging\":\"_81d4e1a6c979f1e4__is-dragging\",\"wp-grid-item-placeholder-in\":\"_0447be8a7068a873__wp-grid-item-placeholder-in\",\"preview-overlay\":\"_2028fc095dbc5cb2__preview-overlay\"};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,mBAAmB;AAC5B,OAAO,UAAU;AACjB,SAAS,UAAU,cAAc;AACjC,SAAS,oBAAoB;;;ACO7B,IAAM,uBAAuB;AAU7B,SAAS,aAAa;AACrB,QAAM,cAAc;AAEpB,MAAK,YAAY,kBAAmB;AACnC,WAAO,YAAY;AAAA,EACpB;AAEA,cAAY,mBAAmB;AAAA,IAC9B,WAAW,oBAAI,IAAI;AAAA,IACnB,QAAQ,oBAAI,IAAI;AAAA,IAChB,gBAAgB,oBAAI,QAAQ;AAAA,EAC7B;AAEA,MAAK,OAAO,aAAa,aAAc;AACtC,qBAAkB,QAAS;AAAA,EAC5B;AAEA,SAAO,YAAY;AACpB;AAUA,SAAS,0BACR,gBACA,MACU;AACV,MAAK,CAAE,eAAe,MAAO;AAC5B,WAAO;AAAA,EACR;AAEA,aAAY,SAAS,eAAe,KAAK;AAAA,IACxC,SAAU,oBAAqB;AAAA,EAChC,GAAI;AACH,QAAK,MAAM,aAAc,oBAAqB,MAAM,MAAO;AAC1D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAUA,SAAS,YAAa,gBAA0B,MAAc,KAAc;AAC3E,MAAK,CAAE,eAAe,MAAO;AAC5B;AAAA,EACD;AAEA,QAAM,UAAU,WAA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