@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/with-colors.jsx"],
4
- "sourcesContent": ["import { useMemo, useRef } from '@wordpress/element';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\nimport { kebabCase } from '@wordpress/kebab-case';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetMostReadableColor,\n} from './utils';\nimport { useSettings } from '../use-settings';\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 factory for injecting the `colorsArray` argument as\n * the colors prop in the `withCustomColors` HOC.\n *\n * @param {Array} colorsArray An array of color objects.\n *\n * @return {Function} The higher order component.\n */\nconst withCustomColorPalette = ( colorsArray ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) =>\n\t\t\tfunction WithCustomColorPalette( props ) {\n\t\t\t\treturn <WrappedComponent { ...props } colors={ colorsArray } />;\n\t\t\t},\n\t\t'withCustomColorPalette'\n\t);\n\n/**\n * Higher order component factory for injecting the editor colors as the\n * `colors` prop in the `withColors` HOC.\n *\n * @return {Function} The higher order component.\n */\nconst withEditorColorPalette = () =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) =>\n\t\t\tfunction WithEditorColorPalette( props ) {\n\t\t\t\tconst [ userPalette, themePalette, defaultPalette ] =\n\t\t\t\t\tuseSettings(\n\t\t\t\t\t\t'color.palette.custom',\n\t\t\t\t\t\t'color.palette.theme',\n\t\t\t\t\t\t'color.palette.default'\n\t\t\t\t\t);\n\t\t\t\tconst allColors = useMemo(\n\t\t\t\t\t() => [\n\t\t\t\t\t\t...( userPalette || [] ),\n\t\t\t\t\t\t...( themePalette || [] ),\n\t\t\t\t\t\t...( defaultPalette || [] ),\n\t\t\t\t\t],\n\t\t\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t\t\t);\n\t\t\t\treturn <WrappedComponent { ...props } colors={ allColors } />;\n\t\t\t},\n\t\t'withEditorColorPalette'\n\t);\n\n/**\n * Helper function used with `createHigherOrderComponent` to create\n * higher order components for managing color logic.\n *\n * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).\n * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.\n *\n * @return {Component} The component that can be used as a HOC.\n */\nfunction createColorHOC( colorTypes, withColorPalette ) {\n\tconst colorMap = colorTypes.reduce( ( colorObject, colorType ) => {\n\t\treturn {\n\t\t\t...colorObject,\n\t\t\t...( typeof colorType === 'string'\n\t\t\t\t? { [ colorType ]: kebabCase( colorType ) }\n\t\t\t\t: colorType ),\n\t\t};\n\t}, {} );\n\n\treturn compose( [\n\t\twithColorPalette,\n\t\t( WrappedComponent ) => {\n\t\t\treturn function WithColors( props ) {\n\t\t\t\tconst { colors: _colors, ...passedProps } = props;\n\t\t\t\tconst { attributes, setAttributes } = passedProps;\n\t\t\t\tconst prevColorPropsRef = useRef( null );\n\n\t\t\t\tconst colorProps = useMemo( () => {\n\t\t\t\t\tconst prevColorProps = prevColorPropsRef.current;\n\n\t\t\t\t\tconst result = Object.fromEntries(\n\t\t\t\t\t\tObject.entries( colorMap ).flatMap(\n\t\t\t\t\t\t\t( [ colorAttributeName, colorContext ] ) => {\n\t\t\t\t\t\t\t\tconst customAttr = `custom${ upperFirst(\n\t\t\t\t\t\t\t\t\tcolorAttributeName\n\t\t\t\t\t\t\t\t) }`;\n\t\t\t\t\t\t\t\tconst upperFirstColorAttributeName =\n\t\t\t\t\t\t\t\t\tupperFirst( colorAttributeName );\n\n\t\t\t\t\t\t\t\tconst colorObject =\n\t\t\t\t\t\t\t\t\tgetColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\t\t_colors,\n\t\t\t\t\t\t\t\t\t\tattributes[ colorAttributeName ],\n\t\t\t\t\t\t\t\t\t\tattributes[ customAttr ]\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst prevColorValue =\n\t\t\t\t\t\t\t\t\tprevColorProps?.[ colorAttributeName ];\n\t\t\t\t\t\t\t\tconst colorValue =\n\t\t\t\t\t\t\t\t\tprevColorValue?.color ===\n\t\t\t\t\t\t\t\t\t\tcolorObject.color && prevColorValue\n\t\t\t\t\t\t\t\t\t\t? prevColorValue\n\t\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\t...colorObject,\n\t\t\t\t\t\t\t\t\t\t\t\tclass: getColorClassName(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorContext,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorObject.slug\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t };\n\n\t\t\t\t\t\t\t\tconst setter = ( newColorValue ) => {\n\t\t\t\t\t\t\t\t\tconst resolvedColorObject =\n\t\t\t\t\t\t\t\t\t\tgetColorObjectByColorValue(\n\t\t\t\t\t\t\t\t\t\t\t_colors,\n\t\t\t\t\t\t\t\t\t\t\tnewColorValue\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t[ colorAttributeName ]:\n\t\t\t\t\t\t\t\t\t\t\tresolvedColorObject?.slug ||\n\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t[ customAttr ]:\n\t\t\t\t\t\t\t\t\t\t\tresolvedColorObject?.slug\n\t\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t\t: newColorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t[ colorAttributeName, colorValue ],\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t`set${ upperFirstColorAttributeName }`,\n\t\t\t\t\t\t\t\t\t\tsetter,\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\n\t\t\t\t\tprevColorPropsRef.current = result;\n\t\t\t\t\treturn result;\n\t\t\t\t}, [ attributes, _colors, setAttributes ] );\n\n\t\t\t\tconst colorUtils = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\tgetMostReadableColor: ( colorValue ) =>\n\t\t\t\t\t\t\tgetMostReadableColor( _colors, colorValue ),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ _colors ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t...passedProps,\n\t\t\t\t\t\t\t...colorProps,\n\t\t\t\t\t\t\tcolorUtils,\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] );\n}\n\n/**\n * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic\n * for class generation color value, retrieval and color attribute setting.\n *\n * Use this higher-order component to work with a custom set of colors.\n *\n * @example\n *\n * ```jsx\n * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];\n * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );\n * // ...\n * export default compose(\n * withCustomColors( 'backgroundColor', 'borderColor' ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ).\n *\n * @return {Function} Higher-order component.\n */\nexport function createCustomColorsHOC( colorsArray ) {\n\treturn ( ...colorTypes ) => {\n\t\tconst withColorPalette = withCustomColorPalette( colorsArray );\n\t\treturn createHigherOrderComponent(\n\t\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t\t'withCustomColors'\n\t\t);\n\t};\n}\n\n/**\n * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting.\n *\n * For use with the default editor/theme color palette.\n *\n * @example\n *\n * ```jsx\n * export default compose(\n * withColors( 'backgroundColor', { textColor: 'color' } ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object,\n * it should contain the color attribute name as key and the color context as value.\n * If the argument is a string the value should be the color attribute name,\n * the color context is computed by applying a kebab case transform to the value.\n * Color context represents the context/place where the color is going to be used.\n * The class name of the color is generated using 'has' followed by the color name\n * and ending with the color context all in kebab case e.g: has-green-background-color.\n *\n * @return {Function} Higher-order component.\n */\nexport default function withColors( ...colorTypes ) {\n\tconst withColorPalette = withEditorColorPalette();\n\treturn createHigherOrderComponent(\n\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t'withColors'\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,SAAS,cAAc;AAChC,SAAS,SAAS,kCAAkC;AACpD,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,mBAAmB;AAwBjB;AAfX,IAAM,aAAa,CAAE,CAAE,aAAgB,OAAK,MAC3C,YAAY,YAAY,IAAI,KAAK,KAAM,EAAG;AAU3C,IAAM,yBAAyB,CAAE,gBAChC;AAAA,EACC,CAAE,qBACD,SAAS,uBAAwB,OAAQ;AACxC,WAAO,oBAAC,oBAAmB,GAAG,OAAQ,QAAS,aAAc;AAAA,EAC9D;AAAA,EACD;AACD;AAQD,IAAM,yBAAyB,MAC9B;AAAA,EACC,CAAE,qBACD,SAAS,uBAAwB,OAAQ;AACxC,UAAM,CAAE,aAAa,cAAc,cAAe,IACjD;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,IACD;AACD,UAAM,YAAY;AAAA,MACjB,MAAM;AAAA,QACL,GAAK,eAAe,CAAC;AAAA,QACrB,GAAK,gBAAgB,CAAC;AAAA,QACtB,GAAK,kBAAkB,CAAC;AAAA,MACzB;AAAA,MACA,CAAE,aAAa,cAAc,cAAe;AAAA,IAC7C;AACA,WAAO,oBAAC,oBAAmB,GAAG,OAAQ,QAAS,WAAY;AAAA,EAC5D;AAAA,EACD;AACD;AAWD,SAAS,eAAgB,YAAY,kBAAmB;AACvD,QAAM,WAAW,WAAW,OAAQ,CAAE,aAAa,cAAe;AACjE,WAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAK,OAAO,cAAc,WACvB,EA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AAU;AAC5B,iBAAO;AAAA,QACR,GAAG,CAAE,YAAY,SAAS,aAAc,CAAE;AAE1C,cAAM,aAAa;AAAA,UAClB,OAAQ;AAAA,YACP,sBAAsB,CAAE,eACvB,qBAAsB,SAAS,UAAW;AAAA,UAC5C;AAAA,UACA,CAAE,OAAQ;AAAA,QACX;AAEA,eACC;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,cACJ,GAAG;AAAA,cACH,GAAG;AAAA,cACH;AAAA,YACD;AAAA;AAAA,QACD;AAAA,MAEF;AAAA,IACD;AAAA,EACD,CAAE;AACH;AAwBO,SAAS,sBAAuB,aAAc;AACpD,SAAO,IAAK,eAAgB;AAC3B,UAAM,mBAAmB,uBAAwB,WAAY;AAC7D,WAAO;AAAA,MACN,eAAgB,YAAY,gBAAiB;AAAA,MAC7C;AAAA,IACD;AAAA,EACD;AACD;AA0Be,SAAR,cAAgC,YAAa;AACnD,QAAM,mBAAmB,uBAAuB;AAChD,SAAO;AAAA,IACN,eAAgB,YAAY,gBAAiB;AAAA,IAC7C;AAAA,EACD;AACD;",
4
+ "sourcesContent": ["import { useMemo, useRef } from '@wordpress/element';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\nimport { kebabCase } from '@wordpress/kebab-case';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetMostReadableColor,\n} from './utils';\nimport { useSettings } from '../use-settings';\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 factory for injecting the `colorsArray` argument as\n * the colors prop in the `withCustomColors` HOC.\n *\n * @param {Array} colorsArray An array of color objects.\n *\n * @return {Function} The higher order component.\n */\nconst withCustomColorPalette = ( colorsArray ) =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) =>\n\t\t\tfunction WithCustomColorPalette( props ) {\n\t\t\t\treturn <WrappedComponent { ...props } colors={ colorsArray } />;\n\t\t\t},\n\t\t'withCustomColorPalette'\n\t);\n\n/**\n * Higher order component factory for injecting the editor colors as the\n * `colors` prop in the `withColors` HOC.\n *\n * @return {Function} The higher order component.\n */\nconst withEditorColorPalette = () =>\n\tcreateHigherOrderComponent(\n\t\t( WrappedComponent ) =>\n\t\t\tfunction WithEditorColorPalette( props ) {\n\t\t\t\tconst [ userPalette, themePalette, defaultPalette ] =\n\t\t\t\t\tuseSettings(\n\t\t\t\t\t\t'color.palette.custom',\n\t\t\t\t\t\t'color.palette.theme',\n\t\t\t\t\t\t'color.palette.default'\n\t\t\t\t\t);\n\t\t\t\tconst allColors = useMemo(\n\t\t\t\t\t() => [\n\t\t\t\t\t\t...( userPalette || [] ),\n\t\t\t\t\t\t...( themePalette || [] ),\n\t\t\t\t\t\t...( defaultPalette || [] ),\n\t\t\t\t\t],\n\t\t\t\t\t[ userPalette, themePalette, defaultPalette ]\n\t\t\t\t);\n\t\t\t\treturn <WrappedComponent { ...props } colors={ allColors } />;\n\t\t\t},\n\t\t'withEditorColorPalette'\n\t);\n\n/**\n * Helper function used with `createHigherOrderComponent` to create\n * higher order components for managing color logic.\n *\n * @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).\n * @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.\n *\n * @return {Component} The component that can be used as a HOC.\n */\nfunction createColorHOC( colorTypes, withColorPalette ) {\n\tconst colorMap = colorTypes.reduce( ( colorObject, colorType ) => {\n\t\treturn {\n\t\t\t...colorObject,\n\t\t\t...( typeof colorType === 'string'\n\t\t\t\t? { [ colorType ]: kebabCase( colorType ) }\n\t\t\t\t: colorType ),\n\t\t};\n\t}, {} );\n\n\treturn compose( [\n\t\twithColorPalette,\n\t\t( WrappedComponent ) => {\n\t\t\treturn function WithColors( props ) {\n\t\t\t\tconst { colors: _colors, ...passedProps } = props;\n\t\t\t\tconst { attributes, setAttributes } = passedProps;\n\t\t\t\tconst prevColorPropsRef = useRef( null );\n\n\t\t\t\tconst colorProps = useMemo( () => {\n\t\t\t\t\tconst prevColorProps = prevColorPropsRef.current;\n\n\t\t\t\t\tconst result = Object.fromEntries(\n\t\t\t\t\t\tObject.entries( colorMap ).flatMap(\n\t\t\t\t\t\t\t( [ colorAttributeName, colorContext ] ) => {\n\t\t\t\t\t\t\t\tconst customAttr = `custom${ upperFirst(\n\t\t\t\t\t\t\t\t\tcolorAttributeName\n\t\t\t\t\t\t\t\t) }`;\n\t\t\t\t\t\t\t\tconst upperFirstColorAttributeName =\n\t\t\t\t\t\t\t\t\tupperFirst( colorAttributeName );\n\n\t\t\t\t\t\t\t\tconst colorObject =\n\t\t\t\t\t\t\t\t\tgetColorObjectByAttributeValues(\n\t\t\t\t\t\t\t\t\t\t_colors,\n\t\t\t\t\t\t\t\t\t\tattributes[ colorAttributeName ],\n\t\t\t\t\t\t\t\t\t\tattributes[ customAttr ]\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst prevColorValue =\n\t\t\t\t\t\t\t\t\tprevColorProps?.[ colorAttributeName ];\n\t\t\t\t\t\t\t\tconst colorValue =\n\t\t\t\t\t\t\t\t\tprevColorValue?.color ===\n\t\t\t\t\t\t\t\t\t\tcolorObject.color && prevColorValue\n\t\t\t\t\t\t\t\t\t\t? prevColorValue\n\t\t\t\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\t\t\t\t...colorObject,\n\t\t\t\t\t\t\t\t\t\t\t\tclass: getColorClassName(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorContext,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorObject.slug\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tconst setter = ( newColorValue ) => {\n\t\t\t\t\t\t\t\t\tconst resolvedColorObject =\n\t\t\t\t\t\t\t\t\t\tgetColorObjectByColorValue(\n\t\t\t\t\t\t\t\t\t\t\t_colors,\n\t\t\t\t\t\t\t\t\t\t\tnewColorValue\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t[ colorAttributeName ]:\n\t\t\t\t\t\t\t\t\t\t\tresolvedColorObject?.slug ||\n\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t[ customAttr ]:\n\t\t\t\t\t\t\t\t\t\t\tresolvedColorObject?.slug\n\t\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t\t: newColorValue,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t\t\t[ colorAttributeName, colorValue ],\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t`set${ upperFirstColorAttributeName }`,\n\t\t\t\t\t\t\t\t\t\tsetter,\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\n\t\t\t\t\tprevColorPropsRef.current = result;\n\t\t\t\t\treturn result;\n\t\t\t\t}, [ attributes, _colors, setAttributes ] );\n\n\t\t\t\tconst colorUtils = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\tgetMostReadableColor: ( colorValue ) =>\n\t\t\t\t\t\t\tgetMostReadableColor( _colors, colorValue ),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ _colors ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<WrappedComponent\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t...passedProps,\n\t\t\t\t\t\t\t...colorProps,\n\t\t\t\t\t\t\tcolorUtils,\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] );\n}\n\n/**\n * A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic\n * for class generation color value, retrieval and color attribute setting.\n *\n * Use this higher-order component to work with a custom set of colors.\n *\n * @example\n *\n * ```jsx\n * const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];\n * const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );\n * // ...\n * export default compose(\n * withCustomColors( 'backgroundColor', 'borderColor' ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {Array} colorsArray The array of color objects (name, slug, color, etc... ).\n *\n * @return {Function} Higher-order component.\n */\nexport function createCustomColorsHOC( colorsArray ) {\n\treturn ( ...colorTypes ) => {\n\t\tconst withColorPalette = withCustomColorPalette( colorsArray );\n\t\treturn createHigherOrderComponent(\n\t\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t\t'withCustomColors'\n\t\t);\n\t};\n}\n\n/**\n * A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting.\n *\n * For use with the default editor/theme color palette.\n *\n * @example\n *\n * ```jsx\n * export default compose(\n * withColors( 'backgroundColor', { textColor: 'color' } ),\n * MyColorfulComponent,\n * );\n * ```\n *\n * @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object,\n * it should contain the color attribute name as key and the color context as value.\n * If the argument is a string the value should be the color attribute name,\n * the color context is computed by applying a kebab case transform to the value.\n * Color context represents the context/place where the color is going to be used.\n * The class name of the color is generated using 'has' followed by the color name\n * and ending with the color context all in kebab case e.g: has-green-background-color.\n *\n * @return {Function} Higher-order component.\n */\nexport default function withColors( ...colorTypes ) {\n\tconst withColorPalette = withEditorColorPalette();\n\treturn createHigherOrderComponent(\n\t\tcreateColorHOC( colorTypes, withColorPalette ),\n\t\t'withColors'\n\t);\n}\n"],
5
+ "mappings": ";AAAA,SAAS,SAAS,cAAc;AAChC,SAAS,SAAS,kC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H;AAAA,YACD;AAAA;AAAA,QACD;AAAA,MAEF;AAAA,IACD;AAAA,EACD,CAAE;AACH;AAwBO,SAAS,sBAAuB,aAAc;AACpD,SAAO,IAAK,eAAgB;AAC3B,UAAM,mBAAmB,uBAAwB,WAAY;AAC7D,WAAO;AAAA,MACN,eAAgB,YAAY,gBAAiB;AAAA,MAC7C;AAAA,IACD;AAAA,EACD;AACD;AA0Be,SAAR,cAAgC,YAAa;AACnD,QAAM,mBAAmB,uBAAuB;AAChD,SAAO;AAAA,IACN,eAAgB,YAAY,gBAAiB;AAAA,IAC7C;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -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,OAAO,UAAU;AACjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AAmDrB,SAsBC,UAtBD,KAsBC,YAtBD;AAjDF,IAAM,EAAE,KAAK,IAAI,OAAQ,qBAAsB;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,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,kBACL,kBACI,UAAU,OAAO,SAAS,KAAO,CAAE;AACxC,QAAM,qBACL,qBACI,aAAa,UAAU,SAAS,KAAO,CAAE;AAE9C,MAAK,CAAE,mBAAmB,CAAE,oBAAqB;AAChD,WAAO;AAAA,EACR;AAEA,QAAM,uBAAuB,qBAC1B,CAAE,UAAU,QAAQ,YAAa;AACjC,kBAAe,UAAU,OAAQ;AACjC,qBAAiB;AAAA,EACjB,IACA,CAAE,UAAU,QAAQ,YAAa,cAAe,UAAU,OAAQ;AAErE,QAAM,eACL;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ;AAAA,MACR,cAAe;AAAA,MACf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GAClB;AAAA,iBACD;AAAA,cACA;AAAA,gBAAC,KAAK;AAAA,gBAAL;AAAA,kBACA,OAAQ,QAAQ;AAAA,kBAChB,WAAU;AAAA,kBACV,WAAY;AAAA,kBAEV,oBAAU;AAAA;AAAA,cACb;AAAA,cACA;AAAA,gBAAC,KAAK;AAAA,gBAAL;AAAA,kBACA,OAAQ,QAAQ;AAAA,kBAChB,WAAU;AAAA,kBACV,WAAY;AAAA,kBAEV,oBAAU;AAAA;AAAA,cACb;AAAA;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,IAAI;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,oBAAC,6BAA4B,GAAG,OAAQ;AAAA,EAChD;AACA,SAAO,oBAAC,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,OAAO,UAAU;AACjB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AAmDrB,SAsBC,UAtBD,KAsBC,YAtBD;AAjDF,IAAM,EAAE,KAAK,IAAI,OAAQ,qBAAsB;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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EACN;AAEF;AAEA,SAAS,qBAAsB,OAAQ;AACtC,MACC,sBAAsB,MAAO,CAAE,QAAS,MAAM,eAAgB,GAAI,CAAE,GACnE;AACD,WAAO,oBAAC,6BAA4B,GAAG,OAAQ;AAAA,EAChD;AACA,SAAO,oBAAC,8BAA6B,GAAG,OAAQ;AACjD;AAEA,IAAO,kBAAQ;",
6
6
  "names": []
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,OAAO,gBAAgB;AACvB,OAAO,iBAAiB;AACxB,SAAS,QAAQ,cAAc;AAC/B,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc;AACvB,SAAS,aAAa;AA4JnB;AA1JH,OAAQ,CAAE,aAAa,UAAW,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,aAAa,GAAI,YAAa;AAAA,IAC/B;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,aAAa,GAAI,YAAa;AAAA,IAC/B;AAAA,EACD;AACA,QAAM,wBAAwB,OAAQ,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,kBAAkB,OAAQ,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,IACpD;AAAA;AAAA,QAEA;AAAA,UACC;AAAA,QACD;AAAA,QACA,KAAK;AAAA,MACL,IACA;AAAA;AAAA,QAEA;AAAA,UACC;AAAA,QACD;AAAA,QACA,KAAK;AAAA,MACL;AACJ,qBAAe;AAAA,QACd;AAAA,MACD;AAGA;AAAA,IACD;AAIA,QAAK,uBAAuB,oBAAqB;AAChD,gBAAU,GAAI,kDAAmD;AACjE,qBAAe;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,QAAO,QAAQ,YAAa;AAE5B,SACC,oBAAC,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,OAAO,gBAAgB;AACvB,OAAO,iBAAiB;AACxB,SAAS,QAAQ,cAAc;AAC/B,SAAS,IAAI,eAAe;AAC5B,SAAS,cAAc;AACvB,SAAS,aAAa;AA4JnB;AA1JH,OAAQ,CAAE,aAAa,UAAW,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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,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,QAAO,QAAQ,YAAa;AAE5B,SACC,oBAAC,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": []
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,SAAS,IAAI,UAAU;AACvB,SAAS,UAAU,qBAAqB;AACxC,SAAS,UAAU,gCAAgC;AACnD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,sBAAsB;AA6B7B,SAK0B,KAL1B;AAzBF,IAAM,cAAc,oBAAI,KAAK;AAC7B,YAAY,QAAS,EAAG;AACxB,YAAY,SAAU,YAAY,SAAS,IAAI,CAAE;AACjD,IAAK,YAAY,SAAS,MAAM,GAAI;AAEnC,cAAY,SAAU,CAAE;AACzB;AAae,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,IAAG;AAAA,MACH,SAAU;AAAA,MACV,WAAU;AAAA,MAEV;AAAA,4BAAC,kBAAe,QAAS,oBAAC,YAAO,GAC9B,aAAI,aAAc,GACrB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,gBAAiB;AAAA,YAC7B,MAAO,GAAI,GAAI,UAAW,CAAE,KAAM;A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AAE,GAAG,kBAAkB,YAAa;AAAA,QAC9C,OACC,WACG,eACA,iBAAiB;AAAA,UACjB,CAAE,WAAY,OAAO,WAAW;AAAA,QAChC,KAAK;AAAA,QAET,UAAW,CAAE,EAAE,aAAa,MAAO;AAClC,cAAK,iBAAiB,cAAe;AACpC,wBAAa,IAAK;AAAA,UACnB,OAAO;AACN,wBAAa,KAAM;AACnB,qBAAU,aAAa,MAAO;AAAA,UAC/B;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACE,YACD;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,eAAgB;AAAA,QAC5B,qBAAmB;AAAA,QACnB,MAAO;AAAA,UACN;AAAA,YACC;AAAA,UACD;AAAA,UACA;AAAA,YACC,MACC;AAAA,cAAC;AAAA;AAAA,gBACA,MAAO;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;",
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( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],
5
+ "mappings": ";AAAA,SAAS,IAAI,UAAU;AACvB,SAAS,UAAU,qBAAqB;AACxC,SAAS,UAAU,gCAAgC;AACnD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,OACM;AACP,SAAS,sBAAsB;AA6B7B,SAK0B,KAL1B;AAzBF,IAAM,cAAc,oBAAI,KAAK;AAC7B,YAAY,QAAS,EAAG;AACxB,YAAY,SAAU,YAAY,SAAS,IAAI,CAAE;AACjD,IAAK,YAAY,SAAS,MAAM,GAAI;AAEnC,cAAY,SAAU,CAAE;AACzB;AAae,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,IAAG;AAAA,MACH,SAAU;AAAA,MACV,WAAU;AAAA,MAEV;AAAA,4BA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UACH,CAAE,iBAAiB,KAAM,CAAE,WAAY,OAAO,WAAW,MAAO;AAAA,EAClE;AAEA,SACC,qBAAC,UACA;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,iBAAkB;AAAA,QAC9B,SAAU,CAAE,GAAG,kBAAkB,YAAa;AAAA,QAC9C,OACC,WACG,eACE,iBAAiB;AAAA,UACnB,CAAE,WAAY,OAAO,WAAW;AAAA,QACjC,KAAK;AAAA,QAER,UAAW,CAAE,EAAE,aAAa,MAAO;AAClC,cAAK,iBAAiB,cAAe;AACpC,wBAAa,IAAK;AAAA,UACnB,OAAO;AACN,wBAAa,KAAM;AACnB,qBAAU,aAAa,MAAO;AAAA,UAC/B;AAAA,QACD;AAAA;AAAA,IACD;AAAA,IACE,YACD;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,GAAI,eAAgB;AAAA,QAC5B,qBAAmB;AAAA,QACnB,MAAO;AAAA,UACN;AAAA,YACC;AAAA,UACD;AAAA,UACA;AAAA,YACC,MACC;AAAA,cAAC;AAAA;AAAA,gBACA,MAAO;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": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  // packages/block-editor/src/components/dimensions-tool/aspect-ratio-tool.jsx
2
- import { SelectControl } from "@wordpress/components";
2
+ import { SelectControl as WCSelectControl } from "@wordpress/components";
3
3
  import { __, _x } from "@wordpress/i18n";
4
4
  import { useSettings } from "../use-settings/index.mjs";
5
5
  import { InheritanceToolsPanelItem } from "../global-styles/inheritance/index.mjs";
@@ -62,7 +62,7 @@ function AspectRatioTool({
62
62
  isShownByDefault,
63
63
  panelId,
64
64
  children: /* @__PURE__ */ jsx(
65
- SelectControl,
65
+ WCSelectControl,
66
66
  {
67
67
  label: __("Aspect ratio"),
68
68
  value: displayValue,
@@ -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={ displayValue }\n\t\t\t\toptions={ resolvedOptions }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t</InheritanceToolsPanelItem>\n\t);\n}\n"],
5
- "mappings": ";AAAA,SAAS,qBAAqB;AAC9B,SAAS,IAAI,UAAU;AACvB,SAAS,mBAAmB;A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I,cAAe;AAAA,UAC3B,OAAQ;AAAA,UACR,SAAU;AAAA,UACV;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
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' ) }\n\t\t\t\tvalue={ displayValue }\n\t\t\t\toptions={ resolvedOptions }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t</InheritanceToolsPanelItem>\n\t);\n}\n"],
5
+ "mappings": ";AAAA,SAAS,iBAAiB,uBAAuB;AACjD,SAAS,IAAI,UAAU;AACvB,SAAS,mBAAmB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AI,cAAe;AAAA,UAC3B,OAAQ;AAAA,UACR,SAAU;AAAA,UACV;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
6
  "names": []
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={ onDimensionChange( 'height' ) }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</>\n\t);\n}\n"],
5
- "mappings": ";AAAA;AAAA,EACC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,OACvB;AACP,SAAS,UAAU;AAyDjB,mBASE,KATF;AAvBa,SAAR,gBAAkC;AAAA,EACxC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,W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D;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,EACC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,OACvB;AACP,SAAS,UAAU;AAyDjB,mBASE,KATF;AAvBa,SAAR,gBAAkC;AAAA,EACxC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB;AAAA,EACA,mBAAmB;AACpB,GAAI;AAEH,QAAM,QAAQ,MAAM,UAAU,SAAS,KAAO,MAAM,SAAS;AAC7D,QAAM,SAAS,MAAM,WAAW,SAAS,KAAO,MAAM,UAAU;AAEhE,QAAM,oBAAoB,CAAE,cAAe,CAAE,kBAAmB;AAC/D,UAAM,YAAY,EAAE,GAAG,MAAM;AAE7B,QAAK,CAAE,eAAgB;AACtB,aAAO,UAAW,SAAU;AAAA,IAC7B,OAAO;AACN,gBAAW,SAAU,IAAI;AAAA,IAC1B;AACA,aAAU,SAAU;AAAA,EACrB;AAEA,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,EAAE,YAAY,SAAS;AAAA,QAC/B,OAAQ,GAAI,OAAQ;AAAA,QACpB;AAAA,QACA,UAAW,MAAM,UAAU;AAAA,QAC3B,YAAa,kBAAmB,OAAQ;AAAA,QACxC;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,OAAQ;AAAA,YACpB,aAAc,GAAI,MAAO;AAAA,YACzB,eAAc;AAAA,YACd;AAAA,YACA,KAAM;AAAA,YACN,OAAQ;AAAA,YACR,UAAW,kBAAmB,OAAQ;AAAA;AAAA,QACvC;AAAA;AAAA,IACD;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,OAAQ,EAAE,YAAY,SAAS;AAAA,QAC/B,OAAQ,GAAI,QAAS;AAAA,QACrB;AAAA,QACA,UAAW,MAAM,WAAW;AAAA,QAC5B,YAAa,kBAAmB,QAAS;AAAA,QACzC;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,QAAS;AAAA,YACrB,aAAc,GAAI,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": []
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,SAAS,4BAA4B,eAAe;AACpD,SAAS,iBAAiB;AAC1B,SAAS,aAAa,wBAAwB;AAC9C,SAAS,mBAAmB;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,0BAA2B;AAC/D,wCACC,qBACD,IAAI,SAAU,WAAY,qBAAsB,CAAE;AAClD,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AAEA,SAAO;AAAA,IACN,QAAS;AAAA,MACR;AAAA,QACC,CAAE,qBACD,SAAS,mBAAoB,OAAQ;AACpC,gBAAM,CAAE,SAAU,IAAI;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,eAAO,MAAM,sBAAsB,UA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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,iBAAiB;AAAA,kBACtB;AAAA,kBACA;AAAA,kBACA,WACC,2BACD;AAAA,gBACD;AACA,oCACC,qBACD,IAAI;AAAA,kBACH,GAAG;AAAA,kBACH,OAAO;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\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ED,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
  }
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  getInheritanceProps,
17
17
  InheritanceToolsPanelItem,
18
- isGlobalStylesInheritanceEnabled
18
+ isGlobalStylesInheritanceIndicatorUIEnabled
19
19
  } from "./inheritance/index.mjs";
20
20
  import { jsx, jsxs } from "react/jsx-runtime";
21
21
  var DEFAULT_CONTROLS = {
@@ -86,7 +86,7 @@ function BackgroundImagePanel({
86
86
  defaultValues = {},
87
87
  headerLabel = __("Background"),
88
88
  contrastWarning,
89
- showInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled()
89
+ showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled()
90
90
  }) {
91
91
  const {
92
92
  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: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AA;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,SAAS,4BAA4B,kBAAkB;AACvD,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,OAAO,4BAA4B;AACnC,OAAO,+BAA+B;AACtC,SAAS,kCAAkC;AAC3C,SAAS,gCAAgC;AACzC,SAAS,sCAAsC;AAC/C,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAkIJ,cAqMD,YArMC;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,qBAAqB,2BAA4B,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,UAC1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AAO;AAAA,cACN;AAAA,gBACC,KAAK;AAAA,gBACL,OAAO,GAAI,UAAW;AAAA,gBACtB,gBAAgB;AAAA,gBAChB,eAAe;AAAA,kBACd,gBAAgB,OAAO;AAAA,kBACvB;AAAA,gBACD;AAAA,gBACA,UAAU;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": []
7
7
  }
@@ -17,7 +17,7 @@ import { ShadowPopover, useShadowPresets } from "./shadow-panel-components.mjs";
17
17
  import {
18
18
  getInheritanceProps,
19
19
  InheritanceToolsPanelItem,
20
- isGlobalStylesInheritanceEnabled
20
+ isGlobalStylesInheritanceIndicatorUIEnabled
21
21
  } from "./inheritance/index.mjs";
22
22
  import { jsx, jsxs } from "react/jsx-runtime";
23
23
  function useHasBorderPanel(settings) {
@@ -88,7 +88,7 @@ function BorderPanel({
88
88
  settings,
89
89
  panelId,
90
90
  defaultControls = DEFAULT_CONTROLS,
91
- showInheritanceLabelIndicators = isGlobalStylesInheritanceEnabled()
91
+ showInheritanceLabelIndicators = isGlobalStylesInheritanceIndicatorUIEnabled()
92
92
  }) {
93
93
  const colors = useColorsPerOrigin(settings);
94
94
  const areCustomSolidsEnabled = settings?.color?.custom;