@wordpress/block-editor 15.15.0 → 15.16.1-next.v.202604091042.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.
- package/CHANGELOG.md +2 -0
- package/build/components/autocomplete/index.cjs +1 -2
- package/build/components/autocomplete/index.cjs.map +3 -3
- package/build/components/block-inspector/index.cjs +2 -1
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block-crash-warning.cjs +4 -2
- package/build/components/block-list/block-crash-warning.cjs.map +2 -2
- package/build/components/block-list/block-html.cjs +6 -2
- package/build/components/block-list/block-html.cjs.map +2 -2
- package/build/components/block-mover/button.cjs +4 -3
- package/build/components/block-mover/button.cjs.map +2 -2
- package/build/components/block-mover/index.cjs +1 -8
- package/build/components/block-mover/index.cjs.map +2 -2
- package/build/components/block-visibility/modal.cjs +2 -2
- package/build/components/block-visibility/modal.cjs.map +1 -1
- package/build/components/block-visibility/viewport-visibility-info.cjs +6 -1
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +142 -33
- package/build/components/global-styles/background-panel.cjs.map +2 -2
- package/build/components/global-styles/color-panel.cjs +18 -7
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/hooks.cjs +8 -4
- package/build/components/global-styles/hooks.cjs.map +2 -2
- package/build/components/iframe/get-compatibility-styles.cjs +1 -1
- package/build/components/iframe/get-compatibility-styles.cjs.map +2 -2
- package/build/components/inserter/media-tab/hooks.cjs +1 -1
- package/build/components/inserter/media-tab/hooks.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +2 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/link-control/search-input.cjs +1 -1
- package/build/components/link-control/search-input.cjs.map +2 -2
- package/build/components/link-picker/link-preview.cjs +2 -1
- package/build/components/link-picker/link-preview.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -1
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/input-event.cjs +3 -3
- package/build/components/rich-text/input-event.cjs.map +2 -2
- package/build/components/use-on-block-drop/index.cjs +1 -1
- package/build/components/use-on-block-drop/index.cjs.map +2 -2
- package/build/components/use-paste-styles/index.cjs +2 -2
- package/build/components/use-paste-styles/index.cjs.map +2 -2
- package/build/hooks/background.cjs +74 -21
- package/build/hooks/background.cjs.map +3 -3
- package/build/hooks/block-style-variation.cjs +5 -6
- package/build/hooks/block-style-variation.cjs.map +3 -3
- package/build/hooks/cross-origin-isolation.cjs +6 -6
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +5 -0
- package/build/hooks/custom-css.cjs.map +2 -2
- package/build/hooks/fit-text.cjs +46 -58
- package/build/hooks/fit-text.cjs.map +3 -3
- package/build/hooks/index.cjs +2 -2
- package/build/hooks/index.cjs.map +2 -2
- package/build/hooks/utils.cjs +5 -1
- package/build/hooks/utils.cjs.map +2 -2
- package/build/private-apis.cjs +1 -1
- package/build/private-apis.cjs.map +1 -1
- package/build/store/actions.cjs +8 -12
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +2 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +112 -146
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +14 -15
- package/build/store/selectors.cjs.map +2 -2
- package/build/store/utils.cjs +1 -1
- package/build/store/utils.cjs.map +2 -2
- package/build/utils/pasting.cjs +1 -1
- package/build/utils/pasting.cjs.map +2 -2
- package/build-module/components/autocomplete/index.mjs +1 -2
- package/build-module/components/autocomplete/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +2 -1
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block-crash-warning.mjs +4 -2
- package/build-module/components/block-list/block-crash-warning.mjs.map +2 -2
- package/build-module/components/block-list/block-html.mjs +7 -3
- package/build-module/components/block-list/block-html.mjs.map +2 -2
- package/build-module/components/block-mover/button.mjs +4 -3
- package/build-module/components/block-mover/button.mjs.map +2 -2
- package/build-module/components/block-mover/index.mjs +1 -8
- package/build-module/components/block-mover/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +2 -2
- package/build-module/components/block-visibility/modal.mjs.map +1 -1
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +6 -1
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +141 -34
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +17 -7
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/hooks.mjs +8 -4
- package/build-module/components/global-styles/hooks.mjs.map +2 -2
- package/build-module/components/iframe/get-compatibility-styles.mjs +1 -1
- package/build-module/components/iframe/get-compatibility-styles.mjs.map +2 -2
- package/build-module/components/inserter/media-tab/hooks.mjs +1 -1
- package/build-module/components/inserter/media-tab/hooks.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +2 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/link-control/search-input.mjs +1 -1
- package/build-module/components/link-control/search-input.mjs.map +2 -2
- package/build-module/components/link-picker/link-preview.mjs +2 -1
- package/build-module/components/link-picker/link-preview.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +2 -2
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/input-event.mjs +2 -2
- package/build-module/components/rich-text/input-event.mjs.map +2 -2
- package/build-module/components/use-on-block-drop/index.mjs +1 -1
- package/build-module/components/use-on-block-drop/index.mjs.map +2 -2
- package/build-module/components/use-paste-styles/index.mjs +2 -2
- package/build-module/components/use-paste-styles/index.mjs.map +2 -2
- package/build-module/hooks/background.mjs +76 -22
- package/build-module/hooks/background.mjs.map +2 -2
- package/build-module/hooks/block-style-variation.mjs +4 -5
- package/build-module/hooks/block-style-variation.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +6 -6
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +5 -0
- package/build-module/hooks/custom-css.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs +46 -58
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/index.mjs +2 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +5 -1
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/private-apis.mjs +2 -2
- package/build-module/private-apis.mjs.map +1 -1
- package/build-module/store/actions.mjs +8 -12
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +2 -2
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +112 -145
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +14 -15
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/store/utils.mjs +1 -1
- package/build-module/store/utils.mjs.map +2 -2
- package/build-module/utils/pasting.mjs +1 -1
- package/build-module/utils/pasting.mjs.map +2 -2
- package/build-style/content-rtl.css +2 -2
- package/build-style/content.css +2 -2
- package/build-style/style-rtl.css +35 -14
- package/build-style/style.css +35 -14
- package/package.json +38 -39
- package/src/autocompleters/style.scss +0 -8
- package/src/components/autocomplete/index.js +1 -2
- package/src/components/background-image-control/style.scss +0 -4
- package/src/components/block-draggable/test/helpers.native.js +1 -1
- package/src/components/block-inspector/index.js +1 -0
- package/src/components/block-list/block-crash-warning.js +3 -1
- package/src/components/block-list/block-crash-warning.native.js +3 -1
- package/src/components/block-list/block-html.js +13 -3
- package/src/components/block-mover/button.js +7 -4
- package/src/components/block-mover/index.js +1 -8
- package/src/components/block-visibility/viewport-visibility-info.js +8 -1
- package/src/components/fit-text-size-warning/style.scss +1 -5
- package/src/components/global-styles/background-panel.js +157 -11
- package/src/components/global-styles/color-panel.js +23 -7
- package/src/components/global-styles/hooks.js +12 -4
- package/src/components/global-styles/test/background-panel.js +44 -1
- package/src/components/iframe/get-compatibility-styles.js +1 -1
- package/src/components/inserter/media-tab/hooks.js +1 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-picker/link-preview.js +2 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/rich-text/index.native.js +1 -1
- package/src/components/rich-text/input-event.js +1 -1
- package/src/components/rich-text/input-event.native.js +1 -1
- package/src/components/rich-text/native/index.native.js +18 -17
- package/src/components/use-on-block-drop/index.js +1 -1
- package/src/components/use-paste-styles/index.js +2 -2
- package/src/hooks/background.js +122 -21
- package/src/hooks/background.scss +45 -0
- package/src/hooks/block-style-variation.js +3 -4
- package/src/hooks/cross-origin-isolation.js +6 -6
- package/src/hooks/custom-css.js +6 -0
- package/src/hooks/fit-text.js +73 -83
- package/src/hooks/index.js +1 -1
- package/src/hooks/test/cross-origin-isolation.js +7 -3
- package/src/hooks/utils.js +4 -0
- package/src/private-apis.js +2 -2
- package/src/store/actions.js +9 -16
- package/src/store/private-selectors.js +2 -2
- package/src/store/reducer.js +144 -193
- package/src/store/selectors.js +33 -23
- package/src/store/test/private-selectors.js +107 -71
- package/src/store/test/reducer.js +593 -152
- package/src/store/test/registry-selectors.js +1 -1
- package/src/store/test/selectors.js +345 -262
- package/src/store/utils.js +1 -1
- package/src/style.scss +1 -0
- package/src/utils/pasting.js +1 -1
- package/build/autocompleters/link.cjs +0 -81
- package/build/autocompleters/link.cjs.map +0 -7
- package/build-module/autocompleters/link.mjs +0 -50
- package/build-module/autocompleters/link.mjs.map +0 -7
- package/src/autocompleters/link.js +0 -63
|
@@ -31,23 +31,33 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var background_panel_exports = {};
|
|
32
32
|
__export(background_panel_exports, {
|
|
33
33
|
default: () => BackgroundImagePanel,
|
|
34
|
+
hasBackgroundGradientValue: () => hasBackgroundGradientValue,
|
|
34
35
|
hasBackgroundImageValue: () => hasBackgroundImageValue,
|
|
35
36
|
hasBackgroundSizeValue: () => hasBackgroundSizeValue,
|
|
37
|
+
useHasBackgroundControl: () => useHasBackgroundControl,
|
|
36
38
|
useHasBackgroundPanel: () => useHasBackgroundPanel
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(background_panel_exports);
|
|
39
41
|
var import_components = require("@wordpress/components");
|
|
40
42
|
var import_element = require("@wordpress/element");
|
|
41
43
|
var import_i18n = require("@wordpress/i18n");
|
|
44
|
+
var import_global_styles_engine = require("@wordpress/global-styles-engine");
|
|
42
45
|
var import_background_image_control = __toESM(require("../background-image-control/index.cjs"));
|
|
46
|
+
var import_color_panel = require("./color-panel.cjs");
|
|
47
|
+
var import_hooks = require("./hooks.cjs");
|
|
43
48
|
var import_utils = require("./utils.cjs");
|
|
44
49
|
var import_object = require("../../utils/object.cjs");
|
|
45
50
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
51
|
var DEFAULT_CONTROLS = {
|
|
47
|
-
backgroundImage: true
|
|
52
|
+
backgroundImage: true,
|
|
53
|
+
gradient: true
|
|
48
54
|
};
|
|
55
|
+
function useHasBackgroundControl(settings, feature) {
|
|
56
|
+
return import_element.Platform.OS === "web" && settings?.background?.[feature];
|
|
57
|
+
}
|
|
49
58
|
function useHasBackgroundPanel(settings) {
|
|
50
|
-
|
|
59
|
+
const { backgroundImage, gradient } = settings?.background || {};
|
|
60
|
+
return import_element.Platform.OS === "web" && (backgroundImage || gradient);
|
|
51
61
|
}
|
|
52
62
|
function hasBackgroundSizeValue(style) {
|
|
53
63
|
return style?.background?.backgroundPosition !== void 0 || style?.background?.backgroundSize !== void 0;
|
|
@@ -56,6 +66,9 @@ function hasBackgroundImageValue(style) {
|
|
|
56
66
|
return !!style?.background?.backgroundImage?.id || // Supports url() string values in theme.json.
|
|
57
67
|
"string" === typeof style?.background?.backgroundImage || !!style?.background?.backgroundImage?.url;
|
|
58
68
|
}
|
|
69
|
+
function hasBackgroundGradientValue(style) {
|
|
70
|
+
return "string" === typeof style?.background?.gradient && style?.background?.gradient !== "";
|
|
71
|
+
}
|
|
59
72
|
function BackgroundToolsPanel({
|
|
60
73
|
resetAllFilter,
|
|
61
74
|
onChange,
|
|
@@ -75,8 +88,12 @@ function BackgroundToolsPanel({
|
|
|
75
88
|
label: headerLabel,
|
|
76
89
|
resetAll,
|
|
77
90
|
panelId,
|
|
91
|
+
hasInnerWrapper: true,
|
|
92
|
+
className: "background-block-support-panel",
|
|
93
|
+
__experimentalFirstVisibleItemClass: "first",
|
|
94
|
+
__experimentalLastVisibleItemClass: "last",
|
|
78
95
|
dropdownMenuProps,
|
|
79
|
-
children
|
|
96
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "background-block-support-panel__inner-wrapper", children })
|
|
80
97
|
}
|
|
81
98
|
);
|
|
82
99
|
}
|
|
@@ -91,15 +108,76 @@ function BackgroundImagePanel({
|
|
|
91
108
|
defaultValues = {},
|
|
92
109
|
headerLabel = (0, import_i18n.__)("Background")
|
|
93
110
|
}) {
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
const gradients = (0, import_hooks.useGradientsPerOrigin)(settings);
|
|
112
|
+
const areCustomGradientsEnabled = settings?.color?.customGradient;
|
|
113
|
+
const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;
|
|
114
|
+
const hasBackgroundGradientControl = useHasBackgroundControl(
|
|
115
|
+
settings,
|
|
116
|
+
"gradient"
|
|
117
|
+
);
|
|
118
|
+
const showBackgroundGradientControl = hasGradientColors && hasBackgroundGradientControl;
|
|
119
|
+
const showBackgroundImageControl = useHasBackgroundControl(
|
|
120
|
+
settings,
|
|
121
|
+
"backgroundImage"
|
|
122
|
+
);
|
|
123
|
+
const resetAllFilter = (0, import_element.useCallback)(
|
|
124
|
+
(previousValue) => {
|
|
125
|
+
return {
|
|
126
|
+
...previousValue,
|
|
127
|
+
background: {},
|
|
128
|
+
color: hasBackgroundGradientControl ? {
|
|
129
|
+
...previousValue?.color,
|
|
130
|
+
gradient: void 0
|
|
131
|
+
} : previousValue?.color
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
[hasBackgroundGradientControl]
|
|
135
|
+
);
|
|
136
|
+
if (!showBackgroundGradientControl && !showBackgroundImageControl) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
const decodeValue = (rawValue) => (0, import_global_styles_engine.getValueFromVariable)({ settings }, "", rawValue);
|
|
140
|
+
const encodeGradientValue = (gradientValue) => {
|
|
141
|
+
const allGradients = gradients.flatMap(
|
|
142
|
+
({ gradients: originGradients }) => originGradients
|
|
143
|
+
);
|
|
144
|
+
const gradientObject = allGradients.find(
|
|
145
|
+
({ gradient }) => gradient === gradientValue
|
|
146
|
+
);
|
|
147
|
+
return gradientObject ? "var:preset|gradient|" + gradientObject.slug : gradientValue;
|
|
148
|
+
};
|
|
149
|
+
const resetBackground = () => onChange(
|
|
150
|
+
(0, import_object.setImmutably)(
|
|
151
|
+
value,
|
|
152
|
+
["background", "backgroundImage"],
|
|
153
|
+
void 0
|
|
154
|
+
)
|
|
155
|
+
);
|
|
156
|
+
const resetGradient = () => {
|
|
157
|
+
let newValue = (0, import_object.setImmutably)(
|
|
158
|
+
value,
|
|
159
|
+
["background", "gradient"],
|
|
160
|
+
void 0
|
|
161
|
+
);
|
|
162
|
+
newValue = (0, import_object.setImmutably)(newValue, ["color", "gradient"], void 0);
|
|
163
|
+
onChange(newValue);
|
|
164
|
+
};
|
|
165
|
+
const currentGradient = decodeValue(
|
|
166
|
+
value?.background?.gradient ?? value?.color?.gradient
|
|
167
|
+
);
|
|
168
|
+
const inheritedGradient = decodeValue(
|
|
169
|
+
inheritedValue?.background?.gradient ?? inheritedValue?.color?.gradient
|
|
170
|
+
);
|
|
171
|
+
const setGradient = (newGradient) => {
|
|
172
|
+
let newValue = (0, import_object.setImmutably)(
|
|
173
|
+
value,
|
|
174
|
+
["background", "gradient"],
|
|
175
|
+
encodeGradientValue(newGradient)
|
|
176
|
+
);
|
|
177
|
+
newValue = (0, import_object.setImmutably)(newValue, ["color", "gradient"], void 0);
|
|
178
|
+
onChange(newValue);
|
|
179
|
+
};
|
|
180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
103
181
|
Wrapper,
|
|
104
182
|
{
|
|
105
183
|
resetAllFilter,
|
|
@@ -107,34 +185,65 @@ function BackgroundImagePanel({
|
|
|
107
185
|
onChange,
|
|
108
186
|
panelId,
|
|
109
187
|
headerLabel,
|
|
110
|
-
children:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
188
|
+
children: [
|
|
189
|
+
showBackgroundImageControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
190
|
+
import_components.__experimentalToolsPanelItem,
|
|
191
|
+
{
|
|
192
|
+
className: "block-editor-background-panel__item",
|
|
193
|
+
hasValue: () => hasBackgroundImageValue(value),
|
|
194
|
+
label: (0, import_i18n.__)("Image"),
|
|
195
|
+
onDeselect: resetBackground,
|
|
196
|
+
isShownByDefault: defaultControls.backgroundImage,
|
|
197
|
+
panelId,
|
|
198
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
199
|
+
import_background_image_control.default,
|
|
200
|
+
{
|
|
201
|
+
value,
|
|
202
|
+
onChange,
|
|
203
|
+
settings,
|
|
204
|
+
inheritedValue,
|
|
205
|
+
defaultControls,
|
|
206
|
+
defaultValues
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
showBackgroundGradientControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
212
|
+
import_color_panel.ColorPanelDropdown,
|
|
213
|
+
{
|
|
214
|
+
className: "block-editor-background-panel__item",
|
|
215
|
+
label: (0, import_i18n.__)("Gradient"),
|
|
216
|
+
hasValue: () => hasBackgroundGradientValue(value),
|
|
217
|
+
resetValue: resetGradient,
|
|
218
|
+
isShownByDefault: defaultControls.gradient,
|
|
219
|
+
indicators: [currentGradient],
|
|
220
|
+
tabs: [
|
|
221
|
+
{
|
|
222
|
+
key: "gradient",
|
|
223
|
+
label: (0, import_i18n.__)("Gradient"),
|
|
224
|
+
inheritedValue: currentGradient ?? inheritedGradient,
|
|
225
|
+
setValue: setGradient,
|
|
226
|
+
userValue: currentGradient,
|
|
227
|
+
isGradient: true
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
colorGradientControlSettings: {
|
|
231
|
+
gradients,
|
|
232
|
+
disableCustomGradients: !areCustomGradientsEnabled
|
|
233
|
+
},
|
|
234
|
+
panelId
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
]
|
|
131
238
|
}
|
|
132
239
|
);
|
|
133
240
|
}
|
|
134
241
|
// Annotate the CommonJS export names for ESM import in node:
|
|
135
242
|
0 && (module.exports = {
|
|
243
|
+
hasBackgroundGradientValue,
|
|
136
244
|
hasBackgroundImageValue,
|
|
137
245
|
hasBackgroundSizeValue,
|
|
246
|
+
useHasBackgroundControl,
|
|
138
247
|
useHasBackgroundPanel
|
|
139
248
|
});
|
|
140
249
|
//# sourceMappingURL=background-panel.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/global-styles/background-panel.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback, Platform } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport BackgroundImageControl from '../background-image-control';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nconst DEFAULT_CONTROLS = {\n\tbackgroundImage: true,\n};\n\n/**\n * Checks site settings to see if the background panel may be used.\n * `settings.background.backgroundSize` exists also,\n * but can only be used if settings?.background?.backgroundImage is `true`.\n *\n * @param {Object} settings Site settings\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundPanel( settings ) {\n\treturn Platform.OS === 'web' &&
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,qBAAsC;AACtC,kBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback, Platform } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getValueFromVariable } from '@wordpress/global-styles-engine';\n\n/**\n * Internal dependencies\n */\nimport BackgroundImageControl from '../background-image-control';\nimport { ColorPanelDropdown } from './color-panel';\nimport { useGradientsPerOrigin } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from './utils';\nimport { setImmutably } from '../../utils/object';\n\nconst DEFAULT_CONTROLS = {\n\tbackgroundImage: true,\n\tgradient: true,\n};\n\n/**\n * Checks site settings to see if the requested feature's control may be used.\n *\n * @param {Object} settings Site settings.\n * @param {string} feature Background feature to check.\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundControl( settings, feature ) {\n\treturn Platform.OS === 'web' && settings?.background?.[ feature ];\n}\n\n/**\n * Checks site settings to see if the background panel may be used.\n * `settings.background.backgroundSize` exists also,\n * but can only be used if settings?.background?.backgroundImage is `true`.\n *\n * @param {Object} settings Site settings\n * @return {boolean} Whether site settings has activated background panel.\n */\nexport function useHasBackgroundPanel( settings ) {\n\tconst { backgroundImage, gradient } = settings?.background || {};\n\treturn Platform.OS === 'web' && ( backgroundImage || gradient );\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\treturn (\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t// Supports url() string values in theme.json.\n\t\t'string' === typeof style?.background?.backgroundImage ||\n\t\t!! style?.background?.backgroundImage?.url\n\t);\n}\n\n/**\n * Checks if there is a current value in the background gradient block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether the block has a background gradient value set.\n */\nexport function hasBackgroundGradientValue( style ) {\n\treturn (\n\t\t'string' === typeof style?.background?.gradient &&\n\t\tstyle?.background?.gradient !== ''\n\t);\n}\n\nfunction BackgroundToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\theaderLabel,\n} ) {\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ headerLabel }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\thasInnerWrapper\n\t\t\tclassName=\"background-block-support-panel\"\n\t\t\t__experimentalFirstVisibleItemClass=\"first\"\n\t\t\t__experimentalLastVisibleItemClass=\"last\"\n\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t>\n\t\t\t<div className=\"background-block-support-panel__inner-wrapper\">\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ToolsPanel>\n\t);\n}\n\nexport default function BackgroundImagePanel( {\n\tas: Wrapper = BackgroundToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tdefaultValues = {},\n\theaderLabel = __( 'Background' ),\n} ) {\n\tconst gradients = useGradientsPerOrigin( settings );\n\tconst areCustomGradientsEnabled = settings?.color?.customGradient;\n\tconst hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;\n\n\tconst hasBackgroundGradientControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'gradient'\n\t);\n\tconst showBackgroundGradientControl =\n\t\thasGradientColors && hasBackgroundGradientControl;\n\tconst showBackgroundImageControl = useHasBackgroundControl(\n\t\tsettings,\n\t\t'backgroundImage'\n\t);\n\n\tconst resetAllFilter = useCallback(\n\t\t( previousValue ) => {\n\t\t\treturn {\n\t\t\t\t...previousValue,\n\t\t\t\tbackground: {},\n\t\t\t\tcolor: hasBackgroundGradientControl\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...previousValue?.color,\n\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t }\n\t\t\t\t\t: previousValue?.color,\n\t\t\t};\n\t\t},\n\t\t[ hasBackgroundGradientControl ]\n\t);\n\n\tif ( ! showBackgroundGradientControl && ! showBackgroundImageControl ) {\n\t\treturn null;\n\t}\n\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\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\tconst resetBackground = () =>\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'background', 'backgroundImage' ],\n\t\t\t\tundefined\n\t\t\t)\n\t\t);\n\n\tconst resetGradient = () => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tundefined\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\n\t};\n\n\t// Get current gradient value, decoding preset slug references.\n\t// Fall back to color.gradient for legacy blocks that haven't migrated\n\t// to background.gradient yet (mirrors block inspector fallback in\n\t// packages/block-editor/src/hooks/background.js).\n\tconst currentGradient = decodeValue(\n\t\tvalue?.background?.gradient ?? value?.color?.gradient\n\t);\n\tconst inheritedGradient = decodeValue(\n\t\tinheritedValue?.background?.gradient ?? inheritedValue?.color?.gradient\n\t);\n\n\t// Set gradient value, encoding preset matches as slug references.\n\t// Also clear color.gradient to migrate from the legacy location,\n\t// matching the block inspector behavior in hooks/background.js.\n\tconst setGradient = ( newGradient ) => {\n\t\tlet newValue = setImmutably(\n\t\t\tvalue,\n\t\t\t[ 'background', 'gradient' ],\n\t\t\tencodeGradientValue( newGradient )\n\t\t);\n\t\tnewValue = setImmutably( newValue, [ 'color', 'gradient' ], undefined );\n\t\tonChange( newValue );\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\theaderLabel={ headerLabel }\n\t\t>\n\t\t\t{ showBackgroundImageControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"block-editor-background-panel__item\"\n\t\t\t\t\thasValue={ () => hasBackgroundImageValue( value ) }\n\t\t\t\t\tlabel={ __( 'Image' ) }\n\t\t\t\t\tonDeselect={ resetBackground }\n\t\t\t\t\tisShownByDefault={ defaultControls.backgroundImage }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BackgroundImageControl\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tinheritedValue={ inheritedValue }\n\t\t\t\t\t\tdefaultControls={ defaultControls }\n\t\t\t\t\t\tdefaultValues={ defaultValues }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBackgroundGradientControl && (\n\t\t\t\t<ColorPanelDropdown\n\t\t\t\t\tclassName=\"block-editor-background-panel__item\"\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t\thasValue={ () => hasBackgroundGradientValue( value ) }\n\t\t\t\t\tresetValue={ resetGradient }\n\t\t\t\t\tisShownByDefault={ defaultControls.gradient }\n\t\t\t\t\tindicators={ [ currentGradient ] }\n\t\t\t\t\ttabs={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: 'gradient',\n\t\t\t\t\t\t\tlabel: __( 'Gradient' ),\n\t\t\t\t\t\t\tinheritedValue:\n\t\t\t\t\t\t\t\tcurrentGradient ?? inheritedGradient,\n\t\t\t\t\t\t\tsetValue: setGradient,\n\t\t\t\t\t\t\tuserValue: currentGradient,\n\t\t\t\t\t\t\tisGradient: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tcolorGradientControlSettings={ {\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomGradients: ! areCustomGradientsEnabled,\n\t\t\t\t\t} }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Wrapper>\n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eAAgB;AAAA,YAC/B,MAAO;AAAA,cACN;AAAA,gBACC,KAAK;AAAA,gBACL,WAAO,gBAAI,UAAW;AAAA,gBACtB,gBACC,mBAAmB;AAAA,gBACpB,UAAU;AAAA,gBACV,WAAW;AAAA,gBACX,YAAY;AAAA,cACb;AAAA,YACD;AAAA,YACA,8BAA+B;AAAA,cAC9B;AAAA,cACA,wBAAwB,CAAE;AAAA,YAC3B;AAAA,YACA;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EAEF;AAEF;",
|
|
6
6
|
"names": ["ToolsPanel", "ToolsPanelItem", "BackgroundImageControl"]
|
|
7
7
|
}
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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: [
|
|
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
|
-
|
|
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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BACC;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;",
|
|
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\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,wB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AC9B;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
|
-
[
|
|
153
|
-
|
|
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
|
-
[
|
|
160
|
+
[settingKey]: false
|
|
157
161
|
};
|
|
158
162
|
}
|
|
159
163
|
});
|