Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: block-editor.js
colorGradientControlSettings,
[27000] Fix | Delete
panelId
[27001] Fix | Delete
}) {
[27002] Fix | Delete
var _tabs$;
[27003] Fix | Delete
const currentTab = tabs.find(tab => tab.userValue !== undefined);
[27004] Fix | Delete
const {
[27005] Fix | Delete
key: firstTabKey,
[27006] Fix | Delete
...firstTab
[27007] Fix | Delete
} = (_tabs$ = tabs[0]) !== null && _tabs$ !== void 0 ? _tabs$ : {};
[27008] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
[27009] Fix | Delete
className: "block-editor-tools-panel-color-gradient-settings__item",
[27010] Fix | Delete
hasValue: hasValue,
[27011] Fix | Delete
label: label,
[27012] Fix | Delete
onDeselect: resetValue,
[27013] Fix | Delete
isShownByDefault: isShownByDefault,
[27014] Fix | Delete
panelId: panelId,
[27015] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Dropdown, {
[27016] Fix | Delete
popoverProps: popoverProps,
[27017] Fix | Delete
className: "block-editor-tools-panel-color-gradient-settings__dropdown",
[27018] Fix | Delete
renderToggle: ({
[27019] Fix | Delete
onToggle,
[27020] Fix | Delete
isOpen
[27021] Fix | Delete
}) => {
[27022] Fix | Delete
const toggleProps = {
[27023] Fix | Delete
onClick: onToggle,
[27024] Fix | Delete
className: dist_clsx('block-editor-panel-color-gradient-settings__dropdown', {
[27025] Fix | Delete
'is-open': isOpen
[27026] Fix | Delete
}),
[27027] Fix | Delete
'aria-expanded': isOpen,
[27028] Fix | Delete
'aria-label': (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s is the type of color property, e.g., "background" */
[27029] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('Color %s styles'), label)
[27030] Fix | Delete
};
[27031] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, {
[27032] Fix | Delete
...toggleProps,
[27033] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(LabeledColorIndicators, {
[27034] Fix | Delete
indicators: indicators,
[27035] Fix | Delete
label: label
[27036] Fix | Delete
})
[27037] Fix | Delete
});
[27038] Fix | Delete
},
[27039] Fix | Delete
renderContent: () => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalDropdownContentWrapper, {
[27040] Fix | Delete
paddingSize: "none",
[27041] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
[27042] Fix | Delete
className: "block-editor-panel-color-gradient-settings__dropdown-content",
[27043] Fix | Delete
children: [tabs.length === 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelTab, {
[27044] Fix | Delete
...firstTab,
[27045] Fix | Delete
colorGradientControlSettings: colorGradientControlSettings
[27046] Fix | Delete
}, firstTabKey), tabs.length > 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(color_panel_Tabs, {
[27047] Fix | Delete
defaultTabId: currentTab?.key,
[27048] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabList, {
[27049] Fix | Delete
children: tabs.map(tab => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.Tab, {
[27050] Fix | Delete
tabId: tab.key,
[27051] Fix | Delete
children: tab.label
[27052] Fix | Delete
}, tab.key))
[27053] Fix | Delete
}), tabs.map(tab => {
[27054] Fix | Delete
const {
[27055] Fix | Delete
key: tabKey,
[27056] Fix | Delete
...restTabProps
[27057] Fix | Delete
} = tab;
[27058] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(color_panel_Tabs.TabPanel, {
[27059] Fix | Delete
tabId: tabKey,
[27060] Fix | Delete
focusable: false,
[27061] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelTab, {
[27062] Fix | Delete
...restTabProps,
[27063] Fix | Delete
colorGradientControlSettings: colorGradientControlSettings
[27064] Fix | Delete
}, tabKey)
[27065] Fix | Delete
}, tabKey);
[27066] Fix | Delete
})]
[27067] Fix | Delete
})]
[27068] Fix | Delete
})
[27069] Fix | Delete
})
[27070] Fix | Delete
})
[27071] Fix | Delete
});
[27072] Fix | Delete
}
[27073] Fix | Delete
function ColorPanel({
[27074] Fix | Delete
as: Wrapper = ColorToolsPanel,
[27075] Fix | Delete
value,
[27076] Fix | Delete
onChange,
[27077] Fix | Delete
inheritedValue = value,
[27078] Fix | Delete
settings,
[27079] Fix | Delete
panelId,
[27080] Fix | Delete
defaultControls = color_panel_DEFAULT_CONTROLS,
[27081] Fix | Delete
children
[27082] Fix | Delete
}) {
[27083] Fix | Delete
const colors = useColorsPerOrigin(settings);
[27084] Fix | Delete
const gradients = useGradientsPerOrigin(settings);
[27085] Fix | Delete
const areCustomSolidsEnabled = settings?.color?.custom;
[27086] Fix | Delete
const areCustomGradientsEnabled = settings?.color?.customGradient;
[27087] Fix | Delete
const hasSolidColors = colors.length > 0 || areCustomSolidsEnabled;
[27088] Fix | Delete
const hasGradientColors = gradients.length > 0 || areCustomGradientsEnabled;
[27089] Fix | Delete
const decodeValue = rawValue => getValueFromVariable({
[27090] Fix | Delete
settings
[27091] Fix | Delete
}, '', rawValue);
[27092] Fix | Delete
const encodeColorValue = colorValue => {
[27093] Fix | Delete
const allColors = colors.flatMap(({
[27094] Fix | Delete
colors: originColors
[27095] Fix | Delete
}) => originColors);
[27096] Fix | Delete
const colorObject = allColors.find(({
[27097] Fix | Delete
color
[27098] Fix | Delete
}) => color === colorValue);
[27099] Fix | Delete
return colorObject ? 'var:preset|color|' + colorObject.slug : colorValue;
[27100] Fix | Delete
};
[27101] Fix | Delete
const encodeGradientValue = gradientValue => {
[27102] Fix | Delete
const allGradients = gradients.flatMap(({
[27103] Fix | Delete
gradients: originGradients
[27104] Fix | Delete
}) => originGradients);
[27105] Fix | Delete
const gradientObject = allGradients.find(({
[27106] Fix | Delete
gradient
[27107] Fix | Delete
}) => gradient === gradientValue);
[27108] Fix | Delete
return gradientObject ? 'var:preset|gradient|' + gradientObject.slug : gradientValue;
[27109] Fix | Delete
};
[27110] Fix | Delete
[27111] Fix | Delete
// BackgroundColor
[27112] Fix | Delete
const showBackgroundPanel = color_panel_useHasBackgroundPanel(settings);
[27113] Fix | Delete
const backgroundColor = decodeValue(inheritedValue?.color?.background);
[27114] Fix | Delete
const userBackgroundColor = decodeValue(value?.color?.background);
[27115] Fix | Delete
const gradient = decodeValue(inheritedValue?.color?.gradient);
[27116] Fix | Delete
const userGradient = decodeValue(value?.color?.gradient);
[27117] Fix | Delete
const hasBackground = () => !!userBackgroundColor || !!userGradient;
[27118] Fix | Delete
const setBackgroundColor = newColor => {
[27119] Fix | Delete
const newValue = setImmutably(value, ['color', 'background'], encodeColorValue(newColor));
[27120] Fix | Delete
newValue.color.gradient = undefined;
[27121] Fix | Delete
onChange(newValue);
[27122] Fix | Delete
};
[27123] Fix | Delete
const setGradient = newGradient => {
[27124] Fix | Delete
const newValue = setImmutably(value, ['color', 'gradient'], encodeGradientValue(newGradient));
[27125] Fix | Delete
newValue.color.background = undefined;
[27126] Fix | Delete
onChange(newValue);
[27127] Fix | Delete
};
[27128] Fix | Delete
const resetBackground = () => {
[27129] Fix | Delete
const newValue = setImmutably(value, ['color', 'background'], undefined);
[27130] Fix | Delete
newValue.color.gradient = undefined;
[27131] Fix | Delete
onChange(newValue);
[27132] Fix | Delete
};
[27133] Fix | Delete
[27134] Fix | Delete
// Links
[27135] Fix | Delete
const showLinkPanel = useHasLinkPanel(settings);
[27136] Fix | Delete
const linkColor = decodeValue(inheritedValue?.elements?.link?.color?.text);
[27137] Fix | Delete
const userLinkColor = decodeValue(value?.elements?.link?.color?.text);
[27138] Fix | Delete
const setLinkColor = newColor => {
[27139] Fix | Delete
onChange(setImmutably(value, ['elements', 'link', 'color', 'text'], encodeColorValue(newColor)));
[27140] Fix | Delete
};
[27141] Fix | Delete
const hoverLinkColor = decodeValue(inheritedValue?.elements?.link?.[':hover']?.color?.text);
[27142] Fix | Delete
const userHoverLinkColor = decodeValue(value?.elements?.link?.[':hover']?.color?.text);
[27143] Fix | Delete
const setHoverLinkColor = newColor => {
[27144] Fix | Delete
onChange(setImmutably(value, ['elements', 'link', ':hover', 'color', 'text'], encodeColorValue(newColor)));
[27145] Fix | Delete
};
[27146] Fix | Delete
const hasLink = () => !!userLinkColor || !!userHoverLinkColor;
[27147] Fix | Delete
const resetLink = () => {
[27148] Fix | Delete
let newValue = setImmutably(value, ['elements', 'link', ':hover', 'color', 'text'], undefined);
[27149] Fix | Delete
newValue = setImmutably(newValue, ['elements', 'link', 'color', 'text'], undefined);
[27150] Fix | Delete
onChange(newValue);
[27151] Fix | Delete
};
[27152] Fix | Delete
[27153] Fix | Delete
// Text Color
[27154] Fix | Delete
const showTextPanel = useHasTextPanel(settings);
[27155] Fix | Delete
const textColor = decodeValue(inheritedValue?.color?.text);
[27156] Fix | Delete
const userTextColor = decodeValue(value?.color?.text);
[27157] Fix | Delete
const hasTextColor = () => !!userTextColor;
[27158] Fix | Delete
const setTextColor = newColor => {
[27159] Fix | Delete
let changedObject = setImmutably(value, ['color', 'text'], encodeColorValue(newColor));
[27160] Fix | Delete
if (textColor === linkColor) {
[27161] Fix | Delete
changedObject = setImmutably(changedObject, ['elements', 'link', 'color', 'text'], encodeColorValue(newColor));
[27162] Fix | Delete
}
[27163] Fix | Delete
onChange(changedObject);
[27164] Fix | Delete
};
[27165] Fix | Delete
const resetTextColor = () => setTextColor(undefined);
[27166] Fix | Delete
[27167] Fix | Delete
// Elements
[27168] Fix | Delete
const elements = [{
[27169] Fix | Delete
name: 'caption',
[27170] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Captions'),
[27171] Fix | Delete
showPanel: useHasCaptionPanel(settings)
[27172] Fix | Delete
}, {
[27173] Fix | Delete
name: 'button',
[27174] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Button'),
[27175] Fix | Delete
showPanel: useHasButtonPanel(settings)
[27176] Fix | Delete
}, {
[27177] Fix | Delete
name: 'heading',
[27178] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Heading'),
[27179] Fix | Delete
showPanel: useHasHeadingPanel(settings)
[27180] Fix | Delete
}, {
[27181] Fix | Delete
name: 'h1',
[27182] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('H1'),
[27183] Fix | Delete
showPanel: useHasHeadingPanel(settings)
[27184] Fix | Delete
}, {
[27185] Fix | Delete
name: 'h2',
[27186] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('H2'),
[27187] Fix | Delete
showPanel: useHasHeadingPanel(settings)
[27188] Fix | Delete
}, {
[27189] Fix | Delete
name: 'h3',
[27190] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('H3'),
[27191] Fix | Delete
showPanel: useHasHeadingPanel(settings)
[27192] Fix | Delete
}, {
[27193] Fix | Delete
name: 'h4',
[27194] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('H4'),
[27195] Fix | Delete
showPanel: useHasHeadingPanel(settings)
[27196] Fix | Delete
}, {
[27197] Fix | Delete
name: 'h5',
[27198] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('H5'),
[27199] Fix | Delete
showPanel: useHasHeadingPanel(settings)
[27200] Fix | Delete
}, {
[27201] Fix | Delete
name: 'h6',
[27202] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('H6'),
[27203] Fix | Delete
showPanel: useHasHeadingPanel(settings)
[27204] Fix | Delete
}];
[27205] Fix | Delete
const resetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(previousValue => {
[27206] Fix | Delete
return {
[27207] Fix | Delete
...previousValue,
[27208] Fix | Delete
color: undefined,
[27209] Fix | Delete
elements: {
[27210] Fix | Delete
...previousValue?.elements,
[27211] Fix | Delete
link: {
[27212] Fix | Delete
...previousValue?.elements?.link,
[27213] Fix | Delete
color: undefined,
[27214] Fix | Delete
':hover': {
[27215] Fix | Delete
color: undefined
[27216] Fix | Delete
}
[27217] Fix | Delete
},
[27218] Fix | Delete
...elements.reduce((acc, element) => {
[27219] Fix | Delete
return {
[27220] Fix | Delete
...acc,
[27221] Fix | Delete
[element.name]: {
[27222] Fix | Delete
...previousValue?.elements?.[element.name],
[27223] Fix | Delete
color: undefined
[27224] Fix | Delete
}
[27225] Fix | Delete
};
[27226] Fix | Delete
}, {})
[27227] Fix | Delete
}
[27228] Fix | Delete
};
[27229] Fix | Delete
}, []);
[27230] Fix | Delete
const items = [showTextPanel && {
[27231] Fix | Delete
key: 'text',
[27232] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
[27233] Fix | Delete
hasValue: hasTextColor,
[27234] Fix | Delete
resetValue: resetTextColor,
[27235] Fix | Delete
isShownByDefault: defaultControls.text,
[27236] Fix | Delete
indicators: [textColor],
[27237] Fix | Delete
tabs: [{
[27238] Fix | Delete
key: 'text',
[27239] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
[27240] Fix | Delete
inheritedValue: textColor,
[27241] Fix | Delete
setValue: setTextColor,
[27242] Fix | Delete
userValue: userTextColor
[27243] Fix | Delete
}]
[27244] Fix | Delete
}, showBackgroundPanel && {
[27245] Fix | Delete
key: 'background',
[27246] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Background'),
[27247] Fix | Delete
hasValue: hasBackground,
[27248] Fix | Delete
resetValue: resetBackground,
[27249] Fix | Delete
isShownByDefault: defaultControls.background,
[27250] Fix | Delete
indicators: [gradient !== null && gradient !== void 0 ? gradient : backgroundColor],
[27251] Fix | Delete
tabs: [hasSolidColors && {
[27252] Fix | Delete
key: 'background',
[27253] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Color'),
[27254] Fix | Delete
inheritedValue: backgroundColor,
[27255] Fix | Delete
setValue: setBackgroundColor,
[27256] Fix | Delete
userValue: userBackgroundColor
[27257] Fix | Delete
}, hasGradientColors && {
[27258] Fix | Delete
key: 'gradient',
[27259] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Gradient'),
[27260] Fix | Delete
inheritedValue: gradient,
[27261] Fix | Delete
setValue: setGradient,
[27262] Fix | Delete
userValue: userGradient,
[27263] Fix | Delete
isGradient: true
[27264] Fix | Delete
}].filter(Boolean)
[27265] Fix | Delete
}, showLinkPanel && {
[27266] Fix | Delete
key: 'link',
[27267] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Link'),
[27268] Fix | Delete
hasValue: hasLink,
[27269] Fix | Delete
resetValue: resetLink,
[27270] Fix | Delete
isShownByDefault: defaultControls.link,
[27271] Fix | Delete
indicators: [linkColor, hoverLinkColor],
[27272] Fix | Delete
tabs: [{
[27273] Fix | Delete
key: 'link',
[27274] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Default'),
[27275] Fix | Delete
inheritedValue: linkColor,
[27276] Fix | Delete
setValue: setLinkColor,
[27277] Fix | Delete
userValue: userLinkColor
[27278] Fix | Delete
}, {
[27279] Fix | Delete
key: 'hover',
[27280] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Hover'),
[27281] Fix | Delete
inheritedValue: hoverLinkColor,
[27282] Fix | Delete
setValue: setHoverLinkColor,
[27283] Fix | Delete
userValue: userHoverLinkColor
[27284] Fix | Delete
}]
[27285] Fix | Delete
}].filter(Boolean);
[27286] Fix | Delete
elements.forEach(({
[27287] Fix | Delete
name,
[27288] Fix | Delete
label,
[27289] Fix | Delete
showPanel
[27290] Fix | Delete
}) => {
[27291] Fix | Delete
if (!showPanel) {
[27292] Fix | Delete
return;
[27293] Fix | Delete
}
[27294] Fix | Delete
const elementBackgroundColor = decodeValue(inheritedValue?.elements?.[name]?.color?.background);
[27295] Fix | Delete
const elementGradient = decodeValue(inheritedValue?.elements?.[name]?.color?.gradient);
[27296] Fix | Delete
const elementTextColor = decodeValue(inheritedValue?.elements?.[name]?.color?.text);
[27297] Fix | Delete
const elementBackgroundUserColor = decodeValue(value?.elements?.[name]?.color?.background);
[27298] Fix | Delete
const elementGradientUserColor = decodeValue(value?.elements?.[name]?.color?.gradient);
[27299] Fix | Delete
const elementTextUserColor = decodeValue(value?.elements?.[name]?.color?.text);
[27300] Fix | Delete
const hasElement = () => !!(elementTextUserColor || elementBackgroundUserColor || elementGradientUserColor);
[27301] Fix | Delete
const resetElement = () => {
[27302] Fix | Delete
const newValue = setImmutably(value, ['elements', name, 'color', 'background'], undefined);
[27303] Fix | Delete
newValue.elements[name].color.gradient = undefined;
[27304] Fix | Delete
newValue.elements[name].color.text = undefined;
[27305] Fix | Delete
onChange(newValue);
[27306] Fix | Delete
};
[27307] Fix | Delete
const setElementTextColor = newTextColor => {
[27308] Fix | Delete
onChange(setImmutably(value, ['elements', name, 'color', 'text'], encodeColorValue(newTextColor)));
[27309] Fix | Delete
};
[27310] Fix | Delete
const setElementBackgroundColor = newBackgroundColor => {
[27311] Fix | Delete
const newValue = setImmutably(value, ['elements', name, 'color', 'background'], encodeColorValue(newBackgroundColor));
[27312] Fix | Delete
newValue.elements[name].color.gradient = undefined;
[27313] Fix | Delete
onChange(newValue);
[27314] Fix | Delete
};
[27315] Fix | Delete
const setElementGradient = newGradient => {
[27316] Fix | Delete
const newValue = setImmutably(value, ['elements', name, 'color', 'gradient'], encodeGradientValue(newGradient));
[27317] Fix | Delete
newValue.elements[name].color.background = undefined;
[27318] Fix | Delete
onChange(newValue);
[27319] Fix | Delete
};
[27320] Fix | Delete
const supportsTextColor = true;
[27321] Fix | Delete
// Background color is not supported for `caption`
[27322] Fix | Delete
// as there isn't yet a way to set padding for the element.
[27323] Fix | Delete
const supportsBackground = name !== 'caption';
[27324] Fix | Delete
items.push({
[27325] Fix | Delete
key: name,
[27326] Fix | Delete
label,
[27327] Fix | Delete
hasValue: hasElement,
[27328] Fix | Delete
resetValue: resetElement,
[27329] Fix | Delete
isShownByDefault: defaultControls[name],
[27330] Fix | Delete
indicators: supportsTextColor && supportsBackground ? [elementTextColor, elementGradient !== null && elementGradient !== void 0 ? elementGradient : elementBackgroundColor] : [supportsTextColor ? elementTextColor : elementGradient !== null && elementGradient !== void 0 ? elementGradient : elementBackgroundColor],
[27331] Fix | Delete
tabs: [hasSolidColors && supportsTextColor && {
[27332] Fix | Delete
key: 'text',
[27333] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Text'),
[27334] Fix | Delete
inheritedValue: elementTextColor,
[27335] Fix | Delete
setValue: setElementTextColor,
[27336] Fix | Delete
userValue: elementTextUserColor
[27337] Fix | Delete
}, hasSolidColors && supportsBackground && {
[27338] Fix | Delete
key: 'background',
[27339] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Background'),
[27340] Fix | Delete
inheritedValue: elementBackgroundColor,
[27341] Fix | Delete
setValue: setElementBackgroundColor,
[27342] Fix | Delete
userValue: elementBackgroundUserColor
[27343] Fix | Delete
}, hasGradientColors && supportsBackground && {
[27344] Fix | Delete
key: 'gradient',
[27345] Fix | Delete
label: (0,external_wp_i18n_namespaceObject.__)('Gradient'),
[27346] Fix | Delete
inheritedValue: elementGradient,
[27347] Fix | Delete
setValue: setElementGradient,
[27348] Fix | Delete
userValue: elementGradientUserColor,
[27349] Fix | Delete
isGradient: true
[27350] Fix | Delete
}].filter(Boolean)
[27351] Fix | Delete
});
[27352] Fix | Delete
});
[27353] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Wrapper, {
[27354] Fix | Delete
resetAllFilter: resetAllFilter,
[27355] Fix | Delete
value: value,
[27356] Fix | Delete
onChange: onChange,
[27357] Fix | Delete
panelId: panelId,
[27358] Fix | Delete
children: [items.map(item => {
[27359] Fix | Delete
const {
[27360] Fix | Delete
key,
[27361] Fix | Delete
...restItem
[27362] Fix | Delete
} = item;
[27363] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanelDropdown, {
[27364] Fix | Delete
...restItem,
[27365] Fix | Delete
colorGradientControlSettings: {
[27366] Fix | Delete
colors,
[27367] Fix | Delete
disableCustomColors: !areCustomSolidsEnabled,
[27368] Fix | Delete
gradients,
[27369] Fix | Delete
disableCustomGradients: !areCustomGradientsEnabled
[27370] Fix | Delete
},
[27371] Fix | Delete
panelId: panelId
[27372] Fix | Delete
}, key);
[27373] Fix | Delete
}), children]
[27374] Fix | Delete
});
[27375] Fix | Delete
}
[27376] Fix | Delete
[27377] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/contrast-checker/index.js
[27378] Fix | Delete
/**
[27379] Fix | Delete
* External dependencies
[27380] Fix | Delete
*/
[27381] Fix | Delete
[27382] Fix | Delete
[27383] Fix | Delete
[27384] Fix | Delete
[27385] Fix | Delete
/**
[27386] Fix | Delete
* WordPress dependencies
[27387] Fix | Delete
*/
[27388] Fix | Delete
[27389] Fix | Delete
[27390] Fix | Delete
[27391] Fix | Delete
[27392] Fix | Delete
k([names, a11y]);
[27393] Fix | Delete
function ContrastChecker({
[27394] Fix | Delete
backgroundColor,
[27395] Fix | Delete
fallbackBackgroundColor,
[27396] Fix | Delete
fallbackTextColor,
[27397] Fix | Delete
fallbackLinkColor,
[27398] Fix | Delete
fontSize,
[27399] Fix | Delete
// Font size value in pixels.
[27400] Fix | Delete
isLargeText,
[27401] Fix | Delete
textColor,
[27402] Fix | Delete
linkColor,
[27403] Fix | Delete
enableAlphaChecker = false
[27404] Fix | Delete
}) {
[27405] Fix | Delete
const currentBackgroundColor = backgroundColor || fallbackBackgroundColor;
[27406] Fix | Delete
[27407] Fix | Delete
// Must have a background color.
[27408] Fix | Delete
if (!currentBackgroundColor) {
[27409] Fix | Delete
return null;
[27410] Fix | Delete
}
[27411] Fix | Delete
const currentTextColor = textColor || fallbackTextColor;
[27412] Fix | Delete
const currentLinkColor = linkColor || fallbackLinkColor;
[27413] Fix | Delete
[27414] Fix | Delete
// Must have at least one text color.
[27415] Fix | Delete
if (!currentTextColor && !currentLinkColor) {
[27416] Fix | Delete
return null;
[27417] Fix | Delete
}
[27418] Fix | Delete
const textColors = [{
[27419] Fix | Delete
color: currentTextColor,
[27420] Fix | Delete
description: (0,external_wp_i18n_namespaceObject.__)('text color')
[27421] Fix | Delete
}, {
[27422] Fix | Delete
color: currentLinkColor,
[27423] Fix | Delete
description: (0,external_wp_i18n_namespaceObject.__)('link color')
[27424] Fix | Delete
}];
[27425] Fix | Delete
const colordBackgroundColor = w(currentBackgroundColor);
[27426] Fix | Delete
const backgroundColorHasTransparency = colordBackgroundColor.alpha() < 1;
[27427] Fix | Delete
const backgroundColorBrightness = colordBackgroundColor.brightness();
[27428] Fix | Delete
const isReadableOptions = {
[27429] Fix | Delete
level: 'AA',
[27430] Fix | Delete
size: isLargeText || isLargeText !== false && fontSize >= 24 ? 'large' : 'small'
[27431] Fix | Delete
};
[27432] Fix | Delete
let message = '';
[27433] Fix | Delete
let speakMessage = '';
[27434] Fix | Delete
for (const item of textColors) {
[27435] Fix | Delete
// If there is no color, go no further.
[27436] Fix | Delete
if (!item.color) {
[27437] Fix | Delete
continue;
[27438] Fix | Delete
}
[27439] Fix | Delete
const colordTextColor = w(item.color);
[27440] Fix | Delete
const isColordTextReadable = colordTextColor.isReadable(colordBackgroundColor, isReadableOptions);
[27441] Fix | Delete
const textHasTransparency = colordTextColor.alpha() < 1;
[27442] Fix | Delete
[27443] Fix | Delete
// If the contrast is not readable.
[27444] Fix | Delete
if (!isColordTextReadable) {
[27445] Fix | Delete
// Don't show the message if the background or text is transparent.
[27446] Fix | Delete
if (backgroundColorHasTransparency || textHasTransparency) {
[27447] Fix | Delete
continue;
[27448] Fix | Delete
}
[27449] Fix | Delete
message = backgroundColorBrightness < colordTextColor.brightness() ? (0,external_wp_i18n_namespaceObject.sprintf)(
[27450] Fix | Delete
// translators: %s is a type of text color, e.g., "text color" or "link color".
[27451] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'), item.description) : (0,external_wp_i18n_namespaceObject.sprintf)(
[27452] Fix | Delete
// translators: %s is a type of text color, e.g., "text color" or "link color".
[27453] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'), item.description);
[27454] Fix | Delete
speakMessage = (0,external_wp_i18n_namespaceObject.__)('This color combination may be hard for people to read.');
[27455] Fix | Delete
// Break from the loop when we have a contrast warning.
[27456] Fix | Delete
// These messages take priority over the transparency warning.
[27457] Fix | Delete
break;
[27458] Fix | Delete
}
[27459] Fix | Delete
[27460] Fix | Delete
// If there is no contrast warning and the text is transparent,
[27461] Fix | Delete
// show the transparent warning if alpha check is enabled.
[27462] Fix | Delete
if (textHasTransparency && enableAlphaChecker) {
[27463] Fix | Delete
message = (0,external_wp_i18n_namespaceObject.__)('Transparent text may be hard for people to read.');
[27464] Fix | Delete
speakMessage = (0,external_wp_i18n_namespaceObject.__)('Transparent text may be hard for people to read.');
[27465] Fix | Delete
}
[27466] Fix | Delete
}
[27467] Fix | Delete
if (!message) {
[27468] Fix | Delete
return null;
[27469] Fix | Delete
}
[27470] Fix | Delete
[27471] Fix | Delete
// Note: The `Notice` component can speak messages via its `spokenMessage`
[27472] Fix | Delete
// prop, but the contrast checker requires granular control over when the
[27473] Fix | Delete
// announcements are made. Notably, the message will be re-announced if a
[27474] Fix | Delete
// new color combination is selected and the contrast is still insufficient.
[27475] Fix | Delete
(0,external_wp_a11y_namespaceObject.speak)(speakMessage);
[27476] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[27477] Fix | Delete
className: "block-editor-contrast-checker",
[27478] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Notice, {
[27479] Fix | Delete
spokenMessage: null,
[27480] Fix | Delete
status: "warning",
[27481] Fix | Delete
isDismissible: false,
[27482] Fix | Delete
children: message
[27483] Fix | Delete
})
[27484] Fix | Delete
});
[27485] Fix | Delete
}
[27486] Fix | Delete
[27487] Fix | Delete
/**
[27488] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/contrast-checker/README.md
[27489] Fix | Delete
*/
[27490] Fix | Delete
/* harmony default export */ const contrast_checker = (ContrastChecker);
[27491] Fix | Delete
[27492] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/contrast-checker.js
[27493] Fix | Delete
/**
[27494] Fix | Delete
* WordPress dependencies
[27495] Fix | Delete
*/
[27496] Fix | Delete
[27497] Fix | Delete
[27498] Fix | Delete
/**
[27499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function