@wordpress/block-editor 12.19.8 → 12.19.9

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.
@@ -38,12 +38,14 @@ function Pagination({
38
38
  variant: "tertiary",
39
39
  onClick: () => changePage(1),
40
40
  disabled: currentPage === 1,
41
- "aria-label": (0, _i18n.__)('First page')
41
+ "aria-label": (0, _i18n.__)('First page'),
42
+ __experimentalIsFocusable: true
42
43
  }, (0, _react.createElement)("span", null, "\xAB")), (0, _react.createElement)(_components.Button, {
43
44
  variant: "tertiary",
44
45
  onClick: () => changePage(currentPage - 1),
45
46
  disabled: currentPage === 1,
46
- "aria-label": (0, _i18n.__)('Previous page')
47
+ "aria-label": (0, _i18n.__)('Previous page'),
48
+ __experimentalIsFocusable: true
47
49
  }, (0, _react.createElement)("span", null, "\u2039"))), (0, _react.createElement)(_components.__experimentalText, {
48
50
  variant: "muted"
49
51
  }, (0, _i18n.sprintf)(
@@ -56,13 +58,15 @@ function Pagination({
56
58
  variant: "tertiary",
57
59
  onClick: () => changePage(currentPage + 1),
58
60
  disabled: currentPage === numPages,
59
- "aria-label": (0, _i18n.__)('Next page')
61
+ "aria-label": (0, _i18n.__)('Next page'),
62
+ __experimentalIsFocusable: true
60
63
  }, (0, _react.createElement)("span", null, "\u203A")), (0, _react.createElement)(_components.Button, {
61
64
  variant: "tertiary",
62
65
  onClick: () => changePage(numPages),
63
66
  disabled: currentPage === numPages,
64
67
  "aria-label": (0, _i18n.__)('Last page'),
65
- size: "default"
68
+ size: "default",
69
+ __experimentalIsFocusable: true
66
70
  }, (0, _react.createElement)("span", null, "\xBB")))));
67
71
  }
68
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","Pagination","currentPage","numPages","changePage","totalItems","_react","createElement","__experimentalVStack","className","__experimentalText","variant","sprintf","_n","__experimentalHStack","expanded","spacing","justify","Button","onClick","disabled","__","_x","size"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\t\ttotalItems\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AATA;AACA;AACA;;AASe,SAASE,UAAUA,CAAE;EACnCC,WAAW;EACXC,QAAQ;EACRC,UAAU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AAAD,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAY,kBAAI;IAACC,OAAO,EAAC;EAAO,GAClB,IAAAC,aAAO;EACR;EACA,IAAAU,QAAE,EAAE,cAAc,EAAE,QAAS,CAAC,EAC9BpB,WAAW,EACXC,QACD,CACK,CAAC,EACP,IAAAG,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAgB,oBAAM;IACNC,QAAQ,EAAG,KAAO;IAClBC,OAAO,EAAG,CAAG;IACbP,SAAS,EAAC;EAA6C,GAEvD,IAAAH,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAoB,MAAM;IACNP,OAAO,EAAC,UAAU;IAClBQ,OAAO,EAAGA,CAAA,KAAMf,UAAU,CAAEF,WAAW,GAAG,CAAE,CAAG;IAC/CkB,QAAQ,EAAGlB,WAAW,KAAKC,QAAU;IACrC,cAAa,IAAAkB,QAAE,EAAE,WAAY;EAAG,GAEhC,IAAAf,MAAA,CAAAC,aAAA,gBAAM,QAAO,CACN,CAAC,EACT,IAAAD,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAoB,MAAM;IACNP,OAAO,EAAC,UAAU;IAClBQ,OAAO,EAAGA,CAAA,KAAMf,UAAU,CAAED,QAAS,CAAG;IACxCiB,QAAQ,EAAGlB,WAAW,KAAKC,QAAU;IACrC,cAAa,IAAAkB,QAAE,EAAE,WAAY,CAAG;IAChCE,IAAI,EAAC;EAAS,GAEd,IAAAjB,MAAA,CAAAC,aAAA,gBAAM,MAAO,CACN,CACD,CACD,CAEF,CAAC;AAEX"}
1
+ {"version":3,"names":["_components","require","_i18n","Pagination","currentPage","numPages","changePage","totalItems","_react","createElement","__experimentalVStack","className","__experimentalText","variant","sprintf","_n","__experimentalHStack","expanded","spacing","justify","Button","onClick","disabled","__","__experimentalIsFocusable","_x","size"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\t\ttotalItems\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AATA;AACA;AACA;;AASe,SAASE,UAAUA,CAAE;EACnC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B;EAAA,GAEzB,IAAAhB,MAAA,CAAAC,aAAA,gBAAM,QAAO,CACN,CACD,CAAC,EACT,IAAAD,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAY,kBAAI;IAACC,OAAO,EAAC;EAAO,GAClB,IAAAC,aAAO;EACR;EACA,IAAAW,QAAE,EAAE,cAAc,EAAE,QAAS,CAAC,EAC9BrB,WAAW,EACXC,QACD,CACK,CAAC,EACP,IAAAG,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAgB,oBAAM;IACNC,QAAQ,EAAG,KAAO;IAClBC,OAAO,EAAG,CAAG;IACbP,SAAS,EAAC;EAA6C,GAEvD,IAAAH,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAoB,MAAM;IACNP,OAAO,EAAC,UAAU;IAClBQ,OAAO,EAAGA,CAAA,KAAMf,UAAU,CAAEF,WAAW,GAAG,CAAE,CAAG;IAC/CkB,QAAQ,EAAGlB,WAAW,KAAKC,QAAU;IACrC,cAAa,IAAAkB,QAAE,EAAE,WAAY,CAAG;IAChCC,yBAAyB;EAAA,GAEzB,IAAAhB,MAAA,CAAAC,aAAA,gBAAM,QAAO,CACN,CAAC,EACT,IAAAD,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAoB,MAAM;IACNP,OAAO,EAAC,UAAU;IAClBQ,OAAO,EAAGA,CAAA,KAAMf,UAAU,CAAED,QAAS,CAAG;IACxCiB,QAAQ,EAAGlB,WAAW,KAAKC,QAAU;IACrC,cAAa,IAAAkB,QAAE,EAAE,WAAY,CAAG;IAChCG,IAAI,EAAC,SAAS;IACdF,yBAAyB;EAAA,GAEzB,IAAAhB,MAAA,CAAAC,aAAA,gBAAM,MAAO,CACN,CACD,CACD,CAEF,CAAC;AAEX"}
@@ -409,9 +409,14 @@ function useListViewDropZone({
409
409
  const ref = (0, _compose.__experimentalUseDropZone)({
410
410
  dropZoneElement,
411
411
  onDrop(event) {
412
+ throttled.cancel();
412
413
  if (target) {
413
414
  onBlockDrop(event);
414
415
  }
416
+ // Use `undefined` value to indicate that the drag has concluded.
417
+ // This allows styling rules that are active only when a user is
418
+ // dragging to be removed.
419
+ setTarget(undefined);
415
420
  },
416
421
  onDragLeave() {
417
422
  throttled.cancel();
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_compose","_i18n","_math","_useOnBlockDrop","_interopRequireDefault","_store","NESTING_LEVEL_INDENTATION","exports","isUpGesture","point","rect","nestingLevel","rtl","blockIndentPosition","right","left","x","getDesiredRelativeParentLevel","distanceBetweenPointAndBlockIndentPosition","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","isNestingHorizontalGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","getDistanceToNearestEdge","isCursorWithinBlock","isPointContainedByRect","undefined","indexOf","previousBlockData","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","newBlockIndex","blockIndex","dropPosition","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","canInsertDraggedBlocksAsSibling","offset","EXPAND_THROTTLE_OPTIONS","leading","trailing","useListViewDropZone","dropZoneElement","expandedState","setExpandedState","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","useSelect","blockEditorStore","target","setTarget","useState","targetRootClientId","targetBlockIndex","onBlockDrop","useOnBlockDrop","isRTL","previousRootClientId","usePrevious","maybeExpandBlock","useCallback","_expandedState","_target","type","clientIds","throttledMaybeExpandBlock","useThrottle","useEffect","cancel","draggedBlockClientIds","throttled","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","classList","contains","parseInt","getAttribute","newTarget","ref","useDropZone","onDrop","onDragLeave","onDragOver","onDragEnd"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback, useEffect } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block (or bottom right in RTL languages), then it is an upward gesture.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel(\n\tpoint,\n\trect,\n\tnestingLevel = 1,\n\trtl = false\n) {\n\t// In RTL languages, the block indent position is from the right edge of the block.\n\t// In LTR languages, the block indent position is from the left edge of the block.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst distanceBetweenPointAndBlockIndentPosition = rtl\n\t\t? blockIndentPosition - point.x\n\t\t: point.x - blockIndentPosition;\n\n\tconst desiredParentLevel = Math.round(\n\t\tdistanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION\n\t);\n\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst isNestingHorizontalGesture = rtl\n\t\t? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION\n\t\t: point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;\n\n\treturn isNestingHorizontalGesture && point.y < rect.bottom;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position, rtl = false ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tclientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture(\n\t\t\tposition,\n\t\t\tcandidateRect,\n\t\t\tcandidateBlockParents.length,\n\t\t\trtl\n\t\t)\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n// Throttle options need to be defined outside of the hook to avoid\n// re-creating the object on every render. This is due to a limitation\n// of the `useThrottle` hook, where the options object is included\n// in the dependency array for memoization.\nconst EXPAND_THROTTLE_OPTIONS = {\n\tleading: false, // Don't call the function immediately on the first call.\n\ttrailing: true, // Do call the function on the last call.\n};\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.\n * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( {\n\tdropZoneElement,\n\texpandedState,\n\tsetExpandedState,\n} ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst rtl = isRTL();\n\n\tconst previousRootClientId = usePrevious( targetRootClientId );\n\n\tconst maybeExpandBlock = useCallback(\n\t\t( _expandedState, _target ) => {\n\t\t\t// If the user is attempting to drop a block inside a collapsed block,\n\t\t\t// that is, using a nesting gesture flagged by 'inside' dropPosition,\n\t\t\t// expand the block within the list view, if it isn't already.\n\t\t\tconst { rootClientId } = _target || {};\n\t\t\tif ( ! rootClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\t_target?.dropPosition === 'inside' &&\n\t\t\t\t! _expandedState[ rootClientId ]\n\t\t\t) {\n\t\t\t\tsetExpandedState( {\n\t\t\t\t\ttype: 'expand',\n\t\t\t\t\tclientIds: [ rootClientId ],\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\n\t// Throttle the maybeExpandBlock function to avoid expanding the block\n\t// too quickly when the user is dragging over the block. This is to\n\t// avoid expanding the block when the user is just passing over it.\n\tconst throttledMaybeExpandBlock = useThrottle(\n\t\tmaybeExpandBlock,\n\t\t500,\n\t\tEXPAND_THROTTLE_OPTIONS\n\t);\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\ttarget?.dropPosition !== 'inside' ||\n\t\t\tpreviousRootClientId !== target?.rootClientId\n\t\t) {\n\t\t\tthrottledMaybeExpandBlock.cancel();\n\t\t\treturn;\n\t\t}\n\t\tthrottledMaybeExpandBlock( expandedState, target );\n\t}, [\n\t\texpandedState,\n\t\tpreviousRootClientId,\n\t\ttarget,\n\t\tthrottledMaybeExpandBlock,\n\t] );\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\t\t\t\t\tconst isDraggedBlock =\n\t\t\t\t\t\tblockElement.classList.contains( 'is-dragging' );\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag ? isDraggedBlock : false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget(\n\t\t\t\t\tblocksData,\n\t\t\t\t\tposition,\n\t\t\t\t\trtl\n\t\t\t\t);\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\n\t\t\t\tcanInsertBlocks,\n\t\t\t\tdraggedBlockClientIds,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\trtl,\n\t\t\t]\n\t\t),\n\t\t50\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop( event ) {\n\t\t\tif ( target ) {\n\t\t\t\tonBlockDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `null` value to indicate that the drop target is not valid,\n\t\t\t// but that the drag is still active. This allows for styling rules\n\t\t\t// that are active only when a user drags outside of the list view.\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `undefined` value to indicate that the drag has concluded.\n\t\t\t// This allows styling rules that are active only when a user is\n\t\t\t// dragging to be removed.\n\t\t\tsetTarget( undefined );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAIA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AApBA;AACA;AACA;;AAUA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACO,MAAMQ,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,EAAE;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,WAAWA,CAAEC,KAAK,EAAEC,IAAI,EAAEC,YAAY,GAAG,CAAC,EAAEC,GAAG,GAAG,KAAK,EAAG;EAClE;EACA;EACA,MAAMC,mBAAmB,GAAGD,GAAG,GAC5BF,IAAI,CAACI,KAAK,GAAGH,YAAY,GAAGL,yBAAyB,GACrDI,IAAI,CAACK,IAAI,GAAGJ,YAAY,GAAGL,yBAAyB;EACvD,OAAOM,GAAG,GAAGH,KAAK,CAACO,CAAC,GAAGH,mBAAmB,GAAGJ,KAAK,CAACO,CAAC,GAAGH,mBAAmB;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,6BAA6BA,CACrCR,KAAK,EACLC,IAAI,EACJC,YAAY,GAAG,CAAC,EAChBC,GAAG,GAAG,KAAK,EACV;EACD;EACA;EACA,MAAMC,mBAAmB,GAAGD,GAAG,GAC5BF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,CAAC;IACF,CAAE,CAAC;IAEH,MAAMmG,SAAS,GAAGxF,qBAAqB,CACtCjB,UAAU,EACVkB,QAAQ,EACR/B,GACD,CAAC;IAED,IAAKsH,SAAS,EAAG;MAChBvC,SAAS,CAAEuC,SAAU,CAAC;IACvB;EACD,CAAC,EACD,CACC3C,eAAe,EACfuB,qBAAqB,EACrBzB,aAAa,EACbD,aAAa,EACbD,oBAAoB,EACpBvE,GAAG,CAEL,CAAC,EACD,EACD,CAAC;EAED,MAAMuH,GAAG,GAAG,IAAAC,kCAAW,EAAE;IACxBpD,eAAe;IACfqD,MAAMA,CAAErB,KAAK,EAAG;MACf,IAAKtB,MAAM,EAAG;QACbK,WAAW,CAAEiB,KAAM,CAAC;MACrB;IACD,CAAC;IACDsB,WAAWA,CAAA,EAAG;MACbvB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAlB,SAAS,CAAE,IAAK,CAAC;IAClB,CAAC;IACD4C,UAAUA,CAAEvB,KAAK,EAAG;MACnB;MACA;MACA;MACAD,SAAS,CAAEC,KAAK,EAAEA,KAAK,CAACC,aAAc,CAAC;IACxC,CAAC;IACDuB,SAASA,CAAA,EAAG;MACXzB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAlB,SAAS,CAAElC,SAAU,CAAC;IACvB;EACD,CAAE,CAAC;EAEH,OAAO;IAAE0E,GAAG;IAAEzC;EAAO,CAAC;AACvB"}
1
+ {"version":3,"names":["_data","require","_element","_compose","_i18n","_math","_useOnBlockDrop","_interopRequireDefault","_store","NESTING_LEVEL_INDENTATION","exports","isUpGesture","point","rect","nestingLevel","rtl","blockIndentPosition","right","left","x","getDesiredRelativeParentLevel","distanceBetweenPointAndBlockIndentPosition","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","isNestingHorizontalGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","getDistanceToNearestEdge","isCursorWithinBlock","isPointContainedByRect","undefined","indexOf","previousBlockData","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","newBlockIndex","blockIndex","dropPosition","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","canInsertDraggedBlocksAsSibling","offset","EXPAND_THROTTLE_OPTIONS","leading","trailing","useListViewDropZone","dropZoneElement","expandedState","setExpandedState","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","useSelect","blockEditorStore","target","setTarget","useState","targetRootClientId","targetBlockIndex","onBlockDrop","useOnBlockDrop","isRTL","previousRootClientId","usePrevious","maybeExpandBlock","useCallback","_expandedState","_target","type","clientIds","throttledMaybeExpandBlock","useThrottle","useEffect","cancel","draggedBlockClientIds","throttled","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","classList","contains","parseInt","getAttribute","newTarget","ref","useDropZone","onDrop","onDragLeave","onDragOver","onDragEnd"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback, useEffect } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block (or bottom right in RTL languages), then it is an upward gesture.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel(\n\tpoint,\n\trect,\n\tnestingLevel = 1,\n\trtl = false\n) {\n\t// In RTL languages, the block indent position is from the right edge of the block.\n\t// In LTR languages, the block indent position is from the left edge of the block.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst distanceBetweenPointAndBlockIndentPosition = rtl\n\t\t? blockIndentPosition - point.x\n\t\t: point.x - blockIndentPosition;\n\n\tconst desiredParentLevel = Math.round(\n\t\tdistanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION\n\t);\n\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst isNestingHorizontalGesture = rtl\n\t\t? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION\n\t\t: point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;\n\n\treturn isNestingHorizontalGesture && point.y < rect.bottom;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position, rtl = false ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tclientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture(\n\t\t\tposition,\n\t\t\tcandidateRect,\n\t\t\tcandidateBlockParents.length,\n\t\t\trtl\n\t\t)\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n// Throttle options need to be defined outside of the hook to avoid\n// re-creating the object on every render. This is due to a limitation\n// of the `useThrottle` hook, where the options object is included\n// in the dependency array for memoization.\nconst EXPAND_THROTTLE_OPTIONS = {\n\tleading: false, // Don't call the function immediately on the first call.\n\ttrailing: true, // Do call the function on the last call.\n};\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.\n * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( {\n\tdropZoneElement,\n\texpandedState,\n\tsetExpandedState,\n} ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst rtl = isRTL();\n\n\tconst previousRootClientId = usePrevious( targetRootClientId );\n\n\tconst maybeExpandBlock = useCallback(\n\t\t( _expandedState, _target ) => {\n\t\t\t// If the user is attempting to drop a block inside a collapsed block,\n\t\t\t// that is, using a nesting gesture flagged by 'inside' dropPosition,\n\t\t\t// expand the block within the list view, if it isn't already.\n\t\t\tconst { rootClientId } = _target || {};\n\t\t\tif ( ! rootClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\t_target?.dropPosition === 'inside' &&\n\t\t\t\t! _expandedState[ rootClientId ]\n\t\t\t) {\n\t\t\t\tsetExpandedState( {\n\t\t\t\t\ttype: 'expand',\n\t\t\t\t\tclientIds: [ rootClientId ],\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\n\t// Throttle the maybeExpandBlock function to avoid expanding the block\n\t// too quickly when the user is dragging over the block. This is to\n\t// avoid expanding the block when the user is just passing over it.\n\tconst throttledMaybeExpandBlock = useThrottle(\n\t\tmaybeExpandBlock,\n\t\t500,\n\t\tEXPAND_THROTTLE_OPTIONS\n\t);\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\ttarget?.dropPosition !== 'inside' ||\n\t\t\tpreviousRootClientId !== target?.rootClientId\n\t\t) {\n\t\t\tthrottledMaybeExpandBlock.cancel();\n\t\t\treturn;\n\t\t}\n\t\tthrottledMaybeExpandBlock( expandedState, target );\n\t}, [\n\t\texpandedState,\n\t\tpreviousRootClientId,\n\t\ttarget,\n\t\tthrottledMaybeExpandBlock,\n\t] );\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\t\t\t\t\tconst isDraggedBlock =\n\t\t\t\t\t\tblockElement.classList.contains( 'is-dragging' );\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag ? isDraggedBlock : false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget(\n\t\t\t\t\tblocksData,\n\t\t\t\t\tposition,\n\t\t\t\t\trtl\n\t\t\t\t);\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\n\t\t\t\tcanInsertBlocks,\n\t\t\t\tdraggedBlockClientIds,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\trtl,\n\t\t\t]\n\t\t),\n\t\t50\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop( event ) {\n\t\t\tthrottled.cancel();\n\t\t\tif ( target ) {\n\t\t\t\tonBlockDrop( event );\n\t\t\t}\n\t\t\t// Use `undefined` value to indicate that the drag has concluded.\n\t\t\t// This allows styling rules that are active only when a user is\n\t\t\t// dragging to be removed.\n\t\t\tsetTarget( undefined );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `null` value to indicate that the drop target is not valid,\n\t\t\t// but that the drag is still active. This allows for styling rules\n\t\t\t// that are active only when a user drags outside of the list view.\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `undefined` value to indicate that the drag has concluded.\n\t\t\t// This allows styling rules that are active only when a user is\n\t\t\t// dragging to be removed.\n\t\t\tsetTarget( undefined );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAIA,IAAAK,eAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AApBA;AACA;AACA;;AAUA;AACA;AACA;;AAQA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;A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Ae;IACfqD,MAAMA,CAAErB,KAAK,EAAG;MACfD,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB,IAAKnB,MAAM,EAAG;QACbK,WAAW,CAAEiB,KAAM,CAAC;MACrB;MACA;MACA;MACA;MACArB,SAAS,CAAElC,SAAU,CAAC;IACvB,CAAC;IACD6E,WAAWA,CAAA,EAAG;MACbvB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAlB,SAAS,CAAE,IAAK,CAAC;IAClB,CAAC;IACD4C,UAAUA,CAAEvB,KAAK,EAAG;MACnB;MACA;MACA;MACAD,SAAS,CAAEC,KAAK,EAAEA,KAAK,CAACC,aAAc,CAAC;IACxC,CAAC;IACDuB,SAASA,CAAA,EAAG;MACXzB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAlB,SAAS,CAAElC,SAAU,CAAC;IACvB;EACD,CAAE,CAAC;EAEH,OAAO;IAAE0E,GAAG;IAAEzC;EAAO,CAAC;AACvB"}
@@ -275,7 +275,8 @@ function addAttribute(settings) {
275
275
  }
276
276
  function BlockWithLayoutStyles({
277
277
  block: BlockListBlock,
278
- props
278
+ props,
279
+ layoutClasses
279
280
  }) {
280
281
  const {
281
282
  name,
@@ -292,7 +293,6 @@ function BlockWithLayoutStyles({
292
293
  ...layout,
293
294
  type: 'constrained'
294
295
  } : layout || defaultBlockLayout || {};
295
- const layoutClasses = useLayoutClasses(attributes, name);
296
296
  const {
297
297
  kebabCase
298
298
  } = (0, _lockUnlock.unlock)(_components.privateApis);
@@ -334,7 +334,12 @@ function BlockWithLayoutStyles({
334
334
  * @return {Function} Wrapped component.
335
335
  */
336
336
  const withLayoutStyles = exports.withLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock => props => {
337
+ const {
338
+ name,
339
+ attributes
340
+ } = props;
337
341
  const blockSupportsLayout = hasLayoutBlockSupport(props.name);
342
+ const layoutClasses = useLayoutClasses(attributes, name);
338
343
  const shouldRenderLayoutStyles = (0, _data.useSelect)(select => {
339
344
  // The callback returns early to avoid block editor subscription.
340
345
  if (!blockSupportsLayout) {
@@ -344,12 +349,14 @@ const withLayoutStyles = exports.withLayoutStyles = (0, _compose.createHigherOrd
344
349
  }, [blockSupportsLayout]);
345
350
  if (!shouldRenderLayoutStyles) {
346
351
  return (0, _react.createElement)(BlockListBlock, {
347
- ...props
352
+ ...props,
353
+ __unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : undefined
348
354
  });
349
355
  }
350
356
  return (0, _react.createElement)(BlockWithLayoutStyles, {
351
357
  block: BlockListBlock,
352
- props: props
358
+ props: props,
359
+ layoutClasses: layoutClasses
353
360
  });
354
361
  }, 'withLayoutStyles');
355
362
  (0, _hooks.addFilter)('blocks.registerBlockType', 'core/layout/addAttribute', addAttribute);
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_hooks","_blocks","_data","_components","_i18n","_store","_components2","_useSettings","_layouts","_blockEditingMode","_definitions","_utils","_lockUnlock","layoutBlockSupportKey","hasLayoutBlockSupport","blockName","hasBlockSupport","useLayoutClasses","blockAttributes","kebabCase","unlock","componentsPrivateApis","rootPaddingAlignment","useSelect","select","getSettings","blockEditorStore","__experimentalFeatures","useRootPaddingAwareAlignments","layout","default","defaultBlockLayout","getBlockSupport","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","LAYOUT_DEFINITIONS","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","getLayoutType","blockGapSupport","useSettings","hasBlockGapSupport","css","getLayoutStyle","LayoutPanelPure","setAttributes","name","settings","useBlockSettings","layoutSettings","defaultThemeLayout","themeSupportsLayout","supportsLayout","blockEditingMode","useBlockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","_react","createElement","Fragment","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","_default","exports","shareWithChildBlocks","edit","attributeKeys","hasSupport","ButtonGroup","getLayoutTypes","map","Button","key","isPressed","onClick","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","id","useInstanceId","layoutClasses","selectorPrefix","layoutClassNames","classnames","useStyleOverride","__unstableLayoutClassNames","withLayoutStyles","createHigherOrderComponent","blockSupportsLayout","shouldRenderLayoutStyles","disableLayoutStyles","addFilter"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanelPure( { layout, setAttributes, name: blockName } ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\t// Layout comes from block attributes.\n\tconst [ defaultThemeLayout ] = useSettings( 'layout' );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( { block: BlockListBlock, props } ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\tconst layoutClasses = useLayoutClasses( attributes, name );\n\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }.${ selectorPrefix }${ id }`;\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = classnames(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( props.name );\n\t\tconst shouldRenderLayoutStyles = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn ! select( blockEditorStore ).getSettings()\n\t\t\t\t\t.disableLayoutStyles;\n\t\t\t},\n\t\t\t[ blockSupportsLayout ]\n\t\t);\n\n\t\tif ( ! shouldRenderLayoutStyles ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles block={ BlockListBlock } props={ props } />\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAOA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,WAAA,GAAAd,O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ACb;IAEA,OAAO,CAAE7G,MAAM,CAAEE,YAAiB,CAAC,CAACD,WAAW,CAAC,CAAC,CAC/C8G,mBAAmB;EACtB,CAAC,EACD,CAAEF,mBAAmB,CACtB,CAAC;EAED,IAAK,CAAEC,wBAAwB,EAAG;IACjC,OAAO,IAAA/C,MAAA,CAAAC,aAAA,EAACiC,cAAc;MAAA,GAAMC;IAAK,CAAI,CAAC;EACvC;EAEA,OACC,IAAAnC,MAAA,CAAAC,aAAA,EAAC+B,qBAAqB;IAACC,KAAK,EAAGC,cAAgB;IAACC,KAAK,EAAGA;EAAO,CAAE,CAAC;AAEpE,CAAC,EACD,kBACD,CAAC;AAED,IAAAc,gBAAS,EACR,0BAA0B,EAC1B,0BAA0B,EAC1BpB,YACD,CAAC;AACD,IAAAoB,gBAAS,EACR,uBAAuB,EACvB,uCAAuC,EACvCL,gBACD,CAAC"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_compose","_hooks","_blocks","_data","_components","_i18n","_store","_components2","_useSettings","_layouts","_blockEditingMode","_definitions","_utils","_lockUnlock","layoutBlockSupportKey","hasLayoutBlockSupport","blockName","hasBlockSupport","useLayoutClasses","blockAttributes","kebabCase","unlock","componentsPrivateApis","rootPaddingAlignment","useSelect","select","getSettings","blockEditorStore","__experimentalFeatures","useRootPaddingAwareAlignments","layout","default","defaultBlockLayout","getBlockSupport","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","LAYOUT_DEFINITIONS","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","getLayoutType","blockGapSupport","useSettings","hasBlockGapSupport","css","getLayoutStyle","LayoutPanelPure","setAttributes","name","settings","useBlockSettings","layoutSettings","defaultThemeLayout","themeSupportsLayout","supportsLayout","blockEditingMode","useBlockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","_react","createElement","Fragment","InspectorControls","PanelBody","title","__","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","_default","exports","shareWithChildBlocks","edit","attributeKeys","hasSupport","ButtonGroup","getLayoutTypes","map","Button","key","isPressed","onClick","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","layoutClasses","id","useInstanceId","selectorPrefix","layoutClassNames","classnames","useStyleOverride","__unstableLayoutClassNames","withLayoutStyles","createHigherOrderComponent","blockSupportsLayout","shouldRenderLayoutStyles","disableLayoutStyles","undefined","addFilter"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanelPure( { layout, setAttributes, name: blockName } ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\t// Layout comes from block attributes.\n\tconst [ defaultThemeLayout ] = useSettings( 'layout' );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }.${ selectorPrefix }${ id }`;\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = classnames(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( props.name );\n\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\tconst shouldRenderLayoutStyles = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn ! select( blockEditorStore ).getSettings()\n\t\t\t\t\t.disableLayoutStyles;\n\t\t\t},\n\t\t\t[ blockSupportsLayout ]\n\t\t);\n\n\t\tif ( ! shouldRenderLayoutStyles ) {\n\t\t\treturn (\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles\n\t\t\t\tblock={ BlockListBlock }\n\t\t\t\tprops={ props }\n\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t/>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAA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IAAAC,mCAA0B,EACvDX,cAAc,IAAQC,KAAK,IAAM;EAClC,MAAM;IAAE1D,IAAI;IAAEsD;EAAW,CAAC,GAAGI,KAAK;EAClC,MAAMW,mBAAmB,GAAGvH,qBAAqB,CAAE4G,KAAK,CAAC1D,IAAK,CAAC;EAC/D,MAAM2D,aAAa,GAAG1G,gBAAgB,CAAEqG,UAAU,EAAEtD,IAAK,CAAC;EAC1D,MAAMsE,wBAAwB,GAAG,IAAA/G,eAAS,EACvCC,MAAM,IAAM;IACb;IACA,IAAK,CAAE6G,mBAAmB,EAAG;MAC5B,OAAO,KAAK;IACb;IAEA,OAAO,CAAE7G,MAAM,CAAEE,YAAiB,CAAC,CAACD,WAAW,CAAC,CAAC,CAC/C8G,mBAAmB;EACtB,CAAC,EACD,CAAEF,mBAAmB,CACtB,CAAC;EAED,IAAK,CAAEC,wBAAwB,EAAG;IACjC,OACC,IAAA/C,MAAA,CAAAC,aAAA,EAACiC,cAAc;MAAA,GACTC,KAAK;MACVQ,0BAA0B,EACzBG,mBAAmB,GAAGV,aAAa,GAAGa;IACtC,CACD,CAAC;EAEJ;EAEA,OACC,IAAAjD,MAAA,CAAAC,aAAA,EAAC+B,qBAAqB;IACrBC,KAAK,EAAGC,cAAgB;IACxBC,KAAK,EAAGA,KAAO;IACfC,aAAa,EAAGA;EAAe,CAC/B,CAAC;AAEJ,CAAC,EACD,kBACD,CAAC;AAED,IAAAc,gBAAS,EACR,0BAA0B,EAC1B,0BAA0B,EAC1BrB,YACD,CAAC;AACD,IAAAqB,gBAAS,EACR,uBAAuB,EACvB,uCAAuC,EACvCN,gBACD,CAAC"}
@@ -31,12 +31,14 @@ export default function Pagination({
31
31
  variant: "tertiary",
32
32
  onClick: () => changePage(1),
33
33
  disabled: currentPage === 1,
34
- "aria-label": __('First page')
34
+ "aria-label": __('First page'),
35
+ __experimentalIsFocusable: true
35
36
  }, createElement("span", null, "\xAB")), createElement(Button, {
36
37
  variant: "tertiary",
37
38
  onClick: () => changePage(currentPage - 1),
38
39
  disabled: currentPage === 1,
39
- "aria-label": __('Previous page')
40
+ "aria-label": __('Previous page'),
41
+ __experimentalIsFocusable: true
40
42
  }, createElement("span", null, "\u2039"))), createElement(Text, {
41
43
  variant: "muted"
42
44
  }, sprintf(
@@ -49,13 +51,15 @@ export default function Pagination({
49
51
  variant: "tertiary",
50
52
  onClick: () => changePage(currentPage + 1),
51
53
  disabled: currentPage === numPages,
52
- "aria-label": __('Next page')
54
+ "aria-label": __('Next page'),
55
+ __experimentalIsFocusable: true
53
56
  }, createElement("span", null, "\u203A")), createElement(Button, {
54
57
  variant: "tertiary",
55
58
  onClick: () => changePage(numPages),
56
59
  disabled: currentPage === numPages,
57
60
  "aria-label": __('Last page'),
58
- size: "default"
61
+ size: "default",
62
+ __experimentalIsFocusable: true
59
63
  }, createElement("span", null, "\xBB")))));
60
64
  }
61
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","Pagination","currentPage","numPages","changePage","totalItems","createElement","className","variant","expanded","spacing","justify","onClick","disabled","size"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\t\ttotalItems\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAErD,eAAe,SAASC,UAAUA,CAAE;EACnCC,WAAW;EACXC,QAAQ;EACRC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAACf,MAAM;IAACgB,SAAS,EAAC;EAAgD,GACjED,aAAA,CAACX,IAAI;IAACa,OAAO,EAAC;EAAO;EAEnB;EACAR,OAAO;EACN;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEM,UAAW,CAAC,EACvCA,UACD,CAEI,CAAC,EAELF,QAAQ,GAAG,CAAC,IACbG,aAAA,CAACb,MAAM;IACNgB,QAAQ,EAAG,KAAO;IAClBC,OAAO,EAAG,CAAG;IACbC,OAAO,EAAC,YAAY;IACpBJ,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AAE,CAAE,WAAY,CAAG;IAChCiB,IAAI,EAAC;EAAS,GAEdR,aAAA,eAAM,MAAO,CACN,CACD,CACD,CAEF,CAAC;AAEX"}
1
+ {"version":3,"names":["__experimentalVStack","VStack","__experimentalHStack","HStack","__experimentalText","Text","Button","__","_x","_n","sprintf","Pagination","currentPage","numPages","changePage","totalItems","createElement","className","variant","expanded","spacing","justify","onClick","disabled","__experimentalIsFocusable","size"],"sources":["@wordpress/block-editor/src/components/block-patterns-paging/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\tButton,\n} from '@wordpress/components';\nimport { __, _x, _n, sprintf } from '@wordpress/i18n';\n\nexport default function Pagination( {\n\tcurrentPage,\n\tnumPages,\n\tchangePage,\n\ttotalItems,\n} ) {\n\treturn (\n\t\t<VStack className=\"block-editor-patterns__grid-pagination-wrapper\">\n\t\t\t<Text variant=\"muted\">\n\t\t\t\t{\n\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: Total number of patterns.\n\t\t\t\t\t\t_n( '%s item', '%s items', totalItems ),\n\t\t\t\t\t\ttotalItems\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t</Text>\n\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<HStack\n\t\t\t\t\texpanded={ false }\n\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination\"\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-previous\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'First page' ) }\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>«</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage - 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === 1 }\n\t\t\t\t\t\t\taria-label={ __( 'Previous page' ) }\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>‹</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %1$s: Current page number, %2$s: Total number of pages.\n\t\t\t\t\t\t\t_x( '%1$s of %2$s', 'paging' ),\n\t\t\t\t\t\t\tcurrentPage,\n\t\t\t\t\t\t\tnumPages\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-patterns__grid-pagination-next\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( currentPage + 1 ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Next page' ) }\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>›</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => changePage( numPages ) }\n\t\t\t\t\t\t\tdisabled={ currentPage === numPages }\n\t\t\t\t\t\t\taria-label={ __( 'Last page' ) }\n\t\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span>»</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,EAC1BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAErD,eAAe,SAASC,UAAUA,CAAE;EACnCC,WAAW;EACXC,QAAQ;EACRC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,OACCC,aAAA,CAACf,MAAM;IAACgB,SAAS,EAAC;EAAgD,GACjED,aAAA,CAACX,IAAI;IAACa,OAAO,EAAC;EAAO;EAEnB;EACAR,OAAO;EACN;EACAD,EAAE,CAAE,SAAS,EAAE,UAAU,EAAEM,UAAW,CAAC,EACvCA,UACD,CAEI,CAAC,EAELF,QAAQ,GAAG,CAAC,IACbG,aAAA,CAACb,MAAM;IACNgB,QAAQ,EAAG,KAAO;IAClBC,OAAO,EAAG,CAAG;IACbC,OAAO,EAAC,YAAY;IACpBJ,SAAS,EAAC;EAAwC,GAElDD,aAAA,CAACb,MAAM;IACNgB,QAAQ,EAAG,KAAO;IAClBC,OAAO,EAAG,CAAG;IACbH,SAAS,EAAC;EAAiD,GAE3DD,aAAA,CAACV,MAAM;IACNY,OAAO,EAAC,UAAU;IAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAE,CAAE,CAAG;IACjCS,QAAQ,EAAGX,WAAW,KAAK,CAAG;IAC9B,cAAaL,EAAE,CAAE,YAAa,CAAG;IACjCiB,yBAAyB;EAAA,GAEzBR,aAAA,eAAM,MAAO,CACN,CAAC,EACTA,aAAA,CAACV,MAAM;IACNY,OAAO,EAAC,UAAU;IAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAEF,WAAW,GAAG,CAAE,CAAG;IAC/CW,QAAQ,EAAGX,WAAW,KAAK,CAAG;IAC9B,cAAaL,EAAE,CAAE,eAAgB,CAAG;IACpCiB,yBAAyB;EAAA,GAEzBR,aAAA,eAAM,QAAO,CACN,CACD,CAAC,EACTA,aAAA,CAACX,IAAI;IAACa,OAAO,EAAC;EAAO,GAClBR,OAAO;EACR;EACAF,EAAE,CAAE,cAAc,EAAE,QAAS,CAAC,EAC9BI,WAAW,EACXC,QACD,CACK,CAAC,EACPG,aAAA,CAACb,MAAM;IACNgB,QAAQ,EAAG,KAAO;IAClBC,OAAO,EAAG,CAAG;IACbH,SAAS,EAAC;EAA6C,GAEvDD,aAAA,CAACV,MAAM;IACNY,OAAO,EAAC,UAAU;IAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAEF,WAAW,GAAG,CAAE,CAAG;IAC/CW,QAAQ,EAAGX,WAAW,KAAKC,QAAU;IACrC,cAAaN,EAAE,CAAE,WAAY,CAAG;IAChCiB,yBAAyB;EAAA,GAEzBR,aAAA,eAAM,QAAO,CACN,CAAC,EACTA,aAAA,CAACV,MAAM;IACNY,OAAO,EAAC,UAAU;IAClBI,OAAO,EAAGA,CAAA,KAAMR,UAAU,CAAED,QAAS,CAAG;IACxCU,QAAQ,EAAGX,WAAW,KAAKC,QAAU;IACrC,cAAaN,EAAE,CAAE,WAAY,CAAG;IAChCkB,IAAI,EAAC,SAAS;IACdD,yBAAyB;EAAA,GAEzBR,aAAA,eAAM,MAAO,CACN,CACD,CACD,CAEF,CAAC;AAEX"}
@@ -400,9 +400,14 @@ export default function useListViewDropZone({
400
400
  const ref = useDropZone({
401
401
  dropZoneElement,
402
402
  onDrop(event) {
403
+ throttled.cancel();
403
404
  if (target) {
404
405
  onBlockDrop(event);
405
406
  }
407
+ // Use `undefined` value to indicate that the drag has concluded.
408
+ // This allows styling rules that are active only when a user is
409
+ // dragging to be removed.
410
+ setTarget(undefined);
406
411
  },
407
412
  onDragLeave() {
408
413
  throttled.cancel();
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useState","useCallback","useEffect","useThrottle","__experimentalUseDropZone","useDropZone","usePrevious","isRTL","getDistanceToNearestEdge","isPointContainedByRect","useOnBlockDrop","store","blockEditorStore","NESTING_LEVEL_INDENTATION","isUpGesture","point","rect","nestingLevel","rtl","blockIndentPosition","right","left","x","getDesiredRelativeParentLevel","distanceBetweenPointAndBlockIndentPosition","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","isNestingHorizontalGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","isCursorWithinBlock","undefined","indexOf","previousBlockData","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","newBlockIndex","blockIndex","dropPosition","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","canInsertDraggedBlocksAsSibling","offset","EXPAND_THROTTLE_OPTIONS","leading","trailing","useListViewDropZone","dropZoneElement","expandedState","setExpandedState","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","target","setTarget","targetRootClientId","targetBlockIndex","onBlockDrop","previousRootClientId","maybeExpandBlock","_expandedState","_target","type","clientIds","throttledMaybeExpandBlock","cancel","draggedBlockClientIds","throttled","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","classList","contains","parseInt","getAttribute","newTarget","ref","onDrop","onDragLeave","onDragOver","onDragEnd"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback, useEffect } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block (or bottom right in RTL languages), then it is an upward gesture.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel(\n\tpoint,\n\trect,\n\tnestingLevel = 1,\n\trtl = false\n) {\n\t// In RTL languages, the block indent position is from the right edge of the block.\n\t// In LTR languages, the block indent position is from the left edge of the block.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst distanceBetweenPointAndBlockIndentPosition = rtl\n\t\t? blockIndentPosition - point.x\n\t\t: point.x - blockIndentPosition;\n\n\tconst desiredParentLevel = Math.round(\n\t\tdistanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION\n\t);\n\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst isNestingHorizontalGesture = rtl\n\t\t? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION\n\t\t: point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;\n\n\treturn isNestingHorizontalGesture && point.y < rect.bottom;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position, rtl = false ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tclientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture(\n\t\t\tposition,\n\t\t\tcandidateRect,\n\t\t\tcandidateBlockParents.length,\n\t\t\trtl\n\t\t)\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n// Throttle options need to be defined outside of the hook to avoid\n// re-creating the object on every render. This is due to a limitation\n// of the `useThrottle` hook, where the options object is included\n// in the dependency array for memoization.\nconst EXPAND_THROTTLE_OPTIONS = {\n\tleading: false, // Don't call the function immediately on the first call.\n\ttrailing: true, // Do call the function on the last call.\n};\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.\n * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( {\n\tdropZoneElement,\n\texpandedState,\n\tsetExpandedState,\n} ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst rtl = isRTL();\n\n\tconst previousRootClientId = usePrevious( targetRootClientId );\n\n\tconst maybeExpandBlock = useCallback(\n\t\t( _expandedState, _target ) => {\n\t\t\t// If the user is attempting to drop a block inside a collapsed block,\n\t\t\t// that is, using a nesting gesture flagged by 'inside' dropPosition,\n\t\t\t// expand the block within the list view, if it isn't already.\n\t\t\tconst { rootClientId } = _target || {};\n\t\t\tif ( ! rootClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\t_target?.dropPosition === 'inside' &&\n\t\t\t\t! _expandedState[ rootClientId ]\n\t\t\t) {\n\t\t\t\tsetExpandedState( {\n\t\t\t\t\ttype: 'expand',\n\t\t\t\t\tclientIds: [ rootClientId ],\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\n\t// Throttle the maybeExpandBlock function to avoid expanding the block\n\t// too quickly when the user is dragging over the block. This is to\n\t// avoid expanding the block when the user is just passing over it.\n\tconst throttledMaybeExpandBlock = useThrottle(\n\t\tmaybeExpandBlock,\n\t\t500,\n\t\tEXPAND_THROTTLE_OPTIONS\n\t);\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\ttarget?.dropPosition !== 'inside' ||\n\t\t\tpreviousRootClientId !== target?.rootClientId\n\t\t) {\n\t\t\tthrottledMaybeExpandBlock.cancel();\n\t\t\treturn;\n\t\t}\n\t\tthrottledMaybeExpandBlock( expandedState, target );\n\t}, [\n\t\texpandedState,\n\t\tpreviousRootClientId,\n\t\ttarget,\n\t\tthrottledMaybeExpandBlock,\n\t] );\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\t\t\t\t\tconst isDraggedBlock =\n\t\t\t\t\t\tblockElement.classList.contains( 'is-dragging' );\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag ? isDraggedBlock : false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget(\n\t\t\t\t\tblocksData,\n\t\t\t\t\tposition,\n\t\t\t\t\trtl\n\t\t\t\t);\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\n\t\t\t\tcanInsertBlocks,\n\t\t\t\tdraggedBlockClientIds,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\trtl,\n\t\t\t]\n\t\t),\n\t\t50\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop( event ) {\n\t\t\tif ( target ) {\n\t\t\t\tonBlockDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `null` value to indicate that the drop target is not valid,\n\t\t\t// but that the drag is still active. This allows for styling rules\n\t\t\t// that are active only when a user drags outside of the list view.\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `undefined` value to indicate that the drag has concluded.\n\t\t\t// This allows styling rules that are active only when a user is\n\t\t\t// dragging to be removed.\n\t\t\tsetTarget( undefined );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"],"mappings":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C;IAEH,MAAMwF,SAAS,GAAG7E,qBAAqB,CACtCjB,UAAU,EACVkB,QAAQ,EACR/B,GACD,CAAC;IAED,IAAK2G,SAAS,EAAG;MAChBhC,SAAS,CAAEgC,SAAU,CAAC;IACvB;EACD,CAAC,EACD,CACClC,eAAe,EACfc,qBAAqB,EACrBhB,aAAa,EACbD,aAAa,EACbD,oBAAoB,EACpBrE,GAAG,CAEL,CAAC,EACD,EACD,CAAC;EAED,MAAM4G,GAAG,GAAGzH,WAAW,CAAE;IACxB+E,eAAe;IACf2C,MAAMA,CAAEpB,KAAK,EAAG;MACf,IAAKf,MAAM,EAAG;QACbI,WAAW,CAAEW,KAAM,CAAC;MACrB;IACD,CAAC;IACDqB,WAAWA,CAAA,EAAG;MACbtB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAX,SAAS,CAAE,IAAK,CAAC;IAClB,CAAC;IACDoC,UAAUA,CAAEtB,KAAK,EAAG;MACnB;MACA;MACA;MACAD,SAAS,CAAEC,KAAK,EAAEA,KAAK,CAACC,aAAc,CAAC;IACxC,CAAC;IACDsB,SAASA,CAAA,EAAG;MACXxB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAX,SAAS,CAAEhC,SAAU,CAAC;IACvB;EACD,CAAE,CAAC;EAEH,OAAO;IAAEiE,GAAG;IAAElC;EAAO,CAAC;AACvB"}
1
+ {"version":3,"names":["useSelect","useState","useCallback","useEffect","useThrottle","__experimentalUseDropZone","useDropZone","usePrevious","isRTL","getDistanceToNearestEdge","isPointContainedByRect","useOnBlockDrop","store","blockEditorStore","NESTING_LEVEL_INDENTATION","isUpGesture","point","rect","nestingLevel","rtl","blockIndentPosition","right","left","x","getDesiredRelativeParentLevel","distanceBetweenPointAndBlockIndentPosition","desiredParentLevel","Math","round","abs","getCandidateBlockParents","candidateBlockData","blocksData","candidateBlockParents","currentBlockData","push","find","blockData","clientId","rootClientId","getNextNonDraggedBlock","index","nextBlockData","isDraggedBlock","isNestingGesture","isNestingHorizontalGesture","y","bottom","ALLOWED_DROP_EDGES","getListViewDropTarget","position","candidateEdge","candidateDistance","candidateRect","candidateBlockIndex","i","length","element","getBoundingClientRect","distance","edge","isCursorWithinBlock","undefined","indexOf","previousBlockData","isDraggingBelow","canInsertDraggedBlocksAsChild","innerBlockCount","isExpanded","newBlockIndex","blockIndex","dropPosition","nextBlock","currentLevel","nextLevel","desiredRelativeLevel","targetParentIndex","max","min","canInsertDraggedBlocksAsSibling","offset","EXPAND_THROTTLE_OPTIONS","leading","trailing","useListViewDropZone","dropZoneElement","expandedState","setExpandedState","getBlockRootClientId","getBlockIndex","getBlockCount","getDraggedBlockClientIds","canInsertBlocks","target","setTarget","targetRootClientId","targetBlockIndex","onBlockDrop","previousRootClientId","maybeExpandBlock","_expandedState","_target","type","clientIds","throttledMaybeExpandBlock","cancel","draggedBlockClientIds","throttled","event","currentTarget","clientX","clientY","isBlockDrag","blockElements","Array","from","querySelectorAll","map","blockElement","dataset","block","expanded","classList","contains","parseInt","getAttribute","newTarget","ref","onDrop","onDragLeave","onDragOver","onDragEnd"],"sources":["@wordpress/block-editor/src/components/list-view/use-list-view-drop-zone.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useCallback, useEffect } from '@wordpress/element';\nimport {\n\tuseThrottle,\n\t__experimentalUseDropZone as useDropZone,\n\tusePrevious,\n} from '@wordpress/compose';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetDistanceToNearestEdge,\n\tisPointContainedByRect,\n} from '../../utils/math';\nimport useOnBlockDrop from '../use-on-block-drop';\nimport { store as blockEditorStore } from '../../store';\n\n/** @typedef {import('../../utils/math').WPPoint} WPPoint */\n\n/**\n * The type of a drag event.\n *\n * @typedef {'default'|'file'|'html'} WPDragEventType\n */\n\n/**\n * An object representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {Object} WPListViewDropZoneBlock\n * @property {string} clientId The client id for the block.\n * @property {string} rootClientId The root client id for the block.\n * @property {number} blockIndex The block's index.\n * @property {Element} element The DOM element representing the block.\n * @property {number} innerBlockCount The number of inner blocks the block has.\n * @property {boolean} isDraggedBlock Whether the block is currently being dragged.\n * @property {boolean} isExpanded Whether the block is expanded in the UI.\n * @property {boolean} canInsertDraggedBlocksAsSibling Whether the dragged block can be a sibling of this block.\n * @property {boolean} canInsertDraggedBlocksAsChild Whether the dragged block can be a child of this block.\n */\n\n/**\n * An array representing data for blocks in the DOM used by drag and drop.\n *\n * @typedef {WPListViewDropZoneBlock[]} WPListViewDropZoneBlocks\n */\n\n/**\n * An object containing details of a drop target.\n *\n * @typedef {Object} WPListViewDropZoneTarget\n * @property {string} blockIndex The insertion index.\n * @property {string} rootClientId The root client id for the block.\n * @property {string|undefined} clientId The client id for the block.\n * @property {'top'|'bottom'|'inside'} dropPosition The position relative to the block that the user is dropping to.\n * 'inside' refers to nesting as an inner block.\n */\n\n// When the indentation level, the corresponding left margin in `style.scss`\n// must be updated as well to ensure the drop zone is aligned with the indentation.\nexport const NESTING_LEVEL_INDENTATION = 28;\n\n/**\n * Determines whether the user is positioning the dragged block to be\n * moved up to a parent level.\n *\n * Determined based on nesting level indentation of the current block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {boolean} Whether the gesture is an upward gesture.\n */\nfunction isUpGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\t// If the block is nested, and the user is dragging to the bottom\n\t// left of the block (or bottom right in RTL languages), then it is an upward gesture.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\treturn rtl ? point.x > blockIndentPosition : point.x < blockIndentPosition;\n}\n\n/**\n * Returns how many nesting levels up the user is attempting to drag to.\n *\n * The relative parent level is calculated based on how far\n * the cursor is from the provided nesting level (e.g. of a candidate block\n * that the user is hovering over). The nesting level is considered \"desired\"\n * because it is not guaranteed that the user will be able to drag to the desired level.\n *\n * The returned integer can be used to access an ascending array\n * of parent blocks, where the first item is the block the user\n * is hovering over, and the last item is the root block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n * @return {number} The desired relative parent level.\n */\nfunction getDesiredRelativeParentLevel(\n\tpoint,\n\trect,\n\tnestingLevel = 1,\n\trtl = false\n) {\n\t// In RTL languages, the block indent position is from the right edge of the block.\n\t// In LTR languages, the block indent position is from the left edge of the block.\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst distanceBetweenPointAndBlockIndentPosition = rtl\n\t\t? blockIndentPosition - point.x\n\t\t: point.x - blockIndentPosition;\n\n\tconst desiredParentLevel = Math.round(\n\t\tdistanceBetweenPointAndBlockIndentPosition / NESTING_LEVEL_INDENTATION\n\t);\n\n\treturn Math.abs( desiredParentLevel );\n}\n\n/**\n * Returns an array of the parent blocks of the block the user is dropping to.\n *\n * @param {WPListViewDropZoneBlock} candidateBlockData The block the user is dropping to.\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @return {WPListViewDropZoneBlocks} An array of block parents, including the block the user is dropping to.\n */\nfunction getCandidateBlockParents( candidateBlockData, blocksData ) {\n\tconst candidateBlockParents = [];\n\tlet currentBlockData = candidateBlockData;\n\n\twhile ( currentBlockData ) {\n\t\tcandidateBlockParents.push( { ...currentBlockData } );\n\t\tcurrentBlockData = blocksData.find(\n\t\t\t( blockData ) =>\n\t\t\t\tblockData.clientId === currentBlockData.rootClientId\n\t\t);\n\t}\n\n\treturn candidateBlockParents;\n}\n\n/**\n * Given a list of blocks data and a block index, return the next non-dragged\n * block. This is used to determine the block that the user is dropping to,\n * while ignoring the dragged block.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {number} index The index to begin searching from.\n * @return {WPListViewDropZoneBlock | undefined} The next non-dragged block.\n */\nfunction getNextNonDraggedBlock( blocksData, index ) {\n\tconst nextBlockData = blocksData[ index + 1 ];\n\tif ( nextBlockData && nextBlockData.isDraggedBlock ) {\n\t\treturn getNextNonDraggedBlock( blocksData, index + 1 );\n\t}\n\n\treturn nextBlockData;\n}\n\n/**\n * Determines whether the user positioning the dragged block to nest as an\n * inner block.\n *\n * Determined based on nesting level indentation of the current block, plus\n * the indentation of the next level of nesting. The vertical position of the\n * cursor must also be within the block.\n *\n * @param {WPPoint} point The point representing the cursor position when dragging.\n * @param {DOMRect} rect The rectangle.\n * @param {number} nestingLevel The nesting level of the block.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n */\nfunction isNestingGesture( point, rect, nestingLevel = 1, rtl = false ) {\n\tconst blockIndentPosition = rtl\n\t\t? rect.right - nestingLevel * NESTING_LEVEL_INDENTATION\n\t\t: rect.left + nestingLevel * NESTING_LEVEL_INDENTATION;\n\n\tconst isNestingHorizontalGesture = rtl\n\t\t? point.x < blockIndentPosition - NESTING_LEVEL_INDENTATION\n\t\t: point.x > blockIndentPosition + NESTING_LEVEL_INDENTATION;\n\n\treturn isNestingHorizontalGesture && point.y < rect.bottom;\n}\n\n// Block navigation is always a vertical list, so only allow dropping\n// to the above or below a block.\nconst ALLOWED_DROP_EDGES = [ 'top', 'bottom' ];\n\n/**\n * Given blocks data and the cursor position, compute the drop target.\n *\n * @param {WPListViewDropZoneBlocks} blocksData Data about the blocks in list view.\n * @param {WPPoint} position The point representing the cursor position when dragging.\n * @param {boolean} rtl Whether the editor is in RTL mode.\n *\n * @return {WPListViewDropZoneTarget | undefined} An object containing data about the drop target.\n */\nexport function getListViewDropTarget( blocksData, position, rtl = false ) {\n\tlet candidateEdge;\n\tlet candidateBlockData;\n\tlet candidateDistance;\n\tlet candidateRect;\n\tlet candidateBlockIndex;\n\n\tfor ( let i = 0; i < blocksData.length; i++ ) {\n\t\tconst blockData = blocksData[ i ];\n\t\tif ( blockData.isDraggedBlock ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst rect = blockData.element.getBoundingClientRect();\n\t\tconst [ distance, edge ] = getDistanceToNearestEdge(\n\t\t\tposition,\n\t\t\trect,\n\t\t\tALLOWED_DROP_EDGES\n\t\t);\n\n\t\tconst isCursorWithinBlock = isPointContainedByRect( position, rect );\n\t\tif (\n\t\t\tcandidateDistance === undefined ||\n\t\t\tdistance < candidateDistance ||\n\t\t\tisCursorWithinBlock\n\t\t) {\n\t\t\tcandidateDistance = distance;\n\n\t\t\tconst index = blocksData.indexOf( blockData );\n\t\t\tconst previousBlockData = blocksData[ index - 1 ];\n\n\t\t\t// If dragging near the top of a block and the preceding block\n\t\t\t// is at the same level, use the preceding block as the candidate\n\t\t\t// instead, as later it makes determining a nesting drop easier.\n\t\t\tif (\n\t\t\t\tedge === 'top' &&\n\t\t\t\tpreviousBlockData &&\n\t\t\t\tpreviousBlockData.rootClientId === blockData.rootClientId &&\n\t\t\t\t! previousBlockData.isDraggedBlock\n\t\t\t) {\n\t\t\t\tcandidateBlockData = previousBlockData;\n\t\t\t\tcandidateEdge = 'bottom';\n\t\t\t\tcandidateRect =\n\t\t\t\t\tpreviousBlockData.element.getBoundingClientRect();\n\t\t\t\tcandidateBlockIndex = index - 1;\n\t\t\t} else {\n\t\t\t\tcandidateBlockData = blockData;\n\t\t\t\tcandidateEdge = edge;\n\t\t\t\tcandidateRect = rect;\n\t\t\t\tcandidateBlockIndex = index;\n\t\t\t}\n\n\t\t\t// If the mouse position is within the block, break early\n\t\t\t// as the user would intend to drop either before or after\n\t\t\t// this block.\n\t\t\t//\n\t\t\t// This solves an issue where some rows in the list view\n\t\t\t// tree overlap slightly due to sub-pixel rendering.\n\t\t\tif ( isCursorWithinBlock ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( ! candidateBlockData ) {\n\t\treturn;\n\t}\n\n\tconst candidateBlockParents = getCandidateBlockParents(\n\t\tcandidateBlockData,\n\t\tblocksData\n\t);\n\n\tconst isDraggingBelow = candidateEdge === 'bottom';\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to nest the block as a child.\n\t// If the block already has inner blocks, and is expanded, this should be treated\n\t// as nesting since the next block in the tree will be the first child.\n\t// However, if the block is collapsed, dragging beneath the block should\n\t// still be allowed, as the next visible block in the tree will be a sibling.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.canInsertDraggedBlocksAsChild &&\n\t\t( ( candidateBlockData.innerBlockCount > 0 &&\n\t\t\tcandidateBlockData.isExpanded ) ||\n\t\t\tisNestingGesture(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t) )\n\t) {\n\t\t// If the block is expanded, insert the block as the first child.\n\t\t// Otherwise, for collapsed blocks, insert the block as the last child.\n\t\tconst newBlockIndex = candidateBlockData.isExpanded\n\t\t\t? 0\n\t\t\t: candidateBlockData.innerBlockCount || 0;\n\n\t\treturn {\n\t\t\trootClientId: candidateBlockData.clientId,\n\t\t\tclientId: candidateBlockData.clientId,\n\t\t\tblockIndex: newBlockIndex,\n\t\t\tdropPosition: 'inside',\n\t\t};\n\t}\n\n\t// If the user is dragging towards the bottom of the block check whether\n\t// they might be trying to move the block to be at a parent level.\n\tif (\n\t\tisDraggingBelow &&\n\t\tcandidateBlockData.rootClientId &&\n\t\tisUpGesture(\n\t\t\tposition,\n\t\t\tcandidateRect,\n\t\t\tcandidateBlockParents.length,\n\t\t\trtl\n\t\t)\n\t) {\n\t\tconst nextBlock = getNextNonDraggedBlock(\n\t\t\tblocksData,\n\t\t\tcandidateBlockIndex\n\t\t);\n\t\tconst currentLevel = candidateBlockData.nestingLevel;\n\t\tconst nextLevel = nextBlock ? nextBlock.nestingLevel : 1;\n\n\t\tif ( currentLevel && nextLevel ) {\n\t\t\t// Determine the desired relative level of the block to be dropped.\n\t\t\tconst desiredRelativeLevel = getDesiredRelativeParentLevel(\n\t\t\t\tposition,\n\t\t\t\tcandidateRect,\n\t\t\t\tcandidateBlockParents.length,\n\t\t\t\trtl\n\t\t\t);\n\n\t\t\tconst targetParentIndex = Math.max(\n\t\t\t\tMath.min( desiredRelativeLevel, currentLevel - nextLevel ),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tif ( candidateBlockParents[ targetParentIndex ] ) {\n\t\t\t\t// Default to the block index of the candidate block.\n\t\t\t\tlet newBlockIndex = candidateBlockData.blockIndex;\n\n\t\t\t\t// If the next block is at the same level, use that as the default\n\t\t\t\t// block index. This ensures that the block is dropped in the correct\n\t\t\t\t// position when dragging to the bottom of a block.\n\t\t\t\tif (\n\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].nestingLevel ===\n\t\t\t\t\tnextBlock?.nestingLevel\n\t\t\t\t) {\n\t\t\t\t\tnewBlockIndex = nextBlock?.blockIndex;\n\t\t\t\t} else {\n\t\t\t\t\t// Otherwise, search from the current block index back\n\t\t\t\t\t// to find the last block index within the same target parent.\n\t\t\t\t\tfor ( let i = candidateBlockIndex; i >= 0; i-- ) {\n\t\t\t\t\t\tconst blockData = blocksData[ i ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tblockData.rootClientId ===\n\t\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ]\n\t\t\t\t\t\t\t\t.rootClientId\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewBlockIndex = blockData.blockIndex + 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\trootClientId:\n\t\t\t\t\t\tcandidateBlockParents[ targetParentIndex ].rootClientId,\n\t\t\t\t\tclientId: candidateBlockData.clientId,\n\t\t\t\t\tblockIndex: newBlockIndex,\n\t\t\t\t\tdropPosition: candidateEdge,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\t// If dropping as a sibling, but block cannot be inserted in\n\t// this context, return early.\n\tif ( ! candidateBlockData.canInsertDraggedBlocksAsSibling ) {\n\t\treturn;\n\t}\n\n\tconst offset = isDraggingBelow ? 1 : 0;\n\treturn {\n\t\trootClientId: candidateBlockData.rootClientId,\n\t\tclientId: candidateBlockData.clientId,\n\t\tblockIndex: candidateBlockData.blockIndex + offset,\n\t\tdropPosition: candidateEdge,\n\t};\n}\n\n// Throttle options need to be defined outside of the hook to avoid\n// re-creating the object on every render. This is due to a limitation\n// of the `useThrottle` hook, where the options object is included\n// in the dependency array for memoization.\nconst EXPAND_THROTTLE_OPTIONS = {\n\tleading: false, // Don't call the function immediately on the first call.\n\ttrailing: true, // Do call the function on the last call.\n};\n\n/**\n * A react hook for implementing a drop zone in list view.\n *\n * @param {Object} props Named parameters.\n * @param {?HTMLElement} [props.dropZoneElement] Optional element to be used as the drop zone.\n * @param {Object} [props.expandedState] The expanded state of the blocks in the list view.\n * @param {Function} [props.setExpandedState] Function to set the expanded state of a list of block clientIds.\n *\n * @return {WPListViewDropZoneTarget} The drop target.\n */\nexport default function useListViewDropZone( {\n\tdropZoneElement,\n\texpandedState,\n\tsetExpandedState,\n} ) {\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockIndex,\n\t\tgetBlockCount,\n\t\tgetDraggedBlockClientIds,\n\t\tcanInsertBlocks,\n\t} = useSelect( blockEditorStore );\n\tconst [ target, setTarget ] = useState();\n\tconst { rootClientId: targetRootClientId, blockIndex: targetBlockIndex } =\n\t\ttarget || {};\n\n\tconst onBlockDrop = useOnBlockDrop( targetRootClientId, targetBlockIndex );\n\n\tconst rtl = isRTL();\n\n\tconst previousRootClientId = usePrevious( targetRootClientId );\n\n\tconst maybeExpandBlock = useCallback(\n\t\t( _expandedState, _target ) => {\n\t\t\t// If the user is attempting to drop a block inside a collapsed block,\n\t\t\t// that is, using a nesting gesture flagged by 'inside' dropPosition,\n\t\t\t// expand the block within the list view, if it isn't already.\n\t\t\tconst { rootClientId } = _target || {};\n\t\t\tif ( ! rootClientId ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (\n\t\t\t\t_target?.dropPosition === 'inside' &&\n\t\t\t\t! _expandedState[ rootClientId ]\n\t\t\t) {\n\t\t\t\tsetExpandedState( {\n\t\t\t\t\ttype: 'expand',\n\t\t\t\t\tclientIds: [ rootClientId ],\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ setExpandedState ]\n\t);\n\n\t// Throttle the maybeExpandBlock function to avoid expanding the block\n\t// too quickly when the user is dragging over the block. This is to\n\t// avoid expanding the block when the user is just passing over it.\n\tconst throttledMaybeExpandBlock = useThrottle(\n\t\tmaybeExpandBlock,\n\t\t500,\n\t\tEXPAND_THROTTLE_OPTIONS\n\t);\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\ttarget?.dropPosition !== 'inside' ||\n\t\t\tpreviousRootClientId !== target?.rootClientId\n\t\t) {\n\t\t\tthrottledMaybeExpandBlock.cancel();\n\t\t\treturn;\n\t\t}\n\t\tthrottledMaybeExpandBlock( expandedState, target );\n\t}, [\n\t\texpandedState,\n\t\tpreviousRootClientId,\n\t\ttarget,\n\t\tthrottledMaybeExpandBlock,\n\t] );\n\n\tconst draggedBlockClientIds = getDraggedBlockClientIds();\n\tconst throttled = useThrottle(\n\t\tuseCallback(\n\t\t\t( event, currentTarget ) => {\n\t\t\t\tconst position = { x: event.clientX, y: event.clientY };\n\t\t\t\tconst isBlockDrag = !! draggedBlockClientIds?.length;\n\n\t\t\t\tconst blockElements = Array.from(\n\t\t\t\t\tcurrentTarget.querySelectorAll( '[data-block]' )\n\t\t\t\t);\n\n\t\t\t\tconst blocksData = blockElements.map( ( blockElement ) => {\n\t\t\t\t\tconst clientId = blockElement.dataset.block;\n\t\t\t\t\tconst isExpanded = blockElement.dataset.expanded === 'true';\n\t\t\t\t\tconst isDraggedBlock =\n\t\t\t\t\t\tblockElement.classList.contains( 'is-dragging' );\n\n\t\t\t\t\t// Get nesting level from `aria-level` attribute because Firefox does not support `element.ariaLevel`.\n\t\t\t\t\tconst nestingLevel = parseInt(\n\t\t\t\t\t\tblockElement.getAttribute( 'aria-level' ),\n\t\t\t\t\t\t10\n\t\t\t\t\t);\n\t\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tisExpanded,\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tblockIndex: getBlockIndex( clientId ),\n\t\t\t\t\t\telement: blockElement,\n\t\t\t\t\t\tnestingLevel: nestingLevel || undefined,\n\t\t\t\t\t\tisDraggedBlock: isBlockDrag ? isDraggedBlock : false,\n\t\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t\tcanInsertDraggedBlocksAsSibling: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks(\n\t\t\t\t\t\t\t\t\tdraggedBlockClientIds,\n\t\t\t\t\t\t\t\t\trootClientId\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t\tcanInsertDraggedBlocksAsChild: isBlockDrag\n\t\t\t\t\t\t\t? canInsertBlocks( draggedBlockClientIds, clientId )\n\t\t\t\t\t\t\t: true,\n\t\t\t\t\t};\n\t\t\t\t} );\n\n\t\t\t\tconst newTarget = getListViewDropTarget(\n\t\t\t\t\tblocksData,\n\t\t\t\t\tposition,\n\t\t\t\t\trtl\n\t\t\t\t);\n\n\t\t\t\tif ( newTarget ) {\n\t\t\t\t\tsetTarget( newTarget );\n\t\t\t\t}\n\t\t\t},\n\t\t\t[\n\t\t\t\tcanInsertBlocks,\n\t\t\t\tdraggedBlockClientIds,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockIndex,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\trtl,\n\t\t\t]\n\t\t),\n\t\t50\n\t);\n\n\tconst ref = useDropZone( {\n\t\tdropZoneElement,\n\t\tonDrop( event ) {\n\t\t\tthrottled.cancel();\n\t\t\tif ( target ) {\n\t\t\t\tonBlockDrop( event );\n\t\t\t}\n\t\t\t// Use `undefined` value to indicate that the drag has concluded.\n\t\t\t// This allows styling rules that are active only when a user is\n\t\t\t// dragging to be removed.\n\t\t\tsetTarget( undefined );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `null` value to indicate that the drop target is not valid,\n\t\t\t// but that the drag is still active. This allows for styling rules\n\t\t\t// that are active only when a user drags outside of the list view.\n\t\t\tsetTarget( null );\n\t\t},\n\t\tonDragOver( event ) {\n\t\t\t// `currentTarget` is only available while the event is being\n\t\t\t// handled, so get it now and pass it to the thottled function.\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n\t\t\tthrottled( event, event.currentTarget );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tthrottled.cancel();\n\t\t\t// Use `undefined` value to indicate that the drag has concluded.\n\t\t\t// This allows styling rules that are active only when a user is\n\t\t\t// dragging to be removed.\n\t\t\tsetTarget( undefined );\n\t\t},\n\t} );\n\n\treturn { ref, target };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,QAAQ,oBAAoB;AACrE,SACCC,WAAW,EACXC,yBAAyB,IAAIC,WAAW,EACxCC,WAAW,QACL,oBAAoB;AAC3B,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SACCC,wBAAwB,EACxBC,sBAAsB,QAChB,kBAAkB;AACzB,OAAOC,cAAc,MAAM,sBAAsB;AACjD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;;AAEA;AACA;AACA;AACA;AACA;;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MAClB,IAAKZ,MAAM,EAAG;QACbI,WAAW,CAAEW,KAAM,CAAC;MACrB;MACA;MACA;MACA;MACAd,SAAS,CAAEhC,SAAU,CAAC;IACvB,CAAC;IACDmE,WAAWA,CAAA,EAAG;MACbtB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAX,SAAS,CAAE,IAAK,CAAC;IAClB,CAAC;IACDoC,UAAUA,CAAEtB,KAAK,EAAG;MACnB;MACA;MACA;MACAD,SAAS,CAAEC,KAAK,EAAEA,KAAK,CAACC,aAAc,CAAC;IACxC,CAAC;IACDsB,SAASA,CAAA,EAAG;MACXxB,SAAS,CAACF,MAAM,CAAC,CAAC;MAClB;MACA;MACA;MACAX,SAAS,CAAEhC,SAAU,CAAC;IACvB;EACD,CAAE,CAAC;EAEH,OAAO;IAAEiE,GAAG;IAAElC;EAAO,CAAC;AACvB"}
@@ -263,7 +263,8 @@ export function addAttribute(settings) {
263
263
  }
264
264
  function BlockWithLayoutStyles({
265
265
  block: BlockListBlock,
266
- props
266
+ props,
267
+ layoutClasses
267
268
  }) {
268
269
  const {
269
270
  name,
@@ -280,7 +281,6 @@ function BlockWithLayoutStyles({
280
281
  ...layout,
281
282
  type: 'constrained'
282
283
  } : layout || defaultBlockLayout || {};
283
- const layoutClasses = useLayoutClasses(attributes, name);
284
284
  const {
285
285
  kebabCase
286
286
  } = unlock(componentsPrivateApis);
@@ -322,7 +322,12 @@ function BlockWithLayoutStyles({
322
322
  * @return {Function} Wrapped component.
323
323
  */
324
324
  export const withLayoutStyles = createHigherOrderComponent(BlockListBlock => props => {
325
+ const {
326
+ name,
327
+ attributes
328
+ } = props;
325
329
  const blockSupportsLayout = hasLayoutBlockSupport(props.name);
330
+ const layoutClasses = useLayoutClasses(attributes, name);
326
331
  const shouldRenderLayoutStyles = useSelect(select => {
327
332
  // The callback returns early to avoid block editor subscription.
328
333
  if (!blockSupportsLayout) {
@@ -332,12 +337,14 @@ export const withLayoutStyles = createHigherOrderComponent(BlockListBlock => pro
332
337
  }, [blockSupportsLayout]);
333
338
  if (!shouldRenderLayoutStyles) {
334
339
  return createElement(BlockListBlock, {
335
- ...props
340
+ ...props,
341
+ __unstableLayoutClassNames: blockSupportsLayout ? layoutClasses : undefined
336
342
  });
337
343
  }
338
344
  return createElement(BlockWithLayoutStyles, {
339
345
  block: BlockListBlock,
340
- props: props
346
+ props: props,
347
+ layoutClasses: layoutClasses
341
348
  });
342
349
  }, 'withLayoutStyles');
343
350
  addFilter('blocks.registerBlockType', 'core/layout/addAttribute', addAttribute);
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","privateApis","componentsPrivateApis","__","store","blockEditorStore","InspectorControls","useSettings","getLayoutType","getLayoutTypes","useBlockEditingMode","LAYOUT_DEFINITIONS","useBlockSettings","useStyleOverride","unlock","layoutBlockSupportKey","hasLayoutBlockSupport","blockName","useLayoutClasses","blockAttributes","kebabCase","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","LayoutPanelPure","setAttributes","name","settings","layoutSettings","defaultThemeLayout","themeSupportsLayout","supportsLayout","blockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","createElement","Fragment","title","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","shareWithChildBlocks","edit","attributeKeys","hasSupport","map","key","isPressed","onClick","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","id","layoutClasses","selectorPrefix","layoutClassNames","__unstableLayoutClassNames","withLayoutStyles","blockSupportsLayout","shouldRenderLayoutStyles","disableLayoutStyles"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanelPure( { layout, setAttributes, name: blockName } ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\t// Layout comes from block attributes.\n\tconst [ defaultThemeLayout ] = useSettings( 'layout' );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( { block: BlockListBlock, props } ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\tconst layoutClasses = useLayoutClasses( attributes, name );\n\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }.${ selectorPrefix }${ id }`;\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = classnames(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( props.name );\n\t\tconst shouldRenderLayoutStyles = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn ! select( blockEditorStore ).getSettings()\n\t\t\t\t\t.disableLayoutStyles;\n\t\t\t},\n\t\t\t[ blockSupportsLayout ]\n\t\t);\n\n\t\tif ( ! shouldRenderLayoutStyles ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles block={ BlockListBlock } props={ props } />\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,0BAA0B,EAAEC,aAAa,QAAQ,oBAAoB;AAC9E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,eAAe,EAAEC,eAAe,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,SAAS,EACTC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SAASC,aAAa,EAAEC,cAAc,QAAQ,YAAY;AAC1D,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS;AAC5D,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAMC,qBAAqB,GAAG,QAAQ;AAEtC,SAASC,qBAAqBA,CA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AgB,GAAGrH,UAAU,CAClC;IACC,CAAG,GAAGoH,cAAgB,GAAGF,EAAI,EAAC,GAAI,CAAC,CAAEnD,GAAG,CAAE;EAC3C,CAAC,EACDoD,aACD,CAAC;EAED5F,gBAAgB,CAAE;IAAEwC;EAAI,CAAE,CAAC;EAE3B,OACCyB,aAAA,CAACwB,cAAc;IAAA,GACTC,KAAK;IACVK,0BAA0B,EAAGD;EAAkB,CAC/C,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,gBAAgB,GAAGtH,0BAA0B,CACvD+G,cAAc,IAAQC,KAAK,IAAM;EAClC,MAAMO,mBAAmB,GAAG9F,qBAAqB,CAAEuF,KAAK,CAAC9C,IAAK,CAAC;EAC/D,MAAMsD,wBAAwB,GAAGnH,SAAS,CACvC0B,MAAM,IAAM;IACb;IACA,IAAK,CAAEwF,mBAAmB,EAAG;MAC5B,OAAO,KAAK;IACb;IAEA,OAAO,CAAExF,MAAM,CAAEjB,gBAAiB,CAAC,CAACkB,WAAW,CAAC,CAAC,CAC/CyF,mBAAmB;EACtB,CAAC,EACD,CAAEF,mBAAmB,CACtB,CAAC;EAED,IAAK,CAAEC,wBAAwB,EAAG;IACjC,OAAOjC,aAAA,CAACwB,cAAc;MAAA,GAAMC;IAAK,CAAI,CAAC;EACvC;EAEA,OACCzB,aAAA,CAACsB,qBAAqB;IAACC,KAAK,EAAGC,cAAgB;IAACC,KAAK,EAAGA;EAAO,CAAE,CAAC;AAEpE,CAAC,EACD,kBACD,CAAC;AAED9G,SAAS,CACR,0BAA0B,EAC1B,0BAA0B,EAC1BwG,YACD,CAAC;AACDxG,SAAS,CACR,uBAAuB,EACvB,uCAAuC,EACvCoH,gBACD,CAAC"}
1
+ {"version":3,"names":["classnames","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","privateApis","componentsPrivateApis","__","store","blockEditorStore","InspectorControls","useSettings","getLayoutType","getLayoutTypes","useBlockEditingMode","LAYOUT_DEFINITIONS","useBlockSettings","useStyleOverride","unlock","layoutBlockSupportKey","hasLayoutBlockSupport","blockName","useLayoutClasses","blockAttributes","kebabCase","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","className","baseClassName","splitBlockName","split","fullBlockName","pop","join","compoundClassName","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","LayoutPanelPure","setAttributes","name","settings","layoutSettings","defaultThemeLayout","themeSupportsLayout","supportsLayout","blockEditingMode","layoutBlockSupport","blockSupportAndThemeSettings","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","createElement","Fragment","title","__nextHasNoMarginBottom","label","checked","onChange","help","LayoutTypeSwitcher","inspectorControls","toolBarControls","shareWithChildBlocks","edit","attributeKeys","hasSupport","map","key","isPressed","onClick","addAttribute","_settings$attributes$","attributes","BlockWithLayoutStyles","block","BlockListBlock","props","layoutClasses","id","selectorPrefix","layoutClassNames","__unstableLayoutClassNames","withLayoutStyles","blockSupportsLayout","shouldRenderLayoutStyles","disableLayoutStyles","undefined"],"sources":["@wordpress/block-editor/src/hooks/layout.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport { useSettings } from '../components/use-settings';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { LAYOUT_DEFINITIONS } from '../layouts/definitions';\nimport { useBlockSettings, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\n\nconst layoutBlockSupportKey = 'layout';\n\nfunction hasLayoutBlockSupport( blockName ) {\n\treturn (\n\t\thasBlockSupport( blockName, 'layout' ) ||\n\t\thasBlockSupport( blockName, '__experimentalLayout' )\n\t);\n}\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif ( LAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className ) {\n\t\tconst baseClassName =\n\t\t\tLAYOUT_DEFINITIONS[ usedLayout?.type || 'default' ]?.className;\n\t\tconst splitBlockName = blockName.split( '/' );\n\t\tconst fullBlockName =\n\t\t\tsplitBlockName[ 0 ] === 'core'\n\t\t\t\t? splitBlockName.pop()\n\t\t\t\t: splitBlockName.join( '-' );\n\t\tconst compoundClassName = `wp-block-${ fullBlockName }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanelPure( { layout, setAttributes, name: blockName } ) {\n\tconst settings = useBlockSettings( blockName );\n\t// Block settings come from theme.json under settings.[blockName].\n\tconst { layout: layoutSettings } = settings;\n\t// Layout comes from block attributes.\n\tconst [ defaultThemeLayout ] = useSettings( 'layout' );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\t// Layout block support comes from the block's block.json.\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst blockSupportAndThemeSettings = {\n\t\t...layoutSettings,\n\t\t...layoutBlockSupport,\n\t};\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = blockSupportAndThemeSettings;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ blockSupportAndThemeSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: LayoutPanelPure,\n\tattributeKeys: [ 'layout' ],\n\thasSupport( name ) {\n\t\treturn hasLayoutBlockSupport( name );\n\t},\n};\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasLayoutBlockSupport( settings ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockWithLayoutStyles( {\n\tblock: BlockListBlock,\n\tprops,\n\tlayoutClasses,\n} ) {\n\tconst { name, attributes } = props;\n\tconst id = useInstanceId( BlockListBlock );\n\tconst { layout } = attributes;\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;\n\t// Higher specificity to override defaults from theme.json.\n\tconst selector = `.${ selectorPrefix }${ id }.${ selectorPrefix }${ id }`;\n\tconst [ blockGapSupport ] = useSettings( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t// Get CSS string for the current layout type.\n\t// The CSS and `style` element is only output if it is not empty.\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName: name,\n\t\tselector,\n\t\tlayout: usedLayout,\n\t\tstyle: attributes?.style,\n\t\thasBlockGapSupport,\n\t} );\n\n\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\tconst layoutClassNames = classnames(\n\t\t{\n\t\t\t[ `${ selectorPrefix }${ id }` ]: !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t},\n\t\tlayoutClasses\n\t);\n\n\tuseStyleOverride( { css } );\n\n\treturn (\n\t\t<BlockListBlock\n\t\t\t{ ...props }\n\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t/>\n\t);\n}\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst blockSupportsLayout = hasLayoutBlockSupport( props.name );\n\t\tconst layoutClasses = useLayoutClasses( attributes, name );\n\t\tconst shouldRenderLayoutStyles = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// The callback returns early to avoid block editor subscription.\n\t\t\t\tif ( ! blockSupportsLayout ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn ! select( blockEditorStore ).getSettings()\n\t\t\t\t\t.disableLayoutStyles;\n\t\t\t},\n\t\t\t[ blockSupportsLayout ]\n\t\t);\n\n\t\tif ( ! shouldRenderLayoutStyles ) {\n\t\t\treturn (\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={\n\t\t\t\t\t\tblockSupportsLayout ? layoutClasses : undefined\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BlockWithLayoutStyles\n\t\t\t\tblock={ BlockListBlock }\n\t\t\t\tprops={ props }\n\t\t\t\tlayoutClasses={ layoutClasses }\n\t\t\t/>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,0BAA0B,EAAEC,aAAa,QAAQ,oBAAoB;AAC9E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,eAAe,EAAEC,eAAe,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,MAAM,EACNC,WAAW,EACXC,aAAa,EACbC,SAAS,EACTC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SAASC,aAAa,EAAEC,cAAc,QAAQ,YAAY;AAC1D,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS;AAC5D,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAMC,qBAAqB,GAAG,QAAQ;AAEtC,SAASC,qBAAqBA,CAAEC,SAAS,EAAG;EAC3C,OACCtB,eAAe,CAAEsB,SAAS,EAAE,QAAS,CAAC,IACtCtB,eAAe,CAAEsB,SAAS,EAAE,sBAAuB,CAAC;AAEtD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAAEC,eAAe,GAAG,CAAC,CAAC,EAAEF,SAAS,G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ACA;AACA;AACA;AACA;AACA,OAAO,MAAME,gBAAgB,GAAGtH,0BAA0B,CACvD+G,cAAc,IAAQC,KAAK,IAAM;EAClC,MAAM;IAAE9C,IAAI;IAAE0C;EAAW,CAAC,GAAGI,KAAK;EAClC,MAAMO,mBAAmB,GAAG9F,qBAAqB,CAAEuF,KAAK,CAAC9C,IAAK,CAAC;EAC/D,MAAM+C,aAAa,GAAGtF,gBAAgB,CAAEiF,UAAU,EAAE1C,IAAK,CAAC;EAC1D,MAAMsD,wBAAwB,GAAGnH,SAAS,CACvC0B,MAAM,IAAM;IACb;IACA,IAAK,CAAEwF,mBAAmB,EAAG;MAC5B,OAAO,KAAK;IACb;IAEA,OAAO,CAAExF,MAAM,CAAEjB,gBAAiB,CAAC,CAACkB,WAAW,CAAC,CAAC,CAC/CyF,mBAAmB;EACtB,CAAC,EACD,CAAEF,mBAAmB,CACtB,CAAC;EAED,IAAK,CAAEC,wBAAwB,EAAG;IACjC,OACCjC,aAAA,CAACwB,cAAc;MAAA,GACTC,KAAK;MACVK,0BAA0B,EACzBE,mBAAmB,GAAGN,aAAa,GAAGS;IACtC,CACD,CAAC;EAEJ;EAEA,OACCnC,aAAA,CAACsB,qBAAqB;IACrBC,KAAK,EAAGC,cAAgB;IACxBC,KAAK,EAAGA,KAAO;IACfC,aAAa,EAAGA;EAAe,CAC/B,CAAC;AAEJ,CAAC,EACD,kBACD,CAAC;AAED/G,SAAS,CACR,0BAA0B,EAC1B,0BAA0B,EAC1BwG,YACD,CAAC;AACDxG,SAAS,CACR,uBAAuB,EACvB,uCAAuC,EACvCoH,gBACD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.19.8",
3
+ "version": "12.19.9",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "be077ee679b7b319a1d9eed46a74ffcbc5ad0b93"
90
+ "gitHead": "88cd256155d396c639216515e05346c687a64112"
91
91
  }
@@ -45,6 +45,7 @@ export default function Pagination( {
45
45
  onClick={ () => changePage( 1 ) }
46
46
  disabled={ currentPage === 1 }
47
47
  aria-label={ __( 'First page' ) }
48
+ __experimentalIsFocusable
48
49
  >
49
50
  <span>«</span>
50
51
  </Button>
@@ -53,6 +54,7 @@ export default function Pagination( {
53
54
  onClick={ () => changePage( currentPage - 1 ) }
54
55
  disabled={ currentPage === 1 }
55
56
  aria-label={ __( 'Previous page' ) }
57
+ __experimentalIsFocusable
56
58
  >
57
59
  <span>‹</span>
58
60
  </Button>
@@ -75,6 +77,7 @@ export default function Pagination( {
75
77
  onClick={ () => changePage( currentPage + 1 ) }
76
78
  disabled={ currentPage === numPages }
77
79
  aria-label={ __( 'Next page' ) }
80
+ __experimentalIsFocusable
78
81
  >
79
82
  <span>›</span>
80
83
  </Button>
@@ -84,6 +87,7 @@ export default function Pagination( {
84
87
  disabled={ currentPage === numPages }
85
88
  aria-label={ __( 'Last page' ) }
86
89
  size="default"
90
+ __experimentalIsFocusable
87
91
  >
88
92
  <span>»</span>
89
93
  </Button>
@@ -556,9 +556,14 @@ export default function useListViewDropZone( {
556
556
  const ref = useDropZone( {
557
557
  dropZoneElement,
558
558
  onDrop( event ) {
559
+ throttled.cancel();
559
560
  if ( target ) {
560
561
  onBlockDrop( event );
561
562
  }
563
+ // Use `undefined` value to indicate that the drag has concluded.
564
+ // This allows styling rules that are active only when a user is
565
+ // dragging to be removed.
566
+ setTarget( undefined );
562
567
  },
563
568
  onDragLeave() {
564
569
  throttled.cancel();
@@ -338,7 +338,11 @@ export function addAttribute( settings ) {
338
338
  return settings;
339
339
  }
340
340
 
341
- function BlockWithLayoutStyles( { block: BlockListBlock, props } ) {
341
+ function BlockWithLayoutStyles( {
342
+ block: BlockListBlock,
343
+ props,
344
+ layoutClasses,
345
+ } ) {
342
346
  const { name, attributes } = props;
343
347
  const id = useInstanceId( BlockListBlock );
344
348
  const { layout } = attributes;
@@ -348,7 +352,6 @@ function BlockWithLayoutStyles( { block: BlockListBlock, props } ) {
348
352
  layout?.inherit || layout?.contentSize || layout?.wideSize
349
353
  ? { ...layout, type: 'constrained' }
350
354
  : layout || defaultBlockLayout || {};
351
- const layoutClasses = useLayoutClasses( attributes, name );
352
355
 
353
356
  const { kebabCase } = unlock( componentsPrivateApis );
354
357
  const selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;
@@ -395,7 +398,9 @@ function BlockWithLayoutStyles( { block: BlockListBlock, props } ) {
395
398
  */
396
399
  export const withLayoutStyles = createHigherOrderComponent(
397
400
  ( BlockListBlock ) => ( props ) => {
401
+ const { name, attributes } = props;
398
402
  const blockSupportsLayout = hasLayoutBlockSupport( props.name );
403
+ const layoutClasses = useLayoutClasses( attributes, name );
399
404
  const shouldRenderLayoutStyles = useSelect(
400
405
  ( select ) => {
401
406
  // The callback returns early to avoid block editor subscription.
@@ -410,11 +415,22 @@ export const withLayoutStyles = createHigherOrderComponent(
410
415
  );
411
416
 
412
417
  if ( ! shouldRenderLayoutStyles ) {
413
- return <BlockListBlock { ...props } />;
418
+ return (
419
+ <BlockListBlock
420
+ { ...props }
421
+ __unstableLayoutClassNames={
422
+ blockSupportsLayout ? layoutClasses : undefined
423
+ }
424
+ />
425
+ );
414
426
  }
415
427
 
416
428
  return (
417
- <BlockWithLayoutStyles block={ BlockListBlock } props={ props } />
429
+ <BlockWithLayoutStyles
430
+ block={ BlockListBlock }
431
+ props={ props }
432
+ layoutClasses={ layoutClasses }
433
+ />
418
434
  );
419
435
  },
420
436
  'withLayoutStyles'