@wordpress/grid 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +35 -14
  2. package/build/dashboard-grid/grid-item.cjs +232 -295
  3. package/build/dashboard-grid/grid-item.cjs.map +1 -7
  4. package/build/dashboard-grid/index.cjs +525 -632
  5. package/build/dashboard-grid/index.cjs.map +1 -7
  6. package/build/dashboard-grid/resolve-fill-widths.cjs +159 -203
  7. package/build/dashboard-grid/resolve-fill-widths.cjs.map +1 -7
  8. package/build/dashboard-grid/types.cjs +4 -18
  9. package/build/dashboard-lanes/index.cjs +494 -576
  10. package/build/dashboard-lanes/index.cjs.map +1 -7
  11. package/build/dashboard-lanes/lane-placement.cjs +77 -100
  12. package/build/dashboard-lanes/lane-placement.cjs.map +1 -7
  13. package/build/dashboard-lanes/lanes-item.cjs +222 -278
  14. package/build/dashboard-lanes/lanes-item.cjs.map +1 -7
  15. package/build/dashboard-lanes/types.cjs +4 -18
  16. package/build/dashboard-lanes/use-lane-placement.cjs +172 -198
  17. package/build/dashboard-lanes/use-lane-placement.cjs.map +1 -7
  18. package/build/index.cjs +16 -31
  19. package/build/shared/array-move-with-pinned.cjs +29 -45
  20. package/build/shared/array-move-with-pinned.cjs.map +1 -7
  21. package/build/shared/column-policy.cjs +58 -0
  22. package/build/shared/column-policy.cjs.map +1 -0
  23. package/build/shared/drag-overlay-drop-animation.cjs +40 -66
  24. package/build/shared/drag-overlay-drop-animation.cjs.map +1 -7
  25. package/build/shared/grid-item-key.cjs +12 -29
  26. package/build/shared/grid-item-key.cjs.map +1 -7
  27. package/build/shared/grid-overlay.cjs +163 -164
  28. package/build/shared/grid-overlay.cjs.map +1 -7
  29. package/build/shared/item-exit-overlay.cjs +132 -134
  30. package/build/shared/item-exit-overlay.cjs.map +1 -7
  31. package/build/shared/resize-handle.cjs +213 -197
  32. package/build/shared/resize-handle.cjs.map +1 -7
  33. package/build/shared/resize-snap.cjs +116 -121
  34. package/build/shared/resize-snap.cjs.map +1 -7
  35. package/build/shared/types.cjs +4 -18
  36. package/build/shared/use-item-exit-animation.cjs +96 -143
  37. package/build/shared/use-item-exit-animation.cjs.map +1 -7
  38. package/build/shared/use-layout-shift-animation.cjs +121 -150
  39. package/build/shared/use-layout-shift-animation.cjs.map +1 -7
  40. package/build/shared/use-span-bounds.cjs +65 -79
  41. package/build/shared/use-span-bounds.cjs.map +1 -7
  42. package/build-module/dashboard-grid/grid-item.mjs +209 -265
  43. package/build-module/dashboard-grid/grid-item.mjs.map +1 -7
  44. package/build-module/dashboard-grid/index.mjs +502 -623
  45. package/build-module/dashboard-grid/index.mjs.map +1 -7
  46. package/build-module/dashboard-grid/resolve-fill-widths.mjs +155 -179
  47. package/build-module/dashboard-grid/resolve-fill-widths.mjs.map +1 -7
  48. package/build-module/dashboard-grid/types.mjs +0 -1
  49. package/build-module/dashboard-lanes/index.mjs +470 -567
  50. package/build-module/dashboard-lanes/index.mjs.map +1 -7
  51. package/build-module/dashboard-lanes/lane-placement.mjs +73 -76
  52. package/build-module/dashboard-lanes/lane-placement.mjs.map +1 -7
  53. package/build-module/dashboard-lanes/lanes-item.mjs +199 -248
  54. package/build-module/dashboard-lanes/lanes-item.mjs.map +1 -7
  55. package/build-module/dashboard-lanes/types.mjs +0 -1
  56. package/build-module/dashboard-lanes/use-lane-placement.mjs +167 -173
  57. package/build-module/dashboard-lanes/use-lane-placement.mjs.map +1 -7
  58. package/build-module/index.mjs +1 -6
  59. package/build-module/shared/array-move-with-pinned.mjs +25 -21
  60. package/build-module/shared/array-move-with-pinned.mjs.map +1 -7
  61. package/build-module/shared/column-policy.mjs +52 -0
  62. package/build-module/shared/column-policy.mjs.map +1 -0
  63. package/build-module/shared/drag-overlay-drop-animation.mjs +35 -44
  64. package/build-module/shared/drag-overlay-drop-animation.mjs.map +1 -7
  65. package/build-module/shared/grid-item-key.mjs +8 -5
  66. package/build-module/shared/grid-item-key.mjs.map +1 -7
  67. package/build-module/shared/grid-overlay.mjs +143 -136
  68. package/build-module/shared/grid-overlay.mjs.map +1 -7
  69. package/build-module/shared/item-exit-overlay.mjs +128 -110
  70. package/build-module/shared/item-exit-overlay.mjs.map +1 -7
  71. package/build-module/shared/resize-handle.mjs +191 -171
  72. package/build-module/shared/resize-handle.mjs.map +1 -7
  73. package/build-module/shared/resize-snap.mjs +108 -93
  74. package/build-module/shared/resize-snap.mjs.map +1 -7
  75. package/build-module/shared/types.mjs +0 -1
  76. package/build-module/shared/use-item-exit-animation.mjs +92 -124
  77. package/build-module/shared/use-item-exit-animation.mjs.map +1 -7
  78. package/build-module/shared/use-layout-shift-animation.mjs +114 -123
  79. package/build-module/shared/use-layout-shift-animation.mjs.map +1 -7
  80. package/build-module/shared/use-span-bounds.mjs +60 -57
  81. package/build-module/shared/use-span-bounds.mjs.map +1 -7
  82. package/build-types/dashboard-grid/index.d.ts.map +1 -1
  83. package/build-types/dashboard-grid/types.d.ts +9 -5
  84. package/build-types/dashboard-grid/types.d.ts.map +1 -1
  85. package/build-types/dashboard-lanes/index.d.ts.map +1 -1
  86. package/build-types/dashboard-lanes/types.d.ts +9 -5
  87. package/build-types/dashboard-lanes/types.d.ts.map +1 -1
  88. package/build-types/index.d.ts +1 -0
  89. package/build-types/index.d.ts.map +1 -1
  90. package/build-types/shared/column-policy.d.ts +43 -0
  91. package/build-types/shared/column-policy.d.ts.map +1 -0
  92. package/package.json +11 -11
  93. package/src/dashboard-grid/grid-item.tsx +1 -1
  94. package/src/dashboard-grid/index.tsx +11 -12
  95. package/src/dashboard-grid/stories/index.story.tsx +129 -50
  96. package/src/dashboard-grid/test/item-interactions.browser.test.tsx +1 -1
  97. package/src/dashboard-grid/types.ts +9 -5
  98. package/src/dashboard-lanes/index.tsx +11 -11
  99. package/src/dashboard-lanes/lanes-item.tsx +1 -1
  100. package/src/dashboard-lanes/stories/index.story.tsx +124 -28
  101. package/src/dashboard-lanes/test/item-interactions.browser.test.tsx +1 -1
  102. package/src/dashboard-lanes/types.ts +9 -5
  103. package/src/index.ts +1 -0
  104. package/src/shared/column-policy.ts +100 -0
  105. package/src/shared/test/column-policy.test.ts +215 -0
  106. package/src/shared/test/sortable-semantics.browser.test.tsx +122 -0
  107. package/build/dashboard-grid/types.cjs.map +0 -7
  108. package/build/dashboard-lanes/types.cjs.map +0 -7
  109. package/build/index.cjs.map +0 -7
  110. package/build/shared/types.cjs.map +0 -7
  111. package/build-module/dashboard-grid/types.mjs.map +0 -7
  112. package/build-module/dashboard-lanes/types.mjs.map +0 -7
  113. package/build-module/index.mjs.map +0 -7
  114. package/build-module/shared/types.mjs.map +0 -7
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // packages/grid/src/shared/column-policy.ts
7
+ function normalizeCount(count) {
8
+ return typeof count === "number" && Number.isFinite(count) ? Math.max(1, Math.floor(count)) : void 0;
9
+ }
10
+ function resolveFloor({ minColumnWidth }) {
11
+ return typeof minColumnWidth === "number" && Number.isFinite(minColumnWidth) && minColumnWidth > 0 ? minColumnWidth : void 0;
12
+ }
13
+ /**
14
+ * The count the policy asks for at a container width, before the floor.
15
+ * Counts are rounded down and never below one; a count that is not a
16
+ * finite number, or a step that is neither a count nor `'auto'`, is
17
+ * ignored.
18
+ *
19
+ * @param policy Column policy.
20
+ * @param containerWidth Measured inline size of the surface in pixels.
21
+ * @return The count, or `undefined` when none applies: no count was set, or
22
+ * an `'auto'` step lifts the cap over a floor.
23
+ */
24
+ function resolveColumnCap(policy, containerWidth) {
25
+ const { columns } = policy;
26
+ if (typeof columns !== "object" || columns === null) return normalizeCount(columns);
27
+ const hasFloor = resolveFloor(policy) !== void 0;
28
+ const widths = Object.keys(columns).map(Number).filter(Number.isFinite).filter((width) => {
29
+ const step = columns[width];
30
+ return step === "auto" ? hasFloor : normalizeCount(step) !== void 0;
31
+ }).sort((a, b) => b - a);
32
+ if (widths.length === 0) return;
33
+ const step = columns[widths.find((width) => containerWidth >= width) ?? widths[widths.length - 1]];
34
+ return step === "auto" ? void 0 : normalizeCount(step);
35
+ }
36
+ /**
37
+ * Resolves the count a surface renders: the policy's count at the container
38
+ * width, lowered by the floor so no column is narrower than
39
+ * `minColumnWidth`. A floor with no count fits as many columns as the
40
+ * container allows.
41
+ *
42
+ * @param policy Column policy.
43
+ * @param containerWidth Measured inline size of the surface in pixels.
44
+ * @param gapPx Column gap in pixels.
45
+ * @param defaultColumns Count used when the policy sets neither field.
46
+ * @return Column count, at least one.
47
+ */
48
+ function resolveColumnCount(policy, containerWidth, gapPx, defaultColumns) {
49
+ const cap = resolveColumnCap(policy, containerWidth);
50
+ const floor = resolveFloor(policy);
51
+ if (floor === void 0) return Math.max(1, cap ?? defaultColumns);
52
+ const maxFit = Math.max(1, Math.floor((containerWidth + gapPx) / (floor + gapPx)));
53
+ return cap === void 0 ? maxFit : Math.max(1, Math.min(cap, maxFit));
54
+ }
55
+ exports.resolveColumnCap = resolveColumnCap;
56
+ exports.resolveColumnCount = resolveColumnCount;
57
+
58
+ //# sourceMappingURL=column-policy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"column-policy.cjs","names":[],"sources":["../../src/shared/column-policy.ts"],"sourcesContent":["/**\n * Column count per container width. Each key is the inline size in pixels\n * from which its count applies: `{ 0: 1, 600: 2, 960: 4 }` is one column\n * from 0px, two from 600px, four from 960px, and below the smallest key\n * that step's count applies. An `'auto'` step lifts the cap from its\n * width up and leaves the count to `minColumnWidth`; with no floor set,\n * the step is skipped and the count below it holds.\n */\nexport type ColumnSteps = Record< number, number | 'auto' >;\n\n/**\n * Column policy shared by the surfaces: a count at every width, or a count\n * per container width, with an optional per-column floor in pixels.\n */\nexport interface ColumnPolicy {\n\tcolumns?: number | ColumnSteps;\n\tminColumnWidth?: number;\n}\n\nfunction normalizeCount( count: unknown ): number | undefined {\n\treturn typeof count === 'number' && Number.isFinite( count )\n\t\t? Math.max( 1, Math.floor( count ) )\n\t\t: undefined;\n}\n\nfunction resolveFloor( { minColumnWidth }: ColumnPolicy ): number | undefined {\n\treturn typeof minColumnWidth === 'number' &&\n\t\tNumber.isFinite( minColumnWidth ) &&\n\t\tminColumnWidth > 0\n\t\t? minColumnWidth\n\t\t: undefined;\n}\n\n/**\n * The count the policy asks for at a container width, before the floor.\n * Counts are rounded down and never below one; a count that is not a\n * finite number, or a step that is neither a count nor `'auto'`, is\n * ignored.\n *\n * @param policy Column policy.\n * @param containerWidth Measured inline size of the surface in pixels.\n * @return The count, or `undefined` when none applies: no count was set, or\n * an `'auto'` step lifts the cap over a floor.\n */\nexport function resolveColumnCap(\n\tpolicy: ColumnPolicy,\n\tcontainerWidth: number\n): number | undefined {\n\tconst { columns } = policy;\n\tif ( typeof columns !== 'object' || columns === null ) {\n\t\treturn normalizeCount( columns );\n\t}\n\tconst hasFloor = resolveFloor( policy ) !== undefined;\n\tconst widths = Object.keys( columns )\n\t\t.map( Number )\n\t\t.filter( Number.isFinite )\n\t\t.filter( ( width ) => {\n\t\t\tconst step = columns[ width ];\n\t\t\treturn step === 'auto'\n\t\t\t\t? hasFloor\n\t\t\t\t: normalizeCount( step ) !== undefined;\n\t\t} )\n\t\t.sort( ( a, b ) => b - a );\n\tif ( widths.length === 0 ) {\n\t\treturn undefined;\n\t}\n\tconst reached = widths.find( ( width ) => containerWidth >= width );\n\tconst step = columns[ reached ?? widths[ widths.length - 1 ] ];\n\treturn step === 'auto' ? undefined : normalizeCount( step );\n}\n\n/**\n * Resolves the count a surface renders: the policy's count at the container\n * width, lowered by the floor so no column is narrower than\n * `minColumnWidth`. A floor with no count fits as many columns as the\n * container allows.\n *\n * @param policy Column policy.\n * @param containerWidth Measured inline size of the surface in pixels.\n * @param gapPx Column gap in pixels.\n * @param defaultColumns Count used when the policy sets neither field.\n * @return Column count, at least one.\n */\nexport function resolveColumnCount(\n\tpolicy: ColumnPolicy,\n\tcontainerWidth: number,\n\tgapPx: number,\n\tdefaultColumns: number\n): number {\n\tconst cap = resolveColumnCap( policy, containerWidth );\n\tconst floor = resolveFloor( policy );\n\tif ( floor === undefined ) {\n\t\treturn Math.max( 1, cap ?? defaultColumns );\n\t}\n\tconst maxFit = Math.max(\n\t\t1,\n\t\tMath.floor( ( containerWidth + gapPx ) / ( floor + gapPx ) )\n\t);\n\treturn cap === undefined ? maxFit : Math.max( 1, Math.min( cap, maxFit ) );\n}\n"],"mappings":";;;;;;AAmBA,SAAS,eAAgB,OAAqC;CAC7D,OAAO,OAAO,UAAU,YAAY,OAAO,SAAU,KAAM,IACxD,KAAK,IAAK,GAAG,KAAK,MAAO,KAAM,CAAE,IACjC,KAAA;AACJ;AAEA,SAAS,aAAc,EAAE,kBAAqD;CAC7E,OAAO,OAAO,mBAAmB,YAChC,OAAO,SAAU,cAAe,KAChC,iBAAiB,IACf,iBACA,KAAA;AACJ;;;;;;;;;;;;AAaA,SAAgB,iBACf,QACA,gBACqB;CACrB,MAAM,EAAE,YAAY;CACpB,IAAK,OAAO,YAAY,YAAY,YAAY,MAC/C,OAAO,eAAgB,OAAQ;CAEhC,MAAM,WAAW,aAAc,MAAO,MAAM,KAAA;CAC5C,MAAM,SAAS,OAAO,KAAM,OAAQ,CAAC,CACnC,IAAK,MAAO,CAAC,CACb,OAAQ,OAAO,QAAS,CAAC,CACzB,QAAU,UAAW;EACrB,MAAM,OAAO,QAAS;EACtB,OAAO,SAAS,SACb,WACA,eAAgB,IAAK,MAAM,KAAA;CAC/B,CAAE,CAAC,CACF,MAAQ,GAAG,MAAO,IAAI,CAAE;CAC1B,IAAK,OAAO,WAAW,GACtB;CAGD,MAAM,OAAO,QADG,OAAO,MAAQ,UAAW,kBAAkB,KAChC,KAAK,OAAQ,OAAO,SAAS;CACzD,OAAO,SAAS,SAAS,KAAA,IAAY,eAAgB,IAAK;AAC3D;;;;;;;;;;;;;AAcA,SAAgB,mBACf,QACA,gBACA,OACA,gBACS;CACT,MAAM,MAAM,iBAAkB,QAAQ,cAAe;CACrD,MAAM,QAAQ,aAAc,MAAO;CACnC,IAAK,UAAU,KAAA,GACd,OAAO,KAAK,IAAK,GAAG,OAAO,cAAe;CAE3C,MAAM,SAAS,KAAK,IACnB,GACA,KAAK,OAAS,iBAAiB,UAAY,QAAQ,MAAQ,CAC5D;CACA,OAAO,QAAQ,KAAA,IAAY,SAAS,KAAK,IAAK,GAAG,KAAK,IAAK,KAAK,MAAO,CAAE;AAC1E"}
@@ -1,70 +1,44 @@
1
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/drag-overlay-drop-animation.ts
21
- var drag_overlay_drop_animation_exports = {};
22
- __export(drag_overlay_drop_animation_exports, {
23
- DROP_ANIMATION_DURATION_MS: () => DROP_ANIMATION_DURATION_MS,
24
- createDashboardDragDropAnimation: () => createDashboardDragDropAnimation
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
25
5
  });
26
- module.exports = __toCommonJS(drag_overlay_drop_animation_exports);
27
- var import_core = require("@dnd-kit/core");
28
- var DROP_ANIMATION_DURATION_MS = 200;
29
- var DROP_ANIMATION_EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
6
+ let _dnd_kit_core = require("@dnd-kit/core");
7
+ // packages/grid/src/shared/drag-overlay-drop-animation.ts
8
+ /** Matches `--wpds-motion-duration-md` on the drag preview frame exit. */
9
+ const DROP_ANIMATION_DURATION_MS = 200;
10
+ /** Matches `--wpds-motion-easing-balanced` on the drag preview frame exit. */
11
+ const DROP_ANIMATION_EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
12
+ /**
13
+ * Composes `@dnd-kit/core`’s default overlay drop translation with preview
14
+ * exit keyframes (via side effects). When the pointer never moves, `@dnd-kit`
15
+ * skips the drop animation and these side effects do not run.
16
+ *
17
+ * @param dragPreviewFrameClassName Hashed class for `.drag-preview-frame`.
18
+ * @param exitingFrameClassName Hashed class for the exit state.
19
+ */
30
20
  function createDashboardDragDropAnimation(dragPreviewFrameClassName, exitingFrameClassName) {
31
- return {
32
- ...import_core.defaultDropAnimation,
33
- duration: DROP_ANIMATION_DURATION_MS,
34
- easing: DROP_ANIMATION_EASING,
35
- sideEffects(args) {
36
- const cleanupDefault = (0, import_core.defaultDropAnimationSideEffects)({
37
- styles: {
38
- active: {
39
- opacity: "0"
40
- }
41
- }
42
- })(args);
43
- const frame = args.dragOverlay.node.getElementsByClassName(
44
- dragPreviewFrameClassName
45
- )[0];
46
- if (frame) {
47
- frame.getAnimations().forEach((animation) => animation.cancel());
48
- const lift = frame.firstElementChild;
49
- if (lift instanceof HTMLElement) {
50
- lift.getAnimations().forEach(
51
- (animation) => animation.cancel()
52
- );
53
- }
54
- frame.classList.add(exitingFrameClassName);
55
- }
56
- return () => {
57
- cleanupDefault?.();
58
- if (frame) {
59
- frame.classList.remove(exitingFrameClassName);
60
- }
61
- };
62
- }
63
- };
21
+ return {
22
+ ..._dnd_kit_core.defaultDropAnimation,
23
+ duration: 200,
24
+ easing: DROP_ANIMATION_EASING,
25
+ sideEffects(args) {
26
+ const cleanupDefault = (0, _dnd_kit_core.defaultDropAnimationSideEffects)({ styles: { active: { opacity: "0" } } })(args);
27
+ const frame = args.dragOverlay.node.getElementsByClassName(dragPreviewFrameClassName)[0];
28
+ if (frame) {
29
+ frame.getAnimations().forEach((animation) => animation.cancel());
30
+ const lift = frame.firstElementChild;
31
+ if (lift instanceof HTMLElement) lift.getAnimations().forEach((animation) => animation.cancel());
32
+ frame.classList.add(exitingFrameClassName);
33
+ }
34
+ return () => {
35
+ cleanupDefault?.();
36
+ if (frame) frame.classList.remove(exitingFrameClassName);
37
+ };
38
+ }
39
+ };
64
40
  }
65
- // Annotate the CommonJS export names for ESM import in node:
66
- 0 && (module.exports = {
67
- DROP_ANIMATION_DURATION_MS,
68
- createDashboardDragDropAnimation
69
- });
70
- //# sourceMappingURL=drag-overlay-drop-animation.cjs.map
41
+ exports.DROP_ANIMATION_DURATION_MS = DROP_ANIMATION_DURATION_MS;
42
+ exports.createDashboardDragDropAnimation = createDashboardDragDropAnimation;
43
+
44
+ //# sourceMappingURL=drag-overlay-drop-animation.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/shared/drag-overlay-drop-animation.ts"],
4
- "sourcesContent": ["import {\n\tdefaultDropAnimation,\n\tdefaultDropAnimationSideEffects,\n} from '@dnd-kit/core';\nimport type { DropAnimation } from '@dnd-kit/core';\n\n/** Matches `--wpds-motion-duration-md` on the drag preview frame exit. */\nexport const DROP_ANIMATION_DURATION_MS = 200;\n\n/** Matches `--wpds-motion-easing-balanced` on the drag preview frame exit. */\nconst DROP_ANIMATION_EASING = 'cubic-bezier(0.4, 0, 0.2, 1)';\n\n/**\n * Composes `@dnd-kit/core`’s default overlay drop translation with preview\n * exit keyframes (via side effects). When the pointer never moves, `@dnd-kit`\n * skips the drop animation and these side effects do not run.\n *\n * @param dragPreviewFrameClassName Hashed class for `.drag-preview-frame`.\n * @param exitingFrameClassName Hashed class for the exit state.\n */\nexport function createDashboardDragDropAnimation(\n\tdragPreviewFrameClassName: string,\n\texitingFrameClassName: string\n): DropAnimation {\n\treturn {\n\t\t...defaultDropAnimation,\n\t\tduration: DROP_ANIMATION_DURATION_MS,\n\t\teasing: DROP_ANIMATION_EASING,\n\t\tsideEffects( args ) {\n\t\t\tconst cleanupDefault = defaultDropAnimationSideEffects( {\n\t\t\t\tstyles: {\n\t\t\t\t\tactive: {\n\t\t\t\t\t\topacity: '0',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} )( args );\n\n\t\t\tconst frame = args.dragOverlay.node.getElementsByClassName(\n\t\t\t\tdragPreviewFrameClassName\n\t\t\t)[ 0 ] as HTMLElement | undefined;\n\n\t\t\tif ( frame ) {\n\t\t\t\tframe\n\t\t\t\t\t.getAnimations()\n\t\t\t\t\t.forEach( ( animation ) => animation.cancel() );\n\t\t\t\tconst lift = frame.firstElementChild;\n\t\t\t\tif ( lift instanceof HTMLElement ) {\n\t\t\t\t\tlift.getAnimations().forEach( ( animation ) =>\n\t\t\t\t\t\tanimation.cancel()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tframe.classList.add( exitingFrameClassName );\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\tcleanupDefault?.();\n\t\t\t\tif ( frame ) {\n\t\t\t\t\tframe.classList.remove( exitingFrameClassName );\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAGO;AAIA,IAAM,6BAA6B;AAG1C,IAAM,wBAAwB;AAUvB,SAAS,iCACf,2BACA,uBACgB;AAChB,SAAO;AAAA,IACN,GAAG;AAAA,IACH,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,YAAa,MAAO;AACnB,YAAM,qBAAiB,6CAAiC;AAAA,QACvD,QAAQ;AAAA,UACP,QAAQ;AAAA,YACP,SAAS;AAAA,UACV;AAAA,QACD;AAAA,MACD,CAAE,EAAG,IAAK;AAEV,YAAM,QAAQ,KAAK,YAAY,KAAK;AAAA,QACnC;AAAA,MACD,EAAG,CAAE;AAEL,UAAK,OAAQ;AACZ,cACE,cAAc,EACd,QAAS,CAAE,cAAe,UAAU,OAAO,CAAE;AAC/C,cAAM,OAAO,MAAM;AACnB,YAAK,gBAAgB,aAAc;AAClC,eAAK,cAAc,EAAE;AAAA,YAAS,CAAE,cAC/B,UAAU,OAAO;AAAA,UAClB;AAAA,QACD;AACA,cAAM,UAAU,IAAK,qBAAsB;AAAA,MAC5C;AAEA,aAAO,MAAM;AACZ,yBAAiB;AACjB,YAAK,OAAQ;AACZ,gBAAM,UAAU,OAAQ,qBAAsB;AAAA,QAC/C;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"drag-overlay-drop-animation.cjs","names":["defaultDropAnimation","defaultDropAnimationSideEffects"],"sources":["../../src/shared/drag-overlay-drop-animation.ts"],"sourcesContent":["import {\n\tdefaultDropAnimation,\n\tdefaultDropAnimationSideEffects,\n} from '@dnd-kit/core';\nimport type { DropAnimation } from '@dnd-kit/core';\n\n/** Matches `--wpds-motion-duration-md` on the drag preview frame exit. */\nexport const DROP_ANIMATION_DURATION_MS = 200;\n\n/** Matches `--wpds-motion-easing-balanced` on the drag preview frame exit. */\nconst DROP_ANIMATION_EASING = 'cubic-bezier(0.4, 0, 0.2, 1)';\n\n/**\n * Composes `@dnd-kit/core`’s default overlay drop translation with preview\n * exit keyframes (via side effects). When the pointer never moves, `@dnd-kit`\n * skips the drop animation and these side effects do not run.\n *\n * @param dragPreviewFrameClassName Hashed class for `.drag-preview-frame`.\n * @param exitingFrameClassName Hashed class for the exit state.\n */\nexport function createDashboardDragDropAnimation(\n\tdragPreviewFrameClassName: string,\n\texitingFrameClassName: string\n): DropAnimation {\n\treturn {\n\t\t...defaultDropAnimation,\n\t\tduration: DROP_ANIMATION_DURATION_MS,\n\t\teasing: DROP_ANIMATION_EASING,\n\t\tsideEffects( args ) {\n\t\t\tconst cleanupDefault = defaultDropAnimationSideEffects( {\n\t\t\t\tstyles: {\n\t\t\t\t\tactive: {\n\t\t\t\t\t\topacity: '0',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t} )( args );\n\n\t\t\tconst frame = args.dragOverlay.node.getElementsByClassName(\n\t\t\t\tdragPreviewFrameClassName\n\t\t\t)[ 0 ] as HTMLElement | undefined;\n\n\t\t\tif ( frame ) {\n\t\t\t\tframe\n\t\t\t\t\t.getAnimations()\n\t\t\t\t\t.forEach( ( animation ) => animation.cancel() );\n\t\t\t\tconst lift = frame.firstElementChild;\n\t\t\t\tif ( lift instanceof HTMLElement ) {\n\t\t\t\t\tlift.getAnimations().forEach( ( animation ) =>\n\t\t\t\t\t\tanimation.cancel()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tframe.classList.add( exitingFrameClassName );\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\tcleanupDefault?.();\n\t\t\t\tif ( frame ) {\n\t\t\t\t\tframe.classList.remove( exitingFrameClassName );\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,6BAA6B;;AAG1C,MAAM,wBAAwB;;;;;;;;;AAU9B,SAAgB,iCACf,2BACA,uBACgB;CAChB,OAAO;EACN,GAAGA,cAAAA;EACH,UAAA;EACA,QAAQ;EACR,YAAa,MAAO;GACnB,MAAM,kBAAA,GAAiBC,cAAAA,gCAAAA,CAAiC,EACvD,QAAQ,EACP,QAAQ,EACP,SAAS,IACV,EACD,EACD,CAAE,CAAC,CAAE,IAAK;GAEV,MAAM,QAAQ,KAAK,YAAY,KAAK,uBACnC,yBACD,CAAC,CAAE;GAEH,IAAK,OAAQ;IACZ,MACE,cAAc,CAAC,CACf,SAAW,cAAe,UAAU,OAAO,CAAE;IAC/C,MAAM,OAAO,MAAM;IACnB,IAAK,gBAAgB,aACpB,KAAK,cAAc,CAAC,CAAC,SAAW,cAC/B,UAAU,OAAO,CAClB;IAED,MAAM,UAAU,IAAK,qBAAsB;GAC5C;GAEA,aAAa;IACZ,iBAAiB;IACjB,IAAK,OACJ,MAAM,UAAU,OAAQ,qBAAsB;GAEhD;EACD;CACD;AACD"}
@@ -1,31 +1,14 @@
1
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/grid-item-key.ts
21
- var grid_item_key_exports = {};
22
- __export(grid_item_key_exports, {
23
- GRID_ITEM_DATA_KEY: () => GRID_ITEM_DATA_KEY
24
- });
25
- module.exports = __toCommonJS(grid_item_key_exports);
26
- var GRID_ITEM_DATA_KEY = "data-wp-grid-item-key";
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- GRID_ITEM_DATA_KEY
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
30
5
  });
31
- //# sourceMappingURL=grid-item-key.cjs.map
6
+ // packages/grid/src/shared/grid-item-key.ts
7
+ /**
8
+ * Data attribute grid tiles declare so layout-shift animation can map
9
+ * measured DOM nodes back to logical item keys.
10
+ */
11
+ const GRID_ITEM_DATA_KEY = "data-wp-grid-item-key";
12
+ exports.GRID_ITEM_DATA_KEY = GRID_ITEM_DATA_KEY;
13
+
14
+ //# sourceMappingURL=grid-item-key.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/shared/grid-item-key.ts"],
4
- "sourcesContent": ["/**\n * Data attribute grid tiles declare so layout-shift animation can map\n * measured DOM nodes back to logical item keys.\n */\nexport const GRID_ITEM_DATA_KEY = 'data-wp-grid-item-key';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,qBAAqB;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"grid-item-key.cjs","names":[],"sources":["../../src/shared/grid-item-key.ts"],"sourcesContent":["/**\n * Data attribute grid tiles declare so layout-shift animation can map\n * measured DOM nodes back to logical item keys.\n */\nexport const GRID_ITEM_DATA_KEY = 'data-wp-grid-item-key';\n"],"mappings":";;;;;;;;;;AAIA,MAAa,qBAAqB"}
@@ -1,187 +1,186 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/grid/src/shared/grid-overlay.tsx
31
- var grid_overlay_exports = {};
32
- __export(grid_overlay_exports, {
33
- GridOverlay: () => GridOverlay
34
- });
35
- module.exports = __toCommonJS(grid_overlay_exports);
36
- var import_clsx = __toESM(require("clsx"));
37
- var import_element = require("@wordpress/element");
38
-
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let clsx = require("clsx");
28
+ clsx = __toESM(clsx);
29
+ let _wordpress_element = require("@wordpress/element");
30
+ let react_jsx_runtime = require("react/jsx-runtime");
39
31
  // packages/style-runtime/src/index.ts
40
- var STYLE_HASH_ATTRIBUTE = "data-wp-hash";
32
+ const STYLE_HASH_ATTRIBUTE = "data-wp-hash";
33
+ /**
34
+ * Returns the shared style runtime registry.
35
+ *
36
+ * The registry is stored on `globalThis` so separately bundled copies of this
37
+ * package can coordinate through the same document and style maps.
38
+ *
39
+ * @return The shared runtime registry.
40
+ */
41
41
  function getRuntime() {
42
- const globalScope = globalThis;
43
- if (globalScope.__wpStyleRuntime) {
44
- return globalScope.__wpStyleRuntime;
45
- }
46
- globalScope.__wpStyleRuntime = {
47
- documents: /* @__PURE__ */ new Map(),
48
- styles: /* @__PURE__ */ new Map(),
49
- injectedStyles: /* @__PURE__ */ new WeakMap()
50
- };
51
- if (typeof document !== "undefined") {
52
- registerDocument(document);
53
- }
54
- return globalScope.__wpStyleRuntime;
42
+ const globalScope = globalThis;
43
+ if (globalScope.__wpStyleRuntime) return globalScope.__wpStyleRuntime;
44
+ globalScope.__wpStyleRuntime = {
45
+ documents: /* @__PURE__ */ new Map(),
46
+ styles: /* @__PURE__ */ new Map(),
47
+ injectedStyles: /* @__PURE__ */ new WeakMap()
48
+ };
49
+ if (typeof document !== "undefined") registerDocument(document);
50
+ return globalScope.__wpStyleRuntime;
55
51
  }
52
+ /**
53
+ * Checks whether a document already contains a style tag for a hash.
54
+ *
55
+ * @param targetDocument Document to inspect.
56
+ * @param hash Stable hash for the transformed CSS.
57
+ *
58
+ * @return Whether the style hash already exists in the document.
59
+ */
56
60
  function documentContainsStyleHash(targetDocument, hash) {
57
- if (!targetDocument.head) {
58
- return false;
59
- }
60
- for (const style of targetDocument.head.querySelectorAll(
61
- `style[${STYLE_HASH_ATTRIBUTE}]`
62
- )) {
63
- if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) {
64
- return true;
65
- }
66
- }
67
- return false;
61
+ if (!targetDocument.head) return false;
62
+ for (const style of targetDocument.head.querySelectorAll(`style[${STYLE_HASH_ATTRIBUTE}]`)) if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) return true;
63
+ return false;
68
64
  }
65
+ /**
66
+ * Injects a registered style into a document, unless that document already
67
+ * contains a style tag for the same hash.
68
+ *
69
+ * @param targetDocument Document to inject the style into.
70
+ * @param hash Stable hash for the transformed CSS.
71
+ * @param css CSS text to inject.
72
+ */
69
73
  function injectStyle(targetDocument, hash, css) {
70
- if (!targetDocument.head) {
71
- return;
72
- }
73
- const runtime = getRuntime();
74
- let injectedStyles = runtime.injectedStyles.get(targetDocument);
75
- if (!injectedStyles) {
76
- injectedStyles = /* @__PURE__ */ new Set();
77
- runtime.injectedStyles.set(targetDocument, injectedStyles);
78
- }
79
- if (injectedStyles.has(hash)) {
80
- return;
81
- }
82
- if (documentContainsStyleHash(targetDocument, hash)) {
83
- injectedStyles.add(hash);
84
- return;
85
- }
86
- const style = targetDocument.createElement("style");
87
- style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
88
- style.appendChild(targetDocument.createTextNode(css));
89
- targetDocument.head.appendChild(style);
90
- injectedStyles.add(hash);
74
+ if (!targetDocument.head) return;
75
+ const runtime = getRuntime();
76
+ let injectedStyles = runtime.injectedStyles.get(targetDocument);
77
+ if (!injectedStyles) {
78
+ injectedStyles = /* @__PURE__ */ new Set();
79
+ runtime.injectedStyles.set(targetDocument, injectedStyles);
80
+ }
81
+ if (injectedStyles.has(hash)) return;
82
+ if (documentContainsStyleHash(targetDocument, hash)) {
83
+ injectedStyles.add(hash);
84
+ return;
85
+ }
86
+ const style = targetDocument.createElement("style");
87
+ style.setAttribute(STYLE_HASH_ATTRIBUTE, hash);
88
+ style.appendChild(targetDocument.createTextNode(css));
89
+ targetDocument.head.appendChild(style);
90
+ injectedStyles.add(hash);
91
91
  }
92
+ /**
93
+ * Registers a document as a style injection target.
94
+ *
95
+ * Existing registered styles are replayed into the document immediately.
96
+ * Documents are reference-counted so multiple providers can safely register the
97
+ * same document without one cleanup removing it while another registration is
98
+ * still active.
99
+ *
100
+ * @param targetDocument Document to receive registered styles.
101
+ * @return Cleanup function that unregisters this document registration.
102
+ */
92
103
  function registerDocument(targetDocument) {
93
- const runtime = getRuntime();
94
- runtime.documents.set(
95
- targetDocument,
96
- (runtime.documents.get(targetDocument) ?? 0) + 1
97
- );
98
- for (const [hash, css] of runtime.styles) {
99
- injectStyle(targetDocument, hash, css);
100
- }
101
- return () => {
102
- const count = runtime.documents.get(targetDocument);
103
- if (count === void 0) {
104
- return;
105
- }
106
- if (count <= 1) {
107
- runtime.documents.delete(targetDocument);
108
- return;
109
- }
110
- runtime.documents.set(targetDocument, count - 1);
111
- };
104
+ const runtime = getRuntime();
105
+ runtime.documents.set(targetDocument, (runtime.documents.get(targetDocument) ?? 0) + 1);
106
+ for (const [hash, css] of runtime.styles) injectStyle(targetDocument, hash, css);
107
+ return () => {
108
+ const count = runtime.documents.get(targetDocument);
109
+ if (count === void 0) return;
110
+ if (count <= 1) {
111
+ runtime.documents.delete(targetDocument);
112
+ return;
113
+ }
114
+ runtime.documents.set(targetDocument, count - 1);
115
+ };
112
116
  }
117
+ /**
118
+ * Registers a style and injects it into all registered documents.
119
+ *
120
+ * The hash is used as the deduplication key, so calling this repeatedly with
121
+ * the same hash will not add duplicate style tags to a document.
122
+ * Registered styles are retained for the lifetime of the page so they can be
123
+ * replayed into documents that are registered later.
124
+ *
125
+ * @param hash Stable hash for the transformed CSS.
126
+ * @param css CSS text to inject.
127
+ */
113
128
  function registerStyle(hash, css) {
114
- const runtime = getRuntime();
115
- runtime.styles.set(hash, css);
116
- for (const targetDocument of runtime.documents.keys()) {
117
- injectStyle(targetDocument, hash, css);
118
- }
129
+ const runtime = getRuntime();
130
+ runtime.styles.set(hash, css);
131
+ for (const targetDocument of runtime.documents.keys()) injectStyle(targetDocument, hash, css);
119
132
  }
120
-
121
133
  // packages/grid/src/shared/grid-overlay.module.css
122
- if (typeof process === "undefined" || process.env.NODE_ENV !== "test") {
123
- registerStyle("63c265b9f4", "._9d372b1b567c1c15__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}._9d372b1b567c1c15__overlay.acb42ab28bd5e371__is-active{opacity:1;visibility:visible}@media not (prefers-reduced-motion){._9d372b1b567c1c15__overlay.acb42ab28bd5e371__is-active .d8e6ee9623aadacf__row,._9d372b1b567c1c15__overlay.acb42ab28bd5e371__is-active:not(._1cee1202cb622c6b__has-rows) ._04ff499ab60b4891__column{animation:_2d68e980e4534716__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 _2d68e980e4534716__grid-overlay-tile-in{to{opacity:1;transform:scale(1)}}._9d372b1b567c1c15__overlay:not(.acb42ab28bd5e371__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)}._9d372b1b567c1c15__overlay:not(.acb42ab28bd5e371__is-active) ._04ff499ab60b4891__column,._9d372b1b567c1c15__overlay:not(.acb42ab28bd5e371__is-active) .d8e6ee9623aadacf__row{animation:none;transform:none}}@media (prefers-reduced-motion:reduce){._9d372b1b567c1c15__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)}._9d372b1b567c1c15__overlay.acb42ab28bd5e371__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}}._04ff499ab60b4891__column{display:flex;flex-direction:column;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));min-width:0}.d8e6ee9623aadacf__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)}");
124
- }
125
- var grid_overlay_default = { "overlay": "_9d372b1b567c1c15__overlay", "is-active": "acb42ab28bd5e371__is-active", "row": "d8e6ee9623aadacf__row", "has-rows": "_1cee1202cb622c6b__has-rows", "column": "_04ff499ab60b4891__column", "grid-overlay-tile-in": "_2d68e980e4534716__grid-overlay-tile-in" };
126
-
134
+ if (typeof process === "undefined" || process.env.NODE_ENV !== "test") registerStyle("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)}");
135
+ var grid_overlay_module_default = {
136
+ "overlay": "_25129ed7a26e7e13__overlay",
137
+ "is-active": "b8aeff13d321f688__is-active",
138
+ "row": "_77f7aa6e64d3f582__row",
139
+ "has-rows": "d45f40be6bbfcbd1__has-rows",
140
+ "column": "_79f01d1ba6c72aa8__column",
141
+ "grid-overlay-tile-in": "b17f75714e3dfcc2__grid-overlay-tile-in"
142
+ };
127
143
  // packages/grid/src/shared/grid-overlay.tsx
128
- var import_jsx_runtime = require("react/jsx-runtime");
129
- function GridOverlay({
130
- columns,
131
- rowHeight,
132
- rows,
133
- isActive
134
- }) {
135
- const showRows = typeof rowHeight === "number" && typeof rows === "number" && rows > 0;
136
- const [waveKey, setWaveKey] = (0, import_element.useState)(0);
137
- (0, import_element.useEffect)(() => {
138
- if (isActive) {
139
- setWaveKey((key) => key + 1);
140
- }
141
- }, [isActive]);
142
- const style = {
143
- gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
144
- ...showRows ? {
145
- "--wp-grid-overlay-row-height": `${rowHeight}px`
146
- } : {}
147
- };
148
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
149
- "div",
150
- {
151
- "aria-hidden": true,
152
- className: (0, import_clsx.default)(
153
- grid_overlay_default.overlay,
154
- isActive && grid_overlay_default["is-active"],
155
- showRows && grid_overlay_default["has-rows"]
156
- ),
157
- style,
158
- children: Array.from({ length: columns }, (_column, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
159
- "div",
160
- {
161
- className: grid_overlay_default.column,
162
- style: {
163
- "--wp-grid-overlay-column-index": columnIndex,
164
- "--wp-grid-overlay-row-index": 0
165
- },
166
- children: showRows && Array.from({ length: rows }, (_row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
167
- "div",
168
- {
169
- className: grid_overlay_default.row,
170
- style: {
171
- "--wp-grid-overlay-row-index": rowIndex
172
- }
173
- },
174
- rowIndex
175
- ))
176
- },
177
- columnIndex
178
- ))
179
- },
180
- waveKey
181
- );
144
+ /**
145
+ * Default edit-mode overlay: one column per track, each holding `rows`
146
+ * row-marker tiles when `rowHeight` is uniform. Used by both surfaces
147
+ * and replaceable via `renderGridOverlay`. Reveals with a diagonal
148
+ * wave on activate and releases paint cost while inactive.
149
+ *
150
+ * @param props Render props supplied by the surface.
151
+ * @param props.columns Column tracks to mirror.
152
+ * @param props.rowHeight Uniform row height in pixels; omitted for
153
+ * content-sized rows, which skip row markers.
154
+ * @param props.rows Row tracks per column; omitted when unknown.
155
+ * @param props.isActive When `false`, the overlay fades out.
156
+ */
157
+ function GridOverlay({ columns, rowHeight, rows, isActive }) {
158
+ const showRows = typeof rowHeight === "number" && typeof rows === "number" && rows > 0;
159
+ const [waveKey, setWaveKey] = (0, _wordpress_element.useState)(0);
160
+ (0, _wordpress_element.useEffect)(() => {
161
+ if (isActive) setWaveKey((key) => key + 1);
162
+ }, [isActive]);
163
+ const style = {
164
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,
165
+ ...showRows ? { "--wp-grid-overlay-row-height": `${rowHeight}px` } : {}
166
+ };
167
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
168
+ "aria-hidden": true,
169
+ className: (0, clsx.default)(grid_overlay_module_default.overlay, isActive && grid_overlay_module_default["is-active"], showRows && grid_overlay_module_default["has-rows"]),
170
+ style,
171
+ children: Array.from({ length: columns }, (_column, columnIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
172
+ className: grid_overlay_module_default.column,
173
+ style: {
174
+ "--wp-grid-overlay-column-index": columnIndex,
175
+ "--wp-grid-overlay-row-index": 0
176
+ },
177
+ children: showRows && Array.from({ length: rows }, (_row, rowIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
178
+ className: grid_overlay_module_default.row,
179
+ style: { "--wp-grid-overlay-row-index": rowIndex }
180
+ }, rowIndex))
181
+ }, columnIndex))
182
+ }, waveKey);
182
183
  }
183
- // Annotate the CommonJS export names for ESM import in node:
184
- 0 && (module.exports = {
185
- GridOverlay
186
- });
187
- //# sourceMappingURL=grid-overlay.cjs.map
184
+ exports.GridOverlay = GridOverlay;
185
+
186
+ //# sourceMappingURL=grid-overlay.cjs.map