@wordpress/block-editor 17.1.0 → 17.2.1-next.v.202609171837.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (541) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +214 -214
  3. package/build/autocompleters/block.cjs.map +2 -2
  4. package/build/components/alignment-control/ui.cjs.map +2 -2
  5. package/build/components/background-image-control/index.cjs +1 -1
  6. package/build/components/background-image-control/index.cjs.map +2 -2
  7. package/build/components/block-alignment-control/ui.cjs +21 -7
  8. package/build/components/block-alignment-control/ui.cjs.map +3 -3
  9. package/build/components/block-alignment-control/use-available-alignments.cjs +60 -13
  10. package/build/components/block-alignment-control/use-available-alignments.cjs.map +2 -2
  11. package/build/components/block-allowed-blocks/allowed-blocks-control.cjs.map +2 -2
  12. package/build/components/block-bindings/attribute-control.cjs +30 -30
  13. package/build/components/block-bindings/attribute-control.cjs.map +3 -3
  14. package/build/components/block-bindings/source-fields-list.cjs +27 -32
  15. package/build/components/block-bindings/source-fields-list.cjs.map +3 -3
  16. package/build/components/block-canvas/index.cjs.map +2 -2
  17. package/build/components/block-card/index.cjs +1 -2
  18. package/build/components/block-card/index.cjs.map +3 -3
  19. package/build/components/block-edit/edit.cjs.map +2 -2
  20. package/build/components/block-heading-level-dropdown/index.cjs.map +2 -2
  21. package/build/components/block-icon/index.cjs.map +2 -2
  22. package/build/components/block-inspector/edit-contents.cjs.map +2 -2
  23. package/build/components/block-inspector/index.cjs +27 -8
  24. package/build/components/block-inspector/index.cjs.map +3 -3
  25. package/build/components/block-keyboard-shortcuts/index.cjs.map +2 -2
  26. package/build/components/block-list/block-html.cjs +1 -12
  27. package/build/components/block-list/block-html.cjs.map +3 -3
  28. package/build/components/block-list/block.cjs +2 -4
  29. package/build/components/block-list/block.cjs.map +2 -2
  30. package/build/components/block-list/layout.cjs +1 -1
  31. package/build/components/block-list/layout.cjs.map +2 -2
  32. package/build/components/block-list/use-block-props/index.cjs.map +2 -2
  33. package/build/components/block-lock/modal.cjs +1 -3
  34. package/build/components/block-lock/modal.cjs.map +2 -2
  35. package/build/components/block-parent-selector/index.cjs +8 -5
  36. package/build/components/block-parent-selector/index.cjs.map +2 -2
  37. package/build/components/block-popover/index.cjs.map +2 -2
  38. package/build/components/block-rename/modal.cjs.map +2 -2
  39. package/build/components/block-settings-menu/block-settings-dropdown.cjs.map +2 -2
  40. package/build/components/block-styles/utils.cjs.map +2 -2
  41. package/build/components/block-switcher/index.cjs.map +2 -2
  42. package/build/components/block-toolbar/edit-section-button.cjs.map +2 -2
  43. package/build/components/block-toolbar/index.cjs +6 -4
  44. package/build/components/block-toolbar/index.cjs.map +2 -2
  45. package/build/components/block-toolbar/switch-section-style.cjs.map +2 -2
  46. package/build/components/block-variation-transforms/index.cjs +28 -18
  47. package/build/components/block-variation-transforms/index.cjs.map +3 -3
  48. package/build/components/block-visibility/modal.cjs.map +2 -2
  49. package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
  50. package/build/components/border-radius-control/index.cjs.map +2 -2
  51. package/build/components/color-palette/with-color-context.cjs.map +2 -2
  52. package/build/components/colors/with-colors.cjs.map +2 -2
  53. package/build/components/colors-gradients/control.cjs.map +2 -2
  54. package/build/components/contrast-checker/index.cjs.map +2 -2
  55. package/build/components/date-format-picker/index.cjs.map +2 -2
  56. package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +3 -3
  57. package/build/components/dimensions-tool/width-height-tool.cjs.map +2 -2
  58. package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
  59. package/build/components/global-styles/background-panel.cjs +1 -1
  60. package/build/components/global-styles/background-panel.cjs.map +2 -2
  61. package/build/components/global-styles/border-panel.cjs +1 -1
  62. package/build/components/global-styles/border-panel.cjs.map +2 -2
  63. package/build/components/global-styles/color-gradient-dropdown-item.cjs +1 -1
  64. package/build/components/global-styles/color-gradient-dropdown-item.cjs.map +2 -2
  65. package/build/components/global-styles/color-panel.cjs +1 -1
  66. package/build/components/global-styles/color-panel.cjs.map +2 -2
  67. package/build/components/global-styles/dimensions-panel.cjs +1 -1
  68. package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
  69. package/build/components/global-styles/filters-panel.cjs +1 -1
  70. package/build/components/global-styles/filters-panel.cjs.map +2 -2
  71. package/build/components/global-styles/hooks.cjs +1 -0
  72. package/build/components/global-styles/hooks.cjs.map +2 -2
  73. package/build/components/global-styles/inheritance/index.cjs +3 -3
  74. package/build/components/global-styles/inheritance/index.cjs.map +2 -2
  75. package/build/components/global-styles/inherited-value-context.cjs +0 -5
  76. package/build/components/global-styles/inherited-value-context.cjs.map +2 -2
  77. package/build/components/global-styles/state-control-badges.cjs +0 -1
  78. package/build/components/global-styles/state-control-badges.cjs.map +2 -2
  79. package/build/components/global-styles/state-control.cjs +6 -4
  80. package/build/components/global-styles/state-control.cjs.map +2 -2
  81. package/build/components/global-styles/text-shadow-panel.cjs +254 -0
  82. package/build/components/global-styles/text-shadow-panel.cjs.map +7 -0
  83. package/build/components/global-styles/typography-panel.cjs +46 -5
  84. package/build/components/global-styles/typography-panel.cjs.map +2 -2
  85. package/build/components/global-styles/typography-utils.cjs.map +2 -2
  86. package/build/components/global-styles/utils.cjs.map +2 -2
  87. package/build/components/html-element-control/index.cjs.map +3 -3
  88. package/build/components/iframe/index.cjs.map +2 -2
  89. package/build/components/iframe/use-scale-canvas.cjs.map +2 -2
  90. package/build/components/image-size-control/index.cjs.map +3 -3
  91. package/build/components/inner-blocks/index.cjs +6 -1
  92. package/build/components/inner-blocks/index.cjs.map +2 -2
  93. package/build/components/inner-content/index.cjs.map +2 -2
  94. package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs +4 -23
  95. package/build/components/inserter/block-patterns-tab/use-pattern-categories.cjs.map +2 -2
  96. package/build/components/inserter/block-patterns-tab/utils.cjs +26 -0
  97. package/build/components/inserter/block-patterns-tab/utils.cjs.map +2 -2
  98. package/build/components/inserter/hooks/use-block-types-state.cjs.map +2 -2
  99. package/build/components/inserter/hooks/use-insertion-point.cjs.map +2 -2
  100. package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
  101. package/build/components/inserter/media-tab/media-panel.cjs.map +2 -2
  102. package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
  103. package/build/components/inserter-list-item/index.cjs.map +2 -2
  104. package/build/components/inspector-controls/list-view-content-popover.cjs.map +2 -2
  105. package/build/components/link-control/search-results.cjs.map +2 -2
  106. package/build/components/link-control/use-search-handler.cjs +3 -0
  107. package/build/components/link-control/use-search-handler.cjs.map +2 -2
  108. package/build/components/list-view/branch.cjs.map +2 -2
  109. package/build/components/list-view/drop-indicator.cjs.map +2 -2
  110. package/build/components/list-view/index.cjs.map +2 -2
  111. package/build/components/list-view/use-list-view-drop-zone.cjs.map +2 -2
  112. package/build/components/list-view/utils.cjs.map +2 -2
  113. package/build/components/media-replace-flow/index.cjs +4 -1
  114. package/build/components/media-replace-flow/index.cjs.map +2 -2
  115. package/build/components/plain-text/index.cjs +1 -2
  116. package/build/components/plain-text/index.cjs.map +3 -3
  117. package/build/components/preset-input-control/index.cjs.map +2 -2
  118. package/build/components/provider/index.cjs +3 -1
  119. package/build/components/provider/index.cjs.map +2 -2
  120. package/build/components/provider/use-block-sync.cjs.map +2 -2
  121. package/build/components/publish-date-time-picker/index.cjs.map +2 -2
  122. package/build/components/resizable-box-popover/index.cjs +1 -1
  123. package/build/components/resizable-box-popover/index.cjs.map +1 -1
  124. package/build/components/resolution-tool/index.cjs.map +3 -3
  125. package/build/components/rich-text/event-listeners/enter.cjs +8 -22
  126. package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
  127. package/build/components/rich-text/format-edit.cjs.map +2 -2
  128. package/build/components/rich-text/index.cjs +20 -0
  129. package/build/components/rich-text/index.cjs.map +2 -2
  130. package/build/components/rich-text/multiline.cjs +10 -2
  131. package/build/components/rich-text/multiline.cjs.map +2 -2
  132. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.cjs.map +2 -2
  133. package/build/components/typewriter/index.cjs.map +2 -2
  134. package/build/components/use-block-commands/index.cjs.map +2 -2
  135. package/build/components/writing-flow/index.cjs +3 -0
  136. package/build/components/writing-flow/index.cjs.map +2 -2
  137. package/build/components/writing-flow/use-clipboard-handler.cjs.map +2 -2
  138. package/build/components/writing-flow/use-selection-observer.cjs +5 -3
  139. package/build/components/writing-flow/use-selection-observer.cjs.map +2 -2
  140. package/build/hooks/align.cjs +3 -5
  141. package/build/hooks/align.cjs.map +2 -2
  142. package/build/hooks/background.cjs.map +2 -2
  143. package/build/hooks/block-bindings.cjs.map +2 -2
  144. package/build/hooks/border.cjs.map +2 -2
  145. package/build/hooks/contrast-checker.cjs.map +2 -2
  146. package/build/hooks/dimensions.cjs.map +2 -2
  147. package/build/hooks/duotone.cjs.map +2 -2
  148. package/build/hooks/elements.cjs.map +2 -2
  149. package/build/hooks/fit-text.cjs.map +2 -2
  150. package/build/hooks/gap.cjs +2 -1
  151. package/build/hooks/gap.cjs.map +3 -3
  152. package/build/hooks/index.cjs +4 -2
  153. package/build/hooks/index.cjs.map +3 -3
  154. package/build/hooks/layout-child.cjs.map +2 -2
  155. package/build/hooks/layout.cjs +15 -14
  156. package/build/hooks/layout.cjs.map +3 -3
  157. package/build/hooks/position.cjs +3 -31
  158. package/build/hooks/position.cjs.map +2 -2
  159. package/build/hooks/states.cjs +3 -2
  160. package/build/hooks/states.cjs.map +2 -2
  161. package/build/hooks/text-shadow.cjs +100 -0
  162. package/build/hooks/text-shadow.cjs.map +7 -0
  163. package/build/hooks/typography.cjs +30 -6
  164. package/build/hooks/typography.cjs.map +2 -2
  165. package/build/hooks/utils.cjs +24 -2
  166. package/build/hooks/utils.cjs.map +2 -2
  167. package/build/layouts/grid.cjs.map +2 -2
  168. package/build/layouts/utils.cjs +7 -2
  169. package/build/layouts/utils.cjs.map +2 -2
  170. package/build/private-apis.cjs +9 -6
  171. package/build/private-apis.cjs.map +2 -2
  172. package/build/store/actions.cjs +26 -4
  173. package/build/store/actions.cjs.map +3 -3
  174. package/build/store/private-selectors.cjs.map +2 -2
  175. package/build/store/reducer.cjs.map +2 -2
  176. package/build/store/selectors.cjs.map +2 -2
  177. package/build/utils/get-font-styles-and-weights.cjs.map +2 -2
  178. package/build/utils/transform-styles/index.cjs.map +1 -1
  179. package/build-module/autocompleters/block.mjs.map +2 -2
  180. package/build-module/components/alignment-control/ui.mjs.map +2 -2
  181. package/build-module/components/background-image-control/index.mjs +2 -2
  182. package/build-module/components/background-image-control/index.mjs.map +2 -2
  183. package/build-module/components/block-alignment-control/ui.mjs +21 -7
  184. package/build-module/components/block-alignment-control/ui.mjs.map +2 -2
  185. package/build-module/components/block-alignment-control/use-available-alignments.mjs +56 -13
  186. package/build-module/components/block-alignment-control/use-available-alignments.mjs.map +2 -2
  187. package/build-module/components/block-allowed-blocks/allowed-blocks-control.mjs.map +2 -2
  188. package/build-module/components/block-bindings/attribute-control.mjs +31 -32
  189. package/build-module/components/block-bindings/attribute-control.mjs.map +2 -2
  190. package/build-module/components/block-bindings/source-fields-list.mjs +25 -30
  191. package/build-module/components/block-bindings/source-fields-list.mjs.map +2 -2
  192. package/build-module/components/block-canvas/index.mjs.map +2 -2
  193. package/build-module/components/block-card/index.mjs +3 -8
  194. package/build-module/components/block-card/index.mjs.map +2 -2
  195. package/build-module/components/block-edit/edit.mjs.map +2 -2
  196. package/build-module/components/block-heading-level-dropdown/index.mjs.map +2 -2
  197. package/build-module/components/block-icon/index.mjs.map +2 -2
  198. package/build-module/components/block-inspector/edit-contents.mjs.map +2 -2
  199. package/build-module/components/block-inspector/index.mjs +29 -10
  200. package/build-module/components/block-inspector/index.mjs.map +2 -2
  201. package/build-module/components/block-keyboard-shortcuts/index.mjs.map +2 -2
  202. package/build-module/components/block-list/block-html.mjs +1 -2
  203. package/build-module/components/block-list/block-html.mjs.map +2 -2
  204. package/build-module/components/block-list/block.mjs +2 -4
  205. package/build-module/components/block-list/block.mjs.map +2 -2
  206. package/build-module/components/block-list/layout.mjs +1 -1
  207. package/build-module/components/block-list/layout.mjs.map +2 -2
  208. package/build-module/components/block-list/use-block-props/index.mjs.map +2 -2
  209. package/build-module/components/block-lock/modal.mjs +1 -3
  210. package/build-module/components/block-lock/modal.mjs.map +2 -2
  211. package/build-module/components/block-parent-selector/index.mjs +8 -5
  212. package/build-module/components/block-parent-selector/index.mjs.map +2 -2
  213. package/build-module/components/block-popover/index.mjs.map +2 -2
  214. package/build-module/components/block-rename/modal.mjs.map +2 -2
  215. package/build-module/components/block-settings-menu/block-settings-dropdown.mjs.map +2 -2
  216. package/build-module/components/block-styles/utils.mjs.map +2 -2
  217. package/build-module/components/block-switcher/index.mjs.map +2 -2
  218. package/build-module/components/block-toolbar/edit-section-button.mjs.map +2 -2
  219. package/build-module/components/block-toolbar/index.mjs +6 -4
  220. package/build-module/components/block-toolbar/index.mjs.map +2 -2
  221. package/build-module/components/block-toolbar/switch-section-style.mjs.map +2 -2
  222. package/build-module/components/block-variation-transforms/index.mjs +30 -21
  223. package/build-module/components/block-variation-transforms/index.mjs.map +2 -2
  224. package/build-module/components/block-visibility/modal.mjs.map +2 -2
  225. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
  226. package/build-module/components/border-radius-control/index.mjs.map +2 -2
  227. package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
  228. package/build-module/components/colors/with-colors.mjs.map +2 -2
  229. package/build-module/components/colors-gradients/control.mjs.map +2 -2
  230. package/build-module/components/contrast-checker/index.mjs.map +2 -2
  231. package/build-module/components/date-format-picker/index.mjs.map +2 -2
  232. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +2 -2
  233. package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
  234. package/build-module/components/dimensions-tool/width-height-tool.mjs.map +2 -2
  235. package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
  236. package/build-module/components/global-styles/background-panel.mjs +2 -2
  237. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  238. package/build-module/components/global-styles/border-panel.mjs +2 -2
  239. package/build-module/components/global-styles/border-panel.mjs.map +2 -2
  240. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs +2 -2
  241. package/build-module/components/global-styles/color-gradient-dropdown-item.mjs.map +2 -2
  242. package/build-module/components/global-styles/color-panel.mjs +2 -2
  243. package/build-module/components/global-styles/color-panel.mjs.map +2 -2
  244. package/build-module/components/global-styles/dimensions-panel.mjs +2 -2
  245. package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
  246. package/build-module/components/global-styles/filters-panel.mjs +2 -2
  247. package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
  248. package/build-module/components/global-styles/hooks.mjs +1 -0
  249. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  250. package/build-module/components/global-styles/inheritance/index.mjs +2 -2
  251. package/build-module/components/global-styles/inheritance/index.mjs.map +2 -2
  252. package/build-module/components/global-styles/inherited-value-context.mjs +0 -5
  253. package/build-module/components/global-styles/inherited-value-context.mjs.map +2 -2
  254. package/build-module/components/global-styles/state-control-badges.mjs +0 -1
  255. package/build-module/components/global-styles/state-control-badges.mjs.map +2 -2
  256. package/build-module/components/global-styles/state-control.mjs +6 -4
  257. package/build-module/components/global-styles/state-control.mjs.map +2 -2
  258. package/build-module/components/global-styles/text-shadow-panel.mjs +224 -0
  259. package/build-module/components/global-styles/text-shadow-panel.mjs.map +7 -0
  260. package/build-module/components/global-styles/typography-panel.mjs +47 -6
  261. package/build-module/components/global-styles/typography-panel.mjs.map +2 -2
  262. package/build-module/components/global-styles/typography-utils.mjs.map +2 -2
  263. package/build-module/components/global-styles/utils.mjs.map +2 -2
  264. package/build-module/components/html-element-control/index.mjs +2 -2
  265. package/build-module/components/html-element-control/index.mjs.map +2 -2
  266. package/build-module/components/iframe/index.mjs.map +2 -2
  267. package/build-module/components/iframe/use-scale-canvas.mjs.map +2 -2
  268. package/build-module/components/image-size-control/index.mjs +2 -2
  269. package/build-module/components/image-size-control/index.mjs.map +2 -2
  270. package/build-module/components/inner-blocks/index.mjs +6 -1
  271. package/build-module/components/inner-blocks/index.mjs.map +2 -2
  272. package/build-module/components/inner-content/index.mjs.map +2 -2
  273. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs +6 -24
  274. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.mjs.map +2 -2
  275. package/build-module/components/inserter/block-patterns-tab/utils.mjs +25 -0
  276. package/build-module/components/inserter/block-patterns-tab/utils.mjs.map +2 -2
  277. package/build-module/components/inserter/hooks/use-block-types-state.mjs.map +2 -2
  278. package/build-module/components/inserter/hooks/use-insertion-point.mjs.map +2 -2
  279. package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
  280. package/build-module/components/inserter/media-tab/media-panel.mjs.map +2 -2
  281. package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
  282. package/build-module/components/inserter-list-item/index.mjs.map +2 -2
  283. package/build-module/components/inspector-controls/list-view-content-popover.mjs.map +2 -2
  284. package/build-module/components/link-control/search-results.mjs.map +2 -2
  285. package/build-module/components/link-control/use-search-handler.mjs +3 -0
  286. package/build-module/components/link-control/use-search-handler.mjs.map +2 -2
  287. package/build-module/components/list-view/branch.mjs.map +2 -2
  288. package/build-module/components/list-view/drop-indicator.mjs.map +2 -2
  289. package/build-module/components/list-view/index.mjs.map +2 -2
  290. package/build-module/components/list-view/use-list-view-drop-zone.mjs.map +2 -2
  291. package/build-module/components/list-view/utils.mjs.map +2 -2
  292. package/build-module/components/media-replace-flow/index.mjs +4 -1
  293. package/build-module/components/media-replace-flow/index.mjs.map +2 -2
  294. package/build-module/components/plain-text/index.mjs +1 -2
  295. package/build-module/components/plain-text/index.mjs.map +2 -2
  296. package/build-module/components/preset-input-control/index.mjs.map +2 -2
  297. package/build-module/components/provider/index.mjs +3 -1
  298. package/build-module/components/provider/index.mjs.map +2 -2
  299. package/build-module/components/provider/use-block-sync.mjs.map +2 -2
  300. package/build-module/components/publish-date-time-picker/index.mjs.map +2 -2
  301. package/build-module/components/resizable-box-popover/index.mjs +1 -1
  302. package/build-module/components/resizable-box-popover/index.mjs.map +1 -1
  303. package/build-module/components/resolution-tool/index.mjs +2 -2
  304. package/build-module/components/resolution-tool/index.mjs.map +2 -2
  305. package/build-module/components/rich-text/event-listeners/enter.mjs +8 -22
  306. package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
  307. package/build-module/components/rich-text/format-edit.mjs.map +2 -2
  308. package/build-module/components/rich-text/index.mjs +21 -0
  309. package/build-module/components/rich-text/index.mjs.map +2 -2
  310. package/build-module/components/rich-text/multiline.mjs +11 -3
  311. package/build-module/components/rich-text/multiline.mjs.map +2 -2
  312. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.mjs.map +2 -2
  313. package/build-module/components/typewriter/index.mjs.map +2 -2
  314. package/build-module/components/use-block-commands/index.mjs.map +2 -2
  315. package/build-module/components/writing-flow/index.mjs +3 -0
  316. package/build-module/components/writing-flow/index.mjs.map +2 -2
  317. package/build-module/components/writing-flow/use-clipboard-handler.mjs.map +2 -2
  318. package/build-module/components/writing-flow/use-selection-observer.mjs +5 -3
  319. package/build-module/components/writing-flow/use-selection-observer.mjs.map +2 -2
  320. package/build-module/hooks/align.mjs +6 -6
  321. package/build-module/hooks/align.mjs.map +2 -2
  322. package/build-module/hooks/background.mjs.map +2 -2
  323. package/build-module/hooks/block-bindings.mjs.map +2 -2
  324. package/build-module/hooks/border.mjs.map +2 -2
  325. package/build-module/hooks/contrast-checker.mjs.map +2 -2
  326. package/build-module/hooks/dimensions.mjs.map +2 -2
  327. package/build-module/hooks/duotone.mjs.map +2 -2
  328. package/build-module/hooks/elements.mjs.map +2 -2
  329. package/build-module/hooks/fit-text.mjs.map +2 -2
  330. package/build-module/hooks/gap.mjs +2 -1
  331. package/build-module/hooks/gap.mjs.map +2 -2
  332. package/build-module/hooks/index.mjs +4 -2
  333. package/build-module/hooks/index.mjs.map +2 -2
  334. package/build-module/hooks/layout-child.mjs.map +2 -2
  335. package/build-module/hooks/layout.mjs +6 -5
  336. package/build-module/hooks/layout.mjs.map +2 -2
  337. package/build-module/hooks/position.mjs +5 -33
  338. package/build-module/hooks/position.mjs.map +2 -2
  339. package/build-module/hooks/states.mjs +3 -2
  340. package/build-module/hooks/states.mjs.map +2 -2
  341. package/build-module/hooks/text-shadow.mjs +65 -0
  342. package/build-module/hooks/text-shadow.mjs.map +7 -0
  343. package/build-module/hooks/typography.mjs +30 -6
  344. package/build-module/hooks/typography.mjs.map +2 -2
  345. package/build-module/hooks/utils.mjs +24 -2
  346. package/build-module/hooks/utils.mjs.map +2 -2
  347. package/build-module/layouts/grid.mjs.map +2 -2
  348. package/build-module/layouts/utils.mjs +5 -1
  349. package/build-module/layouts/utils.mjs.map +2 -2
  350. package/build-module/private-apis.mjs +6 -2
  351. package/build-module/private-apis.mjs.map +2 -2
  352. package/build-module/store/actions.mjs +28 -5
  353. package/build-module/store/actions.mjs.map +3 -3
  354. package/build-module/store/private-selectors.mjs.map +2 -2
  355. package/build-module/store/reducer.mjs.map +2 -2
  356. package/build-module/store/selectors.mjs.map +2 -2
  357. package/build-module/utils/get-font-styles-and-weights.mjs.map +2 -2
  358. package/build-module/utils/transform-styles/index.mjs.map +1 -1
  359. package/build-style/content-rtl.css +7 -2
  360. package/build-style/content.css +7 -2
  361. package/build-style/style-rtl.css +90 -25
  362. package/build-style/style.css +92 -25
  363. package/package.json +42 -43
  364. package/src/autocompleters/block.jsx +4 -4
  365. package/src/components/alignment-control/ui.jsx +1 -1
  366. package/src/components/background-image-control/index.jsx +3 -3
  367. package/src/components/block-alignment-control/test/index.jsdom.test.jsx +267 -0
  368. package/src/components/block-alignment-control/ui.jsx +47 -9
  369. package/src/components/block-alignment-control/use-available-alignments.js +106 -20
  370. package/src/components/block-allowed-blocks/allowed-blocks-control.jsx +1 -1
  371. package/src/components/block-bindings/attribute-control.jsx +27 -29
  372. package/src/components/block-bindings/source-fields-list.jsx +22 -32
  373. package/src/components/block-bindings/test/attribute-control.jsdom.test.jsx +115 -0
  374. package/src/components/block-canvas/index.jsx +1 -1
  375. package/src/components/block-card/index.jsx +5 -11
  376. package/src/components/block-card/style.scss +1 -0
  377. package/src/components/block-edit/edit.jsx +1 -1
  378. package/src/components/block-heading-level-dropdown/index.jsx +1 -1
  379. package/src/components/block-icon/index.jsx +1 -1
  380. package/src/components/block-icon/test/index.browser.test.jsx +74 -0
  381. package/src/components/block-inspector/edit-contents.jsx +2 -2
  382. package/src/components/block-inspector/index.jsx +46 -15
  383. package/src/components/block-inspector/style.scss +16 -0
  384. package/src/components/block-keyboard-shortcuts/index.jsx +2 -2
  385. package/src/components/block-list/block-html.jsx +2 -3
  386. package/src/components/block-list/block.jsx +7 -5
  387. package/src/components/block-list/content.scss +3 -2
  388. package/src/components/block-list/layout.jsx +4 -1
  389. package/src/components/block-list/test/layout.jsdom.test.js +40 -0
  390. package/src/components/block-list/use-block-props/index.js +1 -1
  391. package/src/components/block-lock/modal.jsx +2 -3
  392. package/src/components/block-lock/style.scss +1 -1
  393. package/src/components/block-mover/style.scss +0 -13
  394. package/src/components/block-parent-selector/index.jsx +12 -6
  395. package/src/components/block-patterns-list/style.scss +1 -1
  396. package/src/components/block-popover/index.jsx +1 -1
  397. package/src/components/block-rename/modal.jsx +3 -3
  398. package/src/components/block-settings-menu/block-settings-dropdown.jsx +1 -1
  399. package/src/components/block-styles/utils.js +1 -1
  400. package/src/components/block-switcher/index.jsx +3 -3
  401. package/src/components/block-toolbar/edit-section-button.jsx +2 -2
  402. package/src/components/block-toolbar/index.jsx +8 -4
  403. package/src/components/block-toolbar/switch-section-style.jsx +1 -1
  404. package/src/components/block-variation-transforms/index.jsx +24 -23
  405. package/src/components/block-variation-transforms/test/index.jsdom.test.jsx +93 -0
  406. package/src/components/block-visibility/modal.jsx +7 -7
  407. package/src/components/block-visibility/style.scss +1 -1
  408. package/src/components/block-visibility/viewport-visibility-info.jsx +5 -7
  409. package/src/components/border-radius-control/index.jsx +2 -2
  410. package/src/components/border-radius-control/test/index.jsdom.test.jsx +0 -22
  411. package/src/components/border-radius-control/test/select.browser.test.js +30 -0
  412. package/src/components/color-palette/with-color-context.jsx +1 -1
  413. package/src/components/colors/with-colors.jsx +1 -1
  414. package/src/components/colors-gradients/control.jsx +2 -2
  415. package/src/components/colors-gradients/test/{control.jsdom.test.jsx → control.browser.test.jsx} +6 -9
  416. package/src/components/contrast-checker/index.jsx +2 -2
  417. package/src/components/date-format-picker/index.jsx +2 -2
  418. package/src/components/dimensions-tool/aspect-ratio-tool.jsx +4 -4
  419. package/src/components/dimensions-tool/test/index.jsdom.test.jsx +17 -11
  420. package/src/components/dimensions-tool/width-height-tool.jsx +2 -2
  421. package/src/components/font-sizes/with-font-sizes.jsx +2 -3
  422. package/src/components/global-styles/background-panel.jsx +2 -2
  423. package/src/components/global-styles/border-panel.jsx +2 -2
  424. package/src/components/global-styles/color-gradient-dropdown-item.jsx +3 -3
  425. package/src/components/global-styles/color-panel.jsx +3 -3
  426. package/src/components/global-styles/dimensions-panel.jsx +6 -6
  427. package/src/components/global-styles/filters-panel.jsx +2 -2
  428. package/src/components/global-styles/hooks.js +1 -0
  429. package/src/components/global-styles/inheritance/index.jsx +9 -6
  430. package/src/components/global-styles/inheritance/test/{index.jsdom.test.jsx → index.browser.test.jsx} +34 -28
  431. package/src/components/global-styles/inherited-value-context.js +1 -9
  432. package/src/components/global-styles/state-control-badges.jsx +0 -1
  433. package/src/components/global-styles/state-control.jsx +12 -3
  434. package/src/components/global-styles/style.scss +68 -0
  435. package/src/components/global-styles/test/{color-panel.jsdom.test.jsx → color-panel.browser.test.jsx} +53 -54
  436. package/src/components/global-styles/test/inherited-value-context-core.jsdom.test.js +17 -26
  437. package/src/components/global-styles/test/{typography-panel-core.jsdom.test.jsx → typography-panel-core.browser.test.jsx} +84 -39
  438. package/src/components/global-styles/test/{typography-panel.jsdom.test.jsx → typography-panel.browser.test.jsx} +80 -122
  439. package/src/components/global-styles/text-shadow-panel.tsx +257 -0
  440. package/src/components/global-styles/typography-panel.jsx +52 -13
  441. package/src/components/global-styles/typography-utils.js +2 -2
  442. package/src/components/global-styles/utils.js +1 -1
  443. package/src/components/html-element-control/index.jsx +2 -2
  444. package/src/components/iframe/index.jsx +1 -1
  445. package/src/components/iframe/use-scale-canvas.js +1 -1
  446. package/src/components/image-size-control/index.jsx +2 -2
  447. package/src/components/inner-blocks/index.jsx +9 -1
  448. package/src/components/inner-content/index.jsx +1 -1
  449. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +7 -33
  450. package/src/components/inserter/block-patterns-tab/utils.js +44 -0
  451. package/src/components/inserter/hooks/use-block-types-state.js +2 -2
  452. package/src/components/inserter/hooks/use-insertion-point.js +1 -1
  453. package/src/components/inserter/hooks/use-patterns-state.js +1 -1
  454. package/src/components/inserter/media-tab/media-panel.jsx +9 -9
  455. package/src/components/inserter/media-tab/media-preview.jsx +1 -1
  456. package/src/components/inserter-list-item/index.jsx +1 -1
  457. package/src/components/inserter-list-item/style.scss +2 -2
  458. package/src/components/inspector-controls/list-view-content-popover.jsx +1 -1
  459. package/src/components/link-control/search-results.jsx +1 -1
  460. package/src/components/link-control/style.scss +1 -1
  461. package/src/components/link-control/test/index.jsdom.test.jsx +38 -110
  462. package/src/components/link-control/test/keyboard-selection.browser.test.js +110 -0
  463. package/src/components/link-control/use-search-handler.js +8 -3
  464. package/src/components/list-view/branch.jsx +1 -1
  465. package/src/components/list-view/drop-indicator.jsx +3 -3
  466. package/src/components/list-view/index.jsx +1 -1
  467. package/src/components/list-view/style.scss +1 -9
  468. package/src/components/list-view/use-list-view-drop-zone.js +1 -1
  469. package/src/components/list-view/utils.js +1 -1
  470. package/src/components/media-replace-flow/index.jsx +4 -1
  471. package/src/components/navigable-toolbar/test/index.browser.test.js +6 -7
  472. package/src/components/plain-text/README.md +3 -2
  473. package/src/components/plain-text/content.scss +0 -1
  474. package/src/components/plain-text/index.jsx +2 -3
  475. package/src/components/plain-text/style.scss +4 -0
  476. package/src/components/preset-input-control/index.jsx +2 -2
  477. package/src/components/preset-input-control/test/index.jsdom.test.jsx +0 -56
  478. package/src/components/preset-input-control/test/interaction.browser.test.js +63 -0
  479. package/src/components/provider/index.jsx +5 -3
  480. package/src/components/provider/use-block-sync.js +5 -5
  481. package/src/components/publish-date-time-picker/index.jsx +1 -1
  482. package/src/components/resizable-box-popover/index.jsx +1 -1
  483. package/src/components/resolution-tool/index.jsx +2 -2
  484. package/src/components/responsive-block-control/style.scss +1 -2
  485. package/src/components/responsive-block-control/test/index.jsdom.test.jsx +2 -2
  486. package/src/components/rich-text/event-listeners/enter.js +16 -23
  487. package/src/components/rich-text/format-edit.jsx +1 -1
  488. package/src/components/rich-text/index.jsx +39 -2
  489. package/src/components/rich-text/multiline.jsx +11 -3
  490. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
  491. package/src/components/spacing-sizes-control/test/index.jsdom.test.jsx +0 -21
  492. package/src/components/spacing-sizes-control/test/select.browser.test.js +58 -0
  493. package/src/components/typewriter/index.jsx +1 -1
  494. package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +1 -1
  495. package/src/components/use-block-commands/index.js +1 -1
  496. package/src/components/use-block-drop-zone/test/index.js +2 -2
  497. package/src/components/writing-flow/index.jsx +8 -0
  498. package/src/components/writing-flow/use-clipboard-handler.js +1 -1
  499. package/src/components/writing-flow/use-selection-observer.js +15 -6
  500. package/src/content.scss +1 -0
  501. package/src/hooks/align.jsx +22 -6
  502. package/src/hooks/background.jsx +1 -1
  503. package/src/hooks/block-bindings.jsx +1 -1
  504. package/src/hooks/block-hooks.scss +0 -6
  505. package/src/hooks/border.jsx +2 -2
  506. package/src/hooks/contrast-checker.js +1 -1
  507. package/src/hooks/dimensions.jsx +2 -2
  508. package/src/hooks/duotone.jsx +3 -3
  509. package/src/hooks/elements.jsx +3 -3
  510. package/src/hooks/fit-text.jsx +1 -1
  511. package/src/hooks/gap.js +2 -4
  512. package/src/hooks/index.js +3 -1
  513. package/src/hooks/layout-child.jsx +3 -4
  514. package/src/hooks/layout.jsx +17 -18
  515. package/src/hooks/position.jsx +5 -36
  516. package/src/hooks/states.jsx +6 -2
  517. package/src/hooks/test/layout.jsdom.test.js +44 -1
  518. package/src/hooks/text-shadow.ts +105 -0
  519. package/src/hooks/typography.jsx +58 -30
  520. package/src/hooks/utils.jsx +23 -1
  521. package/src/layouts/grid.jsx +2 -2
  522. package/src/layouts/test/flex.jsdom.test.jsx +4 -3
  523. package/src/layouts/test/utils.js +48 -1
  524. package/src/layouts/utils.js +19 -0
  525. package/src/private-apis.js +4 -0
  526. package/src/store/actions.js +50 -10
  527. package/src/store/private-selectors.js +5 -5
  528. package/src/store/reducer.js +6 -6
  529. package/src/store/selectors.js +3 -3
  530. package/src/store/test/actions.jsdom.test.js +60 -0
  531. package/src/style.scss +1 -0
  532. package/src/utils/get-font-styles-and-weights.ts +1 -1
  533. package/src/utils/transform-styles/index.ts +1 -1
  534. package/build/hooks/cross-origin-isolation.cjs +0 -56
  535. package/build/hooks/cross-origin-isolation.cjs.map +0 -7
  536. package/build-module/hooks/cross-origin-isolation.mjs +0 -54
  537. package/build-module/hooks/cross-origin-isolation.mjs.map +0 -7
  538. package/src/components/block-icon/test/__snapshots__/index.jsdom.test.jsx.snap +0 -27
  539. package/src/components/block-icon/test/index.jsdom.test.jsx +0 -67
  540. package/src/hooks/cross-origin-isolation.js +0 -73
  541. package/src/hooks/test/cross-origin-isolation.jsdom.test.js +0 -173
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/colors-gradients/control.jsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tColorPalette,\n\tGradientPicker,\n\tNotice,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSettings } from '../use-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_IDS = { color: 'color', gradient: 'gradient' };\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tcolorSlug,\n\tgradientValue,\n\tgradientSlug,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n\theadingLevel,\n\tnoticeProps,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange &&\n\t\t( ( colors && colors.length > 0 ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ( gradients && gradients.length > 0 ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst colorPaletteOnChange = canChooseAGradient\n\t\t? ( newColor, _index, newSlug ) => {\n\t\t\t\tonColorChange( newColor, newSlug );\n\t\t\t\tonGradientChange();\n\t\t }\n\t\t: ( newColor, _index, newSlug ) => onColorChange( newColor, newSlug );\n\n\tconst colorPalette = (\n\t\t<ColorPalette\n\t\t\tvalue={ colorValue }\n\t\t\tselectedSlug={ colorSlug }\n\t\t\tonChange={ colorPaletteOnChange }\n\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t}\n\t\t\tclearable={ clearable }\n\t\t\tenableAlpha={ enableAlpha }\n\t\t\theadingLevel={ headingLevel }\n\t\t/>\n\t);\n\n\tconst tabPanels = {\n\t\t// The `ColorPalette` must stay at a stable position in the tree whether\n\t\t// or not a notice is present. Wrapping it in a `VStack` only when a\n\t\t// notice appears remounts it, which resets the custom color picker back\n\t\t// to the swatch view mid-edit. Keep `ColorPalette` first and toggle only\n\t\t// the trailing notice after it, so the palette holds a stable index and\n\t\t// the notice sits at the bottom of the popover.\n\t\t[ TAB_IDS.color ]: (\n\t\t\t<>\n\t\t\t\t{ colorPalette }\n\t\t\t\t{ noticeProps && (\n\t\t\t\t\t<Notice isDismissible={ false } { ...noticeProps } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\t[ TAB_IDS.gradient ]: (\n\t\t\t<GradientPicker\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tselectedSlug={ gradientSlug }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient, _index, newSlug ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient, newSlug );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: ( newGradient, _index, newSlug ) =>\n\t\t\t\t\t\t\t\tonGradientChange( newGradient, newSlug )\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<Tabs\n\t\t\t\t\t\t\t\tdefaultTabId={\n\t\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t\t? TAB_IDS.gradient\n\t\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_IDS.color\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.color }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Color' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.gradient }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Gradient' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.color }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__panel\"\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.color }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.gradient }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__panel\"\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.gradient }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! canChooseAGradient && renderPanelType( TAB_IDS.color ) }\n\t\t\t\t\t{ ! canChooseAColor && renderPanelType( TAB_IDS.gradient ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst [ colors, gradients, customColors, customGradients ] = useSettings(\n\t\t'color.palette',\n\t\t'color.gradients',\n\t\t'color.custom',\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\tcolors={ colors }\n\t\t\tgradients={ gradients }\n\t\t\tdisableCustomColors={ ! customColors }\n\t\t\tdisableCustomGradients={ ! customGradients }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAmB;AACnB,wBAOO;AACP,0BAA4B;AAC5B,yBAAuB;AAmDrB;AAjDF,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAC/C,IAAM,wBAAwB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAM,UAAU,EAAE,OAAO,SAAS,UAAU,WAAW;AAEvD,SAAS,0BAA2B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,E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OAAQ;AACtC,MACC,sBAAsB,MAAO,CAAE,QAAS,MAAM,eAAgB,GAAI,CAAE,GACnE;AACD,WAAO,4CAAC,6BAA4B,GAAG,OAAQ;AAAA,EAChD;AACA,SAAO,4CAAC,8BAA6B,GAAG,OAAQ;AACjD;AAEA,IAAO,kBAAQ;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBaseControl,\n\t__experimentalVStack as VStack,\n\tColorPalette,\n\tGradientPicker,\n\tNotice,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSettings } from '../use-settings';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst TAB_IDS = { color: 'color', gradient: 'gradient' };\n\nfunction ColorGradientControlInner( {\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\t__experimentalIsRenderedInSidebar,\n\tclassName,\n\tlabel,\n\tonColorChange,\n\tonGradientChange,\n\tcolorValue,\n\tcolorSlug,\n\tgradientValue,\n\tgradientSlug,\n\tclearable,\n\tshowTitle = true,\n\tenableAlpha,\n\theadingLevel,\n\tnoticeProps,\n} ) {\n\tconst canChooseAColor =\n\t\tonColorChange &&\n\t\t( ( colors && colors.length > 0 ) || ! disableCustomColors );\n\tconst canChooseAGradient =\n\t\tonGradientChange &&\n\t\t( ( gradients && gradients.length > 0 ) || ! disableCustomGradients );\n\n\tif ( ! canChooseAColor && ! canChooseAGradient ) {\n\t\treturn null;\n\t}\n\n\tconst colorPaletteOnChange = canChooseAGradient\n\t\t? ( newColor, _index, newSlug ) => {\n\t\t\t\tonColorChange( newColor, newSlug );\n\t\t\t\tonGradientChange();\n\t\t\t}\n\t\t: ( newColor, _index, newSlug ) => onColorChange( newColor, newSlug );\n\n\tconst colorPalette = (\n\t\t<ColorPalette\n\t\t\tvalue={ colorValue }\n\t\t\tselectedSlug={ colorSlug }\n\t\t\tonChange={ colorPaletteOnChange }\n\t\t\t{ ...{ colors, disableCustomColors } }\n\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t}\n\t\t\tclearable={ clearable }\n\t\t\tenableAlpha={ enableAlpha }\n\t\t\theadingLevel={ headingLevel }\n\t\t/>\n\t);\n\n\tconst tabPanels = {\n\t\t// The `ColorPalette` must stay at a stable position in the tree whether\n\t\t// or not a notice is present. Wrapping it in a `VStack` only when a\n\t\t// notice appears remounts it, which resets the custom color picker back\n\t\t// to the swatch view mid-edit. Keep `ColorPalette` first and toggle only\n\t\t// the trailing notice after it, so the palette holds a stable index and\n\t\t// the notice sits at the bottom of the popover.\n\t\t[ TAB_IDS.color ]: (\n\t\t\t<>\n\t\t\t\t{ colorPalette }\n\t\t\t\t{ noticeProps && (\n\t\t\t\t\t<Notice isDismissible={ false } { ...noticeProps } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t),\n\t\t[ TAB_IDS.gradient ]: (\n\t\t\t<GradientPicker\n\t\t\t\tvalue={ gradientValue }\n\t\t\t\tselectedSlug={ gradientSlug }\n\t\t\t\tonChange={\n\t\t\t\t\tcanChooseAColor\n\t\t\t\t\t\t? ( newGradient, _index, newSlug ) => {\n\t\t\t\t\t\t\t\tonGradientChange( newGradient, newSlug );\n\t\t\t\t\t\t\t\tonColorChange();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: ( newGradient, _index, newSlug ) =>\n\t\t\t\t\t\t\t\tonGradientChange( newGradient, newSlug )\n\t\t\t\t}\n\t\t\t\t{ ...{ gradients, disableCustomGradients } }\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tclearable={ clearable }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t),\n\t};\n\n\tconst renderPanelType = ( type ) => (\n\t\t<div className=\"block-editor-color-gradient-control__panel\">\n\t\t\t{ tabPanels[ type ] }\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-color-gradient-control',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<fieldset className=\"block-editor-color-gradient-control__fieldset\">\n\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t{ showTitle && (\n\t\t\t\t\t\t<legend>\n\t\t\t\t\t\t\t<div className=\"block-editor-color-gradient-control__color-indicator\">\n\t\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</legend>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canChooseAColor && canChooseAGradient && (\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<Tabs\n\t\t\t\t\t\t\t\tdefaultTabId={\n\t\t\t\t\t\t\t\t\tgradientValue\n\t\t\t\t\t\t\t\t\t\t? TAB_IDS.gradient\n\t\t\t\t\t\t\t\t\t\t: !! canChooseAColor && TAB_IDS.color\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.color }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Color' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t<Tabs.Tab tabId={ TAB_IDS.gradient }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Gradient' ) }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.color }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__panel\"\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.color }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\ttabId={ TAB_IDS.gradient }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-color-gradient-control__panel\"\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ tabPanels.gradient }\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! canChooseAGradient && renderPanelType( TAB_IDS.color ) }\n\t\t\t\t\t{ ! canChooseAColor && renderPanelType( TAB_IDS.gradient ) }\n\t\t\t\t</VStack>\n\t\t\t</fieldset>\n\t\t</BaseControl>\n\t);\n}\n\nfunction ColorGradientControlSelect( props ) {\n\tconst [ colors, gradients, customColors, customGradients ] = useSettings(\n\t\t'color.palette',\n\t\t'color.gradients',\n\t\t'color.custom',\n\t\t'color.customGradient'\n\t);\n\n\treturn (\n\t\t<ColorGradientControlInner\n\t\t\tcolors={ colors }\n\t\t\tgradients={ gradients }\n\t\t\tdisableCustomColors={ ! customColors }\n\t\t\tdisableCustomGradients={ ! customGradients }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ColorGradientControl( props ) {\n\tif (\n\t\tcolorsAndGradientKeys.every( ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <ColorGradientControlInner { ...props } />;\n\t}\n\treturn <ColorGradientControlSelect { ...props } />;\n}\n\nexport default ColorGradientControl;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AAA;AAAA;AAAA,QACD,GACD;AAAA,QAGC,CAAE,sBAAsB,gBAAiB,QAAQ,KAAM;AAAA,QACvD,CAAE,mBAAmB,gBAAiB,QAAQ,QAAS;AAAA,SAC1D,GACD;AAAA;AAAA,EACD;AAEF;AAEA,SAAS,2BAA4B,OAAQ;AAC5C,QAAM,CAAE,QAAQ,WAAW,cAAc,eAAgB,QAAI;AAAA,IAC5D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,qBAAsB,CAAE;AAAA,MACxB,wBAAyB,CAAE;AAAA,MACzB,GAAG;AAAA;AAAA,EACN;AAEF;AAEA,SAAS,qBAAsB,OAAQ;AACtC,MACC,sBAAsB,MAAO,CAAE,QAAS,MAAM,eAAgB,GAAI,CAAE,GACnE;AACD,WAAO,4CAAC,6BAA4B,GAAG,OAAQ;AAAA,EAChD;AACA,SAAO,4CAAC,8BAA6B,GAAG,OAAQ;AACjD;AAEA,IAAO,kBAAQ;",
6
6
  "names": ["componentsPrivateApis", "clsx", "VStack"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/contrast-checker/index.jsx"],
4
- "sourcesContent": ["import a11yPlugin from 'colord/plugins/a11y';\nimport namesPlugin from 'colord/plugins/names';\nimport { colord, extend } from 'colord';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Notice } from '@wordpress/components';\nimport { speak } from '@wordpress/a11y';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Computes a contrast warning for the given color combination, if any.\n *\n * Shared between the `ContrastChecker` component and the block inspector\n * contrast warning indicators, which surface the result without rendering\n * a notice.\n *\n * @param {Object} props\n * @param {string} [props.backgroundColor] Background color.\n * @param {string} [props.fallbackBackgroundColor] Fallback background color.\n * @param {string} [props.fallbackTextColor] Fallback text color.\n * @param {string} [props.fallbackLinkColor] Fallback link color.\n * @param {number} [props.fontSize] Font size value in pixels.\n * @param {boolean} [props.isLargeText] Whether the text is large.\n * @param {string} [props.textColor] Text color.\n * @param {string} [props.linkColor] Link color.\n * @param {string} [props.messageOverride] Caller-provided copy used in place of the generic guidance.\n * @param {boolean} [props.enableAlphaChecker] Whether to warn about transparent text.\n *\n * @return {?Object} `{ message, speakMessage }` when contrast is insufficient, otherwise `null`.\n */\nexport function getContrastWarning( {\n\tbackgroundColor,\n\tfallbackBackgroundColor,\n\tfallbackTextColor,\n\tfallbackLinkColor,\n\tfontSize, // Font size value in pixels.\n\tisLargeText,\n\ttextColor,\n\tlinkColor,\n\tmessageOverride,\n\tenableAlphaChecker = false,\n} ) {\n\tconst currentBackgroundColor = backgroundColor || fallbackBackgroundColor;\n\n\t// Must have a background color.\n\tif ( ! currentBackgroundColor ) {\n\t\treturn null;\n\t}\n\n\tconst currentTextColor = textColor || fallbackTextColor;\n\tconst currentLinkColor = linkColor || fallbackLinkColor;\n\n\t// Must have at least one text color.\n\tif ( ! currentTextColor && ! currentLinkColor ) {\n\t\treturn null;\n\t}\n\n\tconst textColors = [\n\t\t{\n\t\t\tcolor: currentTextColor,\n\t\t\tdescription: __( 'text color' ),\n\t\t},\n\t\t{\n\t\t\tcolor: currentLinkColor,\n\t\t\tdescription: __( 'link color' ),\n\t\t},\n\t];\n\tconst colordBackgroundColor = colord( currentBackgroundColor );\n\tconst backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1;\n\tconst backgroundColorBrightness = colordBackgroundColor.brightness();\n\tconst isReadableOptions = {\n\t\tlevel: 'AA',\n\t\tsize:\n\t\t\tisLargeText || ( isLargeText !== false && fontSize >= 24 )\n\t\t\t\t? 'large'\n\t\t\t\t: 'small',\n\t};\n\n\tlet message = '';\n\tlet speakMessage = '';\n\tfor ( const item of textColors ) {\n\t\t// If there is no color, go no further.\n\t\tif ( ! item.color ) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst colordTextColor = colord( item.color );\n\t\tconst isColordTextReadable = colordTextColor.isReadable(\n\t\t\tcolordBackgroundColor,\n\t\t\tisReadableOptions\n\t\t);\n\t\tconst textHasTransparency = colordTextColor.alpha() < 1;\n\n\t\t// If the contrast is not readable.\n\t\tif ( ! isColordTextReadable ) {\n\t\t\t// Don't show the message if the background or text is transparent.\n\t\t\tif ( backgroundColorHasTransparency || textHasTransparency ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// A caller can provide panel-specific copy that is clearer and\n\t\t\t// more concise than the generic brighter/darker guidance.\n\t\t\tif ( messageOverride ) {\n\t\t\t\tmessage = messageOverride;\n\t\t\t\tspeakMessage = messageOverride;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tmessage =\n\t\t\t\tbackgroundColorBrightness < colordTextColor.brightness()\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s is a type of text color, e.g., \"text color\" or \"link color\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\titem.description\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s is a type of text color, e.g., \"text color\" or \"link color\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\titem.description\n\t\t\t\t\t );\n\t\t\tspeakMessage = __(\n\t\t\t\t'This color combination may be hard for people to read.'\n\t\t\t);\n\t\t\t// Break from the loop when we have a contrast warning.\n\t\t\t// These messages take priority over the transparency warning.\n\t\t\tbreak;\n\t\t}\n\n\t\t// If there is no contrast warning and the text is transparent,\n\t\t// show the transparent warning if alpha check is enabled.\n\t\tif ( textHasTransparency && enableAlphaChecker ) {\n\t\t\tmessage = __( 'Transparent text may be hard for people to read.' );\n\t\t\tspeakMessage = __(\n\t\t\t\t'Transparent text may be hard for people to read.'\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( ! message ) {\n\t\treturn null;\n\t}\n\n\treturn { message, speakMessage };\n}\n\nfunction ContrastChecker( props ) {\n\tconst warning = getContrastWarning( props );\n\n\tif ( ! warning ) {\n\t\treturn null;\n\t}\n\n\t// Note: The `Notice` component can speak messages via its `spokenMessage`\n\t// prop, but the contrast checker requires granular control over when the\n\t// announcements are made. Notably, the message will be re-announced if a\n\t// new color combination is selected and the contrast is still insufficient.\n\tspeak( warning.speakMessage );\n\n\treturn (\n\t\t<div className=\"block-editor-contrast-checker\">\n\t\t\t<Notice\n\t\t\t\tspokenMessage={ null }\n\t\t\t\tstatus=\"warning\"\n\t\t\t\tisDismissible={ false }\n\t\t\t>\n\t\t\t\t{ warning.message }\n\t\t\t</Notice>\n\t\t</div>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/contrast-checker/README.md\n */\nexport default ContrastChecker;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB,mBAAwB;AACxB,oBAA+B;AAC/B,kBAA4B;AAC5B,wBAAuB;AACvB,IAAAA,eAAsB;AA4JnB;AAAA,IA1JH,sBAAQ,CAAE,aAAAC,SAAa,YAAAC,OAAW,CAAE;AAuB7B,SAAS,mBAAoB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AACtB,GAAI;AACH,QAAM,yBAAyB,mBAAmB;AAGlD,MAAK,CAAE,wBAAyB;AAC/B,WAAO;AAAA,EACR;AAEA,QAAM,mBAAmB,aAAa;AACtC,QAAM,mBAAmB,aAAa;AAGtC,MAAK,CAAE,oBAAoB,CAAE,kBAAmB;AAC/C,WAAO;AAAA,EACR;AAEA,QAAM,aAAa;A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AAU,mBAAoB,KAAM;AAE1C,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAMA,0BAAO,QAAQ,YAAa;AAE5B,SACC,4CAAC,SAAI,WAAU,iCACd;AAAA,IAAC;AAAA;AAAA,MACA,eAAgB;AAAA,MAChB,QAAO;AAAA,MACP,eAAgB;AAAA,MAEd,kBAAQ;AAAA;AAAA,EACX,GACD;AAEF;AAKA,IAAO,2BAAQ;",
4
+ "sourcesContent": ["import a11yPlugin from 'colord/plugins/a11y';\nimport namesPlugin from 'colord/plugins/names';\nimport { colord, extend } from 'colord';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Notice } from '@wordpress/components';\nimport { speak } from '@wordpress/a11y';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Computes a contrast warning for the given color combination, if any.\n *\n * Shared between the `ContrastChecker` component and the block inspector\n * contrast warning indicators, which surface the result without rendering\n * a notice.\n *\n * @param {Object} props\n * @param {string} [props.backgroundColor] Background color.\n * @param {string} [props.fallbackBackgroundColor] Fallback background color.\n * @param {string} [props.fallbackTextColor] Fallback text color.\n * @param {string} [props.fallbackLinkColor] Fallback link color.\n * @param {number} [props.fontSize] Font size value in pixels.\n * @param {boolean} [props.isLargeText] Whether the text is large.\n * @param {string} [props.textColor] Text color.\n * @param {string} [props.linkColor] Link color.\n * @param {string} [props.messageOverride] Caller-provided copy used in place of the generic guidance.\n * @param {boolean} [props.enableAlphaChecker] Whether to warn about transparent text.\n *\n * @return {?Object} `{ message, speakMessage }` when contrast is insufficient, otherwise `null`.\n */\nexport function getContrastWarning( {\n\tbackgroundColor,\n\tfallbackBackgroundColor,\n\tfallbackTextColor,\n\tfallbackLinkColor,\n\tfontSize, // Font size value in pixels.\n\tisLargeText,\n\ttextColor,\n\tlinkColor,\n\tmessageOverride,\n\tenableAlphaChecker = false,\n} ) {\n\tconst currentBackgroundColor = backgroundColor || fallbackBackgroundColor;\n\n\t// Must have a background color.\n\tif ( ! currentBackgroundColor ) {\n\t\treturn null;\n\t}\n\n\tconst currentTextColor = textColor || fallbackTextColor;\n\tconst currentLinkColor = linkColor || fallbackLinkColor;\n\n\t// Must have at least one text color.\n\tif ( ! currentTextColor && ! currentLinkColor ) {\n\t\treturn null;\n\t}\n\n\tconst textColors = [\n\t\t{\n\t\t\tcolor: currentTextColor,\n\t\t\tdescription: __( 'text color' ),\n\t\t},\n\t\t{\n\t\t\tcolor: currentLinkColor,\n\t\t\tdescription: __( 'link color' ),\n\t\t},\n\t];\n\tconst colordBackgroundColor = colord( currentBackgroundColor );\n\tconst backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1;\n\tconst backgroundColorBrightness = colordBackgroundColor.brightness();\n\tconst isReadableOptions = {\n\t\tlevel: 'AA',\n\t\tsize:\n\t\t\tisLargeText || ( isLargeText !== false && fontSize >= 24 )\n\t\t\t\t? 'large'\n\t\t\t\t: 'small',\n\t};\n\n\tlet message = '';\n\tlet speakMessage = '';\n\tfor ( const item of textColors ) {\n\t\t// If there is no color, go no further.\n\t\tif ( ! item.color ) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst colordTextColor = colord( item.color );\n\t\tconst isColordTextReadable = colordTextColor.isReadable(\n\t\t\tcolordBackgroundColor,\n\t\t\tisReadableOptions\n\t\t);\n\t\tconst textHasTransparency = colordTextColor.alpha() < 1;\n\n\t\t// If the contrast is not readable.\n\t\tif ( ! isColordTextReadable ) {\n\t\t\t// Don't show the message if the background or text is transparent.\n\t\t\tif ( backgroundColorHasTransparency || textHasTransparency ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// A caller can provide panel-specific copy that is clearer and\n\t\t\t// more concise than the generic brighter/darker guidance.\n\t\t\tif ( messageOverride ) {\n\t\t\t\tmessage = messageOverride;\n\t\t\t\tspeakMessage = messageOverride;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tmessage =\n\t\t\t\tbackgroundColorBrightness < colordTextColor.brightness()\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s is a type of text color, e.g., \"text color\" or \"link color\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\titem.description\n\t\t\t\t\t\t)\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// translators: %s is a type of text color, e.g., \"text color\" or \"link color\".\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\titem.description\n\t\t\t\t\t\t);\n\t\t\tspeakMessage = __(\n\t\t\t\t'This color combination may be hard for people to read.'\n\t\t\t);\n\t\t\t// Break from the loop when we have a contrast warning.\n\t\t\t// These messages take priority over the transparency warning.\n\t\t\tbreak;\n\t\t}\n\n\t\t// If there is no contrast warning and the text is transparent,\n\t\t// show the transparent warning if alpha check is enabled.\n\t\tif ( textHasTransparency && enableAlphaChecker ) {\n\t\t\tmessage = __( 'Transparent text may be hard for people to read.' );\n\t\t\tspeakMessage = __(\n\t\t\t\t'Transparent text may be hard for people to read.'\n\t\t\t);\n\t\t}\n\t}\n\n\tif ( ! message ) {\n\t\treturn null;\n\t}\n\n\treturn { message, speakMessage };\n}\n\nfunction ContrastChecker( props ) {\n\tconst warning = getContrastWarning( props );\n\n\tif ( ! warning ) {\n\t\treturn null;\n\t}\n\n\t// Note: The `Notice` component can speak messages via its `spokenMessage`\n\t// prop, but the contrast checker requires granular control over when the\n\t// announcements are made. Notably, the message will be re-announced if a\n\t// new color combination is selected and the contrast is still insufficient.\n\tspeak( warning.speakMessage );\n\n\treturn (\n\t\t<div className=\"block-editor-contrast-checker\">\n\t\t\t<Notice\n\t\t\t\tspokenMessage={ null }\n\t\t\t\tstatus=\"warning\"\n\t\t\t\tisDismissible={ false }\n\t\t\t>\n\t\t\t\t{ warning.message }\n\t\t\t</Notice>\n\t\t</div>\n\t);\n}\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/contrast-checker/README.md\n */\nexport default ContrastChecker;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB,mBAAwB;AACxB,oBAA+B;AAC/B,kBAA4B;AAC5B,wBAAuB;AACvB,IAAAA,eAAsB;AA4JnB;AAAA,IA1JH,sBAAQ,CAAE,aAAAC,SAAa,YAAAC,OAAW,CAAE;AAuB7B,SAAS,mBAAoB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AACtB,GAAI;AACH,QAAM,yBAAyB,mBAAmB;AAGlD,MAAK,CAAE,wBAAyB;AAC/B,WAAO;AAAA,EACR;AAEA,QAAM,mBAAmB,aAAa;AACtC,QAAM,mBAAmB,aAAa;AAGtC,MAAK,CAAE,oBAAoB,CAAE,kBAAmB;AAC/C,WAAO;AAAA,EACR;AAEA,QAAM,aAAa;AAAA,IAClB;AAAA,MACC,OAAO;AAAA,MACP,iBAAa,gBAAI,YAAa;AAAA,IAC/B;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,iBAAa,gBAAI,YAAa;AAAA,IAC/B;AAAA,EACD;AACA,QAAM,4BAAwB,sBAAQ,sBAAuB;AAC7D,QAAM,iCAAiC,sBAAsB,MAAM,IAAI;AACvE,QAAM,4BAA4B,sBAAsB,WAAW;AACnE,QAAM,oBAAoB;AAAA,IACzB,OAAO;AAAA,IACP,MACC,eAAiB,gBAAgB,SAAS,YAAY,KACnD,UACA;AAAA,EACL;AAEA,MAAI,UAAU;AACd,MAAI,eAAe;AACnB,aAAY,QAAQ,YAAa;AAEhC,QAAK,CAAE,KAAK,OAAQ;AACnB;AAAA,IACD;AACA,UAAM,sBAAkB,sBAAQ,KAAK,KAAM;AAC3C,UAAM,uBAAuB,gBAAgB;AAAA,MAC5C;AAAA,MACA;AAAA,IACD;AACA,UAAM,sBAAsB,gBAAgB,MAAM,IAAI;AAGtD,QAAK,CAAE,sBAAuB;AAE7B,UAAK,kCAAkC,qBAAsB;AAC5D;AAAA,MACD;AAGA,UAAK,iBAAkB;AACtB,kBAAU;AACV,uBAAe;AACf;AAAA,MACD;AACA,gBACC,4BAA4B,gBAAgB,WAAW,QACpD;AAAA;AAAA,YAEA;AAAA,UACC;AAAA,QACD;AAAA,QACA,KAAK;AAAA,MACN,QACC;AAAA;AAAA,YAEA;AAAA,UACC;AAAA,QACD;AAAA,QACA,KAAK;AAAA,MACN;AACH,yBAAe;AAAA,QACd;AAAA,MACD;AAGA;AAAA,IACD;AAIA,QAAK,uBAAuB,oBAAqB;AAChD,oBAAU,gBAAI,kDAAmD;AACjE,yBAAe;AAAA,QACd;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,SAAO,EAAE,SAAS,aAAa;AAChC;AAEA,SAAS,gBAAiB,OAAQ;AACjC,QAAM,UAAU,mBAAoB,KAAM;AAE1C,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAMA,0BAAO,QAAQ,YAAa;AAE5B,SACC,4CAAC,SAAI,WAAU,iCACd;AAAA,IAAC;AAAA;AAAA,MACA,eAAgB;AAAA,MAChB,QAAO;AAAA,MACP,eAAgB;AAAA,MAEd,kBAAQ;AAAA;AAAA,EACX,GACD;AAEF;AAKA,IAAO,2BAAQ;",
6
6
  "names": ["import_a11y", "namesPlugin", "a11yPlugin"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/date-format-picker/index.jsx"],
4
- "sourcesContent": ["import { _x, __ } from '@wordpress/i18n';\nimport { dateI18n, humanTimeDiff } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n\tCustomSelectControl,\n} from '@wordpress/components';\nimport { VisuallyHidden } from '@wordpress/ui';\n\n// So that we illustrate the different formats in the dropdown properly, show a date that is\n// somewhat recent, has a day greater than 12, and a month with more than three letters.\nconst exampleDate = new Date();\nexampleDate.setDate( 20 );\nexampleDate.setMonth( exampleDate.getMonth() - 3 );\nif ( exampleDate.getMonth() === 4 ) {\n\t// May has three letters, so use March.\n\texampleDate.setMonth( 3 );\n}\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date format. If `null`, _Default_ is selected.\n * @param {string} props.defaultFormat The date format that will be used if the user selects 'Default'.\n * @param {Function} props.onChange Called when a selection is made. If `null`, _Default_ is selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<VStack\n\t\t\tas=\"fieldset\"\n\t\t\tspacing={ 4 }\n\t\t\tclassName=\"block-editor-date-format-picker\"\n\t\t>\n\t\t\t<VisuallyHidden render={ <legend /> }>\n\t\t\t\t{ __( 'Date format' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\texampleDate\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = [\n\t\t...suggestedFormats.map( ( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, exampleDate ),\n\t\t\tformat: suggestedFormat,\n\t\t} ) ),\n\t\t{\n\t\t\tkey: 'human-diff',\n\t\t\tname: humanTimeDiff( exampleDate ),\n\t\t\tformat: 'human-diff',\n\t\t},\n\t];\n\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\thint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() =>\n\t\t\t!! format &&\n\t\t\t! suggestedOptions.some( ( option ) => option.format === format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB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AAAA;AAAA,IACzC;AAAA,KAEF;AAEF;",
4
+ "sourcesContent": ["import { _x, __ } from '@wordpress/i18n';\nimport { dateI18n, humanTimeDiff } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n\tCustomSelectControl,\n} from '@wordpress/components';\nimport { VisuallyHidden } from '@wordpress/ui';\n\n// So that we illustrate the different formats in the dropdown properly, show a date that is\n// somewhat recent, has a day greater than 12, and a month with more than three letters.\nconst exampleDate = new Date();\nexampleDate.setDate( 20 );\nexampleDate.setMonth( exampleDate.getMonth() - 3 );\nif ( exampleDate.getMonth() === 4 ) {\n\t// May has three letters, so use March.\n\texampleDate.setMonth( 3 );\n}\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date format. If `null`, _Default_ is selected.\n * @param {string} props.defaultFormat The date format that will be used if the user selects 'Default'.\n * @param {Function} props.onChange Called when a selection is made. If `null`, _Default_ is selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<VStack\n\t\t\tas=\"fieldset\"\n\t\t\tspacing={ 4 }\n\t\t\tclassName=\"block-editor-date-format-picker\"\n\t\t>\n\t\t\t<VisuallyHidden render={ <legend /> }>\n\t\t\t\t{ __( 'Date format' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\texampleDate\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = [\n\t\t...suggestedFormats.map( ( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, exampleDate ),\n\t\t\tformat: suggestedFormat,\n\t\t} ) ),\n\t\t{\n\t\t\tkey: 'human-diff',\n\t\t\tname: humanTimeDiff( exampleDate ),\n\t\t\tformat: 'human-diff',\n\t\t},\n\t];\n\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\thint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() =>\n\t\t\t!! format &&\n\t\t\t! suggestedOptions.some( ( option ) => option.format === format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: ( suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t\t) ?? customOption )\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange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AAAA;AAAA,gBACA,UAAO;AAAA,kBACN;AAAA,gBACD;AAAA;AAAA,YACD;AAAA,UAEF;AAAA,QACD;AAAA,QACA,OAAQ;AAAA,QACR,UAAW,CAAE,UAAW,SAAU,KAAM;AAAA;AAAA,IACzC;AAAA,KAEF;AAEF;",
6
6
  "names": ["VStack"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/dimensions-tool/aspect-ratio-tool.jsx"],
4
- "sourcesContent": ["import { SelectControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSettings } from '../use-settings';\nimport { InheritanceToolsPanelItem } from '../global-styles/inheritance';\nimport { findAspectRatioOption } from './utils';\n\n/**\n * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps\n */\n\n/**\n * @callback AspectRatioToolPropsOnChange\n * @param {string} [value] New aspect ratio value.\n * @return {void} No return.\n */\n\n/**\n * @typedef {Object} AspectRatioToolProps\n * @property {string} [panelId] ID of the panel this tool is associated with.\n * @property {string} [value] Current aspect ratio value.\n * @property {AspectRatioToolPropsOnChange} [onChange] Callback to update the aspect ratio value.\n * @property {SelectControlProps[]} [options] Aspect ratio options.\n * @property {string} [defaultValue] Default aspect ratio value.\n * @property {boolean} [isShownByDefault] Whether the tool is shown by default.\n * @property {string} [className] Additional CSS class on the wrapping panel item.\n * @property {boolean} [isInherited] Whether the control is displaying an inherited Global Styles value.\n * @property {boolean} [hasLocalOverride] Whether a local value is overriding an inherited Global Styles value.\n */\n\nexport default function AspectRatioTool( {\n\tpanelId,\n\tvalue,\n\tonChange = () => {},\n\toptions,\n\tdefaultValue = 'auto',\n\thasValue,\n\tisShownByDefault = true,\n\tclassName,\n\tisInherited,\n\thasLocalOverride,\n} ) {\n\tconst [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(\n\t\t'dimensions.aspectRatios.default',\n\t\t'dimensions.aspectRatios.theme',\n\t\t'dimensions.defaultAspectRatios'\n\t);\n\n\tconst themeOptions = themeRatios?.map( ( { name, ratio } ) => ( {\n\t\tlabel: name,\n\t\tvalue: ratio,\n\t} ) );\n\n\tconst defaultOptions = defaultRatios?.map( ( { name, ratio } ) => ( {\n\t\tlabel: name,\n\t\tvalue: ratio,\n\t} ) );\n\n\tconst aspectRatioOptions = [\n\t\t{\n\t\t\tlabel: _x(\n\t\t\t\t'Original',\n\t\t\t\t'Aspect ratio option for dimensions control'\n\t\t\t),\n\t\t\tvalue: 'auto',\n\t\t},\n\t\t...( showDefaultRatios ? defaultOptions : [] ),\n\t\t...( themeOptions ? themeOptions : [] ),\n\t\t{\n\t\t\tlabel: _x( 'Custom', 'Aspect ratio option for dimensions control' ),\n\t\t\tvalue: 'custom',\n\t\t\tdisabled: true,\n\t\t\thidden: true,\n\t\t},\n\t];\n\n\tconst resolvedOptions = options ?? aspectRatioOptions;\n\n\t// The value is free-form CSS, so it doesn't necessarily match an option as\n\t// written, e.g. '1/1' and '1' describe the same ratio. Resolve it to the\n\t// option that represents it, falling back to 'custom' so that a ratio\n\t// without a matching preset isn't displayed as one of the presets. Values\n\t// that are empty match the CSS default, so if the value is used directly in\n\t// CSS it will look correct in the control.\n\tconst displayValue =\n\t\tvalue === undefined || value === null || value === 'auto'\n\t\t\t? 'auto'\n\t\t\t: findAspectRatioOption( value, resolvedOptions )?.value ??\n\t\t\t 'custom';\n\n\treturn (\n\t\t<InheritanceToolsPanelItem\n\t\t\tclassName={ className }\n\t\t\tisInherited={ isInherited }\n\t\t\thasLocalOverride={ hasLocalOverride }\n\t\t\thasValue={\n\t\t\t\thasValue ? hasValue : () => displayValue !== defaultValue\n\t\t\t}\n\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\tonDeselect={ () => onChange( undefined ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<SelectControl\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tvalue={ displayVal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A,MACA;AAAA,MACA;AAAA,MACA,UACC,WAAW,WAAW,MAAM,iBAAiB;AAAA,MAE9C,WAAQ,gBAAI,cAAe;AAAA,MAC3B,YAAa,MAAM,SAAU,MAAU;AAAA,MACvC;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACA,WAAQ,gBAAI,cAAe;AAAA,UAC3B,OAAQ;AAAA,UACR,SAAU;AAAA,UACV;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
- "names": []
4
+ "sourcesContent": ["import { SelectControl as WCSelectControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSettings } from '../use-settings';\nimport { InheritanceToolsPanelItem } from '../global-styles/inheritance';\nimport { findAspectRatioOption } from './utils';\n\n/**\n * @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps\n */\n\n/**\n * @callback AspectRatioToolPropsOnChange\n * @param {string} [value] New aspect ratio value.\n * @return {void} No return.\n */\n\n/**\n * @typedef {Object} AspectRatioToolProps\n * @property {string} [panelId] ID of the panel this tool is associated with.\n * @property {string} [value] Current aspect ratio value.\n * @property {AspectRatioToolPropsOnChange} [onChange] Callback to update the aspect ratio value.\n * @property {SelectControlProps[]} [options] Aspect ratio options.\n * @property {string} [defaultValue] Default aspect ratio value.\n * @property {boolean} [isShownByDefault] Whether the tool is shown by default.\n * @property {string} [className] Additional CSS class on the wrapping panel item.\n * @property {boolean} [isInherited] Whether the control is displaying an inherited Global Styles value.\n * @property {boolean} [hasLocalOverride] Whether a local value is overriding an inherited Global Styles value.\n */\n\nexport default function AspectRatioTool( {\n\tpanelId,\n\tvalue,\n\tonChange = () => {},\n\toptions,\n\tdefaultValue = 'auto',\n\thasValue,\n\tisShownByDefault = true,\n\tclassName,\n\tisInherited,\n\thasLocalOverride,\n} ) {\n\tconst [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(\n\t\t'dimensions.aspectRatios.default',\n\t\t'dimensions.aspectRatios.theme',\n\t\t'dimensions.defaultAspectRatios'\n\t);\n\n\tconst themeOptions = themeRatios?.map( ( { name, ratio } ) => ( {\n\t\tlabel: name,\n\t\tvalue: ratio,\n\t} ) );\n\n\tconst defaultOptions = defaultRatios?.map( ( { name, ratio } ) => ( {\n\t\tlabel: name,\n\t\tvalue: ratio,\n\t} ) );\n\n\tconst aspectRatioOptions = [\n\t\t{\n\t\t\tlabel: _x(\n\t\t\t\t'Original',\n\t\t\t\t'Aspect ratio option for dimensions control'\n\t\t\t),\n\t\t\tvalue: 'auto',\n\t\t},\n\t\t...( showDefaultRatios ? defaultOptions : [] ),\n\t\t...( themeOptions ? themeOptions : [] ),\n\t\t{\n\t\t\tlabel: _x( 'Custom', 'Aspect ratio option for dimensions control' ),\n\t\t\tvalue: 'custom',\n\t\t\tdisabled: true,\n\t\t\thidden: true,\n\t\t},\n\t];\n\n\tconst resolvedOptions = options ?? aspectRatioOptions;\n\n\t// The value is free-form CSS, so it doesn't necessarily match an option as\n\t// written, e.g. '1/1' and '1' describe the same ratio. Resolve it to the\n\t// option that represents it, falling back to 'custom' so that a ratio\n\t// without a matching preset isn't displayed as one of the presets. Values\n\t// that are empty match the CSS default, so if the value is used directly in\n\t// CSS it will look correct in the control.\n\tconst displayValue =\n\t\tvalue === undefined || value === null || value === 'auto'\n\t\t\t? 'auto'\n\t\t\t: ( findAspectRatioOption( value, resolvedOptions )?.value ??\n\t\t\t\t'custom' );\n\n\treturn (\n\t\t<InheritanceToolsPanelItem\n\t\t\tclassName={ className }\n\t\t\tisInherited={ isInherited }\n\t\t\thasLocalOverride={ hasLocalOverride }\n\t\t\thasValue={\n\t\t\t\thasValue ? hasValue : () => displayValue !== defaultValue\n\t\t\t}\n\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\tonDeselect={ () => onChange( undefined ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<WCSelectControl\n\t\t\t\tlabel={ __( 'Aspect ratio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AAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UACC,WAAW,WAAW,MAAM,iBAAiB;AAAA,MAE9C,WAAQ,gBAAI,cAAe;AAAA,MAC3B,YAAa,MAAM,SAAU,MAAU;AAAA,MACvC;AAAA,MACA;AAAA,MAEA;AAAA,QAAC,kBAAAA;AAAA,QAAA;AAAA,UACA,WAAQ,gBAAI,cAAe;AAAA,UAC3B,OAAQ;AAAA,UACR,SAAU;AAAA,UACV;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
+ "names": ["WCSelectControl"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/dimensions-tool/width-height-tool.jsx"],
4
- "sourcesContent": ["import {\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit\n */\n\n/**\n * @typedef {Object} WidthHeightToolValue\n * @property {string} [width] Width CSS value.\n * @property {string} [height] Height CSS value.\n */\n\n/**\n * @callback WidthHeightToolOnChange\n * @param {WidthHeightToolValue} nextValue Next dimensions value.\n * @return {void}\n */\n\n/**\n * @typedef {Object} WidthHeightToolProps\n * @property {string} [panelId] ID of the panel that contains the controls.\n * @property {WidthHeightToolValue} [value] Current dimensions values.\n * @property {WidthHeightToolOnChange} [onChange] Callback to update the dimensions values.\n * @property {WPUnitControlUnit[]} [units] Units options.\n * @property {boolean} [isShownByDefault] Whether the panel is shown by default.\n */\n\n/**\n * Component that renders controls to edit the dimensions of an image or container.\n *\n * @param {WidthHeightToolProps} props The component props.\n *\n * @return {React.ReactElement} The width and height tool.\n */\nexport default function WidthHeightTool( {\n\tpanelId,\n\tvalue = {},\n\tonChange = () => {},\n\tunits,\n\tisShownByDefault = true,\n} ) {\n\t// null, undefined, and 'auto' all represent the default value.\n\tconst width = value.width === 'auto' ? '' : value.width ?? '';\n\tconst height = value.height === 'auto' ? '' : value.height ?? '';\n\n\tconst onDimensionChange = ( dimension ) => ( nextDimension ) => {\n\t\tconst nextValue = { ...value };\n\t\t// Empty strings or undefined may be passed and both represent removing the value.\n\t\tif ( ! nextDimension ) {\n\t\t\tdelete nextValue[ dimension ];\n\t\t} else {\n\t\t\tnextValue[ dimension ] = nextDimension;\n\t\t}\n\t\tonChange( nextValue );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanelItem\n\t\t\t\tstyle={ { gridColumn: 'span 1' } }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\thasValue={ () => width !== '' }\n\t\t\t\tonDeselect={ onDimensionChange( 'width' ) }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tplaceholder={ __( 'Auto' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tvalue={ width }\n\t\t\t\t\tonChange={ onDimensionChange( 'width' ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tstyle={ { gridColumn: 'span 1' } }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\thasValue={ () => height !== '' }\n\t\t\t\tonDeselect={ onDimensionChange( 'height' ) }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tplaceholder={ __( 'Auto' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tvalue={ height }\n\t\t\t\t\tonChange={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A,QACA,UAAW,MAAM,WAAW;AAAA,QAC5B,YAAa,kBAAmB,QAAS;AAAA,QACzC;AAAA,QAEA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,QAAS;AAAA,YACrB,iBAAc,gBAAI,MAAO;AAAA,YACzB,eAAc;AAAA,YACd;AAAA,YACA,KAAM;AAAA,YACN,OAAQ;AAAA,YACR,UAAW,kBAAmB,QAAS;AAAA;AAAA,QACxC;AAAA;AAAA,IACD;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["import {\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit\n */\n\n/**\n * @typedef {Object} WidthHeightToolValue\n * @property {string} [width] Width CSS value.\n * @property {string} [height] Height CSS value.\n */\n\n/**\n * @callback WidthHeightToolOnChange\n * @param {WidthHeightToolValue} nextValue Next dimensions value.\n * @return {void}\n */\n\n/**\n * @typedef {Object} WidthHeightToolProps\n * @property {string} [panelId] ID of the panel that contains the controls.\n * @property {WidthHeightToolValue} [value] Current dimensions values.\n * @property {WidthHeightToolOnChange} [onChange] Callback to update the dimensions values.\n * @property {WPUnitControlUnit[]} [units] Units options.\n * @property {boolean} [isShownByDefault] Whether the panel is shown by default.\n */\n\n/**\n * Component that renders controls to edit the dimensions of an image or container.\n *\n * @param {WidthHeightToolProps} props The component props.\n *\n * @return {React.ReactElement} The width and height tool.\n */\nexport default function WidthHeightTool( {\n\tpanelId,\n\tvalue = {},\n\tonChange = () => {},\n\tunits,\n\tisShownByDefault = true,\n} ) {\n\t// null, undefined, and 'auto' all represent the default value.\n\tconst width = value.width === 'auto' ? '' : ( value.width ?? '' );\n\tconst height = value.height === 'auto' ? '' : ( value.height ?? '' );\n\n\tconst onDimensionChange = ( dimension ) => ( nextDimension ) => {\n\t\tconst nextValue = { ...value };\n\t\t// Empty strings or undefined may be passed and both represent removing the value.\n\t\tif ( ! nextDimension ) {\n\t\t\tdelete nextValue[ dimension ];\n\t\t} else {\n\t\t\tnextValue[ dimension ] = nextDimension;\n\t\t}\n\t\tonChange( nextValue );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ToolsPanelItem\n\t\t\t\tstyle={ { gridColumn: 'span 1' } }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\thasValue={ () => width !== '' }\n\t\t\t\tonDeselect={ onDimensionChange( 'width' ) }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tplaceholder={ __( 'Auto' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tvalue={ width }\n\t\t\t\t\tonChange={ onDimensionChange( 'width' ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tstyle={ { gridColumn: 'span 1' } }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\thasValue={ () => height !== '' }\n\t\t\t\tonDeselect={ onDimensionChange( 'height' ) }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tplaceholder={ __( 'Auto' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tvalue={ height }\n\t\t\t\t\tonChange={ onDimensionChange( 'height' ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;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AAQ,gBAAI,QAAS;AAAA,YACrB,iBAAc,gBAAI,MAAO;AAAA,YACzB,eAAc;AAAA,YACd;AAAA,YACA,KAAM;AAAA,YACN,OAAQ;AAAA,YACR,UAAW,kBAAmB,QAAS;AAAA;AAAA,QACxC;AAAA;AAAA,IACD;AAAA,KACD;AAEF;",
6
6
  "names": ["ToolsPanelItem", "UnitControl"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/font-sizes/with-font-sizes.jsx"],
4
- "sourcesContent": ["import { createHigherOrderComponent, compose } from '@wordpress/compose';\nimport { Component } from '@wordpress/element';\nimport { getFontSize, getFontSizeClass } from './utils';\nimport { useSettings } from '../use-settings';\n\nconst DEFAULT_FONT_SIZES = [];\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher-order component, which handles font size logic for class generation,\n * font size value retrieval, and font size change handling.\n *\n * @param {...(Object|string)} fontSizeNames The arguments should all be strings.\n * Each string contains the font size\n * attribute name e.g: 'fontSize'.\n *\n * @return {Function} Higher-order component.\n */\nexport default ( ...fontSizeNames ) => {\n\t/*\n\t * Computes an object whose key is the font size attribute name as passed in the array,\n\t * and the value is the custom font size attribute name.\n\t * Custom font size is automatically compted by appending custom followed by the font size attribute name in with the first letter capitalized.\n\t */\n\tconst fontSizeAttributeNames = fontSizeNames.reduce(\n\t\t( fontSizeAttributeNamesAccumulator, fontSizeAttributeName ) => {\n\t\t\tfontSizeAttributeNamesAccumulator[\n\t\t\t\tfontSizeAttributeName\n\t\t\t] = `custom${ upperFirst( fontSizeAttributeName ) }`;\n\t\t\treturn fontSizeAttributeNamesAccumulator;\n\t\t},\n\t\t{}\n\t);\n\n\treturn createHigherOrderComponent(\n\t\tcompose( [\n\t\t\tcreateHigherOrderComponent(\n\t\t\t\t( WrappedComponent ) =>\n\t\t\t\t\tfunction WithFontSizesInner( props ) {\n\t\t\t\t\t\tconst [ fontSizes ] = useSettings(\n\t\t\t\t\t\t\t'typography.fontSizes'\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\tfontSizes={ fontSizes || DEFAULT_FONT_SIZES }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t'withFontSizes'\n\t\t\t),\n\t\t\t( WrappedComponent ) => {\n\t\t\t\treturn class WithFontSizes extends Component {\n\t\t\t\t\tconstructor( props ) {\n\t\t\t\t\t\tsuper( props );\n\n\t\t\t\t\t\tthis.setters = this.createSetters();\n\n\t\t\t\t\t\tthis.state = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetters() {\n\t\t\t\t\t\treturn Object.entries( fontSizeAttributeNames ).reduce(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tsettersAccumulator,\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst upperFirstFontSizeAttributeName =\n\t\t\t\t\t\t\t\t\tupperFirst( fontSizeAttributeName );\n\t\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t\t`set${ upperFirstFontSizeAttributeName }`\n\t\t\t\t\t\t\t\t] = this.createSetFontSize(\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetFontSize(\n\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn ( fontSizeValue ) => {\n\t\t\t\t\t\t\tconst fontSizeObject = this.props.fontSizes?.find(\n\t\t\t\t\t\t\t\t( { size } ) => size === Number( fontSizeValue )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t\t[ fontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t[ customFontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: fontSizeValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t\t{ attributes, fontSizes },\n\t\t\t\t\t\tpreviousState\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst didAttributesChange = (\n\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tif ( previousState[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t// If new font size is name compare with the previous slug.\n\t\t\t\t\t\t\t\tif ( attributes[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ] !==\n\t\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t\t.slug\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If font size is not named, update when the font size value changes.\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t.size !==\n\t\t\t\t\t\t\t\t\tattributes[ customFontSizeAttributeName ]\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// In this case we need to build the font size object.\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! Object.values( fontSizeAttributeNames ).some(\n\t\t\t\t\t\t\t\tdidAttributesChange\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newState = Object.entries(\n\t\t\t\t\t\t\tfontSizeAttributeNames\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( [ key, value ] ) =>\n\t\t\t\t\t\t\t\tdidAttributesChange( value, key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.reduce(\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tnewStateAccumulator,\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\tconst fontSizeAttributeValue =\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ];\n\t\t\t\t\t\t\t\t\tconst fontSizeObject = getFontSize(\n\t\t\t\t\t\t\t\t\t\tfontSizes,\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue,\n\t\t\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tnewStateAccumulator[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t\t\t\t] = {\n\t\t\t\t\t\t\t\t\t\t...fontSizeObject,\n\t\t\t\t\t\t\t\t\t\tclass: getFontSizeClass(\n\t\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn newStateAccumulator;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...previousState,\n\t\t\t\t\t\t\t...newState,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\trender() {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\t\tfontSizes: undefined,\n\t\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t] ),\n\t\t'withFontSizes'\n\t);\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoD;AACpD,qBAA0B;AAC1B,mBAA8C;AAC9C,0BAA4B;AAiDrB;AA/CP,IAAM,qBAAqB,CAAC;AAS5B,IAAM,aAAa,CAAE,CAAE,aAAgB,OAAK,MAC3C,YAAY,YAAY,IAAI,KAAK,KAAM,EAAG;AAY3C,IAAO,0BAAQ,IAAK,kBAAmB;AAMtC,QAAM,yBAAyB,cAAc;AAAA,IAC5C,CAAE,mCAAmC,0BAA2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AAU,GACxB,eACC;AACD,kBAAM,sBAAsB,CAC3B,6BACA,0BACI;AACJ,kBAAK,cAAe,qBAAsB,GAAI;AAE7C,oBAAK,WAAY,qBAAsB,GAAI;AAC1C,yBACC,WAAY,qBAAsB,MAClC,cAAe,qBAAsB,EACnC;AAAA,gBAEJ;AAEA,uBACC,cAAe,qBAAsB,EACnC,SACF,WAAY,2BAA4B;AAAA,cAE1C;AAEA,qBAAO;AAAA,YACR;AAEA,gBACC,CAAE,OAAO,OAAQ,sBAAuB,EAAE;AAAA,cACzC;AAAA,YACD,GACC;AACD,qBAAO;AAAA,YACR;AAEA,kBAAM,WAAW,OAAO;AAAA,cACvB;AAAA,YACD,EACE;AAAA,cAAQ,CAAE,CAAE,KAAK,KAAM,MACvB,oBAAqB,OAAO,GAAI;AAAA,YACjC,EACC;AAAA,cACA,CACC,qBACA;AAAA,gBACC;AAAA,gBACA;AAAA,cACD,MACI;AACJ,sBAAM,yBACL,WAAY,qBAAsB;AACnC,sBAAM,qBAAiB;AAAA,kBACtB;AAAA,kBACA;AAAA,kBACA,WACC,2BACD;AAAA,gBACD;AACA,oCACC,qBACD,IAAI;AAAA,kBACH,GAAG;AAAA,kBACH,WAAO;AAAA,oBACN;AAAA,kBACD;AAAA,gBACD;AACA,uBAAO;AAAA,cACR;AAAA,cACA,CAAC;AAAA,YACF;AAED,mBAAO;AAAA,cACN,GAAG;AAAA,cACH,GAAG;AAAA,YACJ;AAAA,UACD;AAAA,UAEA,SAAS;AACR,mBACC;AAAA,cAAC;AAAA;AAAA,gBACE,GAAG;AAAA,kBACJ,GAAG,KAAK;AAAA,kBACR,WAAW;AAAA,kBACX,GAAG,KAAK;AAAA,kBACR,GAAG,KAAK;AAAA,gBACT;AAAA;AAAA,YACD;AAAA,UAEF;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,IACF;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import { createHigherOrderComponent, compose } from '@wordpress/compose';\nimport { Component } from '@wordpress/element';\nimport { getFontSize, getFontSizeClass } from './utils';\nimport { useSettings } from '../use-settings';\n\nconst DEFAULT_FONT_SIZES = [];\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param {string} str The string whose first letter the function will capitalize.\n *\n * @return {string} Capitalized string.\n */\nconst upperFirst = ( [ firstLetter, ...rest ] ) =>\n\tfirstLetter.toUpperCase() + rest.join( '' );\n\n/**\n * Higher-order component, which handles font size logic for class generation,\n * font size value retrieval, and font size change handling.\n *\n * @param {...(Object|string)} fontSizeNames The arguments should all be strings.\n * Each string contains the font size\n * attribute name e.g: 'fontSize'.\n *\n * @return {Function} Higher-order component.\n */\nexport default ( ...fontSizeNames ) => {\n\t/*\n\t * Computes an object whose key is the font size attribute name as passed in the array,\n\t * and the value is the custom font size attribute name.\n\t * Custom font size is automatically compted by appending custom followed by the font size attribute name in with the first letter capitalized.\n\t */\n\tconst fontSizeAttributeNames = fontSizeNames.reduce(\n\t\t( fontSizeAttributeNamesAccumulator, fontSizeAttributeName ) => {\n\t\t\tfontSizeAttributeNamesAccumulator[ fontSizeAttributeName ] =\n\t\t\t\t`custom${ upperFirst( fontSizeAttributeName ) }`;\n\t\t\treturn fontSizeAttributeNamesAccumulator;\n\t\t},\n\t\t{}\n\t);\n\n\treturn createHigherOrderComponent(\n\t\tcompose( [\n\t\t\tcreateHigherOrderComponent(\n\t\t\t\t( WrappedComponent ) =>\n\t\t\t\t\tfunction WithFontSizesInner( props ) {\n\t\t\t\t\t\tconst [ fontSizes ] = useSettings(\n\t\t\t\t\t\t\t'typography.fontSizes'\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\tfontSizes={ fontSizes || DEFAULT_FONT_SIZES }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t'withFontSizes'\n\t\t\t),\n\t\t\t( WrappedComponent ) => {\n\t\t\t\treturn class WithFontSizes extends Component {\n\t\t\t\t\tconstructor( props ) {\n\t\t\t\t\t\tsuper( props );\n\n\t\t\t\t\t\tthis.setters = this.createSetters();\n\n\t\t\t\t\t\tthis.state = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetters() {\n\t\t\t\t\t\treturn Object.entries( fontSizeAttributeNames ).reduce(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tsettersAccumulator,\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tconst upperFirstFontSizeAttributeName =\n\t\t\t\t\t\t\t\t\tupperFirst( fontSizeAttributeName );\n\t\t\t\t\t\t\t\tsettersAccumulator[\n\t\t\t\t\t\t\t\t\t`set${ upperFirstFontSizeAttributeName }`\n\t\t\t\t\t\t\t\t] = this.createSetFontSize(\n\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\treturn settersAccumulator;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSetFontSize(\n\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn ( fontSizeValue ) => {\n\t\t\t\t\t\t\tconst fontSizeObject = this.props.fontSizes?.find(\n\t\t\t\t\t\t\t\t( { size } ) => size === Number( fontSizeValue )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthis.props.setAttributes( {\n\t\t\t\t\t\t\t\t[ fontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t\t[ customFontSizeAttributeName ]:\n\t\t\t\t\t\t\t\t\tfontSizeObject && fontSizeObject.slug\n\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t: fontSizeValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tstatic getDerivedStateFromProps(\n\t\t\t\t\t\t{ attributes, fontSizes },\n\t\t\t\t\t\tpreviousState\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst didAttributesChange = (\n\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\tif ( previousState[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t// If new font size is name compare with the previous slug.\n\t\t\t\t\t\t\t\tif ( attributes[ fontSizeAttributeName ] ) {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ] !==\n\t\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t\t.slug\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// If font size is not named, update when the font size value changes.\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\tpreviousState[ fontSizeAttributeName ]\n\t\t\t\t\t\t\t\t\t\t.size !==\n\t\t\t\t\t\t\t\t\tattributes[ customFontSizeAttributeName ]\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// In this case we need to build the font size object.\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! Object.values( fontSizeAttributeNames ).some(\n\t\t\t\t\t\t\t\tdidAttributesChange\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newState = Object.entries(\n\t\t\t\t\t\t\tfontSizeAttributeNames\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( [ key, value ] ) =>\n\t\t\t\t\t\t\t\tdidAttributesChange( value, key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.reduce(\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\tnewStateAccumulator,\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName,\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\tconst fontSizeAttributeValue =\n\t\t\t\t\t\t\t\t\t\tattributes[ fontSizeAttributeName ];\n\t\t\t\t\t\t\t\t\tconst fontSizeObject = getFontSize(\n\t\t\t\t\t\t\t\t\t\tfontSizes,\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue,\n\t\t\t\t\t\t\t\t\t\tattributes[\n\t\t\t\t\t\t\t\t\t\t\tcustomFontSizeAttributeName\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tnewStateAccumulator[\n\t\t\t\t\t\t\t\t\t\tfontSizeAttributeName\n\t\t\t\t\t\t\t\t\t] = {\n\t\t\t\t\t\t\t\t\t\t...fontSizeObject,\n\t\t\t\t\t\t\t\t\t\tclass: getFontSizeClass(\n\t\t\t\t\t\t\t\t\t\t\tfontSizeAttributeValue\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn newStateAccumulator;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...previousState,\n\t\t\t\t\t\t\t...newState,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\trender() {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\t...this.props,\n\t\t\t\t\t\t\t\t\tfontSizes: undefined,\n\t\t\t\t\t\t\t\t\t...this.state,\n\t\t\t\t\t\t\t\t\t...this.setters,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t] ),\n\t\t'withFontSizes'\n\t);\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoD;AACpD,qBAA0B;AAC1B,mBAA8C;AAC9C,0BAA4B;AAgDrB;AA9CP,IAAM,qBAAqB,CAAC;AAS5B,IAAM,aAAa,CAAE,CAAE,aAAgB,OAAK,MAC3C,YAAY,YAAY,IAAI,KAAK,KAAM,EAAG;AAY3C,IAAO,0BAAQ,IAAK,kBAAmB;AAMtC,QAAM,yBAAyB,cAAc;AAAA,IAC5C,CAAE,mCAAmC,0BAA2B;AAC/D,wCAAmC,qBAAsB,IACxD,SAAU,WAAY,qBAAsB,CAAE;AAC/C,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AAEA,aAAO;AAAA,QACN,wBAAS;AAAA,UACR;AAAA,QACC,CAAE,qBACD,SAAS,mBAAoB,OAAQ;AACpC,gBAAM,CAAE,SAAU,QAAI;AAAA,YACrB;AAAA,UACD;AACA,iBACC;AAAA,YAAC;AAAA;AAAA,cACE,GAAG;AAAA,cACL,WAAY,aAAa;AAAA;AAAA,UAC1B;AAAA,QAEF;AAAA,QACD;AAAA,MACD;AAAA,MACA,CAAE,qBAAsB;AACvB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,OAAO;AAAA,cACvB;AAAA,YACD,EACE;AAAA,cAAQ,CAAE,CAAE,KAAK,KAAM,MACvB,oBAAqB,OAAO,GAAI;AAAA,YACjC,EACC;AAAA,cACA,CACC,qBACA;AAAA,gBACC;AAAA,gBACA;AAAA,cACD,MACI;AACJ,sBAAM,yBACL,WAAY,qBAAsB;AACnC,sBAAM,qBAAiB;AAAA,kBACtB;AAAA,kBACA;AAAA,kBACA,WACC,2BACD;AAAA,gBACD;AACA,oCACC,qBACD,IAAI;AAAA,kBACH,GAAG;AAAA,kBACH,WAAO;AAAA,oBACN;AAAA,kBACD;AAAA,gBACD;AACA,uBAAO;AAAA,cACR;AAAA,cACA,CAAC;AAAA,YACF;AAED,mBAAO;AAAA,cACN,GAAG;AAAA,cACH,GAAG;AAAA,YACJ;AAAA,UACD;AAAA,UAEA,SAAS;AACR,mBACC;AAAA,cAAC;AAAA;AAAA,gBACE,GAAG;AAAA,kBACJ,GAAG,KAAK;AAAA,kBACR,WAAW;AAAA,kBACX,GAAG,KAAK;AAAA,kBACR,GAAG,KAAK;AAAA,gBACT;AAAA;AAAA,YACD;AAAA,UAEF;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,IACF;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -121,7 +121,7 @@ function BackgroundImagePanel({
121
121
  defaultValues = {},
122
122
  headerLabel = (0, import_i18n.__)("Background"),
123
123
  contrastWarning,
124
- showInheritanceLabelIndicators = (0, import_inheritance.isGlobalStylesInheritanceEnabled)()
124
+ showInheritanceLabelIndicators = (0, import_inheritance.isGlobalStylesInheritanceIndicatorUIEnabled)()
125
125
  }) {
126
126
  const {
127
127
  colors,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/global-styles/background-panel.jsx"],
4
- "sourcesContent": ["import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport BackgroundImageControl from '../background-image-control';\nimport ColorGradientDropdownItem from './color-gradient-dropdown-item';\nimport { useHasBackgroundColorPanel } from './color-panel';\nimport { useColorGradientSettings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport {\n\textractPresetSlug,\n\tencodeColorValueWithPalette,\n} from '../../utils/color-values';\nimport {\n\tgetInheritanceProps,\n\tInheritanceToolsPanelItem,\n\tisGlobalStylesInheritanceEnabled,\n} from './inheritance';\n\nconst DEFAULT_CONTROLS = {\n\tbackgroundImage: true,\n\tbackgroundColor: true,\n\tgradient: true,\n};\n\n/**\n * Checks site settings to see if the requested feature's control may be used.\n *\n * @param {Object} settings Site settings.\n * @param {string} feature Background feature to check.\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundControl( settings, feature ) {\n\treturn settings?.background?.[ feature ];\n}\n\n/**\n * Checks site settings to see if the background panel may be used.\n * `settings.background.backgroundSize` exists also,\n * but can only be used if settings?.background?.backgroundImage is `true`.\n *\n * The panel is also shown when the block has color panel background\n * support (`settings.color.background`), because background color and\n * the legacy `color.gradient` control are rendered here.\n *\n * @param {Object} settings Site settings\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundPanel( settings ) {\n\tconst hasBackgroundColor = useHasBackgroundColorPanel( settings );\n\tconst { backgroundImage, gradient } = settings?.background || {};\n\treturn backgroundImage || gradient || hasBackgroundColor;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\treturn (\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t// Supports url() string values in theme.json.\n\t\t'string' === typeof style?.background?.backgroundImage ||\n\t\t!! style?.background?.backgroundImage?.url\n\t);\n}\n\n/**\n * Checks if there is a current value in the background gradient block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background gradient value set.\n */\nexport function hasBackgroundGradientValue( style ) {\n\treturn (\n\t\t'string' === typeof style?.background?.gradient &&\n\t\tstyle?.background?.gradient !== ''\n\t);\n}\n\n/**\n * Checks if there is a current value for the background color (written to\n * `color.background`).\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background color value set.\n */\nexport function hasBackgroundColorValue( style ) {\n\treturn !! style?.color?.background;\n}\n\n/**\n * Checks if there is a current value in the legacy `color.gradient` location\n * (used by blocks with color panel gradient support that haven't adopted the\n * `background.gradient` block support).\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a legacy color gradient value set.\n */\nexport function hasLegacyColorGradientValue( style ) {\n\treturn !! style?.color?.gradient;\n}\n\nexport function BackgroundToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\theaderLabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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={ headerLabel }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\thasInnerWrapper\n\t\t\tclassName=\"background-block-support-panel\"\n\t\t\t__experimentalFirstVisibleItemClass=\"first\"\n\t\t\t__experimentalLastVisibleItemClass=\"last\"\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<div className=\"background-block-support-panel__inner-wrapper\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ToolsPanel>\n\t);\n}\n\nexport default function BackgroundImagePanel( {\n\tas: Wrapper = BackgroundToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tdefaultValues = {},\n\theaderLabel = __( 'Background' ),\n\tcontrastWarning,\n\tshowInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled(),\n} ) {\n\tconst {\n\t\tcolors,\n\t\tgradients,\n\t\tallColors,\n\t\tareCustomSolidsEnabled,\n\t\tareCustomGradientsEnabled,\n\t\thasSolidColors,\n\t\thasGradientColors,\n\t\tdecodeValue,\n\t\tencodeGradientValue,\n\t} = useColorGradientSettings( settings );\n\n\tconst hasBackgroundGradientControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'gradient'\n\t);\n\tconst hasColorPanelBackgroundSupport =\n\t\tuseHasBackgroundColorPanel( settings );\n\tconst showBackgroundColorControl =\n\t\thasColorPanelBackgroundSupport && hasSolidColors;\n\t// New `background.gradient` block support — gradient lives under the\n\t// `background` style path.\n\tconst showBackgroundGradientControl =\n\t\thasGradientColors && hasBackgroundGradientControl;\n\t// Legacy `color.gradient` path — only rendered when the block has\n\t// color panel background support and hasn't adopted the newer\n\t// `background.gradient` support. Keeps the UI consistent for blocks\n\t// that still write gradients to `color.gradient`.\n\tconst showLegacyColorGradientControl =\n\t\thasColorPanelBackgroundSupport &&\n\t\thasGradientColors &&\n\t\t! hasBackgroundGradientControl;\n\tconst showBackgroundImageControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'backgroundImage'\n\t);\n\n\tconst resetAllFilter = useCallback(\n\t\t( previousValue ) => {\n\t\t\tconst clearsColorBackground = showBackgroundColorControl;\n\t\t\tconst clearsColorGradient =\n\t\t\t\thasBackgroundGradientControl || showLegacyColorGradientControl;\n\t\t\tif ( ! clearsColorBackground && ! clearsColorGradient ) {\n\t\t\t\treturn { ...previousValue, background: {} };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...previousValue,\n\t\t\t\tbackground: {},\n\t\t\t\tcolor: {\n\t\t\t\t\t...previousValue?.color,\n\t\t\t\t\t...( clearsColorBackground && { background: undefined } ),\n\t\t\t\t\t...( clearsColorGradient && { gradient: undefined } ),\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\thasBackgroundGradientControl,\n\t\t\tshowBackgroundColorControl,\n\t\t\tshowLegacyColorGradientControl,\n\t\t]\n\t);\n\n\tif (\n\t\t! showBackgroundImageControl &&\n\t\t! showBackgroundColorControl &&\n\t\t! showBackgroundGradientControl &&\n\t\t! showLegacyColorGradientControl\n\t) {\n\t\treturn null;\n\t}\n\n\tconst resetBackground = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'background', 'backgroundImage' ],\n\t\t\t\tundefined\n\t\t\t)\n\t\t);\n\n\tconst resetGradient = () => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\t// Non-cascading root values are already dropped from `inheritedValue` by\n\t// the builder, so inherited reads below are direct.\n\n\t// Background color (written to `color.background`).\n\tconst backgroundColor = decodeValue( inheritedValue?.color?.background );\n\tconst userBackgroundColor = decodeValue( value?.color?.background );\n\tconst setBackgroundColor = ( newColor, newSlug ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tencodeColorValueWithPalette( allColors, newColor, newSlug )\n\t\t);\n\t\t// Legacy `color.gradient` is mutually exclusive with\n\t\t// `color.background`. `background.gradient` is independent and\n\t\t// should not be touched.\n\t\tif ( showLegacyColorGradientControl ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\tconst resetBackgroundColor = () => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tundefined\n\t\t);\n\t\tif ( showLegacyColorGradientControl ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\n\t// Legacy `color.gradient` setters.\n\tconst legacyColorGradient = decodeValue( inheritedValue?.color?.gradient );\n\tconst userLegacyColorGradient = decodeValue( value?.color?.gradient );\n\tconst setLegacyColorGradient = ( newGradient, newSlug ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient, newSlug )\n\t\t);\n\t\tnewValue.color.background = undefined;\n\t\tonChange( newValue );\n\t};\n\tconst resetLegacyColorGradient = () =>\n\t\tonChange( setImmutably( value, [ 'color', 'gradient' ], undefined ) );\n\n\t// Get current gradient value, decoding preset slug references.\n\t// Fall back to color.gradient for legacy blocks that haven't migrated\n\t// to background.gradient yet (mirrors block inspector fallback in\n\t// packages/block-editor/src/hooks/background.jsx).\n\tconst currentGradient = decodeValue(\n\t\tvalue?.background?.gradient ?? value?.color?.gradient\n\t);\n\tconst inheritedGradient = decodeValue(\n\t\tinheritedValue?.background?.gradient ?? inheritedValue?.color?.gradient\n\t);\n\n\t// Set gradient value, encoding preset matches as slug references.\n\t// Also clear color.gradient to migrate from the legacy location,\n\t// matching the block inspector behavior in hooks/background.jsx.\n\tconst setGradient = ( newGradient, newSlug ) => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient, newSlug )\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\tconst inheritanceProps = ( isInherited, hasLocalOverride, classNames ) =>\n\t\tshowInheritanceLabelIndicators\n\t\t\t? getInheritanceProps( isInherited, hasLocalOverride, classNames )\n\t\t\t: { className: classNames };\n\n\t// The inherited value arrives already resolved (refs + theme-file pointers)\n\t// with non-cascading root values dropped, so a presence check drives the\n\t// label affordance and matches what `BackgroundImageControl` renders.\n\tconst inheritedBackgroundImage = hasBackgroundImageValue( {\n\t\tbackground: {\n\t\t\tbackgroundImage: inheritedValue?.background?.backgroundImage,\n\t\t},\n\t} );\n\tconst hasLocalBackgroundImage = hasBackgroundImageValue( value );\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\theaderLabel={ headerLabel }\n\t\t>\n\t\t\t{ showBackgroundImageControl && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tinheritedBackgroundImage && ! hasLocalBackgroundImage,\n\t\t\t\t\t\thasLocalBackgroundImage && inheritedBackgroundImage,\n\t\t\t\t\t\t'block-editor-color-gradient-item'\n\t\t\t\t\t) }\n\t\t\t\t\tshowLocalOverrideActionsInLabel={ false }\n\t\t\t\t\thasValue={ () => hasBackgroundImageValue( value ) }\n\t\t\t\t\tlabel={ __( 'Image' ) }\n\t\t\t\t\tonDeselect={ resetBackground }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundImage }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BackgroundImageControl\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tinheritedValue={ inheritedValue }\n\t\t\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBackgroundColorControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundColorValue( value ) }\n\t\t\t\t\tresetValue={ resetBackgroundColor }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundColor }\n\t\t\t\t\tindicators={ [ userBackgroundColor ?? backgroundColor ] }\n\t\t\t\t\tcontrastWarning={ contrastWarning }\n\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t}\n\t\t\t\t\tisPlaceholder={\n\t\t\t\t\t\tuserBackgroundColor === undefined &&\n\t\t\t\t\t\tbackgroundColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\thasInheritedValue={ backgroundColor !== undefined }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'background',\n\t\t\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t\t\t\tinheritedValue: backgroundColor,\n\t\t\t\t\t\t\t// The picker selects by slug: `userSlug` when the\n\t\t\t\t\t\t\t// block has its own value, otherwise\n\t\t\t\t\t\t\t// `inheritedSlug`. Hex matching would mark two\n\t\t\t\t\t\t\t// same-hex presets as both selected.\n\t\t\t\t\t\t\tinheritedSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tinheritedValue?.color?.background,\n\t\t\t\t\t\t\t\t'color'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tuserSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tvalue?.color?.background,\n\t\t\t\t\t\t\t\t'color'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsetValue: setBackgroundColor,\n\t\t\t\t\t\t\tuserValue: userBackgroundColor,\n\t\t\t\t\t\t\tisPlaceholder:\n\t\t\t\t\t\t\t\tuserBackgroundColor === undefined &&\n\t\t\t\t\t\t\t\tbackgroundColor !== undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tdisableCustomColors: ! areCustomSolidsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showBackgroundGradientControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [ currentGradient ?? inheritedGradient ] }\n\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t}\n\t\t\t\t\tisPlaceholder={\n\t\t\t\t\t\tcurrentGradient === undefined &&\n\t\t\t\t\t\tinheritedGradient !== undefined\n\t\t\t\t\t}\n\t\t\t\t\thasInheritedValue={ inheritedGradient !== undefined }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue: inheritedGradient,\n\t\t\t\t\t\t\tinheritedSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tinheritedValue?.background?.gradient ??\n\t\t\t\t\t\t\t\t\tinheritedValue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tuserSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tvalue?.background?.gradient ??\n\t\t\t\t\t\t\t\t\tvalue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsetValue: setGradient,\n\t\t\t\t\t\t\tuserValue: currentGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t\tisPlaceholder:\n\t\t\t\t\t\t\t\tcurrentGradient === undefined &&\n\t\t\t\t\t\t\t\tinheritedGradient !== undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showLegacyColorGradientControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasLegacyColorGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetLegacyColorGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [\n\t\t\t\t\t\tuserLegacyColorGradient ?? legacyColorGradient,\n\t\t\t\t\t] }\n\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t}\n\t\t\t\t\tisPlaceholder={\n\t\t\t\t\t\tuserLegacyColorGradient === undefined &&\n\t\t\t\t\t\tlegacyColorGradient !== undefined\n\t\t\t\t\t}\n\t\t\t\t\thasInheritedValue={ legacyColorGradient !== undefined }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue: legacyColorGradient,\n\t\t\t\t\t\t\tinheritedSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tinheritedValue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tuserSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tvalue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsetValue: setLegacyColorGradient,\n\t\t\t\t\t\t\tuserValue: userLegacyColorGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t\tisPlaceholder:\n\t\t\t\t\t\t\t\tuserLegacyColorGradient === undefined &&\n\t\t\t\t\t\t\t\tlegacyColorGradient !== undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAuD;AACvD,qBAA4B;AAC5B,kBAAmB;AACnB,sCAAmC;AACnC,0CAAsC;AACtC,yBAA2C;AAC3C,mBAAyC;AACzC,mBAA+C;AAC/C,oBAA6B;AAC7B,0BAGO;AACP,yBAIO;AAkIJ;AAhIH,IAAM,mBAAmB;AAAA,EACxB,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,UAAU;AACX;AASO,SAAS,wBAAyB,UAAU,SAAU;AAC5D,SAAO,UAAU,aAAc,OAAQ;AACxC;AAcO,SAAS,sBAAuB,UAAW;AACjD,QAAM,yBAAqB,+CAA4B,QAAS;AAChE,QAAM,EAAE,iBAAiB,SAAS,IAAI,UAAU,cAAc,CAAC;AAC/D,SAAO,mBAAmB,YAAY;AACvC;AAUO,SAAS,uBAAwB,OAAQ;AAC/C,SACC,OAAO,YAAY,uBAAuB,UAC1C,OAAO,YAAY,mBAAmB;AAExC;AASO,SAAS,wBAAyB,OAAQ;AAChD,SACC,CAAC,CAAE,OAAO,YAAY,iBAAiB;AAAA,EAEvC,aAAa,OAAO,OAAO,YAAY,mBACvC,CAAC,CAAE,OAAO,YAAY,iBAAiB;AAEzC;AASO,SA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BAAe;AAAA,kBACd,gBAAgB,OAAO;AAAA,kBACvB;AAAA,gBACD;AAAA,gBACA,cAAU;AAAA,kBACT,OAAO,OAAO;AAAA,kBACd;AAAA,gBACD;AAAA,gBACA,UAAU;AAAA,gBACV,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,eACC,4BAA4B,UAC5B,wBAAwB;AAAA,cAC1B;AAAA,YACD;AAAA,YACA,8BAA+B;AAAA,cAC9B;AAAA,cACA,wBAAwB,CAAE;AAAA,YAC3B;AAAA,YACA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
4
+ "sourcesContent": ["import { __experimentalToolsPanel as ToolsPanel } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport BackgroundImageControl from '../background-image-control';\nimport ColorGradientDropdownItem from './color-gradient-dropdown-item';\nimport { useHasBackgroundColorPanel } from './color-panel';\nimport { useColorGradientSettings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport {\n\textractPresetSlug,\n\tencodeColorValueWithPalette,\n} from '../../utils/color-values';\nimport {\n\tgetInheritanceProps,\n\tInheritanceToolsPanelItem,\n\tisGlobalStylesInheritanceIndicatorUIEnabled,\n} from './inheritance';\n\nconst DEFAULT_CONTROLS = {\n\tbackgroundImage: true,\n\tbackgroundColor: true,\n\tgradient: true,\n};\n\n/**\n * Checks site settings to see if the requested feature's control may be used.\n *\n * @param {Object} settings Site settings.\n * @param {string} feature Background feature to check.\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundControl( settings, feature ) {\n\treturn settings?.background?.[ feature ];\n}\n\n/**\n * Checks site settings to see if the background panel may be used.\n * `settings.background.backgroundSize` exists also,\n * but can only be used if settings?.background?.backgroundImage is `true`.\n *\n * The panel is also shown when the block has color panel background\n * support (`settings.color.background`), because background color and\n * the legacy `color.gradient` control are rendered here.\n *\n * @param {Object} settings Site settings\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundPanel( settings ) {\n\tconst hasBackgroundColor = useHasBackgroundColorPanel( settings );\n\tconst { backgroundImage, gradient } = settings?.background || {};\n\treturn backgroundImage || gradient || hasBackgroundColor;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\treturn (\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t// Supports url() string values in theme.json.\n\t\t'string' === typeof style?.background?.backgroundImage ||\n\t\t!! style?.background?.backgroundImage?.url\n\t);\n}\n\n/**\n * Checks if there is a current value in the background gradient block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background gradient value set.\n */\nexport function hasBackgroundGradientValue( style ) {\n\treturn (\n\t\t'string' === typeof style?.background?.gradient &&\n\t\tstyle?.background?.gradient !== ''\n\t);\n}\n\n/**\n * Checks if there is a current value for the background color (written to\n * `color.background`).\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background color value set.\n */\nexport function hasBackgroundColorValue( style ) {\n\treturn !! style?.color?.background;\n}\n\n/**\n * Checks if there is a current value in the legacy `color.gradient` location\n * (used by blocks with color panel gradient support that haven't adopted the\n * `background.gradient` block support).\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a legacy color gradient value set.\n */\nexport function hasLegacyColorGradientValue( style ) {\n\treturn !! style?.color?.gradient;\n}\n\nexport function BackgroundToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\theaderLabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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={ headerLabel }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\thasInnerWrapper\n\t\t\tclassName=\"background-block-support-panel\"\n\t\t\t__experimentalFirstVisibleItemClass=\"first\"\n\t\t\t__experimentalLastVisibleItemClass=\"last\"\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<div className=\"background-block-support-panel__inner-wrapper\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ToolsPanel>\n\t);\n}\n\nexport default function BackgroundImagePanel( {\n\tas: Wrapper = BackgroundToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tdefaultValues = {},\n\theaderLabel = __( 'Background' ),\n\tcontrastWarning,\n\tshowInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),\n} ) {\n\tconst {\n\t\tcolors,\n\t\tgradients,\n\t\tallColors,\n\t\tareCustomSolidsEnabled,\n\t\tareCustomGradientsEnabled,\n\t\thasSolidColors,\n\t\thasGradientColors,\n\t\tdecodeValue,\n\t\tencodeGradientValue,\n\t} = useColorGradientSettings( settings );\n\n\tconst hasBackgroundGradientControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'gradient'\n\t);\n\tconst hasColorPanelBackgroundSupport =\n\t\tuseHasBackgroundColorPanel( settings );\n\tconst showBackgroundColorControl =\n\t\thasColorPanelBackgroundSupport && hasSolidColors;\n\t// New `background.gradient` block support — gradient lives under the\n\t// `background` style path.\n\tconst showBackgroundGradientControl =\n\t\thasGradientColors && hasBackgroundGradientControl;\n\t// Legacy `color.gradient` path — only rendered when the block has\n\t// color panel background support and hasn't adopted the newer\n\t// `background.gradient` support. Keeps the UI consistent for blocks\n\t// that still write gradients to `color.gradient`.\n\tconst showLegacyColorGradientControl =\n\t\thasColorPanelBackgroundSupport &&\n\t\thasGradientColors &&\n\t\t! hasBackgroundGradientControl;\n\tconst showBackgroundImageControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'backgroundImage'\n\t);\n\n\tconst resetAllFilter = useCallback(\n\t\t( previousValue ) => {\n\t\t\tconst clearsColorBackground = showBackgroundColorControl;\n\t\t\tconst clearsColorGradient =\n\t\t\t\thasBackgroundGradientControl || showLegacyColorGradientControl;\n\t\t\tif ( ! clearsColorBackground && ! clearsColorGradient ) {\n\t\t\t\treturn { ...previousValue, background: {} };\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...previousValue,\n\t\t\t\tbackground: {},\n\t\t\t\tcolor: {\n\t\t\t\t\t...previousValue?.color,\n\t\t\t\t\t...( clearsColorBackground && { background: undefined } ),\n\t\t\t\t\t...( clearsColorGradient && { gradient: undefined } ),\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\thasBackgroundGradientControl,\n\t\t\tshowBackgroundColorControl,\n\t\t\tshowLegacyColorGradientControl,\n\t\t]\n\t);\n\n\tif (\n\t\t! showBackgroundImageControl &&\n\t\t! showBackgroundColorControl &&\n\t\t! showBackgroundGradientControl &&\n\t\t! showLegacyColorGradientControl\n\t) {\n\t\treturn null;\n\t}\n\n\tconst resetBackground = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'background', 'backgroundImage' ],\n\t\t\t\tundefined\n\t\t\t)\n\t\t);\n\n\tconst resetGradient = () => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\t// Non-cascading root values are already dropped from `inheritedValue` by\n\t// the builder, so inherited reads below are direct.\n\n\t// Background color (written to `color.background`).\n\tconst backgroundColor = decodeValue( inheritedValue?.color?.background );\n\tconst userBackgroundColor = decodeValue( value?.color?.background );\n\tconst setBackgroundColor = ( newColor, newSlug ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tencodeColorValueWithPalette( allColors, newColor, newSlug )\n\t\t);\n\t\t// Legacy `color.gradient` is mutually exclusive with\n\t\t// `color.background`. `background.gradient` is independent and\n\t\t// should not be touched.\n\t\tif ( showLegacyColorGradientControl ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\tconst resetBackgroundColor = () => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tundefined\n\t\t);\n\t\tif ( showLegacyColorGradientControl ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\n\t// Legacy `color.gradient` setters.\n\tconst legacyColorGradient = decodeValue( inheritedValue?.color?.gradient );\n\tconst userLegacyColorGradient = decodeValue( value?.color?.gradient );\n\tconst setLegacyColorGradient = ( newGradient, newSlug ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient, newSlug )\n\t\t);\n\t\tnewValue.color.background = undefined;\n\t\tonChange( newValue );\n\t};\n\tconst resetLegacyColorGradient = () =>\n\t\tonChange( setImmutably( value, [ 'color', 'gradient' ], undefined ) );\n\n\t// Get current gradient value, decoding preset slug references.\n\t// Fall back to color.gradient for legacy blocks that haven't migrated\n\t// to background.gradient yet (mirrors block inspector fallback in\n\t// packages/block-editor/src/hooks/background.jsx).\n\tconst currentGradient = decodeValue(\n\t\tvalue?.background?.gradient ?? value?.color?.gradient\n\t);\n\tconst inheritedGradient = decodeValue(\n\t\tinheritedValue?.background?.gradient ?? inheritedValue?.color?.gradient\n\t);\n\n\t// Set gradient value, encoding preset matches as slug references.\n\t// Also clear color.gradient to migrate from the legacy location,\n\t// matching the block inspector behavior in hooks/background.jsx.\n\tconst setGradient = ( newGradient, newSlug ) => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient, newSlug )\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\tconst inheritanceProps = ( isInherited, hasLocalOverride, classNames ) =>\n\t\tshowInheritanceLabelIndicators\n\t\t\t? getInheritanceProps( isInherited, hasLocalOverride, classNames )\n\t\t\t: { className: classNames };\n\n\t// The inherited value arrives already resolved (refs + theme-file pointers)\n\t// with non-cascading root values dropped, so a presence check drives the\n\t// label affordance and matches what `BackgroundImageControl` renders.\n\tconst inheritedBackgroundImage = hasBackgroundImageValue( {\n\t\tbackground: {\n\t\t\tbackgroundImage: inheritedValue?.background?.backgroundImage,\n\t\t},\n\t} );\n\tconst hasLocalBackgroundImage = hasBackgroundImageValue( value );\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\theaderLabel={ headerLabel }\n\t\t>\n\t\t\t{ showBackgroundImageControl && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tinheritedBackgroundImage && ! hasLocalBackgroundImage,\n\t\t\t\t\t\thasLocalBackgroundImage && inheritedBackgroundImage,\n\t\t\t\t\t\t'block-editor-color-gradient-item'\n\t\t\t\t\t) }\n\t\t\t\t\tshowLocalOverrideActionsInLabel={ false }\n\t\t\t\t\thasValue={ () => hasBackgroundImageValue( value ) }\n\t\t\t\t\tlabel={ __( 'Image' ) }\n\t\t\t\t\tonDeselect={ resetBackground }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundImage }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BackgroundImageControl\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tinheritedValue={ inheritedValue }\n\t\t\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBackgroundColorControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundColorValue( value ) }\n\t\t\t\t\tresetValue={ resetBackgroundColor }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundColor }\n\t\t\t\t\tindicators={ [ userBackgroundColor ?? backgroundColor ] }\n\t\t\t\t\tcontrastWarning={ contrastWarning }\n\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t}\n\t\t\t\t\tisPlaceholder={\n\t\t\t\t\t\tuserBackgroundColor === undefined &&\n\t\t\t\t\t\tbackgroundColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\thasInheritedValue={ backgroundColor !== undefined }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'background',\n\t\t\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t\t\t\tinheritedValue: backgroundColor,\n\t\t\t\t\t\t\t// The picker selects by slug: `userSlug` when the\n\t\t\t\t\t\t\t// block has its own value, otherwise\n\t\t\t\t\t\t\t// `inheritedSlug`. Hex matching would mark two\n\t\t\t\t\t\t\t// same-hex presets as both selected.\n\t\t\t\t\t\t\tinheritedSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tinheritedValue?.color?.background,\n\t\t\t\t\t\t\t\t'color'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tuserSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tvalue?.color?.background,\n\t\t\t\t\t\t\t\t'color'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsetValue: setBackgroundColor,\n\t\t\t\t\t\t\tuserValue: userBackgroundColor,\n\t\t\t\t\t\t\tisPlaceholder:\n\t\t\t\t\t\t\t\tuserBackgroundColor === undefined &&\n\t\t\t\t\t\t\t\tbackgroundColor !== undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tdisableCustomColors: ! areCustomSolidsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showBackgroundGradientControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [ currentGradient ?? inheritedGradient ] }\n\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t}\n\t\t\t\t\tisPlaceholder={\n\t\t\t\t\t\tcurrentGradient === undefined &&\n\t\t\t\t\t\tinheritedGradient !== undefined\n\t\t\t\t\t}\n\t\t\t\t\thasInheritedValue={ inheritedGradient !== undefined }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue: inheritedGradient,\n\t\t\t\t\t\t\tinheritedSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tinheritedValue?.background?.gradient ??\n\t\t\t\t\t\t\t\t\tinheritedValue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tuserSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tvalue?.background?.gradient ??\n\t\t\t\t\t\t\t\t\tvalue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsetValue: setGradient,\n\t\t\t\t\t\t\tuserValue: currentGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t\tisPlaceholder:\n\t\t\t\t\t\t\t\tcurrentGradient === undefined &&\n\t\t\t\t\t\t\t\tinheritedGradient !== undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showLegacyColorGradientControl && (\n\t\t\t\t<ColorGradientDropdownItem\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasLegacyColorGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetLegacyColorGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [\n\t\t\t\t\t\tuserLegacyColorGradient ?? legacyColorGradient,\n\t\t\t\t\t] }\n\t\t\t\t\tshowInheritanceLabelIndicators={\n\t\t\t\t\t\tshowInheritanceLabelIndicators\n\t\t\t\t\t}\n\t\t\t\t\tisPlaceholder={\n\t\t\t\t\t\tuserLegacyColorGradient === undefined &&\n\t\t\t\t\t\tlegacyColorGradient !== undefined\n\t\t\t\t\t}\n\t\t\t\t\thasInheritedValue={ legacyColorGradient !== undefined }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue: legacyColorGradient,\n\t\t\t\t\t\t\tinheritedSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tinheritedValue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tuserSlug: extractPresetSlug(\n\t\t\t\t\t\t\t\tvalue?.color?.gradient,\n\t\t\t\t\t\t\t\t'gradient'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tsetValue: setLegacyColorGradient,\n\t\t\t\t\t\t\tuserValue: userLegacyColorGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t\tisPlaceholder:\n\t\t\t\t\t\t\t\tuserLegacyColorGradient === undefined &&\n\t\t\t\t\t\t\t\tlegacyColorGradient !== undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAuD;AACvD,qBAA4B;AAC5B,kBAAmB;AACnB,sCAAmC;AACnC,0CAAsC;AACtC,yBAA2C;AAC3C,mBAAyC;AACzC,mBAA+C;AAC/C,oBAA6B;AAC7B,0BAGO;AACP,yBAIO;AAkIJ;AAhIH,IAAM,mBAAmB;AAAA,EACxB,iBAAiB;AAAA,EACjB,iBAAiB;AA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+B;AAAA,cAC9B;AAAA,cACA,wBAAwB,CAAE;AAAA,YAC3B;AAAA,YACA;AAAA;AAAA,QACD;AAAA,QAEC,kCACD;AAAA,UAAC,oCAAAA;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,UAAW;AAAA,YACvB,UAAW,MAAM,4BAA6B,KAAM;AAAA,YACpD,YAAa;AAAA,YACb,kBAAmB,gBAAgB;AAAA,YACnC,YAAa;AAAA,cACZ,2BAA2B;AAAA,YAC5B;AAAA,YACA;AAAA,YAGA,eACC,4BAA4B,UAC5B,wBAAwB;AAAA,YAEzB,mBAAoB,wBAAwB;AAAA,YAC5C,MAAO;AAAA,cACN;AAAA,gBACC,KAAK;AAAA,gBACL,WAAO,gBAAI,UAAW;AAAA,gBACtB,gBAAgB;AAAA,gBAChB,mBAAe;AAAA,kBACd,gBAAgB,OAAO;AAAA,kBACvB;AAAA,gBACD;AAAA,gBACA,cAAU;AAAA,kBACT,OAAO,OAAO;AAAA,kBACd;AAAA,gBACD;AAAA,gBACA,UAAU;AAAA,gBACV,WAAW;AAAA,gBACX,YAAY;AAAA,gBACZ,eACC,4BAA4B,UAC5B,wBAAwB;AAAA,cAC1B;AAAA,YACD;AAAA,YACA,8BAA+B;AAAA,cAC9B;AAAA,cACA,wBAAwB,CAAE;AAAA,YAC3B;AAAA,YACA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
6
6
  "names": ["ToolsPanel", "BackgroundImageControl", "ColorGradientDropdownItem"]
7
7
  }
@@ -114,7 +114,7 @@ function BorderPanel({
114
114
  settings,
115
115
  panelId,
116
116
  defaultControls = DEFAULT_CONTROLS,
117
- showInheritanceLabelIndicators = (0, import_inheritance.isGlobalStylesInheritanceEnabled)()
117
+ showInheritanceLabelIndicators = (0, import_inheritance.isGlobalStylesInheritanceIndicatorUIEnabled)()
118
118
  }) {
119
119
  const colors = (0, import_hooks.useColorsPerOrigin)(settings);
120
120
  const areCustomSolidsEnabled = settings?.color?.custom;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/global-styles/border-panel.jsx"],
4
- "sourcesContent": ["import {\n\tBorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\tBaseControl,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport { ShadowPopover, useShadowPresets } from './shadow-panel-components';\nimport {\n\tgetInheritanceProps,\n\tInheritanceToolsPanelItem,\n\tisGlobalStylesInheritanceEnabled,\n} from './inheritance';\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = Object.values( useHasBorderPanelControls( settings ) );\n\treturn controls.some( Boolean );\n}\n\nexport function useHasBorderPanelControls( settings ) {\n\tconst controls = {\n\t\thasBorderColor: useHasBorderColorControl( settings ),\n\t\thasBorderRadius: useHasBorderRadiusControl( settings ),\n\t\thasBorderStyle: useHasBorderStyleControl( settings ),\n\t\thasBorderWidth: useHasBorderWidthControl( settings ),\n\t\thasShadow: useHasShadowControl( settings ),\n\t};\n\n\treturn controls;\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 useHasShadowControl( settings ) {\n\tconst shadows = useShadowPresets( settings );\n\treturn !! settings?.shadow && shadows.length > 0;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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={ label }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\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\tshadow: 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\tshowInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled(),\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst areCustomSolidsEnabled = settings?.color?.custom;\n\tconst decodeValue = useCallback(\n\t\t( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),\n\t\t[ settings ]\n\t);\n\t// Always keep the layout className (e.g. `single-column`); only the\n\t// inheritance treatment is gated on `showInheritanceLabelIndicators`.\n\tconst inheritanceProps = ( isInherited, hasLocalOverride, className ) =>\n\t\tgetInheritanceProps(\n\t\t\tshowInheritanceLabelIndicators && isInherited,\n\t\t\tshowInheritanceLabelIndicators && hasLocalOverride,\n\t\t\tclassName\n\t\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\t// Decode a `border` sub-tree (handles split borders + flat shape).\n\tconst decodeBorder = useCallback(\n\t\t( source ) => {\n\t\t\tif ( ! source ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( hasSplitBorders( source ) ) {\n\t\t\t\tconst out = { ...source };\n\t\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\t\tout[ side ] = {\n\t\t\t\t\t\t...out[ side ],\n\t\t\t\t\t\tcolor: decodeValue( out[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t} );\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...source,\n\t\t\t\tcolor: source.color ? decodeValue( source.color ) : undefined,\n\t\t\t};\n\t\t},\n\t\t[ decodeValue ]\n\t);\n\t// Local-then-inherited: prefer the user's locally-set border (whether\n\t// flat or split) when defined, otherwise fall back to the inherited\n\t// Global Styles border. The merge happens at the sub-tree root, not\n\t// at the leaf level — borders are commonly authored as a single\n\t// affordance in the inspector, so partial leaf merges would be\n\t// surprising.\n\tconst localBorder = useMemo(\n\t\t() => decodeBorder( value?.border ),\n\t\t[ value?.border, decodeBorder ]\n\t);\n\tconst inheritedBorder = useMemo(\n\t\t() => decodeBorder( inheritedValue?.border ),\n\t\t[ inheritedValue?.border, decodeBorder ]\n\t);\n\tconst isBorderPlaceholder =\n\t\t! isDefinedBorder( value?.border ) &&\n\t\t!! inheritedBorder &&\n\t\tisDefinedBorder( inheritedBorder );\n\tconst border = isBorderPlaceholder ? inheritedBorder : localBorder;\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. Display inherited values through the control's `values`\n\t// prop when local values are empty so UnitControl can parse the numeric\n\t// quantity and selected unit normally (e.g. `2.5em` -> `2.5` + `em`).\n\t// `hasBorderRadius` remains local-only, so displaying the inherited value\n\t// does not mark the ToolsPanel item as customised or commit on mount.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst localBorderRadius = useMemo( () => {\n\t\tif ( typeof value?.border?.radius !== 'object' ) {\n\t\t\treturn decodeValue( value?.border?.radius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( value?.border?.radius?.topLeft ),\n\t\t\ttopRight: decodeValue( value?.border?.radius?.topRight ),\n\t\t\tbottomLeft: decodeValue( value?.border?.radius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( value?.border?.radius?.bottomRight ),\n\t\t};\n\t}, [ value?.border?.radius, decodeValue ] );\n\tconst inheritedBorderRadius = useMemo( () => {\n\t\tconst rawRadius = inheritedValue?.border?.radius;\n\t\tif ( typeof rawRadius !== 'object' ) {\n\t\t\treturn decodeValue( rawRadius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( rawRadius?.topLeft ),\n\t\t\ttopRight: decodeValue( rawRadius?.topRight ),\n\t\t\tbottomLeft: decodeValue( rawRadius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( rawRadius?.bottomRight ),\n\t\t};\n\t}, [ inheritedValue?.border?.radius, decodeValue ] );\n\t// Spread the local border, not the merged display value, or setting a\n\t// radius bakes the inherited border into the local override. Mirror of\n\t// the guard in `onBorderChange`.\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...value?.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( ( [ , v ] ) => !! v );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\tconst isBorderRadiusPlaceholder =\n\t\t! hasBorderRadius() &&\n\t\tinheritedBorderRadius !== undefined &&\n\t\tinheritedBorderRadius !== '';\n\t// Build an object value so unlinked-mode shows per-corner inherited\n\t// values. The control accepts either a string or an object; passing the\n\t// object form is correct in both modes (the control collapses to the\n\t// `all`/first corner in linked mode).\n\tconst borderRadius = useMemo( () => {\n\t\tif ( ! isBorderRadiusPlaceholder ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tif ( typeof inheritedBorderRadius === 'string' ) {\n\t\t\treturn inheritedBorderRadius;\n\t\t}\n\t\tconst obj = inheritedBorderRadius;\n\t\tif ( ! obj ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tconst all =\n\t\t\tobj.topLeft &&\n\t\t\tobj.topLeft === obj.topRight &&\n\t\t\tobj.topLeft === obj.bottomLeft &&\n\t\t\tobj.topLeft === obj.bottomRight\n\t\t\t\t? obj.topLeft\n\t\t\t\t: undefined;\n\t\treturn { all, ...obj };\n\t}, [\n\t\tisBorderRadiusPlaceholder,\n\t\tlocalBorderRadius,\n\t\tinheritedBorderRadius,\n\t] );\n\tconst hasShadowControl = useHasShadowControl( settings );\n\n\t// Shadow. At rest, the popover toggle button uses the placeholder\n\t// treatment, and the popover preset list pre-selects the inherited shadow.\n\t// The interceptor below recognises the user's \"accept inherited\" click as\n\t// an explicit commit, mirroring the ToggleGroup pattern in the typography\n\t// panel.\n\tconst localShadow = decodeValue( value?.shadow );\n\tconst inheritedShadow = decodeValue( inheritedValue?.shadow );\n\tconst isShadowPlaceholder =\n\t\tlocalShadow === undefined &&\n\t\tinheritedShadow !== undefined &&\n\t\tinheritedShadow !== '';\n\tconst shadow = isShadowPlaceholder ? inheritedShadow : localShadow;\n\t// The presets the popover offers, from every origin. A preset the user\n\t// picked has to be stored as a reference to its CSS variable rather than as\n\t// the value it resolves to today, otherwise it stops tracking later edits\n\t// to the preset. Reading the same list the popover renders is what keeps\n\t// the two in step.\n\tconst shadowPresets = useShadowPresets( settings );\n\tconst setShadow = ( newValue ) => {\n\t\t// The list runs default, theme, custom, so searching backwards picks\n\t\t// the most specific origin when more than one defines the same shadow\n\t\t// value — a newly added custom preset starts out identical to the\n\t\t// `natural` default one, and it is the custom slug the user means.\n\t\tconst slug = shadowPresets.findLast(\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\t// Display-without-commit interceptor for the shadow preset list. When the\n\t// user is at the at-rest preselect (local is undefined, inherited is the\n\t// active shadow), `ShadowPresets`' default toggle-off behaviour would\n\t// interpret the click on the highlighted preset as `undefined` (clear).\n\t// Re-route it to an explicit commit of the inherited value, so clicking\n\t// the visible preselected preset is the user's \"accept this inherited\n\t// value\" affordance.\n\tconst setShadowWithInheritedCommit = ( newValue ) => {\n\t\tif ( isShadowPlaceholder && newValue === undefined ) {\n\t\t\tsetShadow( inheritedShadow );\n\t\t\treturn;\n\t\t}\n\t\tsetShadow( newValue );\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\t// A local override exists when the user has set a shadow that shadows an\n\t// inherited one. Only then does the toggle render the blue-dot reset\n\t// affordance (mirroring the color/gradient controls); a merely-inherited\n\t// value at rest shows no reset button.\n\tconst hasShadowLocalOverride =\n\t\tshowInheritanceLabelIndicators &&\n\t\thasShadow() &&\n\t\tinheritedShadow !== undefined;\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. Read from `value` (local-only) rather than\n\t\t// `border` (the merged display value), otherwise an inherited\n\t\t// radius gets baked into the local override every time the\n\t\t// user touches color/style/width — which both pollutes the\n\t\t// stored attribute and causes the radius `ToolsPanelItem` to\n\t\t// flip into the `has-local-override-from-global-styles` state\n\t\t// even though the user never customised the radius. The\n\t\t// `radius` key must come after the spread so it wins over any\n\t\t// `radius` field forwarded by `BorderBoxControl`'s inner\n\t\t// `BorderControl`, which merges its incoming `value` with the\n\t\t// changed prop. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( {\n\t\t\t...updatedBorder,\n\t\t\tradius: value?.border?.radius,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t\tshadow: 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\t// A shadow is treated as a soft border, so the panel keeps one\n\t\t\t// name whichever of its controls a theme or block opts into.\n\t\t\t// A stable title is what lets each control show its own label\n\t\t\t// unconditionally, which in turn keeps their unlink toggles\n\t\t\t// aligned.\n\t\t\tlabel={ __( 'Borders' ) }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderPlaceholder,\n\t\t\t\t\t\tisDefinedBorder( value?.border ) &&\n\t\t\t\t\t\t\t!! inheritedBorder &&\n\t\t\t\t\t\t\tisDefinedBorder( inheritedBorder )\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\thasInlineEndToggle\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{ /* The visible label is always rendered, so the control's\n\t\t\t\t\t linked/unlinked toggle sits in a label row and lines up\n\t\t\t\t\t with the Radius control's. `BorderBoxControl` renders the\n\t\t\t\t\t label as `BaseControl.VisualLabel`, which is what the\n\t\t\t\t\t inheritance treatment and the local-override reset\n\t\t\t\t\t affordance target. */ }\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tlabel={ __( 'Border' ) }\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\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderRadiusPlaceholder,\n\t\t\t\t\t\thasBorderRadius() && inheritedBorderRadius !== undefined\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\thasInlineEndToggle\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\tpresets={ settings?.border?.radiusSizes }\n\t\t\t\t\t\tvalues={ borderRadius }\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</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasShadowControl && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisShadowPlaceholder,\n\t\t\t\t\t\thasShadow() && inheritedShadow !== undefined\n\t\t\t\t\t) }\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\t// The shadow toggle renders its own reset affordance (blue\n\t\t\t\t\t// dot for a local override, default reset otherwise) inside\n\t\t\t\t\t// the control, mirroring the color/gradient controls, so the\n\t\t\t\t\t// panel item must not render a second sibling reset dot.\n\t\t\t\t\tshowLocalOverrideActionsInLabel={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ setShadowWithInheritedCommit }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\thasLocalValue={ hasShadow() }\n\t\t\t\t\t\thasLocalOverride={ hasShadowLocalOverride }\n\t\t\t\t\t\tonReset={ resetShadow }\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
5
- "mappings": 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UAAU,QAAQ;AAAA,gBAC5B,QAAS;AAAA,gBACT,UAAW,CAAE,aAAc;AAC1B,kCAAiB,YAAY,MAAU;AAAA,gBACxC;AAAA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QAEC,oBACD;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,cACJ;AAAA,cACA,UAAU,KAAK,oBAAoB;AAAA,YACpC;AAAA,YACA,WAAQ,gBAAI,QAAS;AAAA,YACrB,UAAW;AAAA,YACX,YAAa;AAAA,YACb,kBAAmB,gBAAgB;AAAA,YAKnC,iCAAkC;AAAA,YAClC;AAAA,YAEA;AAAA,0DAAC,8BAAY,aAAZ,EACE,8BAAI,QAAS,GAChB;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACA;AAAA,kBACA,gBAAiB;AAAA,kBACjB;AAAA,kBACA,eAAgB,UAAU;AAAA,kBAC1B,kBAAmB;AAAA,kBACnB,SAAU;AAAA;AAAA,cACX;AAAA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
4
+ "sourcesContent": ["import {\n\tBorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\tBaseControl,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport { ShadowPopover, useShadowPresets } from './shadow-panel-components';\nimport {\n\tgetInheritanceProps,\n\tInheritanceToolsPanelItem,\n\tisGlobalStylesInheritanceIndicatorUIEnabled,\n} from './inheritance';\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = Object.values( useHasBorderPanelControls( settings ) );\n\treturn controls.some( Boolean );\n}\n\nexport function useHasBorderPanelControls( settings ) {\n\tconst controls = {\n\t\thasBorderColor: useHasBorderColorControl( settings ),\n\t\thasBorderRadius: useHasBorderRadiusControl( settings ),\n\t\thasBorderStyle: useHasBorderStyleControl( settings ),\n\t\thasBorderWidth: useHasBorderWidthControl( settings ),\n\t\thasShadow: useHasShadowControl( settings ),\n\t};\n\n\treturn controls;\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 useHasShadowControl( settings ) {\n\tconst shadows = useShadowPresets( settings );\n\treturn !! settings?.shadow && shadows.length > 0;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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={ label }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\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\tshadow: 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\tshowInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled(),\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst areCustomSolidsEnabled = settings?.color?.custom;\n\tconst decodeValue = useCallback(\n\t\t( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),\n\t\t[ settings ]\n\t);\n\t// Always keep the layout className (e.g. `single-column`); only the\n\t// inheritance treatment is gated on `showInheritanceLabelIndicators`.\n\tconst inheritanceProps = ( isInherited, hasLocalOverride, className ) =>\n\t\tgetInheritanceProps(\n\t\t\tshowInheritanceLabelIndicators && isInherited,\n\t\t\tshowInheritanceLabelIndicators && hasLocalOverride,\n\t\t\tclassName\n\t\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\t// Decode a `border` sub-tree (handles split borders + flat shape).\n\tconst decodeBorder = useCallback(\n\t\t( source ) => {\n\t\t\tif ( ! source ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif ( hasSplitBorders( source ) ) {\n\t\t\t\tconst out = { ...source };\n\t\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\t\tout[ side ] = {\n\t\t\t\t\t\t...out[ side ],\n\t\t\t\t\t\tcolor: decodeValue( out[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t} );\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...source,\n\t\t\t\tcolor: source.color ? decodeValue( source.color ) : undefined,\n\t\t\t};\n\t\t},\n\t\t[ decodeValue ]\n\t);\n\t// Local-then-inherited: prefer the user's locally-set border (whether\n\t// flat or split) when defined, otherwise fall back to the inherited\n\t// Global Styles border. The merge happens at the sub-tree root, not\n\t// at the leaf level — borders are commonly authored as a single\n\t// affordance in the inspector, so partial leaf merges would be\n\t// surprising.\n\tconst localBorder = useMemo(\n\t\t() => decodeBorder( value?.border ),\n\t\t[ value?.border, decodeBorder ]\n\t);\n\tconst inheritedBorder = useMemo(\n\t\t() => decodeBorder( inheritedValue?.border ),\n\t\t[ inheritedValue?.border, decodeBorder ]\n\t);\n\tconst isBorderPlaceholder =\n\t\t! isDefinedBorder( value?.border ) &&\n\t\t!! inheritedBorder &&\n\t\tisDefinedBorder( inheritedBorder );\n\tconst border = isBorderPlaceholder ? inheritedBorder : localBorder;\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. Display inherited values through the control's `values`\n\t// prop when local values are empty so UnitControl can parse the numeric\n\t// quantity and selected unit normally (e.g. `2.5em` -> `2.5` + `em`).\n\t// `hasBorderRadius` remains local-only, so displaying the inherited value\n\t// does not mark the ToolsPanel item as customised or commit on mount.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst localBorderRadius = useMemo( () => {\n\t\tif ( typeof value?.border?.radius !== 'object' ) {\n\t\t\treturn decodeValue( value?.border?.radius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( value?.border?.radius?.topLeft ),\n\t\t\ttopRight: decodeValue( value?.border?.radius?.topRight ),\n\t\t\tbottomLeft: decodeValue( value?.border?.radius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( value?.border?.radius?.bottomRight ),\n\t\t};\n\t}, [ value?.border?.radius, decodeValue ] );\n\tconst inheritedBorderRadius = useMemo( () => {\n\t\tconst rawRadius = inheritedValue?.border?.radius;\n\t\tif ( typeof rawRadius !== 'object' ) {\n\t\t\treturn decodeValue( rawRadius );\n\t\t}\n\t\treturn {\n\t\t\ttopLeft: decodeValue( rawRadius?.topLeft ),\n\t\t\ttopRight: decodeValue( rawRadius?.topRight ),\n\t\t\tbottomLeft: decodeValue( rawRadius?.bottomLeft ),\n\t\t\tbottomRight: decodeValue( rawRadius?.bottomRight ),\n\t\t};\n\t}, [ inheritedValue?.border?.radius, decodeValue ] );\n\t// Spread the local border, not the merged display value, or setting a\n\t// radius bakes the inherited border into the local override. Mirror of\n\t// the guard in `onBorderChange`.\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...value?.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( ( [ , v ] ) => !! v );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\tconst isBorderRadiusPlaceholder =\n\t\t! hasBorderRadius() &&\n\t\tinheritedBorderRadius !== undefined &&\n\t\tinheritedBorderRadius !== '';\n\t// Build an object value so unlinked-mode shows per-corner inherited\n\t// values. The control accepts either a string or an object; passing the\n\t// object form is correct in both modes (the control collapses to the\n\t// `all`/first corner in linked mode).\n\tconst borderRadius = useMemo( () => {\n\t\tif ( ! isBorderRadiusPlaceholder ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tif ( typeof inheritedBorderRadius === 'string' ) {\n\t\t\treturn inheritedBorderRadius;\n\t\t}\n\t\tconst obj = inheritedBorderRadius;\n\t\tif ( ! obj ) {\n\t\t\treturn localBorderRadius;\n\t\t}\n\t\tconst all =\n\t\t\tobj.topLeft &&\n\t\t\tobj.topLeft === obj.topRight &&\n\t\t\tobj.topLeft === obj.bottomLeft &&\n\t\t\tobj.topLeft === obj.bottomRight\n\t\t\t\t? obj.topLeft\n\t\t\t\t: undefined;\n\t\treturn { all, ...obj };\n\t}, [\n\t\tisBorderRadiusPlaceholder,\n\t\tlocalBorderRadius,\n\t\tinheritedBorderRadius,\n\t] );\n\tconst hasShadowControl = useHasShadowControl( settings );\n\n\t// Shadow. At rest, the popover toggle button uses the placeholder\n\t// treatment, and the popover preset list pre-selects the inherited shadow.\n\t// The interceptor below recognises the user's \"accept inherited\" click as\n\t// an explicit commit, mirroring the ToggleGroup pattern in the typography\n\t// panel.\n\tconst localShadow = decodeValue( value?.shadow );\n\tconst inheritedShadow = decodeValue( inheritedValue?.shadow );\n\tconst isShadowPlaceholder =\n\t\tlocalShadow === undefined &&\n\t\tinheritedShadow !== undefined &&\n\t\tinheritedShadow !== '';\n\tconst shadow = isShadowPlaceholder ? inheritedShadow : localShadow;\n\t// The presets the popover offers, from every origin. A preset the user\n\t// picked has to be stored as a reference to its CSS variable rather than as\n\t// the value it resolves to today, otherwise it stops tracking later edits\n\t// to the preset. Reading the same list the popover renders is what keeps\n\t// the two in step.\n\tconst shadowPresets = useShadowPresets( settings );\n\tconst setShadow = ( newValue ) => {\n\t\t// The list runs default, theme, custom, so searching backwards picks\n\t\t// the most specific origin when more than one defines the same shadow\n\t\t// value — a newly added custom preset starts out identical to the\n\t\t// `natural` default one, and it is the custom slug the user means.\n\t\tconst slug = shadowPresets.findLast(\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\t// Display-without-commit interceptor for the shadow preset list. When the\n\t// user is at the at-rest preselect (local is undefined, inherited is the\n\t// active shadow), `ShadowPresets`' default toggle-off behaviour would\n\t// interpret the click on the highlighted preset as `undefined` (clear).\n\t// Re-route it to an explicit commit of the inherited value, so clicking\n\t// the visible preselected preset is the user's \"accept this inherited\n\t// value\" affordance.\n\tconst setShadowWithInheritedCommit = ( newValue ) => {\n\t\tif ( isShadowPlaceholder && newValue === undefined ) {\n\t\t\tsetShadow( inheritedShadow );\n\t\t\treturn;\n\t\t}\n\t\tsetShadow( newValue );\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\t// A local override exists when the user has set a shadow that shadows an\n\t// inherited one. Only then does the toggle render the blue-dot reset\n\t// affordance (mirroring the color/gradient controls); a merely-inherited\n\t// value at rest shows no reset button.\n\tconst hasShadowLocalOverride =\n\t\tshowInheritanceLabelIndicators &&\n\t\thasShadow() &&\n\t\tinheritedShadow !== undefined;\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. Read from `value` (local-only) rather than\n\t\t// `border` (the merged display value), otherwise an inherited\n\t\t// radius gets baked into the local override every time the\n\t\t// user touches color/style/width — which both pollutes the\n\t\t// stored attribute and causes the radius `ToolsPanelItem` to\n\t\t// flip into the `has-local-override-from-global-styles` state\n\t\t// even though the user never customised the radius. The\n\t\t// `radius` key must come after the spread so it wins over any\n\t\t// `radius` field forwarded by `BorderBoxControl`'s inner\n\t\t// `BorderControl`, which merges its incoming `value` with the\n\t\t// changed prop. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( {\n\t\t\t...updatedBorder,\n\t\t\tradius: value?.border?.radius,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t\tshadow: 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\t// A shadow is treated as a soft border, so the panel keeps one\n\t\t\t// name whichever of its controls a theme or block opts into.\n\t\t\t// A stable title is what lets each control show its own label\n\t\t\t// unconditionally, which in turn keeps their unlink toggles\n\t\t\t// aligned.\n\t\t\tlabel={ __( 'Borders' ) }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderPlaceholder,\n\t\t\t\t\t\tisDefinedBorder( value?.border ) &&\n\t\t\t\t\t\t\t!! inheritedBorder &&\n\t\t\t\t\t\t\tisDefinedBorder( inheritedBorder )\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\thasInlineEndToggle\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{ /* The visible label is always rendered, so the control's\n\t\t\t\t\t linked/unlinked toggle sits in a label row and lines up\n\t\t\t\t\t with the Radius control's. `BorderBoxControl` renders the\n\t\t\t\t\t label as `BaseControl.VisualLabel`, which is what the\n\t\t\t\t\t inheritance treatment and the local-override reset\n\t\t\t\t\t affordance target. */ }\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tlabel={ __( 'Border' ) }\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\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisBorderRadiusPlaceholder,\n\t\t\t\t\t\thasBorderRadius() && inheritedBorderRadius !== undefined\n\t\t\t\t\t) }\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\thasInlineEndToggle\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\tpresets={ settings?.border?.radiusSizes }\n\t\t\t\t\t\tvalues={ borderRadius }\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</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasShadowControl && (\n\t\t\t\t<InheritanceToolsPanelItem\n\t\t\t\t\t{ ...inheritanceProps(\n\t\t\t\t\t\tisShadowPlaceholder,\n\t\t\t\t\t\thasShadow() && inheritedShadow !== undefined\n\t\t\t\t\t) }\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\t// The shadow toggle renders its own reset affordance (blue\n\t\t\t\t\t// dot for a local override, default reset otherwise) inside\n\t\t\t\t\t// the control, mirroring the color/gradient controls, so the\n\t\t\t\t\t// panel item must not render a second sibling reset dot.\n\t\t\t\t\tshowLocalOverrideActionsInLabel={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\n\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ setShadowWithInheritedCommit }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\thasLocalValue={ hasShadow() }\n\t\t\t\t\t\thasLocalOverride={ hasShadowLocalOverride }\n\t\t\t\t\t\tonReset={ resetShadow }\n\t\t\t\t\t/>\n\t\t\t\t</InheritanceToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAMO;AACP,qBAAqC;AACrC,kBAAmB;AACnB,kCAAqC;AACrC,mCAAgC;AAChC,mBAAmC;AACnC,mBAA+C;AAC/C,oBAA6B;AAC7B,qCAAgD;AAChD,yBAIO;AAuDL;AArDK,SAAS,kBAAmB,UAAW;AAC7C,QAAM,WAAW,OAAO,OAAQ,0BAA2B,QAAS,CAAE;AACtE,SAAO,SAAS,KAAM,OAAQ;AAC/B;AAEO,SAAS,0BAA2B,UAAW;AACrD,QAAM,WAAW;AAAA,IAChB,gBAAgB,yBAA0B,QAAS;AAAA,IACnD,iBAAiB,0BAA2B,QAAS;AAAA,IACrD,gBAAgB,yBAA0B,QAAS;AAAA,IACnD,gBAAgB,yBAA0B,QAAS;AAAA,IACnD,WAAW,oBAAqB,QAAS;AAAA,EAC1C;AAEA,SAAO;AACR;AAEA,SAAS,yBAA0B,UAAW;AAC7C,SAAO,UAAU,Q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,EAEF;AAEF;",
6
6
  "names": ["ToolsPanel", "hasSplitBorders", "isDefinedBorder", "BorderRadiusControl"]
7
7
  }
@@ -153,7 +153,7 @@ function ColorGradientDropdownItem({
153
153
  className = "block-editor-tools-panel-color-gradient-settings__item",
154
154
  isPlaceholder = false,
155
155
  hasInheritedValue = false,
156
- showInheritanceLabelIndicators = (0, import_inheritance.isGlobalStylesInheritanceEnabled)()
156
+ showInheritanceLabelIndicators = (0, import_inheritance.isGlobalStylesInheritanceIndicatorUIEnabled)()
157
157
  }) {
158
158
  const colorGradientDropdownButtonRef = (0, import_element.useRef)(void 0);
159
159
  const itemClassName = (0, import_clsx.default)("block-editor-color-gradient-item", className);