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
[17000] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/global-styles/hooks.js
[17001] Fix | Delete
/**
[17002] Fix | Delete
* External dependencies
[17003] Fix | Delete
*/
[17004] Fix | Delete
[17005] Fix | Delete
[17006] Fix | Delete
/**
[17007] Fix | Delete
* WordPress dependencies
[17008] Fix | Delete
*/
[17009] Fix | Delete
[17010] Fix | Delete
[17011] Fix | Delete
[17012] Fix | Delete
[17013] Fix | Delete
[17014] Fix | Delete
/**
[17015] Fix | Delete
* Internal dependencies
[17016] Fix | Delete
*/
[17017] Fix | Delete
[17018] Fix | Delete
[17019] Fix | Delete
[17020] Fix | Delete
[17021] Fix | Delete
const EMPTY_CONFIG = {
[17022] Fix | Delete
settings: {},
[17023] Fix | Delete
styles: {}
[17024] Fix | Delete
};
[17025] Fix | Delete
const VALID_SETTINGS = ['appearanceTools', 'useRootPaddingAwareAlignments', 'background.backgroundImage', 'background.backgroundRepeat', 'background.backgroundSize', 'background.backgroundPosition', 'border.color', 'border.radius', 'border.style', 'border.width', 'shadow.presets', 'shadow.defaultPresets', 'color.background', 'color.button', 'color.caption', 'color.custom', 'color.customDuotone', 'color.customGradient', 'color.defaultDuotone', 'color.defaultGradients', 'color.defaultPalette', 'color.duotone', 'color.gradients', 'color.heading', 'color.link', 'color.palette', 'color.text', 'custom', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout.contentSize', 'layout.definitions', 'layout.wideSize', 'lightbox.enabled', 'lightbox.allowEditing', 'position.fixed', 'position.sticky', 'spacing.customSpacingSize', 'spacing.defaultSpacingSizes', 'spacing.spacingSizes', 'spacing.spacingScale', 'spacing.blockGap', 'spacing.margin', 'spacing.padding', 'spacing.units', 'typography.fluid', 'typography.customFontSize', 'typography.defaultFontSizes', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', 'typography.fontStyle', 'typography.fontWeight', 'typography.letterSpacing', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.textTransform', 'typography.writingMode'];
[17026] Fix | Delete
const useGlobalStylesReset = () => {
[17027] Fix | Delete
const {
[17028] Fix | Delete
user,
[17029] Fix | Delete
setUserConfig
[17030] Fix | Delete
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
[17031] Fix | Delete
const config = {
[17032] Fix | Delete
settings: user.settings,
[17033] Fix | Delete
styles: user.styles
[17034] Fix | Delete
};
[17035] Fix | Delete
const canReset = !!config && !es6_default()(config, EMPTY_CONFIG);
[17036] Fix | Delete
return [canReset, (0,external_wp_element_namespaceObject.useCallback)(() => setUserConfig(EMPTY_CONFIG), [setUserConfig])];
[17037] Fix | Delete
};
[17038] Fix | Delete
function useGlobalSetting(propertyPath, blockName, source = 'all') {
[17039] Fix | Delete
const {
[17040] Fix | Delete
setUserConfig,
[17041] Fix | Delete
...configs
[17042] Fix | Delete
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
[17043] Fix | Delete
const appendedBlockPath = blockName ? '.blocks.' + blockName : '';
[17044] Fix | Delete
const appendedPropertyPath = propertyPath ? '.' + propertyPath : '';
[17045] Fix | Delete
const contextualPath = `settings${appendedBlockPath}${appendedPropertyPath}`;
[17046] Fix | Delete
const globalPath = `settings${appendedPropertyPath}`;
[17047] Fix | Delete
const sourceKey = source === 'all' ? 'merged' : source;
[17048] Fix | Delete
const settingValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
[17049] Fix | Delete
const configToUse = configs[sourceKey];
[17050] Fix | Delete
if (!configToUse) {
[17051] Fix | Delete
throw 'Unsupported source';
[17052] Fix | Delete
}
[17053] Fix | Delete
if (propertyPath) {
[17054] Fix | Delete
var _getValueFromObjectPa;
[17055] Fix | Delete
return (_getValueFromObjectPa = getValueFromObjectPath(configToUse, contextualPath)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : getValueFromObjectPath(configToUse, globalPath);
[17056] Fix | Delete
}
[17057] Fix | Delete
let result = {};
[17058] Fix | Delete
VALID_SETTINGS.forEach(setting => {
[17059] Fix | Delete
var _getValueFromObjectPa2;
[17060] Fix | Delete
const value = (_getValueFromObjectPa2 = getValueFromObjectPath(configToUse, `settings${appendedBlockPath}.${setting}`)) !== null && _getValueFromObjectPa2 !== void 0 ? _getValueFromObjectPa2 : getValueFromObjectPath(configToUse, `settings.${setting}`);
[17061] Fix | Delete
if (value !== undefined) {
[17062] Fix | Delete
result = setImmutably(result, setting.split('.'), value);
[17063] Fix | Delete
}
[17064] Fix | Delete
});
[17065] Fix | Delete
return result;
[17066] Fix | Delete
}, [configs, sourceKey, propertyPath, contextualPath, globalPath, appendedBlockPath]);
[17067] Fix | Delete
const setSetting = newValue => {
[17068] Fix | Delete
setUserConfig(currentConfig => setImmutably(currentConfig, contextualPath.split('.'), newValue));
[17069] Fix | Delete
};
[17070] Fix | Delete
return [settingValue, setSetting];
[17071] Fix | Delete
}
[17072] Fix | Delete
function useGlobalStyle(path, blockName, source = 'all', {
[17073] Fix | Delete
shouldDecodeEncode = true
[17074] Fix | Delete
} = {}) {
[17075] Fix | Delete
const {
[17076] Fix | Delete
merged: mergedConfig,
[17077] Fix | Delete
base: baseConfig,
[17078] Fix | Delete
user: userConfig,
[17079] Fix | Delete
setUserConfig
[17080] Fix | Delete
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
[17081] Fix | Delete
const appendedPath = path ? '.' + path : '';
[17082] Fix | Delete
const finalPath = !blockName ? `styles${appendedPath}` : `styles.blocks.${blockName}${appendedPath}`;
[17083] Fix | Delete
const setStyle = newValue => {
[17084] Fix | Delete
setUserConfig(currentConfig => setImmutably(currentConfig, finalPath.split('.'), shouldDecodeEncode ? getPresetVariableFromValue(mergedConfig.settings, blockName, path, newValue) : newValue));
[17085] Fix | Delete
};
[17086] Fix | Delete
let rawResult, result;
[17087] Fix | Delete
switch (source) {
[17088] Fix | Delete
case 'all':
[17089] Fix | Delete
rawResult = getValueFromObjectPath(mergedConfig, finalPath);
[17090] Fix | Delete
result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult;
[17091] Fix | Delete
break;
[17092] Fix | Delete
case 'user':
[17093] Fix | Delete
rawResult = getValueFromObjectPath(userConfig, finalPath);
[17094] Fix | Delete
result = shouldDecodeEncode ? getValueFromVariable(mergedConfig, blockName, rawResult) : rawResult;
[17095] Fix | Delete
break;
[17096] Fix | Delete
case 'base':
[17097] Fix | Delete
rawResult = getValueFromObjectPath(baseConfig, finalPath);
[17098] Fix | Delete
result = shouldDecodeEncode ? getValueFromVariable(baseConfig, blockName, rawResult) : rawResult;
[17099] Fix | Delete
break;
[17100] Fix | Delete
default:
[17101] Fix | Delete
throw 'Unsupported source';
[17102] Fix | Delete
}
[17103] Fix | Delete
return [result, setStyle];
[17104] Fix | Delete
}
[17105] Fix | Delete
function useGlobalStyleLinks() {
[17106] Fix | Delete
const {
[17107] Fix | Delete
merged: mergedConfig
[17108] Fix | Delete
} = (0,external_wp_element_namespaceObject.useContext)(GlobalStylesContext);
[17109] Fix | Delete
return mergedConfig?._links;
[17110] Fix | Delete
}
[17111] Fix | Delete
[17112] Fix | Delete
/**
[17113] Fix | Delete
* React hook that overrides a global settings object with block and element specific settings.
[17114] Fix | Delete
*
[17115] Fix | Delete
* @param {Object} parentSettings Settings object.
[17116] Fix | Delete
* @param {blockName?} blockName Block name.
[17117] Fix | Delete
* @param {element?} element Element name.
[17118] Fix | Delete
*
[17119] Fix | Delete
* @return {Object} Merge of settings and supports.
[17120] Fix | Delete
*/
[17121] Fix | Delete
function useSettingsForBlockElement(parentSettings, blockName, element) {
[17122] Fix | Delete
const {
[17123] Fix | Delete
supportedStyles,
[17124] Fix | Delete
supports
[17125] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
[17126] Fix | Delete
return {
[17127] Fix | Delete
supportedStyles: unlock(select(external_wp_blocks_namespaceObject.store)).getSupportedStyles(blockName, element),
[17128] Fix | Delete
supports: select(external_wp_blocks_namespaceObject.store).getBlockType(blockName)?.supports
[17129] Fix | Delete
};
[17130] Fix | Delete
}, [blockName, element]);
[17131] Fix | Delete
return (0,external_wp_element_namespaceObject.useMemo)(() => {
[17132] Fix | Delete
const updatedSettings = {
[17133] Fix | Delete
...parentSettings
[17134] Fix | Delete
};
[17135] Fix | Delete
if (!supportedStyles.includes('fontSize')) {
[17136] Fix | Delete
updatedSettings.typography = {
[17137] Fix | Delete
...updatedSettings.typography,
[17138] Fix | Delete
fontSizes: {},
[17139] Fix | Delete
customFontSize: false,
[17140] Fix | Delete
defaultFontSizes: false
[17141] Fix | Delete
};
[17142] Fix | Delete
}
[17143] Fix | Delete
if (!supportedStyles.includes('fontFamily')) {
[17144] Fix | Delete
updatedSettings.typography = {
[17145] Fix | Delete
...updatedSettings.typography,
[17146] Fix | Delete
fontFamilies: {}
[17147] Fix | Delete
};
[17148] Fix | Delete
}
[17149] Fix | Delete
updatedSettings.color = {
[17150] Fix | Delete
...updatedSettings.color,
[17151] Fix | Delete
text: updatedSettings.color?.text && supportedStyles.includes('color'),
[17152] Fix | Delete
background: updatedSettings.color?.background && (supportedStyles.includes('background') || supportedStyles.includes('backgroundColor')),
[17153] Fix | Delete
button: updatedSettings.color?.button && supportedStyles.includes('buttonColor'),
[17154] Fix | Delete
heading: updatedSettings.color?.heading && supportedStyles.includes('headingColor'),
[17155] Fix | Delete
link: updatedSettings.color?.link && supportedStyles.includes('linkColor'),
[17156] Fix | Delete
caption: updatedSettings.color?.caption && supportedStyles.includes('captionColor')
[17157] Fix | Delete
};
[17158] Fix | Delete
[17159] Fix | Delete
// Some blocks can enable background colors but disable gradients.
[17160] Fix | Delete
if (!supportedStyles.includes('background')) {
[17161] Fix | Delete
updatedSettings.color.gradients = [];
[17162] Fix | Delete
updatedSettings.color.customGradient = false;
[17163] Fix | Delete
}
[17164] Fix | Delete
[17165] Fix | Delete
// If filters are not supported by the block/element, disable duotone.
[17166] Fix | Delete
if (!supportedStyles.includes('filter')) {
[17167] Fix | Delete
updatedSettings.color.defaultDuotone = false;
[17168] Fix | Delete
updatedSettings.color.customDuotone = false;
[17169] Fix | Delete
}
[17170] Fix | Delete
['lineHeight', 'fontStyle', 'fontWeight', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration', 'writingMode'].forEach(key => {
[17171] Fix | Delete
if (!supportedStyles.includes(key)) {
[17172] Fix | Delete
updatedSettings.typography = {
[17173] Fix | Delete
...updatedSettings.typography,
[17174] Fix | Delete
[key]: false
[17175] Fix | Delete
};
[17176] Fix | Delete
}
[17177] Fix | Delete
});
[17178] Fix | Delete
[17179] Fix | Delete
// The column-count style is named text column to reduce confusion with
[17180] Fix | Delete
// the columns block and manage expectations from the support.
[17181] Fix | Delete
// See: https://github.com/WordPress/gutenberg/pull/33587
[17182] Fix | Delete
if (!supportedStyles.includes('columnCount')) {
[17183] Fix | Delete
updatedSettings.typography = {
[17184] Fix | Delete
...updatedSettings.typography,
[17185] Fix | Delete
textColumns: false
[17186] Fix | Delete
};
[17187] Fix | Delete
}
[17188] Fix | Delete
['contentSize', 'wideSize'].forEach(key => {
[17189] Fix | Delete
if (!supportedStyles.includes(key)) {
[17190] Fix | Delete
updatedSettings.layout = {
[17191] Fix | Delete
...updatedSettings.layout,
[17192] Fix | Delete
[key]: false
[17193] Fix | Delete
};
[17194] Fix | Delete
}
[17195] Fix | Delete
});
[17196] Fix | Delete
['padding', 'margin', 'blockGap'].forEach(key => {
[17197] Fix | Delete
if (!supportedStyles.includes(key)) {
[17198] Fix | Delete
updatedSettings.spacing = {
[17199] Fix | Delete
...updatedSettings.spacing,
[17200] Fix | Delete
[key]: false
[17201] Fix | Delete
};
[17202] Fix | Delete
}
[17203] Fix | Delete
const sides = Array.isArray(supports?.spacing?.[key]) ? supports?.spacing?.[key] : supports?.spacing?.[key]?.sides;
[17204] Fix | Delete
// Check if spacing type is supported before adding sides.
[17205] Fix | Delete
if (sides?.length && updatedSettings.spacing?.[key]) {
[17206] Fix | Delete
updatedSettings.spacing = {
[17207] Fix | Delete
...updatedSettings.spacing,
[17208] Fix | Delete
[key]: {
[17209] Fix | Delete
...updatedSettings.spacing?.[key],
[17210] Fix | Delete
sides
[17211] Fix | Delete
}
[17212] Fix | Delete
};
[17213] Fix | Delete
}
[17214] Fix | Delete
});
[17215] Fix | Delete
['aspectRatio', 'minHeight'].forEach(key => {
[17216] Fix | Delete
if (!supportedStyles.includes(key)) {
[17217] Fix | Delete
updatedSettings.dimensions = {
[17218] Fix | Delete
...updatedSettings.dimensions,
[17219] Fix | Delete
[key]: false
[17220] Fix | Delete
};
[17221] Fix | Delete
}
[17222] Fix | Delete
});
[17223] Fix | Delete
['radius', 'color', 'style', 'width'].forEach(key => {
[17224] Fix | Delete
if (!supportedStyles.includes('border' + key.charAt(0).toUpperCase() + key.slice(1))) {
[17225] Fix | Delete
updatedSettings.border = {
[17226] Fix | Delete
...updatedSettings.border,
[17227] Fix | Delete
[key]: false
[17228] Fix | Delete
};
[17229] Fix | Delete
}
[17230] Fix | Delete
});
[17231] Fix | Delete
updatedSettings.shadow = supportedStyles.includes('shadow') ? updatedSettings.shadow : false;
[17232] Fix | Delete
[17233] Fix | Delete
// Text alignment is only available for blocks.
[17234] Fix | Delete
if (element) {
[17235] Fix | Delete
updatedSettings.typography.textAlign = false;
[17236] Fix | Delete
}
[17237] Fix | Delete
return updatedSettings;
[17238] Fix | Delete
}, [parentSettings, supportedStyles, supports, element]);
[17239] Fix | Delete
}
[17240] Fix | Delete
function useColorsPerOrigin(settings) {
[17241] Fix | Delete
const customColors = settings?.color?.palette?.custom;
[17242] Fix | Delete
const themeColors = settings?.color?.palette?.theme;
[17243] Fix | Delete
const defaultColors = settings?.color?.palette?.default;
[17244] Fix | Delete
const shouldDisplayDefaultColors = settings?.color?.defaultPalette;
[17245] Fix | Delete
return (0,external_wp_element_namespaceObject.useMemo)(() => {
[17246] Fix | Delete
const result = [];
[17247] Fix | Delete
if (themeColors && themeColors.length) {
[17248] Fix | Delete
result.push({
[17249] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'),
[17250] Fix | Delete
colors: themeColors
[17251] Fix | Delete
});
[17252] Fix | Delete
}
[17253] Fix | Delete
if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
[17254] Fix | Delete
result.push({
[17255] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'),
[17256] Fix | Delete
colors: defaultColors
[17257] Fix | Delete
});
[17258] Fix | Delete
}
[17259] Fix | Delete
if (customColors && customColors.length) {
[17260] Fix | Delete
result.push({
[17261] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'),
[17262] Fix | Delete
colors: customColors
[17263] Fix | Delete
});
[17264] Fix | Delete
}
[17265] Fix | Delete
return result;
[17266] Fix | Delete
}, [customColors, themeColors, defaultColors, shouldDisplayDefaultColors]);
[17267] Fix | Delete
}
[17268] Fix | Delete
function useGradientsPerOrigin(settings) {
[17269] Fix | Delete
const customGradients = settings?.color?.gradients?.custom;
[17270] Fix | Delete
const themeGradients = settings?.color?.gradients?.theme;
[17271] Fix | Delete
const defaultGradients = settings?.color?.gradients?.default;
[17272] Fix | Delete
const shouldDisplayDefaultGradients = settings?.color?.defaultGradients;
[17273] Fix | Delete
return (0,external_wp_element_namespaceObject.useMemo)(() => {
[17274] Fix | Delete
const result = [];
[17275] Fix | Delete
if (themeGradients && themeGradients.length) {
[17276] Fix | Delete
result.push({
[17277] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Theme', 'Indicates this palette comes from the theme.'),
[17278] Fix | Delete
gradients: themeGradients
[17279] Fix | Delete
});
[17280] Fix | Delete
}
[17281] Fix | Delete
if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
[17282] Fix | Delete
result.push({
[17283] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Default', 'Indicates this palette comes from WordPress.'),
[17284] Fix | Delete
gradients: defaultGradients
[17285] Fix | Delete
});
[17286] Fix | Delete
}
[17287] Fix | Delete
if (customGradients && customGradients.length) {
[17288] Fix | Delete
result.push({
[17289] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Custom', 'Indicates this palette is created by the user.'),
[17290] Fix | Delete
gradients: customGradients
[17291] Fix | Delete
});
[17292] Fix | Delete
}
[17293] Fix | Delete
return result;
[17294] Fix | Delete
}, [customGradients, themeGradients, defaultGradients, shouldDisplayDefaultGradients]);
[17295] Fix | Delete
}
[17296] Fix | Delete
[17297] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs
[17298] Fix | Delete
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx);
[17299] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/utils.js
[17300] Fix | Delete
/**
[17301] Fix | Delete
* WordPress dependencies
[17302] Fix | Delete
*/
[17303] Fix | Delete
[17304] Fix | Delete
[17305] Fix | Delete
[17306] Fix | Delete
[17307] Fix | Delete
[17308] Fix | Delete
[17309] Fix | Delete
/**
[17310] Fix | Delete
* Internal dependencies
[17311] Fix | Delete
*/
[17312] Fix | Delete
[17313] Fix | Delete
[17314] Fix | Delete
[17315] Fix | Delete
[17316] Fix | Delete
[17317] Fix | Delete
[17318] Fix | Delete
/**
[17319] Fix | Delete
* External dependencies
[17320] Fix | Delete
*/
[17321] Fix | Delete
[17322] Fix | Delete
[17323] Fix | Delete
/**
[17324] Fix | Delete
* Removed falsy values from nested object.
[17325] Fix | Delete
*
[17326] Fix | Delete
* @param {*} object
[17327] Fix | Delete
* @return {*} Object cleaned from falsy values
[17328] Fix | Delete
*/
[17329] Fix | Delete
[17330] Fix | Delete
const utils_cleanEmptyObject = object => {
[17331] Fix | Delete
if (object === null || typeof object !== 'object' || Array.isArray(object)) {
[17332] Fix | Delete
return object;
[17333] Fix | Delete
}
[17334] Fix | Delete
const cleanedNestedObjects = Object.entries(object).map(([key, value]) => [key, utils_cleanEmptyObject(value)]).filter(([, value]) => value !== undefined);
[17335] Fix | Delete
return !cleanedNestedObjects.length ? undefined : Object.fromEntries(cleanedNestedObjects);
[17336] Fix | Delete
};
[17337] Fix | Delete
function transformStyles(activeSupports, migrationPaths, result, source, index, results) {
[17338] Fix | Delete
// If there are no active supports return early.
[17339] Fix | Delete
if (Object.values(activeSupports !== null && activeSupports !== void 0 ? activeSupports : {}).every(isActive => !isActive)) {
[17340] Fix | Delete
return result;
[17341] Fix | Delete
}
[17342] Fix | Delete
// If the condition verifies we are probably in the presence of a wrapping transform
[17343] Fix | Delete
// e.g: nesting paragraphs in a group or columns and in that case the styles should not be transformed.
[17344] Fix | Delete
if (results.length === 1 && result.innerBlocks.length === source.length) {
[17345] Fix | Delete
return result;
[17346] Fix | Delete
}
[17347] Fix | Delete
// For cases where we have a transform from one block to multiple blocks
[17348] Fix | Delete
// or multiple blocks to one block we apply the styles of the first source block
[17349] Fix | Delete
// to the result(s).
[17350] Fix | Delete
let referenceBlockAttributes = source[0]?.attributes;
[17351] Fix | Delete
// If we are in presence of transform between more than one block in the source
[17352] Fix | Delete
// that has more than one block in the result
[17353] Fix | Delete
// we apply the styles on source N to the result N,
[17354] Fix | Delete
// if source N does not exists we do nothing.
[17355] Fix | Delete
if (results.length > 1 && source.length > 1) {
[17356] Fix | Delete
if (source[index]) {
[17357] Fix | Delete
referenceBlockAttributes = source[index]?.attributes;
[17358] Fix | Delete
} else {
[17359] Fix | Delete
return result;
[17360] Fix | Delete
}
[17361] Fix | Delete
}
[17362] Fix | Delete
let returnBlock = result;
[17363] Fix | Delete
Object.entries(activeSupports).forEach(([support, isActive]) => {
[17364] Fix | Delete
if (isActive) {
[17365] Fix | Delete
migrationPaths[support].forEach(path => {
[17366] Fix | Delete
const styleValue = getValueFromObjectPath(referenceBlockAttributes, path);
[17367] Fix | Delete
if (styleValue) {
[17368] Fix | Delete
returnBlock = {
[17369] Fix | Delete
...returnBlock,
[17370] Fix | Delete
attributes: setImmutably(returnBlock.attributes, path, styleValue)
[17371] Fix | Delete
};
[17372] Fix | Delete
}
[17373] Fix | Delete
});
[17374] Fix | Delete
}
[17375] Fix | Delete
});
[17376] Fix | Delete
return returnBlock;
[17377] Fix | Delete
}
[17378] Fix | Delete
[17379] Fix | Delete
/**
[17380] Fix | Delete
* Check whether serialization of specific block support feature or set should
[17381] Fix | Delete
* be skipped.
[17382] Fix | Delete
*
[17383] Fix | Delete
* @param {string|Object} blockNameOrType Block name or block type object.
[17384] Fix | Delete
* @param {string} featureSet Name of block support feature set.
[17385] Fix | Delete
* @param {string} feature Name of the individual feature to check.
[17386] Fix | Delete
*
[17387] Fix | Delete
* @return {boolean} Whether serialization should occur.
[17388] Fix | Delete
*/
[17389] Fix | Delete
function shouldSkipSerialization(blockNameOrType, featureSet, feature) {
[17390] Fix | Delete
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockNameOrType, featureSet);
[17391] Fix | Delete
const skipSerialization = support?.__experimentalSkipSerialization;
[17392] Fix | Delete
if (Array.isArray(skipSerialization)) {
[17393] Fix | Delete
return skipSerialization.includes(feature);
[17394] Fix | Delete
}
[17395] Fix | Delete
return skipSerialization;
[17396] Fix | Delete
}
[17397] Fix | Delete
const pendingStyleOverrides = new WeakMap();
[17398] Fix | Delete
function useStyleOverride({
[17399] Fix | Delete
id,
[17400] Fix | Delete
css,
[17401] Fix | Delete
assets,
[17402] Fix | Delete
__unstableType,
[17403] Fix | Delete
variation,
[17404] Fix | Delete
clientId
[17405] Fix | Delete
} = {}) {
[17406] Fix | Delete
const {
[17407] Fix | Delete
setStyleOverride,
[17408] Fix | Delete
deleteStyleOverride
[17409] Fix | Delete
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
[17410] Fix | Delete
const registry = (0,external_wp_data_namespaceObject.useRegistry)();
[17411] Fix | Delete
const fallbackId = (0,external_wp_element_namespaceObject.useId)();
[17412] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[17413] Fix | Delete
// Unmount if there is CSS and assets are empty.
[17414] Fix | Delete
if (!css && !assets) {
[17415] Fix | Delete
return;
[17416] Fix | Delete
}
[17417] Fix | Delete
const _id = id || fallbackId;
[17418] Fix | Delete
const override = {
[17419] Fix | Delete
id,
[17420] Fix | Delete
css,
[17421] Fix | Delete
assets,
[17422] Fix | Delete
__unstableType,
[17423] Fix | Delete
variation,
[17424] Fix | Delete
clientId
[17425] Fix | Delete
};
[17426] Fix | Delete
// Batch updates to style overrides to avoid triggering cascading renders
[17427] Fix | Delete
// for each style override block included in a tree and optimize initial render.
[17428] Fix | Delete
if (!pendingStyleOverrides.get(registry)) {
[17429] Fix | Delete
pendingStyleOverrides.set(registry, []);
[17430] Fix | Delete
}
[17431] Fix | Delete
pendingStyleOverrides.get(registry).push([_id, override]);
[17432] Fix | Delete
window.queueMicrotask(() => {
[17433] Fix | Delete
if (pendingStyleOverrides.get(registry)?.length) {
[17434] Fix | Delete
registry.batch(() => {
[17435] Fix | Delete
pendingStyleOverrides.get(registry).forEach(args => {
[17436] Fix | Delete
setStyleOverride(...args);
[17437] Fix | Delete
});
[17438] Fix | Delete
pendingStyleOverrides.set(registry, []);
[17439] Fix | Delete
});
[17440] Fix | Delete
}
[17441] Fix | Delete
});
[17442] Fix | Delete
return () => {
[17443] Fix | Delete
const isPending = pendingStyleOverrides.get(registry)?.find(([currentId]) => currentId === _id);
[17444] Fix | Delete
if (isPending) {
[17445] Fix | Delete
pendingStyleOverrides.set(registry, pendingStyleOverrides.get(registry).filter(([currentId]) => currentId !== _id));
[17446] Fix | Delete
} else {
[17447] Fix | Delete
deleteStyleOverride(_id);
[17448] Fix | Delete
}
[17449] Fix | Delete
};
[17450] Fix | Delete
}, [id, css, clientId, assets, __unstableType, fallbackId, setStyleOverride, deleteStyleOverride, registry]);
[17451] Fix | Delete
}
[17452] Fix | Delete
[17453] Fix | Delete
/**
[17454] Fix | Delete
* Based on the block and its context, returns an object of all the block settings.
[17455] Fix | Delete
* This object can be passed as a prop to all the Styles UI components
[17456] Fix | Delete
* (TypographyPanel, DimensionsPanel...).
[17457] Fix | Delete
*
[17458] Fix | Delete
* @param {string} name Block name.
[17459] Fix | Delete
* @param {*} parentLayout Parent layout.
[17460] Fix | Delete
*
[17461] Fix | Delete
* @return {Object} Settings object.
[17462] Fix | Delete
*/
[17463] Fix | Delete
function useBlockSettings(name, parentLayout) {
[17464] Fix | Delete
const [backgroundImage, backgroundSize, customFontFamilies, defaultFontFamilies, themeFontFamilies, defaultFontSizesEnabled, customFontSizes, defaultFontSizes, themeFontSizes, customFontSize, fontStyle, fontWeight, lineHeight, textAlign, textColumns, textDecoration, writingMode, textTransform, letterSpacing, padding, margin, blockGap, defaultSpacingSizesEnabled, customSpacingSize, userSpacingSizes, defaultSpacingSizes, themeSpacingSizes, units, aspectRatio, minHeight, layout, borderColor, borderRadius, borderStyle, borderWidth, customColorsEnabled, customColors, customDuotone, themeColors, defaultColors, defaultPalette, defaultDuotone, userDuotonePalette, themeDuotonePalette, defaultDuotonePalette, userGradientPalette, themeGradientPalette, defaultGradientPalette, defaultGradients, areCustomGradientsEnabled, isBackgroundEnabled, isLinkEnabled, isTextEnabled, isHeadingEnabled, isButtonEnabled, shadow] = use_settings_useSettings('background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies.custom', 'typography.fontFamilies.default', 'typography.fontFamilies.theme', 'typography.defaultFontSizes', 'typography.fontSizes.custom', 'typography.fontSizes.default', 'typography.fontSizes.theme', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', 'typography.lineHeight', 'typography.textAlign', 'typography.textColumns', 'typography.textDecoration', 'typography.writingMode', 'typography.textTransform', 'typography.letterSpacing', 'spacing.padding', 'spacing.margin', 'spacing.blockGap', 'spacing.defaultSpacingSizes', 'spacing.customSpacingSize', 'spacing.spacingSizes.custom', 'spacing.spacingSizes.default', 'spacing.spacingSizes.theme', 'spacing.units', 'dimensions.aspectRatio', 'dimensions.minHeight', 'layout', 'border.color', 'border.radius', 'border.style', 'border.width', 'color.custom', 'color.palette.custom', 'color.customDuotone', 'color.palette.theme', 'color.palette.default', 'color.defaultPalette', 'color.defaultDuotone', 'color.duotone.custom', 'color.duotone.theme', 'color.duotone.default', 'color.gradients.custom', 'color.gradients.theme', 'color.gradients.default', 'color.defaultGradients', 'color.customGradient', 'color.background', 'color.link', 'color.text', 'color.heading', 'color.button', 'shadow');
[17465] Fix | Delete
const rawSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
[17466] Fix | Delete
return {
[17467] Fix | Delete
background: {
[17468] Fix | Delete
backgroundImage,
[17469] Fix | Delete
backgroundSize
[17470] Fix | Delete
},
[17471] Fix | Delete
color: {
[17472] Fix | Delete
palette: {
[17473] Fix | Delete
custom: customColors,
[17474] Fix | Delete
theme: themeColors,
[17475] Fix | Delete
default: defaultColors
[17476] Fix | Delete
},
[17477] Fix | Delete
gradients: {
[17478] Fix | Delete
custom: userGradientPalette,
[17479] Fix | Delete
theme: themeGradientPalette,
[17480] Fix | Delete
default: defaultGradientPalette
[17481] Fix | Delete
},
[17482] Fix | Delete
duotone: {
[17483] Fix | Delete
custom: userDuotonePalette,
[17484] Fix | Delete
theme: themeDuotonePalette,
[17485] Fix | Delete
default: defaultDuotonePalette
[17486] Fix | Delete
},
[17487] Fix | Delete
defaultGradients,
[17488] Fix | Delete
defaultPalette,
[17489] Fix | Delete
defaultDuotone,
[17490] Fix | Delete
custom: customColorsEnabled,
[17491] Fix | Delete
customGradient: areCustomGradientsEnabled,
[17492] Fix | Delete
customDuotone,
[17493] Fix | Delete
background: isBackgroundEnabled,
[17494] Fix | Delete
link: isLinkEnabled,
[17495] Fix | Delete
heading: isHeadingEnabled,
[17496] Fix | Delete
button: isButtonEnabled,
[17497] Fix | Delete
text: isTextEnabled
[17498] Fix | Delete
},
[17499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function