: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
// Collect color CSS classes.
const backgroundClass = getColorClassName('background-color', backgroundColor);
const textClass = getColorClassName('color', textColor);
const gradientClass = __experimentalGetGradientClass(gradient);
const hasGradient = gradientClass || style?.color?.gradient;
// Determine color CSS class name list.
const className = dist_clsx(textClass, gradientClass, {
// Don't apply the background class if there's a gradient.
[backgroundClass]: !hasGradient && !!backgroundClass,
'has-text-color': textColor || style?.color?.text,
'has-background': backgroundColor || style?.color?.background || gradient || style?.color?.gradient,
'has-link-color': style?.elements?.link?.color
// Collect inline styles for colors.
const colorStyles = style?.color || {};
const styleProp = getInlineStyles({
className: className || undefined,
* Determines the color related props for a block derived from its color block
* Inline styles are forced for named colors to ensure these selections are
* reflected when themes do not load their color stylesheets in the editor.
* @param {Object} attributes Block attributes.
* @return {Object} ClassName & style props from colors block support.
function useColorProps(attributes) {
const [userPalette, themePalette, defaultPalette, userGradients, themeGradients, defaultGradients] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default');
const colors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
const gradients = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userGradients || []), ...(themeGradients || []), ...(defaultGradients || [])], [userGradients, themeGradients, defaultGradients]);
const colorProps = getColorClassesAndStyles(attributes);
// Force inline styles to apply colors when themes do not load their color
// stylesheets in the editor.
const backgroundColorObject = getColorObjectByAttributeValues(colors, backgroundColor);
colorProps.style.backgroundColor = backgroundColorObject.color;
colorProps.style.background = getGradientValueBySlug(gradients, gradient);
const textColorObject = getColorObjectByAttributeValues(colors, textColor);
colorProps.style.color = textColorObject.color;
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-spacing-props.js
// This utility is intended to assist where the serialization of the spacing
// block support is being skipped for a block but the spacing related CSS
// styles still need to be generated so they can be applied to inner elements.
* Provides the CSS class names and inline styles for a block's spacing support
* @param {Object} attributes Block attributes.
* @return {Object} Spacing block support derived CSS classes & styles.
function getSpacingClassesAndStyles(attributes) {
// Collect inline styles for spacing.
const spacingStyles = style?.spacing || {};
const styleProp = getInlineStyles({
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-typography-props.js
kebabCase: use_typography_props_kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
* This utility is intended to assist where the serialization of the typography
* block support is being skipped for a block but the typography related CSS
* styles still need to be generated so they can be applied to inner elements.
* Provides the CSS class names and inline styles for a block's typography support
* @param {Object} attributes Block attributes.
* @param {Object|boolean} settings Merged theme.json settings
* @return {Object} Typography block support derived CSS classes & styles.
function getTypographyClassesAndStyles(attributes, settings) {
let typographyStyles = attributes?.style?.typography || {};
fontSize: getTypographyFontSizeValue({
size: attributes?.style?.typography?.fontSize
const style = getInlineStyles({
typography: typographyStyles
const fontFamilyClassName = !!attributes?.fontFamily ? `has-${use_typography_props_kebabCase(attributes.fontFamily)}-font-family` : '';
const textAlignClassName = !!attributes?.style?.typography?.textAlign ? `has-text-align-${attributes?.style?.typography?.textAlign}` : '';
const className = dist_clsx(fontFamilyClassName, textAlignClassName, getFontSizeClass(attributes?.fontSize));
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-cached-truthy.js
* Keeps an up-to-date copy of the passed value and returns it. If value becomes falsy, it will return the last truthy copy.
function useCachedTruthy(value) {
const [cachedValue, setCachedValue] = (0,external_wp_element_namespaceObject.useState)(value);
(0,external_wp_element_namespaceObject.useEffect)(() => {
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/use-zoom-out.js
* A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.
* @param {boolean} zoomOut If we should enter into zoomOut mode or not
function useZoomOut(zoomOut = true) {
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
} = (0,external_wp_data_namespaceObject.useSelect)(store);
const originalEditingMode = (0,external_wp_element_namespaceObject.useRef)(null);
const mode = __unstableGetEditorMode();
(0,external_wp_element_namespaceObject.useEffect)(() => {
// Only set this on mount so we know what to return to when we unmount.
if (!originalEditingMode.current) {
originalEditingMode.current = mode;
// We need to use __unstableGetEditorMode() here and not `mode`, as mode may not update on unmount
if (__unstableGetEditorMode() === 'zoom-out' && __unstableGetEditorMode() !== originalEditingMode.current) {
__unstableSetEditorMode(originalEditingMode.current);
// The effect opens the zoom-out view if we want it open and it's not currently in zoom-out mode.
(0,external_wp_element_namespaceObject.useEffect)(() => {
if (zoomOut && mode !== 'zoom-out') {
__unstableSetEditorMode('zoom-out');
} else if (!zoomOut && __unstableGetEditorMode() === 'zoom-out' && originalEditingMode.current !== mode) {
__unstableSetEditorMode(originalEditingMode.current);
}, [__unstableSetEditorMode, zoomOut, mode]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/index.js
createBlockEditFilter([block_bindings, align, text_align, hooks_anchor, custom_class_name, style, duotone, position, layout, content_lock_ui, block_hooks, layout_child].filter(Boolean));
createBlockListBlockFilter([align, text_align, background, style, color, dimensions, duotone, font_family, font_size, border, position, block_style_variation, layout_child]);
createBlockSaveFilter([align, text_align, hooks_anchor, aria_label, custom_class_name, border, color, style, font_family, font_size]);
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/with-colors.js
kebabCase: with_colors_kebabCase
} = unlock(external_wp_components_namespaceObject.privateApis);
* Capitalizes the first letter in a string.
* @param {string} str The string whose first letter the function will capitalize.
* @return {string} Capitalized string.
const upperFirst = ([firstLetter, ...rest]) => firstLetter.toUpperCase() + rest.join('');
* Higher order component factory for injecting the `colorsArray` argument as
* the colors prop in the `withCustomColors` HOC.
* @param {Array} colorsArray An array of color objects.
* @return {Function} The higher order component.
const withCustomColorPalette = colorsArray => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
}), 'withCustomColorPalette');
* Higher order component factory for injecting the editor colors as the
* `colors` prop in the `withColors` HOC.
* @return {Function} The higher order component.
const withEditorColorPalette = () => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => {
const [userPalette, themePalette, defaultPalette] = use_settings_useSettings('color.palette.custom', 'color.palette.theme', 'color.palette.default');
const allColors = (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
}, 'withEditorColorPalette');
* Helper function used with `createHigherOrderComponent` to create
* higher order components for managing color logic.
* @param {Array} colorTypes An array of color types (e.g. 'backgroundColor, borderColor).
* @param {Function} withColorPalette A HOC for injecting the 'colors' prop into the WrappedComponent.
* @return {Component} The component that can be used as a HOC.
function createColorHOC(colorTypes, withColorPalette) {
const colorMap = colorTypes.reduce((colorObject, colorType) => {
...(typeof colorType === 'string' ? {
[colorType]: with_colors_kebabCase(colorType)
return (0,external_wp_compose_namespaceObject.compose)([withColorPalette, WrappedComponent => {
return class extends external_wp_element_namespaceObject.Component {
this.setters = this.createSetters();
getMostReadableColor: this.getMostReadableColor.bind(this)
getMostReadableColor(colorValue) {
return getMostReadableColor(colors, colorValue);
return Object.keys(colorMap).reduce((settersAccumulator, colorAttributeName) => {
const upperFirstColorAttributeName = upperFirst(colorAttributeName);
const customColorAttributeName = `custom${upperFirstColorAttributeName}`;
settersAccumulator[`set${upperFirstColorAttributeName}`] = this.createSetColor(colorAttributeName, customColorAttributeName);
return settersAccumulator;
createSetColor(colorAttributeName, customColorAttributeName) {
const colorObject = getColorObjectByColorValue(this.props.colors, colorValue);
this.props.setAttributes({
[colorAttributeName]: colorObject && colorObject.slug ? colorObject.slug : undefined,
[customColorAttributeName]: colorObject && colorObject.slug ? undefined : colorValue
static getDerivedStateFromProps({
return Object.entries(colorMap).reduce((newState, [colorAttributeName, colorContext]) => {
const colorObject = getColorObjectByAttributeValues(colors, attributes[colorAttributeName], attributes[`custom${upperFirst(colorAttributeName)}`]);
const previousColorObject = previousState[colorAttributeName];
const previousColor = previousColorObject?.color;
* The "and previousColorObject" condition checks that a previous color object was already computed.
* At the start previousColorObject and colorValue are both equal to undefined
* bus as previousColorObject does not exist we should compute the object.
if (previousColor === colorObject.color && previousColorObject) {
newState[colorAttributeName] = previousColorObject;
newState[colorAttributeName] = {
class: getColorClassName(colorContext, colorObject.slug)
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WrappedComponent, {
colorUtils: this.colorUtils
* A higher-order component factory for creating a 'withCustomColors' HOC, which handles color logic
* for class generation color value, retrieval and color attribute setting.
* Use this higher-order component to work with a custom set of colors.
* const CUSTOM_COLORS = [ { name: 'Red', slug: 'red', color: '#ff0000' }, { name: 'Blue', slug: 'blue', color: '#0000ff' } ];
* const withCustomColors = createCustomColorsHOC( CUSTOM_COLORS );
* export default compose(
* withCustomColors( 'backgroundColor', 'borderColor' ),
* @param {Array} colorsArray The array of color objects (name, slug, color, etc... ).
* @return {Function} Higher-order component.
function createCustomColorsHOC(colorsArray) {
return (...colorTypes) => {
const withColorPalette = withCustomColorPalette(colorsArray);
return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(createColorHOC(colorTypes, withColorPalette), 'withCustomColors');
* A higher-order component, which handles color logic for class generation color value, retrieval and color attribute setting.
* For use with the default editor/theme color palette.
* export default compose(
* withColors( 'backgroundColor', { textColor: 'color' } ),
* @param {...(Object|string)} colorTypes The arguments can be strings or objects. If the argument is an object,
* it should contain the color attribute name as key and the color context as value.
* If the argument is a string the value should be the color attribute name,
* the color context is computed by applying a kebab case transform to the value.
* Color context represents the context/place where the color is going to be used.
* The class name of the color is generated using 'has' followed by the color name
* and ending with the color context all in kebab case e.g: has-green-background-color.
* @return {Function} Higher-order component.
function withColors(...colorTypes) {
const withColorPalette = withEditorColorPalette();
return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(createColorHOC(colorTypes, withColorPalette), 'withColors');
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/colors/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/gradients/index.js
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/font-sizes/font-size-picker.js
function font_size_picker_FontSizePicker(props) {
const [fontSizes, customFontSize] = use_settings_useSettings('typography.fontSizes', 'typography.customFontSize');
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FontSizePicker, {
disableCustomFontSizes: !customFontSize