@wordpress/block-editor 15.21.1 → 15.22.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 (490) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +2 -2
  3. package/build/components/block-card/index.cjs +4 -5
  4. package/build/components/block-card/index.cjs.map +2 -2
  5. package/build/components/block-editing-mode/index.cjs +13 -7
  6. package/build/components/block-editing-mode/index.cjs.map +2 -2
  7. package/build/components/block-inspector/index.cjs +35 -20
  8. package/build/components/block-inspector/index.cjs.map +2 -2
  9. package/build/components/block-mover/mover-description.cjs +6 -6
  10. package/build/components/block-mover/mover-description.cjs.map +1 -1
  11. package/build/components/block-patterns-list/index.cjs.map +2 -2
  12. package/build/components/block-patterns-paging/index.cjs +4 -4
  13. package/build/components/block-patterns-paging/index.cjs.map +2 -2
  14. package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
  15. package/build/components/block-quick-navigation/index.cjs +7 -5
  16. package/build/components/block-quick-navigation/index.cjs.map +2 -2
  17. package/build/components/block-rename/modal.cjs +0 -1
  18. package/build/components/block-rename/modal.cjs.map +2 -2
  19. package/build/components/block-toolbar/block-toolbar-icon.cjs +14 -6
  20. package/build/components/block-toolbar/block-toolbar-icon.cjs.map +2 -2
  21. package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
  22. package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
  23. package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
  24. package/build/components/child-layout-control/index.cjs +51 -19
  25. package/build/components/child-layout-control/index.cjs.map +2 -2
  26. package/build/components/colors-gradients/control.cjs +25 -14
  27. package/build/components/colors-gradients/control.cjs.map +2 -2
  28. package/build/components/colors-gradients/dropdown.cjs +4 -1
  29. package/build/components/colors-gradients/dropdown.cjs.map +3 -3
  30. package/build/components/contrast-checker/index.cjs +22 -4
  31. package/build/components/contrast-checker/index.cjs.map +2 -2
  32. package/build/components/date-format-picker/index.cjs +0 -1
  33. package/build/components/date-format-picker/index.cjs.map +2 -2
  34. package/build/components/dimensions-tool/index.cjs +4 -5
  35. package/build/components/dimensions-tool/index.cjs.map +2 -2
  36. package/build/components/dimensions-tool/scale-tool.cjs +1 -1
  37. package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
  38. package/build/components/global-styles/background-panel.cjs +153 -25
  39. package/build/components/global-styles/background-panel.cjs.map +3 -3
  40. package/build/components/global-styles/color-gradient-dropdown-item.cjs +227 -0
  41. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +7 -0
  42. package/build/components/global-styles/color-panel.cjs +98 -375
  43. package/build/components/global-styles/color-panel.cjs.map +3 -3
  44. package/build/components/global-styles/dimensions-panel.cjs +1 -4
  45. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  46. package/build/components/global-styles/hooks.cjs +34 -0
  47. package/build/components/global-styles/hooks.cjs.map +2 -2
  48. package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
  49. package/build/components/global-styles/typography-panel.cjs +82 -10
  50. package/build/components/global-styles/typography-panel.cjs.map +3 -3
  51. package/build/components/grid/grid-item-resizer.cjs.map +1 -1
  52. package/build/components/grid/grid-visualizer.cjs.map +1 -1
  53. package/build/components/iframe/index.cjs +6 -3
  54. package/build/components/iframe/index.cjs.map +3 -3
  55. package/build/components/image-editor/use-transform-image.cjs.map +1 -1
  56. package/build/components/inserter/get-appender-label.cjs.map +1 -1
  57. package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
  58. package/build/components/inserter/search-items.cjs.map +1 -1
  59. package/build/components/inspector-controls/fill.cjs +1 -3
  60. package/build/components/inspector-controls/fill.cjs.map +2 -2
  61. package/build/components/inspector-controls/groups.cjs +2 -0
  62. package/build/components/inspector-controls/groups.cjs.map +2 -2
  63. package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
  64. package/build/components/inspector-controls-tabs/styles-tab.cjs +76 -32
  65. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  66. package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
  67. package/build/components/line-height-control/index.cjs.map +1 -1
  68. package/build/components/link-control/index.cjs +2 -3
  69. package/build/components/link-control/index.cjs.map +2 -2
  70. package/build/components/link-control/normalize-url.cjs.map +1 -1
  71. package/build/components/list-view/block-select-button.cjs +1 -10
  72. package/build/components/list-view/block-select-button.cjs.map +3 -3
  73. package/build/components/list-view/utils.cjs.map +1 -1
  74. package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
  75. package/build/components/provider/index.cjs.map +1 -1
  76. package/build/components/provider/use-block-sync.cjs +3 -1
  77. package/build/components/provider/use-block-sync.cjs.map +2 -2
  78. package/build/components/rich-text/event-listeners/before-input-rules.cjs +1 -1
  79. package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +2 -2
  80. package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
  81. package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
  82. package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
  83. package/build/components/url-popover/image-url-input-ui.cjs +0 -2
  84. package/build/components/url-popover/image-url-input-ui.cjs.map +2 -2
  85. package/build/components/use-block-display-information/index.cjs +10 -3
  86. package/build/components/use-block-display-information/index.cjs.map +2 -2
  87. package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
  88. package/build/hooks/anchor.cjs +1 -2
  89. package/build/hooks/anchor.cjs.map +2 -2
  90. package/build/hooks/background.cjs +124 -75
  91. package/build/hooks/background.cjs.map +3 -3
  92. package/build/hooks/block-fields/index.cjs +13 -2
  93. package/build/hooks/block-fields/index.cjs.map +2 -2
  94. package/build/hooks/color.cjs +0 -162
  95. package/build/hooks/color.cjs.map +3 -3
  96. package/build/hooks/contrast-checker.cjs +31 -28
  97. package/build/hooks/contrast-checker.cjs.map +3 -3
  98. package/build/hooks/custom-class-name.cjs +0 -1
  99. package/build/hooks/custom-class-name.cjs.map +2 -2
  100. package/build/hooks/dimensions.cjs +13 -2
  101. package/build/hooks/dimensions.cjs.map +2 -2
  102. package/build/hooks/elements.cjs +142 -0
  103. package/build/hooks/elements.cjs.map +7 -0
  104. package/build/hooks/grid-visualizer.cjs +21 -11
  105. package/build/hooks/grid-visualizer.cjs.map +2 -2
  106. package/build/hooks/layout-child.cjs +65 -10
  107. package/build/hooks/layout-child.cjs.map +2 -2
  108. package/build/hooks/layout.cjs +6 -3
  109. package/build/hooks/layout.cjs.map +2 -2
  110. package/build/hooks/list-view.cjs +10 -7
  111. package/build/hooks/list-view.cjs.map +2 -2
  112. package/build/hooks/spacing-visualizer.cjs.map +1 -1
  113. package/build/hooks/state-utils.cjs.map +1 -1
  114. package/build/hooks/states.cjs +2 -2
  115. package/build/hooks/states.cjs.map +2 -2
  116. package/build/hooks/style.cjs +50 -6
  117. package/build/hooks/style.cjs.map +2 -2
  118. package/build/hooks/typography.cjs +62 -10
  119. package/build/hooks/typography.cjs.map +3 -3
  120. package/build/layouts/flex.cjs +99 -6
  121. package/build/layouts/flex.cjs.map +2 -2
  122. package/build/private-apis.cjs +4 -0
  123. package/build/private-apis.cjs.map +2 -2
  124. package/build/store/actions.cjs.map +1 -1
  125. package/build/store/private-selectors.cjs +19 -2
  126. package/build/store/private-selectors.cjs.map +2 -2
  127. package/build/store/reducer.cjs.map +1 -1
  128. package/build/store/selectors.cjs.map +1 -1
  129. package/build/utils/block-bindings.cjs +9 -9
  130. package/build/utils/block-bindings.cjs.map +3 -3
  131. package/build/utils/color-values.cjs +10 -1
  132. package/build/utils/color-values.cjs.map +3 -3
  133. package/build/utils/dom.cjs +2 -5
  134. package/build/utils/dom.cjs.map +3 -3
  135. package/build/utils/fit-text-frontend.cjs +6 -2
  136. package/build/utils/fit-text-frontend.cjs.map +3 -3
  137. package/build/utils/fit-text-utils.cjs +1 -1
  138. package/build/utils/fit-text-utils.cjs.map +3 -3
  139. package/build/utils/format-font-style.cjs +1 -1
  140. package/build/utils/format-font-style.cjs.map +3 -3
  141. package/build/utils/format-font-weight.cjs +1 -1
  142. package/build/utils/format-font-weight.cjs.map +3 -3
  143. package/build/utils/get-editor-region.cjs +4 -2
  144. package/build/utils/get-editor-region.cjs.map +3 -3
  145. package/build/utils/get-font-styles-and-weights.cjs +8 -12
  146. package/build/utils/get-font-styles-and-weights.cjs.map +3 -3
  147. package/build/utils/get-px-from-css-unit.cjs +1 -1
  148. package/build/utils/get-px-from-css-unit.cjs.map +1 -1
  149. package/build/utils/index.cjs +1 -1
  150. package/build/utils/index.cjs.map +1 -1
  151. package/build/utils/math.cjs +1 -1
  152. package/build/utils/math.cjs.map +3 -3
  153. package/build/utils/object.cjs +8 -8
  154. package/build/utils/object.cjs.map +3 -3
  155. package/build/utils/order-inserter-block-items.cjs +1 -1
  156. package/build/utils/order-inserter-block-items.cjs.map +3 -3
  157. package/build/utils/pasting.cjs +4 -2
  158. package/build/utils/pasting.cjs.map +3 -3
  159. package/build/utils/selection.cjs +3 -2
  160. package/build/utils/selection.cjs.map +3 -3
  161. package/build/utils/sorting.cjs +9 -3
  162. package/build/utils/sorting.cjs.map +3 -3
  163. package/build/utils/transform-styles/index.cjs +3 -2
  164. package/build/utils/transform-styles/index.cjs.map +3 -3
  165. package/build/utils/transform-styles/postcss-urlrebase.d.cjs +2 -0
  166. package/build/utils/transform-styles/postcss-urlrebase.d.cjs.map +7 -0
  167. package/build/utils/transform-styles/types.cjs +19 -0
  168. package/build/utils/transform-styles/types.cjs.map +7 -0
  169. package/build/utils/types.cjs +19 -0
  170. package/build/utils/types.cjs.map +7 -0
  171. package/build-module/components/block-card/index.mjs +5 -6
  172. package/build-module/components/block-card/index.mjs.map +2 -2
  173. package/build-module/components/block-editing-mode/index.mjs +14 -8
  174. package/build-module/components/block-editing-mode/index.mjs.map +2 -2
  175. package/build-module/components/block-inspector/index.mjs +35 -21
  176. package/build-module/components/block-inspector/index.mjs.map +2 -2
  177. package/build-module/components/block-mover/mover-description.mjs +6 -6
  178. package/build-module/components/block-mover/mover-description.mjs.map +1 -1
  179. package/build-module/components/block-patterns-list/index.mjs.map +2 -2
  180. package/build-module/components/block-patterns-paging/index.mjs +4 -4
  181. package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
  182. package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
  183. package/build-module/components/block-quick-navigation/index.mjs +8 -6
  184. package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
  185. package/build-module/components/block-rename/modal.mjs +0 -1
  186. package/build-module/components/block-rename/modal.mjs.map +2 -2
  187. package/build-module/components/block-toolbar/block-toolbar-icon.mjs +14 -6
  188. package/build-module/components/block-toolbar/block-toolbar-icon.mjs.map +2 -2
  189. package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
  190. package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
  191. package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
  192. package/build-module/components/child-layout-control/index.mjs +51 -19
  193. package/build-module/components/child-layout-control/index.mjs.map +2 -2
  194. package/build-module/components/colors-gradients/control.mjs +27 -15
  195. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  196. package/build-module/components/colors-gradients/dropdown.mjs +4 -1
  197. package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
  198. package/build-module/components/contrast-checker/index.mjs +18 -4
  199. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  200. package/build-module/components/date-format-picker/index.mjs +0 -1
  201. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  202. package/build-module/components/dimensions-tool/index.mjs +4 -5
  203. package/build-module/components/dimensions-tool/index.mjs.map +2 -2
  204. package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
  205. package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
  206. package/build-module/components/global-styles/background-panel.mjs +155 -27
  207. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  208. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +207 -0
  209. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +7 -0
  210. package/build-module/components/global-styles/color-panel.mjs +106 -387
  211. package/build-module/components/global-styles/color-panel.mjs.map +3 -3
  212. package/build-module/components/global-styles/dimensions-panel.mjs +1 -5
  213. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  214. package/build-module/components/global-styles/hooks.mjs +33 -0
  215. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  216. package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
  217. package/build-module/components/global-styles/typography-panel.mjs +84 -10
  218. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  219. package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
  220. package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
  221. package/build-module/components/iframe/index.mjs +6 -3
  222. package/build-module/components/iframe/index.mjs.map +2 -2
  223. package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
  224. package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
  225. package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
  226. package/build-module/components/inserter/search-items.mjs.map +1 -1
  227. package/build-module/components/inspector-controls/fill.mjs +1 -3
  228. package/build-module/components/inspector-controls/fill.mjs.map +2 -2
  229. package/build-module/components/inspector-controls/groups.mjs +2 -0
  230. package/build-module/components/inspector-controls/groups.mjs.map +2 -2
  231. package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
  232. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +76 -32
  233. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  234. package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
  235. package/build-module/components/line-height-control/index.mjs.map +1 -1
  236. package/build-module/components/link-control/index.mjs +2 -3
  237. package/build-module/components/link-control/index.mjs.map +2 -2
  238. package/build-module/components/link-control/normalize-url.mjs.map +1 -1
  239. package/build-module/components/list-view/block-select-button.mjs +2 -17
  240. package/build-module/components/list-view/block-select-button.mjs.map +2 -2
  241. package/build-module/components/list-view/utils.mjs.map +1 -1
  242. package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
  243. package/build-module/components/provider/index.mjs.map +1 -1
  244. package/build-module/components/provider/use-block-sync.mjs +3 -1
  245. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  246. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +1 -1
  247. package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
  248. package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
  249. package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
  250. package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
  251. package/build-module/components/url-popover/image-url-input-ui.mjs +0 -2
  252. package/build-module/components/url-popover/image-url-input-ui.mjs.map +2 -2
  253. package/build-module/components/use-block-display-information/index.mjs +10 -3
  254. package/build-module/components/use-block-display-information/index.mjs.map +2 -2
  255. package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
  256. package/build-module/hooks/anchor.mjs +1 -2
  257. package/build-module/hooks/anchor.mjs.map +2 -2
  258. package/build-module/hooks/background.mjs +123 -75
  259. package/build-module/hooks/background.mjs.map +2 -2
  260. package/build-module/hooks/block-fields/index.mjs +13 -2
  261. package/build-module/hooks/block-fields/index.mjs.map +2 -2
  262. package/build-module/hooks/color.mjs +2 -175
  263. package/build-module/hooks/color.mjs.map +2 -2
  264. package/build-module/hooks/contrast-checker.mjs +32 -19
  265. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  266. package/build-module/hooks/custom-class-name.mjs +0 -1
  267. package/build-module/hooks/custom-class-name.mjs.map +2 -2
  268. package/build-module/hooks/dimensions.mjs +12 -2
  269. package/build-module/hooks/dimensions.mjs.map +2 -2
  270. package/build-module/hooks/elements.mjs +115 -0
  271. package/build-module/hooks/elements.mjs.map +7 -0
  272. package/build-module/hooks/grid-visualizer.mjs +21 -11
  273. package/build-module/hooks/grid-visualizer.mjs.map +2 -2
  274. package/build-module/hooks/layout-child.mjs +68 -10
  275. package/build-module/hooks/layout-child.mjs.map +2 -2
  276. package/build-module/hooks/layout.mjs +6 -3
  277. package/build-module/hooks/layout.mjs.map +2 -2
  278. package/build-module/hooks/list-view.mjs +10 -7
  279. package/build-module/hooks/list-view.mjs.map +2 -2
  280. package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
  281. package/build-module/hooks/state-utils.mjs.map +1 -1
  282. package/build-module/hooks/states.mjs +2 -2
  283. package/build-module/hooks/states.mjs.map +2 -2
  284. package/build-module/hooks/style.mjs +53 -8
  285. package/build-module/hooks/style.mjs.map +2 -2
  286. package/build-module/hooks/typography.mjs +62 -10
  287. package/build-module/hooks/typography.mjs.map +2 -2
  288. package/build-module/layouts/flex.mjs +105 -7
  289. package/build-module/layouts/flex.mjs.map +2 -2
  290. package/build-module/private-apis.mjs +8 -0
  291. package/build-module/private-apis.mjs.map +2 -2
  292. package/build-module/store/actions.mjs.map +1 -1
  293. package/build-module/store/private-selectors.mjs +18 -1
  294. package/build-module/store/private-selectors.mjs.map +2 -2
  295. package/build-module/store/reducer.mjs.map +1 -1
  296. package/build-module/store/selectors.mjs.map +1 -1
  297. package/build-module/utils/block-bindings.mjs +9 -9
  298. package/build-module/utils/block-bindings.mjs.map +3 -3
  299. package/build-module/utils/color-values.mjs +9 -1
  300. package/build-module/utils/color-values.mjs.map +3 -3
  301. package/build-module/utils/dom.mjs +2 -5
  302. package/build-module/utils/dom.mjs.map +3 -3
  303. package/build-module/utils/fit-text-frontend.mjs +6 -2
  304. package/build-module/utils/fit-text-frontend.mjs.map +3 -3
  305. package/build-module/utils/fit-text-utils.mjs +1 -1
  306. package/build-module/utils/fit-text-utils.mjs.map +3 -3
  307. package/build-module/utils/format-font-style.mjs +1 -1
  308. package/build-module/utils/format-font-style.mjs.map +3 -3
  309. package/build-module/utils/format-font-weight.mjs +1 -1
  310. package/build-module/utils/format-font-weight.mjs.map +3 -3
  311. package/build-module/utils/get-editor-region.mjs +4 -2
  312. package/build-module/utils/get-editor-region.mjs.map +3 -3
  313. package/build-module/utils/get-font-styles-and-weights.mjs +8 -12
  314. package/build-module/utils/get-font-styles-and-weights.mjs.map +3 -3
  315. package/build-module/utils/get-px-from-css-unit.mjs +1 -1
  316. package/build-module/utils/get-px-from-css-unit.mjs.map +1 -1
  317. package/build-module/utils/index.mjs +1 -1
  318. package/build-module/utils/index.mjs.map +1 -1
  319. package/build-module/utils/math.mjs +1 -1
  320. package/build-module/utils/math.mjs.map +3 -3
  321. package/build-module/utils/object.mjs +8 -8
  322. package/build-module/utils/object.mjs.map +3 -3
  323. package/build-module/utils/order-inserter-block-items.mjs +1 -1
  324. package/build-module/utils/order-inserter-block-items.mjs.map +3 -3
  325. package/build-module/utils/pasting.mjs +4 -2
  326. package/build-module/utils/pasting.mjs.map +3 -3
  327. package/build-module/utils/selection.mjs +3 -2
  328. package/build-module/utils/selection.mjs.map +3 -3
  329. package/build-module/utils/sorting.mjs +9 -3
  330. package/build-module/utils/sorting.mjs.map +3 -3
  331. package/build-module/utils/transform-styles/index.mjs +3 -2
  332. package/build-module/utils/transform-styles/index.mjs.map +3 -3
  333. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs +1 -0
  334. package/build-module/utils/transform-styles/postcss-urlrebase.d.mjs.map +7 -0
  335. package/build-module/utils/transform-styles/types.mjs +1 -0
  336. package/build-module/utils/transform-styles/types.mjs.map +7 -0
  337. package/build-module/utils/types.mjs +1 -0
  338. package/build-module/utils/types.mjs.map +7 -0
  339. package/build-style/content-rtl.css +2 -0
  340. package/build-style/content.css +2 -0
  341. package/build-style/style-rtl.css +34 -41
  342. package/build-style/style.css +34 -41
  343. package/build-types/utils/block-bindings.d.ts +27 -0
  344. package/build-types/utils/block-bindings.d.ts.map +1 -0
  345. package/build-types/utils/color-values.d.ts +40 -0
  346. package/build-types/utils/color-values.d.ts.map +1 -0
  347. package/build-types/utils/dom.d.ts +19 -19
  348. package/build-types/utils/dom.d.ts.map +1 -1
  349. package/build-types/utils/fit-text-frontend.d.ts +7 -0
  350. package/build-types/utils/fit-text-frontend.d.ts.map +1 -0
  351. package/build-types/utils/fit-text-utils.d.ts +15 -0
  352. package/build-types/utils/fit-text-utils.d.ts.map +1 -0
  353. package/build-types/utils/format-font-style.d.ts +12 -0
  354. package/build-types/utils/format-font-style.d.ts.map +1 -0
  355. package/build-types/utils/format-font-weight.d.ts +12 -0
  356. package/build-types/utils/format-font-weight.d.ts.map +1 -0
  357. package/build-types/utils/get-editor-region.d.ts +9 -0
  358. package/build-types/utils/get-editor-region.d.ts.map +1 -0
  359. package/build-types/utils/get-font-styles-and-weights.d.ts +16 -0
  360. package/build-types/utils/get-font-styles-and-weights.d.ts.map +1 -0
  361. package/build-types/utils/get-px-from-css-unit.d.ts +10 -0
  362. package/build-types/utils/get-px-from-css-unit.d.ts.map +1 -0
  363. package/build-types/utils/index.d.ts +3 -0
  364. package/build-types/utils/index.d.ts.map +1 -0
  365. package/build-types/utils/math.d.ts +61 -0
  366. package/build-types/utils/math.d.ts.map +1 -0
  367. package/build-types/utils/object.d.ts +39 -0
  368. package/build-types/utils/object.d.ts.map +1 -0
  369. package/build-types/utils/order-inserter-block-items.d.ts +13 -0
  370. package/build-types/utils/order-inserter-block-items.d.ts.map +1 -0
  371. package/build-types/utils/pasting.d.ts +28 -0
  372. package/build-types/utils/pasting.d.ts.map +1 -0
  373. package/build-types/utils/selection.d.ts +21 -0
  374. package/build-types/utils/selection.d.ts.map +1 -0
  375. package/build-types/utils/sorting.d.ts +17 -0
  376. package/build-types/utils/sorting.d.ts.map +1 -0
  377. package/build-types/utils/transform-styles/index.d.ts +15 -0
  378. package/build-types/utils/transform-styles/index.d.ts.map +1 -0
  379. package/build-types/utils/transform-styles/types.d.ts +13 -0
  380. package/build-types/utils/transform-styles/types.d.ts.map +1 -0
  381. package/build-types/utils/types.d.ts +28 -0
  382. package/build-types/utils/types.d.ts.map +1 -0
  383. package/package.json +46 -40
  384. package/src/components/alignment-control/test/__snapshots__/index.js.snap +6 -0
  385. package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +5 -0
  386. package/src/components/block-card/index.js +7 -13
  387. package/src/components/block-editing-mode/index.js +17 -9
  388. package/src/components/block-icon/test/__snapshots__/index.js.snap +1 -0
  389. package/src/components/block-inspector/index.js +22 -20
  390. package/src/components/block-patterns-list/index.js +0 -1
  391. package/src/components/block-quick-navigation/index.js +7 -7
  392. package/src/components/block-rename/modal.js +0 -1
  393. package/src/components/block-toolbar/block-toolbar-icon.js +22 -6
  394. package/src/components/block-toolbar/test/block-toolbar-icon.js +99 -0
  395. package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
  396. package/src/components/block-vertical-alignment-control/test/__snapshots__/index.js.snap +4 -0
  397. package/src/components/child-layout-control/index.js +65 -20
  398. package/src/components/child-layout-control/test/index.js +64 -0
  399. package/src/components/colors-gradients/control.js +29 -12
  400. package/src/components/colors-gradients/dropdown.js +4 -1
  401. package/src/components/colors-gradients/style.scss +39 -2
  402. package/src/components/contrast-checker/README.md +9 -0
  403. package/src/components/contrast-checker/index.js +42 -3
  404. package/src/components/date-format-picker/index.js +0 -1
  405. package/src/components/default-block-appender/content.scss +3 -0
  406. package/src/components/dimensions-tool/index.js +4 -9
  407. package/src/components/dimensions-tool/scale-tool.js +1 -2
  408. package/src/components/dimensions-tool/test/index.js +89 -11
  409. package/src/components/global-styles/background-panel.js +201 -34
  410. package/src/components/global-styles/color-gradient-dropdown-item.js +258 -0
  411. package/src/components/global-styles/color-panel.js +125 -487
  412. package/src/components/global-styles/dimensions-panel.js +1 -5
  413. package/src/components/global-styles/hooks.js +45 -0
  414. package/src/components/global-styles/shadow-panel-components.js +0 -1
  415. package/src/components/global-styles/test/background-panel.js +56 -0
  416. package/src/components/global-styles/test/color-panel.js +172 -118
  417. package/src/components/global-styles/test/typography-panel.js +167 -0
  418. package/src/components/global-styles/typography-panel.js +100 -11
  419. package/src/components/iframe/index.js +8 -3
  420. package/src/components/inserter/media-tab/media-preview.js +0 -1
  421. package/src/components/inspector-controls/README.md +0 -2
  422. package/src/components/inspector-controls/fill.js +6 -8
  423. package/src/components/inspector-controls/groups.js +2 -0
  424. package/src/components/inspector-controls-tabs/index.js +0 -1
  425. package/src/components/inspector-controls-tabs/styles-tab.js +78 -28
  426. package/src/components/link-control/index.js +0 -1
  427. package/src/components/link-control/test/index.js +2 -3
  428. package/src/components/list-view/block-select-button.js +2 -18
  429. package/src/components/preset-input-control/custom-value-controls.js +0 -1
  430. package/src/components/provider/use-block-sync.js +3 -1
  431. package/src/components/rich-text/content.scss +2 -0
  432. package/src/components/url-popover/image-url-input-ui.js +0 -2
  433. package/src/components/use-block-display-information/index.js +15 -2
  434. package/src/components/use-block-display-information/test/index.js +140 -0
  435. package/src/hooks/anchor.js +0 -1
  436. package/src/hooks/background.js +210 -133
  437. package/src/hooks/background.scss +0 -35
  438. package/src/hooks/block-fields/index.js +27 -2
  439. package/src/hooks/color.js +2 -205
  440. package/src/hooks/color.scss +3 -9
  441. package/src/hooks/contrast-checker.js +60 -17
  442. package/src/hooks/custom-class-name.js +0 -1
  443. package/src/hooks/dimensions.js +14 -3
  444. package/src/hooks/elements.js +140 -0
  445. package/src/hooks/elements.scss +8 -0
  446. package/src/hooks/grid-visualizer.js +59 -45
  447. package/src/hooks/layout-child.js +92 -14
  448. package/src/hooks/layout.js +6 -3
  449. package/src/hooks/list-view.js +10 -11
  450. package/src/hooks/states.js +2 -2
  451. package/src/hooks/style.js +91 -9
  452. package/src/hooks/test/background.js +59 -0
  453. package/src/hooks/test/block-style-state.js +14 -14
  454. package/src/hooks/test/dimensions.js +71 -0
  455. package/src/hooks/test/layout-child.js +165 -0
  456. package/src/hooks/test/layout.js +6 -6
  457. package/src/hooks/test/style.js +133 -11
  458. package/src/hooks/typography.js +70 -6
  459. package/src/layouts/flex.js +118 -15
  460. package/src/private-apis.js +8 -0
  461. package/src/store/private-selectors.js +47 -0
  462. package/src/store/test/private-selectors.js +166 -7
  463. package/src/store/test/reducer.js +61 -10
  464. package/src/style.scss +1 -0
  465. package/src/utils/block-bindings.ts +51 -0
  466. package/src/utils/color-values.ts +63 -0
  467. package/src/utils/{dom.js → dom.ts} +27 -27
  468. package/src/utils/{fit-text-frontend.js → fit-text-frontend.ts} +12 -4
  469. package/src/utils/{fit-text-utils.js → fit-text-utils.ts} +15 -7
  470. package/src/utils/{format-font-style.js → format-font-style.ts} +10 -3
  471. package/src/utils/{format-font-weight.js → format-font-weight.ts} +10 -3
  472. package/src/utils/{get-editor-region.js → get-editor-region.ts} +10 -6
  473. package/src/utils/{get-font-styles-and-weights.js → get-font-styles-and-weights.ts} +21 -17
  474. package/src/utils/{math.js → math.ts} +37 -30
  475. package/src/utils/object.ts +89 -0
  476. package/src/utils/{order-inserter-block-items.js → order-inserter-block-items.ts} +8 -5
  477. package/src/utils/{pasting.js → pasting.ts} +18 -11
  478. package/src/utils/{selection.js → selection.ts} +11 -4
  479. package/src/utils/sorting.ts +81 -0
  480. package/src/utils/test/color-values.js +44 -1
  481. package/src/utils/transform-styles/{index.js → index.ts} +25 -25
  482. package/src/utils/transform-styles/postcss-urlrebase.d.ts +15 -0
  483. package/src/utils/transform-styles/types.ts +13 -0
  484. package/src/utils/types.ts +29 -0
  485. package/src/utils/block-bindings.js +0 -46
  486. package/src/utils/color-values.js +0 -28
  487. package/src/utils/object.js +0 -67
  488. package/src/utils/sorting.js +0 -54
  489. /package/src/utils/{get-px-from-css-unit.js → get-px-from-css-unit.ts} +0 -0
  490. /package/src/utils/{index.js → index.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/utils/order-inserter-block-items.js"],
4
- "sourcesContent": ["/** @typedef {import('../store/selectors').WPEditorInserterItem} WPEditorInserterItem */\n\n/**\n * Helper function to order inserter block items according to a provided array of prioritized blocks.\n *\n * @param {WPEditorInserterItem[]} items The array of editor inserter block items to be sorted.\n * @param {string[]} priority The array of block names to be prioritized.\n * @return {WPEditorInserterItem[]} The sorted array of editor inserter block items.\n */\nexport const orderInserterBlockItems = ( items, priority ) => {\n\tif ( ! priority ) {\n\t\treturn items;\n\t}\n\n\titems.sort( ( { id: aName }, { id: bName } ) => {\n\t\t// Sort block items according to `priority`.\n\t\tlet aIndex = priority.indexOf( aName );\n\t\tlet bIndex = priority.indexOf( bName );\n\t\t// All other block items should come after that.\n\t\tif ( aIndex < 0 ) {\n\t\t\taIndex = priority.length;\n\t\t}\n\t\tif ( bIndex < 0 ) {\n\t\t\tbIndex = priority.length;\n\t\t}\n\t\treturn aIndex - bIndex;\n\t} );\n\n\treturn items;\n};\n"],
5
- "mappings": ";AASO,IAAM,0BAA0B,CAAE,OAAO,aAAc;AAC7D,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,KAAM,CAAE,EAAE,IAAI,MAAM,GAAG,EAAE,IAAI,MAAM,MAAO;AAE/C,QAAI,SAAS,SAAS,QAAS,KAAM;AACrC,QAAI,SAAS,SAAS,QAAS,KAAM;AAErC,QAAK,SAAS,GAAI;AACjB,eAAS,SAAS;AAAA,IACnB;AACA,QAAK,SAAS,GAAI;AACjB,eAAS,SAAS;AAAA,IACnB;AACA,WAAO,SAAS;AAAA,EACjB,CAAE;AAEF,SAAO;AACR;",
3
+ "sources": ["../../src/utils/order-inserter-block-items.ts"],
4
+ "sourcesContent": ["type EditorInserterItem = { id: string };\n\n/**\n * Helper function to order inserter block items according to a provided array of prioritized blocks.\n *\n * @param items The array of editor inserter block items to be sorted.\n * @param priority The array of block names to be prioritized.\n * @return The sorted array of editor inserter block items.\n */\nexport const orderInserterBlockItems = (\n\titems: EditorInserterItem[],\n\tpriority: string[] | undefined\n) => {\n\tif ( ! priority ) {\n\t\treturn items;\n\t}\n\n\titems.sort( ( { id: aName }, { id: bName } ) => {\n\t\t// Sort block items according to `priority`.\n\t\tlet aIndex = priority.indexOf( aName );\n\t\tlet bIndex = priority.indexOf( bName );\n\t\t// All other block items should come after that.\n\t\tif ( aIndex < 0 ) {\n\t\t\taIndex = priority.length;\n\t\t}\n\t\tif ( bIndex < 0 ) {\n\t\t\tbIndex = priority.length;\n\t\t}\n\t\treturn aIndex - bIndex;\n\t} );\n\n\treturn items;\n};\n"],
5
+ "mappings": ";AASO,IAAM,0BAA0B,CACtC,OACA,aACI;AACJ,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,KAAM,CAAE,EAAE,IAAI,MAAM,GAAG,EAAE,IAAI,MAAM,MAAO;AAE/C,QAAI,SAAS,SAAS,QAAS,KAAM;AACrC,QAAI,SAAS,SAAS,QAAS,KAAM;AAErC,QAAK,SAAS,GAAI;AACjB,eAAS,SAAS;AAAA,IACnB;AACA,QAAK,SAAS,GAAI;AACjB,eAAS,SAAS;AAAA,IACnB;AACA,WAAO,SAAS;AAAA,EACjB,CAAE;AAEF,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- // packages/block-editor/src/utils/pasting.js
1
+ // packages/block-editor/src/utils/pasting.ts
2
2
  import { getFilesFromDataTransfer } from "@wordpress/dom";
3
3
  function removeWindowsFragments(html) {
4
4
  const startStr = "<!--StartFragment-->";
@@ -22,7 +22,9 @@ function removeCharsetMetaTag(html) {
22
22
  }
23
23
  return html;
24
24
  }
25
- function getPasteEventData({ clipboardData }) {
25
+ function getPasteEventData({
26
+ clipboardData
27
+ }) {
26
28
  let plainText = "";
27
29
  let html = "";
28
30
  try {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/utils/pasting.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Normalizes a given string of HTML to remove the Windows-specific \"Fragment\"\n * comments and any preceding and trailing content.\n *\n * @param {string} html the html to be normalized\n * @return {string} the normalized html\n */\nfunction removeWindowsFragments( html ) {\n\tconst startStr = '<!--StartFragment-->';\n\tconst startIdx = html.indexOf( startStr );\n\tif ( startIdx > -1 ) {\n\t\thtml = html.substring( startIdx + startStr.length );\n\t} else {\n\t\t// No point looking for EndFragment\n\t\treturn html;\n\t}\n\n\tconst endStr = '<!--EndFragment-->';\n\tconst endIdx = html.indexOf( endStr );\n\tif ( endIdx > -1 ) {\n\t\thtml = html.substring( 0, endIdx );\n\t}\n\n\treturn html;\n}\n\n/**\n * Removes the charset meta tag inserted by Chromium.\n * See:\n * - https://github.com/WordPress/gutenberg/issues/33585\n * - https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4\n *\n * @param {string} html the html to be stripped of the meta tag.\n * @return {string} the cleaned html\n */\nfunction removeCharsetMetaTag( html ) {\n\tconst metaTag = `<meta charset='utf-8'>`;\n\n\tif ( html.startsWith( metaTag ) ) {\n\t\treturn html.slice( metaTag.length );\n\t}\n\n\treturn html;\n}\n\nexport function getPasteEventData( { clipboardData } ) {\n\tlet plainText = '';\n\tlet html = '';\n\n\ttry {\n\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\thtml = clipboardData.getData( 'text/html' );\n\t} catch {\n\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t// don't support clipboardData at all, so allow default\n\t\t// behaviour.\n\t\treturn;\n\t}\n\n\t// Remove Windows-specific metadata appended within copied HTML text.\n\thtml = removeWindowsFragments( html );\n\n\t// Strip meta tag.\n\thtml = removeCharsetMetaTag( html );\n\n\tconst files = getFilesFromDataTransfer( clipboardData );\n\n\tif ( files.length && ! shouldDismissPastedFiles( files, html ) ) {\n\t\treturn { files };\n\t}\n\n\treturn { html, plainText, files: [] };\n}\n\n/**\n * Given a collection of DataTransfer files and HTML and plain text strings,\n * determine whether the files are to be dismissed in favor of the HTML.\n *\n * Certain office-type programs, like Microsoft Word or Apple Numbers,\n * will, upon copy, generate a screenshot of the content being copied and\n * attach it to the clipboard alongside the actual rich text that the user\n * sought to copy. In those cases, we should let Gutenberg handle the rich text\n * content and not the screenshot, since this allows Gutenberg to insert\n * meaningful blocks, like paragraphs, lists or even tables.\n *\n * @param {File[]} files File objects obtained from a paste event\n * @param {string} html HTML content obtained from a paste event\n * @return {boolean} True if the files should be dismissed\n */\nexport function shouldDismissPastedFiles( files, html /*, plainText */ ) {\n\t// The question is only relevant when there is actual HTML content and when\n\t// there is exactly one image file.\n\tif (\n\t\thtml &&\n\t\tfiles?.length === 1 &&\n\t\tfiles[ 0 ].type.indexOf( 'image/' ) === 0\n\t) {\n\t\t// A single <img> tag found in the HTML source suggests that the\n\t\t// content being pasted revolves around an image. Sometimes there are\n\t\t// other elements found, like <figure>, but we assume that the user's\n\t\t// intention is to paste the actual image file.\n\t\tconst IMAGE_TAG = /<\\s*img\\b/gi;\n\t\tif ( html.match( IMAGE_TAG )?.length !== 1 ) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Even when there is exactly one <img> tag in the HTML payload, we\n\t\t// choose to weed out local images, i.e. those whose source starts with\n\t\t// \"file://\". These payloads occur in specific configurations, such as\n\t\t// when copying an entire document from Microsoft Word, that contains\n\t\t// text and exactly one image, and pasting that content using Google\n\t\t// Chrome.\n\t\tconst IMG_WITH_LOCAL_SRC = /<\\s*img\\b[^>]*\\bsrc=\"file:\\/\\//i;\n\t\tif ( html.match( IMG_WITH_LOCAL_SRC ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],
5
- "mappings": ";AAGA,SAAS,gCAAgC;AASzC,SAAS,uBAAwB,MAAO;AACvC,QAAM,WAAW;AACjB,QAAM,WAAW,KAAK,QAAS,QAAS;AACxC,MAAK,WAAW,IAAK;AACpB,WAAO,KAAK,UAAW,WAAW,SAAS,MAAO;AAAA,EACnD,OAAO;AAEN,WAAO;AAAA,EACR;AAEA,QAAM,SAAS;AACf,QAAM,SAAS,KAAK,QAAS,MAAO;AACpC,MAAK,SAAS,IAAK;AAClB,WAAO,KAAK,UAAW,GAAG,MAAO;AAAA,EAClC;AAEA,SAAO;AACR;AAWA,SAAS,qBAAsB,MAAO;AACrC,QAAM,UAAU;AAEhB,MAAK,KAAK,WAAY,OAAQ,GAAI;AACjC,WAAO,KAAK,MAAO,QAAQ,MAAO;AAAA,EACnC;AAEA,SAAO;AACR;AAEO,SAAS,kBAAmB,EAAE,cAAc,GAAI;AACtD,MAAI,YAAY;AAChB,MAAI,OAAO;AAEX,MAAI;AACH,gBAAY,cAAc,QAAS,YAAa;AAChD,WAAO,cAAc,QAAS,WAAY;AAAA,EAC3C,QAAQ;AAIP;AAAA,EACD;AAGA,SAAO,uBAAwB,IAAK;AAGpC,SAAO,qBAAsB,IAAK;AAElC,QAAM,QAAQ,yBAA0B,aAAc;AAEtD,MAAK,MAAM,UAAU,CAAE,yBAA0B,OAAO,IAAK,GAAI;AAChE,WAAO,EAAE,MAAM;AAAA,EAChB;AAEA,SAAO,EAAE,MAAM,WAAW,OAAO,CAAC,EAAE;AACrC;AAiBO,SAAS,yBAA0B,OAAO,MAAwB;AAGxE,MACC,QACA,OAAO,WAAW,KAClB,MAAO,CAAE,EAAE,KAAK,QAAS,QAAS,MAAM,GACvC;AAKD,UAAM,YAAY;AAClB,QAAK,KAAK,MAAO,SAAU,GAAG,WAAW,GAAI;AAC5C,aAAO;AAAA,IACR;AAQA,UAAM,qBAAqB;AAC3B,QAAK,KAAK,MAAO,kBAAmB,GAAI;AACvC,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
3
+ "sources": ["../../src/utils/pasting.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\n/**\n * Normalizes a given string of HTML to remove the Windows-specific \"Fragment\"\n * comments and any preceding and trailing content.\n *\n * @param html the html to be normalized\n * @return the normalized html\n */\nfunction removeWindowsFragments( html: string ) {\n\tconst startStr = '<!--StartFragment-->';\n\tconst startIdx = html.indexOf( startStr );\n\tif ( startIdx > -1 ) {\n\t\thtml = html.substring( startIdx + startStr.length );\n\t} else {\n\t\t// No point looking for EndFragment\n\t\treturn html;\n\t}\n\n\tconst endStr = '<!--EndFragment-->';\n\tconst endIdx = html.indexOf( endStr );\n\tif ( endIdx > -1 ) {\n\t\thtml = html.substring( 0, endIdx );\n\t}\n\n\treturn html;\n}\n\n/**\n * Removes the charset meta tag inserted by Chromium.\n * See:\n * - https://github.com/WordPress/gutenberg/issues/33585\n * - https://bugs.chromium.org/p/chromium/issues/detail?id=1264616#c4\n *\n * @param html the html to be stripped of the meta tag.\n * @return the cleaned html\n */\nfunction removeCharsetMetaTag( html: string ) {\n\tconst metaTag = `<meta charset='utf-8'>`;\n\n\tif ( html.startsWith( metaTag ) ) {\n\t\treturn html.slice( metaTag.length );\n\t}\n\n\treturn html;\n}\n\nexport function getPasteEventData( {\n\tclipboardData,\n}: {\n\tclipboardData: DataTransfer;\n} ) {\n\tlet plainText = '';\n\tlet html = '';\n\n\ttry {\n\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\thtml = clipboardData.getData( 'text/html' );\n\t} catch {\n\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t// don't support clipboardData at all, so allow default\n\t\t// behaviour.\n\t\treturn;\n\t}\n\n\t// Remove Windows-specific metadata appended within copied HTML text.\n\thtml = removeWindowsFragments( html );\n\n\t// Strip meta tag.\n\thtml = removeCharsetMetaTag( html );\n\n\tconst files = getFilesFromDataTransfer( clipboardData );\n\n\tif ( files.length && ! shouldDismissPastedFiles( files, html ) ) {\n\t\treturn { files };\n\t}\n\n\treturn { html, plainText, files: [] };\n}\n\n/**\n * Given a collection of DataTransfer files and HTML and plain text strings,\n * determine whether the files are to be dismissed in favor of the HTML.\n *\n * Certain office-type programs, like Microsoft Word or Apple Numbers,\n * will, upon copy, generate a screenshot of the content being copied and\n * attach it to the clipboard alongside the actual rich text that the user\n * sought to copy. In those cases, we should let Gutenberg handle the rich text\n * content and not the screenshot, since this allows Gutenberg to insert\n * meaningful blocks, like paragraphs, lists or even tables.\n *\n * @param files File objects obtained from a paste event\n * @param html HTML content obtained from a paste event\n * @return True if the files should be dismissed\n */\nexport function shouldDismissPastedFiles(\n\tfiles: File[],\n\thtml: string /*, plainText */\n) {\n\t// The question is only relevant when there is actual HTML content and when\n\t// there is exactly one image file.\n\tif (\n\t\thtml &&\n\t\tfiles?.length === 1 &&\n\t\tfiles[ 0 ].type.indexOf( 'image/' ) === 0\n\t) {\n\t\t// A single <img> tag found in the HTML source suggests that the\n\t\t// content being pasted revolves around an image. Sometimes there are\n\t\t// other elements found, like <figure>, but we assume that the user's\n\t\t// intention is to paste the actual image file.\n\t\tconst IMAGE_TAG = /<\\s*img\\b/gi;\n\t\tif ( html.match( IMAGE_TAG )?.length !== 1 ) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Even when there is exactly one <img> tag in the HTML payload, we\n\t\t// choose to weed out local images, i.e. those whose source starts with\n\t\t// \"file://\". These payloads occur in specific configurations, such as\n\t\t// when copying an entire document from Microsoft Word, that contains\n\t\t// text and exactly one image, and pasting that content using Google\n\t\t// Chrome.\n\t\tconst IMG_WITH_LOCAL_SRC = /<\\s*img\\b[^>]*\\bsrc=\"file:\\/\\//i;\n\t\tif ( html.match( IMG_WITH_LOCAL_SRC ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],
5
+ "mappings": ";AAGA,SAAS,gCAAgC;AASzC,SAAS,uBAAwB,MAAe;AAC/C,QAAM,WAAW;AACjB,QAAM,WAAW,KAAK,QAAS,QAAS;AACxC,MAAK,WAAW,IAAK;AACpB,WAAO,KAAK,UAAW,WAAW,SAAS,MAAO;AAAA,EACnD,OAAO;AAEN,WAAO;AAAA,EACR;AAEA,QAAM,SAAS;AACf,QAAM,SAAS,KAAK,QAAS,MAAO;AACpC,MAAK,SAAS,IAAK;AAClB,WAAO,KAAK,UAAW,GAAG,MAAO;AAAA,EAClC;AAEA,SAAO;AACR;AAWA,SAAS,qBAAsB,MAAe;AAC7C,QAAM,UAAU;AAEhB,MAAK,KAAK,WAAY,OAAQ,GAAI;AACjC,WAAO,KAAK,MAAO,QAAQ,MAAO;AAAA,EACnC;AAEA,SAAO;AACR;AAEO,SAAS,kBAAmB;AAAA,EAClC;AACD,GAEI;AACH,MAAI,YAAY;AAChB,MAAI,OAAO;AAEX,MAAI;AACH,gBAAY,cAAc,QAAS,YAAa;AAChD,WAAO,cAAc,QAAS,WAAY;AAAA,EAC3C,QAAQ;AAIP;AAAA,EACD;AAGA,SAAO,uBAAwB,IAAK;AAGpC,SAAO,qBAAsB,IAAK;AAElC,QAAM,QAAQ,yBAA0B,aAAc;AAEtD,MAAK,MAAM,UAAU,CAAE,yBAA0B,OAAO,IAAK,GAAI;AAChE,WAAO,EAAE,MAAM;AAAA,EAChB;AAEA,SAAO,EAAE,MAAM,WAAW,OAAO,CAAC,EAAE;AACrC;AAiBO,SAAS,yBACf,OACA,MACC;AAGD,MACC,QACA,OAAO,WAAW,KAClB,MAAO,CAAE,EAAE,KAAK,QAAS,QAAS,MAAM,GACvC;AAKD,UAAM,YAAY;AAClB,QAAK,KAAK,MAAO,SAAU,GAAG,WAAW,GAAI;AAC5C,aAAO;AAAA,IACR;AAQA,UAAM,qBAAqB;AAC3B,QAAK,KAAK,MAAO,kBAAmB,GAAI;AACvC,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
- // packages/block-editor/src/utils/selection.js
1
+ // packages/block-editor/src/utils/selection.ts
2
2
  import { RichTextData } from "@wordpress/rich-text";
3
- var START_OF_SELECTED_AREA = "\x86";
3
+ var START_OF_SELECTED_AREA = "†";
4
4
  function retrieveSelectedAttribute(blockAttributes) {
5
5
  if (!blockAttributes) {
6
6
  return;
@@ -18,6 +18,7 @@ function findRichTextAttributeKey(blockType) {
18
18
  return key;
19
19
  }
20
20
  }
21
+ return void 0;
21
22
  }
22
23
  export {
23
24
  START_OF_SELECTED_AREA,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/utils/selection.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichTextData } from '@wordpress/rich-text';\n\n/**\n * A robust way to retain selection position through various\n * transforms is to insert a special character at the position and\n * then recover it.\n */\nexport const START_OF_SELECTED_AREA = '\\u0086';\n\n/**\n * Retrieve the block attribute that contains the selection position.\n *\n * @param {Object} blockAttributes Block attributes.\n * @return {string|void} The name of the block attribute that was previously selected.\n */\nexport function retrieveSelectedAttribute( blockAttributes ) {\n\tif ( ! blockAttributes ) {\n\t\treturn;\n\t}\n\n\treturn Object.keys( blockAttributes ).find( ( name ) => {\n\t\tconst value = blockAttributes[ name ];\n\t\treturn (\n\t\t\t( typeof value === 'string' || value instanceof RichTextData ) &&\n\t\t\t// To do: refactor this to use rich text's selection instead, so we\n\t\t\t// no longer have to use on this hack inserting a special character.\n\t\t\tvalue.toString().indexOf( START_OF_SELECTED_AREA ) !== -1\n\t\t);\n\t} );\n}\n\nexport function findRichTextAttributeKey( blockType ) {\n\tfor ( const [ key, value ] of Object.entries( blockType.attributes ) ) {\n\t\tif ( value.source === 'rich-text' || value.source === 'html' ) {\n\t\t\treturn key;\n\t\t}\n\t}\n}\n"],
5
- "mappings": ";AAGA,SAAS,oBAAoB;AAOtB,IAAM,yBAAyB;AAQ/B,SAAS,0BAA2B,iBAAkB;AAC5D,MAAK,CAAE,iBAAkB;AACxB;AAAA,EACD;AAEA,SAAO,OAAO,KAAM,eAAgB,EAAE,KAAM,CAAE,SAAU;AACvD,UAAM,QAAQ,gBAAiB,IAAK;AACpC,YACG,OAAO,UAAU,YAAY,iBAAiB;AAAA;AAAA,IAGhD,MAAM,SAAS,EAAE,QAAS,sBAAuB,MAAM;AAAA,EAEzD,CAAE;AACH;AAEO,SAAS,yBAA0B,WAAY;AACrD,aAAY,CAAE,KAAK,KAAM,KAAK,OAAO,QAAS,UAAU,UAAW,GAAI;AACtE,QAAK,MAAM,WAAW,eAAe,MAAM,WAAW,QAAS;AAC9D,aAAO;AAAA,IACR;AAAA,EACD;AACD;",
3
+ "sources": ["../../src/utils/selection.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichTextData } from '@wordpress/rich-text';\n\n/**\n * A robust way to retain selection position through various\n * transforms is to insert a special character at the position and\n * then recover it.\n */\nexport const START_OF_SELECTED_AREA = '\\u0086';\n\n/**\n * Retrieve the block attribute that contains the selection position.\n *\n * @param blockAttributes Block attributes.\n * @return The name of the block attribute that was previously selected.\n */\nexport function retrieveSelectedAttribute(\n\tblockAttributes: Record< string, unknown > | undefined\n) {\n\tif ( ! blockAttributes ) {\n\t\treturn;\n\t}\n\n\treturn Object.keys( blockAttributes ).find( ( name ) => {\n\t\tconst value = blockAttributes[ name ];\n\t\treturn (\n\t\t\t( typeof value === 'string' || value instanceof RichTextData ) &&\n\t\t\t// To do: refactor this to use rich text's selection instead, so we\n\t\t\t// no longer have to use on this hack inserting a special character.\n\t\t\tvalue.toString().indexOf( START_OF_SELECTED_AREA ) !== -1\n\t\t);\n\t} );\n}\n\ntype BlockTypeWithAttributes = {\n\tattributes: Record< string, { source?: string } >;\n};\n\nexport function findRichTextAttributeKey( blockType: BlockTypeWithAttributes ) {\n\tfor ( const [ key, value ] of Object.entries( blockType.attributes ) ) {\n\t\tif ( value.source === 'rich-text' || value.source === 'html' ) {\n\t\t\treturn key;\n\t\t}\n\t}\n\treturn undefined;\n}\n"],
5
+ "mappings": ";AAGA,SAAS,oBAAoB;AAOtB,IAAM,yBAAyB;AAQ/B,SAAS,0BACf,iBACC;AACD,MAAK,CAAE,iBAAkB;AACxB;AAAA,EACD;AAEA,SAAO,OAAO,KAAM,eAAgB,EAAE,KAAM,CAAE,SAAU;AACvD,UAAM,QAAQ,gBAAiB,IAAK;AACpC,YACG,OAAO,UAAU,YAAY,iBAAiB;AAAA;AAAA,IAGhD,MAAM,SAAS,EAAE,QAAS,sBAAuB,MAAM;AAAA,EAEzD,CAAE;AACH;AAMO,SAAS,yBAA0B,WAAqC;AAC9E,aAAY,CAAE,KAAK,KAAM,KAAK,OAAO,QAAS,UAAU,UAAW,GAAI;AACtE,QAAK,MAAM,WAAW,eAAe,MAAM,WAAW,QAAS;AAC9D,aAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,10 @@
1
- // packages/block-editor/src/utils/sorting.js
1
+ // packages/block-editor/src/utils/sorting.ts
2
+ function isGreater(a, b) {
3
+ if (typeof a === "string" && typeof b === "string") {
4
+ return a > b;
5
+ }
6
+ return Number(a) > Number(b);
7
+ }
2
8
  var comparator = (field, items, order) => {
3
9
  return (a, b) => {
4
10
  let cmpA, cmpB;
@@ -9,9 +15,9 @@ var comparator = (field, items, order) => {
9
15
  cmpA = a[field];
10
16
  cmpB = b[field];
11
17
  }
12
- if (cmpA > cmpB) {
18
+ if (isGreater(cmpA, cmpB)) {
13
19
  return order === "asc" ? 1 : -1;
14
- } else if (cmpB > cmpA) {
20
+ } else if (isGreater(cmpB, cmpA)) {
15
21
  return order === "asc" ? -1 : 1;
16
22
  }
17
23
  const orderA = items.findIndex((item) => item === a);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/utils/sorting.js"],
4
- "sourcesContent": ["/**\n * Recursive stable sorting comparator function.\n *\n * @param {string|Function} field Field to sort by.\n * @param {Array} items Items to sort.\n * @param {string} order Order, 'asc' or 'desc'.\n * @return {Function} Comparison function to be used in a `.sort()`.\n */\nconst comparator = ( field, items, order ) => {\n\treturn ( a, b ) => {\n\t\tlet cmpA, cmpB;\n\n\t\tif ( typeof field === 'function' ) {\n\t\t\tcmpA = field( a );\n\t\t\tcmpB = field( b );\n\t\t} else {\n\t\t\tcmpA = a[ field ];\n\t\t\tcmpB = b[ field ];\n\t\t}\n\n\t\tif ( cmpA > cmpB ) {\n\t\t\treturn order === 'asc' ? 1 : -1;\n\t\t} else if ( cmpB > cmpA ) {\n\t\t\treturn order === 'asc' ? -1 : 1;\n\t\t}\n\n\t\tconst orderA = items.findIndex( ( item ) => item === a );\n\t\tconst orderB = items.findIndex( ( item ) => item === b );\n\n\t\t// Stable sort: maintaining original array order\n\t\tif ( orderA > orderB ) {\n\t\t\treturn 1;\n\t\t} else if ( orderB > orderA ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\treturn 0;\n\t};\n};\n\n/**\n * Order items by a certain key.\n * Supports decorator functions that allow complex picking of a comparison field.\n * Sorts in ascending order by default, but supports descending as well.\n * Stable sort - maintains original order of equal items.\n *\n * @param {Array} items Items to order.\n * @param {string|Function} field Field to order by.\n * @param {string} order Sorting order, `asc` or `desc`.\n * @return {Array} Sorted items.\n */\nexport function orderBy( items, field, order = 'asc' ) {\n\treturn items.concat().sort( comparator( field, items, order ) );\n}\n"],
5
- "mappings": ";AAQA,IAAM,aAAa,CAAE,OAAO,OAAO,UAAW;AAC7C,SAAO,CAAE,GAAG,MAAO;AAClB,QAAI,MAAM;AAEV,QAAK,OAAO,UAAU,YAAa;AAClC,aAAO,MAAO,CAAE;AAChB,aAAO,MAAO,CAAE;AAAA,IACjB,OAAO;AACN,aAAO,EAAG,KAAM;AAChB,aAAO,EAAG,KAAM;AAAA,IACjB;AAEA,QAAK,OAAO,MAAO;AAClB,aAAO,UAAU,QAAQ,IAAI;AAAA,IAC9B,WAAY,OAAO,MAAO;AACzB,aAAO,UAAU,QAAQ,KAAK;AAAA,IAC/B;AAEA,UAAM,SAAS,MAAM,UAAW,CAAE,SAAU,SAAS,CAAE;AACvD,UAAM,SAAS,MAAM,UAAW,CAAE,SAAU,SAAS,CAAE;AAGvD,QAAK,SAAS,QAAS;AACtB,aAAO;AAAA,IACR,WAAY,SAAS,QAAS;AAC7B,aAAO;AAAA,IACR;AAEA,WAAO;AAAA,EACR;AACD;AAaO,SAAS,QAAS,OAAO,OAAO,QAAQ,OAAQ;AACtD,SAAO,MAAM,OAAO,EAAE,KAAM,WAAY,OAAO,OAAO,KAAM,CAAE;AAC/D;",
3
+ "sources": ["../../src/utils/sorting.ts"],
4
+ "sourcesContent": ["type Comparable = string | number | undefined;\ntype SortItem = Record< string, Comparable >;\ntype SortField< T > = string | ( ( item: T ) => Comparable );\n\n/**\n * Mirrors the `>` operator for `Comparable` values: lexicographic when both\n * are strings, numeric otherwise (an `undefined` operand is never greater).\n *\n * @param a Left-hand value.\n * @param b Right-hand value.\n * @return Whether `a` is greater than `b`.\n */\nfunction isGreater( a: Comparable, b: Comparable ): boolean {\n\tif ( typeof a === 'string' && typeof b === 'string' ) {\n\t\treturn a > b;\n\t}\n\treturn Number( a ) > Number( b );\n}\n\n/**\n * Recursive stable sorting comparator function.\n *\n * @param field Field to sort by.\n * @param items Items to sort.\n * @param order Order, 'asc' or 'desc'.\n * @return Comparison function to be used in a `.sort()`.\n */\nconst comparator = < T extends SortItem >(\n\tfield: SortField< T >,\n\titems: T[],\n\torder: string\n) => {\n\treturn ( a: T, b: T ) => {\n\t\tlet cmpA: Comparable, cmpB: Comparable;\n\n\t\tif ( typeof field === 'function' ) {\n\t\t\tcmpA = field( a );\n\t\t\tcmpB = field( b );\n\t\t} else {\n\t\t\tcmpA = a[ field ];\n\t\t\tcmpB = b[ field ];\n\t\t}\n\n\t\tif ( isGreater( cmpA, cmpB ) ) {\n\t\t\treturn order === 'asc' ? 1 : -1;\n\t\t} else if ( isGreater( cmpB, cmpA ) ) {\n\t\t\treturn order === 'asc' ? -1 : 1;\n\t\t}\n\n\t\tconst orderA = items.findIndex( ( item ) => item === a );\n\t\tconst orderB = items.findIndex( ( item ) => item === b );\n\n\t\t// Stable sort: maintaining original array order\n\t\tif ( orderA > orderB ) {\n\t\t\treturn 1;\n\t\t} else if ( orderB > orderA ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\treturn 0;\n\t};\n};\n\n/**\n * Order items by a certain key.\n * Supports decorator functions that allow complex picking of a comparison field.\n * Sorts in ascending order by default, but supports descending as well.\n * Stable sort - maintains original order of equal items.\n *\n * @param items Items to order.\n * @param field Field to order by.\n * @param order Sorting order, `asc` or `desc`.\n * @return Sorted items.\n */\nexport function orderBy< T extends SortItem >(\n\titems: T[],\n\tfield: SortField< T >,\n\torder = 'asc'\n) {\n\treturn items.concat().sort( comparator( field, items, order ) );\n}\n"],
5
+ "mappings": ";AAYA,SAAS,UAAW,GAAe,GAAyB;AAC3D,MAAK,OAAO,MAAM,YAAY,OAAO,MAAM,UAAW;AACrD,WAAO,IAAI;AAAA,EACZ;AACA,SAAO,OAAQ,CAAE,IAAI,OAAQ,CAAE;AAChC;AAUA,IAAM,aAAa,CAClB,OACA,OACA,UACI;AACJ,SAAO,CAAE,GAAM,MAAU;AACxB,QAAI,MAAkB;AAEtB,QAAK,OAAO,UAAU,YAAa;AAClC,aAAO,MAAO,CAAE;AAChB,aAAO,MAAO,CAAE;AAAA,IACjB,OAAO;AACN,aAAO,EAAG,KAAM;AAChB,aAAO,EAAG,KAAM;AAAA,IACjB;AAEA,QAAK,UAAW,MAAM,IAAK,GAAI;AAC9B,aAAO,UAAU,QAAQ,IAAI;AAAA,IAC9B,WAAY,UAAW,MAAM,IAAK,GAAI;AACrC,aAAO,UAAU,QAAQ,KAAK;AAAA,IAC/B;AAEA,UAAM,SAAS,MAAM,UAAW,CAAE,SAAU,SAAS,CAAE;AACvD,UAAM,SAAS,MAAM,UAAW,CAAE,SAAU,SAAS,CAAE;AAGvD,QAAK,SAAS,QAAS;AACtB,aAAO;AAAA,IACR,WAAY,SAAS,QAAS;AAC7B,aAAO;AAAA,IACR;AAEA,WAAO;AAAA,EACR;AACD;AAaO,SAAS,QACf,OACA,OACA,QAAQ,OACP;AACD,SAAO,MAAM,OAAO,EAAE,KAAM,WAAY,OAAO,OAAO,KAAM,CAAE;AAC/D;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- // packages/block-editor/src/utils/transform-styles/index.js
1
+ // packages/block-editor/src/utils/transform-styles/index.ts
2
2
  import * as parsel from "parsel-js";
3
3
  import Processor from "postcss/lib/processor";
4
4
  import CssSyntaxError from "postcss/lib/css-syntax-error";
@@ -34,7 +34,8 @@ function prefixRootSelector(prefix, selector) {
34
34
  0,
35
35
  {
36
36
  type: "combinator",
37
- content: " "
37
+ content: " ",
38
+ pos: [0, 0]
38
39
  },
39
40
  ...tokenizedPrefix
40
41
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/utils/transform-styles/index.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport * as parsel from 'parsel-js';\nimport Processor from 'postcss/lib/processor';\nimport CssSyntaxError from 'postcss/lib/css-syntax-error';\nimport prefixSelector from 'postcss-prefix-selector';\nimport rebaseUrl from 'postcss-urlrebase';\n\nconst cacheByWrapperSelector = new Map();\n\nconst ROOT_SELECTOR_TOKENS = [\n\t{ type: 'type', content: 'body' },\n\t{ type: 'type', content: 'html' },\n\t{ type: 'pseudo-class', content: ':root' },\n\t{ type: 'pseudo-class', content: ':where(body)' },\n\t{ type: 'pseudo-class', content: ':where(:root)' },\n\t{ type: 'pseudo-class', content: ':where(html)' },\n];\n\n/**\n * Prefixes root selectors in a way that ensures consistent specificity.\n * This requires special handling, since prefixing a classname before\n * html, body, or :root will generally result in an invalid selector.\n *\n * Some libraries will simply replace the root selector with the prefix\n * instead, but this results in inconsistent specificity.\n *\n * This function instead inserts the prefix after the root tags but before\n * any other part of the selector. This results in consistent specificity:\n * - If a `:where()` selector is used for the prefix, all selectors output\n * by `transformStyles` will have no specificity increase.\n * - If a classname, id, or something else is used as the prefix, all selectors\n * will have the same specificity bump when transformed.\n *\n * @param {string} prefix The prefix.\n * @param {string} selector The selector.\n *\n * @return {string} The prefixed root selector.\n */\nfunction prefixRootSelector( prefix, selector ) {\n\t// Use a tokenizer, since regular expressions are unreliable.\n\tconst tokenized = parsel.tokenize( selector );\n\n\t// Find the last token that contains a root selector by walking back\n\t// through the tokens.\n\tconst lastRootIndex = tokenized.findLastIndex( ( { content, type } ) => {\n\t\treturn ROOT_SELECTOR_TOKENS.some(\n\t\t\t( rootSelector ) =>\n\t\t\t\tcontent === rootSelector.content && type === rootSelector.type\n\t\t);\n\t} );\n\n\t// Walk forwards to find the combinator after the last root.\n\t// This is where the root ends and the rest of the selector begins,\n\t// and the index to insert before.\n\t// Doing it this way takes into account that a root selector like\n\t// 'body' may have additional id/class/pseudo-class/attribute-selector\n\t// parts chained to it, which is difficult to quantify using a regex.\n\tlet insertionPoint = -1;\n\tfor ( let i = lastRootIndex + 1; i < tokenized.length; i++ ) {\n\t\tif ( tokenized[ i ].type === 'combinator' ) {\n\t\t\tinsertionPoint = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Tokenize and insert the prefix with a ' ' combinator before it.\n\tconst tokenizedPrefix = parsel.tokenize( prefix );\n\ttokenized.splice(\n\t\t// Insert at the insertion point, or the end.\n\t\tinsertionPoint === -1 ? tokenized.length : insertionPoint,\n\t\t0,\n\t\t{\n\t\t\ttype: 'combinator',\n\t\t\tcontent: ' ',\n\t\t},\n\t\t...tokenizedPrefix\n\t);\n\n\treturn parsel.stringify( tokenized );\n}\n\nfunction transformStyle(\n\t{ css, ignoredSelectors = [], baseURL },\n\twrapperSelector = '',\n\ttransformOptions\n) {\n\t// When there is no wrapper selector and no base URL, there is no need\n\t// to transform the CSS. This is most cases because in the default\n\t// iframed editor, no wrapping is needed, and not many styles\n\t// provide a base URL.\n\tif ( ! wrapperSelector && ! baseURL ) {\n\t\treturn css;\n\t}\n\n\ttry {\n\t\tconst excludedSelectors = [\n\t\t\t...ignoredSelectors,\n\t\t\t...( transformOptions?.ignoredSelectors ?? [] ),\n\t\t\twrapperSelector,\n\t\t];\n\n\t\treturn new Processor(\n\t\t\t[\n\t\t\t\twrapperSelector &&\n\t\t\t\t\tprefixSelector( {\n\t\t\t\t\t\tprefix: wrapperSelector,\n\t\t\t\t\t\ttransform( prefix, selector, prefixedSelector ) {\n\t\t\t\t\t\t\t// For backwards compatibility, don't use the `exclude` option\n\t\t\t\t\t\t\t// of postcss-prefix-selector, instead handle it here to match\n\t\t\t\t\t\t\t// the behavior of the old library (postcss-prefix-wrap) that\n\t\t\t\t\t\t\t// `transformStyle` previously used.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\texcludedSelectors.some( ( excludedSelector ) =>\n\t\t\t\t\t\t\t\t\texcludedSelector instanceof RegExp\n\t\t\t\t\t\t\t\t\t\t? selector.match( excludedSelector )\n\t\t\t\t\t\t\t\t\t\t: selector.includes( excludedSelector )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn selector;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst hasRootSelector = ROOT_SELECTOR_TOKENS.some(\n\t\t\t\t\t\t\t\t( rootSelector ) =>\n\t\t\t\t\t\t\t\t\tselector.startsWith( rootSelector.content )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// Reorganize root selectors such that the root part comes before the prefix,\n\t\t\t\t\t\t\t// but the prefix still comes before the remaining part of the selector.\n\t\t\t\t\t\t\tif ( hasRootSelector ) {\n\t\t\t\t\t\t\t\treturn prefixRootSelector( prefix, selector );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn prefixedSelector;\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t\tbaseURL && rebaseUrl( { rootUrl: baseURL } ),\n\t\t\t].filter( Boolean )\n\t\t).process( css, {} ).css; // use sync PostCSS API\n\t} catch ( error ) {\n\t\tif ( error instanceof CssSyntaxError ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'wp.blockEditor.transformStyles Failed to transform CSS.',\n\t\t\t\terror.message + '\\n' + error.showSourceCode( false )\n\t\t\t);\n\t\t} else {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'wp.blockEditor.transformStyles Failed to transform CSS.',\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n}\n\n/**\n * @typedef {Object} EditorStyle\n * @property {string} css the CSS block(s), as a single string.\n * @property {?string} baseURL the base URL to be used as the reference when rewriting urls.\n * @property {?string[]} ignoredSelectors the selectors not to wrap.\n */\n\n/**\n * @typedef {Object} TransformOptions\n * @property {?string[]} ignoredSelectors the selectors not to wrap.\n */\n\n/**\n * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed.\n *\n * @param {EditorStyle[]} styles CSS rules.\n * @param {string} wrapperSelector Wrapper selector.\n * @param {TransformOptions} transformOptions Additional options for style transformation.\n * @return {Array} converted rules.\n */\nconst transformStyles = ( styles, wrapperSelector = '', transformOptions ) => {\n\tlet cache = cacheByWrapperSelector.get( wrapperSelector );\n\tif ( ! cache ) {\n\t\tcache = new WeakMap();\n\t\tcacheByWrapperSelector.set( wrapperSelector, cache );\n\t}\n\treturn styles.map( ( style ) => {\n\t\tlet css = cache.get( style );\n\t\tif ( ! css ) {\n\t\t\tcss = transformStyle( style, wrapperSelector, transformOptions );\n\t\t\tcache.set( style, css );\n\t\t}\n\t\treturn css;\n\t} );\n};\n\nexport default transformStyles;\n"],
5
- "mappings": "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",
3
+ "sources": ["../../../src/utils/transform-styles/index.ts"],
4
+ "sourcesContent": ["/// <reference path=\"./postcss-urlrebase.d.ts\" />\n\n/**\n * External dependencies\n */\nimport * as parsel from 'parsel-js';\nimport Processor from 'postcss/lib/processor';\nimport CssSyntaxError from 'postcss/lib/css-syntax-error';\nimport prefixSelector from 'postcss-prefix-selector';\nimport rebaseUrl from 'postcss-urlrebase';\n\n/**\n * Internal dependencies\n */\nimport type { EditorStyle, TransformOptions } from './types';\n\nconst cacheByWrapperSelector = new Map();\n\nconst ROOT_SELECTOR_TOKENS = [\n\t{ type: 'type', content: 'body' },\n\t{ type: 'type', content: 'html' },\n\t{ type: 'pseudo-class', content: ':root' },\n\t{ type: 'pseudo-class', content: ':where(body)' },\n\t{ type: 'pseudo-class', content: ':where(:root)' },\n\t{ type: 'pseudo-class', content: ':where(html)' },\n];\n\n/**\n * Prefixes root selectors in a way that ensures consistent specificity.\n * This requires special handling, since prefixing a classname before\n * html, body, or :root will generally result in an invalid selector.\n *\n * Some libraries will simply replace the root selector with the prefix\n * instead, but this results in inconsistent specificity.\n *\n * This function instead inserts the prefix after the root tags but before\n * any other part of the selector. This results in consistent specificity:\n * - If a `:where()` selector is used for the prefix, all selectors output\n * by `transformStyles` will have no specificity increase.\n * - If a classname, id, or something else is used as the prefix, all selectors\n * will have the same specificity bump when transformed.\n *\n * @param prefix The prefix.\n * @param selector The selector.\n *\n * @return The prefixed root selector.\n */\nfunction prefixRootSelector( prefix: string, selector: string ) {\n\t// Use a tokenizer, since regular expressions are unreliable.\n\tconst tokenized = parsel.tokenize( selector );\n\n\t// Find the last token that contains a root selector by walking back\n\t// through the tokens.\n\tconst lastRootIndex = tokenized.findLastIndex( ( { content, type } ) => {\n\t\treturn ROOT_SELECTOR_TOKENS.some(\n\t\t\t( rootSelector ) =>\n\t\t\t\tcontent === rootSelector.content && type === rootSelector.type\n\t\t);\n\t} );\n\n\t// Walk forwards to find the combinator after the last root.\n\t// This is where the root ends and the rest of the selector begins,\n\t// and the index to insert before.\n\t// Doing it this way takes into account that a root selector like\n\t// 'body' may have additional id/class/pseudo-class/attribute-selector\n\t// parts chained to it, which is difficult to quantify using a regex.\n\tlet insertionPoint = -1;\n\tfor ( let i = lastRootIndex + 1; i < tokenized.length; i++ ) {\n\t\tif ( tokenized[ i ].type === 'combinator' ) {\n\t\t\tinsertionPoint = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Tokenize and insert the prefix with a ' ' combinator before it.\n\tconst tokenizedPrefix = parsel.tokenize( prefix );\n\ttokenized.splice(\n\t\t// Insert at the insertion point, or the end.\n\t\tinsertionPoint === -1 ? tokenized.length : insertionPoint,\n\t\t0,\n\t\t{\n\t\t\ttype: 'combinator',\n\t\t\tcontent: ' ',\n\t\t\tpos: [ 0, 0 ],\n\t\t} as parsel.Token,\n\t\t...tokenizedPrefix\n\t);\n\n\treturn parsel.stringify( tokenized );\n}\n\nfunction transformStyle(\n\t{ css, ignoredSelectors = [], baseURL }: EditorStyle,\n\twrapperSelector = '',\n\ttransformOptions?: TransformOptions\n) {\n\t// When there is no wrapper selector and no base URL, there is no need\n\t// to transform the CSS. This is most cases because in the default\n\t// iframed editor, no wrapping is needed, and not many styles\n\t// provide a base URL.\n\tif ( ! wrapperSelector && ! baseURL ) {\n\t\treturn css;\n\t}\n\n\ttry {\n\t\tconst excludedSelectors = [\n\t\t\t...ignoredSelectors,\n\t\t\t...( transformOptions?.ignoredSelectors ?? [] ),\n\t\t\twrapperSelector,\n\t\t];\n\n\t\treturn new Processor(\n\t\t\t[\n\t\t\t\twrapperSelector &&\n\t\t\t\t\tprefixSelector( {\n\t\t\t\t\t\tprefix: wrapperSelector,\n\t\t\t\t\t\ttransform( prefix, selector, prefixedSelector ) {\n\t\t\t\t\t\t\t// For backwards compatibility, don't use the `exclude` option\n\t\t\t\t\t\t\t// of postcss-prefix-selector, instead handle it here to match\n\t\t\t\t\t\t\t// the behavior of the old library (postcss-prefix-wrap) that\n\t\t\t\t\t\t\t// `transformStyle` previously used.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\texcludedSelectors.some( ( excludedSelector ) =>\n\t\t\t\t\t\t\t\t\texcludedSelector instanceof RegExp\n\t\t\t\t\t\t\t\t\t\t? selector.match( excludedSelector )\n\t\t\t\t\t\t\t\t\t\t: selector.includes( excludedSelector )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn selector;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst hasRootSelector = ROOT_SELECTOR_TOKENS.some(\n\t\t\t\t\t\t\t\t( rootSelector ) =>\n\t\t\t\t\t\t\t\t\tselector.startsWith( rootSelector.content )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// Reorganize root selectors such that the root part comes before the prefix,\n\t\t\t\t\t\t\t// but the prefix still comes before the remaining part of the selector.\n\t\t\t\t\t\t\tif ( hasRootSelector ) {\n\t\t\t\t\t\t\t\treturn prefixRootSelector( prefix, selector );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn prefixedSelector;\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t\tbaseURL && rebaseUrl( { rootUrl: baseURL } ),\n\t\t\t].filter( Boolean ) as import('postcss').AcceptedPlugin[]\n\t\t).process( css, {} ).css; // use sync PostCSS API\n\t} catch ( error ) {\n\t\tif ( error instanceof CssSyntaxError ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'wp.blockEditor.transformStyles Failed to transform CSS.',\n\t\t\t\terror.message + '\\n' + error.showSourceCode( false )\n\t\t\t);\n\t\t} else {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn(\n\t\t\t\t'wp.blockEditor.transformStyles Failed to transform CSS.',\n\t\t\t\terror\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n}\n\n/**\n * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed.\n *\n * @param styles CSS rules.\n * @param wrapperSelector Wrapper selector.\n * @param transformOptions Additional options for style transformation.\n * @return converted rules.\n */\nconst transformStyles = (\n\tstyles: EditorStyle[],\n\twrapperSelector = '',\n\ttransformOptions?: TransformOptions\n) => {\n\tlet cache = cacheByWrapperSelector.get( wrapperSelector );\n\tif ( ! cache ) {\n\t\tcache = new WeakMap();\n\t\tcacheByWrapperSelector.set( wrapperSelector, cache );\n\t}\n\treturn styles.map( ( style ) => {\n\t\tlet css = cache.get( style );\n\t\tif ( ! css ) {\n\t\t\tcss = transformStyle( style, wrapperSelector, transformOptions );\n\t\t\tcache.set( style, css );\n\t\t}\n\t\treturn css;\n\t} );\n};\n\nexport default transformStyles;\n"],
5
+ "mappings": "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",
6
6
  "names": []
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=postcss-urlrebase.d.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -686,6 +686,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
686
686
  }
687
687
  .block-editor-default-block-appender .block-editor-default-block-appender__content {
688
688
  opacity: 0.62;
689
+ text-shadow: none;
689
690
  margin-block-start: 0;
690
691
  margin-block-end: 0;
691
692
  }
@@ -877,6 +878,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
877
878
  .rich-text [data-rich-text-placeholder]::after {
878
879
  content: attr(data-rich-text-placeholder);
879
880
  opacity: 0.62;
881
+ text-shadow: none;
880
882
  }
881
883
  .rich-text:focus {
882
884
  outline: none;
@@ -687,6 +687,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
687
687
  }
688
688
  .block-editor-default-block-appender .block-editor-default-block-appender__content {
689
689
  opacity: 0.62;
690
+ text-shadow: none;
690
691
  margin-block-start: 0;
691
692
  margin-block-end: 0;
692
693
  }
@@ -878,6 +879,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection=true] .blo
878
879
  .rich-text [data-rich-text-placeholder]::after {
879
880
  content: attr(data-rich-text-placeholder);
880
881
  opacity: 0.62;
882
+ text-shadow: none;
881
883
  }
882
884
  .rich-text:focus {
883
885
  outline: none;
@@ -1519,14 +1519,22 @@ iframe[name=editor-canvas] {
1519
1519
  background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
1520
1520
  }
1521
1521
 
1522
+ .block-editor-panel-color-gradient-settings__contrast-notice {
1523
+ margin-bottom: 16px;
1524
+ }
1525
+
1522
1526
  /**
1523
1527
  * The following styles replicate the separated border of the
1524
1528
  * `ItemGroup` component but allows for hidden items. This is because
1525
1529
  * to maintain the order of `ToolsPanel` controls, each `ToolsPanelItem`
1526
1530
  * must at least render a placeholder which would otherwise interfere
1527
1531
  * with the `:last-child` styles.
1532
+ *
1533
+ * Applied via the shared `block-editor-color-gradient-item` class on
1534
+ * color/gradient dropdown items across the Color, Background, and
1535
+ * Typography panels.
1528
1536
  */
1529
- .block-editor-tools-panel-color-gradient-settings__item {
1537
+ .block-editor-color-gradient-item {
1530
1538
  padding: 0;
1531
1539
  max-width: 100%;
1532
1540
  position: relative;
@@ -1534,18 +1542,17 @@ iframe[name=editor-canvas] {
1534
1542
  border-left: 1px solid #ddd;
1535
1543
  border-bottom: 1px solid #ddd;
1536
1544
  }
1537
- .block-editor-tools-panel-color-gradient-settings__item:nth-child(1 of .block-editor-tools-panel-color-gradient-settings__item) {
1538
- margin-top: 24px;
1545
+ .block-editor-color-gradient-item:nth-child(1 of .block-editor-color-gradient-item) {
1539
1546
  border-top-right-radius: 2px;
1540
1547
  border-top-left-radius: 2px;
1541
1548
  border-top: 1px solid #ddd;
1542
1549
  }
1543
- .block-editor-tools-panel-color-gradient-settings__item:nth-last-child(1 of .block-editor-tools-panel-color-gradient-settings__item) {
1550
+ .block-editor-color-gradient-item:nth-last-child(1 of .block-editor-color-gradient-item) {
1544
1551
  border-bottom-right-radius: 2px;
1545
1552
  border-bottom-left-radius: 2px;
1546
1553
  }
1547
- .block-editor-tools-panel-color-gradient-settings__item > div,
1548
- .block-editor-tools-panel-color-gradient-settings__item > div > button {
1554
+ .block-editor-color-gradient-item > div,
1555
+ .block-editor-color-gradient-item > div > button {
1549
1556
  border-radius: inherit;
1550
1557
  }
1551
1558
 
@@ -1569,6 +1576,9 @@ iframe[name=editor-canvas] {
1569
1576
  text-overflow: ellipsis;
1570
1577
  max-width: calc(100% - 44px);
1571
1578
  }
1579
+ .block-editor-tools-panel-color-gradient-settings__dropdown > button.has-contrast-warning .block-editor-panel-color-gradient-settings__color-name {
1580
+ max-width: calc(100% - 72px);
1581
+ }
1572
1582
 
1573
1583
  .block-editor-panel-color-gradient-settings__dropdown {
1574
1584
  width: 100%;
@@ -1600,6 +1610,19 @@ iframe[name=editor-canvas] {
1600
1610
  opacity: 1;
1601
1611
  }
1602
1612
  }
1613
+ .block-editor-panel-color-gradient-settings__dropdown.has-contrast-warning + .block-editor-panel-color-gradient-settings__reset {
1614
+ left: 28px;
1615
+ }
1616
+
1617
+ .block-editor-panel-color-gradient-settings__contrast-warning {
1618
+ position: absolute;
1619
+ left: 0;
1620
+ top: 8px;
1621
+ margin: auto 8px auto;
1622
+ }
1623
+ .block-editor-panel-color-gradient-settings__contrast-warning.block-editor-panel-color-gradient-settings__contrast-warning {
1624
+ border-radius: 2px;
1625
+ }
1603
1626
 
1604
1627
  .block-editor-date-format-picker {
1605
1628
  margin: 0 0 16px;
@@ -3410,33 +3433,6 @@ iframe[name=editor-canvas] {
3410
3433
  font-size: 12px;
3411
3434
  }
3412
3435
 
3413
- /**
3414
- * ItemGroup-like border styles for the background panel's ToolsPanelItems.
3415
- * Replicates the separated border of the `ItemGroup` component while
3416
- * allowing for hidden placeholder items (same approach as the color panel).
3417
- */
3418
- .block-editor-background-panel__item {
3419
- padding: 0;
3420
- max-width: 100%;
3421
- position: relative;
3422
- border-right: 1px solid #ddd;
3423
- border-left: 1px solid #ddd;
3424
- border-bottom: 1px solid #ddd;
3425
- }
3426
- .block-editor-background-panel__item:nth-child(1 of .block-editor-background-panel__item) {
3427
- border-top-right-radius: 2px;
3428
- border-top-left-radius: 2px;
3429
- border-top: 1px solid #ddd;
3430
- }
3431
- .block-editor-background-panel__item:nth-last-child(1 of .block-editor-background-panel__item) {
3432
- border-bottom-right-radius: 2px;
3433
- border-bottom-left-radius: 2px;
3434
- }
3435
- .block-editor-background-panel__item > div,
3436
- .block-editor-background-panel__item > div > button {
3437
- border-radius: inherit;
3438
- }
3439
-
3440
3436
  .background-block-support-panel {
3441
3437
  /* Increased specificity required to remove the slot wrapper's row gap */
3442
3438
  }
@@ -3651,15 +3647,12 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3651
3647
  .color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper {
3652
3648
  row-gap: 0;
3653
3649
  }
3654
- .color-block-support-panel {
3655
- /**
3656
- * After converting PanelColorGradientSettings to render as a ToolsPanel
3657
- * we need to remove the top margin when wrapping inner content due to
3658
- * rendering via SlotFills.
3659
- */
3650
+
3651
+ .elements-block-support-panel {
3652
+ /* Increased specificity required to remove the slot wrapper's row gap */
3660
3653
  }
3661
- .color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first {
3662
- margin-top: 0;
3654
+ .elements-block-support-panel.elements-block-support-panel .elements-block-support-panel__inner-wrapper {
3655
+ row-gap: 0;
3663
3656
  }
3664
3657
 
3665
3658
  .dimensions-block-support-panel .single-column {
@@ -1519,14 +1519,22 @@ iframe[name=editor-canvas] {
1519
1519
  background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
1520
1520
  }
1521
1521
 
1522
+ .block-editor-panel-color-gradient-settings__contrast-notice {
1523
+ margin-bottom: 16px;
1524
+ }
1525
+
1522
1526
  /**
1523
1527
  * The following styles replicate the separated border of the
1524
1528
  * `ItemGroup` component but allows for hidden items. This is because
1525
1529
  * to maintain the order of `ToolsPanel` controls, each `ToolsPanelItem`
1526
1530
  * must at least render a placeholder which would otherwise interfere
1527
1531
  * with the `:last-child` styles.
1532
+ *
1533
+ * Applied via the shared `block-editor-color-gradient-item` class on
1534
+ * color/gradient dropdown items across the Color, Background, and
1535
+ * Typography panels.
1528
1536
  */
1529
- .block-editor-tools-panel-color-gradient-settings__item {
1537
+ .block-editor-color-gradient-item {
1530
1538
  padding: 0;
1531
1539
  max-width: 100%;
1532
1540
  position: relative;
@@ -1534,18 +1542,17 @@ iframe[name=editor-canvas] {
1534
1542
  border-right: 1px solid #ddd;
1535
1543
  border-bottom: 1px solid #ddd;
1536
1544
  }
1537
- .block-editor-tools-panel-color-gradient-settings__item:nth-child(1 of .block-editor-tools-panel-color-gradient-settings__item) {
1538
- margin-top: 24px;
1545
+ .block-editor-color-gradient-item:nth-child(1 of .block-editor-color-gradient-item) {
1539
1546
  border-top-left-radius: 2px;
1540
1547
  border-top-right-radius: 2px;
1541
1548
  border-top: 1px solid #ddd;
1542
1549
  }
1543
- .block-editor-tools-panel-color-gradient-settings__item:nth-last-child(1 of .block-editor-tools-panel-color-gradient-settings__item) {
1550
+ .block-editor-color-gradient-item:nth-last-child(1 of .block-editor-color-gradient-item) {
1544
1551
  border-bottom-left-radius: 2px;
1545
1552
  border-bottom-right-radius: 2px;
1546
1553
  }
1547
- .block-editor-tools-panel-color-gradient-settings__item > div,
1548
- .block-editor-tools-panel-color-gradient-settings__item > div > button {
1554
+ .block-editor-color-gradient-item > div,
1555
+ .block-editor-color-gradient-item > div > button {
1549
1556
  border-radius: inherit;
1550
1557
  }
1551
1558
 
@@ -1569,6 +1576,9 @@ iframe[name=editor-canvas] {
1569
1576
  text-overflow: ellipsis;
1570
1577
  max-width: calc(100% - 44px);
1571
1578
  }
1579
+ .block-editor-tools-panel-color-gradient-settings__dropdown > button.has-contrast-warning .block-editor-panel-color-gradient-settings__color-name {
1580
+ max-width: calc(100% - 72px);
1581
+ }
1572
1582
 
1573
1583
  .block-editor-panel-color-gradient-settings__dropdown {
1574
1584
  width: 100%;
@@ -1600,6 +1610,19 @@ iframe[name=editor-canvas] {
1600
1610
  opacity: 1;
1601
1611
  }
1602
1612
  }
1613
+ .block-editor-panel-color-gradient-settings__dropdown.has-contrast-warning + .block-editor-panel-color-gradient-settings__reset {
1614
+ right: 28px;
1615
+ }
1616
+
1617
+ .block-editor-panel-color-gradient-settings__contrast-warning {
1618
+ position: absolute;
1619
+ right: 0;
1620
+ top: 8px;
1621
+ margin: auto 8px auto;
1622
+ }
1623
+ .block-editor-panel-color-gradient-settings__contrast-warning.block-editor-panel-color-gradient-settings__contrast-warning {
1624
+ border-radius: 2px;
1625
+ }
1603
1626
 
1604
1627
  .block-editor-date-format-picker {
1605
1628
  margin: 0 0 16px;
@@ -3412,33 +3435,6 @@ iframe[name=editor-canvas] {
3412
3435
  font-size: 12px;
3413
3436
  }
3414
3437
 
3415
- /**
3416
- * ItemGroup-like border styles for the background panel's ToolsPanelItems.
3417
- * Replicates the separated border of the `ItemGroup` component while
3418
- * allowing for hidden placeholder items (same approach as the color panel).
3419
- */
3420
- .block-editor-background-panel__item {
3421
- padding: 0;
3422
- max-width: 100%;
3423
- position: relative;
3424
- border-left: 1px solid #ddd;
3425
- border-right: 1px solid #ddd;
3426
- border-bottom: 1px solid #ddd;
3427
- }
3428
- .block-editor-background-panel__item:nth-child(1 of .block-editor-background-panel__item) {
3429
- border-top-left-radius: 2px;
3430
- border-top-right-radius: 2px;
3431
- border-top: 1px solid #ddd;
3432
- }
3433
- .block-editor-background-panel__item:nth-last-child(1 of .block-editor-background-panel__item) {
3434
- border-bottom-left-radius: 2px;
3435
- border-bottom-right-radius: 2px;
3436
- }
3437
- .block-editor-background-panel__item > div,
3438
- .block-editor-background-panel__item > div > button {
3439
- border-radius: inherit;
3440
- }
3441
-
3442
3438
  .background-block-support-panel {
3443
3439
  /* Increased specificity required to remove the slot wrapper's row gap */
3444
3440
  }
@@ -3653,15 +3649,12 @@ div.block-editor-bindings__panel button:hover .block-editor-bindings__item span
3653
3649
  .color-block-support-panel.color-block-support-panel .color-block-support-panel__inner-wrapper {
3654
3650
  row-gap: 0;
3655
3651
  }
3656
- .color-block-support-panel {
3657
- /**
3658
- * After converting PanelColorGradientSettings to render as a ToolsPanel
3659
- * we need to remove the top margin when wrapping inner content due to
3660
- * rendering via SlotFills.
3661
- */
3652
+
3653
+ .elements-block-support-panel {
3654
+ /* Increased specificity required to remove the slot wrapper's row gap */
3662
3655
  }
3663
- .color-block-support-panel .block-editor-tools-panel-color-gradient-settings__item.first {
3664
- margin-top: 0;
3656
+ .elements-block-support-panel.elements-block-support-panel .elements-block-support-panel__inner-wrapper {
3657
+ row-gap: 0;
3665
3658
  }
3666
3659
 
3667
3660
  .dimensions-block-support-panel .single-column {
@@ -0,0 +1,27 @@
1
+ type Binding = {
2
+ source?: string;
3
+ };
4
+ type Bindings = Record<string, Binding>;
5
+ /**
6
+ * Checks if the block has the `__default` binding for pattern overrides.
7
+ *
8
+ * @param bindings A block's bindings from the metadata attribute.
9
+ *
10
+ * @return Whether the block has the `__default` binding for pattern overrides.
11
+ */
12
+ export declare function hasPatternOverridesDefaultBinding(bindings: Bindings | undefined | null): bindings is Bindings;
13
+ /**
14
+ * Returns the bindings with the `__default` binding for pattern overrides
15
+ * replaced with the full-set of supported attributes. e.g.:
16
+ *
17
+ * - bindings passed in: `{ __default: { source: 'core/pattern-overrides' } }`
18
+ * - bindings returned: `{ content: { source: 'core/pattern-overrides' } }`
19
+ *
20
+ * @param bindings A block's bindings from the metadata attribute.
21
+ * @param supportedAttributes The block's attributes which are supported by block bindings.
22
+ *
23
+ * @return The bindings with default replaced for pattern overrides.
24
+ */
25
+ export declare function replacePatternOverridesDefaultBinding(bindings: Bindings | undefined | null, supportedAttributes: string[]): Bindings | null | undefined;
26
+ export {};
27
+ //# sourceMappingURL=block-bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-bindings.d.ts","sourceRoot":"","sources":["../../src/utils/block-bindings.ts"],"names":[],"mappings":"AAAA,KAAK,OAAO,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACnC,KAAK,QAAQ,GAAG,MAAM,CAAE,MAAM,EAAE,OAAO,CAAE,CAAC;AAK1C;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAChD,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,GACnC,QAAQ,IAAI,QAAQ,CAEtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CACpD,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI,EACrC,mBAAmB,EAAE,MAAM,EAAE,+BAiB7B"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Extracts the palette slug from a style value for any preset type, supporting
3
+ * both the user preset format and the theme CSS-variable format:
4
+ *
5
+ * - User format: `var:preset|<type>|slug`
6
+ * - Theme format: `var(--wp--preset--<type>--slug)`
7
+ *
8
+ * Returns `undefined` for plain values, non-strings, or any other
9
+ * unrecognised format.
10
+ *
11
+ * @param rawValue Raw style value stored in the style object.
12
+ * @param type Preset type, e.g. `'color'` or `'gradient'`.
13
+ * @return The palette slug, or undefined.
14
+ */
15
+ export declare function extractPresetSlug(rawValue: unknown, type: 'color' | 'gradient'): string | undefined;
16
+ /**
17
+ * Encodes a color value for storage in the style object.
18
+ *
19
+ * When a `slug` is provided it is used directly (the slug-based selection
20
+ * path). This is important because two palette entries can share the same
21
+ * hex value (e.g. two custom colors both set to `#e10000`); relying on a
22
+ * hex lookup alone would collapse them onto whichever entry appears first
23
+ * in the palette and silently discard the user's actual choice. Only when
24
+ * no slug is supplied does the function fall back to matching the hex value
25
+ * against the palette; if a match is found the slug is encoded, otherwise
26
+ * the raw value is stored as-is.
27
+ *
28
+ * Callers pass the flattened palette (`allColors`), typically computed once
29
+ * per render from the per-origin `colors` array.
30
+ *
31
+ * @param allColors Flat array of `{ color, slug }` objects.
32
+ * @param colorValue Hex or CSS color string.
33
+ * @param slug Optional palette slug from slug-aware selection.
34
+ * @return Encoded value suitable for the style object.
35
+ */
36
+ export declare function encodeColorValueWithPalette(allColors: {
37
+ color: string;
38
+ slug: string;
39
+ }[], colorValue?: string, slug?: string): string | undefined;
40
+ //# sourceMappingURL=color-values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-values.d.ts","sourceRoot":"","sources":["../../src/utils/color-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,OAAO,GAAG,UAAU,sBAc1B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,2BAA2B,CAC1C,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAC5C,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,sBAOb"}