@wordpress/block-editor 13.0.3 → 13.0.5

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.
Files changed (85) hide show
  1. package/build/components/global-styles/background-panel.js +2 -1
  2. package/build/components/global-styles/background-panel.js.map +1 -1
  3. package/build/components/global-styles/border-panel.js +2 -1
  4. package/build/components/global-styles/border-panel.js.map +1 -1
  5. package/build/components/global-styles/color-panel.js +2 -1
  6. package/build/components/global-styles/color-panel.js.map +1 -1
  7. package/build/components/global-styles/dimensions-panel.js +2 -1
  8. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  9. package/build/components/global-styles/filters-panel.js +2 -1
  10. package/build/components/global-styles/filters-panel.js.map +1 -1
  11. package/build/components/global-styles/image-settings-panel.js +2 -1
  12. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  13. package/build/components/global-styles/typography-panel.js +2 -1
  14. package/build/components/global-styles/typography-panel.js.map +1 -1
  15. package/build/components/global-styles/use-global-styles-output.js +8 -8
  16. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  17. package/build/components/global-styles/utils.js +17 -7
  18. package/build/components/global-styles/utils.js.map +1 -1
  19. package/build/components/inspector-controls/block-support-tools-panel.js +2 -1
  20. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  21. package/build/hooks/block-style-variation.js +171 -6
  22. package/build/hooks/block-style-variation.js.map +1 -1
  23. package/build/hooks/duotone.js +16 -11
  24. package/build/hooks/duotone.js.map +1 -1
  25. package/build/hooks/index.js +7 -1
  26. package/build/hooks/index.js.map +1 -1
  27. package/build/hooks/use-bindings-attributes.js +11 -6
  28. package/build/hooks/use-bindings-attributes.js.map +1 -1
  29. package/build/hooks/utils.js +2 -0
  30. package/build/hooks/utils.js.map +1 -1
  31. package/build/private-apis.js +2 -1
  32. package/build/private-apis.js.map +1 -1
  33. package/build-module/components/global-styles/background-panel.js +3 -2
  34. package/build-module/components/global-styles/background-panel.js.map +1 -1
  35. package/build-module/components/global-styles/border-panel.js +3 -2
  36. package/build-module/components/global-styles/border-panel.js.map +1 -1
  37. package/build-module/components/global-styles/color-panel.js +3 -2
  38. package/build-module/components/global-styles/color-panel.js.map +1 -1
  39. package/build-module/components/global-styles/dimensions-panel.js +3 -2
  40. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  41. package/build-module/components/global-styles/filters-panel.js +3 -2
  42. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  43. package/build-module/components/global-styles/image-settings-panel.js +3 -2
  44. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  45. package/build-module/components/global-styles/typography-panel.js +3 -2
  46. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  47. package/build-module/components/global-styles/use-global-styles-output.js +8 -8
  48. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  49. package/build-module/components/global-styles/utils.js +15 -6
  50. package/build-module/components/global-styles/utils.js.map +1 -1
  51. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -2
  52. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  53. package/build-module/hooks/block-style-variation.js +170 -6
  54. package/build-module/hooks/block-style-variation.js.map +1 -1
  55. package/build-module/hooks/duotone.js +16 -11
  56. package/build-module/hooks/duotone.js.map +1 -1
  57. package/build-module/hooks/index.js +1 -0
  58. package/build-module/hooks/index.js.map +1 -1
  59. package/build-module/hooks/use-bindings-attributes.js +11 -6
  60. package/build-module/hooks/use-bindings-attributes.js.map +1 -1
  61. package/build-module/hooks/utils.js +2 -0
  62. package/build-module/hooks/utils.js.map +1 -1
  63. package/build-module/private-apis.js +3 -2
  64. package/build-module/private-apis.js.map +1 -1
  65. package/build-style/content-rtl.css +1 -0
  66. package/build-style/content.css +1 -0
  67. package/package.json +2 -2
  68. package/src/components/global-styles/background-panel.js +3 -2
  69. package/src/components/global-styles/border-panel.js +3 -2
  70. package/src/components/global-styles/color-panel.js +3 -2
  71. package/src/components/global-styles/dimensions-panel.js +3 -2
  72. package/src/components/global-styles/filters-panel.js +3 -2
  73. package/src/components/global-styles/image-settings-panel.js +3 -2
  74. package/src/components/global-styles/typography-panel.js +3 -2
  75. package/src/components/global-styles/use-global-styles-output.js +8 -8
  76. package/src/components/global-styles/utils.js +17 -6
  77. package/src/components/iframe/content.scss +1 -0
  78. package/src/components/inspector-controls/block-support-tools-panel.js +3 -3
  79. package/src/hooks/block-style-variation.js +204 -5
  80. package/src/hooks/duotone.js +16 -12
  81. package/src/hooks/index.js +1 -0
  82. package/src/hooks/test/get-variation-styles-with-ref-values.js +91 -0
  83. package/src/hooks/use-bindings-attributes.js +13 -4
  84. package/src/hooks/utils.js +2 -0
  85. package/src/private-apis.js +6 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_data","_element","_styleEngine","_components","_utils","_getBlockCssSelector","_typographyUtils","_context","_hooks","_utils2","_gap","_store","_definitions","_object","_lockUnlock","_themeFileUriUtils","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","kebabCase","unlock","componentsPrivateApis","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","PRESET_METADATA","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","getValueFromObjectPath","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","getDuotoneFilter","colors","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","disableRootPadding","isRoot","ROOT_BLOCK_SELECTOR","output","STYLE_PROPERTY","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","getCSSRules","rule","ruleValue","ref","refPath","getTypographyFontSizeValue","size","settings","getLayoutStyles","layoutDefinitions","LAYOUT_DEFINITIONS","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","getGapCSSValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","ROOT_CSS_PROPERTIES_SELECTOR","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","_tree$styles$blocks","nodes","ELEMENTS","elements","blocks","blockName","node","_node$elements","variations","variationName","variation","_variation$elements","_variation$blocks","css","variationSelector","styleVariationSelectors","element","elementStyles","scopeSelector","variationBlockName","variationBlockStyles","_variationBlockStyles","variationBlockSelector","variationDuotoneSelector","duotoneSelector","variationFeatureSelectors","scopeFeatureSelectors","variationBlockStyleNodes","hasLayoutSupport","variationBlockElement","variationBlockElementStyles","elementName","sel","elementSelectors","elementSelector","exports","getNodesWithSettings","_tree$settings$blocks","pickPresets","presets","setImmutably","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","styleOptions","undefined","options","layoutStyles","marginReset","rootPadding","variationStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","hasBodyStyles","featureDeclarations","cssSelector","duotoneStyles","duotoneDeclarations","styleDeclarations","processCSSNesting","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockCSSSelector","getBlockSelectors","blockTypes","getBlockStyles","variationInstanceId","duotoneSupport","getBlockSupport","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","variationSuffix","getBlockStyleVariationSelector","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processedCSS","parts","part","isRootCss","splittedPart","nestedSelector","appendToSelector","useGlobalStylesOutputWithConfig","mergedConfig","useGlobalSetting","setThemeFileUris","_links","useSelect","select","getSettings","blockEditorStore","blocksStore","useMemo","_updatedConfig$styles","updatedConfig","getBlockTypes","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged","useContext","GlobalStylesContext"],"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tROOT_CSS_PROPERTIES_SELECTOR,\n\tscopeSelector,\n\tscopeFeatureSelectors,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n} from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { getDuotoneFilter } from '../duotone/utils';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport { unlock } from '../../lock-unlock';\nimport { setThemeFileUris } from './theme-file-uri-utils';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t);\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\tgetDuotoneFilter(\n\t\t\t\t\t\t`wp-duotone-${ preset.slug }`,\n\t\t\t\t\t\tpreset.colors\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @param {boolean} disableRootPadding Whether to force disable the root padding styles.\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {},\n\tdisableRootPadding = false\n) {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\tblockStyles,\n\t\t\t\tpathToValue\n\t\t\t);\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getValueFromObjectPath( styleValue, [ prop ], false )\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tgetValueFromObjectPath( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue, false )\n\t\t\t) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set or if we're not editing a full template.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\t( useRootPaddingAlign || 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 = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = compileStyleValue(\n\t\t\t\tgetValueFromObjectPath( tree, refPath )\n\t\t\t);\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\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 {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\n\t\t\t\t\t\t\t\t\t\t}`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ 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 } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `.${ 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 ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.entries( node.variations ).forEach(\n\t\t\t\t\t( [ variationName, variation ] ) => {\n\t\t\t\t\t\tvariations[ variationName ] =\n\t\t\t\t\t\t\tpickStyleKeys( variation );\n\t\t\t\t\t\tif ( variation?.css ) {\n\t\t\t\t\t\t\tvariations[ variationName ].css = variation.css;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst variationSelector =\n\t\t\t\t\t\t\tblockSelectors[ blockName ]\n\t\t\t\t\t\t\t\t.styleVariationSelectors?.[ variationName ];\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( variation?.elements ?? {} ).forEach(\n\t\t\t\t\t\t\t( [ element, elementStyles ] ) => {\n\t\t\t\t\t\t\t\tif ( elementStyles && ELEMENTS[ element ] ) {\n\t\t\t\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\t\t\t\tstyles: elementStyles,\n\t\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\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\t// Process the variations inner block type styles.\n\t\t\t\t\t\tObject.entries( variation?.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 = scopeSelector(\n\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t.selector\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst variationDuotoneSelector = scopeSelector(\n\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t.duotoneSelector\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst variationFeatureSelectors =\n\t\t\t\t\t\t\t\t\tscopeFeatureSelectors(\n\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t\t.featureSelectors\n\t\t\t\t\t\t\t\t\t);\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\tnodes.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\tnodes.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 ( blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tlet presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = getValueFromObjectPath( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tpresets = setImmutably( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_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 blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false,\n\tdisableRootPadding = false,\n\tstyleOptions = undefined\n) => {\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, .alignwide)) { 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, .alignwide)) > .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} ) => {\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\tconst 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\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 = {};\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\truleset += `:root :where(${ selector }){${ 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\tconst 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\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\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\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,\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}\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 ) => sel + pseudoKey )\n\t\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\t\tconst pseudoRule = `${ _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 toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = (\n\tblockTypes,\n\tgetBlockStyles,\n\tvariationInstanceId\n) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\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,\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 {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\treturn config;\n}\n\nexport function processCSSNesting( css, blockSelector ) {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tconst isRootCss = ! part.includes( '{' );\n\t\tif ( isRootCss ) {\n\t\t\t// If the part doesn't contain braces, it applies to the root level.\n\t\t\tprocessedCSS += `: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 splittedPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splittedPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splittedPart;\n\t\t\tconst combinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t? scopeSelector( blockSelector, nestedSelector )\n\t\t\t\t: appendToSelector( blockSelector, nestedSelector );\n\n\t\t\tprocessedCSS += `:root :where(${ combinedSelector }){${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig(\n\tmergedConfig = {},\n\tdisableRootPadding\n) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tmergedConfig = setThemeFileUris(\n\t\tmergedConfig,\n\t\tmergedConfig?._links?.[ 'wp:theme-file' ]\n\t);\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst updatedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors\n\t\t);\n\n\t\tconst globalStyles = toStyles(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tdisableRootPadding\n\t\t);\n\t\tconst svgs = toSvgFilters( updatedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: updatedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( updatedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tupdatedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, updatedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t\tdisableRootPadding,\n\t\tgetBlockStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput( disableRootPadding = false ) {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig, disableRootPadding );\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AASA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,IAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,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MAAMlH,QAAQ,GAAGoG,cAAc,CAAEgF,SAAS,CAAC9H,IAAI,CAAE,CAACtD,QAAQ;QAC1D6B,MAAM,CAACvC,IAAI,CAAE;UACZ4H,GAAG,EAAEqD,iBAAiB,CACrBuD,aAAa,CAACjM,MAAM,CAAC4E,MAAM,CAAE2E,SAAS,CAAC9H,IAAI,CAAE,EAAE4D,GAAG,EAClDlH,QACD,CAAC;UACDmO,cAAc,EAAE;QACjB,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;IAEH,OAAO,CAAEtM,MAAM,EAAEiM,aAAa,CAAC7J,QAAQ,CAAE;EAC1C,CAAC,EAAE,CACFK,kBAAkB,EAClBC,qBAAqB,EACrB4I,YAAY,EACZhE,mBAAmB,EACnBxG,kBAAkB,EAClBiJ,cAAc,CACb,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS0C,qBAAqBA,CAAE3L,kBAAkB,GAAG,KAAK,EAAG;EACnE,MAAM;IAAE4L,MAAM,EAAEpB;EAAa,CAAC,GAAG,IAAAqB,mBAAU,EAAEC,4BAAoB,CAAC;EAClE,OAAOvB,+BAA+B,CAAEC,YAAY,EAAExK,kBAAmB,CAAC;AAC3E","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_data","_element","_styleEngine","_components","_utils","_getBlockCssSelector","_typographyUtils","_context","_hooks","_utils2","_gap","_store","_definitions","_object","_lockUnlock","_themeFileUriUtils","BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","kebabCase","unlock","componentsPrivateApis","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","PRESET_METADATA","reduce","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","getValueFromObjectPath","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","getDuotoneFilter","colors","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","concatFeatureVariationSelectorString","featureSelector","styleVariationSelector","featureSelectors","combinedSelectors","trim","getFeatureDeclarations","selectors","styles","entries","feature","isShorthand","subfeature","subfeatureSelector","subfeatureStyles","newDeclarations","getStylesDeclarations","root","featureStyles","blockStyles","useRootPaddingAlign","tree","disableRootPadding","isRoot","ROOT_BLOCK_SELECTOR","output","STYLE_PROPERTY","properties","useEngine","rootOnly","pathToValue","styleValue","entry","name","prop","cssProperty","extraRules","getCSSRules","rule","ruleValue","ref","refPath","getTypographyFontSizeValue","size","settings","getLayoutStyles","layoutDefinitions","LAYOUT_DEFINITIONS","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","getGapCSSValue","blockGap","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","ROOT_CSS_PROPERTIES_SELECTOR","validDisplayModes","displayMode","baseStyles","includes","baseStyle","STYLE_KEYS","pickStyleKeys","treeToPickFrom","pickedEntries","clonedEntries","JSON","parse","stringify","fromEntries","getNodesWithStyles","blockSelectors","_tree$styles$blocks","nodes","ELEMENTS","elements","blocks","blockName","node","_node$elements","variations","variationName","variation","_variation$elements","_variation$blocks","css","variationSelector","styleVariationSelectors","element","elementStyles","scopeSelector","variationBlockName","variationBlockStyles","_variationBlockStyles","variationBlockSelector","variationDuotoneSelector","duotoneSelector","variationFeatureSelectors","scopeFeatureSelectors","variationBlockStyleNodes","hasLayoutSupport","variationBlockElement","variationBlockElementStyles","elementName","sel","elementSelectors","elementSelector","exports","getNodesWithSettings","_tree$settings$blocks","pickPresets","presets","setImmutably","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","styleOptions","undefined","options","layoutStyles","marginReset","rootPadding","variationStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","layout","hasBodyStyles","featureDeclarations","cssSelector","duotoneStyles","duotoneDeclarations","styleDeclarations","processCSSNesting","styleVariationName","styleVariations","baseSelector","styleVariationDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getSelectorsConfig","blockType","rootSelector","config","featureKey","featureName","getBlockCSSSelector","getBlockSelectors","blockTypes","getBlockStyles","variationInstanceId","duotoneSupport","getBlockSupport","supports","__experimentalLayout","__experimentalDefault","blockStyleVariations","variationSuffix","getBlockStyleVariationSelector","updateConfigWithSeparator","needsSeparatorStyleUpdate","background","text","border","processedCSS","parts","part","isRootCss","splittedPart","nestedSelector","appendToSelector","useGlobalStylesOutputWithConfig","mergedConfig","useGlobalSetting","setThemeFileUris","_links","useSelect","select","getSettings","blockEditorStore","blocksStore","useMemo","_updatedConfig$styles","updatedConfig","getBlockTypes","customProperties","globalStyles","svgs","isGlobalStyles","assets","__unstableType","useGlobalStylesOutput","merged","useContext","GlobalStylesContext"],"sources":["@wordpress/block-editor/src/components/global-styles/use-global-styles-output.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockSupport,\n\tgetBlockTypes,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPRESET_METADATA,\n\tROOT_BLOCK_SELECTOR,\n\tROOT_CSS_PROPERTIES_SELECTOR,\n\tscopeSelector,\n\tscopeFeatureSelectors,\n\tappendToSelector,\n\tgetBlockStyleVariationSelector,\n} from './utils';\nimport { getBlockCSSSelector } from './get-block-css-selector';\nimport { getTypographyFontSizeValue } from './typography-utils';\nimport { GlobalStylesContext } from './context';\nimport { useGlobalSetting } from './hooks';\nimport { getDuotoneFilter } from '../duotone/utils';\nimport { getGapCSSValue } from '../../hooks/gap';\nimport { store as blockEditorStore } from '../../store';\nimport { LAYOUT_DEFINITIONS } from '../../layouts/definitions';\nimport { getValueFromObjectPath, setImmutably } from '../../utils/object';\nimport { unlock } from '../../lock-unlock';\nimport { setThemeFileUris } from './theme-file-uri-utils';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\nconst { kebabCase } = unlock( componentsPrivateApis );\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tif ( valueKey && ! valueFunc ) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\tvalueFunc &&\n\t\t\t\t\t\t\ttypeof valueFunc === 'function'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t\t) }: ${ valueFunc( value, mergedSettings ) }`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {?string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector = '*', blockPresets = {} ) {\n\treturn PRESET_METADATA.reduce(\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\t\tblockPresets,\n\t\t\t\tpath,\n\t\t\t\t[]\n\t\t\t);\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction getPresetsSvgFilters( blockPresets = {} ) {\n\treturn PRESET_METADATA.filter(\n\t\t// Duotone are the only type of filters for now.\n\t\t( metadata ) => metadata.path.at( -1 ) === 'duotone'\n\t).flatMap( ( metadata ) => {\n\t\tconst presetByOrigin = getValueFromObjectPath(\n\t\t\tblockPresets,\n\t\t\tmetadata.path,\n\t\t\t{}\n\t\t);\n\t\treturn [ 'default', 'theme' ]\n\t\t\t.filter( ( origin ) => presetByOrigin[ origin ] )\n\t\t\t.flatMap( ( origin ) =>\n\t\t\t\tpresetByOrigin[ origin ].map( ( preset ) =>\n\t\t\t\t\tgetDuotoneFilter(\n\t\t\t\t\t\t`wp-duotone-${ preset.slug }`,\n\t\t\t\t\t\tpreset.colors\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t)\n\t\t\t.join( '' );\n\t} );\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Gets variation selector string from feature selector.\n *\n * @param {string} featureSelector The feature selector.\n *\n * @param {string} styleVariationSelector The style variation selector.\n * @return {string} Combined selector string.\n */\nfunction concatFeatureVariationSelectorString(\n\tfeatureSelector,\n\tstyleVariationSelector\n) {\n\tconst featureSelectors = featureSelector.split( ',' );\n\tconst combinedSelectors = [];\n\tfeatureSelectors.forEach( ( selector ) => {\n\t\tcombinedSelectors.push(\n\t\t\t`${ styleVariationSelector.trim() }${ selector.trim() }`\n\t\t);\n\t} );\n\treturn combinedSelectors.join( ', ' );\n}\n\n/**\n * Generate style declarations for a block's custom feature and subfeature\n * selectors.\n *\n * NOTE: The passed `styles` object will be mutated by this function.\n *\n * @param {Object} selectors Custom selectors object for a block.\n * @param {Object} styles A block's styles object.\n *\n * @return {Object} Style declarations.\n */\nconst getFeatureDeclarations = ( selectors, styles ) => {\n\tconst declarations = {};\n\n\tObject.entries( selectors ).forEach( ( [ feature, selector ] ) => {\n\t\t// We're only processing features/subfeatures that have styles.\n\t\tif ( feature === 'root' || ! styles?.[ feature ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isShorthand = typeof selector === 'string';\n\n\t\t// If we have a selector object instead of shorthand process it.\n\t\tif ( ! isShorthand ) {\n\t\t\tObject.entries( selector ).forEach(\n\t\t\t\t( [ subfeature, subfeatureSelector ] ) => {\n\t\t\t\t\t// Don't process root feature selector yet or any\n\t\t\t\t\t// subfeature that doesn't have a style.\n\t\t\t\t\tif (\n\t\t\t\t\t\tsubfeature === 'root' ||\n\t\t\t\t\t\t! styles?.[ feature ][ subfeature ]\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a temporary styles object and build\n\t\t\t\t\t// declarations for subfeature.\n\t\t\t\t\tconst subfeatureStyles = {\n\t\t\t\t\t\t[ feature ]: {\n\t\t\t\t\t\t\t[ subfeature ]: styles[ feature ][ subfeature ],\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tconst newDeclarations =\n\t\t\t\t\t\tgetStylesDeclarations( subfeatureStyles );\n\n\t\t\t\t\t// Merge new declarations in with any others that\n\t\t\t\t\t// share the same selector.\n\t\t\t\t\tdeclarations[ subfeatureSelector ] = [\n\t\t\t\t\t\t...( declarations[ subfeatureSelector ] || [] ),\n\t\t\t\t\t\t...newDeclarations,\n\t\t\t\t\t];\n\n\t\t\t\t\t// Remove the subfeature's style now it will be\n\t\t\t\t\t// included under its own selector not the block's.\n\t\t\t\t\tdelete styles[ feature ][ subfeature ];\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Now subfeatures have been processed and removed, we can\n\t\t// process root, or shorthand, feature selectors.\n\t\tif ( isShorthand || selector.root ) {\n\t\t\tconst featureSelector = isShorthand ? selector : selector.root;\n\n\t\t\t// Create temporary style object and build declarations for feature.\n\t\t\tconst featureStyles = { [ feature ]: styles[ feature ] };\n\t\t\tconst newDeclarations = getStylesDeclarations( featureStyles );\n\n\t\t\t// Merge new declarations with any others that share the selector.\n\t\t\tdeclarations[ featureSelector ] = [\n\t\t\t\t...( declarations[ featureSelector ] || [] ),\n\t\t\t\t...newDeclarations,\n\t\t\t];\n\n\t\t\t// Remove the feature from the block's styles now as it will be\n\t\t\t// included under its own selector not the block's.\n\t\t\tdelete styles[ feature ];\n\t\t}\n\t} );\n\n\treturn declarations;\n};\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @param {string} selector The selector these declarations should attach to.\n *\n * @param {boolean} useRootPaddingAlign Whether to use CSS custom properties in root selector.\n *\n * @param {Object} tree A theme.json tree containing layout definitions.\n *\n * @param {boolean} disableRootPadding Whether to force disable the root padding styles.\n * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {},\n\tdisableRootPadding = false\n) {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = Object.entries( STYLE_PROPERTY ).reduce(\n\t\t(\n\t\t\tdeclarations,\n\t\t\t[ key, { value, properties, useEngine, rootOnly } ]\n\t\t) => {\n\t\t\tif ( rootOnly && ! isRoot ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\t\t\tconst pathToValue = value;\n\t\t\tif ( pathToValue[ 0 ] === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = getValueFromObjectPath(\n\t\t\t\tblockStyles,\n\t\t\t\tpathToValue\n\t\t\t);\n\n\t\t\t// Root-level padding styles don't currently support strings with CSS shorthand values.\n\t\t\t// This may change: https://github.com/WordPress/gutenberg/issues/40132.\n\t\t\tif (\n\t\t\t\tkey === '--wp--style--root--padding' &&\n\t\t\t\t( typeof styleValue === 'string' || ! useRootPaddingAlign )\n\t\t\t) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tif ( properties && typeof styleValue !== 'string' ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! getValueFromObjectPath( styleValue, [ prop ], false )\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = name.startsWith( '--' )\n\t\t\t\t\t\t? name\n\t\t\t\t\t\t: kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tgetValueFromObjectPath( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if (\n\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue, false )\n\t\t\t) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tgetValueFromObjectPath( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( blockStyles );\n\textraRules.forEach( ( rule ) => {\n\t\t// Don't output padding properties if padding variables are set or if we're not editing a full template.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\t( useRootPaddingAlign || 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 = rule.value;\n\t\tif ( typeof ruleValue !== 'string' && ruleValue?.ref ) {\n\t\t\tconst refPath = ruleValue.ref.split( '.' );\n\t\t\truleValue = compileStyleValue(\n\t\t\t\tgetValueFromObjectPath( tree, refPath )\n\t\t\t);\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Calculate fluid typography rules where available.\n\t\tif ( cssProperty === 'font-size' ) {\n\t\t\t/*\n\t\t\t * getTypographyFontSizeValue() will check\n\t\t\t * if fluid typography has been activated and also\n\t\t\t * whether the incoming value can be converted to a fluid value.\n\t\t\t * Values that already have a \"clamp()\" function will not pass the test,\n\t\t\t * and therefore the original $value will be returned.\n\t\t\t */\n\t\t\truleValue = getTypographyFontSizeValue(\n\t\t\t\t{ size: ruleValue },\n\t\t\t\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 {Object} props\n * @param {Object} props.layoutDefinitions Layout definitions, keyed by layout type.\n * @param {Object} props.style A style object containing spacing values.\n * @param {string} props.selector Selector used to group together layout styling rules.\n * @param {boolean} props.hasBlockGapSupport Whether or not the theme opts-in to blockGap support.\n * @param {boolean} props.hasFallbackGapSupport Whether or not the theme allows fallback gap styles.\n * @param {?string} props.fallbackGapValue An optional fallback gap value if no real gap value is available.\n * @return {string} Generated CSS rules for the layout styles.\n */\nexport function getLayoutStyles( {\n\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\tstyle,\n\tselector,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tfallbackGapValue,\n} ) {\n\tlet ruleset = '';\n\tlet gapValue = hasBlockGapSupport\n\t\t? getGapCSSValue( style?.spacing?.blockGap )\n\t\t: '';\n\n\t// Ensure a fallback gap value for the root layout definitions,\n\t// and use a fallback value if one is provided for the current block.\n\tif ( hasFallbackGapSupport ) {\n\t\tif ( selector === ROOT_BLOCK_SELECTOR ) {\n\t\t\tgapValue = ! gapValue ? '0.5em' : gapValue;\n\t\t} else if ( ! hasBlockGapSupport && fallbackGapValue ) {\n\t\t\tgapValue = fallbackGapValue;\n\t\t}\n\t}\n\n\tif ( gapValue && layoutDefinitions ) {\n\t\tObject.values( layoutDefinitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow outputting fallback gap styles for flex layout type when block gap support isn't available.\n\t\t\t\tif (\n\t\t\t\t\t! hasBlockGapSupport &&\n\t\t\t\t\t'flex' !== name &&\n\t\t\t\t\t'grid' !== name\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( spacingStyles?.length ) {\n\t\t\t\t\tspacingStyles.forEach( ( spacingStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( spacingStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( spacingStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${\n\t\t\t\t\t\t\t\t\t\t\tcssValue ? cssValue : gapValue\n\t\t\t\t\t\t\t\t\t\t}`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tlet combinedSelector = '';\n\n\t\t\t\t\t\t\tif ( ! hasBlockGapSupport ) {\n\t\t\t\t\t\t\t\t// For fallback gap styles, use lower specificity, to ensure styles do not unintentionally override theme styles.\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `:where(.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`\n\t\t\t\t\t\t\t\t\t\t: `:where(${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t })`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcombinedSelector =\n\t\t\t\t\t\t\t\t\tselector === ROOT_BLOCK_SELECTOR\n\t\t\t\t\t\t\t\t\t\t? `.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }-${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ 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 } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `.${ 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 ) {\n\tif ( ! treeToPickFrom ) {\n\t\treturn {};\n\t}\n\tconst entries = Object.entries( treeToPickFrom );\n\tconst pickedEntries = entries.filter( ( [ key ] ) =>\n\t\tSTYLE_KEYS.includes( key )\n\t);\n\t// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it\n\tconst clonedEntries = pickedEntries.map( ( [ key, style ] ) => [\n\t\tkey,\n\t\tJSON.parse( JSON.stringify( style ) ),\n\t] );\n\treturn Object.fromEntries( clonedEntries );\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\tObject.entries( ELEMENTS ).forEach( ( [ name, selector ] ) => {\n\t\tif ( tree.styles?.elements?.[ name ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: tree.styles?.elements?.[ name ],\n\t\t\t\tselector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tObject.entries( tree.styles?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockStyles = pickStyleKeys( node );\n\n\t\t\tif ( node?.variations ) {\n\t\t\t\tconst variations = {};\n\t\t\t\tObject.entries( node.variations ).forEach(\n\t\t\t\t\t( [ variationName, variation ] ) => {\n\t\t\t\t\t\tvariations[ variationName ] =\n\t\t\t\t\t\t\tpickStyleKeys( variation );\n\t\t\t\t\t\tif ( variation?.css ) {\n\t\t\t\t\t\t\tvariations[ variationName ].css = variation.css;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst variationSelector =\n\t\t\t\t\t\t\tblockSelectors[ blockName ]\n\t\t\t\t\t\t\t\t?.styleVariationSelectors?.[ variationName ];\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( variation?.elements ?? {} ).forEach(\n\t\t\t\t\t\t\t( [ element, elementStyles ] ) => {\n\t\t\t\t\t\t\t\tif ( elementStyles && ELEMENTS[ element ] ) {\n\t\t\t\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\t\t\t\tstyles: elementStyles,\n\t\t\t\t\t\t\t\t\t\tselector: scopeSelector(\n\t\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\t\tELEMENTS[ element ]\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\t// Process the variations inner block type styles.\n\t\t\t\t\t\tObject.entries( variation?.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 = scopeSelector(\n\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t?.selector\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst variationDuotoneSelector = scopeSelector(\n\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t?.duotoneSelector\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst variationFeatureSelectors =\n\t\t\t\t\t\t\t\t\tscopeFeatureSelectors(\n\t\t\t\t\t\t\t\t\t\tvariationSelector,\n\t\t\t\t\t\t\t\t\t\tblockSelectors[ variationBlockName ]\n\t\t\t\t\t\t\t\t\t\t\t?.featureSelectors\n\t\t\t\t\t\t\t\t\t);\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\tnodes.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\tnodes.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 ( blockSelectors?.[ blockName ]?.selector ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t\tstyleVariationSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].styleVariationSelectors,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tObject.entries( node?.elements ?? {} ).forEach(\n\t\t\t\t( [ elementName, value ] ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tvalue &&\n\t\t\t\t\t\tblockSelectors?.[ blockName ] &&\n\t\t\t\t\t\tELEMENTS[ elementName ]\n\t\t\t\t\t) {\n\t\t\t\t\t\tnodes.push( {\n\t\t\t\t\t\t\tstyles: value,\n\t\t\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector\n\t\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tlet presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = getValueFromObjectPath( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tpresets = setImmutably( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( Object.keys( presets ).length > 0 || custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_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 blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( Object.keys( blockPresets ).length > 0 || blockCustom ) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tpresets: blockPresets,\n\t\t\t\t\tcustom: blockCustom,\n\t\t\t\t\tselector: blockSelectors[ blockName ]?.selector,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t);\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets, tree?.settings );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset += `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = (\n\ttree,\n\tblockSelectors,\n\thasBlockGapSupport,\n\thasFallbackGapSupport,\n\tdisableLayoutStyles = false,\n\tdisableRootPadding = false,\n\tstyleOptions = undefined\n) => {\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} ) => {\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\tconst 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\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 = {};\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\truleset += `:root :where(${ selector }){${ 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\tconst 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\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\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\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,\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}\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 ) => sel + pseudoKey )\n\t\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\t\tconst pseudoRule = `${ _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 toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nconst getSelectorsConfig = ( blockType, rootSelector ) => {\n\tif (\n\t\tblockType?.selectors &&\n\t\tObject.keys( blockType.selectors ).length > 0\n\t) {\n\t\treturn blockType.selectors;\n\t}\n\n\tconst config = { root: rootSelector };\n\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t( [ featureKey, featureName ] ) => {\n\t\t\tconst featureSelector = getBlockCSSSelector(\n\t\t\t\tblockType,\n\t\t\t\tfeatureKey\n\t\t\t);\n\n\t\t\tif ( featureSelector ) {\n\t\t\t\tconfig[ featureName ] = featureSelector;\n\t\t\t}\n\t\t}\n\t);\n\n\treturn config;\n};\n\nexport const getBlockSelectors = (\n\tblockTypes,\n\tgetBlockStyles,\n\tvariationInstanceId\n) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector = getBlockCSSSelector( blockType );\n\t\tlet duotoneSelector = getBlockCSSSelector(\n\t\t\tblockType,\n\t\t\t'filter.duotone'\n\t\t);\n\n\t\t// Keep backwards compatibility for support.color.__experimentalDuotone.\n\t\tif ( ! duotoneSelector ) {\n\t\t\tconst rootSelector = getBlockCSSSelector( blockType );\n\t\t\tconst duotoneSupport = getBlockSupport(\n\t\t\t\tblockType,\n\t\t\t\t'color.__experimentalDuotone',\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tduotoneSelector =\n\t\t\t\tduotoneSupport && scopeSelector( rootSelector, duotoneSupport );\n\t\t}\n\n\t\tconst hasLayoutSupport =\n\t\t\t!! blockType?.supports?.layout ||\n\t\t\t!! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\tconst blockStyleVariations = getBlockStyles( name );\n\t\tconst styleVariationSelectors = {};\n\t\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,\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 {Object} config Theme.json configuration file object.\n * @return {Object} configTheme.json configuration file object updated.\n */\nfunction updateConfigWithSeparator( config ) {\n\tconst needsSeparatorStyleUpdate =\n\t\tconfig.styles?.blocks?.[ 'core/separator' ] &&\n\t\tconfig.styles?.blocks?.[ 'core/separator' ].color?.background &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].color?.text &&\n\t\t! config.styles?.blocks?.[ 'core/separator' ].border?.color;\n\tif ( needsSeparatorStyleUpdate ) {\n\t\treturn {\n\t\t\t...config,\n\t\t\tstyles: {\n\t\t\t\t...config.styles,\n\t\t\t\tblocks: {\n\t\t\t\t\t...config.styles.blocks,\n\t\t\t\t\t'core/separator': {\n\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ],\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...config.styles.blocks[ 'core/separator' ].color,\n\t\t\t\t\t\t\ttext: config.styles?.blocks[ 'core/separator' ]\n\t\t\t\t\t\t\t\t.color.background,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\treturn config;\n}\n\nexport function processCSSNesting( css, blockSelector ) {\n\tlet processedCSS = '';\n\n\t// Split CSS nested rules.\n\tconst parts = css.split( '&' );\n\tparts.forEach( ( part ) => {\n\t\tconst isRootCss = ! part.includes( '{' );\n\t\tif ( isRootCss ) {\n\t\t\t// If the part doesn't contain braces, it applies to the root level.\n\t\t\tprocessedCSS += `: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 splittedPart = part.replace( '}', '' ).split( '{' );\n\t\t\tif ( splittedPart.length !== 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [ nestedSelector, cssValue ] = splittedPart;\n\t\t\tconst combinedSelector = nestedSelector.startsWith( ' ' )\n\t\t\t\t? scopeSelector( blockSelector, nestedSelector )\n\t\t\t\t: appendToSelector( blockSelector, nestedSelector );\n\n\t\t\tprocessedCSS += `:root :where(${ combinedSelector }){${ cssValue.trim() }}`;\n\t\t}\n\t} );\n\treturn processedCSS;\n}\n\n/**\n * Returns the global styles output using a global styles configuration.\n * If wishing to generate global styles and settings based on the\n * global styles config loaded in the editor context, use `useGlobalStylesOutput()`.\n * The use case for a custom config is to generate bespoke styles\n * and settings for previews, or other out-of-editor experiences.\n *\n * @param {Object} mergedConfig Global styles configuration.\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutputWithConfig(\n\tmergedConfig = {},\n\tdisableRootPadding\n) {\n\tconst [ blockGap ] = useGlobalSetting( 'spacing.blockGap' );\n\tmergedConfig = setThemeFileUris(\n\t\tmergedConfig,\n\t\tmergedConfig?._links?.[ 'wp:theme-file' ]\n\t);\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\tconst { getBlockStyles } = useSelect( blocksStore );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst updatedConfig = updateConfigWithSeparator( mergedConfig );\n\n\t\tconst blockSelectors = getBlockSelectors(\n\t\t\tgetBlockTypes(),\n\t\t\tgetBlockStyles\n\t\t);\n\n\t\tconst customProperties = toCustomProperties(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors\n\t\t);\n\n\t\tconst globalStyles = toStyles(\n\t\t\tupdatedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles,\n\t\t\tdisableRootPadding\n\t\t);\n\t\tconst svgs = toSvgFilters( updatedConfig, blockSelectors );\n\n\t\tconst styles = [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t// Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor.\n\t\t\t{\n\t\t\t\tcss: updatedConfig.styles.css ?? '',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tassets: svgs,\n\t\t\t\t__unstableType: 'svg',\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t];\n\n\t\t// Loop through the blocks to check if there are custom CSS values.\n\t\t// If there are, get the block selector and push the selector together with\n\t\t// the CSS value to the 'stylesheets' array.\n\t\tgetBlockTypes().forEach( ( blockType ) => {\n\t\t\tif ( updatedConfig.styles.blocks[ blockType.name ]?.css ) {\n\t\t\t\tconst selector = blockSelectors[ blockType.name ].selector;\n\t\t\t\tstyles.push( {\n\t\t\t\t\tcss: processCSSNesting(\n\t\t\t\t\t\tupdatedConfig.styles.blocks[ blockType.name ]?.css,\n\t\t\t\t\t\tselector\n\t\t\t\t\t),\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\n\t\treturn [ styles, updatedConfig.settings ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t\tdisableRootPadding,\n\t\tgetBlockStyles,\n\t] );\n}\n\n/**\n * Returns the global styles output based on the current state of global styles config loaded in the editor context.\n *\n * @param {boolean} disableRootPadding Disable root padding styles.\n *\n * @return {Array} Array of stylesheets and settings.\n */\nexport function useGlobalStylesOutput( disableRootPadding = false ) {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\treturn useGlobalStylesOutputWithConfig( mergedConfig, disableRootPadding );\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,I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I,EAAE;MACnCM,cAAc,EAAE;IACjB,CAAC,EACD;MACCC,MAAM,EAAEF,IAAI;MACZG,cAAc,EAAE,KAAK;MACrBF,cAAc,EAAE;IACjB,CAAC,CACD;;IAED;IACA;IACA;IACA,IAAAJ,qBAAa,EAAC,CAAC,CAAC5O,OAAO,CAAIiM,SAAS,IAAM;MACzC,IAAK0C,aAAa,CAACjM,MAAM,CAAC4E,MAAM,CAAE2E,SAAS,CAAC9H,IAAI,CAAE,EAAE4D,GAAG,EAAG;QACzD,MAAMlH,QAAQ,GAAGoG,cAAc,CAAEgF,SAAS,CAAC9H,IAAI,CAAE,CAACtD,QAAQ;QAC1D6B,MAAM,CAACvC,IAAI,CAAE;UACZ4H,GAAG,EAAEqD,iBAAiB,CACrBuD,aAAa,CAACjM,MAAM,CAAC4E,MAAM,CAAE2E,SAAS,CAAC9H,IAAI,CAAE,EAAE4D,GAAG,EAClDlH,QACD,CAAC;UACDmO,cAAc,EAAE;QACjB,CAAE,CAAC;MACJ;IACD,CAAE,CAAC;IAEH,OAAO,CAAEtM,MAAM,EAAEiM,aAAa,CAAC7J,QAAQ,CAAE;EAC1C,CAAC,EAAE,CACFK,kBAAkB,EAClBC,qBAAqB,EACrB4I,YAAY,EACZhE,mBAAmB,EACnBxG,kBAAkB,EAClBiJ,cAAc,CACb,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS0C,qBAAqBA,CAAE3L,kBAAkB,GAAG,KAAK,EAAG;EACnE,MAAM;IAAE4L,MAAM,EAAEpB;EAAa,CAAC,GAAG,IAAAqB,mBAAU,EAAEC,4BAAoB,CAAC;EAClE,OAAOvB,+BAA+B,CAAEC,YAAY,EAAExK,kBAAmB,CAAC;AAC3E","ignoreList":[]}
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.TOOLSPANEL_DROPDOWNMENU_PROPS = exports.STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = exports.STYLE_PATH_TO_CSS_VAR_INFIX = exports.ROOT_CSS_PROPERTIES_SELECTOR = exports.ROOT_BLOCK_SELECTOR = exports.PRESET_METADATA = void 0;
7
+ exports.STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = exports.STYLE_PATH_TO_CSS_VAR_INFIX = exports.ROOT_CSS_PROPERTIES_SELECTOR = exports.ROOT_BLOCK_SELECTOR = exports.PRESET_METADATA = void 0;
8
8
  exports.appendToSelector = appendToSelector;
9
9
  exports.areGlobalStyleConfigsEqual = areGlobalStyleConfigsEqual;
10
10
  exports.getBlockStyleVariationSelector = getBlockStyleVariationSelector;
@@ -12,13 +12,19 @@ exports.getPresetVariableFromValue = getPresetVariableFromValue;
12
12
  exports.getValueFromVariable = getValueFromVariable;
13
13
  exports.scopeFeatureSelectors = scopeFeatureSelectors;
14
14
  exports.scopeSelector = scopeSelector;
15
+ exports.useToolsPanelDropdownMenuProps = useToolsPanelDropdownMenuProps;
15
16
  var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
17
+ var _compose = require("@wordpress/compose");
16
18
  var _typographyUtils = require("./typography-utils");
17
19
  var _object = require("../../utils/object");
18
20
  /**
19
21
  * External dependencies
20
22
  */
21
23
 
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+
22
28
  /**
23
29
  * Internal dependencies
24
30
  */
@@ -143,12 +149,16 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = exports.STYLE_PATH_TO_PRESET_BLOCK_
143
149
  'typography.fontSize': 'fontSize',
144
150
  'typography.fontFamily': 'fontFamily'
145
151
  };
146
- const TOOLSPANEL_DROPDOWNMENU_PROPS = exports.TOOLSPANEL_DROPDOWNMENU_PROPS = {
147
- popoverProps: {
148
- placement: 'left-start',
149
- offset: 259 // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
150
- }
151
- };
152
+ function useToolsPanelDropdownMenuProps() {
153
+ const isMobile = (0, _compose.useViewportMatch)('medium', '<');
154
+ return !isMobile ? {
155
+ popoverProps: {
156
+ placement: 'left-start',
157
+ // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px)
158
+ offset: 259
159
+ }
160
+ } : {};
161
+ }
152
162
  function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
153
163
  // Block presets take priority above root level presets.
154
164
  const orderedPresetsByOrigin = [(0, _object.getValueFromObjectPath)(features, ['blocks', blockName, ...presetPath]), (0, _object.getValueFromObjectPath)(features, presetPath)];