@wordpress/block-editor 14.1.0 → 14.2.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 (630) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -10
  3. package/build/components/block-alignment-matrix-control/index.js +2 -2
  4. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  5. package/build/components/block-breadcrumb/index.js +8 -2
  6. package/build/components/block-breadcrumb/index.js.map +1 -1
  7. package/build/components/block-canvas/index.js +8 -1
  8. package/build/components/block-canvas/index.js.map +1 -1
  9. package/build/components/block-compare/block-view.js +4 -1
  10. package/build/components/block-compare/block-view.js.map +1 -1
  11. package/build/components/block-draggable/index.js +4 -4
  12. package/build/components/block-draggable/index.js.map +1 -1
  13. package/build/components/block-draggable/use-scroll-when-dragging.js +25 -25
  14. package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  15. package/build/components/block-edit/multiple-usage-warning.js +8 -2
  16. package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
  17. package/build/components/block-inspector/index.js +27 -9
  18. package/build/components/block-inspector/index.js.map +1 -1
  19. package/build/components/block-list/block-invalid-warning.js +6 -3
  20. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  21. package/build/components/block-list/block.js +5 -1
  22. package/build/components/block-list/block.js.map +1 -1
  23. package/build/components/block-list/use-block-props/index.js +5 -1
  24. package/build/components/block-list/use-block-props/index.js.map +1 -1
  25. package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  26. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  27. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +46 -0
  28. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  29. package/build/components/block-lock/toolbar.js +3 -3
  30. package/build/components/block-lock/toolbar.js.map +1 -1
  31. package/build/components/block-mover/button.js +4 -1
  32. package/build/components/block-mover/button.js.map +1 -1
  33. package/build/components/block-mover/index.js +4 -1
  34. package/build/components/block-mover/index.js.map +1 -1
  35. package/build/components/block-navigation/dropdown.js +4 -1
  36. package/build/components/block-navigation/dropdown.js.map +1 -1
  37. package/build/components/block-pattern-setup/index.js +1 -4
  38. package/build/components/block-pattern-setup/index.js.map +1 -1
  39. package/build/components/block-pattern-setup/setup-toolbar.js +22 -7
  40. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  41. package/build/components/block-patterns-list/index.js +11 -14
  42. package/build/components/block-patterns-list/index.js.map +1 -1
  43. package/build/components/block-patterns-paging/index.js +12 -3
  44. package/build/components/block-patterns-paging/index.js.map +1 -1
  45. package/build/components/block-popover/index.js +2 -15
  46. package/build/components/block-popover/index.js.map +1 -1
  47. package/build/components/block-quick-navigation/index.js +4 -1
  48. package/build/components/block-quick-navigation/index.js.map +1 -1
  49. package/build/components/block-settings-menu-controls/index.js +4 -0
  50. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  51. package/build/components/block-switcher/index.js +22 -17
  52. package/build/components/block-switcher/index.js.map +1 -1
  53. package/build/components/block-switcher/pattern-transformations-menu.js +1 -4
  54. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  55. package/build/components/block-toolbar/index.js +12 -11
  56. package/build/components/block-toolbar/index.js.map +1 -1
  57. package/build/components/block-toolbar/shuffle.js +6 -2
  58. package/build/components/block-toolbar/shuffle.js.map +1 -1
  59. package/build/components/block-tools/block-selection-button.js +8 -2
  60. package/build/components/block-tools/block-selection-button.js.map +1 -1
  61. package/build/components/block-tools/block-toolbar-popover.js +10 -6
  62. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  63. package/build/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  64. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  65. package/build/components/block-tools/zoom-out-mode-inserters.js +4 -9
  66. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  67. package/build/components/block-tools/zoom-out-popover.js +3 -4
  68. package/build/components/block-tools/zoom-out-popover.js.map +1 -1
  69. package/build/components/block-tools/zoom-out-toolbar.js +14 -5
  70. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  71. package/build/components/block-variation-picker/index.js +4 -1
  72. package/build/components/block-variation-picker/index.js.map +1 -1
  73. package/build/components/block-variation-transforms/index.js +4 -1
  74. package/build/components/block-variation-transforms/index.js.map +1 -1
  75. package/build/components/button-block-appender/index.js +14 -3
  76. package/build/components/button-block-appender/index.js.map +1 -1
  77. package/build/components/colors-gradients/dropdown.js +4 -1
  78. package/build/components/colors-gradients/dropdown.js.map +1 -1
  79. package/build/components/content-lock/index.js +13 -0
  80. package/build/components/content-lock/index.js.map +1 -0
  81. package/build/components/content-lock/modify-content-lock-menu-item.js +64 -0
  82. package/build/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  83. package/build/components/editor-styles/index.js +4 -3
  84. package/build/components/editor-styles/index.js.map +1 -1
  85. package/build/components/global-styles/background-panel.js +8 -12
  86. package/build/components/global-styles/background-panel.js.map +1 -1
  87. package/build/components/global-styles/color-panel.js +8 -5
  88. package/build/components/global-styles/color-panel.js.map +1 -1
  89. package/build/components/global-styles/color-panel.native.js +1 -1
  90. package/build/components/global-styles/color-panel.native.js.map +1 -1
  91. package/build/components/global-styles/dimensions-panel.js +34 -37
  92. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  93. package/build/components/global-styles/filters-panel.js +4 -1
  94. package/build/components/global-styles/filters-panel.js.map +1 -1
  95. package/build/components/global-styles/shadow-panel-components.js +13 -7
  96. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  97. package/build/components/global-styles/typography-utils.js +17 -6
  98. package/build/components/global-styles/typography-utils.js.map +1 -1
  99. package/build/components/global-styles/utils.js +4 -6
  100. package/build/components/global-styles/utils.js.map +1 -1
  101. package/build/components/grid/grid-item-movers.js +2 -2
  102. package/build/components/grid/grid-item-movers.js.map +1 -1
  103. package/build/components/iframe/index.js +5 -5
  104. package/build/components/iframe/index.js.map +1 -1
  105. package/build/components/inner-blocks/index.js +2 -4
  106. package/build/components/inner-blocks/index.js.map +1 -1
  107. package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  108. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  109. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  110. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  111. package/build/components/inserter/block-patterns-tab/index.js +4 -1
  112. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  113. package/build/components/inserter/library.js +2 -4
  114. package/build/components/inserter/library.js.map +1 -1
  115. package/build/components/inserter/media-tab/hooks.js +3 -3
  116. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  117. package/build/components/inserter/media-tab/media-list.js +1 -4
  118. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  119. package/build/components/inserter/media-tab/media-preview.js +8 -2
  120. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  121. package/build/components/inserter/media-tab/media-tab.js +4 -1
  122. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  123. package/build/components/inserter/menu.js +7 -24
  124. package/build/components/inserter/menu.js.map +1 -1
  125. package/build/components/inserter/quick-inserter.js +4 -1
  126. package/build/components/inserter/quick-inserter.js.map +1 -1
  127. package/build/components/inserter-list-item/index.js +4 -4
  128. package/build/components/inserter-list-item/index.js.map +1 -1
  129. package/build/components/inserter-listbox/index.js +3 -7
  130. package/build/components/inserter-listbox/index.js.map +1 -1
  131. package/build/components/inserter-listbox/item.js +4 -1
  132. package/build/components/inserter-listbox/item.js.map +1 -1
  133. package/build/components/inspector-controls/groups.js +2 -0
  134. package/build/components/inspector-controls/groups.js.map +1 -1
  135. package/build/components/inspector-controls-tabs/index.js +4 -1
  136. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  137. package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
  138. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  139. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  140. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  141. package/build/components/inspector-popover-header/index.js +8 -2
  142. package/build/components/inspector-popover-header/index.js.map +1 -1
  143. package/build/components/letter-spacing-control/index.js +7 -4
  144. package/build/components/letter-spacing-control/index.js.map +1 -1
  145. package/build/components/link-control/index.js +19 -10
  146. package/build/components/link-control/index.js.map +1 -1
  147. package/build/components/link-control/settings-drawer.js +4 -1
  148. package/build/components/link-control/settings-drawer.js.map +1 -1
  149. package/build/components/list-view/block-select-button.js +4 -1
  150. package/build/components/list-view/block-select-button.js.map +1 -1
  151. package/build/components/media-placeholder/index.js +28 -7
  152. package/build/components/media-placeholder/index.js.map +1 -1
  153. package/build/components/media-replace-flow/index.js +8 -1
  154. package/build/components/media-replace-flow/index.js.map +1 -1
  155. package/build/components/provider/use-block-sync.js +19 -19
  156. package/build/components/provider/use-block-sync.js.map +1 -1
  157. package/build/components/rich-text/event-listeners/paste-handler.js +12 -1
  158. package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  159. package/build/components/rich-text/index.js +38 -30
  160. package/build/components/rich-text/index.js.map +1 -1
  161. package/build/components/rich-text/use-mark-persistent.js +5 -5
  162. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  163. package/build/components/skip-to-selected-block/index.js +4 -1
  164. package/build/components/skip-to-selected-block/index.js.map +1 -1
  165. package/build/components/tool-selector/index.js +4 -1
  166. package/build/components/tool-selector/index.js.map +1 -1
  167. package/build/components/url-input/button.js +12 -3
  168. package/build/components/url-input/button.js.map +1 -1
  169. package/build/components/url-input/index.js +4 -1
  170. package/build/components/url-input/index.js.map +1 -1
  171. package/build/components/use-block-drop-zone/index.js +4 -6
  172. package/build/components/use-block-drop-zone/index.js.map +1 -1
  173. package/build/components/writing-flow/index.js +2 -1
  174. package/build/components/writing-flow/index.js.map +1 -1
  175. package/build/components/writing-flow/use-arrow-nav.js +4 -1
  176. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  177. package/build/components/writing-flow/use-event-redirect.js +66 -0
  178. package/build/components/writing-flow/use-event-redirect.js.map +1 -0
  179. package/build/components/writing-flow/use-input.js +31 -1
  180. package/build/components/writing-flow/use-input.js.map +1 -1
  181. package/build/components/writing-flow/use-select-all.js +14 -1
  182. package/build/components/writing-flow/use-select-all.js.map +1 -1
  183. package/build/components/writing-flow/use-selection-observer.js +20 -6
  184. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  185. package/build/components/writing-flow/use-tab-nav.js +4 -4
  186. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  187. package/build/components/writing-flow/utils.js +27 -0
  188. package/build/components/writing-flow/utils.js.map +1 -1
  189. package/build/hooks/block-bindings.js +32 -29
  190. package/build/hooks/block-bindings.js.map +1 -1
  191. package/build/hooks/content-lock-ui.js +8 -26
  192. package/build/hooks/content-lock-ui.js.map +1 -1
  193. package/build/hooks/duotone.js +0 -4
  194. package/build/hooks/duotone.js.map +1 -1
  195. package/build/hooks/layout.js +4 -1
  196. package/build/hooks/layout.js.map +1 -1
  197. package/build/hooks/spacing-visualizer.js +3 -3
  198. package/build/hooks/spacing-visualizer.js.map +1 -1
  199. package/build/hooks/style.js +1 -5
  200. package/build/hooks/style.js.map +1 -1
  201. package/build/hooks/use-bindings-attributes.js +19 -20
  202. package/build/hooks/use-bindings-attributes.js.map +1 -1
  203. package/build/hooks/use-zoom-out.js +7 -7
  204. package/build/hooks/use-zoom-out.js.map +1 -1
  205. package/build/layouts/constrained.js +41 -41
  206. package/build/layouts/constrained.js.map +1 -1
  207. package/build/layouts/flex.js +4 -1
  208. package/build/layouts/flex.js.map +1 -1
  209. package/build/layouts/utils.js +1 -7
  210. package/build/layouts/utils.js.map +1 -1
  211. package/build/private-apis.js +2 -1
  212. package/build/private-apis.js.map +1 -1
  213. package/build/store/actions.js +2 -7
  214. package/build/store/actions.js.map +1 -1
  215. package/build/store/private-actions.js +1 -0
  216. package/build/store/private-actions.js.map +1 -1
  217. package/build/store/private-keys.js +2 -1
  218. package/build/store/private-keys.js.map +1 -1
  219. package/build/store/private-selectors.js +13 -15
  220. package/build/store/private-selectors.js.map +1 -1
  221. package/build/store/reducer.js +1 -8
  222. package/build/store/reducer.js.map +1 -1
  223. package/build/store/selectors.js +19 -43
  224. package/build/store/selectors.js.map +1 -1
  225. package/build/store/utils.js +48 -0
  226. package/build/store/utils.js.map +1 -1
  227. package/build/utils/block-bindings.js +16 -11
  228. package/build/utils/block-bindings.js.map +1 -1
  229. package/build/utils/dom.js +101 -0
  230. package/build/utils/dom.js.map +1 -1
  231. package/build/utils/get-font-styles-and-weights.js +4 -4
  232. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  233. package/build/utils/transform-styles/index.js +120 -16
  234. package/build/utils/transform-styles/index.js.map +1 -1
  235. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  236. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  237. package/build-module/components/block-breadcrumb/index.js +8 -2
  238. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  239. package/build-module/components/block-canvas/index.js +9 -1
  240. package/build-module/components/block-canvas/index.js.map +1 -1
  241. package/build-module/components/block-compare/block-view.js +4 -1
  242. package/build-module/components/block-compare/block-view.js.map +1 -1
  243. package/build-module/components/block-draggable/index.js +4 -4
  244. package/build-module/components/block-draggable/index.js.map +1 -1
  245. package/build-module/components/block-draggable/use-scroll-when-dragging.js +25 -25
  246. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  247. package/build-module/components/block-edit/multiple-usage-warning.js +8 -2
  248. package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
  249. package/build-module/components/block-inspector/index.js +27 -9
  250. package/build-module/components/block-inspector/index.js.map +1 -1
  251. package/build-module/components/block-list/block-invalid-warning.js +6 -3
  252. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  253. package/build-module/components/block-list/block.js +5 -1
  254. package/build-module/components/block-list/block.js.map +1 -1
  255. package/build-module/components/block-list/use-block-props/index.js +5 -1
  256. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  257. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  258. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  259. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +40 -0
  260. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  261. package/build-module/components/block-lock/toolbar.js +3 -3
  262. package/build-module/components/block-lock/toolbar.js.map +1 -1
  263. package/build-module/components/block-mover/button.js +4 -1
  264. package/build-module/components/block-mover/button.js.map +1 -1
  265. package/build-module/components/block-mover/index.js +4 -1
  266. package/build-module/components/block-mover/index.js.map +1 -1
  267. package/build-module/components/block-navigation/dropdown.js +4 -1
  268. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  269. package/build-module/components/block-pattern-setup/index.js +1 -4
  270. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  271. package/build-module/components/block-pattern-setup/setup-toolbar.js +23 -8
  272. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  273. package/build-module/components/block-patterns-list/index.js +11 -14
  274. package/build-module/components/block-patterns-list/index.js.map +1 -1
  275. package/build-module/components/block-patterns-paging/index.js +12 -3
  276. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  277. package/build-module/components/block-popover/index.js +2 -15
  278. package/build-module/components/block-popover/index.js.map +1 -1
  279. package/build-module/components/block-quick-navigation/index.js +4 -1
  280. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  281. package/build-module/components/block-settings-menu-controls/index.js +4 -0
  282. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  283. package/build-module/components/block-switcher/index.js +22 -17
  284. package/build-module/components/block-switcher/index.js.map +1 -1
  285. package/build-module/components/block-switcher/pattern-transformations-menu.js +1 -4
  286. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  287. package/build-module/components/block-toolbar/index.js +12 -11
  288. package/build-module/components/block-toolbar/index.js.map +1 -1
  289. package/build-module/components/block-toolbar/shuffle.js +6 -2
  290. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  291. package/build-module/components/block-tools/block-selection-button.js +8 -2
  292. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  293. package/build-module/components/block-tools/block-toolbar-popover.js +10 -6
  294. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  295. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  296. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  297. package/build-module/components/block-tools/zoom-out-mode-inserters.js +4 -9
  298. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  299. package/build-module/components/block-tools/zoom-out-popover.js +3 -4
  300. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
  301. package/build-module/components/block-tools/zoom-out-toolbar.js +15 -6
  302. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  303. package/build-module/components/block-variation-picker/index.js +4 -1
  304. package/build-module/components/block-variation-picker/index.js.map +1 -1
  305. package/build-module/components/block-variation-transforms/index.js +4 -1
  306. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  307. package/build-module/components/button-block-appender/index.js +15 -4
  308. package/build-module/components/button-block-appender/index.js.map +1 -1
  309. package/build-module/components/colors-gradients/dropdown.js +4 -1
  310. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  311. package/build-module/components/content-lock/index.js +2 -0
  312. package/build-module/components/content-lock/index.js.map +1 -0
  313. package/build-module/components/content-lock/modify-content-lock-menu-item.js +57 -0
  314. package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  315. package/build-module/components/editor-styles/index.js +4 -3
  316. package/build-module/components/editor-styles/index.js.map +1 -1
  317. package/build-module/components/global-styles/background-panel.js +8 -12
  318. package/build-module/components/global-styles/background-panel.js.map +1 -1
  319. package/build-module/components/global-styles/color-panel.js +7 -4
  320. package/build-module/components/global-styles/color-panel.js.map +1 -1
  321. package/build-module/components/global-styles/color-panel.native.js +2 -2
  322. package/build-module/components/global-styles/color-panel.native.js.map +1 -1
  323. package/build-module/components/global-styles/dimensions-panel.js +36 -39
  324. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  325. package/build-module/components/global-styles/filters-panel.js +4 -1
  326. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  327. package/build-module/components/global-styles/shadow-panel-components.js +13 -7
  328. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  329. package/build-module/components/global-styles/typography-utils.js +17 -6
  330. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  331. package/build-module/components/global-styles/utils.js +4 -6
  332. package/build-module/components/global-styles/utils.js.map +1 -1
  333. package/build-module/components/grid/grid-item-movers.js +3 -3
  334. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  335. package/build-module/components/iframe/index.js +5 -5
  336. package/build-module/components/iframe/index.js.map +1 -1
  337. package/build-module/components/inner-blocks/index.js +2 -4
  338. package/build-module/components/inner-blocks/index.js.map +1 -1
  339. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  340. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  341. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  342. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  343. package/build-module/components/inserter/block-patterns-tab/index.js +4 -1
  344. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  345. package/build-module/components/inserter/library.js +2 -4
  346. package/build-module/components/inserter/library.js.map +1 -1
  347. package/build-module/components/inserter/media-tab/hooks.js +3 -3
  348. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  349. package/build-module/components/inserter/media-tab/media-list.js +1 -4
  350. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  351. package/build-module/components/inserter/media-tab/media-preview.js +8 -2
  352. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  353. package/build-module/components/inserter/media-tab/media-tab.js +4 -1
  354. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  355. package/build-module/components/inserter/menu.js +7 -24
  356. package/build-module/components/inserter/menu.js.map +1 -1
  357. package/build-module/components/inserter/quick-inserter.js +4 -1
  358. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  359. package/build-module/components/inserter-list-item/index.js +4 -4
  360. package/build-module/components/inserter-list-item/index.js.map +1 -1
  361. package/build-module/components/inserter-listbox/index.js +3 -7
  362. package/build-module/components/inserter-listbox/index.js.map +1 -1
  363. package/build-module/components/inserter-listbox/item.js +4 -1
  364. package/build-module/components/inserter-listbox/item.js.map +1 -1
  365. package/build-module/components/inspector-controls/groups.js +2 -0
  366. package/build-module/components/inspector-controls/groups.js.map +1 -1
  367. package/build-module/components/inspector-controls-tabs/index.js +4 -1
  368. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  369. package/build-module/components/inspector-controls-tabs/settings-tab.js +3 -1
  370. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  371. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  372. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  373. package/build-module/components/inspector-popover-header/index.js +8 -2
  374. package/build-module/components/inspector-popover-header/index.js.map +1 -1
  375. package/build-module/components/letter-spacing-control/index.js +7 -4
  376. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  377. package/build-module/components/link-control/index.js +19 -10
  378. package/build-module/components/link-control/index.js.map +1 -1
  379. package/build-module/components/link-control/settings-drawer.js +4 -1
  380. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  381. package/build-module/components/list-view/block-select-button.js +4 -1
  382. package/build-module/components/list-view/block-select-button.js.map +1 -1
  383. package/build-module/components/media-placeholder/index.js +28 -7
  384. package/build-module/components/media-placeholder/index.js.map +1 -1
  385. package/build-module/components/media-replace-flow/index.js +8 -1
  386. package/build-module/components/media-replace-flow/index.js.map +1 -1
  387. package/build-module/components/provider/use-block-sync.js +19 -19
  388. package/build-module/components/provider/use-block-sync.js.map +1 -1
  389. package/build-module/components/rich-text/event-listeners/paste-handler.js +12 -1
  390. package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  391. package/build-module/components/rich-text/index.js +39 -31
  392. package/build-module/components/rich-text/index.js.map +1 -1
  393. package/build-module/components/rich-text/use-mark-persistent.js +5 -5
  394. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  395. package/build-module/components/skip-to-selected-block/index.js +4 -1
  396. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  397. package/build-module/components/tool-selector/index.js +4 -1
  398. package/build-module/components/tool-selector/index.js.map +1 -1
  399. package/build-module/components/url-input/button.js +12 -3
  400. package/build-module/components/url-input/button.js.map +1 -1
  401. package/build-module/components/url-input/index.js +4 -1
  402. package/build-module/components/url-input/index.js.map +1 -1
  403. package/build-module/components/use-block-drop-zone/index.js +4 -6
  404. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  405. package/build-module/components/writing-flow/index.js +2 -1
  406. package/build-module/components/writing-flow/index.js.map +1 -1
  407. package/build-module/components/writing-flow/use-arrow-nav.js +4 -1
  408. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  409. package/build-module/components/writing-flow/use-event-redirect.js +60 -0
  410. package/build-module/components/writing-flow/use-event-redirect.js.map +1 -0
  411. package/build-module/components/writing-flow/use-input.js +31 -1
  412. package/build-module/components/writing-flow/use-input.js.map +1 -1
  413. package/build-module/components/writing-flow/use-select-all.js +14 -1
  414. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  415. package/build-module/components/writing-flow/use-selection-observer.js +16 -2
  416. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  417. package/build-module/components/writing-flow/use-tab-nav.js +4 -4
  418. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  419. package/build-module/components/writing-flow/utils.js +26 -0
  420. package/build-module/components/writing-flow/utils.js.map +1 -1
  421. package/build-module/hooks/block-bindings.js +34 -31
  422. package/build-module/hooks/block-bindings.js.map +1 -1
  423. package/build-module/hooks/content-lock-ui.js +10 -30
  424. package/build-module/hooks/content-lock-ui.js.map +1 -1
  425. package/build-module/hooks/duotone.js +0 -4
  426. package/build-module/hooks/duotone.js.map +1 -1
  427. package/build-module/hooks/layout.js +4 -1
  428. package/build-module/hooks/layout.js.map +1 -1
  429. package/build-module/hooks/spacing-visualizer.js +3 -3
  430. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  431. package/build-module/hooks/style.js +1 -5
  432. package/build-module/hooks/style.js.map +1 -1
  433. package/build-module/hooks/use-bindings-attributes.js +19 -20
  434. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  435. package/build-module/hooks/use-zoom-out.js +7 -7
  436. package/build-module/hooks/use-zoom-out.js.map +1 -1
  437. package/build-module/layouts/constrained.js +43 -43
  438. package/build-module/layouts/constrained.js.map +1 -1
  439. package/build-module/layouts/flex.js +4 -1
  440. package/build-module/layouts/flex.js.map +1 -1
  441. package/build-module/layouts/utils.js +1 -7
  442. package/build-module/layouts/utils.js.map +1 -1
  443. package/build-module/private-apis.js +3 -2
  444. package/build-module/private-apis.js.map +1 -1
  445. package/build-module/store/actions.js +2 -7
  446. package/build-module/store/actions.js.map +1 -1
  447. package/build-module/store/private-actions.js +1 -0
  448. package/build-module/store/private-actions.js.map +1 -1
  449. package/build-module/store/private-keys.js +1 -0
  450. package/build-module/store/private-keys.js.map +1 -1
  451. package/build-module/store/private-selectors.js +12 -15
  452. package/build-module/store/private-selectors.js.map +1 -1
  453. package/build-module/store/reducer.js +1 -7
  454. package/build-module/store/reducer.js.map +1 -1
  455. package/build-module/store/selectors.js +22 -46
  456. package/build-module/store/selectors.js.map +1 -1
  457. package/build-module/store/utils.js +46 -0
  458. package/build-module/store/utils.js.map +1 -1
  459. package/build-module/utils/block-bindings.js +17 -12
  460. package/build-module/utils/block-bindings.js.map +1 -1
  461. package/build-module/utils/dom.js +99 -0
  462. package/build-module/utils/dom.js.map +1 -1
  463. package/build-module/utils/get-font-styles-and-weights.js +4 -4
  464. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  465. package/build-module/utils/transform-styles/index.js +120 -16
  466. package/build-module/utils/transform-styles/index.js.map +1 -1
  467. package/build-style/content-rtl.css +2 -11
  468. package/build-style/content.css +2 -11
  469. package/build-style/style-rtl.css +17 -38
  470. package/build-style/style.css +17 -38
  471. package/build-types/utils/dom.d.ts +25 -0
  472. package/build-types/utils/dom.d.ts.map +1 -1
  473. package/package.json +34 -32
  474. package/src/components/block-alignment-matrix-control/index.js +1 -1
  475. package/src/components/block-breadcrumb/index.js +4 -0
  476. package/src/components/block-breadcrumb/style.scss +1 -1
  477. package/src/components/block-canvas/index.js +9 -1
  478. package/src/components/block-compare/block-view.js +7 -1
  479. package/src/components/block-draggable/content.scss +1 -1
  480. package/src/components/block-draggable/index.js +4 -4
  481. package/src/components/block-draggable/style.scss +1 -1
  482. package/src/components/block-draggable/use-scroll-when-dragging.js +25 -25
  483. package/src/components/block-edit/multiple-usage-warning.js +4 -0
  484. package/src/components/block-inspector/index.js +22 -6
  485. package/src/components/block-list/block-invalid-warning.js +4 -2
  486. package/src/components/block-list/block.js +6 -2
  487. package/src/components/block-list/content.scss +2 -3
  488. package/src/components/block-list/use-block-props/index.js +3 -0
  489. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  490. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +44 -0
  491. package/src/components/block-lock/style.scss +1 -1
  492. package/src/components/block-lock/toolbar.js +3 -3
  493. package/src/components/block-mover/button.js +2 -0
  494. package/src/components/block-mover/index.js +2 -0
  495. package/src/components/block-mover/style.scss +1 -1
  496. package/src/components/block-navigation/dropdown.js +2 -0
  497. package/src/components/block-pattern-setup/index.js +3 -7
  498. package/src/components/block-pattern-setup/setup-toolbar.js +17 -4
  499. package/src/components/block-pattern-setup/style.scss +2 -2
  500. package/src/components/block-patterns-list/index.js +15 -13
  501. package/src/components/block-patterns-list/style.scss +2 -2
  502. package/src/components/block-patterns-paging/index.js +6 -0
  503. package/src/components/block-popover/index.js +7 -28
  504. package/src/components/block-popover/style.scss +1 -1
  505. package/src/components/block-quick-navigation/index.js +2 -0
  506. package/src/components/block-settings-menu-controls/index.js +7 -1
  507. package/src/components/block-switcher/index.js +26 -20
  508. package/src/components/block-switcher/pattern-transformations-menu.js +3 -7
  509. package/src/components/block-switcher/style.scss +5 -6
  510. package/src/components/block-toolbar/index.js +17 -8
  511. package/src/components/block-toolbar/shuffle.js +9 -7
  512. package/src/components/block-tools/block-selection-button.js +4 -0
  513. package/src/components/block-tools/block-toolbar-popover.js +10 -6
  514. package/src/components/block-tools/style.scss +3 -4
  515. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  516. package/src/components/block-tools/zoom-out-mode-inserters.js +2 -5
  517. package/src/components/block-tools/zoom-out-popover.js +3 -7
  518. package/src/components/block-tools/zoom-out-toolbar.js +20 -6
  519. package/src/components/block-variation-picker/README.md +2 -2
  520. package/src/components/block-variation-picker/index.js +6 -1
  521. package/src/components/block-variation-transforms/index.js +2 -0
  522. package/src/components/block-variation-transforms/style.scss +1 -1
  523. package/src/components/button-block-appender/content.scss +0 -1
  524. package/src/components/button-block-appender/index.js +14 -3
  525. package/src/components/color-palette/test/control.js +15 -2
  526. package/src/components/colors-gradients/dropdown.js +5 -1
  527. package/src/components/colors-gradients/style.scss +4 -4
  528. package/src/components/content-lock/index.js +1 -0
  529. package/src/components/content-lock/modify-content-lock-menu-item.js +58 -0
  530. package/src/components/default-block-appender/content.scss +0 -1
  531. package/src/components/editor-styles/index.js +4 -3
  532. package/src/components/global-styles/background-panel.js +6 -14
  533. package/src/components/global-styles/color-panel.js +8 -4
  534. package/src/components/global-styles/color-panel.native.js +2 -2
  535. package/src/components/global-styles/dimensions-panel.js +40 -40
  536. package/src/components/global-styles/filters-panel.js +5 -1
  537. package/src/components/global-styles/shadow-panel-components.js +12 -8
  538. package/src/components/global-styles/style.scss +3 -4
  539. package/src/components/global-styles/test/typography-utils.js +96 -5
  540. package/src/components/global-styles/test/utils.js +10 -0
  541. package/src/components/global-styles/typography-utils.js +22 -6
  542. package/src/components/global-styles/utils.js +4 -6
  543. package/src/components/grid/grid-item-movers.js +3 -3
  544. package/src/components/grid/style.scss +1 -1
  545. package/src/components/iframe/index.js +5 -5
  546. package/src/components/inner-blocks/index.js +2 -2
  547. package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  548. package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -0
  549. package/src/components/inserter/block-patterns-tab/index.js +2 -0
  550. package/src/components/inserter/library.js +0 -2
  551. package/src/components/inserter/media-tab/hooks.js +3 -3
  552. package/src/components/inserter/media-tab/media-list.js +1 -4
  553. package/src/components/inserter/media-tab/media-preview.js +12 -2
  554. package/src/components/inserter/media-tab/media-tab.js +2 -0
  555. package/src/components/inserter/menu.js +15 -29
  556. package/src/components/inserter/quick-inserter.js +2 -0
  557. package/src/components/inserter/style.scss +6 -8
  558. package/src/components/inserter-list-item/index.js +4 -4
  559. package/src/components/inserter-list-item/style.scss +1 -3
  560. package/src/components/inserter-listbox/index.js +2 -8
  561. package/src/components/inserter-listbox/item.js +9 -1
  562. package/src/components/inspector-controls/groups.js +2 -0
  563. package/src/components/inspector-controls-tabs/index.js +2 -0
  564. package/src/components/inspector-controls-tabs/settings-tab.js +1 -0
  565. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -2
  566. package/src/components/inspector-popover-header/index.js +4 -0
  567. package/src/components/letter-spacing-control/README.md +8 -1
  568. package/src/components/letter-spacing-control/index.js +7 -4
  569. package/src/components/link-control/index.js +17 -8
  570. package/src/components/link-control/settings-drawer.js +2 -0
  571. package/src/components/link-control/style.scss +1 -3
  572. package/src/components/list-view/block-select-button.js +2 -0
  573. package/src/components/list-view/style.scss +14 -16
  574. package/src/components/media-placeholder/index.js +14 -0
  575. package/src/components/media-replace-flow/index.js +12 -1
  576. package/src/components/provider/use-block-sync.js +20 -20
  577. package/src/components/responsive-block-control/README.md +3 -27
  578. package/src/components/rich-text/content.scss +1 -1
  579. package/src/components/rich-text/event-listeners/paste-handler.js +6 -1
  580. package/src/components/rich-text/index.js +54 -41
  581. package/src/components/rich-text/style.scss +1 -1
  582. package/src/components/rich-text/use-mark-persistent.js +5 -5
  583. package/src/components/skip-to-selected-block/index.js +2 -0
  584. package/src/components/spacing-sizes-control/style.scss +1 -0
  585. package/src/components/tool-selector/index.js +2 -0
  586. package/src/components/url-input/button.js +6 -0
  587. package/src/components/url-input/index.js +2 -0
  588. package/src/components/url-popover/stories/index.story.js +7 -1
  589. package/src/components/use-block-drop-zone/index.js +4 -4
  590. package/src/components/warning/content.scss +3 -10
  591. package/src/components/writing-flow/index.js +2 -0
  592. package/src/components/writing-flow/use-arrow-nav.js +9 -2
  593. package/src/components/writing-flow/use-event-redirect.js +72 -0
  594. package/src/components/writing-flow/use-input.js +36 -1
  595. package/src/components/writing-flow/use-select-all.js +18 -1
  596. package/src/components/writing-flow/use-selection-observer.js +23 -3
  597. package/src/components/writing-flow/use-tab-nav.js +4 -4
  598. package/src/components/writing-flow/utils.js +30 -0
  599. package/src/hooks/block-bindings.js +42 -43
  600. package/src/hooks/block-bindings.scss +1 -9
  601. package/src/hooks/content-lock-ui.js +11 -36
  602. package/src/hooks/duotone.js +0 -4
  603. package/src/hooks/layout.js +2 -0
  604. package/src/hooks/layout.scss +3 -11
  605. package/src/hooks/spacing-visualizer.js +3 -3
  606. package/src/hooks/style.js +1 -4
  607. package/src/hooks/use-bindings-attributes.js +23 -24
  608. package/src/hooks/use-zoom-out.js +7 -7
  609. package/src/layouts/constrained.js +50 -47
  610. package/src/layouts/flex.js +2 -0
  611. package/src/layouts/test/grid.js +2 -2
  612. package/src/layouts/test/utils.js +6 -8
  613. package/src/layouts/utils.js +1 -9
  614. package/src/private-apis.js +2 -0
  615. package/src/store/actions.js +4 -6
  616. package/src/store/private-actions.js +1 -0
  617. package/src/store/private-keys.js +1 -0
  618. package/src/store/private-selectors.js +12 -11
  619. package/src/store/reducer.js +0 -5
  620. package/src/store/selectors.js +32 -51
  621. package/src/store/utils.js +50 -0
  622. package/src/utils/block-bindings.js +15 -16
  623. package/src/utils/dom.js +117 -0
  624. package/src/utils/get-font-styles-and-weights.js +12 -4
  625. package/src/utils/test/get-font-styles-and-weights.js +148 -0
  626. package/src/utils/test/transform-styles.js +259 -50
  627. package/src/utils/transform-styles/index.js +132 -21
  628. package/tsconfig.json +1 -0
  629. package/tsconfig.tsbuildinfo +1 -1
  630. package/src/utils/test/__snapshots__/transform-styles.js.snap +0 -109
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
6
- import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalText as Text, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalTruncate as Truncate, __experimentalVStack as VStack, privateApis as componentsPrivateApis } from '@wordpress/components';
7
- import { useRegistry } from '@wordpress/data';
6
+ import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalText as Text, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalVStack as VStack, privateApis as componentsPrivateApis } from '@wordpress/components';
7
+ import { useRegistry, useSelect } from '@wordpress/data';
8
8
  import { useContext, Fragment } from '@wordpress/element';
9
9
  import { useViewportMatch } from '@wordpress/compose';
10
10
 
@@ -16,16 +16,12 @@ import { unlock } from '../lock-unlock';
16
16
  import InspectorControls from '../components/inspector-controls';
17
17
  import BlockContext from '../components/block-context';
18
18
  import { useBlockBindingsUtils } from '../utils/block-bindings';
19
+ import { store as blockEditorStore } from '../store';
19
20
  import { jsx as _jsx } from "react/jsx-runtime";
20
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
22
  import { Fragment as _Fragment } from "react/jsx-runtime";
22
23
  const {
23
- DropdownMenuV2: DropdownMenu,
24
- DropdownMenuGroupV2: DropdownMenuGroup,
25
- DropdownMenuRadioItemV2: DropdownMenuRadioItem,
26
- DropdownMenuItemLabelV2: DropdownMenuItemLabel,
27
- DropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,
28
- DropdownMenuSeparatorV2: DropdownMenuSeparator
24
+ DropdownMenuV2
29
25
  } = unlock(componentsPrivateApis);
30
26
  const useToolsPanelDropdownMenuProps = () => {
31
27
  const isMobile = useViewportMatch('medium', '<');
@@ -52,14 +48,10 @@ function BlockBindingsPanelDropdown({
52
48
  const currentKey = binding?.args?.key;
53
49
  return /*#__PURE__*/_jsx(_Fragment, {
54
50
  children: Object.entries(fieldsList).map(([name, fields], i) => /*#__PURE__*/_jsxs(Fragment, {
55
- children: [/*#__PURE__*/_jsxs(DropdownMenuGroup, {
56
- children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(Text, {
57
- className: "block-editor-bindings__source-label",
58
- upperCase: true,
59
- variant: "muted",
60
- "aria-hidden": true,
51
+ children: [/*#__PURE__*/_jsxs(DropdownMenuV2.Group, {
52
+ children: [Object.keys(fieldsList).length > 1 && /*#__PURE__*/_jsx(DropdownMenuV2.GroupLabel, {
61
53
  children: registeredSources[name].label
62
- }), Object.entries(fields).map(([key, value]) => /*#__PURE__*/_jsxs(DropdownMenuRadioItem, {
54
+ }), Object.entries(fields).map(([key, value]) => /*#__PURE__*/_jsxs(DropdownMenuV2.RadioItem, {
63
55
  onChange: () => updateBlockBindings({
64
56
  [attribute]: {
65
57
  source: name,
@@ -71,13 +63,13 @@ function BlockBindingsPanelDropdown({
71
63
  name: attribute + '-binding',
72
64
  value: key,
73
65
  checked: key === currentKey,
74
- children: [/*#__PURE__*/_jsx(DropdownMenuItemLabel, {
66
+ children: [/*#__PURE__*/_jsx(DropdownMenuV2.ItemLabel, {
75
67
  children: key
76
- }), /*#__PURE__*/_jsx(DropdownMenuItemHelpText, {
68
+ }), /*#__PURE__*/_jsx(DropdownMenuV2.ItemHelpText, {
77
69
  children: value
78
70
  })]
79
71
  }, key))]
80
- }), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(DropdownMenuSeparator, {})]
72
+ }), i !== Object.keys(fieldsList).length - 1 && /*#__PURE__*/_jsx(DropdownMenuV2.Separator, {})]
81
73
  }, name))
82
74
  });
83
75
  }
@@ -90,15 +82,17 @@ function BlockBindingsAttribute({
90
82
  args
91
83
  } = binding || {};
92
84
  const sourceProps = unlock(blocksPrivateApis).getBlockBindingsSource(sourceName);
85
+ const isSourceInvalid = !sourceProps;
93
86
  return /*#__PURE__*/_jsxs(VStack, {
94
- children: [/*#__PURE__*/_jsx(Truncate, {
87
+ className: "block-editor-bindings__item",
88
+ children: [/*#__PURE__*/_jsx(Text, {
89
+ truncate: true,
95
90
  children: attribute
96
91
  }), !!binding && /*#__PURE__*/_jsx(Text, {
97
- variant: "muted",
98
- className: "block-editor-bindings__item-explanation",
99
- children: /*#__PURE__*/_jsx(Truncate, {
100
- children: args?.key || sourceProps?.label || sourceName
101
- })
92
+ truncate: true,
93
+ variant: !isSourceInvalid && 'muted',
94
+ isDestructive: isSourceInvalid,
95
+ children: isSourceInvalid ? __('Invalid source') : args?.key || sourceProps?.label || sourceName
102
96
  })]
103
97
  });
104
98
  }
@@ -134,10 +128,9 @@ function EditableBlockBindingsPanelItems({
134
128
  [attribute]: undefined
135
129
  });
136
130
  },
137
- children: /*#__PURE__*/_jsx(DropdownMenu, {
131
+ children: /*#__PURE__*/_jsx(DropdownMenuV2, {
138
132
  placement: isMobile ? 'bottom-start' : 'left-start',
139
133
  gutter: isMobile ? 8 : 36,
140
- className: "block-editor-bindings__popover",
141
134
  trigger: /*#__PURE__*/_jsx(Item, {
142
135
  children: /*#__PURE__*/_jsx(BlockBindingsAttribute, {
143
136
  attribute: attribute,
@@ -176,6 +169,13 @@ export const BlockBindingsPanel = ({
176
169
  delete filteredBindings[key];
177
170
  }
178
171
  });
172
+ const {
173
+ canUpdateBlockBindings
174
+ } = useSelect(select => {
175
+ return {
176
+ canUpdateBlockBindings: select(blockEditorStore).getSettings().canUpdateBlockBindings
177
+ };
178
+ }, []);
179
179
  if (!bindableAttributes || bindableAttributes.length === 0) {
180
180
  return null;
181
181
  }
@@ -215,12 +215,13 @@ export const BlockBindingsPanel = ({
215
215
  }
216
216
  });
217
217
 
218
- // Lock the UI when the experiment is not enabled or there are no fields to connect to.
219
- const readOnly = !window.__experimentalBlockBindingsUI || !Object.keys(fieldsList).length;
218
+ // Lock the UI when the user can't update bindings or there are no fields to connect to.
219
+ const readOnly = !canUpdateBlockBindings || !Object.keys(fieldsList).length;
220
220
  if (readOnly && Object.keys(filteredBindings).length === 0) {
221
221
  return null;
222
222
  }
223
223
  return /*#__PURE__*/_jsx(InspectorControls, {
224
+ group: "bindings",
224
225
  children: /*#__PURE__*/_jsxs(ToolsPanel, {
225
226
  label: __('Attributes'),
226
227
  resetAll: () => {
@@ -238,9 +239,11 @@ export const BlockBindingsPanel = ({
238
239
  bindings: filteredBindings,
239
240
  fieldsList: fieldsList
240
241
  })
241
- }), /*#__PURE__*/_jsx(Text, {
242
- variant: "muted",
243
- children: __('Attributes connected to various sources.')
242
+ }), /*#__PURE__*/_jsx(ItemGroup, {
243
+ children: /*#__PURE__*/_jsx(Text, {
244
+ variant: "muted",
245
+ children: __('Attributes connected to custom fields or other dynamic data.')
246
+ })
244
247
  })]
245
248
  })
246
249
  });
@@ -1 +1 @@
1
- {"version":3,"names":["__","privateApis","blocksPrivateApis","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalTruncate","Truncate","__experimentalVStack","VStack","componentsPrivateApis","useRegistry","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","unlock","InspectorControls","BlockContext","useBlockBindingsUtils","jsx","_jsx","jsxs","_jsxs","_Fragment","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuRadioItemV2","DropdownMenuRadioItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","DropdownMenuItemHelpTextV2","DropdownMenuItemHelpText","DropdownMenuSeparatorV2","DropdownMenuSeparator","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","getBlockBindingsSources","registeredSources","updateBlockBindings","currentKey","args","key","children","Object","entries","map","name","fields","i","keys","length","className","upperCase","variant","label","value","onChange","source","checked","BlockBindingsAttribute","sourceName","sourceProps","getBlockBindingsSource","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","attributes","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","blockName","metadata","registry","blockContext","removeAllBlockBindings","bindableAttributes","dropdownMenuProps","filteredBindings","forEach","getFieldsList","usesContext","context","sourceList","readOnly","window","__experimentalBlockBindingsUI","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useRegistry } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuRadioItemV2: DropdownMenuRadioItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tDropdownMenuItemHelpTextV2: DropdownMenuItemHelpText,\n\tDropdownMenuSeparatorV2: DropdownMenuSeparator,\n} = unlock( componentsPrivateApis );\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\tclassName=\"block-editor-bindings__source-label\"\n\t\t\t\t\t\t\t\tupperCase\n\t\t\t\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, value ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuRadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\targs: { key },\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuItemLabel>\n\t\t\t\t\t\t\t\t\t{ key }\n\t\t\t\t\t\t\t\t</DropdownMenuItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuItemHelpText>\n\t\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t\t</DropdownMenuItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuRadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuSeparator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps =\n\t\tunlock( blocksPrivateApis ).getBlockBindingsSource( sourceName );\n\treturn (\n\t\t<VStack>\n\t\t\t<Truncate>{ attribute }</Truncate>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tclassName=\"block-editor-bindings__item-explanation\"\n\t\t\t\t>\n\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t{ args?.key || sourceProps?.label || sourceName }\n\t\t\t\t\t</Truncate>\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\tclassName=\"block-editor-bindings__popover\"\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst registry = useRegistry();\n\tconst blockContext = useContext( BlockContext );\n\tconst { bindings } = metadata || {};\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst fieldsList = {};\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tObject.entries( registeredSources ).forEach(\n\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\tif ( getFieldsList ) {\n\t\t\t\t// Populate context.\n\t\t\t\tconst context = {};\n\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\tregistry,\n\t\t\t\t\tcontext,\n\t\t\t\t} );\n\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\tif ( sourceList ) {\n\t\t\t\t\tfieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t// Remove empty sources.\n\tObject.entries( fieldsList ).forEach( ( [ key, value ] ) => {\n\t\tif ( ! Object.keys( value ).length ) {\n\t\t\tdelete fieldsList[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the experiment is not enabled or there are no fields to connect to.\n\tconst readOnly =\n\t\t! window.__experimentalBlockBindingsUI ||\n\t\t! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t{ __( 'Attributes connected to various sources.' ) }\n\t\t\t\t</Text>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mapp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C5B,SAAS,EAAC,8BAA8B;MAAAT,QAAA,gBAExC/B,IAAA,CAACzB,SAAS;QAACwG,UAAU;QAACC,WAAW;QAAAjD,QAAA,EAC9B4C,QAAQ,gBACT3E,IAAA,CAACoD,+BAA+B;UAC/BC,QAAQ,EAAGgB;QAAkB,CAC7B,CAAC,gBAEFrE,IAAA,CAACsD,+BAA+B;UAC/BC,UAAU,EAAGY,kBAAoB;UACjCd,QAAQ,EAAGgB,gBAAkB;UAC7B/C,UAAU,EAAGA;QAAY,CACzB;MACD,CACS,CAAC,eACZtB,IAAA,CAACrB,IAAI;QAAC+D,OAAO,EAAC,OAAO;QAAAX,QAAA,EAClB5D,EAAE,CAAE,0CAA2C;MAAC,CAC7C,CAAC;IAAA,CACI;EAAC,CACK,CAAC;AAEtB,CAAC;AAED,eAAe;EACd8G,IAAI,EAAEpB,kBAAkB;EACxBqB,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","privateApis","blocksPrivateApis","__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalText","Text","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalVStack","VStack","componentsPrivateApis","useRegistry","useSelect","useContext","Fragment","useViewportMatch","canBindAttribute","getBindableAttributes","unlock","InspectorControls","BlockContext","useBlockBindingsUtils","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","_Fragment","DropdownMenuV2","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","BlockBindingsPanelDropdown","fieldsList","attribute","binding","getBlockBindingsSources","registeredSources","updateBlockBindings","currentKey","args","key","children","Object","entries","map","name","fields","i","Group","keys","length","GroupLabel","label","value","RadioItem","onChange","source","checked","ItemLabel","ItemHelpText","Separator","BlockBindingsAttribute","sourceName","sourceProps","getBlockBindingsSource","isSourceInvalid","className","truncate","variant","isDestructive","ReadOnlyBlockBindingsPanelItems","bindings","EditableBlockBindingsPanelItems","attributes","hasValue","onDeselect","undefined","gutter","trigger","BlockBindingsPanel","blockName","metadata","registry","blockContext","removeAllBlockBindings","bindableAttributes","dropdownMenuProps","filteredBindings","forEach","canUpdateBlockBindings","select","getSettings","getFieldsList","usesContext","context","sourceList","readOnly","group","resetAll","isBordered","isSeparated","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/block-bindings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalText as Text,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useRegistry, useSelect } from '@wordpress/data';\nimport { useContext, Fragment } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tcanBindAttribute,\n\tgetBindableAttributes,\n} from '../hooks/use-bindings-attributes';\nimport { unlock } from '../lock-unlock';\nimport InspectorControls from '../components/inspector-controls';\nimport BlockContext from '../components/block-context';\nimport { useBlockBindingsUtils } from '../utils/block-bindings';\nimport { store as blockEditorStore } from '../store';\n\nconst { DropdownMenuV2 } = unlock( componentsPrivateApis );\n\nconst useToolsPanelDropdownMenuProps = () => {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n};\n\nfunction BlockBindingsPanelDropdown( { fieldsList, attribute, binding } ) {\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst currentKey = binding?.args?.key;\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( fieldsList ).map( ( [ name, fields ], i ) => (\n\t\t\t\t<Fragment key={ name }>\n\t\t\t\t\t<DropdownMenuV2.Group>\n\t\t\t\t\t\t{ Object.keys( fieldsList ).length > 1 && (\n\t\t\t\t\t\t\t<DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t\t\t{ registeredSources[ name ].label }\n\t\t\t\t\t\t\t</DropdownMenuV2.GroupLabel>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ Object.entries( fields ).map( ( [ key, value ] ) => (\n\t\t\t\t\t\t\t<DropdownMenuV2.RadioItem\n\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t\t\t[ attribute ]: {\n\t\t\t\t\t\t\t\t\t\t\tsource: name,\n\t\t\t\t\t\t\t\t\t\t\targs: { key },\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tname={ attribute + '-binding' }\n\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\tchecked={ key === currentKey }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ key }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemLabel>\n\t\t\t\t\t\t\t\t<DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t\t</DropdownMenuV2.ItemHelpText>\n\t\t\t\t\t\t\t</DropdownMenuV2.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</DropdownMenuV2.Group>\n\t\t\t\t\t{ i !== Object.keys( fieldsList ).length - 1 && (\n\t\t\t\t\t\t<DropdownMenuV2.Separator />\n\t\t\t\t\t) }\n\t\t\t\t</Fragment>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction BlockBindingsAttribute( { attribute, binding } ) {\n\tconst { source: sourceName, args } = binding || {};\n\tconst sourceProps =\n\t\tunlock( blocksPrivateApis ).getBlockBindingsSource( sourceName );\n\tconst isSourceInvalid = ! sourceProps;\n\treturn (\n\t\t<VStack className=\"block-editor-bindings__item\">\n\t\t\t<Text truncate>{ attribute }</Text>\n\t\t\t{ !! binding && (\n\t\t\t\t<Text\n\t\t\t\t\ttruncate\n\t\t\t\t\tvariant={ ! isSourceInvalid && 'muted' }\n\t\t\t\t\tisDestructive={ isSourceInvalid }\n\t\t\t\t>\n\t\t\t\t\t{ isSourceInvalid\n\t\t\t\t\t\t? __( 'Invalid source' )\n\t\t\t\t\t\t: args?.key || sourceProps?.label || sourceName }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction ReadOnlyBlockBindingsPanelItems( { bindings } ) {\n\treturn (\n\t\t<>\n\t\t\t{ Object.entries( bindings ).map( ( [ attribute, binding ] ) => (\n\t\t\t\t<Item key={ attribute }>\n\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t/>\n\t\t\t\t</Item>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nfunction EditableBlockBindingsPanelItems( {\n\tattributes,\n\tbindings,\n\tfieldsList,\n} ) {\n\tconst { updateBlockBindings } = useBlockBindingsUtils();\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn (\n\t\t<>\n\t\t\t{ attributes.map( ( attribute ) => {\n\t\t\t\tconst binding = bindings[ attribute ];\n\t\t\t\treturn (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tkey={ attribute }\n\t\t\t\t\t\thasValue={ () => !! binding }\n\t\t\t\t\t\tlabel={ attribute }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tupdateBlockBindings( {\n\t\t\t\t\t\t\t\t[ attribute ]: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DropdownMenuV2\n\t\t\t\t\t\t\tplacement={\n\t\t\t\t\t\t\t\tisMobile ? 'bottom-start' : 'left-start'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgutter={ isMobile ? 8 : 36 }\n\t\t\t\t\t\t\ttrigger={\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t<BlockBindingsAttribute\n\t\t\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockBindingsPanelDropdown\n\t\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t\t\t\tbinding={ binding }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</DropdownMenuV2>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport const BlockBindingsPanel = ( { name: blockName, metadata } ) => {\n\tconst registry = useRegistry();\n\tconst blockContext = useContext( BlockContext );\n\tconst { bindings } = metadata || {};\n\tconst { removeAllBlockBindings } = useBlockBindingsUtils();\n\tconst bindableAttributes = getBindableAttributes( blockName );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst filteredBindings = { ...bindings };\n\tObject.keys( filteredBindings ).forEach( ( key ) => {\n\t\tif (\n\t\t\t! canBindAttribute( blockName, key ) ||\n\t\t\tfilteredBindings[ key ].source === 'core/pattern-overrides'\n\t\t) {\n\t\t\tdelete filteredBindings[ key ];\n\t\t}\n\t} );\n\n\tconst { canUpdateBlockBindings } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tcanUpdateBlockBindings:\n\t\t\t\tselect( blockEditorStore ).getSettings().canUpdateBlockBindings,\n\t\t};\n\t}, [] );\n\n\tif ( ! bindableAttributes || bindableAttributes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst fieldsList = {};\n\tconst { getBlockBindingsSources } = unlock( blocksPrivateApis );\n\tconst registeredSources = getBlockBindingsSources();\n\tObject.entries( registeredSources ).forEach(\n\t\t( [ sourceName, { getFieldsList, usesContext } ] ) => {\n\t\t\tif ( getFieldsList ) {\n\t\t\t\t// Populate context.\n\t\t\t\tconst context = {};\n\t\t\t\tif ( usesContext?.length ) {\n\t\t\t\t\tfor ( const key of usesContext ) {\n\t\t\t\t\t\tcontext[ key ] = blockContext[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst sourceList = getFieldsList( {\n\t\t\t\t\tregistry,\n\t\t\t\t\tcontext,\n\t\t\t\t} );\n\t\t\t\t// Only add source if the list is not empty.\n\t\t\t\tif ( sourceList ) {\n\t\t\t\t\tfieldsList[ sourceName ] = { ...sourceList };\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t);\n\t// Remove empty sources.\n\tObject.entries( fieldsList ).forEach( ( [ key, value ] ) => {\n\t\tif ( ! Object.keys( value ).length ) {\n\t\t\tdelete fieldsList[ key ];\n\t\t}\n\t} );\n\n\t// Lock the UI when the user can't update bindings or there are no fields to connect to.\n\tconst readOnly =\n\t\t! canUpdateBlockBindings || ! Object.keys( fieldsList ).length;\n\n\tif ( readOnly && Object.keys( filteredBindings ).length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorControls group=\"bindings\">\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Attributes' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tremoveAllBlockBindings();\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\tclassName=\"block-editor-bindings__panel\"\n\t\t\t>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t{ readOnly ? (\n\t\t\t\t\t\t<ReadOnlyBlockBindingsPanelItems\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<EditableBlockBindingsPanelItems\n\t\t\t\t\t\t\tattributes={ bindableAttributes }\n\t\t\t\t\t\t\tbindings={ filteredBindings }\n\t\t\t\t\t\t\tfieldsList={ fieldsList }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ItemGroup>\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Attributes connected to custom fields or other dynamic data.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Text>\n\t\t\t\t</ItemGroup>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n};\n\nexport default {\n\tedit: BlockBindingsPanel,\n\tattributeKeys: [ 'metadata' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCC,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,kBAAkB,IAAIC,IAAI,EAC1BC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,oBAAoB,IAAIC,MAAM,EAC9Bb,WAAW,IAAIc,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,UAAU,EAAEC,QAAQ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,EAAGgB,gBAAkB;UAC7BvD,UAAU,EAAGA;QAAY,CACzB;MACD,CACS,CAAC,eACZX,IAAA,CAAC1B,SAAS;QAAA8C,QAAA,eACTpB,IAAA,CAACtB,IAAI;UAACqE,OAAO,EAAC,OAAO;UAAA3B,QAAA,EAClBlD,EAAE,CACH,8DACD;QAAC,CACI;MAAC,CACG,CAAC;IAAA,CACD;EAAC,CACK,CAAC;AAEtB,CAAC;AAED,eAAe;EACd8G,IAAI,EAAEtB,kBAAkB;EACxBuB,aAAa,EAAE,CAAE,UAAU,CAAE;EAC7BC,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { ToolbarButton, MenuItem } from '@wordpress/components';
4
+ import { ToolbarButton } from '@wordpress/components';
5
5
  import { useDispatch, useSelect } from '@wordpress/data';
6
6
  import { __ } from '@wordpress/i18n';
7
7
  import { useCallback } from '@wordpress/element';
@@ -10,7 +10,7 @@ import { useCallback } from '@wordpress/element';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { store as blockEditorStore } from '../store';
13
- import { BlockControls, BlockSettingsMenuControls } from '../components';
13
+ import { BlockControls } from '../components';
14
14
  import { unlock } from '../lock-unlock';
15
15
 
16
16
  // The implementation of content locking is mainly in this file, although the mechanism
@@ -19,11 +19,8 @@ import { unlock } from '../lock-unlock';
19
19
  // Besides the components on this file and the file referenced above the implementation
20
20
  // also includes artifacts on the store (actions, reducers, and selector).
21
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
- import { Fragment as _Fragment } from "react/jsx-runtime";
23
- import { jsxs as _jsxs } from "react/jsx-runtime";
24
22
  function ContentLockControlsPure({
25
- clientId,
26
- isSelected
23
+ clientId
27
24
  }) {
28
25
  const {
29
26
  templateLock,
@@ -42,8 +39,7 @@ function ContentLockControlsPure({
42
39
  };
43
40
  }, [clientId]);
44
41
  const {
45
- stopEditingAsBlocks,
46
- modifyContentLockBlock
42
+ stopEditingAsBlocks
47
43
  } = unlock(useDispatch(blockEditorStore));
48
44
  const isContentLocked = !isLockedByParent && templateLock === 'contentOnly';
49
45
  const stopEditingAsBlockCallback = useCallback(() => {
@@ -53,28 +49,12 @@ function ContentLockControlsPure({
53
49
  return null;
54
50
  }
55
51
  const showStopEditingAsBlocks = isEditingAsBlocks && !isContentLocked;
56
- const showStartEditingAsBlocks = !isEditingAsBlocks && isContentLocked && isSelected;
57
- return /*#__PURE__*/_jsxs(_Fragment, {
58
- children: [showStopEditingAsBlocks && /*#__PURE__*/_jsx(_Fragment, {
59
- children: /*#__PURE__*/_jsx(BlockControls, {
60
- group: "other",
61
- children: /*#__PURE__*/_jsx(ToolbarButton, {
62
- onClick: stopEditingAsBlockCallback,
63
- children: __('Done')
64
- })
65
- })
66
- }), showStartEditingAsBlocks && /*#__PURE__*/_jsx(BlockSettingsMenuControls, {
67
- children: ({
68
- selectedClientIds,
69
- onClose
70
- }) => selectedClientIds.length === 1 && selectedClientIds[0] === clientId && /*#__PURE__*/_jsx(MenuItem, {
71
- onClick: () => {
72
- modifyContentLockBlock(clientId);
73
- onClose();
74
- },
75
- children: __('Modify')
76
- })
77
- })]
52
+ return showStopEditingAsBlocks && /*#__PURE__*/_jsx(BlockControls, {
53
+ group: "other",
54
+ children: /*#__PURE__*/_jsx(ToolbarButton, {
55
+ onClick: stopEditingAsBlockCallback,
56
+ children: __('Done')
57
+ })
78
58
  });
79
59
  }
80
60
  export default {
@@ -1 +1 @@
1
- {"version":3,"names":["ToolbarButton","MenuItem","useDispatch","useSelect","__","useCallback","store","blockEditorStore","BlockControls","BlockSettingsMenuControls","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ContentLockControlsPure","clientId","isSelected","templateLock","isLockedByParent","isEditingAsBlocks","select","getContentLockingParent","getTemplateLock","getTemporarilyEditingAsBlocks","stopEditingAsBlocks","modifyContentLockBlock","isContentLocked","stopEditingAsBlockCallback","showStopEditingAsBlocks","showStartEditingAsBlocks","children","group","onClick","selectedClientIds","onClose","length","edit","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls, BlockSettingsMenuControls } from '../components';\nimport { unlock } from '../lock-unlock';\n\n// The implementation of content locking is mainly in this file, although the mechanism\n// to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect\n// at block-editor/src/components/block-list/index.js.\n// Besides the components on this file and the file referenced above the implementation\n// also includes artifacts on the store (actions, reducers, and selector).\n\nfunction ContentLockControlsPure( { clientId, isSelected } ) {\n\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetContentLockingParent,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetTemporarilyEditingAsBlocks,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\treturn {\n\t\t\t\ttemplateLock: getTemplateLock( clientId ),\n\t\t\t\tisLockedByParent: !! getContentLockingParent( clientId ),\n\t\t\t\tisEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { stopEditingAsBlocks, modifyContentLockBlock } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst isContentLocked =\n\t\t! isLockedByParent && templateLock === 'contentOnly';\n\n\tconst stopEditingAsBlockCallback = useCallback( () => {\n\t\tstopEditingAsBlocks( clientId );\n\t}, [ clientId, stopEditingAsBlocks ] );\n\n\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\treturn null;\n\t}\n\n\tconst showStopEditingAsBlocks = isEditingAsBlocks && ! isContentLocked;\n\tconst showStartEditingAsBlocks =\n\t\t! isEditingAsBlocks && isContentLocked && isSelected;\n\n\treturn (\n\t\t<>\n\t\t\t{ showStopEditingAsBlocks && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarButton onClick={ stopEditingAsBlockCallback }>\n\t\t\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showStartEditingAsBlocks && (\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds, onClose } ) =>\n\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\tselectedClientIds[ 0 ] === clientId && (\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tmodifyContentLockBlock( clientId );\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Modify' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tedit: ContentLockControlsPure,\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,uBAAuB;AAC/D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,eAAe;AACxE,SAASC,MAAM,Q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CAAAE,SAAA;MAAAmB,QAAA,eACCrB,IAAA,CAACJ,aAAa;QAAC0B,KAAK,EAAC,OAAO;QAAAD,QAAA,eAC3BrB,IAAA,CAACZ,aAAa;UAACmC,OAAO,EAAGL,0BAA4B;UAAAG,QAAA,EAClD7B,EAAE,CAAE,MAAO;QAAC,CACA;MAAC,CACF;IAAC,CACf,CACF,EACC4B,wBAAwB,iBACzBpB,IAAA,CAACH,yBAAyB;MAAAwB,QAAA,EACvBA,CAAE;QAAEG,iBAAiB;QAAEC;MAAQ,CAAC,KACjCD,iBAAiB,CAACE,MAAM,KAAK,CAAC,IAC9BF,iBAAiB,CAAE,CAAC,CAAE,KAAKlB,QAAQ,iBAClCN,IAAA,CAACX,QAAQ;QACRkC,OAAO,EAAGA,CAAA,KAAM;UACfP,sBAAsB,CAAEV,QAAS,CAAC;UAClCmB,OAAO,CAAC,CAAC;QACV,CAAG;QAAAJ,QAAA,EAED7B,EAAE,CAAE,QAAS;MAAC,CACP;IACV,CAEwB,CAC3B;EAAA,CACA,CAAC;AAEL;AAEA,eAAe;EACdmC,IAAI,EAAEtB,uBAAuB;EAC7BuB,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ToolbarButton","useDispatch","useSelect","__","useCallback","store","blockEditorStore","BlockControls","unlock","jsx","_jsx","ContentLockControlsPure","clientId","templateLock","isLockedByParent","isEditingAsBlocks","select","getContentLockingParent","getTemplateLock","getTemporarilyEditingAsBlocks","stopEditingAsBlocks","isContentLocked","stopEditingAsBlockCallback","showStopEditingAsBlocks","group","children","onClick","edit","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/content-lock-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { BlockControls } from '../components';\nimport { unlock } from '../lock-unlock';\n\n// The implementation of content locking is mainly in this file, although the mechanism\n// to stop temporarily editing as blocks when an outside block is selected is on component StopEditingAsBlocksOnOutsideSelect\n// at block-editor/src/components/block-list/index.js.\n// Besides the components on this file and the file referenced above the implementation\n// also includes artifacts on the store (actions, reducers, and selector).\n\nfunction ContentLockControlsPure( { clientId } ) {\n\tconst { templateLock, isLockedByParent, isEditingAsBlocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetContentLockingParent,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tgetTemporarilyEditingAsBlocks,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\treturn {\n\t\t\t\ttemplateLock: getTemplateLock( clientId ),\n\t\t\t\tisLockedByParent: !! getContentLockingParent( clientId ),\n\t\t\t\tisEditingAsBlocks: getTemporarilyEditingAsBlocks() === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { stopEditingAsBlocks } = unlock( useDispatch( blockEditorStore ) );\n\tconst isContentLocked =\n\t\t! isLockedByParent && templateLock === 'contentOnly';\n\n\tconst stopEditingAsBlockCallback = useCallback( () => {\n\t\tstopEditingAsBlocks( clientId );\n\t}, [ clientId, stopEditingAsBlocks ] );\n\n\tif ( ! isContentLocked && ! isEditingAsBlocks ) {\n\t\treturn null;\n\t}\n\n\tconst showStopEditingAsBlocks = isEditingAsBlocks && ! isContentLocked;\n\n\treturn (\n\t\tshowStopEditingAsBlocks && (\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarButton onClick={ stopEditingAsBlockCallback }>\n\t\t\t\t\t{ __( 'Done' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</BlockControls>\n\t\t)\n\t);\n}\n\nexport default {\n\tedit: ContentLockControlsPure,\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAA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AEtE,OACCE,uBAAuB,iBACtBb,IAAA,CAACH,aAAa;IAACiB,KAAK,EAAC,OAAO;IAAAC,QAAA,eAC3Bf,IAAA,CAACV,aAAa;MAAC0B,OAAO,EAAGJ,0BAA4B;MAAAG,QAAA,EAClDtB,EAAE,CAAE,MAAO;IAAC,CACA;EAAC,CACF,CACf;AAEH;AAEA,eAAe;EACdwB,IAAI,EAAEhB,uBAAuB;EAC7BiB,UAAUA,CAAA,EAAG;IACZ,OAAO,IAAI;EACZ;AACD,CAAC","ignoreList":[]}
@@ -208,10 +208,6 @@ function useDuotoneStyles({
208
208
  // Build the CSS selectors to which the filter will be applied.
209
209
  const selectors = duotoneSelector.split(',');
210
210
  const selectorsScoped = selectors.map(selectorPart => {
211
- // Extra .editor-styles-wrapper specificity is needed in the editor
212
- // since we're not using inline styles to apply the filter. We need to
213
- // override duotone applied by global styles and theme.json.
214
-
215
211
  // Assuming the selector part is a subclass selector (not a tag name)
216
212
  // so we can prepend the filter id class. If we want to support elements
217
213
  // such as `img` or namespaces, we'll need to add a case for that here.
@@ -1 +1 @@
1
- {"version":3,"names":["extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","useInstanceId","addFilter","useMemo","useEffect","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSettings","getDuotoneFilter","getDuotoneStylesheet","getDuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","usePrivateStyleOverride","default","StylesFiltersPanel","useBlockEditingMode","useBlockElement","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","blockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","children","group","value","filter","onChange","newDuotone","newStyle","__experimentalShareWithChildBlocks","maybePreset","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","css","__unstableType","assets","blockElement","display","offsetHeight","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, usePrivateStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,WAAW,MAAM,sBAAsB;;AAE9C;AACA;AACA;AACA,SACCC,eAAe,EACfC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SACCC,aAAa,EACbC,iBAAiB,EACjBC,4BAA4B,IAAIC,cAAc,EAC9CC,WAAW,QACL,eAAe;AACtB,SACCC,gBAAgB,EAChBC,oBAAoB,EACpBC,yBAAyB,QACnB,6BAA6B;AACpC,SAASC,mBAAmB,QAAQ,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oH,SAAS,EACT,6BAA6B,EAC7B,KACD,CAAC;MACD,IAAKE,mBAAmB,EAAG;QAC1B,MAAMC,YAAY,GAAGxG,mBAAmB,CAAEqG,SAAU,CAAC;QACrD,OAAO,OAAOE,mBAAmB,KAAK,QAAQ,GAC3CtG,aAAa,CAAEuG,YAAY,EAAED,mBAAoB,CAAC,GAClDC,YAAY;MAChB;;MAEA;MACA,OAAOxG,mBAAmB,CAAEqG,SAAS,EAAE,gBAAgB,EAAE;QACxDI,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAE5D,IAAI,CAAG,CAAC;EAEb,MAAMqC,SAAS,GAAGvC,KAAK,EAAEI,KAAK,EAAEnB,OAAO;EAEvC,MAAM8E,WAAW,GAAI,cAAc5B,EAAI,EAAC;EAExC,MAAM6B,YAAY,GAAG3B,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ;IACRC,EAAE,EAAE4B,WAAW;IACf1B,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACN0B,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEArH,SAAS,CACR,0BAA0B,EAC1B,oCAAoC,EACpCkF,oBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","useInstanceId","addFilter","useMemo","useEffect","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSettings","getDuotoneFilter","getDuotoneStylesheet","getDuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","usePrivateStyleOverride","default","StylesFiltersPanel","useBlockEditingMode","useBlockElement","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","EMPTY_ARRAY","isSafari","window","navigator","userAgent","includes","useMultiOriginPresets","presetSetting","defaultSetting","enableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanelPure","style","setAttributes","name","duotoneStyle","color","settings","blockEditingMode","colorPalette","enableCustomColors","enableCustomDuotone","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","children","group","value","filter","onChange","newDuotone","newStyle","__experimentalShareWithChildBlocks","maybePreset","shareWithChildBlocks","edit","useBlockProps","attributeKeys","hasSupport","addDuotoneAttributes","attributes","Object","assign","type","useDuotoneStyles","clientId","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","css","__unstableType","assets","blockElement","display","offsetHeight","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSettings,\n} from '../components';\nimport {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings, usePrivateStyleOverride } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { useBlockElement } from '../components/block-list/use-block-props/use-block-refs';\n\nconst EMPTY_ARRAY = [];\n\n// Safari does not always update the duotone filter when the duotone colors\n// are changed. This browser check is later used to force a re-render of the block\n// element to ensure the duotone filter is updated. The check is included at the\n// root of this file as it only needs to be run once per page load.\nconst isSafari =\n\twindow?.navigator.userAgent &&\n\twindow.navigator.userAgent.includes( 'Safari' ) &&\n\t! window.navigator.userAgent.includes( 'Chrome' ) &&\n\t! window.navigator.userAgent.includes( 'Chromium' );\n\nextend( [ namesPlugin ] );\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst [ enableDefault, userPresets, themePresets, defaultPresets ] =\n\t\tuseSettings(\n\t\t\tdefaultSetting,\n\t\t\t`${ presetSetting }.custom`,\n\t\t\t`${ presetSetting }.theme`,\n\t\t\t`${ presetSetting }.default`\n\t\t);\n\treturn useMemo(\n\t\t() => [\n\t\t\t...( userPresets || EMPTY_ARRAY ),\n\t\t\t...( themePresets || EMPTY_ARRAY ),\n\t\t\t...( ( enableDefault && defaultPresets ) || EMPTY_ARRAY ),\n\t\t],\n\t\t[ enableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nexport function getColorsFromDuotonePreset( duotone, duotonePalette ) {\n\tif ( ! duotone ) {\n\t\treturn;\n\t}\n\tconst preset = duotonePalette?.find( ( { slug } ) => {\n\t\treturn duotone === `var:preset|duotone|${ slug }`;\n\t} );\n\n\treturn preset ? preset.colors : undefined;\n}\n\nexport function getDuotonePresetFromColors( colors, duotonePalette ) {\n\tif ( ! colors || ! Array.isArray( colors ) ) {\n\t\treturn;\n\t}\n\n\tconst preset = duotonePalette?.find( ( duotonePreset ) => {\n\t\treturn duotonePreset?.colors?.every(\n\t\t\t( val, index ) => val === colors[ index ]\n\t\t);\n\t} );\n\n\treturn preset ? `var:preset|duotone|${ preset.slug }` : undefined;\n}\n\nfunction DuotonePanelPure( { style, setAttributes, name } ) {\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst [ enableCustomColors, enableCustomDuotone ] = useSettings(\n\t\t'color.custom',\n\t\t'color.customDuotone'\n\t);\n\tconst disableCustomColors = ! enableCustomColors;\n\tconst disableCustomDuotone =\n\t\t! enableCustomDuotone ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst duotonePresetOrColors = ! Array.isArray( duotoneStyle )\n\t\t? getColorsFromDuotonePreset( duotoneStyle, duotonePalette )\n\t\t: duotoneStyle;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"filter\">\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tvalue={ { filter: { duotone: duotonePresetOrColors } } }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...newDuotone?.filter,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t\t<DuotoneControl\n\t\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tvalue={ duotonePresetOrColors }\n\t\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\t\tconst maybePreset = getDuotonePresetFromColors(\n\t\t\t\t\t\t\tnewDuotone,\n\t\t\t\t\t\t\tduotonePalette\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\tduotone: maybePreset ?? newDuotone, // use preset or fallback to custom colors.\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t\t} }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t</>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: DuotonePanelPure,\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'filter.duotone' );\n\t},\n};\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\tif ( ! hasBlockSupport( settings, 'filter.duotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\nfunction useDuotoneStyles( {\n\tclientId,\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tcss:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t\t\t__unstableType: 'presets',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\tusePrivateStyleOverride(\n\t\tisValidFilter\n\t\t\t? {\n\t\t\t\t\tassets:\n\t\t\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t\t\t? getDuotoneFilter( filterId, colors )\n\t\t\t\t\t\t\t: '',\n\t\t\t\t\t__unstableType: 'svgs',\n\t\t\t }\n\t\t\t: undefined\n\t);\n\n\tconst blockElement = useBlockElement( clientId );\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Safari does not always update the duotone filter when the duotone\n\t\t// colors are changed. When using Safari, force the block element to be\n\t\t// repainted by the browser to ensure any changes are reflected\n\t\t// visually. This logic matches that used on the site frontend in\n\t\t// `block-supports/duotone.php`.\n\t\tif ( blockElement && isSafari ) {\n\t\t\tconst display = blockElement.style.display;\n\t\t\t// Switch to `inline-block` to force a repaint. In the editor,\n\t\t\t// `inline-block` is used instead of `none` to ensure that scroll\n\t\t\t// position is not affected, as `none` results in the editor\n\t\t\t// scrolling to the top of the block.\n\t\t\tblockElement.style.display = 'inline-block';\n\t\t\t// Simply accessing el.offsetHeight flushes layout and style changes\n\t\t\t// in WebKit without having to wait for setTimeout.\n\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\tblockElement.offsetHeight;\n\t\t\tblockElement.style.display = display;\n\t\t}\n\t\t// `colors` must be a dependency so this effect runs when the colors\n\t\t// change in Safari.\n\t}, [ isValidFilter, blockElement, colors ] );\n}\n\nfunction useBlockProps( { clientId, name, style } ) {\n\tconst id = useInstanceId( useBlockProps );\n\tconst selector = useMemo( () => {\n\t\tconst blockType = getBlockType( name );\n\n\t\tif ( blockType ) {\n\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t// experimental property has been, the experimental property\n\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'filter.duotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t// to be treated as a selector and requires scoping.\n\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tif ( experimentalDuotone ) {\n\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t: rootSelector;\n\t\t\t}\n\n\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\tfallback: true,\n\t\t\t} );\n\t\t}\n\t}, [ name ] );\n\n\tconst attribute = style?.color?.duotone;\n\n\tconst filterClass = `wp-duotone-${ id }`;\n\n\tconst shouldRender = selector && attribute;\n\n\tuseDuotoneStyles( {\n\t\tclientId,\n\t\tid: filterClass,\n\t\tselector,\n\t\tattribute,\n\t} );\n\n\treturn {\n\t\tclassName: shouldRender ? filterClass : '',\n\t};\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,OAAOC,WAAW,MAAM,sBAAsB;;AAE9C;AACA;AACA;AACA,SACCC,eAAe,EACfC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SACCC,aAAa,EACbC,iBAAiB,EACjBC,4BAA4B,IAAIC,cAAc,EAC9CC,WAAW,QACL,eAAe;AACtB,SACCC,gBAAgB,EAChBC,oBAAoB,EACpBC,yBAAyB,QACnB,6BAA6B;A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Ae,CAC1CoH,SAAS,EACT,6BAA6B,EAC7B,KACD,CAAC;MACD,IAAKE,mBAAmB,EAAG;QAC1B,MAAMC,YAAY,GAAGxG,mBAAmB,CAAEqG,SAAU,CAAC;QACrD,OAAO,OAAOE,mBAAmB,KAAK,QAAQ,GAC3CtG,aAAa,CAAEuG,YAAY,EAAED,mBAAoB,CAAC,GAClDC,YAAY;MAChB;;MAEA;MACA,OAAOxG,mBAAmB,CAAEqG,SAAS,EAAE,gBAAgB,EAAE;QACxDI,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAE5D,IAAI,CAAG,CAAC;EAEb,MAAMqC,SAAS,GAAGvC,KAAK,EAAEI,KAAK,EAAEnB,OAAO;EAEvC,MAAM8E,WAAW,GAAI,cAAc5B,EAAI,EAAC;EAExC,MAAM6B,YAAY,GAAG3B,QAAQ,IAAIE,SAAS;EAE1CN,gBAAgB,CAAE;IACjBC,QAAQ;IACRC,EAAE,EAAE4B,WAAW;IACf1B,QAAQ;IACRE;EACD,CAAE,CAAC;EAEH,OAAO;IACN0B,SAAS,EAAED,YAAY,GAAGD,WAAW,GAAG;EACzC,CAAC;AACF;AAEArH,SAAS,CACR,0BAA0B,EAC1B,oCAAoC,EACpCkF,oBACD,CAAC","ignoreList":[]}
@@ -256,7 +256,10 @@ function LayoutTypeSwitcher({
256
256
  name,
257
257
  label
258
258
  }) => {
259
- return /*#__PURE__*/_jsx(Button, {
259
+ return /*#__PURE__*/_jsx(Button
260
+ // TODO: Switch to `true` (40px size) if possible
261
+ , {
262
+ __next40pxDefaultSize: false,
260
263
  isPressed: type === name,
261
264
  onClick: () => onChange(name),
262
265
  children: label