: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
function getComputedStyle(node) {
return node.ownerDocument.defaultView.getComputedStyle(node);
function BlockColorContrastChecker({
const [detectedBackgroundColor, setDetectedBackgroundColor] = (0,external_wp_element_namespaceObject.useState)();
const [detectedColor, setDetectedColor] = (0,external_wp_element_namespaceObject.useState)();
const [detectedLinkColor, setDetectedLinkColor] = (0,external_wp_element_namespaceObject.useState)();
const ref = useBlockRef(clientId);
// There are so many things that can change the color of a block
// So we perform this check on every render.
// eslint-disable-next-line react-hooks/exhaustive-deps
(0,external_wp_element_namespaceObject.useEffect)(() => {
setDetectedColor(getComputedStyle(ref.current).color);
const firstLinkElement = ref.current?.querySelector('a');
if (firstLinkElement && !!firstLinkElement.innerText) {
setDetectedLinkColor(getComputedStyle(firstLinkElement).color);
let backgroundColorNode = ref.current;
let backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor;
while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === backgroundColorNode.parentNode.ELEMENT_NODE) {
backgroundColorNode = backgroundColorNode.parentNode;
backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor;
setDetectedBackgroundColor(backgroundColor);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(contrast_checker, {
backgroundColor: detectedBackgroundColor,
textColor: detectedColor,
enableAlphaChecker: true,
linkColor: detectedLinkColor
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/color.js
const COLOR_SUPPORT_KEY = 'color';
const hasColorSupport = blockNameOrType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY);
return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false);
const hasLinkColorSupport = blockType => {
if (external_wp_element_namespaceObject.Platform.OS !== 'web') {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.link;
const hasGradientSupport = blockNameOrType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, COLOR_SUPPORT_KEY);
return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.gradients;
const hasBackgroundColorSupport = blockType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
return colorSupport && colorSupport.background !== false;
const hasTextColorSupport = blockType => {
const colorSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, COLOR_SUPPORT_KEY);
return colorSupport && colorSupport.text !== false;
* Filters registered block settings, extending attributes to include
* `backgroundColor` and `textColor` attribute.
* @param {Object} settings Original block settings.
* @return {Object} Filtered block settings.
function color_addAttributes(settings) {
if (!hasColorSupport(settings)) {
// Allow blocks to specify their own attribute definition with default values if needed.
if (!settings.attributes.backgroundColor) {
Object.assign(settings.attributes, {
if (!settings.attributes.textColor) {
Object.assign(settings.attributes, {
if (hasGradientSupport(settings) && !settings.attributes.gradient) {
Object.assign(settings.attributes, {
* Override props assigned to save component to inject colors classnames.
* @param {Object} props Additional props applied to save element.
* @param {Object|string} blockNameOrType Block type.
* @param {Object} attributes Block attributes.
* @return {Object} Filtered props applied to save element.
function color_addSaveProps(props, blockNameOrType, attributes) {
if (!hasColorSupport(blockNameOrType) || shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY)) {
const hasGradient = hasGradientSupport(blockNameOrType);
// I'd have preferred to avoid the "style" attribute usage here
const shouldSerialize = feature => !shouldSkipSerialization(blockNameOrType, COLOR_SUPPORT_KEY, feature);
// Primary color classes must come before the `has-text-color`,
// `has-background` and `has-link-color` classes to maintain backwards
// compatibility and avoid block invalidations.
const textClass = shouldSerialize('text') ? getColorClassName('color', textColor) : undefined;
const gradientClass = shouldSerialize('gradients') ? __experimentalGetGradientClass(gradient) : undefined;
const backgroundClass = shouldSerialize('background') ? getColorClassName('background-color', backgroundColor) : undefined;
const serializeHasBackground = shouldSerialize('background') || shouldSerialize('gradients');
const hasBackground = backgroundColor || style?.color?.background || hasGradient && (gradient || style?.color?.gradient);
const newClassName = dist_clsx(props.className, textClass, gradientClass, {
// Don't apply the background class if there's a custom gradient.
[backgroundClass]: (!hasGradient || !style?.color?.gradient) && !!backgroundClass,
'has-text-color': shouldSerialize('text') && (textColor || style?.color?.text),
'has-background': serializeHasBackground && hasBackground,
'has-link-color': shouldSerialize('link') && style?.elements?.link?.color
props.className = newClassName ? newClassName : undefined;
function color_styleToAttributes(style) {
const textColorValue = style?.color?.text;
const textColorSlug = textColorValue?.startsWith('var:preset|color|') ? textColorValue.substring('var:preset|color|'.length) : undefined;
const backgroundColorValue = style?.color?.background;
const backgroundColorSlug = backgroundColorValue?.startsWith('var:preset|color|') ? backgroundColorValue.substring('var:preset|color|'.length) : undefined;
const gradientValue = style?.color?.gradient;
const gradientSlug = gradientValue?.startsWith('var:preset|gradient|') ? gradientValue.substring('var:preset|gradient|'.length) : undefined;
text: textColorSlug ? undefined : textColorValue,
background: backgroundColorSlug ? undefined : backgroundColorValue,
gradient: gradientSlug ? undefined : gradientValue
style: utils_cleanEmptyObject(updatedStyle),
textColor: textColorSlug,
backgroundColor: backgroundColorSlug,
function color_attributesToStyle(attributes) {
...attributes.style?.color,
text: attributes.textColor ? 'var:preset|color|' + attributes.textColor : attributes.style?.color?.text,
background: attributes.backgroundColor ? 'var:preset|color|' + attributes.backgroundColor : attributes.style?.color?.background,
gradient: attributes.gradient ? 'var:preset|gradient|' + attributes.gradient : attributes.style?.color?.gradient
function ColorInspectorControl({
const attributesResetAllFilter = (0,external_wp_element_namespaceObject.useCallback)(attributes => {
const existingStyle = color_attributesToStyle(attributes);
const updatedStyle = resetAllFilter(existingStyle);
...color_styleToAttributes(updatedStyle)
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, {
resetAllFilter: attributesResetAllFilter,
const isEnabled = useHasColorPanel(settings);
function selector(select) {
} = select(store).getBlockAttributes(clientId) || {};
} = (0,external_wp_data_namespaceObject.useSelect)(selector, [clientId]);
const value = (0,external_wp_element_namespaceObject.useMemo)(() => {
return color_attributesToStyle({
}, [style, textColor, backgroundColor, gradient]);
const onChange = newStyle => {
setAttributes(color_styleToAttributes(newStyle));
const defaultControls = (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, '__experimentalDefaultControls']);
const enableContrastChecking = external_wp_element_namespaceObject.Platform.OS === 'web' && !value?.color?.gradient && (settings?.color?.text || settings?.color?.link) &&
// Contrast checking is enabled by default.
// Deactivating it requires `enableContrastChecker` to have
// an explicit value of `false`.
false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ColorPanel, {
as: ColorInspectorControl,
defaultControls: defaultControls,
enableContrastChecker: false !== (0,external_wp_blocks_namespaceObject.getBlockSupport)(name, [COLOR_SUPPORT_KEY, 'enableContrastChecker']),
children: enableContrastChecking && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockColorContrastChecker, {
function color_useBlockProps({
const [userPalette, themePalette, defaultPalette] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default');
const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
if (!hasColorSupport(name) || shouldSkipSerialization(name, COLOR_SUPPORT_KEY)) {
if (textColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'text')) {
extraStyles.color = getColorObjectByAttributeValues(colors, textColor)?.color;
if (backgroundColor && !shouldSkipSerialization(name, COLOR_SUPPORT_KEY, 'background')) {
extraStyles.backgroundColor = getColorObjectByAttributeValues(colors, backgroundColor)?.color;
const saveProps = color_addSaveProps({
const hasBackgroundValue = backgroundColor || style?.color?.background || gradient || style?.color?.gradient;
className: dist_clsx(saveProps.className,
// Add background image classes in the editor, if not already handled by background color values.
!hasBackgroundValue && getBackgroundImageClasses(style))
/* harmony default export */ const color = ({
useBlockProps: color_useBlockProps,
addSaveProps: color_addSaveProps,
attributeKeys: ['backgroundColor', 'textColor', 'gradient', 'style'],
hasSupport: hasColorSupport
const MIGRATION_PATHS = {
linkColor: [['style', 'elements', 'link', 'color', 'text']],
textColor: [['textColor'], ['style', 'color', 'text']],
backgroundColor: [['backgroundColor'], ['style', 'color', 'background']],
gradient: [['gradient'], ['style', 'color', 'gradient']]
function color_addTransforms(result, source, index, results) {
const destinationBlockType = result.name;
linkColor: hasLinkColorSupport(destinationBlockType),
textColor: hasTextColorSupport(destinationBlockType),
backgroundColor: hasBackgroundColorSupport(destinationBlockType),
gradient: hasGradientSupport(destinationBlockType)
return transformStyles(activeSupports, MIGRATION_PATHS, result, source, index, results);
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/color/addAttribute', color_addAttributes);
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.switchToBlockType.transformedBlock', 'core/color/addTransforms', color_addTransforms);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-family/index.js
function FontFamilyControl({
const [blockLevelFontFamilies] = use_settings_useSettings('typography.fontFamilies');
fontFamilies = blockLevelFontFamilies;
if (!fontFamilies || fontFamilies.length === 0) {
label: (0,external_wp_i18n_namespaceObject.__)('Default')
}, ...fontFamilies.map(({
label: name || fontFamily
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Font'),
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-appearance-control/index.js
name: (0,external_wp_i18n_namespaceObject._x)('Regular', 'font style'),
name: (0,external_wp_i18n_namespaceObject._x)('Italic', 'font style'),
name: (0,external_wp_i18n_namespaceObject._x)('Thin', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Extra Light', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Light', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Regular', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Semi Bold', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Bold', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Extra Bold', 'font weight'),
name: (0,external_wp_i18n_namespaceObject._x)('Black', 'font weight'),
* Adjusts font appearance field label in case either font styles or weights
* @param {boolean} hasFontStyles Whether font styles are enabled and present.
* @param {boolean} hasFontWeights Whether font weights are enabled and present.
* @return {string} A label representing what font appearance is being edited.
const getFontAppearanceLabel = (hasFontStyles, hasFontWeights) => {
return (0,external_wp_i18n_namespaceObject.__)('Font weight');
return (0,external_wp_i18n_namespaceObject.__)('Font style');
return (0,external_wp_i18n_namespaceObject.__)('Appearance');
* Control to display unified font style and weight options.
* @param {Object} props Component props.
* @return {Element} Font appearance control.
function FontAppearanceControl(props) {
const hasStylesOrWeights = hasFontStyles || hasFontWeights;
const label = getFontAppearanceLabel(hasFontStyles, hasFontWeights);
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
// Combines both font style and weight options into a single dropdown.
const combineOptions = () => {
const combinedOptions = [defaultOption];
const optionName = styleValue === 'normal' ? weightName : (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: 1: Font weight name. 2: Font style name. */
(0,external_wp_i18n_namespaceObject.__)('%1$s %2$s'), weightName, styleName);