@wordpress/global-styles-engine 1.10.0 → 1.11.0

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.
@@ -973,7 +973,9 @@ var getBlockSelectors = (blockTypes, variationInstanceId) => {
973
973
  "color.__experimentalDuotone",
974
974
  false
975
975
  );
976
- duotoneSelector = duotoneSupport && rootSelector && (0, import_common.scopeSelector)(rootSelector, duotoneSupport);
976
+ if (typeof duotoneSupport === "string" && rootSelector) {
977
+ duotoneSelector = (0, import_common.scopeSelector)(rootSelector, duotoneSupport);
978
+ }
977
979
  }
978
980
  const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout;
979
981
  const fallbackGapValue = (
@@ -1108,7 +1110,7 @@ function generateGlobalStyles(config = {}, blockTypes = [], options = {}) {
1108
1110
  },
1109
1111
  {
1110
1112
  assets: svgs,
1111
- __unstableType: "svg",
1113
+ __unstableType: "svgs",
1112
1114
  isGlobalStyles: true
1113
1115
  }
1114
1116
  ];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/core/render.tsx"],
4
- "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\t// @ts-expect-error - @wordpress/blocks module doesn't have TypeScript declarations\n} from '@wordpress/blocks';\nimport { getCSSRules, getCSSValueFromRawStyle } from '@wordpress/style-engine';\nimport { select } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tROOT_CSS_PROPERTIES_SELECTOR,\n\tscopeSelector,\n\tscopeFeatureSelectors,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n\tgetResolvedValue,\n} from '../utils/common';\nimport { getBlockSelector } from './selectors';\nimport { getTypographyFontSizeValue } from '../utils/typography';\nimport { getDuotoneFilter } from '../utils/duotone';\nimport { kebabCase } from '../utils/string';\nimport { getGapCSSValue } from '../utils/gap';\nimport { setBackgroundStyleDefaults } from '../utils/background';\nimport { LAYOUT_DEFINITIONS } from '../utils/layout';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\nimport { getSetting } from '../settings/get-setting';\nimport type {\n\tBlockStyleVariation,\n\tBlockType,\n\tGlobalStylesConfig,\n\tGlobalStylesStyles,\n} from '../types';\n\n// =============================================================================\n// LOCAL TYPE DEFINITIONS\n// =============================================================================\n\n/**\n * Preset metadata for CSS variable generation\n */\ninterface PresetMetadata {\n\tpath: string[];\n\tvalueKey?: string;\n\tvalueFunc?: ( preset: any, settings: any ) => string | number | null;\n\tcssVarInfix: string;\n\tclasses?: Array< {\n\t\tclassSuffix: string;\n\t\tpropertyName: string;\n\t} >;\n}\n\n/**\n * Preset collection by origin\n */\ninterface PresetsByOrigin {\n\t[ origin: string ]: any[];\n}\n\n/**\n * CSS class configuration\n */\ninterface CSSClassConfig {\n\tclassSuffix: string;\n\tpropertyName: string;\n}\n\n/**\n * Style property configuration from WordPress\n */\ninterface StylePropertyConfig {\n\tvalue: string[];\n\tproperties?: Record< string, string >;\n\tuseEngine?: boolean;\n\trootOnly?: boolean;\n}\n\n/**\n * Layout definition structure\n */\ninterface LayoutDefinition {\n\tclassName: string;\n\tname: string;\n\tdisplayMode?: string;\n\tspacingStyles?: Array< {\n\t\tselector?: string;\n\t\trules?: Record< string, any >;\n\t} >;\n\tbaseStyles?: Array< {\n\t\tselector?: string;\n\t\trules?: Record< string, any >;\n\t} >;\n}\n\n/**\n * CSS rule from style engine\n */\ninterface CSSRule {\n\tkey: string;\n\tvalue: any;\n}\n\n/**\n * Block variation in theme.json (different from BlockStyleVariation)\n */\ninterface BlockVariation {\n\tcss?: string;\n\telements?: Record< string, any >;\n\tblocks?: Record< string, any >;\n\t[ key: string ]: any; // For additional style properties\n}\n\n/**\n * Block node in theme.json\n */\ninterface BlockNode {\n\tvariations?: Record< string, BlockVariation >;\n\telements?: Record< string, any >;\n\t[ key: string ]: any; // For additional style properties\n}\n\nexport type BlockSelectors = Record<\n\tstring,\n\t{\n\t\tduotoneSelector?: string;\n\t\tselector: string;\n\t\tfallbackGapValue?: string;\n\t\thasLayoutSupport?: boolean;\n\t\tfeatureSelectors?:\n\t\t\t| string\n\t\t\t| Record< string, string | Record< string, string > >;\n\t\tname?: string;\n\t\tstyleVariationSelectors?: Record< string, string >;\n\t}\n>;\n\n// Elements that rely on class names in their selectors.\nconst ELEMENT_CLASS_NAMES = {\n\tbutton: 'wp-element-button',\n\tcaption: 'wp-element-caption',\n};\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\tdimensions: 'dimensions',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param blockSelector Block selector string\n * @param blockPresets Block presets object\n * @return CSS declarations for the preset classes\n */\nfunction getPresetsClasses(\n\tblockSelector: string = '*',\n\tblockPresets: Record< string, any > = {}\n): string {\n\treturn PRESET_METADATA.reduce(\n\t\t(\n\t\t\tdeclarations: string,\n\t\t\t{ path, cssVarInfix, classes }: PresetMetadata\n\t\t) => {\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) as PresetsByOrigin;\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach(\n\t\t\t\t\t\t( { slug }: { slug: string } ) => {\n\t\t\t\t\t\t\tclasses!.forEach(\n\t\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\t\tclassSuffix,\n\t\t\t\t\t\t\t\t\tpropertyName,\n\t\t\t\t\t\t\t\t}: CSSClassConfig ) => {\n\t\t\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters(\n\tblockPresets: Record< string, any > = {}\n): string[] {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata: PresetMetadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata: PresetMetadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t) as PresetsByOrigin;\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: any ) =>\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(\n\tinput: any = {},\n\tprefix: string,\n\ttoken: string\n): string[] {\n\tlet result: string[] = [];\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 featureSelector The feature selector\n * @param styleVariationSelector The style variation selector\n * @return Combined selector string\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector: string,\n\tstyleVariationSelector: string\n): string {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors: string[] = [];\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 * Updates the text indent selector for paragraph blocks based on the textIndent setting.\n *\n * The textIndent setting can be 'subsequent' (default), 'all', or false.\n * When set to 'all', the selector should be '.wp-block-paragraph' instead of\n * '.wp-block-paragraph + .wp-block-paragraph' to apply indent to all paragraphs.\n *\n * @param featureDeclarations The feature declarations keyed by selector\n * @param settings Theme.json settings\n * @param blockName The name of the block being processed\n * @return Updated feature declarations\n */\nconst updateParagraphTextIndentSelector = (\n\tfeatureDeclarations: Record< string, string[] >,\n\tsettings: Record< string, any > | undefined,\n\tblockName: string | undefined\n): Record< string, string[] > => {\n\tif ( blockName !== 'core/paragraph' ) {\n\t\treturn featureDeclarations;\n\t}\n\n\t// Check block-level settings first, then fall back to global settings.\n\tconst blockSettings = settings?.blocks?.[ 'core/paragraph' ];\n\tconst textIndentSetting =\n\t\tblockSettings?.typography?.textIndent ??\n\t\tsettings?.typography?.textIndent ??\n\t\t'subsequent';\n\n\tif ( textIndentSetting !== 'all' ) {\n\t\treturn featureDeclarations;\n\t}\n\n\t// Look for the text indent selector and replace it.\n\tconst oldSelector = '.wp-block-paragraph + .wp-block-paragraph';\n\tconst newSelector = '.wp-block-paragraph';\n\n\tif ( oldSelector in featureDeclarations ) {\n\t\tconst declarations = featureDeclarations[ oldSelector ];\n\t\tconst updated = { ...featureDeclarations };\n\t\tdelete updated[ oldSelector ];\n\t\tupdated[ newSelector ] = declarations;\n\t\treturn updated;\n\t}\n\n\treturn featureDeclarations;\n};\n\n/**\n * Updates button width declarations to use a calc() formula for percentage values.\n *\n * When a percentage width is set on the Button block via Global Styles, the\n * resulting CSS needs to account for block gap spacing so that buttons tile\n * correctly on a row (e.g. 4 buttons at 25% width all fit on one row).\n *\n * This mirrors the dynamic calc() formula applied at the block instance level\n * in the button block's stylesheet (style.scss).\n *\n * @param featureDeclarations Feature declarations keyed by selector.\n * @param settings The theme.json settings.\n * @return Updated feature declarations.\n */\nconst updateButtonWidthDeclarations = (\n\tfeatureDeclarations: Record< string, string[] >,\n\tsettings: Record< string, any > | undefined\n): Record< string, string[] > => {\n\tconst buttonSelector = '.wp-block-button';\n\tif ( ! ( buttonSelector in featureDeclarations ) ) {\n\t\treturn featureDeclarations;\n\t}\n\n\tconst updated = { ...featureDeclarations };\n\tupdated[ buttonSelector ] = updated[ buttonSelector ].map(\n\t\t( declaration ) => {\n\t\t\t// Match \"width: <value>\" declarations.\n\t\t\tconst match = declaration.match( /^width:\\s*(.+)$/ );\n\t\t\tif ( ! match ) {\n\t\t\t\treturn declaration;\n\t\t\t}\n\n\t\t\tconst value = match[ 1 ];\n\t\t\tlet percentage: number | null = null;\n\n\t\t\t// Case 1: Direct percentage value e.g. \"25%\".\n\t\t\tif ( value.endsWith( '%' ) ) {\n\t\t\t\tpercentage = parseFloat( value );\n\t\t\t}\n\n\t\t\t// Case 2: Preset CSS var e.g. \"var(--wp--preset--dimension--50)\".\n\t\t\tconst presetPrefix = 'var(--wp--preset--dimension--';\n\t\t\tif (\n\t\t\t\tpercentage === null &&\n\t\t\t\tvalue.startsWith( presetPrefix ) &&\n\t\t\t\tvalue.endsWith( ')' )\n\t\t\t) {\n\t\t\t\tconst slug = value.slice( presetPrefix.length, -1 );\n\n\t\t\t\t/*\n\t\t\t\t * Look up the preset size across all origins.\n\t\t\t\t * Check block-level settings first (core/button), then top-level settings.\n\t\t\t\t * Spread block-level entries first so they take precedence.\n\t\t\t\t */\n\t\t\t\tconst dimensionSizes = {\n\t\t\t\t\t...( settings?.dimensions?.dimensionSizes ?? {} ),\n\t\t\t\t\t...( settings?.blocks?.[ 'core/button' ]?.dimensions\n\t\t\t\t\t\t?.dimensionSizes ?? {} ),\n\t\t\t\t};\n\t\t\t\tfor ( const origin of Object.values( dimensionSizes ) ) {\n\t\t\t\t\tif ( ! Array.isArray( origin ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tfor ( const preset of origin ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tpreset.slug === slug &&\n\t\t\t\t\t\t\ttypeof preset.size === 'string' &&\n\t\t\t\t\t\t\tpreset.size.endsWith( '%' )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tpercentage = parseFloat( preset.size );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( percentage !== null ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( percentage === null || isNaN( percentage ) ) {\n\t\t\t\treturn declaration;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Apply the same calc() formula as the block instance level (style.scss).\n\t\t\t * The numeric percentage value is used as a unitless number:\n\t\t\t * - Multiplied by 1% to get the percentage width.\n\t\t\t * - Divided by 100 to calculate the gap adjustment proportion.\n\t\t\t */\n\t\t\treturn `width: calc(${ percentage } * 1% - (var(--wp--style--block-gap, 0.5em) * (1 - ${ percentage } / 100)))`;\n\t\t}\n\t);\n\n\treturn updated;\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 selectors Custom selectors object for a block\n * @param styles A block's styles object\n * @return Style declarations\n */\nconst getFeatureDeclarations = (\n\tselectors: Record< string, any >,\n\tstyles: Record< string, any >\n): Record< string, string[] > => {\n\tconst declarations: Record< string, string[] > = {};\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 (\n\t\t\t! isShorthand &&\n\t\t\ttypeof selector === 'object' &&\n\t\t\tselector !== null\n\t\t) {\n\t\t\tObject.entries( selector as Record< string, string > ).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 (\n\t\t\tisShorthand ||\n\t\t\t( typeof selector === 'object' &&\n\t\t\t\tselector !== null &&\n\t\t\t\t'root' in selector )\n\t\t) {\n\t\t\tconst featureSelector = isShorthand\n\t\t\t\t? ( selector as string )\n\t\t\t\t: ( selector as any ).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 blockStyles Block styles\n * @param selector The selector these declarations should attach to\n * @param useRootPaddingAlign Whether to use CSS custom properties in root selector\n * @param tree A theme.json tree containing layout definitions\n * @param disableRootPadding Whether to force disable the root padding styles\n * @return An array of style declarations\n */\nexport function getStylesDeclarations(\n\tblockStyles: any = {},\n\tselector: string = '',\n\tuseRootPaddingAlign?: boolean,\n\ttree: any = {},\n\tdisableRootPadding: boolean = false\n): string[] {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries(\n\t\tSTYLE_PROPERTY as Record< string, StylePropertyConfig >\n\t).reduce(\n\t\t(\n\t\t\tdeclarations: string[],\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]: [\n\t\t\t\tstring,\n\t\t\t\tStylePropertyConfig,\n\t\t\t]\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 }: ${ getCSSValueFromRawStyle(\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 }: ${ getCSSValueFromRawStyle(\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[] as string[]\n\t);\n\n\t/*\n\t * Preprocess background image values.\n\t *\n\t * Note: As we absorb more and more styles into the engine, we could simplify this function.\n\t * A refactor is for the style engine to handle ref resolution (and possibly defaults)\n\t * via a public util used internally and externally. Theme.json tree and defaults could be passed\n\t * as options.\n\t */\n\tif ( !! blockStyles.background ) {\n\t\t/*\n\t\t * Resolve dynamic values before they are compiled by the style engine,\n\t\t * which doesn't (yet) resolve dynamic values.\n\t\t */\n\t\tif ( blockStyles.background?.backgroundImage ) {\n\t\t\tblockStyles.background.backgroundImage = getResolvedValue(\n\t\t\t\tblockStyles.background.backgroundImage,\n\t\t\t\ttree\n\t\t\t);\n\t\t}\n\n\t\t/*\n\t\t * Set default values for block background styles.\n\t\t * Top-level styles are an exception as they are applied to the body.\n\t\t */\n\t\tif ( ! isRoot && !! blockStyles.background?.backgroundImage?.id ) {\n\t\t\tblockStyles = {\n\t\t\t\t...blockStyles,\n\t\t\t\tbackground: {\n\t\t\t\t\t...blockStyles.background,\n\t\t\t\t\t...setBackgroundStyleDefaults( blockStyles.background ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule: CSSRule ) => {\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 || disableRootPadding ) &&\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 = getResolvedValue( rule.value, tree );\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{ name: '', slug: '', size: ruleValue as string },\n\t\t\t\ttree?.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 props Layout styles configuration\n * @param props.layoutDefinitions Layout definitions from theme.json\n * @param props.style Style object for the block\n * @param props.selector Selector to apply the styles to\n * @param props.hasBlockGapSupport Whether the block supports block gap styles\n * @param props.hasFallbackGapSupport Whether the block supports fallback gap styles\n * @param props.fallbackGapValue Fallback gap value to use if block gap support is\n *\n * @return 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\tlayoutDefinitions?: Record< string, LayoutDefinition >;\n\tstyle?: GlobalStylesStyles;\n\tselector?: string;\n\thasBlockGapSupport?: boolean;\n\thasFallbackGapSupport?: boolean;\n\tfallbackGapValue?: string;\n} ): string {\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: any ) => {\n\t\t\t\t\t\tconst declarations: string[] = [];\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? `:root :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: `:root :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}\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 += `${ ROOT_CSS_PROPERTIES_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 }: LayoutDefinition ) => {\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: any ) => {\n\t\t\t\t\t\tconst declarations: string[] = [];\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 = `.${ 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\t'background',\n];\n\nfunction pickStyleKeys( treeToPickFrom: any ): any {\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 = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: string | BlockSelectors\n): any[] => {\n\tconst nodes: {\n\t\tstyles: Partial< Omit< GlobalStylesStyles, 'elements' | 'blocks' > >;\n\t\tselector: string;\n\t\tskipSelectorWrapper?: boolean;\n\t\tduotoneSelector?: string;\n\t\tfeatureSelectors?:\n\t\t\t| string\n\t\t\t| Record< string, string | Record< string, string > >;\n\t\tfallbackGapValue?: string;\n\t\thasLayoutSupport?: boolean;\n\t\tstyleVariationSelectors?: Record< string, string >;\n\t\tname?: string;\n\t}[] = [];\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\t// Root selector (body) styles should not be wrapped in `:root where()` to keep\n\t\t\t// specificity at (0,0,1) and maintain backwards compatibility.\n\t\t\tskipSelectorWrapper: true,\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: selector as string,\n\t\t\t\t// Top level elements that don't use a class name should not receive the\n\t\t\t\t// `:root :where()` wrapper to maintain backwards compatibility.\n\t\t\t\tskipSelectorWrapper: ! (\n\t\t\t\t\tELEMENT_CLASS_NAMES as Record< string, string >\n\t\t\t\t )[ name ],\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\t\t\tconst typedNode = node as BlockNode;\n\n\t\t\t// Store variation data for later processing, but don't add to nodes yet.\n\t\t\t// Variations should be processed AFTER the main block styles to match PHP order.\n\t\t\tconst variationNodesToAdd: typeof nodes = [];\n\n\t\t\tif ( typedNode?.variations ) {\n\t\t\t\tconst variations: Record< string, any > = {};\n\t\t\t\tObject.entries( typedNode.variations ).forEach(\n\t\t\t\t\t( [ variationName, variation ] ) => {\n\t\t\t\t\t\tconst typedVariation = variation as BlockVariation;\n\t\t\t\t\t\tvariations[ variationName ] =\n\t\t\t\t\t\t\tpickStyleKeys( typedVariation );\n\t\t\t\t\t\tif ( typedVariation?.css ) {\n\t\t\t\t\t\t\tvariations[ variationName ].css =\n\t\t\t\t\t\t\t\ttypedVariation.css;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst variationSelector =\n\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t? blockSelectors[ blockName ]\n\t\t\t\t\t\t\t\t\t\t?.styleVariationSelectors?.[\n\t\t\t\t\t\t\t\t\t\tvariationName\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t// Process the variation's inner element styles.\n\t\t\t\t\t\t// This comes before the inner block styles so the\n\t\t\t\t\t\t// element styles within the block type styles take\n\t\t\t\t\t\t// precedence over these.\n\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\ttypedVariation?.elements ?? {}\n\t\t\t\t\t\t).forEach( ( [ element, elementStyles ] ) => {\n\t\t\t\t\t\t\tif ( elementStyles && ELEMENTS[ element ] ) {\n\t\t\t\t\t\t\t\tvariationNodesToAdd.push( {\n\t\t\t\t\t\t\t\t\tstyles: elementStyles,\n\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\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\t// Process the variations inner block type styles.\n\t\t\t\t\t\tObject.entries( typedVariation?.blocks ?? {} ).forEach(\n\t\t\t\t\t\t\t( [\n\t\t\t\t\t\t\t\tvariationBlockName,\n\t\t\t\t\t\t\t\tvariationBlockStyles,\n\t\t\t\t\t\t\t] ) => {\n\t\t\t\t\t\t\t\tconst variationBlockSelector =\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t\t\t? scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\t\tblockSelectors[\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockName\n\t\t\t\t\t\t\t\t\t\t\t\t]?.selector\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst variationDuotoneSelector =\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t\t\t? scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\t\tblockSelectors[\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockName\n\t\t\t\t\t\t\t\t\t\t\t\t]?.duotoneSelector as string\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst variationFeatureSelectors =\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t\t\t? scopeFeatureSelectors(\n\t\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\t\tblockSelectors[\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockName\n\t\t\t\t\t\t\t\t\t\t\t\t]?.featureSelectors ?? {}\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t\t\tconst variationBlockStyleNodes =\n\t\t\t\t\t\t\t\t\tpickStyleKeys( variationBlockStyles );\n\n\t\t\t\t\t\t\t\tif ( variationBlockStyles?.css ) {\n\t\t\t\t\t\t\t\t\tvariationBlockStyleNodes.css =\n\t\t\t\t\t\t\t\t\t\tvariationBlockStyles.css;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! variationBlockSelector ||\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors === 'string'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvariationNodesToAdd.push( {\n\t\t\t\t\t\t\t\t\tselector: variationBlockSelector,\n\t\t\t\t\t\t\t\t\tduotoneSelector: variationDuotoneSelector,\n\t\t\t\t\t\t\t\t\tfeatureSelectors: variationFeatureSelectors,\n\t\t\t\t\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t\t?.fallbackGapValue,\n\t\t\t\t\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t\t?.hasLayoutSupport,\n\t\t\t\t\t\t\t\t\tstyles: variationBlockStyleNodes,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\t// Process element styles for the inner blocks\n\t\t\t\t\t\t\t\t// of the variation.\n\t\t\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\t\t\tvariationBlockStyles.elements ?? {}\n\t\t\t\t\t\t\t\t).forEach(\n\t\t\t\t\t\t\t\t\t( [\n\t\t\t\t\t\t\t\t\t\tvariationBlockElement,\n\t\t\t\t\t\t\t\t\t\tvariationBlockElementStyles,\n\t\t\t\t\t\t\t\t\t] ) => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tvariationBlockElementStyles &&\n\t\t\t\t\t\t\t\t\t\t\tELEMENTS[ variationBlockElement ]\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tvariationNodesToAdd.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tstyles: variationBlockElementStyles,\n\t\t\t\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tELEMENTS[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockElement\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t} );\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\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof blockSelectors !== 'string' &&\n\t\t\t\tblockSelectors?.[ blockName ]?.selector\n\t\t\t) {\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\tname: blockName,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( typedNode?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof blockSelectors !== 'string' &&\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: string ) => {\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: string ) =>\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\n\t\t\t// Add variation nodes AFTER the main block and its elements\n\t\t\t// to match PHP processing order.\n\t\t\tnodes.push( ...variationNodesToAdd );\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: string | BlockSelectors\n): any[] => {\n\tconst nodes: {\n\t\tpresets: Record< string, any >;\n\t\tcustom?: Record< string, any >;\n\t\tselector?: string;\n\t\tduotoneSelector?: string;\n\t\tfallbackGapValue?: string;\n\t\thasLayoutSupport?: boolean;\n\t\tfeatureSelectors?:\n\t\t\t| string\n\t\t\t| Record< string, string | Record< string, string > >;\n\t\tstyleVariationSelectors?: Record< string, string >;\n\t}[] = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom: any ): any => {\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_CSS_PROPERTIES_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 blockCustom = node.custom;\n\t\t\tif (\n\t\t\t\ttypeof blockSelectors === 'string' ||\n\t\t\t\t! blockSelectors[ blockName ]\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst blockPresets = pickPresets( node );\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\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ]?.featureSelectors,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\n/**\n * Resolves the selector for a given block support feature.\n *\n * If the block defines a feature-level selector (as a string or an object\n * with a `root` key), that selector is returned. Otherwise the fallback\n * selector is used.\n *\n * @param {string|Record<string,string|Record<string,string>>|undefined} featureSelectors The block's feature selectors.\n * @param {string} featureKey The feature key to resolve.\n * @param {string} fallback The default selector.\n * @return {string} The resolved selector.\n */\nfunction resolveFeatureSelector(\n\tfeatureSelectors:\n\t\t| string\n\t\t| Record< string, string | Record< string, string > >\n\t\t| undefined,\n\tfeatureKey: string,\n\tfallback: string\n): string {\n\tif ( ! featureSelectors || typeof featureSelectors === 'string' ) {\n\t\treturn fallback;\n\t}\n\n\tconst feature = featureSelectors[ featureKey ];\n\tif ( typeof feature === 'string' ) {\n\t\treturn feature;\n\t}\n\tif ( typeof feature === 'object' && feature.root ) {\n\t\treturn feature.root;\n\t}\n\treturn fallback;\n}\n\n/**\n * Collects CSS variable declarations for a single preset metadata entry\n * across all origins.\n *\n * @param {Record<string,any>} presets The preset values keyed by origin.\n * @param {GlobalStylesConfig['settings']} mergedSettings The merged global styles settings.\n * @param {PresetMetadata} presetMetadata The preset metadata.\n * @return {string[]} The CSS variable declarations.\n */\nfunction getPresetVarDeclarations(\n\tpresets: Record< string, any >,\n\tmergedSettings: GlobalStylesConfig[ 'settings' ],\n\t{ path, valueKey, valueFunc, cssVarInfix }: PresetMetadata\n): string[] {\n\tconst presetByOrigin = getValueFromObjectPath(\n\t\tpresets,\n\t\tpath,\n\t\t[]\n\t) as PresetsByOrigin;\n\n\tconst declarations: string[] = [];\n\tfor ( const origin of [ 'default', 'theme', 'custom' ] ) {\n\t\tif ( ! presetByOrigin[ origin ] ) {\n\t\t\tcontinue;\n\t\t}\n\t\tfor ( const value of presetByOrigin[ origin ] ) {\n\t\t\tconst slug = kebabCase( value.slug );\n\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ slug }: ${ value[ valueKey ] }`\n\t\t\t\t);\n\t\t\t} else if ( valueFunc && typeof valueFunc === 'function' ) {\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ slug }: ${ valueFunc(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tmergedSettings\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn declarations;\n}\n\nexport const generateCustomProperties = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: BlockSelectors\n): string => {\n\tconst nodes = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\n\tfor ( const { presets, custom, selector, featureSelectors } of nodes ) {\n\t\tconst defaultSelector = selector as string;\n\n\t\t/*\n\t\t * Group preset declarations by selector. Blocks that define\n\t\t * feature-level selectors need their preset CSS variables output\n\t\t * under that feature selector instead of the block's root selector.\n\t\t */\n\t\tconst varsBySelector: Record< string, string[] > = {\n\t\t\t[ defaultSelector ]: [],\n\t\t};\n\n\t\tif ( tree?.settings ) {\n\t\t\tfor ( const metadata of PRESET_METADATA ) {\n\t\t\t\tconst declarations = getPresetVarDeclarations(\n\t\t\t\t\tpresets,\n\t\t\t\t\ttree.settings,\n\t\t\t\t\tmetadata\n\t\t\t\t);\n\t\t\t\tif ( declarations.length === 0 ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst target = resolveFeatureSelector(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tmetadata.path[ 0 ],\n\t\t\t\t\tdefaultSelector\n\t\t\t\t);\n\t\t\t\tif ( ! varsBySelector[ target ] ) {\n\t\t\t\t\tvarsBySelector[ target ] = [];\n\t\t\t\t}\n\t\t\t\tvarsBySelector[ target ].push( ...declarations );\n\t\t\t}\n\t\t}\n\n\t\t// Custom properties always use the block's default selector.\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tvarsBySelector[ defaultSelector ].push( ...customProps );\n\t\t}\n\n\t\tfor ( const [ ruleSelector, declarations ] of Object.entries(\n\t\t\tvarsBySelector\n\t\t) ) {\n\t\t\tif ( declarations.length > 0 ) {\n\t\t\t\truleset += `${ ruleSelector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ruleset;\n};\n\nexport const transformToStyles = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: string | BlockSelectors,\n\thasBlockGapSupport?: boolean,\n\thasFallbackGapSupport?: boolean,\n\tdisableLayoutStyles: boolean = false,\n\tdisableRootPadding: boolean = false,\n\tstyleOptions: Record< string, boolean > = {}\n): string => {\n\t// These allow opting out of certain sets of styles.\n\tconst options = {\n\t\tblockGap: true,\n\t\tblockStyles: true,\n\t\tlayoutStyles: true,\n\t\tmarginReset: true,\n\t\tpresets: true,\n\t\trootPadding: true,\n\t\tvariationStyles: false,\n\t\t...styleOptions,\n\t};\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\tconst hasBodyStyles =\n\t\toptions.marginReset || options.rootPadding || options.layoutStyles;\n\n\tlet ruleset = '';\n\n\tif ( options.presets && ( contentSize || wideSize ) ) {\n\t\truleset += `${ ROOT_CSS_PROPERTIES_SELECTOR } {`;\n\t\truleset = contentSize\n\t\t\t? ruleset + ` --wp--style--global--content-size: ${ contentSize };`\n\t\t\t: ruleset;\n\t\truleset = wideSize\n\t\t\t? ruleset + ` --wp--style--global--wide-size: ${ wideSize };`\n\t\t\t: ruleset;\n\t\truleset += '}';\n\t}\n\n\tif ( hasBodyStyles ) {\n\t\t/*\n\t\t * Reset default browser margin on the body element.\n\t\t * This is set on the body selector **before** generating the ruleset\n\t\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t\t * `margin` in its `spacing` declaration for the `body` element then these\n\t\t * user-generated values take precedence in the CSS cascade.\n\t\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t\t */\n\t\truleset += ':where(body) {margin: 0;';\n\n\t\t// Root padding styles should be output for full templates, patterns and template parts.\n\t\tif ( options.rootPadding && useRootPaddingAlign ) {\n\t\t\t/*\n\t\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\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\t */\n\t\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\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\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\t.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }\n\t\t\t\t.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;\n\t\t\t\t`;\n\t\t}\n\n\t\truleset += '}';\n\t}\n\n\tif ( options.blockStyles ) {\n\t\tnodesWithStyles.forEach(\n\t\t\t( {\n\t\t\t\tselector,\n\t\t\t\tduotoneSelector,\n\t\t\t\tstyles,\n\t\t\t\tfallbackGapValue,\n\t\t\t\thasLayoutSupport,\n\t\t\t\tfeatureSelectors,\n\t\t\t\tstyleVariationSelectors,\n\t\t\t\tskipSelectorWrapper,\n\t\t\t\tname,\n\t\t\t} ) => {\n\t\t\t\t// Process styles for block support features with custom feature level\n\t\t\t\t// CSS selectors set.\n\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\tlet featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\tstyles\n\t\t\t\t\t);\n\n\t\t\t\t\t// Update text indent selector for paragraph blocks based on the textIndent setting.\n\t\t\t\t\tfeatureDeclarations = updateParagraphTextIndentSelector(\n\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\ttree.settings,\n\t\t\t\t\t\tname\n\t\t\t\t\t);\n\n\t\t\t\t\t// Update button width declarations for percentage values to use calc() with block gap.\n\t\t\t\t\tfeatureDeclarations = updateButtonWidthDeclarations(\n\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\ttree.settings\n\t\t\t\t\t);\n\n\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\t\truleset += `:root :where(${ cssSelector }){${ rules };}`;\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\n\t\t\t\t// Process duotone styles.\n\t\t\t\tif ( duotoneSelector ) {\n\t\t\t\t\tconst duotoneStyles: any = {};\n\t\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\t\tdelete styles.filter;\n\t\t\t\t\t}\n\t\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\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\n\t\t\t\t// Process blockGap and layout styles.\n\t\t\t\tif (\n\t\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t\t) {\n\t\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\t\tstyle: styles,\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\t\tfallbackGapValue,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\t\tconst styleDeclarations = getStylesDeclarations(\n\t\t\t\t\tstyles,\n\t\t\t\t\tselector,\n\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\ttree,\n\t\t\t\t\tdisableRootPadding\n\t\t\t\t);\n\t\t\t\tif ( styleDeclarations?.length ) {\n\t\t\t\t\tconst generalSelector = skipSelectorWrapper\n\t\t\t\t\t\t? selector\n\t\t\t\t\t\t: `:root :where(${ selector })`;\n\t\t\t\t\truleset += `${ generalSelector }{${ styleDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t\tif ( styles?.css ) {\n\t\t\t\t\truleset += processCSSNesting(\n\t\t\t\t\t\tstyles.css,\n\t\t\t\t\t\t`:root :where(${ selector })`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( options.variationStyles && styleVariationSelectors ) {\n\t\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\t\tif ( styleVariations ) {\n\t\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\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\t\tlet featureDeclarations =\n\t\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t// Update text indent selector for paragraph blocks based on the textIndent setting.\n\t\t\t\t\t\t\t\t\tfeatureDeclarations =\n\t\t\t\t\t\t\t\t\t\tupdateParagraphTextIndentSelector(\n\t\t\t\t\t\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\t\t\t\t\t\ttree.settings,\n\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t// Update button width declarations for percentage values to use calc() with block gap.\n\t\t\t\t\t\t\t\t\tfeatureDeclarations =\n\t\t\t\t\t\t\t\t\t\tupdateButtonWidthDeclarations(\n\t\t\t\t\t\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\t\t\t\t\t\ttree.settings\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\t\t\t\tfeatureDeclarations\n\t\t\t\t\t\t\t\t\t).forEach(\n\t\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ]: [\n\t\t\t\t\t\t\t\t\t\t\tstring,\n\t\t\t\t\t\t\t\t\t\t\tstring[],\n\t\t\t\t\t\t\t\t\t\t] ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\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\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector as string\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\t\truleset += `:root :where(${ cssSelector }){${ rules };}`;\n\t\t\t\t\t\t\t\t\t\t\t}\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\n\t\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\t\tstyleVariationSelector as string,\n\t\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\t\truleset += `:root :where(${ styleVariationSelector }){${ styleVariationDeclarations.join(\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\tif ( styleVariations?.css ) {\n\t\t\t\t\t\t\t\t\truleset += processCSSNesting(\n\t\t\t\t\t\t\t\t\t\tstyleVariations.css,\n\t\t\t\t\t\t\t\t\t\t`:root :where(${ styleVariationSelector })`\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// Generate layout styles for the variation if it supports layout and has blockGap defined.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\thasLayoutSupport &&\n\t\t\t\t\t\t\t\t\tstyleVariations?.spacing?.blockGap\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t// Append block selector to variation selector so layout classes are properly constructed.\n\t\t\t\t\t\t\t\t\tconst variationSelectorWithBlock =\n\t\t\t\t\t\t\t\t\t\tstyleVariationSelector + selector;\n\t\t\t\t\t\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\t\t\t\t\t\tstyle: styleVariations,\n\t\t\t\t\t\t\t\t\t\tselector: variationSelectorWithBlock,\n\t\t\t\t\t\t\t\t\t\thasBlockGapSupport: true,\n\t\t\t\t\t\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\t\t\t\t\t\tfallbackGapValue,\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\n\t\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t\t);\n\n\t\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// `selector` may be provided in a form\n\t\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t\t// string.\n\t\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\t// Split and append pseudo selector to create\n\t\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel: string ) => sel + pseudoKey )\n\t\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\t\t// As pseudo classes such as :hover, :focus etc. have class-level\n\t\t\t\t\t\t\t// specificity, they must use the `:root :where()` wrapper. This.\n\t\t\t\t\t\t\t// caps the specificity at `0-1-0` to allow proper nesting of variations\n\t\t\t\t\t\t\t// and block type element styles.\n\t\t\t\t\t\t\tconst pseudoRule = `:root :where(${ _selector }){${ pseudoDeclarations.join(\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\truleset += pseudoRule;\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\tif ( options.layoutStyles ) {\n\t\t/* Add alignment / layout styles */\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\t}\n\n\tif ( options.blockGap && 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`:root :where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }';\n\t}\n\n\tif ( options.presets ) {\n\t\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\t\tif (\n\t\t\t\tROOT_BLOCK_SELECTOR === selector ||\n\t\t\t\tROOT_CSS_PROPERTIES_SELECTOR === selector\n\t\t\t) {\n\t\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\t\tselector = '';\n\t\t\t}\n\n\t\t\tconst classes = getPresetsClasses( selector, presets );\n\t\t\tif ( classes.length > 0 ) {\n\t\t\t\truleset += classes;\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn ruleset;\n};\n\nexport function generateSvgFilters(\n\ttree: GlobalStylesConfig,\n\tblockSelectors: BlockSelectors\n): string[] {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType: BlockType, rootSelector: string ) => {\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: Record< string, string > = {\n\t\troot: rootSelector,\n\t};\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockSelector( blockType, featureKey );\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 = (\n\tblockTypes: BlockType[],\n\tvariationInstanceId?: string\n) => {\n\tconst { getBlockStyles } = select( blocksStore );\n\tconst result: BlockSelectors = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockSelector( blockType );\n\n\t\tif ( ! selector ) {\n\t\t\treturn; // Skip blocks without valid selectors\n\t\t}\n\t\tlet duotoneSelector = getBlockSelector( blockType, 'filter.duotone' );\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockSelector( 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 &&\n\t\t\t\trootSelector &&\n\t\t\t\tscopeSelector( 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\t// @ts-expect-error\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors: Record< string, string > = {};\n\t\tblockStyleVariations?.forEach( ( variation: BlockStyleVariation ) => {\n\t\t\tconst variationSuffix = variationInstanceId\n\t\t\t\t? `-${ variationInstanceId }`\n\t\t\t\t: '';\n\t\t\tconst variationName = `${ variation.name }${ variationSuffix }`;\n\t\t\tconst styleVariationSelector = getBlockStyleVariationSelector(\n\t\t\t\tvariationName,\n\t\t\t\tselector\n\t\t\t);\n\n\t\t\tstyleVariationSelectors[ variationName ] = styleVariationSelector;\n\t\t} );\n\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: duotoneSelector ?? undefined,\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: blockStyleVariations?.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 config Theme.json configuration file object\n * @return Theme.json configuration file object updated\n */\nfunction updateConfigWithSeparator(\n\tconfig: GlobalStylesConfig\n): GlobalStylesConfig {\n\tconst blocks = config.styles?.blocks;\n\tconst separatorBlock = blocks?.[ 'core/separator' ];\n\tconst needsSeparatorStyleUpdate =\n\t\tseparatorBlock &&\n\t\tseparatorBlock.color?.background &&\n\t\t! separatorBlock.color?.text &&\n\t\t! separatorBlock.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...blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...separatorBlock,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...separatorBlock.color,\n\t\t\t\t\t\t\ttext: separatorBlock.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: string, blockSelector: string ) {\n\tlet processedCSS = '';\n\n\tif ( ! css || css.trim() === '' ) {\n\t\treturn processedCSS;\n\t}\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part: string ) => {\n\t\tif ( ! part || part.trim() === '' ) {\n\t\t\treturn;\n\t\t}\n\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 += `:root :where(${ 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 splitPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splitPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splitPart;\n\n\t\t\t// Handle pseudo elements such as ::before, ::after, etc. Regex will also\n\t\t\t// capture any leading combinator such as >, +, or ~, as well as spaces.\n\t\t\t// This allows pseudo elements as descendants e.g. `.parent ::before`.\n\t\t\tconst matches = nestedSelector.match( /([>+~\\s]*::[a-zA-Z-]+)/ );\n\t\t\tconst pseudoPart = matches ? matches[ 1 ] : '';\n\t\t\tconst withoutPseudoElement = matches\n\t\t\t\t? nestedSelector.replace( pseudoPart, '' ).trim()\n\t\t\t\t: nestedSelector.trim();\n\n\t\t\tlet combinedSelector;\n\t\t\tif ( withoutPseudoElement === '' ) {\n\t\t\t\t// Only contained a pseudo element to use the block selector to form\n\t\t\t\t// the final `:root :where()` selector.\n\t\t\t\tcombinedSelector = blockSelector;\n\t\t\t} else {\n\t\t\t\t// If the nested selector is a descendant of the block scope it with the\n\t\t\t\t// block selector. Otherwise append it to the block selector.\n\t\t\t\tcombinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t\t? scopeSelector( blockSelector, withoutPseudoElement )\n\t\t\t\t\t: appendToSelector( blockSelector, withoutPseudoElement );\n\t\t\t}\n\n\t\t\t// Build final rule, re-adding any pseudo element outside the `:where()`\n\t\t\t// to maintain valid CSS selector.\n\t\t\tprocessedCSS += `:root :where(${ combinedSelector })${ pseudoPart }{${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\nexport interface GlobalStylesRenderOptions {\n\thasBlockGapSupport?: boolean;\n\thasFallbackGapSupport?: boolean;\n\tdisableLayoutStyles?: boolean;\n\tdisableRootPadding?: boolean;\n\tgetBlockStyles?: ( blockName: string ) => any[];\n\tstyleOptions?: Record< string, boolean >;\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 * @param config Global styles configuration\n * @param blockTypes Array of block types from WordPress blocks store\n * @param options Options for rendering global styles\n * @return Array of stylesheets and settings\n */\nexport function generateGlobalStyles(\n\tconfig: GlobalStylesConfig | undefined = {},\n\tblockTypes: any[] = [],\n\toptions: GlobalStylesRenderOptions = {}\n): [ any[], any ] {\n\tconst {\n\t\thasBlockGapSupport: hasBlockGapSupportOption,\n\t\thasFallbackGapSupport: hasFallbackGapSupportOption,\n\t\tdisableLayoutStyles = false,\n\t\tdisableRootPadding = false,\n\t\tstyleOptions = {},\n\t} = options;\n\n\t// Use provided block types or fall back to getBlockTypes()\n\tconst blocks = blockTypes.length > 0 ? blockTypes : getBlockTypes();\n\n\tconst blockGap = getSetting( config, 'spacing.blockGap' );\n\tconst hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null;\n\tconst hasFallbackGapSupport =\n\t\thasFallbackGapSupportOption ?? ! hasBlockGapSupport;\n\n\tif ( ! config?.styles || ! config?.settings ) {\n\t\treturn [ [], {} ];\n\t}\n\tconst updatedConfig = updateConfigWithSeparator( config );\n\tconst blockSelectors = getBlockSelectors( blocks );\n\tconst customProperties = generateCustomProperties(\n\t\tupdatedConfig,\n\t\tblockSelectors\n\t);\n\tconst globalStyles = transformToStyles(\n\t\tupdatedConfig,\n\t\tblockSelectors,\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tdisableLayoutStyles,\n\t\tdisableRootPadding,\n\t\tstyleOptions\n\t);\n\tconst svgs = generateSvgFilters( updatedConfig, blockSelectors );\n\tconst styles = [\n\t\t{\n\t\t\tcss: customProperties,\n\t\t\tisGlobalStyles: true,\n\t\t},\n\t\t{\n\t\t\tcss: globalStyles,\n\t\t\tisGlobalStyles: true,\n\t\t},\n\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{\n\t\t\tcss: updatedConfig?.styles?.css ?? '',\n\t\t\tisGlobalStyles: true,\n\t\t},\n\t\t{\n\t\t\tassets: svgs,\n\t\t\t__unstableType: 'svg',\n\t\t\tisGlobalStyles: true,\n\t\t},\n\t];\n\n\t// Loop through the blocks to check if there are custom CSS values.\n\t// If there are, get the block selector and push the selector together with\n\t// the CSS value to the 'stylesheets' array.\n\tblocks.forEach( ( blockType: BlockType ) => {\n\t\tconst blockStyles = updatedConfig?.styles?.blocks?.[ blockType.name ];\n\t\tif ( blockStyles?.css ) {\n\t\t\tconst { featureSelectors } = blockSelectors[ blockType.name ];\n\t\t\tconst cssFeatureSelector =\n\t\t\t\ttypeof featureSelectors === 'object'\n\t\t\t\t\t? featureSelectors?.css\n\t\t\t\t\t: undefined;\n\t\t\tlet resolvedCssSelector: string | undefined;\n\t\t\tif ( typeof cssFeatureSelector === 'string' ) {\n\t\t\t\tresolvedCssSelector = cssFeatureSelector;\n\t\t\t} else if ( typeof cssFeatureSelector === 'object' ) {\n\t\t\t\tresolvedCssSelector = (\n\t\t\t\t\tcssFeatureSelector as Record< string, string >\n\t\t\t\t )?.root;\n\t\t\t}\n\t\t\tconst selector =\n\t\t\t\tresolvedCssSelector ??\n\t\t\t\tblockSelectors[ blockType.name ].selector;\n\t\t\tstyles.push( {\n\t\t\t\tcss: processCSSNesting( blockStyles.css, selector ),\n\t\t\t\tisGlobalStyles: true,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn [ styles, updatedConfig.settings ];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAOO;AACP,0BAAqD;AACrD,kBAAuB;AAKvB,oBASO;AACP,uBAAiC;AACjC,wBAA2C;AAC3C,qBAAiC;AACjC,oBAA0B;AAC1B,iBAA+B;AAC/B,wBAA2C;AAC3C,oBAAmC;AACnC,oBAAqD;AACrD,yBAA2B;AA+G3B,IAAM,sBAAsB;AAAA,EAC3B,QAAQ;AAAA,EACR,SAAS;AACV;AAIA,IAAM,wCAAwC;AAAA,EAC7C,sBAAsB;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,YAAY;AACb;AASA,SAAS,kBACR,gBAAwB,KACxB,eAAsC,CAAC,GAC9B;AACT,SAAO,8BAAgB;AAAA,IACtB,CACC,cACA,EAAE,MAAM,aAAa,QAAQ,MACzB;AACJ,UAAK,CAAE,SAAU;AAChB,eAAO;AAAA,MACR;AAEA,YAAM,qBAAiB;AAAA,QACtB;AAAA,QACA;AAAA,QACA,CAAC;AAAA,MACF;AACA,OAAE,WAAW,SAAS,QAAS,EAAE,QAAS,CAAE,WAAY;AACvD,YAAK,eAAgB,MAAO,GAAI;AAC/B,yBAAgB,MAAO,EAAE;AAAA,YACxB,CAAE,EAAE,KAAK,MAAyB;AACjC,sBAAS;AAAA,gBACR,CAAE;AAAA,kBACD;AAAA,kBACA;AAAA,gBACD,MAAuB;AACtB,wBAAM,qBAAqB,YAAS;AAAA,oBACnC;AAAA,kBACD,CAAE,IAAK,WAAY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,YAAM,EAAE,iBAAiB,IAAI,eAAgB,UAAU,IAAK;AAC5D,YAAM,qBACL,OAAO,qBAAqB,WACzB,kBAAkB,MAClB;AACJ,UAAI;AACJ,UAAK,OAAO,uBAAuB,UAAW;AAC7C,8BAAsB;AAAA,MACvB,WAAY,OAAO,uBAAuB,UAAW;AACpD,8BACC,oBACG;AAAA,MACL;AACA,YAAM,WACL,uBACA,eAAgB,UAAU,IAAK,EAAE;AAClC,aAAO,KAAM;AAAA,QACZ,KAAK,kBAAmB,YAAY,KAAK,QAAS;AAAA,QAClD,gBAAgB;AAAA,MACjB,CAAE;AAAA,IACH;AAAA,EACD,CAAE;AAEF,SAAO,CAAE,QAAQ,cAAc,QAAS;AACzC;",
4
+ "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 type { BlockType } from '@wordpress/blocks';\nimport { getCSSRules, getCSSValueFromRawStyle } from '@wordpress/style-engine';\nimport { select } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tROOT_CSS_PROPERTIES_SELECTOR,\n\tscopeSelector,\n\tscopeFeatureSelectors,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n\tgetResolvedValue,\n} from '../utils/common';\nimport { getBlockSelector } from './selectors';\nimport { getTypographyFontSizeValue } from '../utils/typography';\nimport { getDuotoneFilter } from '../utils/duotone';\nimport { kebabCase } from '../utils/string';\nimport { getGapCSSValue } from '../utils/gap';\nimport { setBackgroundStyleDefaults } from '../utils/background';\nimport { LAYOUT_DEFINITIONS } from '../utils/layout';\nimport { getValueFromObjectPath, setImmutably } from '../utils/object';\nimport { getSetting } from '../settings/get-setting';\nimport type { GlobalStylesConfig, GlobalStylesStyles } from '../types';\n\n// =============================================================================\n// LOCAL TYPE DEFINITIONS\n// =============================================================================\n\n/**\n * Preset metadata for CSS variable generation\n */\ninterface PresetMetadata {\n\tpath: string[];\n\tvalueKey?: string;\n\tvalueFunc?: ( preset: any, settings: any ) => string | number | null;\n\tcssVarInfix: string;\n\tclasses?: Array< {\n\t\tclassSuffix: string;\n\t\tpropertyName: string;\n\t} >;\n}\n\n/**\n * Preset collection by origin\n */\ninterface PresetsByOrigin {\n\t[ origin: string ]: any[];\n}\n\n/**\n * CSS class configuration\n */\ninterface CSSClassConfig {\n\tclassSuffix: string;\n\tpropertyName: string;\n}\n\n/**\n * Style property configuration from WordPress\n */\ninterface StylePropertyConfig {\n\tvalue: string[];\n\tproperties?: Record< string, string >;\n\tuseEngine?: boolean;\n\trootOnly?: boolean;\n}\n\n/**\n * Layout definition structure\n */\ninterface LayoutDefinition {\n\tclassName: string;\n\tname: string;\n\tdisplayMode?: string;\n\tspacingStyles?: Array< {\n\t\tselector?: string;\n\t\trules?: Record< string, any >;\n\t} >;\n\tbaseStyles?: Array< {\n\t\tselector?: string;\n\t\trules?: Record< string, any >;\n\t} >;\n}\n\n/**\n * CSS rule from style engine\n */\ninterface CSSRule {\n\tkey: string;\n\tvalue: any;\n}\n\n/**\n * Block variation in theme.json (different from BlockStyleVariation)\n */\ninterface BlockVariation {\n\tcss?: string;\n\telements?: Record< string, any >;\n\tblocks?: Record< string, any >;\n\t[ key: string ]: any; // For additional style properties\n}\n\n/**\n * Block node in theme.json\n */\ninterface BlockNode {\n\tvariations?: Record< string, BlockVariation >;\n\telements?: Record< string, any >;\n\t[ key: string ]: any; // For additional style properties\n}\n\nexport type BlockSelectors = Record<\n\tstring,\n\t{\n\t\tduotoneSelector?: string;\n\t\tselector: string;\n\t\tfallbackGapValue?: string;\n\t\thasLayoutSupport?: boolean;\n\t\tfeatureSelectors?:\n\t\t\t| string\n\t\t\t| Record< string, string | Record< string, string > >;\n\t\tname?: string;\n\t\tstyleVariationSelectors?: Record< string, string >;\n\t}\n>;\n\ntype ElementName = keyof typeof ELEMENTS;\n\n// Elements that rely on class names in their selectors.\nconst ELEMENT_CLASS_NAMES = {\n\tbutton: 'wp-element-button',\n\tcaption: 'wp-element-caption',\n};\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\tdimensions: 'dimensions',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param blockSelector Block selector string\n * @param blockPresets Block presets object\n * @return CSS declarations for the preset classes\n */\nfunction getPresetsClasses(\n\tblockSelector: string = '*',\n\tblockPresets: Record< string, any > = {}\n): string {\n\treturn PRESET_METADATA.reduce(\n\t\t(\n\t\t\tdeclarations: string,\n\t\t\t{ path, cssVarInfix, classes }: PresetMetadata\n\t\t) => {\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) as PresetsByOrigin;\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach(\n\t\t\t\t\t\t( { slug }: { slug: string } ) => {\n\t\t\t\t\t\t\tclasses!.forEach(\n\t\t\t\t\t\t\t\t( {\n\t\t\t\t\t\t\t\t\tclassSuffix,\n\t\t\t\t\t\t\t\t\tpropertyName,\n\t\t\t\t\t\t\t\t}: CSSClassConfig ) => {\n\t\t\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\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\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters(\n\tblockPresets: Record< string, any > = {}\n): string[] {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata: PresetMetadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata: PresetMetadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t) as PresetsByOrigin;\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: any ) =>\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(\n\tinput: any = {},\n\tprefix: string,\n\ttoken: string\n): string[] {\n\tlet result: string[] = [];\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 featureSelector The feature selector\n * @param styleVariationSelector The style variation selector\n * @return Combined selector string\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector: string,\n\tstyleVariationSelector: string\n): string {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors: string[] = [];\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 * Updates the text indent selector for paragraph blocks based on the textIndent setting.\n *\n * The textIndent setting can be 'subsequent' (default), 'all', or false.\n * When set to 'all', the selector should be '.wp-block-paragraph' instead of\n * '.wp-block-paragraph + .wp-block-paragraph' to apply indent to all paragraphs.\n *\n * @param featureDeclarations The feature declarations keyed by selector\n * @param settings Theme.json settings\n * @param blockName The name of the block being processed\n * @return Updated feature declarations\n */\nconst updateParagraphTextIndentSelector = (\n\tfeatureDeclarations: Record< string, string[] >,\n\tsettings: Record< string, any > | undefined,\n\tblockName: string | undefined\n): Record< string, string[] > => {\n\tif ( blockName !== 'core/paragraph' ) {\n\t\treturn featureDeclarations;\n\t}\n\n\t// Check block-level settings first, then fall back to global settings.\n\tconst blockSettings = settings?.blocks?.[ 'core/paragraph' ];\n\tconst textIndentSetting =\n\t\tblockSettings?.typography?.textIndent ??\n\t\tsettings?.typography?.textIndent ??\n\t\t'subsequent';\n\n\tif ( textIndentSetting !== 'all' ) {\n\t\treturn featureDeclarations;\n\t}\n\n\t// Look for the text indent selector and replace it.\n\tconst oldSelector = '.wp-block-paragraph + .wp-block-paragraph';\n\tconst newSelector = '.wp-block-paragraph';\n\n\tif ( oldSelector in featureDeclarations ) {\n\t\tconst declarations = featureDeclarations[ oldSelector ];\n\t\tconst updated = { ...featureDeclarations };\n\t\tdelete updated[ oldSelector ];\n\t\tupdated[ newSelector ] = declarations;\n\t\treturn updated;\n\t}\n\n\treturn featureDeclarations;\n};\n\n/**\n * Updates button width declarations to use a calc() formula for percentage values.\n *\n * When a percentage width is set on the Button block via Global Styles, the\n * resulting CSS needs to account for block gap spacing so that buttons tile\n * correctly on a row (e.g. 4 buttons at 25% width all fit on one row).\n *\n * This mirrors the dynamic calc() formula applied at the block instance level\n * in the button block's stylesheet (style.scss).\n *\n * @param featureDeclarations Feature declarations keyed by selector.\n * @param settings The theme.json settings.\n * @return Updated feature declarations.\n */\nconst updateButtonWidthDeclarations = (\n\tfeatureDeclarations: Record< string, string[] >,\n\tsettings: Record< string, any > | undefined\n): Record< string, string[] > => {\n\tconst buttonSelector = '.wp-block-button';\n\tif ( ! ( buttonSelector in featureDeclarations ) ) {\n\t\treturn featureDeclarations;\n\t}\n\n\tconst updated = { ...featureDeclarations };\n\tupdated[ buttonSelector ] = updated[ buttonSelector ].map(\n\t\t( declaration ) => {\n\t\t\t// Match \"width: <value>\" declarations.\n\t\t\tconst match = declaration.match( /^width:\\s*(.+)$/ );\n\t\t\tif ( ! match ) {\n\t\t\t\treturn declaration;\n\t\t\t}\n\n\t\t\tconst value = match[ 1 ];\n\t\t\tlet percentage: number | null = null;\n\n\t\t\t// Case 1: Direct percentage value e.g. \"25%\".\n\t\t\tif ( value.endsWith( '%' ) ) {\n\t\t\t\tpercentage = parseFloat( value );\n\t\t\t}\n\n\t\t\t// Case 2: Preset CSS var e.g. \"var(--wp--preset--dimension--50)\".\n\t\t\tconst presetPrefix = 'var(--wp--preset--dimension--';\n\t\t\tif (\n\t\t\t\tpercentage === null &&\n\t\t\t\tvalue.startsWith( presetPrefix ) &&\n\t\t\t\tvalue.endsWith( ')' )\n\t\t\t) {\n\t\t\t\tconst slug = value.slice( presetPrefix.length, -1 );\n\n\t\t\t\t/*\n\t\t\t\t * Look up the preset size across all origins.\n\t\t\t\t * Check block-level settings first (core/button), then top-level settings.\n\t\t\t\t * Spread block-level entries first so they take precedence.\n\t\t\t\t */\n\t\t\t\tconst dimensionSizes = {\n\t\t\t\t\t...( settings?.dimensions?.dimensionSizes ?? {} ),\n\t\t\t\t\t...( settings?.blocks?.[ 'core/button' ]?.dimensions\n\t\t\t\t\t\t?.dimensionSizes ?? {} ),\n\t\t\t\t};\n\t\t\t\tfor ( const origin of Object.values( dimensionSizes ) ) {\n\t\t\t\t\tif ( ! Array.isArray( origin ) ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tfor ( const preset of origin ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tpreset.slug === slug &&\n\t\t\t\t\t\t\ttypeof preset.size === 'string' &&\n\t\t\t\t\t\t\tpreset.size.endsWith( '%' )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tpercentage = parseFloat( preset.size );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( percentage !== null ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( percentage === null || isNaN( percentage ) ) {\n\t\t\t\treturn declaration;\n\t\t\t}\n\n\t\t\t/*\n\t\t\t * Apply the same calc() formula as the block instance level (style.scss).\n\t\t\t * The numeric percentage value is used as a unitless number:\n\t\t\t * - Multiplied by 1% to get the percentage width.\n\t\t\t * - Divided by 100 to calculate the gap adjustment proportion.\n\t\t\t */\n\t\t\treturn `width: calc(${ percentage } * 1% - (var(--wp--style--block-gap, 0.5em) * (1 - ${ percentage } / 100)))`;\n\t\t}\n\t);\n\n\treturn updated;\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 selectors Custom selectors object for a block\n * @param styles A block's styles object\n * @return Style declarations\n */\nconst getFeatureDeclarations = (\n\tselectors: Record< string, any >,\n\tstyles: Record< string, any >\n): Record< string, string[] > => {\n\tconst declarations: Record< string, string[] > = {};\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 (\n\t\t\t! isShorthand &&\n\t\t\ttypeof selector === 'object' &&\n\t\t\tselector !== null\n\t\t) {\n\t\t\tObject.entries( selector as Record< string, string > ).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 (\n\t\t\tisShorthand ||\n\t\t\t( typeof selector === 'object' &&\n\t\t\t\tselector !== null &&\n\t\t\t\t'root' in selector )\n\t\t) {\n\t\t\tconst featureSelector = isShorthand\n\t\t\t\t? ( selector as string )\n\t\t\t\t: ( selector as any ).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 blockStyles Block styles\n * @param selector The selector these declarations should attach to\n * @param useRootPaddingAlign Whether to use CSS custom properties in root selector\n * @param tree A theme.json tree containing layout definitions\n * @param disableRootPadding Whether to force disable the root padding styles\n * @return An array of style declarations\n */\nexport function getStylesDeclarations(\n\tblockStyles: any = {},\n\tselector: string = '',\n\tuseRootPaddingAlign?: boolean,\n\ttree: any = {},\n\tdisableRootPadding: boolean = false\n): string[] {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries(\n\t\tSTYLE_PROPERTY as Record< string, StylePropertyConfig >\n\t).reduce(\n\t\t(\n\t\t\tdeclarations: string[],\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]: [\n\t\t\t\tstring,\n\t\t\t\tStylePropertyConfig,\n\t\t\t]\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 }: ${ getCSSValueFromRawStyle(\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 }: ${ getCSSValueFromRawStyle(\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[] as string[]\n\t);\n\n\t/*\n\t * Preprocess background image values.\n\t *\n\t * Note: As we absorb more and more styles into the engine, we could simplify this function.\n\t * A refactor is for the style engine to handle ref resolution (and possibly defaults)\n\t * via a public util used internally and externally. Theme.json tree and defaults could be passed\n\t * as options.\n\t */\n\tif ( !! blockStyles.background ) {\n\t\t/*\n\t\t * Resolve dynamic values before they are compiled by the style engine,\n\t\t * which doesn't (yet) resolve dynamic values.\n\t\t */\n\t\tif ( blockStyles.background?.backgroundImage ) {\n\t\t\tblockStyles.background.backgroundImage = getResolvedValue(\n\t\t\t\tblockStyles.background.backgroundImage,\n\t\t\t\ttree\n\t\t\t);\n\t\t}\n\n\t\t/*\n\t\t * Set default values for block background styles.\n\t\t * Top-level styles are an exception as they are applied to the body.\n\t\t */\n\t\tif ( ! isRoot && !! blockStyles.background?.backgroundImage?.id ) {\n\t\t\tblockStyles = {\n\t\t\t\t...blockStyles,\n\t\t\t\tbackground: {\n\t\t\t\t\t...blockStyles.background,\n\t\t\t\t\t...setBackgroundStyleDefaults( blockStyles.background ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule: CSSRule ) => {\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 || disableRootPadding ) &&\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 = getResolvedValue( rule.value, tree );\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{ name: '', slug: '', size: ruleValue as string },\n\t\t\t\ttree?.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 props Layout styles configuration\n * @param props.layoutDefinitions Layout definitions from theme.json\n * @param props.style Style object for the block\n * @param props.selector Selector to apply the styles to\n * @param props.hasBlockGapSupport Whether the block supports block gap styles\n * @param props.hasFallbackGapSupport Whether the block supports fallback gap styles\n * @param props.fallbackGapValue Fallback gap value to use if block gap support is\n *\n * @return 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\tlayoutDefinitions?: Record< string, LayoutDefinition >;\n\tstyle?: GlobalStylesStyles;\n\tselector?: string;\n\thasBlockGapSupport?: boolean;\n\thasFallbackGapSupport?: boolean;\n\tfallbackGapValue?: string;\n} ): string {\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: any ) => {\n\t\t\t\t\t\tconst declarations: string[] = [];\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? `:root :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: `:root :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}\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 += `${ ROOT_CSS_PROPERTIES_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 }: LayoutDefinition ) => {\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: any ) => {\n\t\t\t\t\t\tconst declarations: string[] = [];\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 = `.${ 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\t'background',\n];\n\nfunction pickStyleKeys( treeToPickFrom: any ): any {\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 = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: string | BlockSelectors\n): any[] => {\n\tconst nodes: {\n\t\tstyles: Partial< Omit< GlobalStylesStyles, 'elements' | 'blocks' > >;\n\t\tselector: string;\n\t\tskipSelectorWrapper?: boolean;\n\t\tduotoneSelector?: string;\n\t\tfeatureSelectors?:\n\t\t\t| string\n\t\t\t| Record< string, string | Record< string, string > >;\n\t\tfallbackGapValue?: string;\n\t\thasLayoutSupport?: boolean;\n\t\tstyleVariationSelectors?: Record< string, string >;\n\t\tname?: string;\n\t}[] = [];\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\t// Root selector (body) styles should not be wrapped in `:root where()` to keep\n\t\t\t// specificity at (0,0,1) and maintain backwards compatibility.\n\t\t\tskipSelectorWrapper: true,\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: selector as string,\n\t\t\t\t// Top level elements that don't use a class name should not receive the\n\t\t\t\t// `:root :where()` wrapper to maintain backwards compatibility.\n\t\t\t\tskipSelectorWrapper: ! (\n\t\t\t\t\tELEMENT_CLASS_NAMES as Record< string, string >\n\t\t\t\t )[ name ],\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\t\t\tconst typedNode = node as BlockNode;\n\n\t\t\t// Store variation data for later processing, but don't add to nodes yet.\n\t\t\t// Variations should be processed AFTER the main block styles to match PHP order.\n\t\t\tconst variationNodesToAdd: typeof nodes = [];\n\n\t\t\tif ( typedNode?.variations ) {\n\t\t\t\tconst variations: Record< string, any > = {};\n\t\t\t\tObject.entries( typedNode.variations ).forEach(\n\t\t\t\t\t( [ variationName, variation ] ) => {\n\t\t\t\t\t\tconst typedVariation = variation as BlockVariation;\n\t\t\t\t\t\tvariations[ variationName ] =\n\t\t\t\t\t\t\tpickStyleKeys( typedVariation );\n\t\t\t\t\t\tif ( typedVariation?.css ) {\n\t\t\t\t\t\t\tvariations[ variationName ].css =\n\t\t\t\t\t\t\t\ttypedVariation.css;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst variationSelector =\n\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t? blockSelectors[ blockName ]\n\t\t\t\t\t\t\t\t\t\t?.styleVariationSelectors?.[\n\t\t\t\t\t\t\t\t\t\tvariationName\n\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t// Process the variation's inner element styles.\n\t\t\t\t\t\t// This comes before the inner block styles so the\n\t\t\t\t\t\t// element styles within the block type styles take\n\t\t\t\t\t\t// precedence over these.\n\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\ttypedVariation?.elements ?? {}\n\t\t\t\t\t\t).forEach( ( [ element, elementStyles ] ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\telementStyles &&\n\t\t\t\t\t\t\t\tELEMENTS[ element as ElementName ]\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tvariationNodesToAdd.push( {\n\t\t\t\t\t\t\t\t\tstyles: elementStyles,\n\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ element as ElementName ]\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\t// Process the variations inner block type styles.\n\t\t\t\t\t\tObject.entries( typedVariation?.blocks ?? {} ).forEach(\n\t\t\t\t\t\t\t( [\n\t\t\t\t\t\t\t\tvariationBlockName,\n\t\t\t\t\t\t\t\tvariationBlockStyles,\n\t\t\t\t\t\t\t] ) => {\n\t\t\t\t\t\t\t\tconst variationBlockSelector =\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t\t\t? scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\t\tblockSelectors[\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockName\n\t\t\t\t\t\t\t\t\t\t\t\t]?.selector\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst variationDuotoneSelector =\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t\t\t? scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\t\tblockSelectors[\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockName\n\t\t\t\t\t\t\t\t\t\t\t\t]?.duotoneSelector as string\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\tconst variationFeatureSelectors =\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors !== 'string'\n\t\t\t\t\t\t\t\t\t\t? scopeFeatureSelectors(\n\t\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\t\tblockSelectors[\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockName\n\t\t\t\t\t\t\t\t\t\t\t\t]?.featureSelectors ?? {}\n\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\t\t\t\tconst variationBlockStyleNodes =\n\t\t\t\t\t\t\t\t\tpickStyleKeys( variationBlockStyles );\n\n\t\t\t\t\t\t\t\tif ( variationBlockStyles?.css ) {\n\t\t\t\t\t\t\t\t\tvariationBlockStyleNodes.css =\n\t\t\t\t\t\t\t\t\t\tvariationBlockStyles.css;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! variationBlockSelector ||\n\t\t\t\t\t\t\t\t\ttypeof blockSelectors === 'string'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvariationNodesToAdd.push( {\n\t\t\t\t\t\t\t\t\tselector: variationBlockSelector,\n\t\t\t\t\t\t\t\t\tduotoneSelector: variationDuotoneSelector,\n\t\t\t\t\t\t\t\t\tfeatureSelectors: variationFeatureSelectors,\n\t\t\t\t\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t\t?.fallbackGapValue,\n\t\t\t\t\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t\t?.hasLayoutSupport,\n\t\t\t\t\t\t\t\t\tstyles: variationBlockStyleNodes,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\t// Process element styles for the inner blocks\n\t\t\t\t\t\t\t\t// of the variation.\n\t\t\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\t\t\tvariationBlockStyles.elements ?? {}\n\t\t\t\t\t\t\t\t).forEach(\n\t\t\t\t\t\t\t\t\t( [\n\t\t\t\t\t\t\t\t\t\tvariationBlockElement,\n\t\t\t\t\t\t\t\t\t\tvariationBlockElementStyles,\n\t\t\t\t\t\t\t\t\t] ) => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\tvariationBlockElementStyles &&\n\t\t\t\t\t\t\t\t\t\t\tELEMENTS[\n\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockElement as ElementName\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tvariationNodesToAdd.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tstyles: variationBlockElementStyles,\n\t\t\t\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\tELEMENTS[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariationBlockElement as ElementName\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t} );\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\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tblockStyles.variations = variations;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\ttypeof blockSelectors !== 'string' &&\n\t\t\t\tblockSelectors?.[ blockName ]?.selector\n\t\t\t) {\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\tname: blockName,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( typedNode?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof blockSelectors !== 'string' &&\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName as 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: string ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[\n\t\t\t\t\t\t\t\t\t\t\telementName as ElementName\n\t\t\t\t\t\t\t\t\t\t].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: string ) =>\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\n\t\t\t// Add variation nodes AFTER the main block and its elements\n\t\t\t// to match PHP processing order.\n\t\t\tnodes.push( ...variationNodesToAdd );\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: string | BlockSelectors\n): any[] => {\n\tconst nodes: {\n\t\tpresets: Record< string, any >;\n\t\tcustom?: Record< string, any >;\n\t\tselector?: string;\n\t\tduotoneSelector?: string;\n\t\tfallbackGapValue?: string;\n\t\thasLayoutSupport?: boolean;\n\t\tfeatureSelectors?:\n\t\t\t| string\n\t\t\t| Record< string, string | Record< string, string > >;\n\t\tstyleVariationSelectors?: Record< string, string >;\n\t}[] = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom: any ): any => {\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_CSS_PROPERTIES_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 blockCustom = node.custom;\n\t\t\tif (\n\t\t\t\ttypeof blockSelectors === 'string' ||\n\t\t\t\t! blockSelectors[ blockName ]\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst blockPresets = pickPresets( node );\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\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ]?.featureSelectors,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\n/**\n * Resolves the selector for a given block support feature.\n *\n * If the block defines a feature-level selector (as a string or an object\n * with a `root` key), that selector is returned. Otherwise the fallback\n * selector is used.\n *\n * @param {string|Record<string,string|Record<string,string>>|undefined} featureSelectors The block's feature selectors.\n * @param {string} featureKey The feature key to resolve.\n * @param {string} fallback The default selector.\n * @return {string} The resolved selector.\n */\nfunction resolveFeatureSelector(\n\tfeatureSelectors:\n\t\t| string\n\t\t| Record< string, string | Record< string, string > >\n\t\t| undefined,\n\tfeatureKey: string,\n\tfallback: string\n): string {\n\tif ( ! featureSelectors || typeof featureSelectors === 'string' ) {\n\t\treturn fallback;\n\t}\n\n\tconst feature = featureSelectors[ featureKey ];\n\tif ( typeof feature === 'string' ) {\n\t\treturn feature;\n\t}\n\tif ( typeof feature === 'object' && feature.root ) {\n\t\treturn feature.root;\n\t}\n\treturn fallback;\n}\n\n/**\n * Collects CSS variable declarations for a single preset metadata entry\n * across all origins.\n *\n * @param {Record<string,any>} presets The preset values keyed by origin.\n * @param {GlobalStylesConfig['settings']} mergedSettings The merged global styles settings.\n * @param {PresetMetadata} presetMetadata The preset metadata.\n * @return {string[]} The CSS variable declarations.\n */\nfunction getPresetVarDeclarations(\n\tpresets: Record< string, any >,\n\tmergedSettings: GlobalStylesConfig[ 'settings' ],\n\t{ path, valueKey, valueFunc, cssVarInfix }: PresetMetadata\n): string[] {\n\tconst presetByOrigin = getValueFromObjectPath(\n\t\tpresets,\n\t\tpath,\n\t\t[]\n\t) as PresetsByOrigin;\n\n\tconst declarations: string[] = [];\n\tfor ( const origin of [ 'default', 'theme', 'custom' ] ) {\n\t\tif ( ! presetByOrigin[ origin ] ) {\n\t\t\tcontinue;\n\t\t}\n\t\tfor ( const value of presetByOrigin[ origin ] ) {\n\t\t\tconst slug = kebabCase( value.slug );\n\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ slug }: ${ value[ valueKey ] }`\n\t\t\t\t);\n\t\t\t} else if ( valueFunc && typeof valueFunc === 'function' ) {\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ slug }: ${ valueFunc(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tmergedSettings\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn declarations;\n}\n\nexport const generateCustomProperties = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: BlockSelectors\n): string => {\n\tconst nodes = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\n\tfor ( const { presets, custom, selector, featureSelectors } of nodes ) {\n\t\tconst defaultSelector = selector as string;\n\n\t\t/*\n\t\t * Group preset declarations by selector. Blocks that define\n\t\t * feature-level selectors need their preset CSS variables output\n\t\t * under that feature selector instead of the block's root selector.\n\t\t */\n\t\tconst varsBySelector: Record< string, string[] > = {\n\t\t\t[ defaultSelector ]: [],\n\t\t};\n\n\t\tif ( tree?.settings ) {\n\t\t\tfor ( const metadata of PRESET_METADATA ) {\n\t\t\t\tconst declarations = getPresetVarDeclarations(\n\t\t\t\t\tpresets,\n\t\t\t\t\ttree.settings,\n\t\t\t\t\tmetadata\n\t\t\t\t);\n\t\t\t\tif ( declarations.length === 0 ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst target = resolveFeatureSelector(\n\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\tmetadata.path[ 0 ],\n\t\t\t\t\tdefaultSelector\n\t\t\t\t);\n\t\t\t\tif ( ! varsBySelector[ target ] ) {\n\t\t\t\t\tvarsBySelector[ target ] = [];\n\t\t\t\t}\n\t\t\t\tvarsBySelector[ target ].push( ...declarations );\n\t\t\t}\n\t\t}\n\n\t\t// Custom properties always use the block's default selector.\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tvarsBySelector[ defaultSelector ].push( ...customProps );\n\t\t}\n\n\t\tfor ( const [ ruleSelector, declarations ] of Object.entries(\n\t\t\tvarsBySelector\n\t\t) ) {\n\t\t\tif ( declarations.length > 0 ) {\n\t\t\t\truleset += `${ ruleSelector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ruleset;\n};\n\nexport const transformToStyles = (\n\ttree: GlobalStylesConfig,\n\tblockSelectors: string | BlockSelectors,\n\thasBlockGapSupport?: boolean,\n\thasFallbackGapSupport?: boolean,\n\tdisableLayoutStyles: boolean = false,\n\tdisableRootPadding: boolean = false,\n\tstyleOptions: Record< string, boolean > = {}\n): string => {\n\t// These allow opting out of certain sets of styles.\n\tconst options = {\n\t\tblockGap: true,\n\t\tblockStyles: true,\n\t\tlayoutStyles: true,\n\t\tmarginReset: true,\n\t\tpresets: true,\n\t\trootPadding: true,\n\t\tvariationStyles: false,\n\t\t...styleOptions,\n\t};\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\tconst hasBodyStyles =\n\t\toptions.marginReset || options.rootPadding || options.layoutStyles;\n\n\tlet ruleset = '';\n\n\tif ( options.presets && ( contentSize || wideSize ) ) {\n\t\truleset += `${ ROOT_CSS_PROPERTIES_SELECTOR } {`;\n\t\truleset = contentSize\n\t\t\t? ruleset + ` --wp--style--global--content-size: ${ contentSize };`\n\t\t\t: ruleset;\n\t\truleset = wideSize\n\t\t\t? ruleset + ` --wp--style--global--wide-size: ${ wideSize };`\n\t\t\t: ruleset;\n\t\truleset += '}';\n\t}\n\n\tif ( hasBodyStyles ) {\n\t\t/*\n\t\t * Reset default browser margin on the body element.\n\t\t * This is set on the body selector **before** generating the ruleset\n\t\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t\t * `margin` in its `spacing` declaration for the `body` element then these\n\t\t * user-generated values take precedence in the CSS cascade.\n\t\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t\t */\n\t\truleset += ':where(body) {margin: 0;';\n\n\t\t// Root padding styles should be output for full templates, patterns and template parts.\n\t\tif ( options.rootPadding && useRootPaddingAlign ) {\n\t\t\t/*\n\t\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\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\t */\n\t\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\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }\n\t\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\t.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; }\n\t\t\t\t.has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0;\n\t\t\t\t`;\n\t\t}\n\n\t\truleset += '}';\n\t}\n\n\tif ( options.blockStyles ) {\n\t\tnodesWithStyles.forEach(\n\t\t\t( {\n\t\t\t\tselector,\n\t\t\t\tduotoneSelector,\n\t\t\t\tstyles,\n\t\t\t\tfallbackGapValue,\n\t\t\t\thasLayoutSupport,\n\t\t\t\tfeatureSelectors,\n\t\t\t\tstyleVariationSelectors,\n\t\t\t\tskipSelectorWrapper,\n\t\t\t\tname,\n\t\t\t} ) => {\n\t\t\t\t// Process styles for block support features with custom feature level\n\t\t\t\t// CSS selectors set.\n\t\t\t\tif ( featureSelectors ) {\n\t\t\t\t\tlet featureDeclarations = getFeatureDeclarations(\n\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\tstyles\n\t\t\t\t\t);\n\n\t\t\t\t\t// Update text indent selector for paragraph blocks based on the textIndent setting.\n\t\t\t\t\tfeatureDeclarations = updateParagraphTextIndentSelector(\n\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\ttree.settings,\n\t\t\t\t\t\tname\n\t\t\t\t\t);\n\n\t\t\t\t\t// Update button width declarations for percentage values to use calc() with block gap.\n\t\t\t\t\tfeatureDeclarations = updateButtonWidthDeclarations(\n\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\ttree.settings\n\t\t\t\t\t);\n\n\t\t\t\t\tObject.entries( featureDeclarations ).forEach(\n\t\t\t\t\t\t( [ cssSelector, declarations ] ) => {\n\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\tconst rules = declarations.join( ';' );\n\t\t\t\t\t\t\t\truleset += `:root :where(${ cssSelector }){${ rules };}`;\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\n\t\t\t\t// Process duotone styles.\n\t\t\t\tif ( duotoneSelector ) {\n\t\t\t\t\tconst duotoneStyles: any = {};\n\t\t\t\t\tif ( styles?.filter ) {\n\t\t\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\t\t\tdelete styles.filter;\n\t\t\t\t\t}\n\t\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\t\tif ( duotoneDeclarations.length ) {\n\t\t\t\t\t\truleset += `${ duotoneSelector }{${ duotoneDeclarations.join(\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\n\t\t\t\t// Process blockGap and layout styles.\n\t\t\t\tif (\n\t\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t\t) {\n\t\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\t\tstyle: styles,\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\t\tfallbackGapValue,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\t\tconst styleDeclarations = getStylesDeclarations(\n\t\t\t\t\tstyles,\n\t\t\t\t\tselector,\n\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\ttree,\n\t\t\t\t\tdisableRootPadding\n\t\t\t\t);\n\t\t\t\tif ( styleDeclarations?.length ) {\n\t\t\t\t\tconst generalSelector = skipSelectorWrapper\n\t\t\t\t\t\t? selector\n\t\t\t\t\t\t: `:root :where(${ selector })`;\n\t\t\t\t\truleset += `${ generalSelector }{${ styleDeclarations.join(\n\t\t\t\t\t\t';'\n\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t\tif ( styles?.css ) {\n\t\t\t\t\truleset += processCSSNesting(\n\t\t\t\t\t\tstyles.css,\n\t\t\t\t\t\t`:root :where(${ selector })`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif ( options.variationStyles && styleVariationSelectors ) {\n\t\t\t\t\tObject.entries( styleVariationSelectors ).forEach(\n\t\t\t\t\t\t( [ styleVariationName, styleVariationSelector ] ) => {\n\t\t\t\t\t\t\tconst styleVariations =\n\t\t\t\t\t\t\t\tstyles?.variations?.[ styleVariationName ];\n\t\t\t\t\t\t\tif ( styleVariations ) {\n\t\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\t\tif ( featureSelectors ) {\n\t\t\t\t\t\t\t\t\tlet featureDeclarations =\n\t\t\t\t\t\t\t\t\t\tgetFeatureDeclarations(\n\t\t\t\t\t\t\t\t\t\t\tfeatureSelectors,\n\t\t\t\t\t\t\t\t\t\t\tstyleVariations\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t// Update text indent selector for paragraph blocks based on the textIndent setting.\n\t\t\t\t\t\t\t\t\tfeatureDeclarations =\n\t\t\t\t\t\t\t\t\t\tupdateParagraphTextIndentSelector(\n\t\t\t\t\t\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\t\t\t\t\t\ttree.settings,\n\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t// Update button width declarations for percentage values to use calc() with block gap.\n\t\t\t\t\t\t\t\t\tfeatureDeclarations =\n\t\t\t\t\t\t\t\t\t\tupdateButtonWidthDeclarations(\n\t\t\t\t\t\t\t\t\t\t\tfeatureDeclarations,\n\t\t\t\t\t\t\t\t\t\t\ttree.settings\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\t\t\t\tfeatureDeclarations\n\t\t\t\t\t\t\t\t\t).forEach(\n\t\t\t\t\t\t\t\t\t\t( [ baseSelector, declarations ]: [\n\t\t\t\t\t\t\t\t\t\t\tstring,\n\t\t\t\t\t\t\t\t\t\t\tstring[],\n\t\t\t\t\t\t\t\t\t\t] ) => {\n\t\t\t\t\t\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\t\t\t\t\t\tconst cssSelector =\n\t\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\t\tbaseSelector,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstyleVariationSelector as string\n\t\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tconst rules =\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeclarations.join( ';' );\n\t\t\t\t\t\t\t\t\t\t\t\truleset += `:root :where(${ cssSelector }){${ rules };}`;\n\t\t\t\t\t\t\t\t\t\t\t}\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\n\t\t\t\t\t\t\t\t// Otherwise add regular selectors.\n\t\t\t\t\t\t\t\tconst styleVariationDeclarations =\n\t\t\t\t\t\t\t\t\tgetStylesDeclarations(\n\t\t\t\t\t\t\t\t\t\tstyleVariations,\n\t\t\t\t\t\t\t\t\t\tstyleVariationSelector as string,\n\t\t\t\t\t\t\t\t\t\tuseRootPaddingAlign,\n\t\t\t\t\t\t\t\t\t\ttree\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tif ( styleVariationDeclarations.length ) {\n\t\t\t\t\t\t\t\t\truleset += `:root :where(${ styleVariationSelector }){${ styleVariationDeclarations.join(\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\tif ( styleVariations?.css ) {\n\t\t\t\t\t\t\t\t\truleset += processCSSNesting(\n\t\t\t\t\t\t\t\t\t\tstyleVariations.css,\n\t\t\t\t\t\t\t\t\t\t`:root :where(${ styleVariationSelector })`\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// Generate layout styles for the variation if it supports layout and has blockGap defined.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\thasLayoutSupport &&\n\t\t\t\t\t\t\t\t\tstyleVariations?.spacing?.blockGap\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t// Append block selector to variation selector so layout classes are properly constructed.\n\t\t\t\t\t\t\t\t\tconst variationSelectorWithBlock =\n\t\t\t\t\t\t\t\t\t\tstyleVariationSelector + selector;\n\t\t\t\t\t\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\t\t\t\t\t\tstyle: styleVariations,\n\t\t\t\t\t\t\t\t\t\tselector: variationSelectorWithBlock,\n\t\t\t\t\t\t\t\t\t\thasBlockGapSupport: true,\n\t\t\t\t\t\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\t\t\t\t\t\tfallbackGapValue,\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\n\t\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t\t);\n\n\t\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// `selector` may be provided in a form\n\t\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t\t// string.\n\t\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\t// Split and append pseudo selector to create\n\t\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel: string ) => sel + pseudoKey )\n\t\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\t\t// As pseudo classes such as :hover, :focus etc. have class-level\n\t\t\t\t\t\t\t// specificity, they must use the `:root :where()` wrapper. This.\n\t\t\t\t\t\t\t// caps the specificity at `0-1-0` to allow proper nesting of variations\n\t\t\t\t\t\t\t// and block type element styles.\n\t\t\t\t\t\t\tconst pseudoRule = `:root :where(${ _selector }){${ pseudoDeclarations.join(\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\truleset += pseudoRule;\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\tif ( options.layoutStyles ) {\n\t\t/* Add alignment / layout styles */\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\t}\n\n\tif ( options.blockGap && 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`:root :where(.wp-site-blocks) > * { margin-block-start: ${ gapValue }; margin-block-end: 0; }`;\n\t\truleset =\n\t\t\truleset +\n\t\t\t':root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t':root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }';\n\t}\n\n\tif ( options.presets ) {\n\t\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\t\tif (\n\t\t\t\tROOT_BLOCK_SELECTOR === selector ||\n\t\t\t\tROOT_CSS_PROPERTIES_SELECTOR === selector\n\t\t\t) {\n\t\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\t\tselector = '';\n\t\t\t}\n\n\t\t\tconst classes = getPresetsClasses( selector, presets );\n\t\t\tif ( classes.length > 0 ) {\n\t\t\t\truleset += classes;\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn ruleset;\n};\n\nexport function generateSvgFilters(\n\ttree: GlobalStylesConfig,\n\tblockSelectors: BlockSelectors\n): string[] {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType: BlockType, rootSelector: string ) => {\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: Record< string, string > = {\n\t\troot: rootSelector,\n\t};\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockSelector( blockType, featureKey );\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 = (\n\tblockTypes: BlockType[],\n\tvariationInstanceId?: string\n) => {\n\tconst { getBlockStyles } = select( blocksStore );\n\tconst result: BlockSelectors = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockSelector( blockType );\n\n\t\tif ( ! selector ) {\n\t\t\treturn; // Skip blocks without valid selectors\n\t\t}\n\t\tlet duotoneSelector = getBlockSelector( blockType, 'filter.duotone' );\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockSelector( 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\tif ( typeof duotoneSupport === 'string' && rootSelector ) {\n\t\t\t\tduotoneSelector = scopeSelector( rootSelector, duotoneSupport );\n\t\t\t}\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\t// @ts-expect-error\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors: Record< string, string > = {};\n\t\tblockStyleVariations?.forEach( ( variation ) => {\n\t\t\tconst variationSuffix = variationInstanceId\n\t\t\t\t? `-${ variationInstanceId }`\n\t\t\t\t: '';\n\t\t\tconst variationName = `${ variation.name }${ variationSuffix }`;\n\t\t\tconst styleVariationSelector = getBlockStyleVariationSelector(\n\t\t\t\tvariationName,\n\t\t\t\tselector\n\t\t\t);\n\n\t\t\tstyleVariationSelectors[ variationName ] = styleVariationSelector;\n\t\t} );\n\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: duotoneSelector ?? undefined,\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: blockStyleVariations?.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 config Theme.json configuration file object\n * @return Theme.json configuration file object updated\n */\nfunction updateConfigWithSeparator(\n\tconfig: GlobalStylesConfig\n): GlobalStylesConfig {\n\tconst blocks = config.styles?.blocks;\n\tconst separatorBlock = blocks?.[ 'core/separator' ];\n\tconst needsSeparatorStyleUpdate =\n\t\tseparatorBlock &&\n\t\tseparatorBlock.color?.background &&\n\t\t! separatorBlock.color?.text &&\n\t\t! separatorBlock.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...blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...separatorBlock,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...separatorBlock.color,\n\t\t\t\t\t\t\ttext: separatorBlock.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: string, blockSelector: string ) {\n\tlet processedCSS = '';\n\n\tif ( ! css || css.trim() === '' ) {\n\t\treturn processedCSS;\n\t}\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part: string ) => {\n\t\tif ( ! part || part.trim() === '' ) {\n\t\t\treturn;\n\t\t}\n\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 += `:root :where(${ 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 splitPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splitPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splitPart;\n\n\t\t\t// Handle pseudo elements such as ::before, ::after, etc. Regex will also\n\t\t\t// capture any leading combinator such as >, +, or ~, as well as spaces.\n\t\t\t// This allows pseudo elements as descendants e.g. `.parent ::before`.\n\t\t\tconst matches = nestedSelector.match( /([>+~\\s]*::[a-zA-Z-]+)/ );\n\t\t\tconst pseudoPart = matches ? matches[ 1 ] : '';\n\t\t\tconst withoutPseudoElement = matches\n\t\t\t\t? nestedSelector.replace( pseudoPart, '' ).trim()\n\t\t\t\t: nestedSelector.trim();\n\n\t\t\tlet combinedSelector;\n\t\t\tif ( withoutPseudoElement === '' ) {\n\t\t\t\t// Only contained a pseudo element to use the block selector to form\n\t\t\t\t// the final `:root :where()` selector.\n\t\t\t\tcombinedSelector = blockSelector;\n\t\t\t} else {\n\t\t\t\t// If the nested selector is a descendant of the block scope it with the\n\t\t\t\t// block selector. Otherwise append it to the block selector.\n\t\t\t\tcombinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t\t? scopeSelector( blockSelector, withoutPseudoElement )\n\t\t\t\t\t: appendToSelector( blockSelector, withoutPseudoElement );\n\t\t\t}\n\n\t\t\t// Build final rule, re-adding any pseudo element outside the `:where()`\n\t\t\t// to maintain valid CSS selector.\n\t\t\tprocessedCSS += `:root :where(${ combinedSelector })${ pseudoPart }{${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\nexport interface GlobalStylesRenderOptions {\n\thasBlockGapSupport?: boolean;\n\thasFallbackGapSupport?: boolean;\n\tdisableLayoutStyles?: boolean;\n\tdisableRootPadding?: boolean;\n\tgetBlockStyles?: ( blockName: string ) => any[];\n\tstyleOptions?: Record< string, boolean >;\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 * @param config Global styles configuration\n * @param blockTypes Array of block types from WordPress blocks store\n * @param options Options for rendering global styles\n * @return Array of stylesheets and settings\n */\nexport function generateGlobalStyles(\n\tconfig: GlobalStylesConfig | undefined = {},\n\tblockTypes: any[] = [],\n\toptions: GlobalStylesRenderOptions = {}\n): [ any[], any ] {\n\tconst {\n\t\thasBlockGapSupport: hasBlockGapSupportOption,\n\t\thasFallbackGapSupport: hasFallbackGapSupportOption,\n\t\tdisableLayoutStyles = false,\n\t\tdisableRootPadding = false,\n\t\tstyleOptions = {},\n\t} = options;\n\n\t// Use provided block types or fall back to getBlockTypes()\n\tconst blocks = blockTypes.length > 0 ? blockTypes : getBlockTypes();\n\n\tconst blockGap = getSetting( config, 'spacing.blockGap' );\n\tconst hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null;\n\tconst hasFallbackGapSupport =\n\t\thasFallbackGapSupportOption ?? ! hasBlockGapSupport;\n\n\tif ( ! config?.styles || ! config?.settings ) {\n\t\treturn [ [], {} ];\n\t}\n\tconst updatedConfig = updateConfigWithSeparator( config );\n\tconst blockSelectors = getBlockSelectors( blocks );\n\tconst customProperties = generateCustomProperties(\n\t\tupdatedConfig,\n\t\tblockSelectors\n\t);\n\tconst globalStyles = transformToStyles(\n\t\tupdatedConfig,\n\t\tblockSelectors,\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tdisableLayoutStyles,\n\t\tdisableRootPadding,\n\t\tstyleOptions\n\t);\n\tconst svgs = generateSvgFilters( updatedConfig, blockSelectors );\n\tconst styles = [\n\t\t{\n\t\t\tcss: customProperties,\n\t\t\tisGlobalStyles: true,\n\t\t},\n\t\t{\n\t\t\tcss: globalStyles,\n\t\t\tisGlobalStyles: true,\n\t\t},\n\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{\n\t\t\tcss: updatedConfig?.styles?.css ?? '',\n\t\t\tisGlobalStyles: true,\n\t\t},\n\t\t{\n\t\t\tassets: svgs,\n\t\t\t__unstableType: 'svgs',\n\t\t\tisGlobalStyles: true,\n\t\t},\n\t];\n\n\t// Loop through the blocks to check if there are custom CSS values.\n\t// If there are, get the block selector and push the selector together with\n\t// the CSS value to the 'stylesheets' array.\n\tblocks.forEach( ( blockType: BlockType ) => {\n\t\tconst blockStyles = updatedConfig?.styles?.blocks?.[ blockType.name ];\n\t\tif ( blockStyles?.css ) {\n\t\t\tconst { featureSelectors } = blockSelectors[ blockType.name ];\n\t\t\tconst cssFeatureSelector =\n\t\t\t\ttypeof featureSelectors === 'object'\n\t\t\t\t\t? featureSelectors?.css\n\t\t\t\t\t: undefined;\n\t\t\tlet resolvedCssSelector: string | undefined;\n\t\t\tif ( typeof cssFeatureSelector === 'string' ) {\n\t\t\t\tresolvedCssSelector = cssFeatureSelector;\n\t\t\t} else if ( typeof cssFeatureSelector === 'object' ) {\n\t\t\t\tresolvedCssSelector = (\n\t\t\t\t\tcssFeatureSelector as Record< string, string >\n\t\t\t\t )?.root;\n\t\t\t}\n\t\t\tconst selector =\n\t\t\t\tresolvedCssSelector ??\n\t\t\t\tblockSelectors[ blockType.name ].selector;\n\t\t\tstyles.push( {\n\t\t\t\tcss: processCSSNesting( blockStyles.css, selector ),\n\t\t\t\tisGlobalStyles: true,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn [ styles, updatedConfig.settings ];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAMO;AAEP,0BAAqD;AACrD,kBAAuB;AAKvB,oBASO;AACP,uBAAiC;AACjC,wBAA2C;AAC3C,qBAAiC;AACjC,oBAA0B;AAC1B,iBAA+B;AAC/B,wBAA2C;AAC3C,oBAAmC;AACnC,oBAAqD;AACrD,yBAA2B;AA4G3B,IAAM,sBAAsB;AAAA,EAC3B,QAAQ;AAAA,EACR,SAAS;AACV;AAIA,IAAM,wCAAwC;AAAA,EAC7C,sBAAsB;AAAA,EACtB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,YAAY;AACb;AASA,SAAS,kBACR,gBAAwB,KACxB,eAAsC,CAAC,GAC9B;AACT,SAAO,8BAAgB;AAAA,IACtB,CACC,cACA,EAAE,MAAM,aAAa,QAAQ,MACzB;AACJ,UAAK,CAAE,SAAU;AAChB,eAAO;AAAA,MACR;AAEA,YAAM,qBAAiB;AAAA,QACtB;AAAA,QACA;AAAA,QACA,CAAC;AAAA,MACF;AACA,OAAE,WAAW,SAAS,QAAS,EAAE,QAAS,CAAE,WAAY;AACvD,YAAK,eAAgB,MAAO,GAAI;AAC/B,yBAAgB,MAAO,EAAE;AAAA,YACxB,CAAE,EAAE,KAAK,MAAyB;AACjC,sBAAS;AAAA,gBACR,CAAE;AAAA,kBACD;AAAA,kBACA;AAAA,gBACD,MAAuB;AACtB,wBAAM,qBAAqB,YAAS;AAAA,oBACnC;AAAA,kBACD,CAAE,IAAK,WAAY;AACnB,wBAAM,gBAAgB,cACpB,MAAO,GAAI,EACX;AAAA,oBACA,CAAE,aACD,GAAI,QAAS,GAAI,kBA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,OAAO,qBAAqB,WACzB,kBAAkB,MAClB;AACJ,UAAI;AACJ,UAAK,OAAO,uBAAuB,UAAW;AAC7C,8BAAsB;AAAA,MACvB,WAAY,OAAO,uBAAuB,UAAW;AACpD,8BACC,oBACG;AAAA,MACL;AACA,YAAM,WACL,uBACA,eAAgB,UAAU,IAAK,EAAE;AAClC,aAAO,KAAM;AAAA,QACZ,KAAK,kBAAmB,YAAY,KAAK,QAAS;AAAA,QAClD,gBAAgB;AAAA,MACjB,CAAE;AAAA,IACH;AAAA,EACD,CAAE;AAEF,SAAO,CAAE,QAAQ,cAAc,QAAS;AACzC;",
6
6
  "names": ["STYLE_PROPERTY", "ELEMENTS", "presets", "blocksStore"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/core/selectors.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { BlockType } from '../types';\nimport { scopeSelector } from '../utils/common';\nimport { getValueFromObjectPath } from '../utils/object';\n\n/**\n * Determine the CSS selector for the block type and target provided, returning\n * it if available.\n *\n * @param blockType The block's type.\n * @param target The desired selector's target e.g. `root`, delimited string, or array path.\n * @param options Options object.\n * @param options.fallback Whether or not to fallback to broader selector.\n *\n * @return The CSS selector or `null` if no selector available.\n */\nexport function getBlockSelector(\n\tblockType: BlockType,\n\ttarget: string = 'root',\n\toptions: { fallback?: boolean } = {}\n): string | null {\n\tif ( ! target ) {\n\t\treturn null;\n\t}\n\n\tconst { fallback = false } = options;\n\tconst { name, selectors, supports } = blockType;\n\n\tconst hasSelectors = selectors && Object.keys( selectors ).length > 0;\n\tconst path = Array.isArray( target ) ? target.join( '.' ) : target;\n\n\t// Root selector.\n\n\t// Calculated before returning as it can be used as a fallback for feature\n\t// selectors later on.\n\tlet rootSelector: string | null = null;\n\n\tif ( hasSelectors && selectors.root ) {\n\t\t// Use the selectors API if available.\n\t\trootSelector = selectors?.root as string;\n\t} else if ( supports?.__experimentalSelector ) {\n\t\t// Use the old experimental selector supports property if set.\n\t\trootSelector = supports.__experimentalSelector;\n\t} else {\n\t\t// If no root selector found, generate default block class selector.\n\t\trootSelector =\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t}\n\n\t// Return selector if it's the root target we are looking for.\n\tif ( path === 'root' ) {\n\t\treturn rootSelector;\n\t}\n\n\t// If target is not `root` or `duotone` we have a feature or subfeature\n\t// as the target. If the target is a string convert to an array.\n\tconst pathArray = Array.isArray( target ) ? target : target.split( '.' );\n\n\t// Feature selectors ( may fallback to root selector );\n\tif ( pathArray.length === 1 ) {\n\t\tconst fallbackSelector = fallback ? rootSelector : null;\n\n\t\t// Prefer the selectors API if available.\n\t\tif ( hasSelectors ) {\n\t\t\t// Get selector from either `feature.root` or shorthand path.\n\t\t\tconst featureSelector =\n\t\t\t\t( getValueFromObjectPath(\n\t\t\t\t\tselectors,\n\t\t\t\t\t`${ path }.root`,\n\t\t\t\t\tnull\n\t\t\t\t) as string ) ||\n\t\t\t\t( getValueFromObjectPath( selectors, path, null ) as string );\n\n\t\t\t// Return feature selector if found or any available fallback.\n\t\t\treturn featureSelector || fallbackSelector;\n\t\t}\n\n\t\t// Try getting old experimental supports selector value.\n\t\tconst featureSelector = supports\n\t\t\t? ( getValueFromObjectPath(\n\t\t\t\t\tsupports,\n\t\t\t\t\t`${ path }.__experimentalSelector`,\n\t\t\t\t\tnull\n\t\t\t ) as string | undefined )\n\t\t\t: undefined;\n\n\t\t// If nothing to work with, provide fallback selector if available.\n\t\tif ( ! featureSelector ) {\n\t\t\treturn fallbackSelector;\n\t\t}\n\n\t\t// Scope the feature selector by the block's root selector.\n\t\treturn scopeSelector( rootSelector, featureSelector );\n\t}\n\n\t// Subfeature selector.\n\t// This may fallback either to parent feature or root selector.\n\tlet subfeatureSelector;\n\n\t// Use selectors API if available.\n\tif ( hasSelectors ) {\n\t\tsubfeatureSelector = getValueFromObjectPath( selectors, path, null );\n\t}\n\n\t// Only return if we have a subfeature selector.\n\tif ( subfeatureSelector ) {\n\t\treturn subfeatureSelector as string;\n\t}\n\n\t// To this point we don't have a subfeature selector. If a fallback has been\n\t// requested, remove subfeature from target path and return results of a\n\t// call for the parent feature's selector.\n\tif ( fallback ) {\n\t\treturn getBlockSelector( blockType, pathArray[ 0 ], options );\n\t}\n\n\t// We tried.\n\treturn null;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAA8B;AAC9B,oBAAuC;AAahC,SAAS,iBACf,WACA,SAAiB,QACjB,UAAkC,CAAC,GACnB;AAChB,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,WAAW,MAAM,IAAI;AAC7B,QAAM,EAAE,MAAM,WAAW,SAAS,IAAI;AAEtC,QAAM,eAAe,aAAa,OAAO,KAAM,SAAU,EAAE,SAAS;AACpE,QAAM,OAAO,MAAM,QAAS,MAAO,IAAI,OAAO,KAAM,GAAI,IAAI;AAM5D,MAAI,eAA8B;AAElC,MAAK,gBAAgB,UAAU,MAAO;AAErC,mBAAe,WAAW;AAAA,EAC3B,WAAY,UAAU,wBAAyB;AAE9C,mBAAe,SAAS;AAAA,EACzB,OAAO;AAEN,mBACC,eAAe,KAAK,QAAS,SAAS,EAAG,EAAE,QAAS,KAAK,GAAI;AAAA,EAC/D;AAGA,MAAK,SAAS,QAAS;AACtB,WAAO;AAAA,EACR;AAIA,QAAM,YAAY,MAAM,QAAS,MAAO,IAAI,SAAS,OAAO,MAAO,GAAI;AAGvE,MAAK,UAAU,WAAW,GAAI;AAC7B,UAAM,mBAAmB,WAAW,eAAe;AAGnD,QAAK,cAAe;AAEnB,YAAMA,uBACH;AAAA,QACD;AAAA,QACA,GAAI,IAAK;AAAA,QACT;AAAA,MACD,SACE,sCAAwB,WAAW,MAAM,IAAK;AAGjD,aAAOA,oBAAmB;AAAA,IAC3B;AAGA,UAAM,kBAAkB,eACnB;AAAA,MACF;AAAA,MACA,GAAI,IAAK;AAAA,MACT;AAAA,IACA,IACA;AAGH,QAAK,CAAE,iBAAkB;AACxB,aAAO;AAAA,IACR;AAGA,eAAO,6BAAe,cAAc,eAAgB;AAAA,EACrD;AAIA,MAAI;AAGJ,MAAK,cAAe;AACnB,6BAAqB,sCAAwB,WAAW,MAAM,IAAK;AAAA,EACpE;AAGA,MAAK,oBAAqB;AACzB,WAAO;AAAA,EACR;AAKA,MAAK,UAAW;AACf,WAAO,iBAAkB,WAAW,UAAW,CAAE,GAAG,OAAQ;AAAA,EAC7D;AAGA,SAAO;AACR;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { BlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { scopeSelector } from '../utils/common';\nimport { getValueFromObjectPath } from '../utils/object';\n\n/**\n * Determine the CSS selector for the block type and target provided, returning\n * it if available.\n *\n * @param blockType The block's type.\n * @param target The desired selector's target e.g. `root`, delimited string, or array path.\n * @param options Options object.\n * @param options.fallback Whether or not to fallback to broader selector.\n *\n * @return The CSS selector or `null` if no selector available.\n */\nexport function getBlockSelector(\n\tblockType: BlockType,\n\ttarget: string = 'root',\n\toptions: { fallback?: boolean } = {}\n): string | null {\n\tif ( ! target ) {\n\t\treturn null;\n\t}\n\n\tconst { fallback = false } = options;\n\tconst { name, selectors, supports } = blockType;\n\n\tconst hasSelectors = selectors && Object.keys( selectors ).length > 0;\n\tconst path = Array.isArray( target ) ? target.join( '.' ) : target;\n\n\t// Root selector.\n\n\t// Calculated before returning as it can be used as a fallback for feature\n\t// selectors later on.\n\tlet rootSelector: string | null = null;\n\n\tif ( hasSelectors && selectors.root ) {\n\t\t// Use the selectors API if available.\n\t\trootSelector = selectors?.root as string;\n\t} else if ( supports?.__experimentalSelector ) {\n\t\t// Use the old experimental selector supports property if set.\n\t\trootSelector = supports.__experimentalSelector;\n\t} else {\n\t\t// If no root selector found, generate default block class selector.\n\t\trootSelector =\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t}\n\n\t// Return selector if it's the root target we are looking for.\n\tif ( path === 'root' ) {\n\t\treturn rootSelector;\n\t}\n\n\t// If target is not `root` or `duotone` we have a feature or subfeature\n\t// as the target. If the target is a string convert to an array.\n\tconst pathArray = Array.isArray( target ) ? target : target.split( '.' );\n\n\t// Feature selectors ( may fallback to root selector );\n\tif ( pathArray.length === 1 ) {\n\t\tconst fallbackSelector = fallback ? rootSelector : null;\n\n\t\t// Prefer the selectors API if available.\n\t\tif ( hasSelectors ) {\n\t\t\t// Get selector from either `feature.root` or shorthand path.\n\t\t\tconst featureSelector =\n\t\t\t\t( getValueFromObjectPath(\n\t\t\t\t\tselectors,\n\t\t\t\t\t`${ path }.root`,\n\t\t\t\t\tnull\n\t\t\t\t) as string ) ||\n\t\t\t\t( getValueFromObjectPath( selectors, path, null ) as string );\n\n\t\t\t// Return feature selector if found or any available fallback.\n\t\t\treturn featureSelector || fallbackSelector;\n\t\t}\n\n\t\t// Try getting old experimental supports selector value.\n\t\tconst featureSelector = supports\n\t\t\t? ( getValueFromObjectPath(\n\t\t\t\t\tsupports,\n\t\t\t\t\t`${ path }.__experimentalSelector`,\n\t\t\t\t\tnull\n\t\t\t ) as string | undefined )\n\t\t\t: undefined;\n\n\t\t// If nothing to work with, provide fallback selector if available.\n\t\tif ( ! featureSelector ) {\n\t\t\treturn fallbackSelector;\n\t\t}\n\n\t\t// Scope the feature selector by the block's root selector.\n\t\treturn scopeSelector( rootSelector, featureSelector );\n\t}\n\n\t// Subfeature selector.\n\t// This may fallback either to parent feature or root selector.\n\tlet subfeatureSelector;\n\n\t// Use selectors API if available.\n\tif ( hasSelectors ) {\n\t\tsubfeatureSelector = getValueFromObjectPath( selectors, path, null );\n\t}\n\n\t// Only return if we have a subfeature selector.\n\tif ( subfeatureSelector ) {\n\t\treturn subfeatureSelector as string;\n\t}\n\n\t// To this point we don't have a subfeature selector. If a fallback has been\n\t// requested, remove subfeature from target path and return results of a\n\t// call for the parent feature's selector.\n\tif ( fallback ) {\n\t\treturn getBlockSelector( blockType, pathArray[ 0 ], options );\n\t}\n\n\t// We tried.\n\treturn null;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,oBAA8B;AAC9B,oBAAuC;AAahC,SAAS,iBACf,WACA,SAAiB,QACjB,UAAkC,CAAC,GACnB;AAChB,MAAK,CAAE,QAAS;AACf,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,WAAW,MAAM,IAAI;AAC7B,QAAM,EAAE,MAAM,WAAW,SAAS,IAAI;AAEtC,QAAM,eAAe,aAAa,OAAO,KAAM,SAAU,EAAE,SAAS;AACpE,QAAM,OAAO,MAAM,QAAS,MAAO,IAAI,OAAO,KAAM,GAAI,IAAI;AAM5D,MAAI,eAA8B;AAElC,MAAK,gBAAgB,UAAU,MAAO;AAErC,mBAAe,WAAW;AAAA,EAC3B,WAAY,UAAU,wBAAyB;AAE9C,mBAAe,SAAS;AAAA,EACzB,OAAO;AAEN,mBACC,eAAe,KAAK,QAAS,SAAS,EAAG,EAAE,QAAS,KAAK,GAAI;AAAA,EAC/D;AAGA,MAAK,SAAS,QAAS;AACtB,WAAO;AAAA,EACR;AAIA,QAAM,YAAY,MAAM,QAAS,MAAO,IAAI,SAAS,OAAO,MAAO,GAAI;AAGvE,MAAK,UAAU,WAAW,GAAI;AAC7B,UAAM,mBAAmB,WAAW,eAAe;AAGnD,QAAK,cAAe;AAEnB,YAAMA,uBACH;AAAA,QACD;AAAA,QACA,GAAI,IAAK;AAAA,QACT;AAAA,MACD,SACE,sCAAwB,WAAW,MAAM,IAAK;AAGjD,aAAOA,oBAAmB;AAAA,IAC3B;AAGA,UAAM,kBAAkB,eACnB;AAAA,MACF;AAAA,MACA,GAAI,IAAK;AAAA,MACT;AAAA,IACA,IACA;AAGH,QAAK,CAAE,iBAAkB;AACxB,aAAO;AAAA,IACR;AAGA,eAAO,6BAAe,cAAc,eAAgB;AAAA,EACrD;AAIA,MAAI;AAGJ,MAAK,cAAe;AACnB,6BAAqB,sCAAwB,WAAW,MAAM,IAAK;AAAA,EACpE;AAGA,MAAK,oBAAqB;AACzB,WAAO;AAAA,EACR;AAKA,MAAK,UAAW;AACf,WAAO,iBAAkB,WAAW,UAAW,CAAE,GAAG,OAAQ;AAAA,EAC7D;AAGA,SAAO;AACR;",
6
6
  "names": ["featureSelector"]
7
7
  }
@@ -40,7 +40,7 @@ function generatePreviewStateStyles(stateStyles, blockName) {
40
40
  try {
41
41
  const [generatedStyles] = (0, import_render.generateGlobalStyles)(previewConfig, []);
42
42
  return generatedStyles.map((style) => style.css).join("\n");
43
- } catch (error) {
43
+ } catch {
44
44
  return "";
45
45
  }
46
46
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/preview-state-styles.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { generateGlobalStyles } from './core/render';\nimport type { GlobalStylesConfig } from './types';\n\n/**\n * Generates CSS for preview contexts to display a specific state (hover, focus, etc.).\n * Takes state-specific styles and generates CSS as if they were the default styles,\n * allowing previews to show how a block will appear in that state.\n *\n * @param stateStyles - The styles for the specific state (e.g., hover styles)\n * @param blockName - The block name (e.g., 'core/button')\n * @return CSS string for the state preview\n */\nexport function generatePreviewStateStyles(\n\tstateStyles: any,\n\tblockName: string\n): string {\n\tif ( ! stateStyles || ! blockName ) {\n\t\treturn '';\n\t}\n\n\t// Create a minimal theme.json-like config with the state styles\n\t// positioned as if they were the default styles for this block\n\tconst previewConfig: GlobalStylesConfig = {\n\t\tsettings: {}, // Empty settings to satisfy the config structure\n\t\tstyles: {\n\t\t\tblocks: {\n\t\t\t\t[ blockName ]: stateStyles,\n\t\t\t},\n\t\t},\n\t};\n\n\ttry {\n\t\tconst [ generatedStyles ] = generateGlobalStyles( previewConfig, [] );\n\n\t\treturn generatedStyles.map( ( style ) => style.css ).join( '\\n' );\n\t} catch ( error ) {\n\t\t// If generation fails, return empty string to avoid breaking previews\n\t\treturn '';\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AAY9B,SAAS,2BACf,aACA,WACS;AACT,MAAK,CAAE,eAAe,CAAE,WAAY;AACnC,WAAO;AAAA,EACR;AAIA,QAAM,gBAAoC;AAAA,IACzC,UAAU,CAAC;AAAA;AAAA,IACX,QAAQ;AAAA,MACP,QAAQ;AAAA,QACP,CAAE,SAAU,GAAG;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AAEA,MAAI;AACH,UAAM,CAAE,eAAgB,QAAI,oCAAsB,eAAe,CAAC,CAAE;AAEpE,WAAO,gBAAgB,IAAK,CAAE,UAAW,MAAM,GAAI,EAAE,KAAM,IAAK;AAAA,EACjE,SAAU,OAAQ;AAEjB,WAAO;AAAA,EACR;AACD;",
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { generateGlobalStyles } from './core/render';\nimport type { GlobalStylesConfig } from './types';\n\n/**\n * Generates CSS for preview contexts to display a specific state (hover, focus, etc.).\n * Takes state-specific styles and generates CSS as if they were the default styles,\n * allowing previews to show how a block will appear in that state.\n *\n * @param stateStyles - The styles for the specific state (e.g., hover styles)\n * @param blockName - The block name (e.g., 'core/button')\n * @return CSS string for the state preview\n */\nexport function generatePreviewStateStyles(\n\tstateStyles: any,\n\tblockName: string\n): string {\n\tif ( ! stateStyles || ! blockName ) {\n\t\treturn '';\n\t}\n\n\t// Create a minimal theme.json-like config with the state styles\n\t// positioned as if they were the default styles for this block\n\tconst previewConfig: GlobalStylesConfig = {\n\t\tsettings: {}, // Empty settings to satisfy the config structure\n\t\tstyles: {\n\t\t\tblocks: {\n\t\t\t\t[ blockName ]: stateStyles,\n\t\t\t},\n\t\t},\n\t};\n\n\ttry {\n\t\tconst [ generatedStyles ] = generateGlobalStyles( previewConfig, [] );\n\n\t\treturn generatedStyles.map( ( style ) => style.css ).join( '\\n' );\n\t} catch {\n\t\t// If generation fails, return empty string to avoid breaking previews\n\t\treturn '';\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AAY9B,SAAS,2BACf,aACA,WACS;AACT,MAAK,CAAE,eAAe,CAAE,WAAY;AACnC,WAAO;AAAA,EACR;AAIA,QAAM,gBAAoC;AAAA,IACzC,UAAU,CAAC;AAAA;AAAA,IACX,QAAQ;AAAA,MACP,QAAQ;AAAA,QACP,CAAE,SAAU,GAAG;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AAEA,MAAI;AACH,UAAM,CAAE,eAAgB,QAAI,oCAAsB,eAAe,CAAC,CAAE;AAEpE,WAAO,gBAAgB,IAAK,CAAE,UAAW,MAAM,GAAI,EAAE,KAAM,IAAK;AAAA,EACjE,QAAQ;AAEP,WAAO;AAAA,EACR;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/types.ts"],
4
- "sourcesContent": ["// =============================================================================\n// CORE PRIMITIVE TYPES\n// =============================================================================\n\n/**\n * Value that can be resolved from various sources (direct value, reference, or URL)\n */\nexport type UnresolvedValue =\n\t| string\n\t| number\n\t| { ref: string }\n\t| { url: string }\n\t| undefined\n\t| null;\n\n/**\n * Origin of a preset (theme, user customizations, or WordPress defaults)\n */\nexport type PresetOrigin = 'theme' | 'custom' | 'default';\n\n/**\n * Common properties for all preset types\n */\nexport interface BasePreset {\n\tname: string;\n\tslug: string;\n}\n\n// =============================================================================\n// COLOR SYSTEM TYPES\n// =============================================================================\n\n/**\n * Color preset definition\n */\nexport interface Color extends BasePreset {\n\tcolor: string;\n}\n\n/**\n * Gradient preset definition\n */\nexport interface Gradient extends BasePreset {\n\tgradient: string;\n}\n\n/**\n * Duotone filter preset definition\n */\nexport interface Duotone extends BasePreset {\n\tcolors: string[];\n}\n\n/**\n * Palette collection for a specific origin (theme, custom, default)\n */\nexport interface Palette {\n\tname: string;\n\tslug: PresetOrigin;\n\tcolors?: Color[];\n\tgradients?: Gradient[];\n\tduotones?: Duotone[];\n}\n\n/**\n * Multi-origin palette structure used by StyleBook\n */\nexport interface MultiOriginPalettes {\n\tcolors?: Palette[];\n\tgradients?: Palette[];\n\tduotones?: Palette[];\n\tdisableCustomColors?: boolean;\n\tdisableCustomGradients?: boolean;\n\thasColorsOrGradients?: boolean;\n}\n\n/**\n * Background style properties\n */\nexport interface BackgroundStyle {\n\tbackgroundColor?: UnresolvedValue;\n\tbackgroundImage?:\n\t\t| {\n\t\t\t\turl: string;\n\t\t\t\tid?: number;\n\t\t }\n\t\t| UnresolvedValue;\n\tbackgroundSize?: UnresolvedValue;\n\tbackgroundPosition?: UnresolvedValue;\n\tbackgroundRepeat?: UnresolvedValue;\n\tbackgroundAttachment?: UnresolvedValue;\n\tbackgroundBlendMode?: UnresolvedValue;\n\tbackgroundOpacity?: UnresolvedValue;\n}\n\n// =============================================================================\n// TYPOGRAPHY SYSTEM TYPES\n// =============================================================================\n\n/**\n * Fluid typography settings for responsive font sizes\n */\nexport interface FluidTypographyConfig {\n\tmin?: string;\n\tmax?: string;\n}\n\n/**\n * Typography preset (font size) definition\n */\nexport interface TypographyPreset extends BasePreset {\n\tsize: string | number | null;\n\tpreviewFontSize?: string;\n\tfluid?: boolean | FluidTypographyConfig;\n}\n\n/**\n * Font size preset definition (alias for TypographyPreset for clarity)\n */\nexport interface FontSizePreset extends TypographyPreset {}\n\n/**\n * Convenience type alias for font size data\n */\nexport type FontSize = FontSizePreset;\n\n/**\n * Font face definition as found in theme.json\n */\nexport interface FontFace {\n\tfontFamily: string;\n\tfontWeight?: string | number;\n\tfontStyle?: string;\n\tfontStretch?: string;\n\tfontDisplay?: string;\n\tsrc?: string | string[];\n}\n\n/**\n * Font family preset definition as found in theme.json\n */\nexport interface FontFamilyPreset extends BasePreset {\n\tfontFamily: string;\n\tfontFace?: FontFace[];\n}\n\n/**\n * Global fluid typography settings\n */\nexport interface FluidTypographySettings {\n\tmaxViewportWidth?: string;\n\tminFontSize?: string;\n\tminViewportWidth?: string;\n}\n\n/**\n * Typography settings collection\n */\nexport interface TypographySettings {\n\tfluid?: boolean | FluidTypographySettings;\n\tfontSizes?: TypographyPreset[] | Record< string, TypographyPreset[] >;\n\tfontFamilies?: Record< string, FontFamilyPreset[] >;\n\tdefaultFontSizes?: boolean;\n}\n\n// =============================================================================\n// LAYOUT SYSTEM TYPES\n// =============================================================================\n\n/**\n * Layout constraint settings\n */\nexport interface LayoutSettings {\n\twideSize?: string;\n\tcontentSize?: string;\n}\n\n/**\n * Spacing settings\n */\nexport interface SpacingSettings {\n\tpadding?: string | Record< string, string >;\n\tmargin?: string | Record< string, string >;\n\tblockGap?: string;\n}\n\n// =============================================================================\n// BLOCK SYSTEM TYPES (need to move to the blocks package eventually)\n// =============================================================================\n\n/**\n * Block type definition with global styles support\n */\nexport interface BlockType {\n\tname: string;\n\ttitle: string;\n\tcategory: string;\n\texample?: any;\n\tattributes?: Record< string, unknown >;\n\tsupports?: {\n\t\t__experimentalSelector?: string;\n\t\tinserter?: boolean;\n\t\tspacing?:\n\t\t\t| boolean\n\t\t\t| {\n\t\t\t\t\tblockGap?:\n\t\t\t\t\t\t| boolean\n\t\t\t\t\t\t| string[]\n\t\t\t\t\t\t| {\n\t\t\t\t\t\t\t\t__experimentalDefault?: string;\n\t\t\t\t\t\t\t\tsides: string[];\n\t\t\t\t\t\t };\n\t\t\t };\n\t\t[ key: string ]: unknown;\n\t};\n\tselectors?: Record< string, string | Record< string, string > >;\n}\n\n/**\n * Block style variation\n */\nexport interface BlockStyleVariation {\n\tname: string;\n\tlabel: string;\n\tstyles?: Record< string, any >;\n}\n\n// =============================================================================\n// GLOBAL STYLES STRUCTURE TYPES\n// =============================================================================\n\n/**\n * Global styles settings node\n */\nexport interface GlobalStylesSettings {\n\tuseRootPaddingAwareAlignments?: boolean;\n\ttypography?: TypographySettings;\n\tlayout?: LayoutSettings;\n\tspacing?: SpacingSettings;\n\tcolor?: {\n\t\tpalette?:\n\t\t\t| Color[]\n\t\t\t| {\n\t\t\t\t\ttheme?: Color[];\n\t\t\t\t\tcustom?: Color[];\n\t\t\t\t\tdefault?: Color[];\n\t\t\t };\n\t\tgradients?: {\n\t\t\ttheme?: Gradient[];\n\t\t\tcustom?: Gradient[];\n\t\t\tdefault?: Gradient[];\n\t\t};\n\t\tduotone?: {\n\t\t\ttheme?: Duotone[];\n\t\t\tcustom?: Duotone[];\n\t\t\tdefault?: Duotone[];\n\t\t};\n\t\tlink?: boolean;\n\t\tcustom?: boolean;\n\t\tcustomGradient?: boolean;\n\t\tcustomDuotone?: boolean;\n\t\tdefaultPalette?: boolean;\n\t\tdefaultGradients?: boolean;\n\t\tdefaultDuotone?: boolean;\n\t};\n\tcustom?: Record<\n\t\tstring,\n\t\tstring | number | Record< string, string | number >\n\t>;\n\tblocks?: Record< string, Omit< GlobalStylesSettings, 'blocks' > >;\n}\n\n/**\n * Global styles values node\n */\nexport interface GlobalStylesStyles {\n\tcolor?: {\n\t\tbackground?: UnresolvedValue;\n\t\ttext?: UnresolvedValue;\n\t};\n\ttypography?: {\n\t\tfontFamily?: UnresolvedValue;\n\t\tfontSize?: UnresolvedValue;\n\t\tfontWeight?: UnresolvedValue;\n\t\tlineHeight?: UnresolvedValue;\n\t\tletterSpacing?: UnresolvedValue;\n\t\ttextTransform?: UnresolvedValue;\n\t\ttextIndent?: UnresolvedValue;\n\t};\n\tspacing?: {\n\t\tpadding?: UnresolvedValue | Record< string, UnresolvedValue >;\n\t\tmargin?: UnresolvedValue | Record< string, UnresolvedValue >;\n\t\tblockGap?: string;\n\t};\n\tbackground?: BackgroundStyle;\n\tborder?: {\n\t\tcolor?: UnresolvedValue;\n\t\twidth?: UnresolvedValue;\n\t\tstyle?: UnresolvedValue;\n\t\tradius?:\n\t\t\t| UnresolvedValue\n\t\t\t| {\n\t\t\t\t\ttopLeft?: UnresolvedValue;\n\t\t\t\t\ttopRight?: UnresolvedValue;\n\t\t\t\t\tbottomRight?: UnresolvedValue;\n\t\t\t\t\tbottomLeft?: UnresolvedValue;\n\t\t\t };\n\t\ttop?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t\tright?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t\tbottom?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t\tleft?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t};\n\tfilter?: {\n\t\tduotone?: UnresolvedValue;\n\t\topacity?: UnresolvedValue;\n\t};\n\tdimensions?: {\n\t\twidth?: UnresolvedValue;\n\t\theight?: UnresolvedValue;\n\t\tminWidth?: UnresolvedValue;\n\t\tminHeight?: UnresolvedValue;\n\t\tmaxWidth?: UnresolvedValue;\n\t\tmaxHeight?: UnresolvedValue;\n\t};\n\telements?: Record<\n\t\tstring,\n\t\tOmit< GlobalStylesStyles, 'blocks' | 'elements' | 'variations' > & {\n\t\t\t':hover'?: Omit<\n\t\t\t\tGlobalStylesStyles,\n\t\t\t\t'blocks' | 'elements' | 'variations'\n\t\t\t>;\n\t\t}\n\t>;\n\tblocks?: Record< string, Omit< GlobalStylesStyles, 'blocks' > >;\n\tvariations?: Record< string, Omit< GlobalStylesStyles, 'blocks' > >;\n\tcss?: string;\n}\n\n/**\n * Complete global styles configuration\n */\nexport interface GlobalStylesConfig {\n\tversion?: number;\n\tsettings?: GlobalStylesSettings;\n\tstyles?: GlobalStylesStyles;\n\t_links?: {\n\t\t[ 'wp:theme-file' ]?: ThemeFileLink[];\n\t\t[ 'wp:action-edit-css' ]?: Array< { href: string } >;\n\t};\n}\n\n/**\n * Style variation (extends GlobalStylesConfig with metadata)\n */\nexport interface StyleVariation extends GlobalStylesConfig {\n\ttitle?: string;\n\tdescription?: string;\n}\n\n/**\n * WordPress theme file link\n */\nexport interface ThemeFileLink {\n\tname: string;\n\thref: string;\n\ttarget?: string;\n}\n\n// =============================================================================\n// UTILITY TYPES\n// =============================================================================\n\n/**\n * Deep partial type for global styles merging\n */\nexport type DeepPartial< T > = {\n\t[ P in keyof T ]?: T[ P ] extends object ? DeepPartial< T[ P ] > : T[ P ];\n};\n\n/**\n * CSS selector string\n */\nexport type CSSSelector = string;\n\n/**\n * CSS property value\n */\nexport type CSSValue = string | number | undefined;\n\n/**\n * CSS rules object\n */\nexport type CSSRules = Record< string, CSSValue >;\n"],
4
+ "sourcesContent": ["// =============================================================================\n// CORE PRIMITIVE TYPES\n// =============================================================================\n\n/**\n * Value that can be resolved from various sources (direct value, reference, or URL)\n */\nexport type UnresolvedValue =\n\t| string\n\t| number\n\t| { ref: string }\n\t| { url: string }\n\t| undefined\n\t| null;\n\n/**\n * Origin of a preset (theme, user customizations, or WordPress defaults)\n */\nexport type PresetOrigin = 'theme' | 'custom' | 'default';\n\n/**\n * Common properties for all preset types\n */\nexport interface BasePreset {\n\tname: string;\n\tslug: string;\n}\n\n// =============================================================================\n// COLOR SYSTEM TYPES\n// =============================================================================\n\n/**\n * Color preset definition\n */\nexport interface Color extends BasePreset {\n\tcolor: string;\n}\n\n/**\n * Gradient preset definition\n */\nexport interface Gradient extends BasePreset {\n\tgradient: string;\n}\n\n/**\n * Duotone filter preset definition\n */\nexport interface Duotone extends BasePreset {\n\tcolors: string[];\n}\n\n/**\n * Palette collection for a specific origin (theme, custom, default)\n */\nexport interface Palette {\n\tname: string;\n\tslug: PresetOrigin;\n\tcolors?: Color[];\n\tgradients?: Gradient[];\n\tduotones?: Duotone[];\n}\n\n/**\n * Multi-origin palette structure used by StyleBook\n */\nexport interface MultiOriginPalettes {\n\tcolors?: Palette[];\n\tgradients?: Palette[];\n\tduotones?: Palette[];\n\tdisableCustomColors?: boolean;\n\tdisableCustomGradients?: boolean;\n\thasColorsOrGradients?: boolean;\n}\n\n/**\n * Background style properties\n */\nexport interface BackgroundStyle {\n\tbackgroundColor?: UnresolvedValue;\n\tbackgroundImage?:\n\t\t| {\n\t\t\t\turl: string;\n\t\t\t\tid?: number;\n\t\t }\n\t\t| UnresolvedValue;\n\tbackgroundSize?: UnresolvedValue;\n\tbackgroundPosition?: UnresolvedValue;\n\tbackgroundRepeat?: UnresolvedValue;\n\tbackgroundAttachment?: UnresolvedValue;\n\tbackgroundBlendMode?: UnresolvedValue;\n\tbackgroundOpacity?: UnresolvedValue;\n}\n\n// =============================================================================\n// TYPOGRAPHY SYSTEM TYPES\n// =============================================================================\n\n/**\n * Fluid typography settings for responsive font sizes\n */\nexport interface FluidTypographyConfig {\n\tmin?: string;\n\tmax?: string;\n}\n\n/**\n * Typography preset (font size) definition\n */\nexport interface TypographyPreset extends BasePreset {\n\tsize: string | number | null;\n\tpreviewFontSize?: string;\n\tfluid?: boolean | FluidTypographyConfig;\n}\n\n/**\n * Font size preset definition (alias for TypographyPreset for clarity)\n */\nexport interface FontSizePreset extends TypographyPreset {}\n\n/**\n * Convenience type alias for font size data\n */\nexport type FontSize = FontSizePreset;\n\n/**\n * Font face definition as found in theme.json\n */\nexport interface FontFace {\n\tfontFamily: string;\n\tfontWeight?: string | number;\n\tfontStyle?: string;\n\tfontStretch?: string;\n\tfontDisplay?: string;\n\tsrc?: string | string[];\n}\n\n/**\n * Font family preset definition as found in theme.json\n */\nexport interface FontFamilyPreset extends BasePreset {\n\tfontFamily: string;\n\tfontFace?: FontFace[];\n}\n\n/**\n * Global fluid typography settings\n */\nexport interface FluidTypographySettings {\n\tmaxViewportWidth?: string;\n\tminFontSize?: string;\n\tminViewportWidth?: string;\n}\n\n/**\n * Typography settings collection\n */\nexport interface TypographySettings {\n\tfluid?: boolean | FluidTypographySettings;\n\tfontSizes?: TypographyPreset[] | Record< string, TypographyPreset[] >;\n\tfontFamilies?: Record< string, FontFamilyPreset[] >;\n\tdefaultFontSizes?: boolean;\n}\n\n// =============================================================================\n// LAYOUT SYSTEM TYPES\n// =============================================================================\n\n/**\n * Layout constraint settings\n */\nexport interface LayoutSettings {\n\twideSize?: string;\n\tcontentSize?: string;\n}\n\n/**\n * Spacing settings\n */\nexport interface SpacingSettings {\n\tpadding?: string | Record< string, string >;\n\tmargin?: string | Record< string, string >;\n\tblockGap?: string;\n}\n\n// =============================================================================\n// GLOBAL STYLES STRUCTURE TYPES\n// =============================================================================\n\n/**\n * Global styles settings node\n */\nexport interface GlobalStylesSettings {\n\tuseRootPaddingAwareAlignments?: boolean;\n\ttypography?: TypographySettings;\n\tlayout?: LayoutSettings;\n\tspacing?: SpacingSettings;\n\tcolor?: {\n\t\tpalette?:\n\t\t\t| Color[]\n\t\t\t| {\n\t\t\t\t\ttheme?: Color[];\n\t\t\t\t\tcustom?: Color[];\n\t\t\t\t\tdefault?: Color[];\n\t\t\t };\n\t\tgradients?: {\n\t\t\ttheme?: Gradient[];\n\t\t\tcustom?: Gradient[];\n\t\t\tdefault?: Gradient[];\n\t\t};\n\t\tduotone?: {\n\t\t\ttheme?: Duotone[];\n\t\t\tcustom?: Duotone[];\n\t\t\tdefault?: Duotone[];\n\t\t};\n\t\tlink?: boolean;\n\t\tcustom?: boolean;\n\t\tcustomGradient?: boolean;\n\t\tcustomDuotone?: boolean;\n\t\tdefaultPalette?: boolean;\n\t\tdefaultGradients?: boolean;\n\t\tdefaultDuotone?: boolean;\n\t};\n\tcustom?: Record<\n\t\tstring,\n\t\tstring | number | Record< string, string | number >\n\t>;\n\tblocks?: Record< string, Omit< GlobalStylesSettings, 'blocks' > >;\n}\n\n/**\n * Global styles values node\n */\nexport interface GlobalStylesStyles {\n\tcolor?: {\n\t\tbackground?: UnresolvedValue;\n\t\ttext?: UnresolvedValue;\n\t};\n\ttypography?: {\n\t\tfontFamily?: UnresolvedValue;\n\t\tfontSize?: UnresolvedValue;\n\t\tfontWeight?: UnresolvedValue;\n\t\tlineHeight?: UnresolvedValue;\n\t\tletterSpacing?: UnresolvedValue;\n\t\ttextTransform?: UnresolvedValue;\n\t\ttextIndent?: UnresolvedValue;\n\t};\n\tspacing?: {\n\t\tpadding?: UnresolvedValue | Record< string, UnresolvedValue >;\n\t\tmargin?: UnresolvedValue | Record< string, UnresolvedValue >;\n\t\tblockGap?: string;\n\t};\n\tbackground?: BackgroundStyle;\n\tborder?: {\n\t\tcolor?: UnresolvedValue;\n\t\twidth?: UnresolvedValue;\n\t\tstyle?: UnresolvedValue;\n\t\tradius?:\n\t\t\t| UnresolvedValue\n\t\t\t| {\n\t\t\t\t\ttopLeft?: UnresolvedValue;\n\t\t\t\t\ttopRight?: UnresolvedValue;\n\t\t\t\t\tbottomRight?: UnresolvedValue;\n\t\t\t\t\tbottomLeft?: UnresolvedValue;\n\t\t\t };\n\t\ttop?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t\tright?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t\tbottom?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t\tleft?: {\n\t\t\tcolor?: UnresolvedValue;\n\t\t\twidth?: UnresolvedValue;\n\t\t\tstyle?: UnresolvedValue;\n\t\t};\n\t};\n\tfilter?: {\n\t\tduotone?: UnresolvedValue;\n\t\topacity?: UnresolvedValue;\n\t};\n\tdimensions?: {\n\t\twidth?: UnresolvedValue;\n\t\theight?: UnresolvedValue;\n\t\tminWidth?: UnresolvedValue;\n\t\tminHeight?: UnresolvedValue;\n\t\tmaxWidth?: UnresolvedValue;\n\t\tmaxHeight?: UnresolvedValue;\n\t};\n\telements?: Record<\n\t\tstring,\n\t\tOmit< GlobalStylesStyles, 'blocks' | 'elements' | 'variations' > & {\n\t\t\t':hover'?: Omit<\n\t\t\t\tGlobalStylesStyles,\n\t\t\t\t'blocks' | 'elements' | 'variations'\n\t\t\t>;\n\t\t}\n\t>;\n\tblocks?: Record< string, Omit< GlobalStylesStyles, 'blocks' > >;\n\tvariations?: Record< string, Omit< GlobalStylesStyles, 'blocks' > >;\n\tcss?: string;\n}\n\n/**\n * Complete global styles configuration\n */\nexport interface GlobalStylesConfig {\n\tversion?: number;\n\tsettings?: GlobalStylesSettings;\n\tstyles?: GlobalStylesStyles;\n\t_links?: {\n\t\t[ 'wp:theme-file' ]?: ThemeFileLink[];\n\t\t[ 'wp:action-edit-css' ]?: Array< { href: string } >;\n\t};\n}\n\n/**\n * Style variation (extends GlobalStylesConfig with metadata)\n */\nexport interface StyleVariation extends GlobalStylesConfig {\n\ttitle?: string;\n\tdescription?: string;\n}\n\n/**\n * WordPress theme file link\n */\nexport interface ThemeFileLink {\n\tname: string;\n\thref: string;\n\ttarget?: string;\n}\n\n// =============================================================================\n// UTILITY TYPES\n// =============================================================================\n\n/**\n * Deep partial type for global styles merging\n */\nexport type DeepPartial< T > = {\n\t[ P in keyof T ]?: T[ P ] extends object ? DeepPartial< T[ P ] > : T[ P ];\n};\n\n/**\n * CSS selector string\n */\nexport type CSSSelector = string;\n\n/**\n * CSS property value\n */\nexport type CSSValue = string | number | undefined;\n\n/**\n * CSS rules object\n */\nexport type CSSRules = Record< string, CSSValue >;\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }