@wordpress/block-editor 12.8.0 → 12.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +30 -12
  3. package/build/components/block-controls/slot.js +1 -1
  4. package/build/components/block-controls/slot.js.map +1 -1
  5. package/build/components/block-controls/slot.native.js +1 -1
  6. package/build/components/block-controls/slot.native.js.map +1 -1
  7. package/build/components/block-controls/use-has-block-controls.js +1 -1
  8. package/build/components/block-controls/use-has-block-controls.js.map +1 -1
  9. package/build/components/block-list/block-outline.native.js +4 -3
  10. package/build/components/block-list/block-outline.native.js.map +1 -1
  11. package/build/components/block-list/index.js +4 -3
  12. package/build/components/block-list/index.js.map +1 -1
  13. package/build/components/block-list/use-block-props/index.js +27 -1
  14. package/build/components/block-list/use-block-props/index.js.map +1 -1
  15. package/build/components/block-list/use-block-props/use-nav-mode-exit.js +1 -1
  16. package/build/components/block-list/use-block-props/use-nav-mode-exit.js.map +1 -1
  17. package/build/components/block-lock/menu-item.js +3 -1
  18. package/build/components/block-lock/menu-item.js.map +1 -1
  19. package/build/components/block-lock/toolbar.js +3 -1
  20. package/build/components/block-lock/toolbar.js.map +1 -1
  21. package/build/components/block-popover/inbetween.js +4 -5
  22. package/build/components/block-popover/inbetween.js.map +1 -1
  23. package/build/components/block-popover/index.js +3 -2
  24. package/build/components/block-popover/index.js.map +1 -1
  25. package/build/components/color-style-selector/index.js +1 -1
  26. package/build/components/color-style-selector/index.js.map +1 -1
  27. package/build/components/iframe/index.js +1 -0
  28. package/build/components/iframe/index.js.map +1 -1
  29. package/build/components/inserter/reusable-blocks-tab.native.js +7 -4
  30. package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  31. package/build/components/inserter/search-results.native.js +10 -8
  32. package/build/components/inserter/search-results.native.js.map +1 -1
  33. package/build/components/inspector-controls/fill.js +1 -1
  34. package/build/components/inspector-controls/fill.js.map +1 -1
  35. package/build/components/inspector-controls/fill.native.js +1 -1
  36. package/build/components/inspector-controls/fill.native.js.map +1 -1
  37. package/build/components/inspector-controls/slot.js +1 -1
  38. package/build/components/inspector-controls/slot.js.map +1 -1
  39. package/build/components/inspector-controls/slot.native.js +1 -1
  40. package/build/components/inspector-controls/slot.native.js.map +1 -1
  41. package/build/components/link-control/index.js +1 -7
  42. package/build/components/link-control/index.js.map +1 -1
  43. package/build/components/list-view/block-select-button.js +48 -7
  44. package/build/components/list-view/block-select-button.js.map +1 -1
  45. package/build/components/list-view/drop-indicator.js +3 -3
  46. package/build/components/list-view/drop-indicator.js.map +1 -1
  47. package/build/components/list-view/index.js +14 -8
  48. package/build/components/list-view/index.js.map +1 -1
  49. package/build/components/list-view/use-list-view-images.js +5 -4
  50. package/build/components/list-view/use-list-view-images.js.map +1 -1
  51. package/build/components/preview-options/index.js +3 -1
  52. package/build/components/preview-options/index.js.map +1 -1
  53. package/build/components/provider/index.js +3 -1
  54. package/build/components/provider/index.js.map +1 -1
  55. package/build/components/rich-text/use-remove-browser-shortcuts.js +1 -1
  56. package/build/components/rich-text/use-remove-browser-shortcuts.js.map +1 -1
  57. package/build/components/use-block-commands/index.js +74 -63
  58. package/build/components/use-block-commands/index.js.map +1 -1
  59. package/build/components/warning/index.js +1 -1
  60. package/build/components/warning/index.js.map +1 -1
  61. package/build/hooks/auto-inserting-blocks.js +174 -0
  62. package/build/hooks/auto-inserting-blocks.js.map +1 -0
  63. package/build/hooks/index.js +1 -0
  64. package/build/hooks/index.js.map +1 -1
  65. package/build/store/selectors.js +1 -1
  66. package/build/store/selectors.js.map +1 -1
  67. package/build-module/components/block-controls/slot.js +1 -1
  68. package/build-module/components/block-controls/slot.js.map +1 -1
  69. package/build-module/components/block-controls/slot.native.js +1 -1
  70. package/build-module/components/block-controls/slot.native.js.map +1 -1
  71. package/build-module/components/block-controls/use-has-block-controls.js +1 -1
  72. package/build-module/components/block-controls/use-has-block-controls.js.map +1 -1
  73. package/build-module/components/block-list/block-outline.native.js +4 -3
  74. package/build-module/components/block-list/block-outline.native.js.map +1 -1
  75. package/build-module/components/block-list/index.js +4 -3
  76. package/build-module/components/block-list/index.js.map +1 -1
  77. package/build-module/components/block-list/use-block-props/index.js +27 -1
  78. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  79. package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js +1 -1
  80. package/build-module/components/block-list/use-block-props/use-nav-mode-exit.js.map +1 -1
  81. package/build-module/components/block-lock/menu-item.js +3 -1
  82. package/build-module/components/block-lock/menu-item.js.map +1 -1
  83. package/build-module/components/block-lock/toolbar.js +3 -1
  84. package/build-module/components/block-lock/toolbar.js.map +1 -1
  85. package/build-module/components/block-popover/inbetween.js +4 -5
  86. package/build-module/components/block-popover/inbetween.js.map +1 -1
  87. package/build-module/components/block-popover/index.js +3 -2
  88. package/build-module/components/block-popover/index.js.map +1 -1
  89. package/build-module/components/color-style-selector/index.js +1 -1
  90. package/build-module/components/color-style-selector/index.js.map +1 -1
  91. package/build-module/components/iframe/index.js +1 -0
  92. package/build-module/components/iframe/index.js.map +1 -1
  93. package/build-module/components/inserter/reusable-blocks-tab.native.js +8 -4
  94. package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
  95. package/build-module/components/inserter/search-results.native.js +11 -8
  96. package/build-module/components/inserter/search-results.native.js.map +1 -1
  97. package/build-module/components/inspector-controls/fill.js +1 -1
  98. package/build-module/components/inspector-controls/fill.js.map +1 -1
  99. package/build-module/components/inspector-controls/fill.native.js +1 -1
  100. package/build-module/components/inspector-controls/fill.native.js.map +1 -1
  101. package/build-module/components/inspector-controls/slot.js +1 -1
  102. package/build-module/components/inspector-controls/slot.js.map +1 -1
  103. package/build-module/components/inspector-controls/slot.native.js +1 -1
  104. package/build-module/components/inspector-controls/slot.native.js.map +1 -1
  105. package/build-module/components/link-control/index.js +1 -7
  106. package/build-module/components/link-control/index.js.map +1 -1
  107. package/build-module/components/list-view/block-select-button.js +48 -7
  108. package/build-module/components/list-view/block-select-button.js.map +1 -1
  109. package/build-module/components/list-view/drop-indicator.js +3 -3
  110. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  111. package/build-module/components/list-view/index.js +14 -8
  112. package/build-module/components/list-view/index.js.map +1 -1
  113. package/build-module/components/list-view/use-list-view-images.js +5 -4
  114. package/build-module/components/list-view/use-list-view-images.js.map +1 -1
  115. package/build-module/components/preview-options/index.js +3 -1
  116. package/build-module/components/preview-options/index.js.map +1 -1
  117. package/build-module/components/provider/index.js +3 -1
  118. package/build-module/components/provider/index.js.map +1 -1
  119. package/build-module/components/rich-text/use-remove-browser-shortcuts.js +1 -1
  120. package/build-module/components/rich-text/use-remove-browser-shortcuts.js.map +1 -1
  121. package/build-module/components/use-block-commands/index.js +74 -63
  122. package/build-module/components/use-block-commands/index.js.map +1 -1
  123. package/build-module/components/warning/index.js +2 -2
  124. package/build-module/components/warning/index.js.map +1 -1
  125. package/build-module/hooks/auto-inserting-blocks.js +167 -0
  126. package/build-module/hooks/auto-inserting-blocks.js.map +1 -0
  127. package/build-module/hooks/index.js +1 -0
  128. package/build-module/hooks/index.js.map +1 -1
  129. package/build-module/store/selectors.js +1 -1
  130. package/build-module/store/selectors.js.map +1 -1
  131. package/build-style/content-rtl.css +8 -7
  132. package/build-style/content.css +8 -7
  133. package/build-style/style-rtl.css +0 -3
  134. package/build-style/style.css +0 -3
  135. package/package.json +32 -32
  136. package/src/components/block-icon/test/index.js +2 -2
  137. package/src/components/block-list/block-outline.native.js +5 -2
  138. package/src/components/block-list/content.scss +2 -3
  139. package/src/components/block-list/index.js +4 -3
  140. package/src/components/block-list/use-block-props/index.js +26 -0
  141. package/src/components/block-list/use-block-props/use-nav-mode-exit.js +1 -1
  142. package/src/components/block-lock/menu-item.js +2 -0
  143. package/src/components/block-lock/toolbar.js +3 -1
  144. package/src/components/block-popover/inbetween.js +4 -3
  145. package/src/components/block-popover/index.js +3 -2
  146. package/src/components/block-styles/style.scss +0 -3
  147. package/src/components/button-block-appender/content.scss +8 -0
  148. package/src/components/color-style-selector/index.js +1 -1
  149. package/src/components/iframe/index.js +1 -0
  150. package/src/components/inserter/reusable-blocks-tab.native.js +7 -2
  151. package/src/components/inserter/search-results.native.js +13 -9
  152. package/src/components/link-control/index.js +1 -5
  153. package/src/components/link-control/test/index.js +1 -0
  154. package/src/components/list-view/block-select-button.js +67 -15
  155. package/src/components/list-view/drop-indicator.js +4 -5
  156. package/src/components/list-view/index.js +19 -13
  157. package/src/components/list-view/use-list-view-images.js +8 -4
  158. package/src/components/observe-typing/README.md +2 -2
  159. package/src/components/preview-options/index.js +2 -0
  160. package/src/components/provider/index.js +8 -1
  161. package/src/components/rich-text/use-remove-browser-shortcuts.js +1 -1
  162. package/src/components/use-block-commands/index.js +92 -88
  163. package/src/components/warning/index.js +2 -2
  164. package/src/hooks/auto-inserting-blocks.js +232 -0
  165. package/src/hooks/index.js +1 -0
  166. package/src/store/selectors.js +1 -1
  167. package/build/utils/pre-parse-patterns.js +0 -68
  168. package/build/utils/pre-parse-patterns.js.map +0 -1
  169. package/build-module/utils/pre-parse-patterns.js +0 -61
  170. package/build-module/utils/pre-parse-patterns.js.map +0 -1
  171. package/src/components/url-popover/test/__snapshots__/index.js.snap +0 -133
  172. package/src/components/url-popover/test/index.js +0 -75
  173. package/src/utils/pre-parse-patterns.js +0 -69
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_data","_components","_i18n","_store","_useBlockRefs","_usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","InsertionPointOpenRef","createContext","exports","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","props","popoverRecomputeCounter","forcePopoverRecompute","useReducer","s","orientation","rootClientId","isVisible","useSelect","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","blockEditorStore","_rootClientId","previousElement","useBlockElement","nextElement","isVertical","popoverAnchor","useMemo","undefined","ownerDocument","getBoundingClientRect","previousRect","nextRect","left","top","width","height","bottom","isRTL","right","window","DOMRect","popoverScrollRef","usePopoverScroll","useLayoutEffect","observer","MutationObserver","observe","attributes","disconnect","defaultView","addEventListener","removeEventListener","createElement","Popover","ref","animate","anchor","focusOnMount","__unstableSlotName","key","className","classnames","resize","flip","placement","variant","_default","default"],"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseMemo,\n\tcreateContext,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\t...props\n} ) {\n\t// This is a temporary hack to get the inbetween inserter to recompute properly.\n\tconst [ popoverRecomputeCounter, forcePopoverRecompute ] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tpreviousClientId ?? nextClientId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId, nextClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverRecomputeCounter is by definition always equal or greater than 0.\n\t\t\t// This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverRecomputeCounter < 0 ||\n\t\t\t( ! previousElement && ! nextElement ) ||\n\t\t\t! isVisible\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst { ownerDocument } = previousElement || nextElement;\n\n\t\treturn {\n\t\t\townerDocument,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst previousRect = previousElement\n\t\t\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\t\t\t\tconst nextRect = nextElement\n\t\t\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\n\t\t\t\tlet left = 0;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet width = 0;\n\t\t\t\tlet height = 0;\n\n\t\t\t\tif ( isVertical ) {\n\t\t\t\t\t// vertical\n\t\t\t\t\ttop = previousRect ? previousRect.bottom : nextRect.top;\n\t\t\t\t\twidth = previousRect ? previousRect.width : nextRect.width;\n\t\t\t\t\theight =\n\t\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tleft = previousRect ? previousRect.left : nextRect.left;\n\t\t\t\t} else {\n\t\t\t\t\ttop = previousRect ? previousRect.top : nextRect.top;\n\t\t\t\t\theight = previousRect\n\t\t\t\t\t\t? previousRect.height\n\t\t\t\t\t\t: nextRect.height;\n\n\t\t\t\t\tif ( isRTL() ) {\n\t\t\t\t\t\t// non vertical, rtl\n\t\t\t\t\t\tleft = nextRect ? nextRect.right : previousRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// non vertical, ltr\n\t\t\t\t\t\tleft = previousRect\n\t\t\t\t\t\t\t? previousRect.right\n\t\t\t\t\t\t\t: nextRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? nextRect.left - previousRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\tpreviousElement,\n\t\tnextElement,\n\t\tpopoverRecomputeCounter,\n\t\tisVertical,\n\t\tisVisible,\n\t] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\t// When blocks are moved up/down, their position can be set by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( previousElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ previousElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! nextElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( nextElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ nextElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tpreviousElement.ownerDocument.defaultView.addEventListener(\n\t\t\t'resize',\n\t\t\tforcePopoverRecompute\n\t\t);\n\t\treturn () => {\n\t\t\tpreviousElement.ownerDocument.defaultView?.removeEventListener(\n\t\t\t\t'resize',\n\t\t\t\tforcePopoverRecompute\n\t\t\t);\n\t\t};\n\t}, [ previousElement ] );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tplacement=\"overlay\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"block-editor-block-popover__inbetween-container\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAN,sBAAA,CAAAF,OAAA;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAKA,MAAMS,6BAA6B,GAAGC,MAAM,CAACC,gBAAgB;AAEtD,MAAMC,qBAAqB,GAAG,IAAAC,sBAAa,EAAC,CAAC;AAACC,OAAA,CAAAF,qBAAA,GAAAA,qBAAA;AAErD,SAASG,qBAAqBA,CAAE;EAC/BC,gBAAgB;EAChBC,YAAY;EACZC,QAAQ;EACRC,qBAAqB;EACrBC,oBAAoB;EACpB,GAAGC;AACJ,CAAC,EAAG;EACH;EACA,MAAM,CAAEC,uBAAuB,EAAEC,qBAAqB,CAAE,GAAG,IAAAC,mBAAU;EACpE;EACEC,CAAC,IAAM,CAAEA,CAAC,GAAG,CAAC,IAAKhB,6BAA6B,EAClD,CACD,CAAC;EAED,MAAM;IAAEiB,WAAW;IAAEC,YAAY;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAS,EACvDC,MAAM,IAAM;IACb,MAAM;MACLC,oBAAoB;MACpBC,oBAAoB;MACpBC;IACD,CAAC,GAAG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EAAGb,gBAAkB;IACxBc,OAAO,EAAG,KAAO;IACjBC,MAAM,EAAG/B,aAAe;IACxBgC,YAAY,EAAG;IACf;IACA;IAAA;IACAC,kBAAkB,EAAGtD,qBAAqB,IAAI;IAC9C;IACA;IAAA;IACAuD,GAAG,EAAGzD,YAAY,GAAG,IAAI,GAAGU,YAAc;IAAA,GACrCN,KAAK;IACVsD,SAAS,EAAG,IAAAC,mBAAU,EACrB,4BAA4B,EAC5B,uCAAuC,EACvCvD,KAAK,CAACsD,SACP,CAAG;IACHE,MAAM,EAAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACdC,SAAS,EAAC,SAAS;IACnBC,OAAO,EAAC;EAAU,GAElB,IAAAjF,QAAA,CAAAoE,aAAA;IAAKQ,SAAS,EAAC;EAAiD,GAC7DzD,QACE,CACG,CAAC;EAEX;AACD;AAAC,IAAA+D,QAAA,GAEclE,qBAAqB;AAAAD,OAAA,CAAAoE,OAAA,GAAAD,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_data","_components","_i18n","_store","_useBlockRefs","_usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","InsertionPointOpenRef","createContext","exports","BlockPopoverInbetween","previousClientId","nextClientId","children","__unstablePopoverSlot","__unstableContentRef","props","popoverRecomputeCounter","forcePopoverRecompute","useReducer","s","orientation","rootClientId","isVisible","useSelect","select","getBlockListSettings","getBlockRootClientId","isBlockVisible","blockEditorStore","_rootClientId","previousElement","useBlockElement","nextElement","isVertical","popoverAnchor","useMemo","undefined","contextElement","getBoundingClientRect","previousRect","nextRect","left","top","width","height","bottom","isRTL","right","window","DOMRect","popoverScrollRef","usePopoverScroll","useLayoutEffect","observer","MutationObserver","observe","attributes","disconnect","ownerDocument","defaultView","addEventListener","removeEventListener","createElement","Popover","ref","animate","anchor","focusOnMount","__unstableSlotName","inline","key","className","classnames","resize","flip","placement","variant","_default","default"],"sources":["@wordpress/block-editor/src/components/block-popover/inbetween.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseMemo,\n\tcreateContext,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport { Popover } from '@wordpress/components';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction BlockPopoverInbetween( {\n\tpreviousClientId,\n\tnextClientId,\n\tchildren,\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\t...props\n} ) {\n\t// This is a temporary hack to get the inbetween inserter to recompute properly.\n\tconst [ popoverRecomputeCounter, forcePopoverRecompute ] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\tconst { orientation, rootClientId, isVisible } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockListSettings,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tisBlockVisible,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst _rootClientId = getBlockRootClientId(\n\t\t\t\tpreviousClientId ?? nextClientId\n\t\t\t);\n\t\t\treturn {\n\t\t\t\torientation:\n\t\t\t\t\tgetBlockListSettings( _rootClientId )?.orientation ||\n\t\t\t\t\t'vertical',\n\t\t\t\trootClientId: _rootClientId,\n\t\t\t\tisVisible:\n\t\t\t\t\tisBlockVisible( previousClientId ) &&\n\t\t\t\t\tisBlockVisible( nextClientId ),\n\t\t\t};\n\t\t},\n\t\t[ previousClientId, nextClientId ]\n\t);\n\tconst previousElement = useBlockElement( previousClientId );\n\tconst nextElement = useBlockElement( nextClientId );\n\tconst isVertical = orientation === 'vertical';\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverRecomputeCounter is by definition always equal or greater than 0.\n\t\t\t// This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverRecomputeCounter < 0 ||\n\t\t\t( ! previousElement && ! nextElement ) ||\n\t\t\t! isVisible\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst contextElement = previousElement || nextElement;\n\n\t\treturn {\n\t\t\tcontextElement,\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst previousRect = previousElement\n\t\t\t\t\t? previousElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\t\t\t\tconst nextRect = nextElement\n\t\t\t\t\t? nextElement.getBoundingClientRect()\n\t\t\t\t\t: null;\n\n\t\t\t\tlet left = 0;\n\t\t\t\tlet top = 0;\n\t\t\t\tlet width = 0;\n\t\t\t\tlet height = 0;\n\n\t\t\t\tif ( isVertical ) {\n\t\t\t\t\t// vertical\n\t\t\t\t\ttop = previousRect ? previousRect.bottom : nextRect.top;\n\t\t\t\t\twidth = previousRect ? previousRect.width : nextRect.width;\n\t\t\t\t\theight =\n\t\t\t\t\t\tnextRect && previousRect\n\t\t\t\t\t\t\t? nextRect.top - previousRect.bottom\n\t\t\t\t\t\t\t: 0;\n\t\t\t\t\tleft = previousRect ? previousRect.left : nextRect.left;\n\t\t\t\t} else {\n\t\t\t\t\ttop = previousRect ? previousRect.top : nextRect.top;\n\t\t\t\t\theight = previousRect\n\t\t\t\t\t\t? previousRect.height\n\t\t\t\t\t\t: nextRect.height;\n\n\t\t\t\t\tif ( isRTL() ) {\n\t\t\t\t\t\t// non vertical, rtl\n\t\t\t\t\t\tleft = nextRect ? nextRect.right : previousRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? previousRect.left - nextRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// non vertical, ltr\n\t\t\t\t\t\tleft = previousRect\n\t\t\t\t\t\t\t? previousRect.right\n\t\t\t\t\t\t\t: nextRect.left;\n\t\t\t\t\t\twidth =\n\t\t\t\t\t\t\tpreviousRect && nextRect\n\t\t\t\t\t\t\t\t? nextRect.left - previousRect.right\n\t\t\t\t\t\t\t\t: 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t};\n\t}, [\n\t\tpreviousElement,\n\t\tnextElement,\n\t\tpopoverRecomputeCounter,\n\t\tisVertical,\n\t\tisVisible,\n\t] );\n\n\tconst popoverScrollRef = usePopoverScroll( __unstableContentRef );\n\n\t// This is only needed for a smooth transition when moving blocks.\n\t// When blocks are moved up/down, their position can be set by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( previousElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ previousElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! nextElement ) {\n\t\t\treturn;\n\t\t}\n\t\tconst observer = new window.MutationObserver( forcePopoverRecompute );\n\t\tobserver.observe( nextElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ nextElement ] );\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previousElement ) {\n\t\t\treturn;\n\t\t}\n\t\tpreviousElement.ownerDocument.defaultView.addEventListener(\n\t\t\t'resize',\n\t\t\tforcePopoverRecompute\n\t\t);\n\t\treturn () => {\n\t\t\tpreviousElement.ownerDocument.defaultView?.removeEventListener(\n\t\t\t\t'resize',\n\t\t\t\tforcePopoverRecompute\n\t\t\t);\n\t\t};\n\t}, [ previousElement ] );\n\n\t// If there's either a previous or a next element, show the inbetween popover.\n\t// Note that drag and drop uses the inbetween popover to show the drop indicator\n\t// before the first block and after the last block.\n\tif ( ( ! previousElement && ! nextElement ) || ! isVisible ) {\n\t\treturn null;\n\t}\n\n\t/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n\t// While ideally it would be enough to capture the\n\t// bubbling focus event from the Inserter, due to the\n\t// characteristics of click focusing of `button`s in\n\t// Firefox and Safari, it is not reliable.\n\t//\n\t// See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus\n\treturn (\n\t\t<Popover\n\t\t\tref={ popoverScrollRef }\n\t\t\tanimate={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\tfocusOnMount={ false }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\t// Forces a remount of the popover when its position changes\n\t\t\t// This makes sure the popover doesn't animate from its previous position.\n\t\t\tkey={ nextClientId + '--' + rootClientId }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\t'block-editor-block-popover__inbetween',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tplacement=\"overlay\"\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<div className=\"block-editor-block-popover__inbetween-container\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</Popover>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */\n}\n\nexport default BlockPopoverInbetween;\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAOA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAN,sBAAA,CAAAF,OAAA;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAKA,MAAMS,6BAA6B,GAAGC,MAAM,CAACC,gBAAgB;AAEtD,MAAMC,qBAAqB,GAAG,IAAAC,sBAAa,EAAC,CAAC;AAACC,OAAA,CAAAF,qBAAA,GAAAA,qBAAA;AAErD,SAASG,qBAAqBA,CAAE;EAC/BC,gBAAgB;EAChBC,YAAY;EACZC,QAAQ;EACRC,qBAAqB;EACrBC,oBAAoB;EACpB,GAAGC;AACJ,CAAC,EAAG;EACH;EACA,MAAM,CAAEC,uBAAuB,EAAEC,qBAAqB,CAAE,GAAG,IAAAC,mBAAU;EACpE;EACEC,CAAC,IAAM,CAAEA,CAAC,GAAG,CAAC,IAAKhB,6BAA6B,EAClD,CACD,CAAC;EAED,MAAM;IAAEiB,WAAW;IAAEC,YAAY;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAS,EACvDC,MAAM,IAAM;IACb,MAAM;MACLC,oBAAoB;MACpBC,oBAAoB;MACpBC;IACD,CAAC,GAAGH,MAAM,CAAEI,YAAiB,CAAC;IAE9B,MAAMC,aAAa,GAAGH,oBAAoB,CACzChB,gBAAgB,aAAhBA,gBAAgB,cAAhBA,gBAAgB,GAAIC,YACrB,CAAC;IACD,OAAO;MACNS,WAAW,EACVK,oBAAoB,CAAEI,aAAc,CAAC,EAAET,WAAW,IAClD,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,GAAGU,YAAc;IAAA,GACrCN,KAAK;IACVwD,SAAS,EAAG,IAAAC,mBAAU,EACrB,4BAA4B,EAC5B,uCAAuC,EACvCzD,KAAK,CAACwD,SACP,CAAG;IACHE,MAAM,EAAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACdC,SAAS,EAAC,SAAS;IACnBC,OAAO,EAAC;EAAU,GAElB,IAAAnF,QAAA,CAAAqE,aAAA;IAAKS,SAAS,EAAC;EAAiD,GAC7D3D,QACE,CACG,CAAC;EAEX;AACD;AAAC,IAAAiE,QAAA,GAEcpE,qBAAqB;AAAAD,OAAA,CAAAsE,OAAA,GAAAD,QAAA"}
@@ -101,7 +101,7 @@ function BlockPopover({
101
101
  const height = bottom - top;
102
102
  return new window.DOMRect(left, top, width, height);
103
103
  },
104
- ownerDocument: selectedElement.ownerDocument
104
+ contextElement: selectedElement
105
105
  };
106
106
  }, [bottomClientId, lastSelectedElement, selectedElement, popoverDimensionsRecomputeCounter]);
107
107
  if (!selectedElement || bottomClientId && !lastSelectedElement) {
@@ -115,7 +115,8 @@ function BlockPopover({
115
115
  // Render in the old slot if needed for backward compatibility,
116
116
  // otherwise render in place (not in the default popover slot).
117
117
  ,
118
- __unstableSlotName: __unstablePopoverSlot || null,
118
+ __unstableSlotName: __unstablePopoverSlot,
119
+ inline: !__unstablePopoverSlot,
119
120
  placement: "top-start",
120
121
  resize: false,
121
122
  flip: false,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_compose","_components","_useBlockRefs","_usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstableRefreshSize","__unstableCoverTarget","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","useBlockElement","lastSelectedElement","mergedRefs","useMergeRefs","usePopoverScroll","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","useReducer","s","useLayoutEffect","observer","window","MutationObserver","observe","attributes","disconnect","style","useMemo","position","width","offsetWidth","height","offsetHeight","popoverAnchor","undefined","getBoundingClientRect","_lastSelectedBCR$left","_lastSelectedBCR$top","_lastSelectedBCR$righ","_lastSelectedBCR$bott","selectedBCR","lastSelectedBCR","left","Math","min","Infinity","top","right","max","bottom","DOMRect","ownerDocument","createElement","Popover","animate","focusOnMount","anchor","__unstableSlotName","placement","resize","flip","className","classnames","variant","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstableRefreshSize,\n\t\t__unstableCoverTarget = false,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst style = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\tlastSelectedElement !== selectedElement\n\t\t) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tposition: 'absolute',\n\t\t\twidth: selectedElement.offsetWidth,\n\t\t\theight: selectedElement.offsetHeight,\n\t\t};\n\t}, [\n\t\tselectedElement,\n\t\tlastSelectedElement,\n\t\t__unstableRefreshSize,\n\t\tpopoverDimensionsRecomputeCounter,\n\t] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst selectedBCR = selectedElement.getBoundingClientRect();\n\t\t\t\tconst lastSelectedBCR =\n\t\t\t\t\tlastSelectedElement?.getBoundingClientRect();\n\n\t\t\t\t// Get the biggest rectangle that encompasses completely the currently\n\t\t\t\t// selected element and the last selected element:\n\t\t\t\t// - for top/left coordinates, use the smaller numbers\n\t\t\t\t// - for the bottom/right coordinates, use the largest numbers\n\t\t\t\tconst left = Math.min(\n\t\t\t\t\tselectedBCR.left,\n\t\t\t\t\tlastSelectedBCR?.left ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst top = Math.min(\n\t\t\t\t\tselectedBCR.top,\n\t\t\t\t\tlastSelectedBCR?.top ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst right = Math.max(\n\t\t\t\t\tselectedBCR.right,\n\t\t\t\t\tlastSelectedBCR.right ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst bottom = Math.max(\n\t\t\t\t\tselectedBCR.bottom,\n\t\t\t\t\tlastSelectedBCR.bottom ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst width = right - left;\n\t\t\t\tconst height = bottom - top;\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t\townerDocument: selectedElement.ownerDocument,\n\t\t};\n\t}, [\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t\tselectedElement,\n\t\tpopoverDimensionsRecomputeCounter,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot || null }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ __unstableCoverTarget && <div style={ style }>{ children }</div> }\n\t\t\t{ ! __unstableCoverTarget && children }\n\t\t</Popover>\n\t);\n}\n\nexport default forwardRef( BlockPopover );\n"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAWA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA,MAAMO,6BAA6B,GAAGC,MAAM,CAACC,gBAAgB;AAE7D,SAASC,YAAYA,CACpB;EACCC,QAAQ;EACRC,cAAc;EACdC,QAAQ;EACRC,qBAAqB;EACrBC,qBAAqB,GAAG,KAAK;EAC7BC,qBAAqB;EACrBC,oBAAoB;EACpBC,KAAK,GAAG,IAAI;EACZ,GAAGC;AACJ,CAAC,EACDC,GAAG,EACF;EACD,MAAMC,eAAe,GAAG,IAAAC,uCAAe,EAAEX,QAAS,CAAC;EACnD,MAAMY,mBAAmB,GAAG,IAAAD,uCAAe,EAAEV,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAID,QAAS,CAAC;EACzE,MAAMa,UAAU,GAAG,IAAAC,qBAAY,EAAE,CAChCL,GAAG,EACH,IAAAM,yBAAgB,EAAET,oBAAqB,CAAC,CACvC,CAAC;EAEH,MAAM,CACLU,iCAAiC,EACjCC,+BAA+B,CAC/B,GAAG,IAAAC,mBAAU;EACb;EACEC,CAAC,IAAM,CAAEA,CAAC,GAAG,CAAC,IAAKvB,6BAA6B,EAClD,CACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAAwB,wBAAe,EAAE,MAAM;IACtB,IAAK,CAAEV,eAAe,EAAG;M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AAG,KAAO;IAChBC,IAAI,EAAG,KAAO;IACdtD,KAAK,EAAGA,KAAO;IAAA,GACVC,KAAK;IACVsD,SAAS,EAAG,IAAAC,mBAAU,EACrB,4BAA4B,EAC5BvD,KAAK,CAACsD,SACP,CAAG;IACHE,OAAO,EAAC;EAAU,GAEhB5D,qBAAqB,IAAI,IAAAhB,QAAA,CAAAiE,aAAA;IAAK1B,KAAK,EAAGA;EAAO,GAAGzB,QAAe,CAAC,EAChE,CAAEE,qBAAqB,IAAIF,QACrB,CAAC;AAEZ;AAAC,IAAA+D,QAAA,GAEc,IAAAC,mBAAU,EAAEnE,YAAa,CAAC;AAAAoE,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_compose","_components","_useBlockRefs","_usePopoverScroll","MAX_POPOVER_RECOMPUTE_COUNTER","Number","MAX_SAFE_INTEGER","BlockPopover","clientId","bottomClientId","children","__unstableRefreshSize","__unstableCoverTarget","__unstablePopoverSlot","__unstableContentRef","shift","props","ref","selectedElement","useBlockElement","lastSelectedElement","mergedRefs","useMergeRefs","usePopoverScroll","popoverDimensionsRecomputeCounter","forceRecomputePopoverDimensions","useReducer","s","useLayoutEffect","observer","window","MutationObserver","observe","attributes","disconnect","style","useMemo","position","width","offsetWidth","height","offsetHeight","popoverAnchor","undefined","getBoundingClientRect","_lastSelectedBCR$left","_lastSelectedBCR$top","_lastSelectedBCR$righ","_lastSelectedBCR$bott","selectedBCR","lastSelectedBCR","left","Math","min","Infinity","top","right","max","bottom","DOMRect","contextElement","createElement","Popover","animate","focusOnMount","anchor","__unstableSlotName","inline","placement","resize","flip","className","classnames","variant","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/block-popover/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMergeRefs } from '@wordpress/compose';\nimport { Popover } from '@wordpress/components';\nimport {\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\tuseLayoutEffect,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport usePopoverScroll from './use-popover-scroll';\n\nconst MAX_POPOVER_RECOMPUTE_COUNTER = Number.MAX_SAFE_INTEGER;\n\nfunction BlockPopover(\n\t{\n\t\tclientId,\n\t\tbottomClientId,\n\t\tchildren,\n\t\t__unstableRefreshSize,\n\t\t__unstableCoverTarget = false,\n\t\t__unstablePopoverSlot,\n\t\t__unstableContentRef,\n\t\tshift = true,\n\t\t...props\n\t},\n\tref\n) {\n\tconst selectedElement = useBlockElement( clientId );\n\tconst lastSelectedElement = useBlockElement( bottomClientId ?? clientId );\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tusePopoverScroll( __unstableContentRef ),\n\t] );\n\n\tconst [\n\t\tpopoverDimensionsRecomputeCounter,\n\t\tforceRecomputePopoverDimensions,\n\t] = useReducer(\n\t\t// Module is there to make sure that the counter doesn't overflow.\n\t\t( s ) => ( s + 1 ) % MAX_POPOVER_RECOMPUTE_COUNTER,\n\t\t0\n\t);\n\n\t// When blocks are moved up/down, they are animated to their new position by\n\t// updating the `transform` property manually (i.e. without using CSS\n\t// transitions or animations). The animation, which can also scroll the block\n\t// editor, can sometimes cause the position of the Popover to get out of sync.\n\t// A MutationObserver is therefore used to make sure that changes to the\n\t// selectedElement's attribute (i.e. `transform`) can be tracked and used to\n\t// trigger the Popover to rerender.\n\tuseLayoutEffect( () => {\n\t\tif ( ! selectedElement ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst observer = new window.MutationObserver(\n\t\t\tforceRecomputePopoverDimensions\n\t\t);\n\t\tobserver.observe( selectedElement, { attributes: true } );\n\n\t\treturn () => {\n\t\t\tobserver.disconnect();\n\t\t};\n\t}, [ selectedElement ] );\n\n\tconst style = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\tlastSelectedElement !== selectedElement\n\t\t) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tposition: 'absolute',\n\t\t\twidth: selectedElement.offsetWidth,\n\t\t\theight: selectedElement.offsetHeight,\n\t\t};\n\t}, [\n\t\tselectedElement,\n\t\tlastSelectedElement,\n\t\t__unstableRefreshSize,\n\t\tpopoverDimensionsRecomputeCounter,\n\t] );\n\n\tconst popoverAnchor = useMemo( () => {\n\t\tif (\n\t\t\t// popoverDimensionsRecomputeCounter is by definition always equal or greater\n\t\t\t// than 0. This check is only there to satisfy the correctness of the\n\t\t\t// exhaustive-deps rule for the `useMemo` hook.\n\t\t\tpopoverDimensionsRecomputeCounter < 0 ||\n\t\t\t! selectedElement ||\n\t\t\t( bottomClientId && ! lastSelectedElement )\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tgetBoundingClientRect() {\n\t\t\t\tconst selectedBCR = selectedElement.getBoundingClientRect();\n\t\t\t\tconst lastSelectedBCR =\n\t\t\t\t\tlastSelectedElement?.getBoundingClientRect();\n\n\t\t\t\t// Get the biggest rectangle that encompasses completely the currently\n\t\t\t\t// selected element and the last selected element:\n\t\t\t\t// - for top/left coordinates, use the smaller numbers\n\t\t\t\t// - for the bottom/right coordinates, use the largest numbers\n\t\t\t\tconst left = Math.min(\n\t\t\t\t\tselectedBCR.left,\n\t\t\t\t\tlastSelectedBCR?.left ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst top = Math.min(\n\t\t\t\t\tselectedBCR.top,\n\t\t\t\t\tlastSelectedBCR?.top ?? Infinity\n\t\t\t\t);\n\t\t\t\tconst right = Math.max(\n\t\t\t\t\tselectedBCR.right,\n\t\t\t\t\tlastSelectedBCR.right ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst bottom = Math.max(\n\t\t\t\t\tselectedBCR.bottom,\n\t\t\t\t\tlastSelectedBCR.bottom ?? -Infinity\n\t\t\t\t);\n\t\t\t\tconst width = right - left;\n\t\t\t\tconst height = bottom - top;\n\n\t\t\t\treturn new window.DOMRect( left, top, width, height );\n\t\t\t},\n\t\t\tcontextElement: selectedElement,\n\t\t};\n\t}, [\n\t\tbottomClientId,\n\t\tlastSelectedElement,\n\t\tselectedElement,\n\t\tpopoverDimensionsRecomputeCounter,\n\t] );\n\n\tif ( ! selectedElement || ( bottomClientId && ! lastSelectedElement ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Popover\n\t\t\tref={ mergedRefs }\n\t\t\tanimate={ false }\n\t\t\tfocusOnMount={ false }\n\t\t\tanchor={ popoverAnchor }\n\t\t\t// Render in the old slot if needed for backward compatibility,\n\t\t\t// otherwise render in place (not in the default popover slot).\n\t\t\t__unstableSlotName={ __unstablePopoverSlot }\n\t\t\tinline={ ! __unstablePopoverSlot }\n\t\t\tplacement=\"top-start\"\n\t\t\tresize={ false }\n\t\t\tflip={ false }\n\t\t\tshift={ shift }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-block-popover',\n\t\t\t\tprops.className\n\t\t\t) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t{ __unstableCoverTarget && <div style={ style }>{ children }</div> }\n\t\t\t{ ! __unstableCoverTarget && children }\n\t\t</Popover>\n\t);\n}\n\nexport default forwardRef( BlockPopover );\n"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAPA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAWA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AArBA;AACA;AACA;;AAGA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AC,OAAA,GAAAH,QAAA"}
@@ -15,7 +15,7 @@ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
15
15
  */
16
16
 
17
17
  const ColorSelectorSVGIcon = () => (0, _element.createElement)(_components.SVG, {
18
- xmlns: "https://www.w3.org/2000/svg",
18
+ xmlns: "http://www.w3.org/2000/svg",
19
19
  viewBox: "0 0 20 20"
20
20
  }, (0, _element.createElement)(_components.Path, {
21
21
  d: "M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z"
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_keycodes","_deprecated","_interopRequireDefault","ColorSelectorSVGIcon","_element","createElement","SVG","xmlns","viewBox","Path","d","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","ToolbarGroup","ToolbarButton","label","__","onClick","onKeyDown","icon","BlockColorsStyleSelector","children","other","deprecated","alternative","since","version","Dropdown","popoverProps","placement","contentClassName","renderToggle","renderContent","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\nimport deprecated from '@wordpress/deprecated';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"https://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent =\n\t( { TextColor, BackgroundColor } ) =>\n\t( { onToggle, isOpen } ) => {\n\t\tconst openOnArrowDown = ( event ) => {\n\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonToggle();\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t\t</BackgroundColor>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => {\n\tdeprecated( `wp.blockEditor.BlockColorsStyleSelector`, {\n\t\talternative: 'block supports API',\n\t\tsince: '6.1',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tclassName=\"block-library-colors-selector\"\n\t\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\t\trenderToggle={ renderToggleComponent( other ) }\n\t\t\trenderContent={ () => children }\n\t\t/>\n\t);\n};\n\nexport default BlockColorsStyleSelector;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAZA;AACA;AACA;;AAYA,MAAMK,oBAAoB,GAAGA,CAAA,KAC5B,IAAAC,QAAA,CAAAC,aAAA,EAACR,WAAA,CAAAS,GAAG;EAACC,KAAK,EAAC,6BAA6B;EAACC,OAAO,EAAC;AAAW,GAC3D,IAAAJ,QAAA,CAAAC,aAAA,EAACR,WAAA,CAAAY,IAAI;EAACC,CAAC,EAAC;AAA6e,CAAE,CACnf,CACL;;AAED;AACA;AACA;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AAC,KAAM;EAC9D,IAAAC,mBAAU,EAAG,yCAAwC,EAAE;IACtDC,WAAW,EAAE,oBAAoB;IACjCC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,OACC,IAAAjC,QAAA,CAAAC,aAAA,EAACR,WAAA,CAAAyC,QAAQ;IACRC,YAAY,EAAG;MAAEC,SAAS,EAAE;IAAe,CAAG;IAC9C3B,SAAS,EAAC,+BAA+B;IACzC4B,gBAAgB,EAAC,wCAAwC;IACzDC,YAAY,EAAG5B,qBAAqB,CAAEmB,KAAM,CAAG;IAC/CU,aAAa,EAAGA,CAAA,KAAMX;EAAU,CAChC,CAAC;AAEJ,CAAC;AAAC,IAAAY,QAAA,GAEab,wBAAwB;AAAAc,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_components","require","_i18n","_keycodes","_deprecated","_interopRequireDefault","ColorSelectorSVGIcon","_element","createElement","SVG","xmlns","viewBox","Path","d","ColorSelectorIcon","style","className","renderToggleComponent","TextColor","BackgroundColor","onToggle","isOpen","openOnArrowDown","event","keyCode","DOWN","preventDefault","ToolbarGroup","ToolbarButton","label","__","onClick","onKeyDown","icon","BlockColorsStyleSelector","children","other","deprecated","alternative","since","version","Dropdown","popoverProps","placement","contentClassName","renderToggle","renderContent","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/color-style-selector/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarButton,\n\tDropdown,\n\tToolbarGroup,\n\tSVG,\n\tPath,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { DOWN } from '@wordpress/keycodes';\nimport deprecated from '@wordpress/deprecated';\n\nconst ColorSelectorSVGIcon = () => (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\">\n\t\t<Path d=\"M7.434 5l3.18 9.16H8.538l-.692-2.184H4.628l-.705 2.184H2L5.18 5h2.254zm-1.13 1.904h-.115l-1.148 3.593H7.44L6.304 6.904zM14.348 7.006c1.853 0 2.9.876 2.9 2.374v4.78h-1.79v-.914h-.114c-.362.64-1.123 1.022-2.031 1.022-1.346 0-2.292-.826-2.292-2.108 0-1.27.972-2.006 2.71-2.107l1.696-.102V9.38c0-.584-.42-.914-1.18-.914-.667 0-1.112.228-1.264.647h-1.701c.12-1.295 1.307-2.107 3.066-2.107zm1.079 4.1l-1.416.09c-.793.056-1.18.342-1.18.844 0 .52.45.837 1.091.837.857 0 1.505-.545 1.505-1.256v-.515z\" />\n\t</SVG>\n);\n\n/**\n * Color Selector Icon component.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.style Style object.\n * @param {string} props.className Class name for component.\n *\n * @return {*} React Icon component.\n */\nconst ColorSelectorIcon = ( { style, className } ) => {\n\treturn (\n\t\t<div className=\"block-library-colors-selector__icon-container\">\n\t\t\t<div\n\t\t\t\tclassName={ `${ className } block-library-colors-selector__state-selection` }\n\t\t\t\tstyle={ style }\n\t\t\t>\n\t\t\t\t<ColorSelectorSVGIcon />\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n/**\n * Renders the Colors Selector Toolbar with the icon button.\n *\n * @param {Object} props Component properties.\n * @param {Object} props.TextColor Text color component that wraps icon.\n * @param {Object} props.BackgroundColor Background color component that wraps icon.\n *\n * @return {*} React toggle button component.\n */\nconst renderToggleComponent =\n\t( { TextColor, BackgroundColor } ) =>\n\t( { onToggle, isOpen } ) => {\n\t\tconst openOnArrowDown = ( event ) => {\n\t\t\tif ( ! isOpen && event.keyCode === DOWN ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonToggle();\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tclassName=\"components-toolbar__control block-library-colors-selector__toggle\"\n\t\t\t\t\tlabel={ __( 'Open Colors Selector' ) }\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<BackgroundColor>\n\t\t\t\t\t\t\t<TextColor>\n\t\t\t\t\t\t\t\t<ColorSelectorIcon />\n\t\t\t\t\t\t\t</TextColor>\n\t\t\t\t\t\t</BackgroundColor>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t};\n\nconst BlockColorsStyleSelector = ( { children, ...other } ) => {\n\tdeprecated( `wp.blockEditor.BlockColorsStyleSelector`, {\n\t\talternative: 'block supports API',\n\t\tsince: '6.1',\n\t\tversion: '6.3',\n\t} );\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\tclassName=\"block-library-colors-selector\"\n\t\t\tcontentClassName=\"block-library-colors-selector__popover\"\n\t\t\trenderToggle={ renderToggleComponent( other ) }\n\t\t\trenderContent={ () => children }\n\t\t/>\n\t);\n};\n\nexport default BlockColorsStyleSelector;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAZA;AACA;AACA;;AAYA,MAAMK,oBAAoB,GAAGA,CAAA,KAC5B,IAAAC,QAAA,CAAAC,aAAA,EAACR,WAAA,CAAAS,GAAG;EAACC,KAAK,EAAC,4BAA4B;EAACC,OAAO,EAAC;AAAW,GAC1D,IAAAJ,QAAA,CAAAC,aAAA,EAACR,WAAA,CAAAY,IAAI;EAACC,CAAC,EAAC;AAA6e,CAAE,CACnf,CACL;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAU,CAAC,KAAM;EACrD,OACC,IAAAT,QAAA,CAAAC,aAAA;IAAKQ,SAAS,EAAC;EAA+C,GAC7D,IAAAT,QAAA,CAAA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CAAAyC,QAAQ;IACRC,YAAY,EAAG;MAAEC,SAAS,EAAE;IAAe,CAAG;IAC9C3B,SAAS,EAAC,+BAA+B;IACzC4B,gBAAgB,EAAC,wCAAwC;IACzDC,YAAY,EAAG5B,qBAAqB,CAAEmB,KAAM,CAAG;IAC/CU,aAAa,EAAGA,CAAA,KAAMX;EAAU,CAChC,CAAC;AAEJ,CAAC;AAAC,IAAAY,QAAA,GAEab,wBAAwB;AAAAc,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -159,6 +159,7 @@ function Iframe({
159
159
  const html = `<!doctype html>
160
160
  <html>
161
161
  <head>
162
+ <meta charset="utf-8">
162
163
  <script>window.frameElement._load()</script>
163
164
  <style>html{height:auto!important;min-height:100%;}body{margin:0}</style>
164
165
  ${styles}
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_useCompatibilityStyles","_store","bubbleEvents","doc","defaultView","frameElement","bubbleEvent","event","prototype","Object","getPrototypeOf","constructorName","constructor","name","Constructor","window","init","key","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","cancelled","dispatchEvent","preventDefault","eventTypes","addEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","useSelect","select","settings","blockEditorStore","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","iframeDocument","setIframeDocument","useState","bodyClasses","setBodyClasses","compatStyles","useCompatibilityStyles","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","setRef","useRefEffect","node","_load","contentDocument","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","documentElement","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","removeEventListener","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","html","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","useEffect","marginFromScaling","createElement","Fragment","style","marginTop","marginBottom","transform","transition","title","__","createPortal","className","classnames","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} doc Document to attach listeners to.\n */\nfunction bubbleEvents( doc ) {\n\tconst { defaultView } = doc;\n\tconst { frameElement } = defaultView;\n\n\tfunction bubbleEvent( event ) {\n\t\tconst prototype = Object.getPrototypeOf( event );\n\t\tconst constructorName = prototype.constructor.name;\n\t\tconst Constructor = window[ constructorName ];\n\n\t\tconst init = {};\n\n\t\tfor ( const key in event ) {\n\t\t\tinit[ key ] = event[ key ];\n\t\t}\n\n\t\tif ( event instanceof defaultView.MouseEvent ) {\n\t\t\tconst rect = frameElement.getBoundingClientRect();\n\t\t\tinit.clientX += rect.left;\n\t\t\tinit.clientY += rect.top;\n\t\t}\n\n\t\tconst newEvent = new Constructor( event.type, init );\n\t\tconst cancelled = ! frameElement.dispatchEvent( newEvent );\n\n\t\tif ( cancelled ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\n\tfor ( const name of eventTypes ) {\n\t\tdoc.addEventListener( name, bubbleEvent );\n\t}\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tbubbleEvents( contentDocument );\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;A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7E,QAAA,CAAA2H,aAAA,EAACrH,WAAA,CAAAiI,2BAAa;IAACC,QAAQ,EAAGxE;EAAgB,GACvCpB,QACY,CACV,CAAC,EACPoB,cAAc,CAAC0B,eAChB,CACM,CAAC,EACP7C,QAAQ,IAAI,CAAC,IAAI8B,KAClB,CAAC;AAEL;AAEA,SAAS8D,aAAaA,CAAErF,KAAK,EAAED,GAAG,EAAG;EACpC,MAAMuF,aAAa,GAAG,IAAAnF,eAAS,EAC5BC,MAAM,IACPA,MAAM,CAAEE,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACgF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAA1I,QAAA,CAAA2H,aAAA,EAACjF,MAAM;IAAA,GAAMU,KAAK;IAAGF,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAAC,IAAAyF,QAAA,GAEc,IAAAC,mBAAU,EAAEJ,aAAc,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_compose","_components","_data","_blockSelectionClearer","_writingFlow","_useCompatibilityStyles","_store","bubbleEvents","doc","defaultView","frameElement","bubbleEvent","event","prototype","Object","getPrototypeOf","constructorName","constructor","name","Constructor","window","init","key","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","cancelled","dispatchEvent","preventDefault","eventTypes","addEventListener","Iframe","contentRef","children","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","resolvedAssets","isPreviewMode","useSelect","select","settings","blockEditorStore","getSettings","__unstableResolvedAssets","__unstableIsPreviewMode","styles","scripts","iframeDocument","setIframeDocument","useState","bodyClasses","setBodyClasses","compatStyles","useCompatibilityStyles","clearerRef","useBlockSelectionClearer","before","writingFlowRef","after","useWritingFlow","contentResizeListener","height","contentHeight","useResizeObserver","setRef","useRefEffect","node","_load","contentDocument","iFrameDocument","preventFileDropDefault","onLoad","ownerDocument","documentElement","Array","from","body","classList","filter","startsWith","dir","compatStyle","getElementById","id","head","appendChild","cloneNode","console","warn","removeEventListener","disabledRef","useDisabled","isDisabled","bodyRef","useMergeRefs","html","src","cleanup","useMemo","_src","URL","createObjectURL","Blob","revokeObjectURL","useEffect","marginFromScaling","createElement","Fragment","style","marginTop","marginBottom","transform","transition","title","__","createPortal","className","classnames","__experimentalStyleProvider","document","IframeIfReady","isInitialised","__internalIsInitialized","_default","forwardRef","exports","default"],"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} doc Document to attach listeners to.\n */\nfunction bubbleEvents( doc ) {\n\tconst { defaultView } = doc;\n\tconst { frameElement } = defaultView;\n\n\tfunction bubbleEvent( event ) {\n\t\tconst prototype = Object.getPrototypeOf( event );\n\t\tconst constructorName = prototype.constructor.name;\n\t\tconst Constructor = window[ constructorName ];\n\n\t\tconst init = {};\n\n\t\tfor ( const key in event ) {\n\t\t\tinit[ key ] = event[ key ];\n\t\t}\n\n\t\tif ( event instanceof defaultView.MouseEvent ) {\n\t\t\tconst rect = frameElement.getBoundingClientRect();\n\t\t\tinit.clientX += rect.left;\n\t\t\tinit.clientY += rect.top;\n\t\t}\n\n\t\tconst newEvent = new Constructor( event.type, init );\n\t\tconst cancelled = ! frameElement.dispatchEvent( newEvent );\n\n\t\tif ( cancelled ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\n\tfor ( const name of eventTypes ) {\n\t\tdoc.addEventListener( name, bubbleEvent );\n\t}\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {\n\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tresolvedAssets: settings.__unstableResolvedAssets,\n\t\t\tisPreviewMode: settings.__unstableIsPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { styles = '', scripts = '' } = resolvedAssets;\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tnode._load = () => {\n\t\t\tsetIframeDocument( node.contentDocument );\n\t\t};\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tbubbleEvents( contentDocument );\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of compatStyles ) {\n\t\t\t\tif ( contentDocument.getElementById( compatStyle.id ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontentDocument.head.appendChild(\n\t\t\t\t\tcompatStyle.cloneNode( true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! isPreviewMode ) {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,\n\t\t\t\t\t\tcompatStyle\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tdelete node._load;\n\t\t\tnode.removeEventListener( 'load', onLoad );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<script>window.frameElement._load()</script>\n\t\t<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>\n\t\t${ styles }\n\t\t${ scripts }\n\t</head>\n\t<body>\n\t\t<script>document.currentScript.parentElement.remove()</script>\n\t</body>\n</html>`;\n\n\tconst [ src, cleanup ] = useMemo( () => {\n\t\tconst _src = URL.createObjectURL(\n\t\t\tnew window.Blob( [ html ], { type: 'text/html' } )\n\t\t);\n\t\treturn [ _src, () => URL.revokeObjectURL( _src ) ];\n\t}, [ html ] );\n\n\tuseEffect( () => cleanup, [ cleanup ] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<body\n\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t</body>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAYA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAMA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,sBAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,uBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASW,YAAYA,CAAEC,GAAG,EAAG;EAC5B,MAAM;IAAEC;EAAY,CAAC,GAAGD,GAAG;EAC3B,MAAM;IAAEE;EAAa,CAAC,GAAGD,WAAW;EAEpC,SAASE,WAAWA,CAAEC,KAAK,EAAG;IAC7B,MAAMC,SAAS,GAAGC,MAAM,CAACC,cAAc,CAAEH,KAAM,CAAC;IAChD,MAAMI,eAAe,GAAGH,SAAS,CAACI,WAAW,CAACC,IAAI;IAClD,MAAMC,WAAW,GAAGC,MAAM,CAAEJ,eAAe,CAAE;IAE7C,MAAMK,IAAI,GAAG,CAAC,CAAC;IAEf,KAAM,MAAMC,GAAG,IAAIV,KAAK,EAAG;MAC1BS,IAAI,CAAEC,GAAG,CAAE,GAAGV,KAAK,CAAEU,GAAG,CAAE;IAC3B;IAEA,IAAKV,KAAK,YAAYH,WAAW,CAACc,UAAU,EAAG;MAC9C,MAAMC,IAAI,GAAGd,YAAY,CAACe,qBAAqB,CAAC,CAAC;MACjDJ,IAAI,CAACK,OAAO,IAAIF,IAAI,CAACG,I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;EAAG,GAE7BnE,cAAc,IACf,IAAAoE,qBAAY,EACX,IAAApI,QAAA,CAAA2H,aAAA;IACCxE,GAAG,EAAG2D,OAAS;IACfuB,SAAS,EAAG,IAAAC,mBAAU,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,GAAGnE,WACJ;EAAG,GAEDU,qBAAqB,EACvB,IAAA7E,QAAA,CAAA2H,aAAA,EAACrH,WAAA,CAAAiI,2BAAa;IAACC,QAAQ,EAAGxE;EAAgB,GACvCpB,QACY,CACV,CAAC,EACPoB,cAAc,CAAC0B,eAChB,CACM,CAAC,EACP7C,QAAQ,IAAI,CAAC,IAAI8B,KAClB,CAAC;AAEL;AAEA,SAAS8D,aAAaA,CAAErF,KAAK,EAAED,GAAG,EAAG;EACpC,MAAMuF,aAAa,GAAG,IAAAnF,eAAS,EAC5BC,MAAM,IACPA,MAAM,CAAEE,YAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACgF,uBAAuB,EACjE,EACD,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OAAO,IAAA1I,QAAA,CAAA2H,aAAA,EAACjF,MAAM;IAAA,GAAMU,KAAK;IAAGF,YAAY,EAAGC;EAAK,CAAE,CAAC;AACpD;AAAC,IAAAyF,QAAA,GAEc,IAAAC,mBAAU,EAAEJ,aAAc,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -25,18 +25,21 @@ function ReusableBlocksTab({
25
25
  listProps
26
26
  }) {
27
27
  const {
28
- items
28
+ inserterItems
29
29
  } = (0, _data.useSelect)(select => {
30
30
  const {
31
31
  getInserterItems
32
32
  } = select(_store.store);
33
33
  const allItems = getInserterItems(rootClientId);
34
34
  return {
35
- items: (0, _utils.filterInserterItems)(allItems, {
36
- onlyReusable: true
37
- })
35
+ inserterItems: allItems
38
36
  };
39
37
  }, [rootClientId]);
38
+ const items = (0, _element.useMemo)(() => {
39
+ return (0, _utils.filterInserterItems)(inserterItems, {
40
+ onlyReusable: true
41
+ });
42
+ }, [inserterItems]);
40
43
  const sections = [(0, _utils.createInserterSection)({
41
44
  key: 'reuseable',
42
45
  items
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_blockTypesList","_interopRequireDefault","_store","_utils","ReusableBlocksTab","onSelect","rootClientId","listProps","items","useSelect","select","getInserterItems","blockEditorStore","allItems","filterInserterItems","onlyReusable","sections","createInserterSection","key","_element","createElement","default","name","label","__","_default","exports"],"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport { store as blockEditorStore } from '../../store';\nimport { createInserterSection, filterInserterItems } from './utils';\n\nfunction ReusableBlocksTab( { onSelect, rootClientId, listProps } ) {\n\tconst { items } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst allItems = getInserterItems( rootClientId );\n\n\t\t\treturn {\n\t\t\t\titems: filterInserterItems( allItems, { onlyReusable: true } ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst sections = [ createInserterSection( { key: 'reuseable', items } ) ];\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"SyncedPatterns\"\n\t\t\tsections={ sections }\n\t\t\tonSelect={ onSelect }\n\t\t\tlistProps={ listProps }\n\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t/>\n\t);\n}\n\nexport default ReusableBlocksTab;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,eAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,SAASM,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC,YAAY;EAAEC;AAAU,CAAC,EAAG;EACnE,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,eAAS,EACxBC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAiB,CAAC,GAAGD,MAAM,CAAEE,YAAiB,CAAC;IACvD,MAAMC,QAAQ,GAAGF,gBAAgB,CAAEL,YAAa,CAAC;IAEjD,OAAO;MACNE,KAAK,EAAE,IAAAM,0BAAmB,EAAED,QAAQ,EAAE;QAAEE,YAAY,EAAE;MAAK,CAAE;IAC9D,CAAC;EACF,CAAC,EACD,CAAET,YAAY,CACf,CAAC;EAED,MAAMU,QAAQ,GAAG,CAAE,IAAAC,4BAAqB,EAAE;IAAEC,GAAG,EAAE,WAAW;IAAEV;EAAM,CAAE,CAAC,CAAE;EAEzE,OACC,IAAAW,QAAA,CAAAC,aAAA,EAACpB,eAAA,CAAAqB,OAAc;IACdC,IAAI,EAAC,gBAAgB;IACrBN,QAAQ,EAAGA,QAAU;IACrBX,QAAQ,EAAGA,QAAU;IACrBE,SAAS,EAAGA,SAAW;IACvBgB,KAAK,EAAG,IAAAC,QAAE,EAAE,iBAAkB;EAAG,CACjC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEcrB,iBAAiB;AAAAsB,OAAA,CAAAL,OAAA,GAAAI,QAAA"}
1
+ {"version":3,"names":["_element","require","_data","_i18n","_blockTypesList","_interopRequireDefault","_store","_utils","ReusableBlocksTab","onSelect","rootClientId","listProps","inserterItems","useSelect","select","getInserterItems","blockEditorStore","allItems","items","useMemo","filterInserterItems","onlyReusable","sections","createInserterSection","key","createElement","default","name","label","__","_default","exports"],"sources":["@wordpress/block-editor/src/components/inserter/reusable-blocks-tab.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesList from '../block-types-list';\nimport { store as blockEditorStore } from '../../store';\nimport { createInserterSection, filterInserterItems } from './utils';\n\nfunction ReusableBlocksTab( { onSelect, rootClientId, listProps } ) {\n\tconst { inserterItems } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getInserterItems } = select( blockEditorStore );\n\t\t\tconst allItems = getInserterItems( rootClientId );\n\n\t\t\treturn {\n\t\t\t\tinserterItems: allItems,\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst items = useMemo( () => {\n\t\treturn filterInserterItems( inserterItems, { onlyReusable: true } );\n\t}, [ inserterItems ] );\n\n\tconst sections = [ createInserterSection( { key: 'reuseable', items } ) ];\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"SyncedPatterns\"\n\t\t\tsections={ sections }\n\t\t\tonSelect={ onSelect }\n\t\t\tlistProps={ listProps }\n\t\t\tlabel={ __( 'Synced patterns' ) }\n\t\t/>\n\t);\n}\n\nexport default ReusableBlocksTab;\n"],"mappings":";;;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AAFA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAMA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,SAASO,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC,YAAY;EAAEC;AAAU,CAAC,EAAG;EACnE,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAChCC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAiB,CAAC,GAAGD,MAAM,CAAEE,YAAiB,CAAC;IACvD,MAAMC,QAAQ,GAAGF,gBAAgB,CAAEL,YAAa,CAAC;IAEjD,OAAO;MACNE,aAAa,EAAEK;IAChB,CAAC;EACF,CAAC,EACD,CAAEP,YAAY,CACf,CAAC;EAED,MAAMQ,KAAK,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC5B,OAAO,IAAAC,0BAAmB,EAAER,aAAa,EAAE;MAAES,YAAY,EAAE;IAAK,CAAE,CAAC;EACpE,CAAC,EAAE,CAAET,aAAa,CAAG,CAAC;EAEtB,MAAMU,QAAQ,GAAG,CAAE,IAAAC,4BAAqB,EAAE;IAAEC,GAAG,EAAE,WAAW;IAAEN;EAAM,CAAE,CAAC,CAAE;EAEzE,OACC,IAAAlB,QAAA,CAAAyB,aAAA,EAACrB,eAAA,CAAAsB,OAAc;IACdC,IAAI,EAAC,gBAAgB;IACrBL,QAAQ,EAAGA,QAAU;IACrBb,QAAQ,EAAGA,QAAU;IACrBE,SAAS,EAAGA,SAAW;IACvBiB,KAAK,EAAG,IAAAC,QAAE,EAAE,iBAAkB;EAAG,CACjC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEctB,iBAAiB;AAAAuB,OAAA,CAAAL,OAAA,GAAAI,QAAA"}
@@ -30,17 +30,19 @@ function InserterSearchResults({
30
30
  isFullScreen
31
31
  }) {
32
32
  const {
33
- blockTypes
33
+ inserterItems
34
34
  } = (0, _data.useSelect)(select => {
35
- const allItems = select(_store.store).getInserterItems(rootClientId);
36
- const availableItems = (0, _utils.filterInserterItems)(allItems, {
37
- allowReusable: true
38
- });
39
- const filteredItems = (0, _searchItems.searchItems)(availableItems, filterValue);
35
+ const items = select(_store.store).getInserterItems(rootClientId);
40
36
  return {
41
- blockTypes: filteredItems
37
+ inserterItems: items
42
38
  };
43
- }, [rootClientId, filterValue]);
39
+ }, [rootClientId]);
40
+ const blockTypes = (0, _element.useMemo)(() => {
41
+ const availableItems = (0, _utils.filterInserterItems)(inserterItems, {
42
+ allowReusable: true
43
+ });
44
+ return (0, _searchItems.searchItems)(availableItems, filterValue);
45
+ }, [inserterItems, filterValue]);
44
46
  const {
45
47
  items,
46
48
  trackBlockTypeSelected
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_searchItems","_blockTypesList","_interopRequireDefault","_noResults","_store","_useBlockTypeImpressions","_utils","InserterSearchResults","filterValue","onSelect","listProps","rootClientId","isFullScreen","blockTypes","useSelect","select","allItems","blockEditorStore","getInserterItems","availableItems","filterInserterItems","allowReusable","filteredItems","searchItems","items","trackBlockTypeSelected","useBlockTypeImpressions","length","_element","createElement","default","handleSelect","args","name","initialNumToRender","sections","createInserterSection","key","label","__","_default","exports"],"sources":["@wordpress/block-editor/src/components/inserter/search-results.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { searchItems } from './search-items';\nimport BlockTypesList from '../block-types-list';\nimport InserterNoResults from './no-results';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockTypeImpressions from './hooks/use-block-type-impressions';\nimport { createInserterSection, filterInserterItems } from './utils';\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tlistProps,\n\trootClientId,\n\tisFullScreen,\n} ) {\n\tconst { blockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst allItems =\n\t\t\t\tselect( blockEditorStore ).getInserterItems( rootClientId );\n\n\t\t\tconst availableItems = filterInserterItems( allItems, {\n\t\t\t\tallowReusable: true,\n\t\t\t} );\n\t\t\tconst filteredItems = searchItems( availableItems, filterValue );\n\n\t\t\treturn { blockTypes: filteredItems };\n\t\t},\n\t\t[ rootClientId, filterValue ]\n\t);\n\n\tconst { items, trackBlockTypeSelected } =\n\t\tuseBlockTypeImpressions( blockTypes );\n\n\tif ( ! items || items?.length === 0 ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\tconst handleSelect = ( ...args ) => {\n\t\ttrackBlockTypeSelected( ...args );\n\t\tonSelect( ...args );\n\t};\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"Blocks\"\n\t\t\tinitialNumToRender={ isFullScreen ? 10 : 3 }\n\t\t\tsections={ [ createInserterSection( { key: 'search', items } ) ] }\n\t\t\tonSelect={ handleSelect }\n\t\t\tlistProps={ listProps }\n\t\t\tlabel={ __( 'Blocks' ) }\n\t\t/>\n\t);\n}\n\nexport default InserterSearchResults;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAIA;AACA;AACA;;AAQA,SAASS,qBAAqBA,CAAE;EAC/BC,WAAW;EACXC,QAAQ;EACRC,SAAS;EACTC,YAAY;EACZC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IAAM;IACb,MAAMC,QAAQ,GACbD,MAAM,CAAEE,YAAiB,CAAC,CAACC,gBAAgB,CAAEP,YAAa,CAAC;IAE5D,MAAMQ,cAAc,GAAG,IAAAC,0BAAmB,EAAEJ,QAAQ,EAAE;MACrDK,aAAa,EAAE;IAChB,CAAE,CAAC;IACH,MAAMC,aAAa,GAAG,IAAAC,wBAAW,EAAEJ,cAAc,EAAEX,WAAY,CAAC;IAEhE,OAAO;MAAEK,UAAU,EAAES;IAAc,CAAC;EACrC,CAAC,EACD,CAAEX,YAAY,EAAEH,WAAW,CAC5B,CAAC;EAED,MAAM;IAAEgB,KAAK;IAAEC;EAAuB,CAAC,GACtC,IAAAC,gCAAuB,EAAEb,UAAW,CAAC;EAEtC,IAAK,CAAEW,KAAK,IAAIA,KAAK,EAAEG,MAAM,KAAK,CAAC,EAAG;IACrC,OAAO,IAAAC,QAAA,CAAAC,aAAA,EAAC1B,UAAA,CAAA2B,OAAiB,MAAE,CAAC;EAC7B;EAEA,MAAMC,YAAY,GAAGA,CAAE,GAAGC,IAAI,KAAM;IACnCP,sBAAsB,CAAE,GAAGO,IAAK,CAAC;IACjCvB,QAAQ,CAAE,GAAGuB,IAAK,CAAC;EACpB,CAAC;EAED,OACC,IAAAJ,QAAA,CAAAC,aAAA,EAAC5B,eAAA,CAAA6B,OAAc;IACdG,IAAI,EAAC,QAAQ;IACbC,kBAAkB,EAAGtB,YAAY,GAAG,EAAE,GAAG,CAAG;IAC5CuB,QAAQ,EAAG,CAAE,IAAAC,4BAAqB,EAAE;MAAEC,GAAG,EAAE,QAAQ;MAAEb;IAAM,CAAE,CAAC,CAAI;IAClEf,QAAQ,EAAGsB,YAAc;IACzBrB,SAAS,EAAGA,SAAW;IACvB4B,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS;EAAG,CACxB,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEcjC,qBAAqB;AAAAkC,OAAA,CAAAX,OAAA,GAAAU,QAAA"}
1
+ {"version":3,"names":["_element","require","_data","_i18n","_searchItems","_blockTypesList","_interopRequireDefault","_noResults","_store","_useBlockTypeImpressions","_utils","InserterSearchResults","filterValue","onSelect","listProps","rootClientId","isFullScreen","inserterItems","useSelect","select","items","blockEditorStore","getInserterItems","blockTypes","useMemo","availableItems","filterInserterItems","allowReusable","searchItems","trackBlockTypeSelected","useBlockTypeImpressions","length","createElement","default","handleSelect","args","name","initialNumToRender","sections","createInserterSection","key","label","__","_default","exports"],"sources":["@wordpress/block-editor/src/components/inserter/search-results.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { searchItems } from './search-items';\nimport BlockTypesList from '../block-types-list';\nimport InserterNoResults from './no-results';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockTypeImpressions from './hooks/use-block-type-impressions';\nimport { createInserterSection, filterInserterItems } from './utils';\n\nfunction InserterSearchResults( {\n\tfilterValue,\n\tonSelect,\n\tlistProps,\n\trootClientId,\n\tisFullScreen,\n} ) {\n\tconst { inserterItems } = useSelect(\n\t\t( select ) => {\n\t\t\tconst items =\n\t\t\t\tselect( blockEditorStore ).getInserterItems( rootClientId );\n\n\t\t\treturn { inserterItems: items };\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\n\tconst blockTypes = useMemo( () => {\n\t\tconst availableItems = filterInserterItems( inserterItems, {\n\t\t\tallowReusable: true,\n\t\t} );\n\n\t\treturn searchItems( availableItems, filterValue );\n\t}, [ inserterItems, filterValue ] );\n\n\tconst { items, trackBlockTypeSelected } =\n\t\tuseBlockTypeImpressions( blockTypes );\n\n\tif ( ! items || items?.length === 0 ) {\n\t\treturn <InserterNoResults />;\n\t}\n\n\tconst handleSelect = ( ...args ) => {\n\t\ttrackBlockTypeSelected( ...args );\n\t\tonSelect( ...args );\n\t};\n\n\treturn (\n\t\t<BlockTypesList\n\t\t\tname=\"Blocks\"\n\t\t\tinitialNumToRender={ isFullScreen ? 10 : 3 }\n\t\t\tsections={ [ createInserterSection( { key: 'search', items } ) ] }\n\t\t\tonSelect={ handleSelect }\n\t\t\tlistProps={ listProps }\n\t\t\tlabel={ __( 'Blocks' ) }\n\t\t/>\n\t);\n}\n\nexport default InserterSearchResults;\n"],"mappings":";;;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AAFA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAMA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,wBAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,MAAA,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AAqB,EAAE;MAAEC,GAAG,EAAE,QAAQ;MAAEpB;IAAM,CAAE,CAAC,CAAI;IAClEP,QAAQ,EAAGqB,YAAc;IACzBpB,SAAS,EAAGA,SAAW;IACvB2B,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS;EAAG,CACxB,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEchC,qBAAqB;AAAAiC,OAAA,CAAAX,OAAA,GAAAU,QAAA"}
@@ -36,7 +36,7 @@ function InspectorControlsFill({
36
36
  const isDisplayed = (0, _useDisplayBlockControls.default)();
37
37
  const Fill = _groups.default[group]?.Fill;
38
38
  if (!Fill) {
39
- typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
39
+ typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
40
40
  return null;
41
41
  }
42
42
  if (!isDisplayed) {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_deprecated","_useDisplayBlockControls","_groups","InspectorControlsFill","children","group","__experimentalGroup","resetAllFilter","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","process","env","NODE_ENV","warning","createElement","__experimentalStyleProvider","document","fillProps","ToolsPanelInspectorControl","registerResetAllFilter","deregisterResetAllFilter","useEffect","value","Object","keys","length","__experimentalToolsPanelContext","Provider"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useDisplayBlockControls from '../use-display-block-controls';\nimport groups from './groups';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst isDisplayed = useDisplayBlockControls();\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } = fillProps;\n\tuseEffect( () => {\n\t\tif ( resetAllFilter && registerResetAllFilter ) {\n\t\t\tregisterResetAllFilter( resetAllFilter );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( resetAllFilter && deregisterResetAllFilter ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilter );\n\t\t\t}\n\t\t};\n\t}, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst value =\n\t\tfillProps && Object.keys( fillProps ).length > 0 ? fillProps : null;\n\treturn (\n\t\t<ToolsPanelContext.Provider value={ value }>\n\t\t\t{ children }\n\t\t</ToolsPanelContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AAMA,IAAAK,wBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,OAAA,GAAAH,sBAAA,CAAAH,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIe,SAASO,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,KAAK,GAAG,SAAS;EACjBC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,IAAKD,mBAAmB,EAAG;IAC1B,IAAAE,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGC,mBAAmB;EAC5B;EAEA,MAAMM,WAAW,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EAC7C,MAAMC,IAAI,GAAGC,eAAM,CAAEV,KAAK,CAAE,EAAES,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,OAAA,oBAAAA,OAAA,CAAAC,GAAA,IAAAD,OAAA,CAAAC,GAAA,CAAAC,QAAA,wBAAAC,gBAAO,EAAG,oCAAoCd,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EACA,IAAK,CAAEO,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAjB,QAAA,CAAAyB,aAAA,EAACvB,WAAA,CAAAwB,2BAAa;IAACC,QAAQ,EAAGA;EAAU,GACnC,IAAA3B,QAAA,CAAAyB,aAAA,EAACN,IAAI,QACAS,SAAS,IAAM;IAClB,OACC,IAAA5B,QAAA,CAAAyB,aAAA,EAACI,0BAA0B;MAC1BD,SAAS,EAAGA,SAAW;MACvBnB,QAAQ,EAAGA,QAAU;MACrBG,cAAc,EAAGA;IAAgB,CACjC,CAAC;EAEJ,CACK,CACQ,CAAC;AAElB;AAEA,SAASiB,0BAA0BA,CAAE;EAAEpB,QAAQ;EAAEG,cAAc;EAAEgB;AAAU,CAAC,EAAG;EAC9E,MAAM;IAAEE,sBAAsB;IAAEC;EAAyB,CAAC,GAAGH,SAAS;EACtE,IAAAI,kBAAS,EAAE,MAAM;IAChB,IAAKpB,cAAc,IAAIkB,sBAAsB,EAAG;MAC/CA,sBAAsB,CAAElB,cAAe,CAAC;IACzC;IACA,OAAO,MAAM;MACZ,IAAKA,cAAc,IAAImB,wBAAwB,EAAG;QACjDA,wBAAwB,CAAEnB,cAAe,CAAC;MAC3C;IACD,CAAC;EACF,CAAC,EAAE,CAAEA,cAAc,EAAEkB,sBAAsB,EAAEC,wBAAwB,CAAG,CAAC;;EAEzE;EACA;EACA;EACA;EACA,MAAME,KAAK,GACVL,SAAS,IAAIM,MAAM,CAACC,IAAI,CAAEP,SAAU,CAAC,CAACQ,MAAM,GAAG,CAAC,GAAGR,SAAS,GAAG,IAAI;EACpE,OACC,IAAA5B,QAAA,CAAAyB,aAAA,EAACvB,WAAA,CAAAmC,+BAAiB,CAACC,QAAQ;IAACL,KAAK,EAAGA;EAAO,GACxCxB,QACyB,CAAC;AAE/B"}
1
+ {"version":3,"names":["_element","require","_components","_warning","_interopRequireDefault","_deprecated","_useDisplayBlockControls","_groups","InspectorControlsFill","children","group","__experimentalGroup","resetAllFilter","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","SCRIPT_DEBUG","warning","createElement","__experimentalStyleProvider","document","fillProps","ToolsPanelInspectorControl","registerResetAllFilter","deregisterResetAllFilter","useEffect","value","Object","keys","length","__experimentalToolsPanelContext","Provider"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalStyleProvider as StyleProvider,\n\t__experimentalToolsPanelContext as ToolsPanelContext,\n} from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useDisplayBlockControls from '../use-display-block-controls';\nimport groups from './groups';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\tresetAllFilter,\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\n\tconst isDisplayed = useDisplayBlockControls();\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill>\n\t\t\t\t{ ( fillProps ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ToolsPanelInspectorControl\n\t\t\t\t\t\t\tfillProps={ fillProps }\n\t\t\t\t\t\t\tchildren={ children }\n\t\t\t\t\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</Fill>\n\t\t</StyleProvider>\n\t);\n}\n\nfunction ToolsPanelInspectorControl( { children, resetAllFilter, fillProps } ) {\n\tconst { registerResetAllFilter, deregisterResetAllFilter } = fillProps;\n\tuseEffect( () => {\n\t\tif ( resetAllFilter && registerResetAllFilter ) {\n\t\t\tregisterResetAllFilter( resetAllFilter );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( resetAllFilter && deregisterResetAllFilter ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilter );\n\t\t\t}\n\t\t};\n\t}, [ resetAllFilter, registerResetAllFilter, deregisterResetAllFilter ] );\n\n\t// Children passed to InspectorControlsFill will not have\n\t// access to any React Context whose Provider is part of\n\t// the InspectorControlsSlot tree. So we re-create the\n\t// Provider in this subtree.\n\tconst value =\n\t\tfillProps && Object.keys( fillProps ).length > 0 ? fillProps : null;\n\treturn (\n\t\t<ToolsPanelContext.Provider value={ value }>\n\t\t\t{ children }\n\t\t</ToolsPanelContext.Provider>\n\t);\n}\n"],"mappings":";;;;;;;AASA,IAAAA,QAAA,GAAAC,OAAA;AANA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AAMA,IAAAK,wBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,OAAA,GAAAH,sBAAA,CAAAH,OAAA;AAfA;AACA;AACA;;AASA;AACA;AACA;;AAIe,SAASO,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,KAAK,GAAG,SAAS;EACjBC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,IAAKD,mBAAmB,EAAG;IAC1B,IAAAE,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGC,mBAAmB;EAC5B;EAEA,MAAMM,WAAW,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EAC7C,MAAMC,IAAI,GAAGC,eAAM,CAAEV,KAAK,CAAE,EAAES,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,oCAAoCZ,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EACA,IAAK,CAAEO,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAjB,QAAA,CAAAuB,aAAA,EAACrB,WAAA,CAAAsB,2BAAa;IAACC,QAAQ,EAAGA;EAAU,GACnC,IAAAzB,QAAA,CAAAuB,aAAA,EAACJ,IAAI,QACAO,SAAS,IAAM;IAClB,OACC,IAAA1B,QAAA,CAAAuB,aAAA,EAACI,0BAA0B;MAC1BD,SAAS,EAAGA,SAAW;MACvBjB,QAAQ,EAAGA,QAAU;MACrBG,cAAc,EAAGA;IAAgB,CACjC,CAAC;EAEJ,CACK,CACQ,CAAC;AAElB;AAEA,SAASe,0BAA0BA,CAAE;EAAElB,QAAQ;EAAEG,cAAc;EAAEc;AAAU,CAAC,EAAG;EAC9E,MAAM;IAAEE,sBAAsB;IAAEC;EAAyB,CAAC,GAAGH,SAAS;EACtE,IAAAI,kBAAS,EAAE,MAAM;IAChB,IAAKlB,cAAc,IAAIgB,sBAAsB,EAAG;MAC/CA,sBAAsB,CAAEhB,cAAe,CAAC;IACzC;IACA,OAAO,MAAM;MACZ,IAAKA,cAAc,IAAIiB,wBAAwB,EAAG;QACjDA,wBAAwB,CAAEjB,cAAe,CAAC;MAC3C;IACD,CAAC;EACF,CAAC,EAAE,CAAEA,cAAc,EAAEgB,sBAAsB,EAAEC,wBAAwB,CAAG,CAAC;;EAEzE;EACA;EACA;EACA;EACA,MAAME,KAAK,GACVL,SAAS,IAAIM,MAAM,CAACC,IAAI,CAAEP,SAAU,CAAC,CAACQ,MAAM,GAAG,CAAC,GAAGR,SAAS,GAAG,IAAI;EACpE,OACC,IAAA1B,QAAA,CAAAuB,aAAA,EAACrB,WAAA,CAAAiC,+BAAiB,CAACC,QAAQ;IAACL,KAAK,EAAGA;EAAO,GACxCtB,QACyB,CAAC;AAE/B"}
@@ -42,7 +42,7 @@ function InspectorControlsFill({
42
42
  const isDisplayed = (0, _useDisplayBlockControls.default)();
43
43
  const Fill = _groups.default[group]?.Fill;
44
44
  if (!Fill) {
45
- typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
45
+ typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
46
46
  return null;
47
47
  }
48
48
  if (!isDisplayed) {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_reactNative","_components","_warning","_interopRequireDefault","_deprecated","_groups","_useDisplayBlockControls","_blockSettings","InspectorControlsFill","children","group","__experimentalGroup","props","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","process","env","NODE_ENV","warning","createElement","Fragment","BottomSheetConsumer","View","Children","count","BlockSettingsButton"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\nimport { BottomSheetConsumer } from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\nimport useDisplayBlockControls from '../use-display-block-controls';\nimport { BlockSettingsButton } from '../block-settings';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst isDisplayed = useDisplayBlockControls();\n\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Fill { ...props }>\n\t\t\t\t{\n\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t{ () => <View>{ children }</View> }\n\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t}\n\t\t\t</Fill>\n\t\t\t{ Children.count( children ) > 0 && <BlockSettingsButton /> }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAKA,IAAAM,OAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,wBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAKe,SAASS,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,KAAK,GAAG,SAAS;EACjBC,mBAAmB;EACnB,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKD,mBAAmB,EAAG;IAC1B,IAAAE,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGC,mBAAmB;EAC5B;EACA,MAAMM,WAAW,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EAE7C,MAAMC,IAAI,GAAGC,eAAM,CAAEV,KAAK,CAAE,EAAES,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,OAAA,oBAAAA,OAAA,CAAAC,GAAA,IAAAD,OAAA,CAAAC,GAAA,CAAAC,QAAA,wBAAAC,gBAAO,EAAG,oCAAoCd,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EACA,IAAK,CAAEO,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAnB,QAAA,CAAA2B,aAAA,EAAA3B,QAAA,CAAA4B,QAAA,QACC,IAAA5B,QAAA,CAAA2B,aAAA,EAACN,IAAI;IAAA,GAAMP;EAAK,GAEd,IAAAd,QAAA,CAAA2B,aAAA,EAACxB,WAAA,CAAA0B,mBAAmB,QACjB,MAAM,IAAA7B,QAAA,CAAA2B,aAAA,EAACzB,YAAA,CAAA4B,IAAI,QAAGnB,QAAgB,CACZ,CAEjB,CAAC,EACLoB,iBAAQ,CAACC,KAAK,CAAErB,QAAS,CAAC,GAAG,CAAC,IAAI,IAAAX,QAAA,CAAA2B,aAAA,EAAClB,cAAA,CAAAwB,mBAAmB,MAAE,CACzD,CAAC;AAEL"}
1
+ {"version":3,"names":["_element","require","_reactNative","_components","_warning","_interopRequireDefault","_deprecated","_groups","_useDisplayBlockControls","_blockSettings","InspectorControlsFill","children","group","__experimentalGroup","props","deprecated","since","version","alternative","isDisplayed","useDisplayBlockControls","Fill","groups","SCRIPT_DEBUG","warning","createElement","Fragment","BottomSheetConsumer","View","Children","count","BlockSettingsButton"],"sources":["@wordpress/block-editor/src/components/inspector-controls/fill.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Children } from '@wordpress/element';\nimport { BottomSheetConsumer } from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\nimport useDisplayBlockControls from '../use-display-block-controls';\nimport { BlockSettingsButton } from '../block-settings';\n\nexport default function InspectorControlsFill( {\n\tchildren,\n\tgroup = 'default',\n\t__experimentalGroup,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsFill`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst isDisplayed = useDisplayBlockControls();\n\n\tconst Fill = groups[ group ]?.Fill;\n\tif ( ! Fill ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Fill { ...props }>\n\t\t\t\t{\n\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t{ () => <View>{ children }</View> }\n\t\t\t\t\t</BottomSheetConsumer>\n\t\t\t\t}\n\t\t\t</Fill>\n\t\t\t{ Children.count( children ) > 0 && <BlockSettingsButton /> }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAKA,IAAAM,OAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,wBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAKe,SAASS,qBAAqBA,CAAE;EAC9CC,QAAQ;EACRC,KAAK,GAAG,SAAS;EACjBC,mBAAmB;EACnB,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKD,mBAAmB,EAAG;IAC1B,IAAAE,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGC,mBAAmB;EAC5B;EACA,MAAMM,WAAW,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EAE7C,MAAMC,IAAI,GAAGC,eAAM,CAAEV,KAAK,CAAE,EAAES,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,oCAAoCZ,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EACA,IAAK,CAAEO,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAnB,QAAA,CAAAyB,aAAA,EAAAzB,QAAA,CAAA0B,QAAA,QACC,IAAA1B,QAAA,CAAAyB,aAAA,EAACJ,IAAI;IAAA,GAAMP;EAAK,GAEd,IAAAd,QAAA,CAAAyB,aAAA,EAACtB,WAAA,CAAAwB,mBAAmB,QACjB,MAAM,IAAA3B,QAAA,CAAAyB,aAAA,EAACvB,YAAA,CAAA0B,IAAI,QAAGjB,QAAgB,CACZ,CAEjB,CAAC,EACLkB,iBAAQ,CAACC,KAAK,CAAEnB,QAAS,CAAC,GAAG,CAAC,IAAI,IAAAX,QAAA,CAAAyB,aAAA,EAAChB,cAAA,CAAAsB,mBAAmB,MAAE,CACzD,CAAC;AAEL"}
@@ -37,7 +37,7 @@ function InspectorControlsSlot({
37
37
  const Slot = _groups.default[group]?.Slot;
38
38
  const fills = (0, _components.__experimentalUseSlotFills)(Slot?.__unstableName);
39
39
  if (!Slot) {
40
- typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
40
+ typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
41
41
  return null;
42
42
  }
43
43
  if (!fills?.length) {
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_warning","_interopRequireDefault","_deprecated","_blockSupportToolsPanel","_blockSupportSlotContainer","_groups","InspectorControlsSlot","__experimentalGroup","group","label","props","deprecated","since","version","alternative","Slot","groups","fills","useSlotFills","__unstableName","process","env","NODE_ENV","warning","length","_element","createElement","default","bubblesVirtually"],"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport BlockSupportToolsPanel from './block-support-tools-panel';\nimport BlockSupportSlotContainer from './block-support-slot-container';\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup,\n\tgroup = 'default',\n\tlabel,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsSlot`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst Slot = groups[ group ]?.Slot;\n\tconst fills = useSlotFills( Slot?.__unstableName );\n\tif ( ! Slot ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\tif ( ! fills?.length ) {\n\t\treturn null;\n\t}\n\n\tif ( label ) {\n\t\treturn (\n\t\t\t<BlockSupportToolsPanel group={ group } label={ label }>\n\t\t\t\t<BlockSupportSlotContainer { ...props } Slot={ Slot } />\n\t\t\t</BlockSupportToolsPanel>\n\t\t);\n\t}\n\n\treturn <Slot { ...props } bubblesVirtually />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,uBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,0BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKe,SAASO,qBAAqBA,CAAE;EAC9CC,mBAAmB;EACnBC,KAAK,GAAG,SAAS;EACjBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKH,mBAAmB,EAAG;IAC1B,IAAAI,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGD,mBAAmB;EAC5B;EACA,MAAMQ,IAAI,GAAGC,eAAM,CAAER,KAAK,CAAE,EAAEO,IAAI;EAClC,MAAME,KAAK,GAAG,IAAAC,sCAAY,EAAEH,IAAI,EAAEI,cAAe,CAAC;EAClD,IAAK,CAAEJ,IAAI,EAAG;IACb,OAAAK,OAAA,oBAAAA,OAAA,CAAAC,GAAA,IAAAD,OAAA,CAAAC,GAAA,CAAAC,QAAA,wBAAAC,gBAAO,EAAG,oCAAoCf,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EAEA,IAAK,CAAES,KAAK,EAAEO,MAAM,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,IAAKf,KAAK,EAAG;IACZ,OACC,IAAAgB,QAAA,CAAAC,aAAA,EAACvB,uBAAA,CAAAwB,OAAsB;MAACnB,KAAK,EAAGA,KAAO;MAACC,KAAK,EAAGA;IAAO,GACtD,IAAAgB,QAAA,CAAAC,aAAA,EAACtB,0BAAA,CAAAuB,OAAyB;MAAA,GAAMjB,KAAK;MAAGK,IAAI,EAAGA;IAAM,CAAE,CAChC,CAAC;EAE3B;EAEA,OAAO,IAAAU,QAAA,CAAAC,aAAA,EAACX,IAAI;IAAA,GAAML,KAAK;IAAGkB,gBAAgB;EAAA,CAAE,CAAC;AAC9C"}
1
+ {"version":3,"names":["_components","require","_warning","_interopRequireDefault","_deprecated","_blockSupportToolsPanel","_blockSupportSlotContainer","_groups","InspectorControlsSlot","__experimentalGroup","group","label","props","deprecated","since","version","alternative","Slot","groups","fills","useSlotFills","__unstableName","SCRIPT_DEBUG","warning","length","_element","createElement","default","bubblesVirtually"],"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport BlockSupportToolsPanel from './block-support-tools-panel';\nimport BlockSupportSlotContainer from './block-support-slot-container';\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup,\n\tgroup = 'default',\n\tlabel,\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsSlot`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst Slot = groups[ group ]?.Slot;\n\tconst fills = useSlotFills( Slot?.__unstableName );\n\tif ( ! Slot ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\tif ( ! fills?.length ) {\n\t\treturn null;\n\t}\n\n\tif ( label ) {\n\t\treturn (\n\t\t\t<BlockSupportToolsPanel group={ group } label={ label }>\n\t\t\t\t<BlockSupportSlotContainer { ...props } Slot={ Slot } />\n\t\t\t</BlockSupportToolsPanel>\n\t\t);\n\t}\n\n\treturn <Slot { ...props } bubblesVirtually />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AAKA,IAAAI,uBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,0BAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,OAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKe,SAASO,qBAAqBA,CAAE;EAC9CC,mBAAmB;EACnBC,KAAK,GAAG,SAAS;EACjBC,KAAK;EACL,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKH,mBAAmB,EAAG;IAC1B,IAAAI,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDN,KAAK,GAAGD,mBAAmB;EAC5B;EACA,MAAMQ,IAAI,GAAGC,eAAM,CAAER,KAAK,CAAE,EAAEO,IAAI;EAClC,MAAME,KAAK,GAAG,IAAAC,sCAAY,EAAEH,IAAI,EAAEI,cAAe,CAAC;EAClD,IAAK,CAAEJ,IAAI,EAAG;IACb,OAAAK,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,oCAAoCb,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EAEA,IAAK,CAAES,KAAK,EAAEK,MAAM,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,IAAKb,KAAK,EAAG;IACZ,OACC,IAAAc,QAAA,CAAAC,aAAA,EAACrB,uBAAA,CAAAsB,OAAsB;MAACjB,KAAK,EAAGA,KAAO;MAACC,KAAK,EAAGA;IAAO,GACtD,IAAAc,QAAA,CAAAC,aAAA,EAACpB,0BAAA,CAAAqB,OAAyB;MAAA,GAAMf,KAAK;MAAGK,IAAI,EAAGA;IAAM,CAAE,CAChC,CAAC;EAE3B;EAEA,OAAO,IAAAQ,QAAA,CAAAC,aAAA,EAACT,IAAI;IAAA,GAAML,KAAK;IAAGgB,gBAAgB;EAAA,CAAE,CAAC;AAC9C"}
@@ -32,7 +32,7 @@ function InspectorControlsSlot({
32
32
  }
33
33
  const Slot = _groups.default[group]?.Slot;
34
34
  if (!Slot) {
35
- typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
35
+ typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? (0, _warning.default)(`Unknown InspectorControls group "${group}" provided.`) : void 0;
36
36
  return null;
37
37
  }
38
38
  return (0, _element.createElement)(Slot, {
@@ -1 +1 @@
1
- {"version":3,"names":["_warning","_interopRequireDefault","require","_deprecated","_groups","InspectorControlsSlot","__experimentalGroup","group","props","deprecated","since","version","alternative","Slot","groups","process","env","NODE_ENV","warning","_element","createElement"],"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup,\n\tgroup = 'default',\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsSlot`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst Slot = groups[ group ]?.Slot;\n\tif ( ! Slot ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\treturn <Slot { ...props } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAKA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASG,qBAAqBA,CAAE;EAC9CC,mBAAmB;EACnBC,KAAK,GAAG,SAAS;EACjB,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKF,mBAAmB,EAAG;IAC1B,IAAAG,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDL,KAAK,GAAGD,mBAAmB;EAC5B;EACA,MAAMO,IAAI,GAAGC,eAAM,CAAEP,KAAK,CAAE,EAAEM,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,OAAA,oBAAAA,OAAA,CAAAC,GAAA,IAAAD,OAAA,CAAAC,GAAA,CAAAC,QAAA,wBAAAC,gBAAO,EAAG,oCAAoCX,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAY,QAAA,CAAAC,aAAA,EAACP,IAAI;IAAA,GAAML;EAAK,CAAI,CAAC;AAC7B"}
1
+ {"version":3,"names":["_warning","_interopRequireDefault","require","_deprecated","_groups","InspectorControlsSlot","__experimentalGroup","group","props","deprecated","since","version","alternative","Slot","groups","SCRIPT_DEBUG","warning","_element","createElement"],"sources":["@wordpress/block-editor/src/components/inspector-controls/slot.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport warning from '@wordpress/warning';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport groups from './groups';\n\nexport default function InspectorControlsSlot( {\n\t__experimentalGroup,\n\tgroup = 'default',\n\t...props\n} ) {\n\tif ( __experimentalGroup ) {\n\t\tdeprecated(\n\t\t\t'`__experimentalGroup` property in `InspectorControlsSlot`',\n\t\t\t{\n\t\t\t\tsince: '6.2',\n\t\t\t\tversion: '6.4',\n\t\t\t\talternative: '`group`',\n\t\t\t}\n\t\t);\n\t\tgroup = __experimentalGroup;\n\t}\n\tconst Slot = groups[ group ]?.Slot;\n\tif ( ! Slot ) {\n\t\twarning( `Unknown InspectorControls group \"${ group }\" provided.` );\n\t\treturn null;\n\t}\n\n\treturn <Slot { ...props } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAKA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGe,SAASG,qBAAqBA,CAAE;EAC9CC,mBAAmB;EACnBC,KAAK,GAAG,SAAS;EACjB,GAAGC;AACJ,CAAC,EAAG;EACH,IAAKF,mBAAmB,EAAG;IAC1B,IAAAG,mBAAU,EACT,2DAA2D,EAC3D;MACCC,KAAK,EAAE,KAAK;MACZC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE;IACd,CACD,CAAC;IACDL,KAAK,GAAGD,mBAAmB;EAC5B;EACA,MAAMO,IAAI,GAAGC,eAAM,CAAEP,KAAK,CAAE,EAAEM,IAAI;EAClC,IAAK,CAAEA,IAAI,EAAG;IACb,OAAAE,YAAA,oBAAAA,YAAA,gBAAAC,gBAAO,EAAG,oCAAoCT,KAAO,aAAa,CAAC;IACnE,OAAO,IAAI;EACZ;EAEA,OAAO,IAAAU,QAAA,CAAAC,aAAA,EAACL,IAAI;IAAA,GAAML;EAAK,CAAI,CAAC;AAC7B"}
@@ -355,13 +355,7 @@ function LinkControl({
355
355
  settings: settings?.filter(({
356
356
  id
357
357
  }) => id === 'opensInNewTab'),
358
- onChange: ({
359
- opensInNewTab
360
- }) => {
361
- onChange({
362
- opensInNewTab
363
- });
364
- }
358
+ onChange: onChange
365
359
  });
366
360
  }
367
361
  },