@wordpress/block-editor 15.15.0 → 15.16.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 (94) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-inspector/index.cjs +2 -1
  3. package/build/components/block-inspector/index.cjs.map +2 -2
  4. package/build/components/block-visibility/modal.cjs +2 -2
  5. package/build/components/block-visibility/modal.cjs.map +1 -1
  6. package/build/components/block-visibility/viewport-visibility-info.cjs +6 -1
  7. package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
  8. package/build/components/global-styles/background-panel.cjs +142 -33
  9. package/build/components/global-styles/background-panel.cjs.map +2 -2
  10. package/build/components/global-styles/color-panel.cjs +18 -7
  11. package/build/components/global-styles/color-panel.cjs.map +2 -2
  12. package/build/components/global-styles/hooks.cjs +8 -4
  13. package/build/components/global-styles/hooks.cjs.map +2 -2
  14. package/build/components/inspector-controls-tabs/styles-tab.cjs +2 -1
  15. package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
  16. package/build/hooks/background.cjs +74 -21
  17. package/build/hooks/background.cjs.map +3 -3
  18. package/build/hooks/cross-origin-isolation.cjs +6 -6
  19. package/build/hooks/cross-origin-isolation.cjs.map +2 -2
  20. package/build/hooks/custom-css.cjs +5 -0
  21. package/build/hooks/custom-css.cjs.map +2 -2
  22. package/build/hooks/fit-text.cjs +46 -58
  23. package/build/hooks/fit-text.cjs.map +3 -3
  24. package/build/hooks/utils.cjs +5 -1
  25. package/build/hooks/utils.cjs.map +2 -2
  26. package/build/store/actions.cjs +8 -4
  27. package/build/store/actions.cjs.map +2 -2
  28. package/build/store/private-selectors.cjs +2 -2
  29. package/build/store/private-selectors.cjs.map +2 -2
  30. package/build/store/reducer.cjs +62 -95
  31. package/build/store/reducer.cjs.map +2 -2
  32. package/build/store/selectors.cjs +2 -2
  33. package/build/store/selectors.cjs.map +2 -2
  34. package/build-module/components/block-inspector/index.mjs +2 -1
  35. package/build-module/components/block-inspector/index.mjs.map +2 -2
  36. package/build-module/components/block-visibility/modal.mjs +2 -2
  37. package/build-module/components/block-visibility/modal.mjs.map +1 -1
  38. package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -1
  39. package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
  40. package/build-module/components/global-styles/background-panel.mjs +141 -34
  41. package/build-module/components/global-styles/background-panel.mjs.map +2 -2
  42. package/build-module/components/global-styles/color-panel.mjs +17 -7
  43. package/build-module/components/global-styles/color-panel.mjs.map +2 -2
  44. package/build-module/components/global-styles/hooks.mjs +8 -4
  45. package/build-module/components/global-styles/hooks.mjs.map +2 -2
  46. package/build-module/components/inspector-controls-tabs/styles-tab.mjs +2 -1
  47. package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
  48. package/build-module/hooks/background.mjs +76 -22
  49. package/build-module/hooks/background.mjs.map +2 -2
  50. package/build-module/hooks/cross-origin-isolation.mjs +6 -6
  51. package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
  52. package/build-module/hooks/custom-css.mjs +5 -0
  53. package/build-module/hooks/custom-css.mjs.map +2 -2
  54. package/build-module/hooks/fit-text.mjs +46 -58
  55. package/build-module/hooks/fit-text.mjs.map +2 -2
  56. package/build-module/hooks/utils.mjs +5 -1
  57. package/build-module/hooks/utils.mjs.map +2 -2
  58. package/build-module/store/actions.mjs +8 -4
  59. package/build-module/store/actions.mjs.map +2 -2
  60. package/build-module/store/private-selectors.mjs +2 -2
  61. package/build-module/store/private-selectors.mjs.map +2 -2
  62. package/build-module/store/reducer.mjs +62 -94
  63. package/build-module/store/reducer.mjs.map +2 -2
  64. package/build-module/store/selectors.mjs +2 -2
  65. package/build-module/store/selectors.mjs.map +2 -2
  66. package/build-style/content-rtl.css +2 -2
  67. package/build-style/content.css +2 -2
  68. package/build-style/style-rtl.css +35 -7
  69. package/build-style/style.css +35 -7
  70. package/package.json +39 -39
  71. package/src/components/background-image-control/style.scss +0 -4
  72. package/src/components/block-inspector/index.js +1 -0
  73. package/src/components/block-visibility/viewport-visibility-info.js +8 -1
  74. package/src/components/fit-text-size-warning/style.scss +1 -5
  75. package/src/components/global-styles/background-panel.js +157 -11
  76. package/src/components/global-styles/color-panel.js +23 -7
  77. package/src/components/global-styles/hooks.js +12 -4
  78. package/src/components/global-styles/test/background-panel.js +44 -1
  79. package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
  80. package/src/hooks/background.js +122 -21
  81. package/src/hooks/background.scss +45 -0
  82. package/src/hooks/cross-origin-isolation.js +6 -6
  83. package/src/hooks/custom-css.js +6 -0
  84. package/src/hooks/fit-text.js +73 -83
  85. package/src/hooks/test/cross-origin-isolation.js +7 -3
  86. package/src/hooks/utils.js +4 -0
  87. package/src/store/actions.js +9 -8
  88. package/src/store/private-selectors.js +2 -2
  89. package/src/store/reducer.js +84 -128
  90. package/src/store/selectors.js +2 -2
  91. package/src/store/test/private-selectors.js +67 -34
  92. package/src/store/test/reducer.js +436 -66
  93. package/src/store/test/selectors.js +81 -63
  94. package/src/style.scss +1 -0
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // packages/block-editor/src/components/global-styles/color-panel.js
31
31
  var color_panel_exports = {};
32
32
  __export(color_panel_exports, {
33
+ ColorPanelDropdown: () => ColorPanelDropdown,
33
34
  ColorToolsPanel: () => ColorToolsPanel,
34
35
  default: () => ColorPanel,
35
36
  useHasBackgroundColorPanel: () => useHasBackgroundColorPanel,
@@ -167,7 +168,8 @@ function ColorPanelDropdown({
167
168
  indicators,
168
169
  tabs,
169
170
  colorGradientControlSettings,
170
- panelId
171
+ panelId,
172
+ className = "block-editor-tools-panel-color-gradient-settings__item"
171
173
  }) {
172
174
  const currentTab = tabs.find((tab) => tab.userValue !== void 0);
173
175
  const { key: firstTabKey, ...firstTab } = tabs[0] ?? {};
@@ -175,7 +177,7 @@ function ColorPanelDropdown({
175
177
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
176
178
  import_components.__experimentalToolsPanelItem,
177
179
  {
178
- className: "block-editor-tools-panel-color-gradient-settings__item",
180
+ className,
179
181
  hasValue,
180
182
  label,
181
183
  onDeselect: resetValue,
@@ -284,6 +286,8 @@ function ColorPanel({
284
286
  const areCustomGradientsEnabled = settings?.color?.customGradient;
285
287
  const hasSolidColors = colors.length > 0 || areCustomSolidsEnabled;
286
288
  const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;
289
+ const hasBackgroundGradientSupport = !!settings?.background?.gradient;
290
+ const showGradientColors = hasGradientColors && !hasBackgroundGradientSupport;
287
291
  const decodeValue = (rawValue) => (0, import_global_styles_engine.getValueFromVariable)({ settings }, "", rawValue);
288
292
  const encodeColorValue = (colorValue) => {
289
293
  const allColors = colors.flatMap(
@@ -308,14 +312,16 @@ function ColorPanel({
308
312
  const userBackgroundColor = decodeValue(value?.color?.background);
309
313
  const gradient = decodeValue(inheritedValue?.color?.gradient);
310
314
  const userGradient = decodeValue(value?.color?.gradient);
311
- const hasBackground = () => !!userBackgroundColor || !!userGradient;
315
+ const hasBackground = () => !!userBackgroundColor || !hasBackgroundGradientSupport && !!userGradient;
312
316
  const setBackgroundColor = (newColor) => {
313
317
  const newValue = (0, import_object.setImmutably)(
314
318
  value,
315
319
  ["color", "background"],
316
320
  encodeColorValue(newColor)
317
321
  );
318
- newValue.color.gradient = void 0;
322
+ if (!hasBackgroundGradientSupport) {
323
+ newValue.color.gradient = void 0;
324
+ }
319
325
  onChange(newValue);
320
326
  };
321
327
  const setGradient = (newGradient) => {
@@ -333,7 +339,9 @@ function ColorPanel({
333
339
  ["color", "background"],
334
340
  void 0
335
341
  );
336
- newValue.color.gradient = void 0;
342
+ if (!hasBackgroundGradientSupport) {
343
+ newValue.color.gradient = void 0;
344
+ }
337
345
  onChange(newValue);
338
346
  };
339
347
  const showLinkPanel = useHasLinkPanel(settings);
@@ -498,7 +506,9 @@ function ColorPanel({
498
506
  hasValue: hasBackground,
499
507
  resetValue: resetBackground,
500
508
  isShownByDefault: defaultControls.background,
501
- indicators: [gradient ?? backgroundColor],
509
+ indicators: [
510
+ (showGradientColors ? gradient : void 0) ?? backgroundColor
511
+ ],
502
512
  tabs: [
503
513
  hasSolidColors && {
504
514
  key: "background",
@@ -507,7 +517,7 @@ function ColorPanel({
507
517
  setValue: setBackgroundColor,
508
518
  userValue: userBackgroundColor
509
519
  },
510
- hasGradientColors && {
520
+ showGradientColors && {
511
521
  key: "gradient",
512
522
  label: (0, import_i18n.__)("Gradient"),
513
523
  inheritedValue: gradient,
@@ -675,6 +685,7 @@ function ColorPanel({
675
685
  }
676
686
  // Annotate the CommonJS export names for ESM import in node:
677
687
  0 && (module.exports = {
688
+ ColorPanelDropdown,
678
689
  ColorToolsPanel,
679
690
  useHasBackgroundColorPanel,
680
691
  useHasButtonPanel,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/global-styles/color-panel.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalHStack as HStack,\n\t// TODO: Replace this ZStack with ad hoc CSS.\n\t// eslint-disable-next-line @wordpress/use-recommended-components\n\t__experimentalZStack as ZStack,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tColorIndicator,\n\tFlex,\n\tFlexItem,\n\tDropdown,\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\nimport { reset as resetIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from '../colors-gradients/control';\nimport { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport { unlock } from '../../lock-unlock';\n\nexport function useHasColorPanel( settings ) {\n\tconst hasTextPanel = useHasTextPanel( settings );\n\tconst hasBackgroundPanel = useHasBackgroundColorPanel( settings );\n\tconst hasLinkPanel = useHasLinkPanel( settings );\n\tconst hasHeadingPanel = useHasHeadingPanel( settings );\n\tconst hasButtonPanel = useHasButtonPanel( settings );\n\tconst hasCaptionPanel = useHasCaptionPanel( settings );\n\n\treturn (\n\t\thasTextPanel ||\n\t\thasBackgroundPanel ||\n\t\thasLinkPanel ||\n\t\thasHeadingPanel ||\n\t\thasButtonPanel ||\n\t\thasCaptionPanel\n\t);\n}\n\nexport function useHasTextPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.text &&\n\t\t( colors?.length > 0 || settings?.color?.custom )\n\t);\n}\n\nexport function useHasLinkPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.link &&\n\t\t( colors?.length > 0 || settings?.color?.custom )\n\t);\n}\n\nexport function useHasCaptionPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.caption &&\n\t\t( colors?.length > 0 || settings?.color?.custom )\n\t);\n}\n\nexport function useHasHeadingPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.heading &&\n\t\t( colors?.length > 0 ||\n\t\t\tsettings?.color?.custom ||\n\t\t\tgradients?.length > 0 ||\n\t\t\tsettings?.color?.customGradient )\n\t);\n}\n\nexport function useHasButtonPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.button &&\n\t\t( colors?.length > 0 ||\n\t\t\tsettings?.color?.custom ||\n\t\t\tgradients?.length > 0 ||\n\t\t\tsettings?.color?.customGradient )\n\t);\n}\n\nexport function useHasBackgroundColorPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.background &&\n\t\t( colors?.length > 0 ||\n\t\t\tsettings?.color?.custom ||\n\t\t\tgradients?.length > 0 ||\n\t\t\tsettings?.color?.customGradient )\n\t);\n}\n\nexport function ColorToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ label || __( 'Elements' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\thasInnerWrapper\n\t\t\theadingLevel={ 3 }\n\t\t\tclassName=\"color-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=\"color-block-support-panel__inner-wrapper\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\ttext: true,\n\tbackground: true,\n\tlink: true,\n\theading: true,\n\tbutton: true,\n\tcaption: true,\n};\n\nconst popoverProps = {\n\tplacement: 'left-start',\n\toffset: 36,\n\tshift: true,\n};\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst LabeledColorIndicators = ( { indicators, label } ) => (\n\t<HStack justify=\"flex-start\">\n\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t{ indicators.map( ( indicator, index ) => (\n\t\t\t\t<Flex key={ index } expanded={ false }>\n\t\t\t\t\t<ColorIndicator colorValue={ indicator } />\n\t\t\t\t</Flex>\n\t\t\t) ) }\n\t\t</ZStack>\n\t\t<FlexItem className=\"block-editor-panel-color-gradient-settings__color-name\">\n\t\t\t{ label }\n\t\t</FlexItem>\n\t</HStack>\n);\n\nfunction ColorPanelTab( {\n\tisGradient,\n\tinheritedValue,\n\tuserValue,\n\tsetValue,\n\tcolorGradientControlSettings,\n} ) {\n\treturn (\n\t\t<ColorGradientControl\n\t\t\t{ ...colorGradientControlSettings }\n\t\t\tshowTitle={ false }\n\t\t\tenableAlpha\n\t\t\t__experimentalIsRenderedInSidebar\n\t\t\tcolorValue={ isGradient ? undefined : inheritedValue }\n\t\t\tgradientValue={ isGradient ? inheritedValue : undefined }\n\t\t\tonColorChange={ isGradient ? undefined : setValue }\n\t\t\tonGradientChange={ isGradient ? setValue : undefined }\n\t\t\tclearable={ inheritedValue === userValue }\n\t\t\theadingLevel={ 3 }\n\t\t/>\n\t);\n}\n\nfunction ColorPanelDropdown( {\n\tlabel,\n\thasValue,\n\tresetValue,\n\tisShownByDefault,\n\tindicators,\n\ttabs,\n\tcolorGradientControlSettings,\n\tpanelId,\n} ) {\n\tconst currentTab = tabs.find( ( tab ) => tab.userValue !== undefined );\n\tconst { key: firstTabKey, ...firstTab } = tabs[ 0 ] ?? {};\n\tconst colorGradientDropdownButtonRef = useRef( undefined );\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__item\"\n\t\t\thasValue={ hasValue }\n\t\t\tlabel={ label }\n\t\t\tonDeselect={ resetValue }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__dropdown\"\n\t\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\t\tconst toggleProps = {\n\t\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t'block-editor-panel-color-gradient-settings__dropdown',\n\t\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t\t\tref: colorGradientDropdownButtonRef,\n\t\t\t\t\t};\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Button { ...toggleProps } __next40pxDefaultSize>\n\t\t\t\t\t\t\t\t<LabeledColorIndicators\n\t\t\t\t\t\t\t\t\tindicators={ indicators }\n\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t{ hasValue() && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-panel-color-gradient-settings__reset\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tresetValue();\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Return focus to parent button\n\t\t\t\t\t\t\t\t\t\tcolorGradientDropdownButtonRef.current?.focus();\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} }\n\t\t\t\trenderContent={ () => (\n\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t<div className=\"block-editor-panel-color-gradient-settings__dropdown-content\">\n\t\t\t\t\t\t\t{ tabs.length === 1 && (\n\t\t\t\t\t\t\t\t<ColorPanelTab\n\t\t\t\t\t\t\t\t\tkey={ firstTabKey }\n\t\t\t\t\t\t\t\t\t{ ...firstTab }\n\t\t\t\t\t\t\t\t\tcolorGradientControlSettings={\n\t\t\t\t\t\t\t\t\t\tcolorGradientControlSettings\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\t{ tabs.length > 1 && (\n\t\t\t\t\t\t\t\t<Tabs defaultTabId={ currentTab?.key }>\n\t\t\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ tab.key }\n\t\t\t\t\t\t\t\t\t\t\t\ttabId={ tab.key }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ tab.label }\n\t\t\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t\t</Tabs.TabList>\n\n\t\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\t\tconst { key: tabKey, ...restTabProps } =\n\t\t\t\t\t\t\t\t\t\t\ttab;\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ tabKey }\n\t\t\t\t\t\t\t\t\t\t\t\ttabId={ tabKey }\n\t\t\t\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<ColorPanelTab\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ tabKey }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...restTabProps }\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorGradientControlSettings={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolorGradientControlSettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\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</Tabs.TabPanel>\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</Tabs>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nexport default function ColorPanel( {\n\tas: Wrapper = ColorToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tlabel,\n\tchildren,\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\tconst areCustomSolidsEnabled = settings?.color?.custom;\n\tconst areCustomGradientsEnabled = settings?.color?.customGradient;\n\tconst hasSolidColors = colors.length > 0 || areCustomSolidsEnabled;\n\tconst hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\tconst encodeGradientValue = ( gradientValue ) => {\n\t\tconst allGradients = gradients.flatMap(\n\t\t\t( { gradients: originGradients } ) => originGradients\n\t\t);\n\t\tconst gradientObject = allGradients.find(\n\t\t\t( { gradient } ) => gradient === gradientValue\n\t\t);\n\t\treturn gradientObject\n\t\t\t? 'var:preset|gradient|' + gradientObject.slug\n\t\t\t: gradientValue;\n\t};\n\n\t// BackgroundColor\n\tconst showBackgroundPanel = useHasBackgroundColorPanel( settings );\n\tconst backgroundColor = decodeValue( inheritedValue?.color?.background );\n\tconst userBackgroundColor = decodeValue( value?.color?.background );\n\tconst gradient = decodeValue( inheritedValue?.color?.gradient );\n\tconst userGradient = decodeValue( value?.color?.gradient );\n\tconst hasBackground = () => !! userBackgroundColor || !! userGradient;\n\tconst setBackgroundColor = ( newColor ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tencodeColorValue( newColor )\n\t\t);\n\t\tnewValue.color.gradient = undefined;\n\t\tonChange( newValue );\n\t};\n\tconst setGradient = ( newGradient ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient )\n\t\t);\n\t\tnewValue.color.background = undefined;\n\t\tonChange( newValue );\n\t};\n\tconst resetBackground = () => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue.color.gradient = undefined;\n\t\tonChange( newValue );\n\t};\n\n\t// Links\n\tconst showLinkPanel = useHasLinkPanel( settings );\n\tconst linkColor = decodeValue(\n\t\tinheritedValue?.elements?.link?.color?.text\n\t);\n\tconst userLinkColor = decodeValue( value?.elements?.link?.color?.text );\n\tconst setLinkColor = ( newColor ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tencodeColorValue( newColor )\n\t\t\t)\n\t\t);\n\t};\n\tconst hoverLinkColor = decodeValue(\n\t\tinheritedValue?.elements?.link?.[ ':hover' ]?.color?.text\n\t);\n\tconst userHoverLinkColor = decodeValue(\n\t\tvalue?.elements?.link?.[ ':hover' ]?.color?.text\n\t);\n\tconst setHoverLinkColor = ( newColor ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', 'link', ':hover', 'color', 'text' ],\n\t\t\t\tencodeColorValue( newColor )\n\t\t\t)\n\t\t);\n\t};\n\tconst hasLink = () => !! userLinkColor || !! userHoverLinkColor;\n\tconst resetLink = () => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'elements', 'link', ':hover', 'color', 'text' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue = setImmutably(\n\t\t\tnewValue,\n\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\tundefined\n\t\t);\n\t\tonChange( newValue );\n\t};\n\n\t// Text Color\n\tconst showTextPanel = useHasTextPanel( settings );\n\tconst textColor = decodeValue( inheritedValue?.color?.text );\n\tconst userTextColor = decodeValue( value?.color?.text );\n\tconst hasTextColor = () => !! userTextColor;\n\tconst setTextColor = ( newColor ) => {\n\t\tlet changedObject = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'text' ],\n\t\t\tencodeColorValue( newColor )\n\t\t);\n\t\tif ( textColor === linkColor ) {\n\t\t\tchangedObject = setImmutably(\n\t\t\t\tchangedObject,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tencodeColorValue( newColor )\n\t\t\t);\n\t\t}\n\n\t\tonChange( changedObject );\n\t};\n\tconst resetTextColor = () => setTextColor( undefined );\n\n\t// Elements\n\tconst elements = [\n\t\t{\n\t\t\tname: 'caption',\n\t\t\tlabel: __( 'Captions' ),\n\t\t\tshowPanel: useHasCaptionPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'button',\n\t\t\tlabel: __( 'Button' ),\n\t\t\tshowPanel: useHasButtonPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'heading',\n\t\t\tlabel: __( 'Heading' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h1',\n\t\t\tlabel: __( 'H1' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h2',\n\t\t\tlabel: __( 'H2' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h3',\n\t\t\tlabel: __( 'H3' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h4',\n\t\t\tlabel: __( 'H4' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h5',\n\t\t\tlabel: __( 'H5' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h6',\n\t\t\tlabel: __( 'H6' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t];\n\n\tconst resetAllFilter = useCallback(\n\t\t( previousValue ) => {\n\t\t\treturn {\n\t\t\t\t...previousValue,\n\t\t\t\tcolor: undefined,\n\t\t\t\telements: {\n\t\t\t\t\t...previousValue?.elements,\n\t\t\t\t\tlink: {\n\t\t\t\t\t\t...previousValue?.elements?.link,\n\t\t\t\t\t\tcolor: undefined,\n\t\t\t\t\t\t':hover': {\n\t\t\t\t\t\t\tcolor: undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t...elements.reduce( ( acc, element ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t[ element.name ]: {\n\t\t\t\t\t\t\t\t...previousValue?.elements?.[ element.name ],\n\t\t\t\t\t\t\t\tcolor: undefined,\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[ elements ]\n\t);\n\n\tconst items = [\n\t\tshowTextPanel && {\n\t\t\tkey: 'text',\n\t\t\tlabel: __( 'Text' ),\n\t\t\thasValue: hasTextColor,\n\t\t\tresetValue: resetTextColor,\n\t\t\tisShownByDefault: defaultControls.text,\n\t\t\tindicators: [ textColor ],\n\t\t\ttabs: [\n\t\t\t\t{\n\t\t\t\t\tkey: 'text',\n\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\tinheritedValue: textColor,\n\t\t\t\t\tsetValue: setTextColor,\n\t\t\t\t\tuserValue: userTextColor,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tshowBackgroundPanel && {\n\t\t\tkey: 'background',\n\t\t\tlabel: __( 'Background' ),\n\t\t\thasValue: hasBackground,\n\t\t\tresetValue: resetBackground,\n\t\t\tisShownByDefault: defaultControls.background,\n\t\t\tindicators: [ gradient ?? backgroundColor ],\n\t\t\ttabs: [\n\t\t\t\thasSolidColors && {\n\t\t\t\t\tkey: 'background',\n\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t\tinheritedValue: backgroundColor,\n\t\t\t\t\tsetValue: setBackgroundColor,\n\t\t\t\t\tuserValue: userBackgroundColor,\n\t\t\t\t},\n\t\t\t\thasGradientColors && {\n\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\tinheritedValue: gradient,\n\t\t\t\t\tsetValue: setGradient,\n\t\t\t\t\tuserValue: userGradient,\n\t\t\t\t\tisGradient: true,\n\t\t\t\t},\n\t\t\t].filter( Boolean ),\n\t\t},\n\t\tshowLinkPanel && {\n\t\t\tkey: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\thasValue: hasLink,\n\t\t\tresetValue: resetLink,\n\t\t\tisShownByDefault: defaultControls.link,\n\t\t\tindicators: [ linkColor, hoverLinkColor ],\n\t\t\ttabs: [\n\t\t\t\t{\n\t\t\t\t\tkey: 'link',\n\t\t\t\t\tlabel: __( 'Default' ),\n\t\t\t\t\tinheritedValue: linkColor,\n\t\t\t\t\tsetValue: setLinkColor,\n\t\t\t\t\tuserValue: userLinkColor,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tkey: 'hover',\n\t\t\t\t\tlabel: __( 'Hover' ),\n\t\t\t\t\tinheritedValue: hoverLinkColor,\n\t\t\t\t\tsetValue: setHoverLinkColor,\n\t\t\t\t\tuserValue: userHoverLinkColor,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t].filter( Boolean );\n\n\telements.forEach( ( { name, label: elementLabel, showPanel } ) => {\n\t\tif ( ! showPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elementBackgroundColor = decodeValue(\n\t\t\tinheritedValue?.elements?.[ name ]?.color?.background\n\t\t);\n\t\tconst elementGradient = decodeValue(\n\t\t\tinheritedValue?.elements?.[ name ]?.color?.gradient\n\t\t);\n\t\tconst elementTextColor = decodeValue(\n\t\t\tinheritedValue?.elements?.[ name ]?.color?.text\n\t\t);\n\t\tconst elementBackgroundUserColor = decodeValue(\n\t\t\tvalue?.elements?.[ name ]?.color?.background\n\t\t);\n\t\tconst elementGradientUserColor = decodeValue(\n\t\t\tvalue?.elements?.[ name ]?.color?.gradient\n\t\t);\n\t\tconst elementTextUserColor = decodeValue(\n\t\t\tvalue?.elements?.[ name ]?.color?.text\n\t\t);\n\t\tconst hasElement = () =>\n\t\t\t!! (\n\t\t\t\telementTextUserColor ||\n\t\t\t\telementBackgroundUserColor ||\n\t\t\t\telementGradientUserColor\n\t\t\t);\n\t\tconst resetElement = () => {\n\t\t\tconst newValue = setImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', name, 'color', 'background' ],\n\t\t\t\tundefined\n\t\t\t);\n\t\t\tnewValue.elements[ name ].color.gradient = undefined;\n\t\t\tnewValue.elements[ name ].color.text = undefined;\n\t\t\tonChange( newValue );\n\t\t};\n\n\t\tconst setElementTextColor = ( newTextColor ) => {\n\t\t\tonChange(\n\t\t\t\tsetImmutably(\n\t\t\t\t\tvalue,\n\t\t\t\t\t[ 'elements', name, 'color', 'text' ],\n\t\t\t\t\tencodeColorValue( newTextColor )\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tconst setElementBackgroundColor = ( newBackgroundColor ) => {\n\t\t\tconst newValue = setImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', name, 'color', 'background' ],\n\t\t\t\tencodeColorValue( newBackgroundColor )\n\t\t\t);\n\t\t\tnewValue.elements[ name ].color.gradient = undefined;\n\t\t\tonChange( newValue );\n\t\t};\n\t\tconst setElementGradient = ( newGradient ) => {\n\t\t\tconst newValue = setImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', name, 'color', 'gradient' ],\n\t\t\t\tencodeGradientValue( newGradient )\n\t\t\t);\n\t\t\tnewValue.elements[ name ].color.background = undefined;\n\t\t\tonChange( newValue );\n\t\t};\n\t\tconst supportsTextColor = true;\n\t\t// Background color is not supported for `caption`\n\t\t// as there isn't yet a way to set padding for the element.\n\t\tconst supportsBackground = name !== 'caption';\n\n\t\titems.push( {\n\t\t\tkey: name,\n\t\t\tlabel: elementLabel,\n\t\t\thasValue: hasElement,\n\t\t\tresetValue: resetElement,\n\t\t\tisShownByDefault: defaultControls[ name ],\n\t\t\tindicators:\n\t\t\t\tsupportsTextColor && supportsBackground\n\t\t\t\t\t? [\n\t\t\t\t\t\t\telementTextColor,\n\t\t\t\t\t\t\telementGradient ?? elementBackgroundColor,\n\t\t\t\t\t ]\n\t\t\t\t\t: [\n\t\t\t\t\t\t\tsupportsTextColor\n\t\t\t\t\t\t\t\t? elementTextColor\n\t\t\t\t\t\t\t\t: elementGradient ?? elementBackgroundColor,\n\t\t\t\t\t ],\n\t\t\ttabs: [\n\t\t\t\thasSolidColors &&\n\t\t\t\t\tsupportsTextColor && {\n\t\t\t\t\t\tkey: 'text',\n\t\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\t\tinheritedValue: elementTextColor,\n\t\t\t\t\t\tsetValue: setElementTextColor,\n\t\t\t\t\t\tuserValue: elementTextUserColor,\n\t\t\t\t\t},\n\t\t\t\thasSolidColors &&\n\t\t\t\t\tsupportsBackground && {\n\t\t\t\t\t\tkey: 'background',\n\t\t\t\t\t\tlabel: __( 'Background' ),\n\t\t\t\t\t\tinheritedValue: elementBackgroundColor,\n\t\t\t\t\t\tsetValue: setElementBackgroundColor,\n\t\t\t\t\t\tuserValue: elementBackgroundUserColor,\n\t\t\t\t\t},\n\t\t\t\thasGradientColors &&\n\t\t\t\t\tsupportsBackground && {\n\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\tinheritedValue: elementGradient,\n\t\t\t\t\t\tsetValue: setElementGradient,\n\t\t\t\t\t\tuserValue: elementGradientUserColor,\n\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t},\n\t\t\t].filter( Boolean ),\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\tconst { key, ...restItem } = item;\n\t\t\t\treturn (\n\t\t\t\t\t<ColorPanelDropdown\n\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t{ ...restItem }\n\t\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\t\tcolors,\n\t\t\t\t\t\t\tdisableCustomColors: ! areCustomSolidsEnabled,\n\t\t\t\t\t\t\tgradients,\n\t\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ children }\n\t\t</Wrapper>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAcO;AACP,qBAAoC;AACp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nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalHStack as HStack,\n\t// TODO: Replace this ZStack with ad hoc CSS.\n\t// eslint-disable-next-line @wordpress/use-recommended-components\n\t__experimentalZStack as ZStack,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tColorIndicator,\n\tFlex,\n\tFlexItem,\n\tDropdown,\n\tButton,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\nimport { reset as resetIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from '../colors-gradients/control';\nimport { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\nimport { unlock } from '../../lock-unlock';\n\nexport function useHasColorPanel( settings ) {\n\tconst hasTextPanel = useHasTextPanel( settings );\n\tconst hasBackgroundPanel = useHasBackgroundColorPanel( settings );\n\tconst hasLinkPanel = useHasLinkPanel( settings );\n\tconst hasHeadingPanel = useHasHeadingPanel( settings );\n\tconst hasButtonPanel = useHasButtonPanel( settings );\n\tconst hasCaptionPanel = useHasCaptionPanel( settings );\n\n\treturn (\n\t\thasTextPanel ||\n\t\thasBackgroundPanel ||\n\t\thasLinkPanel ||\n\t\thasHeadingPanel ||\n\t\thasButtonPanel ||\n\t\thasCaptionPanel\n\t);\n}\n\nexport function useHasTextPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.text &&\n\t\t( colors?.length > 0 || settings?.color?.custom )\n\t);\n}\n\nexport function useHasLinkPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.link &&\n\t\t( colors?.length > 0 || settings?.color?.custom )\n\t);\n}\n\nexport function useHasCaptionPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.caption &&\n\t\t( colors?.length > 0 || settings?.color?.custom )\n\t);\n}\n\nexport function useHasHeadingPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.heading &&\n\t\t( colors?.length > 0 ||\n\t\t\tsettings?.color?.custom ||\n\t\t\tgradients?.length > 0 ||\n\t\t\tsettings?.color?.customGradient )\n\t);\n}\n\nexport function useHasButtonPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.button &&\n\t\t( colors?.length > 0 ||\n\t\t\tsettings?.color?.custom ||\n\t\t\tgradients?.length > 0 ||\n\t\t\tsettings?.color?.customGradient )\n\t);\n}\n\nexport function useHasBackgroundColorPanel( settings ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\treturn (\n\t\tsettings?.color?.background &&\n\t\t( colors?.length > 0 ||\n\t\t\tsettings?.color?.custom ||\n\t\t\tgradients?.length > 0 ||\n\t\t\tsettings?.color?.customGradient )\n\t);\n}\n\nexport function ColorToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ label || __( 'Elements' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\thasInnerWrapper\n\t\t\theadingLevel={ 3 }\n\t\t\tclassName=\"color-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=\"color-block-support-panel__inner-wrapper\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\ttext: true,\n\tbackground: true,\n\tlink: true,\n\theading: true,\n\tbutton: true,\n\tcaption: true,\n};\n\nconst popoverProps = {\n\tplacement: 'left-start',\n\toffset: 36,\n\tshift: true,\n};\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst LabeledColorIndicators = ( { indicators, label } ) => (\n\t<HStack justify=\"flex-start\">\n\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t{ indicators.map( ( indicator, index ) => (\n\t\t\t\t<Flex key={ index } expanded={ false }>\n\t\t\t\t\t<ColorIndicator colorValue={ indicator } />\n\t\t\t\t</Flex>\n\t\t\t) ) }\n\t\t</ZStack>\n\t\t<FlexItem className=\"block-editor-panel-color-gradient-settings__color-name\">\n\t\t\t{ label }\n\t\t</FlexItem>\n\t</HStack>\n);\n\nfunction ColorPanelTab( {\n\tisGradient,\n\tinheritedValue,\n\tuserValue,\n\tsetValue,\n\tcolorGradientControlSettings,\n} ) {\n\treturn (\n\t\t<ColorGradientControl\n\t\t\t{ ...colorGradientControlSettings }\n\t\t\tshowTitle={ false }\n\t\t\tenableAlpha\n\t\t\t__experimentalIsRenderedInSidebar\n\t\t\tcolorValue={ isGradient ? undefined : inheritedValue }\n\t\t\tgradientValue={ isGradient ? inheritedValue : undefined }\n\t\t\tonColorChange={ isGradient ? undefined : setValue }\n\t\t\tonGradientChange={ isGradient ? setValue : undefined }\n\t\t\tclearable={ inheritedValue === userValue }\n\t\t\theadingLevel={ 3 }\n\t\t/>\n\t);\n}\n\nexport function ColorPanelDropdown( {\n\tlabel,\n\thasValue,\n\tresetValue,\n\tisShownByDefault,\n\tindicators,\n\ttabs,\n\tcolorGradientControlSettings,\n\tpanelId,\n\tclassName = 'block-editor-tools-panel-color-gradient-settings__item',\n} ) {\n\tconst currentTab = tabs.find( ( tab ) => tab.userValue !== undefined );\n\tconst { key: firstTabKey, ...firstTab } = tabs[ 0 ] ?? {};\n\tconst colorGradientDropdownButtonRef = useRef( undefined );\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName={ className }\n\t\t\thasValue={ hasValue }\n\t\t\tlabel={ label }\n\t\t\tonDeselect={ resetValue }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tclassName=\"block-editor-tools-panel-color-gradient-settings__dropdown\"\n\t\t\t\trenderToggle={ ( { onToggle, isOpen } ) => {\n\t\t\t\t\tconst toggleProps = {\n\t\t\t\t\t\tonClick: onToggle,\n\t\t\t\t\t\tclassName: clsx(\n\t\t\t\t\t\t\t'block-editor-panel-color-gradient-settings__dropdown',\n\t\t\t\t\t\t\t{ 'is-open': isOpen }\n\t\t\t\t\t\t),\n\t\t\t\t\t\t'aria-expanded': isOpen,\n\t\t\t\t\t\tref: colorGradientDropdownButtonRef,\n\t\t\t\t\t};\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Button { ...toggleProps } __next40pxDefaultSize>\n\t\t\t\t\t\t\t\t<LabeledColorIndicators\n\t\t\t\t\t\t\t\t\tindicators={ indicators }\n\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t{ hasValue() && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-panel-color-gradient-settings__reset\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\ticon={ resetIcon }\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tresetValue();\n\t\t\t\t\t\t\t\t\t\tif ( isOpen ) {\n\t\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Return focus to parent button\n\t\t\t\t\t\t\t\t\t\tcolorGradientDropdownButtonRef.current?.focus();\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} }\n\t\t\t\trenderContent={ () => (\n\t\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t\t<div className=\"block-editor-panel-color-gradient-settings__dropdown-content\">\n\t\t\t\t\t\t\t{ tabs.length === 1 && (\n\t\t\t\t\t\t\t\t<ColorPanelTab\n\t\t\t\t\t\t\t\t\tkey={ firstTabKey }\n\t\t\t\t\t\t\t\t\t{ ...firstTab }\n\t\t\t\t\t\t\t\t\tcolorGradientControlSettings={\n\t\t\t\t\t\t\t\t\t\tcolorGradientControlSettings\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\t{ tabs.length > 1 && (\n\t\t\t\t\t\t\t\t<Tabs defaultTabId={ currentTab?.key }>\n\t\t\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ tab.key }\n\t\t\t\t\t\t\t\t\t\t\t\ttabId={ tab.key }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ tab.label }\n\t\t\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t\t</Tabs.TabList>\n\n\t\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\t\tconst { key: tabKey, ...restTabProps } =\n\t\t\t\t\t\t\t\t\t\t\ttab;\n\t\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ tabKey }\n\t\t\t\t\t\t\t\t\t\t\t\ttabId={ tabKey }\n\t\t\t\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<ColorPanelTab\n\t\t\t\t\t\t\t\t\t\t\t\t\tkey={ tabKey }\n\t\t\t\t\t\t\t\t\t\t\t\t\t{ ...restTabProps }\n\t\t\t\t\t\t\t\t\t\t\t\t\tcolorGradientControlSettings={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcolorGradientControlSettings\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\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</Tabs.TabPanel>\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</Tabs>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</DropdownContentWrapper>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nexport default function ColorPanel( {\n\tas: Wrapper = ColorToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tlabel,\n\tchildren,\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst gradients = useGradientsPerOrigin( settings );\n\tconst areCustomSolidsEnabled = settings?.color?.custom;\n\tconst areCustomGradientsEnabled = settings?.color?.customGradient;\n\tconst hasSolidColors = colors.length > 0 || areCustomSolidsEnabled;\n\tconst hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;\n\t// When a block opts into background.gradient support, the gradient\n\t// picker moves to the Background panel. Hide it here to avoid\n\t// showing duplicate gradient controls.\n\tconst hasBackgroundGradientSupport = !! settings?.background?.gradient;\n\tconst showGradientColors =\n\t\thasGradientColors && ! hasBackgroundGradientSupport;\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\tconst encodeGradientValue = ( gradientValue ) => {\n\t\tconst allGradients = gradients.flatMap(\n\t\t\t( { gradients: originGradients } ) => originGradients\n\t\t);\n\t\tconst gradientObject = allGradients.find(\n\t\t\t( { gradient } ) => gradient === gradientValue\n\t\t);\n\t\treturn gradientObject\n\t\t\t? 'var:preset|gradient|' + gradientObject.slug\n\t\t\t: gradientValue;\n\t};\n\n\t// BackgroundColor\n\tconst showBackgroundPanel = useHasBackgroundColorPanel( settings );\n\tconst backgroundColor = decodeValue( inheritedValue?.color?.background );\n\tconst userBackgroundColor = decodeValue( value?.color?.background );\n\tconst gradient = decodeValue( inheritedValue?.color?.gradient );\n\tconst userGradient = decodeValue( value?.color?.gradient );\n\tconst hasBackground = () =>\n\t\t!! userBackgroundColor ||\n\t\t( ! hasBackgroundGradientSupport && !! userGradient );\n\tconst setBackgroundColor = ( newColor ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'background' ],\n\t\t\tencodeColorValue( newColor )\n\t\t);\n\t\tif ( ! hasBackgroundGradientSupport ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\tconst setGradient = ( newGradient ) => {\n\t\tconst newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient )\n\t\t);\n\t\tnewValue.color.background = undefined;\n\t\tonChange( newValue );\n\t};\n\tconst resetBackground = () => {\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 ( ! hasBackgroundGradientSupport ) {\n\t\t\tnewValue.color.gradient = undefined;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\n\t// Links\n\tconst showLinkPanel = useHasLinkPanel( settings );\n\tconst linkColor = decodeValue(\n\t\tinheritedValue?.elements?.link?.color?.text\n\t);\n\tconst userLinkColor = decodeValue( value?.elements?.link?.color?.text );\n\tconst setLinkColor = ( newColor ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tencodeColorValue( newColor )\n\t\t\t)\n\t\t);\n\t};\n\tconst hoverLinkColor = decodeValue(\n\t\tinheritedValue?.elements?.link?.[ ':hover' ]?.color?.text\n\t);\n\tconst userHoverLinkColor = decodeValue(\n\t\tvalue?.elements?.link?.[ ':hover' ]?.color?.text\n\t);\n\tconst setHoverLinkColor = ( newColor ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', 'link', ':hover', 'color', 'text' ],\n\t\t\t\tencodeColorValue( newColor )\n\t\t\t)\n\t\t);\n\t};\n\tconst hasLink = () => !! userLinkColor || !! userHoverLinkColor;\n\tconst resetLink = () => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'elements', 'link', ':hover', 'color', 'text' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue = setImmutably(\n\t\t\tnewValue,\n\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\tundefined\n\t\t);\n\t\tonChange( newValue );\n\t};\n\n\t// Text Color\n\tconst showTextPanel = useHasTextPanel( settings );\n\tconst textColor = decodeValue( inheritedValue?.color?.text );\n\tconst userTextColor = decodeValue( value?.color?.text );\n\tconst hasTextColor = () => !! userTextColor;\n\tconst setTextColor = ( newColor ) => {\n\t\tlet changedObject = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'color', 'text' ],\n\t\t\tencodeColorValue( newColor )\n\t\t);\n\t\tif ( textColor === linkColor ) {\n\t\t\tchangedObject = setImmutably(\n\t\t\t\tchangedObject,\n\t\t\t\t[ 'elements', 'link', 'color', 'text' ],\n\t\t\t\tencodeColorValue( newColor )\n\t\t\t);\n\t\t}\n\n\t\tonChange( changedObject );\n\t};\n\tconst resetTextColor = () => setTextColor( undefined );\n\n\t// Elements\n\tconst elements = [\n\t\t{\n\t\t\tname: 'caption',\n\t\t\tlabel: __( 'Captions' ),\n\t\t\tshowPanel: useHasCaptionPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'button',\n\t\t\tlabel: __( 'Button' ),\n\t\t\tshowPanel: useHasButtonPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'heading',\n\t\t\tlabel: __( 'Heading' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h1',\n\t\t\tlabel: __( 'H1' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h2',\n\t\t\tlabel: __( 'H2' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h3',\n\t\t\tlabel: __( 'H3' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h4',\n\t\t\tlabel: __( 'H4' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h5',\n\t\t\tlabel: __( 'H5' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t\t{\n\t\t\tname: 'h6',\n\t\t\tlabel: __( 'H6' ),\n\t\t\tshowPanel: useHasHeadingPanel( settings ),\n\t\t},\n\t];\n\n\tconst resetAllFilter = useCallback(\n\t\t( previousValue ) => {\n\t\t\treturn {\n\t\t\t\t...previousValue,\n\t\t\t\tcolor: undefined,\n\t\t\t\telements: {\n\t\t\t\t\t...previousValue?.elements,\n\t\t\t\t\tlink: {\n\t\t\t\t\t\t...previousValue?.elements?.link,\n\t\t\t\t\t\tcolor: undefined,\n\t\t\t\t\t\t':hover': {\n\t\t\t\t\t\t\tcolor: undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t...elements.reduce( ( acc, element ) => {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t\t[ element.name ]: {\n\t\t\t\t\t\t\t\t...previousValue?.elements?.[ element.name ],\n\t\t\t\t\t\t\t\tcolor: undefined,\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[ elements ]\n\t);\n\n\tconst items = [\n\t\tshowTextPanel && {\n\t\t\tkey: 'text',\n\t\t\tlabel: __( 'Text' ),\n\t\t\thasValue: hasTextColor,\n\t\t\tresetValue: resetTextColor,\n\t\t\tisShownByDefault: defaultControls.text,\n\t\t\tindicators: [ textColor ],\n\t\t\ttabs: [\n\t\t\t\t{\n\t\t\t\t\tkey: 'text',\n\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\tinheritedValue: textColor,\n\t\t\t\t\tsetValue: setTextColor,\n\t\t\t\t\tuserValue: userTextColor,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tshowBackgroundPanel && {\n\t\t\tkey: 'background',\n\t\t\tlabel: __( 'Background' ),\n\t\t\thasValue: hasBackground,\n\t\t\tresetValue: resetBackground,\n\t\t\tisShownByDefault: defaultControls.background,\n\t\t\tindicators: [\n\t\t\t\t( showGradientColors ? gradient : undefined ) ??\n\t\t\t\t\tbackgroundColor,\n\t\t\t],\n\t\t\ttabs: [\n\t\t\t\thasSolidColors && {\n\t\t\t\t\tkey: 'background',\n\t\t\t\t\tlabel: __( 'Color' ),\n\t\t\t\t\tinheritedValue: backgroundColor,\n\t\t\t\t\tsetValue: setBackgroundColor,\n\t\t\t\t\tuserValue: userBackgroundColor,\n\t\t\t\t},\n\t\t\t\tshowGradientColors && {\n\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\tinheritedValue: gradient,\n\t\t\t\t\tsetValue: setGradient,\n\t\t\t\t\tuserValue: userGradient,\n\t\t\t\t\tisGradient: true,\n\t\t\t\t},\n\t\t\t].filter( Boolean ),\n\t\t},\n\t\tshowLinkPanel && {\n\t\t\tkey: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\thasValue: hasLink,\n\t\t\tresetValue: resetLink,\n\t\t\tisShownByDefault: defaultControls.link,\n\t\t\tindicators: [ linkColor, hoverLinkColor ],\n\t\t\ttabs: [\n\t\t\t\t{\n\t\t\t\t\tkey: 'link',\n\t\t\t\t\tlabel: __( 'Default' ),\n\t\t\t\t\tinheritedValue: linkColor,\n\t\t\t\t\tsetValue: setLinkColor,\n\t\t\t\t\tuserValue: userLinkColor,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tkey: 'hover',\n\t\t\t\t\tlabel: __( 'Hover' ),\n\t\t\t\t\tinheritedValue: hoverLinkColor,\n\t\t\t\t\tsetValue: setHoverLinkColor,\n\t\t\t\t\tuserValue: userHoverLinkColor,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t].filter( Boolean );\n\n\telements.forEach( ( { name, label: elementLabel, showPanel } ) => {\n\t\tif ( ! showPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elementBackgroundColor = decodeValue(\n\t\t\tinheritedValue?.elements?.[ name ]?.color?.background\n\t\t);\n\t\tconst elementGradient = decodeValue(\n\t\t\tinheritedValue?.elements?.[ name ]?.color?.gradient\n\t\t);\n\t\tconst elementTextColor = decodeValue(\n\t\t\tinheritedValue?.elements?.[ name ]?.color?.text\n\t\t);\n\t\tconst elementBackgroundUserColor = decodeValue(\n\t\t\tvalue?.elements?.[ name ]?.color?.background\n\t\t);\n\t\tconst elementGradientUserColor = decodeValue(\n\t\t\tvalue?.elements?.[ name ]?.color?.gradient\n\t\t);\n\t\tconst elementTextUserColor = decodeValue(\n\t\t\tvalue?.elements?.[ name ]?.color?.text\n\t\t);\n\t\tconst hasElement = () =>\n\t\t\t!! (\n\t\t\t\telementTextUserColor ||\n\t\t\t\telementBackgroundUserColor ||\n\t\t\t\telementGradientUserColor\n\t\t\t);\n\t\tconst resetElement = () => {\n\t\t\tconst newValue = setImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', name, 'color', 'background' ],\n\t\t\t\tundefined\n\t\t\t);\n\t\t\tnewValue.elements[ name ].color.gradient = undefined;\n\t\t\tnewValue.elements[ name ].color.text = undefined;\n\t\t\tonChange( newValue );\n\t\t};\n\n\t\tconst setElementTextColor = ( newTextColor ) => {\n\t\t\tonChange(\n\t\t\t\tsetImmutably(\n\t\t\t\t\tvalue,\n\t\t\t\t\t[ 'elements', name, 'color', 'text' ],\n\t\t\t\t\tencodeColorValue( newTextColor )\n\t\t\t\t)\n\t\t\t);\n\t\t};\n\t\tconst setElementBackgroundColor = ( newBackgroundColor ) => {\n\t\t\tconst newValue = setImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', name, 'color', 'background' ],\n\t\t\t\tencodeColorValue( newBackgroundColor )\n\t\t\t);\n\t\t\tnewValue.elements[ name ].color.gradient = undefined;\n\t\t\tonChange( newValue );\n\t\t};\n\t\tconst setElementGradient = ( newGradient ) => {\n\t\t\tconst newValue = setImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'elements', name, 'color', 'gradient' ],\n\t\t\t\tencodeGradientValue( newGradient )\n\t\t\t);\n\t\t\tnewValue.elements[ name ].color.background = undefined;\n\t\t\tonChange( newValue );\n\t\t};\n\t\tconst supportsTextColor = true;\n\t\t// Background color is not supported for `caption`\n\t\t// as there isn't yet a way to set padding for the element.\n\t\tconst supportsBackground = name !== 'caption';\n\n\t\titems.push( {\n\t\t\tkey: name,\n\t\t\tlabel: elementLabel,\n\t\t\thasValue: hasElement,\n\t\t\tresetValue: resetElement,\n\t\t\tisShownByDefault: defaultControls[ name ],\n\t\t\tindicators:\n\t\t\t\tsupportsTextColor && supportsBackground\n\t\t\t\t\t? [\n\t\t\t\t\t\t\telementTextColor,\n\t\t\t\t\t\t\telementGradient ?? elementBackgroundColor,\n\t\t\t\t\t ]\n\t\t\t\t\t: [\n\t\t\t\t\t\t\tsupportsTextColor\n\t\t\t\t\t\t\t\t? elementTextColor\n\t\t\t\t\t\t\t\t: elementGradient ?? elementBackgroundColor,\n\t\t\t\t\t ],\n\t\t\ttabs: [\n\t\t\t\thasSolidColors &&\n\t\t\t\t\tsupportsTextColor && {\n\t\t\t\t\t\tkey: 'text',\n\t\t\t\t\t\tlabel: __( 'Text' ),\n\t\t\t\t\t\tinheritedValue: elementTextColor,\n\t\t\t\t\t\tsetValue: setElementTextColor,\n\t\t\t\t\t\tuserValue: elementTextUserColor,\n\t\t\t\t\t},\n\t\t\t\thasSolidColors &&\n\t\t\t\t\tsupportsBackground && {\n\t\t\t\t\t\tkey: 'background',\n\t\t\t\t\t\tlabel: __( 'Background' ),\n\t\t\t\t\t\tinheritedValue: elementBackgroundColor,\n\t\t\t\t\t\tsetValue: setElementBackgroundColor,\n\t\t\t\t\t\tuserValue: elementBackgroundUserColor,\n\t\t\t\t\t},\n\t\t\t\thasGradientColors &&\n\t\t\t\t\tsupportsBackground && {\n\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\tinheritedValue: elementGradient,\n\t\t\t\t\t\tsetValue: setElementGradient,\n\t\t\t\t\t\tuserValue: elementGradientUserColor,\n\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t},\n\t\t\t].filter( Boolean ),\n\t\t} );\n\t} );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\tconst { key, ...restItem } = item;\n\t\t\t\treturn (\n\t\t\t\t\t<ColorPanelDropdown\n\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t{ ...restItem }\n\t\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\t\tcolors,\n\t\t\t\t\t\t\tdisableCustomColors: ! areCustomSolidsEnabled,\n\t\t\t\t\t\t\tgradients,\n\t\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ children }\n\t\t</Wrapper>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAcO;AACP,qBAAoC;AACpC,kBAAmB;AACnB,kCAAqC;AACrC,mBAAmC;AAKnC,qBAAiC;AACjC,mBAA0D;AAC1D,mBAA+C;AAC/C,oBAA6B;AAC7B,yBAAuB;AA0GpB;AAxGI,SAAS,iBAAkB,UAAW;AAC5C,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,qBAAqB,2BAA4B,QAAS;AAChE,QAAM,eAAe,gBAAiB,QAAS;AAC/C,QAAM,kBAAkB,mB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YAAY;AAAA,MACZ,kBAAkB,gBAAiB,IAAK;AAAA,MACxC,YACC,qBAAqB,qBAClB;AAAA,QACA;AAAA,QACA,mBAAmB;AAAA,MACnB,IACA;AAAA,QACA,oBACG,mBACA,mBAAmB;AAAA,MACtB;AAAA,MACJ,MAAM;AAAA,QACL,kBACC,qBAAqB;AAAA,UACpB,KAAK;AAAA,UACL,WAAO,gBAAI,MAAO;AAAA,UAClB,gBAAgB;AAAA,UAChB,UAAU;AAAA,UACV,WAAW;AAAA,QACZ;AAAA,QACD,kBACC,sBAAsB;AAAA,UACrB,KAAK;AAAA,UACL,WAAO,gBAAI,YAAa;AAAA,UACxB,gBAAgB;AAAA,UAChB,UAAU;AAAA,UACV,WAAW;AAAA,QACZ;AAAA,QACD,qBACC,sBAAsB;AAAA,UACrB,KAAK;AAAA,UACL,WAAO,gBAAI,UAAW;AAAA,UACtB,gBAAgB;AAAA,UAChB,UAAU;AAAA,UACV,WAAW;AAAA,UACX,YAAY;AAAA,QACb;AAAA,MACF,EAAE,OAAQ,OAAQ;AAAA,IACnB,CAAE;AAAA,EACH,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEE;AAAA,cAAM,IAAK,CAAE,SAAU;AACxB,gBAAM,EAAE,KAAK,GAAG,SAAS,IAAI;AAC7B,iBACC;AAAA,YAAC;AAAA;AAAA,cAEE,GAAG;AAAA,cACL,8BAA+B;AAAA,gBAC9B;AAAA,gBACA,qBAAqB,CAAE;AAAA,gBACvB;AAAA,gBACA,wBAAwB,CAAE;AAAA,cAC3B;AAAA,cACA;AAAA;AAAA,YARM;AAAA,UASP;AAAA,QAEF,CAAE;AAAA,QACA;AAAA;AAAA;AAAA,EACH;AAEF;",
6
6
  "names": ["ToolsPanel", "componentsPrivateApis", "HStack", "ZStack", "ColorGradientControl", "ToolsPanelItem", "clsx", "resetIcon", "DropdownContentWrapper", "gradient"]
7
7
  }
@@ -67,7 +67,7 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
67
67
  link: updatedSettings.color?.link && supportedStyles.includes("linkColor"),
68
68
  caption: updatedSettings.color?.caption && supportedStyles.includes("captionColor")
69
69
  };
70
- if (!supportedStyles.includes("background")) {
70
+ if (!supportedStyles.includes("background") && !supportedStyles.includes("backgroundGradient")) {
71
71
  updatedSettings.color.gradients = [];
72
72
  updatedSettings.color.customGradient = false;
73
73
  }
@@ -149,11 +149,15 @@ function useSettingsForBlockElement(parentSettings, blockName, element) {
149
149
  };
150
150
  }
151
151
  });
152
- ["backgroundImage", "backgroundSize"].forEach((key) => {
153
- if (!supportedStyles.includes(key)) {
152
+ [
153
+ ["backgroundImage", "backgroundImage"],
154
+ ["backgroundSize", "backgroundSize"],
155
+ ["backgroundGradient", "gradient"]
156
+ ].forEach(([styleKey, settingKey]) => {
157
+ if (!supportedStyles.includes(styleKey)) {
154
158
  updatedSettings.background = {
155
159
  ...updatedSettings.background,
156
- [key]: false
160
+ [settingKey]: false
157
161
  };
158
162
  }
159
163
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/global-styles/hooks.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t\tdefaultFontSizes: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\tupdatedSettings.color = {\n\t\t\t...updatedSettings.color,\n\t\t\ttext:\n\t\t\t\tupdatedSettings.color?.text &&\n\t\t\t\tsupportedStyles.includes( 'color' ),\n\t\t\tbackground:\n\t\t\t\tupdatedSettings.color?.background &&\n\t\t\t\t( supportedStyles.includes( 'background' ) ||\n\t\t\t\t\tsupportedStyles.includes( 'backgroundColor' ) ),\n\t\t\tbutton:\n\t\t\t\tupdatedSettings.color?.button &&\n\t\t\t\tsupportedStyles.includes( 'buttonColor' ),\n\t\t\theading:\n\t\t\t\tupdatedSettings.color?.heading &&\n\t\t\t\tsupportedStyles.includes( 'headingColor' ),\n\t\t\tlink:\n\t\t\t\tupdatedSettings.color?.link &&\n\t\t\t\tsupportedStyles.includes( 'linkColor' ),\n\t\t\tcaption:\n\t\t\t\tupdatedSettings.color?.caption &&\n\t\t\t\tsupportedStyles.includes( 'captionColor' ),\n\t\t};\n\n\t\t// Some blocks can enable background colors but disable gradients.\n\t\tif ( ! supportedStyles.includes( 'background' ) ) {\n\t\t\tupdatedSettings.color.gradients = [];\n\t\t\tupdatedSettings.color.customGradient = false;\n\t\t}\n\n\t\t// If filters are not supported by the block/element, disable duotone.\n\t\tif ( ! supportedStyles.includes( 'filter' ) ) {\n\t\t\tupdatedSettings.color.defaultDuotone = false;\n\t\t\tupdatedSettings.color.customDuotone = false;\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textAlign',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t\t'textIndent',\n\t\t\t'writingMode',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t// Text indent needs explicit handling since it may not be in parent settings.\n\t\tif ( supportedStyles.includes( 'textIndent' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextIndent:\n\t\t\t\t\tupdatedSettings.typography?.textIndent ?? 'subsequent',\n\t\t\t};\n\t\t}\n\n\t\t// The column-count style is named text column to reduce confusion with\n\t\t// the columns block and manage expectations from the support.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/33587\n\t\tif ( ! supportedStyles.includes( 'columnCount' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextColumns: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\t// Check if spacing type is supported before adding sides.\n\t\t\tif ( sides?.length && updatedSettings.spacing?.[ key ] ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'aspectRatio', 'height', 'minHeight', 'width' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {\n\t\t\tif (\n\t\t\t\t! supportedStyles.includes(\n\t\t\t\t\t'border' + key.charAt( 0 ).toUpperCase() + key.slice( 1 )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tupdatedSettings.border = {\n\t\t\t\t\t...updatedSettings.border,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'backgroundImage', 'backgroundSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.background = {\n\t\t\t\t\t...updatedSettings.background,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tupdatedSettings.shadow = supportedStyles.includes( 'shadow' )\n\t\t\t? updatedSettings.shadow\n\t\t\t: false;\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n\nexport function useColorsPerOrigin( settings ) {\n\tconst customColors = settings?.color?.palette?.custom;\n\tconst themeColors = settings?.color?.palette?.theme;\n\tconst defaultColors = settings?.color?.palette?.default;\n\tconst shouldDisplayDefaultColors = settings?.color?.defaultPalette;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n}\n\nexport function useGradientsPerOrigin( settings ) {\n\tconst customGradients = settings?.color?.gradients?.custom;\n\tconst themeGradients = settings?.color?.gradients?.theme;\n\tconst defaultGradients = settings?.color?.gradients?.default;\n\tconst shouldDisplayDefaultGradients = settings?.color?.defaultGradients;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,kBAA0B;AAC1B,oBAAqC;AACrC,kBAAmB;AAKnB,yBAAuB;AAWhB,SAAS,2BACf,gBACA,WACA,SACC;AACD,QAAM,EAAE,iBAAiB,SAAS,QAAI;AAAA,IACrC,CAAE,WAAY;AACb,aAAO;AAAA,QACN,qBAAiB;AAAA,UAChB,OAAQ,cAAAA,KAAY;AAAA,QACrB,EAAE,mBAAoB,WAAW,OAAQ;AAAA,QACzC,UACC,OAAQ,cAAAA,KAAY,EAAE,aAAc,SAAU,GAAG;AAAA,MACnD;AAAA,IACD;AAAA,IACA,CAAE,WAAW,OAAQ;AAAA,EACtB;AAEA,aAAO,wBAAS,MAAM;AACrB,UAAM,kBAAkB,EAAE,GAAG,eAAe;AAE5C,QAAK,CAAE,gBAAgB,SAAU,UAAW,GAAI;AAC/C,sBAAgB,aAAa;AAAA,QAC5B,GAAG,gBAAgB;AAAA,QACnB,WAAW,CAAC;AAAA,QACZ,gBAAgB;AAAA,QAChB,kBAAkB;AAAA,MACnB;AAAA,IACD;AAEA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A,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;AAEO,SAAS,sBAAuB,UAAW;AACjD,QAAM,kBAAkB,UAAU,OAAO,WAAW;AACpD,QAAM,iBAAiB,UAAU,OAAO,WAAW;AACnD,QAAM,mBAAmB,UAAU,OAAO,WAAW;AACrD,QAAM,gCAAgC,UAAU,OAAO;AAEvD,aAAO,wBAAS,MAAM;AACrB,UAAM,SAAS,CAAC;AAChB,QAAK,kBAAkB,eAAe,QAAS;AAC9C,aAAO,KAAM;AAAA,QACZ,UAAM;AAAA,UACL;AAAA,UACA;AAAA,QACD;AAAA,QACA,WAAW;AAAA,MACZ,CAAE;AAAA,IACH;AACA,QACC,iCACA,oBACA,iBAAiB,QAChB;AACD,aAAO,KAAM;AAAA,QACZ,UAAM;AAAA,UACL;AAAA,UACA;AAAA,QACD;AAAA,QACA,WAAW;AAAA,MACZ,CAAE;AAAA,IACH;AACA,QAAK,mBAAmB,gBAAgB,QAAS;AAChD,aAAO,KAAM;AAAA,QACZ,UAAM;AAAA,UACL;AAAA,UACA;AAAA,QACD;AAAA,QACA,WAAW;AAAA,MACZ,CAAE;AAAA,IACH;AACA,WAAO;AAAA,EACR,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\n/**\n * React hook that overrides a global settings object with block and element specific settings.\n *\n * @param {Object} parentSettings Settings object.\n * @param {blockName?} blockName Block name.\n * @param {element?} element Element name.\n *\n * @return {Object} Merge of settings and supports.\n */\nexport function useSettingsForBlockElement(\n\tparentSettings,\n\tblockName,\n\telement\n) {\n\tconst { supportedStyles, supports } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tsupportedStyles: unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t).getSupportedStyles( blockName, element ),\n\t\t\t\tsupports:\n\t\t\t\t\tselect( blocksStore ).getBlockType( blockName )?.supports,\n\t\t\t};\n\t\t},\n\t\t[ blockName, element ]\n\t);\n\n\treturn useMemo( () => {\n\t\tconst updatedSettings = { ...parentSettings };\n\n\t\tif ( ! supportedStyles.includes( 'fontSize' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontSizes: {},\n\t\t\t\tcustomFontSize: false,\n\t\t\t\tdefaultFontSizes: false,\n\t\t\t};\n\t\t}\n\n\t\tif ( ! supportedStyles.includes( 'fontFamily' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\tfontFamilies: {},\n\t\t\t};\n\t\t}\n\n\t\tupdatedSettings.color = {\n\t\t\t...updatedSettings.color,\n\t\t\ttext:\n\t\t\t\tupdatedSettings.color?.text &&\n\t\t\t\tsupportedStyles.includes( 'color' ),\n\t\t\tbackground:\n\t\t\t\tupdatedSettings.color?.background &&\n\t\t\t\t( supportedStyles.includes( 'background' ) ||\n\t\t\t\t\tsupportedStyles.includes( 'backgroundColor' ) ),\n\t\t\tbutton:\n\t\t\t\tupdatedSettings.color?.button &&\n\t\t\t\tsupportedStyles.includes( 'buttonColor' ),\n\t\t\theading:\n\t\t\t\tupdatedSettings.color?.heading &&\n\t\t\t\tsupportedStyles.includes( 'headingColor' ),\n\t\t\tlink:\n\t\t\t\tupdatedSettings.color?.link &&\n\t\t\t\tsupportedStyles.includes( 'linkColor' ),\n\t\t\tcaption:\n\t\t\t\tupdatedSettings.color?.caption &&\n\t\t\t\tsupportedStyles.includes( 'captionColor' ),\n\t\t};\n\n\t\t// Some blocks can enable background colors but disable gradients.\n\t\t// Preserve gradient settings when background.gradient is supported.\n\t\tif (\n\t\t\t! supportedStyles.includes( 'background' ) &&\n\t\t\t! supportedStyles.includes( 'backgroundGradient' )\n\t\t) {\n\t\t\tupdatedSettings.color.gradients = [];\n\t\t\tupdatedSettings.color.customGradient = false;\n\t\t}\n\n\t\t// If filters are not supported by the block/element, disable duotone.\n\t\tif ( ! supportedStyles.includes( 'filter' ) ) {\n\t\t\tupdatedSettings.color.defaultDuotone = false;\n\t\t\tupdatedSettings.color.customDuotone = false;\n\t\t}\n\n\t\t[\n\t\t\t'lineHeight',\n\t\t\t'fontStyle',\n\t\t\t'fontWeight',\n\t\t\t'letterSpacing',\n\t\t\t'textAlign',\n\t\t\t'textTransform',\n\t\t\t'textDecoration',\n\t\t\t'textIndent',\n\t\t\t'writingMode',\n\t\t].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.typography = {\n\t\t\t\t\t...updatedSettings.typography,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t// Text indent needs explicit handling since it may not be in parent settings.\n\t\tif ( supportedStyles.includes( 'textIndent' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextIndent:\n\t\t\t\t\tupdatedSettings.typography?.textIndent ?? 'subsequent',\n\t\t\t};\n\t\t}\n\n\t\t// The column-count style is named text column to reduce confusion with\n\t\t// the columns block and manage expectations from the support.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/33587\n\t\tif ( ! supportedStyles.includes( 'columnCount' ) ) {\n\t\t\tupdatedSettings.typography = {\n\t\t\t\t...updatedSettings.typography,\n\t\t\t\ttextColumns: false,\n\t\t\t};\n\t\t}\n\n\t\t[ 'contentSize', 'wideSize' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.layout = {\n\t\t\t\t\t...updatedSettings.layout,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'padding', 'margin', 'blockGap' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst sides = Array.isArray( supports?.spacing?.[ key ] )\n\t\t\t\t? supports?.spacing?.[ key ]\n\t\t\t\t: supports?.spacing?.[ key ]?.sides;\n\t\t\t// Check if spacing type is supported before adding sides.\n\t\t\tif ( sides?.length && updatedSettings.spacing?.[ key ] ) {\n\t\t\t\tupdatedSettings.spacing = {\n\t\t\t\t\t...updatedSettings.spacing,\n\t\t\t\t\t[ key ]: {\n\t\t\t\t\t\t...updatedSettings.spacing?.[ key ],\n\t\t\t\t\t\tsides,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'aspectRatio', 'height', 'minHeight', 'width' ].forEach( ( key ) => {\n\t\t\tif ( ! supportedStyles.includes( key ) ) {\n\t\t\t\tupdatedSettings.dimensions = {\n\t\t\t\t\t...updatedSettings.dimensions,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {\n\t\t\tif (\n\t\t\t\t! supportedStyles.includes(\n\t\t\t\t\t'border' + key.charAt( 0 ).toUpperCase() + key.slice( 1 )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tupdatedSettings.border = {\n\t\t\t\t\t...updatedSettings.border,\n\t\t\t\t\t[ key ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\t[\n\t\t\t[ 'backgroundImage', 'backgroundImage' ],\n\t\t\t[ 'backgroundSize', 'backgroundSize' ],\n\t\t\t[ 'backgroundGradient', 'gradient' ],\n\t\t].forEach( ( [ styleKey, settingKey ] ) => {\n\t\t\tif ( ! supportedStyles.includes( styleKey ) ) {\n\t\t\t\tupdatedSettings.background = {\n\t\t\t\t\t...updatedSettings.background,\n\t\t\t\t\t[ settingKey ]: false,\n\t\t\t\t};\n\t\t\t}\n\t\t} );\n\n\t\tupdatedSettings.shadow = supportedStyles.includes( 'shadow' )\n\t\t\t? updatedSettings.shadow\n\t\t\t: false;\n\n\t\treturn updatedSettings;\n\t}, [ parentSettings, supportedStyles, supports ] );\n}\n\nexport function useColorsPerOrigin( settings ) {\n\tconst customColors = settings?.color?.palette?.custom;\n\tconst themeColors = settings?.color?.palette?.theme;\n\tconst defaultColors = settings?.color?.palette?.default;\n\tconst shouldDisplayDefaultColors = settings?.color?.defaultPalette;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomColors,\n\t\tthemeColors,\n\t\tdefaultColors,\n\t\tshouldDisplayDefaultColors,\n\t] );\n}\n\nexport function useGradientsPerOrigin( settings ) {\n\tconst customGradients = settings?.color?.gradients?.custom;\n\tconst themeGradients = settings?.color?.gradients?.theme;\n\tconst defaultGradients = settings?.color?.gradients?.default;\n\tconst shouldDisplayDefaultGradients = settings?.color?.defaultGradients;\n\n\treturn useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [\n\t\tcustomGradients,\n\t\tthemeGradients,\n\t\tdefaultGradients,\n\t\tshouldDisplayDefaultGradients,\n\t] );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,kBAA0B;AAC1B,oBAAqC;AACrC,kBAAmB;AAKnB,yBAAuB;AAWhB,SAAS,2BACf,gBACA,WACA,SACC;AACD,QAAM,EAAE,iBAAiB,SAAS,QAAI;AAAA,IACrC,CAAE,WAAY;AACb,aAAO;AAAA,QACN,qBAAiB;AAAA,UAChB,OAAQ,cAAAA,KAAY;AAAA,QACrB,EAAE,mBAAoB,WAAW,OAAQ;AAAA,QACzC,UACC,OAAQ,cAAAA,KAAY,EAAE,aAAc,SAAU,GAAG;AAAA,MACnD;AAAA,IACD;AAAA,IACA,CAAE,WAAW,OA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  "names": ["blocksStore"]
7
7
  }
@@ -114,7 +114,8 @@ var StylesTab = ({
114
114
  import_inspector_controls.default.Slot,
115
115
  {
116
116
  group: "background",
117
- label: (0, import_i18n.__)("Background image")
117
+ label: (0, import_i18n.__)("Background image"),
118
+ className: "background-block-support-panel__inner-wrapper"
118
119
  }
119
120
  ),
120
121
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inspector_controls.default.Slot, { group: "filter" }),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/inspector-controls-tabs/styles-tab.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport InspectorControls from '../inspector-controls';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { useBlockSettings } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { ColorEdit } from '../../hooks/color';\nimport { ColorToolsPanel } from '../global-styles/color-panel';\n\nfunction SectionBlockColorControls( {\n\tblockName,\n\tclientId,\n\tcontentClientIds,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst { hasButtons, hasHeading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNames =\n\t\t\t\tselect( blockEditorStore ).getBlockNamesByClientId(\n\t\t\t\t\tcontentClientIds\n\t\t\t\t);\n\t\t\treturn {\n\t\t\t\thasButtons: blockNames.includes( 'core/buttons' ),\n\t\t\t\thasHeading: blockNames.includes( 'core/heading' ),\n\t\t\t};\n\t\t},\n\t\t[ contentClientIds ]\n\t);\n\n\tconst setAttributes = ( newAttributes ) => {\n\t\tupdateBlockAttributes( clientId, newAttributes );\n\t};\n\n\treturn (\n\t\t<ColorEdit\n\t\t\tclientId={ clientId }\n\t\t\tname={ blockName }\n\t\t\tsettings={ settings }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tasWrapper={ ColorToolsPanel }\n\t\t\tlabel={ __( 'Color' ) }\n\t\t\tdefaultControls={ {\n\t\t\t\ttext: true,\n\t\t\t\tbackground: true,\n\t\t\t\tbutton: hasButtons,\n\t\t\t\theading: hasHeading,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nconst StylesTab = ( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) => {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && <BlockStyles clientId={ clientId } /> }\n\t\t\t{ isSectionBlock && (\n\t\t\t\t<SectionBlockColorControls\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isSectionBlock && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\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4EACG;AAAA,sBAAkB,4CAAC,oBAAAC,SAAA,EAAY,UAAsB;AAAA,IACrD,kBACD;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IAEC,CAAE,kBACH,4EACC;AAAA;AAAA,QAAC,0BAAAC,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,OAAQ;AAAA,UACpB,WAAU;AAAA;AAAA,MACX;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,kBAAmB;AAAA;AAAA,MAChC;AAAA,MACA,4CAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,UAAS;AAAA,MACvC;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,OAAQ;AAAA;AAAA,MACT;AAAA,MACA,4CAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,UAAS;AAAA,OACxC;AAAA,KAEF;AAEF;AAEA,IAAO,qBAAQ;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockStyles from '../block-styles';\nimport InspectorControls from '../inspector-controls';\nimport { useBorderPanelLabel } from '../../hooks/border';\nimport { useBlockSettings } from '../../hooks/utils';\nimport { store as blockEditorStore } from '../../store';\nimport { ColorEdit } from '../../hooks/color';\nimport { ColorToolsPanel } from '../global-styles/color-panel';\n\nfunction SectionBlockColorControls( {\n\tblockName,\n\tclientId,\n\tcontentClientIds,\n} ) {\n\tconst settings = useBlockSettings( blockName );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst { hasButtons, hasHeading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst blockNames =\n\t\t\t\tselect( blockEditorStore ).getBlockNamesByClientId(\n\t\t\t\t\tcontentClientIds\n\t\t\t\t);\n\t\t\treturn {\n\t\t\t\thasButtons: blockNames.includes( 'core/buttons' ),\n\t\t\t\thasHeading: blockNames.includes( 'core/heading' ),\n\t\t\t};\n\t\t},\n\t\t[ contentClientIds ]\n\t);\n\n\tconst setAttributes = ( newAttributes ) => {\n\t\tupdateBlockAttributes( clientId, newAttributes );\n\t};\n\n\treturn (\n\t\t<ColorEdit\n\t\t\tclientId={ clientId }\n\t\t\tname={ blockName }\n\t\t\tsettings={ settings }\n\t\t\tsetAttributes={ setAttributes }\n\t\t\tasWrapper={ ColorToolsPanel }\n\t\t\tlabel={ __( 'Color' ) }\n\t\t\tdefaultControls={ {\n\t\t\t\ttext: true,\n\t\t\t\tbackground: true,\n\t\t\t\tbutton: hasButtons,\n\t\t\t\theading: hasHeading,\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nconst StylesTab = ( {\n\tblockName,\n\tclientId,\n\thasBlockStyles,\n\tisSectionBlock,\n\tcontentClientIds,\n} ) => {\n\tconst borderPanelLabel = useBorderPanelLabel( { blockName } );\n\n\treturn (\n\t\t<>\n\t\t\t{ hasBlockStyles && <BlockStyles clientId={ clientId } /> }\n\t\t\t{ isSectionBlock && (\n\t\t\t\t<SectionBlockColorControls\n\t\t\t\t\tblockName={ blockName }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tcontentClientIds={ contentClientIds }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ! isSectionBlock && (\n\t\t\t\t<>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"color\"\n\t\t\t\t\t\tlabel={ __( 'Color' ) }\n\t\t\t\t\t\tclassName=\"color-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"background\"\n\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\tclassName=\"background-block-support-panel__inner-wrapper\"\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"filter\" />\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"typography\"\n\t\t\t\t\t\tlabel={ __( 'Typography' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"dimensions\"\n\t\t\t\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot\n\t\t\t\t\t\tgroup=\"border\"\n\t\t\t\t\t\tlabel={ borderPanelLabel }\n\t\t\t\t\t/>\n\t\t\t\t\t<InspectorControls.Slot group=\"styles\" />\n\t\t\t\t</>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default StylesTab;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,kBAAuC;AAKvC,0BAAwB;AACxB,gCAA8B;AAC9B,oBAAoC;AACpC,mBAAiC;AACjC,mBAA0C;AAC1C,mBAA0B;AAC1B,yBAAgC;AA6B9B;AA3BF,SAAS,0BAA2B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,eAAW,+BAAkB,SAAU;AAC7C,QAAM,EAAE,sBAAsB,QAAI,yBAAa,aAAAA,KAAiB;AAEhE,QAAM,EAAE,YAAY,WAAW,QAAI;AAAA,IAClC,CAAE,WAAY;AACb,YAAM,aACL,OAAQ,aAAAA,KAAiB,EAAE;AAAA,QAC1B;AAAA,MACD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,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,WAAQ,gBAAI,YAAa;AAAA;AAAA,MAC1B;AAAA,MACA;AAAA,QAAC,0BAAAA,QAAkB;AAAA,QAAlB;AAAA,UACA,OAAM;AAAA,UACN,OAAQ;AAAA;AAAA,MACT;AAAA,MACA,4CAAC,0BAAAA,QAAkB,MAAlB,EAAuB,OAAM,UAAS;AAAA,OACxC;AAAA,KAEF;AAEF;AAEA,IAAO,qBAAQ;",
6
6
  "names": ["blockEditorStore", "BlockStyles", "InspectorControls"]
7
7
  }
@@ -39,6 +39,7 @@ __export(background_exports, {
39
39
  setBackgroundStyleDefaults: () => setBackgroundStyleDefaults
40
40
  });
41
41
  module.exports = __toCommonJS(background_exports);
42
+ var import_clsx = __toESM(require("clsx"));
42
43
  var import_blocks = require("@wordpress/blocks");
43
44
  var import_data = require("@wordpress/data");
44
45
  var import_element = require("@wordpress/element");
@@ -60,7 +61,7 @@ function hasBackgroundSupport(blockName, feature = "any") {
60
61
  return true;
61
62
  }
62
63
  if (feature === "any") {
63
- return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat;
64
+ return !!support?.backgroundImage || !!support?.backgroundSize || !!support?.backgroundRepeat || !!support?.gradient;
64
65
  }
65
66
  return !!support?.[feature];
66
67
  }
@@ -96,18 +97,32 @@ function useBlockProps({ name, style }) {
96
97
  };
97
98
  }
98
99
  function getBackgroundImageClasses(style) {
99
- return (0, import_background_panel.hasBackgroundImageValue)(style) ? "has-background" : "";
100
+ return (0, import_background_panel.hasBackgroundImageValue)(style) || (0, import_background_panel.hasBackgroundGradientValue)(style) ? "has-background" : "";
100
101
  }
101
- function BackgroundInspectorControl({ children }) {
102
- const resetAllFilter = (0, import_element.useCallback)((attributes) => {
103
- return {
104
- ...attributes,
105
- style: {
106
- ...attributes.style,
107
- background: void 0
108
- }
109
- };
110
- }, []);
102
+ function BackgroundInspectorControl({
103
+ children,
104
+ backgroundGradientSupported = false
105
+ }) {
106
+ const resetAllFilter = (0, import_element.useCallback)(
107
+ (attributes) => {
108
+ const updatedClassName = attributes.className?.includes(
109
+ "has-background"
110
+ ) ? attributes.className.split(" ").filter((c) => c !== "has-background").join(" ") || void 0 : attributes.className;
111
+ return {
112
+ ...attributes,
113
+ className: updatedClassName,
114
+ style: (0, import_utils.cleanEmptyObject)({
115
+ ...attributes.style,
116
+ background: void 0,
117
+ color: backgroundGradientSupported ? {
118
+ ...attributes.style?.color,
119
+ gradient: void 0
120
+ } : attributes.style?.color
121
+ })
122
+ };
123
+ },
124
+ [backgroundGradientSupported]
125
+ );
111
126
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_inspector_controls.default, { group: "background", resetAllFilter, children });
112
127
  }
113
128
  function BackgroundImagePanel({
@@ -116,12 +131,14 @@ function BackgroundImagePanel({
116
131
  setAttributes,
117
132
  settings
118
133
  }) {
119
- const { style, inheritedValue } = (0, import_data.useSelect)(
134
+ const { style, className, inheritedValue } = (0, import_data.useSelect)(
120
135
  (select) => {
121
136
  const { getBlockAttributes, getSettings } = select(import_store.store);
122
137
  const _settings = getSettings();
138
+ const blockAttributes = getBlockAttributes(clientId);
123
139
  return {
124
- style: getBlockAttributes(clientId)?.style,
140
+ style: blockAttributes?.style,
141
+ className: blockAttributes?.className,
125
142
  /*
126
143
  * To ensure we pass down the right inherited values:
127
144
  * @TODO 1. Pass inherited value down to all block style controls,
@@ -134,14 +151,50 @@ function BackgroundImagePanel({
134
151
  },
135
152
  [clientId, name]
136
153
  );
137
- if (!(0, import_background_panel.useHasBackgroundPanel)(settings) || !hasBackgroundSupport(name, "backgroundImage")) {
154
+ const backgroundGradientSupported = hasBackgroundSupport(
155
+ name,
156
+ "gradient"
157
+ );
158
+ const as = (0, import_element.useCallback)(
159
+ ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
160
+ BackgroundInspectorControl,
161
+ {
162
+ backgroundGradientSupported,
163
+ children
164
+ }
165
+ ),
166
+ [backgroundGradientSupported]
167
+ );
168
+ if (!(0, import_background_panel.useHasBackgroundPanel)(settings) || !hasBackgroundSupport(name)) {
138
169
  return null;
139
170
  }
140
171
  const onChange = (newStyle) => {
141
- setAttributes({
142
- style: (0, import_utils.cleanEmptyObject)(newStyle)
143
- });
172
+ const isMigrating = backgroundGradientSupported && !!style?.color?.gradient;
173
+ const newAttributes = {
174
+ style: (0, import_utils.cleanEmptyObject)(
175
+ backgroundGradientSupported ? {
176
+ ...newStyle,
177
+ color: {
178
+ ...newStyle?.color,
179
+ gradient: void 0
180
+ }
181
+ } : newStyle
182
+ )
183
+ };
184
+ if (isMigrating && !!newStyle?.background?.gradient) {
185
+ newAttributes.className = (0, import_clsx.default)(className, "has-background");
186
+ } else if (!newStyle?.background?.gradient && className?.includes("has-background")) {
187
+ newAttributes.className = className.split(" ").filter((c) => c !== "has-background").join(" ") || void 0;
188
+ }
189
+ setAttributes(newAttributes);
144
190
  };
191
+ const styleValue = backgroundGradientSupported && !style?.background?.gradient && style?.color?.gradient ? {
192
+ ...style,
193
+ background: {
194
+ ...style?.background,
195
+ gradient: style?.color?.gradient
196
+ }
197
+ } : style;
145
198
  const updatedSettings = {
146
199
  ...settings,
147
200
  background: {
@@ -151,19 +204,19 @@ function BackgroundImagePanel({
151
204
  };
152
205
  const defaultControls = (0, import_blocks.getBlockSupport)(name, [
153
206
  BACKGROUND_SUPPORT_KEY,
154
- "defaultControls"
207
+ "__experimentalDefaultControls"
155
208
  ]);
156
209
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
157
210
  import_background_panel.default,
158
211
  {
159
212
  inheritedValue,
160
- as: BackgroundInspectorControl,
213
+ as,
161
214
  panelId: clientId,
162
215
  defaultValues: BACKGROUND_BLOCK_DEFAULT_VALUES,
163
216
  settings: updatedSettings,
164
217
  onChange,
165
218
  defaultControls,
166
- value: style
219
+ value: styleValue
167
220
  }
168
221
  );
169
222
  }