@wordpress/block-editor 12.19.5 → 12.19.6

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.
@@ -884,19 +884,19 @@ function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
884
884
  });
885
885
  const blockContext = (0, _element.useContext)(_blockContext.default);
886
886
  const isTemplate = blockContext?.templateSlug !== undefined;
887
- const getBlockStyles = (0, _data.useSelect)(select => {
888
- return select(_blocks.store).getBlockStyles;
889
- }, []);
887
+ const {
888
+ getBlockStyles
889
+ } = (0, _data.useSelect)(_blocks.store);
890
890
  return (0, _element.useMemo)(() => {
891
- var _mergedConfig$styles$;
891
+ var _updatedConfig$styles;
892
892
  if (!mergedConfig?.styles || !mergedConfig?.settings) {
893
893
  return [];
894
894
  }
895
- mergedConfig = updateConfigWithSeparator(mergedConfig);
895
+ const updatedConfig = updateConfigWithSeparator(mergedConfig);
896
896
  const blockSelectors = getBlockSelectors((0, _blocks.getBlockTypes)(), getBlockStyles);
897
- const customProperties = toCustomProperties(mergedConfig, blockSelectors);
898
- const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
899
- const svgs = toSvgFilters(mergedConfig, blockSelectors);
897
+ const customProperties = toCustomProperties(updatedConfig, blockSelectors);
898
+ const globalStyles = toStyles(updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
899
+ const svgs = toSvgFilters(updatedConfig, blockSelectors);
900
900
  const styles = [{
901
901
  css: customProperties,
902
902
  isGlobalStyles: true
@@ -906,7 +906,7 @@ function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
906
906
  },
907
907
  // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
908
908
  {
909
- css: (_mergedConfig$styles$ = mergedConfig.styles.css) !== null && _mergedConfig$styles$ !== void 0 ? _mergedConfig$styles$ : '',
909
+ css: (_updatedConfig$styles = updatedConfig.styles.css) !== null && _updatedConfig$styles !== void 0 ? _updatedConfig$styles : '',
910
910
  isGlobalStyles: true
911
911
  }, {
912
912
  assets: svgs,
@@ -918,16 +918,16 @@ function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
918
918
  // If there are, get the block selector and push the selector together with
919
919
  // the CSS value to the 'stylesheets' array.
920
920
  (0, _blocks.getBlockTypes)().forEach(blockType => {
921
- if (mergedConfig.styles.blocks[blockType.name]?.css) {
921
+ if (updatedConfig.styles.blocks[blockType.name]?.css) {
922
922
  const selector = blockSelectors[blockType.name].selector;
923
923
  styles.push({
924
- css: processCSSNesting(mergedConfig.styles.blocks[blockType.name]?.css, selector),
924
+ css: processCSSNesting(updatedConfig.styles.blocks[blockType.name]?.css, selector),
925
925
  isGlobalStyles: true
926
926
  });
927
927
  }
928
928
  });
929
- return [styles, mergedConfig.settings];
930
- }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles]);
929
+ return [styles, updatedConfig.settings];
930
+ }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, isTemplate, getBlockStyles]);
931
931
  }
932
932
 
933
933
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_element","_styleEngine","_components","_utils","_getBlockCssSelector","_typographyUtils","_context","_hooks","_utils2","_gap","_store","_definitions","_object","_blockContext","_interopRequireDefault","_lockUnlock","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","kebabCase","unlock","componentsPrivateApis","PRESET_METADATA","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","getValueFromObjectPath","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","getDuotoneFilter","colors","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","isTemplate","isRoot","ROOT_BLOCK_SELECTOR","output","STYLE_PROPERTY","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","getCSSRules","rule","ruleValue","ref","refPath","getTypographyFontSizeValue","size","getFluidTypographyOptionsFromSettings","settings","getLayoutStyles","layoutDefinitions","LAYOUT_DEFINITIONS","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","getGapCSSValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","_tree$styles$blocks","nodes","ELEMENTS","elements","blocks","blockName","node","_node$elements","variations","variation","duotoneSelector","hasLayoutSupport","styleVariationSelectors","elementName","sel","elementSelectors","elementSelector","exports","getNodesWithSettings","_tree$settings$blocks","pickPresets","presets","setImmutably","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","featureDeclarations","cssSelector","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockCSSSelector","getBlockSelectors","blockTypes","getBlockStyles","duotoneSupport","getBlockSupport","scopeSelector","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","getBlockStyleVariationSelector","undefined","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processCSSNesting","css","processedCSS","parts","part","isRootCss","splittedPart","nestedSelector","appendToSelector","useGlobalStylesOutputWithConfig","mergedConfig","useGlobalSetting","useSelect","select","getSettings","blockEditorStore","blockContext","useContext","BlockContext","templateSlug","blocksStore","useMemo","_mergedConfig$styles$","getBlockTypes","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged","GlobalStylesContext"],"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tscopeSelector,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n} from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport {\n\tgetTypographyFontSizeValue,\n\tgetFluidTypographyOptionsFromSettings,\n} from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { getDuotoneFilter } from '../duotone/utils';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport BlockContext from '../block-context';\nimport { unlock } from '../../lock-unlock';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\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\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t);\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\tgetDuotoneFilter(\n\t\t\t\t\t\t`wp-duotone-${ preset.slug }`,\n\t\t\t\t\t\tpreset.colors\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern.\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {},\n\tisTemplate = true\n) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\tblockStyles,\n\t\t\t\tpathToValue\n\t\t\t);\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getValueFromObjectPath( styleValue, [ prop ], false )\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tgetValueFromObjectPath( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue, false )\n\t\t\t) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set or if we're not editing a full template.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\t( useRootPaddingAlign || ! isTemplate ) &&\n\t\t\trule.key.startsWith( 'padding' )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\n\t\tlet ruleValue = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = getValueFromObjectPath( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\tgetFluidTypographyOptionsFromSettings( tree?.settings )\n\t\t\t);\n\t\t}\n\n\t\t// For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset.\n\t\t// This ensures that a fixed height does not override the aspect ratio.\n\t\tif ( cssProperty === 'aspect-ratio' ) {\n\t\t\toutput.push( 'min-height: unset' );\n\t\t}\n\n\t\toutput.push( `${ cssProperty }: ${ ruleValue }` );\n\t} );\n\n\treturn output;\n}\n\n/**\n * Get generated CSS for layout styles by looking up layout definitions provided\n * in theme.json, and outputting common layout styles, and specific blockGap values.\n *\n * @param {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\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}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(${ selector } .${ className })${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif ( selector === ROOT_BLOCK_SELECTOR && layoutDefinitions ) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\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\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nconst STYLE_KEYS = [\n\t'border',\n\t'color',\n\t'dimensions',\n\t'spacing',\n\t'typography',\n\t'filter',\n\t'outline',\n\t'shadow',\n];\n\nfunction pickStyleKeys( treeToPickFrom ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.keys( node.variations ).forEach( ( variation ) => {\n\t\t\t\t\tvariations[ variation ] = pickStyleKeys(\n\t\t\t\t\t\tnode.variations[ variation ]\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\t\t\tif ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\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\t.join( ',' ),\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);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tlet presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = getValueFromObjectPath( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tpresets = setImmutably( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tObject.entries( tree.settings?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false,\n\tisTemplate = true\n) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\t// Root padding styles should only be output for full templates, not patterns or template parts.\n\tif ( useRootPaddingAlign && isTemplate ) {\n\t\t/*\n\t\t * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508\n\t\t * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.\n\t\t */\n\t\truleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t\tstyleVariationSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tconst featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( styleVariationSelectors ) {\n\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\tif ( styleVariations ) {\n\t\t\t\t\t\t\t// If the block uses any custom selectors for block support, add those first.\n\t\t\t\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\t\t\t\t\t\t\t\t\t\t\tconcatFeatureVariationSelectorString(\n\t\t\t\t\t\t\t\t\t\t\t\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\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);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\tstyleVariationSelector,\n\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(\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}\n\n\t\t\t// Process duotone styles.\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneStyles = {};\n\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\tdelete styles.filter;\n\t\t\t\t}\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree,\n\t\t\t\tisTemplate\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset += pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`:where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( classes.length > 0 ) {\n\t\t\truleset += classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = ( blockTypes, getBlockStyles ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\tif ( blockStyleVariations?.length ) {\n\t\t\tblockStyleVariations.forEach( ( variation ) => {\n\t\t\t\tconst styleVariationSelector = getBlockStyleVariationSelector(\n\t\t\t\t\tvariation.name,\n\t\t\t\t\tselector\n\t\t\t\t);\n\t\t\t\tstyleVariationSelectors[ variation.name ] =\n\t\t\t\t\tstyleVariationSelector;\n\t\t\t} );\n\t\t}\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = getSelectorsConfig( blockType, selector );\n\n\t\tresult[ name ] = {\n\t\t\tduotoneSelector,\n\t\t\tfallbackGapValue,\n\t\t\tfeatureSelectors: Object.keys( featureSelectors ).length\n\t\t\t\t? featureSelectors\n\t\t\t\t: undefined,\n\t\t\thasLayoutSupport,\n\t\t\tname,\n\t\t\tselector,\n\t\t\tstyleVariationSelectors: Object.keys( styleVariationSelectors )\n\t\t\t\t.length\n\t\t\t\t? styleVariationSelectors\n\t\t\t\t: undefined,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\n/**\n * If there is a separator block whose color is defined in theme.json via background,\n * update the separator color to the same value by using border color.\n *\n * @param {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\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}\n\treturn config;\n}\n\nexport function processCSSNesting( css, blockSelector ) {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tconst isRootCss = ! part.includes( '{' );\n\t\tif ( isRootCss ) {\n\t\t\t// If the part doesn't contain braces, it applies to the root level.\n\t\t\tprocessedCSS += `${ blockSelector }{${ part.trim() }}`;\n\t\t} else {\n\t\t\t// If the part contains braces, it's a nested CSS rule.\n\t\t\tconst splittedPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splittedPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splittedPart;\n\t\t\tconst combinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t? scopeSelector( blockSelector, nestedSelector )\n\t\t\t\t: appendToSelector( blockSelector, nestedSelector );\n\n\t\t\tprocessedCSS += `${ combinedSelector }{${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst blockContext = useContext( BlockContext );\n\n\tconst isTemplate = blockContext?.templateSlug !== undefined;\n\n\tconst getBlockStyles = useSelect( ( select ) => {\n\t\treturn select( blocksStore ).getBlockStyles;\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tmergedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tisTemplate\n\t\t);\n\t\tconst svgs = toSvgFilters( mergedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: mergedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( mergedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tmergedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, mergedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAO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CAAClG,IAAI,CAAE,EAAE0H,GAAG,EACjDhL,QACD,CAAC;UACD0M,cAAc,EAAE;QACjB,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;IAEH,OAAO,CAAE7K,MAAM,EAAE4J,YAAY,CAACvH,QAAQ,CAAE;EACzC,CAAC,EAAE,CACFK,kBAAkB,EAClBC,qBAAqB,EACrBiH,YAAY,EACZxD,mBAAmB,CAClB,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS4E,qBAAqBA,CAAA,EAAG;EACvC,MAAM;IAAEC,MAAM,EAAErB;EAAa,CAAC,GAAG,IAAAO,mBAAU,EAAEe,4BAAoB,CAAC;EAClE,OAAOvB,+BAA+B,CAAEC,YAAa,CAAC;AACvD"}
1
+ {"version":3,"names":["_blocks","require","_data","_element","_styleEngine","_components","_utils","_getBlockCssSelector","_typographyUtils","_context","_hooks","_utils2","_gap","_store","_definitions","_object","_blockContext","_interopRequireDefault","_lockUnlock","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","kebabCase","unlock","componentsPrivateApis","PRESET_METADATA","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","getValueFromObjectPath","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","getDuotoneFilter","colors","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","isTemplate","isRoot","ROOT_BLOCK_SELECTOR","output","STYLE_PROPERTY","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","getCSSRules","rule","ruleValue","ref","refPath","getTypographyFontSizeValue","size","getFluidTypographyOptionsFromSettings","settings","getLayoutStyles","layoutDefinitions","LAYOUT_DEFINITIONS","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","getGapCSSValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","_tree$styles$blocks","nodes","ELEMENTS","elements","blocks","blockName","node","_node$elements","variations","variation","duotoneSelector","hasLayoutSupport","styleVariationSelectors","elementName","sel","elementSelectors","elementSelector","exports","getNodesWithSettings","_tree$settings$blocks","pickPresets","presets","setImmutably","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","featureDeclarations","cssSelector","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockCSSSelector","getBlockSelectors","blockTypes","getBlockStyles","duotoneSupport","getBlockSupport","scopeSelector","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","getBlockStyleVariationSelector","undefined","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processCSSNesting","css","processedCSS","parts","part","isRootCss","splittedPart","nestedSelector","appendToSelector","useGlobalStylesOutputWithConfig","mergedConfig","useGlobalSetting","useSelect","select","getSettings","blockEditorStore","blockContext","useContext","BlockContext","templateSlug","blocksStore","useMemo","_updatedConfig$styles","updatedConfig","getBlockTypes","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged","GlobalStylesContext"],"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tscopeSelector,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n} from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport {\n\tgetTypographyFontSizeValue,\n\tgetFluidTypographyOptionsFromSettings,\n} from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { getDuotoneFilter } from '../duotone/utils';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport BlockContext from '../block-context';\nimport { unlock } from '../../lock-unlock';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\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\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t);\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\tgetDuotoneFilter(\n\t\t\t\t\t\t`wp-duotone-${ preset.slug }`,\n\t\t\t\t\t\tpreset.colors\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern.\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {},\n\tisTemplate = true\n) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\tblockStyles,\n\t\t\t\tpathToValue\n\t\t\t);\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getValueFromObjectPath( styleValue, [ prop ], false )\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tgetValueFromObjectPath( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue, false )\n\t\t\t) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set or if we're not editing a full template.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\t( useRootPaddingAlign || ! isTemplate ) &&\n\t\t\trule.key.startsWith( 'padding' )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\n\t\tlet ruleValue = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = getValueFromObjectPath( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\tgetFluidTypographyOptionsFromSettings( tree?.settings )\n\t\t\t);\n\t\t}\n\n\t\t// For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset.\n\t\t// This ensures that a fixed height does not override the aspect ratio.\n\t\tif ( cssProperty === 'aspect-ratio' ) {\n\t\t\toutput.push( 'min-height: unset' );\n\t\t}\n\n\t\toutput.push( `${ cssProperty }: ${ ruleValue }` );\n\t} );\n\n\treturn output;\n}\n\n/**\n * Get generated CSS for layout styles by looking up layout definitions provided\n * in theme.json, and outputting common layout styles, and specific blockGap values.\n *\n * @param {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\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}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(${ selector } .${ className })${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif ( selector === ROOT_BLOCK_SELECTOR && layoutDefinitions ) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\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\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nconst STYLE_KEYS = [\n\t'border',\n\t'color',\n\t'dimensions',\n\t'spacing',\n\t'typography',\n\t'filter',\n\t'outline',\n\t'shadow',\n];\n\nfunction pickStyleKeys( treeToPickFrom ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.keys( node.variations ).forEach( ( variation ) => {\n\t\t\t\t\tvariations[ variation ] = pickStyleKeys(\n\t\t\t\t\t\tnode.variations[ variation ]\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\t\t\tif ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\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\t.join( ',' ),\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);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tlet presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = getValueFromObjectPath( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tpresets = setImmutably( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tObject.entries( tree.settings?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false,\n\tisTemplate = true\n) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\t// Root padding styles should only be output for full templates, not patterns or template parts.\n\tif ( useRootPaddingAlign && isTemplate ) {\n\t\t/*\n\t\t * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508\n\t\t * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.\n\t\t */\n\t\truleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t\tstyleVariationSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tconst featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( styleVariationSelectors ) {\n\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\tif ( styleVariations ) {\n\t\t\t\t\t\t\t// If the block uses any custom selectors for block support, add those first.\n\t\t\t\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\t\t\t\t\t\t\t\t\t\t\tconcatFeatureVariationSelectorString(\n\t\t\t\t\t\t\t\t\t\t\t\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\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);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\tstyleVariationSelector,\n\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(\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}\n\n\t\t\t// Process duotone styles.\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneStyles = {};\n\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\tdelete styles.filter;\n\t\t\t\t}\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree,\n\t\t\t\tisTemplate\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset += pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`:where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( classes.length > 0 ) {\n\t\t\truleset += classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = ( blockTypes, getBlockStyles ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\tif ( blockStyleVariations?.length ) {\n\t\t\tblockStyleVariations.forEach( ( variation ) => {\n\t\t\t\tconst styleVariationSelector = getBlockStyleVariationSelector(\n\t\t\t\t\tvariation.name,\n\t\t\t\t\tselector\n\t\t\t\t);\n\t\t\t\tstyleVariationSelectors[ variation.name ] =\n\t\t\t\t\tstyleVariationSelector;\n\t\t\t} );\n\t\t}\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = getSelectorsConfig( blockType, selector );\n\n\t\tresult[ name ] = {\n\t\t\tduotoneSelector,\n\t\t\tfallbackGapValue,\n\t\t\tfeatureSelectors: Object.keys( featureSelectors ).length\n\t\t\t\t? featureSelectors\n\t\t\t\t: undefined,\n\t\t\thasLayoutSupport,\n\t\t\tname,\n\t\t\tselector,\n\t\t\tstyleVariationSelectors: Object.keys( styleVariationSelectors )\n\t\t\t\t.length\n\t\t\t\t? styleVariationSelectors\n\t\t\t\t: undefined,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\n/**\n * If there is a separator block whose color is defined in theme.json via background,\n * update the separator color to the same value by using border color.\n *\n * @param {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\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}\n\treturn config;\n}\n\nexport function processCSSNesting( css, blockSelector ) {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tconst isRootCss = ! part.includes( '{' );\n\t\tif ( isRootCss ) {\n\t\t\t// If the part doesn't contain braces, it applies to the root level.\n\t\t\tprocessedCSS += `${ blockSelector }{${ part.trim() }}`;\n\t\t} else {\n\t\t\t// If the part contains braces, it's a nested CSS rule.\n\t\t\tconst splittedPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splittedPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splittedPart;\n\t\t\tconst combinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t? scopeSelector( blockSelector, nestedSelector )\n\t\t\t\t: appendToSelector( blockSelector, nestedSelector );\n\n\t\t\tprocessedCSS += `${ combinedSelector }{${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst blockContext = useContext( BlockContext );\n\n\tconst isTemplate = blockContext?.templateSlug !== undefined;\n\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst updatedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tisTemplate\n\t\t);\n\t\tconst svgs = toSvgFilters( updatedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: updatedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( updatedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tupdatedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, updatedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t\tisTemplate,\n\t\tgetBlockStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAOA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAIA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,MA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BAAqBA,CAAA,EAAG;EACvC,MAAM;IAAEC,MAAM,EAAEtB;EAAa,CAAC,GAAG,IAAAO,mBAAU,EAAEgB,4BAAoB,CAAC;EAClE,OAAOxB,+BAA+B,CAAEC,YAAa,CAAC;AACvD"}
@@ -148,6 +148,10 @@ function useMovingAnimation({
148
148
  });
149
149
  return () => {
150
150
  controller.stop();
151
+ controller.set({
152
+ x: 0,
153
+ y: 0
154
+ });
151
155
  };
152
156
  }, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected]);
153
157
  return ref;
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAE;EAAEC,wBAAwB;EAAEC;AAAS,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAM;IACLC,QAAQ;IACRC,mBAAmB;IACnBC,eAAe;IACfC,yBAAyB;IACzBC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;;EAEjC;EACA;EACA,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAG,IAAAC,gBAAO,EACrC,OAAQ;IACPF,QAAQ,EAAEV,GAAG,CAACa,OAAO,IAAItB,mBAAmB,CAAES,GAAG,CAACa,OAAQ,CAAC;IAC3DF,QAAQ,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I,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;IAClB,CAAC;EACF,CAAC,EAAE,CACFxC,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxD,kBAAkB"}
1
+ {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AAErC,SAASC,mBAAmBA,CAAEC,OAAO,EAAG;EACvC,OAAO;IACNC,GAAG,EAAED,OAAO,CAACE,SAAS;IACtBC,IAAI,EAAEH,OAAO,CAACI;EACf,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,kBAAkBA,CAAE;EAAEC,wBAAwB;EAAEC;AAAS,CAAC,EAAG;EACrE,MAAMC,GAAG,GAAG,IAAAC,eAAM,EAAC,CAAC;EACpB,MAAM;IACLC,QAAQ;IACRC,mBAAmB;IACnBC,eAAe;IACfC,yBAAyB;IACzBC,oBAAoB;IACpBC;EACD,CAAC,GAAG,IAAAC,eAAS,EAAEC,YAAiB,CAAC;;EAEjC;EACA;EACA,MAAM;IAAEC,QAAQ;IAAEC;EAAS,CAAC,GAAG,IAAAC,gBAAO,EACrC,OAAQ;IACPF,QAAQ,EAAEV,GAAG,CAACa,OAAO,IAAItB,mBAAmB,CAAES,GAAG,CAACa,OAAQ,CAAC;IAC3DF,QAAQ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AI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;MACjBpB,UAAU,CAACqB,GAAG,CAAE;QAAEnB,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAE,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,CACFvB,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEczD,kBAAkB"}
@@ -864,19 +864,19 @@ export function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
864
864
  });
865
865
  const blockContext = useContext(BlockContext);
866
866
  const isTemplate = blockContext?.templateSlug !== undefined;
867
- const getBlockStyles = useSelect(select => {
868
- return select(blocksStore).getBlockStyles;
869
- }, []);
867
+ const {
868
+ getBlockStyles
869
+ } = useSelect(blocksStore);
870
870
  return useMemo(() => {
871
- var _mergedConfig$styles$;
871
+ var _updatedConfig$styles;
872
872
  if (!mergedConfig?.styles || !mergedConfig?.settings) {
873
873
  return [];
874
874
  }
875
- mergedConfig = updateConfigWithSeparator(mergedConfig);
875
+ const updatedConfig = updateConfigWithSeparator(mergedConfig);
876
876
  const blockSelectors = getBlockSelectors(getBlockTypes(), getBlockStyles);
877
- const customProperties = toCustomProperties(mergedConfig, blockSelectors);
878
- const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
879
- const svgs = toSvgFilters(mergedConfig, blockSelectors);
877
+ const customProperties = toCustomProperties(updatedConfig, blockSelectors);
878
+ const globalStyles = toStyles(updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, isTemplate);
879
+ const svgs = toSvgFilters(updatedConfig, blockSelectors);
880
880
  const styles = [{
881
881
  css: customProperties,
882
882
  isGlobalStyles: true
@@ -886,7 +886,7 @@ export function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
886
886
  },
887
887
  // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
888
888
  {
889
- css: (_mergedConfig$styles$ = mergedConfig.styles.css) !== null && _mergedConfig$styles$ !== void 0 ? _mergedConfig$styles$ : '',
889
+ css: (_updatedConfig$styles = updatedConfig.styles.css) !== null && _updatedConfig$styles !== void 0 ? _updatedConfig$styles : '',
890
890
  isGlobalStyles: true
891
891
  }, {
892
892
  assets: svgs,
@@ -898,16 +898,16 @@ export function useGlobalStylesOutputWithConfig(mergedConfig = {}) {
898
898
  // If there are, get the block selector and push the selector together with
899
899
  // the CSS value to the 'stylesheets' array.
900
900
  getBlockTypes().forEach(blockType => {
901
- if (mergedConfig.styles.blocks[blockType.name]?.css) {
901
+ if (updatedConfig.styles.blocks[blockType.name]?.css) {
902
902
  const selector = blockSelectors[blockType.name].selector;
903
903
  styles.push({
904
- css: processCSSNesting(mergedConfig.styles.blocks[blockType.name]?.css, selector),
904
+ css: processCSSNesting(updatedConfig.styles.blocks[blockType.name]?.css, selector),
905
905
  isGlobalStyles: true
906
906
  });
907
907
  }
908
908
  });
909
- return [styles, mergedConfig.settings];
910
- }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles]);
909
+ return [styles, updatedConfig.settings];
910
+ }, [hasBlockGapSupport, hasFallbackGapSupport, mergedConfig, disableLayoutStyles, isTemplate, getBlockStyles]);
911
911
  }
912
912
 
913
913
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockSupport","getBlockTypes","store","blocksStore","useSelect","useContext","useMemo","getCSSRules","privateApis","componentsPrivateApis","PRESET_METADATA","ROOT_BLOCK_SELECTOR","scopeSelector","appendToSelector","getBlockStyleVariationSelector","getBlockCSSSelector","getTypographyFontSizeValue","getFluidTypographyOptionsFromSettings","GlobalStylesContext","useGlobalSetting","getDuotoneFilter","getGapCSSValue","blockEditorStore","LAYOUT_DEFINITIONS","getValueFromObjectPath","setImmutably","BlockContext","unlock","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","kebabCase","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","colors","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","isTemplate","isRoot","output","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","rule","ruleValue","ref","refPath","size","settings","getLayoutStyles","layoutDefinitions","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","_tree$styles$blocks","nodes","elements","blocks","blockName","node","_node$elements","variations","variation","duotoneSelector","hasLayoutSupport","styleVariationSelectors","elementName","sel","elementSelectors","elementSelector","getNodesWithSettings","_tree$settings$blocks","pickPresets","presets","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","featureDeclarations","cssSelector","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockSelectors","blockTypes","getBlockStyles","duotoneSupport","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","undefined","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processCSSNesting","css","processedCSS","parts","part","isRootCss","splittedPart","nestedSelector","useGlobalStylesOutputWithConfig","mergedConfig","select","getSettings","blockContext","templateSlug","_mergedConfig$styles$","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged"],"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tscopeSelector,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n} from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport {\n\tgetTypographyFontSizeValue,\n\tgetFluidTypographyOptionsFromSettings,\n} from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { getDuotoneFilter } from '../duotone/utils';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport BlockContext from '../block-context';\nimport { unlock } from '../../lock-unlock';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\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\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t);\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\tgetDuotoneFilter(\n\t\t\t\t\t\t`wp-duotone-${ preset.slug }`,\n\t\t\t\t\t\tpreset.colors\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern.\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {},\n\tisTemplate = true\n) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\tblockStyles,\n\t\t\t\tpathToValue\n\t\t\t);\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getValueFromObjectPath( styleValue, [ prop ], false )\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tgetValueFromObjectPath( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue, false )\n\t\t\t) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set or if we're not editing a full template.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\t( useRootPaddingAlign || ! isTemplate ) &&\n\t\t\trule.key.startsWith( 'padding' )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\n\t\tlet ruleValue = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = getValueFromObjectPath( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\tgetFluidTypographyOptionsFromSettings( tree?.settings )\n\t\t\t);\n\t\t}\n\n\t\t// For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset.\n\t\t// This ensures that a fixed height does not override the aspect ratio.\n\t\tif ( cssProperty === 'aspect-ratio' ) {\n\t\t\toutput.push( 'min-height: unset' );\n\t\t}\n\n\t\toutput.push( `${ cssProperty }: ${ ruleValue }` );\n\t} );\n\n\treturn output;\n}\n\n/**\n * Get generated CSS for layout styles by looking up layout definitions provided\n * in theme.json, and outputting common layout styles, and specific blockGap values.\n *\n * @param {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\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}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(${ selector } .${ className })${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif ( selector === ROOT_BLOCK_SELECTOR && layoutDefinitions ) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\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\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nconst STYLE_KEYS = [\n\t'border',\n\t'color',\n\t'dimensions',\n\t'spacing',\n\t'typography',\n\t'filter',\n\t'outline',\n\t'shadow',\n];\n\nfunction pickStyleKeys( treeToPickFrom ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.keys( node.variations ).forEach( ( variation ) => {\n\t\t\t\t\tvariations[ variation ] = pickStyleKeys(\n\t\t\t\t\t\tnode.variations[ variation ]\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\t\t\tif ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\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\t.join( ',' ),\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);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tlet presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = getValueFromObjectPath( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tpresets = setImmutably( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tObject.entries( tree.settings?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false,\n\tisTemplate = true\n) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\t// Root padding styles should only be output for full templates, not patterns or template parts.\n\tif ( useRootPaddingAlign && isTemplate ) {\n\t\t/*\n\t\t * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508\n\t\t * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.\n\t\t */\n\t\truleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t\tstyleVariationSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tconst featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( styleVariationSelectors ) {\n\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\tif ( styleVariations ) {\n\t\t\t\t\t\t\t// If the block uses any custom selectors for block support, add those first.\n\t\t\t\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\t\t\t\t\t\t\t\t\t\t\tconcatFeatureVariationSelectorString(\n\t\t\t\t\t\t\t\t\t\t\t\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\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);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\tstyleVariationSelector,\n\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(\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}\n\n\t\t\t// Process duotone styles.\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneStyles = {};\n\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\tdelete styles.filter;\n\t\t\t\t}\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree,\n\t\t\t\tisTemplate\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset += pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`:where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( classes.length > 0 ) {\n\t\t\truleset += classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = ( blockTypes, getBlockStyles ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\tif ( blockStyleVariations?.length ) {\n\t\t\tblockStyleVariations.forEach( ( variation ) => {\n\t\t\t\tconst styleVariationSelector = getBlockStyleVariationSelector(\n\t\t\t\t\tvariation.name,\n\t\t\t\t\tselector\n\t\t\t\t);\n\t\t\t\tstyleVariationSelectors[ variation.name ] =\n\t\t\t\t\tstyleVariationSelector;\n\t\t\t} );\n\t\t}\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = getSelectorsConfig( blockType, selector );\n\n\t\tresult[ name ] = {\n\t\t\tduotoneSelector,\n\t\t\tfallbackGapValue,\n\t\t\tfeatureSelectors: Object.keys( featureSelectors ).length\n\t\t\t\t? featureSelectors\n\t\t\t\t: undefined,\n\t\t\thasLayoutSupport,\n\t\t\tname,\n\t\t\tselector,\n\t\t\tstyleVariationSelectors: Object.keys( styleVariationSelectors )\n\t\t\t\t.length\n\t\t\t\t? styleVariationSelectors\n\t\t\t\t: undefined,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\n/**\n * If there is a separator block whose color is defined in theme.json via background,\n * update the separator color to the same value by using border color.\n *\n * @param {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\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}\n\treturn config;\n}\n\nexport function processCSSNesting( css, blockSelector ) {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tconst isRootCss = ! part.includes( '{' );\n\t\tif ( isRootCss ) {\n\t\t\t// If the part doesn't contain braces, it applies to the root level.\n\t\t\tprocessedCSS += `${ blockSelector }{${ part.trim() }}`;\n\t\t} else {\n\t\t\t// If the part contains braces, it's a nested CSS rule.\n\t\t\tconst splittedPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splittedPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splittedPart;\n\t\t\tconst combinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t? scopeSelector( blockSelector, nestedSelector )\n\t\t\t\t: appendToSelector( blockSelector, nestedSelector );\n\n\t\t\tprocessedCSS += `${ combinedSelector }{${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst blockContext = useContext( BlockContext );\n\n\tconst isTemplate = blockContext?.templateSlug !== undefined;\n\n\tconst getBlockStyles = useSelect( ( select ) => {\n\t\treturn select( blocksStore ).getBlockStyles;\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tmergedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tisTemplate\n\t\t);\n\t\tconst svgs = toSvgFilters( mergedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: mergedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( mergedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tmergedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, mergedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,6BAA6B,IAAIC,cAAc,EAC/CC,uBAAuB,IAAIC,QAAQ,EACnCC,eAAe,EACfC,aAAa,EACbC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,SACCC,eAAe,EACfC,mBAAmB,EACnBC,aAAa,EACbC,gBAAgB,EAChBC,8BAA8B,QACxB,SAAS;AAChB,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SACCC,0BAA0B,EAC1BC,qCAAqC,QAC/B,oBAAoB;AAC3B,SAASC,mBAAmB,QAAQ,WAAW;AAC/C,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASnB,KAAK,IAAIoB,gBAAgB,QAAQ,aAAa;AACvD,SAASC,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,sBAAsB,EAAEC,YAAY,QAAQ,oBAAoB;AACzE,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;AACA;AACA,MAAMC,qCAAqC,GAAG;EAC7CC,oBAAoB,EAAE,QAAQ;EAC9BC,KAAK,EAAE,OAAO;EACdC,OAAO,EAAE,SAAS;EAClBC,UAAU,EAAE;AACb,CAAC;AAED,SAASC,iBAAiBA,CAAEC,eAAe,EAAG;EAC7C,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,MAAM,CAACoE,MAAM,CAAE6C,SAAS,CAAC1F,IAAI,CAAE,EAAE8G,GAAG,EACjDjK,QACD,CAAC;UACDkL,cAAc,EAAE;QACjB,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;IAEH,OAAO,CAAEtJ,MAAM,EAAE6I,YAAY,CAAC7G,QAAQ,CAAE;EACzC,CAAC,EAAE,CACFI,kBAAkB,EAClBC,qBAAqB,EACrBwG,YAAY,EACZnD,mBAAmB,CAClB,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS+D,qBAAqBA,CAAA,EAAG;EACvC,MAAM;IAAEC,MAAM,EAAEb;EAAa,CAAC,GAAGxO,UAAU,CAAEa,mBAAoB,CAAC;EAClE,OAAO0N,+BAA+B,CAAEC,YAAa,CAAC;AACvD"}
1
+ {"version":3,"names":["__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockSupport","getBlockTypes","store","blocksStore","useSelect","useContext","useMemo","getCSSRules","privateApis","componentsPrivateApis","PRESET_METADATA","ROOT_BLOCK_SELECTOR","scopeSelector","appendToSelector","getBlockStyleVariationSelector","getBlockCSSSelector","getTypographyFontSizeValue","getFluidTypographyOptionsFromSettings","GlobalStylesContext","useGlobalSetting","getDuotoneFilter","getGapCSSValue","blockEditorStore","LAYOUT_DEFINITIONS","getValueFromObjectPath","setImmutably","BlockContext","unlock","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","kebabCase","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","colors","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","isTemplate","isRoot","output","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","rule","ruleValue","ref","refPath","size","settings","getLayoutStyles","layoutDefinitions","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","_tree$styles$blocks","nodes","elements","blocks","blockName","node","_node$elements","variations","variation","duotoneSelector","hasLayoutSupport","styleVariationSelectors","elementName","sel","elementSelectors","elementSelector","getNodesWithSettings","_tree$settings$blocks","pickPresets","presets","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","featureDeclarations","cssSelector","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockSelectors","blockTypes","getBlockStyles","duotoneSupport","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","undefined","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processCSSNesting","css","processedCSS","parts","part","isRootCss","splittedPart","nestedSelector","useGlobalStylesOutputWithConfig","mergedConfig","select","getSettings","blockContext","templateSlug","_updatedConfig$styles","updatedConfig","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged"],"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tscopeSelector,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n} from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport {\n\tgetTypographyFontSizeValue,\n\tgetFluidTypographyOptionsFromSettings,\n} from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { getDuotoneFilter } from '../duotone/utils';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport BlockContext from '../block-context';\nimport { unlock } from '../../lock-unlock';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\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\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t);\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\tgetDuotoneFilter(\n\t\t\t\t\t\t`wp-duotone-${ preset.slug }`,\n\t\t\t\t\t\tpreset.colors\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @param {boolean} isTemplate Whether the entity being edited is a full template or a pattern.\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {},\n\tisTemplate = true\n) {\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\tblockStyles,\n\t\t\t\tpathToValue\n\t\t\t);\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getValueFromObjectPath( styleValue, [ prop ], false )\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tgetValueFromObjectPath( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue, false )\n\t\t\t) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set or if we're not editing a full template.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\t( useRootPaddingAlign || ! isTemplate ) &&\n\t\t\trule.key.startsWith( 'padding' )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst cssProperty = rule.key.startsWith( '--' )\n\t\t\t? rule.key\n\t\t\t: kebabCase( rule.key );\n\n\t\tlet ruleValue = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = getValueFromObjectPath( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\tgetFluidTypographyOptionsFromSettings( tree?.settings )\n\t\t\t);\n\t\t}\n\n\t\t// For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset.\n\t\t// This ensures that a fixed height does not override the aspect ratio.\n\t\tif ( cssProperty === 'aspect-ratio' ) {\n\t\t\toutput.push( 'min-height: unset' );\n\t\t}\n\n\t\toutput.push( `${ cssProperty }: ${ ruleValue }` );\n\t} );\n\n\treturn output;\n}\n\n/**\n * Get generated CSS for layout styles by looking up layout definitions provided\n * in theme.json, and outputting common layout styles, and specific blockGap values.\n *\n * @param {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\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}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(${ selector } .${ className })${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif ( selector === ROOT_BLOCK_SELECTOR && layoutDefinitions ) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\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\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\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}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nconst STYLE_KEYS = [\n\t'border',\n\t'color',\n\t'dimensions',\n\t'spacing',\n\t'typography',\n\t'filter',\n\t'outline',\n\t'shadow',\n];\n\nfunction pickStyleKeys( treeToPickFrom ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.keys( node.variations ).forEach( ( variation ) => {\n\t\t\t\t\tvariations[ variation ] = pickStyleKeys(\n\t\t\t\t\t\tnode.variations[ variation ]\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\t\t\tif ( blockStyles && blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\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\t.join( ',' ),\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);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tlet presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = getValueFromObjectPath( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tpresets = setImmutably( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tObject.entries( tree.settings?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false,\n\tisTemplate = true\n) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\t// Root padding styles should only be output for full templates, not patterns or template parts.\n\tif ( useRootPaddingAlign && isTemplate ) {\n\t\t/*\n\t\t * These rules reproduce the ones from https://github.com/WordPress/gutenberg/blob/79103f124925d1f457f627e154f52a56228ed5ad/lib/class-wp-theme-json-gutenberg.php#L2508\n\t\t * almost exactly, but for the selectors that target block wrappers in the front end. This code only runs in the editor, so it doesn't need those selectors.\n\t\t */\n\t\truleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }\n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }\n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }\n\t\t\t.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }\n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where(.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t\tstyleVariationSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tconst featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tstyles\n\t\t\t\t);\n\n\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif ( styleVariationSelectors ) {\n\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\tif ( styleVariations ) {\n\t\t\t\t\t\t\t// If the block uses any custom selectors for block support, add those first.\n\t\t\t\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ] ) => {\n\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\t\t\t\t\t\t\t\t\t\t\tconcatFeatureVariationSelectorString(\n\t\t\t\t\t\t\t\t\t\t\t\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\truleset += `${ cssSelector }{${ rules };}`;\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);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\tstyleVariationSelector,\n\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset += `${ styleVariationSelector }{${ styleVariationDeclarations.join(\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}\n\n\t\t\t// Process duotone styles.\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneStyles = {};\n\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\tdelete styles.filter;\n\t\t\t\t}\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree,\n\t\t\t\tisTemplate\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset += pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`:where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :first-child:first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':where(.wp-site-blocks) > :last-child:last-child { margin-block-end: 0; }';\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( classes.length > 0 ) {\n\t\t\truleset += classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = ( blockTypes, getBlockStyles ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\tif ( blockStyleVariations?.length ) {\n\t\t\tblockStyleVariations.forEach( ( variation ) => {\n\t\t\t\tconst styleVariationSelector = getBlockStyleVariationSelector(\n\t\t\t\t\tvariation.name,\n\t\t\t\t\tselector\n\t\t\t\t);\n\t\t\t\tstyleVariationSelectors[ variation.name ] =\n\t\t\t\t\tstyleVariationSelector;\n\t\t\t} );\n\t\t}\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = getSelectorsConfig( blockType, selector );\n\n\t\tresult[ name ] = {\n\t\t\tduotoneSelector,\n\t\t\tfallbackGapValue,\n\t\t\tfeatureSelectors: Object.keys( featureSelectors ).length\n\t\t\t\t? featureSelectors\n\t\t\t\t: undefined,\n\t\t\thasLayoutSupport,\n\t\t\tname,\n\t\t\tselector,\n\t\t\tstyleVariationSelectors: Object.keys( styleVariationSelectors )\n\t\t\t\t.length\n\t\t\t\t? styleVariationSelectors\n\t\t\t\t: undefined,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\n/**\n * If there is a separator block whose color is defined in theme.json via background,\n * update the separator color to the same value by using border color.\n *\n * @param {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\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}\n\treturn config;\n}\n\nexport function processCSSNesting( css, blockSelector ) {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tconst isRootCss = ! part.includes( '{' );\n\t\tif ( isRootCss ) {\n\t\t\t// If the part doesn't contain braces, it applies to the root level.\n\t\t\tprocessedCSS += `${ blockSelector }{${ part.trim() }}`;\n\t\t} else {\n\t\t\t// If the part contains braces, it's a nested CSS rule.\n\t\t\tconst splittedPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splittedPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splittedPart;\n\t\t\tconst combinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t? scopeSelector( blockSelector, nestedSelector )\n\t\t\t\t: appendToSelector( blockSelector, nestedSelector );\n\n\t\t\tprocessedCSS += `${ combinedSelector }{${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst blockContext = useContext( BlockContext );\n\n\tconst isTemplate = blockContext?.templateSlug !== undefined;\n\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst updatedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tisTemplate\n\t\t);\n\t\tconst svgs = toSvgFilters( updatedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: updatedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( updatedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tupdatedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, updatedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t\tisTemplate,\n\t\tgetBlockStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,6BAA6B,IAAIC,cAAc,EAC/CC,uBAAuB,IAAIC,QAAQ,EACnCC,eAAe,EACfC,aAAa,EACbC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,SACCC,eAAe,E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AAEgB,YAAY;MACjBE,cAAc,EAAE;IACjB,CAAC;IACD;IACA;MACClB,GAAG,GAAAa,qBAAA,GAAEC,aAAa,CAACnJ,MAAM,CAACqI,GAAG,cAAAa,qBAAA,cAAAA,qBAAA,GAAI,EAAE;MACnCK,cAAc,EAAE;IACjB,CAAC,EACD;MACCC,MAAM,EAAEF,IAAI;MACZG,cAAc,EAAE,KAAK;MACrBF,cAAc,EAAE;IACjB,CAAC,CACD;;IAED;IACA;IACA;IACAtP,aAAa,CAAC,CAAC,CAACsD,OAAO,CAAI0J,SAAS,IAAM;MACzC,IAAKkC,aAAa,CAACnJ,MAAM,CAACoE,MAAM,CAAE6C,SAAS,CAAC1F,IAAI,CAAE,EAAE8G,GAAG,EAAG;QACzD,MAAMjK,QAAQ,GAAG4F,cAAc,CAAEiD,SAAS,CAAC1F,IAAI,CAAE,CAACnD,QAAQ;QAC1D4B,MAAM,CAACtC,IAAI,CAAE;UACZ2K,GAAG,EAAED,iBAAiB,CACrBe,aAAa,CAACnJ,MAAM,CAACoE,MAAM,CAAE6C,SAAS,CAAC1F,IAAI,CAAE,EAAE8G,GAAG,EAClDjK,QACD,CAAC;UACDmL,cAAc,EAAE;QACjB,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;IAEH,OAAO,CAAEvJ,MAAM,EAAEmJ,aAAa,CAACnH,QAAQ,CAAE;EAC1C,CAAC,EAAE,CACFI,kBAAkB,EAClBC,qBAAqB,EACrBwG,YAAY,EACZnD,mBAAmB,EACnB5E,UAAU,EACV0G,cAAc,CACb,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASkC,qBAAqBA,CAAA,EAAG;EACvC,MAAM;IAAEC,MAAM,EAAEd;EAAa,CAAC,GAAGxO,UAAU,CAAEa,mBAAoB,CAAC;EAClE,OAAO0N,+BAA+B,CAAEC,YAAa,CAAC;AACvD"}
@@ -142,6 +142,10 @@ function useMovingAnimation({
142
142
  });
143
143
  return () => {
144
144
  controller.stop();
145
+ controller.set({
146
+ x: 0,
147
+ y: 0
148
+ });
145
149
  };
146
150
  }, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected]);
147
151
  return ref;
@@ -1 +1 @@
1
- {"version":3,"names":["Controller","useLayoutEffect","useMemo","useRef","getScrollContainer","useSelect","store","blockEditorStore","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","previous","prevRect","current","getBoundingClientRect","scrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n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,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAON,GAAG;AACX;AAEA,eAAeH,kBAAkB"}
1
+ {"version":3,"names":["Controller","useLayoutEffect","useMemo","useRef","getScrollContainer","useSelect","store","blockEditorStore","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","previous","prevRect","current","getBoundingClientRect","scrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":"AAAA;AACA;AACA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AAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAON,GAAG;AACX;AAEA,eAAeH,kBAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "12.19.5",
3
+ "version": "12.19.6",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -38,9 +38,9 @@
38
38
  "@wordpress/a11y": "^3.51.1",
39
39
  "@wordpress/api-fetch": "^6.48.1",
40
40
  "@wordpress/blob": "^3.51.1",
41
- "@wordpress/blocks": "^12.28.5",
42
- "@wordpress/commands": "^0.22.4",
43
- "@wordpress/components": "^26.0.4",
41
+ "@wordpress/blocks": "^12.28.6",
42
+ "@wordpress/commands": "^0.22.5",
43
+ "@wordpress/components": "^26.0.5",
44
44
  "@wordpress/compose": "^6.28.1",
45
45
  "@wordpress/data": "^9.21.1",
46
46
  "@wordpress/date": "^4.51.1",
@@ -51,14 +51,14 @@
51
51
  "@wordpress/hooks": "^3.51.1",
52
52
  "@wordpress/html-entities": "^3.51.1",
53
53
  "@wordpress/i18n": "^4.51.1",
54
- "@wordpress/icons": "^9.42.3",
54
+ "@wordpress/icons": "^9.42.4",
55
55
  "@wordpress/is-shallow-equal": "^4.51.1",
56
56
  "@wordpress/keyboard-shortcuts": "^4.28.1",
57
57
  "@wordpress/keycodes": "^3.51.1",
58
58
  "@wordpress/notices": "^4.19.1",
59
- "@wordpress/preferences": "^3.28.4",
59
+ "@wordpress/preferences": "^3.28.5",
60
60
  "@wordpress/private-apis": "^0.33.1",
61
- "@wordpress/rich-text": "^6.28.3",
61
+ "@wordpress/rich-text": "^6.28.4",
62
62
  "@wordpress/style-engine": "^1.34.1",
63
63
  "@wordpress/token-list": "^2.51.1",
64
64
  "@wordpress/url": "^3.52.1",
@@ -87,5 +87,5 @@
87
87
  "publishConfig": {
88
88
  "access": "public"
89
89
  },
90
- "gitHead": "4927ea437069f9aed12f696df294a79bd8e12fd5"
90
+ "gitHead": "7d2a00f1998a0a696694802725e523628f994cfc"
91
91
  }
@@ -1194,15 +1194,13 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
1194
1194
 
1195
1195
  const isTemplate = blockContext?.templateSlug !== undefined;
1196
1196
 
1197
- const getBlockStyles = useSelect( ( select ) => {
1198
- return select( blocksStore ).getBlockStyles;
1199
- }, [] );
1197
+ const { getBlockStyles } = useSelect( blocksStore );
1200
1198
 
1201
1199
  return useMemo( () => {
1202
1200
  if ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {
1203
1201
  return [];
1204
1202
  }
1205
- mergedConfig = updateConfigWithSeparator( mergedConfig );
1203
+ const updatedConfig = updateConfigWithSeparator( mergedConfig );
1206
1204
 
1207
1205
  const blockSelectors = getBlockSelectors(
1208
1206
  getBlockTypes(),
@@ -1210,18 +1208,18 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
1210
1208
  );
1211
1209
 
1212
1210
  const customProperties = toCustomProperties(
1213
- mergedConfig,
1211
+ updatedConfig,
1214
1212
  blockSelectors
1215
1213
  );
1216
1214
  const globalStyles = toStyles(
1217
- mergedConfig,
1215
+ updatedConfig,
1218
1216
  blockSelectors,
1219
1217
  hasBlockGapSupport,
1220
1218
  hasFallbackGapSupport,
1221
1219
  disableLayoutStyles,
1222
1220
  isTemplate
1223
1221
  );
1224
- const svgs = toSvgFilters( mergedConfig, blockSelectors );
1222
+ const svgs = toSvgFilters( updatedConfig, blockSelectors );
1225
1223
 
1226
1224
  const styles = [
1227
1225
  {
@@ -1234,7 +1232,7 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
1234
1232
  },
1235
1233
  // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.
1236
1234
  {
1237
- css: mergedConfig.styles.css ?? '',
1235
+ css: updatedConfig.styles.css ?? '',
1238
1236
  isGlobalStyles: true,
1239
1237
  },
1240
1238
  {
@@ -1248,11 +1246,11 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
1248
1246
  // If there are, get the block selector and push the selector together with
1249
1247
  // the CSS value to the 'stylesheets' array.
1250
1248
  getBlockTypes().forEach( ( blockType ) => {
1251
- if ( mergedConfig.styles.blocks[ blockType.name ]?.css ) {
1249
+ if ( updatedConfig.styles.blocks[ blockType.name ]?.css ) {
1252
1250
  const selector = blockSelectors[ blockType.name ].selector;
1253
1251
  styles.push( {
1254
1252
  css: processCSSNesting(
1255
- mergedConfig.styles.blocks[ blockType.name ]?.css,
1253
+ updatedConfig.styles.blocks[ blockType.name ]?.css,
1256
1254
  selector
1257
1255
  ),
1258
1256
  isGlobalStyles: true,
@@ -1260,12 +1258,14 @@ export function useGlobalStylesOutputWithConfig( mergedConfig = {} ) {
1260
1258
  }
1261
1259
  } );
1262
1260
 
1263
- return [ styles, mergedConfig.settings ];
1261
+ return [ styles, updatedConfig.settings ];
1264
1262
  }, [
1265
1263
  hasBlockGapSupport,
1266
1264
  hasFallbackGapSupport,
1267
1265
  mergedConfig,
1268
1266
  disableLayoutStyles,
1267
+ isTemplate,
1268
+ getBlockStyles,
1269
1269
  ] );
1270
1270
  }
1271
1271
 
@@ -142,6 +142,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
142
142
 
143
143
  return () => {
144
144
  controller.stop();
145
+ controller.set( { x: 0, y: 0 } );
145
146
  };
146
147
  }, [
147
148
  previous,