@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.1

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 (448) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +33 -3
  3. package/build/components/block-canvas/index.js +107 -0
  4. package/build/components/block-canvas/index.js.map +1 -0
  5. package/build/components/block-inspector/index.js +4 -1
  6. package/build/components/block-inspector/index.js.map +1 -1
  7. package/build/components/block-patterns-list/index.js +28 -8
  8. package/build/components/block-patterns-list/index.js.map +1 -1
  9. package/build/components/block-patterns-paging/index.js +68 -0
  10. package/build/components/block-patterns-paging/index.js.map +1 -0
  11. package/build/components/block-settings-menu/block-settings-dropdown.js +28 -0
  12. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  13. package/build/components/block-settings-menu-controls/index.js +4 -7
  14. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  15. package/build/components/block-styles/index.js +1 -0
  16. package/build/components/block-styles/index.js.map +1 -1
  17. package/build/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  18. package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  19. package/build/components/block-tools/block-contextual-toolbar.js +18 -7
  20. package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
  21. package/build/components/block-tools/block-selection-button.js +5 -1
  22. package/build/components/block-tools/block-selection-button.js.map +1 -1
  23. package/build/components/border-radius-control/input-controls.js +1 -1
  24. package/build/components/border-radius-control/input-controls.js.map +1 -1
  25. package/build/components/border-radius-control/linked-button.js +2 -4
  26. package/build/components/border-radius-control/linked-button.js.map +1 -1
  27. package/build/components/colors/with-colors.js.map +1 -1
  28. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  29. package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  30. package/build/components/default-block-appender/index.native.js +20 -1
  31. package/build/components/default-block-appender/index.native.js.map +1 -1
  32. package/build/components/duotone/utils.js +68 -0
  33. package/build/components/duotone/utils.js.map +1 -1
  34. package/build/components/editor-styles/index.js +28 -9
  35. package/build/components/editor-styles/index.js.map +1 -1
  36. package/build/components/global-styles/hooks.js +2 -101
  37. package/build/components/global-styles/hooks.js.map +1 -1
  38. package/build/components/global-styles/image-settings-panel.js +61 -0
  39. package/build/components/global-styles/image-settings-panel.js.map +1 -0
  40. package/build/components/global-styles/index.js +11 -17
  41. package/build/components/global-styles/index.js.map +1 -1
  42. package/build/components/global-styles/use-global-styles-output.js +19 -15
  43. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  44. package/build/components/global-styles/utils.js +1 -1
  45. package/build/components/global-styles/utils.js.map +1 -1
  46. package/build/components/iframe/index.js +67 -33
  47. package/build/components/iframe/index.js.map +1 -1
  48. package/build/components/image-editor/use-save-image.js +2 -5
  49. package/build/components/image-editor/use-save-image.js.map +1 -1
  50. package/build/components/image-editor/use-transform-image.js +9 -9
  51. package/build/components/image-editor/use-transform-image.js.map +1 -1
  52. package/build/components/index.js +8 -12
  53. package/build/components/index.js.map +1 -1
  54. package/build/components/index.native.js +6 -5
  55. package/build/components/index.native.js.map +1 -1
  56. package/build/components/inner-blocks/use-nested-settings-update.js +13 -7
  57. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  58. package/build/components/inserter/block-patterns-explorer/explorer.js +12 -6
  59. package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  60. package/build/components/inserter/block-patterns-explorer/patterns-list.js +45 -22
  61. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  62. package/build/components/inserter/block-patterns-explorer/sidebar.js +9 -9
  63. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  64. package/build/components/inserter/block-patterns-filter.js +137 -0
  65. package/build/components/inserter/block-patterns-filter.js.map +1 -0
  66. package/build/components/inserter/block-patterns-tab.js +128 -42
  67. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  68. package/build/components/inserter/hooks/use-patterns-paging.js +61 -0
  69. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  70. package/build/components/inserter/hooks/use-patterns-state.js +21 -10
  71. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  72. package/build/components/inserter/menu.js +13 -11
  73. package/build/components/inserter/menu.js.map +1 -1
  74. package/build/components/inserter/search-results.js +4 -3
  75. package/build/components/inserter/search-results.js.map +1 -1
  76. package/build/components/inserter/tabs.js +1 -12
  77. package/build/components/inserter/tabs.js.map +1 -1
  78. package/build/components/inspector-controls/block-support-slot-container.js +12 -1
  79. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  80. package/build/components/inspector-controls/fill.js +24 -13
  81. package/build/components/inspector-controls/fill.js.map +1 -1
  82. package/build/components/inspector-controls/groups.js +5 -3
  83. package/build/components/inspector-controls/groups.js.map +1 -1
  84. package/build/components/inspector-controls/slot.js +13 -0
  85. package/build/components/inspector-controls/slot.js.map +1 -1
  86. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  87. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  88. package/build/components/link-control/index.js +12 -2
  89. package/build/components/link-control/index.js.map +1 -1
  90. package/build/components/list-view/block-select-button.js +1 -3
  91. package/build/components/list-view/block-select-button.js.map +1 -1
  92. package/build/components/list-view/block.js +13 -1
  93. package/build/components/list-view/block.js.map +1 -1
  94. package/build/components/list-view/use-block-selection.js +29 -24
  95. package/build/components/list-view/use-block-selection.js.map +1 -1
  96. package/build/components/media-placeholder/index.js +2 -2
  97. package/build/components/media-placeholder/index.js.map +1 -1
  98. package/build/components/media-placeholder/index.native.js +11 -11
  99. package/build/components/media-placeholder/index.native.js.map +1 -1
  100. package/build/components/media-replace-flow/index.js +2 -3
  101. package/build/components/media-replace-flow/index.js.map +1 -1
  102. package/build/components/media-upload/constants.js +30 -0
  103. package/build/components/media-upload/constants.js.map +1 -0
  104. package/build/components/media-upload/index.native.js +63 -53
  105. package/build/components/media-upload/index.native.js.map +1 -1
  106. package/build/components/preview-options/index.js +1 -1
  107. package/build/components/preview-options/index.js.map +1 -1
  108. package/build/components/rich-text/index.js +34 -35
  109. package/build/components/rich-text/index.js.map +1 -1
  110. package/build/components/rich-text/index.native.js +14 -32
  111. package/build/components/rich-text/index.native.js.map +1 -1
  112. package/build/components/rich-text/multiline.js +95 -0
  113. package/build/components/rich-text/multiline.js.map +1 -0
  114. package/build/components/rich-text/split-value.js +10 -16
  115. package/build/components/rich-text/split-value.js.map +1 -1
  116. package/build/components/rich-text/use-enter.js +31 -40
  117. package/build/components/rich-text/use-enter.js.map +1 -1
  118. package/build/components/rich-text/use-paste-handler.js +18 -33
  119. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  120. package/build/components/spacing-sizes-control/utils.js +1 -1
  121. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  122. package/build/components/use-block-commands/index.js +30 -18
  123. package/build/components/use-block-commands/index.js.map +1 -1
  124. package/build/components/use-block-display-information/index.js +5 -2
  125. package/build/components/use-block-display-information/index.js.map +1 -1
  126. package/build/hooks/background.js +263 -0
  127. package/build/hooks/background.js.map +1 -0
  128. package/build/hooks/block-hooks.js +188 -0
  129. package/build/hooks/block-hooks.js.map +1 -0
  130. package/build/hooks/block-rename-ui.js +161 -0
  131. package/build/hooks/block-rename-ui.js.map +1 -0
  132. package/build/hooks/duotone.js +29 -42
  133. package/build/hooks/duotone.js.map +1 -1
  134. package/build/hooks/index.js +2 -2
  135. package/build/hooks/index.js.map +1 -1
  136. package/build/hooks/layout.js +31 -14
  137. package/build/hooks/layout.js.map +1 -1
  138. package/build/hooks/position.js +4 -2
  139. package/build/hooks/position.js.map +1 -1
  140. package/build/hooks/style.js +10 -3
  141. package/build/hooks/style.js.map +1 -1
  142. package/build/private-apis.js +2 -0
  143. package/build/private-apis.js.map +1 -1
  144. package/build/store/actions.js +33 -10
  145. package/build/store/actions.js.map +1 -1
  146. package/build/store/private-actions.js +42 -8
  147. package/build/store/private-actions.js.map +1 -1
  148. package/build/store/private-selectors.js +25 -3
  149. package/build/store/private-selectors.js.map +1 -1
  150. package/build/store/reducer.js +43 -1
  151. package/build/store/reducer.js.map +1 -1
  152. package/build/store/selectors.js +84 -23
  153. package/build/store/selectors.js.map +1 -1
  154. package/build/store/utils.js +0 -4
  155. package/build/store/utils.js.map +1 -1
  156. package/build-module/components/block-canvas/index.js +97 -0
  157. package/build-module/components/block-canvas/index.js.map +1 -0
  158. package/build-module/components/block-inspector/index.js +4 -1
  159. package/build-module/components/block-inspector/index.js.map +1 -1
  160. package/build-module/components/block-patterns-list/index.js +30 -10
  161. package/build-module/components/block-patterns-list/index.js.map +1 -1
  162. package/build-module/components/block-patterns-paging/index.js +61 -0
  163. package/build-module/components/block-patterns-paging/index.js.map +1 -0
  164. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
  165. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  166. package/build-module/components/block-settings-menu-controls/index.js +4 -7
  167. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  168. package/build-module/components/block-styles/index.js +1 -0
  169. package/build-module/components/block-styles/index.js.map +1 -1
  170. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  171. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  172. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
  173. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  174. package/build-module/components/block-tools/block-selection-button.js +5 -1
  175. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  176. package/build-module/components/border-radius-control/input-controls.js +1 -1
  177. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  178. package/build-module/components/border-radius-control/linked-button.js +2 -4
  179. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  180. package/build-module/components/colors/with-colors.js.map +1 -1
  181. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  182. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  183. package/build-module/components/default-block-appender/index.native.js +20 -1
  184. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  185. package/build-module/components/duotone/utils.js +65 -0
  186. package/build-module/components/duotone/utils.js.map +1 -1
  187. package/build-module/components/editor-styles/index.js +28 -9
  188. package/build-module/components/editor-styles/index.js.map +1 -1
  189. package/build-module/components/global-styles/hooks.js +3 -100
  190. package/build-module/components/global-styles/hooks.js.map +1 -1
  191. package/build-module/components/global-styles/image-settings-panel.js +53 -0
  192. package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
  193. package/build-module/components/global-styles/index.js +2 -2
  194. package/build-module/components/global-styles/index.js.map +1 -1
  195. package/build-module/components/global-styles/use-global-styles-output.js +18 -16
  196. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  197. package/build-module/components/global-styles/utils.js +1 -1
  198. package/build-module/components/global-styles/utils.js.map +1 -1
  199. package/build-module/components/iframe/index.js +66 -33
  200. package/build-module/components/iframe/index.js.map +1 -1
  201. package/build-module/components/image-editor/use-save-image.js +2 -5
  202. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  203. package/build-module/components/image-editor/use-transform-image.js +9 -9
  204. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  205. package/build-module/components/index.js +1 -1
  206. package/build-module/components/index.js.map +1 -1
  207. package/build-module/components/index.native.js +2 -1
  208. package/build-module/components/index.native.js.map +1 -1
  209. package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
  210. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  211. package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
  212. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  213. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +47 -24
  214. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +9 -9
  216. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  217. package/build-module/components/inserter/block-patterns-filter.js +128 -0
  218. package/build-module/components/inserter/block-patterns-filter.js.map +1 -0
  219. package/build-module/components/inserter/block-patterns-tab.js +125 -44
  220. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  221. package/build-module/components/inserter/hooks/use-patterns-paging.js +54 -0
  222. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  223. package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
  224. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  225. package/build-module/components/inserter/menu.js +13 -11
  226. package/build-module/components/inserter/menu.js.map +1 -1
  227. package/build-module/components/inserter/search-results.js +4 -3
  228. package/build-module/components/inserter/search-results.js.map +1 -1
  229. package/build-module/components/inserter/tabs.js +1 -12
  230. package/build-module/components/inserter/tabs.js.map +1 -1
  231. package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
  232. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  233. package/build-module/components/inspector-controls/fill.js +25 -14
  234. package/build-module/components/inspector-controls/fill.js.map +1 -1
  235. package/build-module/components/inspector-controls/groups.js +5 -3
  236. package/build-module/components/inspector-controls/groups.js.map +1 -1
  237. package/build-module/components/inspector-controls/slot.js +15 -1
  238. package/build-module/components/inspector-controls/slot.js.map +1 -1
  239. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  240. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  241. package/build-module/components/link-control/index.js +12 -2
  242. package/build-module/components/link-control/index.js.map +1 -1
  243. package/build-module/components/list-view/block-select-button.js +1 -3
  244. package/build-module/components/list-view/block-select-button.js.map +1 -1
  245. package/build-module/components/list-view/block.js +13 -1
  246. package/build-module/components/list-view/block.js.map +1 -1
  247. package/build-module/components/list-view/use-block-selection.js +30 -25
  248. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  249. package/build-module/components/media-placeholder/index.js +2 -2
  250. package/build-module/components/media-placeholder/index.js.map +1 -1
  251. package/build-module/components/media-placeholder/index.native.js +7 -7
  252. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  253. package/build-module/components/media-replace-flow/index.js +2 -3
  254. package/build-module/components/media-replace-flow/index.js.map +1 -1
  255. package/build-module/components/media-upload/constants.js +14 -0
  256. package/build-module/components/media-upload/constants.js.map +1 -0
  257. package/build-module/components/media-upload/index.native.js +53 -34
  258. package/build-module/components/media-upload/index.native.js.map +1 -1
  259. package/build-module/components/preview-options/index.js +1 -1
  260. package/build-module/components/preview-options/index.js.map +1 -1
  261. package/build-module/components/rich-text/index.js +35 -37
  262. package/build-module/components/rich-text/index.js.map +1 -1
  263. package/build-module/components/rich-text/index.native.js +15 -33
  264. package/build-module/components/rich-text/index.native.js.map +1 -1
  265. package/build-module/components/rich-text/multiline.js +87 -0
  266. package/build-module/components/rich-text/multiline.js.map +1 -0
  267. package/build-module/components/rich-text/split-value.js +10 -16
  268. package/build-module/components/rich-text/split-value.js.map +1 -1
  269. package/build-module/components/rich-text/use-enter.js +33 -42
  270. package/build-module/components/rich-text/use-enter.js.map +1 -1
  271. package/build-module/components/rich-text/use-paste-handler.js +19 -34
  272. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  273. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  274. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  275. package/build-module/components/use-block-commands/index.js +28 -16
  276. package/build-module/components/use-block-commands/index.js.map +1 -1
  277. package/build-module/components/use-block-display-information/index.js +5 -2
  278. package/build-module/components/use-block-display-information/index.js.map +1 -1
  279. package/build-module/hooks/background.js +249 -0
  280. package/build-module/hooks/background.js.map +1 -0
  281. package/build-module/hooks/block-hooks.js +181 -0
  282. package/build-module/hooks/block-hooks.js.map +1 -0
  283. package/build-module/hooks/block-rename-ui.js +154 -0
  284. package/build-module/hooks/block-rename-ui.js.map +1 -0
  285. package/build-module/hooks/duotone.js +26 -39
  286. package/build-module/hooks/duotone.js.map +1 -1
  287. package/build-module/hooks/index.js +2 -2
  288. package/build-module/hooks/index.js.map +1 -1
  289. package/build-module/hooks/layout.js +33 -16
  290. package/build-module/hooks/layout.js.map +1 -1
  291. package/build-module/hooks/position.js +4 -2
  292. package/build-module/hooks/position.js.map +1 -1
  293. package/build-module/hooks/style.js +10 -3
  294. package/build-module/hooks/style.js.map +1 -1
  295. package/build-module/private-apis.js +2 -0
  296. package/build-module/private-apis.js.map +1 -1
  297. package/build-module/store/actions.js +33 -10
  298. package/build-module/store/actions.js.map +1 -1
  299. package/build-module/store/private-actions.js +39 -8
  300. package/build-module/store/private-actions.js.map +1 -1
  301. package/build-module/store/private-selectors.js +23 -3
  302. package/build-module/store/private-selectors.js.map +1 -1
  303. package/build-module/store/reducer.js +41 -1
  304. package/build-module/store/reducer.js.map +1 -1
  305. package/build-module/store/selectors.js +78 -22
  306. package/build-module/store/selectors.js.map +1 -1
  307. package/build-module/store/utils.js +0 -4
  308. package/build-module/store/utils.js.map +1 -1
  309. package/build-style/content-rtl.css +0 -1
  310. package/build-style/content.css +0 -1
  311. package/build-style/style-rtl.css +201 -131
  312. package/build-style/style.css +201 -131
  313. package/package.json +32 -32
  314. package/src/components/block-canvas/index.js +108 -0
  315. package/src/components/block-inspector/index.js +5 -1
  316. package/src/components/block-list/content.scss +0 -1
  317. package/src/components/block-patterns-list/index.js +53 -19
  318. package/src/components/block-patterns-list/style.scss +26 -9
  319. package/src/components/block-patterns-paging/index.js +92 -0
  320. package/src/components/block-patterns-paging/style.scss +45 -0
  321. package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
  322. package/src/components/block-settings-menu-controls/index.js +4 -9
  323. package/src/components/block-styles/index.js +1 -0
  324. package/src/components/block-styles/style.scss +3 -3
  325. package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
  326. package/src/components/block-tools/block-contextual-toolbar.js +16 -5
  327. package/src/components/block-tools/block-selection-button.js +9 -1
  328. package/src/components/block-tools/style.scss +0 -98
  329. package/src/components/border-radius-control/input-controls.js +1 -1
  330. package/src/components/border-radius-control/linked-button.js +8 -11
  331. package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
  332. package/src/components/colors/with-colors.js +3 -2
  333. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
  334. package/src/components/default-block-appender/index.native.js +26 -3
  335. package/src/components/duotone/utils.js +65 -0
  336. package/src/components/editor-styles/index.js +32 -23
  337. package/src/components/global-styles/hooks.js +4 -112
  338. package/src/components/global-styles/image-settings-panel.js +71 -0
  339. package/src/components/global-styles/index.js +4 -3
  340. package/src/components/global-styles/use-global-styles-output.js +25 -16
  341. package/src/components/global-styles/utils.js +1 -2
  342. package/src/components/iframe/index.js +72 -33
  343. package/src/components/image-editor/use-save-image.js +2 -9
  344. package/src/components/image-editor/use-transform-image.js +9 -9
  345. package/src/components/index.js +1 -1
  346. package/src/components/index.native.js +2 -2
  347. package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
  348. package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
  349. package/src/components/inserter/block-patterns-explorer/patterns-list.js +68 -43
  350. package/src/components/inserter/block-patterns-explorer/sidebar.js +8 -8
  351. package/src/components/inserter/block-patterns-filter.js +183 -0
  352. package/src/components/inserter/block-patterns-tab.js +217 -58
  353. package/src/components/inserter/hooks/use-patterns-paging.js +76 -0
  354. package/src/components/inserter/hooks/use-patterns-state.js +27 -16
  355. package/src/components/inserter/menu.js +15 -17
  356. package/src/components/inserter/search-results.js +6 -4
  357. package/src/components/inserter/style.scss +36 -7
  358. package/src/components/inserter/tabs.js +2 -12
  359. package/src/components/inserter/test/index.native.js +8 -12
  360. package/src/components/inspector-controls/block-support-slot-container.js +19 -3
  361. package/src/components/inspector-controls/fill.js +28 -14
  362. package/src/components/inspector-controls/groups.js +6 -2
  363. package/src/components/inspector-controls/slot.js +28 -3
  364. package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
  365. package/src/components/link-control/index.js +13 -0
  366. package/src/components/link-control/style.scss +23 -2
  367. package/src/components/link-control/test/index.js +88 -6
  368. package/src/components/list-view/block-select-button.js +1 -3
  369. package/src/components/list-view/block.js +19 -1
  370. package/src/components/list-view/style.scss +1 -2
  371. package/src/components/list-view/use-block-selection.js +38 -32
  372. package/src/components/media-placeholder/README.md +2 -2
  373. package/src/components/media-placeholder/index.js +2 -2
  374. package/src/components/media-placeholder/index.native.js +11 -12
  375. package/src/components/media-replace-flow/index.js +2 -2
  376. package/src/components/media-replace-flow/test/index.js +5 -23
  377. package/src/components/media-upload/README.md +3 -2
  378. package/src/components/media-upload/constants.js +15 -0
  379. package/src/components/media-upload/index.native.js +66 -40
  380. package/src/components/media-upload/style.native.scss +4 -0
  381. package/src/components/media-upload/test/index.native.js +2 -2
  382. package/src/components/preview-options/README.md +7 -0
  383. package/src/components/preview-options/index.js +1 -1
  384. package/src/components/rich-text/index.js +48 -44
  385. package/src/components/rich-text/index.native.js +14 -42
  386. package/src/components/rich-text/multiline.js +121 -0
  387. package/src/components/rich-text/split-value.js +10 -35
  388. package/src/components/rich-text/use-enter.js +32 -42
  389. package/src/components/rich-text/use-paste-handler.js +16 -40
  390. package/src/components/spacing-sizes-control/style.scss +5 -7
  391. package/src/components/spacing-sizes-control/utils.js +1 -2
  392. package/src/components/use-block-commands/index.js +28 -20
  393. package/src/components/use-block-display-information/index.js +3 -0
  394. package/src/hooks/background.js +299 -0
  395. package/src/hooks/background.scss +75 -0
  396. package/src/hooks/block-hooks.js +257 -0
  397. package/src/hooks/block-hooks.scss +16 -0
  398. package/src/hooks/block-rename-ui.js +231 -0
  399. package/src/hooks/block-rename-ui.scss +3 -0
  400. package/src/hooks/duotone.js +42 -43
  401. package/src/hooks/index.js +2 -2
  402. package/src/hooks/layout.js +31 -33
  403. package/src/hooks/position.js +4 -3
  404. package/src/hooks/style.js +11 -2
  405. package/src/hooks/test/align.native.js +4 -3
  406. package/src/private-apis.js +2 -0
  407. package/src/store/actions.js +52 -10
  408. package/src/store/private-actions.js +37 -6
  409. package/src/store/private-selectors.js +28 -3
  410. package/src/store/reducer.js +38 -0
  411. package/src/store/selectors.js +107 -26
  412. package/src/store/test/actions.js +19 -8
  413. package/src/store/test/private-actions.js +17 -0
  414. package/src/store/test/reducer.js +25 -0
  415. package/src/store/test/selectors.js +130 -123
  416. package/src/store/utils.js +3 -10
  417. package/src/style.scss +4 -0
  418. package/build/components/duotone/components.js +0 -135
  419. package/build/components/duotone/components.js.map +0 -1
  420. package/build/components/duotone/index.js +0 -38
  421. package/build/components/duotone/index.js.map +0 -1
  422. package/build/components/global-styles/behaviors-panel.js +0 -64
  423. package/build/components/global-styles/behaviors-panel.js.map +0 -1
  424. package/build/components/inserter/reusable-blocks-tab.js +0 -85
  425. package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
  426. package/build/hooks/auto-inserting-blocks.js +0 -174
  427. package/build/hooks/auto-inserting-blocks.js.map +0 -1
  428. package/build/hooks/behaviors.js +0 -173
  429. package/build/hooks/behaviors.js.map +0 -1
  430. package/build-module/components/duotone/components.js +0 -126
  431. package/build-module/components/duotone/components.js.map +0 -1
  432. package/build-module/components/duotone/index.js +0 -3
  433. package/build-module/components/duotone/index.js.map +0 -1
  434. package/build-module/components/global-styles/behaviors-panel.js +0 -57
  435. package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
  436. package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
  437. package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
  438. package/build-module/hooks/auto-inserting-blocks.js +0 -167
  439. package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
  440. package/build-module/hooks/behaviors.js +0 -166
  441. package/build-module/hooks/behaviors.js.map +0 -1
  442. package/src/components/duotone/components.js +0 -133
  443. package/src/components/duotone/index.js +0 -7
  444. package/src/components/global-styles/behaviors-panel.js +0 -71
  445. package/src/components/inserter/reusable-blocks-tab.js +0 -84
  446. package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
  447. package/src/hooks/auto-inserting-blocks.js +0 -232
  448. package/src/hooks/behaviors.js +0 -206
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withBlockRenameControl = void 0;
7
+ var _element = require("@wordpress/element");
8
+ var _compose = require("@wordpress/compose");
9
+ var _hooks = require("@wordpress/hooks");
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _blocks = require("@wordpress/blocks");
12
+ var _components = require("@wordpress/components");
13
+ var _a11y = require("@wordpress/a11y");
14
+ var _components2 = require("../components");
15
+ /**
16
+ * WordPress dependencies
17
+ */
18
+
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+
23
+ const emptyString = testString => testString?.trim()?.length === 0;
24
+ function RenameModal({
25
+ blockName,
26
+ originalBlockName,
27
+ onClose,
28
+ onSave
29
+ }) {
30
+ const [editedBlockName, setEditedBlockName] = (0, _element.useState)(blockName);
31
+ const nameHasChanged = editedBlockName !== blockName;
32
+ const nameIsOriginal = editedBlockName === originalBlockName;
33
+ const nameIsEmpty = emptyString(editedBlockName);
34
+ const isNameValid = nameHasChanged || nameIsOriginal;
35
+ const autoSelectInputText = event => event.target.select();
36
+ const dialogDescription = (0, _compose.useInstanceId)(RenameModal, `block-editor-rename-modal__description`);
37
+ const handleSubmit = () => {
38
+ // Must be assertive to immediately announce change.
39
+ (0, _a11y.speak)((0, _i18n.sprintf)( /* translators: %1$s: type of update (either reset of changed). %2$s: new name/label for the block */
40
+ (0, _i18n.__)('Block name %1$s to: "%2$s".'), nameIsOriginal || nameIsEmpty ? (0, _i18n.__)('reset') : (0, _i18n.__)('changed'), editedBlockName), 'assertive');
41
+ onSave(editedBlockName);
42
+
43
+ // Immediate close avoids ability to hit save multiple times.
44
+ onClose();
45
+ };
46
+ return (0, _element.createElement)(_components.Modal, {
47
+ title: (0, _i18n.__)('Rename'),
48
+ onRequestClose: onClose,
49
+ overlayClassName: "block-editor-block-rename-modal",
50
+ aria: {
51
+ describedby: dialogDescription
52
+ },
53
+ focusOnMount: "firstContentElement"
54
+ }, (0, _element.createElement)("p", {
55
+ id: dialogDescription
56
+ }, (0, _i18n.__)('Enter a custom name for this block.')), (0, _element.createElement)("form", {
57
+ onSubmit: e => {
58
+ e.preventDefault();
59
+ if (!isNameValid) {
60
+ return;
61
+ }
62
+ handleSubmit();
63
+ }
64
+ }, (0, _element.createElement)(_components.__experimentalVStack, {
65
+ spacing: "3"
66
+ }, (0, _element.createElement)(_components.TextControl, {
67
+ __nextHasNoMarginBottom: true,
68
+ value: editedBlockName,
69
+ label: (0, _i18n.__)('Block name'),
70
+ hideLabelFromVision: true,
71
+ placeholder: originalBlockName,
72
+ onChange: setEditedBlockName,
73
+ onFocus: autoSelectInputText
74
+ }), (0, _element.createElement)(_components.__experimentalHStack, {
75
+ justify: "right"
76
+ }, (0, _element.createElement)(_components.Button, {
77
+ variant: "tertiary",
78
+ onClick: onClose
79
+ }, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
80
+ "aria-disabled": !isNameValid,
81
+ variant: "primary",
82
+ type: "submit"
83
+ }, (0, _i18n.__)('Save'))))));
84
+ }
85
+ function BlockRenameControl(props) {
86
+ const [renamingBlock, setRenamingBlock] = (0, _element.useState)(false);
87
+ const {
88
+ clientId,
89
+ customName,
90
+ onChange
91
+ } = props;
92
+ const blockInformation = (0, _components2.useBlockDisplayInformation)(clientId);
93
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components2.InspectorControls, {
94
+ group: "advanced"
95
+ }, (0, _element.createElement)(_components.TextControl, {
96
+ __nextHasNoMarginBottom: true,
97
+ label: (0, _i18n.__)('Block name'),
98
+ value: customName || '',
99
+ onChange: onChange
100
+ })), (0, _element.createElement)(_components2.BlockSettingsMenuControls, null, ({
101
+ selectedClientIds
102
+ }) => {
103
+ // Only enabled for single selections.
104
+ const canRename = selectedClientIds.length === 1 && clientId === selectedClientIds[0];
105
+
106
+ // This check ensures the `BlockSettingsMenuControls` fill
107
+ // doesn't render multiple times and also that it renders for
108
+ // the block from which the menu was triggered.
109
+ if (!canRename) {
110
+ return null;
111
+ }
112
+ return (0, _element.createElement)(_components.MenuItem, {
113
+ onClick: () => {
114
+ setRenamingBlock(true);
115
+ },
116
+ "aria-expanded": renamingBlock,
117
+ "aria-haspopup": "dialog"
118
+ }, (0, _i18n.__)('Rename'));
119
+ }), renamingBlock && (0, _element.createElement)(RenameModal, {
120
+ blockName: customName || '',
121
+ originalBlockName: blockInformation?.title,
122
+ onClose: () => setRenamingBlock(false),
123
+ onSave: newName => {
124
+ // If the new value is the block's original name (e.g. `Group`)
125
+ // or it is an empty string then assume the intent is to reset
126
+ // the value. Therefore reset the metadata.
127
+ if (newName === blockInformation?.title || emptyString(newName)) {
128
+ newName = undefined;
129
+ }
130
+ onChange(newName);
131
+ }
132
+ }));
133
+ }
134
+ const withBlockRenameControl = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
135
+ const {
136
+ clientId,
137
+ name,
138
+ attributes,
139
+ setAttributes
140
+ } = props;
141
+ const metaDataSupport = (0, _blocks.getBlockSupport)(name, '__experimentalMetadata', false);
142
+ const supportsBlockNaming = !!(true === metaDataSupport || metaDataSupport?.name);
143
+ return (0, _element.createElement)(_element.Fragment, null, supportsBlockNaming && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockRenameControl, {
144
+ clientId: clientId,
145
+ customName: attributes?.metadata?.name,
146
+ onChange: newName => {
147
+ setAttributes({
148
+ metadata: {
149
+ ...(attributes?.metadata && attributes?.metadata),
150
+ name: newName
151
+ }
152
+ });
153
+ }
154
+ })), (0, _element.createElement)(BlockEdit, {
155
+ key: "edit",
156
+ ...props
157
+ }));
158
+ }, 'withToolbarControls');
159
+ exports.withBlockRenameControl = withBlockRenameControl;
160
+ (0, _hooks.addFilter)('editor.BlockEdit', 'core/block-rename-ui/with-block-rename-control', withBlockRenameControl);
161
+ //# sourceMappingURL=block-rename-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_compose","_hooks","_i18n","_blocks","_components","_a11y","_components2","emptyString","testString","trim","length","RenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","useState","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","useInstanceId","handleSubmit","speak","sprintf","__","createElement","Modal","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","value","label","hideLabelFromVision","placeholder","onChange","onFocus","__experimentalHStack","justify","Button","variant","onClick","type","BlockRenameControl","props","renamingBlock","setRenamingBlock","clientId","customName","blockInformation","useBlockDisplayInformation","Fragment","InspectorControls","group","BlockSettingsMenuControls","selectedClientIds","canRename","MenuItem","newName","undefined","withBlockRenameControl","createHigherOrderComponent","BlockEdit","name","attributes","setAttributes","metaDataSupport","getBlockSupport","supportsBlockNaming","metadata","key","exports","addFilter"],"sources":["@wordpress/block-editor/src/hooks/block-rename-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockDisplayInformation,\n\tInspectorControls,\n} from '../components';\n\nconst emptyString = ( testString ) => testString?.trim()?.length === 0;\n\nfunction RenameModal( { blockName, originalBlockName, onClose, onSave } ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = emptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %1$s: type of update (either reset of changed). %2$s: new name/label for the block */\n\t\t\t\t__( 'Block name %1$s to: \"%2$s\".' ),\n\t\t\t\tnameIsOriginal || nameIsEmpty ? __( 'reset' ) : __( 'changed' ),\n\t\t\t\teditedBlockName\n\t\t\t),\n\t\t\t'assertive'\n\t\t);\n\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nfunction BlockRenameControl( props ) {\n\tconst [ renamingBlock, setRenamingBlock ] = useState( false );\n\n\tconst { clientId, customName, onChange } = props;\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\tvalue={ customName || '' }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t// Only enabled for single selections.\n\t\t\t\t\tconst canRename =\n\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\tclientId === selectedClientIds[ 0 ];\n\n\t\t\t\t\t// This check ensures the `BlockSettingsMenuControls` fill\n\t\t\t\t\t// doesn't render multiple times and also that it renders for\n\t\t\t\t\t// the block from which the menu was triggered.\n\t\t\t\t\tif ( ! canRename ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenamingBlock( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-expanded={ renamingBlock }\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t{ renamingBlock && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tblockName={ customName || '' }\n\t\t\t\t\toriginalBlockName={ blockInformation?.title }\n\t\t\t\t\tonClose={ () => setRenamingBlock( false ) }\n\t\t\t\t\tonSave={ ( newName ) => {\n\t\t\t\t\t\t// If the new value is the block's original name (e.g. `Group`)\n\t\t\t\t\t\t// or it is an empty string then assume the intent is to reset\n\t\t\t\t\t\t// the value. Therefore reset the metadata.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnewName === blockInformation?.title ||\n\t\t\t\t\t\t\temptyString( newName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewName = undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( newName );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const withBlockRenameControl = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name, attributes, setAttributes } = props;\n\n\t\tconst metaDataSupport = getBlockSupport(\n\t\t\tname,\n\t\t\t'__experimentalMetadata',\n\t\t\tfalse\n\t\t);\n\n\t\tconst supportsBlockNaming = !! (\n\t\t\ttrue === metaDataSupport || metaDataSupport?.name\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ supportsBlockNaming && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockRenameControl\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tcustomName={ attributes?.metadata?.name }\n\t\t\t\t\t\t\tonChange={ ( newName ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t...( attributes?.metadata &&\n\t\t\t\t\t\t\t\t\t\t\tattributes?.metadata ),\n\t\t\t\t\t\t\t\t\t\tname: newName,\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} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/block-rename-ui/with-block-rename-control',\n\twithBlockRenameControl\n);\n"],"mappings":";;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AASA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,YAAA,GAAAP,OAAA;AArBA;AACA;AACA;;AAgBA;AACA;AACA;;AAOA,MAAMQ,WAAW,GAAKC,UAAU,IAAMA,UAAU,EAAEC,IAAI,CAAC,CAAC,EAAEC,MAAM,KAAK,CAAC;AAEtE,SAASC,WAAWA,CAAE;EAAEC,SAAS;EAAEC,iBAAiB;EAAEC,OAAO;EAAEC;AAAO,CAAC,EAAG;EACzE,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAEN,SAAU,CAAC;EAErE,MAAMO,cAAc,GAAGH,eAAe,KAAKJ,SAAS;EACpD,MAAMQ,cAAc,GAAGJ,eAAe,KAAKH,iBAAiB;EAC5D,MAAMQ,WAAW,GAAGd,WAAW,CAAES,eAAgB,CAAC;EAElD,MAAMM,WAAW,GAAGH,cAAc,IAAIC,cAAc;EAEpD,MAAM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B,KAAK;EAE3D,MAAMsB,eAAe,GAAG,IAAAC,uBAAe,EACtCJ,IAAI,EACJ,wBAAwB,EACxB,KACD,CAAC;EAED,MAAMK,mBAAmB,GAAG,CAAC,EAC5B,IAAI,KAAKF,eAAe,IAAIA,eAAe,EAAEH,IAAI,CACjD;EAED,OACC,IAAAnF,QAAA,CAAAmC,aAAA,EAAAnC,QAAA,CAAAuE,QAAA,QACGiB,mBAAmB,IACpB,IAAAxF,QAAA,CAAAmC,aAAA,EAAAnC,QAAA,CAAAuE,QAAA,QACC,IAAAvE,QAAA,CAAAmC,aAAA,EAAC4B,kBAAkB;IAClBI,QAAQ,EAAGA,QAAU;IACrBC,UAAU,EAAGgB,UAAU,EAAEK,QAAQ,EAAEN,IAAM;IACzC5B,QAAQ,EAAKuB,OAAO,IAAM;MACzBO,aAAa,CAAE;QACdI,QAAQ,EAAE;UACT,IAAKL,UAAU,EAAEK,QAAQ,IACxBL,UAAU,EAAEK,QAAQ,CAAE;UACvBN,IAAI,EAAEL;QACP;MACD,CAAE,CAAC;IACJ;EAAG,CACH,CACA,CACF,EAED,IAAA9E,QAAA,CAAAmC,aAAA,EAAC+C,SAAS;IAACQ,GAAG,EAAC,MAAM;IAAA,GAAM1B;EAAK,CAAI,CACnC,CAAC;AAEL,CAAC,EACD,qBACD,CAAC;AAAC2B,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAEF,IAAAY,gBAAS,EACR,kBAAkB,EAClB,gDAAgD,EAChDZ,sBACD,CAAC"}
@@ -13,14 +13,16 @@ var _names = _interopRequireDefault(require("colord/plugins/names"));
13
13
  var _blocks = require("@wordpress/blocks");
14
14
  var _compose = require("@wordpress/compose");
15
15
  var _hooks = require("@wordpress/hooks");
16
+ var _data = require("@wordpress/data");
16
17
  var _components = require("../components");
17
- var _blockList = _interopRequireDefault(require("../components/block-list"));
18
- var _duotone = require("../components/duotone");
18
+ var _utils = require("../components/duotone/utils");
19
19
  var _getBlockCssSelector = require("../components/global-styles/get-block-css-selector");
20
- var _utils = require("../components/global-styles/utils");
21
- var _utils2 = require("./utils");
20
+ var _utils2 = require("../components/global-styles/utils");
21
+ var _utils3 = require("./utils");
22
22
  var _filtersPanel = _interopRequireDefault(require("../components/global-styles/filters-panel"));
23
23
  var _blockEditingMode = require("../components/block-editing-mode");
24
+ var _store = require("../store");
25
+ var _lockUnlock = require("../lock-unlock");
24
26
  /**
25
27
  * External dependencies
26
28
  */
@@ -35,35 +37,6 @@ var _blockEditingMode = require("../components/block-editing-mode");
35
37
 
36
38
  const EMPTY_ARRAY = [];
37
39
  (0, _colord.extend)([_names.default]);
38
-
39
- /**
40
- * SVG and stylesheet needed for rendering the duotone filter.
41
- *
42
- * @param {Object} props Duotone props.
43
- * @param {string} props.selector Selector to apply the filter to.
44
- * @param {string} props.id Unique id for this duotone filter.
45
- * @param {string[]|"unset"} props.colors Array of RGB color strings ordered from dark to light.
46
- *
47
- * @return {WPElement} Duotone element.
48
- */
49
- function InlineDuotone({
50
- selector,
51
- id,
52
- colors
53
- }) {
54
- if (colors === 'unset') {
55
- return (0, _element.createElement)(_duotone.__unstableDuotoneUnsetStylesheet, {
56
- selector: selector
57
- });
58
- }
59
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_duotone.__unstableDuotoneFilter, {
60
- id: id,
61
- colors: colors
62
- }), (0, _element.createElement)(_duotone.__unstableDuotoneStylesheet, {
63
- id: id,
64
- selector: selector
65
- }));
66
- }
67
40
  function useMultiOriginPresets({
68
41
  presetSetting,
69
42
  defaultSetting
@@ -101,7 +74,7 @@ function DuotonePanel({
101
74
  }) {
102
75
  const style = attributes?.style;
103
76
  const duotoneStyle = style?.color?.duotone;
104
- const settings = (0, _utils2.useBlockSettings)(name);
77
+ const settings = (0, _utils3.useBlockSettings)(name);
105
78
  const duotonePalette = useMultiOriginPresets({
106
79
  presetSetting: 'color.duotone',
107
80
  defaultSetting: 'color.defaultDuotone'
@@ -219,7 +192,6 @@ function DuotoneStyles({
219
192
  selector: duotoneSelector,
220
193
  attribute: duotoneAttr
221
194
  }) {
222
- const element = (0, _element.useContext)(_blockList.default.__unstableElementContext);
223
195
  const duotonePalette = useMultiOriginPresets({
224
196
  presetSetting: 'color.duotone',
225
197
  defaultSetting: 'color.defaultDuotone'
@@ -257,15 +229,30 @@ function DuotoneStyles({
257
229
  // Assuming the selector part is a subclass selector (not a tag name)
258
230
  // so we can prepend the filter id class. If we want to support elements
259
231
  // such as `img` or namespaces, we'll need to add a case for that here.
260
- return `.editor-styles-wrapper .${filterId}${selectorPart.trim()}`;
232
+ return `.${filterId}${selectorPart.trim()}`;
261
233
  });
262
234
  const selector = selectorsScoped.join(', ');
263
235
  const isValidFilter = Array.isArray(colors) || colors === 'unset';
264
- return element && isValidFilter && (0, _element.createPortal)((0, _element.createElement)(InlineDuotone, {
265
- selector: selector,
266
- id: filterId,
267
- colors: colors
268
- }), element);
236
+ const {
237
+ setStyleOverride,
238
+ deleteStyleOverride
239
+ } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
240
+ (0, _element.useEffect)(() => {
241
+ if (!isValidFilter) return;
242
+ setStyleOverride(filterId, {
243
+ css: colors !== 'unset' ? (0, _utils.getDuotoneStylesheet)(selector, filterId) : (0, _utils.getDuotoneUnsetStylesheet)(selector),
244
+ __unstableType: 'presets'
245
+ });
246
+ setStyleOverride(`duotone-${filterId}`, {
247
+ assets: colors !== 'unset' ? (0, _utils.getDuotoneFilter)(filterId, colors) : '',
248
+ __unstableType: 'svgs'
249
+ });
250
+ return () => {
251
+ deleteStyleOverride(filterId);
252
+ deleteStyleOverride(`duotone-${filterId}`);
253
+ };
254
+ }, [isValidFilter, colors, selector, filterId, setStyleOverride, deleteStyleOverride]);
255
+ return null;
269
256
  }
270
257
 
271
258
  /**
@@ -295,7 +282,7 @@ const withDuotoneStyles = (0, _compose.createHigherOrderComponent)(BlockListBloc
295
282
  const experimentalDuotone = (0, _blocks.getBlockSupport)(blockType, 'color.__experimentalDuotone', false);
296
283
  if (experimentalDuotone) {
297
284
  const rootSelector = (0, _getBlockCssSelector.getBlockCSSSelector)(blockType);
298
- return typeof experimentalDuotone === 'string' ? (0, _utils.scopeSelector)(rootSelector, experimentalDuotone) : rootSelector;
285
+ return typeof experimentalDuotone === 'string' ? (0, _utils2.scopeSelector)(rootSelector, experimentalDuotone) : rootSelector;
299
286
  }
300
287
 
301
288
  // Regular filter.duotone support uses filter.duotone selectors with fallbacks.
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_colord","_names","_blocks","_compose","_hooks","_components","_blockList","_duotone","_getBlockCssSelector","_utils","_utils2","_filtersPanel","_blockEditingMode","EMPTY_ARRAY","extend","namesPlugin","InlineDuotone","selector","id","colors","createElement","__unstableDuotoneUnsetStylesheet","Fragment","__unstableDuotoneFilter","__unstableDuotoneStylesheet","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","useSetting","userPresets","themePresets","defaultPresets","useMemo","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","name","style","duotoneStyle","color","settings","useBlockSettings","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","InspectorControls","group","default","value","filter","onChange","newDuotone","newStyle","BlockControls","__experimentalShareWithChildBlocks","__experimentalDuotoneControl","maybePreset","addDuotoneAttributes","hasBlockSupport","Object","assign","type","withDuotoneControls","createHigherOrderComponent","BlockEdit","props","hasDuotoneSupport","blockEditingMode","useBlockEditingMode","DuotoneStyles","filterId","duotoneSelector","attribute","duotoneAttr","element","useContext","BlockList","__unstableElementContext","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","createPortal","withDuotoneStyles","BlockListBlock","useInstanceId","blockType","getBlockType","duotoneSupport","getBlockSupport","experimentalDuotone","rootSelector","getBlockCSSSelector","scopeSelector","fallback","filterClass","shouldRender","className","classnames","addFilter"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"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"],"mappings":";;;;;;;;AAiBA,IAAAA,QAAA,GAAAC,OAAA;AAdA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAMA,IAAAQ,WAAA,GAAAR,OAAA;AAMA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAKA,IAAAW,oBAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAZ,sBAAA,C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AAC;AACD,IAAAiD,gBAAS,EACR,kBAAkB,EAClB,0CAA0C,EAC1C5C,mBACD,CAAC;AACD,IAAA4C,gBAAS,EACR,uBAAuB,EACvB,iCAAiC,EACjChB,iBACD,CAAC"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_colord","_names","_blocks","_compose","_hooks","_data","_components","_utils","_getBlockCssSelector","_utils2","_utils3","_filtersPanel","_blockEditingMode","_store","_lockUnlock","EMPTY_ARRAY","extend","namesPlugin","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","useSetting","userPresets","themePresets","defaultPresets","useMemo","getColorsFromDuotonePreset","duotone","duotonePalette","preset","find","slug","colors","undefined","getDuotonePresetFromColors","Array","isArray","duotonePreset","every","val","index","DuotonePanel","attributes","setAttributes","name","style","duotoneStyle","color","settings","useBlockSettings","colorPalette","disableCustomColors","disableCustomDuotone","length","duotonePresetOrColors","createElement","Fragment","InspectorControls","group","default","value","filter","onChange","newDuotone","newStyle","BlockControls","__experimentalShareWithChildBlocks","__experimentalDuotoneControl","maybePreset","addDuotoneAttributes","hasBlockSupport","Object","assign","type","withDuotoneControls","createHigherOrderComponent","BlockEdit","props","hasDuotoneSupport","blockEditingMode","useBlockEditingMode","DuotoneStyles","id","filterId","selector","duotoneSelector","attribute","duotoneAttr","isCustom","isPreset","isCSS","selectors","split","selectorsScoped","map","selectorPart","trim","join","isValidFilter","setStyleOverride","deleteStyleOverride","unlock","useDispatch","blockEditorStore","useEffect","css","getDuotoneStylesheet","getDuotoneUnsetStylesheet","__unstableType","assets","getDuotoneFilter","withDuotoneStyles","BlockListBlock","useInstanceId","blockType","getBlockType","duotoneSupport","getBlockSupport","experimentalDuotone","rootSelector","getBlockCSSSelector","scopeSelector","fallback","filterClass","shouldRender","className","classnames","addFilter"],"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"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, useEffect } from '@wordpress/element';\nimport { useDispatch } 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 {\n\tgetDuotoneFilter,\n\tgetDuotoneStylesheet,\n\tgetDuotoneUnsetStylesheet,\n} from '../components/duotone/utils';\nimport { getBlockCSSSelector } from '../components/global-styles/get-block-css-selector';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockSettings } from './utils';\nimport { default as StylesFiltersPanel } from '../components/global-styles/filters-panel';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\nimport { store as blockEditorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\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 duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\n\t// Possible values for duotone attribute:\n\t// 1. Array of colors - e.g. ['#000000', '#ffffff'].\n\t// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''\n\t// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.\n\tconst isCustom = Array.isArray( duotoneAttr );\n\tconst duotonePreset = isCustom\n\t\t? undefined\n\t\t: getColorsFromDuotonePreset( duotoneAttr, duotonePalette );\n\tconst isPreset = typeof duotoneAttr === 'string' && duotonePreset;\n\tconst isCSS = typeof duotoneAttr === 'string' && ! isPreset;\n\n\t// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.\n\tlet colors = null;\n\tif ( isPreset ) {\n\t\t// Array of colors.\n\t\tcolors = duotonePreset;\n\t} else if ( isCSS ) {\n\t\t// CSS filter property string (e.g. 'unset').\n\t\tcolors = duotoneAttr;\n\t} else if ( isCustom ) {\n\t\t// Array of colors.\n\t\tcolors = duotoneAttr;\n\t}\n\n\t// Build the CSS selectors to which the filter will be applied.\n\tconst selectors = duotoneSelector.split( ',' );\n\n\tconst selectorsScoped = selectors.map( ( selectorPart ) => {\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\n\t\t// Assuming the selector part is a subclass selector (not a tag name)\n\t\t// so we can prepend the filter id class. If we want to support elements\n\t\t// such as `img` or namespaces, we'll need to add a case for that here.\n\t\treturn `.${ filterId }${ selectorPart.trim() }`;\n\t} );\n\n\tconst selector = selectorsScoped.join( ', ' );\n\n\tconst isValidFilter = Array.isArray( colors ) || colors === 'unset';\n\n\tconst { setStyleOverride, deleteStyleOverride } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tuseEffect( () => {\n\t\tif ( ! isValidFilter ) return;\n\n\t\tsetStyleOverride( filterId, {\n\t\t\tcss:\n\t\t\t\tcolors !== 'unset'\n\t\t\t\t\t? getDuotoneStylesheet( selector, filterId )\n\t\t\t\t\t: getDuotoneUnsetStylesheet( selector ),\n\t\t\t__unstableType: 'presets',\n\t\t} );\n\t\tsetStyleOverride( `duotone-${ filterId }`, {\n\t\t\tassets:\n\t\t\t\tcolors !== 'unset' ? getDuotoneFilter( filterId, colors ) : '',\n\t\t\t__unstableType: 'svgs',\n\t\t} );\n\n\t\treturn () => {\n\t\t\tdeleteStyleOverride( filterId );\n\t\t\tdeleteStyleOverride( `duotone-${ filterId }` );\n\t\t};\n\t}, [\n\t\tisValidFilter,\n\t\tcolors,\n\t\tselector,\n\t\tfilterId,\n\t\tsetStyleOverride,\n\t\tdeleteStyleOverride,\n\t] );\n\n\treturn null;\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"],"mappings":";;;;;;;;AAiBA,IAAAA,QAAA,GAAAC,OAAA;AAdA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAKA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAEA,IAAAQ,KAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AAMA,IAAAU,MAAA,GAAAV,OAAA;AAKA,IAAAW,oBAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,aAAA,GAAAZ,sBAAA,CAAAF,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AAxCA;AAC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C"}
@@ -88,9 +88,9 @@ var _layout = require("./layout");
88
88
  require("./content-lock-ui");
89
89
  require("./metadata");
90
90
  require("./metadata-name");
91
- require("./behaviors");
92
91
  require("./custom-fields");
93
- require("./auto-inserting-blocks");
92
+ require("./block-hooks");
93
+ require("./block-rename-ui");
94
94
  var _dimensions = require("./dimensions");
95
95
  var _useBorderProps = require("./use-border-props");
96
96
  var _useColorProps = require("./use-color-props");
@@ -1 +1 @@
1
- {"version":3,"names":["require","_layout","_dimensions","_useBorderProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"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';\nimport './custom-fields';\nimport './auto-inserting-blocks';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA"}
1
+ {"version":3,"names":["require","_layout","_dimensions","_useBorderProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"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 './custom-fields';\nimport './block-hooks';\nimport './block-rename-ui';\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AACAA,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA"}
@@ -19,13 +19,12 @@ var _i18n = require("@wordpress/i18n");
19
19
  var _store = require("../store");
20
20
  var _components2 = require("../components");
21
21
  var _useSetting = _interopRequireDefault(require("../components/use-setting"));
22
- var _layout = require("../components/block-list/layout");
23
- var _blockList = _interopRequireDefault(require("../components/block-list"));
24
22
  var _layouts = require("../layouts");
25
23
  var _blockEditingMode = require("../components/block-editing-mode");
26
24
  var _definitions = require("../layouts/definitions");
27
25
  var _object = require("../utils/object");
28
26
  var _utils = require("./utils");
27
+ var _lockUnlock = require("../lock-unlock");
29
28
  /**
30
29
  * External dependencies
31
30
  */
@@ -302,7 +301,6 @@ const withLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock
302
301
  });
303
302
  const shouldRenderLayoutStyles = blockSupportsLayout && !disableLayoutStyles;
304
303
  const id = (0, _compose.useInstanceId)(BlockListBlock);
305
- const element = (0, _element.useContext)(_blockList.default.__unstableElementContext);
306
304
  const {
307
305
  layout
308
306
  } = attributes;
@@ -337,16 +335,23 @@ const withLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockListBlock
337
335
  const layoutClassNames = (0, _classnames.default)({
338
336
  [`wp-container-${id}`]: shouldRenderLayoutStyles && !!css // Only attach a container class if there is generated CSS to be attached.
339
337
  }, layoutClasses);
340
- return (0, _element.createElement)(_element.Fragment, null, shouldRenderLayoutStyles && element && !!css && (0, _element.createPortal)((0, _element.createElement)(_layout.LayoutStyle, {
341
- blockName: name,
342
- selector: selector,
343
- css: css,
344
- layout: usedLayout,
345
- style: attributes?.style
346
- }), element), (0, _element.createElement)(BlockListBlock, {
338
+ const {
339
+ setStyleOverride,
340
+ deleteStyleOverride
341
+ } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
342
+ (0, _element.useEffect)(() => {
343
+ if (!css) return;
344
+ setStyleOverride(id, {
345
+ css
346
+ });
347
+ return () => {
348
+ deleteStyleOverride(id);
349
+ };
350
+ }, [id, css, setStyleOverride, deleteStyleOverride]);
351
+ return (0, _element.createElement)(BlockListBlock, {
347
352
  ...props,
348
353
  __unstableLayoutClassNames: layoutClassNames
349
- }));
354
+ });
350
355
  }, 'withLayoutStyles');
351
356
 
352
357
  /**
@@ -378,7 +383,6 @@ const withChildLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockList
378
383
  return !!getSettings().disableLayoutStyles;
379
384
  });
380
385
  const shouldRenderChildLayoutStyles = hasChildLayout && !disableLayoutStyles;
381
- const element = (0, _element.useContext)(_blockList.default.__unstableElementContext);
382
386
  const id = (0, _compose.useInstanceId)(BlockListBlock);
383
387
  const selector = `.wp-container-content-${id}`;
384
388
  let css = '';
@@ -398,10 +402,23 @@ const withChildLayoutStyles = (0, _compose.createHigherOrderComponent)(BlockList
398
402
  [`wp-container-content-${id}`]: shouldRenderChildLayoutStyles && !!css // Only attach a container class if there is generated CSS to be attached.
399
403
  });
400
404
 
401
- return (0, _element.createElement)(_element.Fragment, null, shouldRenderChildLayoutStyles && element && !!css && (0, _element.createPortal)((0, _element.createElement)("style", null, css), element), (0, _element.createElement)(BlockListBlock, {
405
+ const {
406
+ setStyleOverride,
407
+ deleteStyleOverride
408
+ } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
409
+ (0, _element.useEffect)(() => {
410
+ if (!css) return;
411
+ setStyleOverride(id, {
412
+ css
413
+ });
414
+ return () => {
415
+ deleteStyleOverride(id);
416
+ };
417
+ }, [id, css, setStyleOverride, deleteStyleOverride]);
418
+ return (0, _element.createElement)(BlockListBlock, {
402
419
  ...props,
403
420
  className: className
404
- }));
421
+ });
405
422
  }, 'withChildLayoutStyles');
406
423
  exports.withChildLayoutStyles = withChildLayoutStyles;
407
424
  (0, _hooks.addFilter)('blocks.registerBlockType', 'core/layout/addAttribute', addAttribute);