@wordpress/block-editor 12.17.0 → 12.18.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 (401) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +32 -0
  3. package/build/components/block-draggable/index.js +11 -3
  4. package/build/components/block-draggable/index.js.map +1 -1
  5. package/build/components/block-edit/context.js +3 -1
  6. package/build/components/block-edit/context.js.map +1 -1
  7. package/build/components/block-edit/index.js +4 -2
  8. package/build/components/block-edit/index.js.map +1 -1
  9. package/build/components/block-editing-mode/index.js +6 -3
  10. package/build/components/block-editing-mode/index.js.map +1 -1
  11. package/build/components/block-inspector/index.js +5 -2
  12. package/build/components/block-inspector/index.js.map +1 -1
  13. package/build/components/block-list/block.js +4 -3
  14. package/build/components/block-list/block.js.map +1 -1
  15. package/build/components/block-list/block.native.js +9 -5
  16. package/build/components/block-list/block.native.js.map +1 -1
  17. package/build/components/block-list/index.js +30 -4
  18. package/build/components/block-list/index.js.map +1 -1
  19. package/build/components/block-list/private-block-context.js +1 -1
  20. package/build/components/block-list/private-block-context.js.map +1 -1
  21. package/build/components/block-list/use-in-between-inserter.js +1 -1
  22. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  23. package/build/components/block-lock/toolbar.js +8 -2
  24. package/build/components/block-lock/toolbar.js.map +1 -1
  25. package/build/components/block-popover/inbetween.js +15 -3
  26. package/build/components/block-popover/inbetween.js.map +1 -1
  27. package/build/components/block-preview/auto.js +1 -1
  28. package/build/components/block-preview/auto.js.map +1 -1
  29. package/build/components/block-removal-warning-modal/index.js +3 -2
  30. package/build/components/block-removal-warning-modal/index.js.map +1 -1
  31. package/build/components/block-settings-menu/block-settings-dropdown.js +2 -4
  32. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  33. package/build/components/block-switcher/block-transformations-menu.js +12 -1
  34. package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
  35. package/build/components/block-switcher/index.js +119 -90
  36. package/build/components/block-switcher/index.js.map +1 -1
  37. package/build/components/block-tools/insertion-point.js +10 -3
  38. package/build/components/block-tools/insertion-point.js.map +1 -1
  39. package/build/components/font-sizes/fluid-utils.js +7 -1
  40. package/build/components/font-sizes/fluid-utils.js.map +1 -1
  41. package/build/components/global-styles/border-panel.js +5 -14
  42. package/build/components/global-styles/border-panel.js.map +1 -1
  43. package/build/components/global-styles/effects-panel.js +7 -1
  44. package/build/components/global-styles/effects-panel.js.map +1 -1
  45. package/build/components/global-styles/hooks.js +3 -2
  46. package/build/components/global-styles/hooks.js.map +1 -1
  47. package/build/components/global-styles/typography-panel.js +31 -14
  48. package/build/components/global-styles/typography-panel.js.map +1 -1
  49. package/build/components/iframe/get-compatibility-styles.js +99 -0
  50. package/build/components/iframe/get-compatibility-styles.js.map +1 -0
  51. package/build/components/iframe/index.js +2 -3
  52. package/build/components/iframe/index.js.map +1 -1
  53. package/build/components/index.js +16 -2
  54. package/build/components/index.js.map +1 -1
  55. package/build/components/index.native.js +16 -2
  56. package/build/components/index.native.js.map +1 -1
  57. package/build/components/inspector-controls/groups.js +2 -0
  58. package/build/components/inspector-controls/groups.js.map +1 -1
  59. package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
  60. package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  61. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  62. package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  63. package/build/components/link-control/link-preview.js +30 -26
  64. package/build/components/link-control/link-preview.js.map +1 -1
  65. package/build/components/link-control/search-input.js +1 -9
  66. package/build/components/link-control/search-input.js.map +1 -1
  67. package/build/components/list-view/block-contents.js +3 -1
  68. package/build/components/list-view/block-contents.js.map +1 -1
  69. package/build/components/list-view/block.js +10 -1
  70. package/build/components/list-view/block.js.map +1 -1
  71. package/build/components/list-view/branch.js +29 -8
  72. package/build/components/list-view/branch.js.map +1 -1
  73. package/build/components/list-view/drop-indicator.js +100 -32
  74. package/build/components/list-view/drop-indicator.js.map +1 -1
  75. package/build/components/list-view/index.js +52 -4
  76. package/build/components/list-view/index.js.map +1 -1
  77. package/build/components/list-view/leaf.js +2 -2
  78. package/build/components/list-view/leaf.js.map +1 -1
  79. package/build/components/list-view/use-list-view-block-indexes.js +30 -0
  80. package/build/components/list-view/use-list-view-block-indexes.js.map +1 -0
  81. package/build/components/list-view/use-list-view-drop-zone.js +56 -5
  82. package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
  83. package/build/components/list-view/utils.js +92 -0
  84. package/build/components/list-view/utils.js.map +1 -1
  85. package/build/components/provider/index.js +1 -1
  86. package/build/components/provider/index.js.map +1 -1
  87. package/build/components/recursion-provider/index.js +21 -0
  88. package/build/components/recursion-provider/index.js.map +1 -1
  89. package/build/components/rich-text/index.js +30 -6
  90. package/build/components/rich-text/index.js.map +1 -1
  91. package/build/components/rich-text/native/index.native.js +9 -9
  92. package/build/components/rich-text/native/index.native.js.map +1 -1
  93. package/build/components/use-block-drop-zone/index.js +30 -7
  94. package/build/components/use-block-drop-zone/index.js.map +1 -1
  95. package/build/components/use-on-block-drop/index.js +50 -8
  96. package/build/components/use-on-block-drop/index.js.map +1 -1
  97. package/build/hooks/block-hooks.js +5 -14
  98. package/build/hooks/block-hooks.js.map +1 -1
  99. package/build/hooks/content-lock-ui.js +17 -42
  100. package/build/hooks/content-lock-ui.js.map +1 -1
  101. package/build/hooks/effects.js +66 -0
  102. package/build/hooks/effects.js.map +1 -0
  103. package/build/hooks/index.js +15 -2
  104. package/build/hooks/index.js.map +1 -1
  105. package/build/hooks/index.native.js +13 -0
  106. package/build/hooks/index.native.js.map +1 -1
  107. package/build/hooks/style.js +6 -2
  108. package/build/hooks/style.js.map +1 -1
  109. package/build/hooks/supports.js +2 -1
  110. package/build/hooks/supports.js.map +1 -1
  111. package/build/hooks/typography.native.js +2 -2
  112. package/build/hooks/typography.native.js.map +1 -1
  113. package/build/hooks/use-bindings-attributes.js +115 -0
  114. package/build/hooks/use-bindings-attributes.js.map +1 -0
  115. package/build/hooks/use-shadow-props.js +46 -0
  116. package/build/hooks/use-shadow-props.js.map +1 -0
  117. package/build/hooks/utils.js +11 -7
  118. package/build/hooks/utils.js.map +1 -1
  119. package/build/index.js +14 -0
  120. package/build/index.js.map +1 -1
  121. package/build/store/actions.js +10 -6
  122. package/build/store/actions.js.map +1 -1
  123. package/build/store/index.js +2 -0
  124. package/build/store/index.js.map +1 -1
  125. package/build/store/private-actions.js +37 -0
  126. package/build/store/private-actions.js.map +1 -1
  127. package/build/store/private-selectors.js +60 -9
  128. package/build/store/private-selectors.js.map +1 -1
  129. package/build/store/reducer.js +44 -3
  130. package/build/store/reducer.js.map +1 -1
  131. package/build/store/resolvers.js +27 -0
  132. package/build/store/resolvers.js.map +1 -0
  133. package/build/store/selectors.js +94 -56
  134. package/build/store/selectors.js.map +1 -1
  135. package/build/store/utils.js +5 -26
  136. package/build/store/utils.js.map +1 -1
  137. package/build/utils/index.js +0 -16
  138. package/build/utils/index.js.map +1 -1
  139. package/build/utils/math.js +13 -0
  140. package/build/utils/math.js.map +1 -1
  141. package/build/utils/object.js +17 -0
  142. package/build/utils/object.js.map +1 -1
  143. package/build/utils/transform-styles/index.js +37 -27
  144. package/build/utils/transform-styles/index.js.map +1 -1
  145. package/build-module/components/block-draggable/index.js +11 -3
  146. package/build-module/components/block-draggable/index.js.map +1 -1
  147. package/build-module/components/block-edit/context.js +1 -0
  148. package/build-module/components/block-edit/context.js.map +1 -1
  149. package/build-module/components/block-edit/index.js +5 -3
  150. package/build-module/components/block-edit/index.js.map +1 -1
  151. package/build-module/components/block-editing-mode/index.js +7 -4
  152. package/build-module/components/block-editing-mode/index.js.map +1 -1
  153. package/build-module/components/block-inspector/index.js +5 -2
  154. package/build-module/components/block-inspector/index.js.map +1 -1
  155. package/build-module/components/block-list/block.js +6 -5
  156. package/build-module/components/block-list/block.js.map +1 -1
  157. package/build-module/components/block-list/block.native.js +11 -7
  158. package/build-module/components/block-list/block.native.js.map +1 -1
  159. package/build-module/components/block-list/index.js +31 -5
  160. package/build-module/components/block-list/index.js.map +1 -1
  161. package/build-module/components/block-list/private-block-context.js +1 -1
  162. package/build-module/components/block-list/private-block-context.js.map +1 -1
  163. package/build-module/components/block-list/use-in-between-inserter.js +1 -1
  164. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  165. package/build-module/components/block-lock/toolbar.js +8 -2
  166. package/build-module/components/block-lock/toolbar.js.map +1 -1
  167. package/build-module/components/block-popover/inbetween.js +15 -3
  168. package/build-module/components/block-popover/inbetween.js.map +1 -1
  169. package/build-module/components/block-preview/auto.js +3 -3
  170. package/build-module/components/block-preview/auto.js.map +1 -1
  171. package/build-module/components/block-removal-warning-modal/index.js +3 -2
  172. package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
  173. package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
  174. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  175. package/build-module/components/block-switcher/block-transformations-menu.js +12 -1
  176. package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
  177. package/build-module/components/block-switcher/index.js +116 -86
  178. package/build-module/components/block-switcher/index.js.map +1 -1
  179. package/build-module/components/block-tools/insertion-point.js +10 -3
  180. package/build-module/components/block-tools/insertion-point.js.map +1 -1
  181. package/build-module/components/font-sizes/fluid-utils.js +7 -1
  182. package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
  183. package/build-module/components/global-styles/border-panel.js +5 -14
  184. package/build-module/components/global-styles/border-panel.js.map +1 -1
  185. package/build-module/components/global-styles/effects-panel.js +7 -1
  186. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  187. package/build-module/components/global-styles/hooks.js +3 -2
  188. package/build-module/components/global-styles/hooks.js.map +1 -1
  189. package/build-module/components/global-styles/typography-panel.js +32 -15
  190. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  191. package/build-module/components/iframe/get-compatibility-styles.js +93 -0
  192. package/build-module/components/iframe/get-compatibility-styles.js.map +1 -0
  193. package/build-module/components/iframe/index.js +2 -3
  194. package/build-module/components/iframe/index.js.map +1 -1
  195. package/build-module/components/index.js +1 -1
  196. package/build-module/components/index.js.map +1 -1
  197. package/build-module/components/index.native.js +1 -1
  198. package/build-module/components/index.native.js.map +1 -1
  199. package/build-module/components/inspector-controls/groups.js +2 -0
  200. package/build-module/components/inspector-controls/groups.js.map +1 -1
  201. package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
  202. package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
  203. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
  204. package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
  205. package/build-module/components/link-control/link-preview.js +32 -28
  206. package/build-module/components/link-control/link-preview.js.map +1 -1
  207. package/build-module/components/link-control/search-input.js +1 -8
  208. package/build-module/components/link-control/search-input.js.map +1 -1
  209. package/build-module/components/list-view/block-contents.js +3 -1
  210. package/build-module/components/list-view/block-contents.js.map +1 -1
  211. package/build-module/components/list-view/block.js +10 -1
  212. package/build-module/components/list-view/block.js.map +1 -1
  213. package/build-module/components/list-view/branch.js +30 -9
  214. package/build-module/components/list-view/branch.js.map +1 -1
  215. package/build-module/components/list-view/drop-indicator.js +99 -32
  216. package/build-module/components/list-view/drop-indicator.js.map +1 -1
  217. package/build-module/components/list-view/index.js +54 -6
  218. package/build-module/components/list-view/index.js.map +1 -1
  219. package/build-module/components/list-view/leaf.js +2 -2
  220. package/build-module/components/list-view/leaf.js.map +1 -1
  221. package/build-module/components/list-view/use-list-view-block-indexes.js +23 -0
  222. package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -0
  223. package/build-module/components/list-view/use-list-view-drop-zone.js +58 -7
  224. package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
  225. package/build-module/components/list-view/utils.js +91 -0
  226. package/build-module/components/list-view/utils.js.map +1 -1
  227. package/build-module/components/provider/index.js +1 -1
  228. package/build-module/components/provider/index.js.map +1 -1
  229. package/build-module/components/recursion-provider/index.js +17 -0
  230. package/build-module/components/recursion-provider/index.js.map +1 -1
  231. package/build-module/components/rich-text/index.js +30 -6
  232. package/build-module/components/rich-text/index.js.map +1 -1
  233. package/build-module/components/rich-text/native/index.native.js +9 -9
  234. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  235. package/build-module/components/use-block-drop-zone/index.js +31 -8
  236. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  237. package/build-module/components/use-on-block-drop/index.js +51 -9
  238. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  239. package/build-module/hooks/block-hooks.js +5 -14
  240. package/build-module/hooks/block-hooks.js.map +1 -1
  241. package/build-module/hooks/content-lock-ui.js +19 -43
  242. package/build-module/hooks/content-lock-ui.js.map +1 -1
  243. package/build-module/hooks/effects.js +51 -0
  244. package/build-module/hooks/effects.js.map +1 -0
  245. package/build-module/hooks/index.js +3 -2
  246. package/build-module/hooks/index.js.map +1 -1
  247. package/build-module/hooks/index.native.js +1 -0
  248. package/build-module/hooks/index.native.js.map +1 -1
  249. package/build-module/hooks/style.js +6 -2
  250. package/build-module/hooks/style.js.map +1 -1
  251. package/build-module/hooks/supports.js +2 -1
  252. package/build-module/hooks/supports.js.map +1 -1
  253. package/build-module/hooks/typography.native.js +2 -2
  254. package/build-module/hooks/typography.native.js.map +1 -1
  255. package/build-module/hooks/use-bindings-attributes.js +112 -0
  256. package/build-module/hooks/use-bindings-attributes.js.map +1 -0
  257. package/build-module/hooks/use-shadow-props.js +39 -0
  258. package/build-module/hooks/use-shadow-props.js.map +1 -0
  259. package/build-module/hooks/utils.js +13 -9
  260. package/build-module/hooks/utils.js.map +1 -1
  261. package/build-module/index.js +1 -1
  262. package/build-module/index.js.map +1 -1
  263. package/build-module/store/actions.js +10 -6
  264. package/build-module/store/actions.js.map +1 -1
  265. package/build-module/store/index.js +2 -0
  266. package/build-module/store/index.js.map +1 -1
  267. package/build-module/store/private-actions.js +35 -0
  268. package/build-module/store/private-actions.js.map +1 -1
  269. package/build-module/store/private-selectors.js +53 -8
  270. package/build-module/store/private-selectors.js.map +1 -1
  271. package/build-module/store/reducer.js +43 -3
  272. package/build-module/store/reducer.js.map +1 -1
  273. package/build-module/store/resolvers.js +20 -0
  274. package/build-module/store/resolvers.js.map +1 -0
  275. package/build-module/store/selectors.js +89 -52
  276. package/build-module/store/selectors.js.map +1 -1
  277. package/build-module/store/utils.js +3 -23
  278. package/build-module/store/utils.js.map +1 -1
  279. package/build-module/utils/index.js +0 -1
  280. package/build-module/utils/index.js.map +1 -1
  281. package/build-module/utils/math.js +12 -0
  282. package/build-module/utils/math.js.map +1 -1
  283. package/build-module/utils/object.js +16 -0
  284. package/build-module/utils/object.js.map +1 -1
  285. package/build-module/utils/transform-styles/index.js +36 -27
  286. package/build-module/utils/transform-styles/index.js.map +1 -1
  287. package/build-style/content-rtl.css +33 -16
  288. package/build-style/content.css +33 -16
  289. package/build-style/default-editor-styles-rtl.css +1 -1
  290. package/build-style/default-editor-styles.css +1 -1
  291. package/build-style/style-rtl.css +169 -114
  292. package/build-style/style.css +169 -114
  293. package/package.json +31 -31
  294. package/src/components/block-canvas/style.scss +8 -1
  295. package/src/components/block-draggable/index.js +16 -5
  296. package/src/components/block-edit/context.js +1 -0
  297. package/src/components/block-edit/index.js +4 -0
  298. package/src/components/block-editing-mode/index.js +12 -7
  299. package/src/components/block-inspector/index.js +5 -2
  300. package/src/components/block-list/block.js +5 -4
  301. package/src/components/block-list/block.native.js +13 -3
  302. package/src/components/block-list/content.scss +34 -5
  303. package/src/components/block-list/index.js +52 -16
  304. package/src/components/block-list/private-block-context.js +1 -1
  305. package/src/components/block-list/use-in-between-inserter.js +1 -2
  306. package/src/components/block-lock/toolbar.js +10 -2
  307. package/src/components/block-popover/inbetween.js +22 -2
  308. package/src/components/block-preview/auto.js +3 -3
  309. package/src/components/block-removal-warning-modal/index.js +3 -2
  310. package/src/components/block-settings-menu/block-settings-dropdown.js +2 -7
  311. package/src/components/block-switcher/block-transformations-menu.js +18 -1
  312. package/src/components/block-switcher/index.js +133 -111
  313. package/src/components/block-switcher/style.scss +6 -4
  314. package/src/components/block-switcher/test/index.js +113 -230
  315. package/src/components/block-toolbar/style.scss +22 -18
  316. package/src/components/block-tools/insertion-point.js +15 -2
  317. package/src/components/block-tools/style.scss +8 -7
  318. package/src/components/font-sizes/fluid-utils.js +8 -2
  319. package/src/components/font-sizes/test/fluid-utils.js +9 -0
  320. package/src/components/global-styles/border-panel.js +7 -17
  321. package/src/components/global-styles/effects-panel.js +16 -1
  322. package/src/components/global-styles/hooks.js +2 -0
  323. package/src/components/global-styles/typography-panel.js +45 -13
  324. package/src/components/iframe/get-compatibility-styles.js +120 -0
  325. package/src/components/iframe/index.js +2 -3
  326. package/src/components/index.js +4 -2
  327. package/src/components/index.native.js +4 -2
  328. package/src/components/inspector-controls/groups.js +2 -0
  329. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  330. package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -0
  331. package/src/components/link-control/link-preview.js +31 -55
  332. package/src/components/link-control/search-input.js +1 -9
  333. package/src/components/link-control/style.scss +31 -85
  334. package/src/components/link-control/test/index.js +2 -1
  335. package/src/components/list-view/block-contents.js +5 -1
  336. package/src/components/list-view/block.js +9 -0
  337. package/src/components/list-view/branch.js +30 -10
  338. package/src/components/list-view/drop-indicator.js +139 -46
  339. package/src/components/list-view/index.js +74 -3
  340. package/src/components/list-view/leaf.js +2 -2
  341. package/src/components/list-view/style.scss +102 -13
  342. package/src/components/list-view/test/use-list-view-drop-zone.js +4 -0
  343. package/src/components/list-view/test/utils.js +218 -1
  344. package/src/components/list-view/use-list-view-block-indexes.js +29 -0
  345. package/src/components/list-view/use-list-view-drop-zone.js +78 -6
  346. package/src/components/list-view/utils.js +116 -0
  347. package/src/components/provider/index.js +3 -1
  348. package/src/components/recursion-provider/README.md +2 -2
  349. package/src/components/recursion-provider/index.js +17 -0
  350. package/src/components/rich-text/index.js +48 -10
  351. package/src/components/rich-text/native/index.native.js +10 -10
  352. package/src/components/use-block-drop-zone/index.js +60 -19
  353. package/src/components/use-block-drop-zone/test/index.js +32 -61
  354. package/src/components/use-on-block-drop/index.js +92 -11
  355. package/src/hooks/block-hooks.js +5 -17
  356. package/src/hooks/content-lock-ui.js +15 -55
  357. package/src/hooks/effects.js +57 -0
  358. package/src/hooks/index.js +2 -2
  359. package/src/hooks/index.native.js +1 -0
  360. package/src/hooks/style.js +8 -0
  361. package/src/hooks/supports.js +2 -0
  362. package/src/hooks/test/effects.js +39 -0
  363. package/src/hooks/typography.native.js +2 -2
  364. package/src/hooks/use-bindings-attributes.js +148 -0
  365. package/src/hooks/use-shadow-props.js +37 -0
  366. package/src/hooks/utils.js +26 -10
  367. package/src/index.js +2 -0
  368. package/src/store/actions.js +9 -4
  369. package/src/store/index.js +2 -0
  370. package/src/store/private-actions.js +32 -0
  371. package/src/store/private-selectors.js +78 -21
  372. package/src/store/reducer.js +49 -2
  373. package/src/store/resolvers.js +17 -0
  374. package/src/store/selectors.js +169 -161
  375. package/src/store/test/registry-selectors.js +431 -0
  376. package/src/store/test/selectors.js +14 -400
  377. package/src/store/utils.js +10 -33
  378. package/src/style.scss +0 -1
  379. package/src/utils/index.js +0 -1
  380. package/src/utils/math.js +12 -0
  381. package/src/utils/object.js +16 -0
  382. package/src/utils/transform-styles/index.js +52 -37
  383. package/tsconfig.tsbuildinfo +1 -1
  384. package/build/components/iframe/use-compatibility-styles.js +0 -100
  385. package/build/components/iframe/use-compatibility-styles.js.map +0 -1
  386. package/build/hooks/custom-fields.js +0 -106
  387. package/build/hooks/custom-fields.js.map +0 -1
  388. package/build/utils/block-variation-transforms.js +0 -42
  389. package/build/utils/block-variation-transforms.js.map +0 -1
  390. package/build-module/components/iframe/use-compatibility-styles.js +0 -94
  391. package/build-module/components/iframe/use-compatibility-styles.js.map +0 -1
  392. package/build-module/hooks/custom-fields.js +0 -99
  393. package/build-module/hooks/custom-fields.js.map +0 -1
  394. package/build-module/utils/block-variation-transforms.js +0 -35
  395. package/build-module/utils/block-variation-transforms.js.map +0 -1
  396. package/src/components/block-switcher/test/__snapshots__/index.js.snap +0 -116
  397. package/src/components/contrast-checker/style.scss +0 -3
  398. package/src/components/iframe/use-compatibility-styles.js +0 -122
  399. package/src/hooks/custom-fields.js +0 -115
  400. package/src/utils/block-variation-transforms.js +0 -38
  401. package/src/utils/test/block-variation-transforms.js +0 -94
@@ -70,9 +70,9 @@ function BorderPanel({
70
70
  defaultControls = DEFAULT_CONTROLS
71
71
  }) {
72
72
  const colors = (0, _hooks.useColorsPerOrigin)(settings);
73
- const decodeValue = rawValue => (0, _utils.getValueFromVariable)({
73
+ const decodeValue = (0, _element.useCallback)(rawValue => (0, _utils.getValueFromVariable)({
74
74
  settings
75
- }, '', rawValue);
75
+ }, '', rawValue), [settings]);
76
76
  const encodeColorValue = colorValue => {
77
77
  const allColors = colors.flatMap(({
78
78
  colors: originColors
@@ -82,15 +82,6 @@ function BorderPanel({
82
82
  }) => color === colorValue);
83
83
  return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue;
84
84
  };
85
- const decodeColorValue = (0, _element.useCallback)(colorValue => {
86
- const allColors = colors.flatMap(({
87
- colors: originColors
88
- }) => originColors);
89
- const colorObject = allColors.find(({
90
- slug
91
- }) => colorValue === 'var:preset|color|' + slug);
92
- return colorObject ? colorObject.color : colorValue;
93
- }, [colors]);
94
85
  const border = (0, _element.useMemo)(() => {
95
86
  if ((0, _components.__experimentalHasSplitBorders)(inheritedValue?.border)) {
96
87
  const borderValue = {
@@ -99,16 +90,16 @@ function BorderPanel({
99
90
  ['top', 'right', 'bottom', 'left'].forEach(side => {
100
91
  borderValue[side] = {
101
92
  ...borderValue[side],
102
- color: decodeColorValue(borderValue[side]?.color)
93
+ color: decodeValue(borderValue[side]?.color)
103
94
  };
104
95
  });
105
96
  return borderValue;
106
97
  }
107
98
  return {
108
99
  ...inheritedValue?.border,
109
- color: inheritedValue?.border?.color ? decodeColorValue(inheritedValue?.border?.color) : undefined
100
+ color: inheritedValue?.border?.color ? decodeValue(inheritedValue?.border?.color) : undefined
110
101
  };
111
- }, [inheritedValue?.border, decodeColorValue]);
102
+ }, [inheritedValue?.border, decodeValue]);
112
103
  const setBorder = newBorder => onChange({
113
104
  ...value,
114
105
  border: newBorder
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_element","_i18n","_borderRadiusControl","_interopRequireDefault","_hooks","_utils","useHasBorderPanel","settings","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","border","color","radius","style","width","BorderToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","_react","createElement","__experimentalToolsPanel","label","__","dropdownMenuProps","TOOLSPANEL_DROPDOWNMENU_PROPS","DEFAULT_CONTROLS","BorderPanel","as","Wrapper","inheritedValue","defaultControls","colors","useColorsPerOrigin","decodeValue","rawValue","getValueFromVariable","encodeColorValue","colorValue","allColors","flatMap","originColors","colorObject","find","slug","decodeColorValue","useCallback","useMemo","hasSplitBorders","borderValue","forEach","side","undefined","setBorder","newBorder","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","newBorderRadius","hasBorderRadius","borderValues","Object","entries","resetBorder","onBorderChange","updatedBorder","previousValue","showBorderByDefault","__experimentalToolsPanelItem","hasValue","isDefinedBorder","onDeselect","isShownByDefault","__experimentalBorderBoxControl","enableAlpha","enableStyle","popoverOffset","popoverPlacement","__experimentalIsRenderedInSidebar","size","default","values","newValue"],"sources":["@wordpress/block-editor/src/components/global-styles/border-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( settings ),\n\t\tuseHasBorderRadiusControl( settings ),\n\t\tuseHasBorderStyleControl( settings ),\n\t\tuseHasBorderWidthControl( settings ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( settings ) {\n\treturn settings?.border?.color;\n}\n\nfunction useHasBorderRadiusControl( settings ) {\n\treturn settings?.border?.radius;\n}\n\nfunction useHasBorderStyleControl( settings ) {\n\treturn settings?.border?.style;\n}\n\nfunction useHasBorderWidthControl( settings ) {\n\treturn settings?.border?.width;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Border' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tradius: true,\n\tcolor: true,\n\twidth: true,\n};\n\nexport default function BorderPanel( {\n\tas: Wrapper = BorderToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\tconst decodeColorValue = useCallback(\n\t\t( colorValue ) => {\n\t\t\tconst allColors = colors.flatMap(\n\t\t\t\t( { colors: originColors } ) => originColors\n\t\t\t);\n\t\t\tconst colorObject = allColors.find(\n\t\t\t\t( { slug } ) => colorValue === 'var:preset|color|' + slug\n\t\t\t);\n\t\t\treturn colorObject ? colorObject.color : colorValue;\n\t\t},\n\t\t[ colors ]\n\t);\n\tconst border = useMemo( () => {\n\t\tif ( hasSplitBorders( inheritedValue?.border ) ) {\n\t\t\tconst borderValue = { ...inheritedValue?.border };\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tborderValue[ side ] = {\n\t\t\t\t\t...borderValue[ side ],\n\t\t\t\t\tcolor: decodeColorValue( borderValue[ side ]?.color ),\n\t\t\t\t};\n\t\t\t} );\n\t\t\treturn borderValue;\n\t\t}\n\t\treturn {\n\t\t\t...inheritedValue?.border,\n\t\t\tcolor: inheritedValue?.border?.color\n\t\t\t\t? decodeColorValue( inheritedValue?.border?.color )\n\t\t\t\t: undefined,\n\t\t};\n\t}, [ inheritedValue?.border, decodeColorValue ] );\n\tconst setBorder = ( newBorder ) =>\n\t\tonChange( { ...value, border: newBorder } );\n\tconst showBorderColor = useHasBorderColorControl( settings );\n\tconst showBorderStyle = useHasBorderStyleControl( settings );\n\tconst showBorderWidth = useHasBorderWidthControl( settings );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst borderRadiusValues = decodeValue( border?.radius );\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...border, radius: newBorderRadius } );\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = value?.border?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: value?.border?.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Ensure we have a visible border style when a border width or\n\t\t// color is being selected.\n\t\tconst updatedBorder = { ...newBorder };\n\n\t\tif ( hasSplitBorders( updatedBorder ) ) {\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tif ( updatedBorder[ side ] ) {\n\t\t\t\t\tupdatedBorder[ side ] = {\n\t\t\t\t\t\t...updatedBorder[ side ],\n\t\t\t\t\t\tcolor: encodeColorValue( updatedBorder[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( updatedBorder ) {\n\t\t\tupdatedBorder.color = encodeColorValue( updatedBorder.color );\n\t\t}\n\n\t\t// As radius is maintained separately to color, style, and width\n\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t};\n\t}, [] );\n\n\tconst showBorderByDefault =\n\t\tdefaultControls?.color || defaultControls?.width;\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ defaultControls.radius }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetBorderRadius( newValue || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,oBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAlBA;AACA;AACA;;AAWA;AACA;AACA;;AAKO,SAASO,iBAAiBA,CAAEC,QAAQ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;IAC3CO,OAAO,EAAGA;EAAS,GAEnB,IAAAI,MAAA,CAAAC,aAAA,EAAC3B,oBAAA,CAAA0F,OAAmB;IACnBC,MAAM,EAAGzB,kBAAoB;IAC7B9C,QAAQ,EAAKwE,QAAQ,IAAM;MAC1BzB,eAAe,CAAEyB,QAAQ,IAAIjC,SAAU,CAAC;IACzC;EAAG,CACH,CACc,CAET,CAAC;AAEZ"}
1
+ {"version":3,"names":["_components","require","_element","_i18n","_borderRadiusControl","_interopRequireDefault","_hooks","_utils","useHasBorderPanel","settings","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","border","color","radius","style","width","BorderToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","_react","createElement","__experimentalToolsPanel","label","__","dropdownMenuProps","TOOLSPANEL_DROPDOWNMENU_PROPS","DEFAULT_CONTROLS","BorderPanel","as","Wrapper","inheritedValue","defaultControls","colors","useColorsPerOrigin","decodeValue","useCallback","rawValue","getValueFromVariable","encodeColorValue","colorValue","allColors","flatMap","originColors","colorObject","find","slug","useMemo","hasSplitBorders","borderValue","forEach","side","undefined","setBorder","newBorder","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","newBorderRadius","hasBorderRadius","borderValues","Object","entries","resetBorder","onBorderChange","updatedBorder","previousValue","showBorderByDefault","__experimentalToolsPanelItem","hasValue","isDefinedBorder","onDeselect","isShownByDefault","__experimentalBorderBoxControl","enableAlpha","enableStyle","popoverOffset","popoverPlacement","__experimentalIsRenderedInSidebar","size","default","values","newValue"],"sources":["@wordpress/block-editor/src/components/global-styles/border-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( settings ),\n\t\tuseHasBorderRadiusControl( settings ),\n\t\tuseHasBorderStyleControl( settings ),\n\t\tuseHasBorderWidthControl( settings ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( settings ) {\n\treturn settings?.border?.color;\n}\n\nfunction useHasBorderRadiusControl( settings ) {\n\treturn settings?.border?.radius;\n}\n\nfunction useHasBorderStyleControl( settings ) {\n\treturn settings?.border?.style;\n}\n\nfunction useHasBorderWidthControl( settings ) {\n\treturn settings?.border?.width;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Border' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tradius: true,\n\tcolor: true,\n\twidth: true,\n};\n\nexport default function BorderPanel( {\n\tas: Wrapper = BorderToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst decodeValue = useCallback(\n\t\t( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),\n\t\t[ settings ]\n\t);\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\tconst border = useMemo( () => {\n\t\tif ( hasSplitBorders( inheritedValue?.border ) ) {\n\t\t\tconst borderValue = { ...inheritedValue?.border };\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tborderValue[ side ] = {\n\t\t\t\t\t...borderValue[ side ],\n\t\t\t\t\tcolor: decodeValue( borderValue[ side ]?.color ),\n\t\t\t\t};\n\t\t\t} );\n\t\t\treturn borderValue;\n\t\t}\n\t\treturn {\n\t\t\t...inheritedValue?.border,\n\t\t\tcolor: inheritedValue?.border?.color\n\t\t\t\t? decodeValue( inheritedValue?.border?.color )\n\t\t\t\t: undefined,\n\t\t};\n\t}, [ inheritedValue?.border, decodeValue ] );\n\tconst setBorder = ( newBorder ) =>\n\t\tonChange( { ...value, border: newBorder } );\n\tconst showBorderColor = useHasBorderColorControl( settings );\n\tconst showBorderStyle = useHasBorderStyleControl( settings );\n\tconst showBorderWidth = useHasBorderWidthControl( settings );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst borderRadiusValues = decodeValue( border?.radius );\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...border, radius: newBorderRadius } );\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = value?.border?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: value?.border?.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Ensure we have a visible border style when a border width or\n\t\t// color is being selected.\n\t\tconst updatedBorder = { ...newBorder };\n\n\t\tif ( hasSplitBorders( updatedBorder ) ) {\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tif ( updatedBorder[ side ] ) {\n\t\t\t\t\tupdatedBorder[ side ] = {\n\t\t\t\t\t\t...updatedBorder[ side ],\n\t\t\t\t\t\tcolor: encodeColorValue( updatedBorder[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( updatedBorder ) {\n\t\t\tupdatedBorder.color = encodeColorValue( updatedBorder.color );\n\t\t}\n\n\t\t// As radius is maintained separately to color, style, and width\n\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t};\n\t}, [] );\n\n\tconst showBorderByDefault =\n\t\tdefaultControls?.color || defaultControls?.width;\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ defaultControls.radius }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetBorderRadius( newValue || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAKA,IAAAG,oBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAlBA;AACA;AACA;;AAWA;AACA;AACA;;AAKO,SAASO,iBAAiBA,CAAEC,QAAQ,EAAG;EAC7C,MAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,QAAS,CAAC,EACpCG,yBAAyB,CAAEH,QAAS,CAAC,EACrCI,wBAAwB,CAAEJ,QAAS,CAAC,EACpCK,wBAAwB,CAAEL,QAAS,CAAC,CACpC;EAED,OAAOC,QAAQ,CAACK,IAAI,CAAEC,O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C,CAAG;IAClCS,gBAAgB,EAAGL,mBAAqB;IACxCtD,OAAO,EAAGA;EAAS,GAEnB,IAAAI,MAAA,CAAAC,aAAA,EAAC/B,WAAA,CAAAsF,8BAAgB;IAChB3C,MAAM,EAAGA,MAAQ;IACjB4C,WAAW,EAAG,IAAM;IACpBC,WAAW,EAAGtB,eAAiB;IAC/B1C,QAAQ,EAAGqD,cAAgB;IAC3BY,aAAa,EAAG,EAAI;IACpBC,gBAAgB,EAAC,YAAY;IAC7BjE,KAAK,EAAGR,MAAQ;IAChB0E,iCAAiC,EAAG,IAAM;IAC1CC,IAAI,EAAG;EAAoB,CAC3B,CACc,CAChB,EACCxB,gBAAgB,IACjB,IAAAtC,MAAA,CAAAC,aAAA,EAAC/B,WAAA,CAAAiF,4BAAc;IACdC,QAAQ,EAAGV,eAAiB;IAC5BvC,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IACxBkD,UAAU,EAAGA,CAAA,KAAMd,eAAe,CAAER,SAAU,CAAG;IACjDuB,gBAAgB,EAAG3C,eAAe,CAACvB,MAAQ;IAC3CO,OAAO,EAAGA;EAAS,GAEnB,IAAAI,MAAA,CAAAC,aAAA,EAAC3B,oBAAA,CAAAyF,OAAmB;IACnBC,MAAM,EAAGzB,kBAAoB;IAC7B7C,QAAQ,EAAKuE,QAAQ,IAAM;MAC1BzB,eAAe,CAAEyB,QAAQ,IAAIjC,SAAU,CAAC;IACzC;EAAG,CACH,CACc,CAET,CAAC;AAEZ"}
@@ -12,6 +12,7 @@ var _components = require("@wordpress/components");
12
12
  var _i18n = require("@wordpress/i18n");
13
13
  var _element = require("@wordpress/element");
14
14
  var _icons = require("@wordpress/icons");
15
+ var _useSettings = require("../use-settings");
15
16
  var _utils = require("./utils");
16
17
  var _object = require("../../utils/object");
17
18
  /**
@@ -70,8 +71,13 @@ function EffectsPanel({
70
71
  // Shadow
71
72
  const hasShadowEnabled = useHasShadowControl(settings);
72
73
  const shadow = decodeValue(inheritedValue?.shadow);
74
+ const shadowPresets = settings?.shadow?.presets;
75
+ const mergedShadowPresets = shadowPresets ? (0, _useSettings.mergeOrigins)(shadowPresets) : [];
73
76
  const setShadow = newValue => {
74
- onChange((0, _object.setImmutably)(value, ['shadow'], newValue));
77
+ const slug = mergedShadowPresets?.find(({
78
+ shadow: shadowName
79
+ }) => shadowName === newValue)?.slug;
80
+ onChange((0, _object.setImmutably)(value, ['shadow'], slug ? `var:preset|shadow|${slug}` : newValue || undefined));
75
81
  };
76
82
  const hasShadow = () => !!value?.shadow;
77
83
  const resetShadow = () => setShadow(undefined);
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_element","_icons","_utils","_object","useHasEffectsPanel","settings","hasShadowControl","useHasShadowControl","shadow","EffectsToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","_react","createElement","__experimentalToolsPanel","label","__","dropdownMenuProps","TOOLSPANEL_DROPDOWNMENU_PROPS","DEFAULT_CONTROLS","EffectsPanel","as","Wrapper","inheritedValue","defaultControls","decodeValue","rawValue","getValueFromVariable","hasShadowEnabled","setShadow","newValue","setImmutably","hasShadow","resetShadow","undefined","useCallback","previousValue","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","__experimentalItemGroup","isBordered","isSeparated","ShadowPopover","onShadowChange","popoverProps","placement","offset","shift","Dropdown","className","renderToggle","renderShadowToggle","renderContent","__experimentalDropdownContentWrapper","paddingSize","ShadowPopoverContainer","onToggle","isOpen","toggleProps","onClick","classnames","Button","__experimentalHStack","justify","Icon","icon","shadowIcon","size","FlexItem","defaultShadows","presets","default","themeShadows","theme","defaultPresetsEnabled","defaultPresets","shadows","__experimentalVStack","spacing","__experimentalHeading","level","ShadowPresets","activeShadow","onSelect","__experimentalGrid","columns","gap","align","map","name","slug","ShadowIndicator","key","isActive","style","boxShadow","showTooltip","check"],"sources":["@wordpress/block-editor/src/components/global-styles/effects-panel.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalGrid as Grid,\n\t__experimentalHeading as Heading,\n\tFlexItem,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\nimport { shadow as shadowIcon, Icon, check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nexport function useHasEffectsPanel( settings ) {\n\tconst hasShadowControl = useHasShadowControl( settings );\n\treturn hasShadowControl;\n}\n\nfunction useHasShadowControl( settings ) {\n\treturn !! settings?.shadow;\n}\n\nfunction EffectsToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Effects' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tshadow: true,\n};\n\nexport default function EffectsPanel( {\n\tas: Wrapper = EffectsToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\t// Shadow\n\tconst hasShadowEnabled = useHasShadowControl( settings );\n\tconst shadow = decodeValue( inheritedValue?.shadow );\n\tconst setShadow = ( newValue ) => {\n\t\tonChange( setImmutably( value, [ 'shadow' ], newValue ) );\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tshadow: undefined,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ hasShadowEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\t\thasValue={ hasShadow }\n\t\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\t\tisShownByDefault={ defaultControls.shadow }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\t\tonShadowChange={ setShadow }\n\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n\nconst ShadowPopover = ( { shadow, onShadowChange, settings } ) => {\n\tconst popoverProps = {\n\t\tplacement: 'left-start',\n\t\toffset: 36,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName=\"block-editor-global-styles-effects-panel__shadow-dropdown\"\n\t\t\trenderToggle={ renderShadowToggle() }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t\t<ShadowPopoverContainer\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ onShadowChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n};\n\nfunction renderShadowToggle() {\n\treturn ( { onToggle, isOpen } ) => {\n\t\tconst toggleProps = {\n\t\t\tonClick: onToggle,\n\t\t\tclassName: classnames( { 'is-open': isOpen } ),\n\t\t\t'aria-expanded': isOpen,\n\t\t};\n\n\t\treturn (\n\t\t\t<Button { ...toggleProps }>\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName=\"block-editor-global-styles-effects-panel__toggle-icon\"\n\t\t\t\t\t\ticon={ shadowIcon }\n\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t\t<FlexItem>{ __( 'Shadow' ) }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t);\n\t};\n}\n\nfunction ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {\n\tconst defaultShadows = settings?.shadow?.presets?.default;\n\tconst themeShadows = settings?.shadow?.presets?.theme;\n\tconst defaultPresetsEnabled = settings?.shadow?.defaultPresets;\n\n\tconst shadows = [\n\t\t...( defaultPresetsEnabled ? defaultShadows : [] ),\n\t\t...( themeShadows || [] ),\n\t];\n\n\treturn (\n\t\t<div className=\"block-editor-global-styles-effects-panel__shadow-popover-container\">\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<Heading level={ 5 }>{ __( 'Shadow' ) }</Heading>\n\t\t\t\t<ShadowPresets\n\t\t\t\t\tpresets={ shadows }\n\t\t\t\t\tactiveShadow={ shadow }\n\t\t\t\t\tonSelect={ onShadowChange }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction ShadowPresets( { presets, activeShadow, onSelect } ) {\n\treturn ! presets ? null : (\n\t\t<Grid columns={ 6 } gap={ 0 } align=\"center\" justify=\"center\">\n\t\t\t{ presets.map( ( { name, slug, shadow } ) => (\n\t\t\t\t<ShadowIndicator\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tlabel={ name }\n\t\t\t\t\tisActive={ shadow === activeShadow }\n\t\t\t\t\tonSelect={ () =>\n\t\t\t\t\t\tonSelect( shadow === activeShadow ? undefined : shadow )\n\t\t\t\t\t}\n\t\t\t\t\tshadow={ shadow }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Grid>\n\t);\n}\n\nfunction ShadowIndicator( { label, isActive, onSelect, shadow } ) {\n\treturn (\n\t\t<div className=\"block-editor-global-styles-effects-panel__shadow-indicator-wrapper\">\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-global-styles-effects-panel__shadow-indicator\"\n\t\t\t\tonClick={ onSelect }\n\t\t\t\tlabel={ label }\n\t\t\t\tstyle={ { boxShadow: shadow } }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t{ isActive && <Icon icon={ check } /> }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAaA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAkBA;AACA;AACA;;AAIO,SAASO,kBAAkBA,CAAEC,QAAQ,EAAG;EAC9C,MAAMC,gBAAgB,GAAGC,mBAAmB,CAAEF,QAAS,CAAC;EACxD,OAAOC,gBAAgB;AACxB;AAEA,SAASC,mBAAmBA,CAAEF,QAAQ,EAAG;EACxC,OAAO,CAAC,CAAEA,QAAQ,EAAEG,MAAM;AAC3B;AAEA,SAASC,iBAAiBA,C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Q,CACjB,CACA,CACG,CACN;AACF;AAEA,SAAS0F,eAAeA,CAAE;EAAE9E,KAAK;EAAEgF,QAAQ;EAAEV,QAAQ;EAAElF;AAAO,CAAC,EAAG;EACjE,OACC,IAAAS,MAAA,CAAAC,aAAA;IAAKsC,SAAS,EAAC;EAAoE,GAClF,IAAAvC,MAAA,CAAAC,aAAA,EAACpB,WAAA,CAAAsE,MAAM;IACNZ,SAAS,EAAC,4DAA4D;IACtEU,OAAO,EAAGwB,QAAU;IACpBtE,KAAK,EAAGA,KAAO;IACfiF,KAAK,EAAG;MAAEC,SAAS,EAAE9F;IAAO,CAAG;IAC/B+F,WAAW;EAAA,GAETH,QAAQ,IAAI,IAAAnF,MAAA,CAAAC,aAAA,EAACjB,MAAA,CAAAsE,IAAI;IAACC,IAAI,EAAGgC;EAAO,CAAE,CAC7B,CACJ,CAAC;AAER"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_element","_icons","_useSettings","_utils","_object","useHasEffectsPanel","settings","hasShadowControl","useHasShadowControl","shadow","EffectsToolsPanel","resetAllFilter","onChange","value","panelId","children","resetAll","updatedValue","_react","createElement","__experimentalToolsPanel","label","__","dropdownMenuProps","TOOLSPANEL_DROPDOWNMENU_PROPS","DEFAULT_CONTROLS","EffectsPanel","as","Wrapper","inheritedValue","defaultControls","decodeValue","rawValue","getValueFromVariable","hasShadowEnabled","shadowPresets","presets","mergedShadowPresets","mergeOrigins","setShadow","newValue","slug","find","shadowName","setImmutably","undefined","hasShadow","resetShadow","useCallback","previousValue","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","__experimentalItemGroup","isBordered","isSeparated","ShadowPopover","onShadowChange","popoverProps","placement","offset","shift","Dropdown","className","renderToggle","renderShadowToggle","renderContent","__experimentalDropdownContentWrapper","paddingSize","ShadowPopoverContainer","onToggle","isOpen","toggleProps","onClick","classnames","Button","__experimentalHStack","justify","Icon","icon","shadowIcon","size","FlexItem","defaultShadows","default","themeShadows","theme","defaultPresetsEnabled","defaultPresets","shadows","__experimentalVStack","spacing","__experimentalHeading","level","ShadowPresets","activeShadow","onSelect","__experimentalGrid","columns","gap","align","map","name","ShadowIndicator","key","isActive","style","boxShadow","showTooltip","check"],"sources":["@wordpress/block-editor/src/components/global-styles/effects-panel.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalGrid as Grid,\n\t__experimentalHeading as Heading,\n\tFlexItem,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\nimport { shadow as shadowIcon, Icon, check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { mergeOrigins } from '../use-settings';\nimport { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nexport function useHasEffectsPanel( settings ) {\n\tconst hasShadowControl = useHasShadowControl( settings );\n\treturn hasShadowControl;\n}\n\nfunction useHasShadowControl( settings ) {\n\treturn !! settings?.shadow;\n}\n\nfunction EffectsToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Effects' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tshadow: true,\n};\n\nexport default function EffectsPanel( {\n\tas: Wrapper = EffectsToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\t// Shadow\n\tconst hasShadowEnabled = useHasShadowControl( settings );\n\tconst shadow = decodeValue( inheritedValue?.shadow );\n\tconst shadowPresets = settings?.shadow?.presets;\n\tconst mergedShadowPresets = shadowPresets\n\t\t? mergeOrigins( shadowPresets )\n\t\t: [];\n\tconst setShadow = ( newValue ) => {\n\t\tconst slug = mergedShadowPresets?.find(\n\t\t\t( { shadow: shadowName } ) => shadowName === newValue\n\t\t)?.slug;\n\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'shadow' ],\n\t\t\t\tslug ? `var:preset|shadow|${ slug }` : newValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tshadow: undefined,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ hasShadowEnabled && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\t\thasValue={ hasShadow }\n\t\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\t\tisShownByDefault={ defaultControls.shadow }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\t\tonShadowChange={ setShadow }\n\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n\nconst ShadowPopover = ( { shadow, onShadowChange, settings } ) => {\n\tconst popoverProps = {\n\t\tplacement: 'left-start',\n\t\toffset: 36,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName=\"block-editor-global-styles-effects-panel__shadow-dropdown\"\n\t\t\trenderToggle={ renderShadowToggle() }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t\t<ShadowPopoverContainer\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ onShadowChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n};\n\nfunction renderShadowToggle() {\n\treturn ( { onToggle, isOpen } ) => {\n\t\tconst toggleProps = {\n\t\t\tonClick: onToggle,\n\t\t\tclassName: classnames( { 'is-open': isOpen } ),\n\t\t\t'aria-expanded': isOpen,\n\t\t};\n\n\t\treturn (\n\t\t\t<Button { ...toggleProps }>\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName=\"block-editor-global-styles-effects-panel__toggle-icon\"\n\t\t\t\t\t\ticon={ shadowIcon }\n\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t\t<FlexItem>{ __( 'Shadow' ) }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t);\n\t};\n}\n\nfunction ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {\n\tconst defaultShadows = settings?.shadow?.presets?.default;\n\tconst themeShadows = settings?.shadow?.presets?.theme;\n\tconst defaultPresetsEnabled = settings?.shadow?.defaultPresets;\n\n\tconst shadows = [\n\t\t...( defaultPresetsEnabled ? defaultShadows : [] ),\n\t\t...( themeShadows || [] ),\n\t];\n\n\treturn (\n\t\t<div className=\"block-editor-global-styles-effects-panel__shadow-popover-container\">\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<Heading level={ 5 }>{ __( 'Shadow' ) }</Heading>\n\t\t\t\t<ShadowPresets\n\t\t\t\t\tpresets={ shadows }\n\t\t\t\t\tactiveShadow={ shadow }\n\t\t\t\t\tonSelect={ onShadowChange }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nfunction ShadowPresets( { presets, activeShadow, onSelect } ) {\n\treturn ! presets ? null : (\n\t\t<Grid columns={ 6 } gap={ 0 } align=\"center\" justify=\"center\">\n\t\t\t{ presets.map( ( { name, slug, shadow } ) => (\n\t\t\t\t<ShadowIndicator\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tlabel={ name }\n\t\t\t\t\tisActive={ shadow === activeShadow }\n\t\t\t\t\tonSelect={ () =>\n\t\t\t\t\t\tonSelect( shadow === activeShadow ? undefined : shadow )\n\t\t\t\t\t}\n\t\t\t\t\tshadow={ shadow }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Grid>\n\t);\n}\n\nfunction ShadowIndicator( { label, isActive, onSelect, shadow } ) {\n\treturn (\n\t\t<div className=\"block-editor-global-styles-effects-panel__shadow-indicator-wrapper\">\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-global-styles-effects-panel__shadow-indicator\"\n\t\t\t\tonClick={ onSelect }\n\t\t\t\tlabel={ label }\n\t\t\t\tstyle={ { boxShadow: shadow } }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t{ isActive && <Icon icon={ check } /> }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,s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O;IACfsF,KAAK,EAAG;MAAEC,SAAS,EAAEnG;IAAO,CAAG;IAC/BoG,WAAW;EAAA,GAETH,QAAQ,IAAI,IAAAxF,MAAA,CAAAC,aAAA,EAAClB,MAAA,CAAA8E,IAAI;IAACC,IAAI,EAAG8B;EAAO,CAAE,CAC7B,CACJ,CAAC;AAER"}
@@ -35,7 +35,7 @@ const EMPTY_CONFIG = {
35
35
  settings: {},
36
36
  styles: {}
37
37
  };
38
- const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'background.backgroundImage', 'background.backgroundRepeat', 'background.backgroundSize', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'lightbox.enabled', 'lightbox.allowEditing', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform', 'typography.writingMode'];
38
+ const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'background.backgroundImage', 'background.backgroundRepeat', 'background.backgroundSize', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'lightbox.enabled', 'lightbox.allowEditing', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.defaultFontSizes', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform', 'typography.writingMode'];
39
39
  const useGlobalStylesReset = () => {
40
40
  const {
41
41
  user: config,
@@ -140,7 +140,8 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
140
140
  updatedSettings.typography = {
141
141
  ...updatedSettings.typography,
142
142
  fontSizes: {},
143
- customFontSize: false
143
+ customFontSize: false,
144
+ defaultFontSizes: false
144
145
  };
145
146
  }
146
147
  if (!supportedStyles.includes('fontFamily')) {
@@ -1 +1 @@
1
- {"version":3,"names":["_es","_interopRequireDefault","require","_element","_data","_blocks","_i18n","_utils","_object","_context","_lockUnlock","EMPTY_CONFIG","settings","styles","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","useContext","GlobalStylesContext","canReset","fastDeepEqual","useCallback","exports","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","useMemo","configToUse","_getValueFromObjectPa","getValueFromObjectPath","result","forEach","setting","_getValueFromObjectPa2","value","undefined","setImmutably","split","setSetting","newValue","currentConfig","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","getPresetVariableFromValue","rawResult","getValueFromVariable","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","useSelect","select","unlock","blocksStore","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","fontFamilies","color","text","background","button","heading","link","caption","gradients","customGradient","defaultDuotone","customDuotone","key","textColumns","layout","spacing","sides","Array","isArray","length","dimensions","minHeight","charAt","toUpperCase","slice","border","shadow","useColorsPerOrigin","customColors","palette","custom","themeColors","theme","defaultColors","default","shouldDisplayDefaultColors","defaultPalette","push","name","_x","colors","useGradientsPerOrigin","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients"],"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_CONFIG = { settings: {}, styles: {} };\n\nconst VALID_SETTINGS = [\n\t'appearanceTools',\n\t'useRootPaddingAwareAlignments',\n\t'background.backgroundImage',\n\t'background.backgroundRepeat',\n\t'background.backgroundSize',\n\t'border.color',\n\t'border.radius',\n\t'border.style',\n\t'border.width',\n\t'shadow.presets',\n\t'shadow.defaultPresets',\n\t'color.background',\n\t'color.button',\n\t'color.caption',\n\t'color.custom',\n\t'color.customDuotone',\n\t'color.customGradient',\n\t'color.defaultDuotone',\n\t'color.defaultGradients',\n\t'color.defaultPalette',\n\t'color.duotone',\n\t'color.gradients',\n\t'color.heading',\n\t'color.link',\n\t'color.palette',\n\t'color.text',\n\t'custom',\n\t'dimensions.minHeight',\n\t'layout.contentSize',\n\t'layout.definitions',\n\t'layout.wideSize',\n\t'lightbox.enabled',\n\t'lightbox.allowEditing',\n\t'position.fixed',\n\t'position.sticky',\n\t'spacing.customSpacingSize',\n\t'spacing.spacingSizes',\n\t'spacing.spacingScale',\n\t'spacing.blockGap',\n\t'spacing.margin',\n\t'spacing.padding',\n\t'spacing.units',\n\t'typography.fluid',\n\t'typography.customFontSize',\n\t'typography.dropCap',\n\t'typography.fontFamilies',\n\t'typography.fontSizes',\n\t'typography.fontStyle',\n\t'typography.fontWeight',\n\t'typography.letterSpacing',\n\t'typography.lineHeight',\n\t'typography.textColumns',\n\t'typography.textDecoration',\n\t'typography.textTransform',\n\t'typography.writingMode',\n];\n\nexport const useGlobalStylesReset = () => {\n\tconst { user: config, setUserConfig } = useContext( GlobalStylesContext );\n\tconst canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );\n\treturn [\n\t\tcanReset,\n\t\tuseCallback(\n\t\t\t() => setUserConfig( () => EMPTY_CONFIG ),\n\t\t\t[ setUserConfig ]\n\t\t),\n\t];\n};\n\nexport function useGlobalSetting( propertyPath, blockName, source = 'all' ) {\n\tconst { setUserConfig, ...configs } = useContext( GlobalStylesContext );\n\tconst appendedBlockPath = blockName ? '.blocks.' + blockName : '';\n\tconst appendedPropertyPath = propertyPath ? '.' + propertyPath : '';\n\tconst contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;\n\tconst globalPath = `settings${ appendedPropertyPath }`;\n\tconst sourceKey = source === 'all' ? 'merged' : source;\n\n\tconst settingValue = useMemo( () => {\n\t\tconst configToUse = configs[ sourceKey ];\n\t\tif ( ! configToUse ) {\n\t\t\tthrow 'Unsupported source';\n\t\t}\n\n\t\tif ( propertyPath ) {\n\t\t\treturn (\n\t\t\t\tgetValueFromObjectPath( configToUse, contextualPath ) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tlet result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, `settings.${ setting }` );\n\t\t\tif ( value !== undefined ) {\n\t\t\t\tresult = setImmutably( result, setting.split( '.' ), value );\n\t\t\t}\n\t\t} );\n\t\treturn result;\n\t}, [\n\t\tconfigs,\n\t\tsourceKey,\n\t\tpropertyPath,\n\t\tcontextualPath,\n\t\tglobalPath,\n\t\tappendedBlockPath,\n\t] );\n\n\tconst setSetting = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) =>\n\t\t\tsetImmutably( currentConfig, contextualPath.split( '.' ), newValue )\n\t\t);\n\t};\n\treturn [ settingValue, setSetting ];\n}\n\nexport function useGlobalStyle(\n\tpath,\n\tblockName,\n\tsource = 'all',\n\t{ shouldDecodeEncode = true } = {}\n) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst appendedPath = path ? '.' + path : '';\n\tconst finalPath = ! blockName\n\t\t? `styles${ appendedPath }`\n\t\t: `styles.blocks.${ blockName }${ appendedPath }`;\n\n\tconst setStyle = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) =>\n\t\t\tsetImmutably(\n\t\t\t\tcurrentConfig,\n\t\t\t\tfinalPath.split( '.' ),\n\t\t\t\tshouldDecodeEncode\n\t\t\t\t\t? getPresetVariableFromValue(\n\t\t\t\t\t\t\tmergedConfig.settings,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tnewValue\n\t\t\t\t\t )\n\t\t\t\t\t: newValue\n\t\t\t)\n\t\t);\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult = getValueFromObjectPath( mergedConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\trawResult = getValueFromObjectPath( userConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\trawResult = getValueFromObjectPath( baseConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( baseConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\treturn [ result, setStyle ];\n}\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\tupdatedSettings.color = {\n\t\t\t...updatedSettings.color,\n\t\t\ttext:\n\t\t\t\tupdatedSettings.color?.text &&\n\t\t\t\tsupportedStyles.includes( 'color' ),\n\t\t\tbackground:\n\t\t\t\tupdatedSettings.color?.background &&\n\t\t\t\t( supportedStyles.includes( 'background' ) ||\n\t\t\t\t\tsupportedStyles.includes( 'backgroundColor' ) ),\n\t\t\tbutton:\n\t\t\t\tupdatedSettings.color?.button &&\n\t\t\t\tsupportedStyles.includes( 'buttonColor' ),\n\t\t\theading:\n\t\t\t\tupdatedSettings.color?.heading &&\n\t\t\t\tsupportedStyles.includes( 'headingColor' ),\n\t\t\tlink:\n\t\t\t\tupdatedSettings.color?.link &&\n\t\t\t\tsupportedStyles.includes( 'linkColor' ),\n\t\t\tcaption:\n\t\t\t\tupdatedSettings.color?.caption &&\n\t\t\t\tsupportedStyles.includes( 'captionColor' ),\n\t\t};\n\n\t\t// Some blocks can enable background colors but disable gradients.\n\t\tif ( ! supportedStyles.includes( 'background' ) ) {\n\t\t\tupdatedSettings.color.gradients = [];\n\t\t\tupdatedSettings.color.customGradient = false;\n\t\t}\n\n\t\t// If filters are not supported by the block/element, disable duotone.\n\t\tif ( ! supportedStyles.includes( 'filter' ) ) {\n\t\t\tupdatedSettings.color.defaultDuotone = false;\n\t\t\tupdatedSettings.color.customDuotone = false;\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t\t'writingMode',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t// The column-count style is named text column to reduce confusion with\n\t\t// the columns block and manage expectations from the support.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/33587\n\t\tif ( ! supportedStyles.includes( 'columnCount' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextColumns: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\t// Check if spacing type is supported before adding sides.\n\t\t\tif ( sides?.length && updatedSettings.spacing?.[ key ] ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tif ( ! supportedStyles.includes( 'minHeight' ) ) {\n\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\tminHeight: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {\n\t\t\tif (\n\t\t\t\t! supportedStyles.includes(\n\t\t\t\t\t'border' + key.charAt( 0 ).toUpperCase() + key.slice( 1 )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tupdatedSettings.border = {\n\t\t\t\t\t...updatedSettings.border,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tupdatedSettings.shadow = supportedStyles.includes( 'shadow' )\n\t\t\t? updatedSettings.shadow\n\t\t\t: false;\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n\nexport function useColorsPerOrigin( settings ) {\n\tconst customColors = settings?.color?.palette?.custom;\n\tconst themeColors = settings?.color?.palette?.theme;\n\tconst defaultColors = settings?.color?.palette?.default;\n\tconst shouldDisplayDefaultColors = settings?.color?.defaultPalette;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n}\n\nexport function useGradientsPerOrigin( settings ) {\n\tconst customGradients = settings?.color?.gradients?.custom;\n\tconst themeGradients = settings?.color?.gradients?.theme;\n\tconst defaultGradients = settings?.color?.gradients?.default;\n\tconst shouldDisplayDefaultGradients = settings?.color?.defaultGradients;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] );\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAMA,MAAMS,YAAY,GAAG;EAAEC,QAAQ,EAAE,CAAC,CAAC;EAAEC,MAAM,EAAE,CAAC;AAAE,CAAC;AAEjD,MAAMC,cAAc,GAAG,CACtB,iBAAiB,EACjB,+BAA+B,EAC/B,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC3B,cAAc,EACd,eAAe,EACf,cAAc,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EAAEsE,KAAK,EAAEO,SAAS,EAAEwB,KAAK;EACxD,MAAMY,gBAAgB,GAAGjH,QAAQ,EAAEsE,KAAK,EAAEO,SAAS,EAAE0B,OAAO;EAC5D,MAAMW,6BAA6B,GAAGlH,QAAQ,EAAEsE,KAAK,EAAE2C,gBAAgB;EAEvE,OAAO,IAAAzF,gBAAO,EAAE,MAAM;IACrB,MAAMI,MAAM,GAAG,EAAE;IACjB,IAAKoF,cAAc,IAAIA,cAAc,CAACxB,MAAM,EAAG;MAC9C5D,MAAM,CAAC8E,IAAI,CAAE;QACZC,IAAI,EAAE,IAAAC,QAAE,EACP,OAAO,EACP,8CACD,CAAC;QACD/B,SAAS,EAAEmC;MACZ,CAAE,CAAC;IACJ;IACA,IACCE,6BAA6B,IAC7BD,gBAAgB,IAChBA,gBAAgB,CAACzB,MAAM,EACtB;MACD5D,MAAM,CAAC8E,IAAI,CAAE;QACZC,IAAI,EAAE,IAAAC,QAAE,EACP,SAAS,EACT,8CACD,CAAC;QACD/B,SAAS,EAAEoC;MACZ,CAAE,CAAC;IACJ;IACA,IAAKF,eAAe,IAAIA,eAAe,CAACvB,MAAM,EAAG;MAChD5D,MAAM,CAAC8E,IAAI,CAAE;QACZC,IAAI,EAAE,IAAAC,QAAE,EACP,QAAQ,EACR,gDACD,CAAC;QACD/B,SAAS,EAAEkC;MACZ,CAAE,CAAC;IACJ;IACA,OAAOnF,MAAM;EACd,CAAC,EAAE,CACFmF,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,6BAA6B,CAC5B,CAAC;AACJ"}
1
+ {"version":3,"names":["_es","_interopRequireDefault","require","_element","_data","_blocks","_i18n","_utils","_object","_context","_lockUnlock","EMPTY_CONFIG","settings","styles","VALID_SETTINGS","useGlobalStylesReset","user","config","setUserConfig","useContext","GlobalStylesContext","canReset","fastDeepEqual","useCallback","exports","useGlobalSetting","propertyPath","blockName","source","configs","appendedBlockPath","appendedPropertyPath","contextualPath","globalPath","sourceKey","settingValue","useMemo","configToUse","_getValueFromObjectPa","getValueFromObjectPath","result","forEach","setting","_getValueFromObjectPa2","value","undefined","setImmutably","split","setSetting","newValue","currentConfig","useGlobalStyle","path","shouldDecodeEncode","merged","mergedConfig","base","baseConfig","userConfig","appendedPath","finalPath","setStyle","getPresetVariableFromValue","rawResult","getValueFromVariable","useSettingsForBlockElement","parentSettings","element","supportedStyles","supports","useSelect","select","unlock","blocksStore","getSupportedStyles","getBlockType","updatedSettings","includes","typography","fontSizes","customFontSize","defaultFontSizes","fontFamilies","color","text","background","button","heading","link","caption","gradients","customGradient","defaultDuotone","customDuotone","key","textColumns","layout","spacing","sides","Array","isArray","length","dimensions","minHeight","charAt","toUpperCase","slice","border","shadow","useColorsPerOrigin","customColors","palette","custom","themeColors","theme","defaultColors","default","shouldDisplayDefaultColors","defaultPalette","push","name","_x","colors","useGradientsPerOrigin","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients"],"sources":["@wordpress/block-editor/src/components/global-styles/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable, getPresetVariableFromValue } from './utils';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport { GlobalStylesContext } from './context';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_CONFIG = { settings: {}, styles: {} };\n\nconst VALID_SETTINGS = [\n\t'appearanceTools',\n\t'useRootPaddingAwareAlignments',\n\t'background.backgroundImage',\n\t'background.backgroundRepeat',\n\t'background.backgroundSize',\n\t'border.color',\n\t'border.radius',\n\t'border.style',\n\t'border.width',\n\t'shadow.presets',\n\t'shadow.defaultPresets',\n\t'color.background',\n\t'color.button',\n\t'color.caption',\n\t'color.custom',\n\t'color.customDuotone',\n\t'color.customGradient',\n\t'color.defaultDuotone',\n\t'color.defaultGradients',\n\t'color.defaultPalette',\n\t'color.duotone',\n\t'color.gradients',\n\t'color.heading',\n\t'color.link',\n\t'color.palette',\n\t'color.text',\n\t'custom',\n\t'dimensions.minHeight',\n\t'layout.contentSize',\n\t'layout.definitions',\n\t'layout.wideSize',\n\t'lightbox.enabled',\n\t'lightbox.allowEditing',\n\t'position.fixed',\n\t'position.sticky',\n\t'spacing.customSpacingSize',\n\t'spacing.spacingSizes',\n\t'spacing.spacingScale',\n\t'spacing.blockGap',\n\t'spacing.margin',\n\t'spacing.padding',\n\t'spacing.units',\n\t'typography.fluid',\n\t'typography.customFontSize',\n\t'typography.defaultFontSizes',\n\t'typography.dropCap',\n\t'typography.fontFamilies',\n\t'typography.fontSizes',\n\t'typography.fontStyle',\n\t'typography.fontWeight',\n\t'typography.letterSpacing',\n\t'typography.lineHeight',\n\t'typography.textColumns',\n\t'typography.textDecoration',\n\t'typography.textTransform',\n\t'typography.writingMode',\n];\n\nexport const useGlobalStylesReset = () => {\n\tconst { user: config, setUserConfig } = useContext( GlobalStylesContext );\n\tconst canReset = !! config && ! fastDeepEqual( config, EMPTY_CONFIG );\n\treturn [\n\t\tcanReset,\n\t\tuseCallback(\n\t\t\t() => setUserConfig( () => EMPTY_CONFIG ),\n\t\t\t[ setUserConfig ]\n\t\t),\n\t];\n};\n\nexport function useGlobalSetting( propertyPath, blockName, source = 'all' ) {\n\tconst { setUserConfig, ...configs } = useContext( GlobalStylesContext );\n\tconst appendedBlockPath = blockName ? '.blocks.' + blockName : '';\n\tconst appendedPropertyPath = propertyPath ? '.' + propertyPath : '';\n\tconst contextualPath = `settings${ appendedBlockPath }${ appendedPropertyPath }`;\n\tconst globalPath = `settings${ appendedPropertyPath }`;\n\tconst sourceKey = source === 'all' ? 'merged' : source;\n\n\tconst settingValue = useMemo( () => {\n\t\tconst configToUse = configs[ sourceKey ];\n\t\tif ( ! configToUse ) {\n\t\t\tthrow 'Unsupported source';\n\t\t}\n\n\t\tif ( propertyPath ) {\n\t\t\treturn (\n\t\t\t\tgetValueFromObjectPath( configToUse, contextualPath ) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, globalPath )\n\t\t\t);\n\t\t}\n\n\t\tlet result = {};\n\t\tVALID_SETTINGS.forEach( ( setting ) => {\n\t\t\tconst value =\n\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\tconfigToUse,\n\t\t\t\t\t`settings${ appendedBlockPath }.${ setting }`\n\t\t\t\t) ??\n\t\t\t\tgetValueFromObjectPath( configToUse, `settings.${ setting }` );\n\t\t\tif ( value !== undefined ) {\n\t\t\t\tresult = setImmutably( result, setting.split( '.' ), value );\n\t\t\t}\n\t\t} );\n\t\treturn result;\n\t}, [\n\t\tconfigs,\n\t\tsourceKey,\n\t\tpropertyPath,\n\t\tcontextualPath,\n\t\tglobalPath,\n\t\tappendedBlockPath,\n\t] );\n\n\tconst setSetting = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) =>\n\t\t\tsetImmutably( currentConfig, contextualPath.split( '.' ), newValue )\n\t\t);\n\t};\n\treturn [ settingValue, setSetting ];\n}\n\nexport function useGlobalStyle(\n\tpath,\n\tblockName,\n\tsource = 'all',\n\t{ shouldDecodeEncode = true } = {}\n) {\n\tconst {\n\t\tmerged: mergedConfig,\n\t\tbase: baseConfig,\n\t\tuser: userConfig,\n\t\tsetUserConfig,\n\t} = useContext( GlobalStylesContext );\n\tconst appendedPath = path ? '.' + path : '';\n\tconst finalPath = ! blockName\n\t\t? `styles${ appendedPath }`\n\t\t: `styles.blocks.${ blockName }${ appendedPath }`;\n\n\tconst setStyle = ( newValue ) => {\n\t\tsetUserConfig( ( currentConfig ) =>\n\t\t\tsetImmutably(\n\t\t\t\tcurrentConfig,\n\t\t\t\tfinalPath.split( '.' ),\n\t\t\t\tshouldDecodeEncode\n\t\t\t\t\t? getPresetVariableFromValue(\n\t\t\t\t\t\t\tmergedConfig.settings,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpath,\n\t\t\t\t\t\t\tnewValue\n\t\t\t\t\t )\n\t\t\t\t\t: newValue\n\t\t\t)\n\t\t);\n\t};\n\n\tlet rawResult, result;\n\tswitch ( source ) {\n\t\tcase 'all':\n\t\t\trawResult = getValueFromObjectPath( mergedConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'user':\n\t\t\trawResult = getValueFromObjectPath( userConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( mergedConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tcase 'base':\n\t\t\trawResult = getValueFromObjectPath( baseConfig, finalPath );\n\t\t\tresult = shouldDecodeEncode\n\t\t\t\t? getValueFromVariable( baseConfig, blockName, rawResult )\n\t\t\t\t: rawResult;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow 'Unsupported source';\n\t}\n\n\treturn [ result, setStyle ];\n}\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t\tdefaultFontSizes: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\tupdatedSettings.color = {\n\t\t\t...updatedSettings.color,\n\t\t\ttext:\n\t\t\t\tupdatedSettings.color?.text &&\n\t\t\t\tsupportedStyles.includes( 'color' ),\n\t\t\tbackground:\n\t\t\t\tupdatedSettings.color?.background &&\n\t\t\t\t( supportedStyles.includes( 'background' ) ||\n\t\t\t\t\tsupportedStyles.includes( 'backgroundColor' ) ),\n\t\t\tbutton:\n\t\t\t\tupdatedSettings.color?.button &&\n\t\t\t\tsupportedStyles.includes( 'buttonColor' ),\n\t\t\theading:\n\t\t\t\tupdatedSettings.color?.heading &&\n\t\t\t\tsupportedStyles.includes( 'headingColor' ),\n\t\t\tlink:\n\t\t\t\tupdatedSettings.color?.link &&\n\t\t\t\tsupportedStyles.includes( 'linkColor' ),\n\t\t\tcaption:\n\t\t\t\tupdatedSettings.color?.caption &&\n\t\t\t\tsupportedStyles.includes( 'captionColor' ),\n\t\t};\n\n\t\t// Some blocks can enable background colors but disable gradients.\n\t\tif ( ! supportedStyles.includes( 'background' ) ) {\n\t\t\tupdatedSettings.color.gradients = [];\n\t\t\tupdatedSettings.color.customGradient = false;\n\t\t}\n\n\t\t// If filters are not supported by the block/element, disable duotone.\n\t\tif ( ! supportedStyles.includes( 'filter' ) ) {\n\t\t\tupdatedSettings.color.defaultDuotone = false;\n\t\t\tupdatedSettings.color.customDuotone = false;\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t\t'writingMode',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t// The column-count style is named text column to reduce confusion with\n\t\t// the columns block and manage expectations from the support.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/33587\n\t\tif ( ! supportedStyles.includes( 'columnCount' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextColumns: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\t// Check if spacing type is supported before adding sides.\n\t\t\tif ( sides?.length && updatedSettings.spacing?.[ key ] ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tif ( ! supportedStyles.includes( 'minHeight' ) ) {\n\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\tminHeight: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {\n\t\t\tif (\n\t\t\t\t! supportedStyles.includes(\n\t\t\t\t\t'border' + key.charAt( 0 ).toUpperCase() + key.slice( 1 )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tupdatedSettings.border = {\n\t\t\t\t\t...updatedSettings.border,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tupdatedSettings.shadow = supportedStyles.includes( 'shadow' )\n\t\t\t? updatedSettings.shadow\n\t\t\t: false;\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n\nexport function useColorsPerOrigin( settings ) {\n\tconst customColors = settings?.color?.palette?.custom;\n\tconst themeColors = settings?.color?.palette?.theme;\n\tconst defaultColors = settings?.color?.palette?.default;\n\tconst shouldDisplayDefaultColors = settings?.color?.defaultPalette;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n}\n\nexport function useGradientsPerOrigin( settings ) {\n\tconst customGradients = settings?.color?.gradients?.custom;\n\tconst themeGradients = settings?.color?.gradients?.theme;\n\tconst defaultGradients = settings?.color?.gradients?.default;\n\tconst shouldDisplayDefaultGradients = settings?.color?.defaultGradients;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] );\n}\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAC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/B,SAAS,EAAEkC;MACZ,CAAE,CAAC;IACJ;IACA,OAAOpF,MAAM;EACd,CAAC,EAAE,CACFoF,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,6BAA6B,CAC5B,CAAC;AACJ"}
@@ -43,7 +43,7 @@ function useHasTypographyPanel(settings) {
43
43
  return hasFontFamily || hasLineHeight || hasFontAppearance || hasLetterSpacing || hasTextTransform || hasFontSize || hasTextDecoration || hasWritingMode || hasTextColumns;
44
44
  }
45
45
  function useHasFontSizeControl(settings) {
46
- return (0, _useSettings.hasMergedOrigins)(settings?.typography?.fontSizes) || settings?.typography?.customFontSize;
46
+ return settings?.typography?.defaultFontSizes !== false && settings?.typography?.fontSizes?.default?.length || settings?.typography?.fontSizes?.theme?.length || settings?.typography?.fontSizes?.custom?.length || settings?.typography?.customFontSize;
47
47
  }
48
48
  function useHasFontFamilyControl(settings) {
49
49
  return (0, _useSettings.hasMergedOrigins)(settings?.typography?.fontFamilies);
@@ -78,18 +78,35 @@ function useHasWritingModeControl(settings) {
78
78
  function useHasTextColumnsControl(settings) {
79
79
  return settings?.typography?.textColumns;
80
80
  }
81
- function getUniqueFontSizesBySlug(settings) {
82
- const fontSizes = settings?.typography?.fontSizes;
83
- const mergedFontSizes = fontSizes ? (0, _useSettings.mergeOrigins)(fontSizes) : [];
84
- const uniqueSizes = [];
85
- for (const currentSize of mergedFontSizes) {
86
- if (!uniqueSizes.some(({
87
- slug
88
- }) => slug === currentSize.slug)) {
89
- uniqueSizes.push(currentSize);
90
- }
91
- }
92
- return uniqueSizes;
81
+
82
+ /**
83
+ * TODO: The reversing and filtering of default font sizes is a hack so the
84
+ * dropdown UI matches what is generated in the global styles CSS stylesheet.
85
+ *
86
+ * This is a temporary solution until #57733 is resolved. At which point,
87
+ * the mergedFontSizes would just need to be the concatenated array of all
88
+ * presets or a custom dropdown with sections for each.
89
+ *
90
+ * @see {@link https://github.com/WordPress/gutenberg/issues/57733}
91
+ *
92
+ * @param {Object} settings The global styles settings.
93
+ *
94
+ * @return {Array} The merged font sizes.
95
+ */
96
+ function getMergedFontSizes(settings) {
97
+ // The font size presets are merged in reverse order so that the duplicates
98
+ // that may defined later in the array have higher priority to match the CSS.
99
+ const mergedFontSizesAll = (0, _object.uniqByProperty)([settings?.typography?.fontSizes?.custom, settings?.typography?.fontSizes?.theme, settings?.typography?.fontSizes?.default].flatMap(presets => {
100
+ var _presets$toReversed;
101
+ return (_presets$toReversed = presets?.toReversed()) !== null && _presets$toReversed !== void 0 ? _presets$toReversed : [];
102
+ }), 'slug').reverse();
103
+
104
+ // Default presets exist in the global styles CSS no matter the setting, so
105
+ // filtering them out in the UI has to be done after merging.
106
+ const mergedFontSizes = settings?.typography?.defaultFontSizes === false ? mergedFontSizesAll.filter(({
107
+ slug
108
+ }) => !['small', 'medium', 'large', 'x-large'].includes(slug)) : mergedFontSizesAll;
109
+ return mergedFontSizes;
93
110
  }
94
111
  function TypographyToolsPanel({
95
112
  resetAllFilter,
@@ -150,7 +167,7 @@ function TypographyPanel({
150
167
  // Font Size
151
168
  const hasFontSizeEnabled = useHasFontSizeControl(settings);
152
169
  const disableCustomFontSizes = !settings?.typography?.customFontSize;
153
- const mergedFontSizes = getUniqueFontSizesBySlug(settings);
170
+ const mergedFontSizes = getMergedFontSizes(settings);
154
171
  const fontSize = decodeValue(inheritedValue?.typography?.fontSize);
155
172
  const setFontSize = (newValue, metadata) => {
156
173
  const actualValue = !!metadata?.slug ? `var:preset|font-size|${metadata?.slug}` : newValue;