@wordpress/block-editor 17.0.2-next.v.202608281122.0 → 17.1.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 (382) hide show
  1. package/CHANGELOG.md +29 -1
  2. package/build/components/background-image-control/index.cjs +18 -1
  3. package/build/components/background-image-control/index.cjs.map +2 -2
  4. package/build/components/block-allowed-blocks/modal.cjs +2 -1
  5. package/build/components/block-allowed-blocks/modal.cjs.map +3 -3
  6. package/build/components/block-edit/edit.cjs.map +1 -1
  7. package/build/components/block-inspector/index.cjs +3 -12
  8. package/build/components/block-inspector/index.cjs.map +2 -2
  9. package/build/components/block-list/use-block-props/use-is-hovered.cjs +17 -4
  10. package/build/components/block-list/use-block-props/use-is-hovered.cjs.map +2 -2
  11. package/build/components/block-preview/index.cjs +1 -2
  12. package/build/components/block-preview/index.cjs.map +2 -2
  13. package/build/components/block-switcher/index.cjs +2 -1
  14. package/build/components/block-switcher/index.cjs.map +3 -3
  15. package/build/components/block-toolbar/pattern-overrides-dropdown.cjs +2 -1
  16. package/build/components/block-toolbar/pattern-overrides-dropdown.cjs.map +3 -3
  17. package/build/components/global-styles/border-panel.cjs +19 -42
  18. package/build/components/global-styles/border-panel.cjs.map +2 -2
  19. package/build/components/global-styles/image-settings-panel.cjs.map +1 -1
  20. package/build/components/iframe/index.cjs.map +1 -1
  21. package/build/components/inserter/hooks/use-patterns-paging.cjs.map +1 -1
  22. package/build/components/inserter-draggable-blocks/index.cjs.map +1 -1
  23. package/build/components/inspector-controls-tabs/content-tab.cjs +2 -3
  24. package/build/components/inspector-controls-tabs/content-tab.cjs.map +2 -2
  25. package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -3
  26. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  27. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +1 -2
  28. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
  29. package/build/components/inspector-popover-header/index.cjs +5 -4
  30. package/build/components/inspector-popover-header/index.cjs.map +3 -3
  31. package/build/components/link-control/index.cjs.map +2 -2
  32. package/build/components/link-control/search-input.cjs.map +1 -1
  33. package/build/components/list-view/block-select-button.cjs +9 -1
  34. package/build/components/list-view/block-select-button.cjs.map +2 -2
  35. package/build/components/list-view/block.cjs +2 -1
  36. package/build/components/list-view/block.cjs.map +2 -2
  37. package/build/components/list-view/use-list-view-drop-zone.cjs.map +1 -1
  38. package/build/components/media-replace-flow/index.cjs +4 -1
  39. package/build/components/media-replace-flow/index.cjs.map +2 -2
  40. package/build/components/navigable-toolbar/index.cjs +3 -0
  41. package/build/components/navigable-toolbar/index.cjs.map +2 -2
  42. package/build/components/rich-text/event-listeners/enter.cjs +23 -11
  43. package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
  44. package/build/components/rich-text/event-listeners/index.cjs +0 -2
  45. package/build/components/rich-text/event-listeners/index.cjs.map +3 -3
  46. package/build/components/rich-text/event-listeners/input-rules.cjs +4 -2
  47. package/build/components/rich-text/event-listeners/input-rules.cjs.map +2 -2
  48. package/build/components/use-block-drop-zone/index.cjs.map +1 -1
  49. package/build/components/writing-flow/index.cjs +5 -0
  50. package/build/components/writing-flow/index.cjs.map +3 -3
  51. package/build/components/writing-flow/use-arrow-nav.cjs.map +1 -1
  52. package/build/components/writing-flow/use-input.cjs +12 -2
  53. package/build/components/writing-flow/use-input.cjs.map +2 -2
  54. package/build/components/writing-flow/use-tab-nav.cjs +84 -41
  55. package/build/components/writing-flow/use-tab-nav.cjs.map +3 -3
  56. package/build/components/{rich-text/event-listeners/undo-automatic-change.cjs → writing-flow/use-undo-automatic-change.cjs} +18 -15
  57. package/build/components/writing-flow/use-undo-automatic-change.cjs.map +7 -0
  58. package/build/hooks/border.cjs +2 -46
  59. package/build/hooks/border.cjs.map +2 -2
  60. package/build/hooks/generate-fields-from-attributes.cjs.map +1 -1
  61. package/build/hooks/index.cjs +0 -2
  62. package/build/hooks/index.cjs.map +3 -3
  63. package/build/hooks/style.cjs +2 -2
  64. package/build/hooks/style.cjs.map +2 -2
  65. package/build/layouts/flex.cjs +3 -0
  66. package/build/layouts/flex.cjs.map +2 -2
  67. package/build/store/actions.cjs +12 -9
  68. package/build/store/actions.cjs.map +3 -3
  69. package/build-module/components/background-image-control/index.mjs +18 -1
  70. package/build-module/components/background-image-control/index.mjs.map +2 -2
  71. package/build-module/components/block-allowed-blocks/modal.mjs +2 -2
  72. package/build-module/components/block-allowed-blocks/modal.mjs.map +2 -2
  73. package/build-module/components/block-edit/edit.mjs.map +1 -1
  74. package/build-module/components/block-inspector/index.mjs +3 -12
  75. package/build-module/components/block-inspector/index.mjs.map +2 -2
  76. package/build-module/components/block-list/use-block-props/use-is-hovered.mjs +17 -4
  77. package/build-module/components/block-list/use-block-props/use-is-hovered.mjs.map +2 -2
  78. package/build-module/components/block-preview/index.mjs +1 -2
  79. package/build-module/components/block-preview/index.mjs.map +2 -2
  80. package/build-module/components/block-switcher/index.mjs +2 -2
  81. package/build-module/components/block-switcher/index.mjs.map +2 -2
  82. package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs +3 -6
  83. package/build-module/components/block-toolbar/pattern-overrides-dropdown.mjs.map +2 -2
  84. package/build-module/components/global-styles/border-panel.mjs +19 -42
  85. package/build-module/components/global-styles/border-panel.mjs.map +2 -2
  86. package/build-module/components/global-styles/image-settings-panel.mjs.map +1 -1
  87. package/build-module/components/iframe/index.mjs.map +1 -1
  88. package/build-module/components/inserter/hooks/use-patterns-paging.mjs.map +1 -1
  89. package/build-module/components/inserter-draggable-blocks/index.mjs.map +1 -1
  90. package/build-module/components/inspector-controls-tabs/content-tab.mjs +3 -4
  91. package/build-module/components/inspector-controls-tabs/content-tab.mjs.map +2 -2
  92. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -3
  93. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  94. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +1 -2
  95. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
  96. package/build-module/components/inspector-popover-header/index.mjs +6 -7
  97. package/build-module/components/inspector-popover-header/index.mjs.map +2 -2
  98. package/build-module/components/link-control/index.mjs.map +2 -2
  99. package/build-module/components/link-control/search-input.mjs.map +1 -1
  100. package/build-module/components/list-view/block-select-button.mjs +9 -1
  101. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  102. package/build-module/components/list-view/block.mjs +2 -1
  103. package/build-module/components/list-view/block.mjs.map +2 -2
  104. package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +1 -1
  105. package/build-module/components/media-replace-flow/index.mjs +4 -1
  106. package/build-module/components/media-replace-flow/index.mjs.map +2 -2
  107. package/build-module/components/navigable-toolbar/index.mjs +3 -0
  108. package/build-module/components/navigable-toolbar/index.mjs.map +2 -2
  109. package/build-module/components/rich-text/event-listeners/enter.mjs +23 -11
  110. package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
  111. package/build-module/components/rich-text/event-listeners/index.mjs +0 -2
  112. package/build-module/components/rich-text/event-listeners/index.mjs.map +2 -2
  113. package/build-module/components/rich-text/event-listeners/input-rules.mjs +4 -2
  114. package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
  115. package/build-module/components/use-block-drop-zone/index.mjs.map +1 -1
  116. package/build-module/components/writing-flow/index.mjs +5 -0
  117. package/build-module/components/writing-flow/index.mjs.map +2 -2
  118. package/build-module/components/writing-flow/use-arrow-nav.mjs.map +1 -1
  119. package/build-module/components/writing-flow/use-input.mjs +12 -2
  120. package/build-module/components/writing-flow/use-input.mjs.map +2 -2
  121. package/build-module/components/writing-flow/use-tab-nav.mjs +86 -43
  122. package/build-module/components/writing-flow/use-tab-nav.mjs.map +3 -3
  123. package/build-module/components/writing-flow/use-undo-automatic-change.mjs +36 -0
  124. package/build-module/components/writing-flow/use-undo-automatic-change.mjs.map +7 -0
  125. package/build-module/hooks/border.mjs +1 -45
  126. package/build-module/hooks/border.mjs.map +2 -2
  127. package/build-module/hooks/generate-fields-from-attributes.mjs.map +1 -1
  128. package/build-module/hooks/index.mjs +0 -2
  129. package/build-module/hooks/index.mjs.map +2 -2
  130. package/build-module/hooks/style.mjs +3 -2
  131. package/build-module/hooks/style.mjs.map +2 -2
  132. package/build-module/layouts/flex.mjs +3 -0
  133. package/build-module/layouts/flex.mjs.map +2 -2
  134. package/build-module/store/actions.mjs +12 -9
  135. package/build-module/store/actions.mjs.map +2 -2
  136. package/build-style/content-rtl.css +9 -20
  137. package/build-style/content.css +9 -20
  138. package/build-style/style-rtl.css +100 -221
  139. package/build-style/style.css +100 -221
  140. package/package.json +42 -41
  141. package/src/autocompleters/test/block.js +1 -0
  142. package/src/components/alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +34 -16
  143. package/src/components/alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
  144. package/src/components/background-image-control/index.jsx +32 -1
  145. package/src/components/background-image-control/style.scss +5 -3
  146. package/src/components/background-image-control/test/{index.js → index.jsdom.test.js} +1 -0
  147. package/src/components/block-alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +68 -13
  148. package/src/components/block-alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
  149. package/src/components/block-allowed-blocks/modal.jsx +3 -3
  150. package/src/components/block-bindings/test/{use-block-bindings-utils.js → use-block-bindings-utils.jsdom.test.js} +2 -1
  151. package/src/components/block-breadcrumb/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +2 -2
  152. package/src/components/block-breadcrumb/test/{index.jsx → index.jsdom.test.jsx} +1 -0
  153. package/src/components/block-compare/test/__snapshots__/{block-view.jsx.snap → block-view.jsdom.test.jsx.snap} +2 -2
  154. package/src/components/block-compare/test/{block-view.jsx → block-view.jsdom.test.jsx} +1 -0
  155. package/src/components/block-controls/test/{index.jsx → index.jsdom.test.jsx} +1 -0
  156. package/src/components/block-edit/edit.jsx +1 -1
  157. package/src/components/block-edit/test/{edit.jsx → edit.jsdom.test.jsx} +1 -0
  158. package/src/components/block-icon/content.scss +0 -6
  159. package/src/components/block-icon/style.scss +0 -6
  160. package/src/components/block-icon/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +6 -2
  161. package/src/components/block-inspector/index.jsx +3 -11
  162. package/src/components/block-list/content.scss +4 -1
  163. package/src/components/block-list/use-block-props/use-is-hovered.js +24 -5
  164. package/src/components/block-manager/style.scss +2 -0
  165. package/src/components/block-mover/test/mover-description.js +1 -0
  166. package/src/components/block-preview/index.jsx +1 -2
  167. package/src/components/block-preview/test/{index.jsx → index.jsdom.test.jsx} +10 -6
  168. package/src/components/block-selection-clearer/test/{index.jsx → index.jsdom.test.jsx} +24 -19
  169. package/src/components/block-settings-menu/test/{block-mode-toggle.jsx → block-mode-toggle.jsdom.test.jsx} +5 -1
  170. package/src/components/block-styles/test/utils.js +1 -0
  171. package/src/components/block-switcher/index.jsx +3 -3
  172. package/src/components/block-switcher/test/{index.jsx → index.jsdom.test.jsx} +8 -4
  173. package/src/components/block-switcher/test/use-transformed.patterns.js +1 -0
  174. package/src/components/block-switcher/test/utils.js +1 -0
  175. package/src/components/block-title/test/{index.jsx → index.jsdom.test.jsx} +7 -3
  176. package/src/components/block-toolbar/pattern-overrides-dropdown.jsx +3 -6
  177. package/src/components/block-toolbar/style.scss +1 -1
  178. package/src/components/block-toolbar/test/{block-toolbar-icon.jsx → block-toolbar-icon.jsdom.test.jsx} +25 -21
  179. package/src/components/block-variation-picker/content.scss +5 -3
  180. package/src/components/block-vertical-alignment-control/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +55 -11
  181. package/src/components/block-vertical-alignment-control/test/{index.jsx → index.jsdom.test.jsx} +2 -1
  182. package/src/components/block-visibility/test/{use-block-visibility.js → use-block-visibility.jsdom.test.js} +6 -5
  183. package/src/components/block-visibility/test/utils.js +2 -1
  184. package/src/components/border-radius-control/test/{index.jsx → index.jsdom.test.jsx} +8 -1
  185. package/src/components/border-radius-control/test/utils.js +1 -0
  186. package/src/components/button-block-appender/content.scss +1 -1
  187. package/src/components/child-layout-control/test/{index.jsx → index.jsdom.test.jsx} +18 -15
  188. package/src/components/color-palette/test/{control.jsx → control.jsdom.test.jsx} +15 -4
  189. package/src/components/colors/test/utils.js +1 -0
  190. package/src/components/colors/test/{with-colors.jsx → with-colors.jsdom.test.jsx} +4 -3
  191. package/src/components/colors-gradients/test/{control.jsx → control.jsdom.test.jsx} +8 -3
  192. package/src/components/contrast-checker/test/{index.jsx → index.jsdom.test.jsx} +2 -1
  193. package/src/components/default-block-appender/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +4 -4
  194. package/src/components/default-block-appender/test/{index.jsx → index.jsdom.test.jsx} +8 -7
  195. package/src/components/dimensions-tool/test/{index.jsx → index.jsdom.test.jsx} +27 -22
  196. package/src/components/dimensions-tool/test/utils.js +1 -0
  197. package/src/components/duotone-control/test/{index.jsx → index.jsdom.test.jsx} +6 -3
  198. package/src/components/font-sizes/test/fluid-utils.js +1 -0
  199. package/src/components/font-sizes/test/utils.js +1 -0
  200. package/src/components/global-styles/border-panel.jsx +17 -40
  201. package/src/components/global-styles/image-settings-panel.jsx +1 -1
  202. package/src/components/global-styles/inheritance/test/{index.jsx → index.jsdom.test.jsx} +5 -2
  203. package/src/components/global-styles/test/{background-panel.jsx → background-panel.jsdom.test.jsx} +10 -5
  204. package/src/components/global-styles/test/{border-panel.jsx → border-panel.jsdom.test.jsx} +113 -13
  205. package/src/components/global-styles/test/{color-panel.jsx → color-panel.jsdom.test.jsx} +5 -0
  206. package/src/components/global-styles/test/{dimensions-panel.jsx → dimensions-panel.jsdom.test.jsx} +14 -14
  207. package/src/components/global-styles/test/{filters-panel.jsx → filters-panel.jsdom.test.jsx} +7 -4
  208. package/src/components/global-styles/test/{inherited-value-context-core.js → inherited-value-context-core.jsdom.test.js} +10 -9
  209. package/src/components/global-styles/test/{inherited-value-context.jsx → inherited-value-context.jsdom.test.jsx} +18 -17
  210. package/src/components/global-styles/test/{state-control-badges.jsx → state-control-badges.jsdom.test.jsx} +3 -2
  211. package/src/components/global-styles/test/{typography-panel-core.jsx → typography-panel-core.jsdom.test.jsx} +5 -2
  212. package/src/components/global-styles/test/{typography-panel.jsx → typography-panel.jsdom.test.jsx} +17 -12
  213. package/src/components/global-styles/test/typography-utils.js +1 -0
  214. package/src/components/global-styles/test/utils.js +1 -0
  215. package/src/components/grid/style.scss +0 -10
  216. package/src/components/iframe/index.jsx +3 -3
  217. package/src/components/image-editor/test/index.js +1 -0
  218. package/src/components/image-size-control/test/{index.jsx → index.jsdom.test.jsx} +8 -3
  219. package/src/components/inner-blocks/test/__snapshots__/index.jsdom.test.jsx.snap +15 -0
  220. package/src/components/inner-blocks/test/{index.jsx → index.jsdom.test.jsx} +2 -0
  221. package/src/components/inner-content/test/{index.jsx → index.jsdom.test.jsx} +1 -0
  222. package/src/components/inserter/hooks/use-patterns-paging.js +1 -1
  223. package/src/components/inserter/media-tab/test/{hooks.js → hooks.jsdom.test.js} +12 -11
  224. package/src/components/inserter/media-tab/test/{media-panel.jsx → media-panel.jsdom.test.jsx} +15 -12
  225. package/src/components/inserter/style.scss +2 -2
  226. package/src/components/inserter/test/get-appender-label.js +12 -11
  227. package/src/components/inserter/test/search-items.js +1 -0
  228. package/src/components/inserter-draggable-blocks/index.jsx +1 -1
  229. package/src/components/inserter-list-item/style.scss +1 -0
  230. package/src/components/inspector-controls-tabs/content-tab.jsx +7 -14
  231. package/src/components/inspector-controls-tabs/styles-tab.jsx +1 -4
  232. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -8
  233. package/src/components/inspector-popover-header/index.jsx +6 -7
  234. package/src/components/line-height-control/test/{index.jsx → index.jsdom.test.jsx} +3 -0
  235. package/src/components/link-control/index.jsx +3 -0
  236. package/src/components/link-control/search-input.jsx +1 -1
  237. package/src/components/link-control/style.scss +1 -1
  238. package/src/components/link-control/test/{index.jsx → index.jsdom.test.jsx} +52 -42
  239. package/src/components/link-control/test/is-url-like.js +1 -0
  240. package/src/components/link-control/test/{url-normalization.test.jsx → url-normalization.jsdom.test.jsx} +21 -20
  241. package/src/components/link-picker/test/{index.jsx → index.jsdom.test.jsx} +31 -30
  242. package/src/components/list-view/block-select-button.jsx +6 -1
  243. package/src/components/list-view/block.jsx +6 -4
  244. package/src/components/list-view/style.scss +55 -35
  245. package/src/components/list-view/test/use-list-view-drop-zone.js +1 -0
  246. package/src/components/list-view/test/utils.js +1 -0
  247. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  248. package/src/components/media-placeholder/test/get-computed-accept-attribute.js +1 -0
  249. package/src/components/media-placeholder/test/{index.jsx → index.jsdom.test.jsx} +8 -2
  250. package/src/components/media-replace-flow/index.jsx +6 -1
  251. package/src/components/media-replace-flow/test/{index.jsx → index.jsdom.test.jsx} +3 -0
  252. package/src/components/navigable-toolbar/index.jsx +4 -0
  253. package/src/components/navigable-toolbar/test/index.browser.test.js +50 -0
  254. package/src/components/panel-color-settings/test/{index.jsx → index.jsdom.test.jsx} +3 -0
  255. package/src/components/preset-input-control/test/{index.jsx → index.jsdom.test.jsx} +8 -2
  256. package/src/components/preset-input-control/test/utils.js +1 -0
  257. package/src/components/provider/test/{experimental-provider.jsx → experimental-provider.jsdom.test.jsx} +3 -2
  258. package/src/components/provider/test/{use-block-sync.jsx → use-block-sync.jsdom.test.jsx} +45 -44
  259. package/src/components/recursion-provider/test/{index.jsx → index.jsdom.test.jsx} +1 -0
  260. package/src/components/responsive-block-control/style.scss +1 -0
  261. package/src/components/responsive-block-control/test/{index.jsx → index.jsdom.test.jsx} +6 -3
  262. package/src/components/rich-text/event-listeners/enter.js +29 -14
  263. package/src/components/rich-text/event-listeners/index.js +0 -2
  264. package/src/components/rich-text/event-listeners/input-rules.js +7 -2
  265. package/src/components/spacing-sizes-control/test/{index.jsx → index.jsdom.test.jsx} +23 -20
  266. package/src/components/spacing-sizes-control/test/utils.js +1 -0
  267. package/src/components/url-input/test/{button.jsx → button.jsdom.test.jsx} +4 -1
  268. package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +2 -0
  269. package/src/components/url-input/test/{index.jsx → index.jsdom.test.jsx} +23 -13
  270. package/src/components/use-block-display-information/test/{index.jsx → index.jsdom.test.jsx} +14 -10
  271. package/src/components/use-block-drop-zone/index.js +2 -2
  272. package/src/components/use-block-drop-zone/test/index.js +1 -0
  273. package/src/components/use-on-block-drop/test/index.js +28 -31
  274. package/src/components/warning/test/__snapshots__/{index.jsx.snap → index.jsdom.test.jsx.snap} +2 -2
  275. package/src/components/warning/test/{index.jsx → index.jsdom.test.jsx} +1 -0
  276. package/src/components/writing-flow/index.jsx +5 -0
  277. package/src/components/writing-flow/style.scss +48 -0
  278. package/src/components/writing-flow/test/{index.js → index.jsdom.test.js} +1 -0
  279. package/src/components/writing-flow/use-arrow-nav.js +2 -2
  280. package/src/components/writing-flow/use-input.js +29 -2
  281. package/src/components/writing-flow/use-tab-nav.jsx +155 -70
  282. package/src/components/writing-flow/use-undo-automatic-change.js +40 -0
  283. package/src/elements/test/{index.js → index.jsdom.test.js} +1 -0
  284. package/src/hooks/border.jsx +0 -53
  285. package/src/hooks/generate-fields-from-attributes.js +1 -1
  286. package/src/hooks/index.js +0 -2
  287. package/src/hooks/style.jsx +3 -2
  288. package/src/hooks/test/{align.jsx → align.jsdom.test.jsx} +1 -0
  289. package/src/hooks/test/allowed-blocks.js +1 -0
  290. package/src/hooks/test/{anchor.js → anchor.jsdom.test.js} +1 -0
  291. package/src/hooks/test/{auto-inspector-controls.js → auto-inspector-controls.jsdom.test.js} +1 -0
  292. package/src/hooks/test/{background.jsx → background.jsdom.test.jsx} +5 -2
  293. package/src/hooks/test/{block-style-state.js → block-style-state.jsdom.test.js} +4 -3
  294. package/src/hooks/test/{cross-origin-isolation.js → cross-origin-isolation.jsdom.test.js} +18 -25
  295. package/src/hooks/test/{custom-class-name.jsx → custom-class-name.jsdom.test.jsx} +1 -0
  296. package/src/hooks/test/{dimensions.js → dimensions.jsdom.test.js} +1 -0
  297. package/src/hooks/test/{duotone.js → duotone.jsdom.test.js} +1 -0
  298. package/src/hooks/test/{font-size.js → font-size.jsdom.test.js} +1 -0
  299. package/src/hooks/test/gap.js +1 -0
  300. package/src/hooks/test/generate-fields-from-attributes.js +1 -0
  301. package/src/hooks/test/generated-class-name.js +1 -0
  302. package/src/hooks/test/{inherited-value-wiring.jsx → inherited-value-wiring.jsdom.test.jsx} +49 -51
  303. package/src/hooks/test/{layout-child.js → layout-child.jsdom.test.js} +1 -0
  304. package/src/hooks/test/{layout.js → layout.jsdom.test.js} +1 -0
  305. package/src/hooks/test/metadata.js +1 -0
  306. package/src/hooks/test/preset-round-trip.js +2 -0
  307. package/src/hooks/test/settings.jsx +1 -0
  308. package/src/hooks/test/state-utils.js +1 -0
  309. package/src/hooks/test/{style.jsx → style.jsdom.test.jsx} +1 -0
  310. package/src/hooks/test/{text-align.jsx → text-align.jsdom.test.jsx} +1 -0
  311. package/src/hooks/test/{use-typography-props.js → use-typography-props.jsdom.test.js} +1 -0
  312. package/src/hooks/test/{utils.js → utils.jsdom.test.js} +1 -0
  313. package/src/layouts/flex.jsx +7 -0
  314. package/src/layouts/test/{constrained.jsx → constrained.jsdom.test.jsx} +6 -3
  315. package/src/layouts/test/{flex.jsx → flex.jsdom.test.jsx} +52 -2
  316. package/src/layouts/test/{flow.js → flow.jsdom.test.js} +1 -0
  317. package/src/layouts/test/{grid.jsx → grid.jsdom.test.jsx} +5 -2
  318. package/src/layouts/test/utils.js +1 -0
  319. package/src/store/actions.js +14 -12
  320. package/src/store/test/{actions.js → actions.jsdom.test.js} +50 -49
  321. package/src/store/test/array.js +1 -0
  322. package/src/store/test/get-block-settings.js +1 -0
  323. package/src/store/test/performance.js +2 -1
  324. package/src/store/test/private-actions.js +1 -0
  325. package/src/store/test/private-selectors.js +13 -3
  326. package/src/store/test/reducer.js +37 -8
  327. package/src/store/test/{registry-selectors.js → registry-selectors.jsdom.test.js} +9 -0
  328. package/src/store/test/{selectors.jsx → selectors.jsdom.test.jsx} +13 -3
  329. package/src/style.scss +1 -1
  330. package/src/utils/test/block-bindings.js +1 -0
  331. package/src/utils/test/color-values.js +1 -0
  332. package/src/utils/test/{dom.jsx → dom.jsdom.test.jsx} +38 -43
  333. package/src/utils/test/format-font-style.js +1 -0
  334. package/src/utils/test/format-font-weight.js +1 -0
  335. package/src/utils/test/get-font-styles-and-weights.js +1 -0
  336. package/src/utils/test/math.js +1 -0
  337. package/src/utils/test/object.js +1 -0
  338. package/src/utils/test/pasting.js +1 -0
  339. package/src/utils/test/selection.js +1 -0
  340. package/src/utils/test/sorting.js +1 -0
  341. package/src/utils/test/transform-styles.js +2 -1
  342. package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +0 -7
  343. package/build/hooks/block-fields/fields-dropdown-menu.cjs +0 -67
  344. package/build/hooks/block-fields/fields-dropdown-menu.cjs.map +0 -7
  345. package/build/hooks/block-fields/index.cjs +0 -238
  346. package/build/hooks/block-fields/index.cjs.map +0 -7
  347. package/build/hooks/block-fields/link/index.cjs +0 -174
  348. package/build/hooks/block-fields/link/index.cjs.map +0 -7
  349. package/build/hooks/block-fields/media/index.cjs +0 -262
  350. package/build/hooks/block-fields/media/index.cjs.map +0 -7
  351. package/build/hooks/block-fields/rich-text/index.cjs +0 -146
  352. package/build/hooks/block-fields/rich-text/index.cjs.map +0 -7
  353. package/build/hooks/block-fields/use-inspector-popover-placement.cjs +0 -41
  354. package/build/hooks/block-fields/use-inspector-popover-placement.cjs.map +0 -7
  355. package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +0 -33
  356. package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +0 -7
  357. package/build-module/hooks/block-fields/fields-dropdown-menu.mjs +0 -46
  358. package/build-module/hooks/block-fields/fields-dropdown-menu.mjs.map +0 -7
  359. package/build-module/hooks/block-fields/index.mjs +0 -210
  360. package/build-module/hooks/block-fields/index.mjs.map +0 -7
  361. package/build-module/hooks/block-fields/link/index.mjs +0 -141
  362. package/build-module/hooks/block-fields/link/index.mjs.map +0 -7
  363. package/build-module/hooks/block-fields/media/index.mjs +0 -241
  364. package/build-module/hooks/block-fields/media/index.mjs.map +0 -7
  365. package/build-module/hooks/block-fields/rich-text/index.mjs +0 -115
  366. package/build-module/hooks/block-fields/rich-text/index.mjs.map +0 -7
  367. package/build-module/hooks/block-fields/use-inspector-popover-placement.mjs +0 -16
  368. package/build-module/hooks/block-fields/use-inspector-popover-placement.mjs.map +0 -7
  369. package/src/components/color-palette/test/__snapshots__/control.jsx.snap +0 -143
  370. package/src/components/inner-blocks/test/__snapshots__/index.jsx.snap +0 -15
  371. package/src/components/rich-text/event-listeners/undo-automatic-change.js +0 -39
  372. package/src/hooks/block-fields/fields-dropdown-menu.jsx +0 -47
  373. package/src/hooks/block-fields/index.jsx +0 -302
  374. package/src/hooks/block-fields/link/index.jsx +0 -155
  375. package/src/hooks/block-fields/link/styles.scss +0 -18
  376. package/src/hooks/block-fields/media/index.jsx +0 -269
  377. package/src/hooks/block-fields/media/styles.scss +0 -77
  378. package/src/hooks/block-fields/rich-text/index.jsx +0 -123
  379. package/src/hooks/block-fields/rich-text/styles.scss +0 -24
  380. package/src/hooks/block-fields/styles.scss +0 -33
  381. package/src/hooks/block-fields/use-inspector-popover-placement.js +0 -16
  382. /package/src/components/block-icon/test/{index.jsx → index.jsdom.test.jsx} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/block-preview/index.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { useDisabled, useMergeRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport { ExperimentalBlockEditorProvider } from '../provider';\nimport AutoHeightBlockPreview from './auto';\nimport EditorStyles from '../editor-styles';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockListItems } from '../block-list';\nimport { Async } from './async';\n\nconst EMPTY_ADDITIONAL_STYLES = [];\n\nexport function BlockPreview( {\n\tblocks,\n\tviewportWidth = 1200,\n\tminHeight,\n\tadditionalStyles = EMPTY_ADDITIONAL_STYLES,\n\t// Deprecated props:\n\t__experimentalMinHeight,\n\t__experimentalPadding,\n} ) {\n\tif ( __experimentalMinHeight ) {\n\t\tminHeight = __experimentalMinHeight;\n\t\tdeprecated( 'The __experimentalMinHeight prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'minHeight',\n\t\t} );\n\t}\n\tif ( __experimentalPadding ) {\n\t\tadditionalStyles = [\n\t\t\t...additionalStyles,\n\t\t\t{ css: `body { padding: ${ __experimentalPadding }px; }` },\n\t\t];\n\t\tdeprecated( 'The __experimentalPadding prop of BlockPreview', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'additionalStyles',\n\t\t} );\n\t}\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tif ( ! blocks || blocks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<AutoHeightBlockPreview\n\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t/>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\nconst MemoizedBlockPreview = memo( BlockPreview );\n\nMemoizedBlockPreview.Async = Async;\n\n/**\n * BlockPreview renders a preview of a block or array of blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md\n *\n * @param {Object} preview options for how the preview should be shown\n * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.\n * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.\n *\n * @return {Component} The component to be rendered.\n */\nexport default MemoizedBlockPreview;\n\n/**\n * This hook is used to lightly mark an element as a block preview wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * a block preview wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} options Preview options.\n * @param {WPBlock[]} options.blocks Block objects.\n * @param {Object} options.props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options.layout Layout settings to be used in the preview.\n */\nexport function useBlockPreview( { blocks, props = {}, layout } ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst disabledRef = useDisabled();\n\tconst ref = useMergeRefs( [ props.ref, disabledRef ] );\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst children = (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<EditorStyles />\n\t\t\t<BlockListItems renderAppender={ false } layout={ layout } />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-preview__live-content',\n\t\t\t'components-disabled'\n\t\t),\n\t\tchildren: blocks?.length ? children : null,\n\t};\n}\n"],
5
- "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,MAAM,eAAe;AAC9B,OAAO,gBAAgB;AACvB,SAAS,uCAAuC;AAChD,OAAO,4BAA4B;AACnC,OAAO,kBAAkB;AACzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AA0DnB,cA8DD,YA9DC;AAxDH,IAAM,0BAA0B,CAAC;AAE1B,SAAS,aAAc;AAAA,EAC7B;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,mBAAmB;AAAA;AAAA,EAEnB;AAAA,EACA;AACD,GAAI;AACH,MAAK,yBAA0B;AAC9B,gBAAY;AACZ,eAAY,oCAAoC;AAAA,MAC/C,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AACA,MAAK,uBAAwB;AAC5B,uBAAmB;AAAA,MAClB,GAAG;AAAA,MACH,EAAE,KAAK,mBAAoB,qBAAsB,QAAQ;AAAA,IAC1D;AACA,eAAY,kDAAkD;AAAA,MAC7D,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AAEA,QAAM,mBAAmB;AAAA,IACxB,CAAE,WAAY,OAAQ,gBAAiB,EAAE,YAAY;AAAA,IACrD,CAAC;AAAA,EACF;AACA,QAAM,WAAW;AAAA,IAChB,OAAQ;AAAA,MACP,GAAG;AAAA,MACH,eAAe;AAAA,IAChB;AAAA,IACA,CAAE,gBAAiB;AAAA,EACpB;AACA,QAAM,iBAAiB;AAAA,IACtB,MAAQ,MAAM,QAAS,MAAO,IAAI,SAAS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eRefs } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { memo, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\nimport { ExperimentalBlockEditorProvider } from '../provider';\nimport AutoHeightBlockPreview from './auto';\nimport EditorStyles from '../editor-styles';\nimport { store as blockEditorStore } from '../../store';\nimport { BlockListItems } from '../block-list';\nimport { Async } from './async';\n\nconst EMPTY_ADDITIONAL_STYLES = [];\n\nexport function BlockPreview( {\n\tblocks,\n\tviewportWidth = 1200,\n\tminHeight,\n\tadditionalStyles = EMPTY_ADDITIONAL_STYLES,\n\t// Deprecated props:\n\t__experimentalMinHeight,\n\t__experimentalPadding,\n} ) {\n\tif ( __experimentalMinHeight ) {\n\t\tminHeight = __experimentalMinHeight;\n\t\tdeprecated( 'The __experimentalMinHeight prop', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'minHeight',\n\t\t} );\n\t}\n\tif ( __experimentalPadding ) {\n\t\tadditionalStyles = [\n\t\t\t...additionalStyles,\n\t\t\t{ css: `body { padding: ${ __experimentalPadding }px; }` },\n\t\t];\n\t\tdeprecated( 'The __experimentalPadding prop of BlockPreview', {\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t\talternative: 'additionalStyles',\n\t\t} );\n\t}\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tif ( ! blocks || blocks.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<AutoHeightBlockPreview\n\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\tminHeight={ minHeight }\n\t\t\t\tadditionalStyles={ additionalStyles }\n\t\t\t/>\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n\nconst MemoizedBlockPreview = memo( BlockPreview );\n\nMemoizedBlockPreview.Async = Async;\n\n/**\n * BlockPreview renders a preview of a block or array of blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-preview/README.md\n *\n * @param {Object} preview options for how the preview should be shown\n * @param {Array|Object} preview.blocks A block instance (object) or an array of blocks to be previewed.\n * @param {number} preview.viewportWidth Width of the preview container in pixels. Controls at what size the blocks will be rendered inside the preview. Default: 700.\n *\n * @return {Component} The component to be rendered.\n */\nexport default MemoizedBlockPreview;\n\n/**\n * This hook is used to lightly mark an element as a block preview wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * a block preview wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} options Preview options.\n * @param {WPBlock[]} options.blocks Block objects.\n * @param {Object} options.props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options.layout Layout settings to be used in the preview.\n */\nexport function useBlockPreview( { blocks, props = {}, layout } ) {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tstyles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.\n\t\t\tisPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\tconst disabledRef = useDisabled();\n\tconst ref = useMergeRefs( [ props.ref, disabledRef ] );\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst children = (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ renderedBlocks }\n\t\t\tsettings={ settings }\n\t\t>\n\t\t\t<EditorStyles />\n\t\t\t<BlockListItems renderAppender={ false } layout={ layout } />\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: clsx(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-preview__live-content'\n\t\t),\n\t\tchildren: blocks?.length ? children : null,\n\t};\n}\n"],
5
+ "mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,iBAAiB;AAC1B,SAAS,MAAM,eAAe;AAC9B,OAAO,gBAAgB;AACvB,SAAS,uCAAuC;AAChD,OAAO,4BAA4B;AACnC,OAAO,kBAAkB;AACzB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AA0DnB,cA8DD,YA9DC;AAxDH,IAAM,0BAA0B,CAAC;AAE1B,SAAS,aAAc;AAAA,EAC7B;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,mBAAmB;AAAA;AAAA,EAEnB;AAAA,EACA;AACD,GAAI;AACH,MAAK,yBAA0B;AAC9B,gBAAY;AACZ,eAAY,oCAAoC;AAAA,MAC/C,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AACA,MAAK,uBAAwB;AAC5B,uBAAmB;AAAA,MAClB,GAAG;AAAA,MACH,EAAE,KAAK,mBAAoB,qBAAsB,QAAQ;AAAA,IAC1D;AACA,eAAY,kDAAkD;AAAA,MAC7D,OAAO;AAAA,MACP,SAAS;AAAA,MACT,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AAEA,QAAM,mBAAmB;AAAA,IACxB,CAAE,WAAY,OAAQ,gBAAiB,EAAE,YAAY;AAAA,IACrD,CAAC;AAAA,EACF;AACA,QAAM,W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,IACH;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,MACN;AAAA,IACD;AAAA,IACA,UAAU,QAAQ,SAAS,WAAW;AAAA,EACvC;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,10 @@
1
1
  // packages/block-editor/src/components/block-switcher/index.jsx
2
2
  import { __, _n, sprintf, _x } from "@wordpress/i18n";
3
+ import { Text } from "@wordpress/ui";
3
4
  import {
4
5
  DropdownMenu,
5
6
  ToolbarGroup,
6
7
  ToolbarItem,
7
- __experimentalText as WCText,
8
8
  MenuGroup
9
9
  } from "@wordpress/components";
10
10
  import {
@@ -146,7 +146,7 @@ function BlockSwitcherDropdownMenuContents({ onClose, clientIds }) {
146
146
  onSwitch: onClose
147
147
  }
148
148
  ),
149
- isUsingBindings && /* @__PURE__ */ jsx(MenuGroup, { children: /* @__PURE__ */ jsx(WCText, { className: "block-editor-block-switcher__binding-indicator", children: connectedBlockDescription }) })
149
+ isUsingBindings && /* @__PURE__ */ jsx(MenuGroup, { children: /* @__PURE__ */ jsx(Text, { className: "block-editor-block-switcher__binding-indicator", children: connectedBlockDescription }) })
150
150
  ] });
151
151
  }
152
152
  var BlockSwitcher = ({ children, clientIds, label, text }) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/block-switcher/index.jsx"],
4
- "sourcesContent": ["import { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tToolbarGroup,\n\tToolbarItem,\n\t__experimentalText as WCText,\n\tMenuGroup,\n} from '@wordpress/components';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '../../store';\nimport BlockTransformationsMenu from './block-transformations-menu';\nimport { useBlockVariationTransforms } from './block-variation-transformations';\nimport BlockStylesMenu from './block-styles-menu';\nimport PatternTransformationsMenu from './pattern-transformations-menu';\n\nfunction BlockSwitcherDropdownMenuContents( { onClose, clientIds } ) {\n\tconst { replaceBlocks, multiSelect, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tpossibleBlockTransformations,\n\t\tpatterns,\n\t\tblocks,\n\t\tisUsingBindings,\n\t\tcanRemove,\n\t\thasBlockStyles,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockTransformItems,\n\t\t\t\t__experimentalGetPatternTransformItems,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t\tgetBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\tconst _isSingleBlock = clientIds.length === 1;\n\t\t\tconst _blockName = _isSingleBlock && getBlockName( clientIds[ 0 ] );\n\t\t\tconst _hasBlockStyles =\n\t\t\t\t_isSingleBlock && !! getBlockStyles( _blockName )?.length;\n\t\t\treturn {\n\t\t\t\tblocks: _blocks,\n\t\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\t\t_blocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpatterns: __experimentalGetPatternTransformItems(\n\t\t\t\t\t_blocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tisUsingBindings: clientIds.every(\n\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t\t\t),\n\t\t\t\tcanRemove: canRemoveBlocks( clientIds ),\n\t\t\t\thasBlockStyles: _hasBlockStyles,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\tconst blockVariationTransformations = useBlockVariationTransforms( {\n\t\tclientIds,\n\t\tblocks,\n\t} );\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\t// Simple block transformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name, variationName ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name, variationName );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\tfunction onBlockVariationTransform( name ) {\n\t\tupdateBlockAttributes( blocks[ 0 ].clientId, {\n\t\t\t...blockVariationTransformations.find(\n\t\t\t\t( { name: variationName } ) => variationName === name\n\t\t\t).attributes,\n\t\t} );\n\t}\n\t// Pattern transformation through the `Patterns` API.\n\tfunction onPatternTransform( transformedBlocks ) {\n\t\treplaceBlocks( clientIds, transformedBlocks );\n\t\tselectForMultipleBlocks( transformedBlocks );\n\t}\n\n\t/**\n\t * The `isSynced` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst isSingleBlock = blocks.length === 1;\n\tconst isSynced =\n\t\tisSingleBlock &&\n\t\t( isTemplatePart( blocks[ 0 ] ) || isReusableBlock( blocks[ 0 ] ) );\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations?.length && canRemove && ! isSynced;\n\tconst hasPossibleBlockVariationTransformations =\n\t\t!! blockVariationTransformations?.length;\n\tconst hasPatternTransformation = !! patterns?.length && canRemove;\n\tconst hasBlockOrBlockVariationTransforms =\n\t\thasPossibleBlockTransformations ||\n\t\thasPossibleBlockVariationTransformations;\n\tconst hasContents =\n\t\thasBlockStyles ||\n\t\thasBlockOrBlockVariationTransforms ||\n\t\thasPatternTransformation;\n\tif ( ! hasContents ) {\n\t\treturn (\n\t\t\t<p className=\"block-editor-block-switcher__no-transforms\">\n\t\t\t\t{ __( 'No transforms.' ) }\n\t\t\t</p>\n\t\t);\n\t}\n\n\tconst connectedBlockDescription = isSingleBlock\n\t\t? _x(\n\t\t\t\t'This block is connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t )\n\t\t: _x(\n\t\t\t\t'These blocks are connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t );\n\n\treturn (\n\t\t<div className=\"block-editor-block-switcher__container\">\n\t\t\t{ hasPatternTransformation && (\n\t\t\t\t<PatternTransformationsMenu\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\tonSelect={ ( transformedBlocks ) => {\n\t\t\t\t\t\tonPatternTransform( transformedBlocks );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockOrBlockVariationTransforms && (\n\t\t\t\t<BlockTransformationsMenu\n\t\t\t\t\tclassName=\"block-editor-block-switcher__transforms__menugroup\"\n\t\t\t\t\tpossibleBlockTransformations={\n\t\t\t\t\t\tpossibleBlockTransformations\n\t\t\t\t\t}\n\t\t\t\t\tpossibleBlockVariationTransformations={\n\t\t\t\t\t\tblockVariationTransformations\n\t\t\t\t\t}\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tonSelect={ ( name, variationName ) => {\n\t\t\t\t\t\tonBlockTransform( name, variationName );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t\tonSelectVariation={ ( name ) => {\n\t\t\t\t\t\tonBlockVariationTransform( name );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockStyles && (\n\t\t\t\t<BlockStylesMenu\n\t\t\t\t\thoveredBlock={ blocks[ 0 ] }\n\t\t\t\t\tonSwitch={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isUsingBindings && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<WCText className=\"block-editor-block-switcher__binding-indicator\">\n\t\t\t\t\t\t{ connectedBlockDescription }\n\t\t\t\t\t</WCText>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const BlockSwitcher = ( { children, clientIds, label, text } ) => {\n\tconst isSingleBlock = clientIds.length === 1;\n\n\tconst blockSwitcherDescription = isSingleBlock\n\t\t? __( 'Change block type or style' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'Change type of %d block',\n\t\t\t\t\t'Change type of %d blocks',\n\t\t\t\t\tclientIds.length\n\t\t\t\t),\n\t\t\t\tclientIds.length\n\t\t );\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\tclassName=\"block-editor-block-switcher\"\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\t\tclassName: 'block-editor-block-switcher__popover',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ children }\n\t\t\t\t\t\ttext={ text }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tdescription: blockSwitcherDescription,\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmenuProps={ { orientation: 'both' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<BlockSwitcherDropdownMenuContents\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n};\n\nexport default B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C;AAAA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA;AAAA,EAEF,GAEF,GACD;AAEF;AAEA,IAAO,yBAAQ;",
4
+ "sourcesContent": ["import { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport { Text } from '@wordpress/ui';\nimport {\n\tDropdownMenu,\n\tToolbarGroup,\n\tToolbarItem,\n\tMenuGroup,\n} from '@wordpress/components';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '../../store';\nimport BlockTransformationsMenu from './block-transformations-menu';\nimport { useBlockVariationTransforms } from './block-variation-transformations';\nimport BlockStylesMenu from './block-styles-menu';\nimport PatternTransformationsMenu from './pattern-transformations-menu';\n\nfunction BlockSwitcherDropdownMenuContents( { onClose, clientIds } ) {\n\tconst { replaceBlocks, multiSelect, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\tconst {\n\t\tpossibleBlockTransformations,\n\t\tpatterns,\n\t\tblocks,\n\t\tisUsingBindings,\n\t\tcanRemove,\n\t\thasBlockStyles,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockTransformItems,\n\t\t\t\t__experimentalGetPatternTransformItems,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t\tgetBlockName,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\tconst _blocks = getBlocksByClientId( clientIds );\n\t\t\tconst _isSingleBlock = clientIds.length === 1;\n\t\t\tconst _blockName = _isSingleBlock && getBlockName( clientIds[ 0 ] );\n\t\t\tconst _hasBlockStyles =\n\t\t\t\t_isSingleBlock && !! getBlockStyles( _blockName )?.length;\n\t\t\treturn {\n\t\t\t\tblocks: _blocks,\n\t\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\t\t_blocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpatterns: __experimentalGetPatternTransformItems(\n\t\t\t\t\t_blocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tisUsingBindings: clientIds.every(\n\t\t\t\t\t( clientId ) =>\n\t\t\t\t\t\t!! getBlockAttributes( clientId )?.metadata?.bindings\n\t\t\t\t),\n\t\t\t\tcanRemove: canRemoveBlocks( clientIds ),\n\t\t\t\thasBlockStyles: _hasBlockStyles,\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\tconst blockVariationTransformations = useBlockVariationTransforms( {\n\t\tclientIds,\n\t\tblocks,\n\t} );\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\t// Simple block transformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name, variationName ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name, variationName );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\tfunction onBlockVariationTransform( name ) {\n\t\tupdateBlockAttributes( blocks[ 0 ].clientId, {\n\t\t\t...blockVariationTransformations.find(\n\t\t\t\t( { name: variationName } ) => variationName === name\n\t\t\t).attributes,\n\t\t} );\n\t}\n\t// Pattern transformation through the `Patterns` API.\n\tfunction onPatternTransform( transformedBlocks ) {\n\t\treplaceBlocks( clientIds, transformedBlocks );\n\t\tselectForMultipleBlocks( transformedBlocks );\n\t}\n\n\t/**\n\t * The `isSynced` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst isSingleBlock = blocks.length === 1;\n\tconst isSynced =\n\t\tisSingleBlock &&\n\t\t( isTemplatePart( blocks[ 0 ] ) || isReusableBlock( blocks[ 0 ] ) );\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations?.length && canRemove && ! isSynced;\n\tconst hasPossibleBlockVariationTransformations =\n\t\t!! blockVariationTransformations?.length;\n\tconst hasPatternTransformation = !! patterns?.length && canRemove;\n\tconst hasBlockOrBlockVariationTransforms =\n\t\thasPossibleBlockTransformations ||\n\t\thasPossibleBlockVariationTransformations;\n\tconst hasContents =\n\t\thasBlockStyles ||\n\t\thasBlockOrBlockVariationTransforms ||\n\t\thasPatternTransformation;\n\tif ( ! hasContents ) {\n\t\treturn (\n\t\t\t<p className=\"block-editor-block-switcher__no-transforms\">\n\t\t\t\t{ __( 'No transforms.' ) }\n\t\t\t</p>\n\t\t);\n\t}\n\n\tconst connectedBlockDescription = isSingleBlock\n\t\t? _x(\n\t\t\t\t'This block is connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t )\n\t\t: _x(\n\t\t\t\t'These blocks are connected.',\n\t\t\t\t'block toolbar button label and description'\n\t\t );\n\n\treturn (\n\t\t<div className=\"block-editor-block-switcher__container\">\n\t\t\t{ hasPatternTransformation && (\n\t\t\t\t<PatternTransformationsMenu\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\tonSelect={ ( transformedBlocks ) => {\n\t\t\t\t\t\tonPatternTransform( transformedBlocks );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockOrBlockVariationTransforms && (\n\t\t\t\t<BlockTransformationsMenu\n\t\t\t\t\tclassName=\"block-editor-block-switcher__transforms__menugroup\"\n\t\t\t\t\tpossibleBlockTransformations={\n\t\t\t\t\t\tpossibleBlockTransformations\n\t\t\t\t\t}\n\t\t\t\t\tpossibleBlockVariationTransformations={\n\t\t\t\t\t\tblockVariationTransformations\n\t\t\t\t\t}\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tonSelect={ ( name, variationName ) => {\n\t\t\t\t\t\tonBlockTransform( name, variationName );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t\tonSelectVariation={ ( name ) => {\n\t\t\t\t\t\tonBlockVariationTransform( name );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBlockStyles && (\n\t\t\t\t<BlockStylesMenu\n\t\t\t\t\thoveredBlock={ blocks[ 0 ] }\n\t\t\t\t\tonSwitch={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isUsingBindings && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<Text className=\"block-editor-block-switcher__binding-indicator\">\n\t\t\t\t\t\t{ connectedBlockDescription }\n\t\t\t\t\t</Text>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport const BlockSwitcher = ( { children, clientIds, label, text } ) => {\n\tconst isSingleBlock = clientIds.length === 1;\n\n\tconst blockSwitcherDescription = isSingleBlock\n\t\t? __( 'Change block type or style' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'Change type of %d block',\n\t\t\t\t\t'Change type of %d blocks',\n\t\t\t\t\tclientIds.length\n\t\t\t\t),\n\t\t\t\tclientIds.length\n\t\t );\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\tclassName=\"block-editor-block-switcher\"\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\t\tclassName: 'block-editor-block-switcher__popover',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={ children }\n\t\t\t\t\t\ttext={ text }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tdescription: blockSwitcherDescription,\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmenuProps={ { orientation: 'both' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<BlockSwitcherDropdownMenuContents\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n};\n\nexport default BlockSwitcher;\n"],
5
+ "mappings": ";AAAA,SAAS,IAAI,IAAI,SAAS,UAAU;AACpC,SAAS,YAAY;AACrB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,OACM;AACP,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,wBAAwB;AAC1C,OAAO,8BAA8B;AACrC,SAAS,mCAAmC;AAC5C,OAAO,qBAAqB;AAC5B,OAAO,gCAAgC;AAwGpC,cAiBD,YAjBC;AAtGH,SAAS,kCAAmC,EAAE,SAAS,UAAU,GAAI;AACpE,QAAM,EAAE,eAAe,aAAa,sBAAsB,IACzD,YAAa,gBAAiB;AAC/B,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAAA,IACH,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,gBAAiB;AAC7B,YAAM,EAAE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xE,QAAM,gBAAgB,UAAU,WAAW;AAE3C,QAAM,2BAA2B,gBAC9B,GAAI,4BAA6B,IACjC;AAAA;AAAA,IAEA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,EACV;AACH,SACC,oBAAC,gBACA,8BAAC,eACE,WAAE,gBACH;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV;AAAA,MACA,cAAe;AAAA,QACd,WAAW;AAAA,QACX,WAAW;AAAA,MACZ;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA,aAAc;AAAA,QACb,aAAa;AAAA,QACb,GAAG;AAAA,MACJ;AAAA,MACA,WAAY,EAAE,aAAa,OAAO;AAAA,MAEhC,WAAE,EAAE,QAAQ,MACb;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA;AAAA,EAEF,GAEF,GACD;AAEF;AAEA,IAAO,yBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,9 +1,6 @@
1
1
  // packages/block-editor/src/components/block-toolbar/pattern-overrides-dropdown.jsx
2
- import {
3
- Popover,
4
- ToolbarButton,
5
- __experimentalText as WCText
6
- } from "@wordpress/components";
2
+ import { Popover, ToolbarButton } from "@wordpress/components";
3
+ import { Text } from "@wordpress/ui";
7
4
  import { __, sprintf } from "@wordpress/i18n";
8
5
  import { useState, useRef } from "@wordpress/element";
9
6
  import { useSelect } from "@wordpress/data";
@@ -29,7 +26,7 @@ function PatternOverridesPopoverContent({ clientIds, blockTitle }) {
29
26
  } else {
30
27
  description = __("These blocks are editable using overrides.");
31
28
  }
32
- return /* @__PURE__ */ jsx(WCText, { children: description });
29
+ return /* @__PURE__ */ jsx(Text, { children: description });
33
30
  }
34
31
  function PatternOverridesDropdown({
35
32
  icon,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/block-toolbar/pattern-overrides-dropdown.jsx"],
4
- "sourcesContent": ["import {\n\tPopover,\n\tToolbarButton,\n\t__experimentalText as WCText,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Renders the content of the pattern overrides popover.\n * Only mounts when the popover is opened.\n *\n * @param {Object} props Component props.\n * @param {Array} props.clientIds The client IDs of selected blocks.\n * @param {string} props.blockTitle The display title of the block.\n * @return {React.JSX.Element} The popover content.\n */\nfunction PatternOverridesPopoverContent( { clientIds, blockTitle } ) {\n\tconst blockMetaName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes } = select( blockEditorStore );\n\t\t\treturn getBlockAttributes( clientIds?.[ 0 ] )?.metadata?.name;\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst isSingleBlock = clientIds.length === 1;\n\n\t// Pattern overrides description\n\tlet description;\n\tif ( isSingleBlock && blockMetaName ) {\n\t\tdescription = sprintf(\n\t\t\t/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */\n\t\t\t__( 'This %1$s is editable using the \"%2$s\" override.' ),\n\t\t\tblockTitle.toLowerCase(),\n\t\t\tblockMetaName\n\t\t);\n\t} else {\n\t\tdescription = __( 'These blocks are editable using overrides.' );\n\t}\n\n\treturn <WCText>{ description }</WCText>;\n}\n\n/**\n * Renders a toolbar button that displays information about pattern overrides in a popover.\n *\n * @param {Object} props Component props.\n * @param {React.JSX.Element} props.icon The icon element to display.\n * @param {Array} props.clientIds The client IDs of selected blocks.\n * @param {string} props.blockTitle The display title of the block.\n * @param {string} props.label The label for the button.\n * @return {React.JSX.Element} The pattern overrides button component.\n */\nexport default function PatternOverridesDropdown( {\n\ticon,\n\tclientIds,\n\tblockTitle,\n\tlabel,\n} ) {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst anchorRef = useRef();\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tref={ anchorRef }\n\t\t\t\tclassName=\"block-editor-block-toolbar__pattern-overrides-indicator\"\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tonClick={ () => setIsOpen( ! isOpen ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tanchor={ anchorRef.current }\n\t\t\t\t\tonClose={ () => setIsOpen( false ) }\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tclassName=\"block-editor-block-toolbar__pattern-overrides-popover\"\n\t\t\t\t>\n\t\t\t\t\t<PatternOverridesPopoverContent\n\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\tblockTitle={ blockTitle }\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";AAAA;AAAA,EACC;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,OAChB;AACP,SAAS,IAAI,eAAe;AAC5B,SAAS,UAAU,cAAc;AACjC,SAAS,iBAAiB;AAC1B,SAAS,SAAS,wBAAwB;AAmClC,SAuBN,UAvBM,KAuBN,YAvBM;AAxBR,SAAS,+BAAgC,EAAE,WAAW,WAAW,GAAI;AACpE,QAAM,gBAAgB;AAAA,IACrB,CAAE,WAAY;AACb,YAAM,EAAE,mBAAmB,IAAI,OAAQ,gBAAiB;AACxD,aAAO,mBAAoB,YAAa,CAAE,CAAE,GAAG,UAAU;AAAA,IAC1D;AAAA,IACA,CAAE,SAAU;AAAA,EACb;AAEA,QAAM,gBAAgB,UAAU,WAAW;AAG3C,MAAI;AACJ,MAAK,iBAAiB,eAAgB;AACrC,kBAAc;AAAA;AAAA,MAEb,GAAI,kDAAmD;AAAA,MACvD,WAAW,YAAY;AAAA,MACvB;AAAA,IACD;AAAA,EACD,OAAO;AACN,kBAAc,GAAI,4CAA6C;AAAA,EAChE;AAEA,SAAO,oBAAC,UAAS,uBAAa;AAC/B;AAYe,SAAR,yBAA2C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,CAAE,QAAQ,SAAU,IAAI,SAAU,KAAM;AAC9C,QAAM,YAAY,OAAO;AAEzB,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,KAAM;AAAA,QACN,WAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,SAAU,MAAM,UAAW,CAAE,MAAO;AAAA,QACpC,iBAAgB;AAAA;AAAA,IACjB;AAAA,IACE,UACD;AAAA,MAAC;AAAA;AAAA,QACA,QAAS,UAAU;AAAA,QACnB,SAAU,MAAM,UAAW,KAAM;AAAA,QACjC,WAAU;AAAA,QACV,QAAS;AAAA,QACT,WAAU;AAAA,QAEV;AAAA,UAAC;AAAA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
4
+ "sourcesContent": ["import { Popover, ToolbarButton } from '@wordpress/components';\nimport { Text } from '@wordpress/ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useState, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Renders the content of the pattern overrides popover.\n * Only mounts when the popover is opened.\n *\n * @param {Object} props Component props.\n * @param {Array} props.clientIds The client IDs of selected blocks.\n * @param {string} props.blockTitle The display title of the block.\n * @return {React.JSX.Element} The popover content.\n */\nfunction PatternOverridesPopoverContent( { clientIds, blockTitle } ) {\n\tconst blockMetaName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes } = select( blockEditorStore );\n\t\t\treturn getBlockAttributes( clientIds?.[ 0 ] )?.metadata?.name;\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst isSingleBlock = clientIds.length === 1;\n\n\t// Pattern overrides description\n\tlet description;\n\tif ( isSingleBlock && blockMetaName ) {\n\t\tdescription = sprintf(\n\t\t\t/* translators: 1: The block type's name. 2: The block's user-provided name (the same as the override name). */\n\t\t\t__( 'This %1$s is editable using the \"%2$s\" override.' ),\n\t\t\tblockTitle.toLowerCase(),\n\t\t\tblockMetaName\n\t\t);\n\t} else {\n\t\tdescription = __( 'These blocks are editable using overrides.' );\n\t}\n\n\treturn <Text>{ description }</Text>;\n}\n\n/**\n * Renders a toolbar button that displays information about pattern overrides in a popover.\n *\n * @param {Object} props Component props.\n * @param {React.JSX.Element} props.icon The icon element to display.\n * @param {Array} props.clientIds The client IDs of selected blocks.\n * @param {string} props.blockTitle The display title of the block.\n * @param {string} props.label The label for the button.\n * @return {React.JSX.Element} The pattern overrides button component.\n */\nexport default function PatternOverridesDropdown( {\n\ticon,\n\tclientIds,\n\tblockTitle,\n\tlabel,\n} ) {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst anchorRef = useRef();\n\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tref={ anchorRef }\n\t\t\t\tclassName=\"block-editor-block-toolbar__pattern-overrides-indicator\"\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tonClick={ () => setIsOpen( ! isOpen ) }\n\t\t\t\taria-expanded={ isOpen }\n\t\t\t/>\n\t\t\t{ isOpen && (\n\t\t\t\t<Popover\n\t\t\t\t\tanchor={ anchorRef.current }\n\t\t\t\t\tonClose={ () => setIsOpen( false ) }\n\t\t\t\t\tplacement=\"bottom-start\"\n\t\t\t\t\toffset={ 16 }\n\t\t\t\t\tclassName=\"block-editor-block-toolbar__pattern-overrides-popover\"\n\t\t\t\t>\n\t\t\t\t\t<PatternOverridesPopoverContent\n\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\tblockTitle={ blockTitle }\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";AAAA,SAAS,SAAS,qBAAqB;AACvC,SAAS,YAA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-13,7 +13,6 @@ import BorderRadiusControl from "../border-radius-control/index.mjs";
13
13
  import { useColorsPerOrigin } from "./hooks.mjs";
14
14
  import { useToolsPanelDropdownMenuProps } from "./utils.mjs";
15
15
  import { setImmutably } from "../../utils/object.mjs";
16
- import { useBorderPanelLabel } from "../../hooks/border.mjs";
17
16
  import { ShadowPopover, useShadowPresets } from "./shadow-panel-components.mjs";
18
17
  import {
19
18
  getInheritanceProps,
@@ -259,11 +258,6 @@ function BorderPanel({
259
258
  };
260
259
  }, []);
261
260
  const showBorderByDefault = defaultControls?.color || defaultControls?.width;
262
- const hasBorderControl = showBorderColor || showBorderStyle || showBorderWidth || showBorderRadius;
263
- const label = useBorderPanelLabel({
264
- hasShadowControl,
265
- hasBorderControl
266
- });
267
261
  return /* @__PURE__ */ jsxs(
268
262
  Wrapper,
269
263
  {
@@ -271,9 +265,9 @@ function BorderPanel({
271
265
  value,
272
266
  onChange,
273
267
  panelId,
274
- label,
268
+ label: __("Borders"),
275
269
  children: [
276
- (showBorderWidth || showBorderColor) && /* @__PURE__ */ jsxs(
270
+ (showBorderWidth || showBorderColor) && /* @__PURE__ */ jsx(
277
271
  InheritanceToolsPanelItem,
278
272
  {
279
273
  ...inheritanceProps(
@@ -282,42 +276,25 @@ function BorderPanel({
282
276
  ),
283
277
  hasValue: () => isDefinedBorder(value?.border),
284
278
  label: __("Border"),
279
+ hasInlineEndToggle: true,
285
280
  onDeselect: () => resetBorder(),
286
281
  isShownByDefault: showBorderByDefault,
287
282
  panelId,
288
- children: [
289
- (showInheritanceLabelIndicators || hasShadowControl) && // Render the visible label as `BaseControl.VisualLabel`
290
- // (which produces `.components-base-control__label`)
291
- // rather than passing `label` to `BorderBoxControl`,
292
- // whose internal `<StyledLabel>` carries no stable
293
- // className. The inheritance treatment and the
294
- // local-override reset affordance both target
295
- // `.components-base-control__label`, so the visible
296
- // "Border" label has to be a `BaseControl` label to
297
- // receive them.
298
- //
299
- // Render it whenever a Shadow control is also present so
300
- // the two controls stay disambiguated (mirrors the
301
- // Shadow label's `hasBorderControl` guard below, and
302
- // trunk's `hideLabelFromVision={ ! hasShadowControl }`),
303
- // even when inheritance indicators are off (e.g. in
304
- // Global Styles).
305
- /* @__PURE__ */ jsx(BaseControl.VisualLabel, { as: "legend", children: __("Border") }),
306
- /* @__PURE__ */ jsx(
307
- BorderBoxControl,
308
- {
309
- colors,
310
- disableCustomColors: !areCustomSolidsEnabled,
311
- enableAlpha: true,
312
- enableStyle: showBorderStyle,
313
- onChange: onBorderChange,
314
- popoverOffset: 40,
315
- popoverPlacement: "left-start",
316
- value: border,
317
- __experimentalIsRenderedInSidebar: true
318
- }
319
- )
320
- ]
283
+ children: /* @__PURE__ */ jsx(
284
+ BorderBoxControl,
285
+ {
286
+ colors,
287
+ disableCustomColors: !areCustomSolidsEnabled,
288
+ enableAlpha: true,
289
+ enableStyle: showBorderStyle,
290
+ label: __("Border"),
291
+ onChange: onBorderChange,
292
+ popoverOffset: 40,
293
+ popoverPlacement: "left-start",
294
+ value: border,
295
+ __experimentalIsRenderedInSidebar: true
296
+ }
297
+ )
321
298
  }
322
299
  ),
323
300
  showBorderRadius && /* @__PURE__ */ jsx(
@@ -359,7 +336,7 @@ function BorderPanel({
359
336
  showLocalOverrideActionsInLabel: false,
360
337
  panelId,
361
338
  children: [
362
- hasBorderControl ? /* @__PURE__ */ jsx(BaseControl.VisualLabel, { as: "legend", children: __("Shadow") }) : null,
339
+ /* @__PURE__ */ jsx(BaseControl.VisualLabel, { children: __("Shadow") }),
363
340
  /* @__PURE__ */ jsx(
364
341
  ShadowPopover,
365
342
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/global-styles/border-panel.jsx"],
4
- "sourcesContent": ["import {\n\tBorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\tBaseControl,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { ShadowPopover, useShadowPresets } from './shadow-panel-components';\nimport {\n\tgetInheritanceProps,\n\tInheritanceToolsPanelItem,\n\tisGlobalStylesInheritanceEnabled,\n} from './inheritance';\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = Object.values( useHasBorderPanelControls( settings ) );\n\treturn controls.some( Boolean );\n}\n\nexport function useHasBorderPanelControls( settings ) {\n\tconst controls = {\n\t\thasBorderColor: useHasBorderColorControl( settings ),\n\t\thasBorderRadius: useHasBorderRadiusControl( settings ),\n\t\thasBorderStyle: useHasBorderStyleControl( settings ),\n\t\thasBorderWidth: useHasBorderWidthControl( settings ),\n\t\thasShadow: useHasShadowControl( settings ),\n\t};\n\n\treturn controls;\n}\n\nfunction useHasBorderColorControl( settings ) {\n\treturn settings?.border?.color;\n}\n\nfunction useHasBorderRadiusControl( settings ) {\n\treturn settings?.border?.radius;\n}\n\nfunction useHasBorderStyleControl( settings ) {\n\treturn settings?.border?.style;\n}\n\nfunction useHasBorderWidthControl( settings ) {\n\treturn settings?.border?.width;\n}\n\nfunction useHasShadowControl( settings ) {\n\tconst shadows = useShadowPresets( settings );\n\treturn !! settings?.shadow && shadows.length > 0;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ label }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tradius: true,\n\tcolor: true,\n\twidth: true,\n\tshadow: true,\n};\n\nexport default function BorderPanel( {\n\tas: Wrapper = BorderToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tshowInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled(),\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst areCustomSolidsEnabled = settings?.color?.custom;\n\tconst decodeValue = useCallback(\n\t\t( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),\n\t\t[ settings ]\n\t);\n\t// Always keep the layout className (e.g. `single-column`); only the\n\t// inheritance treatment is gated on `showInheritanceLabelIndicators`.\n\tconst inheritanceProps = ( isInherited, hasLocalOverride, className ) =>\n\t\tgetInheritanceProps(\n\t\t\tshowInheritanceLabelIndicators && isInherited,\n\t\t\tshowInheritanceLabelIndicators && hasLocalOverride,\n\t\t\tclassName\n\t\t);\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\t// Decode a `border` sub-tree (handles split borders + flat shape).\n\tconst decodeBorder = useCallback(\n\t\t( source ) => {\n\t\t\tif ( ! source ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( hasSplitBorders( source ) ) {\n\t\t\t\tconst out = { ...source };\n\t\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\t\tout[ side ] = {\n\t\t\t\t\t\t...out[ side ],\n\t\t\t\t\t\tcolor: decodeValue( out[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t} );\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...source,\n\t\t\t\tcolor: source.color ? decodeValue( source.color ) : undefined,\n\t\t\t};\n\t\t},\n\t\t[ decodeValue ]\n\t);\n\t// Local-then-inherited: prefer the user's locally-set border (whether\n\t// flat or split) when defined, otherwise fall back to the inherited\n\t// Global Styles border. The merge happens at the sub-tree root, not\n\t// at the leaf level — borders are commonly authored as a single\n\t// affordance in the inspector, so partial leaf merges would be\n\t// surprising.\n\tconst localBorder = useMemo(\n\t\t() => decodeBorder( value?.border ),\n\t\t[ value?.border, decodeBorder ]\n\t);\n\tconst inheritedBorder = useMemo(\n\t\t() => decodeBorder( inheritedValue?.border ),\n\t\t[ inheritedValue?.border, decodeBorder ]\n\t);\n\tconst isBorderPlaceholder =\n\t\t! isDefinedBorder( value?.border ) &&\n\t\t!! inheritedBorder &&\n\t\tisDefinedBorder( inheritedBorder );\n\tconst border = isBorderPlaceholder ? inheritedBorder : localBorder;\n\tconst setBorder = ( newBorder ) =>\n\t\tonChange( { ...value, border: newBorder } );\n\tconst showBorderColor = useHasBorderColorControl( settings );\n\tconst showBorderStyle = useHasBorderStyleControl( settings );\n\tconst showBorderWidth = useHasBorderWidthControl( settings );\n\n\t// Border radius. Display inherited values through the control's `values`\n\t// prop when local values are empty so UnitControl can parse the numeric\n\t// quantity and selected unit normally (e.g. `2.5em` -> `2.5` + `em`).\n\t// `hasBorderRadius` remains local-only, so displaying the inherited value\n\t// does not mark the ToolsPanel item as customised or commit on mount.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst localBorderRadius = useMemo( () => {\n\t\tif ( typeof value?.border?.radius !== 'object' ) {\n\t\t\treturn decodeValue( value?.border?.radius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( value?.border?.radius?.topLeft ),\n\t\t\ttopRight: decodeValue( value?.border?.radius?.topRight ),\n\t\t\tbottomLeft: decodeValue( value?.border?.radius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( value?.border?.radius?.bottomRight ),\n\t\t};\n\t}, [ value?.border?.radius, decodeValue ] );\n\tconst inheritedBorderRadius = useMemo( () => {\n\t\tconst rawRadius = inheritedValue?.border?.radius;\n\t\tif ( typeof rawRadius !== 'object' ) {\n\t\t\treturn decodeValue( rawRadius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( rawRadius?.topLeft ),\n\t\t\ttopRight: decodeValue( rawRadius?.topRight ),\n\t\t\tbottomLeft: decodeValue( rawRadius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( rawRadius?.bottomRight ),\n\t\t};\n\t}, [ inheritedValue?.border?.radius, decodeValue ] );\n\t// Spread the local border, not the merged display value, or setting a\n\t// radius bakes the inherited border into the local override. Mirror of\n\t// the guard in `onBorderChange`.\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...value?.border, radius: newBorderRadius } );\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = value?.border?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( ( [ , v ] ) => !! v );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\tconst isBorderRadiusPlaceholder =\n\t\t! hasBorderRadius() &&\n\t\tinheritedBorderRadius !== undefined &&\n\t\tinheritedBorderRadius !== '';\n\t// Build an object value so unlinked-mode shows per-corner inherited\n\t// values. The control accepts either a string or an object; passing the\n\t// object form is correct in both modes (the control collapses to the\n\t// `all`/first corner in linked mode).\n\tconst borderRadius = useMemo( () => {\n\t\tif ( ! isBorderRadiusPlaceholder ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tif ( typeof inheritedBorderRadius === 'string' ) {\n\t\t\treturn inheritedBorderRadius;\n\t\t}\n\t\tconst obj = inheritedBorderRadius;\n\t\tif ( ! obj ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tconst all =\n\t\t\tobj.topLeft &&\n\t\t\tobj.topLeft === obj.topRight &&\n\t\t\tobj.topLeft === obj.bottomLeft &&\n\t\t\tobj.topLeft === obj.bottomRight\n\t\t\t\t? obj.topLeft\n\t\t\t\t: undefined;\n\t\treturn { all, ...obj };\n\t}, [\n\t\tisBorderRadiusPlaceholder,\n\t\tlocalBorderRadius,\n\t\tinheritedBorderRadius,\n\t] );\n\tconst hasShadowControl = useHasShadowControl( settings );\n\n\t// Shadow. At rest, the popover toggle button uses the placeholder\n\t// treatment, and the popover preset list pre-selects the inherited shadow.\n\t// The interceptor below recognises the user's \"accept inherited\" click as\n\t// an explicit commit, mirroring the ToggleGroup pattern in the typography\n\t// panel.\n\tconst localShadow = decodeValue( value?.shadow );\n\tconst inheritedShadow = decodeValue( inheritedValue?.shadow );\n\tconst isShadowPlaceholder =\n\t\tlocalShadow === undefined &&\n\t\tinheritedShadow !== undefined &&\n\t\tinheritedShadow !== '';\n\tconst shadow = isShadowPlaceholder ? inheritedShadow : localShadow;\n\t// The presets the popover offers, from every origin. A preset the user\n\t// picked has to be stored as a reference to its CSS variable rather than as\n\t// the value it resolves to today, otherwise it stops tracking later edits\n\t// to the preset. Reading the same list the popover renders is what keeps\n\t// the two in step.\n\tconst shadowPresets = useShadowPresets( settings );\n\tconst setShadow = ( newValue ) => {\n\t\t// The list runs default, theme, custom, so searching backwards picks\n\t\t// the most specific origin when more than one defines the same shadow\n\t\t// value — a newly added custom preset starts out identical to the\n\t\t// `natural` default one, and it is the custom slug the user means.\n\t\tconst slug = shadowPresets.findLast(\n\t\t\t( { shadow: shadowName } ) => shadowName === newValue\n\t\t)?.slug;\n\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'shadow' ],\n\t\t\t\tslug ? `var:preset|shadow|${ slug }` : newValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\t// Display-without-commit interceptor for the shadow preset list. When the\n\t// user is at the at-rest preselect (local is undefined, inherited is the\n\t// active shadow), `ShadowPresets`' default toggle-off behaviour would\n\t// interpret the click on the highlighted preset as `undefined` (clear).\n\t// Re-route it to an explicit commit of the inherited value, so clicking\n\t// the visible preselected preset is the user's \"accept this inherited\n\t// value\" affordance.\n\tconst setShadowWithInheritedCommit = ( newValue ) => {\n\t\tif ( isShadowPlaceholder && newValue === undefined ) {\n\t\t\tsetShadow( inheritedShadow );\n\t\t\treturn;\n\t\t}\n\t\tsetShadow( newValue );\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\t// A local override exists when the user has set a shadow that shadows an\n\t// inherited one. Only then does the toggle render the blue-dot reset\n\t// affordance (mirroring the color/gradient controls); a merely-inherited\n\t// value at rest shows no reset button.\n\tconst hasShadowLocalOverride =\n\t\tshowInheritanceLabelIndicators &&\n\t\thasShadow() &&\n\t\tinheritedShadow !== undefined;\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: value?.border?.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Ensure we have a visible border style when a border width or\n\t\t// color is being selected.\n\t\tconst updatedBorder = { ...newBorder };\n\n\t\tif ( hasSplitBorders( updatedBorder ) ) {\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tif ( updatedBorder[ side ] ) {\n\t\t\t\t\tupdatedBorder[ side ] = {\n\t\t\t\t\t\t...updatedBorder[ side ],\n\t\t\t\t\t\tcolor: encodeColorValue( updatedBorder[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( updatedBorder ) {\n\t\t\tupdatedBorder.color = encodeColorValue( updatedBorder.color );\n\t\t}\n\n\t\t// As radius is maintained separately to color, style, and width\n\t\t// maintain its value. Read from `value` (local-only) rather than\n\t\t// `border` (the merged display value), otherwise an inherited\n\t\t// radius gets baked into the local override every time the\n\t\t// user touches color/style/width — which both pollutes the\n\t\t// stored attribute and causes the radius `ToolsPanelItem` to\n\t\t// flip into the `has-local-override-from-global-styles` state\n\t\t// even though the user never customised the radius. The\n\t\t// `radius` key must come after the spread so it wins over any\n\t\t// `radius` field forwarded by `BorderBoxControl`'s inner\n\t\t// `BorderControl`, which merges its incoming `value` with the\n\t\t// changed prop. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( {\n\t\t\t...updatedBorder,\n\t\t\tradius: value?.border?.radius,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t\tshadow: undefined,\n\t\t};\n\t}, [] );\n\n\tconst showBorderByDefault =\n\t\tdefaultControls?.color || defaultControls?.width;\n\n\tconst hasBorderControl =\n\t\tshowBorderColor ||\n\t\tshowBorderStyle ||\n\t\tshowBorderWidth ||\n\t\tshowBorderRadius;\n\n\tconst label = useBorderPanelLabel( {\n\t\thasShadowControl,\n\t\thasBorderControl,\n\t} );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderPlaceholder,\n\t\t\t\t\t\tisDefinedBorder( value?.border ) &&\n\t\t\t\t\t\t\t!! inheritedBorder &&\n\t\t\t\t\t\t\tisDefinedBorder( inheritedBorder )\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ ( showInheritanceLabelIndicators ||\n\t\t\t\t\t\thasShadowControl ) && (\n\t\t\t\t\t\t// Render the visible label as `BaseControl.VisualLabel`\n\t\t\t\t\t\t// (which produces `.components-base-control__label`)\n\t\t\t\t\t\t// rather than passing `label` to `BorderBoxControl`,\n\t\t\t\t\t\t// whose internal `<StyledLabel>` carries no stable\n\t\t\t\t\t\t// className. The inheritance treatment and the\n\t\t\t\t\t\t// local-override reset affordance both target\n\t\t\t\t\t\t// `.components-base-control__label`, so the visible\n\t\t\t\t\t\t// \"Border\" label has to be a `BaseControl` label to\n\t\t\t\t\t\t// receive them.\n\t\t\t\t\t\t//\n\t\t\t\t\t\t// Render it whenever a Shadow control is also present so\n\t\t\t\t\t\t// the two controls stay disambiguated (mirrors the\n\t\t\t\t\t\t// Shadow label's `hasBorderControl` guard below, and\n\t\t\t\t\t\t// trunk's `hideLabelFromVision={ ! hasShadowControl }`),\n\t\t\t\t\t\t// even when inheritance indicators are off (e.g. in\n\t\t\t\t\t\t// Global Styles).\n\t\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t\t{ __( 'Border' ) }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t) }\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderRadiusPlaceholder,\n\t\t\t\t\t\thasBorderRadius() && inheritedBorderRadius !== undefined\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\thasInlineEndToggle\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ defaultControls.radius }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tpresets={ settings?.border?.radiusSizes }\n\t\t\t\t\t\tvalues={ borderRadius }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetBorderRadius( newValue || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasShadowControl && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisShadowPlaceholder,\n\t\t\t\t\t\thasShadow() && inheritedShadow !== undefined\n\t\t\t\t\t) }\n\t\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\t\thasValue={ hasShadow }\n\t\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\t\tisShownByDefault={ defaultControls.shadow }\n\t\t\t\t\t// The shadow toggle renders its own reset affordance (blue\n\t\t\t\t\t// dot for a local override, default reset otherwise) inside\n\t\t\t\t\t// the control, mirroring the color/gradient controls, so the\n\t\t\t\t\t// panel item must not render a second sibling reset dot.\n\t\t\t\t\tshowLocalOverrideActionsInLabel={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ hasBorderControl ? (\n\t\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t) : null }\n\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ setShadowWithInheritedCommit }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\thasLocalValue={ hasShadow() }\n\t\t\t\t\t\thasLocalOverride={ hasShadowLocalOverride }\n\t\t\t\t\t\tonReset={ resetShadow }\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
5
- "mappings": ";AAAA;AAAA,EACC;AAAA,EACA,iCAAiC;AAAA,EACjC,iCAAiC;AAAA,EACjC,4BAA4B;AAAA,EAC5B;AAAA,OACM;AACP,SAAS,aAAa,eAAe;AACrC,SAAS,UAAU;AACnB,SAAS,4BAA4B;AACrC,OAAO,yBAAyB;AAChC,SAAS,0BAA0B;AACnC,SAAS,sCAAsC;AAC/C,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,SAAS,eAAe,wBAAwB;AAChD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAuDL,cAwTE,YAxTF;AArDK,SAAS,kBAAmB,UAAW;AAC7C,QAAM,WAAW,OAAO,OAAQ,0BAA2B,QAAS,CAAE;AACtE,SAAO,SAAS,KAAM,OAAQ;AAC/B;AAEO,SAAS,0BAA2B,UAAW;AACrD,QAAM,WAAW;AAAA,IAChB,gBAAgB,yBAA0B,QAAS;AAAA,IACnD,iBAAiB,0BAA2B,QAAS;AAAA,IACrD,gBAAgB,yBAA0B,QAAS;AAAA,IACnD,gBAAgB,yBAA0B,QAAS;AAAA,IACnD,WAAW,oBAAqB,QAAS;AAAA,EAC1C;AAEA,SAAO;AACR;AAEA,SAAS,yBAA0B,UAAW;AAC7C,SAAO,UAAU,QAAQ;AAC1B;AAEA,SAAS,0BAA2B,UAAW;AAC9C,SAAO,UAAU,QAAQ;AAC1B;AAEA,SAAS,yBAA0B,UAAW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AA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
4
+ "sourcesContent": ["import {\n\tBorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\tBaseControl,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport { ShadowPopover, useShadowPresets } from './shadow-panel-components';\nimport {\n\tgetInheritanceProps,\n\tInheritanceToolsPanelItem,\n\tisGlobalStylesInheritanceEnabled,\n} from './inheritance';\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = Object.values( useHasBorderPanelControls( settings ) );\n\treturn controls.some( Boolean );\n}\n\nexport function useHasBorderPanelControls( settings ) {\n\tconst controls = {\n\t\thasBorderColor: useHasBorderColorControl( settings ),\n\t\thasBorderRadius: useHasBorderRadiusControl( settings ),\n\t\thasBorderStyle: useHasBorderStyleControl( settings ),\n\t\thasBorderWidth: useHasBorderWidthControl( settings ),\n\t\thasShadow: useHasShadowControl( settings ),\n\t};\n\n\treturn controls;\n}\n\nfunction useHasBorderColorControl( settings ) {\n\treturn settings?.border?.color;\n}\n\nfunction useHasBorderRadiusControl( settings ) {\n\treturn settings?.border?.radius;\n}\n\nfunction useHasBorderStyleControl( settings ) {\n\treturn settings?.border?.style;\n}\n\nfunction useHasBorderWidthControl( settings ) {\n\treturn settings?.border?.width;\n}\n\nfunction useHasShadowControl( settings ) {\n\tconst shadows = useShadowPresets( settings );\n\treturn !! settings?.shadow && shadows.length > 0;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ label }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tradius: true,\n\tcolor: true,\n\twidth: true,\n\tshadow: true,\n};\n\nexport default function BorderPanel( {\n\tas: Wrapper = BorderToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tshowInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled(),\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst areCustomSolidsEnabled = settings?.color?.custom;\n\tconst decodeValue = useCallback(\n\t\t( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),\n\t\t[ settings ]\n\t);\n\t// Always keep the layout className (e.g. `single-column`); only the\n\t// inheritance treatment is gated on `showInheritanceLabelIndicators`.\n\tconst inheritanceProps = ( isInherited, hasLocalOverride, className ) =>\n\t\tgetInheritanceProps(\n\t\t\tshowInheritanceLabelIndicators && isInherited,\n\t\t\tshowInheritanceLabelIndicators && hasLocalOverride,\n\t\t\tclassName\n\t\t);\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\t// Decode a `border` sub-tree (handles split borders + flat shape).\n\tconst decodeBorder = useCallback(\n\t\t( source ) => {\n\t\t\tif ( ! source ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( hasSplitBorders( source ) ) {\n\t\t\t\tconst out = { ...source };\n\t\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\t\tout[ side ] = {\n\t\t\t\t\t\t...out[ side ],\n\t\t\t\t\t\tcolor: decodeValue( out[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t} );\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...source,\n\t\t\t\tcolor: source.color ? decodeValue( source.color ) : undefined,\n\t\t\t};\n\t\t},\n\t\t[ decodeValue ]\n\t);\n\t// Local-then-inherited: prefer the user's locally-set border (whether\n\t// flat or split) when defined, otherwise fall back to the inherited\n\t// Global Styles border. The merge happens at the sub-tree root, not\n\t// at the leaf level — borders are commonly authored as a single\n\t// affordance in the inspector, so partial leaf merges would be\n\t// surprising.\n\tconst localBorder = useMemo(\n\t\t() => decodeBorder( value?.border ),\n\t\t[ value?.border, decodeBorder ]\n\t);\n\tconst inheritedBorder = useMemo(\n\t\t() => decodeBorder( inheritedValue?.border ),\n\t\t[ inheritedValue?.border, decodeBorder ]\n\t);\n\tconst isBorderPlaceholder =\n\t\t! isDefinedBorder( value?.border ) &&\n\t\t!! inheritedBorder &&\n\t\tisDefinedBorder( inheritedBorder );\n\tconst border = isBorderPlaceholder ? inheritedBorder : localBorder;\n\tconst setBorder = ( newBorder ) =>\n\t\tonChange( { ...value, border: newBorder } );\n\tconst showBorderColor = useHasBorderColorControl( settings );\n\tconst showBorderStyle = useHasBorderStyleControl( settings );\n\tconst showBorderWidth = useHasBorderWidthControl( settings );\n\n\t// Border radius. Display inherited values through the control's `values`\n\t// prop when local values are empty so UnitControl can parse the numeric\n\t// quantity and selected unit normally (e.g. `2.5em` -> `2.5` + `em`).\n\t// `hasBorderRadius` remains local-only, so displaying the inherited value\n\t// does not mark the ToolsPanel item as customised or commit on mount.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst localBorderRadius = useMemo( () => {\n\t\tif ( typeof value?.border?.radius !== 'object' ) {\n\t\t\treturn decodeValue( value?.border?.radius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( value?.border?.radius?.topLeft ),\n\t\t\ttopRight: decodeValue( value?.border?.radius?.topRight ),\n\t\t\tbottomLeft: decodeValue( value?.border?.radius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( value?.border?.radius?.bottomRight ),\n\t\t};\n\t}, [ value?.border?.radius, decodeValue ] );\n\tconst inheritedBorderRadius = useMemo( () => {\n\t\tconst rawRadius = inheritedValue?.border?.radius;\n\t\tif ( typeof rawRadius !== 'object' ) {\n\t\t\treturn decodeValue( rawRadius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( rawRadius?.topLeft ),\n\t\t\ttopRight: decodeValue( rawRadius?.topRight ),\n\t\t\tbottomLeft: decodeValue( rawRadius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( rawRadius?.bottomRight ),\n\t\t};\n\t}, [ inheritedValue?.border?.radius, decodeValue ] );\n\t// Spread the local border, not the merged display value, or setting a\n\t// radius bakes the inherited border into the local override. Mirror of\n\t// the guard in `onBorderChange`.\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...value?.border, radius: newBorderRadius } );\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = value?.border?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( ( [ , v ] ) => !! v );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\tconst isBorderRadiusPlaceholder =\n\t\t! hasBorderRadius() &&\n\t\tinheritedBorderRadius !== undefined &&\n\t\tinheritedBorderRadius !== '';\n\t// Build an object value so unlinked-mode shows per-corner inherited\n\t// values. The control accepts either a string or an object; passing the\n\t// object form is correct in both modes (the control collapses to the\n\t// `all`/first corner in linked mode).\n\tconst borderRadius = useMemo( () => {\n\t\tif ( ! isBorderRadiusPlaceholder ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tif ( typeof inheritedBorderRadius === 'string' ) {\n\t\t\treturn inheritedBorderRadius;\n\t\t}\n\t\tconst obj = inheritedBorderRadius;\n\t\tif ( ! obj ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tconst all =\n\t\t\tobj.topLeft &&\n\t\t\tobj.topLeft === obj.topRight &&\n\t\t\tobj.topLeft === obj.bottomLeft &&\n\t\t\tobj.topLeft === obj.bottomRight\n\t\t\t\t? obj.topLeft\n\t\t\t\t: undefined;\n\t\treturn { all, ...obj };\n\t}, [\n\t\tisBorderRadiusPlaceholder,\n\t\tlocalBorderRadius,\n\t\tinheritedBorderRadius,\n\t] );\n\tconst hasShadowControl = useHasShadowControl( settings );\n\n\t// Shadow. At rest, the popover toggle button uses the placeholder\n\t// treatment, and the popover preset list pre-selects the inherited shadow.\n\t// The interceptor below recognises the user's \"accept inherited\" click as\n\t// an explicit commit, mirroring the ToggleGroup pattern in the typography\n\t// panel.\n\tconst localShadow = decodeValue( value?.shadow );\n\tconst inheritedShadow = decodeValue( inheritedValue?.shadow );\n\tconst isShadowPlaceholder =\n\t\tlocalShadow === undefined &&\n\t\tinheritedShadow !== undefined &&\n\t\tinheritedShadow !== '';\n\tconst shadow = isShadowPlaceholder ? inheritedShadow : localShadow;\n\t// The presets the popover offers, from every origin. A preset the user\n\t// picked has to be stored as a reference to its CSS variable rather than as\n\t// the value it resolves to today, otherwise it stops tracking later edits\n\t// to the preset. Reading the same list the popover renders is what keeps\n\t// the two in step.\n\tconst shadowPresets = useShadowPresets( settings );\n\tconst setShadow = ( newValue ) => {\n\t\t// The list runs default, theme, custom, so searching backwards picks\n\t\t// the most specific origin when more than one defines the same shadow\n\t\t// value — a newly added custom preset starts out identical to the\n\t\t// `natural` default one, and it is the custom slug the user means.\n\t\tconst slug = shadowPresets.findLast(\n\t\t\t( { shadow: shadowName } ) => shadowName === newValue\n\t\t)?.slug;\n\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'shadow' ],\n\t\t\t\tslug ? `var:preset|shadow|${ slug }` : newValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\t// Display-without-commit interceptor for the shadow preset list. When the\n\t// user is at the at-rest preselect (local is undefined, inherited is the\n\t// active shadow), `ShadowPresets`' default toggle-off behaviour would\n\t// interpret the click on the highlighted preset as `undefined` (clear).\n\t// Re-route it to an explicit commit of the inherited value, so clicking\n\t// the visible preselected preset is the user's \"accept this inherited\n\t// value\" affordance.\n\tconst setShadowWithInheritedCommit = ( newValue ) => {\n\t\tif ( isShadowPlaceholder && newValue === undefined ) {\n\t\t\tsetShadow( inheritedShadow );\n\t\t\treturn;\n\t\t}\n\t\tsetShadow( newValue );\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\t// A local override exists when the user has set a shadow that shadows an\n\t// inherited one. Only then does the toggle render the blue-dot reset\n\t// affordance (mirroring the color/gradient controls); a merely-inherited\n\t// value at rest shows no reset button.\n\tconst hasShadowLocalOverride =\n\t\tshowInheritanceLabelIndicators &&\n\t\thasShadow() &&\n\t\tinheritedShadow !== undefined;\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: value?.border?.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Ensure we have a visible border style when a border width or\n\t\t// color is being selected.\n\t\tconst updatedBorder = { ...newBorder };\n\n\t\tif ( hasSplitBorders( updatedBorder ) ) {\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tif ( updatedBorder[ side ] ) {\n\t\t\t\t\tupdatedBorder[ side ] = {\n\t\t\t\t\t\t...updatedBorder[ side ],\n\t\t\t\t\t\tcolor: encodeColorValue( updatedBorder[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( updatedBorder ) {\n\t\t\tupdatedBorder.color = encodeColorValue( updatedBorder.color );\n\t\t}\n\n\t\t// As radius is maintained separately to color, style, and width\n\t\t// maintain its value. Read from `value` (local-only) rather than\n\t\t// `border` (the merged display value), otherwise an inherited\n\t\t// radius gets baked into the local override every time the\n\t\t// user touches color/style/width — which both pollutes the\n\t\t// stored attribute and causes the radius `ToolsPanelItem` to\n\t\t// flip into the `has-local-override-from-global-styles` state\n\t\t// even though the user never customised the radius. The\n\t\t// `radius` key must come after the spread so it wins over any\n\t\t// `radius` field forwarded by `BorderBoxControl`'s inner\n\t\t// `BorderControl`, which merges its incoming `value` with the\n\t\t// changed prop. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( {\n\t\t\t...updatedBorder,\n\t\t\tradius: value?.border?.radius,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t\tshadow: undefined,\n\t\t};\n\t}, [] );\n\n\tconst showBorderByDefault =\n\t\tdefaultControls?.color || defaultControls?.width;\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\t// A shadow is treated as a soft border, so the panel keeps one\n\t\t\t// name whichever of its controls a theme or block opts into.\n\t\t\t// A stable title is what lets each control show its own label\n\t\t\t// unconditionally, which in turn keeps their unlink toggles\n\t\t\t// aligned.\n\t\t\tlabel={ __( 'Borders' ) }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderPlaceholder,\n\t\t\t\t\t\tisDefinedBorder( value?.border ) &&\n\t\t\t\t\t\t\t!! inheritedBorder &&\n\t\t\t\t\t\t\tisDefinedBorder( inheritedBorder )\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\thasInlineEndToggle\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ /* The visible label is always rendered, so the control's\n\t\t\t\t\t linked/unlinked toggle sits in a label row and lines up\n\t\t\t\t\t with the Radius control's. `BorderBoxControl` renders the\n\t\t\t\t\t label as `BaseControl.VisualLabel`, which is what the\n\t\t\t\t\t inheritance treatment and the local-override reset\n\t\t\t\t\t affordance target. */ }\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderRadiusPlaceholder,\n\t\t\t\t\t\thasBorderRadius() && inheritedBorderRadius !== undefined\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\thasInlineEndToggle\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ defaultControls.radius }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tpresets={ settings?.border?.radiusSizes }\n\t\t\t\t\t\tvalues={ borderRadius }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetBorderRadius( newValue || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasShadowControl && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisShadowPlaceholder,\n\t\t\t\t\t\thasShadow() && inheritedShadow !== undefined\n\t\t\t\t\t) }\n\t\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\t\thasValue={ hasShadow }\n\t\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\t\tisShownByDefault={ defaultControls.shadow }\n\t\t\t\t\t// The shadow toggle renders its own reset affordance (blue\n\t\t\t\t\t// dot for a local override, default reset otherwise) inside\n\t\t\t\t\t// the control, mirroring the color/gradient controls, so the\n\t\t\t\t\t// panel item must not render a second sibling reset dot.\n\t\t\t\t\tshowLocalOverrideActionsInLabel={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ setShadowWithInheritedCommit }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\thasLocalValue={ hasShadow() }\n\t\t\t\t\t\thasLocalOverride={ hasShadowLocalOverride }\n\t\t\t\t\t\tonReset={ resetShadow }\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
5
+ "mappings": ";AAAA;AAAA,EACC;AAAA,EAC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AA,gBAC5B,QAAS;AAAA,gBACT,UAAW,CAAE,aAAc;AAC1B,kCAAiB,YAAY,MAAU;AAAA,gBACxC;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QAEC,oBACD;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,cACJ;AAAA,cACA,UAAU,KAAK,oBAAoB;AAAA,YACpC;AAAA,YACA,OAAQ,GAAI,QAAS;AAAA,YACrB,UAAW;AAAA,YACX,YAAa;AAAA,YACb,kBAAmB,gBAAgB;AAAA,YAKnC,iCAAkC;AAAA,YAClC;AAAA,YAEA;AAAA,kCAAC,YAAY,aAAZ,EACE,aAAI,QAAS,GAChB;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACA;AAAA,kBACA,gBAAiB;AAAA,kBACjB;AAAA,kBACA,eAAgB,UAAU;AAAA,kBAC1B,kBAAmB;AAAA,kBACnB,SAAU;AAAA;AAAA,cACX;AAAA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/global-styles/image-settings-panel.jsx"],
4
- "sourcesContent": ["import {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useToolsPanelDropdownMenuProps } from './utils';\n\nexport function useHasImageSettingsPanel( name, value, inheritedValue ) {\n\t// Note: If lightbox `value` exists, that means it was\n\t// defined via the the Global Styles UI and will NOT\n\t// be a boolean value or contain the `allowEditing` property,\n\t// so we should show the settings panel in those cases.\n\treturn (\n\t\t( name === 'core/image' && inheritedValue?.lightbox?.allowEditing ) ||\n\t\t!! value?.lightbox\n\t);\n}\n\nexport default function ImageSettingsPanel( {\n\tonChange,\n\tvalue,\n\tinheritedValue,\n\tpanelId,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetLightbox = () => {\n\t\tonChange( undefined );\n\t};\n\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\tonChange( {\n\t\t\tenabled: newSetting,\n\t\t} );\n\t};\n\n\tlet lightboxChecked = false;\n\n\tif ( inheritedValue?.lightbox?.enabled ) {\n\t\tlightboxChecked = inheritedValue.lightbox.enabled;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ _x( 'Settings', 'Image settings' ) }\n\t\t\t\tresetAll={ resetLightbox }\n\t\t\t\tpanelId={ panelId }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t// We use the `userSettings` prop instead of `settings`, because `settings`\n\t\t\t\t\t// contains the core/theme values for the lightbox and we want to show the\n\t\t\t\t\t// \"RESET\" button ONLY when the user has explicitly set a value in the\n\t\t\t\t\t// Global Styles.\n\t\t\t\t\thasValue={ () => !! value?.lightbox }\n\t\t\t\t\tlabel={ __( 'Enlarge on click' ) }\n\t\t\t\t\tonDeselect={ resetLightbox }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Enlarge on click' ) }\n\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</>\n\t);\n}\n"],
4
+ "sourcesContent": ["import {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useToolsPanelDropdownMenuProps } from './utils';\n\nexport function useHasImageSettingsPanel( name, value, inheritedValue ) {\n\t// Note: If lightbox `value` exists, that means it was\n\t// defined via the Global Styles UI and will NOT\n\t// be a boolean value or contain the `allowEditing` property,\n\t// so we should show the settings panel in those cases.\n\treturn (\n\t\t( name === 'core/image' && inheritedValue?.lightbox?.allowEditing ) ||\n\t\t!! value?.lightbox\n\t);\n}\n\nexport default function ImageSettingsPanel( {\n\tonChange,\n\tvalue,\n\tinheritedValue,\n\tpanelId,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetLightbox = () => {\n\t\tonChange( undefined );\n\t};\n\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\tonChange( {\n\t\t\tenabled: newSetting,\n\t\t} );\n\t};\n\n\tlet lightboxChecked = false;\n\n\tif ( inheritedValue?.lightbox?.enabled ) {\n\t\tlightboxChecked = inheritedValue.lightbox.enabled;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ _x( 'Settings', 'Image settings' ) }\n\t\t\t\tresetAll={ resetLightbox }\n\t\t\t\tpanelId={ panelId }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t// We use the `userSettings` prop instead of `settings`, because `settings`\n\t\t\t\t\t// contains the core/theme values for the lightbox and we want to show the\n\t\t\t\t\t// \"RESET\" button ONLY when the user has explicitly set a value in the\n\t\t\t\t\t// Global Styles.\n\t\t\t\t\thasValue={ () => !! value?.lightbox }\n\t\t\t\t\tlabel={ __( 'Enlarge on click' ) }\n\t\t\t\t\tonDeselect={ resetLightbox }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Enlarge on click' ) }\n\t\t\t\t\t\tchecked={ lightboxChecked }\n\t\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</>\n\t);\n}\n"],
5
5
  "mappings": ";AAAA;AAAA,EACC,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC;AAAA,OACM;AACP,SAAS,IAAI,UAAU;AACvB,SAAS,sCAAsC;AAqC7C,mBAkBG,WAlBH;AAnCK,SAAS,yBAA0B,MAAM,OAAO,gBAAiB;AAKvE,SACG,SAAS,gBAAgB,gBAAgB,UAAU,gBACrD,CAAC,CAAE,OAAO;AAEZ;AAEe,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,oBAAoB,+BAA+B;AACzD,QAAM,gBAAgB,MAAM;AAC3B,aAAU,MAAU;AAAA,EACrB;AAEA,QAAM,mBAAmB,CAAE,eAAgB;AAC1C,aAAU;AAAA,MACT,SAAS;AAAA,IACV,CAAE;AAAA,EACH;AAEA,MAAI,kBAAkB;AAEtB,MAAK,gBAAgB,UAAU,SAAU;AACxC,sBAAkB,eAAe,SAAS;AAAA,EAC3C;AAEA,SACC,gCACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,YAAY,gBAAiB;AAAA,MACzC,UAAW;AAAA,MACX;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UAKA,UAAW,MAAM,CAAC,CAAE,OAAO;AAAA,UAC3B,OAAQ,GAAI,kBAAmB;AAAA,UAC/B,YAAa;AAAA,UACb,kBAAgB;AAAA,UAChB;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACA,OAAQ,GAAI,kBAAmB;AAAA,cAC/B,SAAU;AAAA,cACV,UAAW;AAAA;AAAA,UACZ;AAAA;AAAA,MACD;AAAA;AAAA,EACD,GACD;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/iframe/index.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { version as reactVersion } from 'react';\nimport { useState, createPortal, forwardRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect, useDisabled } from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { useScaleCanvas } from './use-scale-canvas';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\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} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nconst iframeSrcCache = new WeakMap();\nconst iframeSrcCleanup = globalThis.FinalizationRegistry\n\t? new globalThis.FinalizationRegistry( ( url ) =>\n\t\t\tURL.revokeObjectURL( url )\n\t )\n\t: undefined;\n\nfunction getIframeSrc( resolvedAssets ) {\n\tlet src = iframeSrcCache.get( resolvedAssets );\n\tif ( src ) {\n\t\treturn src;\n\t}\n\n\tlet body = '';\n\tif ( reactVersion.split( '.' )[ 0 ] === '18' ) {\n\t\tbody =\n\t\t\t'<body><script>document.currentScript.parentElement.remove()</script></body>';\n\t}\n\n\t// Correct doctype is required to enable rendering in standards mode.\n\t// Also preload the styles to avoid a flash of unstyled content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<base href=\"${ window.location.href }\">\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ resolvedAssets.styles ?? '' }\n\t\t${ resolvedAssets.scripts ?? '' }\n\t</head>\n\t${ body }\n</html>`;\n\n\tsrc = URL.createObjectURL( new Blob( [ html ], { type: 'text/html' } ) );\n\tiframeSrcCache.set( resolvedAssets, src );\n\tiframeSrcCleanup?.register( resolvedAssets, src );\n\treturn src;\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\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.isPreviewMode,\n\t\t};\n\t}, [] );\n\t/** @type {[Document, React.Dispatch<Document>]} */\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\n\tconst setRef = useRefEffect( ( node ) => {\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\t// Prevent clicks on link fragments from navigating away. Note that links\n\t\t// inside `contenteditable` are already disabled by the browser, so\n\t\t// this is for links in blocks outside of `contenteditable`.\n\t\tfunction interceptLinkClicks( event ) {\n\t\t\tif (\n\t\t\t\tevent.target.tagName === 'A' &&\n\t\t\t\tevent.target.getAttribute( 'href' )?.startsWith( '#' )\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// Manually handle link fragment navigation within the iframe. The iframe's\n\t\t\t\t// location is a blob URL, which can't be used to resolve relative links like\n\t\t\t\t// `#hash`. The relative link would be resolved against the iframe's base URL\n\t\t\t\t// or the parent frame's URL, causing the iframe to navigate to a completely\n\t\t\t\t// different page. Setting the `location.hash` works because it really sets the\n\t\t\t\t// blob URL's hash.\n\t\t\t\t//\n\t\t\t\t// Links with fragments are used for example with footnotes. Clicking on these\n\t\t\t\t// links will scroll smoothly to the anchors in the editor canvas.\n\t\t\t\tiFrameDocument.defaultView.location.hash = event.target\n\t\t\t\t\t.getAttribute( 'href' )\n\t\t\t\t\t.slice( 1 );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\n\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t// the server in the future (which will run the PHP filters).\n\t\tsetBodyClasses(\n\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t( name ) =>\n\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t)\n\t\t);\n\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\t\t\tsetIframeDocument( contentDocument );\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\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\tiFrameDocument.addEventListener( 'click', interceptLinkClicks );\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tsetIframeDocument( undefined );\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\tiFrameDocument?.removeEventListener( 'click', interceptLinkClicks );\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\tcontentRef: scaleContentRef,\n\t\tcontainerRef,\n\t\tisZoomedOut,\n\t\tscaleContainerWidth,\n\t} = useScaleCanvas( {\n\t\tscale,\n\t\tframeSize: parseInt( frameSize ),\n\t\tiframeDocument,\n\t} );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\n\tconst unguardedBodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\tscaleContentRef,\n\t] );\n\n\t// Attach the body ref only when the iframe document and window are available.\n\t// When an iframe element is moved in the DOM, like when reordering a list,\n\t// its `window` object is destroyed and recreated, and the `defaultView` field is\n\t// briefly `null`. We need to guard for such calls of the ref callbacks.\n\tconst bodyRef = useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( node.ownerDocument.defaultView ) {\n\t\t\t\tunguardedBodyRef( node );\n\t\t\t\treturn () => unguardedBodyRef( null );\n\t\t\t}\n\t\t\treturn () => {};\n\t\t},\n\t\t[ unguardedBodyRef ]\n\t);\n\n\tconst src = getIframeSrc( resolvedAssets );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\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: props.style?.height,\n\t\t\t\t\tborder: 0,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\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={ clsx(\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<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{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ containerRef }>\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ scaleContainerWidth }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\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"],
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { version as reactVersion } from 'react';\nimport { useState, createPortal, forwardRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs, useRefEffect, useDisabled } from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useWritingFlow } from '../writing-flow';\nimport { getCompatibilityStyles } from './get-compatibility-styles';\nimport { useScaleCanvas } from './use-scale-canvas';\nimport { store as blockEditorStore } from '../../store';\n\nfunction bubbleEvent( event, Constructor, frame ) {\n\tconst init = {};\n\n\tfor ( const key in event ) {\n\t\tinit[ key ] = event[ key ];\n\t}\n\n\t// Check if the event is a MouseEvent generated within the iframe.\n\t// If so, adjust the coordinates to be relative to the position of\n\t// the iframe. This ensures that components such as Draggable\n\t// receive coordinates relative to the window, instead of relative\n\t// to the iframe. Without this, the Draggable event handler would\n\t// result in components \"jumping\" position as soon as the user\n\t// drags over the iframe.\n\tif ( event instanceof frame.contentDocument.defaultView.MouseEvent ) {\n\t\tconst rect = frame.getBoundingClientRect();\n\t\tinit.clientX += rect.left;\n\t\tinit.clientY += rect.top;\n\t}\n\n\tconst newEvent = new Constructor( event.type, init );\n\tif ( init.defaultPrevented ) {\n\t\tnewEvent.preventDefault();\n\t}\n\tconst cancelled = ! frame.dispatchEvent( newEvent );\n\n\tif ( cancelled ) {\n\t\tevent.preventDefault();\n\t}\n}\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} iframeDocument Document to attach listeners to.\n */\nfunction useBubbleEvents( iframeDocument ) {\n\treturn useRefEffect( () => {\n\t\tconst { defaultView } = iframeDocument;\n\t\tif ( ! defaultView ) {\n\t\t\treturn;\n\t\t}\n\t\tconst { frameElement } = defaultView;\n\t\tconst html = iframeDocument.documentElement;\n\t\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\t\tconst handlers = {};\n\t\tfor ( const name of eventTypes ) {\n\t\t\thandlers[ name ] = ( event ) => {\n\t\t\t\tconst prototype = Object.getPrototypeOf( event );\n\t\t\t\tconst constructorName = prototype.constructor.name;\n\t\t\t\tconst Constructor = window[ constructorName ];\n\t\t\t\tbubbleEvent( event, Constructor, frameElement );\n\t\t\t};\n\t\t\thtml.addEventListener( name, handlers[ name ] );\n\t\t}\n\n\t\treturn () => {\n\t\t\tfor ( const name of eventTypes ) {\n\t\t\t\thtml.removeEventListener( name, handlers[ name ] );\n\t\t\t}\n\t\t};\n\t} );\n}\n\nconst iframeSrcCache = new WeakMap();\nconst iframeSrcCleanup = globalThis.FinalizationRegistry\n\t? new globalThis.FinalizationRegistry( ( url ) =>\n\t\t\tURL.revokeObjectURL( url )\n\t )\n\t: undefined;\n\nfunction getIframeSrc( resolvedAssets ) {\n\tlet src = iframeSrcCache.get( resolvedAssets );\n\tif ( src ) {\n\t\treturn src;\n\t}\n\n\tlet body = '';\n\tif ( reactVersion.split( '.' )[ 0 ] === '18' ) {\n\t\tbody =\n\t\t\t'<body><script>document.currentScript.parentElement.remove()</script></body>';\n\t}\n\n\t// Correct doctype is required to enable rendering in standards mode.\n\t// Also preload the styles to avoid a flash of unstyled content.\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<base href=\"${ window.location.href }\">\n\t\t<style>\n\t\t\thtml{\n\t\t\t\theight: auto !important;\n\t\t\t\tmin-height: 100%;\n\t\t\t}\n\t\t\t/* Lowest specificity to not override global styles */\n\t\t\t:where(body) {\n\t\t\t\tmargin: 0;\n\t\t\t\t/* Default background color in case zoom out mode background\n\t\t\t\tcolors the html element */\n\t\t\t\tbackground-color: white;\n\t\t\t}\n\t\t</style>\n\t\t${ resolvedAssets.styles ?? '' }\n\t\t${ resolvedAssets.scripts ?? '' }\n\t</head>\n\t${ body }\n</html>`;\n\n\tsrc = URL.createObjectURL( new Blob( [ html ], { type: 'text/html' } ) );\n\tiframeSrcCache.set( resolvedAssets, src );\n\tiframeSrcCleanup?.register( resolvedAssets, src );\n\treturn src;\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\treadonly,\n\tforwardedRef: ref,\n\ttitle = __( 'Editor canvas' ),\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.isPreviewMode,\n\t\t};\n\t}, [] );\n\t/** @type {[Document, React.Dispatch<Document>]} */\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\n\tconst setRef = useRefEffect( ( node ) => {\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\t// Prevent clicks on link fragments from navigating away. Note that links\n\t\t// inside `contenteditable` are already disabled by the browser, so\n\t\t// this is for links in blocks outside of `contenteditable`.\n\t\tfunction interceptLinkClicks( event ) {\n\t\t\tif (\n\t\t\t\tevent.target.tagName === 'A' &&\n\t\t\t\tevent.target.getAttribute( 'href' )?.startsWith( '#' )\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// Manually handle link fragment navigation within the iframe. The iframe's\n\t\t\t\t// location is a blob URL, which can't be used to resolve relative links like\n\t\t\t\t// `#hash`. The relative link would be resolved against the iframe's base URL\n\t\t\t\t// or the parent frame's URL, causing the iframe to navigate to a completely\n\t\t\t\t// different page. Setting the `location.hash` works because it really sets the\n\t\t\t\t// blob URL's hash.\n\t\t\t\t//\n\t\t\t\t// Links with fragments are used for example with footnotes. Clicking on these\n\t\t\t\t// links will scroll smoothly to the anchors in the editor canvas.\n\t\t\t\tiFrameDocument.defaultView.location.hash = event.target\n\t\t\t\t\t.getAttribute( 'href' )\n\t\t\t\t\t.slice( 1 );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\n\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t// the server in the future (which will run the PHP filters).\n\t\tsetBodyClasses(\n\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t( name ) =>\n\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t)\n\t\t);\n\n\t\tfunction onLoad() {\n\t\t\tconst { contentDocument } = node;\n\t\t\tconst { documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\t\t\tsetIframeDocument( contentDocument );\n\n\t\t\tdocumentElement.classList.add( 'block-editor-iframe__html' );\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\n\t\t\tfor ( const compatStyle of getCompatibilityStyles() ) {\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\tiFrameDocument.addEventListener( 'click', interceptLinkClicks );\n\t\t}\n\n\t\tnode.addEventListener( 'load', onLoad );\n\n\t\treturn () => {\n\t\t\tsetIframeDocument( undefined );\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\tiFrameDocument?.removeEventListener( 'click', interceptLinkClicks );\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\tcontentRef: scaleContentRef,\n\t\tcontainerRef,\n\t\tisZoomedOut,\n\t\tscaleContainerWidth,\n\t} = useScaleCanvas( {\n\t\tscale,\n\t\tframeSize: parseInt( frameSize ),\n\t\tiframeDocument,\n\t} );\n\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\n\tconst unguardedBodyRef = useMergeRefs( [\n\t\tuseBubbleEvents( iframeDocument ),\n\t\tcontentRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t\tscaleContentRef,\n\t] );\n\n\t// Attach the body ref only when the iframe document and window are available.\n\t// When an iframe element is moved in the DOM, like when reordering a list,\n\t// its `window` object is destroyed and recreated, and the `defaultView` field is\n\t// briefly `null`. We need to guard for such calls of the ref callbacks.\n\tconst bodyRef = useRefEffect(\n\t\t( node ) => {\n\t\t\tif ( node.ownerDocument.defaultView ) {\n\t\t\t\tunguardedBodyRef( node );\n\t\t\t\treturn () => unguardedBodyRef( null );\n\t\t\t}\n\t\t\treturn () => {};\n\t\t},\n\t\t[ unguardedBodyRef ]\n\t);\n\n\tconst src = getIframeSrc( resolvedAssets );\n\n\t// Make sure to not render the before and after focusable div elements in view\n\t// mode. They're only needed to capture focus in edit mode.\n\tconst shouldRenderFocusCaptureElements = tabIndex >= 0 && ! isPreviewMode;\n\n\tconst iframe = (\n\t\t<>\n\t\t\t{ shouldRenderFocusCaptureElements && before }\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\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: props.style?.height,\n\t\t\t\t\tborder: 0,\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ title }\n\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\tif ( props.onKeyDown ) {\n\t\t\t\t\t\tprops.onKeyDown( event );\n\t\t\t\t\t}\n\t\t\t\t\t// If the event originates from inside the iframe, it means\n\t\t\t\t\t// it bubbled through the portal, but only with React\n\t\t\t\t\t// events. We need to bubble native events as well,\n\t\t\t\t\t// though by doing so we also trigger another React event,\n\t\t\t\t\t// so we need to stop the propagation of this event to avoid\n\t\t\t\t\t// duplication.\n\t\t\t\t\tif (\n\t\t\t\t\t\tevent.currentTarget.ownerDocument !==\n\t\t\t\t\t\tevent.target.ownerDocument\n\t\t\t\t\t) {\n\t\t\t\t\t\t// We should only stop propagation of the React event,\n\t\t\t\t\t\t// the native event should further bubble inside the\n\t\t\t\t\t\t// iframe to the document and window.\n\t\t\t\t\t\t// Alternatively, we could consider redispatching the\n\t\t\t\t\t\t// native event in the iframe.\n\t\t\t\t\t\tconst { stopPropagation } = event.nativeEvent;\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = () => {};\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tevent.nativeEvent.stopPropagation = stopPropagation;\n\t\t\t\t\t\tbubbleEvent(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\twindow.KeyboardEvent,\n\t\t\t\t\t\t\tevent.currentTarget\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\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={ clsx(\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<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{ shouldRenderFocusCaptureElements && after }\n\t\t</>\n\t);\n\n\treturn (\n\t\t<div className=\"block-editor-iframe__container\" ref={ containerRef }>\n\t\t\t<div\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-iframe__scale-container',\n\t\t\t\t\tisZoomedOut && 'is-zoomed-out'\n\t\t\t\t) }\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--wp-block-editor-iframe-zoom-out-scale-container-width':\n\t\t\t\t\t\tisZoomedOut && `${ scaleContainerWidth }px`,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ iframe }\n\t\t\t</div>\n\t\t</div>\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 initialized.\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 set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised )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AO,oBAAC,UAAS,GAAG,OAAQ,cAAe,KAAM;AAClD;AAEA,IAAO,iBAAQ,WAAY,aAAc;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/inserter/hooks/use-patterns-paging.js"],
4
- "sourcesContent": ["import { useMemo, useState, useEffect } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst PAGE_SIZE = 20;\n\n/**\n * Supplies values needed to page the patterns list client side.\n *\n * @param {Array} currentCategoryPatterns An array of the current patterns to display.\n * @param {string} currentCategory The currently selected category.\n * @param {Object} scrollContainerRef Ref of container to to find scroll container for when moving between pages.\n * @param {string} currentFilter The currently search filter.\n *\n * @return {Object} Returns the relevant paging values. (totalItems, categoryPatternsList, numPages, changePage, currentPage)\n */\nexport default function usePatternsPaging(\n\tcurrentCategoryPatterns,\n\tcurrentCategory,\n\tscrollContainerRef,\n\tcurrentFilter = ''\n) {\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\tconst previousCategory = usePrevious( currentCategory );\n\tconst previousFilter = usePrevious( currentFilter );\n\tif (\n\t\t( previousCategory !== currentCategory ||\n\t\t\tpreviousFilter !== currentFilter ) &&\n\t\tcurrentPage !== 1\n\t) {\n\t\tsetCurrentPage( 1 );\n\t}\n\tconst totalItems = currentCategoryPatterns.length;\n\tconst pageIndex = currentPage - 1;\n\tconst categoryPatterns = useMemo( () => {\n\t\treturn currentCategoryPatterns.slice(\n\t\t\tpageIndex * PAGE_SIZE,\n\t\t\tpageIndex * PAGE_SIZE + PAGE_SIZE\n\t\t);\n\t}, [ pageIndex, currentCategoryPatterns ] );\n\tconst numPages = Math.ceil( currentCategoryPatterns.length / PAGE_SIZE );\n\tconst changePage = ( page ) => {\n\t\tconst scrollContainer = getScrollContainer(\n\t\t\tscrollContainerRef?.current\n\t\t);\n\t\tscrollContainer?.scrollTo( 0, 0 );\n\n\t\tsetCurrentPage( page );\n\t};\n\n\tuseEffect(\n\t\tfunction scrollToTopOnCategoryChange() {\n\t\t\tconst scrollContainer = getScrollContainer(\n\t\t\t\tscrollContainerRef?.current\n\t\t\t);\n\t\t\tscrollContainer?.scrollTo( 0, 0 );\n\t\t},\n\t\t[ currentCategory, scrollContainerRef ]\n\t);\n\n\treturn {\n\t\ttotalItems,\n\t\tcategoryPatterns,\n\t\tnumPages,\n\t\tchangePage,\n\t\tcurrentPage,\n\t};\n}\n"],
4
+ "sourcesContent": ["import { useMemo, useState, useEffect } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\nimport { getScrollContainer } from '@wordpress/dom';\n\nconst PAGE_SIZE = 20;\n\n/**\n * Supplies values needed to page the patterns list client side.\n *\n * @param {Array} currentCategoryPatterns An array of the current patterns to display.\n * @param {string} currentCategory The currently selected category.\n * @param {Object} scrollContainerRef Ref of container to find scroll container for when moving between pages.\n * @param {string} currentFilter The currently search filter.\n *\n * @return {Object} Returns the relevant paging values. (totalItems, categoryPatternsList, numPages, changePage, currentPage)\n */\nexport default function usePatternsPaging(\n\tcurrentCategoryPatterns,\n\tcurrentCategory,\n\tscrollContainerRef,\n\tcurrentFilter = ''\n) {\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\tconst previousCategory = usePrevious( currentCategory );\n\tconst previousFilter = usePrevious( currentFilter );\n\tif (\n\t\t( previousCategory !== currentCategory ||\n\t\t\tpreviousFilter !== currentFilter ) &&\n\t\tcurrentPage !== 1\n\t) {\n\t\tsetCurrentPage( 1 );\n\t}\n\tconst totalItems = currentCategoryPatterns.length;\n\tconst pageIndex = currentPage - 1;\n\tconst categoryPatterns = useMemo( () => {\n\t\treturn currentCategoryPatterns.slice(\n\t\t\tpageIndex * PAGE_SIZE,\n\t\t\tpageIndex * PAGE_SIZE + PAGE_SIZE\n\t\t);\n\t}, [ pageIndex, currentCategoryPatterns ] );\n\tconst numPages = Math.ceil( currentCategoryPatterns.length / PAGE_SIZE );\n\tconst changePage = ( page ) => {\n\t\tconst scrollContainer = getScrollContainer(\n\t\t\tscrollContainerRef?.current\n\t\t);\n\t\tscrollContainer?.scrollTo( 0, 0 );\n\n\t\tsetCurrentPage( page );\n\t};\n\n\tuseEffect(\n\t\tfunction scrollToTopOnCategoryChange() {\n\t\t\tconst scrollContainer = getScrollContainer(\n\t\t\t\tscrollContainerRef?.current\n\t\t\t);\n\t\t\tscrollContainer?.scrollTo( 0, 0 );\n\t\t},\n\t\t[ currentCategory, scrollContainerRef ]\n\t);\n\n\treturn {\n\t\ttotalItems,\n\t\tcategoryPatterns,\n\t\tnumPages,\n\t\tchangePage,\n\t\tcurrentPage,\n\t};\n}\n"],
5
5
  "mappings": ";AAAA,SAAS,SAAS,UAAU,iBAAiB;AAC7C,SAAS,mBAAmB;AAC5B,SAAS,0BAA0B;AAEnC,IAAM,YAAY;AAYH,SAAR,kBACN,yBACA,iBACA,oBACA,gBAAgB,IACf;AACD,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,CAAE;AACpD,QAAM,mBAAmB,YAAa,eAAgB;AACtD,QAAM,iBAAiB,YAAa,aAAc;AAClD,OACG,qBAAqB,mBACtB,mBAAmB,kBACpB,gBAAgB,GACf;AACD,mBAAgB,CAAE;AAAA,EACnB;AACA,QAAM,aAAa,wBAAwB;AAC3C,QAAM,YAAY,cAAc;AAChC,QAAM,mBAAmB,QAAS,MAAM;AACvC,WAAO,wBAAwB;AAAA,MAC9B,YAAY;AAAA,MACZ,YAAY,YAAY;AAAA,IACzB;AAAA,EACD,GAAG,CAAE,WAAW,uBAAwB,CAAE;AAC1C,QAAM,WAAW,KAAK,KAAM,wBAAwB,SAAS,SAAU;AACvE,QAAM,aAAa,CAAE,SAAU;AAC9B,UAAM,kBAAkB;AAAA,MACvB,oBAAoB;AAAA,IACrB;AACA,qBAAiB,SAAU,GAAG,CAAE;AAEhC,mBAAgB,IAAK;AAAA,EACtB;AAEA;AAAA,IACC,SAAS,8BAA8B;AACtC,YAAM,kBAAkB;AAAA,QACvB,oBAAoB;AAAA,MACrB;AACA,uBAAiB,SAAU,GAAG,CAAE;AAAA,IACjC;AAAA,IACA,CAAE,iBAAiB,kBAAmB;AAAA,EACvC;AAEA,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/inserter-draggable-blocks/index.jsx"],
4
- "sourcesContent": ["import { Draggable } from '@wordpress/components';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport BlockDraggableChip from '../block-draggable/draggable-chip';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst InserterDraggableBlocks = ( {\n\tisEnabled,\n\tblocks,\n\ticon,\n\tchildren,\n\tpattern,\n} ) => {\n\tconst blockName = blocks.length === 1 ? blocks[ 0 ].name : undefined;\n\tconst blockTypeIcon = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\tblockName &&\n\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.icon\n\t\t\t);\n\t\t},\n\t\t[ blockName ]\n\t);\n\n\tconst { startDragging, stopDragging } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst patternBlock = useMemo( () => {\n\t\treturn pattern?.type === INSERTER_PATTERN_TYPES.user &&\n\t\t\tpattern?.syncStatus !== 'unsynced'\n\t\t\t? [ createBlock( 'core/block', { ref: pattern.id } ) ]\n\t\t\t: undefined;\n\t}, [ pattern?.type, pattern?.syncStatus, pattern?.id ] );\n\n\tif ( ! isEnabled ) {\n\t\treturn children( {\n\t\t\tdraggable: false,\n\t\t\tonDragStart: undefined,\n\t\t\tonDragEnd: undefined,\n\t\t} );\n\t}\n\n\tconst draggableBlocks = patternBlock ?? blocks;\n\treturn (\n\t\t<Draggable\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ { type: 'inserter', blocks: draggableBlocks } }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\tstartDragging();\n\t\t\t\tconst addedTypes = new Set();\n\t\t\t\tfor ( const block of draggableBlocks ) {\n\t\t\t\t\tconst type = `wp-block:${ block.name }`;\n\t\t\t\t\t/*\n\t\t\t\t\t * Only add each block type once to avoid DataTransferItemList::add `NotSupportedError`\n\t\t\t\t\t * when patterns contain multiple blocks of the same type.\n\t\t\t\t\t */\n\t\t\t\t\tif ( ! addedTypes.has( type ) ) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * This will fill in the dataTransfer.types array so that\n\t\t\t\t\t\t * the drop zone can check if the draggable is eligible.\n\t\t\t\t\t\t * Unfortuantely, on drag start, we don't have access to the\n\t\t\t\t\t\t * actual data, only the data keys/types.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tevent.dataTransfer.items.add( '', type );\n\t\t\t\t\t\taddedTypes.add( type );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonDragEnd={ () => {\n\t\t\t\tstopDragging();\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip\n\t\t\t\t\tcount={ blocks.length }\n\t\t\t\t\ticon={ icon || ( ! pattern && blockTypeIcon ) }\n\t\t\t\t\tisPattern={ !! pattern }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tonDragStart: onDraggableStart,\n\t\t\t\t\tonDragEnd: onDraggableEnd,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default InserterDraggableBlocks;\n"],
4
+ "sourcesContent": ["import { Draggable } from '@wordpress/components';\nimport { createBlock, store as blocksStore } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport BlockDraggableChip from '../block-draggable/draggable-chip';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst InserterDraggableBlocks = ( {\n\tisEnabled,\n\tblocks,\n\ticon,\n\tchildren,\n\tpattern,\n} ) => {\n\tconst blockName = blocks.length === 1 ? blocks[ 0 ].name : undefined;\n\tconst blockTypeIcon = useSelect(\n\t\t( select ) => {\n\t\t\treturn (\n\t\t\t\tblockName &&\n\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.icon\n\t\t\t);\n\t\t},\n\t\t[ blockName ]\n\t);\n\n\tconst { startDragging, stopDragging } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst patternBlock = useMemo( () => {\n\t\treturn pattern?.type === INSERTER_PATTERN_TYPES.user &&\n\t\t\tpattern?.syncStatus !== 'unsynced'\n\t\t\t? [ createBlock( 'core/block', { ref: pattern.id } ) ]\n\t\t\t: undefined;\n\t}, [ pattern?.type, pattern?.syncStatus, pattern?.id ] );\n\n\tif ( ! isEnabled ) {\n\t\treturn children( {\n\t\t\tdraggable: false,\n\t\t\tonDragStart: undefined,\n\t\t\tonDragEnd: undefined,\n\t\t} );\n\t}\n\n\tconst draggableBlocks = patternBlock ?? blocks;\n\treturn (\n\t\t<Draggable\n\t\t\t__experimentalTransferDataType=\"wp-blocks\"\n\t\t\ttransferData={ { type: 'inserter', blocks: draggableBlocks } }\n\t\t\tonDragStart={ ( event ) => {\n\t\t\t\tstartDragging();\n\t\t\t\tconst addedTypes = new Set();\n\t\t\t\tfor ( const block of draggableBlocks ) {\n\t\t\t\t\tconst type = `wp-block:${ block.name }`;\n\t\t\t\t\t/*\n\t\t\t\t\t * Only add each block type once to avoid DataTransferItemList::add `NotSupportedError`\n\t\t\t\t\t * when patterns contain multiple blocks of the same type.\n\t\t\t\t\t */\n\t\t\t\t\tif ( ! addedTypes.has( type ) ) {\n\t\t\t\t\t\t/*\n\t\t\t\t\t\t * This will fill in the dataTransfer.types array so that\n\t\t\t\t\t\t * the drop zone can check if the draggable is eligible.\n\t\t\t\t\t\t * Unfortunately, on drag start, we don't have access to the\n\t\t\t\t\t\t * actual data, only the data keys/types.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tevent.dataTransfer.items.add( '', type );\n\t\t\t\t\t\taddedTypes.add( type );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonDragEnd={ () => {\n\t\t\t\tstopDragging();\n\t\t\t} }\n\t\t\t__experimentalDragComponent={\n\t\t\t\t<BlockDraggableChip\n\t\t\t\t\tcount={ blocks.length }\n\t\t\t\t\ticon={ icon || ( ! pattern && blockTypeIcon ) }\n\t\t\t\t\tisPattern={ !! pattern }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onDraggableStart, onDraggableEnd } ) => {\n\t\t\t\treturn children( {\n\t\t\t\t\tdraggable: true,\n\t\t\t\t\tonDragStart: onDraggableStart,\n\t\t\t\t\tonDragEnd: onDraggableEnd,\n\t\t\t\t} );\n\t\t\t} }\n\t\t</Draggable>\n\t);\n};\n\nexport default InserterDraggableBlocks;\n"],
5
5
  "mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,aAAa,SAAS,mBAAmB;AAClD,SAAS,aAAa,iBAAiB;AACvC,SAAS,eAAe;AACxB,OAAO,wBAAwB;AAC/B,SAAS,8BAA8B;AACvC,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AAqEnB;AAnEJ,IAAM,0BAA0B,CAAE;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAO;AACN,QAAM,YAAY,OAAO,WAAW,IAAI,OAAQ,CAAE,EAAE,OAAO;AAC3D,QAAM,gBAA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AAAA,UACX,aAAa;AAAA,UACb,WAAW;AAAA,QACZ,CAAE;AAAA,MACH;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,oCAAQ;",
6
6
  "names": []
7
7
  }
@@ -2,7 +2,7 @@
2
2
  import { PanelBody } from "@wordpress/components";
3
3
  import { __ } from "@wordpress/i18n";
4
4
  import BlockQuickNavigation from "../block-quick-navigation/index.mjs";
5
- import { Fragment, jsx } from "react/jsx-runtime";
5
+ import { jsx } from "react/jsx-runtime";
6
6
  var ContentTab = ({
7
7
  contentClientIds,
8
8
  onSwitchToListView,
@@ -11,15 +11,14 @@ var ContentTab = ({
11
11
  if (!contentClientIds || contentClientIds.length === 0) {
12
12
  return null;
13
13
  }
14
- const shouldShowBlockFields = window?.__experimentalContentOnlyInspectorFields;
15
- return /* @__PURE__ */ jsx(Fragment, { children: !shouldShowBlockFields && /* @__PURE__ */ jsx(PanelBody, { title: __("Content"), children: /* @__PURE__ */ jsx(
14
+ return /* @__PURE__ */ jsx(PanelBody, { title: __("Content"), children: /* @__PURE__ */ jsx(
16
15
  BlockQuickNavigation,
17
16
  {
18
17
  clientIds: contentClientIds,
19
18
  onSwitchToListView,
20
19
  hasListViewTab
21
20
  }
22
- ) }) });
21
+ ) });
23
22
  };
24
23
  var content_tab_default = ContentTab;
25
24
  export {