@wordpress/block-editor 12.9.1-next.5a1d1283.0 → 12.10.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 (453) 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 +19 -4
  8. package/build/components/block-patterns-list/index.js.map +1 -1
  9. package/build/components/block-patterns-paging/index.js +66 -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 +57 -23
  61. package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  62. package/build/components/inserter/block-patterns-explorer/sidebar.js +24 -9
  63. package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  64. package/build/components/inserter/block-patterns-source-filter.js +54 -0
  65. package/build/components/inserter/block-patterns-source-filter.js.map +1 -0
  66. package/build/components/inserter/block-patterns-sync-filter.js +46 -0
  67. package/build/components/inserter/block-patterns-sync-filter.js.map +1 -0
  68. package/build/components/inserter/block-patterns-tab.js +91 -45
  69. package/build/components/inserter/block-patterns-tab.js.map +1 -1
  70. package/build/components/inserter/hooks/use-patterns-paging.js +57 -0
  71. package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  72. package/build/components/inserter/hooks/use-patterns-state.js +21 -10
  73. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  74. package/build/components/inserter/menu.js +13 -11
  75. package/build/components/inserter/menu.js.map +1 -1
  76. package/build/components/inserter/search-results.js +4 -3
  77. package/build/components/inserter/search-results.js.map +1 -1
  78. package/build/components/inserter/tabs.js +1 -12
  79. package/build/components/inserter/tabs.js.map +1 -1
  80. package/build/components/inspector-controls/block-support-slot-container.js +12 -1
  81. package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
  82. package/build/components/inspector-controls/fill.js +24 -13
  83. package/build/components/inspector-controls/fill.js.map +1 -1
  84. package/build/components/inspector-controls/groups.js +5 -3
  85. package/build/components/inspector-controls/groups.js.map +1 -1
  86. package/build/components/inspector-controls/slot.js +13 -0
  87. package/build/components/inspector-controls/slot.js.map +1 -1
  88. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  89. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  90. package/build/components/link-control/index.js +12 -2
  91. package/build/components/link-control/index.js.map +1 -1
  92. package/build/components/list-view/block-select-button.js +1 -3
  93. package/build/components/list-view/block-select-button.js.map +1 -1
  94. package/build/components/list-view/block.js +13 -1
  95. package/build/components/list-view/block.js.map +1 -1
  96. package/build/components/list-view/use-block-selection.js +29 -24
  97. package/build/components/list-view/use-block-selection.js.map +1 -1
  98. package/build/components/media-placeholder/index.js +2 -2
  99. package/build/components/media-placeholder/index.js.map +1 -1
  100. package/build/components/media-placeholder/index.native.js +11 -11
  101. package/build/components/media-placeholder/index.native.js.map +1 -1
  102. package/build/components/media-replace-flow/index.js +2 -3
  103. package/build/components/media-replace-flow/index.js.map +1 -1
  104. package/build/components/media-upload/constants.js +30 -0
  105. package/build/components/media-upload/constants.js.map +1 -0
  106. package/build/components/media-upload/index.native.js +63 -53
  107. package/build/components/media-upload/index.native.js.map +1 -1
  108. package/build/components/preview-options/index.js +1 -1
  109. package/build/components/preview-options/index.js.map +1 -1
  110. package/build/components/rich-text/index.js +34 -35
  111. package/build/components/rich-text/index.js.map +1 -1
  112. package/build/components/rich-text/index.native.js +14 -32
  113. package/build/components/rich-text/index.native.js.map +1 -1
  114. package/build/components/rich-text/multiline.js +95 -0
  115. package/build/components/rich-text/multiline.js.map +1 -0
  116. package/build/components/rich-text/split-value.js +10 -16
  117. package/build/components/rich-text/split-value.js.map +1 -1
  118. package/build/components/rich-text/use-enter.js +31 -40
  119. package/build/components/rich-text/use-enter.js.map +1 -1
  120. package/build/components/rich-text/use-paste-handler.js +18 -33
  121. package/build/components/rich-text/use-paste-handler.js.map +1 -1
  122. package/build/components/spacing-sizes-control/utils.js +1 -1
  123. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  124. package/build/components/use-block-commands/index.js +30 -18
  125. package/build/components/use-block-commands/index.js.map +1 -1
  126. package/build/components/use-block-display-information/index.js +5 -2
  127. package/build/components/use-block-display-information/index.js.map +1 -1
  128. package/build/hooks/background.js +258 -0
  129. package/build/hooks/background.js.map +1 -0
  130. package/build/hooks/block-hooks.js +188 -0
  131. package/build/hooks/block-hooks.js.map +1 -0
  132. package/build/hooks/block-rename-ui.js +160 -0
  133. package/build/hooks/block-rename-ui.js.map +1 -0
  134. package/build/hooks/duotone.js +29 -42
  135. package/build/hooks/duotone.js.map +1 -1
  136. package/build/hooks/index.js +2 -2
  137. package/build/hooks/index.js.map +1 -1
  138. package/build/hooks/layout.js +31 -14
  139. package/build/hooks/layout.js.map +1 -1
  140. package/build/hooks/position.js +4 -2
  141. package/build/hooks/position.js.map +1 -1
  142. package/build/hooks/style.js +10 -3
  143. package/build/hooks/style.js.map +1 -1
  144. package/build/private-apis.js +2 -0
  145. package/build/private-apis.js.map +1 -1
  146. package/build/store/actions.js +33 -10
  147. package/build/store/actions.js.map +1 -1
  148. package/build/store/private-actions.js +42 -8
  149. package/build/store/private-actions.js.map +1 -1
  150. package/build/store/private-selectors.js +23 -0
  151. package/build/store/private-selectors.js.map +1 -1
  152. package/build/store/reducer.js +43 -1
  153. package/build/store/reducer.js.map +1 -1
  154. package/build/store/selectors.js +84 -23
  155. package/build/store/selectors.js.map +1 -1
  156. package/build/store/utils.js +0 -4
  157. package/build/store/utils.js.map +1 -1
  158. package/build-module/components/block-canvas/index.js +97 -0
  159. package/build-module/components/block-canvas/index.js.map +1 -0
  160. package/build-module/components/block-inspector/index.js +4 -1
  161. package/build-module/components/block-inspector/index.js.map +1 -1
  162. package/build-module/components/block-patterns-list/index.js +20 -5
  163. package/build-module/components/block-patterns-list/index.js.map +1 -1
  164. package/build-module/components/block-patterns-paging/index.js +59 -0
  165. package/build-module/components/block-patterns-paging/index.js.map +1 -0
  166. package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -0
  167. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  168. package/build-module/components/block-settings-menu-controls/index.js +4 -7
  169. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  170. package/build-module/components/block-styles/index.js +1 -0
  171. package/build-module/components/block-styles/index.js.map +1 -1
  172. package/build-module/components/block-toolbar/block-toolbar-menu.native.js +3 -7
  173. package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
  174. package/build-module/components/block-tools/block-contextual-toolbar.js +18 -7
  175. package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
  176. package/build-module/components/block-tools/block-selection-button.js +5 -1
  177. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  178. package/build-module/components/border-radius-control/input-controls.js +1 -1
  179. package/build-module/components/border-radius-control/input-controls.js.map +1 -1
  180. package/build-module/components/border-radius-control/linked-button.js +2 -4
  181. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  182. package/build-module/components/colors/with-colors.js.map +1 -1
  183. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -21
  184. package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
  185. package/build-module/components/default-block-appender/index.native.js +20 -1
  186. package/build-module/components/default-block-appender/index.native.js.map +1 -1
  187. package/build-module/components/duotone/utils.js +65 -0
  188. package/build-module/components/duotone/utils.js.map +1 -1
  189. package/build-module/components/editor-styles/index.js +28 -9
  190. package/build-module/components/editor-styles/index.js.map +1 -1
  191. package/build-module/components/global-styles/hooks.js +3 -100
  192. package/build-module/components/global-styles/hooks.js.map +1 -1
  193. package/build-module/components/global-styles/image-settings-panel.js +53 -0
  194. package/build-module/components/global-styles/image-settings-panel.js.map +1 -0
  195. package/build-module/components/global-styles/index.js +2 -2
  196. package/build-module/components/global-styles/index.js.map +1 -1
  197. package/build-module/components/global-styles/use-global-styles-output.js +18 -16
  198. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  199. package/build-module/components/global-styles/utils.js +1 -1
  200. package/build-module/components/global-styles/utils.js.map +1 -1
  201. package/build-module/components/iframe/index.js +66 -33
  202. package/build-module/components/iframe/index.js.map +1 -1
  203. package/build-module/components/image-editor/use-save-image.js +2 -5
  204. package/build-module/components/image-editor/use-save-image.js.map +1 -1
  205. package/build-module/components/image-editor/use-transform-image.js +9 -9
  206. package/build-module/components/image-editor/use-transform-image.js.map +1 -1
  207. package/build-module/components/index.js +1 -1
  208. package/build-module/components/index.js.map +1 -1
  209. package/build-module/components/index.native.js +2 -1
  210. package/build-module/components/index.native.js.map +1 -1
  211. package/build-module/components/inner-blocks/use-nested-settings-update.js +14 -8
  212. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  213. package/build-module/components/inserter/block-patterns-explorer/explorer.js +12 -6
  214. package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -1
  215. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +59 -25
  216. package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -1
  217. package/build-module/components/inserter/block-patterns-explorer/sidebar.js +23 -9
  218. package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
  219. package/build-module/components/inserter/block-patterns-source-filter.js +44 -0
  220. package/build-module/components/inserter/block-patterns-source-filter.js.map +1 -0
  221. package/build-module/components/inserter/block-patterns-sync-filter.js +38 -0
  222. package/build-module/components/inserter/block-patterns-sync-filter.js.map +1 -0
  223. package/build-module/components/inserter/block-patterns-tab.js +87 -46
  224. package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
  225. package/build-module/components/inserter/hooks/use-patterns-paging.js +50 -0
  226. package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -0
  227. package/build-module/components/inserter/hooks/use-patterns-state.js +22 -10
  228. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  229. package/build-module/components/inserter/menu.js +13 -11
  230. package/build-module/components/inserter/menu.js.map +1 -1
  231. package/build-module/components/inserter/search-results.js +4 -3
  232. package/build-module/components/inserter/search-results.js.map +1 -1
  233. package/build-module/components/inserter/tabs.js +1 -12
  234. package/build-module/components/inserter/tabs.js.map +1 -1
  235. package/build-module/components/inspector-controls/block-support-slot-container.js +13 -2
  236. package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
  237. package/build-module/components/inspector-controls/fill.js +25 -14
  238. package/build-module/components/inspector-controls/fill.js.map +1 -1
  239. package/build-module/components/inspector-controls/groups.js +5 -3
  240. package/build-module/components/inspector-controls/groups.js.map +1 -1
  241. package/build-module/components/inspector-controls/slot.js +15 -1
  242. package/build-module/components/inspector-controls/slot.js.map +1 -1
  243. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  244. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  245. package/build-module/components/link-control/index.js +12 -2
  246. package/build-module/components/link-control/index.js.map +1 -1
  247. package/build-module/components/list-view/block-select-button.js +1 -3
  248. package/build-module/components/list-view/block-select-button.js.map +1 -1
  249. package/build-module/components/list-view/block.js +13 -1
  250. package/build-module/components/list-view/block.js.map +1 -1
  251. package/build-module/components/list-view/use-block-selection.js +30 -25
  252. package/build-module/components/list-view/use-block-selection.js.map +1 -1
  253. package/build-module/components/media-placeholder/index.js +2 -2
  254. package/build-module/components/media-placeholder/index.js.map +1 -1
  255. package/build-module/components/media-placeholder/index.native.js +7 -7
  256. package/build-module/components/media-placeholder/index.native.js.map +1 -1
  257. package/build-module/components/media-replace-flow/index.js +2 -3
  258. package/build-module/components/media-replace-flow/index.js.map +1 -1
  259. package/build-module/components/media-upload/constants.js +14 -0
  260. package/build-module/components/media-upload/constants.js.map +1 -0
  261. package/build-module/components/media-upload/index.native.js +53 -34
  262. package/build-module/components/media-upload/index.native.js.map +1 -1
  263. package/build-module/components/preview-options/index.js +1 -1
  264. package/build-module/components/preview-options/index.js.map +1 -1
  265. package/build-module/components/rich-text/index.js +35 -37
  266. package/build-module/components/rich-text/index.js.map +1 -1
  267. package/build-module/components/rich-text/index.native.js +15 -33
  268. package/build-module/components/rich-text/index.native.js.map +1 -1
  269. package/build-module/components/rich-text/multiline.js +87 -0
  270. package/build-module/components/rich-text/multiline.js.map +1 -0
  271. package/build-module/components/rich-text/split-value.js +10 -16
  272. package/build-module/components/rich-text/split-value.js.map +1 -1
  273. package/build-module/components/rich-text/use-enter.js +33 -42
  274. package/build-module/components/rich-text/use-enter.js.map +1 -1
  275. package/build-module/components/rich-text/use-paste-handler.js +19 -34
  276. package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
  277. package/build-module/components/spacing-sizes-control/utils.js +2 -2
  278. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  279. package/build-module/components/use-block-commands/index.js +28 -16
  280. package/build-module/components/use-block-commands/index.js.map +1 -1
  281. package/build-module/components/use-block-display-information/index.js +5 -2
  282. package/build-module/components/use-block-display-information/index.js.map +1 -1
  283. package/build-module/hooks/background.js +244 -0
  284. package/build-module/hooks/background.js.map +1 -0
  285. package/build-module/hooks/block-hooks.js +181 -0
  286. package/build-module/hooks/block-hooks.js.map +1 -0
  287. package/build-module/hooks/block-rename-ui.js +153 -0
  288. package/build-module/hooks/block-rename-ui.js.map +1 -0
  289. package/build-module/hooks/duotone.js +26 -39
  290. package/build-module/hooks/duotone.js.map +1 -1
  291. package/build-module/hooks/index.js +2 -2
  292. package/build-module/hooks/index.js.map +1 -1
  293. package/build-module/hooks/layout.js +33 -16
  294. package/build-module/hooks/layout.js.map +1 -1
  295. package/build-module/hooks/position.js +4 -2
  296. package/build-module/hooks/position.js.map +1 -1
  297. package/build-module/hooks/style.js +10 -3
  298. package/build-module/hooks/style.js.map +1 -1
  299. package/build-module/private-apis.js +2 -0
  300. package/build-module/private-apis.js.map +1 -1
  301. package/build-module/store/actions.js +33 -10
  302. package/build-module/store/actions.js.map +1 -1
  303. package/build-module/store/private-actions.js +39 -8
  304. package/build-module/store/private-actions.js.map +1 -1
  305. package/build-module/store/private-selectors.js +21 -0
  306. package/build-module/store/private-selectors.js.map +1 -1
  307. package/build-module/store/reducer.js +41 -1
  308. package/build-module/store/reducer.js.map +1 -1
  309. package/build-module/store/selectors.js +78 -22
  310. package/build-module/store/selectors.js.map +1 -1
  311. package/build-module/store/utils.js +0 -4
  312. package/build-module/store/utils.js.map +1 -1
  313. package/build-style/content-rtl.css +0 -1
  314. package/build-style/content.css +0 -1
  315. package/build-style/style-rtl.css +170 -127
  316. package/build-style/style.css +170 -127
  317. package/package.json +32 -32
  318. package/src/components/block-canvas/index.js +108 -0
  319. package/src/components/block-inspector/index.js +5 -1
  320. package/src/components/block-list/content.scss +0 -1
  321. package/src/components/block-patterns-list/index.js +32 -7
  322. package/src/components/block-patterns-list/style.scss +26 -9
  323. package/src/components/block-patterns-paging/index.js +92 -0
  324. package/src/components/block-patterns-paging/style.scss +42 -0
  325. package/src/components/block-settings-menu/block-settings-dropdown.js +44 -0
  326. package/src/components/block-settings-menu-controls/index.js +4 -9
  327. package/src/components/block-styles/index.js +1 -0
  328. package/src/components/block-styles/style.scss +3 -3
  329. package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -6
  330. package/src/components/block-tools/block-contextual-toolbar.js +16 -5
  331. package/src/components/block-tools/block-selection-button.js +9 -1
  332. package/src/components/block-tools/style.scss +0 -98
  333. package/src/components/border-radius-control/input-controls.js +1 -1
  334. package/src/components/border-radius-control/linked-button.js +8 -11
  335. package/src/components/color-palette/test/__snapshots__/control.js.snap +34 -21
  336. package/src/components/colors/with-colors.js +3 -2
  337. package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +8 -35
  338. package/src/components/default-block-appender/index.native.js +26 -3
  339. package/src/components/duotone/utils.js +65 -0
  340. package/src/components/editor-styles/index.js +32 -23
  341. package/src/components/global-styles/hooks.js +4 -112
  342. package/src/components/global-styles/image-settings-panel.js +71 -0
  343. package/src/components/global-styles/index.js +4 -3
  344. package/src/components/global-styles/use-global-styles-output.js +25 -16
  345. package/src/components/global-styles/utils.js +1 -2
  346. package/src/components/iframe/index.js +72 -33
  347. package/src/components/image-editor/use-save-image.js +2 -9
  348. package/src/components/image-editor/use-transform-image.js +9 -9
  349. package/src/components/index.js +1 -1
  350. package/src/components/index.native.js +2 -2
  351. package/src/components/inner-blocks/use-nested-settings-update.js +15 -10
  352. package/src/components/inserter/block-patterns-explorer/explorer.js +17 -5
  353. package/src/components/inserter/block-patterns-explorer/patterns-list.js +109 -40
  354. package/src/components/inserter/block-patterns-explorer/sidebar.js +23 -8
  355. package/src/components/inserter/block-patterns-source-filter.js +40 -0
  356. package/src/components/inserter/block-patterns-sync-filter.js +35 -0
  357. package/src/components/inserter/block-patterns-tab.js +168 -57
  358. package/src/components/inserter/hooks/use-patterns-paging.js +65 -0
  359. package/src/components/inserter/hooks/use-patterns-state.js +27 -16
  360. package/src/components/inserter/menu.js +15 -17
  361. package/src/components/inserter/search-results.js +6 -4
  362. package/src/components/inserter/style.scss +23 -2
  363. package/src/components/inserter/tabs.js +2 -12
  364. package/src/components/inserter/test/index.native.js +8 -12
  365. package/src/components/inspector-controls/block-support-slot-container.js +19 -3
  366. package/src/components/inspector-controls/fill.js +28 -14
  367. package/src/components/inspector-controls/groups.js +6 -2
  368. package/src/components/inspector-controls/slot.js +28 -3
  369. package/src/components/inspector-controls-tabs/styles-tab.js +4 -0
  370. package/src/components/link-control/index.js +13 -0
  371. package/src/components/link-control/style.scss +23 -2
  372. package/src/components/link-control/test/index.js +88 -6
  373. package/src/components/list-view/block-select-button.js +1 -3
  374. package/src/components/list-view/block.js +19 -1
  375. package/src/components/list-view/style.scss +1 -2
  376. package/src/components/list-view/use-block-selection.js +38 -32
  377. package/src/components/media-placeholder/README.md +2 -2
  378. package/src/components/media-placeholder/index.js +2 -2
  379. package/src/components/media-placeholder/index.native.js +11 -12
  380. package/src/components/media-replace-flow/index.js +2 -2
  381. package/src/components/media-replace-flow/test/index.js +5 -23
  382. package/src/components/media-upload/README.md +3 -2
  383. package/src/components/media-upload/constants.js +15 -0
  384. package/src/components/media-upload/index.native.js +66 -40
  385. package/src/components/media-upload/style.native.scss +4 -0
  386. package/src/components/media-upload/test/index.native.js +2 -2
  387. package/src/components/preview-options/README.md +7 -0
  388. package/src/components/preview-options/index.js +1 -1
  389. package/src/components/rich-text/index.js +48 -44
  390. package/src/components/rich-text/index.native.js +14 -42
  391. package/src/components/rich-text/multiline.js +121 -0
  392. package/src/components/rich-text/split-value.js +10 -35
  393. package/src/components/rich-text/use-enter.js +32 -42
  394. package/src/components/rich-text/use-paste-handler.js +16 -40
  395. package/src/components/spacing-sizes-control/style.scss +5 -7
  396. package/src/components/spacing-sizes-control/utils.js +1 -2
  397. package/src/components/use-block-commands/index.js +28 -20
  398. package/src/components/use-block-display-information/index.js +3 -0
  399. package/src/hooks/background.js +288 -0
  400. package/src/hooks/background.scss +57 -0
  401. package/src/hooks/block-hooks.js +257 -0
  402. package/src/hooks/block-hooks.scss +16 -0
  403. package/src/hooks/block-rename-ui.js +230 -0
  404. package/src/hooks/block-rename-ui.scss +3 -0
  405. package/src/hooks/duotone.js +42 -43
  406. package/src/hooks/index.js +2 -2
  407. package/src/hooks/layout.js +31 -33
  408. package/src/hooks/position.js +4 -3
  409. package/src/hooks/style.js +11 -2
  410. package/src/hooks/test/align.native.js +4 -3
  411. package/src/private-apis.js +2 -0
  412. package/src/store/actions.js +52 -10
  413. package/src/store/private-actions.js +37 -6
  414. package/src/store/private-selectors.js +21 -0
  415. package/src/store/reducer.js +38 -0
  416. package/src/store/selectors.js +107 -26
  417. package/src/store/test/actions.js +19 -8
  418. package/src/store/test/private-actions.js +17 -0
  419. package/src/store/test/reducer.js +25 -0
  420. package/src/store/test/selectors.js +130 -123
  421. package/src/store/utils.js +3 -10
  422. package/src/style.scss +4 -0
  423. package/build/components/duotone/components.js +0 -135
  424. package/build/components/duotone/components.js.map +0 -1
  425. package/build/components/duotone/index.js +0 -38
  426. package/build/components/duotone/index.js.map +0 -1
  427. package/build/components/global-styles/behaviors-panel.js +0 -64
  428. package/build/components/global-styles/behaviors-panel.js.map +0 -1
  429. package/build/components/inserter/reusable-blocks-tab.js +0 -85
  430. package/build/components/inserter/reusable-blocks-tab.js.map +0 -1
  431. package/build/hooks/auto-inserting-blocks.js +0 -174
  432. package/build/hooks/auto-inserting-blocks.js.map +0 -1
  433. package/build/hooks/behaviors.js +0 -173
  434. package/build/hooks/behaviors.js.map +0 -1
  435. package/build-module/components/duotone/components.js +0 -126
  436. package/build-module/components/duotone/components.js.map +0 -1
  437. package/build-module/components/duotone/index.js +0 -3
  438. package/build-module/components/duotone/index.js.map +0 -1
  439. package/build-module/components/global-styles/behaviors-panel.js +0 -57
  440. package/build-module/components/global-styles/behaviors-panel.js.map +0 -1
  441. package/build-module/components/inserter/reusable-blocks-tab.js +0 -76
  442. package/build-module/components/inserter/reusable-blocks-tab.js.map +0 -1
  443. package/build-module/hooks/auto-inserting-blocks.js +0 -167
  444. package/build-module/hooks/auto-inserting-blocks.js.map +0 -1
  445. package/build-module/hooks/behaviors.js +0 -166
  446. package/build-module/hooks/behaviors.js.map +0 -1
  447. package/src/components/duotone/components.js +0 -133
  448. package/src/components/duotone/index.js +0 -7
  449. package/src/components/global-styles/behaviors-panel.js +0 -71
  450. package/src/components/inserter/reusable-blocks-tab.js +0 -84
  451. package/src/components/inserter/test/reusable-blocks-tab.js +0 -73
  452. package/src/hooks/auto-inserting-blocks.js +0 -232
  453. package/src/hooks/behaviors.js +0 -206
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_blocks","_components","_compose","_data","_hooks","_blockList","_useSetting","_inspectorControls","_useBlockDisplayInformation","_utils","_lockUnlock","_store","CustomSelectControl","unlock","componentsPrivateApis","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","__","className","STICKY_OPTION","_x","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","getBlockSupport","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","cleanEmptyObject","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","useSetting","allowSticky","isDisabled","PositionPanel","clientId","firstParentClientId","useSelect","select","getBlockParents","blockEditorStore","parents","length","blockInformation","useBlockDisplayInformation","stickyHelpText","sprintf","title","options","useMemo","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","Platform","web","createElement","default","group","BaseControl","__nextHasNoMarginBottom","help","__nextUnconstrainedWidth","__next36pxDefaultSize","label","hideLabelFromVision","describedBy","__experimentalShowSelectedHint","onChange","selectedItem","size","native","withInspectorControls","createHigherOrderComponent","BlockEdit","positionSupport","hasBlockSupport","showPositionControls","exports","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","useInstanceId","element","useContext","BlockList","__unstableElementContext","positionSelector","css","classnames","Fragment","createPortal","addFilter"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport useSetting from '../components/use-setting';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst allowFixed = useSetting( 'position.fixed' );\n\tconst allowSticky = useSetting( 'position.sticky' );\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {WPElement} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next36pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position 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 positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst showPositionControls =\n\t\t\tpositionSupport && ! useIsPositionDisabled( props );\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\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 position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! useIsPositionDisabled( props );\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\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'withPositionStyles'\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twith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,KAAK,EAAE3B,SAAS,EAAE;IAC/C,CAAG,gBAAgBiG,EAAI,EAAC,GAAID,mBAAmB,IAAI,CAAC,CAAEQ,GAAG;IAAE;IAC3D,CAAG,eAAe5E,UAAU,EAAEnB,KAAK,EAAEI,QAAQ,EAAEF,IAAM,EAAC,GACrDqF,mBAAmB,IACnB,CAAC,CAAEQ,GAAG,IACN,CAAC,CAAE5E,UAAU,EAAEnB,KAAK,EAAEI,QAAQ,EAAEF;EAClC,CAAE,CAAC;EAEH,OACC,IAAAtC,QAAA,CAAAiG,aAAA,EAAAjG,QAAA,CAAAqI,QAAA,QACGV,mBAAmB,IACpBG,OAAO,IACP,CAAC,CAAEK,GAAG,IACN,IAAAG,qBAAY,EAAE,IAAAtI,QAAA,CAAAiG,aAAA,iBAASkC,GAAY,CAAC,EAAEL,OAAQ,CAAC,EAChD,IAAA9H,QAAA,CAAAiG,aAAA,EAACwB,cAAc;IAAA,GAAMnE,KAAK;IAAG3B,SAAS,EAAGA;EAAW,CAAE,CACrD,CAAC;AAEL,CAAC,EACD,oBACD,CAAC;AAAC4F,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEF,IAAAe,gBAAS,EACR,uBAAuB,EACvB,2CAA2C,EAC3Cf,kBACD,CAAC;AACD,IAAAe,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CtB,qBACD,CAAC"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_i18n","_blocks","_components","_compose","_data","_hooks","_blockList","_useSetting","_inspectorControls","_useBlockDisplayInformation","_utils","_lockUnlock","_store","CustomSelectControl","unlock","componentsPrivateApis","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","__","className","STICKY_OPTION","_x","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","getBlockSupport","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","cleanEmptyObject","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","useSetting","allowSticky","isDisabled","PositionPanel","clientId","firstParentClientId","useSelect","select","getBlockParents","blockEditorStore","parents","length","blockInformation","useBlockDisplayInformation","stickyHelpText","sprintf","title","options","useMemo","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","Platform","web","createElement","default","group","BaseControl","__nextHasNoMarginBottom","help","__nextUnconstrainedWidth","__next36pxDefaultSize","label","hideLabelFromVision","describedBy","__experimentalShowSelectedHint","onChange","selectedItem","size","native","withInspectorControls","createHigherOrderComponent","BlockEdit","positionSupport","hasBlockSupport","isPositionDisabled","showPositionControls","exports","withPositionStyles","BlockListBlock","hasPositionBlockSupport","allowPositionStyles","id","useInstanceId","element","useContext","BlockList","__unstableElementContext","positionSelector","css","classnames","Fragment","createPortal","addFilter"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseContext,\n\tuseMemo,\n\tcreatePortal,\n\tPlatform,\n} from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport useSetting from '../components/use-setting';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst allowFixed = useSetting( 'position.fixed' );\n\tconst allowSticky = useSetting( 'position.sticky' );\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {WPElement} Position panel.\n */\nexport function PositionPanel( props ) {\n\tconst {\n\t\tattributes: { style = {} },\n\t\tclientId,\n\t\tname: blockName,\n\t\tsetAttributes,\n\t} = props;\n\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next36pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\n/**\n * Override the default edit UI to include position 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 positionSupport = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tconst showPositionControls = positionSupport && ! isPositionDisabled;\n\n\t\treturn [\n\t\t\tshowPositionControls && (\n\t\t\t\t<PositionPanel key=\"position\" { ...props } />\n\t\t\t),\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 position styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withPositionStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\t\tname,\n\t\t\tPOSITION_SUPPORT_KEY\n\t\t);\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tconst allowPositionStyles =\n\t\t\thasPositionBlockSupport && ! isPositionDisabled;\n\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\t// Higher specificity to override defaults in editor UI.\n\t\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t\t// Get CSS string for the current position values.\n\t\tlet css;\n\t\tif ( allowPositionStyles ) {\n\t\t\tcss =\n\t\t\t\tgetPositionCSS( {\n\t\t\t\t\tselector: positionSelector,\n\t\t\t\t\tstyle: attributes?.style,\n\t\t\t\t} ) || '';\n\t\t}\n\n\t\t// Attach a `wp-container-` id-based class name.\n\t\tconst className = classnames( props?.className, {\n\t\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t\t[ `is-position-${ attributes?.style?.position?.type }` ]:\n\t\t\t\tallowPositionStyles &&\n\t\t\t\t!! css &&\n\t\t\t\t!! attributes?.style?.position?.type,\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ allowPositionStyles &&\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'withPositionStyles'\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/position/with-position-styles',\n\twithPositionStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/position/with-inspector-controls',\n\twithInspectorControls\n);\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAAA,QAAA,GAAAC,OAAA;AAbA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAIA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAOA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,UAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,WAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,kBAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,2BAA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QAAA,CAAAiG,aAAA,iBAASmC,GAAY,CAAC,EAAEL,OAAQ,CAAC,EAChD,IAAA/H,QAAA,CAAAiG,aAAA,EAACyB,cAAc;IAAA,GAAMpE,KAAK;IAAG3B,SAAS,EAAGA;EAAW,CAAE,CACrD,CAAC;AAEL,CAAC,EACD,oBACD,CAAC;AAAC6F,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEF,IAAAe,gBAAS,EACR,uBAAuB,EACvB,2CAA2C,EAC3Cf,kBACD,CAAC;AACD,IAAAe,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CvB,qBACD,CAAC"}
@@ -16,6 +16,7 @@ var _blocks = require("@wordpress/blocks");
16
16
  var _compose = require("@wordpress/compose");
17
17
  var _styleEngine = require("@wordpress/style-engine");
18
18
  var _blockList = _interopRequireDefault(require("../components/block-list"));
19
+ var _background = require("./background");
19
20
  var _border = require("./border");
20
21
  var _color = require("./color");
21
22
  var _typography = require("./typography");
@@ -36,7 +37,7 @@ var _blockEditingMode = require("../components/block-editing-mode");
36
37
  * Internal dependencies
37
38
  */
38
39
 
39
- const styleSupportKeys = [..._typography.TYPOGRAPHY_SUPPORT_KEYS, _border.BORDER_SUPPORT_KEY, _color.COLOR_SUPPORT_KEY, _dimensions.DIMENSIONS_SUPPORT_KEY, _dimensions.SPACING_SUPPORT_KEY];
40
+ const styleSupportKeys = [..._typography.TYPOGRAPHY_SUPPORT_KEYS, _border.BORDER_SUPPORT_KEY, _color.COLOR_SUPPORT_KEY, _dimensions.DIMENSIONS_SUPPORT_KEY, _background.BACKGROUND_SUPPORT_KEY, _dimensions.SPACING_SUPPORT_KEY];
40
41
  const hasStyleSupport = nameOrType => styleSupportKeys.some(key => (0, _blocks.hasBlockSupport)(nameOrType, key));
41
42
 
42
43
  /**
@@ -108,7 +109,11 @@ const skipSerializationPathsEdit = {
108
109
  */
109
110
  const skipSerializationPathsSave = {
110
111
  ...skipSerializationPathsEdit,
111
- [`${_dimensions.SPACING_SUPPORT_KEY}`]: ['spacing.blockGap']
112
+ [`${_background.BACKGROUND_SUPPORT_KEY}`]: [_background.BACKGROUND_SUPPORT_KEY] // Skip serialization of background support in save mode.
113
+ };
114
+
115
+ const skipSerializationPathsSaveChecks = {
116
+ [`${_background.BACKGROUND_SUPPORT_KEY}`]: true
112
117
  };
113
118
 
114
119
  /**
@@ -259,7 +264,7 @@ function addSaveProps(props, blockType, attributes, skipPaths = skipSerializatio
259
264
  style
260
265
  } = attributes;
261
266
  Object.entries(skipPaths).forEach(([indicator, path]) => {
262
- const skipSerialization = (0, _blocks.getBlockSupport)(blockType, indicator);
267
+ const skipSerialization = skipSerializationPathsSaveChecks[indicator] || (0, _blocks.getBlockSupport)(blockType, indicator);
263
268
  if (skipSerialization === true) {
264
269
  style = omitStyle(style, path);
265
270
  }
@@ -319,6 +324,8 @@ const withBlockControls = (0, _compose.createHigherOrderComponent)(BlockEdit =>
319
324
  const blockEditingMode = (0, _blockEditingMode.useBlockEditingMode)();
320
325
  return (0, _element.createElement)(_element.Fragment, null, shouldDisplayControls && blockEditingMode === 'default' && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_color.ColorEdit, {
321
326
  ...props
327
+ }), (0, _element.createElement)(_background.BackgroundImagePanel, {
328
+ ...props
322
329
  }), (0, _element.createElement)(_typography.TypographyPanel, {
323
330
  ...props
324
331
  }), (0, _element.createElement)(_border.BorderPanel, {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_hooks","_blocks","_compose","_styleEngine","_blockList","_border","_color","_typography","_dimensions","_useDisplayBlockControls","_utils","_utils2","_blockEditingMode","styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","DIMENSIONS_SUPPORT_KEY","SPACING_SUPPORT_KEY","hasStyleSupport","nameOrType","some","key","hasBlockSupport","getInlineStyles","styles","output","getCSSRules","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","blockType","skipPaths","entries","indicator","skipSerialization","getBlockSupport","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","createHigherOrderComponent","BlockEdit","name","createElement","shouldDisplayControls","useDisplayBlockControls","blockEditingMode","useBlockEditingMode","Fragment","ColorEdit","TypographyPanel","BorderPanel","DimensionsPanel","exports","elementTypes","elementType","pseudo","elements","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","useInstanceId","baseElementSelector","blockElementStyles","useMemo","elementCSSRules","shouldSkipSerialization","elementStyles","selector","scopeSelector","ELEMENTS","push","compileCSS","pseudoSelector","element","join","undefined","useContext","BlockList","__unstableElementContext","createPortal","dangerouslySetInnerHTML","__html","className","classnames","addFilter"],"sources":["@wordpress/block-editor/src/hooks/style.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default 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 * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization = getBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tif ( ! hasStyleSupport( props.name ) ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\t\tconst blockEditingMode = useBlockEditingMode();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && blockEditingMode === 'default' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n// Defines which element types are supported, including their hover styles or\n// any other elements that have been included under a single element type\n// e.g. heading and h1-h6.\nconst elementTypes = [\n\t{ elementType: 'button' },\n\t{ elementType: 'link', pseudo: [ ':hover' ] },\n\t{\n\t\telementType: 'heading',\n\t\telements: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],\n\t},\n];\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t// styles to override element styles because of higher specificity.\n\t\tconst baseElementSelector = `.editor-styles-wrapper .${ blockElementsContainerIdentifier }`;\n\t\tconst blockElementStyles = props.attributes.style?.elements;\n\n\t\tconst styles = useMemo( () => {\n\t\t\tif ( ! blockElementStyles ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst elementCSSRules = [];\n\n\t\t\telementTypes.forEach( ( { elementType, pseudo, elements } ) => {\n\t\t\t\tconst skipSerialization = shouldSkipSerialization(\n\t\t\t\t\tprops.name,\n\t\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t\telementType\n\t\t\t\t);\n\n\t\t\t\tif ( skipSerialization ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst elementStyles = blockElementStyles?.[ elementType ];\n\n\t\t\t\t// Process primary element type styles.\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst selector = scopeSelector(\n\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\tELEMENTS[ elementType ]\n\t\t\t\t\t);\n\n\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\tcompileCSS( elementStyles, { selector } )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Process any interactive states for the element type.\n\t\t\t\t\tif ( pseudo ) {\n\t\t\t\t\t\tpseudo.forEach( ( pseudoSelector ) => {\n\t\t\t\t\t\t\tif ( elementStyles[ pseudoSelector ] ) {\n\t\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\t\tcompileCSS(\n\t\t\t\t\t\t\t\t\t\telementStyles[ pseudoSelector ],\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t`${ ELEMENTS[ elementType ] }${ pseudoSelector }`\n\t\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)\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// Process related elements e.g. h1-h6 for headings\n\t\t\t\tif ( elements ) {\n\t\t\t\t\telements.forEach( ( element ) => {\n\t\t\t\t\t\tif ( blockElementStyles[ element ] ) {\n\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\tcompileCSS( blockElementStyles[ element ], {\n\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\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\t\t\t} );\n\n\t\t\treturn elementCSSRules.length > 0\n\t\t\t\t? elementCSSRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [ baseElementSelector, blockElementStyles, props.name ] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withElementsStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"],"mappings":";;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAKA,IAAAW,WAAA,GAAAX,OAAA;AAKA,IAAAY,wBAAA,GAAAV,sBAAA,CAAAF,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,OAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AArCA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAmBA,MAAMgB,gBAAgB,GAAG,CACxB,GAAGC,mCAAuB,EAC1BC,0BAAkB,EAClBC,wBAAiB,EACjBC,kCAAsB,EACtBC,+BAAmB,CACnB;AAED,MAAMC,eAAe,GAAKC,UAAU,IACnCP,gBAAgB,CAACQ,IAAI,CAAIC,GAAG,IAAM,IAAAC,uBAAe,EAAEH,UAAU,EAAEE,GAAI,CAAE,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMuB,eAAe,GAAG;EAAEC,SAAS,EAAE;AAAW,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAAET,KAAK,EAAEU,KAAK,EAAEC,iBAAiB,GAAG,KAAK,EAAG;EACpE,IAAK,CAAEX,KAAK,EAAG;IACd,OAAOA,KAAK;EACb;EAEA,IAAIY,QAAQ,GAAGZ,KAAK;EACpB,IAAK,CAAEW,iBAAiB,EAAG;IAC1BC,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAAED,IAAI,CAACE,SAAS,CAAEf,KAAM,CAAE,CAAC;EACjD;EAEA,IAAK,CAAEgB,KAAK,CAACC,OAAO,CAAEP,KAAM,CAAC,EAAG;IAC/BA,KAAK,GAAG,CAAEA,KAAK,CAAE;EAClB;EAEAA,KAAK,CAAChB,OAAO,CAAIwB,IAAI,IAAM;IAC1B,IAAK,CAAEF,KAAK,CAACC,OAAO,CAAEC,IAAK,CAAC,EAAG;MAC9BA,IAAI,GAAGA,IAAI,CAACC,KAAK,CAAE,GAAI,CAAC;IACzB;IAEA,IAAKD,IAAI,CAACE,MAAM,GAAG,CAAC,EAAG;MACtB,MAAM,CAAEC,YAAY,EAAE,GAAGC,QAAQ,CAAE,GAAGJ,IAAI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AC;MACJ;IACD,CAAE,CAAC;IAEH,OAAOT,eAAe,CAAC1C,MAAM,GAAG,CAAC,GAC9B0C,eAAe,CAACU,IAAI,CAAE,EAAG,CAAC,GAC1BC,SAAS;EACb,CAAC,EAAE,CAAEd,mBAAmB,EAAEC,kBAAkB,EAAEpC,KAAK,CAACe,IAAI,CAAG,CAAC;EAE5D,MAAMgC,OAAO,GAAG,IAAAG,mBAAU,EAAEC,kBAAS,CAACC,wBAAyB,CAAC;EAEhE,OACC,IAAAlH,QAAA,CAAA8E,aAAA,EAAA9E,QAAA,CAAAmF,QAAA,QACGtD,MAAM,IACPgF,OAAO,IACP,IAAAM,qBAAY,EACX,IAAAnH,QAAA,CAAA8E,aAAA;IACCsC,uBAAuB,EAAG;MACzBC,MAAM,EAAExF;IACT;EAAG,CACH,CAAC,EACFgF,OACD,CAAC,EAEF,IAAA7G,QAAA,CAAA8E,aAAA,EAACgB,cAAc;IAAA,GACThC,KAAK;IACVwD,SAAS,EACRxD,KAAK,CAACzB,UAAU,CAACC,KAAK,EAAEsD,QAAQ,GAC7B,IAAA2B,mBAAU,EACVzD,KAAK,CAACwD,SAAS,EACfvB,gCACA,CAAC,GACDjC,KAAK,CAACwD;EACT,CACD,CACA,CAAC;AAEL,CAAC,EACD,oBACD,CAAC;AAED,IAAAE,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzBrF,YACD,CAAC;AAED,IAAAqF,gBAAS,EACR,kCAAkC,EAClC,yBAAyB,EACzB3D,YACD,CAAC;AAED,IAAA2D,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzBjD,YACD,CAAC;AAED,IAAAiD,gBAAS,EACR,kBAAkB,EAClB,gCAAgC,EAChC9C,iBACD,CAAC;AAED,IAAA8C,gBAAS,EACR,uBAAuB,EACvB,kCAAkC,EAClC3B,kBACD,CAAC"}
1
+ {"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_hooks","_blocks","_compose","_styleEngine","_blockList","_background","_border","_color","_typography","_dimensions","_useDisplayBlockControls","_utils","_utils2","_blockEditingMode","styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","DIMENSIONS_SUPPORT_KEY","BACKGROUND_SUPPORT_KEY","SPACING_SUPPORT_KEY","hasStyleSupport","nameOrType","some","key","hasBlockSupport","getInlineStyles","styles","output","getCSSRules","forEach","rule","value","addAttribute","settings","attributes","style","Object","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","skipSerializationPathsSaveChecks","renamedFeatures","gradients","omitStyle","paths","preserveReference","newStyle","JSON","parse","stringify","Array","isArray","path","split","length","firstSubpath","restPath","addSaveProps","props","blockType","skipPaths","entries","indicator","skipSerialization","getBlockSupport","featureName","feature","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","createHigherOrderComponent","BlockEdit","name","createElement","shouldDisplayControls","useDisplayBlockControls","blockEditingMode","useBlockEditingMode","Fragment","ColorEdit","BackgroundImagePanel","TypographyPanel","BorderPanel","DimensionsPanel","exports","elementTypes","elementType","pseudo","elements","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","useInstanceId","baseElementSelector","blockElementStyles","useMemo","elementCSSRules","shouldSkipSerialization","elementStyles","selector","scopeSelector","ELEMENTS","push","compileCSS","pseudoSelector","element","join","undefined","useContext","BlockList","__unstableElementContext","createPortal","dangerouslySetInnerHTML","__html","className","classnames","addFilter"],"sources":["@wordpress/block-editor/src/hooks/style.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules, compileCSS } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BACKGROUND_SUPPORT_KEY, BackgroundImagePanel } from './background';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport {\n\tDIMENSIONS_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n\tDimensionsPanel,\n} from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\nimport { shouldSkipSerialization } from './utils';\nimport { scopeSelector } from '../components/global-styles/utils';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tDIMENSIONS_SUPPORT_KEY,\n\tBACKGROUND_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst output = {};\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tgetCSSRules( styles ).forEach( ( rule ) => {\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default 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 * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ DIMENSIONS_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tDIMENSIONS_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tSPACING_SUPPORT_KEY,\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ BACKGROUND_SUPPORT_KEY }` ]: [ BACKGROUND_SUPPORT_KEY ], // Skip serialization of background support in save mode.\n};\n\nconst skipSerializationPathsSaveChecks = {\n\t[ `${ BACKGROUND_SUPPORT_KEY }` ]: true,\n};\n\n/**\n * A dictionary used to normalize feature names between support flags, style\n * object properties and __experimentSkipSerialization configuration arrays.\n *\n * This allows not having to provide a migration for a support flag and possible\n * backwards compatibility bridges, while still achieving consistency between\n * the support flag and the skip serialization array.\n *\n * @constant\n * @type {Record<string, string>}\n */\nconst renamedFeatures = { gradients: 'gradient' };\n\n/**\n * A utility function used to remove one or more paths from a style object.\n * Works in a way similar to Lodash's `omit()`. See unit tests and examples below.\n *\n * It supports a single string path:\n *\n * ```\n * omitStyle( { color: 'red' }, 'color' ); // {}\n * ```\n *\n * or an array of paths:\n *\n * ```\n * omitStyle( { color: 'red', background: '#fff' }, [ 'color', 'background' ] ); // {}\n * ```\n *\n * It also allows you to specify paths at multiple levels in a string.\n *\n * ```\n * omitStyle( { typography: { textDecoration: 'underline' } }, 'typography.textDecoration' ); // {}\n * ```\n *\n * You can remove multiple paths at the same time:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t'typography.textDecoration',\n * \t\t\t'typography.textTransform',\n *\t\t]\n * );\n * // {}\n * ```\n *\n * You can also specify nested paths as arrays:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\ttypography: {\n * \t\t\t\ttextDecoration: 'underline',\n * \t\t\t\ttextTransform: 'uppercase',\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'typography', 'textDecoration' ],\n * \t\t\t[ 'typography', 'textTransform' ],\n *\t\t]\n * );\n * // {}\n * ```\n *\n * With regards to nesting of styles, infinite depth is supported:\n *\n * ```\n * omitStyle(\n * \t\t{\n * \t\t\tborder: {\n * \t\t\t\tradius: {\n * \t\t\t\t\ttopLeft: '10px',\n * \t\t\t\t\ttopRight: '0.5rem',\n * \t\t\t\t}\n * \t\t\t}\n *\t\t},\n *\t\t[\n * \t\t\t[ 'border', 'radius', 'topRight' ],\n *\t\t]\n * );\n * // { border: { radius: { topLeft: '10px' } } }\n * ```\n *\n * The third argument, `preserveReference`, defines how to treat the input style object.\n * It is mostly necessary to properly handle mutation when recursively handling the style object.\n * Defaulting to `false`, this will always create a new object, avoiding to mutate `style`.\n * However, when recursing, we change that value to `true` in order to work with a single copy\n * of the original style object.\n *\n * @see https://lodash.com/docs/4.17.15#omit\n *\n * @param {Object} style Styles object.\n * @param {Array|string} paths Paths to remove.\n * @param {boolean} preserveReference True to mutate the `style` object, false otherwise.\n * @return {Object} Styles object with the specified paths removed.\n */\nexport function omitStyle( style, paths, preserveReference = false ) {\n\tif ( ! style ) {\n\t\treturn style;\n\t}\n\n\tlet newStyle = style;\n\tif ( ! preserveReference ) {\n\t\tnewStyle = JSON.parse( JSON.stringify( style ) );\n\t}\n\n\tif ( ! Array.isArray( paths ) ) {\n\t\tpaths = [ paths ];\n\t}\n\n\tpaths.forEach( ( path ) => {\n\t\tif ( ! Array.isArray( path ) ) {\n\t\t\tpath = path.split( '.' );\n\t\t}\n\n\t\tif ( path.length > 1 ) {\n\t\t\tconst [ firstSubpath, ...restPath ] = path;\n\t\t\tomitStyle( newStyle[ firstSubpath ], [ restPath ], true );\n\t\t} else if ( path.length === 1 ) {\n\t\t\tdelete newStyle[ path[ 0 ] ];\n\t\t}\n\t} );\n\n\treturn newStyle;\n}\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\tObject.entries( skipPaths ).forEach( ( [ indicator, path ] ) => {\n\t\tconst skipSerialization =\n\t\t\tskipSerializationPathsSaveChecks[ indicator ] ||\n\t\t\tgetBlockSupport( blockType, indicator );\n\n\t\tif ( skipSerialization === true ) {\n\t\t\tstyle = omitStyle( style, path );\n\t\t}\n\n\t\tif ( Array.isArray( skipSerialization ) ) {\n\t\t\tskipSerialization.forEach( ( featureName ) => {\n\t\t\t\tconst feature = renamedFeatures[ featureName ] || featureName;\n\t\t\t\tstyle = omitStyle( style, [ [ ...path, feature ] ] );\n\t\t\t} );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tif ( ! hasStyleSupport( props.name ) ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\t\tconst blockEditingMode = useBlockEditingMode();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && blockEditingMode === 'default' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<BackgroundImagePanel { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n// Defines which element types are supported, including their hover styles or\n// any other elements that have been included under a single element type\n// e.g. heading and h1-h6.\nconst elementTypes = [\n\t{ elementType: 'button' },\n\t{ elementType: 'link', pseudo: [ ':hover' ] },\n\t{\n\t\telementType: 'heading',\n\t\telements: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],\n\t},\n];\n\n/**\n * Override the default block element to include elements styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\n\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t// styles to override element styles because of higher specificity.\n\t\tconst baseElementSelector = `.editor-styles-wrapper .${ blockElementsContainerIdentifier }`;\n\t\tconst blockElementStyles = props.attributes.style?.elements;\n\n\t\tconst styles = useMemo( () => {\n\t\t\tif ( ! blockElementStyles ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst elementCSSRules = [];\n\n\t\t\telementTypes.forEach( ( { elementType, pseudo, elements } ) => {\n\t\t\t\tconst skipSerialization = shouldSkipSerialization(\n\t\t\t\t\tprops.name,\n\t\t\t\t\tCOLOR_SUPPORT_KEY,\n\t\t\t\t\telementType\n\t\t\t\t);\n\n\t\t\t\tif ( skipSerialization ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst elementStyles = blockElementStyles?.[ elementType ];\n\n\t\t\t\t// Process primary element type styles.\n\t\t\t\tif ( elementStyles ) {\n\t\t\t\t\tconst selector = scopeSelector(\n\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\tELEMENTS[ elementType ]\n\t\t\t\t\t);\n\n\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\tcompileCSS( elementStyles, { selector } )\n\t\t\t\t\t);\n\n\t\t\t\t\t// Process any interactive states for the element type.\n\t\t\t\t\tif ( pseudo ) {\n\t\t\t\t\t\tpseudo.forEach( ( pseudoSelector ) => {\n\t\t\t\t\t\t\tif ( elementStyles[ pseudoSelector ] ) {\n\t\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\t\tcompileCSS(\n\t\t\t\t\t\t\t\t\t\telementStyles[ pseudoSelector ],\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t`${ ELEMENTS[ elementType ] }${ pseudoSelector }`\n\t\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)\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// Process related elements e.g. h1-h6 for headings\n\t\t\t\tif ( elements ) {\n\t\t\t\t\telements.forEach( ( element ) => {\n\t\t\t\t\t\tif ( blockElementStyles[ element ] ) {\n\t\t\t\t\t\t\telementCSSRules.push(\n\t\t\t\t\t\t\t\tcompileCSS( blockElementStyles[ element ], {\n\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\tbaseElementSelector,\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\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\t\t\t} );\n\n\t\t\treturn elementCSSRules.length > 0\n\t\t\t\t? elementCSSRules.join( '' )\n\t\t\t\t: undefined;\n\t\t}, [ baseElementSelector, blockElementStyles, props.name ] );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ styles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\tprops.attributes.style?.elements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t},\n\t'withElementsStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"],"mappings":";;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AALA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAMA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,WAAA,GAAAR,O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E;MACP;IACD,CAAE,CAAC;EACJ;EAEA,OAAOL,QAAQ;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,0BAA0B,GAAG;EAClC,CAAG,GAAGxB,0BAAoB,kCAAiC,GAAI,CAAE,QAAQ,CAAE;EAC3E,CAAG,GAAGC,wBAAmB,kCAAiC,GAAI,CAC7DA,wBAAiB,CACjB;EACD,CAAG,GAAGwB,kCAAwB,kCAAiC,GAAI,CAClEA,kCAAsB,CACtB;EACD,CAAG,GAAGvB,kCAAwB,kCAAiC,GAAI,CAClEA,kCAAsB,CACtB;EACD,CAAG,GAAGE,+BAAqB,kCAAiC,GAAI,CAC/DA,+BAAmB;AAErB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMsB,0BAA0B,GAAG;EAClC,GAAGF,0BAA0B;EAC7B,CAAG,GAAGrB,kCAAwB,EAAC,GAAI,CAAEA,kCAAsB,CAAE,CAAE;AAChE,CAAC;;AAED,MAAMwB,gCAAgC,GAAG;EACxC,CAAG,GAAGxB,kCAAwB,EAAC,GAAI;AACpC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMyB,eAAe,GAAG;EAAEC,SAAS,EAAE;AAAW,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ACGvD,MAAM,IACPkF,OAAO,IACP,IAAAM,qBAAY,EACX,IAAAvH,QAAA,CAAAiF,aAAA;IACCuC,uBAAuB,EAAG;MACzBC,MAAM,EAAE1F;IACT;EAAG,CACH,CAAC,EACFkF,OACD,CAAC,EAEF,IAAAjH,QAAA,CAAAiF,aAAA,EAACiB,cAAc;IAAA,GACTjC,KAAK;IACVyD,SAAS,EACRzD,KAAK,CAAC1B,UAAU,CAACC,KAAK,EAAEwD,QAAQ,GAC7B,IAAA2B,mBAAU,EACV1D,KAAK,CAACyD,SAAS,EACfvB,gCACA,CAAC,GACDlC,KAAK,CAACyD;EACT,CACD,CACA,CAAC;AAEL,CAAC,EACD,oBACD,CAAC;AAED,IAAAE,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzBvF,YACD,CAAC;AAED,IAAAuF,gBAAS,EACR,kCAAkC,EAClC,yBAAyB,EACzB5D,YACD,CAAC;AAED,IAAA4D,gBAAS,EACR,0BAA0B,EAC1B,yBAAyB,EACzBlD,YACD,CAAC;AAED,IAAAkD,gBAAS,EACR,kBAAkB,EAClB,gCAAgC,EAChC/C,iBACD,CAAC;AAED,IAAA+C,gBAAS,EACR,uBAAuB,EACvB,kCAAkC,EAClC3B,kBACD,CAAC"}
@@ -24,6 +24,7 @@ var _dimensionsTool = _interopRequireDefault(require("./components/dimensions-to
24
24
  var _resolutionTool = _interopRequireDefault(require("./components/resolution-tool"));
25
25
  var _reusableBlockRenameHint = _interopRequireWildcard(require("./components/inserter/reusable-block-rename-hint"));
26
26
  var _formatEdit = require("./components/rich-text/format-edit");
27
+ var _blockCanvas = require("./components/block-canvas");
27
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
28
29
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
30
  /**
@@ -37,6 +38,7 @@ const privateApis = {};
37
38
  exports.privateApis = privateApis;
38
39
  (0, _lockUnlock.lock)(privateApis, {
39
40
  ...globalStyles,
41
+ ExperimentalBlockCanvas: _blockCanvas.ExperimentalBlockCanvas,
40
42
  ExperimentalBlockEditorProvider: _provider.ExperimentalBlockEditorProvider,
41
43
  getRichTextValues: _getRichTextValues.getRichTextValues,
42
44
  kebabCase: _object.kebabCase,
@@ -1 +1 @@
1
- {"version":3,"names":["globalStyles","_interopRequireWildcard","require","_provider","_lockUnlock","_getRichTextValues","_object","_resizableBoxPopover","_interopRequireDefault","_inserter","_listView","_blockInfoSlotFill","_useShouldContextualToolbarShow","_utils","_blockQuickNavigation","_layout","_blockRemovalWarningModal","_hooks","_dimensionsTool","_resolutionTool","_reusableBlockRenameHint","_formatEdit","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","privateApis","exports","lock","ExperimentalBlockEditorProvider","getRichTextValues","kebabCase","PrivateInserter","PrivateListView","ResizableBoxPopover","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles","DimensionsTool","ResolutionTool","ReusableBlocksRenameHint","useReusableBlocksRenameHint","usesContextKey"],"sources":["@wordpress/block-editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport { kebabCase } from './utils/object';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';\nimport { cleanEmptyObject } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport { useLayoutClasses, useLayoutStyles } from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport {\n\tdefault as ReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n} from './components/inserter/reusable-block-rename-hint';\nimport { usesContextKey } from './components/rich-text/format-edit';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockEditorProvider,\n\tgetRichTextValues,\n\tkebabCase,\n\tPrivateInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n\tusesContextKey,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA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A2B;EAC3BC,cAAc,EAAdA;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["globalStyles","_interopRequireWildcard","require","_provider","_lockUnlock","_getRichTextValues","_object","_resizableBoxPopover","_interopRequireDefault","_inserter","_listView","_blockInfoSlotFill","_useShouldContextualToolbarShow","_utils","_blockQuickNavigation","_layout","_blockRemovalWarningModal","_hooks","_dimensionsTool","_resolutionTool","_reusableBlockRenameHint","_formatEdit","_blockCanvas","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","privateApis","exports","lock","ExperimentalBlockCanvas","ExperimentalBlockEditorProvider","getRichTextValues","kebabCase","PrivateInserter","PrivateListView","ResizableBoxPopover","BlockInfo","useShouldContextualToolbarShow","cleanEmptyObject","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles","DimensionsTool","ResolutionTool","ReusableBlocksRenameHint","useReusableBlocksRenameHint","usesContextKey"],"sources":["@wordpress/block-editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport { kebabCase } from './utils/object';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useShouldContextualToolbarShow } from './utils/use-should-contextual-toolbar-show';\nimport { cleanEmptyObject } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport { useLayoutClasses, useLayoutStyles } from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport {\n\tdefault as ReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n} from './components/inserter/reusable-block-rename-hint';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport { ExperimentalBlockCanvas } from './components/block-canvas';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tExperimentalBlockEditorProvider,\n\tgetRichTextValues,\n\tkebabCase,\n\tPrivateInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseShouldContextualToolbarShow,\n\tcleanEmptyObject,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n\tusesContextKey,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAH,sBAAA,CAAAN,OAAA;AACA,IAAAU,+BAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,qBAAA,GAAAN,sBAAA,CAAAN,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,yBAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AACA,IAAAgB,eAAA,GAAAV,sBAAA,CAAAN,OAAA;AACA,IAAAiB,eAA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AAA,MAAA;AAzBpE;AACA;AACA;;AAyBA;AACA;AACA;AACO,MAAMW,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClB,GAAG7C,YAAY;EACfgD,uBAAuB,EAAvBA,oCAAuB;EACvBC,+BAA+B,EAA/BA,yCAA+B;EAC/BC,iBAAiB,EAAjBA,oCAAiB;EACjBC,SAAS,EAATA,iBAAS;EACTC,eAAe,EAAfA,iCAAe;EACfC,eAAe,EAAfA,yBAAe;EACfC,mBAAmB,EAAnBA,4BAAmB;EACnBC,SAAS,EAATA,0BAAS;EACTC,8BAA8B,EAA9BA,8DAA8B;EAC9BC,gBAAgB,EAAhBA,uBAAgB;EAChBC,oBAAoB,EAApBA,6BAAoB;EACpBC,WAAW,EAAXA,mBAAW;EACXC,wBAAwB,EAAxBA,kDAAwB;EACxBC,gBAAgB,EAAhBA,uBAAgB;EAChBC,eAAe,EAAfA,sBAAe;EACfC,cAAc,EAAdA,uBAAc;EACdC,cAAc,EAAdA,uBAAc;EACdC,wBAAwB,EAAxBA,gCAAwB;EACxBC,2BAA2B,EAA3BA,oDAA2B;EAC3BC,cAAc,EAAdA;AACD,CAAE,CAAC"}
@@ -401,7 +401,8 @@ function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
401
401
  */
402
402
  const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, meta) => ({
403
403
  select,
404
- dispatch
404
+ dispatch,
405
+ registry
405
406
  }) => {
406
407
  /* eslint-enable jsdoc/valid-types */
407
408
  clientIds = castArray(clientIds);
@@ -415,16 +416,22 @@ const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition = 0, me
415
416
  return;
416
417
  }
417
418
  }
418
- dispatch({
419
- type: 'REPLACE_BLOCKS',
420
- clientIds,
421
- blocks,
422
- time: Date.now(),
423
- indexToSelect,
424
- initialPosition,
425
- meta
419
+ // We're batching these two actions because an extra `undo/redo` step can
420
+ // be created, based on whether we insert a default block or not.
421
+ registry.batch(() => {
422
+ dispatch({
423
+ type: 'REPLACE_BLOCKS',
424
+ clientIds,
425
+ blocks,
426
+ time: Date.now(),
427
+ indexToSelect,
428
+ initialPosition,
429
+ meta
430
+ });
431
+ // To avoid a focus loss when removing the last block, assure there is
432
+ // always a default block if the last of the blocks have been removed.
433
+ dispatch.ensureDefaultBlock();
426
434
  });
427
- dispatch.ensureDefaultBlock();
428
435
  };
429
436
 
430
437
  /**
@@ -937,6 +944,22 @@ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => ({
937
944
  dispatch.insertBlocks(blockWithSameType.innerBlocks, undefined, clientIdA);
938
945
  dispatch.removeBlock(clientIdB);
939
946
  dispatch.selectBlock(blockWithSameType.innerBlocks[0].clientId);
947
+
948
+ // Attempt to merge the next block if it's the same type and
949
+ // same attributes. This is useful when merging a paragraph into
950
+ // a list, and the next block is also a list. If we don't merge,
951
+ // it looks like one list, but it's actually two lists. The same
952
+ // applies to other blocks such as a group with the same
953
+ // attributes.
954
+ const nextBlockClientId = select.getNextBlockClientId(clientIdA);
955
+ if (nextBlockClientId && select.getBlockName(clientIdA) === select.getBlockName(nextBlockClientId)) {
956
+ const rootAttributes = select.getBlockAttributes(clientIdA);
957
+ const previousRootAttributes = select.getBlockAttributes(nextBlockClientId);
958
+ if (Object.keys(rootAttributes).every(key => rootAttributes[key] === previousRootAttributes[key])) {
959
+ dispatch.moveBlocksToPosition(select.getBlockOrder(nextBlockClientId), nextBlockClientId, clientIdA);
960
+ dispatch.removeBlock(nextBlockClientId, false);
961
+ }
962
+ }
940
963
  });
941
964
  return;
942
965
  }