@wordpress/block-editor 14.1.0 → 14.2.1-next.1f6eadc42.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 (705) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -10
  3. package/build/components/block-alignment-matrix-control/index.js +2 -2
  4. package/build/components/block-alignment-matrix-control/index.js.map +1 -1
  5. package/build/components/block-breadcrumb/index.js +2 -2
  6. package/build/components/block-breadcrumb/index.js.map +1 -1
  7. package/build/components/block-canvas/index.js +8 -1
  8. package/build/components/block-canvas/index.js.map +1 -1
  9. package/build/components/block-compare/block-view.js +1 -0
  10. package/build/components/block-compare/block-view.js.map +1 -1
  11. package/build/components/block-draggable/index.js +4 -4
  12. package/build/components/block-draggable/index.js.map +1 -1
  13. package/build/components/block-draggable/use-scroll-when-dragging.js +25 -25
  14. package/build/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  15. package/build/components/block-edit/multiple-usage-warning.js +2 -0
  16. package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
  17. package/build/components/block-inspector/index.js +27 -11
  18. package/build/components/block-inspector/index.js.map +1 -1
  19. package/build/components/block-list/block-invalid-warning.js +3 -2
  20. package/build/components/block-list/block-invalid-warning.js.map +1 -1
  21. package/build/components/block-list/block.js +5 -1
  22. package/build/components/block-list/block.js.map +1 -1
  23. package/build/components/block-list/index.js +14 -3
  24. package/build/components/block-list/index.js.map +1 -1
  25. package/build/components/block-list/use-block-props/index.js +5 -1
  26. package/build/components/block-list/use-block-props/index.js.map +1 -1
  27. package/build/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  28. package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  29. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +53 -0
  30. package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  31. package/build/components/block-list/zoom-out-separator.js +98 -0
  32. package/build/components/block-list/zoom-out-separator.js.map +1 -0
  33. package/build/components/block-lock/toolbar.js +3 -3
  34. package/build/components/block-lock/toolbar.js.map +1 -1
  35. package/build/components/block-mover/button.js +1 -0
  36. package/build/components/block-mover/button.js.map +1 -1
  37. package/build/components/block-mover/index.js +1 -0
  38. package/build/components/block-mover/index.js.map +1 -1
  39. package/build/components/block-navigation/dropdown.js +4 -1
  40. package/build/components/block-navigation/dropdown.js.map +1 -1
  41. package/build/components/block-pattern-setup/index.js +2 -10
  42. package/build/components/block-pattern-setup/index.js.map +1 -1
  43. package/build/components/block-pattern-setup/setup-toolbar.js +22 -7
  44. package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  45. package/build/components/block-patterns-list/index.js +12 -20
  46. package/build/components/block-patterns-list/index.js.map +1 -1
  47. package/build/components/block-patterns-paging/index.js +12 -3
  48. package/build/components/block-patterns-paging/index.js.map +1 -1
  49. package/build/components/block-popover/index.js +2 -15
  50. package/build/components/block-popover/index.js.map +1 -1
  51. package/build/components/block-quick-navigation/index.js +4 -1
  52. package/build/components/block-quick-navigation/index.js.map +1 -1
  53. package/build/components/block-settings-menu-controls/index.js +4 -0
  54. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  55. package/build/components/block-switcher/index.js +30 -19
  56. package/build/components/block-switcher/index.js.map +1 -1
  57. package/build/components/block-switcher/pattern-transformations-menu.js +2 -10
  58. package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  59. package/build/components/block-toolbar/index.js +19 -12
  60. package/build/components/block-toolbar/index.js.map +1 -1
  61. package/build/components/block-toolbar/shuffle.js +6 -2
  62. package/build/components/block-toolbar/shuffle.js.map +1 -1
  63. package/build/components/block-tools/block-selection-button.js +8 -2
  64. package/build/components/block-tools/block-selection-button.js.map +1 -1
  65. package/build/components/block-tools/block-toolbar-popover.js +10 -6
  66. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  67. package/build/components/block-tools/index.js +1 -1
  68. package/build/components/block-tools/index.js.map +1 -1
  69. package/build/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  70. package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  71. package/build/components/block-tools/zoom-out-mode-inserters.js +7 -21
  72. package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  73. package/build/components/block-tools/zoom-out-popover.js +3 -4
  74. package/build/components/block-tools/zoom-out-popover.js.map +1 -1
  75. package/build/components/block-tools/zoom-out-toolbar.js +26 -7
  76. package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
  77. package/build/components/block-variation-picker/index.js +4 -1
  78. package/build/components/block-variation-picker/index.js.map +1 -1
  79. package/build/components/block-variation-transforms/index.js +4 -1
  80. package/build/components/block-variation-transforms/index.js.map +1 -1
  81. package/build/components/button-block-appender/index.js +20 -23
  82. package/build/components/button-block-appender/index.js.map +1 -1
  83. package/build/components/colors-gradients/dropdown.js +4 -1
  84. package/build/components/colors-gradients/dropdown.js.map +1 -1
  85. package/build/components/content-lock/index.js +13 -0
  86. package/build/components/content-lock/index.js.map +1 -0
  87. package/build/components/content-lock/modify-content-lock-menu-item.js +64 -0
  88. package/build/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  89. package/build/components/editor-styles/index.js +4 -3
  90. package/build/components/editor-styles/index.js.map +1 -1
  91. package/build/components/global-styles/background-panel.js +8 -12
  92. package/build/components/global-styles/background-panel.js.map +1 -1
  93. package/build/components/global-styles/color-panel.js +8 -5
  94. package/build/components/global-styles/color-panel.js.map +1 -1
  95. package/build/components/global-styles/color-panel.native.js +1 -1
  96. package/build/components/global-styles/color-panel.native.js.map +1 -1
  97. package/build/components/global-styles/dimensions-panel.js +34 -37
  98. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  99. package/build/components/global-styles/filters-panel.js +4 -1
  100. package/build/components/global-styles/filters-panel.js.map +1 -1
  101. package/build/components/global-styles/shadow-panel-components.js +14 -17
  102. package/build/components/global-styles/shadow-panel-components.js.map +1 -1
  103. package/build/components/global-styles/typography-utils.js +17 -6
  104. package/build/components/global-styles/typography-utils.js.map +1 -1
  105. package/build/components/global-styles/utils.js +4 -6
  106. package/build/components/global-styles/utils.js.map +1 -1
  107. package/build/components/grid/grid-item-movers.js +2 -2
  108. package/build/components/grid/grid-item-movers.js.map +1 -1
  109. package/build/components/grid/grid-item-resizer.js +2 -2
  110. package/build/components/grid/grid-item-resizer.js.map +1 -1
  111. package/build/components/iframe/get-compatibility-styles.js +1 -1
  112. package/build/components/iframe/get-compatibility-styles.js.map +1 -1
  113. package/build/components/iframe/index.js +5 -5
  114. package/build/components/iframe/index.js.map +1 -1
  115. package/build/components/inner-blocks/index.js +2 -4
  116. package/build/components/inner-blocks/index.js.map +1 -1
  117. package/build/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  118. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  119. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  120. package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  121. package/build/components/inserter/block-patterns-tab/index.js +4 -1
  122. package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
  123. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
  124. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  125. package/build/components/inserter/index.js +4 -11
  126. package/build/components/inserter/index.js.map +1 -1
  127. package/build/components/inserter/library.js +2 -4
  128. package/build/components/inserter/library.js.map +1 -1
  129. package/build/components/inserter/media-tab/hooks.js +3 -3
  130. package/build/components/inserter/media-tab/hooks.js.map +1 -1
  131. package/build/components/inserter/media-tab/media-list.js +1 -8
  132. package/build/components/inserter/media-tab/media-list.js.map +1 -1
  133. package/build/components/inserter/media-tab/media-preview.js +9 -7
  134. package/build/components/inserter/media-tab/media-preview.js.map +1 -1
  135. package/build/components/inserter/media-tab/media-tab.js +4 -1
  136. package/build/components/inserter/media-tab/media-tab.js.map +1 -1
  137. package/build/components/inserter/menu.js +7 -24
  138. package/build/components/inserter/menu.js.map +1 -1
  139. package/build/components/inserter/quick-inserter.js +4 -5
  140. package/build/components/inserter/quick-inserter.js.map +1 -1
  141. package/build/components/inserter-list-item/index.js +4 -4
  142. package/build/components/inserter-list-item/index.js.map +1 -1
  143. package/build/components/inserter-listbox/index.js +3 -13
  144. package/build/components/inserter-listbox/index.js.map +1 -1
  145. package/build/components/inserter-listbox/item.js +6 -11
  146. package/build/components/inserter-listbox/item.js.map +1 -1
  147. package/build/components/inserter-listbox/row.js +1 -9
  148. package/build/components/inserter-listbox/row.js.map +1 -1
  149. package/build/components/inspector-controls/groups.js +2 -0
  150. package/build/components/inspector-controls/groups.js.map +1 -1
  151. package/build/components/inspector-controls-tabs/index.js +4 -1
  152. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  153. package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
  154. package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  155. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  156. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  157. package/build/components/inspector-popover-header/index.js +8 -2
  158. package/build/components/inspector-popover-header/index.js.map +1 -1
  159. package/build/components/letter-spacing-control/index.js +7 -4
  160. package/build/components/letter-spacing-control/index.js.map +1 -1
  161. package/build/components/link-control/index.js +19 -10
  162. package/build/components/link-control/index.js.map +1 -1
  163. package/build/components/link-control/settings-drawer.js +4 -1
  164. package/build/components/link-control/settings-drawer.js.map +1 -1
  165. package/build/components/list-view/block-select-button.js +4 -1
  166. package/build/components/list-view/block-select-button.js.map +1 -1
  167. package/build/components/list-view/index.js +3 -7
  168. package/build/components/list-view/index.js.map +1 -1
  169. package/build/components/media-placeholder/index.js +32 -11
  170. package/build/components/media-placeholder/index.js.map +1 -1
  171. package/build/components/media-replace-flow/index.js +8 -1
  172. package/build/components/media-replace-flow/index.js.map +1 -1
  173. package/build/components/provider/use-block-sync.js +19 -19
  174. package/build/components/provider/use-block-sync.js.map +1 -1
  175. package/build/components/rich-text/event-listeners/paste-handler.js +12 -1
  176. package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  177. package/build/components/rich-text/index.js +38 -30
  178. package/build/components/rich-text/index.js.map +1 -1
  179. package/build/components/rich-text/use-mark-persistent.js +5 -5
  180. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  181. package/build/components/skip-to-selected-block/index.js +4 -1
  182. package/build/components/skip-to-selected-block/index.js.map +1 -1
  183. package/build/components/spacing-sizes-control/index.js +8 -9
  184. package/build/components/spacing-sizes-control/index.js.map +1 -1
  185. package/build/components/spacing-sizes-control/linked-button.js +35 -0
  186. package/build/components/spacing-sizes-control/linked-button.js.map +1 -0
  187. package/build/components/spacing-sizes-control/utils.js +4 -15
  188. package/build/components/spacing-sizes-control/utils.js.map +1 -1
  189. package/build/components/tool-selector/index.js +4 -1
  190. package/build/components/tool-selector/index.js.map +1 -1
  191. package/build/components/url-input/button.js +12 -3
  192. package/build/components/url-input/button.js.map +1 -1
  193. package/build/components/url-input/index.js +4 -1
  194. package/build/components/url-input/index.js.map +1 -1
  195. package/build/components/use-block-drop-zone/index.js +31 -7
  196. package/build/components/use-block-drop-zone/index.js.map +1 -1
  197. package/build/components/writing-flow/index.js +2 -1
  198. package/build/components/writing-flow/index.js.map +1 -1
  199. package/build/components/writing-flow/use-arrow-nav.js +4 -1
  200. package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
  201. package/build/components/writing-flow/use-event-redirect.js +66 -0
  202. package/build/components/writing-flow/use-event-redirect.js.map +1 -0
  203. package/build/components/writing-flow/use-input.js +31 -1
  204. package/build/components/writing-flow/use-input.js.map +1 -1
  205. package/build/components/writing-flow/use-select-all.js +14 -1
  206. package/build/components/writing-flow/use-select-all.js.map +1 -1
  207. package/build/components/writing-flow/use-selection-observer.js +20 -6
  208. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  209. package/build/components/writing-flow/use-tab-nav.js +4 -4
  210. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  211. package/build/components/writing-flow/utils.js +27 -0
  212. package/build/components/writing-flow/utils.js.map +1 -1
  213. package/build/hooks/block-bindings.js +33 -29
  214. package/build/hooks/block-bindings.js.map +1 -1
  215. package/build/hooks/content-lock-ui.js +8 -26
  216. package/build/hooks/content-lock-ui.js.map +1 -1
  217. package/build/hooks/duotone.js +0 -4
  218. package/build/hooks/duotone.js.map +1 -1
  219. package/build/hooks/layout.js +4 -2
  220. package/build/hooks/layout.js.map +1 -1
  221. package/build/hooks/spacing-visualizer.js +3 -3
  222. package/build/hooks/spacing-visualizer.js.map +1 -1
  223. package/build/hooks/style.js +1 -5
  224. package/build/hooks/style.js.map +1 -1
  225. package/build/hooks/use-bindings-attributes.js +19 -20
  226. package/build/hooks/use-bindings-attributes.js.map +1 -1
  227. package/build/hooks/use-zoom-out.js +7 -7
  228. package/build/hooks/use-zoom-out.js.map +1 -1
  229. package/build/layouts/constrained.js +41 -42
  230. package/build/layouts/constrained.js.map +1 -1
  231. package/build/layouts/flex.js +4 -1
  232. package/build/layouts/flex.js.map +1 -1
  233. package/build/layouts/grid.js +19 -16
  234. package/build/layouts/grid.js.map +1 -1
  235. package/build/layouts/utils.js +1 -7
  236. package/build/layouts/utils.js.map +1 -1
  237. package/build/private-apis.js +2 -3
  238. package/build/private-apis.js.map +1 -1
  239. package/build/store/actions.js +2 -7
  240. package/build/store/actions.js.map +1 -1
  241. package/build/store/private-actions.js +1 -0
  242. package/build/store/private-actions.js.map +1 -1
  243. package/build/store/private-keys.js +2 -1
  244. package/build/store/private-keys.js.map +1 -1
  245. package/build/store/private-selectors.js +16 -18
  246. package/build/store/private-selectors.js.map +1 -1
  247. package/build/store/reducer.js +1 -10
  248. package/build/store/reducer.js.map +1 -1
  249. package/build/store/selectors.js +19 -43
  250. package/build/store/selectors.js.map +1 -1
  251. package/build/store/utils.js +48 -0
  252. package/build/store/utils.js.map +1 -1
  253. package/build/utils/block-bindings.js +16 -11
  254. package/build/utils/block-bindings.js.map +1 -1
  255. package/build/utils/dom.js +101 -0
  256. package/build/utils/dom.js.map +1 -1
  257. package/build/utils/get-font-styles-and-weights.js +4 -4
  258. package/build/utils/get-font-styles-and-weights.js.map +1 -1
  259. package/build/utils/transform-styles/index.js +120 -16
  260. package/build/utils/transform-styles/index.js.map +1 -1
  261. package/build-module/components/block-alignment-matrix-control/index.js +1 -1
  262. package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
  263. package/build-module/components/block-breadcrumb/index.js +2 -2
  264. package/build-module/components/block-breadcrumb/index.js.map +1 -1
  265. package/build-module/components/block-canvas/index.js +9 -1
  266. package/build-module/components/block-canvas/index.js.map +1 -1
  267. package/build-module/components/block-compare/block-view.js +1 -0
  268. package/build-module/components/block-compare/block-view.js.map +1 -1
  269. package/build-module/components/block-draggable/index.js +4 -4
  270. package/build-module/components/block-draggable/index.js.map +1 -1
  271. package/build-module/components/block-draggable/use-scroll-when-dragging.js +25 -25
  272. package/build-module/components/block-draggable/use-scroll-when-dragging.js.map +1 -1
  273. package/build-module/components/block-edit/multiple-usage-warning.js +2 -0
  274. package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
  275. package/build-module/components/block-inspector/index.js +27 -11
  276. package/build-module/components/block-inspector/index.js.map +1 -1
  277. package/build-module/components/block-list/block-invalid-warning.js +3 -2
  278. package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
  279. package/build-module/components/block-list/block.js +5 -1
  280. package/build-module/components/block-list/block.js.map +1 -1
  281. package/build-module/components/block-list/index.js +14 -3
  282. package/build-module/components/block-list/index.js.map +1 -1
  283. package/build-module/components/block-list/use-block-props/index.js +5 -1
  284. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  285. package/build-module/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  286. package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
  287. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +47 -0
  288. package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -0
  289. package/build-module/components/block-list/zoom-out-separator.js +90 -0
  290. package/build-module/components/block-list/zoom-out-separator.js.map +1 -0
  291. package/build-module/components/block-lock/toolbar.js +3 -3
  292. package/build-module/components/block-lock/toolbar.js.map +1 -1
  293. package/build-module/components/block-mover/button.js +1 -0
  294. package/build-module/components/block-mover/button.js.map +1 -1
  295. package/build-module/components/block-mover/index.js +1 -0
  296. package/build-module/components/block-mover/index.js.map +1 -1
  297. package/build-module/components/block-navigation/dropdown.js +4 -1
  298. package/build-module/components/block-navigation/dropdown.js.map +1 -1
  299. package/build-module/components/block-pattern-setup/index.js +2 -10
  300. package/build-module/components/block-pattern-setup/index.js.map +1 -1
  301. package/build-module/components/block-pattern-setup/setup-toolbar.js +23 -8
  302. package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
  303. package/build-module/components/block-patterns-list/index.js +12 -20
  304. package/build-module/components/block-patterns-list/index.js.map +1 -1
  305. package/build-module/components/block-patterns-paging/index.js +12 -3
  306. package/build-module/components/block-patterns-paging/index.js.map +1 -1
  307. package/build-module/components/block-popover/index.js +2 -15
  308. package/build-module/components/block-popover/index.js.map +1 -1
  309. package/build-module/components/block-quick-navigation/index.js +4 -1
  310. package/build-module/components/block-quick-navigation/index.js.map +1 -1
  311. package/build-module/components/block-settings-menu-controls/index.js +4 -0
  312. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  313. package/build-module/components/block-switcher/index.js +30 -19
  314. package/build-module/components/block-switcher/index.js.map +1 -1
  315. package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -10
  316. package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
  317. package/build-module/components/block-toolbar/index.js +19 -12
  318. package/build-module/components/block-toolbar/index.js.map +1 -1
  319. package/build-module/components/block-toolbar/shuffle.js +6 -2
  320. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  321. package/build-module/components/block-tools/block-selection-button.js +8 -2
  322. package/build-module/components/block-tools/block-selection-button.js.map +1 -1
  323. package/build-module/components/block-tools/block-toolbar-popover.js +10 -6
  324. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  325. package/build-module/components/block-tools/index.js +1 -1
  326. package/build-module/components/block-tools/index.js.map +1 -1
  327. package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  328. package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
  329. package/build-module/components/block-tools/zoom-out-mode-inserters.js +7 -22
  330. package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
  331. package/build-module/components/block-tools/zoom-out-popover.js +3 -4
  332. package/build-module/components/block-tools/zoom-out-popover.js.map +1 -1
  333. package/build-module/components/block-tools/zoom-out-toolbar.js +27 -8
  334. package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
  335. package/build-module/components/block-variation-picker/index.js +4 -1
  336. package/build-module/components/block-variation-picker/index.js.map +1 -1
  337. package/build-module/components/block-variation-transforms/index.js +4 -1
  338. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  339. package/build-module/components/button-block-appender/index.js +22 -26
  340. package/build-module/components/button-block-appender/index.js.map +1 -1
  341. package/build-module/components/colors-gradients/dropdown.js +4 -1
  342. package/build-module/components/colors-gradients/dropdown.js.map +1 -1
  343. package/build-module/components/content-lock/index.js +2 -0
  344. package/build-module/components/content-lock/index.js.map +1 -0
  345. package/build-module/components/content-lock/modify-content-lock-menu-item.js +57 -0
  346. package/build-module/components/content-lock/modify-content-lock-menu-item.js.map +1 -0
  347. package/build-module/components/editor-styles/index.js +4 -3
  348. package/build-module/components/editor-styles/index.js.map +1 -1
  349. package/build-module/components/global-styles/background-panel.js +8 -12
  350. package/build-module/components/global-styles/background-panel.js.map +1 -1
  351. package/build-module/components/global-styles/color-panel.js +7 -4
  352. package/build-module/components/global-styles/color-panel.js.map +1 -1
  353. package/build-module/components/global-styles/color-panel.native.js +2 -2
  354. package/build-module/components/global-styles/color-panel.native.js.map +1 -1
  355. package/build-module/components/global-styles/dimensions-panel.js +36 -39
  356. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  357. package/build-module/components/global-styles/filters-panel.js +4 -1
  358. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  359. package/build-module/components/global-styles/shadow-panel-components.js +14 -17
  360. package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
  361. package/build-module/components/global-styles/typography-utils.js +17 -6
  362. package/build-module/components/global-styles/typography-utils.js.map +1 -1
  363. package/build-module/components/global-styles/utils.js +4 -6
  364. package/build-module/components/global-styles/utils.js.map +1 -1
  365. package/build-module/components/grid/grid-item-movers.js +3 -3
  366. package/build-module/components/grid/grid-item-movers.js.map +1 -1
  367. package/build-module/components/grid/grid-item-resizer.js +2 -2
  368. package/build-module/components/grid/grid-item-resizer.js.map +1 -1
  369. package/build-module/components/iframe/get-compatibility-styles.js +1 -1
  370. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
  371. package/build-module/components/iframe/index.js +5 -5
  372. package/build-module/components/iframe/index.js.map +1 -1
  373. package/build-module/components/inner-blocks/index.js +2 -4
  374. package/build-module/components/inner-blocks/index.js.map +1 -1
  375. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  376. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  377. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +4 -1
  378. package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
  379. package/build-module/components/inserter/block-patterns-tab/index.js +4 -1
  380. package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
  381. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
  382. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  383. package/build-module/components/inserter/index.js +4 -11
  384. package/build-module/components/inserter/index.js.map +1 -1
  385. package/build-module/components/inserter/library.js +2 -4
  386. package/build-module/components/inserter/library.js.map +1 -1
  387. package/build-module/components/inserter/media-tab/hooks.js +3 -3
  388. package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
  389. package/build-module/components/inserter/media-tab/media-list.js +1 -8
  390. package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
  391. package/build-module/components/inserter/media-tab/media-preview.js +10 -8
  392. package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
  393. package/build-module/components/inserter/media-tab/media-tab.js +4 -1
  394. package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
  395. package/build-module/components/inserter/menu.js +7 -24
  396. package/build-module/components/inserter/menu.js.map +1 -1
  397. package/build-module/components/inserter/quick-inserter.js +5 -6
  398. package/build-module/components/inserter/quick-inserter.js.map +1 -1
  399. package/build-module/components/inserter-list-item/index.js +4 -4
  400. package/build-module/components/inserter-list-item/index.js.map +1 -1
  401. package/build-module/components/inserter-listbox/index.js +3 -11
  402. package/build-module/components/inserter-listbox/index.js.map +1 -1
  403. package/build-module/components/inserter-listbox/item.js +7 -12
  404. package/build-module/components/inserter-listbox/item.js.map +1 -1
  405. package/build-module/components/inserter-listbox/row.js +2 -10
  406. package/build-module/components/inserter-listbox/row.js.map +1 -1
  407. package/build-module/components/inspector-controls/groups.js +2 -0
  408. package/build-module/components/inspector-controls/groups.js.map +1 -1
  409. package/build-module/components/inspector-controls-tabs/index.js +4 -1
  410. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  411. package/build-module/components/inspector-controls-tabs/settings-tab.js +3 -1
  412. package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
  413. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -1
  414. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  415. package/build-module/components/inspector-popover-header/index.js +8 -2
  416. package/build-module/components/inspector-popover-header/index.js.map +1 -1
  417. package/build-module/components/letter-spacing-control/index.js +7 -4
  418. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  419. package/build-module/components/link-control/index.js +19 -10
  420. package/build-module/components/link-control/index.js.map +1 -1
  421. package/build-module/components/link-control/settings-drawer.js +4 -1
  422. package/build-module/components/link-control/settings-drawer.js.map +1 -1
  423. package/build-module/components/list-view/block-select-button.js +4 -1
  424. package/build-module/components/list-view/block-select-button.js.map +1 -1
  425. package/build-module/components/list-view/index.js +3 -7
  426. package/build-module/components/list-view/index.js.map +1 -1
  427. package/build-module/components/media-placeholder/index.js +32 -11
  428. package/build-module/components/media-placeholder/index.js.map +1 -1
  429. package/build-module/components/media-replace-flow/index.js +8 -1
  430. package/build-module/components/media-replace-flow/index.js.map +1 -1
  431. package/build-module/components/provider/use-block-sync.js +19 -19
  432. package/build-module/components/provider/use-block-sync.js.map +1 -1
  433. package/build-module/components/rich-text/event-listeners/paste-handler.js +12 -1
  434. package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
  435. package/build-module/components/rich-text/index.js +39 -31
  436. package/build-module/components/rich-text/index.js.map +1 -1
  437. package/build-module/components/rich-text/use-mark-persistent.js +5 -5
  438. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  439. package/build-module/components/skip-to-selected-block/index.js +4 -1
  440. package/build-module/components/skip-to-selected-block/index.js.map +1 -1
  441. package/build-module/components/spacing-sizes-control/index.js +9 -10
  442. package/build-module/components/spacing-sizes-control/index.js.map +1 -1
  443. package/build-module/components/spacing-sizes-control/linked-button.js +28 -0
  444. package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -0
  445. package/build-module/components/spacing-sizes-control/utils.js +4 -15
  446. package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
  447. package/build-module/components/tool-selector/index.js +4 -1
  448. package/build-module/components/tool-selector/index.js.map +1 -1
  449. package/build-module/components/url-input/button.js +12 -3
  450. package/build-module/components/url-input/button.js.map +1 -1
  451. package/build-module/components/url-input/index.js +4 -1
  452. package/build-module/components/url-input/index.js.map +1 -1
  453. package/build-module/components/use-block-drop-zone/index.js +31 -7
  454. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  455. package/build-module/components/writing-flow/index.js +2 -1
  456. package/build-module/components/writing-flow/index.js.map +1 -1
  457. package/build-module/components/writing-flow/use-arrow-nav.js +4 -1
  458. package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
  459. package/build-module/components/writing-flow/use-event-redirect.js +60 -0
  460. package/build-module/components/writing-flow/use-event-redirect.js.map +1 -0
  461. package/build-module/components/writing-flow/use-input.js +31 -1
  462. package/build-module/components/writing-flow/use-input.js.map +1 -1
  463. package/build-module/components/writing-flow/use-select-all.js +14 -1
  464. package/build-module/components/writing-flow/use-select-all.js.map +1 -1
  465. package/build-module/components/writing-flow/use-selection-observer.js +16 -2
  466. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  467. package/build-module/components/writing-flow/use-tab-nav.js +4 -4
  468. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  469. package/build-module/components/writing-flow/utils.js +26 -0
  470. package/build-module/components/writing-flow/utils.js.map +1 -1
  471. package/build-module/hooks/block-bindings.js +35 -31
  472. package/build-module/hooks/block-bindings.js.map +1 -1
  473. package/build-module/hooks/content-lock-ui.js +10 -30
  474. package/build-module/hooks/content-lock-ui.js.map +1 -1
  475. package/build-module/hooks/duotone.js +0 -4
  476. package/build-module/hooks/duotone.js.map +1 -1
  477. package/build-module/hooks/layout.js +4 -2
  478. package/build-module/hooks/layout.js.map +1 -1
  479. package/build-module/hooks/spacing-visualizer.js +3 -3
  480. package/build-module/hooks/spacing-visualizer.js.map +1 -1
  481. package/build-module/hooks/style.js +1 -5
  482. package/build-module/hooks/style.js.map +1 -1
  483. package/build-module/hooks/use-bindings-attributes.js +19 -20
  484. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  485. package/build-module/hooks/use-zoom-out.js +7 -7
  486. package/build-module/hooks/use-zoom-out.js.map +1 -1
  487. package/build-module/layouts/constrained.js +44 -45
  488. package/build-module/layouts/constrained.js.map +1 -1
  489. package/build-module/layouts/flex.js +4 -1
  490. package/build-module/layouts/flex.js.map +1 -1
  491. package/build-module/layouts/grid.js +21 -18
  492. package/build-module/layouts/grid.js.map +1 -1
  493. package/build-module/layouts/utils.js +1 -7
  494. package/build-module/layouts/utils.js.map +1 -1
  495. package/build-module/private-apis.js +3 -4
  496. package/build-module/private-apis.js.map +1 -1
  497. package/build-module/store/actions.js +2 -7
  498. package/build-module/store/actions.js.map +1 -1
  499. package/build-module/store/private-actions.js +1 -0
  500. package/build-module/store/private-actions.js.map +1 -1
  501. package/build-module/store/private-keys.js +1 -0
  502. package/build-module/store/private-keys.js.map +1 -1
  503. package/build-module/store/private-selectors.js +15 -18
  504. package/build-module/store/private-selectors.js.map +1 -1
  505. package/build-module/store/reducer.js +1 -9
  506. package/build-module/store/reducer.js.map +1 -1
  507. package/build-module/store/selectors.js +22 -46
  508. package/build-module/store/selectors.js.map +1 -1
  509. package/build-module/store/utils.js +46 -0
  510. package/build-module/store/utils.js.map +1 -1
  511. package/build-module/utils/block-bindings.js +17 -12
  512. package/build-module/utils/block-bindings.js.map +1 -1
  513. package/build-module/utils/dom.js +99 -0
  514. package/build-module/utils/dom.js.map +1 -1
  515. package/build-module/utils/get-font-styles-and-weights.js +4 -4
  516. package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
  517. package/build-module/utils/transform-styles/index.js +120 -16
  518. package/build-module/utils/transform-styles/index.js.map +1 -1
  519. package/build-style/content-rtl.css +19 -11
  520. package/build-style/content.css +19 -11
  521. package/build-style/style-rtl.css +27 -117
  522. package/build-style/style.css +27 -117
  523. package/build-types/utils/dom.d.ts +25 -0
  524. package/build-types/utils/dom.d.ts.map +1 -1
  525. package/package.json +34 -32
  526. package/src/components/block-alignment-matrix-control/index.js +1 -1
  527. package/src/components/block-breadcrumb/index.js +2 -2
  528. package/src/components/block-breadcrumb/style.scss +1 -30
  529. package/src/components/block-canvas/index.js +9 -1
  530. package/src/components/block-compare/block-view.js +6 -1
  531. package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
  532. package/src/components/block-draggable/content.scss +1 -1
  533. package/src/components/block-draggable/index.js +4 -4
  534. package/src/components/block-draggable/style.scss +1 -1
  535. package/src/components/block-draggable/use-scroll-when-dragging.js +25 -25
  536. package/src/components/block-edit/multiple-usage-warning.js +2 -0
  537. package/src/components/block-inspector/index.js +22 -7
  538. package/src/components/block-inspector/style.scss +2 -4
  539. package/src/components/block-list/block-invalid-warning.js +3 -2
  540. package/src/components/block-list/block.js +6 -2
  541. package/src/components/block-list/content.scss +23 -3
  542. package/src/components/block-list/index.js +59 -38
  543. package/src/components/block-list/use-block-props/index.js +3 -0
  544. package/src/components/block-list/use-block-props/use-focus-first-element.js +1 -0
  545. package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +56 -0
  546. package/src/components/block-list/zoom-out-separator.js +110 -0
  547. package/src/components/block-lock/style.scss +1 -1
  548. package/src/components/block-lock/toolbar.js +3 -3
  549. package/src/components/block-mover/button.js +1 -0
  550. package/src/components/block-mover/index.js +1 -0
  551. package/src/components/block-mover/style.scss +1 -1
  552. package/src/components/block-navigation/dropdown.js +2 -0
  553. package/src/components/block-pattern-setup/index.js +3 -15
  554. package/src/components/block-pattern-setup/setup-toolbar.js +17 -4
  555. package/src/components/block-pattern-setup/style.scss +2 -2
  556. package/src/components/block-patterns-list/index.js +15 -18
  557. package/src/components/block-patterns-list/style.scss +2 -2
  558. package/src/components/block-patterns-paging/index.js +6 -0
  559. package/src/components/block-popover/index.js +7 -28
  560. package/src/components/block-popover/style.scss +1 -1
  561. package/src/components/block-quick-navigation/index.js +2 -0
  562. package/src/components/block-settings-menu-controls/index.js +7 -1
  563. package/src/components/block-switcher/index.js +45 -23
  564. package/src/components/block-switcher/pattern-transformations-menu.js +3 -12
  565. package/src/components/block-switcher/style.scss +5 -30
  566. package/src/components/block-toolbar/index.js +27 -11
  567. package/src/components/block-toolbar/shuffle.js +9 -7
  568. package/src/components/block-toolbar/style.scss +4 -1
  569. package/src/components/block-tools/block-selection-button.js +4 -0
  570. package/src/components/block-tools/block-toolbar-popover.js +10 -6
  571. package/src/components/block-tools/index.js +1 -1
  572. package/src/components/block-tools/style.scss +3 -4
  573. package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -1
  574. package/src/components/block-tools/zoom-out-mode-inserters.js +2 -17
  575. package/src/components/block-tools/zoom-out-popover.js +3 -7
  576. package/src/components/block-tools/zoom-out-toolbar.js +31 -6
  577. package/src/components/block-variation-picker/README.md +2 -2
  578. package/src/components/block-variation-picker/index.js +6 -1
  579. package/src/components/block-variation-transforms/index.js +2 -0
  580. package/src/components/block-variation-transforms/style.scss +1 -1
  581. package/src/components/button-block-appender/content.scss +0 -1
  582. package/src/components/button-block-appender/index.js +30 -28
  583. package/src/components/color-palette/test/control.js +15 -2
  584. package/src/components/colors-gradients/dropdown.js +5 -1
  585. package/src/components/colors-gradients/style.scss +4 -4
  586. package/src/components/content-lock/index.js +1 -0
  587. package/src/components/content-lock/modify-content-lock-menu-item.js +58 -0
  588. package/src/components/default-block-appender/content.scss +0 -1
  589. package/src/components/editor-styles/index.js +4 -3
  590. package/src/components/global-styles/background-panel.js +6 -14
  591. package/src/components/global-styles/color-panel.js +8 -4
  592. package/src/components/global-styles/color-panel.native.js +2 -2
  593. package/src/components/global-styles/dimensions-panel.js +40 -40
  594. package/src/components/global-styles/filters-panel.js +5 -1
  595. package/src/components/global-styles/shadow-panel-components.js +11 -15
  596. package/src/components/global-styles/style.scss +3 -4
  597. package/src/components/global-styles/test/typography-utils.js +96 -5
  598. package/src/components/global-styles/test/utils.js +10 -0
  599. package/src/components/global-styles/typography-utils.js +22 -6
  600. package/src/components/global-styles/utils.js +4 -6
  601. package/src/components/grid/grid-item-movers.js +3 -3
  602. package/src/components/grid/grid-item-resizer.js +2 -2
  603. package/src/components/grid/style.scss +1 -1
  604. package/src/components/iframe/get-compatibility-styles.js +6 -1
  605. package/src/components/iframe/index.js +5 -5
  606. package/src/components/inner-blocks/index.js +2 -2
  607. package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -3
  608. package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +2 -0
  609. package/src/components/inserter/block-patterns-tab/index.js +2 -0
  610. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +32 -15
  611. package/src/components/inserter/index.js +4 -10
  612. package/src/components/inserter/library.js +0 -2
  613. package/src/components/inserter/media-tab/hooks.js +3 -3
  614. package/src/components/inserter/media-tab/media-list.js +1 -7
  615. package/src/components/inserter/media-tab/media-preview.js +15 -8
  616. package/src/components/inserter/media-tab/media-tab.js +2 -0
  617. package/src/components/inserter/menu.js +15 -29
  618. package/src/components/inserter/quick-inserter.js +3 -4
  619. package/src/components/inserter/style.scss +10 -17
  620. package/src/components/inserter-list-item/index.js +4 -4
  621. package/src/components/inserter-list-item/style.scss +1 -3
  622. package/src/components/inserter-listbox/index.js +2 -11
  623. package/src/components/inserter-listbox/item.js +12 -14
  624. package/src/components/inserter-listbox/row.js +2 -9
  625. package/src/components/inspector-controls/groups.js +2 -0
  626. package/src/components/inspector-controls-tabs/index.js +2 -0
  627. package/src/components/inspector-controls-tabs/settings-tab.js +1 -0
  628. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +5 -2
  629. package/src/components/inspector-popover-header/index.js +4 -0
  630. package/src/components/letter-spacing-control/README.md +8 -1
  631. package/src/components/letter-spacing-control/index.js +7 -4
  632. package/src/components/link-control/index.js +17 -8
  633. package/src/components/link-control/settings-drawer.js +2 -0
  634. package/src/components/link-control/style.scss +1 -3
  635. package/src/components/list-view/block-select-button.js +2 -0
  636. package/src/components/list-view/index.js +3 -8
  637. package/src/components/list-view/style.scss +14 -16
  638. package/src/components/media-placeholder/README.md +2 -2
  639. package/src/components/media-placeholder/index.js +21 -4
  640. package/src/components/media-replace-flow/index.js +12 -1
  641. package/src/components/provider/use-block-sync.js +20 -20
  642. package/src/components/responsive-block-control/README.md +3 -27
  643. package/src/components/rich-text/content.scss +1 -1
  644. package/src/components/rich-text/event-listeners/paste-handler.js +6 -1
  645. package/src/components/rich-text/index.js +54 -41
  646. package/src/components/rich-text/style.scss +1 -1
  647. package/src/components/rich-text/use-mark-persistent.js +5 -5
  648. package/src/components/skip-to-selected-block/index.js +2 -0
  649. package/src/components/spacing-sizes-control/index.js +10 -13
  650. package/src/components/spacing-sizes-control/linked-button.js +32 -0
  651. package/src/components/spacing-sizes-control/style.scss +1 -0
  652. package/src/components/spacing-sizes-control/test/utils.js +14 -15
  653. package/src/components/spacing-sizes-control/utils.js +5 -18
  654. package/src/components/tool-selector/index.js +2 -0
  655. package/src/components/url-input/button.js +6 -0
  656. package/src/components/url-input/index.js +2 -0
  657. package/src/components/url-popover/stories/index.story.js +7 -1
  658. package/src/components/use-block-drop-zone/index.js +37 -5
  659. package/src/components/warning/content.scss +3 -10
  660. package/src/components/writing-flow/index.js +2 -0
  661. package/src/components/writing-flow/use-arrow-nav.js +9 -2
  662. package/src/components/writing-flow/use-event-redirect.js +72 -0
  663. package/src/components/writing-flow/use-input.js +36 -1
  664. package/src/components/writing-flow/use-select-all.js +18 -1
  665. package/src/components/writing-flow/use-selection-observer.js +23 -3
  666. package/src/components/writing-flow/use-tab-nav.js +4 -4
  667. package/src/components/writing-flow/utils.js +30 -0
  668. package/src/hooks/block-bindings.js +42 -43
  669. package/src/hooks/block-bindings.scss +1 -9
  670. package/src/hooks/content-lock-ui.js +11 -36
  671. package/src/hooks/duotone.js +0 -4
  672. package/src/hooks/layout.js +2 -1
  673. package/src/hooks/layout.scss +5 -27
  674. package/src/hooks/spacing-visualizer.js +3 -3
  675. package/src/hooks/style.js +1 -4
  676. package/src/hooks/use-bindings-attributes.js +23 -24
  677. package/src/hooks/use-zoom-out.js +7 -7
  678. package/src/layouts/constrained.js +53 -48
  679. package/src/layouts/flex.js +2 -0
  680. package/src/layouts/grid.js +29 -22
  681. package/src/layouts/test/grid.js +2 -2
  682. package/src/layouts/test/utils.js +6 -8
  683. package/src/layouts/utils.js +1 -9
  684. package/src/private-apis.js +2 -2
  685. package/src/store/actions.js +4 -6
  686. package/src/store/private-actions.js +1 -0
  687. package/src/store/private-keys.js +1 -0
  688. package/src/store/private-selectors.js +18 -14
  689. package/src/store/reducer.js +0 -7
  690. package/src/store/selectors.js +32 -51
  691. package/src/store/utils.js +50 -0
  692. package/src/utils/block-bindings.js +15 -16
  693. package/src/utils/dom.js +117 -0
  694. package/src/utils/get-font-styles-and-weights.js +12 -4
  695. package/src/utils/test/get-font-styles-and-weights.js +148 -0
  696. package/src/utils/test/transform-styles.js +259 -50
  697. package/src/utils/transform-styles/index.js +132 -21
  698. package/tsconfig.json +1 -0
  699. package/tsconfig.tsbuildinfo +1 -1
  700. package/build/components/spacing-sizes-control/sides-dropdown/index.js +0 -86
  701. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
  702. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +0 -81
  703. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +0 -1
  704. package/src/components/spacing-sizes-control/sides-dropdown/index.js +0 -91
  705. package/src/utils/test/__snapshots__/transform-styles.js.snap +0 -109
@@ -37,6 +37,8 @@ import { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights
37
37
  * Returns a font-size value based on a given font-size preset.
38
38
  * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.
39
39
  *
40
+ * The Core PHP equivalent is wp_get_typography_font_size_value().
41
+ *
40
42
  * @param {Preset} preset
41
43
  * @param {Object} settings
42
44
  * @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.
@@ -48,15 +50,23 @@ export function getTypographyFontSizeValue(preset, settings) {
48
50
  const {
49
51
  size: defaultSize
50
52
  } = preset;
51
- if (!isFluidTypographyEnabled(settings?.typography)) {
53
+
54
+ /*
55
+ * Catch falsy values and 0/'0'. Fluid calculations cannot be performed on `0`.
56
+ * Also return early when a preset font size explicitly disables fluid typography with `false`.
57
+ */
58
+ if (!defaultSize || '0' === defaultSize || false === preset?.fluid) {
52
59
  return defaultSize;
53
60
  }
61
+
54
62
  /*
55
- * Checks whether a font size has explicitly bypassed fluid calculations.
56
- * Also catches falsy values and 0/'0'.
57
- * Fluid calculations cannot be performed on `0`.
63
+ * Return early when fluid typography is disabled in the settings, and there
64
+ * are no local settings to enable it for the individual preset.
65
+ *
66
+ * If this condition isn't met, either the settings or individual preset settings
67
+ * have enabled fluid typography.
58
68
  */
59
- if (!defaultSize || '0' === defaultSize || false === preset?.fluid) {
69
+ if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) {
60
70
  return defaultSize;
61
71
  }
62
72
  let fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings);
@@ -132,6 +142,7 @@ export function getMergedFontFamiliesAndFontFamilyFaces(settings, selectedFontFa
132
142
  * @return {string} Nearest font weight.
133
143
  */
134
144
  export function findNearestFontWeight(availableFontWeights, newFontWeightValue) {
145
+ newFontWeightValue = 'number' === typeof newFontWeightValue ? newFontWeightValue.toString() : newFontWeightValue;
135
146
  if (!newFontWeightValue || typeof newFontWeightValue !== 'string') {
136
147
  return '';
137
148
  }
@@ -196,7 +207,7 @@ export function findNearestStyleAndWeight(fontFamilyFaces, fontStyle, fontWeight
196
207
  }) => fs === fontStyle);
197
208
  const hasFontWeight = fontWeights?.some(({
198
209
  value: fw
199
- }) => fw === fontWeight);
210
+ }) => fw?.toString() === fontWeight?.toString());
200
211
  if (!hasFontStyle) {
201
212
  /*
202
213
  * Default to italic if oblique is not available.
@@ -1 +1 @@
1
- {"version":3,"names":["getComputedFluidTypographyValue","getTypographyValueAndUnit","getFontStylesAndWeights","getTypographyFontSizeValue","preset","settings","size","defaultSize","isFluidTypographyEnabled","typography","fluid","fluidTypographySettings","getFluidTypographyOptionsFromSettings","fluidFontSizeValue","minimumFontSize","min","maximumFontSize","max","fontSize","minimumFontSizeLimit","minFontSize","maximumViewportWidth","maxViewportWidth","minimumViewportWidth","minViewportWidth","typographySettings","fluidSettings","Object","keys","length","layoutSettings","layout","defaultMaxViewportWidth","wideSize","getMergedFontFamiliesAndFontFamilyFaces","selectedFontFamily","_fontFamilies$find$fo","fontFamiliesFromSettings","fontFamilies","flatMap","key","_fontFamiliesFromSett","fontFamilyFaces","find","family","fontFamily","fontFace","findNearestFontWeight","availableFontWeights","newFontWeightValue","nearestFontWeight","reduce","nearest","value","fw","currentDiff","Math","abs","parseInt","nearestDiff","findNearestFontStyle","availableFontStyles","newFontStyleValue","validStyles","includes","style","findNearestStyleAndWeight","fontStyle","fontWeight","nearestFontStyle","fontStyles","fontWeights","combinedStyleAndWeightOptions","hasFontStyle","some","fs","hasFontWeight","option"],"sources":["@wordpress/block-editor/src/components/global-styles/typography-utils.js"],"sourcesContent":["/**\n * The fluid utilities must match the backend equivalent.\n * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php\n * ---------------------------------------------------------------\n */\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetComputedFluidTypographyValue,\n\tgetTypographyValueAndUnit,\n} from '../font-sizes/fluid-utils';\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * @typedef {Object} FluidPreset\n * @property {string|undefined} max A maximum font size value.\n * @property {?string|undefined} min A minimum font size value.\n */\n\n/**\n * @typedef {Object} Preset\n * @property {?string|?number} size A default font size.\n * @property {string} name A font size name, displayed in the UI.\n * @property {string} slug A font size slug\n * @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size.\n */\n\n/**\n * @typedef {Object} TypographySettings\n * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.\n * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.\n * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.\n * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.\n * @property {?string} minFontSize The smallest a calculated font size may be. Optional.\n */\n\n/**\n * Returns a font-size value based on a given font-size preset.\n * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.\n *\n * @param {Preset} preset\n * @param {Object} settings\n * @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.\n * @param {Object?} settings.typography.layout Layout options.\n *\n * @return {string|*} A font-size value or the value of preset.size.\n */\nexport function getTypographyFontSizeValue( preset, settings ) {\n\tconst { size: defaultSize } = preset;\n\n\tif ( ! isFluidTypographyEnabled( settings?.typography ) ) {\n\t\treturn defaultSize;\n\t}\n\t/*\n\t * Checks whether a font size has explicitly bypassed fluid calculations.\n\t * Also catches falsy values and 0/'0'.\n\t * Fluid calculations cannot be performed on `0`.\n\t */\n\tif ( ! defaultSize || '0' === defaultSize || false === preset?.fluid ) {\n\t\treturn defaultSize;\n\t}\n\n\tlet fluidTypographySettings =\n\t\tgetFluidTypographyOptionsFromSettings( settings );\n\tfluidTypographySettings =\n\t\ttypeof fluidTypographySettings?.fluid === 'object'\n\t\t\t? fluidTypographySettings?.fluid\n\t\t\t: {};\n\n\tconst fluidFontSizeValue = getComputedFluidTypographyValue( {\n\t\tminimumFontSize: preset?.fluid?.min,\n\t\tmaximumFontSize: preset?.fluid?.max,\n\t\tfontSize: defaultSize,\n\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\tmaximumViewportWidth: fluidTypographySettings?.maxViewportWidth,\n\t\tminimumViewportWidth: fluidTypographySettings?.minViewportWidth,\n\t} );\n\n\tif ( !! fluidFontSizeValue ) {\n\t\treturn fluidFontSizeValue;\n\t}\n\n\treturn defaultSize;\n}\n\nfunction isFluidTypographyEnabled( typographySettings ) {\n\tconst fluidSettings = typographySettings?.fluid;\n\treturn (\n\t\ttrue === fluidSettings ||\n\t\t( fluidSettings &&\n\t\t\ttypeof fluidSettings === 'object' &&\n\t\t\tObject.keys( fluidSettings ).length > 0 )\n\t);\n}\n\n/**\n * Returns fluid typography settings from theme.json setting object.\n *\n * @param {Object} settings Theme.json settings\n * @param {Object} settings.typography Theme.json typography settings\n * @param {Object} settings.layout Theme.json layout settings\n * @return {TypographySettings} Fluid typography settings\n */\nexport function getFluidTypographyOptionsFromSettings( settings ) {\n\tconst typographySettings = settings?.typography;\n\tconst layoutSettings = settings?.layout;\n\tconst defaultMaxViewportWidth = getTypographyValueAndUnit(\n\t\tlayoutSettings?.wideSize\n\t)\n\t\t? layoutSettings?.wideSize\n\t\t: null;\n\treturn isFluidTypographyEnabled( typographySettings ) &&\n\t\tdefaultMaxViewportWidth\n\t\t? {\n\t\t\t\tfluid: {\n\t\t\t\t\tmaxViewportWidth: defaultMaxViewportWidth,\n\t\t\t\t\t...typographySettings.fluid,\n\t\t\t\t},\n\t\t }\n\t\t: {\n\t\t\t\tfluid: typographySettings?.fluid,\n\t\t };\n}\n\n/**\n * Returns an object of merged font families and the font faces from the selected font family\n * based on the theme.json settings object and the currently selected font family.\n *\n * @param {Object} settings Theme.json settings.\n * @param {string} selectedFontFamily Decoded font family string.\n * @return {Object} Merged font families and font faces from the selected font family.\n */\nexport function getMergedFontFamiliesAndFontFamilyFaces(\n\tsettings,\n\tselectedFontFamily\n) {\n\tconst fontFamiliesFromSettings = settings?.typography?.fontFamilies;\n\n\tconst fontFamilies = [ 'default', 'theme', 'custom' ].flatMap(\n\t\t( key ) => fontFamiliesFromSettings?.[ key ] ?? []\n\t);\n\n\tconst fontFamilyFaces =\n\t\tfontFamilies.find(\n\t\t\t( family ) => family.fontFamily === selectedFontFamily\n\t\t)?.fontFace ?? [];\n\n\treturn { fontFamilies, fontFamilyFaces };\n}\n\n/**\n * Returns the nearest font weight value from the available font weight list based on the new font weight.\n * The nearest font weight is the one with the smallest difference from the new font weight.\n *\n * @param {Array} availableFontWeights Array of available font weights.\n * @param {string} newFontWeightValue New font weight value.\n * @return {string} Nearest font weight.\n */\nexport function findNearestFontWeight(\n\tavailableFontWeights,\n\tnewFontWeightValue\n) {\n\tif ( ! newFontWeightValue || typeof newFontWeightValue !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tif ( ! availableFontWeights || availableFontWeights.length === 0 ) {\n\t\treturn newFontWeightValue;\n\t}\n\n\tconst nearestFontWeight = availableFontWeights?.reduce(\n\t\t( nearest, { value: fw } ) => {\n\t\t\tconst currentDiff = Math.abs(\n\t\t\t\tparseInt( fw ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\tconst nearestDiff = Math.abs(\n\t\t\t\tparseInt( nearest ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\treturn currentDiff < nearestDiff ? fw : nearest;\n\t\t},\n\t\tavailableFontWeights[ 0 ]?.value\n\t);\n\n\treturn nearestFontWeight;\n}\n\n/**\n * Returns the nearest font style based on the new font style.\n * Defaults to an empty string if the new font style is not valid or available.\n *\n * @param {Array} availableFontStyles Array of available font weights.\n * @param {string} newFontStyleValue New font style value.\n * @return {string} Nearest font style or an empty string.\n */\nexport function findNearestFontStyle( availableFontStyles, newFontStyleValue ) {\n\tif ( typeof newFontStyleValue !== 'string' || ! newFontStyleValue ) {\n\t\treturn '';\n\t}\n\n\tconst validStyles = [ 'normal', 'italic', 'oblique' ];\n\tif ( ! validStyles.includes( newFontStyleValue ) ) {\n\t\treturn '';\n\t}\n\n\tif (\n\t\t! availableFontStyles ||\n\t\tavailableFontStyles.length === 0 ||\n\t\tavailableFontStyles.find(\n\t\t\t( style ) => style.value === newFontStyleValue\n\t\t)\n\t) {\n\t\treturn newFontStyleValue;\n\t}\n\n\tif (\n\t\tnewFontStyleValue === 'oblique' &&\n\t\t! availableFontStyles.find( ( style ) => style.value === 'oblique' )\n\t) {\n\t\treturn 'italic';\n\t}\n\n\treturn '';\n}\n\n/**\n * Returns the nearest font style and weight based on the available font family faces and the new font style and weight.\n *\n * @param {Array} fontFamilyFaces Array of available font family faces.\n * @param {string} fontStyle New font style. Defaults to previous value.\n * @param {string} fontWeight New font weight. Defaults to previous value.\n * @return {Object} Nearest font style and font weight.\n */\nexport function findNearestStyleAndWeight(\n\tfontFamilyFaces,\n\tfontStyle,\n\tfontWeight\n) {\n\tlet nearestFontStyle = fontStyle;\n\tlet nearestFontWeight = fontWeight;\n\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Check if the new font style and weight are available in the font family faces.\n\tconst hasFontStyle = fontStyles?.some(\n\t\t( { value: fs } ) => fs === fontStyle\n\t);\n\tconst hasFontWeight = fontWeights?.some(\n\t\t( { value: fw } ) => fw === fontWeight\n\t);\n\n\tif ( ! hasFontStyle ) {\n\t\t/*\n\t\t * Default to italic if oblique is not available.\n\t\t * Or find the nearest font style based on the nearest font weight.\n\t\t */\n\t\tnearestFontStyle = fontStyle\n\t\t\t? findNearestFontStyle( fontStyles, fontStyle )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontWeight ===\n\t\t\t\t\t\tfindNearestFontWeight( fontWeights, fontWeight )\n\t\t\t )?.style?.fontStyle;\n\t}\n\n\tif ( ! hasFontWeight ) {\n\t\t/*\n\t\t * Find the nearest font weight based on available weights.\n\t\t * Or find the nearest font weight based on the nearest font style.\n\t\t */\n\t\tnearestFontWeight = fontWeight\n\t\t\t? findNearestFontWeight( fontWeights, fontWeight )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontStyle ===\n\t\t\t\t\t\t( nearestFontStyle || fontStyle )\n\t\t\t )?.style?.fontWeight;\n\t}\n\n\treturn { nearestFontStyle, nearestFontWeight };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SACCA,+BAA+B,EAC/BC,yBAAyB,QACnB,2BAA2B;AAClC,SAASC,uBAAuB,QAAQ,yCAAyC;;AAEjF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CAAEC,MAAM,EAAEC,QAA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AAC,EAAEF,KAAK,EAAEG,UAAU;EACxB;EAEA,OAAO;IAAEC,gBAAgB;IAAEnB;EAAkB,CAAC;AAC/C","ignoreList":[]}
1
+ {"version":3,"names":["getComputedFluidTypographyValue","getTypographyValueAndUnit","getFontStylesAndWeights","getTypographyFontSizeValue","preset","settings","size","defaultSize","fluid","isFluidTypographyEnabled","typography","fluidTypographySettings","getFluidTypographyOptionsFromSettings","fluidFontSizeValue","minimumFontSize","min","maximumFontSize","max","fontSize","minimumFontSizeLimit","minFontSize","maximumViewportWidth","maxViewportWidth","minimumViewportWidth","minViewportWidth","typographySettings","fluidSettings","Object","keys","length","layoutSettings","layout","defaultMaxViewportWidth","wideSize","getMergedFontFamiliesAndFontFamilyFaces","selectedFontFamily","_fontFamilies$find$fo","fontFamiliesFromSettings","fontFamilies","flatMap","key","_fontFamiliesFromSett","fontFamilyFaces","find","family","fontFamily","fontFace","findNearestFontWeight","availableFontWeights","newFontWeightValue","toString","nearestFontWeight","reduce","nearest","value","fw","currentDiff","Math","abs","parseInt","nearestDiff","findNearestFontStyle","availableFontStyles","newFontStyleValue","validStyles","includes","style","findNearestStyleAndWeight","fontStyle","fontWeight","nearestFontStyle","fontStyles","fontWeights","combinedStyleAndWeightOptions","hasFontStyle","some","fs","hasFontWeight","option"],"sources":["@wordpress/block-editor/src/components/global-styles/typography-utils.js"],"sourcesContent":["/**\n * The fluid utilities must match the backend equivalent.\n * See: gutenberg_get_typography_font_size_value() in lib/block-supports/typography.php\n * ---------------------------------------------------------------\n */\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetComputedFluidTypographyValue,\n\tgetTypographyValueAndUnit,\n} from '../font-sizes/fluid-utils';\nimport { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';\n\n/**\n * @typedef {Object} FluidPreset\n * @property {string|undefined} max A maximum font size value.\n * @property {?string|undefined} min A minimum font size value.\n */\n\n/**\n * @typedef {Object} Preset\n * @property {?string|?number} size A default font size.\n * @property {string} name A font size name, displayed in the UI.\n * @property {string} slug A font size slug\n * @property {boolean|FluidPreset|undefined} fluid Specifies the minimum and maximum font size value of a fluid font size.\n */\n\n/**\n * @typedef {Object} TypographySettings\n * @property {?string} minViewportWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.\n * @property {?string} maxViewportWidth Maximum size up to which type will have fluidity. Optional if size is specified.\n * @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.\n * @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.\n * @property {?string} minFontSize The smallest a calculated font size may be. Optional.\n */\n\n/**\n * Returns a font-size value based on a given font-size preset.\n * Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.\n *\n * The Core PHP equivalent is wp_get_typography_font_size_value().\n *\n * @param {Preset} preset\n * @param {Object} settings\n * @param {boolean|TypographySettings} settings.typography.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.\n * @param {Object?} settings.typography.layout Layout options.\n *\n * @return {string|*} A font-size value or the value of preset.size.\n */\nexport function getTypographyFontSizeValue( preset, settings ) {\n\tconst { size: defaultSize } = preset;\n\n\t/*\n\t * Catch falsy values and 0/'0'. Fluid calculations cannot be performed on `0`.\n\t * Also return early when a preset font size explicitly disables fluid typography with `false`.\n\t */\n\tif ( ! defaultSize || '0' === defaultSize || false === preset?.fluid ) {\n\t\treturn defaultSize;\n\t}\n\n\t/*\n\t * Return early when fluid typography is disabled in the settings, and there\n\t * are no local settings to enable it for the individual preset.\n\t *\n\t * If this condition isn't met, either the settings or individual preset settings\n\t * have enabled fluid typography.\n\t */\n\tif (\n\t\t! isFluidTypographyEnabled( settings?.typography ) &&\n\t\t! isFluidTypographyEnabled( preset )\n\t) {\n\t\treturn defaultSize;\n\t}\n\n\tlet fluidTypographySettings =\n\t\tgetFluidTypographyOptionsFromSettings( settings );\n\tfluidTypographySettings =\n\t\ttypeof fluidTypographySettings?.fluid === 'object'\n\t\t\t? fluidTypographySettings?.fluid\n\t\t\t: {};\n\n\tconst fluidFontSizeValue = getComputedFluidTypographyValue( {\n\t\tminimumFontSize: preset?.fluid?.min,\n\t\tmaximumFontSize: preset?.fluid?.max,\n\t\tfontSize: defaultSize,\n\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\tmaximumViewportWidth: fluidTypographySettings?.maxViewportWidth,\n\t\tminimumViewportWidth: fluidTypographySettings?.minViewportWidth,\n\t} );\n\n\tif ( !! fluidFontSizeValue ) {\n\t\treturn fluidFontSizeValue;\n\t}\n\n\treturn defaultSize;\n}\n\nfunction isFluidTypographyEnabled( typographySettings ) {\n\tconst fluidSettings = typographySettings?.fluid;\n\treturn (\n\t\ttrue === fluidSettings ||\n\t\t( fluidSettings &&\n\t\t\ttypeof fluidSettings === 'object' &&\n\t\t\tObject.keys( fluidSettings ).length > 0 )\n\t);\n}\n\n/**\n * Returns fluid typography settings from theme.json setting object.\n *\n * @param {Object} settings Theme.json settings\n * @param {Object} settings.typography Theme.json typography settings\n * @param {Object} settings.layout Theme.json layout settings\n * @return {TypographySettings} Fluid typography settings\n */\nexport function getFluidTypographyOptionsFromSettings( settings ) {\n\tconst typographySettings = settings?.typography;\n\tconst layoutSettings = settings?.layout;\n\tconst defaultMaxViewportWidth = getTypographyValueAndUnit(\n\t\tlayoutSettings?.wideSize\n\t)\n\t\t? layoutSettings?.wideSize\n\t\t: null;\n\treturn isFluidTypographyEnabled( typographySettings ) &&\n\t\tdefaultMaxViewportWidth\n\t\t? {\n\t\t\t\tfluid: {\n\t\t\t\t\tmaxViewportWidth: defaultMaxViewportWidth,\n\t\t\t\t\t...typographySettings.fluid,\n\t\t\t\t},\n\t\t }\n\t\t: {\n\t\t\t\tfluid: typographySettings?.fluid,\n\t\t };\n}\n\n/**\n * Returns an object of merged font families and the font faces from the selected font family\n * based on the theme.json settings object and the currently selected font family.\n *\n * @param {Object} settings Theme.json settings.\n * @param {string} selectedFontFamily Decoded font family string.\n * @return {Object} Merged font families and font faces from the selected font family.\n */\nexport function getMergedFontFamiliesAndFontFamilyFaces(\n\tsettings,\n\tselectedFontFamily\n) {\n\tconst fontFamiliesFromSettings = settings?.typography?.fontFamilies;\n\n\tconst fontFamilies = [ 'default', 'theme', 'custom' ].flatMap(\n\t\t( key ) => fontFamiliesFromSettings?.[ key ] ?? []\n\t);\n\n\tconst fontFamilyFaces =\n\t\tfontFamilies.find(\n\t\t\t( family ) => family.fontFamily === selectedFontFamily\n\t\t)?.fontFace ?? [];\n\n\treturn { fontFamilies, fontFamilyFaces };\n}\n\n/**\n * Returns the nearest font weight value from the available font weight list based on the new font weight.\n * The nearest font weight is the one with the smallest difference from the new font weight.\n *\n * @param {Array} availableFontWeights Array of available font weights.\n * @param {string} newFontWeightValue New font weight value.\n * @return {string} Nearest font weight.\n */\nexport function findNearestFontWeight(\n\tavailableFontWeights,\n\tnewFontWeightValue\n) {\n\tnewFontWeightValue =\n\t\t'number' === typeof newFontWeightValue\n\t\t\t? newFontWeightValue.toString()\n\t\t\t: newFontWeightValue;\n\tif ( ! newFontWeightValue || typeof newFontWeightValue !== 'string' ) {\n\t\treturn '';\n\t}\n\n\tif ( ! availableFontWeights || availableFontWeights.length === 0 ) {\n\t\treturn newFontWeightValue;\n\t}\n\n\tconst nearestFontWeight = availableFontWeights?.reduce(\n\t\t( nearest, { value: fw } ) => {\n\t\t\tconst currentDiff = Math.abs(\n\t\t\t\tparseInt( fw ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\tconst nearestDiff = Math.abs(\n\t\t\t\tparseInt( nearest ) - parseInt( newFontWeightValue )\n\t\t\t);\n\t\t\treturn currentDiff < nearestDiff ? fw : nearest;\n\t\t},\n\t\tavailableFontWeights[ 0 ]?.value\n\t);\n\n\treturn nearestFontWeight;\n}\n\n/**\n * Returns the nearest font style based on the new font style.\n * Defaults to an empty string if the new font style is not valid or available.\n *\n * @param {Array} availableFontStyles Array of available font weights.\n * @param {string} newFontStyleValue New font style value.\n * @return {string} Nearest font style or an empty string.\n */\nexport function findNearestFontStyle( availableFontStyles, newFontStyleValue ) {\n\tif ( typeof newFontStyleValue !== 'string' || ! newFontStyleValue ) {\n\t\treturn '';\n\t}\n\n\tconst validStyles = [ 'normal', 'italic', 'oblique' ];\n\tif ( ! validStyles.includes( newFontStyleValue ) ) {\n\t\treturn '';\n\t}\n\n\tif (\n\t\t! availableFontStyles ||\n\t\tavailableFontStyles.length === 0 ||\n\t\tavailableFontStyles.find(\n\t\t\t( style ) => style.value === newFontStyleValue\n\t\t)\n\t) {\n\t\treturn newFontStyleValue;\n\t}\n\n\tif (\n\t\tnewFontStyleValue === 'oblique' &&\n\t\t! availableFontStyles.find( ( style ) => style.value === 'oblique' )\n\t) {\n\t\treturn 'italic';\n\t}\n\n\treturn '';\n}\n\n/**\n * Returns the nearest font style and weight based on the available font family faces and the new font style and weight.\n *\n * @param {Array} fontFamilyFaces Array of available font family faces.\n * @param {string} fontStyle New font style. Defaults to previous value.\n * @param {string} fontWeight New font weight. Defaults to previous value.\n * @return {Object} Nearest font style and font weight.\n */\nexport function findNearestStyleAndWeight(\n\tfontFamilyFaces,\n\tfontStyle,\n\tfontWeight\n) {\n\tlet nearestFontStyle = fontStyle;\n\tlet nearestFontWeight = fontWeight;\n\n\tconst { fontStyles, fontWeights, combinedStyleAndWeightOptions } =\n\t\tgetFontStylesAndWeights( fontFamilyFaces );\n\n\t// Check if the new font style and weight are available in the font family faces.\n\tconst hasFontStyle = fontStyles?.some(\n\t\t( { value: fs } ) => fs === fontStyle\n\t);\n\tconst hasFontWeight = fontWeights?.some(\n\t\t( { value: fw } ) => fw?.toString() === fontWeight?.toString()\n\t);\n\n\tif ( ! hasFontStyle ) {\n\t\t/*\n\t\t * Default to italic if oblique is not available.\n\t\t * Or find the nearest font style based on the nearest font weight.\n\t\t */\n\t\tnearestFontStyle = fontStyle\n\t\t\t? findNearestFontStyle( fontStyles, fontStyle )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontWeight ===\n\t\t\t\t\t\tfindNearestFontWeight( fontWeights, fontWeight )\n\t\t\t )?.style?.fontStyle;\n\t}\n\n\tif ( ! hasFontWeight ) {\n\t\t/*\n\t\t * Find the nearest font weight based on available weights.\n\t\t * Or find the nearest font weight based on the nearest font style.\n\t\t */\n\t\tnearestFontWeight = fontWeight\n\t\t\t? findNearestFontWeight( fontWeights, fontWeight )\n\t\t\t: combinedStyleAndWeightOptions?.find(\n\t\t\t\t\t( option ) =>\n\t\t\t\t\t\toption.style.fontStyle ===\n\t\t\t\t\t\t( nearestFontStyle || fontStyle )\n\t\t\t )?.style?.fontWeight;\n\t}\n\n\treturn { nearestFontStyle, nearestFontWeight };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SACCA,+BAA+B,EAC/BC,yBAAyB,QACnB,2BAA2B;AAClC,SAASC,uBAAuB,QAAQ,yCAAyC;;AAEjF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC9D,MAAM;IAAEC,IAAI,EAAEC;EAAY,CAAC,GAAGH,MAAM;;EAEpC;AACD;AACA;AACA;EACC,IAAK,CAAEG,WAAW,IAAI,GAAG,KAAKA,WAAW,IAAI,KAAK,KAAKH,MAAM,EAAEI,KAAK,EAAG;IACtE,OAAOD,WAAW;EACnB;;EAEA;AACD;AACA;AACA;AACA;AACA;AACA;EACC,IACC,CAAEE,wBAAwB,CAAEJ,QAAQ,EAAEK,UAAW,CAAC,IAClD,CAAED,wBAAwB,CAAEL,MAAO,CAAC,EACnC;IACD,OAAOG,WAAW;EACnB;EAEA,IAAII,uBAAuB,GAC1BC,qCAAqC,CAAEP,QAAS,CAAC;EAClDM,uBAAuB,G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AIC,gBAAgB,GAAGF,SAAS;EAChC,IAAIjB,iBAAiB,GAAGkB,UAAU;EAElC,MAAM;IAAEE,UAAU;IAAEC,WAAW;IAAEC;EAA8B,CAAC,GAC/DvE,uBAAuB,CAAEwC,eAAgB,CAAC;;EAE3C;EACA,MAAMgC,YAAY,GAAGH,UAAU,EAAEI,IAAI,CACpC,CAAE;IAAErB,KAAK,EAAEsB;EAAG,CAAC,KAAMA,EAAE,KAAKR,SAC7B,CAAC;EACD,MAAMS,aAAa,GAAGL,WAAW,EAAEG,IAAI,CACtC,CAAE;IAAErB,KAAK,EAAEC;EAAG,CAAC,KAAMA,EAAE,EAAEL,QAAQ,CAAC,CAAC,KAAKmB,UAAU,EAAEnB,QAAQ,CAAC,CAC9D,CAAC;EAED,IAAK,CAAEwB,YAAY,EAAG;IACrB;AACF;AACA;AACA;IACEJ,gBAAgB,GAAGF,SAAS,GACzBP,oBAAoB,CAAEU,UAAU,EAAEH,SAAU,CAAC,GAC7CK,6BAA6B,EAAE9B,IAAI,CACjCmC,MAAM,IACPA,MAAM,CAACZ,KAAK,CAACG,UAAU,KACvBtB,qBAAqB,CAAEyB,WAAW,EAAEH,UAAW,CAChD,CAAC,EAAEH,KAAK,EAAEE,SAAS;EACvB;EAEA,IAAK,CAAES,aAAa,EAAG;IACtB;AACF;AACA;AACA;IACE1B,iBAAiB,GAAGkB,UAAU,GAC3BtB,qBAAqB,CAAEyB,WAAW,EAAEH,UAAW,CAAC,GAChDI,6BAA6B,EAAE9B,IAAI,CACjCmC,MAAM,IACPA,MAAM,CAACZ,KAAK,CAACE,SAAS,MACpBE,gBAAgB,IAAIF,SAAS,CAChC,CAAC,EAAEF,KAAK,EAAEG,UAAU;EACxB;EAEA,OAAO;IAAEC,gBAAgB;IAAEnB;EAAkB,CAAC;AAC/C","ignoreList":[]}
@@ -230,9 +230,8 @@ function getValueFromCustomVariable(features, blockName, variable, path) {
230
230
  */
231
231
  export function getValueFromVariable(features, blockName, variable) {
232
232
  if (!variable || typeof variable !== 'string') {
233
- if (variable?.ref && typeof variable?.ref === 'string') {
234
- const refPath = variable.ref.split('.');
235
- variable = getValueFromObjectPath(features, refPath);
233
+ if (typeof variable?.ref === 'string') {
234
+ variable = getValueFromObjectPath(features, variable.ref);
236
235
  // Presence of another ref indicates a reference to another dynamic value.
237
236
  // Pointing to another dynamic value is not supported.
238
237
  if (!variable || !!variable?.ref) {
@@ -447,8 +446,7 @@ export function getResolvedRefValue(ruleValue, tree) {
447
446
  * For example: { "ref": "style.color.background" } => "#fff".
448
447
  */
449
448
  if (typeof ruleValue !== 'string' && ruleValue?.ref) {
450
- const refPath = ruleValue.ref.split('.');
451
- const resolvedRuleValue = getCSSValueFromRawStyle(getValueFromObjectPath(tree, refPath));
449
+ const resolvedRuleValue = getCSSValueFromRawStyle(getValueFromObjectPath(tree, ruleValue.ref));
452
450
 
453
451
  /*
454
452
  * Presence of another ref indicates a reference to another dynamic value.
@@ -457,7 +455,7 @@ export function getResolvedRefValue(ruleValue, tree) {
457
455
  if (resolvedRuleValue?.ref) {
458
456
  return undefined;
459
457
  }
460
- if (!resolvedRuleValue) {
458
+ if (resolvedRuleValue === undefined) {
461
459
  return ruleValue;
462
460
  }
463
461
  return resolvedRuleValue;
@@ -1 +1 @@
1
- {"version":3,"names":["fastDeepEqual","useViewportMatch","getCSSValueFromRawStyle","getTypographyFontSizeValue","getValueFromObjectPath","ROOT_BLOCK_SELECTOR","ROOT_CSS_PROPERTIES_SELECTOR","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","preset","settings","size","STYLE_PATH_TO_CSS_VAR_INFIX","shadow","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","find","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","data","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","_getValueFromObjectPa","ref","refPath","split","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","endsWith","type","scopeSelector","scope","selector","scopes","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","scopeFeatureSelectors","featureSelectors","Object","entries","feature","subfeature","subfeatureSelector","appendToSelector","toAppend","includes","newSelectors","map","sel","areGlobalStyleConfigsEqual","original","variation","styles","getBlockStyleVariationSelector","blockSelector","variationClass","ancestorRegex","addVariationClass","_match","group1","group2","part","replace","getResolvedThemeFilePath","file","themeFileURIs","Array","isArray","uri","themeFileUri","name","href","getResolvedRefValue","ruleValue","tree","resolvedRuleValue","getResolvedValue","resolvedValue","url","_links"],"sources":["@wordpress/block-editor/src/components/global-styles/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getCSSValueFromRawStyle } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { getValueFromObjectPath } from '../../utils/object';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_CSS_PROPERTIES_SELECTOR = ':root';\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tvalueKey: 'colors',\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'shadow', 'presets' ],\n\t\tvalueKey: 'shadow',\n\t\tcssVarInfix: 'shadow',\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueFunc: ( preset, settings ) =>\n\t\t\tgetTypographyFontSizeValue( preset, settings ),\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'spacing', 'spacingSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'spacing',\n\t\tvalueFunc: ( { size } ) => size,\n\t\tclasses: [],\n\t},\n];\n\nexport const STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'filter.duotone': 'duotone',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.caption.color.text': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tshadow: 'shadow',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// A static list of block attributes that store global style preset slugs.\nexport const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nexport function useToolsPanelDropdownMenuProps() {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tgetValueFromObjectPath( features, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t...presetPath,\n\t\t] ),\n\t\tgetValueFromObjectPath( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = presets.find(\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === cssVarInfix\n\t);\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === presetType\n\t);\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures.settings,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tgetValueFromObjectPath( features.settings, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t'custom',\n\t\t\t...path,\n\t\t] ) ??\n\t\tgetValueFromObjectPath( features.settings, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\n/**\n * Attempts to fetch the value of a theme.json CSS variable.\n *\n * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.\n * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.\n * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.\n * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.\n */\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || typeof variable !== 'string' ) {\n\t\tif ( variable?.ref && typeof variable?.ref === 'string' ) {\n\t\t\tconst refPath = variable.ref.split( '.' );\n\t\t\tvariable = getValueFromObjectPath( features, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! variable || !! variable?.ref ) {\n\t\t\t\treturn variable;\n\t\t\t}\n\t\t} else {\n\t\t\treturn variable;\n\t\t}\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nexport function scopeSelector( scope, selector ) {\n\tif ( ! scope || ! selector ) {\n\t\treturn selector;\n\t}\n\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Scopes a collection of selectors for features and subfeatures.\n *\n * @example\n * ```js\n * const scope = '.custom-scope';\n * const selectors = {\n * color: '.wp-my-block p',\n * typography: { fontSize: '.wp-my-block caption' },\n * };\n * const result = scopeFeatureSelector( scope, selectors );\n * // result is {\n * // color: '.custom-scope .wp-my-block p',\n * // typography: { fonSize: '.custom-scope .wp-my-block caption' },\n * // }\n * ```\n *\n * @param {string} scope Selector to scope collection of selectors with.\n * @param {Object} selectors Collection of feature selectors e.g.\n *\n * @return {Object|undefined} Scoped collection of feature selectors.\n */\nexport function scopeFeatureSelectors( scope, selectors ) {\n\tif ( ! scope || ! selectors ) {\n\t\treturn;\n\t}\n\n\tconst featureSelectors = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\tif ( typeof selector === 'string' ) {\n\t\t\tfeatureSelectors[ feature ] = scopeSelector( scope, selector );\n\t\t}\n\n\t\tif ( typeof selector === 'object' ) {\n\t\t\tfeatureSelectors[ feature ] = {};\n\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\tfeatureSelectors[ feature ][ subfeature ] = scopeSelector(\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tsubfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn featureSelectors;\n}\n\n/**\n * Appends a sub-selector to an existing one.\n *\n * Given the compounded `selector` \"h1, h2, h3\"\n * and the `toAppend` selector \".some-class\" the result will be\n * \"h1.some-class, h2.some-class, h3.some-class\".\n *\n * @param {string} selector Original selector.\n * @param {string} toAppend Selector to append.\n *\n * @return {string} The new selector.\n */\nexport function appendToSelector( selector, toAppend ) {\n\tif ( ! selector.includes( ',' ) ) {\n\t\treturn selector + toAppend;\n\t}\n\tconst selectors = selector.split( ',' );\n\tconst newSelectors = selectors.map( ( sel ) => sel + toAppend );\n\treturn newSelectors.join( ',' );\n}\n\n/**\n * Compares global style variations according to their styles and settings properties.\n *\n * @example\n * ```js\n * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };\n * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };\n * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );\n * // false\n * ```\n *\n * @param {Object} original A global styles object.\n * @param {Object} variation A global styles object.\n *\n * @return {boolean} Whether `original` and `variation` match.\n */\nexport function areGlobalStyleConfigsEqual( original, variation ) {\n\tif ( typeof original !== 'object' || typeof variation !== 'object' ) {\n\t\treturn original === variation;\n\t}\n\treturn (\n\t\tfastDeepEqual( original?.styles, variation?.styles ) &&\n\t\tfastDeepEqual( original?.settings, variation?.settings )\n\t);\n}\n\n/**\n * Generates the selector for a block style variation by creating the\n * appropriate CSS class and adding it to the ancestor portion of the block's\n * selector.\n *\n * For example, take the Button block which has a compound selector:\n * `.wp-block-button .wp-block-button__link`. With a variation named 'custom',\n * the class `.is-style-custom` should be added to the `.wp-block-button`\n * ancestor only.\n *\n * This function will take into account comma separated and complex selectors.\n *\n * @param {string} variation Name for the variation.\n * @param {string} blockSelector CSS selector for the block.\n *\n * @return {string} CSS selector for the block style variation.\n */\nexport function getBlockStyleVariationSelector( variation, blockSelector ) {\n\tconst variationClass = `.is-style-${ variation }`;\n\n\tif ( ! blockSelector ) {\n\t\treturn variationClass;\n\t}\n\n\tconst ancestorRegex = /((?::\\([^)]+\\))?\\s*)([^\\s:]+)/;\n\tconst addVariationClass = ( _match, group1, group2 ) => {\n\t\treturn group1 + group2 + variationClass;\n\t};\n\n\tconst result = blockSelector\n\t\t.split( ',' )\n\t\t.map( ( part ) => part.replace( ancestorRegex, addVariationClass ) );\n\n\treturn result.join( ',' );\n}\n\n/**\n * Looks up a theme file URI based on a relative path.\n *\n * @param {string} file A relative path.\n * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.\n * @return {string} A resolved theme file URI, if one is found in the themeFileURIs collection.\n */\nexport function getResolvedThemeFilePath( file, themeFileURIs ) {\n\tif ( ! file || ! themeFileURIs || ! Array.isArray( themeFileURIs ) ) {\n\t\treturn file;\n\t}\n\n\tconst uri = themeFileURIs.find(\n\t\t( themeFileUri ) => themeFileUri?.name === file\n\t);\n\n\tif ( ! uri?.href ) {\n\t\treturn file;\n\t}\n\n\treturn uri?.href;\n}\n\n/**\n * Resolves ref values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedRefValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t/*\n\t * Where the rule value is an object with a 'ref' property pointing\n\t * to a path, this converts that path into the value at that path.\n\t * For example: { \"ref\": \"style.color.background\" } => \"#fff\".\n\t */\n\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\tconst resolvedRuleValue = getCSSValueFromRawStyle(\n\t\t\tgetValueFromObjectPath( tree, refPath )\n\t\t);\n\n\t\t/*\n\t\t * Presence of another ref indicates a reference to another dynamic value.\n\t\t * Pointing to another dynamic value is not supported.\n\t\t */\n\t\tif ( resolvedRuleValue?.ref ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( ! resolvedRuleValue ) {\n\t\t\treturn ruleValue;\n\t\t}\n\n\t\treturn resolvedRuleValue;\n\t}\n\treturn ruleValue;\n}\n\n/**\n * Resolves ref and relative path values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t// Resolve ref values.\n\tconst resolvedValue = getResolvedRefValue( ruleValue, tree );\n\n\t// Resolve relative paths.\n\tif ( resolvedValue?.url ) {\n\t\tresolvedValue.url = getResolvedThemeFilePath(\n\t\t\tresolvedValue.url,\n\t\t\ttree?._links?.[ 'wp:theme-file' ]\n\t\t);\n\t}\n\n\treturn resolvedValue;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,yBAAyB;;AAEjE;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,sBAAsB,QAAQ,oBAAoB;;AAE3D;AACA,OAAO,MAAMC,mBAAmB,GAAG,MAAM;AACzC,OAAO,MAAMC,4BAA4B,GAAG,OAAO;AAEnD,OAAO,MAAMC,eAAe,GAAG,CAC9B;EACCC,IAAI,EAAE,CAAE,OAAO,EAAE,SAAS,CAAE;EA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EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,SAAS,EAAEC,IAAI,EAAG;EACtD,IAAK,CAAED,SAAS,IAAI,CAAEC,IAAI,EAAG;IAC5B,OAAOD,SAAS;EACjB;;EAEA;AACD;AACA;AACA;AACA;EACC,IAAK,OAAOA,SAAS,KAAK,QAAQ,IAAIA,SAAS,EAAE7D,GAAG,EAAG;IACtD,MAAMC,OAAO,GAAG4D,SAAS,CAAC7D,GAAG,CAACE,KAAK,CAAE,GAAI,CAAC;IAC1C,MAAM6D,iBAAiB,GAAGnH,uBAAuB,CAChDE,sBAAsB,CAAEgH,IAAI,EAAE7D,OAAQ,CACvC,CAAC;;IAED;AACF;AACA;AACA;IACE,IAAK8D,iBAAiB,EAAE/D,GAAG,EAAG;MAC7B,OAAOb,SAAS;IACjB;IAEA,IAAK,CAAE4E,iBAAiB,EAAG;MAC1B,OAAOF,SAAS;IACjB;IAEA,OAAOE,iBAAiB;EACzB;EACA,OAAOF,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,gBAAgBA,CAAEH,SAAS,EAAEC,IAAI,EAAG;EACnD,IAAK,CAAED,SAAS,IAAI,CAAEC,IAAI,EAAG;IAC5B,OAAOD,SAAS;EACjB;;EAEA;EACA,MAAMI,aAAa,GAAGL,mBAAmB,CAAEC,SAAS,EAAEC,IAAK,CAAC;;EAE5D;EACA,IAAKG,aAAa,EAAEC,GAAG,EAAG;IACzBD,aAAa,CAACC,GAAG,GAAGf,wBAAwB,CAC3Cc,aAAa,CAACC,GAAG,EACjBJ,IAAI,EAAEK,MAAM,GAAI,eAAe,CAChC,CAAC;EACF;EAEA,OAAOF,aAAa;AACrB","ignoreList":[]}
1
+ {"version":3,"names":["fastDeepEqual","useViewportMatch","getCSSValueFromRawStyle","getTypographyFontSizeValue","getValueFromObjectPath","ROOT_BLOCK_SELECTOR","ROOT_CSS_PROPERTIES_SELECTOR","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","preset","settings","size","STYLE_PATH_TO_CSS_VAR_INFIX","shadow","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useToolsPanelDropdownMenuProps","isMobile","popoverProps","placement","offset","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","find","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","data","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","_getValueFromObjectPa","ref","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","split","endsWith","type","scopeSelector","scope","selector","scopes","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","scopeFeatureSelectors","featureSelectors","Object","entries","feature","subfeature","subfeatureSelector","appendToSelector","toAppend","includes","newSelectors","map","sel","areGlobalStyleConfigsEqual","original","variation","styles","getBlockStyleVariationSelector","blockSelector","variationClass","ancestorRegex","addVariationClass","_match","group1","group2","part","replace","getResolvedThemeFilePath","file","themeFileURIs","Array","isArray","uri","themeFileUri","name","href","getResolvedRefValue","ruleValue","tree","resolvedRuleValue","getResolvedValue","resolvedValue","url","_links"],"sources":["@wordpress/block-editor/src/components/global-styles/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getCSSValueFromRawStyle } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { getValueFromObjectPath } from '../../utils/object';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_CSS_PROPERTIES_SELECTOR = ':root';\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tvalueKey: 'colors',\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'shadow', 'presets' ],\n\t\tvalueKey: 'shadow',\n\t\tcssVarInfix: 'shadow',\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueFunc: ( preset, settings ) =>\n\t\t\tgetTypographyFontSizeValue( preset, settings ),\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'spacing', 'spacingSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'spacing',\n\t\tvalueFunc: ( { size } ) => size,\n\t\tclasses: [],\n\t},\n];\n\nexport const STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'filter.duotone': 'duotone',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.caption.color.text': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tshadow: 'shadow',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// A static list of block attributes that store global style preset slugs.\nexport const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nexport function useToolsPanelDropdownMenuProps() {\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\treturn ! isMobile\n\t\t? {\n\t\t\t\tpopoverProps: {\n\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t// For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)\n\t\t\t\t\toffset: 259,\n\t\t\t\t},\n\t\t }\n\t\t: {};\n}\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tgetValueFromObjectPath( features, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t...presetPath,\n\t\t] ),\n\t\tgetValueFromObjectPath( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = presets.find(\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === cssVarInfix\n\t);\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === presetType\n\t);\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures.settings,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tgetValueFromObjectPath( features.settings, [\n\t\t\t'blocks',\n\t\t\tblockName,\n\t\t\t'custom',\n\t\t\t...path,\n\t\t] ) ??\n\t\tgetValueFromObjectPath( features.settings, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\n/**\n * Attempts to fetch the value of a theme.json CSS variable.\n *\n * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.\n * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.\n * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.\n * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.\n */\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || typeof variable !== 'string' ) {\n\t\tif ( typeof variable?.ref === 'string' ) {\n\t\t\tvariable = getValueFromObjectPath( features, variable.ref );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! variable || !! variable?.ref ) {\n\t\t\t\treturn variable;\n\t\t\t}\n\t\t} else {\n\t\t\treturn variable;\n\t\t}\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nexport function scopeSelector( scope, selector ) {\n\tif ( ! scope || ! selector ) {\n\t\treturn selector;\n\t}\n\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Scopes a collection of selectors for features and subfeatures.\n *\n * @example\n * ```js\n * const scope = '.custom-scope';\n * const selectors = {\n * color: '.wp-my-block p',\n * typography: { fontSize: '.wp-my-block caption' },\n * };\n * const result = scopeFeatureSelector( scope, selectors );\n * // result is {\n * // color: '.custom-scope .wp-my-block p',\n * // typography: { fonSize: '.custom-scope .wp-my-block caption' },\n * // }\n * ```\n *\n * @param {string} scope Selector to scope collection of selectors with.\n * @param {Object} selectors Collection of feature selectors e.g.\n *\n * @return {Object|undefined} Scoped collection of feature selectors.\n */\nexport function scopeFeatureSelectors( scope, selectors ) {\n\tif ( ! scope || ! selectors ) {\n\t\treturn;\n\t}\n\n\tconst featureSelectors = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\tif ( typeof selector === 'string' ) {\n\t\t\tfeatureSelectors[ feature ] = scopeSelector( scope, selector );\n\t\t}\n\n\t\tif ( typeof selector === 'object' ) {\n\t\t\tfeatureSelectors[ feature ] = {};\n\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\tfeatureSelectors[ feature ][ subfeature ] = scopeSelector(\n\t\t\t\t\t\tscope,\n\t\t\t\t\t\tsubfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn featureSelectors;\n}\n\n/**\n * Appends a sub-selector to an existing one.\n *\n * Given the compounded `selector` \"h1, h2, h3\"\n * and the `toAppend` selector \".some-class\" the result will be\n * \"h1.some-class, h2.some-class, h3.some-class\".\n *\n * @param {string} selector Original selector.\n * @param {string} toAppend Selector to append.\n *\n * @return {string} The new selector.\n */\nexport function appendToSelector( selector, toAppend ) {\n\tif ( ! selector.includes( ',' ) ) {\n\t\treturn selector + toAppend;\n\t}\n\tconst selectors = selector.split( ',' );\n\tconst newSelectors = selectors.map( ( sel ) => sel + toAppend );\n\treturn newSelectors.join( ',' );\n}\n\n/**\n * Compares global style variations according to their styles and settings properties.\n *\n * @example\n * ```js\n * const globalStyles = { styles: { typography: { fontSize: '10px' } }, settings: {} };\n * const variation = { styles: { typography: { fontSize: '10000px' } }, settings: {} };\n * const isEqual = areGlobalStyleConfigsEqual( globalStyles, variation );\n * // false\n * ```\n *\n * @param {Object} original A global styles object.\n * @param {Object} variation A global styles object.\n *\n * @return {boolean} Whether `original` and `variation` match.\n */\nexport function areGlobalStyleConfigsEqual( original, variation ) {\n\tif ( typeof original !== 'object' || typeof variation !== 'object' ) {\n\t\treturn original === variation;\n\t}\n\treturn (\n\t\tfastDeepEqual( original?.styles, variation?.styles ) &&\n\t\tfastDeepEqual( original?.settings, variation?.settings )\n\t);\n}\n\n/**\n * Generates the selector for a block style variation by creating the\n * appropriate CSS class and adding it to the ancestor portion of the block's\n * selector.\n *\n * For example, take the Button block which has a compound selector:\n * `.wp-block-button .wp-block-button__link`. With a variation named 'custom',\n * the class `.is-style-custom` should be added to the `.wp-block-button`\n * ancestor only.\n *\n * This function will take into account comma separated and complex selectors.\n *\n * @param {string} variation Name for the variation.\n * @param {string} blockSelector CSS selector for the block.\n *\n * @return {string} CSS selector for the block style variation.\n */\nexport function getBlockStyleVariationSelector( variation, blockSelector ) {\n\tconst variationClass = `.is-style-${ variation }`;\n\n\tif ( ! blockSelector ) {\n\t\treturn variationClass;\n\t}\n\n\tconst ancestorRegex = /((?::\\([^)]+\\))?\\s*)([^\\s:]+)/;\n\tconst addVariationClass = ( _match, group1, group2 ) => {\n\t\treturn group1 + group2 + variationClass;\n\t};\n\n\tconst result = blockSelector\n\t\t.split( ',' )\n\t\t.map( ( part ) => part.replace( ancestorRegex, addVariationClass ) );\n\n\treturn result.join( ',' );\n}\n\n/**\n * Looks up a theme file URI based on a relative path.\n *\n * @param {string} file A relative path.\n * @param {Array<Object>} themeFileURIs A collection of absolute theme file URIs and their corresponding file paths.\n * @return {string} A resolved theme file URI, if one is found in the themeFileURIs collection.\n */\nexport function getResolvedThemeFilePath( file, themeFileURIs ) {\n\tif ( ! file || ! themeFileURIs || ! Array.isArray( themeFileURIs ) ) {\n\t\treturn file;\n\t}\n\n\tconst uri = themeFileURIs.find(\n\t\t( themeFileUri ) => themeFileUri?.name === file\n\t);\n\n\tif ( ! uri?.href ) {\n\t\treturn file;\n\t}\n\n\treturn uri?.href;\n}\n\n/**\n * Resolves ref values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedRefValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t/*\n\t * Where the rule value is an object with a 'ref' property pointing\n\t * to a path, this converts that path into the value at that path.\n\t * For example: { \"ref\": \"style.color.background\" } => \"#fff\".\n\t */\n\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\tconst resolvedRuleValue = getCSSValueFromRawStyle(\n\t\t\tgetValueFromObjectPath( tree, ruleValue.ref )\n\t\t);\n\n\t\t/*\n\t\t * Presence of another ref indicates a reference to another dynamic value.\n\t\t * Pointing to another dynamic value is not supported.\n\t\t */\n\t\tif ( resolvedRuleValue?.ref ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( resolvedRuleValue === undefined ) {\n\t\t\treturn ruleValue;\n\t\t}\n\n\t\treturn resolvedRuleValue;\n\t}\n\treturn ruleValue;\n}\n\n/**\n * Resolves ref and relative path values in theme JSON.\n *\n * @param {Object|string} ruleValue A block style value that may contain a reference to a theme.json value.\n * @param {Object} tree A theme.json object.\n * @return {*} The resolved value or incoming ruleValue.\n */\nexport function getResolvedValue( ruleValue, tree ) {\n\tif ( ! ruleValue || ! tree ) {\n\t\treturn ruleValue;\n\t}\n\n\t// Resolve ref values.\n\tconst resolvedValue = getResolvedRefValue( ruleValue, tree );\n\n\t// Resolve relative paths.\n\tif ( resolvedValue?.url ) {\n\t\tresolvedValue.url = getResolvedThemeFilePath(\n\t\t\tresolvedValue.url,\n\t\t\ttree?._links?.[ 'wp:theme-file' ]\n\t\t);\n\t}\n\n\treturn resolvedValue;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,yBAAyB;;AAEjE;AACA;AACA;A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  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { __ } from '@wordpress/i18n';
9
+ import { __, isRTL } from '@wordpress/i18n';
10
10
  import { VisuallyHidden, ToolbarButton, ToolbarGroup } from '@wordpress/components';
11
11
  import { chevronLeft, chevronUp, chevronDown, chevronRight } from '@wordpress/icons';
12
12
  import { useDispatch } from '@wordpress/data';
@@ -49,7 +49,7 @@ export function GridItemMovers({
49
49
  children: [/*#__PURE__*/_jsx("div", {
50
50
  className: "block-editor-grid-item-mover__move-horizontal-button-container is-left",
51
51
  children: /*#__PURE__*/_jsx(GridItemMover, {
52
- icon: chevronLeft,
52
+ icon: isRTL() ? chevronRight : chevronLeft,
53
53
  label: __('Move left'),
54
54
  description: __('Move left'),
55
55
  isDisabled: columnStart <= 1,
@@ -93,7 +93,7 @@ export function GridItemMovers({
93
93
  }), /*#__PURE__*/_jsx("div", {
94
94
  className: "block-editor-grid-item-mover__move-horizontal-button-container is-right",
95
95
  children: /*#__PURE__*/_jsx(GridItemMover, {
96
- icon: chevronRight,
96
+ icon: isRTL() ? chevronLeft : chevronRight,
97
97
  label: __('Move right'),
98
98
  description: __('Move right'),
99
99
  isDisabled: columnCount && columnEnd >= columnCount,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","__","VisuallyHidden","ToolbarButton","ToolbarGroup","chevronLeft","chevronUp","chevronDown","chevronRight","useDispatch","useInstanceId","BlockControls","useGetNumberOfBlocksBeforeCell","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","GridItemMovers","layout","parentLayout","onChange","gridClientId","blockClientId","_layout$columnStart","_layout$rowStart","_layout$columnSpan","_layout$rowSpan","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","columnStart","rowStart","columnSpan","rowSpan","columnEnd","rowEnd","columnCount","rowCount","getNumberOfBlocksBeforeCell","group","children","className","GridItemMover","icon","label","description","isDisabled","onClick","instanceId","descriptionId","disabled","accessibleWhenDisabled","id"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-movers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport {\n\tchevronLeft,\n\tchevronUp,\n\tchevronDown,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\n\nexport function GridItemMovers( {\n\tlayout,\n\tparentLayout,\n\tonChange,\n\tgridClientId,\n\tblockClientId,\n} ) {\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst columnStart = layout?.columnStart ?? 1;\n\tconst rowStart = layout?.rowStart ?? 1;\n\tconst columnSpan = layout?.columnSpan ?? 1;\n\tconst rowSpan = layout?.rowSpan ?? 1;\n\tconst columnEnd = columnStart + columnSpan - 1;\n\tconst rowEnd = rowStart + rowSpan - 1;\n\tconst columnCount = parentLayout?.columnCount;\n\tconst rowCount = parentLayout?.rowCount;\n\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\tgridClientId,\n\t\tcolumnCount\n\t);\n\n\treturn (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<ToolbarGroup className=\"block-editor-grid-item-mover__move-button-container\">\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-left\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ chevronLeft }\n\t\t\t\t\t\tlabel={ __( 'Move left' ) }\n\t\t\t\t\t\tdescription={ __( 'Move left' ) }\n\t\t\t\t\t\tisDisabled={ columnStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart - 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-vertical-button-container\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-up-button\"\n\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\tlabel={ __( 'Move up' ) }\n\t\t\t\t\t\tdescription={ __( 'Move up' ) }\n\t\t\t\t\t\tisDisabled={ rowStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart - 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-down-button\"\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tlabel={ __( 'Move down' ) }\n\t\t\t\t\t\tdescription={ __( 'Move down' ) }\n\t\t\t\t\t\tisDisabled={ rowCount && rowEnd >= rowCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-right\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ chevronRight }\n\t\t\t\t\t\tlabel={ __( 'Move right' ) }\n\t\t\t\t\t\tdescription={ __( 'Move right' ) }\n\t\t\t\t\t\tisDisabled={ columnCount && columnEnd >= columnCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart + 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\nfunction GridItemMover( {\n\tclassName,\n\ticon,\n\tlabel,\n\tisDisabled,\n\tonClick,\n\tdescription,\n} ) {\n\tconst instanceId = useInstanceId( GridItemMover );\n\tconst descriptionId = `block-editor-grid-item-mover-button__description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-grid-item-mover-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\tdisabled={ isDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ description }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,cAAc,EACdC,aAAa,EACbC,YAAY,QACN,uBAAuB;AAC9B,SACCC,WAAW,EACXC,SAAS,EACTC,WAAW,EACXC,YAAY,QACN,kBAAkB;AACzB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,8BAA8B,QAAQ,wCAAwC;AACvF,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAExD,OAAO,SAASC,cA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,oBAAmBK,aAAe;MAClCF,OAAO,EAAGD,UAAU,GAAG,IAAI,GAAGC,OAAS;MACvCG,QAAQ,EAAGJ,UAAY;MACvBK,sBAAsB;IAAA,CACtB,CAAC,eACFtC,IAAA,CAACd,cAAc;MAACqD,EAAE,EAAGH,aAAe;MAAAT,QAAA,EACjCK;IAAW,CACE,CAAC;EAAA,CAChB,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["clsx","__","isRTL","VisuallyHidden","ToolbarButton","ToolbarGroup","chevronLeft","chevronUp","chevronDown","chevronRight","useDispatch","useInstanceId","BlockControls","useGetNumberOfBlocksBeforeCell","store","blockEditorStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","GridItemMovers","layout","parentLayout","onChange","gridClientId","blockClientId","_layout$columnStart","_layout$rowStart","_layout$columnSpan","_layout$rowSpan","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","columnStart","rowStart","columnSpan","rowSpan","columnEnd","rowEnd","columnCount","rowCount","getNumberOfBlocksBeforeCell","group","children","className","GridItemMover","icon","label","description","isDisabled","onClick","instanceId","descriptionId","disabled","accessibleWhenDisabled","id"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-movers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tVisuallyHidden,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport {\n\tchevronLeft,\n\tchevronUp,\n\tchevronDown,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockControls from '../block-controls';\nimport { useGetNumberOfBlocksBeforeCell } from './use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\n\nexport function GridItemMovers( {\n\tlayout,\n\tparentLayout,\n\tonChange,\n\tgridClientId,\n\tblockClientId,\n} ) {\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst columnStart = layout?.columnStart ?? 1;\n\tconst rowStart = layout?.rowStart ?? 1;\n\tconst columnSpan = layout?.columnSpan ?? 1;\n\tconst rowSpan = layout?.rowSpan ?? 1;\n\tconst columnEnd = columnStart + columnSpan - 1;\n\tconst rowEnd = rowStart + rowSpan - 1;\n\tconst columnCount = parentLayout?.columnCount;\n\tconst rowCount = parentLayout?.rowCount;\n\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\tgridClientId,\n\t\tcolumnCount\n\t);\n\n\treturn (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<ToolbarGroup className=\"block-editor-grid-item-mover__move-button-container\">\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-left\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\tlabel={ __( 'Move left' ) }\n\t\t\t\t\t\tdescription={ __( 'Move left' ) }\n\t\t\t\t\t\tisDisabled={ columnStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart - 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-vertical-button-container\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-up-button\"\n\t\t\t\t\t\ticon={ chevronUp }\n\t\t\t\t\t\tlabel={ __( 'Move up' ) }\n\t\t\t\t\t\tdescription={ __( 'Move up' ) }\n\t\t\t\t\t\tisDisabled={ rowStart <= 1 }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart - 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart - 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\tclassName=\"is-down-button\"\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tlabel={ __( 'Move down' ) }\n\t\t\t\t\t\tdescription={ __( 'Move down' ) }\n\t\t\t\t\t\tisDisabled={ rowCount && rowEnd >= rowCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowStart: rowStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-grid-item-mover__move-horizontal-button-container is-right\">\n\t\t\t\t\t<GridItemMover\n\t\t\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\t\t\tlabel={ __( 'Move right' ) }\n\t\t\t\t\t\tdescription={ __( 'Move right' ) }\n\t\t\t\t\t\tisDisabled={ columnCount && columnEnd >= columnCount }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart: columnStart + 1,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t[ blockClientId ],\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgridClientId,\n\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\tcolumnStart + 1,\n\t\t\t\t\t\t\t\t\trowStart\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n}\n\nfunction GridItemMover( {\n\tclassName,\n\ticon,\n\tlabel,\n\tisDisabled,\n\tonClick,\n\tdescription,\n} ) {\n\tconst instanceId = useInstanceId( GridItemMover );\n\tconst descriptionId = `block-editor-grid-item-mover-button__description-${ instanceId }`;\n\treturn (\n\t\t<>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-editor-grid-item-mover-button',\n\t\t\t\t\tclassName\n\t\t\t\t) }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\tonClick={ isDisabled ? null : onClick }\n\t\t\t\tdisabled={ isDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t{ description }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SACCC,cAAc,EACdC,aAAa,EACbC,YAAY,QACN,uBAAuB;AAC9B,SACCC,WAAW,EACXC,SAAS,EACTC,WAAW,EACXC,YAAY,QACN,kBAAkB;AACzB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,8BAA8B,QAAQ,wCAAwC;AACvF,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAExD,OAAO,SAASC,cAAcA,CAAE;EAC/BC,MAAM;EACNC,YAAY;EACZC,QAAQ;EACRC,YAAY;EACZC;AACD,CAAC,EAAG;EAAA,IAAAC,mBAAA,EAAAC,gBAAA,EAAAC,kBAAA,EAAAC,eAAA;EACH,MAAM;IAAEC,oBAAoB;IAAEC;EAAwC,CAAC,GACtEvB,WAAW,CAAEK,gBAAiB,CAAC;EAEhC,MAAMmB,WAAW,IAAAN,mBAAA,GAAGL,MAAM,EAAEW,WAAW,cAAAN,mBAAA,cAAAA,mBAAA,GAAI,CAAC;EAC5C,MAAMO,QAAQ,IAAAN,gBAAA,GAAGN,MAAM,EAAEY,QAAQ,cAAAN,gBAAA,cAAAA,gBAAA,GAAI,CAAC;EACtC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C,KAAK,EAAG/C,EAAE,CAAE,YAAa,CAAG;UAC5BgD,WAAW,EAAGhD,EAAE,CAAE,YAAa,CAAG;UAClCiD,UAAU,EAAGV,WAAW,IAAIF,SAAS,IAAIE,WAAa;UACtDW,OAAO,EAAGA,CAAA,KAAM;YACf1B,QAAQ,CAAE;cACTS,WAAW,EAAEA,WAAW,GAAG;YAC5B,CAAE,CAAC;YACHD,uCAAuC,CAAC,CAAC;YACzCD,oBAAoB,CACnB,CAAEL,aAAa,CAAE,EACjBD,YAAY,EACZA,YAAY,EACZgB,2BAA2B,CAC1BR,WAAW,GAAG,CAAC,EACfC,QACD,CACD,CAAC;UACF;QAAG,CACH;MAAC,CACE,CAAC;IAAA,CACO;EAAC,CACD,CAAC;AAElB;AAEA,SAASW,aAAaA,CAAE;EACvBD,SAAS;EACTE,IAAI;EACJC,KAAK;EACLE,UAAU;EACVC,OAAO;EACPF;AACD,CAAC,EAAG;EACH,MAAMG,UAAU,GAAGzC,aAAa,CAAEmC,aAAc,CAAC;EACjD,MAAMO,aAAa,GAAI,oDAAoDD,UAAY,EAAC;EACxF,oBACCjC,KAAA,CAAAE,SAAA;IAAAuB,QAAA,gBACC3B,IAAA,CAACb,aAAa;MACbyC,SAAS,EAAG7C,IAAI,CACf,qCAAqC,EACrC6C,SACD,CAAG;MACHE,IAAI,EAAGA,IAAM;MACbC,KAAK,EAAGA,KAAO;MACf,oBAAmBK,aAAe;MAClCF,OAAO,EAAGD,UAAU,GAAG,IAAI,GAAGC,OAAS;MACvCG,QAAQ,EAAGJ,UAAY;MACvBK,sBAAsB;IAAA,CACtB,CAAC,eACFtC,IAAA,CAACd,cAAc;MAACqD,EAAE,EAAGH,aAAe;MAAAT,QAAA,EACjCK;IAAW,CACE,CAAC;EAAA,CAChB,CAAC;AAEL","ignoreList":[]}
@@ -64,8 +64,8 @@ function GridItemResizerInner({
64
64
  return () => observer.disconnect();
65
65
  }, [blockElement, rootBlockElement]);
66
66
  const justification = {
67
- right: 'flex-start',
68
- left: 'flex-end'
67
+ right: 'left',
68
+ left: 'right'
69
69
  };
70
70
  const alignment = {
71
71
  top: 'flex-end',
@@ -1 +1 @@
1
- {"version":3,"names":["ResizableBox","useState","useEffect","useBlockElement","BlockPopoverCover","getComputedCSS","getGridTracks","getClosestTrack","jsx","_jsx","GridItemResizer","clientId","bounds","onChange","parentLayout","blockElement","rootBlockElement","parentElement","isManualPlacement","GridItemResizerInner","isManualGrid","window","__experimentalEnableGridInteractivity","resizeDirection","setResizeDirection","enableSide","setEnableSide","top","bottom","left","right","observer","ResizeObserver","blockClientRect","getBoundingClientRect","rootBlockClientRect","observe","disconnect","justification","alignment","styles","display","justifyContent","alignItems","className","__unstablePopoverSlot","additionalStyles","children","size","width","height","enable","bottomLeft","bottomRight","topLeft","topRight","boundsByDirection","onPointerDown","target","pointerId","setPointerCapture","onResizeStart","event","direction","onResizeStop","boxElement","columnGap","parseFloat","rowGap","gridColumnTracks","gridRowTracks","rect","DOMRect","offsetLeft","offsetTop","offsetWidth","offsetHeight","columnStart","rowStart","columnEnd","rowEnd","columnSpan","rowSpan","undefined"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-resizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport BlockPopoverCover from '../block-popover/cover';\nimport { getComputedCSS, getGridTracks, getClosestTrack } from './utils';\n\nexport function GridItemResizer( {\n\tclientId,\n\tbounds,\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst rootBlockElement = blockElement?.parentElement;\n\tconst { isManualPlacement } = parentLayout;\n\n\tif ( ! blockElement || ! rootBlockElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridItemResizerInner\n\t\t\tclientId={ clientId }\n\t\t\tbounds={ bounds }\n\t\t\tblockElement={ blockElement }\n\t\t\trootBlockElement={ rootBlockElement }\n\t\t\tonChange={ onChange }\n\t\t\tisManualGrid={\n\t\t\t\tisManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction GridItemResizerInner( {\n\tclientId,\n\tbounds,\n\tblockElement,\n\trootBlockElement,\n\tonChange,\n\tisManualGrid,\n} ) {\n\tconst [ resizeDirection, setResizeDirection ] = useState( null );\n\tconst [ enableSide, setEnableSide ] = useState( {\n\t\ttop: false,\n\t\tbottom: false,\n\t\tleft: false,\n\t\tright: false,\n\t} );\n\n\tuseEffect( () => {\n\t\tconst observer = new window.ResizeObserver( () => {\n\t\t\tconst blockClientRect = blockElement.getBoundingClientRect();\n\t\t\tconst rootBlockClientRect =\n\t\t\t\trootBlockElement.getBoundingClientRect();\n\t\t\tsetEnableSide( {\n\t\t\t\ttop: blockClientRect.top > rootBlockClientRect.top,\n\t\t\t\tbottom: blockClientRect.bottom < rootBlockClientRect.bottom,\n\t\t\t\tleft: blockClientRect.left > rootBlockClientRect.left,\n\t\t\t\tright: blockClientRect.right < rootBlockClientRect.right,\n\t\t\t} );\n\t\t} );\n\t\tobserver.observe( blockElement );\n\t\treturn () => observer.disconnect();\n\t}, [ blockElement, rootBlockElement ] );\n\n\tconst justification = {\n\t\tright: 'flex-start',\n\t\tleft: 'flex-end',\n\t};\n\n\tconst alignment = {\n\t\ttop: 'flex-end',\n\t\tbottom: 'flex-start',\n\t};\n\n\tconst styles = {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\t...( justification[ resizeDirection ] && {\n\t\t\tjustifyContent: justification[ resizeDirection ],\n\t\t} ),\n\t\t...( alignment[ resizeDirection ] && {\n\t\t\talignItems: alignment[ resizeDirection ],\n\t\t} ),\n\t};\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclassName=\"block-editor-grid-item-resizer\"\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"__unstable-block-tools-after\"\n\t\t\tadditionalStyles={ styles }\n\t\t>\n\t\t\t<ResizableBox\n\t\t\t\tclassName=\"block-editor-grid-item-resizer__box\"\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\theight: '100%',\n\t\t\t\t} }\n\t\t\t\tenable={ {\n\t\t\t\t\tbottom: enableSide.bottom,\n\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\tbottomRight: false,\n\t\t\t\t\tleft: enableSide.left,\n\t\t\t\t\tright: enableSide.right,\n\t\t\t\t\ttop: enableSide.top,\n\t\t\t\t\ttopLeft: false,\n\t\t\t\t\ttopRight: false,\n\t\t\t\t} }\n\t\t\t\tbounds={ bounds }\n\t\t\t\tboundsByDirection\n\t\t\t\tonPointerDown={ ( { target, pointerId } ) => {\n\t\t\t\t\t/*\n\t\t\t\t\t * Captures the pointer to avoid hiccups while dragging over objects\n\t\t\t\t\t * like iframes and ensures that the event to end the drag is\n\t\t\t\t\t * captured by the target (resize handle) whether or not it’s under\n\t\t\t\t\t * the pointer.\n\t\t\t\t\t */\n\t\t\t\t\ttarget.setPointerCapture( pointerId );\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ ( event, direction ) => {\n\t\t\t\t\t/*\n\t\t\t\t\t * The container justification and alignment need to be set\n\t\t\t\t\t * according to the direction the resizer is being dragged in,\n\t\t\t\t\t * so that it resizes in the right direction.\n\t\t\t\t\t */\n\t\t\t\t\tsetResizeDirection( direction );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, boxElement ) => {\n\t\t\t\t\tconst columnGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'column-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst rowGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'row-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst gridColumnTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-columns'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolumnGap\n\t\t\t\t\t);\n\t\t\t\t\tconst gridRowTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-rows'\n\t\t\t\t\t\t),\n\t\t\t\t\t\trowGap\n\t\t\t\t\t);\n\t\t\t\t\tconst rect = new window.DOMRect(\n\t\t\t\t\t\tblockElement.offsetLeft + boxElement.offsetLeft,\n\t\t\t\t\t\tblockElement.offsetTop + boxElement.offsetTop,\n\t\t\t\t\t\tboxElement.offsetWidth,\n\t\t\t\t\t\tboxElement.offsetHeight\n\t\t\t\t\t);\n\t\t\t\t\tconst columnStart =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.left ) + 1;\n\t\t\t\t\tconst rowStart =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.top ) + 1;\n\t\t\t\t\tconst columnEnd =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.right, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tconst rowEnd =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.bottom, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tcolumnSpan: columnEnd - columnStart + 1,\n\t\t\t\t\t\trowSpan: rowEnd - rowStart + 1,\n\t\t\t\t\t\tcolumnStart: isManualGrid ? columnStart : undefined,\n\t\t\t\t\t\trowStart: isManualGrid ? rowStart : undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockPopoverCover>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,SAASC,e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U,CAACQ,UAAU,EAC/C1D,YAAY,CAAC2D,SAAS,GAAGT,UAAU,CAACS,SAAS,EAC7CT,UAAU,CAACU,WAAW,EACtBV,UAAU,CAACW,YACZ,CAAC;QACD,MAAMC,WAAW,GAChBtE,eAAe,CAAE8D,gBAAgB,EAAEE,IAAI,CAAC1C,IAAK,CAAC,GAAG,CAAC;QACnD,MAAMiD,QAAQ,GACbvE,eAAe,CAAE+D,aAAa,EAAEC,IAAI,CAAC5C,GAAI,CAAC,GAAG,CAAC;QAC/C,MAAMoD,SAAS,GACdxE,eAAe,CAAE8D,gBAAgB,EAAEE,IAAI,CAACzC,KAAK,EAAE,KAAM,CAAC,GACtD,CAAC;QACF,MAAMkD,MAAM,GACXzE,eAAe,CAAE+D,aAAa,EAAEC,IAAI,CAAC3C,MAAM,EAAE,KAAM,CAAC,GACpD,CAAC;QACFf,QAAQ,CAAE;UACToE,UAAU,EAAEF,SAAS,GAAGF,WAAW,GAAG,CAAC;UACvCK,OAAO,EAAEF,MAAM,GAAGF,QAAQ,GAAG,CAAC;UAC9BD,WAAW,EAAEzD,YAAY,GAAGyD,WAAW,GAAGM,SAAS;UACnDL,QAAQ,EAAE1D,YAAY,GAAG0D,QAAQ,GAAGK;QACrC,CAAE,CAAC;MACJ;IAAG,CACH;EAAC,CACgB,CAAC;AAEtB","ignoreList":[]}
1
+ {"version":3,"names":["ResizableBox","useState","useEffect","useBlockElement","BlockPopoverCover","getComputedCSS","getGridTracks","getClosestTrack","jsx","_jsx","GridItemResizer","clientId","bounds","onChange","parentLayout","blockElement","rootBlockElement","parentElement","isManualPlacement","GridItemResizerInner","isManualGrid","window","__experimentalEnableGridInteractivity","resizeDirection","setResizeDirection","enableSide","setEnableSide","top","bottom","left","right","observer","ResizeObserver","blockClientRect","getBoundingClientRect","rootBlockClientRect","observe","disconnect","justification","alignment","styles","display","justifyContent","alignItems","className","__unstablePopoverSlot","additionalStyles","children","size","width","height","enable","bottomLeft","bottomRight","topLeft","topRight","boundsByDirection","onPointerDown","target","pointerId","setPointerCapture","onResizeStart","event","direction","onResizeStop","boxElement","columnGap","parseFloat","rowGap","gridColumnTracks","gridRowTracks","rect","DOMRect","offsetLeft","offsetTop","offsetWidth","offsetHeight","columnStart","rowStart","columnEnd","rowEnd","columnSpan","rowSpan","undefined"],"sources":["@wordpress/block-editor/src/components/grid/grid-item-resizer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useBlockElement } from '../block-list/use-block-props/use-block-refs';\nimport BlockPopoverCover from '../block-popover/cover';\nimport { getComputedCSS, getGridTracks, getClosestTrack } from './utils';\n\nexport function GridItemResizer( {\n\tclientId,\n\tbounds,\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst blockElement = useBlockElement( clientId );\n\tconst rootBlockElement = blockElement?.parentElement;\n\tconst { isManualPlacement } = parentLayout;\n\n\tif ( ! blockElement || ! rootBlockElement ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<GridItemResizerInner\n\t\t\tclientId={ clientId }\n\t\t\tbounds={ bounds }\n\t\t\tblockElement={ blockElement }\n\t\t\trootBlockElement={ rootBlockElement }\n\t\t\tonChange={ onChange }\n\t\t\tisManualGrid={\n\t\t\t\tisManualPlacement &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction GridItemResizerInner( {\n\tclientId,\n\tbounds,\n\tblockElement,\n\trootBlockElement,\n\tonChange,\n\tisManualGrid,\n} ) {\n\tconst [ resizeDirection, setResizeDirection ] = useState( null );\n\tconst [ enableSide, setEnableSide ] = useState( {\n\t\ttop: false,\n\t\tbottom: false,\n\t\tleft: false,\n\t\tright: false,\n\t} );\n\n\tuseEffect( () => {\n\t\tconst observer = new window.ResizeObserver( () => {\n\t\t\tconst blockClientRect = blockElement.getBoundingClientRect();\n\t\t\tconst rootBlockClientRect =\n\t\t\t\trootBlockElement.getBoundingClientRect();\n\t\t\tsetEnableSide( {\n\t\t\t\ttop: blockClientRect.top > rootBlockClientRect.top,\n\t\t\t\tbottom: blockClientRect.bottom < rootBlockClientRect.bottom,\n\t\t\t\tleft: blockClientRect.left > rootBlockClientRect.left,\n\t\t\t\tright: blockClientRect.right < rootBlockClientRect.right,\n\t\t\t} );\n\t\t} );\n\t\tobserver.observe( blockElement );\n\t\treturn () => observer.disconnect();\n\t}, [ blockElement, rootBlockElement ] );\n\n\tconst justification = {\n\t\tright: 'left',\n\t\tleft: 'right',\n\t};\n\n\tconst alignment = {\n\t\ttop: 'flex-end',\n\t\tbottom: 'flex-start',\n\t};\n\n\tconst styles = {\n\t\tdisplay: 'flex',\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\t...( justification[ resizeDirection ] && {\n\t\t\tjustifyContent: justification[ resizeDirection ],\n\t\t} ),\n\t\t...( alignment[ resizeDirection ] && {\n\t\t\talignItems: alignment[ resizeDirection ],\n\t\t} ),\n\t};\n\n\treturn (\n\t\t<BlockPopoverCover\n\t\t\tclassName=\"block-editor-grid-item-resizer\"\n\t\t\tclientId={ clientId }\n\t\t\t__unstablePopoverSlot=\"__unstable-block-tools-after\"\n\t\t\tadditionalStyles={ styles }\n\t\t>\n\t\t\t<ResizableBox\n\t\t\t\tclassName=\"block-editor-grid-item-resizer__box\"\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: '100%',\n\t\t\t\t\theight: '100%',\n\t\t\t\t} }\n\t\t\t\tenable={ {\n\t\t\t\t\tbottom: enableSide.bottom,\n\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\tbottomRight: false,\n\t\t\t\t\tleft: enableSide.left,\n\t\t\t\t\tright: enableSide.right,\n\t\t\t\t\ttop: enableSide.top,\n\t\t\t\t\ttopLeft: false,\n\t\t\t\t\ttopRight: false,\n\t\t\t\t} }\n\t\t\t\tbounds={ bounds }\n\t\t\t\tboundsByDirection\n\t\t\t\tonPointerDown={ ( { target, pointerId } ) => {\n\t\t\t\t\t/*\n\t\t\t\t\t * Captures the pointer to avoid hiccups while dragging over objects\n\t\t\t\t\t * like iframes and ensures that the event to end the drag is\n\t\t\t\t\t * captured by the target (resize handle) whether or not it’s under\n\t\t\t\t\t * the pointer.\n\t\t\t\t\t */\n\t\t\t\t\ttarget.setPointerCapture( pointerId );\n\t\t\t\t} }\n\t\t\t\tonResizeStart={ ( event, direction ) => {\n\t\t\t\t\t/*\n\t\t\t\t\t * The container justification and alignment need to be set\n\t\t\t\t\t * according to the direction the resizer is being dragged in,\n\t\t\t\t\t * so that it resizes in the right direction.\n\t\t\t\t\t */\n\t\t\t\t\tsetResizeDirection( direction );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, boxElement ) => {\n\t\t\t\t\tconst columnGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'column-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst rowGap = parseFloat(\n\t\t\t\t\t\tgetComputedCSS( rootBlockElement, 'row-gap' )\n\t\t\t\t\t);\n\t\t\t\t\tconst gridColumnTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-columns'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcolumnGap\n\t\t\t\t\t);\n\t\t\t\t\tconst gridRowTracks = getGridTracks(\n\t\t\t\t\t\tgetComputedCSS(\n\t\t\t\t\t\t\trootBlockElement,\n\t\t\t\t\t\t\t'grid-template-rows'\n\t\t\t\t\t\t),\n\t\t\t\t\t\trowGap\n\t\t\t\t\t);\n\t\t\t\t\tconst rect = new window.DOMRect(\n\t\t\t\t\t\tblockElement.offsetLeft + boxElement.offsetLeft,\n\t\t\t\t\t\tblockElement.offsetTop + boxElement.offsetTop,\n\t\t\t\t\t\tboxElement.offsetWidth,\n\t\t\t\t\t\tboxElement.offsetHeight\n\t\t\t\t\t);\n\t\t\t\t\tconst columnStart =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.left ) + 1;\n\t\t\t\t\tconst rowStart =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.top ) + 1;\n\t\t\t\t\tconst columnEnd =\n\t\t\t\t\t\tgetClosestTrack( gridColumnTracks, rect.right, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tconst rowEnd =\n\t\t\t\t\t\tgetClosestTrack( gridRowTracks, rect.bottom, 'end' ) +\n\t\t\t\t\t\t1;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tcolumnSpan: columnEnd - columnStart + 1,\n\t\t\t\t\t\trowSpan: rowEnd - rowStart + 1,\n\t\t\t\t\t\tcolumnStart: isManualGrid ? columnStart : undefined,\n\t\t\t\t\t\trowStart: isManualGrid ? rowStart : undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockPopoverCover>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AACA;AACA,SAASC,eAAe,QAAQ,8CAA8C;AAC9E,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,cAAc,EAAEC,aAAa,EAAEC,eAAe,QAAQ,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEzE,OAAO,SAASC,eAAeA,CAAE;EAChCC,QAAQ;EACRC,MAAM;EACNC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAMC,YAAY,GAAGZ,eAAe,CAAEQ,QAAS,CAAC;EAChD,MAAMK,gBAAgB,GAAGD,YAAY,EAAEE,aAAa;EACpD,MAAM;IAAEC;EAAkB,CAAC,GAAGJ,YAAY;EAE1C,IAAK,CAAEC,YAAY,IAAI,CAAEC,gBAAgB,EAAG;IAC3C,OAAO,IAAI;EACZ;EAEA,oBACCP,IAAA,CAACU,oBAAoB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AE,KAAM,CAAC,GACpD,CAAC;QACFf,QAAQ,CAAE;UACToE,UAAU,EAAEF,SAAS,GAAGF,WAAW,GAAG,CAAC;UACvCK,OAAO,EAAEF,MAAM,GAAGF,QAAQ,GAAG,CAAC;UAC9BD,WAAW,EAAEzD,YAAY,GAAGyD,WAAW,GAAGM,SAAS;UACnDL,QAAQ,EAAE1D,YAAY,GAAG0D,QAAQ,GAAGK;QACrC,CAAE,CAAC;MACJ;IAAG,CACH;EAAC,CACgB,CAAC;AAEtB","ignoreList":[]}
@@ -40,7 +40,7 @@ export function getCompatibilityStyles() {
40
40
  // Don't try to add the reset styles, which were removed as a dependency
41
41
  // from `edit-blocks` for the iframe since we don't need to reset admin
42
42
  // styles.
43
- if (ownerNode.id === 'wp-reset-editor-styles-css') {
43
+ if (['wp-reset-editor-styles-css', 'wp-reset-editor-styles-rtl-css'].includes(ownerNode.id)) {
44
44
  return accumulator;
45
45
  }
46
46
 
@@ -1 +1 @@
1
- {"version":3,"names":["compatibilityStyles","getCompatibilityStyles","Array","from","document","styleSheets","reduce","accumulator","styleSheet","cssRules","e","ownerNode","id","matchFromRules","_cssRules","find","selectorText","conditionText","__cssRules","includes","isInline","tagName","mainStylesCssId","replace","mainStylesElement","getElementById","push","cloneNode","inlineStylesCssId","inlineStylesElement"],"sources":["@wordpress/block-editor/src/components/iframe/get-compatibility-styles.js"],"sourcesContent":["let compatibilityStyles = null;\n\n/**\n * Returns a list of stylesheets that target the editor canvas. A stylesheet is\n * considered targetting the editor a canvas if it contains the\n * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.\n *\n * Ideally, this hook should be removed in the future and styles should be added\n * explicitly as editor styles.\n */\nexport function getCompatibilityStyles() {\n\tif ( compatibilityStyles ) {\n\t\treturn compatibilityStyles;\n\t}\n\n\t// Only memoize the result once on load, since these stylesheets should not\n\t// change.\n\tcompatibilityStyles = Array.from( document.styleSheets ).reduce(\n\t\t( accumulator, styleSheet ) => {\n\t\t\ttry {\n\t\t\t\t// May fail for external styles.\n\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\tstyleSheet.cssRules;\n\t\t\t} catch ( e ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\tconst { ownerNode, cssRules } = styleSheet;\n\n\t\t\t// Stylesheet is added by another stylesheet. See\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/ownerNode#notes.\n\t\t\tif ( ownerNode === null ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\tif ( ! cssRules ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\t// Don't try to add the reset styles, which were removed as a dependency\n\t\t\t// from `edit-blocks` for the iframe since we don't need to reset admin\n\t\t\t// styles.\n\t\t\tif ( ownerNode.id === 'wp-reset-editor-styles-css' ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\t// Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs.\n\t\t\tif ( ! ownerNode.id ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\tfunction matchFromRules( _cssRules ) {\n\t\t\t\treturn Array.from( _cssRules ).find(\n\t\t\t\t\t( {\n\t\t\t\t\t\tselectorText,\n\t\t\t\t\t\tconditionText,\n\t\t\t\t\t\tcssRules: __cssRules,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\t// If the rule is conditional then it will not have selector text.\n\t\t\t\t\t\t// Recurse into child CSS ruleset to determine selector eligibility.\n\t\t\t\t\t\tif ( conditionText ) {\n\t\t\t\t\t\t\treturn matchFromRules( __cssRules );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tselectorText &&\n\t\t\t\t\t\t\t( selectorText.includes(\n\t\t\t\t\t\t\t\t'.editor-styles-wrapper'\n\t\t\t\t\t\t\t) ||\n\t\t\t\t\t\t\t\tselectorText.includes( '.wp-block' ) )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( matchFromRules( cssRules ) ) {\n\t\t\t\tconst isInline = ownerNode.tagName === 'STYLE';\n\n\t\t\t\tif ( isInline ) {\n\t\t\t\t\t// If the current target is inline,\n\t\t\t\t\t// it could be a dependency of an existing stylesheet.\n\t\t\t\t\t// Look for that dependency and add it BEFORE the current target.\n\t\t\t\t\tconst mainStylesCssId = ownerNode.id.replace(\n\t\t\t\t\t\t'-inline-css',\n\t\t\t\t\t\t'-css'\n\t\t\t\t\t);\n\t\t\t\t\tconst mainStylesElement =\n\t\t\t\t\t\tdocument.getElementById( mainStylesCssId );\n\t\t\t\t\tif ( mainStylesElement ) {\n\t\t\t\t\t\taccumulator.push( mainStylesElement.cloneNode( true ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\taccumulator.push( ownerNode.cloneNode( true ) );\n\n\t\t\t\tif ( ! isInline ) {\n\t\t\t\t\t// If the current target is not inline,\n\t\t\t\t\t// we still look for inline styles that could be relevant for the current target.\n\t\t\t\t\t// If they exist, add them AFTER the current target.\n\t\t\t\t\tconst inlineStylesCssId = ownerNode.id.replace(\n\t\t\t\t\t\t'-css',\n\t\t\t\t\t\t'-inline-css'\n\t\t\t\t\t);\n\t\t\t\t\tconst inlineStylesElement =\n\t\t\t\t\t\tdocument.getElementById( inlineStylesCssId );\n\t\t\t\t\tif ( inlineStylesElement ) {\n\t\t\t\t\t\taccumulator.push(\n\t\t\t\t\t\t\tinlineStylesElement.cloneNode( true )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\treturn compatibilityStyles;\n}\n"],"mappings":"AAAA,IAAIA,mBAAmB,GAAG,IAAI;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAA,EAAG;EACxC,IAAKD,mBAAmB,EAAG;IAC1B,OAAOA,mBAAmB;EAC3B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,iBAAiB,GACtBpB,QAAQ,CAACqB,cAAc,CAAEH,eAAgB,CAAC;QAC3C,IAAKE,iBAAiB,EAAG;UACxBjB,WAAW,CAACmB,IAAI,CAAEF,iBAAiB,CAACG,SAAS,CAAE,IAAK,CAAE,CAAC;QACxD;MACD;MAEApB,WAAW,CAACmB,IAAI,CAAEf,SAAS,CAACgB,SAAS,CAAE,IAAK,CAAE,CAAC;MAE/C,IAAK,CAAEP,QAAQ,EAAG;QACjB;QACA;QACA;QACA,MAAMQ,iBAAiB,GAAGjB,SAAS,CAACC,EAAE,CAACW,OAAO,CAC7C,MAAM,EACN,aACD,CAAC;QACD,MAAMM,mBAAmB,GACxBzB,QAAQ,CAACqB,cAAc,CAAEG,iBAAkB,CAAC;QAC7C,IAAKC,mBAAmB,EAAG;UAC1BtB,WAAW,CAACmB,IAAI,CACfG,mBAAmB,CAACF,SAAS,CAAE,IAAK,CACrC,CAAC;QACF;MACD;IACD;IAEA,OAAOpB,WAAW;EACnB,CAAC,EACD,EACD,CAAC;EAED,OAAOP,mBAAmB;AAC3B","ignoreList":[]}
1
+ {"version":3,"names":["compatibilityStyles","getCompatibilityStyles","Array","from","document","styleSheets","reduce","accumulator","styleSheet","cssRules","e","ownerNode","includes","id","matchFromRules","_cssRules","find","selectorText","conditionText","__cssRules","isInline","tagName","mainStylesCssId","replace","mainStylesElement","getElementById","push","cloneNode","inlineStylesCssId","inlineStylesElement"],"sources":["@wordpress/block-editor/src/components/iframe/get-compatibility-styles.js"],"sourcesContent":["let compatibilityStyles = null;\n\n/**\n * Returns a list of stylesheets that target the editor canvas. A stylesheet is\n * considered targetting the editor a canvas if it contains the\n * `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.\n *\n * Ideally, this hook should be removed in the future and styles should be added\n * explicitly as editor styles.\n */\nexport function getCompatibilityStyles() {\n\tif ( compatibilityStyles ) {\n\t\treturn compatibilityStyles;\n\t}\n\n\t// Only memoize the result once on load, since these stylesheets should not\n\t// change.\n\tcompatibilityStyles = Array.from( document.styleSheets ).reduce(\n\t\t( accumulator, styleSheet ) => {\n\t\t\ttry {\n\t\t\t\t// May fail for external styles.\n\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\tstyleSheet.cssRules;\n\t\t\t} catch ( e ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\tconst { ownerNode, cssRules } = styleSheet;\n\n\t\t\t// Stylesheet is added by another stylesheet. See\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/ownerNode#notes.\n\t\t\tif ( ownerNode === null ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\tif ( ! cssRules ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\t// Don't try to add the reset styles, which were removed as a dependency\n\t\t\t// from `edit-blocks` for the iframe since we don't need to reset admin\n\t\t\t// styles.\n\t\t\tif (\n\t\t\t\t[\n\t\t\t\t\t'wp-reset-editor-styles-css',\n\t\t\t\t\t'wp-reset-editor-styles-rtl-css',\n\t\t\t\t].includes( ownerNode.id )\n\t\t\t) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\t// Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs.\n\t\t\tif ( ! ownerNode.id ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\tfunction matchFromRules( _cssRules ) {\n\t\t\t\treturn Array.from( _cssRules ).find(\n\t\t\t\t\t( {\n\t\t\t\t\t\tselectorText,\n\t\t\t\t\t\tconditionText,\n\t\t\t\t\t\tcssRules: __cssRules,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\t// If the rule is conditional then it will not have selector text.\n\t\t\t\t\t\t// Recurse into child CSS ruleset to determine selector eligibility.\n\t\t\t\t\t\tif ( conditionText ) {\n\t\t\t\t\t\t\treturn matchFromRules( __cssRules );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tselectorText &&\n\t\t\t\t\t\t\t( selectorText.includes(\n\t\t\t\t\t\t\t\t'.editor-styles-wrapper'\n\t\t\t\t\t\t\t) ||\n\t\t\t\t\t\t\t\tselectorText.includes( '.wp-block' ) )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( matchFromRules( cssRules ) ) {\n\t\t\t\tconst isInline = ownerNode.tagName === 'STYLE';\n\n\t\t\t\tif ( isInline ) {\n\t\t\t\t\t// If the current target is inline,\n\t\t\t\t\t// it could be a dependency of an existing stylesheet.\n\t\t\t\t\t// Look for that dependency and add it BEFORE the current target.\n\t\t\t\t\tconst mainStylesCssId = ownerNode.id.replace(\n\t\t\t\t\t\t'-inline-css',\n\t\t\t\t\t\t'-css'\n\t\t\t\t\t);\n\t\t\t\t\tconst mainStylesElement =\n\t\t\t\t\t\tdocument.getElementById( mainStylesCssId );\n\t\t\t\t\tif ( mainStylesElement ) {\n\t\t\t\t\t\taccumulator.push( mainStylesElement.cloneNode( true ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\taccumulator.push( ownerNode.cloneNode( true ) );\n\n\t\t\t\tif ( ! isInline ) {\n\t\t\t\t\t// If the current target is not inline,\n\t\t\t\t\t// we still look for inline styles that could be relevant for the current target.\n\t\t\t\t\t// If they exist, add them AFTER the current target.\n\t\t\t\t\tconst inlineStylesCssId = ownerNode.id.replace(\n\t\t\t\t\t\t'-css',\n\t\t\t\t\t\t'-inline-css'\n\t\t\t\t\t);\n\t\t\t\t\tconst inlineStylesElement =\n\t\t\t\t\t\tdocument.getElementById( inlineStylesCssId );\n\t\t\t\t\tif ( inlineStylesElement ) {\n\t\t\t\t\t\taccumulator.push(\n\t\t\t\t\t\t\tinlineStylesElement.cloneNode( true )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\treturn compatibilityStyles;\n}\n"],"mappings":"AAAA,I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C,EAAG;MACjC,MAAMW,QAAQ,GAAGT,SAAS,CAACU,OAAO,KAAK,OAAO;MAE9C,IAAKD,QAAQ,EAAG;QACf;QACA;QACA;QACA,MAAME,eAAe,GAAGX,SAAS,CAACE,EAAE,CAACU,OAAO,CAC3C,aAAa,EACb,MACD,CAAC;QACD,MAAMC,iBAAiB,GACtBpB,QAAQ,CAACqB,cAAc,CAAEH,eAAgB,CAAC;QAC3C,IAAKE,iBAAiB,EAAG;UACxBjB,WAAW,CAACmB,IAAI,CAAEF,iBAAiB,CAACG,SAAS,CAAE,IAAK,CAAE,CAAC;QACxD;MACD;MAEApB,WAAW,CAACmB,IAAI,CAAEf,SAAS,CAACgB,SAAS,CAAE,IAAK,CAAE,CAAC;MAE/C,IAAK,CAAEP,QAAQ,EAAG;QACjB;QACA;QACA;QACA,MAAMQ,iBAAiB,GAAGjB,SAAS,CAACE,EAAE,CAACU,OAAO,CAC7C,MAAM,EACN,aACD,CAAC;QACD,MAAMM,mBAAmB,GACxBzB,QAAQ,CAACqB,cAAc,CAAEG,iBAAkB,CAAC;QAC7C,IAAKC,mBAAmB,EAAG;UAC1BtB,WAAW,CAACmB,IAAI,CACfG,mBAAmB,CAACF,SAAS,CAAE,IAAK,CACrC,CAAC;QACF;MACD;IACD;IAEA,OAAOpB,WAAW;EACnB,CAAC,EACD,EACD,CAAC;EAED,OAAOP,mBAAmB;AAC3B","ignoreList":[]}
@@ -119,7 +119,7 @@ function Iframe({
119
119
  scripts = ''
120
120
  } = resolvedAssets;
121
121
  const [iframeDocument, setIframeDocument] = useState();
122
- const prevContainerWidth = useRef();
122
+ const prevContainerWidthRef = useRef();
123
123
  const [bodyClasses, setBodyClasses] = useState([]);
124
124
  const clearerRef = useBlockSelectionClearer();
125
125
  const [before, writingFlowRef, after] = useWritingFlow();
@@ -203,7 +203,7 @@ function Iframe({
203
203
  const isZoomedOut = scale !== 1;
204
204
  useEffect(() => {
205
205
  if (!isZoomedOut) {
206
- prevContainerWidth.current = containerWidth;
206
+ prevContainerWidthRef.current = containerWidth;
207
207
  }
208
208
  }, [containerWidth, isZoomedOut]);
209
209
  const disabledRef = useDisabled({
@@ -256,12 +256,12 @@ function Iframe({
256
256
  }
257
257
  iframeDocument.documentElement.classList.add('is-zoomed-out');
258
258
  const maxWidth = 750;
259
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) / prevContainerWidth.current : scale);
259
+ iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-scale', scale === 'default' ? Math.min(containerWidth, maxWidth) / prevContainerWidthRef.current : scale);
260
260
  iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-frame-size', typeof frameSize === 'number' ? `${frameSize}px` : frameSize);
261
261
  iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-content-height', `${contentHeight}px`);
262
262
  iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-inner-height', `${iframeWindowInnerHeight}px`);
263
263
  iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-container-width', `${containerWidth}px`);
264
- iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-prev-container-width', `${prevContainerWidth.current}px`);
264
+ iframeDocument.documentElement.style.setProperty('--wp-block-editor-iframe-zoom-out-prev-container-width', `${prevContainerWidthRef.current}px`);
265
265
  return () => {
266
266
  iframeDocument.documentElement.classList.remove('is-zoomed-out');
267
267
  iframeDocument.documentElement.style.removeProperty('--wp-block-editor-iframe-zoom-out-scale');
@@ -338,7 +338,7 @@ function Iframe({
338
338
  className: clsx('block-editor-iframe__scale-container', isZoomedOut && 'is-zoomed-out'),
339
339
  style: {
340
340
  '--wp-block-editor-iframe-zoom-out-container-width': isZoomedOut && `${containerWidth}px`,
341
- '--wp-block-editor-iframe-zoom-out-prev-container-width': isZoomedOut && `${prevContainerWidth.current}px`
341
+ '--wp-block-editor-iframe-zoom-out-prev-container-width': isZoomedOut && `${prevContainerWidthRef.current}px`
342
342
  },
343
343
  children: iframe
344
344
  })]