@wordpress/block-editor 17.1.0 → 17.2.1-next.v.202609171837.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 (541) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +214 -214
  3. package/build/autocompleters/block.cjs.map +2 -2
  4. package/build/components/alignment-control/ui.cjs.map +2 -2
  5. package/build/components/background-image-control/index.cjs +1 -1
  6. package/build/components/background-image-control/index.cjs.map +2 -2
  7. package/build/components/block-alignment-control/ui.cjs +21 -7
  8. package/build/components/block-alignment-control/ui.cjs.map +3 -3
  9. package/build/components/block-alignment-control/use-available-alignments.cjs +60 -13
  10. package/build/components/block-alignment-control/use-available-alignments.cjs.map +2 -2
  11. package/build/components/block-allowed-blocks/allowed-blocks-control.cjs.map +2 -2
  12. package/build/components/block-bindings/attribute-control.cjs +30 -30
  13. package/build/components/block-bindings/attribute-control.cjs.map +3 -3
  14. package/build/components/block-bindings/source-fields-list.cjs +27 -32
  15. package/build/components/block-bindings/source-fields-list.cjs.map +3 -3
  16. package/build/components/block-canvas/index.cjs.map +2 -2
  17. package/build/components/block-card/index.cjs +1 -2
  18. package/build/components/block-card/index.cjs.map +3 -3
  19. package/build/components/block-edit/edit.cjs.map +2 -2
  20. package/build/components/block-heading-level-dropdown/index.cjs.map +2 -2
  21. package/build/components/block-icon/index.cjs.map +2 -2
  22. package/build/components/block-inspector/edit-contents.cjs.map +2 -2
  23. package/build/components/block-inspector/index.cjs +27 -8
  24. package/build/components/block-inspector/index.cjs.map +3 -3
  25. package/build/components/block-keyboard-shortcuts/index.cjs.map +2 -2
  26. package/build/components/block-list/block-html.cjs +1 -12
  27. package/build/components/block-list/block-html.cjs.map +3 -3
  28. package/build/components/block-list/block.cjs +2 -4
  29. package/build/components/block-list/block.cjs.map +2 -2
  30. package/build/components/block-list/layout.cjs +1 -1
  31. package/build/components/block-list/layout.cjs.map +2 -2
  32. package/build/components/block-list/use-block-props/index.cjs.map +2 -2
  33. package/build/components/block-lock/modal.cjs +1 -3
  34. package/build/components/block-lock/modal.cjs.map +2 -2
  35. package/build/components/block-parent-selector/index.cjs +8 -5
  36. package/build/components/block-parent-selector/index.cjs.map +2 -2
  37. package/build/components/block-popover/index.cjs.map +2 -2
  38. package/build/components/block-rename/modal.cjs.map +2 -2
  39. package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
  40. package/build/components/block-styles/utils.cjs.map +2 -2
  41. package/build/components/block-switcher/index.cjs.map +2 -2
  42. package/build/components/block-toolbar/edit-section-button.cjs.map +2 -2
  43. package/build/components/block-toolbar/index.cjs +6 -4
  44. package/build/components/block-toolbar/index.cjs.map +2 -2
  45. package/build/components/block-toolbar/switch-section-style.cjs.map +2 -2
  46. package/build/components/block-variation-transforms/index.cjs +28 -18
  47. package/build/components/block-variation-transforms/index.cjs.map +3 -3
  48. package/build/components/block-visibility/modal.cjs.map +2 -2
  49. package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
  50. package/build/components/border-radius-control/index.cjs.map +2 -2
  51. package/build/components/color-palette/with-color-context.cjs.map +2 -2
  52. package/build/components/colors/with-colors.cjs.map +2 -2
  53. package/build/components/colors-gradients/control.cjs.map +2 -2
  54. package/build/components/contrast-checker/index.cjs.map +2 -2
  55. package/build/components/date-format-picker/index.cjs.map +2 -2
  56. package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
  57. package/build/components/dimensions-tool/width-height-tool.cjs.map +2 -2
  58. package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
  59. package/build/components/global-styles/background-panel.cjs +1 -1
  60. package/build/components/global-styles/background-panel.cjs.map +2 -2
  61. package/build/components/global-styles/border-panel.cjs +1 -1
  62. package/build/components/global-styles/border-panel.cjs.map +2 -2
  63. package/build/components/global-styles/color-gradient-dropdown-item.cjs +1 -1
  64. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +2 -2
  65. package/build/components/global-styles/color-panel.cjs +1 -1
  66. package/build/components/global-styles/color-panel.cjs.map +2 -2
  67. package/build/components/global-styles/dimensions-panel.cjs +1 -1
  68. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  69. package/build/components/global-styles/filters-panel.cjs +1 -1
  70. package/build/components/global-styles/filters-panel.cjs.map +2 -2
  71. package/build/components/global-styles/hooks.cjs +1 -0
  72. package/build/components/global-styles/hooks.cjs.map +2 -2
  73. package/build/components/global-styles/inheritance/index.cjs +3 -3
  74. package/build/components/global-styles/inheritance/index.cjs.map +2 -2
  75. package/build/components/global-styles/inherited-value-context.cjs +0 -5
  76. package/build/components/global-styles/inherited-value-context.cjs.map +2 -2
  77. package/build/components/global-styles/state-control-badges.cjs +0 -1
  78. package/build/components/global-styles/state-control-badges.cjs.map +2 -2
  79. package/build/components/global-styles/state-control.cjs +6 -4
  80. package/build/components/global-styles/state-control.cjs.map +2 -2
  81. package/build/components/global-styles/text-shadow-panel.cjs +254 -0
  82. package/build/components/global-styles/text-shadow-panel.cjs.map +7 -0
  83. package/build/components/global-styles/typography-panel.cjs +46 -5
  84. package/build/components/global-styles/typography-panel.cjs.map +2 -2
  85. package/build/components/global-styles/typography-utils.cjs.map +2 -2
  86. package/build/components/global-styles/utils.cjs.map +2 -2
  87. package/build/components/html-element-control/index.cjs.map +3 -3
  88. package/build/components/iframe/index.cjs.map +2 -2
  89. package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
  90. package/build/components/image-size-control/index.cjs.map +3 -3
  91. package/build/components/inner-blocks/index.cjs +6 -1
  92. package/build/components/inner-blocks/index.cjs.map +2 -2
  93. package/build/components/inner-content/index.cjs.map +2 -2
  94. package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs +4 -23
  95. package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs.map +2 -2
  96. package/build/components/inserter/block-patterns-tab/utils.cjs +26 -0
  97. package/build/components/inserter/block-patterns-tab/utils.cjs.map +2 -2
  98. package/build/components/inserter/hooks/use-block-types-state.cjs.map +2 -2
  99. package/build/components/inserter/hooks/use-insertion-point.cjs.map +2 -2
  100. package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
  101. package/build/components/inserter/media-tab/media-panel.cjs.map +2 -2
  102. package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
  103. package/build/components/inserter-list-item/index.cjs.map +2 -2
  104. package/build/components/inspector-controls/list-view-content-popover.cjs.map +2 -2
  105. package/build/components/link-control/search-results.cjs.map +2 -2
  106. package/build/components/link-control/use-search-handler.cjs +3 -0
  107. package/build/components/link-control/use-search-handler.cjs.map +2 -2
  108. package/build/components/list-view/branch.cjs.map +2 -2
  109. package/build/components/list-view/drop-indicator.cjs.map +2 -2
  110. package/build/components/list-view/index.cjs.map +2 -2
  111. package/build/components/list-view/use-list-view-drop-zone.cjs.map +2 -2
  112. package/build/components/list-view/utils.cjs.map +2 -2
  113. package/build/components/media-replace-flow/index.cjs +4 -1
  114. package/build/components/media-replace-flow/index.cjs.map +2 -2
  115. package/build/components/plain-text/index.cjs +1 -2
  116. package/build/components/plain-text/index.cjs.map +3 -3
  117. package/build/components/preset-input-control/index.cjs.map +2 -2
  118. package/build/components/provider/index.cjs +3 -1
  119. package/build/components/provider/index.cjs.map +2 -2
  120. package/build/components/provider/use-block-sync.cjs.map +2 -2
  121. package/build/components/publish-date-time-picker/index.cjs.map +2 -2
  122. package/build/components/resizable-box-popover/index.cjs +1 -1
  123. package/build/components/resizable-box-popover/index.cjs.map +1 -1
  124. package/build/components/resolution-tool/index.cjs.map +3 -3
  125. package/build/components/rich-text/event-listeners/enter.cjs +8 -22
  126. package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
  127. package/build/components/rich-text/format-edit.cjs.map +2 -2
  128. package/build/components/rich-text/index.cjs +20 -0
  129. package/build/components/rich-text/index.cjs.map +2 -2
  130. package/build/components/rich-text/multiline.cjs +10 -2
  131. package/build/components/rich-text/multiline.cjs.map +2 -2
  132. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.cjs.map +2 -2
  133. package/build/components/typewriter/index.cjs.map +2 -2
  134. package/build/components/use-block-commands/index.cjs.map +2 -2
  135. package/build/components/writing-flow/index.cjs +3 -0
  136. package/build/components/writing-flow/index.cjs.map +2 -2
  137. package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
  138. package/build/components/writing-flow/use-selection-observer.cjs +5 -3
  139. package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
  140. package/build/hooks/align.cjs +3 -5
  141. package/build/hooks/align.cjs.map +2 -2
  142. package/build/hooks/background.cjs.map +2 -2
  143. package/build/hooks/block-bindings.cjs.map +2 -2
  144. package/build/hooks/border.cjs.map +2 -2
  145. package/build/hooks/contrast-checker.cjs.map +2 -2
  146. package/build/hooks/dimensions.cjs.map +2 -2
  147. package/build/hooks/duotone.cjs.map +2 -2
  148. package/build/hooks/elements.cjs.map +2 -2
  149. package/build/hooks/fit-text.cjs.map +2 -2
  150. package/build/hooks/gap.cjs +2 -1
  151. package/build/hooks/gap.cjs.map +3 -3
  152. package/build/hooks/index.cjs +4 -2
  153. package/build/hooks/index.cjs.map +3 -3
  154. package/build/hooks/layout-child.cjs.map +2 -2
  155. package/build/hooks/layout.cjs +15 -14
  156. package/build/hooks/layout.cjs.map +3 -3
  157. package/build/hooks/position.cjs +3 -31
  158. package/build/hooks/position.cjs.map +2 -2
  159. package/build/hooks/states.cjs +3 -2
  160. package/build/hooks/states.cjs.map +2 -2
  161. package/build/hooks/text-shadow.cjs +100 -0
  162. package/build/hooks/text-shadow.cjs.map +7 -0
  163. package/build/hooks/typography.cjs +30 -6
  164. package/build/hooks/typography.cjs.map +2 -2
  165. package/build/hooks/utils.cjs +24 -2
  166. package/build/hooks/utils.cjs.map +2 -2
  167. package/build/layouts/grid.cjs.map +2 -2
  168. package/build/layouts/utils.cjs +7 -2
  169. package/build/layouts/utils.cjs.map +2 -2
  170. package/build/private-apis.cjs +9 -6
  171. package/build/private-apis.cjs.map +2 -2
  172. package/build/store/actions.cjs +26 -4
  173. package/build/store/actions.cjs.map +3 -3
  174. package/build/store/private-selectors.cjs.map +2 -2
  175. package/build/store/reducer.cjs.map +2 -2
  176. package/build/store/selectors.cjs.map +2 -2
  177. package/build/utils/get-font-styles-and-weights.cjs.map +2 -2
  178. package/build/utils/transform-styles/index.cjs.map +1 -1
  179. package/build-module/autocompleters/block.mjs.map +2 -2
  180. package/build-module/components/alignment-control/ui.mjs.map +2 -2
  181. package/build-module/components/background-image-control/index.mjs +2 -2
  182. package/build-module/components/background-image-control/index.mjs.map +2 -2
  183. package/build-module/components/block-alignment-control/ui.mjs +21 -7
  184. package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
  185. package/build-module/components/block-alignment-control/use-available-alignments.mjs +56 -13
  186. package/build-module/components/block-alignment-control/use-available-alignments.mjs.map +2 -2
  187. package/build-module/components/block-allowed-blocks/allowed-blocks-control.mjs.map +2 -2
  188. package/build-module/components/block-bindings/attribute-control.mjs +31 -32
  189. package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
  190. package/build-module/components/block-bindings/source-fields-list.mjs +25 -30
  191. package/build-module/components/block-bindings/source-fields-list.mjs.map +2 -2
  192. package/build-module/components/block-canvas/index.mjs.map +2 -2
  193. package/build-module/components/block-card/index.mjs +3 -8
  194. package/build-module/components/block-card/index.mjs.map +2 -2
  195. package/build-module/components/block-edit/edit.mjs.map +2 -2
  196. package/build-module/components/block-heading-level-dropdown/index.mjs.map +2 -2
  197. package/build-module/components/block-icon/index.mjs.map +2 -2
  198. package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
  199. package/build-module/components/block-inspector/index.mjs +29 -10
  200. package/build-module/components/block-inspector/index.mjs.map +2 -2
  201. package/build-module/components/block-keyboard-shortcuts/index.mjs.map +2 -2
  202. package/build-module/components/block-list/block-html.mjs +1 -2
  203. package/build-module/components/block-list/block-html.mjs.map +2 -2
  204. package/build-module/components/block-list/block.mjs +2 -4
  205. package/build-module/components/block-list/block.mjs.map +2 -2
  206. package/build-module/components/block-list/layout.mjs +1 -1
  207. package/build-module/components/block-list/layout.mjs.map +2 -2
  208. package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
  209. package/build-module/components/block-lock/modal.mjs +1 -3
  210. package/build-module/components/block-lock/modal.mjs.map +2 -2
  211. package/build-module/components/block-parent-selector/index.mjs +8 -5
  212. package/build-module/components/block-parent-selector/index.mjs.map +2 -2
  213. package/build-module/components/block-popover/index.mjs.map +2 -2
  214. package/build-module/components/block-rename/modal.mjs.map +2 -2
  215. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
  216. package/build-module/components/block-styles/utils.mjs.map +2 -2
  217. package/build-module/components/block-switcher/index.mjs.map +2 -2
  218. package/build-module/components/block-toolbar/edit-section-button.mjs.map +2 -2
  219. package/build-module/components/block-toolbar/index.mjs +6 -4
  220. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  221. package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
  222. package/build-module/components/block-variation-transforms/index.mjs +30 -21
  223. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  224. package/build-module/components/block-visibility/modal.mjs.map +2 -2
  225. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
  226. package/build-module/components/border-radius-control/index.mjs.map +2 -2
  227. package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
  228. package/build-module/components/colors/with-colors.mjs.map +2 -2
  229. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  230. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  231. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  232. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +2 -2
  233. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
  234. package/build-module/components/dimensions-tool/width-height-tool.mjs.map +2 -2
  235. package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
  236. package/build-module/components/global-styles/background-panel.mjs +2 -2
  237. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  238. package/build-module/components/global-styles/border-panel.mjs +2 -2
  239. package/build-module/components/global-styles/border-panel.mjs.map +2 -2
  240. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +2 -2
  241. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
  242. package/build-module/components/global-styles/color-panel.mjs +2 -2
  243. package/build-module/components/global-styles/color-panel.mjs.map +2 -2
  244. package/build-module/components/global-styles/dimensions-panel.mjs +2 -2
  245. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  246. package/build-module/components/global-styles/filters-panel.mjs +2 -2
  247. package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
  248. package/build-module/components/global-styles/hooks.mjs +1 -0
  249. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  250. package/build-module/components/global-styles/inheritance/index.mjs +2 -2
  251. package/build-module/components/global-styles/inheritance/index.mjs.map +2 -2
  252. package/build-module/components/global-styles/inherited-value-context.mjs +0 -5
  253. package/build-module/components/global-styles/inherited-value-context.mjs.map +2 -2
  254. package/build-module/components/global-styles/state-control-badges.mjs +0 -1
  255. package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
  256. package/build-module/components/global-styles/state-control.mjs +6 -4
  257. package/build-module/components/global-styles/state-control.mjs.map +2 -2
  258. package/build-module/components/global-styles/text-shadow-panel.mjs +224 -0
  259. package/build-module/components/global-styles/text-shadow-panel.mjs.map +7 -0
  260. package/build-module/components/global-styles/typography-panel.mjs +47 -6
  261. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  262. package/build-module/components/global-styles/typography-utils.mjs.map +2 -2
  263. package/build-module/components/global-styles/utils.mjs.map +2 -2
  264. package/build-module/components/html-element-control/index.mjs +2 -2
  265. package/build-module/components/html-element-control/index.mjs.map +2 -2
  266. package/build-module/components/iframe/index.mjs.map +2 -2
  267. package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
  268. package/build-module/components/image-size-control/index.mjs +2 -2
  269. package/build-module/components/image-size-control/index.mjs.map +2 -2
  270. package/build-module/components/inner-blocks/index.mjs +6 -1
  271. package/build-module/components/inner-blocks/index.mjs.map +2 -2
  272. package/build-module/components/inner-content/index.mjs.map +2 -2
  273. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs +6 -24
  274. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs.map +2 -2
  275. package/build-module/components/inserter/block-patterns-tab/utils.mjs +25 -0
  276. package/build-module/components/inserter/block-patterns-tab/utils.mjs.map +2 -2
  277. package/build-module/components/inserter/hooks/use-block-types-state.mjs.map +2 -2
  278. package/build-module/components/inserter/hooks/use-insertion-point.mjs.map +2 -2
  279. package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
  280. package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
  281. package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
  282. package/build-module/components/inserter-list-item/index.mjs.map +2 -2
  283. package/build-module/components/inspector-controls/list-view-content-popover.mjs.map +2 -2
  284. package/build-module/components/link-control/search-results.mjs.map +2 -2
  285. package/build-module/components/link-control/use-search-handler.mjs +3 -0
  286. package/build-module/components/link-control/use-search-handler.mjs.map +2 -2
  287. package/build-module/components/list-view/branch.mjs.map +2 -2
  288. package/build-module/components/list-view/drop-indicator.mjs.map +2 -2
  289. package/build-module/components/list-view/index.mjs.map +2 -2
  290. package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +2 -2
  291. package/build-module/components/list-view/utils.mjs.map +2 -2
  292. package/build-module/components/media-replace-flow/index.mjs +4 -1
  293. package/build-module/components/media-replace-flow/index.mjs.map +2 -2
  294. package/build-module/components/plain-text/index.mjs +1 -2
  295. package/build-module/components/plain-text/index.mjs.map +2 -2
  296. package/build-module/components/preset-input-control/index.mjs.map +2 -2
  297. package/build-module/components/provider/index.mjs +3 -1
  298. package/build-module/components/provider/index.mjs.map +2 -2
  299. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  300. package/build-module/components/publish-date-time-picker/index.mjs.map +2 -2
  301. package/build-module/components/resizable-box-popover/index.mjs +1 -1
  302. package/build-module/components/resizable-box-popover/index.mjs.map +1 -1
  303. package/build-module/components/resolution-tool/index.mjs +2 -2
  304. package/build-module/components/resolution-tool/index.mjs.map +2 -2
  305. package/build-module/components/rich-text/event-listeners/enter.mjs +8 -22
  306. package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
  307. package/build-module/components/rich-text/format-edit.mjs.map +2 -2
  308. package/build-module/components/rich-text/index.mjs +21 -0
  309. package/build-module/components/rich-text/index.mjs.map +2 -2
  310. package/build-module/components/rich-text/multiline.mjs +11 -3
  311. package/build-module/components/rich-text/multiline.mjs.map +2 -2
  312. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.mjs.map +2 -2
  313. package/build-module/components/typewriter/index.mjs.map +2 -2
  314. package/build-module/components/use-block-commands/index.mjs.map +2 -2
  315. package/build-module/components/writing-flow/index.mjs +3 -0
  316. package/build-module/components/writing-flow/index.mjs.map +2 -2
  317. package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
  318. package/build-module/components/writing-flow/use-selection-observer.mjs +5 -3
  319. package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
  320. package/build-module/hooks/align.mjs +6 -6
  321. package/build-module/hooks/align.mjs.map +2 -2
  322. package/build-module/hooks/background.mjs.map +2 -2
  323. package/build-module/hooks/block-bindings.mjs.map +2 -2
  324. package/build-module/hooks/border.mjs.map +2 -2
  325. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  326. package/build-module/hooks/dimensions.mjs.map +2 -2
  327. package/build-module/hooks/duotone.mjs.map +2 -2
  328. package/build-module/hooks/elements.mjs.map +2 -2
  329. package/build-module/hooks/fit-text.mjs.map +2 -2
  330. package/build-module/hooks/gap.mjs +2 -1
  331. package/build-module/hooks/gap.mjs.map +2 -2
  332. package/build-module/hooks/index.mjs +4 -2
  333. package/build-module/hooks/index.mjs.map +2 -2
  334. package/build-module/hooks/layout-child.mjs.map +2 -2
  335. package/build-module/hooks/layout.mjs +6 -5
  336. package/build-module/hooks/layout.mjs.map +2 -2
  337. package/build-module/hooks/position.mjs +5 -33
  338. package/build-module/hooks/position.mjs.map +2 -2
  339. package/build-module/hooks/states.mjs +3 -2
  340. package/build-module/hooks/states.mjs.map +2 -2
  341. package/build-module/hooks/text-shadow.mjs +65 -0
  342. package/build-module/hooks/text-shadow.mjs.map +7 -0
  343. package/build-module/hooks/typography.mjs +30 -6
  344. package/build-module/hooks/typography.mjs.map +2 -2
  345. package/build-module/hooks/utils.mjs +24 -2
  346. package/build-module/hooks/utils.mjs.map +2 -2
  347. package/build-module/layouts/grid.mjs.map +2 -2
  348. package/build-module/layouts/utils.mjs +5 -1
  349. package/build-module/layouts/utils.mjs.map +2 -2
  350. package/build-module/private-apis.mjs +6 -2
  351. package/build-module/private-apis.mjs.map +2 -2
  352. package/build-module/store/actions.mjs +28 -5
  353. package/build-module/store/actions.mjs.map +3 -3
  354. package/build-module/store/private-selectors.mjs.map +2 -2
  355. package/build-module/store/reducer.mjs.map +2 -2
  356. package/build-module/store/selectors.mjs.map +2 -2
  357. package/build-module/utils/get-font-styles-and-weights.mjs.map +2 -2
  358. package/build-module/utils/transform-styles/index.mjs.map +1 -1
  359. package/build-style/content-rtl.css +7 -2
  360. package/build-style/content.css +7 -2
  361. package/build-style/style-rtl.css +90 -25
  362. package/build-style/style.css +92 -25
  363. package/package.json +42 -43
  364. package/src/autocompleters/block.jsx +4 -4
  365. package/src/components/alignment-control/ui.jsx +1 -1
  366. package/src/components/background-image-control/index.jsx +3 -3
  367. package/src/components/block-alignment-control/test/index.jsdom.test.jsx +267 -0
  368. package/src/components/block-alignment-control/ui.jsx +47 -9
  369. package/src/components/block-alignment-control/use-available-alignments.js +106 -20
  370. package/src/components/block-allowed-blocks/allowed-blocks-control.jsx +1 -1
  371. package/src/components/block-bindings/attribute-control.jsx +27 -29
  372. package/src/components/block-bindings/source-fields-list.jsx +22 -32
  373. package/src/components/block-bindings/test/attribute-control.jsdom.test.jsx +115 -0
  374. package/src/components/block-canvas/index.jsx +1 -1
  375. package/src/components/block-card/index.jsx +5 -11
  376. package/src/components/block-card/style.scss +1 -0
  377. package/src/components/block-edit/edit.jsx +1 -1
  378. package/src/components/block-heading-level-dropdown/index.jsx +1 -1
  379. package/src/components/block-icon/index.jsx +1 -1
  380. package/src/components/block-icon/test/index.browser.test.jsx +74 -0
  381. package/src/components/block-inspector/edit-contents.jsx +2 -2
  382. package/src/components/block-inspector/index.jsx +46 -15
  383. package/src/components/block-inspector/style.scss +16 -0
  384. package/src/components/block-keyboard-shortcuts/index.jsx +2 -2
  385. package/src/components/block-list/block-html.jsx +2 -3
  386. package/src/components/block-list/block.jsx +7 -5
  387. package/src/components/block-list/content.scss +3 -2
  388. package/src/components/block-list/layout.jsx +4 -1
  389. package/src/components/block-list/test/layout.jsdom.test.js +40 -0
  390. package/src/components/block-list/use-block-props/index.js +1 -1
  391. package/src/components/block-lock/modal.jsx +2 -3
  392. package/src/components/block-lock/style.scss +1 -1
  393. package/src/components/block-mover/style.scss +0 -13
  394. package/src/components/block-parent-selector/index.jsx +12 -6
  395. package/src/components/block-patterns-list/style.scss +1 -1
  396. package/src/components/block-popover/index.jsx +1 -1
  397. package/src/components/block-rename/modal.jsx +3 -3
  398. package/src/components/block-settings-menu/block-settings-dropdown.jsx +1 -1
  399. package/src/components/block-styles/utils.js +1 -1
  400. package/src/components/block-switcher/index.jsx +3 -3
  401. package/src/components/block-toolbar/edit-section-button.jsx +2 -2
  402. package/src/components/block-toolbar/index.jsx +8 -4
  403. package/src/components/block-toolbar/switch-section-style.jsx +1 -1
  404. package/src/components/block-variation-transforms/index.jsx +24 -23
  405. package/src/components/block-variation-transforms/test/index.jsdom.test.jsx +93 -0
  406. package/src/components/block-visibility/modal.jsx +7 -7
  407. package/src/components/block-visibility/style.scss +1 -1
  408. package/src/components/block-visibility/viewport-visibility-info.jsx +5 -7
  409. package/src/components/border-radius-control/index.jsx +2 -2
  410. package/src/components/border-radius-control/test/index.jsdom.test.jsx +0 -22
  411. package/src/components/border-radius-control/test/select.browser.test.js +30 -0
  412. package/src/components/color-palette/with-color-context.jsx +1 -1
  413. package/src/components/colors/with-colors.jsx +1 -1
  414. package/src/components/colors-gradients/control.jsx +2 -2
  415. package/src/components/colors-gradients/test/{control.jsdom.test.jsx → control.browser.test.jsx} +6 -9
  416. package/src/components/contrast-checker/index.jsx +2 -2
  417. package/src/components/date-format-picker/index.jsx +2 -2
  418. package/src/components/dimensions-tool/aspect-ratio-tool.jsx +4 -4
  419. package/src/components/dimensions-tool/test/index.jsdom.test.jsx +17 -11
  420. package/src/components/dimensions-tool/width-height-tool.jsx +2 -2
  421. package/src/components/font-sizes/with-font-sizes.jsx +2 -3
  422. package/src/components/global-styles/background-panel.jsx +2 -2
  423. package/src/components/global-styles/border-panel.jsx +2 -2
  424. package/src/components/global-styles/color-gradient-dropdown-item.jsx +3 -3
  425. package/src/components/global-styles/color-panel.jsx +3 -3
  426. package/src/components/global-styles/dimensions-panel.jsx +6 -6
  427. package/src/components/global-styles/filters-panel.jsx +2 -2
  428. package/src/components/global-styles/hooks.js +1 -0
  429. package/src/components/global-styles/inheritance/index.jsx +9 -6
  430. package/src/components/global-styles/inheritance/test/{index.jsdom.test.jsx → index.browser.test.jsx} +34 -28
  431. package/src/components/global-styles/inherited-value-context.js +1 -9
  432. package/src/components/global-styles/state-control-badges.jsx +0 -1
  433. package/src/components/global-styles/state-control.jsx +12 -3
  434. package/src/components/global-styles/style.scss +68 -0
  435. package/src/components/global-styles/test/{color-panel.jsdom.test.jsx → color-panel.browser.test.jsx} +53 -54
  436. package/src/components/global-styles/test/inherited-value-context-core.jsdom.test.js +17 -26
  437. package/src/components/global-styles/test/{typography-panel-core.jsdom.test.jsx → typography-panel-core.browser.test.jsx} +84 -39
  438. package/src/components/global-styles/test/{typography-panel.jsdom.test.jsx → typography-panel.browser.test.jsx} +80 -122
  439. package/src/components/global-styles/text-shadow-panel.tsx +257 -0
  440. package/src/components/global-styles/typography-panel.jsx +52 -13
  441. package/src/components/global-styles/typography-utils.js +2 -2
  442. package/src/components/global-styles/utils.js +1 -1
  443. package/src/components/html-element-control/index.jsx +2 -2
  444. package/src/components/iframe/index.jsx +1 -1
  445. package/src/components/iframe/use-scale-canvas.js +1 -1
  446. package/src/components/image-size-control/index.jsx +2 -2
  447. package/src/components/inner-blocks/index.jsx +9 -1
  448. package/src/components/inner-content/index.jsx +1 -1
  449. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +7 -33
  450. package/src/components/inserter/block-patterns-tab/utils.js +44 -0
  451. package/src/components/inserter/hooks/use-block-types-state.js +2 -2
  452. package/src/components/inserter/hooks/use-insertion-point.js +1 -1
  453. package/src/components/inserter/hooks/use-patterns-state.js +1 -1
  454. package/src/components/inserter/media-tab/media-panel.jsx +9 -9
  455. package/src/components/inserter/media-tab/media-preview.jsx +1 -1
  456. package/src/components/inserter-list-item/index.jsx +1 -1
  457. package/src/components/inserter-list-item/style.scss +2 -2
  458. package/src/components/inspector-controls/list-view-content-popover.jsx +1 -1
  459. package/src/components/link-control/search-results.jsx +1 -1
  460. package/src/components/link-control/style.scss +1 -1
  461. package/src/components/link-control/test/index.jsdom.test.jsx +38 -110
  462. package/src/components/link-control/test/keyboard-selection.browser.test.js +110 -0
  463. package/src/components/link-control/use-search-handler.js +8 -3
  464. package/src/components/list-view/branch.jsx +1 -1
  465. package/src/components/list-view/drop-indicator.jsx +3 -3
  466. package/src/components/list-view/index.jsx +1 -1
  467. package/src/components/list-view/style.scss +1 -9
  468. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  469. package/src/components/list-view/utils.js +1 -1
  470. package/src/components/media-replace-flow/index.jsx +4 -1
  471. package/src/components/navigable-toolbar/test/index.browser.test.js +6 -7
  472. package/src/components/plain-text/README.md +3 -2
  473. package/src/components/plain-text/content.scss +0 -1
  474. package/src/components/plain-text/index.jsx +2 -3
  475. package/src/components/plain-text/style.scss +4 -0
  476. package/src/components/preset-input-control/index.jsx +2 -2
  477. package/src/components/preset-input-control/test/index.jsdom.test.jsx +0 -56
  478. package/src/components/preset-input-control/test/interaction.browser.test.js +63 -0
  479. package/src/components/provider/index.jsx +5 -3
  480. package/src/components/provider/use-block-sync.js +5 -5
  481. package/src/components/publish-date-time-picker/index.jsx +1 -1
  482. package/src/components/resizable-box-popover/index.jsx +1 -1
  483. package/src/components/resolution-tool/index.jsx +2 -2
  484. package/src/components/responsive-block-control/style.scss +1 -2
  485. package/src/components/responsive-block-control/test/index.jsdom.test.jsx +2 -2
  486. package/src/components/rich-text/event-listeners/enter.js +16 -23
  487. package/src/components/rich-text/format-edit.jsx +1 -1
  488. package/src/components/rich-text/index.jsx +39 -2
  489. package/src/components/rich-text/multiline.jsx +11 -3
  490. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  491. package/src/components/spacing-sizes-control/test/index.jsdom.test.jsx +0 -21
  492. package/src/components/spacing-sizes-control/test/select.browser.test.js +58 -0
  493. package/src/components/typewriter/index.jsx +1 -1
  494. package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +1 -1
  495. package/src/components/use-block-commands/index.js +1 -1
  496. package/src/components/use-block-drop-zone/test/index.js +2 -2
  497. package/src/components/writing-flow/index.jsx +8 -0
  498. package/src/components/writing-flow/use-clipboard-handler.js +1 -1
  499. package/src/components/writing-flow/use-selection-observer.js +15 -6
  500. package/src/content.scss +1 -0
  501. package/src/hooks/align.jsx +22 -6
  502. package/src/hooks/background.jsx +1 -1
  503. package/src/hooks/block-bindings.jsx +1 -1
  504. package/src/hooks/block-hooks.scss +0 -6
  505. package/src/hooks/border.jsx +2 -2
  506. package/src/hooks/contrast-checker.js +1 -1
  507. package/src/hooks/dimensions.jsx +2 -2
  508. package/src/hooks/duotone.jsx +3 -3
  509. package/src/hooks/elements.jsx +3 -3
  510. package/src/hooks/fit-text.jsx +1 -1
  511. package/src/hooks/gap.js +2 -4
  512. package/src/hooks/index.js +3 -1
  513. package/src/hooks/layout-child.jsx +3 -4
  514. package/src/hooks/layout.jsx +17 -18
  515. package/src/hooks/position.jsx +5 -36
  516. package/src/hooks/states.jsx +6 -2
  517. package/src/hooks/test/layout.jsdom.test.js +44 -1
  518. package/src/hooks/text-shadow.ts +105 -0
  519. package/src/hooks/typography.jsx +58 -30
  520. package/src/hooks/utils.jsx +23 -1
  521. package/src/layouts/grid.jsx +2 -2
  522. package/src/layouts/test/flex.jsdom.test.jsx +4 -3
  523. package/src/layouts/test/utils.js +48 -1
  524. package/src/layouts/utils.js +19 -0
  525. package/src/private-apis.js +4 -0
  526. package/src/store/actions.js +50 -10
  527. package/src/store/private-selectors.js +5 -5
  528. package/src/store/reducer.js +6 -6
  529. package/src/store/selectors.js +3 -3
  530. package/src/store/test/actions.jsdom.test.js +60 -0
  531. package/src/style.scss +1 -0
  532. package/src/utils/get-font-styles-and-weights.ts +1 -1
  533. package/src/utils/transform-styles/index.ts +1 -1
  534. package/build/hooks/cross-origin-isolation.cjs +0 -56
  535. package/build/hooks/cross-origin-isolation.cjs.map +0 -7
  536. package/build-module/hooks/cross-origin-isolation.mjs +0 -54
  537. package/build-module/hooks/cross-origin-isolation.mjs.map +0 -7
  538. package/src/components/block-icon/test/__snapshots__/index.jsdom.test.jsx.snap +0 -27
  539. package/src/components/block-icon/test/index.jsdom.test.jsx +0 -67
  540. package/src/hooks/cross-origin-isolation.js +0 -73
  541. package/src/hooks/test/cross-origin-isolation.jsdom.test.js +0 -173
package/src/content.scss CHANGED
@@ -12,5 +12,6 @@
12
12
  @use "./components/iframe/content.scss" as *;
13
13
  @use "./components/media-placeholder/content.scss" as *;
14
14
  @use "./components/plain-text/content.scss" as *;
15
+ @use "./components/plain-text/style.scss" as *;
15
16
  @use "./components/rich-text/content.scss" as *;
16
17
  @use "./components/warning/content.scss" as *;
@@ -6,7 +6,9 @@ import {
6
6
  hasBlockSupport,
7
7
  } from '@wordpress/blocks';
8
8
  import { BlockControls, BlockAlignmentControl } from '../components';
9
- import useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';
9
+ import useAvailableAlignments, {
10
+ useAlignmentMenu,
11
+ } from '../components/block-alignment-control/use-available-alignments';
10
12
  import { useBlockEditingMode } from '../components/block-editing-mode';
11
13
 
12
14
  /**
@@ -110,11 +112,18 @@ function BlockEditAlignmentToolbarControlsPure( {
110
112
  hasBlockSupport( blockName, 'alignWide', true )
111
113
  );
112
114
 
113
- const validAlignments = useAvailableAlignments(
114
- blockAllowedAlignments
115
- ).map( ( { name } ) => name );
115
+ const { enabled, unavailable } = useAlignmentMenu( blockAllowedAlignments );
116
116
  const blockEditingMode = useBlockEditingMode();
117
- if ( ! validAlignments.length || blockEditingMode !== 'default' ) {
117
+ /*
118
+ * Render whenever there is something to say, which includes having only
119
+ * unavailable alignments to report: a Group supports nothing but wide and
120
+ * full, so in a layout offering neither the control would otherwise vanish
121
+ * from the block most likely to want them.
122
+ */
123
+ if (
124
+ ( ! enabled.length && ! unavailable.length ) ||
125
+ blockEditingMode !== 'default'
126
+ ) {
118
127
  return null;
119
128
  }
120
129
 
@@ -134,7 +143,14 @@ function BlockEditAlignmentToolbarControlsPure( {
134
143
  <BlockAlignmentControl
135
144
  value={ align }
136
145
  onChange={ updateAlignment }
137
- controls={ validAlignments }
146
+ /*
147
+ * Pass the alignments the block itself supports rather than the
148
+ * ones the current layout leaves available. The control filters
149
+ * them again, but keeping the unfiltered list lets it tell the
150
+ * difference between an alignment this block never had and one a
151
+ * parent layout has taken away.
152
+ */
153
+ controls={ blockAllowedAlignments }
138
154
  />
139
155
  </BlockControls>
140
156
  );
@@ -219,7 +219,7 @@ export function BackgroundImagePanel( {
219
219
  ...style?.background,
220
220
  gradient: gradient
221
221
  ? 'var:preset|gradient|' + gradient
222
- : style?.background?.gradient ?? style?.color?.gradient,
222
+ : ( style?.background?.gradient ?? style?.color?.gradient ),
223
223
  },
224
224
  } ),
225
225
  };
@@ -26,7 +26,7 @@ const useToolsPanelDropdownMenuProps = () => {
26
26
  // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
27
27
  offset: 259,
28
28
  },
29
- }
29
+ }
30
30
  : {};
31
31
  };
32
32
 
@@ -2,7 +2,6 @@
2
2
  @use "@wordpress/base-styles/colors" as *;
3
3
 
4
4
  .block-editor-hooks__block-hooks {
5
-
6
5
  /**
7
6
  * Un-reverse the flex direction for the toggle's label.
8
7
  */
@@ -16,8 +15,3 @@
16
15
  margin-bottom: $grid-unit-20;
17
16
  }
18
17
  }
19
-
20
- .block-editor-hooks__position-control-item-hint {
21
- color: var(--wpds-color-foreground-content-neutral-weak);
22
- margin-block-start: $grid-unit-05;
23
- }
@@ -173,10 +173,10 @@ export function BorderPanel( { clientId, name, setAttributes, settings } ) {
173
173
  setAttributes( {
174
174
  style: setStyleForState( style, selectedState, newStyle ),
175
175
  } );
176
- }
176
+ }
177
177
  : ( newStyle ) => {
178
178
  setAttributes( styleToAttributes( newStyle ) );
179
- };
179
+ };
180
180
 
181
181
  if ( ! isEnabled ) {
182
182
  return null;
@@ -156,7 +156,7 @@ export default function useBlockColorContrastWarning( {
156
156
  linkColor: checkLinkColor ? colors.linkColor : undefined,
157
157
  messageOverride,
158
158
  enableAlphaChecker: true,
159
- } )
159
+ } )
160
160
  : null;
161
161
 
162
162
  // The popover Notice that displays this warning is muted
@@ -101,12 +101,12 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
101
101
  setAttributes( {
102
102
  style: setStyleForState( style, selectedState, newStyle ),
103
103
  } );
104
- }
104
+ }
105
105
  : ( newStyle ) => {
106
106
  setAttributes( {
107
107
  style: cleanEmptyObject( newStyle ),
108
108
  } );
109
- };
109
+ };
110
110
 
111
111
  if ( ! isEnabled ) {
112
112
  return null;
@@ -186,7 +186,7 @@ function DuotonePanelPure( { style, setAttributes, name, clientId } ) {
186
186
  : getDuotonePresetFromColors(
187
187
  newDuotone,
188
188
  duotonePalette
189
- );
189
+ );
190
190
 
191
191
  const newStyle = {
192
192
  ...style,
@@ -301,7 +301,7 @@ function useDuotoneStyles( {
301
301
  ? getDuotoneStylesheet( selector, filterId )
302
302
  : getDuotoneUnsetStylesheet( selector ),
303
303
  __unstableType: 'presets',
304
- }
304
+ }
305
305
  : undefined
306
306
  );
307
307
  usePrivateStyleOverride(
@@ -312,7 +312,7 @@ function useDuotoneStyles( {
312
312
  ? getDuotoneFilter( filterId, colors )
313
313
  : '',
314
314
  __unstableType: 'svgs',
315
- }
315
+ }
316
316
  : undefined
317
317
  );
318
318
 
@@ -88,10 +88,10 @@ export function ElementsEdit( {
88
88
  setAttributes( {
89
89
  style: setStyleForState( style, selectedState, newStyle ),
90
90
  } );
91
- }
91
+ }
92
92
  : ( newStyle ) => {
93
93
  setAttributes( { style: cleanEmptyObject( newStyle ) } );
94
- };
94
+ };
95
95
 
96
96
  // Text and background color failures are reported by the Typography and
97
97
  // Background panels, which own those selections.
@@ -123,7 +123,7 @@ export function ElementsEdit( {
123
123
  : getBlockSupport( name, [
124
124
  COLOR_SUPPORT_KEY,
125
125
  '__experimentalDefaultControls',
126
- ] );
126
+ ] );
127
127
 
128
128
  const Wrapper = asWrapper || ElementsInspectorControl;
129
129
 
@@ -297,7 +297,7 @@ export function FitTextControl( {
297
297
  ? __( 'Text will resize to fit its container.' )
298
298
  : __(
299
299
  'The text will resize to fit its container, resetting other font size settings.'
300
- )
300
+ )
301
301
  }
302
302
  />
303
303
  </ToolsPanelItem>
package/src/hooks/gap.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils';
2
+ import { normalizeLegacyLayout } from '../layouts/utils';
2
3
 
3
4
  /**
4
5
  * Returns whether the current layout can use separate row and column gaps.
@@ -8,10 +9,7 @@ import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/util
8
9
  * @return {boolean} Whether axial block gap controls should be available.
9
10
  */
10
11
  export function isAxialBlockGapAllowed( layout, defaultLayout ) {
11
- const usedLayout =
12
- layout?.inherit || layout?.contentSize || layout?.wideSize
13
- ? { ...layout, type: 'constrained' }
14
- : layout || defaultLayout || {};
12
+ const usedLayout = normalizeLegacyLayout( layout ) || defaultLayout || {};
15
13
 
16
14
  return [ 'flex', 'grid' ].includes( usedLayout?.type );
17
15
  }
@@ -4,7 +4,6 @@ import {
4
4
  createBlockSaveFilter,
5
5
  } from './utils';
6
6
  import './compat';
7
- import './cross-origin-isolation';
8
7
  import align from './align';
9
8
  import background from './background';
10
9
  import './lock';
@@ -21,6 +20,7 @@ import duotone from './duotone';
21
20
  import fontFamily from './font-family';
22
21
  import fontSize from './font-size';
23
22
  import textAlign from './text-align';
23
+ import textShadow from './text-shadow';
24
24
  import fitText from './fit-text';
25
25
  import border from './border';
26
26
  import customCSS from './custom-css';
@@ -66,6 +66,7 @@ createBlockListBlockFilter( [
66
66
  duotone,
67
67
  fontFamily,
68
68
  fontSize,
69
+ textShadow,
69
70
  fitText,
70
71
  border,
71
72
  customCSS,
@@ -86,6 +87,7 @@ createBlockSaveFilter( [
86
87
  style,
87
88
  fontFamily,
88
89
  fontSize,
90
+ textShadow,
89
91
  ] );
90
92
 
91
93
  export { useCustomSides } from './dimensions';
@@ -65,7 +65,7 @@ export function getChildLayoutStyleRules( {
65
65
  ? {
66
66
  ...layout,
67
67
  ...viewportOverrides,
68
- }
68
+ }
69
69
  : layout;
70
70
  const hasViewportOverride = ( key ) =>
71
71
  Object.hasOwn( viewportOverrides || {}, key );
@@ -121,9 +121,8 @@ export function getChildLayoutStyleRules( {
121
121
  hasViewportOverride( 'columnSpan' )
122
122
  ) {
123
123
  if ( columnStart && columnSpan ) {
124
- declarations[
125
- 'grid-column'
126
- ] = `${ columnStart } / span ${ columnSpan }`;
124
+ declarations[ 'grid-column' ] =
125
+ `${ columnStart } / span ${ columnSpan }`;
127
126
  } else if ( columnStart ) {
128
127
  declarations[ 'grid-column' ] = `${ columnStart }`;
129
128
  } else if ( columnSpan ) {
@@ -23,6 +23,7 @@ import { useSettings } from '../components/use-settings';
23
23
  import { getLayoutType, getLayoutTypes } from '../layouts';
24
24
  import { useBlockEditingMode } from '../components/block-editing-mode';
25
25
  import { LAYOUT_DEFINITIONS } from '../layouts/definitions';
26
+ import { normalizeLegacyLayout } from '../layouts/utils';
26
27
  import { cleanEmptyObject, useBlockSettings, useStyleOverride } from './utils';
27
28
  import { unlock } from '../lock-unlock';
28
29
  import { globalStylesDataKey } from '../store/private-keys';
@@ -162,9 +163,7 @@ export function useLayoutClasses( blockAttributes = {}, blockName = '' ) {
162
163
  const { default: defaultBlockLayout } =
163
164
  getBlockSupport( blockName, layoutBlockSupportKey ) || {};
164
165
  const usedLayout =
165
- layout?.inherit || layout?.contentSize || layout?.wideSize
166
- ? { ...layout, type: 'constrained' }
167
- : layout || defaultBlockLayout || {};
166
+ normalizeLegacyLayout( layout ) || defaultBlockLayout || {};
168
167
 
169
168
  const layoutClassnames = [];
170
169
 
@@ -231,14 +230,13 @@ export function useLayoutClasses( blockAttributes = {}, blockName = '' ) {
231
230
  */
232
231
  export function useLayoutStyles( blockAttributes = {}, blockName, selector ) {
233
232
  const { layout = {}, style = {} } = blockAttributes;
234
- // Update type for blocks using legacy layouts.
235
- const usedLayout =
236
- layout?.inherit || layout?.contentSize || layout?.wideSize
237
- ? { ...layout, type: 'constrained' }
238
- : layout || {};
233
+ const usedLayout = normalizeLegacyLayout( layout ) || {};
239
234
  const fullLayoutType = getLayoutType( usedLayout?.type || 'default' );
240
235
  const [ blockGapSupport ] = useSettings( 'spacing.blockGap' );
241
- const hasBlockGapSupport = blockGapSupport !== null;
236
+ // Like the server's `isset()` check, an unset or `null` setting means the
237
+ // theme has not opted into block gap.
238
+ const hasBlockGapSupport =
239
+ blockGapSupport !== null && blockGapSupport !== undefined;
242
240
  return fullLayoutType?.getLayoutStyle?.( {
243
241
  blockName,
244
242
  selector,
@@ -444,7 +442,7 @@ function LayoutPanelPure( {
444
442
  ? cleanEmptyObject( {
445
443
  ...baseLayout,
446
444
  ...stateLayout,
447
- } ) || {}
445
+ } ) || {}
448
446
  : baseLayout;
449
447
  const resetLayoutDefaults = isViewportLayoutState
450
448
  ? baseLayout
@@ -524,7 +522,7 @@ function LayoutPanelPure( {
524
522
  const hasInheritToggleValue = () =>
525
523
  isViewportLayoutState
526
524
  ? ( usedLayout?.type ?? 'default' ) !==
527
- ( resetLayoutDefaults?.type ?? 'default' )
525
+ ( resetLayoutDefaults?.type ?? 'default' )
528
526
  : layout?.type === 'constrained';
529
527
  const hasLayoutTypeValue = () =>
530
528
  ( usedLayout?.type ?? 'default' ) !==
@@ -559,10 +557,10 @@ function LayoutPanelPure( {
559
557
  isUsingContentWidth()
560
558
  ? __(
561
559
  'Nested blocks use content width with options for full and wide widths.'
562
- )
560
+ )
563
561
  : __(
564
562
  'Nested blocks will fill the width of this container.'
565
- )
563
+ )
566
564
  }
567
565
  />
568
566
  </ToolsPanelItem>
@@ -696,14 +694,15 @@ function BlockWithLayoutStyles( {
696
694
  const { default: defaultBlockLayout } =
697
695
  getBlockSupport( name, layoutBlockSupportKey ) || {};
698
696
  const usedLayout =
699
- layout?.inherit || layout?.contentSize || layout?.wideSize
700
- ? { ...layout, type: 'constrained' }
701
- : layout || defaultBlockLayout || {};
697
+ normalizeLegacyLayout( layout ) || defaultBlockLayout || {};
702
698
 
703
699
  const selectorPrefix = `wp-container-${ kebabCase( name ) }-is-layout-`;
704
700
  // Higher specificity to override defaults from theme.json.
705
701
  const selector = `.${ selectorPrefix }${ id }`;
706
- const hasBlockGapSupport = blockGapSupport !== null;
702
+ // Like the server's `isset()` check, an unset or `null` setting means the
703
+ // theme has not opted into block gap.
704
+ const hasBlockGapSupport =
705
+ blockGapSupport !== null && blockGapSupport !== undefined;
707
706
 
708
707
  // Get CSS string for the current layout type.
709
708
  // The CSS and `style` element is only output if it is not empty.
@@ -800,7 +799,7 @@ export const withLayoutStyles = createHigherOrderComponent(
800
799
  variationBlockGapValue = variationName
801
800
  ? globalStyles?.blocks?.[ name ]?.variations?.[
802
801
  variationName
803
- ]?.spacing?.blockGap
802
+ ]?.spacing?.blockGap
804
803
  : undefined;
805
804
  }
806
805
 
@@ -3,8 +3,7 @@ import { __, _x, sprintf } from '@wordpress/i18n';
3
3
  import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
4
4
  import { useInstanceId } from '@wordpress/compose';
5
5
  import { useSelect } from '@wordpress/data';
6
- import { useId, useMemo } from '@wordpress/element';
7
- // eslint-disable-next-line @wordpress/use-recommended-components -- Use the portal-based popup to avoid inspector clipping.
6
+ import { useMemo } from '@wordpress/element';
8
7
  import { SelectControl } from '@wordpress/ui';
9
8
  import { useSettings } from '../components/use-settings';
10
9
  import InspectorControls from '../components/inspector-controls';
@@ -15,25 +14,22 @@ import { store as blockEditorStore } from '../store';
15
14
  const POSITION_SUPPORT_KEY = 'position';
16
15
 
17
16
  const DEFAULT_OPTION = {
18
- key: 'default',
19
17
  value: '',
20
18
  label: __( 'Default' ),
21
19
  };
22
20
 
23
21
  const STICKY_OPTION = {
24
- key: 'sticky',
25
22
  value: 'sticky',
26
23
  label: _x( 'Sticky', 'Name for the value of the CSS position property' ),
27
- hint: __(
24
+ description: __(
28
25
  'The block will stick to the top of the window instead of scrolling.'
29
26
  ),
30
27
  };
31
28
 
32
29
  const FIXED_OPTION = {
33
- key: 'fixed',
34
30
  value: 'fixed',
35
31
  label: _x( 'Fixed', 'Name for the value of the CSS position property' ),
36
- hint: __( 'The block will not move when the page is scrolled.' ),
32
+ description: __( 'The block will not move when the page is scrolled.' ),
37
33
  };
38
34
 
39
35
  const POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];
@@ -210,7 +206,7 @@ export function PositionPanelPure( {
210
206
  'The block will stick to the scrollable area of the parent %s block.'
211
207
  ),
212
208
  blockInformation.title
213
- )
209
+ )
214
210
  : null;
215
211
 
216
212
  const options = useMemo( () => {
@@ -252,7 +248,6 @@ export function PositionPanelPure( {
252
248
  const selectedOption = value
253
249
  ? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION
254
250
  : DEFAULT_OPTION;
255
- const hintIdPrefix = useId();
256
251
 
257
252
  // Only display position controls if there is at least one option to choose from.
258
253
  return options.length > 1 ? (
@@ -267,33 +262,7 @@ export function PositionPanelPure( {
267
262
  onValueChange={ ( selectedItem ) => {
268
263
  onChangeType( selectedItem.value );
269
264
  } }
270
- >
271
- { options.map( ( option ) => {
272
- const hintId = option.hint
273
- ? `${ hintIdPrefix }-${ option.key }`
274
- : undefined;
275
-
276
- return (
277
- <SelectControl.Item
278
- key={ option.key }
279
- value={ option }
280
- label={ option.label }
281
- aria-describedby={ hintId }
282
- >
283
- <div>{ option.label }</div>
284
- { option.hint && (
285
- <div
286
- id={ hintId }
287
- className="block-editor-hooks__position-control-item-hint"
288
- aria-hidden="true"
289
- >
290
- { option.hint }
291
- </div>
292
- ) }
293
- </SelectControl.Item>
294
- );
295
- } ) }
296
- </SelectControl>
265
+ />
297
266
  </InspectorControls>
298
267
  ) : null;
299
268
  }
@@ -71,9 +71,11 @@ const EMPTY_STATE_OPTIONS = [];
71
71
  * @param {string} props.name Block name.
72
72
  * @param {Object} props.value Currently selected style-state value.
73
73
  * @param {Function} props.onChange Callback when style-state selection changes.
74
+ * @param {Element} props.children Optional menu content rendered after the
75
+ * state groups.
74
76
  * @return {Element|null} State control component, or null if not applicable.
75
77
  */
76
- export function BlockStatesControl( { name, value, onChange } ) {
78
+ export function BlockStatesControl( { name, value, onChange, children } ) {
77
79
  const pseudoStateOptions = useMemo(
78
80
  () => getPseudoStateOptions( name ),
79
81
  [ name ]
@@ -91,7 +93,9 @@ export function BlockStatesControl( { name, value, onChange } ) {
91
93
  onChangePseudoState={ ( pseudo ) => onChange( { pseudo } ) }
92
94
  popoverProps={ dropdownMenuProps.popoverProps }
93
95
  showText={ false }
94
- />
96
+ >
97
+ { children }
98
+ </StateControl>
95
99
  );
96
100
  }
97
101
 
@@ -1,13 +1,56 @@
1
- import { describe, expect, it } from 'vitest';
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { renderHook } from '@testing-library/react';
2
3
  import {
3
4
  getLayoutStateOverrides,
4
5
  getResetLayout,
5
6
  getResponsiveLayoutStyles,
6
7
  hasLayoutPanelControls,
8
+ useLayoutStyles,
7
9
  } from '../layout';
8
10
  import { getLayoutType } from '../../layouts';
11
+ import { useSettings } from '../../components/use-settings';
12
+
13
+ vi.mock(
14
+ import( '../../components/use-settings' ),
15
+ async ( importOriginal ) => ( {
16
+ ...( await importOriginal() ),
17
+ useSettings: vi.fn(),
18
+ } )
19
+ );
9
20
 
10
21
  describe( 'layout', () => {
22
+ describe( 'useLayoutStyles()', () => {
23
+ const attributes = {
24
+ layout: { type: 'flex' },
25
+ style: { spacing: { blockGap: '10px' } },
26
+ };
27
+
28
+ it.each( [ null, undefined ] )(
29
+ 'outputs no layout styles when the block gap setting is %s',
30
+ ( blockGapSetting ) => {
31
+ useSettings.mockReturnValue( [ blockGapSetting ] );
32
+
33
+ const { result } = renderHook( () =>
34
+ useLayoutStyles( attributes, 'test/block', '.my-container' )
35
+ );
36
+
37
+ expect( result.current ).toBe( '' );
38
+ }
39
+ );
40
+
41
+ it( 'outputs block gap styles when the theme opts into block gap', () => {
42
+ useSettings.mockReturnValue( [ true ] );
43
+
44
+ const { result } = renderHook( () =>
45
+ useLayoutStyles( attributes, 'test/block', '.my-container' )
46
+ );
47
+
48
+ expect( result.current ).toContain(
49
+ '.my-container { gap: 10px; }'
50
+ );
51
+ } );
52
+ } );
53
+
11
54
  describe( 'hasLayoutPanelControls()', () => {
12
55
  it( 'does not show the layout panel when every flex layout control is disabled', () => {
13
56
  expect(
@@ -0,0 +1,105 @@
1
+ import { addFilter } from '@wordpress/hooks';
2
+ import { hasBlockSupport } from '@wordpress/blocks';
3
+ import type { BlockType } from '@wordpress/blocks';
4
+ import TokenList from '@wordpress/token-list';
5
+ import { kebabCase } from '@wordpress/kebab-case';
6
+ import { shouldSkipSerialization } from './utils';
7
+ import { TYPOGRAPHY_SUPPORT_KEY } from './typography';
8
+
9
+ export const TEXT_SHADOW_SUPPORT_KEY = 'typography.textShadow';
10
+
11
+ interface TextShadowAttributes {
12
+ textShadow?: string;
13
+ }
14
+
15
+ interface SaveProps {
16
+ className?: string;
17
+ [ key: string ]: unknown;
18
+ }
19
+
20
+ /**
21
+ * Filters registered block settings, extending attributes to include
22
+ * the `textShadow` attribute.
23
+ *
24
+ * @param settings Original block settings.
25
+ * @return Filtered block settings.
26
+ */
27
+ function addAttributes( settings: BlockType ) {
28
+ if ( ! hasBlockSupport( settings, TEXT_SHADOW_SUPPORT_KEY ) ) {
29
+ return settings;
30
+ }
31
+
32
+ // Allow blocks to specify a default value if needed.
33
+ if ( ! settings.attributes.textShadow ) {
34
+ Object.assign( settings.attributes, {
35
+ textShadow: {
36
+ type: 'string',
37
+ },
38
+ } );
39
+ }
40
+
41
+ return settings;
42
+ }
43
+
44
+ /**
45
+ * Override props assigned to save component to inject the text shadow preset
46
+ * class name.
47
+ *
48
+ * @param props Additional props applied to save element.
49
+ * @param blockType Block type.
50
+ * @param attributes Block attributes.
51
+ * @return Filtered props applied to save element.
52
+ */
53
+ function addSaveProps(
54
+ props: SaveProps,
55
+ blockType: string | BlockType,
56
+ attributes: TextShadowAttributes | undefined
57
+ ) {
58
+ if ( ! hasBlockSupport( blockType, TEXT_SHADOW_SUPPORT_KEY ) ) {
59
+ return props;
60
+ }
61
+
62
+ if (
63
+ shouldSkipSerialization(
64
+ blockType,
65
+ TYPOGRAPHY_SUPPORT_KEY,
66
+ 'textShadow'
67
+ )
68
+ ) {
69
+ return props;
70
+ }
71
+
72
+ if ( ! attributes?.textShadow ) {
73
+ return props;
74
+ }
75
+
76
+ // Use TokenList to dedupe classes.
77
+ const classes = new TokenList( props.className );
78
+ classes.add( `has-${ kebabCase( attributes.textShadow ) }-text-shadow` );
79
+ const newClassName = classes.value;
80
+ props.className = newClassName ? newClassName : undefined;
81
+
82
+ return props;
83
+ }
84
+
85
+ function useBlockProps( {
86
+ name,
87
+ textShadow,
88
+ }: TextShadowAttributes & { name: string } ) {
89
+ return addSaveProps( {}, name, { textShadow } );
90
+ }
91
+
92
+ export default {
93
+ useBlockProps,
94
+ addSaveProps,
95
+ attributeKeys: [ 'textShadow' ],
96
+ hasSupport( name: string ) {
97
+ return hasBlockSupport( name, TEXT_SHADOW_SUPPORT_KEY );
98
+ },
99
+ };
100
+
101
+ addFilter(
102
+ 'blocks.registerBlockType',
103
+ 'core/textShadow/addAttribute',
104
+ addAttributes
105
+ );