@wordpress/block-editor 15.22.1-next.v.202606191442.0 → 15.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +2 -2
  3. package/build/components/block-editing-mode/index.cjs +13 -7
  4. package/build/components/block-editing-mode/index.cjs.map +2 -2
  5. package/build/components/block-inspector/index.cjs +32 -16
  6. package/build/components/block-inspector/index.cjs.map +2 -2
  7. package/build/components/block-rename/modal.cjs +0 -1
  8. package/build/components/block-rename/modal.cjs.map +2 -2
  9. package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
  10. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  11. package/build/components/colors-gradients/control.cjs +25 -14
  12. package/build/components/colors-gradients/control.cjs.map +2 -2
  13. package/build/components/colors-gradients/dropdown.cjs +4 -1
  14. package/build/components/colors-gradients/dropdown.cjs.map +3 -3
  15. package/build/components/contrast-checker/index.cjs +22 -4
  16. package/build/components/contrast-checker/index.cjs.map +2 -2
  17. package/build/components/date-format-picker/index.cjs +0 -1
  18. package/build/components/date-format-picker/index.cjs.map +2 -2
  19. package/build/components/global-styles/background-panel.cjs +153 -25
  20. package/build/components/global-styles/background-panel.cjs.map +3 -3
  21. package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
  22. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
  23. package/build/components/global-styles/color-panel.cjs +98 -375
  24. package/build/components/global-styles/color-panel.cjs.map +3 -3
  25. package/build/components/global-styles/dimensions-panel.cjs +0 -3
  26. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  27. package/build/components/global-styles/hooks.cjs +34 -0
  28. package/build/components/global-styles/hooks.cjs.map +2 -2
  29. package/build/components/global-styles/typography-panel.cjs +82 -10
  30. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  31. package/build/components/inspector-controls/groups.cjs +2 -0
  32. package/build/components/inspector-controls/groups.cjs.map +2 -2
  33. package/build/components/inspector-controls-tabs/styles-tab.cjs +75 -31
  34. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  35. package/build/components/link-control/index.cjs +1 -2
  36. package/build/components/link-control/index.cjs.map +2 -2
  37. package/build/components/list-view/block-select-button.cjs +1 -10
  38. package/build/components/list-view/block-select-button.cjs.map +3 -3
  39. package/build/components/provider/use-block-sync.cjs +3 -1
  40. package/build/components/provider/use-block-sync.cjs.map +2 -2
  41. package/build/components/url-popover/image-url-input-ui.cjs +0 -2
  42. package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
  43. package/build/components/use-block-display-information/index.cjs +10 -3
  44. package/build/components/use-block-display-information/index.cjs.map +2 -2
  45. package/build/hooks/anchor.cjs +0 -1
  46. package/build/hooks/anchor.cjs.map +2 -2
  47. package/build/hooks/background.cjs +124 -75
  48. package/build/hooks/background.cjs.map +3 -3
  49. package/build/hooks/color.cjs +0 -162
  50. package/build/hooks/color.cjs.map +3 -3
  51. package/build/hooks/contrast-checker.cjs +31 -28
  52. package/build/hooks/contrast-checker.cjs.map +3 -3
  53. package/build/hooks/custom-class-name.cjs +0 -1
  54. package/build/hooks/custom-class-name.cjs.map +2 -2
  55. package/build/hooks/elements.cjs +142 -0
  56. package/build/hooks/elements.cjs.map +7 -0
  57. package/build/hooks/grid-visualizer.cjs +21 -11
  58. package/build/hooks/grid-visualizer.cjs.map +2 -2
  59. package/build/hooks/layout-child.cjs +38 -8
  60. package/build/hooks/layout-child.cjs.map +2 -2
  61. package/build/hooks/layout.cjs +6 -3
  62. package/build/hooks/layout.cjs.map +2 -2
  63. package/build/hooks/states.cjs +2 -2
  64. package/build/hooks/states.cjs.map +2 -2
  65. package/build/hooks/style.cjs +8 -4
  66. package/build/hooks/style.cjs.map +2 -2
  67. package/build/hooks/typography.cjs +62 -10
  68. package/build/hooks/typography.cjs.map +3 -3
  69. package/build/layouts/flex.cjs +99 -6
  70. package/build/layouts/flex.cjs.map +2 -2
  71. package/build/utils/block-bindings.cjs +9 -9
  72. package/build/utils/block-bindings.cjs.map +3 -3
  73. package/build/utils/color-values.cjs +10 -1
  74. package/build/utils/color-values.cjs.map +3 -3
  75. package/build/utils/dom.cjs +2 -5
  76. package/build/utils/dom.cjs.map +3 -3
  77. package/build/utils/fit-text-frontend.cjs +6 -2
  78. package/build/utils/fit-text-frontend.cjs.map +3 -3
  79. package/build/utils/fit-text-utils.cjs +1 -1
  80. package/build/utils/fit-text-utils.cjs.map +3 -3
  81. package/build/utils/format-font-style.cjs +1 -1
  82. package/build/utils/format-font-style.cjs.map +3 -3
  83. package/build/utils/format-font-weight.cjs +1 -1
  84. package/build/utils/format-font-weight.cjs.map +3 -3
  85. package/build/utils/get-editor-region.cjs +4 -2
  86. package/build/utils/get-editor-region.cjs.map +3 -3
  87. package/build/utils/get-font-styles-and-weights.cjs +8 -12
  88. package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
  89. package/build/utils/get-px-from-css-unit.cjs +1 -1
  90. package/build/utils/get-px-from-css-unit.cjs.map +1 -1
  91. package/build/utils/index.cjs +1 -1
  92. package/build/utils/index.cjs.map +1 -1
  93. package/build/utils/math.cjs +1 -1
  94. package/build/utils/math.cjs.map +3 -3
  95. package/build/utils/object.cjs +8 -8
  96. package/build/utils/object.cjs.map +3 -3
  97. package/build/utils/order-inserter-block-items.cjs +1 -1
  98. package/build/utils/order-inserter-block-items.cjs.map +3 -3
  99. package/build/utils/pasting.cjs +4 -2
  100. package/build/utils/pasting.cjs.map +3 -3
  101. package/build/utils/selection.cjs +2 -1
  102. package/build/utils/selection.cjs.map +3 -3
  103. package/build/utils/sorting.cjs +9 -3
  104. package/build/utils/sorting.cjs.map +3 -3
  105. package/build/utils/transform-styles/index.cjs +3 -2
  106. package/build/utils/transform-styles/index.cjs.map +3 -3
  107. package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
  108. package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
  109. package/build/utils/transform-styles/types.cjs +19 -0
  110. package/build/utils/transform-styles/types.cjs.map +7 -0
  111. package/build/utils/types.cjs +19 -0
  112. package/build/utils/types.cjs.map +7 -0
  113. package/build-module/components/block-editing-mode/index.mjs +14 -8
  114. package/build-module/components/block-editing-mode/index.mjs.map +2 -2
  115. package/build-module/components/block-inspector/index.mjs +32 -16
  116. package/build-module/components/block-inspector/index.mjs.map +2 -2
  117. package/build-module/components/block-rename/modal.mjs +0 -1
  118. package/build-module/components/block-rename/modal.mjs.map +2 -2
  119. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
  120. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  121. package/build-module/components/colors-gradients/control.mjs +27 -15
  122. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  123. package/build-module/components/colors-gradients/dropdown.mjs +4 -1
  124. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  125. package/build-module/components/contrast-checker/index.mjs +18 -4
  126. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  127. package/build-module/components/date-format-picker/index.mjs +0 -1
  128. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  129. package/build-module/components/global-styles/background-panel.mjs +155 -27
  130. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  131. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
  132. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
  133. package/build-module/components/global-styles/color-panel.mjs +106 -387
  134. package/build-module/components/global-styles/color-panel.mjs.map +3 -3
  135. package/build-module/components/global-styles/dimensions-panel.mjs +0 -3
  136. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  137. package/build-module/components/global-styles/hooks.mjs +33 -0
  138. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  139. package/build-module/components/global-styles/typography-panel.mjs +84 -10
  140. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  141. package/build-module/components/inspector-controls/groups.mjs +2 -0
  142. package/build-module/components/inspector-controls/groups.mjs.map +2 -2
  143. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +75 -31
  144. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  145. package/build-module/components/link-control/index.mjs +1 -2
  146. package/build-module/components/link-control/index.mjs.map +2 -2
  147. package/build-module/components/list-view/block-select-button.mjs +2 -17
  148. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  149. package/build-module/components/provider/use-block-sync.mjs +3 -1
  150. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  151. package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
  152. package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
  153. package/build-module/components/use-block-display-information/index.mjs +10 -3
  154. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  155. package/build-module/hooks/anchor.mjs +0 -1
  156. package/build-module/hooks/anchor.mjs.map +2 -2
  157. package/build-module/hooks/background.mjs +123 -75
  158. package/build-module/hooks/background.mjs.map +2 -2
  159. package/build-module/hooks/color.mjs +2 -175
  160. package/build-module/hooks/color.mjs.map +2 -2
  161. package/build-module/hooks/contrast-checker.mjs +32 -19
  162. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  163. package/build-module/hooks/custom-class-name.mjs +0 -1
  164. package/build-module/hooks/custom-class-name.mjs.map +2 -2
  165. package/build-module/hooks/elements.mjs +115 -0
  166. package/build-module/hooks/elements.mjs.map +7 -0
  167. package/build-module/hooks/grid-visualizer.mjs +21 -11
  168. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  169. package/build-module/hooks/layout-child.mjs +41 -8
  170. package/build-module/hooks/layout-child.mjs.map +2 -2
  171. package/build-module/hooks/layout.mjs +6 -3
  172. package/build-module/hooks/layout.mjs.map +2 -2
  173. package/build-module/hooks/states.mjs +2 -2
  174. package/build-module/hooks/states.mjs.map +2 -2
  175. package/build-module/hooks/style.mjs +9 -5
  176. package/build-module/hooks/style.mjs.map +2 -2
  177. package/build-module/hooks/typography.mjs +62 -10
  178. package/build-module/hooks/typography.mjs.map +2 -2
  179. package/build-module/layouts/flex.mjs +105 -7
  180. package/build-module/layouts/flex.mjs.map +2 -2
  181. package/build-module/utils/block-bindings.mjs +9 -9
  182. package/build-module/utils/block-bindings.mjs.map +3 -3
  183. package/build-module/utils/color-values.mjs +9 -1
  184. package/build-module/utils/color-values.mjs.map +3 -3
  185. package/build-module/utils/dom.mjs +2 -5
  186. package/build-module/utils/dom.mjs.map +3 -3
  187. package/build-module/utils/fit-text-frontend.mjs +6 -2
  188. package/build-module/utils/fit-text-frontend.mjs.map +3 -3
  189. package/build-module/utils/fit-text-utils.mjs +1 -1
  190. package/build-module/utils/fit-text-utils.mjs.map +3 -3
  191. package/build-module/utils/format-font-style.mjs +1 -1
  192. package/build-module/utils/format-font-style.mjs.map +3 -3
  193. package/build-module/utils/format-font-weight.mjs +1 -1
  194. package/build-module/utils/format-font-weight.mjs.map +3 -3
  195. package/build-module/utils/get-editor-region.mjs +4 -2
  196. package/build-module/utils/get-editor-region.mjs.map +3 -3
  197. package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
  198. package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
  199. package/build-module/utils/get-px-from-css-unit.mjs +1 -1
  200. package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
  201. package/build-module/utils/index.mjs +1 -1
  202. package/build-module/utils/index.mjs.map +1 -1
  203. package/build-module/utils/math.mjs +1 -1
  204. package/build-module/utils/math.mjs.map +3 -3
  205. package/build-module/utils/object.mjs +8 -8
  206. package/build-module/utils/object.mjs.map +3 -3
  207. package/build-module/utils/order-inserter-block-items.mjs +1 -1
  208. package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
  209. package/build-module/utils/pasting.mjs +4 -2
  210. package/build-module/utils/pasting.mjs.map +3 -3
  211. package/build-module/utils/selection.mjs +2 -1
  212. package/build-module/utils/selection.mjs.map +3 -3
  213. package/build-module/utils/sorting.mjs +9 -3
  214. package/build-module/utils/sorting.mjs.map +3 -3
  215. package/build-module/utils/transform-styles/index.mjs +3 -2
  216. package/build-module/utils/transform-styles/index.mjs.map +3 -3
  217. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
  218. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
  219. package/build-module/utils/transform-styles/types.mjs +1 -0
  220. package/build-module/utils/transform-styles/types.mjs.map +7 -0
  221. package/build-module/utils/types.mjs +1 -0
  222. package/build-module/utils/types.mjs.map +7 -0
  223. package/build-style/content-rtl.css +2 -0
  224. package/build-style/content.css +2 -0
  225. package/build-style/style-rtl.css +34 -41
  226. package/build-style/style.css +34 -41
  227. package/build-types/utils/block-bindings.d.ts +27 -0
  228. package/build-types/utils/block-bindings.d.ts.map +1 -0
  229. package/build-types/utils/color-values.d.ts +40 -0
  230. package/build-types/utils/color-values.d.ts.map +1 -0
  231. package/build-types/utils/dom.d.ts +19 -19
  232. package/build-types/utils/dom.d.ts.map +1 -1
  233. package/build-types/utils/fit-text-frontend.d.ts +7 -0
  234. package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
  235. package/build-types/utils/fit-text-utils.d.ts +15 -0
  236. package/build-types/utils/fit-text-utils.d.ts.map +1 -0
  237. package/build-types/utils/format-font-style.d.ts +12 -0
  238. package/build-types/utils/format-font-style.d.ts.map +1 -0
  239. package/build-types/utils/format-font-weight.d.ts +12 -0
  240. package/build-types/utils/format-font-weight.d.ts.map +1 -0
  241. package/build-types/utils/get-editor-region.d.ts +9 -0
  242. package/build-types/utils/get-editor-region.d.ts.map +1 -0
  243. package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
  244. package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
  245. package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
  246. package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
  247. package/build-types/utils/index.d.ts +3 -0
  248. package/build-types/utils/index.d.ts.map +1 -0
  249. package/build-types/utils/math.d.ts +61 -0
  250. package/build-types/utils/math.d.ts.map +1 -0
  251. package/build-types/utils/object.d.ts +39 -0
  252. package/build-types/utils/object.d.ts.map +1 -0
  253. package/build-types/utils/order-inserter-block-items.d.ts +13 -0
  254. package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
  255. package/build-types/utils/pasting.d.ts +28 -0
  256. package/build-types/utils/pasting.d.ts.map +1 -0
  257. package/build-types/utils/selection.d.ts +21 -0
  258. package/build-types/utils/selection.d.ts.map +1 -0
  259. package/build-types/utils/sorting.d.ts +17 -0
  260. package/build-types/utils/sorting.d.ts.map +1 -0
  261. package/build-types/utils/transform-styles/index.d.ts +15 -0
  262. package/build-types/utils/transform-styles/index.d.ts.map +1 -0
  263. package/build-types/utils/transform-styles/types.d.ts +13 -0
  264. package/build-types/utils/transform-styles/types.d.ts.map +1 -0
  265. package/build-types/utils/types.d.ts +28 -0
  266. package/build-types/utils/types.d.ts.map +1 -0
  267. package/package.json +40 -39
  268. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
  269. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
  270. package/src/components/block-editing-mode/index.js +17 -9
  271. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
  272. package/src/components/block-inspector/index.js +20 -10
  273. package/src/components/block-rename/modal.js +0 -1
  274. package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
  275. package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
  276. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
  277. package/src/components/colors-gradients/control.js +29 -12
  278. package/src/components/colors-gradients/dropdown.js +4 -1
  279. package/src/components/colors-gradients/style.scss +39 -2
  280. package/src/components/contrast-checker/README.md +9 -0
  281. package/src/components/contrast-checker/index.js +42 -3
  282. package/src/components/date-format-picker/index.js +0 -1
  283. package/src/components/default-block-appender/content.scss +3 -0
  284. package/src/components/global-styles/background-panel.js +201 -34
  285. package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
  286. package/src/components/global-styles/color-panel.js +125 -487
  287. package/src/components/global-styles/dimensions-panel.js +0 -3
  288. package/src/components/global-styles/hooks.js +45 -0
  289. package/src/components/global-styles/test/background-panel.js +56 -0
  290. package/src/components/global-styles/test/color-panel.js +172 -118
  291. package/src/components/global-styles/test/typography-panel.js +167 -0
  292. package/src/components/global-styles/typography-panel.js +100 -11
  293. package/src/components/inspector-controls/README.md +0 -2
  294. package/src/components/inspector-controls/groups.js +2 -0
  295. package/src/components/inspector-controls-tabs/styles-tab.js +74 -28
  296. package/src/components/link-control/index.js +0 -1
  297. package/src/components/link-control/test/index.js +2 -3
  298. package/src/components/list-view/block-select-button.js +2 -17
  299. package/src/components/provider/use-block-sync.js +3 -1
  300. package/src/components/rich-text/content.scss +2 -0
  301. package/src/components/url-popover/image-url-input-ui.js +0 -2
  302. package/src/components/use-block-display-information/index.js +15 -2
  303. package/src/components/use-block-display-information/test/index.js +140 -0
  304. package/src/hooks/anchor.js +0 -1
  305. package/src/hooks/background.js +210 -133
  306. package/src/hooks/background.scss +0 -35
  307. package/src/hooks/color.js +2 -205
  308. package/src/hooks/color.scss +3 -9
  309. package/src/hooks/contrast-checker.js +60 -17
  310. package/src/hooks/custom-class-name.js +0 -1
  311. package/src/hooks/elements.js +140 -0
  312. package/src/hooks/elements.scss +8 -0
  313. package/src/hooks/grid-visualizer.js +59 -45
  314. package/src/hooks/layout-child.js +51 -12
  315. package/src/hooks/layout.js +6 -3
  316. package/src/hooks/states.js +2 -2
  317. package/src/hooks/style.js +11 -7
  318. package/src/hooks/test/background.js +59 -0
  319. package/src/hooks/test/block-style-state.js +14 -14
  320. package/src/hooks/test/layout.js +6 -6
  321. package/src/hooks/test/style.js +8 -8
  322. package/src/hooks/typography.js +70 -6
  323. package/src/layouts/flex.js +118 -15
  324. package/src/store/test/private-selectors.js +28 -7
  325. package/src/store/test/reducer.js +61 -10
  326. package/src/style.scss +1 -0
  327. package/src/utils/block-bindings.ts +51 -0
  328. package/src/utils/color-values.ts +63 -0
  329. package/src/utils/{dom.js → dom.ts} +27 -27
  330. package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
  331. package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
  332. package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
  333. package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
  334. package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
  335. package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
  336. package/src/utils/{math.js → math.ts} +37 -30
  337. package/src/utils/object.ts +89 -0
  338. package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
  339. package/src/utils/{pasting.js → pasting.ts} +18 -11
  340. package/src/utils/{selection.js → selection.ts} +11 -4
  341. package/src/utils/sorting.ts +81 -0
  342. package/src/utils/test/color-values.js +44 -1
  343. package/src/utils/transform-styles/{index.js → index.ts} +25 -25
  344. package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
  345. package/src/utils/transform-styles/types.ts +13 -0
  346. package/src/utils/types.ts +29 -0
  347. package/src/utils/block-bindings.js +0 -46
  348. package/src/utils/color-values.js +0 -28
  349. package/src/utils/object.js +0 -67
  350. package/src/utils/sorting.js +0 -54
  351. /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
  352. /package/src/utils/{index.js → index.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/transform-styles/index.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAyJ7D;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,WACZ,WAAW,EAAE,+CAEF,gBAAgB,UAenC,CAAC;eAEa,eAAe"}
@@ -0,0 +1,13 @@
1
+ export interface EditorStyle {
2
+ /** The CSS block(s), as a single string. */
3
+ css: string;
4
+ /** The base URL to be used as the reference when rewriting urls. */
5
+ baseURL?: string;
6
+ /** The selectors not to wrap. */
7
+ ignoredSelectors?: (string | RegExp)[];
8
+ }
9
+ export interface TransformOptions {
10
+ /** The selectors not to wrap. */
11
+ ignoredSelectors?: (string | RegExp)[];
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/transform-styles/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC3B,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,CAAE,MAAM,GAAG,MAAM,CAAE,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAChC,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,CAAE,MAAM,GAAG,MAAM,CAAE,EAAE,CAAC;CACzC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Result of formatting a font style or weight.
3
+ */
4
+ export interface FormattedFont {
5
+ /** Human readable name. */
6
+ name?: string;
7
+ /** Original CSS value. */
8
+ value?: string;
9
+ }
10
+ /**
11
+ * A font family face from theme.json.
12
+ */
13
+ export interface FontFamilyFace {
14
+ fontStyle?: string;
15
+ fontWeight?: string | number;
16
+ }
17
+ /**
18
+ * Combined font style and weight option for a font picker.
19
+ */
20
+ export interface CombinedStyleAndWeightOption {
21
+ key: string;
22
+ name: string;
23
+ style: {
24
+ fontStyle?: string;
25
+ fontWeight?: string;
26
+ };
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACN,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "15.22.1-next.v.202606191442.0+17fe7db8a",
3
+ "version": "15.22.1",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -60,43 +60,43 @@
60
60
  ],
61
61
  "dependencies": {
62
62
  "@react-spring/web": "^9.4.5",
63
- "@wordpress/a11y": "^4.48.2-next.v.202606191442.0+17fe7db8a",
64
- "@wordpress/base-styles": "^10.0.2-next.v.202606191442.0+17fe7db8a",
65
- "@wordpress/blob": "^4.48.2-next.v.202606191442.0+17fe7db8a",
66
- "@wordpress/block-serialization-default-parser": "^5.48.2-next.v.202606191442.0+17fe7db8a",
67
- "@wordpress/blocks": "^15.21.3-next.v.202606191442.0+17fe7db8a",
68
- "@wordpress/commands": "^1.48.2-next.v.202606191442.0+17fe7db8a",
69
- "@wordpress/components": "^35.1.1-next.v.202606191442.0+17fe7db8a",
70
- "@wordpress/compose": "^8.1.2-next.v.202606191442.0+17fe7db8a",
71
- "@wordpress/data": "^10.48.2-next.v.202606191442.0+17fe7db8a",
72
- "@wordpress/dataviews": "^17.0.1-next.v.202606191442.0+17fe7db8a",
73
- "@wordpress/date": "^5.48.2-next.v.202606191442.0+17fe7db8a",
74
- "@wordpress/deprecated": "^4.48.2-next.v.202606191442.0+17fe7db8a",
75
- "@wordpress/dom": "^4.48.2-next.v.202606191442.0+17fe7db8a",
76
- "@wordpress/element": "^8.0.2-next.v.202606191442.0+17fe7db8a",
77
- "@wordpress/escape-html": "^3.48.2-next.v.202606191442.0+17fe7db8a",
78
- "@wordpress/global-styles-engine": "^1.15.2-next.v.202606191442.0+17fe7db8a",
79
- "@wordpress/hooks": "^4.48.2-next.v.202606191442.0+17fe7db8a",
80
- "@wordpress/html-entities": "^4.48.2-next.v.202606191442.0+17fe7db8a",
81
- "@wordpress/i18n": "^6.21.2-next.v.202606191442.0+17fe7db8a",
82
- "@wordpress/icons": "^14.0.2-next.v.202606191442.0+17fe7db8a",
83
- "@wordpress/image-cropper": "^1.12.2-next.v.202606191442.0+17fe7db8a",
84
- "@wordpress/interactivity": "^6.48.2-next.v.202606191442.0+17fe7db8a",
85
- "@wordpress/is-shallow-equal": "^5.48.2-next.v.202606191442.0+17fe7db8a",
86
- "@wordpress/keyboard-shortcuts": "^5.48.2-next.v.202606191442.0+17fe7db8a",
87
- "@wordpress/keycodes": "^4.48.2-next.v.202606191442.0+17fe7db8a",
88
- "@wordpress/notices": "^5.48.2-next.v.202606191442.0+17fe7db8a",
89
- "@wordpress/preferences": "^4.48.2-next.v.202606191442.0+17fe7db8a",
90
- "@wordpress/priority-queue": "^3.48.2-next.v.202606191442.0+17fe7db8a",
91
- "@wordpress/private-apis": "^1.48.2-next.v.202606191442.0+17fe7db8a",
92
- "@wordpress/rich-text": "^7.48.2-next.v.202606191442.0+17fe7db8a",
93
- "@wordpress/style-engine": "^2.49.1-next.v.202606191442.0+17fe7db8a",
94
- "@wordpress/token-list": "^3.48.2-next.v.202606191442.0+17fe7db8a",
95
- "@wordpress/ui": "^0.16.1-next.v.202606191442.0+17fe7db8a",
96
- "@wordpress/upload-media": "^0.34.1-next.v.202606191442.0+17fe7db8a",
97
- "@wordpress/url": "^4.48.2-next.v.202606191442.0+17fe7db8a",
98
- "@wordpress/warning": "^3.48.2-next.v.202606191442.0+17fe7db8a",
99
- "@wordpress/wordcount": "^4.48.2-next.v.202606191442.0+17fe7db8a",
63
+ "@wordpress/a11y": "^4.49.0",
64
+ "@wordpress/base-styles": "^10.1.0",
65
+ "@wordpress/blob": "^4.49.0",
66
+ "@wordpress/block-serialization-default-parser": "^5.49.0",
67
+ "@wordpress/blocks": "^15.22.0",
68
+ "@wordpress/commands": "^1.49.1",
69
+ "@wordpress/components": "^36.0.1",
70
+ "@wordpress/compose": "^8.2.0",
71
+ "@wordpress/data": "^10.49.0",
72
+ "@wordpress/dataviews": "^17.0.1",
73
+ "@wordpress/date": "^5.49.0",
74
+ "@wordpress/deprecated": "^4.49.0",
75
+ "@wordpress/dom": "^4.49.0",
76
+ "@wordpress/element": "^8.1.0",
77
+ "@wordpress/escape-html": "^3.49.0",
78
+ "@wordpress/global-styles-engine": "^1.16.0",
79
+ "@wordpress/hooks": "^4.49.0",
80
+ "@wordpress/html-entities": "^4.49.0",
81
+ "@wordpress/i18n": "^6.22.0",
82
+ "@wordpress/icons": "^15.0.0",
83
+ "@wordpress/image-cropper": "^1.13.1",
84
+ "@wordpress/interactivity": "^6.49.0",
85
+ "@wordpress/is-shallow-equal": "^5.49.0",
86
+ "@wordpress/keyboard-shortcuts": "^5.49.0",
87
+ "@wordpress/keycodes": "^4.49.0",
88
+ "@wordpress/notices": "^5.49.1",
89
+ "@wordpress/preferences": "^4.49.1",
90
+ "@wordpress/priority-queue": "^3.49.0",
91
+ "@wordpress/private-apis": "^1.49.0",
92
+ "@wordpress/rich-text": "^7.49.0",
93
+ "@wordpress/style-engine": "^2.49.0",
94
+ "@wordpress/token-list": "^3.49.0",
95
+ "@wordpress/ui": "^0.16.1",
96
+ "@wordpress/upload-media": "^0.34.1",
97
+ "@wordpress/url": "^4.49.0",
98
+ "@wordpress/warning": "^3.49.0",
99
+ "@wordpress/wordcount": "^4.49.0",
100
100
  "change-case": "^4.1.2",
101
101
  "clsx": "^2.1.1",
102
102
  "colord": "^2.9.3",
@@ -117,6 +117,7 @@
117
117
  "@testing-library/dom": "^10.4.1",
118
118
  "@testing-library/react": "^16.3.2",
119
119
  "@testing-library/user-event": "^14.6.1",
120
+ "@types/postcss-prefix-selector": "^1.16.3",
120
121
  "deep-freeze": "^0.0.1"
121
122
  },
122
123
  "peerDependencies": {
@@ -132,5 +133,5 @@
132
133
  "publishConfig": {
133
134
  "access": "public"
134
135
  },
135
- "gitHead": "1b6a19222df5a88f161880b5789efb3171d8f425"
136
+ "gitHead": "9a75283890dda96ae1d37197b5070fae8c9cf66f"
136
137
  }
@@ -18,6 +18,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`]
18
18
  >
19
19
  <svg
20
20
  aria-hidden="true"
21
+ fill="currentColor"
21
22
  focusable="false"
22
23
  height="24"
23
24
  viewBox="0 0 24 24"
@@ -41,6 +42,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`]
41
42
  >
42
43
  <svg
43
44
  aria-hidden="true"
45
+ fill="currentColor"
44
46
  focusable="false"
45
47
  height="24"
46
48
  viewBox="0 0 24 24"
@@ -73,6 +75,7 @@ exports[`AlignmentUI should match snapshot when controls are hidden 1`] = `
73
75
  >
74
76
  <svg
75
77
  aria-hidden="true"
78
+ fill="currentColor"
76
79
  focusable="false"
77
80
  height="24"
78
81
  viewBox="0 0 24 24"
@@ -106,6 +109,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
106
109
  >
107
110
  <svg
108
111
  aria-hidden="true"
112
+ fill="currentColor"
109
113
  focusable="false"
110
114
  height="24"
111
115
  viewBox="0 0 24 24"
@@ -129,6 +133,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
129
133
  >
130
134
  <svg
131
135
  aria-hidden="true"
136
+ fill="currentColor"
132
137
  focusable="false"
133
138
  height="24"
134
139
  viewBox="0 0 24 24"
@@ -152,6 +157,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = `
152
157
  >
153
158
  <svg
154
159
  aria-hidden="true"
160
+ fill="currentColor"
155
161
  focusable="false"
156
162
  height="24"
157
163
  viewBox="0 0 24 24"
@@ -16,6 +16,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are hidden 1`] = `
16
16
  >
17
17
  <svg
18
18
  aria-hidden="true"
19
+ fill="currentColor"
19
20
  focusable="false"
20
21
  height="24"
21
22
  viewBox="0 0 24 24"
@@ -48,6 +49,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
48
49
  >
49
50
  <svg
50
51
  aria-hidden="true"
52
+ fill="currentColor"
51
53
  focusable="false"
52
54
  height="24"
53
55
  viewBox="0 0 24 24"
@@ -70,6 +72,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
70
72
  >
71
73
  <svg
72
74
  aria-hidden="true"
75
+ fill="currentColor"
73
76
  focusable="false"
74
77
  height="24"
75
78
  viewBox="0 0 24 24"
@@ -92,6 +95,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
92
95
  >
93
96
  <svg
94
97
  aria-hidden="true"
98
+ fill="currentColor"
95
99
  focusable="false"
96
100
  height="24"
97
101
  viewBox="0 0 24 24"
@@ -114,6 +118,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] =
114
118
  >
115
119
  <svg
116
120
  aria-hidden="true"
121
+ fill="currentColor"
117
122
  focusable="false"
118
123
  height="24"
119
124
  viewBox="0 0 24 24"
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useSelect, useDispatch } from '@wordpress/data';
4
+ import { useSelect, useRegistry } from '@wordpress/data';
5
5
  import { useEffect } from '@wordpress/element';
6
6
 
7
7
  /**
@@ -50,8 +50,7 @@ import {
50
50
  export function useBlockEditingMode( mode ) {
51
51
  const context = useBlockEditContext();
52
52
  const { clientId = '' } = context;
53
- const { setBlockEditingMode, unsetBlockEditingMode } =
54
- useDispatch( blockEditorStore );
53
+ const registry = useRegistry();
55
54
  const globalBlockEditingMode = useSelect(
56
55
  ( select ) =>
57
56
  // Avoid adding the subscription if not needed!
@@ -59,14 +58,23 @@ export function useBlockEditingMode( mode ) {
59
58
  [ clientId ]
60
59
  );
61
60
  useEffect( () => {
62
- if ( mode ) {
63
- setBlockEditingMode( clientId, mode );
61
+ if ( ! mode ) {
62
+ return;
64
63
  }
64
+
65
+ const {
66
+ setBlockEditingMode,
67
+ unsetBlockEditingMode,
68
+ __unstableMarkNextChangeAsNotPersistent,
69
+ } = registry.dispatch( blockEditorStore );
70
+
71
+ __unstableMarkNextChangeAsNotPersistent();
72
+ setBlockEditingMode( clientId, mode );
73
+
65
74
  return () => {
66
- if ( mode ) {
67
- unsetBlockEditingMode( clientId );
68
- }
75
+ __unstableMarkNextChangeAsNotPersistent();
76
+ unsetBlockEditingMode( clientId );
69
77
  };
70
- }, [ clientId, mode, setBlockEditingMode, unsetBlockEditingMode ] );
78
+ }, [ registry, clientId, mode ] );
71
79
  return clientId ? context[ blockEditingModeKey ] : globalBlockEditingMode;
72
80
  }
@@ -7,6 +7,7 @@ exports[`BlockIcon renders a Icon 1`] = `
7
7
  >
8
8
  <svg
9
9
  aria-hidden="true"
10
+ fill="currentColor"
10
11
  focusable="false"
11
12
  height="24"
12
13
  viewBox="0 0 24 24"
@@ -57,6 +57,10 @@ function StyleInspectorSlots( {
57
57
  return (
58
58
  <>
59
59
  <InspectorControls.Slot />
60
+ <InspectorControls.Slot
61
+ group="typography"
62
+ label={ __( 'Typography' ) }
63
+ />
60
64
  <InspectorControls.Slot
61
65
  group="color"
62
66
  label={ __( 'Color' ) }
@@ -64,19 +68,20 @@ function StyleInspectorSlots( {
64
68
  />
65
69
  <InspectorControls.Slot
66
70
  group="background"
67
- label={ __( 'Background image' ) }
71
+ label={ __( 'Background' ) }
68
72
  className="background-block-support-panel__inner-wrapper"
69
73
  />
70
- <InspectorControls.Slot
71
- group="typography"
72
- label={ __( 'Typography' ) }
73
- />
74
74
  <InspectorControls.Slot group="layout" label={ __( 'Layout' ) } />
75
75
  <InspectorControls.Slot
76
76
  group="dimensions"
77
77
  label={ __( 'Dimensions' ) }
78
78
  />
79
79
  <InspectorControls.Slot group="border" label={ borderPanelLabel } />
80
+ <InspectorControls.Slot
81
+ group="elements"
82
+ label={ __( 'Elements' ) }
83
+ className="elements-block-support-panel__inner-wrapper"
84
+ />
80
85
  { showPositionControls && <PositionControls /> }
81
86
  <InspectorControls.Slot group="styles" />
82
87
  { showBindingsControls && (
@@ -98,6 +103,10 @@ function StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {
98
103
  ! hasPseudoBlockStyleState( selectedBlockStyleState );
99
104
  return (
100
105
  <>
106
+ <InspectorControls.Slot
107
+ group="typography"
108
+ label={ __( 'Typography' ) }
109
+ />
101
110
  <InspectorControls.Slot
102
111
  group="color"
103
112
  label={ __( 'Color' ) }
@@ -105,13 +114,9 @@ function StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {
105
114
  />
106
115
  <InspectorControls.Slot
107
116
  group="background"
108
- label={ __( 'Background image' ) }
117
+ label={ __( 'Background' ) }
109
118
  className="background-block-support-panel__inner-wrapper"
110
119
  />
111
- <InspectorControls.Slot
112
- group="typography"
113
- label={ __( 'Typography' ) }
114
- />
115
120
  { showLayoutControls && (
116
121
  <InspectorControls.Slot
117
122
  group="layout"
@@ -123,6 +128,11 @@ function StyleStateInspectorSlots( { blockName, selectedBlockStyleState } ) {
123
128
  label={ __( 'Dimensions' ) }
124
129
  />
125
130
  <InspectorControls.Slot group="border" label={ borderPanelLabel } />
131
+ <InspectorControls.Slot
132
+ group="elements"
133
+ label={ __( 'Elements' ) }
134
+ className="elements-block-support-panel__inner-wrapper"
135
+ />
126
136
  </>
127
137
  );
128
138
  }
@@ -107,7 +107,6 @@ export default function BlockRenameModal( { clientId, onClose } ) {
107
107
  >
108
108
  <VStack spacing="3">
109
109
  <TextControl
110
- __next40pxDefaultSize
111
110
  value={ editedBlockName ?? blockName }
112
111
  label={ __( 'Name' ) }
113
112
  help={
@@ -19,6 +19,7 @@ import useBlockDisplayTitle from '../block-title/use-block-display-title';
19
19
  import { store as blockEditorStore } from '../../store';
20
20
  import { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';
21
21
  import { unlock } from '../../lock-unlock';
22
+ import { isIsolatedEditorKey } from '../../store/private-keys';
22
23
 
23
24
  function getBlockIconVariant( { select, clientIds } ) {
24
25
  const {
@@ -29,8 +30,11 @@ function getBlockIconVariant( { select, clientIds } ) {
29
30
  getTemplateLock,
30
31
  getBlockEditingMode,
31
32
  canEditBlock,
33
+ isWithinEditedContentOnlySection,
34
+ getSettings,
32
35
  } = unlock( select( blockEditorStore ) );
33
36
  const { getBlockStyles } = select( blocksStore );
37
+ const isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];
34
38
 
35
39
  const hasTemplateLock = clientIds.some(
36
40
  ( id ) => getTemplateLock( id ) === 'contentOnly'
@@ -42,7 +46,10 @@ function getBlockIconVariant( { select, clientIds } ) {
42
46
  const hasBlockStyles =
43
47
  isSingleBlock && !! getBlockStyles( blockName )?.length;
44
48
  const hasPatternNameInSelection = clientIds.some(
45
- ( id ) => !! getBlockAttributes( id )?.metadata?.patternName
49
+ ( id ) =>
50
+ !! getBlockAttributes( id )?.metadata?.patternName &&
51
+ ! isWithinEditedContentOnlySection( id ) &&
52
+ ! isIsolatedEditor
46
53
  );
47
54
  const hasPatternOverrides = clientIds.every( ( clientId ) =>
48
55
  hasPatternOverridesDefaultBinding(
@@ -86,20 +93,29 @@ function getBlockIconVariant( { select, clientIds } ) {
86
93
  }
87
94
 
88
95
  function getBlockIcon( { select, clientIds } ) {
89
- const { getBlockName, getBlockAttributes } = unlock(
90
- select( blockEditorStore )
91
- );
96
+ const {
97
+ getBlockName,
98
+ getBlockAttributes,
99
+ isWithinEditedContentOnlySection,
100
+ getSettings,
101
+ } = unlock( select( blockEditorStore ) );
102
+ const isIsolatedEditor = !! getSettings()?.[ isIsolatedEditorKey ];
92
103
 
93
104
  const _isSingleBlock = clientIds.length === 1;
94
105
  const firstClientId = clientIds[ 0 ];
106
+
95
107
  const blockAttributes = getBlockAttributes( firstClientId );
96
- if ( _isSingleBlock && blockAttributes?.metadata?.patternName ) {
108
+ if (
109
+ _isSingleBlock &&
110
+ blockAttributes?.metadata?.patternName &&
111
+ ! isWithinEditedContentOnlySection( firstClientId ) &&
112
+ ! isIsolatedEditor
113
+ ) {
97
114
  return symbol;
98
115
  }
99
116
 
100
117
  const blockName = getBlockName( firstClientId );
101
118
  const blockType = getBlockType( blockName );
102
-
103
119
  if ( _isSingleBlock ) {
104
120
  const { getActiveBlockVariation } = select( blocksStore );
105
121
  const match = getActiveBlockVariation( blockName, blockAttributes );
@@ -13,11 +13,33 @@ import { paragraph } from '@wordpress/icons';
13
13
  * Internal dependencies
14
14
  */
15
15
  import BlockToolbarIcon from '../block-toolbar-icon';
16
+ import { isIsolatedEditorKey } from '../../../store/private-keys';
16
17
 
18
+ jest.mock( '@wordpress/blocks', () => {
19
+ const actualImplementation = jest.requireActual( '@wordpress/blocks' );
20
+ return {
21
+ ...actualImplementation,
22
+ getBlockType: ( name ) => ( {
23
+ name,
24
+ title: name === 'core/template-part' ? 'Template Part' : 'Group',
25
+ icon: `${ name }-icon`,
26
+ } ),
27
+ };
28
+ } );
17
29
  jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
30
+ jest.mock( '../../../lock-unlock', () => ( {
31
+ unlock: ( value ) => ( {
32
+ registerPrivateActions: jest.fn(),
33
+ registerPrivateSelectors: jest.fn(),
34
+ ...value,
35
+ } ),
36
+ } ) );
18
37
  jest.mock( '../../block-title/use-block-display-title', () =>
19
38
  jest.fn().mockReturnValue( 'Block Name' )
20
39
  );
40
+ jest.mock( '../../block-icon', () =>
41
+ jest.fn( ( { icon } ) => <span data-testid="block-icon">{ icon }</span> )
42
+ );
21
43
  jest.mock( '../../block-switcher', () =>
22
44
  jest.fn( ( { children } ) => (
23
45
  <div data-testid="block-switcher">{ children }</div>
@@ -38,6 +60,34 @@ describe( 'BlockToolbarIcon', () => {
38
60
  clientIds: [ 'test-client-id' ],
39
61
  isSynced: false,
40
62
  };
63
+ const setupToolbarSelectors = ( {
64
+ attributes = {
65
+ metadata: {
66
+ patternName: 'theme/hero',
67
+ },
68
+ },
69
+ blockName = 'core/group',
70
+ getActiveBlockVariation = () => null,
71
+ settings = {},
72
+ isWithinEditedSection = false,
73
+ } = {} ) => {
74
+ useSelect.mockImplementation( ( mapSelect ) =>
75
+ mapSelect( () => ( {
76
+ get: () => false,
77
+ getBlockName: () => blockName,
78
+ getBlockAttributes: () => attributes,
79
+ getSettings: () => settings,
80
+ getBlockParentsByBlockName: () => [],
81
+ canRemoveBlocks: () => true,
82
+ getTemplateLock: () => undefined,
83
+ getBlockEditingMode: () => 'default',
84
+ canEditBlock: () => true,
85
+ getBlockStyles: () => [ {} ],
86
+ getActiveBlockVariation,
87
+ isWithinEditedContentOnlySection: () => isWithinEditedSection,
88
+ } ) )
89
+ );
90
+ };
41
91
 
42
92
  beforeEach( () => {
43
93
  jest.clearAllMocks();
@@ -144,6 +194,55 @@ describe( 'BlockToolbarIcon', () => {
144
194
  } );
145
195
  } );
146
196
 
197
+ describe( 'pattern sections', () => {
198
+ it( 'should not show the block switcher before the section is being edited', () => {
199
+ setupToolbarSelectors();
200
+
201
+ render( <BlockToolbarIcon { ...defaultProps } /> );
202
+
203
+ expect(
204
+ screen.queryByTestId( 'block-switcher' )
205
+ ).not.toBeInTheDocument();
206
+ expect( screen.getByRole( 'button' ) ).toHaveAttribute(
207
+ 'aria-disabled',
208
+ 'true'
209
+ );
210
+ } );
211
+
212
+ it( 'should show the block switcher when the section is being edited', () => {
213
+ setupToolbarSelectors( { isWithinEditedSection: true } );
214
+
215
+ render( <BlockToolbarIcon { ...defaultProps } /> );
216
+
217
+ expect(
218
+ screen.getByTestId( 'block-switcher' )
219
+ ).toBeInTheDocument();
220
+ } );
221
+
222
+ it( 'should show the block icon for pattern wrappers in isolated editors', () => {
223
+ setupToolbarSelectors( {
224
+ attributes: {
225
+ metadata: {
226
+ name: 'Header',
227
+ patternName: 'theme/header-wrapper',
228
+ },
229
+ },
230
+ settings: {
231
+ [ isIsolatedEditorKey ]: true,
232
+ },
233
+ } );
234
+
235
+ render( <BlockToolbarIcon { ...defaultProps } /> );
236
+
237
+ expect(
238
+ screen.getByTestId( 'block-switcher' )
239
+ ).toBeInTheDocument();
240
+ expect( screen.getByTestId( 'block-icon' ) ).toHaveTextContent(
241
+ 'core/group-icon'
242
+ );
243
+ } );
244
+ } );
245
+
147
246
  describe( 'label calculation', () => {
148
247
  it( 'should use block title for single block', () => {
149
248
  useSelect.mockImplementation( () => ( {
@@ -16,6 +16,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden
16
16
  >
17
17
  <svg
18
18
  aria-hidden="true"
19
+ fill="currentColor"
19
20
  focusable="false"
20
21
  height="24"
21
22
  viewBox="0 0 24 24"
@@ -48,6 +49,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
48
49
  >
49
50
  <svg
50
51
  aria-hidden="true"
52
+ fill="currentColor"
51
53
  focusable="false"
52
54
  height="24"
53
55
  viewBox="0 0 24 24"
@@ -70,6 +72,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
70
72
  >
71
73
  <svg
72
74
  aria-hidden="true"
75
+ fill="currentColor"
73
76
  focusable="false"
74
77
  height="24"
75
78
  viewBox="0 0 24 24"
@@ -92,6 +95,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are visibl
92
95
  >
93
96
  <svg
94
97
  aria-hidden="true"
98
+ fill="currentColor"
95
99
  focusable="false"
96
100
  height="24"
97
101
  viewBox="0 0 24 24"
@@ -12,6 +12,7 @@ import {
12
12
  __experimentalVStack as VStack,
13
13
  ColorPalette,
14
14
  GradientPicker,
15
+ Notice,
15
16
  privateApis as componentsPrivateApis,
16
17
  } from '@wordpress/components';
17
18
 
@@ -48,6 +49,7 @@ function ColorGradientControlInner( {
48
49
  showTitle = true,
49
50
  enableAlpha,
50
51
  headingLevel,
52
+ noticeProps,
51
53
  } ) {
52
54
  const canChooseAColor =
53
55
  onColorChange &&
@@ -67,20 +69,35 @@ function ColorGradientControlInner( {
67
69
  }
68
70
  : ( newColor, _index, newSlug ) => onColorChange( newColor, newSlug );
69
71
 
72
+ const colorPalette = (
73
+ <ColorPalette
74
+ value={ colorValue }
75
+ selectedSlug={ colorSlug }
76
+ onChange={ colorPaletteOnChange }
77
+ { ...{ colors, disableCustomColors } }
78
+ __experimentalIsRenderedInSidebar={
79
+ __experimentalIsRenderedInSidebar
80
+ }
81
+ clearable={ clearable }
82
+ enableAlpha={ enableAlpha }
83
+ headingLevel={ headingLevel }
84
+ />
85
+ );
86
+
70
87
  const tabPanels = {
88
+ // The `ColorPalette` must stay at a stable position in the tree whether
89
+ // or not a notice is present. Wrapping it in a `VStack` only when a
90
+ // notice appears remounts it, which resets the custom color picker back
91
+ // to the swatch view mid-edit. Keep `ColorPalette` last and toggle only
92
+ // the notice ahead of it; the notice's own bottom margin provides the
93
+ // spacing the wrapper used to.
71
94
  [ TAB_IDS.color ]: (
72
- <ColorPalette
73
- value={ colorValue }
74
- selectedSlug={ colorSlug }
75
- onChange={ colorPaletteOnChange }
76
- { ...{ colors, disableCustomColors } }
77
- __experimentalIsRenderedInSidebar={
78
- __experimentalIsRenderedInSidebar
79
- }
80
- clearable={ clearable }
81
- enableAlpha={ enableAlpha }
82
- headingLevel={ headingLevel }
83
- />
95
+ <>
96
+ { noticeProps && (
97
+ <Notice isDismissible={ false } { ...noticeProps } />
98
+ ) }
99
+ { colorPalette }
100
+ </>
84
101
  ),
85
102
  [ TAB_IDS.gradient ]: (
86
103
  <GradientPicker