@wordpress/block-editor 12.1.0 → 12.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 (391) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/autocompleters/block.js +13 -5
  3. package/build/autocompleters/block.js.map +1 -1
  4. package/build/components/block-breadcrumb/index.js +6 -3
  5. package/build/components/block-breadcrumb/index.js.map +1 -1
  6. package/build/components/block-editing-mode/index.js +84 -0
  7. package/build/components/block-editing-mode/index.js.map +1 -0
  8. package/build/components/block-list/block-list-block-context.js +15 -0
  9. package/build/components/block-list/block-list-block-context.js.map +1 -0
  10. package/build/components/block-list/block.js +29 -37
  11. package/build/components/block-list/block.js.map +1 -1
  12. package/build/components/block-list/block.native.js +14 -22
  13. package/build/components/block-list/block.native.js.map +1 -1
  14. package/build/components/block-list/index.native.js +107 -108
  15. package/build/components/block-list/index.native.js.map +1 -1
  16. package/build/components/block-list/use-block-props/index.js +2 -2
  17. package/build/components/block-list/use-block-props/index.js.map +1 -1
  18. package/build/components/block-list/use-in-between-inserter.js +7 -5
  19. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  20. package/build/components/block-list-appender/index.js +15 -1
  21. package/build/components/block-list-appender/index.js.map +1 -1
  22. package/build/components/block-mobile-toolbar/block-actions-menu.native.js +19 -4
  23. package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  24. package/build/components/block-styles/preview-panel.js +1 -2
  25. package/build/components/block-styles/preview-panel.js.map +1 -1
  26. package/build/components/block-switcher/block-transformations-menu.js +8 -0
  27. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  28. package/build/components/block-switcher/block-variation-transformations.js +125 -0
  29. package/build/components/block-switcher/block-variation-transformations.js.map +1 -0
  30. package/build/components/block-switcher/index.js +34 -12
  31. package/build/components/block-switcher/index.js.map +1 -1
  32. package/build/components/block-switcher/pattern-transformations-menu.js +3 -3
  33. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  34. package/build/components/block-toolbar/index.js +9 -7
  35. package/build/components/block-toolbar/index.js.map +1 -1
  36. package/build/components/block-tools/block-contextual-toolbar.js +5 -3
  37. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  38. package/build/components/block-tools/insertion-point.js +11 -5
  39. package/build/components/block-tools/insertion-point.js.map +1 -1
  40. package/build/components/convert-to-group-buttons/index.js +7 -2
  41. package/build/components/convert-to-group-buttons/index.js.map +1 -1
  42. package/build/components/convert-to-group-buttons/index.native.js +87 -3
  43. package/build/components/convert-to-group-buttons/index.native.js.map +1 -1
  44. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +23 -37
  45. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  46. package/build/components/global-styles/dimensions-panel.js +3 -2
  47. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  48. package/build/components/iframe/index.js +14 -7
  49. package/build/components/iframe/index.js.map +1 -1
  50. package/build/components/inner-blocks/index.js +2 -1
  51. package/build/components/inner-blocks/index.js.map +1 -1
  52. package/build/components/inner-blocks/index.native.js +7 -7
  53. package/build/components/inner-blocks/index.native.js.map +1 -1
  54. package/build/components/inner-blocks/use-nested-settings-update.js +13 -5
  55. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  56. package/build/components/inserter/index.js +3 -7
  57. package/build/components/inserter/index.js.map +1 -1
  58. package/build/components/inserter/quick-inserter.js +2 -4
  59. package/build/components/inserter/quick-inserter.js.map +1 -1
  60. package/build/components/inserter/search-results.js +19 -6
  61. package/build/components/inserter/search-results.js.map +1 -1
  62. package/build/components/list-view/appender.js +6 -1
  63. package/build/components/list-view/appender.js.map +1 -1
  64. package/build/components/list-view/block-contents.js +4 -2
  65. package/build/components/list-view/block-contents.js.map +1 -1
  66. package/build/components/list-view/block.js +21 -25
  67. package/build/components/list-view/block.js.map +1 -1
  68. package/build/components/list-view/branch.js +1 -3
  69. package/build/components/list-view/branch.js.map +1 -1
  70. package/build/components/list-view/index.js +14 -7
  71. package/build/components/list-view/index.js.map +1 -1
  72. package/build/components/list-view/use-list-view-client-ids.js +27 -3
  73. package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
  74. package/build/components/publish-date-time-picker/index.js +0 -2
  75. package/build/components/publish-date-time-picker/index.js.map +1 -1
  76. package/build/components/url-input/index.js +3 -0
  77. package/build/components/url-input/index.js.map +1 -1
  78. package/build/components/use-block-drop-zone/index.js +25 -15
  79. package/build/components/use-block-drop-zone/index.js.map +1 -1
  80. package/build/components/use-resize-canvas/index.js +8 -1
  81. package/build/components/use-resize-canvas/index.js.map +1 -1
  82. package/build/components/writing-flow/use-arrow-nav.js +13 -7
  83. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  84. package/build/hooks/align.js +3 -7
  85. package/build/hooks/align.js.map +1 -1
  86. package/build/hooks/behaviors.js +115 -0
  87. package/build/hooks/behaviors.js.map +1 -0
  88. package/build/hooks/dimensions.js +0 -30
  89. package/build/hooks/dimensions.js.map +1 -1
  90. package/build/hooks/duotone.js +4 -8
  91. package/build/hooks/duotone.js.map +1 -1
  92. package/build/hooks/index.js +2 -0
  93. package/build/hooks/index.js.map +1 -1
  94. package/build/hooks/layout.js +8 -9
  95. package/build/hooks/layout.js.map +1 -1
  96. package/build/private-apis.js +4 -7
  97. package/build/private-apis.js.map +1 -1
  98. package/build/store/private-actions.js +46 -0
  99. package/build/store/private-actions.js.map +1 -1
  100. package/build/store/private-selectors.js +88 -0
  101. package/build/store/private-selectors.js.map +1 -1
  102. package/build/store/reducer.js +36 -1
  103. package/build/store/reducer.js.map +1 -1
  104. package/build/store/selectors.js +28 -18
  105. package/build/store/selectors.js.map +1 -1
  106. package/build/utils/order-inserter-block-items.js +41 -0
  107. package/build/utils/order-inserter-block-items.js.map +1 -0
  108. package/build-module/autocompleters/block.js +12 -5
  109. package/build-module/autocompleters/block.js.map +1 -1
  110. package/build-module/components/block-breadcrumb/index.js +5 -3
  111. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  112. package/build-module/components/block-editing-mode/index.js +72 -0
  113. package/build-module/components/block-editing-mode/index.js.map +1 -0
  114. package/build-module/components/block-list/block-list-block-context.js +6 -0
  115. package/build-module/components/block-list/block-list-block-context.js.map +1 -0
  116. package/build-module/components/block-list/block.js +26 -34
  117. package/build-module/components/block-list/block.js.map +1 -1
  118. package/build-module/components/block-list/block.native.js +14 -22
  119. package/build-module/components/block-list/block.native.js.map +1 -1
  120. package/build-module/components/block-list/index.native.js +108 -110
  121. package/build-module/components/block-list/index.native.js.map +1 -1
  122. package/build-module/components/block-list/use-block-props/index.js +1 -1
  123. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  124. package/build-module/components/block-list/use-in-between-inserter.js +6 -5
  125. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  126. package/build-module/components/block-list-appender/index.js +15 -1
  127. package/build-module/components/block-list-appender/index.js.map +1 -1
  128. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -4
  129. package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
  130. package/build-module/components/block-styles/preview-panel.js +1 -2
  131. package/build-module/components/block-styles/preview-panel.js.map +1 -1
  132. package/build-module/components/block-switcher/block-transformations-menu.js +7 -0
  133. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  134. package/build-module/components/block-switcher/block-variation-transformations.js +108 -0
  135. package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -0
  136. package/build-module/components/block-switcher/index.js +33 -12
  137. package/build-module/components/block-switcher/index.js.map +1 -1
  138. package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -3
  139. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  140. package/build-module/components/block-toolbar/index.js +8 -7
  141. package/build-module/components/block-toolbar/index.js.map +1 -1
  142. package/build-module/components/block-tools/block-contextual-toolbar.js +4 -3
  143. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  144. package/build-module/components/block-tools/insertion-point.js +11 -5
  145. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  146. package/build-module/components/convert-to-group-buttons/index.js +7 -2
  147. package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
  148. package/build-module/components/convert-to-group-buttons/index.native.js +76 -1
  149. package/build-module/components/convert-to-group-buttons/index.native.js.map +1 -1
  150. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +22 -36
  151. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  152. package/build-module/components/global-styles/dimensions-panel.js +3 -2
  153. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  154. package/build-module/components/iframe/index.js +15 -8
  155. package/build-module/components/iframe/index.js.map +1 -1
  156. package/build-module/components/inner-blocks/index.js +2 -1
  157. package/build-module/components/inner-blocks/index.js.map +1 -1
  158. package/build-module/components/inner-blocks/index.native.js +7 -6
  159. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  160. package/build-module/components/inner-blocks/use-nested-settings-update.js +13 -5
  161. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  162. package/build-module/components/inserter/index.js +3 -7
  163. package/build-module/components/inserter/index.js.map +1 -1
  164. package/build-module/components/inserter/quick-inserter.js +2 -4
  165. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  166. package/build-module/components/inserter/search-results.js +16 -6
  167. package/build-module/components/inserter/search-results.js.map +1 -1
  168. package/build-module/components/list-view/appender.js +6 -2
  169. package/build-module/components/list-view/appender.js.map +1 -1
  170. package/build-module/components/list-view/block-contents.js +4 -2
  171. package/build-module/components/list-view/block-contents.js.map +1 -1
  172. package/build-module/components/list-view/block.js +20 -25
  173. package/build-module/components/list-view/block.js.map +1 -1
  174. package/build-module/components/list-view/branch.js +1 -3
  175. package/build-module/components/list-view/branch.js.map +1 -1
  176. package/build-module/components/list-view/index.js +15 -8
  177. package/build-module/components/list-view/index.js.map +1 -1
  178. package/build-module/components/list-view/use-list-view-client-ids.js +26 -3
  179. package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
  180. package/build-module/components/publish-date-time-picker/index.js +0 -2
  181. package/build-module/components/publish-date-time-picker/index.js.map +1 -1
  182. package/build-module/components/url-input/index.js +3 -0
  183. package/build-module/components/url-input/index.js.map +1 -1
  184. package/build-module/components/use-block-drop-zone/index.js +25 -16
  185. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  186. package/build-module/components/use-resize-canvas/index.js +8 -1
  187. package/build-module/components/use-resize-canvas/index.js.map +1 -1
  188. package/build-module/components/writing-flow/use-arrow-nav.js +13 -7
  189. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  190. package/build-module/hooks/align.js +3 -6
  191. package/build-module/hooks/align.js.map +1 -1
  192. package/build-module/hooks/behaviors.js +97 -0
  193. package/build-module/hooks/behaviors.js.map +1 -0
  194. package/build-module/hooks/dimensions.js +0 -28
  195. package/build-module/hooks/dimensions.js.map +1 -1
  196. package/build-module/hooks/duotone.js +3 -6
  197. package/build-module/hooks/duotone.js.map +1 -1
  198. package/build-module/hooks/index.js +1 -0
  199. package/build-module/hooks/index.js.map +1 -1
  200. package/build-module/hooks/layout.js +7 -9
  201. package/build-module/hooks/layout.js.map +1 -1
  202. package/build-module/private-apis.js +3 -5
  203. package/build-module/private-apis.js.map +1 -1
  204. package/build-module/store/private-actions.js +42 -0
  205. package/build-module/store/private-actions.js.map +1 -1
  206. package/build-module/store/private-selectors.js +79 -0
  207. package/build-module/store/private-selectors.js.map +1 -1
  208. package/build-module/store/reducer.js +34 -1
  209. package/build-module/store/reducer.js.map +1 -1
  210. package/build-module/store/selectors.js +26 -17
  211. package/build-module/store/selectors.js.map +1 -1
  212. package/build-module/utils/order-inserter-block-items.js +32 -0
  213. package/build-module/utils/order-inserter-block-items.js.map +1 -0
  214. package/build-style/content-rtl.css +32 -13
  215. package/build-style/content.css +32 -13
  216. package/build-style/default-editor-styles-rtl.css +1 -1
  217. package/build-style/default-editor-styles.css +1 -1
  218. package/build-style/style-rtl.css +19 -64
  219. package/build-style/style.css +20 -64
  220. package/package.json +32 -31
  221. package/src/autocompleters/block.js +15 -7
  222. package/src/components/block-breadcrumb/index.js +11 -3
  223. package/src/components/block-editing-mode/index.js +71 -0
  224. package/src/components/block-list/block-list-block-context.js +6 -0
  225. package/src/components/block-list/block.js +38 -56
  226. package/src/components/block-list/block.native.js +30 -41
  227. package/src/components/block-list/content.scss +5 -5
  228. package/src/components/block-list/index.native.js +164 -153
  229. package/src/components/block-list/test/index.native.js +2 -2
  230. package/src/components/block-list/use-block-props/index.js +1 -1
  231. package/src/components/block-list/use-in-between-inserter.js +7 -3
  232. package/src/components/block-list-appender/index.js +22 -4
  233. package/src/components/block-mobile-toolbar/block-actions-menu.native.js +23 -0
  234. package/src/components/block-mover/style.scss +1 -0
  235. package/src/components/block-styles/preview-panel.js +1 -3
  236. package/src/components/block-switcher/block-transformations-menu.js +12 -0
  237. package/src/components/block-switcher/block-variation-transformations.js +115 -0
  238. package/src/components/block-switcher/index.js +38 -5
  239. package/src/components/block-switcher/pattern-transformations-menu.js +5 -5
  240. package/src/components/block-switcher/style.scss +6 -5
  241. package/src/components/block-toolbar/index.js +10 -11
  242. package/src/components/block-tools/block-contextual-toolbar.js +4 -5
  243. package/src/components/block-tools/insertion-point.js +23 -9
  244. package/src/components/button-block-appender/content.scss +22 -0
  245. package/src/components/convert-to-group-buttons/index.js +9 -2
  246. package/src/components/convert-to-group-buttons/index.native.js +79 -1
  247. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +32 -38
  248. package/src/components/global-styles/dimensions-panel.js +3 -2
  249. package/src/components/global-styles/style.scss +3 -0
  250. package/src/components/iframe/index.js +22 -12
  251. package/src/components/inner-blocks/README.md +5 -0
  252. package/src/components/inner-blocks/index.js +2 -0
  253. package/src/components/inner-blocks/index.native.js +16 -6
  254. package/src/components/inner-blocks/use-nested-settings-update.js +20 -3
  255. package/src/components/inserter/index.js +1 -9
  256. package/src/components/inserter/quick-inserter.js +0 -2
  257. package/src/components/inserter/search-results.js +32 -6
  258. package/src/components/list-view/appender.js +3 -2
  259. package/src/components/list-view/block-contents.js +8 -2
  260. package/src/components/list-view/block.js +29 -35
  261. package/src/components/list-view/branch.js +1 -7
  262. package/src/components/list-view/index.js +17 -4
  263. package/src/components/list-view/style.scss +2 -5
  264. package/src/components/list-view/use-list-view-client-ids.js +21 -4
  265. package/src/components/publish-date-time-picker/index.js +0 -2
  266. package/src/components/url-input/README.md +6 -0
  267. package/src/components/url-input/index.js +1 -0
  268. package/src/components/use-block-drop-zone/index.js +31 -17
  269. package/src/components/use-resize-canvas/index.js +9 -1
  270. package/src/components/writing-flow/test/index.js +15 -0
  271. package/src/components/writing-flow/use-arrow-nav.js +17 -4
  272. package/src/hooks/align.js +3 -11
  273. package/src/hooks/behaviors.js +104 -0
  274. package/src/hooks/dimensions.js +0 -40
  275. package/src/hooks/duotone.js +3 -11
  276. package/src/hooks/index.js +1 -0
  277. package/src/hooks/layout.js +10 -18
  278. package/src/private-apis.js +2 -4
  279. package/src/store/private-actions.js +39 -0
  280. package/src/store/private-selectors.js +95 -0
  281. package/src/store/reducer.js +27 -0
  282. package/src/store/selectors.js +25 -15
  283. package/src/store/test/private-actions.js +32 -1
  284. package/src/store/test/private-selectors.js +158 -0
  285. package/src/store/test/reducer.js +48 -0
  286. package/src/style.scss +0 -3
  287. package/src/utils/order-inserter-block-items.js +26 -0
  288. package/build/components/block-list/block-list-compact.native.js +0 -75
  289. package/build/components/block-list/block-list-compact.native.js.map +0 -1
  290. package/build/components/off-canvas-editor/appender.js +0 -125
  291. package/build/components/off-canvas-editor/appender.js.map +0 -1
  292. package/build/components/off-canvas-editor/block-contents.js +0 -141
  293. package/build/components/off-canvas-editor/block-contents.js.map +0 -1
  294. package/build/components/off-canvas-editor/block-select-button.js +0 -126
  295. package/build/components/off-canvas-editor/block-select-button.js.map +0 -1
  296. package/build/components/off-canvas-editor/block.js +0 -297
  297. package/build/components/off-canvas-editor/block.js.map +0 -1
  298. package/build/components/off-canvas-editor/branch.js +0 -197
  299. package/build/components/off-canvas-editor/branch.js.map +0 -1
  300. package/build/components/off-canvas-editor/context.js +0 -19
  301. package/build/components/off-canvas-editor/context.js.map +0 -1
  302. package/build/components/off-canvas-editor/drop-indicator.js +0 -118
  303. package/build/components/off-canvas-editor/drop-indicator.js.map +0 -1
  304. package/build/components/off-canvas-editor/expander.js +0 -41
  305. package/build/components/off-canvas-editor/expander.js.map +0 -1
  306. package/build/components/off-canvas-editor/index.js +0 -236
  307. package/build/components/off-canvas-editor/index.js.map +0 -1
  308. package/build/components/off-canvas-editor/leaf-more-menu.js +0 -148
  309. package/build/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
  310. package/build/components/off-canvas-editor/leaf.js +0 -60
  311. package/build/components/off-canvas-editor/leaf.js.map +0 -1
  312. package/build/components/off-canvas-editor/link-ui.js +0 -186
  313. package/build/components/off-canvas-editor/link-ui.js.map +0 -1
  314. package/build/components/off-canvas-editor/update-attributes.js +0 -108
  315. package/build/components/off-canvas-editor/update-attributes.js.map +0 -1
  316. package/build/components/off-canvas-editor/use-block-selection.js +0 -139
  317. package/build/components/off-canvas-editor/use-block-selection.js.map +0 -1
  318. package/build/components/off-canvas-editor/use-inserted-block.js +0 -58
  319. package/build/components/off-canvas-editor/use-inserted-block.js.map +0 -1
  320. package/build/components/off-canvas-editor/use-list-view-client-ids.js +0 -33
  321. package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
  322. package/build/components/off-canvas-editor/use-list-view-drop-zone.js +0 -235
  323. package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
  324. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -60
  325. package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
  326. package/build/components/off-canvas-editor/utils.js +0 -60
  327. package/build/components/off-canvas-editor/utils.js.map +0 -1
  328. package/build-module/components/block-list/block-list-compact.native.js +0 -60
  329. package/build-module/components/block-list/block-list-compact.native.js.map +0 -1
  330. package/build-module/components/off-canvas-editor/appender.js +0 -108
  331. package/build-module/components/off-canvas-editor/appender.js.map +0 -1
  332. package/build-module/components/off-canvas-editor/block-contents.js +0 -121
  333. package/build-module/components/off-canvas-editor/block-contents.js.map +0 -1
  334. package/build-module/components/off-canvas-editor/block-select-button.js +0 -107
  335. package/build-module/components/off-canvas-editor/block-select-button.js.map +0 -1
  336. package/build-module/components/off-canvas-editor/block.js +0 -273
  337. package/build-module/components/off-canvas-editor/block.js.map +0 -1
  338. package/build-module/components/off-canvas-editor/branch.js +0 -179
  339. package/build-module/components/off-canvas-editor/branch.js.map +0 -1
  340. package/build-module/components/off-canvas-editor/context.js +0 -7
  341. package/build-module/components/off-canvas-editor/context.js.map +0 -1
  342. package/build-module/components/off-canvas-editor/drop-indicator.js +0 -111
  343. package/build-module/components/off-canvas-editor/drop-indicator.js.map +0 -1
  344. package/build-module/components/off-canvas-editor/expander.js +0 -32
  345. package/build-module/components/off-canvas-editor/expander.js.map +0 -1
  346. package/build-module/components/off-canvas-editor/index.js +0 -213
  347. package/build-module/components/off-canvas-editor/index.js.map +0 -1
  348. package/build-module/components/off-canvas-editor/leaf-more-menu.js +0 -130
  349. package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
  350. package/build-module/components/off-canvas-editor/leaf.js +0 -45
  351. package/build-module/components/off-canvas-editor/leaf.js.map +0 -1
  352. package/build-module/components/off-canvas-editor/link-ui.js +0 -166
  353. package/build-module/components/off-canvas-editor/link-ui.js.map +0 -1
  354. package/build-module/components/off-canvas-editor/update-attributes.js +0 -97
  355. package/build-module/components/off-canvas-editor/update-attributes.js.map +0 -1
  356. package/build-module/components/off-canvas-editor/use-block-selection.js +0 -124
  357. package/build-module/components/off-canvas-editor/use-block-selection.js.map +0 -1
  358. package/build-module/components/off-canvas-editor/use-inserted-block.js +0 -47
  359. package/build-module/components/off-canvas-editor/use-inserted-block.js.map +0 -1
  360. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +0 -24
  361. package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
  362. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +0 -220
  363. package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
  364. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -50
  365. package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
  366. package/build-module/components/off-canvas-editor/utils.js +0 -44
  367. package/build-module/components/off-canvas-editor/utils.js.map +0 -1
  368. package/src/components/block-list/block-list-compact.native.js +0 -63
  369. package/src/components/off-canvas-editor/README.md +0 -5
  370. package/src/components/off-canvas-editor/appender.js +0 -124
  371. package/src/components/off-canvas-editor/block-contents.js +0 -156
  372. package/src/components/off-canvas-editor/block-select-button.js +0 -128
  373. package/src/components/off-canvas-editor/block.js +0 -347
  374. package/src/components/off-canvas-editor/branch.js +0 -238
  375. package/src/components/off-canvas-editor/context.js +0 -8
  376. package/src/components/off-canvas-editor/drop-indicator.js +0 -126
  377. package/src/components/off-canvas-editor/expander.js +0 -26
  378. package/src/components/off-canvas-editor/index.js +0 -271
  379. package/src/components/off-canvas-editor/leaf-more-menu.js +0 -158
  380. package/src/components/off-canvas-editor/leaf.js +0 -52
  381. package/src/components/off-canvas-editor/link-ui.js +0 -167
  382. package/src/components/off-canvas-editor/style.scss +0 -34
  383. package/src/components/off-canvas-editor/test/use-inserted-block.js +0 -108
  384. package/src/components/off-canvas-editor/test/utils.js +0 -50
  385. package/src/components/off-canvas-editor/update-attributes.js +0 -99
  386. package/src/components/off-canvas-editor/use-block-selection.js +0 -169
  387. package/src/components/off-canvas-editor/use-inserted-block.js +0 -47
  388. package/src/components/off-canvas-editor/use-list-view-client-ids.js +0 -29
  389. package/src/components/off-canvas-editor/use-list-view-drop-zone.js +0 -260
  390. package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -58
  391. package/src/components/off-canvas-editor/utils.js +0 -58
@@ -0,0 +1,97 @@
1
+ import { createElement, Fragment } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { addFilter } from '@wordpress/hooks';
7
+ import { SelectControl } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { createHigherOrderComponent } from '@wordpress/compose';
10
+ import { select } from '@wordpress/data';
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ import { InspectorControls } from '../components';
16
+ import { store as blockEditorStore } from '../store';
17
+ /**
18
+ * External dependencies
19
+ */
20
+
21
+ import merge from 'deepmerge';
22
+ /**
23
+ * Override the default edit UI to include a new block inspector control for
24
+ * assigning behaviors to blocks if behaviors are enabled in the theme.json.
25
+ *
26
+ * Currently, only the `core/image` block is supported.
27
+ *
28
+ * @param {WPComponent} BlockEdit Original component.
29
+ *
30
+ * @return {WPComponent} Wrapped component.
31
+ */
32
+
33
+ export const withBehaviors = createHigherOrderComponent(BlockEdit => {
34
+ return props => {
35
+ var _select$getSettings, _select$getSettings$_, _select$getSettings$_2, _select$getSettings$_3, _select$getBehaviors, _select$getBehaviors$;
36
+
37
+ // Only add behaviors to the core/image block.
38
+ if (props.name !== 'core/image') {
39
+ return createElement(BlockEdit, props);
40
+ }
41
+
42
+ const settings = (_select$getSettings = select(blockEditorStore).getSettings()) === null || _select$getSettings === void 0 ? void 0 : (_select$getSettings$_ = _select$getSettings.__experimentalFeatures) === null || _select$getSettings$_ === void 0 ? void 0 : (_select$getSettings$_2 = _select$getSettings$_.blocks) === null || _select$getSettings$_2 === void 0 ? void 0 : (_select$getSettings$_3 = _select$getSettings$_2[props.name]) === null || _select$getSettings$_3 === void 0 ? void 0 : _select$getSettings$_3.behaviors;
43
+
44
+ if (!settings || // If every behavior is disabled, do not show the behaviors inspector control.
45
+ Object.entries(settings).every(_ref => {
46
+ let [, value] = _ref;
47
+ return !value;
48
+ })) {
49
+ return createElement(BlockEdit, props);
50
+ }
51
+
52
+ const {
53
+ behaviors: blockBehaviors
54
+ } = props.attributes; // Get the theme behaviors for the block from the theme.json.
55
+
56
+ const themeBehaviors = (_select$getBehaviors = select(blockEditorStore).getBehaviors()) === null || _select$getBehaviors === void 0 ? void 0 : (_select$getBehaviors$ = _select$getBehaviors.blocks) === null || _select$getBehaviors$ === void 0 ? void 0 : _select$getBehaviors$[props.name]; // Block behaviors take precedence over theme behaviors.
57
+
58
+ const behaviors = merge(themeBehaviors, blockBehaviors || {});
59
+ return createElement(Fragment, null, createElement(BlockEdit, props), createElement(InspectorControls, {
60
+ group: "advanced"
61
+ }, createElement(SelectControl, {
62
+ __nextHasNoMarginBottom: true,
63
+ label: __('Behaviors') // At the moment we are only supporting one behavior (Lightbox)
64
+ ,
65
+ value: behaviors !== null && behaviors !== void 0 && behaviors.lightbox ? 'lightbox' : '',
66
+ options: Object.entries(settings).filter(_ref2 => {
67
+ let [, behaviorValue] = _ref2;
68
+ return behaviorValue;
69
+ }) // Filter out behaviors that are disabled.
70
+ .map(_ref3 => {
71
+ let [behaviorName] = _ref3;
72
+ return {
73
+ value: behaviorName,
74
+ label: // Capitalize the first letter of the behavior name.
75
+ behaviorName[0].toUpperCase() + behaviorName.slice(1).toLowerCase()
76
+ };
77
+ }).concat({
78
+ value: '',
79
+ label: __('No behaviors')
80
+ }),
81
+ onChange: nextValue => {
82
+ // If the user selects something, it means that they want to
83
+ // change the default value (true) so we save it in the attributes.
84
+ props.setAttributes({
85
+ behaviors: {
86
+ lightbox: nextValue === 'lightbox'
87
+ }
88
+ });
89
+ },
90
+ hideCancelButton: true,
91
+ help: __('Add behaviors.'),
92
+ size: "__unstable-large"
93
+ })));
94
+ };
95
+ }, 'withBehaviors');
96
+ addFilter('editor.BlockEdit', 'core/behaviors/with-inspector-control', withBehaviors);
97
+ //# sourceMappingURL=behaviors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/behaviors.js"],"names":["addFilter","SelectControl","__","createHigherOrderComponent","select","InspectorControls","store","blockEditorStore","merge","withBehaviors","BlockEdit","props","name","settings","getSettings","__experimentalFeatures","blocks","behaviors","Object","entries","every","value","blockBehaviors","attributes","themeBehaviors","getBehaviors","lightbox","filter","behaviorValue","map","behaviorName","label","toUpperCase","slice","toLowerCase","concat","nextValue","setAttributes"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,MAAT,QAAuB,iBAAvB;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,eAAlC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AAEA;AACA;AACA;;AACA,OAAOC,KAAP,MAAkB,WAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAGN,0BAA0B,CAAIO,SAAF,IAAiB;AACzE,SAASC,KAAF,IAAa;AAAA;;AACnB;AACA,QAAKA,KAAK,CAACC,IAAN,KAAe,YAApB,EAAmC;AAClC,aAAO,cAAC,SAAD,EAAgBD,KAAhB,CAAP;AACA;;AAED,UAAME,QAAQ,0BACbT,MAAM,CAAEG,gBAAF,CAAN,CAA2BO,WAA3B,EADa,iFACb,oBAA0CC,sBAD7B,oFACb,sBACGC,MAFU,qFACb,uBACaL,KAAK,CAACC,IADnB,CADa,2DACb,uBAC2BK,SAF5B;;AAIA,QACC,CAAEJ,QAAF,IACA;AACAK,IAAAA,MAAM,CAACC,OAAP,CAAgBN,QAAhB,EAA2BO,KAA3B,CAAkC;AAAA,UAAE,GAAIC,KAAJ,CAAF;AAAA,aAAmB,CAAEA,KAArB;AAAA,KAAlC,CAHD,EAIE;AACD,aAAO,cAAC,SAAD,EAAgBV,KAAhB,CAAP;AACA;;AAED,UAAM;AAAEM,MAAAA,SAAS,EAAEK;AAAb,QAAgCX,KAAK,CAACY,UAA5C,CAlBmB,CAoB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SAAS,KAAK;AADd;AADS,SAArB;AAKA,OA1BF;AA2BC,MAAA,gBAAgB,EAAG,IA3BpB;AA4BC,MAAA,IAAI,EAAGlC,EAAE,CAAE,gBAAF,CA5BV;AA6BC,MAAA,IAAI,EAAC;AA7BN,MADD,CAFD,CADD;AAsCA,GAjED;AAkEA,CAnEsD,EAmEpD,eAnEoD,CAAhD;AAqEPF,SAAS,CACR,kBADQ,EAER,uCAFQ,EAGRS,aAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { select } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { store as blockEditorStore } from '../store';\n\n/**\n * External dependencies\n */\nimport merge from 'deepmerge';\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning behaviors to blocks if behaviors are enabled in the theme.json.\n *\n * Currently, only the `core/image` block is supported.\n *\n * @param {WPComponent} BlockEdit Original component.\n *\n * @return {WPComponent} Wrapped component.\n */\nexport const withBehaviors = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn ( props ) => {\n\t\t// Only add behaviors to the core/image block.\n\t\tif ( props.name !== 'core/image' ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst settings =\n\t\t\tselect( blockEditorStore ).getSettings()?.__experimentalFeatures\n\t\t\t\t?.blocks?.[ props.name ]?.behaviors;\n\n\t\tif (\n\t\t\t! settings ||\n\t\t\t// If every behavior is disabled, do not show the behaviors inspector control.\n\t\t\tObject.entries( settings ).every( ( [ , value ] ) => ! value )\n\t\t) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst { behaviors: blockBehaviors } = props.attributes;\n\n\t\t// Get the theme behaviors for the block from the theme.json.\n\t\tconst themeBehaviors =\n\t\t\tselect( blockEditorStore ).getBehaviors()?.blocks?.[ props.name ];\n\n\t\t// Block behaviors take precedence over theme behaviors.\n\t\tconst behaviors = merge( themeBehaviors, blockBehaviors || {} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Behaviors' ) }\n\t\t\t\t\t\t// At the moment we are only supporting one behavior (Lightbox)\n\t\t\t\t\t\tvalue={ behaviors?.lightbox ? 'lightbox' : '' }\n\t\t\t\t\t\toptions={ Object.entries( settings )\n\t\t\t\t\t\t\t.filter( ( [ , behaviorValue ] ) => behaviorValue ) // Filter out behaviors that are disabled.\n\t\t\t\t\t\t\t.map( ( [ behaviorName ] ) => ( {\n\t\t\t\t\t\t\t\tvalue: behaviorName,\n\t\t\t\t\t\t\t\tlabel:\n\t\t\t\t\t\t\t\t\t// Capitalize the first letter of the behavior name.\n\t\t\t\t\t\t\t\t\tbehaviorName[ 0 ].toUpperCase() +\n\t\t\t\t\t\t\t\t\tbehaviorName.slice( 1 ).toLowerCase(),\n\t\t\t\t\t\t\t} ) )\n\t\t\t\t\t\t\t.concat( {\n\t\t\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t\t\t\tlabel: __( 'No behaviors' ),\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\t\t\t// If the user selects something, it means that they want to\n\t\t\t\t\t\t\t// change the default value (true) so we save it in the attributes.\n\t\t\t\t\t\t\tprops.setAttributes( {\n\t\t\t\t\t\t\t\tbehaviors: {\n\t\t\t\t\t\t\t\t\tlightbox: nextValue === 'lightbox',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thideCancelButton={ true }\n\t\t\t\t\t\thelp={ __( 'Add behaviors.' ) }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t</>\n\t\t);\n\t};\n}, 'withBehaviors' );\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/behaviors/with-inspector-control',\n\twithBehaviors\n);\n"]}
@@ -112,32 +112,4 @@ export function useCustomSides() {
112
112
  version: '6.4'
113
113
  });
114
114
  }
115
- /**
116
- * Custom hook to determine whether the sides configured in the
117
- * block support are valid. A dimension property cannot declare
118
- * support for a mix of axial and individual sides.
119
- *
120
- * @param {string} blockName Block name.
121
- * @param {string} feature The feature custom sides relate to e.g. padding or margins.
122
- *
123
- * @return {boolean} If the feature has a valid configuration of sides.
124
- */
125
-
126
- export function useIsDimensionsSupportValid(blockName, feature) {
127
- const sides = useCustomSides(blockName, feature);
128
-
129
- if (sides && sides.some(side => ALL_SIDES.includes(side)) && sides.some(side => AXIAL_SIDES.includes(side))) {
130
- // eslint-disable-next-line no-console
131
- console.warn(`The ${feature} support for the "${blockName}" block can not be configured to support both axial and arbitrary sides.`);
132
- return false;
133
- }
134
-
135
- if (sides !== null && sides !== void 0 && sides.length && feature === 'blockGap' && !AXIAL_SIDES.every(side => sides.includes(side))) {
136
- // eslint-disable-next-line no-console
137
- console.warn(`The ${feature} support for the "${blockName}" block can not be configured to support arbitrary sides.`);
138
- return false;
139
- }
140
-
141
- return true;
142
- }
143
115
  //# sourceMappingURL=dimensions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"names":["useState","useEffect","useCallback","useDispatch","getBlockSupport","deprecated","InspectorControls","DimensionsPanel","StylesDimensionsPanel","useHasDimensionsPanel","MarginVisualizer","PaddingVisualizer","store","blockEditorStore","unlock","cleanEmptyObject","useBlockSettings","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizer","property","setProperty","hideBlockInterface","showBlockInterface","DimensionsInspectorControl","children","resetAllFilter","attributesResetAllFilter","attributes","existingStyle","style","updatedStyle","props","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","visualizedProperty","setVisualizedProperty","onChange","newStyle","defaultDimensionsControls","defaultSpacingControls","defaultControls","spacing","padding","margin","useCustomSides","since","version","useIsDimensionsSupportValid","blockName","feature","sides","some","side","includes","console","warn","length","every"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,eAAe,IAAIC,qBADpB,EAECC,qBAFD,QAGO,6BAHP;AAIA,SAASC,gBAAT,QAAiC,UAAjC;AACA,SAASC,iBAAT,QAAkC,WAAlC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,MAAT,QAAuB,gBAAvB;AAEA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,SAAnD;AAEA,OAAO,MAAMC,sBAAsB,GAAG,YAA/B;AACP,OAAO,MAAMC,mBAAmB,GAAG,SAA5B;AACP,OAAO,MAAMC,SAAS,GAAG,CAAE,KAAF,EAAS,OAAT,EAAkB,QAAlB,EAA4B,MAA5B,CAAlB;AACP,OAAO,MAAMC,WAAW,GAAG,CAAE,UAAF,EAAc,YAAd,CAApB;;AAEP,SAASC,aAAT,GAAyB;AACxB,QAAM,CAAEC,QAAF,EAAYC,WAAZ,IAA4BvB,QAAQ,CAAE,KAAF,CAA1C;AACA,QAAM;AAAEwB,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAA6CX,MAAM,CACxDX,WAAW,CAAEU,gBAAF,CAD6C,CAAzD;AAGAZ,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,CAAEqB,QAAP,EAAkB;AACjBG,MAAAA,kBAA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C,EAAiDC,OAAjD,EAA2D;AACjE,QAAMC,KAAK,GAAGN,cAAc,CAAEI,SAAF,EAAaC,OAAb,CAA5B;;AAEA,MACCC,KAAK,IACLA,KAAK,CAACC,IAAN,CAAcC,IAAF,IAAYzC,SAAS,CAAC0C,QAAV,CAAoBD,IAApB,CAAxB,CADA,IAEAF,KAAK,CAACC,IAAN,CAAcC,IAAF,IAAYxC,WAAW,CAACyC,QAAZ,CAAsBD,IAAtB,CAAxB,CAHD,EAIE;AACD;AACAE,IAAAA,OAAO,CAACC,IAAR,CACE,OAAON,OAAS,qBAAqBD,SAAW,0EADlD;AAGA,WAAO,KAAP;AACA;;AAED,MACCE,KAAK,SAAL,IAAAA,KAAK,WAAL,IAAAA,KAAK,CAAEM,MAAP,IACAP,OAAO,KAAK,UADZ,IAEA,CAAErC,WAAW,CAAC6C,KAAZ,CAAqBL,IAAF,IAAYF,KAAK,CAACG,QAAN,CAAgBD,IAAhB,CAA/B,CAHH,EAIE;AACD;AACAE,IAAAA,OAAO,CAACC,IAAR,CACE,OAAON,OAAS,qBAAqBD,SAAW,2DADlD;AAGA,WAAO,KAAP;AACA;;AAED,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tDimensionsPanel as StylesDimensionsPanel,\n\tuseHasDimensionsPanel,\n} from '../components/global-styles';\nimport { MarginVisualizer } from './margin';\nimport { PaddingVisualizer } from './padding';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nimport { cleanEmptyObject, useBlockSettings } from './utils';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizer() {\n\tconst [ property, setProperty ] = useState( false );\n\tconst { hideBlockInterface, showBlockInterface } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tuseEffect( () => {\n\t\tif ( ! property ) {\n\t\t\tshowBlockInterface();\n\t\t} else {\n\t\t\thideBlockInterface();\n\t\t}\n\t}, [ property, showBlockInterface, hideBlockInterface ] );\n\n\treturn [ property, setProperty ];\n}\n\nfunction DimensionsInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributes.style;\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tstyle: updatedStyle,\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"dimensions\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function DimensionsPanel( props ) {\n\tconst {\n\t\tclientId,\n\t\tname,\n\t\tattributes,\n\t\tsetAttributes,\n\t\t__unstableParentLayout,\n\t} = props;\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasDimensionsPanel( settings );\n\tconst value = attributes.style;\n\tconst [ visualizedProperty, setVisualizedProperty ] = useVisualizer();\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( props.name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultSpacingControls = getBlockSupport( props.name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultControls = {\n\t\t...defaultDimensionsControls,\n\t\t...defaultSpacingControls,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<StylesDimensionsPanel\n\t\t\t\tas={ DimensionsInspectorControl }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\tonVisualize={ setVisualizedProperty }\n\t\t\t/>\n\t\t\t{ !! settings?.spacing?.padding && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'padding' }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! settings?.spacing?.margin && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'margin' }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function useCustomSides() {\n\tdeprecated( 'wp.blockEditor.__experimentalUseCustomSides', {\n\t\tsince: '6.3',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Custom hook to determine whether the sides configured in the\n * block support are valid. A dimension property cannot declare\n * support for a mix of axial and individual sides.\n *\n * @param {string} blockName Block name.\n * @param {string} feature The feature custom sides relate to e.g. padding or margins.\n *\n * @return {boolean} If the feature has a valid configuration of sides.\n */\nexport function useIsDimensionsSupportValid( blockName, feature ) {\n\tconst sides = useCustomSides( blockName, feature );\n\n\tif (\n\t\tsides &&\n\t\tsides.some( ( side ) => ALL_SIDES.includes( side ) ) &&\n\t\tsides.some( ( side ) => AXIAL_SIDES.includes( side ) )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`The ${ feature } support for the \"${ blockName }\" block can not be configured to support both axial and arbitrary sides.`\n\t\t);\n\t\treturn false;\n\t}\n\n\tif (\n\t\tsides?.length &&\n\t\tfeature === 'blockGap' &&\n\t\t! AXIAL_SIDES.every( ( side ) => sides.includes( side ) )\n\t) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`The ${ feature } support for the \"${ blockName }\" block can not be configured to support arbitrary sides.`\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/dimensions.js"],"names":["useState","useEffect","useCallback","useDispatch","getBlockSupport","deprecated","InspectorControls","DimensionsPanel","StylesDimensionsPanel","useHasDimensionsPanel","MarginVisualizer","PaddingVisualizer","store","blockEditorStore","unlock","cleanEmptyObject","useBlockSettings","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","ALL_SIDES","AXIAL_SIDES","useVisualizer","property","setProperty","hideBlockInterface","showBlockInterface","DimensionsInspectorControl","children","resetAllFilter","attributesResetAllFilter","attributes","existingStyle","style","updatedStyle","props","clientId","name","setAttributes","__unstableParentLayout","settings","isEnabled","value","visualizedProperty","setVisualizedProperty","onChange","newStyle","defaultDimensionsControls","defaultSpacingControls","defaultControls","spacing","padding","margin","useCustomSides","since","version"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,kCAA9B;AACA,SACCC,eAAe,IAAIC,qBADpB,EAECC,qBAFD,QAGO,6BAHP;AAIA,SAASC,gBAAT,QAAiC,UAAjC;AACA,SAASC,iBAAT,QAAkC,WAAlC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,MAAT,QAAuB,gBAAvB;AAEA,SAASC,gBAAT,EAA2BC,gBAA3B,QAAmD,SAAnD;AAEA,OAA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;AACC,IAAA,SAAS,EAAGR,kBAAkB,KAAK;AADpC,KAEMR,KAFN,EAXF,EAgBG,CAAC,EAAEK,QAAF,aAAEA,QAAF,qCAAEA,QAAQ,CAAEU,OAAZ,+CAAE,mBAAmBE,MAArB,CAAD,IACD,cAAC,gBAAD;AACC,IAAA,SAAS,EAAGT,kBAAkB,KAAK;AADpC,KAEMR,KAFN,EAjBF,CADD;AAyBA;AAED;AACA;AACA;;AACA,OAAO,SAASkB,cAAT,GAA0B;AAChC/C,EAAAA,UAAU,CAAE,6CAAF,EAAiD;AAC1DgD,IAAAA,KAAK,EAAE,KADmD;AAE1DC,IAAAA,OAAO,EAAE;AAFiD,GAAjD,CAAV;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport {\n\tDimensionsPanel as StylesDimensionsPanel,\n\tuseHasDimensionsPanel,\n} from '../components/global-styles';\nimport { MarginVisualizer } from './margin';\nimport { PaddingVisualizer } from './padding';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nimport { cleanEmptyObject, useBlockSettings } from './utils';\n\nexport const DIMENSIONS_SUPPORT_KEY = 'dimensions';\nexport const SPACING_SUPPORT_KEY = 'spacing';\nexport const ALL_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nexport const AXIAL_SIDES = [ 'vertical', 'horizontal' ];\n\nfunction useVisualizer() {\n\tconst [ property, setProperty ] = useState( false );\n\tconst { hideBlockInterface, showBlockInterface } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tuseEffect( () => {\n\t\tif ( ! property ) {\n\t\t\tshowBlockInterface();\n\t\t} else {\n\t\t\thideBlockInterface();\n\t\t}\n\t}, [ property, showBlockInterface, hideBlockInterface ] );\n\n\treturn [ property, setProperty ];\n}\n\nfunction DimensionsInspectorControl( { children, resetAllFilter } ) {\n\tconst attributesResetAllFilter = useCallback(\n\t\t( attributes ) => {\n\t\t\tconst existingStyle = attributes.style;\n\t\t\tconst updatedStyle = resetAllFilter( existingStyle );\n\t\t\treturn {\n\t\t\t\t...attributes,\n\t\t\t\tstyle: updatedStyle,\n\t\t\t};\n\t\t},\n\t\t[ resetAllFilter ]\n\t);\n\n\treturn (\n\t\t<InspectorControls\n\t\t\tgroup=\"dimensions\"\n\t\t\tresetAllFilter={ attributesResetAllFilter }\n\t\t>\n\t\t\t{ children }\n\t\t</InspectorControls>\n\t);\n}\n\nexport function DimensionsPanel( props ) {\n\tconst {\n\t\tclientId,\n\t\tname,\n\t\tattributes,\n\t\tsetAttributes,\n\t\t__unstableParentLayout,\n\t} = props;\n\tconst settings = useBlockSettings( name, __unstableParentLayout );\n\tconst isEnabled = useHasDimensionsPanel( settings );\n\tconst value = attributes.style;\n\tconst [ visualizedProperty, setVisualizedProperty ] = useVisualizer();\n\tconst onChange = ( newStyle ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst defaultDimensionsControls = getBlockSupport( props.name, [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultSpacingControls = getBlockSupport( props.name, [\n\t\tSPACING_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\tconst defaultControls = {\n\t\t...defaultDimensionsControls,\n\t\t...defaultSpacingControls,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<StylesDimensionsPanel\n\t\t\t\tas={ DimensionsInspectorControl }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\tsettings={ settings }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\tonVisualize={ setVisualizedProperty }\n\t\t\t/>\n\t\t\t{ !! settings?.spacing?.padding && (\n\t\t\t\t<PaddingVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'padding' }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! settings?.spacing?.margin && (\n\t\t\t\t<MarginVisualizer\n\t\t\t\t\tforceShow={ visualizedProperty === 'margin' }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function useCustomSides() {\n\tdeprecated( 'wp.blockEditor.__experimentalUseCustomSides', {\n\t\tsince: '6.3',\n\t\tversion: '6.4',\n\t} );\n}\n"]}
@@ -15,7 +15,6 @@ import { getBlockSupport, getBlockType, hasBlockSupport } from '@wordpress/block
15
15
  import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
16
16
  import { addFilter } from '@wordpress/hooks';
17
17
  import { useMemo, useContext, createPortal } from '@wordpress/element';
18
- import { useSelect } from '@wordpress/data';
19
18
  /**
20
19
  * Internal dependencies
21
20
  */
@@ -26,8 +25,8 @@ import { __unstableDuotoneFilter as DuotoneFilter, __unstableDuotoneStylesheet a
26
25
  import { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';
27
26
  import { scopeSelector } from '../components/global-styles/utils';
28
27
  import { useBlockSettings } from './utils';
29
- import { store as blockEditorStore } from '../store';
30
28
  import { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';
29
+ import { useBlockEditingMode } from '../components/block-editing-mode';
31
30
  const EMPTY_ARRAY = [];
32
31
  extend([namesPlugin]);
33
32
  /**
@@ -213,14 +212,12 @@ const withDuotoneControls = createHigherOrderComponent(BlockEdit => props => {
213
212
  // Previous `color.__experimentalDuotone` support flag is migrated via
214
213
  // block_type_metadata_settings filter in `lib/block-supports/duotone.php`.
215
214
  const hasDuotoneSupport = hasBlockSupport(props.name, 'filter.duotone');
216
- const isContentLocked = useSelect(select => {
217
- return select(blockEditorStore).__unstableGetContentLockingParent(props.clientId);
218
- }, [props.clientId]); // CAUTION: code added before this line will be executed
215
+ const blockEditingMode = useBlockEditingMode(); // CAUTION: code added before this line will be executed
219
216
  // for all blocks, not just those that support duotone. Code added
220
217
  // above this line should be carefully evaluated for its impact on
221
218
  // performance.
222
219
 
223
- return createElement(Fragment, null, hasDuotoneSupport && !isContentLocked && createElement(DuotonePanel, props), createElement(BlockEdit, props));
220
+ return createElement(Fragment, null, hasDuotoneSupport && blockEditingMode === 'default' && createElement(DuotonePanel, props), createElement(BlockEdit, props));
224
221
  }, 'withDuotoneControls');
225
222
 
226
223
  function DuotoneStyles(_ref5) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","useSelect","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","__unstableDuotoneFilter","DuotoneFilter","__unstableDuotoneStylesheet","DuotoneStylesheet","__unstableDuotoneUnsetStylesheet","DuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","store","blockEditorStore","default","StylesFiltersPanel","EMPTY_ARRAY","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","name","style","duotoneStyle","color","settings","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","filter","newDuotone","newStyle","maybePreset","addDuotoneAttributes","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","isContentLocked","select","__unstableGetContentLockingParent","clientId","DuotoneStyles","filterId","duotoneSelector","attribute","duotoneAttr","element","__unstableElementContext","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","withDuotoneStyles","BlockListBlock","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,YAA9B,QAAkD,oBAAlD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,4BAA4B,IAAIC,cAHjC,EAICC,UAJD,QAKO,eALP;AAMA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SACCC,uBAAuB,IAAIC,aAD5B,EAECC,2BAA2B,IAAIC,iBAFhC,EAGCC,gCAAgC,IAAIC,sBAHrC,QAIO,uBAJP;AAKA,SAASC,mBAAT,QAAoC,oDAApC;AACA,SAASC,aAAT,QAA8B,mCAA9B;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,OAAO,IAAIC,kBAApB,QAA8C,2CAA9C;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA/B,MAAM,CAAE,CAAEC,WAAF,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAAS+B,aAAT,OAAmD;AAAA,MAA3B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAZ;AAAgBC,IAAAA;AAAhB,GAA2B;;AAClD,MAAKA,MAAM,KAAK,OAAhB,EAA0B;AACzB,WAAO,cAAC,s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EAER,iCAFQ,EAGRiG,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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 { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings } from './utils';\nimport { store as blockEditorStore } from '../store';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, 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 DuotonePanel( { attributes, setAttributes, name } ) {\n\tconst style = attributes?.style;\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\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 disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\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\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\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\tconst isContentLocked = useSelect(\n\t\t\t( select ) => {\n\t\t\t\treturn select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).__unstableGetContentLockingParent( props.clientId );\n\t\t\t},\n\t\t\t[ props.clientId ]\n\t\t);\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasDuotoneSupport && ! isContentLocked && (\n\t\t\t\t\t<DuotonePanel { ...props } />\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\nfunction DuotoneStyles( {\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst element = useContext( BlockList.__unstableElementContext );\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 `.editor-styles-wrapper .${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\treturn (\n\t\telement &&\n\t\tisValidFilter &&\n\t\tcreatePortal(\n\t\t\t<InlineDuotone\n\t\t\t\tselector={ selector }\n\t\t\t\tid={ filterId }\n\t\t\t\tcolors={ colors }\n\t\t\t/>,\n\t\t\telement\n\t\t)\n\t);\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst id = useInstanceId( BlockListBlock );\n\n\t\tconst selector = useMemo( () => {\n\t\t\tconst blockType = getBlockType( props.name );\n\n\t\t\tif ( blockType ) {\n\t\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t\t// experimental property has been, the experimental property\n\t\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'filter.duotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t\t// to be treated as a selector and requires scoping.\n\t\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( experimentalDuotone ) {\n\t\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t\t: rootSelector;\n\t\t\t\t}\n\n\t\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\t\tfallback: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}, [ props.name ] );\n\n\t\tconst attribute = props?.attributes?.style?.color?.duotone;\n\n\t\tconst filterClass = `wp-duotone-${ id }`;\n\n\t\tconst shouldRender = selector && attribute;\n\n\t\tconst className = shouldRender\n\t\t\t? classnames( props?.className, filterClass )\n\t\t\t: props?.className;\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRender && (\n\t\t\t\t\t<DuotoneStyles\n\t\t\t\t\t\tid={ filterClass }\n\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","extend","namesPlugin","getBlockSupport","getBlockType","hasBlockSupport","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","BlockControls","InspectorControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","__unstableDuotoneFilter","DuotoneFilter","__unstableDuotoneStylesheet","DuotoneStylesheet","__unstableDuotoneUnsetStylesheet","DuotoneUnsetStylesheet","getBlockCSSSelector","scopeSelector","useBlockSettings","default","StylesFiltersPanel","useBlockEditingMode","EMPTY_ARRAY","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","name","style","duotoneStyle","color","settings","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","filter","newDuotone","newStyle","maybePreset","addDuotoneAttributes","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","blockEditingMode","DuotoneStyles","filterId","duotoneSelector","attribute","duotoneAttr","element","__unstableElementContext","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","withDuotoneStyles","BlockListBlock","blockType","duotoneSupport","experimentalDuotone","rootSelector","fallback","filterClass","shouldRender","className"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,YAFD,EAGCC,eAHD,QAIO,mBAJP;AAKA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,YAA9B,QAAkD,oBAAlD;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,4BAA4B,IAAIC,cAHjC,EAICC,UAJD,QAKO,eALP;AAMA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SACCC,uBAAuB,IAAIC,aAD5B,EAECC,2BAA2B,IAAIC,iBAFhC,EAGCC,gCAAgC,IAAIC,sBAHrC,QAIO,uBAJP;AAKA,SAASC,mBAAT,QAAoC,oDAApC;AACA,SAASC,aAAT,QAA8B,mCAA9B;AACA,SAASC,gBAAT,QAAiC,SAAjC;AACA,SAASC,OAAO,IAAIC,kBAAp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KARD,CADD;AAYA,CArEkD,EAsEnD,mBAtEmD,CAApD;AAyEArG,SAAS,CACR,0BADQ,EAER,oCAFQ,EAGRiE,oBAHQ,CAAT;AAKAjE,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRqE,mBAHQ,CAAT;AAKArE,SAAS,CACR,uBADQ,EAER,iCAFQ,EAGR4F,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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 { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, 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 DuotonePanel( { attributes, setAttributes, name } ) {\n\tconst style = attributes?.style;\n\tconst duotoneStyle = style?.color?.duotone;\n\tconst settings = useBlockSettings( name );\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 disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\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\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\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\t// Previous `color.__experimentalDuotone` support flag is migrated via\n\t\t// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\tconst blockEditingMode = useBlockEditingMode();\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasDuotoneSupport && blockEditingMode === 'default' && (\n\t\t\t\t\t<DuotonePanel { ...props } />\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\nfunction DuotoneStyles( {\n\tid: filterId,\n\tselector: duotoneSelector,\n\tattribute: duotoneAttr,\n} ) {\n\tconst element = useContext( BlockList.__unstableElementContext );\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 `.editor-styles-wrapper .${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\treturn (\n\t\telement &&\n\t\tisValidFilter &&\n\t\tcreatePortal(\n\t\t\t<InlineDuotone\n\t\t\t\tselector={ selector }\n\t\t\t\tid={ filterId }\n\t\t\t\tcolors={ colors }\n\t\t\t/>,\n\t\t\telement\n\t\t)\n\t);\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst id = useInstanceId( BlockListBlock );\n\n\t\tconst selector = useMemo( () => {\n\t\t\tconst blockType = getBlockType( props.name );\n\n\t\t\tif ( blockType ) {\n\t\t\t\t// Backwards compatibility for `supports.color.__experimentalDuotone`\n\t\t\t\t// is provided via the `block_type_metadata_settings` filter. If\n\t\t\t\t// `supports.filter.duotone` has not been set and the\n\t\t\t\t// experimental property has been, the experimental property\n\t\t\t\t// value is copied into `supports.filter.duotone`.\n\t\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'filter.duotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( ! duotoneSupport ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// If the experimental duotone support was set, that value is\n\t\t\t\t// to be treated as a selector and requires scoping.\n\t\t\t\tconst experimentalDuotone = getBlockSupport(\n\t\t\t\t\tblockType,\n\t\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t\tif ( experimentalDuotone ) {\n\t\t\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\t\t\treturn typeof experimentalDuotone === 'string'\n\t\t\t\t\t\t? scopeSelector( rootSelector, experimentalDuotone )\n\t\t\t\t\t\t: rootSelector;\n\t\t\t\t}\n\n\t\t\t\t// Regular filter.duotone support uses filter.duotone selectors with fallbacks.\n\t\t\t\treturn getBlockCSSSelector( blockType, 'filter.duotone', {\n\t\t\t\t\tfallback: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t}, [ props.name ] );\n\n\t\tconst attribute = props?.attributes?.style?.color?.duotone;\n\n\t\tconst filterClass = `wp-duotone-${ id }`;\n\n\t\tconst shouldRender = selector && attribute;\n\n\t\tconst className = shouldRender\n\t\t\t? classnames( props?.className, filterClass )\n\t\t\t: props?.className;\n\n\t\t// CAUTION: code added before this line will be executed\n\t\t// for all blocks, not just those that support duotone. Code added\n\t\t// above this line should be carefully evaluated for its impact on\n\t\t// performance.\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRender && (\n\t\t\t\t\t<DuotoneStyles\n\t\t\t\t\t\tid={ filterClass }\n\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\tattribute={ attribute }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
@@ -20,6 +20,7 @@ import './layout';
20
20
  import './content-lock-ui';
21
21
  import './metadata';
22
22
  import './metadata-name';
23
+ import './behaviors';
23
24
  export { useCustomSides } from './dimensions';
24
25
  export { useLayoutClasses, useLayoutStyles } from './layout';
25
26
  export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":["useCustomSides","useLayoutClasses","useLayoutStyles","getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","getTypographyClassesAndStyles","getGapCSSValue","useCachedTruthy"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,UAAP;AACA,OAAO,SAAP;AACA,OAAO,QAAP;AACA,OAAO,UAAP;AACA,OAAO,cAAP;AACA,OAAO,qBAAP;AACA,OAAO,wBAAP;AACA,OAAO,SAAP;AACA,OAAO,YAAP;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,eAAP;AACA,OAAO,aAAP;AACA,OAAO,UAAP;AACA,OAAO,YAAP;AACA,OAAO,UAAP;AACA,OAAO,mBAAP;AACA,OAAO,YAAP;AACA,OAAO,iBAAP;AAEA,SAASA,cAAT,QAA+B,cAA/B;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,UAAlD;AACA,SAASC,yBAAT,EAAoCC,cAApC,QAA0D,oBAA1D;AACA,SAASC,wBAAT,EAAmCC,aAAnC,QAAwD,mBAAxD;AACA,SAASC,0BAAT,QAA2C,qBAA3C;AACA,SAASC,6BAAT,QAA8C,wBAA9C;AACA,SAASC,cAAT,QAA+B,OAA/B;AACA,SAASC,eAAT,QAAgC,qBAAhC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-family';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":["useCustomSides","useLayoutClasses","useLayoutStyles","getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","getTypographyClassesAndStyles","getGapCSSValue","useCachedTruthy"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,UAAP;AACA,OAAO,SAAP;AACA,OAAO,QAAP;AACA,OAAO,UAAP;AACA,OAAO,cAAP;AACA,OAAO,qBAAP;AACA,OAAO,wBAAP;AACA,OAAO,SAAP;AACA,OAAO,YAAP;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,eAAP;AACA,OAAO,aAAP;AACA,OAAO,UAAP;AACA,OAAO,YAAP;AACA,OAAO,UAAP;AACA,OAAO,mBAAP;AACA,OAAO,YAAP;AACA,OAAO,iBAAP;AACA,OAAO,aAAP;AAEA,SAASA,cAAT,QAA+B,cAA/B;AACA,SAASC,gBAAT,EAA2BC,eAA3B,QAAkD,UAAlD;AACA,SAASC,yBAAT,EAAoCC,cAApC,QAA0D,oBAA1D;AACA,SAASC,wBAAT,EAAmCC,aAAnC,QAAwD,mBAAxD;AACA,SAASC,0BAAT,QAA2C,qBAA3C;AACA,SAASC,6BAAT,QAA8C,wBAA9C;AACA,SAASC,cAAT,QAA+B,OAA/B;AACA,SAASC,eAAT,QAAgC,qBAAhC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-family';\nimport './font-size';\nimport './border';\nimport './position';\nimport './layout';\nimport './content-lock-ui';\nimport './metadata';\nimport './metadata-name';\nimport './behaviors';\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
@@ -27,6 +27,7 @@ import useSetting from '../components/use-setting';
27
27
  import { LayoutStyle } from '../components/block-list/layout';
28
28
  import BlockList from '../components/block-list';
29
29
  import { getLayoutType, getLayoutTypes } from '../layouts';
30
+ import { useBlockEditingMode } from '../components/block-editing-mode';
30
31
  const layoutBlockSupportKey = '__experimentalLayout';
31
32
  /**
32
33
  * Generates the utility classnames for the given block's layout attributes.
@@ -129,7 +130,6 @@ export function useLayoutStyles() {
129
130
 
130
131
  function LayoutPanel(_ref) {
131
132
  let {
132
- clientId,
133
133
  setAttributes,
134
134
  attributes,
135
135
  name: blockName
@@ -139,18 +139,16 @@ function LayoutPanel(_ref) {
139
139
  } = attributes;
140
140
  const defaultThemeLayout = useSetting('layout');
141
141
  const {
142
- themeSupportsLayout,
143
- isContentLocked
142
+ themeSupportsLayout
144
143
  } = useSelect(select => {
145
144
  const {
146
- getSettings,
147
- __unstableGetContentLockingParent
145
+ getSettings
148
146
  } = select(blockEditorStore);
149
147
  return {
150
- themeSupportsLayout: getSettings().supportsLayout,
151
- isContentLocked: __unstableGetContentLockingParent(clientId)
148
+ themeSupportsLayout: getSettings().supportsLayout
152
149
  };
153
- }, [clientId]);
150
+ }, []);
151
+ const blockEditingMode = useBlockEditingMode();
154
152
  const layoutBlockSupport = getBlockSupport(blockName, layoutBlockSupportKey, {});
155
153
  const {
156
154
  allowSwitching,
@@ -222,7 +220,7 @@ function LayoutPanel(_ref) {
222
220
  layout: usedLayout,
223
221
  onChange: onChangeLayout,
224
222
  layoutBlockSupport: layoutBlockSupport
225
- }))), !inherit && !isContentLocked && layoutType && createElement(layoutType.toolBarControls, {
223
+ }))), !inherit && blockEditingMode === 'default' && layoutType && createElement(layoutType.toolBarControls, {
226
224
  layout: usedLayout,
227
225
  onChange: onChangeLayout,
228
226
  layoutBlockSupport: layoutBlockSupport
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","kebabCase","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","layoutBlockSupportKey","useLayoutClasses","blockAttributes","blockName","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","globalLayoutSettings","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","definitions","className","baseClassName","compoundClassName","split","pop","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","layoutDefinitions","LayoutPanel","clientId","setAttributes","attributes","name","defaultThemeLayout","themeSupportsLayout","isContentLocked","__unstableGetContentLockingParent","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","layoutClassNames","withChildLayoutStyles","selfStretch","flexSize","hasChildLayout","shouldRenderChildLayoutStyles"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,SA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AAGhG,aAAa,CAAE4F,cAAF,CAAxB;AACA,QAAM1C,QAAQ,GAAI,yBAAyB8C,EAAI,EAA/C;AAEA,MAAIzC,GAAG,GAAG,EAAV;;AAEA,MAAK+C,WAAW,KAAK,OAAhB,IAA2BC,QAAhC,EAA2C;AAC1ChD,IAAAA,GAAG,IAAK,GAAGL,QAAU;AACxB,kBAAmBqD,QAAU;AAC7B;AACA,KAHG;AAIA,GALD,MAKO,IAAKD,WAAW,KAAK,MAArB,EAA8B;AACpC/C,IAAAA,GAAG,IAAK,GAAGL,QAAU;AACxB;AACA,KAFG;AAGA,GA3BiC,CA6BlC;;;AACA,QAAMV,SAAS,GAAG3C,UAAU,CAAE4F,KAAF,aAAEA,KAAF,uBAAEA,KAAK,CAAEjD,SAAT,EAAoB;AAC/C,KAAG,wBAAwBwD,EAAI,EAA/B,GACCS,6BAA6B,IAAI,CAAC,CAAElD,GAFU,CAEL;;AAFK,GAApB,CAA5B;AAKA,SACC,8BACGkD,6BAA6B,IAC9BR,OADC,IAED,CAAC,CAAE1C,GAFF,IAGD5C,YAAY,CAAE,6BAAS4C,GAAT,CAAF,EAA0B0C,OAA1B,CAJd,EAKC,cAAC,cAAD,eAAqBR,KAArB;AAA6B,IAAA,SAAS,EAAGjD;AAAzC,KALD,CADD;AASA,CA7C6D,EA8C9D,uBA9C8D,CAAxD;AAiDPvC,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGRoF,YAHQ,CAAT;AAKApF,SAAS,CACR,uBADQ,EAER,uCAFQ,EAGR0F,gBAHQ,CAAT;AAKA1F,SAAS,CACR,uBADQ,EAER,6CAFQ,EAGRoG,qBAHQ,CAAT;AAKApG,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGRsF,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif (\n\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t?.className\n\t) {\n\t\tconst baseClassName =\n\t\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t\t?.className;\n\t\tconst compoundClassName = `wp-block-${ blockName\n\t\t\t.split( '/' )\n\t\t\t.pop() }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tlayoutDefinitions: globalLayoutSettings?.definitions,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanel( {\n\tclientId,\n\tsetAttributes,\n\tattributes,\n\tname: blockName,\n} ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst { themeSupportsLayout, isContentLocked } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings, __unstableGetContentLockingParent } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t\t\tisContentLocked: __unstableGetContentLockingParent( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && ! isContentLocked && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( attributes, name )\n\t\t\t: null;\n\t\t// Higher specificity to override defaults from theme.json.\n\t\tconst selector = `.wp-container-${ id }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst layoutClassNames = classnames(\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\n/**\n * Override the default block element to add the child layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withChildLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { attributes } = props;\n\t\tconst { style: { layout = {} } = {} } = attributes;\n\t\tconst { selfStretch, flexSize } = layout;\n\t\tconst hasChildLayout = selfStretch || flexSize;\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderChildLayoutStyles =\n\t\t\thasChildLayout && ! disableLayoutStyles;\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst selector = `.wp-container-content-${ id }`;\n\n\t\tlet css = '';\n\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t}\n\n\t\t// Attach a `wp-container-content` id-based classname.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-content-${ id }` ]:\n\t\t\t\tshouldRenderChildLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderChildLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withChildLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-child-layout-styles',\n\twithChildLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","kebabCase","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","useBlockEditingMode","layoutBlockSupportKey","useLayoutClasses","blockAttributes","blockName","rootPaddingAlignment","select","getSettings","__experimentalFeatures","useRootPaddingAwareAlignments","globalLayoutSettings","layout","default","defaultBlockLayout","usedLayout","inherit","contentSize","wideSize","type","layoutClassnames","definitions","className","baseClassName","compoundClassName","split","pop","push","orientation","justifyContent","flexWrap","useLayoutStyles","selector","style","fullLayoutType","blockGapSupport","hasBlockGapSupport","css","getLayoutStyle","layoutDefinitions","LayoutPanel","setAttributes","attributes","name","defaultThemeLayout","themeSupportsLayout","supportsLayout","blockEditingMode","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","showInheritToggle","layoutType","constrainedType","displayControlsForLegacyLayouts","hasContentSizeOrLegacySettings","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","hasLayoutBlockSupport","disableLayoutStyles","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","layoutClassNames","withChildLayoutStyles","selfStretch","flexSize","hasChildLayout","shouldRenderChildLayoutStyles"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,WAFD,EAGCC,aAHD,EAICC,SAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,iBAAT,QAAkC,eAAlC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,WAAT,QAA4B,iCAA5B;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,YAA9C;AACA,SAASC,mBAAT,QAAoC,kCAApC;AAEA,MAAMC,qBAAqB,GAAG,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,GAAkE;AAAA;;AAAA,MAAvCC,eAAuC,uEAArB,EAAqB;AAAA,MAAjBC,SAAiB,uEAAL,EAAK;AACxE,QAAMC,oBAAoB,GAAGrB,SAAS,CAAIsB,MAAF,IAAc;AAAA;;AACrD,UAAM;AAAEC,MAAAA;AAAF,QAAkBD,MAAM,CAAEb,gBAAF,CAA9B;AACA,oCAAOc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8C9D,uBA9C8D,CAAxD;AAiDPxC,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGRmF,YAHQ,CAAT;AAKAnF,SAAS,CACR,uBADQ,EAER,uCAFQ,EAGRyF,gBAHQ,CAAT;AAKAzF,SAAS,CACR,uBADQ,EAER,6CAFQ,EAGRmG,qBAHQ,CAAT;AAKAnG,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGRqF,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given block's layout attributes.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n *\n * @return { Array } Array of CSS classname strings.\n */\nexport function useLayoutClasses( blockAttributes = {}, blockName = '' ) {\n\tconst rootPaddingAlignment = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().__experimentalFeatures\n\t\t\t?.useRootPaddingAwareAlignments;\n\t}, [] );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\n\tconst { layout } = blockAttributes;\n\n\tconst { default: defaultBlockLayout } =\n\t\tgetBlockSupport( blockName, layoutBlockSupportKey ) || {};\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || defaultBlockLayout || {};\n\n\tconst layoutClassnames = [];\n\n\tif (\n\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t?.className\n\t) {\n\t\tconst baseClassName =\n\t\t\tglobalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]\n\t\t\t\t?.className;\n\t\tconst compoundClassName = `wp-block-${ blockName\n\t\t\t.split( '/' )\n\t\t\t.pop() }-${ baseClassName }`;\n\t\tlayoutClassnames.push( baseClassName, compoundClassName );\n\t}\n\n\tif (\n\t\t( usedLayout?.inherit ||\n\t\t\tusedLayout?.contentSize ||\n\t\t\tusedLayout?.type === 'constrained' ) &&\n\t\trootPaddingAlignment\n\t) {\n\t\tlayoutClassnames.push( 'has-global-padding' );\n\t}\n\n\tif ( usedLayout?.orientation ) {\n\t\tlayoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );\n\t}\n\n\tif ( usedLayout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tusedLayout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\n/**\n * Generates a CSS rule with the given block's layout styles.\n *\n * @param { Object } blockAttributes Block attributes.\n * @param { string } blockName Block name.\n * @param { string } selector A selector to use in generating the CSS rule.\n *\n * @return { string } CSS rule.\n */\nexport function useLayoutStyles( blockAttributes = {}, blockName, selector ) {\n\tconst { layout = {}, style = {} } = blockAttributes;\n\t// Update type for blocks using legacy layouts.\n\tconst usedLayout =\n\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t: layout || {};\n\tconst fullLayoutType = getLayoutType( usedLayout?.type || 'default' );\n\tconst globalLayoutSettings = useSetting( 'layout' ) || {};\n\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGapSupport !== null;\n\tconst css = fullLayoutType?.getLayoutStyle?.( {\n\t\tblockName,\n\t\tselector,\n\t\tlayout,\n\t\tlayoutDefinitions: globalLayoutSettings?.definitions,\n\t\tstyle,\n\t\thasBlockGapSupport,\n\t} );\n\treturn css;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst { themeSupportsLayout } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tthemeSupportsLayout: getSettings().supportsLayout,\n\t\t};\n\t}, [] );\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and either the default / flow or the constrained layout type is in use, as the toggle switches from one to the other.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type ||\n\t\t\tlayout?.type === 'default' ||\n\t\t\tlayout?.type === 'constrained' ||\n\t\t\tlayout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst {\n\t\tinherit = false,\n\t\ttype = 'default',\n\t\tcontentSize = null,\n\t} = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow` or\n\t * `constrained` layouts and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif (\n\t\t( type === 'default' || type === 'constrained' ) &&\n\t\t! themeSupportsLayout\n\t) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\tconst constrainedType = getLayoutType( 'constrained' );\n\tconst displayControlsForLegacyLayouts =\n\t\t! usedLayout.type && ( contentSize || inherit );\n\tconst hasContentSizeOrLegacySettings = !! inherit || !! contentSize;\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tclassName=\"block-editor-hooks__toggle-control\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use content width' ) }\n\t\t\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t\t\ttype:\n\t\t\t\t\t\t\t\t\t\t\t\tlayoutType?.name ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t'constrained' ||\n\t\t\t\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 'default'\n\t\t\t\t\t\t\t\t\t\t\t\t\t: 'constrained',\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\tlayoutType?.name === 'constrained' ||\n\t\t\t\t\t\t\t\t\thasContentSizeOrLegacySettings\n\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container. Toggle to constrain.'\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ layoutType && layoutType.name !== 'default' && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ constrainedType && displayControlsForLegacyLayouts && (\n\t\t\t\t\t\t<constrainedType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && blockEditingMode === 'default' && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( 'type' in ( settings.attributes?.layout ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasLayoutBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderLayoutStyles =\n\t\t\thasLayoutBlockSupport && ! disableLayoutStyles;\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout =\n\t\t\tlayout?.inherit || layout?.contentSize || layout?.wideSize\n\t\t\t\t? { ...layout, type: 'constrained' }\n\t\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = hasLayoutBlockSupport\n\t\t\t? useLayoutClasses( attributes, name )\n\t\t\t: null;\n\t\t// Higher specificity to override defaults from theme.json.\n\t\tconst selector = `.wp-container-${ id }.wp-container-${ id }`;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapSupport = blockGapSupport !== null;\n\n\t\t// Get CSS string for the current layout type.\n\t\t// The CSS and `style` element is only output if it is not empty.\n\t\tlet css;\n\t\tif ( shouldRenderLayoutStyles ) {\n\t\t\tconst fullLayoutType = getLayoutType(\n\t\t\t\tusedLayout?.type || 'default'\n\t\t\t);\n\t\t\tcss = fullLayoutType?.getLayoutStyle?.( {\n\t\t\t\tblockName: name,\n\t\t\t\tselector,\n\t\t\t\tlayout: usedLayout,\n\t\t\t\tlayoutDefinitions: defaultThemeLayout?.definitions,\n\t\t\t\tstyle: attributes?.style,\n\t\t\t\thasBlockGapSupport,\n\t\t\t} );\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name as well as a layout class name such as `is-layout-flex`.\n\t\tconst layoutClassNames = classnames(\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ selector }\n\t\t\t\t\t\t\tcss={ css }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\t__unstableLayoutClassNames={ layoutClassNames }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withLayoutStyles'\n);\n\n/**\n * Override the default block element to add the child layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withChildLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { attributes } = props;\n\t\tconst { style: { layout = {} } = {} } = attributes;\n\t\tconst { selfStretch, flexSize } = layout;\n\t\tconst hasChildLayout = selfStretch || flexSize;\n\t\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\treturn !! getSettings().disableLayoutStyles;\n\t\t} );\n\t\tconst shouldRenderChildLayoutStyles =\n\t\t\thasChildLayout && ! disableLayoutStyles;\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst selector = `.wp-container-content-${ id }`;\n\n\t\tlet css = '';\n\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t}\n\n\t\t// Attach a `wp-container-content` id-based classname.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-content-${ id }` ]:\n\t\t\t\tshouldRenderChildLayoutStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderChildLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\t!! css &&\n\t\t\t\t\tcreatePortal( <style>{ css }</style>, element ) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withChildLayoutStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-child-layout-styles',\n\twithChildLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
@@ -4,14 +4,13 @@
4
4
  import * as globalStyles from './components/global-styles';
5
5
  import { ExperimentalBlockEditorProvider } from './components/provider';
6
6
  import { lock } from './lock-unlock';
7
- import OffCanvasEditor from './components/off-canvas-editor';
8
- import LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu';
9
7
  import ResizableBoxPopover from './components/resizable-box-popover';
10
8
  import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
11
9
  import { PrivateListView } from './components/list-view';
12
10
  import BlockInfo from './components/block-info-slot-fill';
13
11
  import { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';
14
12
  import { cleanEmptyObject } from './hooks/utils';
13
+ import { useBlockEditingMode } from './components/block-editing-mode';
15
14
  /**
16
15
  * Private @wordpress/block-editor APIs.
17
16
  */
@@ -19,13 +18,12 @@ import { cleanEmptyObject } from './hooks/utils';
19
18
  export const privateApis = {};
20
19
  lock(privateApis, { ...globalStyles,
21
20
  ExperimentalBlockEditorProvider,
22
- LeafMoreMenu,
23
- OffCanvasEditor,
24
21
  PrivateInserter,
25
22
  PrivateListView,
26
23
  ResizableBoxPopover,
27
24
  BlockInfo,
28
25
  useShouldContextualToolbarShow,
29
- cleanEmptyObject
26
+ cleanEmptyObject,
27
+ useBlockEditingMode
30
28
  });
31
29
  //# sourceMappingURL=private-apis.js.map