@wordpress/edit-site 4.13.1-next.957ca95e4c.0 → 4.14.1

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 (77) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-editor/index.js +20 -10
  3. package/build/components/block-editor/index.js.map +1 -1
  4. package/build/components/block-editor/resizable-editor.js +8 -1
  5. package/build/components/block-editor/resizable-editor.js.map +1 -1
  6. package/build/components/editor/index.js +9 -4
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/gradients-palette-panel.js +6 -2
  9. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  10. package/build/components/global-styles/hooks.js +5 -3
  11. package/build/components/global-styles/hooks.js.map +1 -1
  12. package/build/components/global-styles/typography-panel.js +40 -4
  13. package/build/components/global-styles/typography-panel.js.map +1 -1
  14. package/build/components/global-styles/use-global-styles-output.js +41 -29
  15. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  16. package/build/components/header/document-actions/index.js +11 -8
  17. package/build/components/header/document-actions/index.js.map +1 -1
  18. package/build/components/header/index.js +41 -5
  19. package/build/components/header/index.js.map +1 -1
  20. package/build/components/list/header.js +15 -2
  21. package/build/components/list/header.js.map +1 -1
  22. package/build/components/navigation-sidebar/navigation-panel/index.js +10 -4
  23. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  24. package/build/components/sidebar/index.js +8 -3
  25. package/build/components/sidebar/index.js.map +1 -1
  26. package/build/components/template-part-converter/convert-to-template-part.js +16 -0
  27. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  28. package/build/index.js +4 -1
  29. package/build/index.js.map +1 -1
  30. package/build-module/components/block-editor/index.js +20 -9
  31. package/build-module/components/block-editor/index.js.map +1 -1
  32. package/build-module/components/block-editor/resizable-editor.js +9 -2
  33. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  34. package/build-module/components/editor/index.js +10 -5
  35. package/build-module/components/editor/index.js.map +1 -1
  36. package/build-module/components/global-styles/gradients-palette-panel.js +6 -2
  37. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  38. package/build-module/components/global-styles/hooks.js +6 -4
  39. package/build-module/components/global-styles/hooks.js.map +1 -1
  40. package/build-module/components/global-styles/typography-panel.js +41 -5
  41. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  42. package/build-module/components/global-styles/use-global-styles-output.js +42 -30
  43. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  44. package/build-module/components/header/document-actions/index.js +12 -9
  45. package/build-module/components/header/document-actions/index.js.map +1 -1
  46. package/build-module/components/header/index.js +42 -7
  47. package/build-module/components/header/index.js.map +1 -1
  48. package/build-module/components/list/header.js +14 -2
  49. package/build-module/components/list/header.js.map +1 -1
  50. package/build-module/components/navigation-sidebar/navigation-panel/index.js +11 -5
  51. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  52. package/build-module/components/sidebar/index.js +7 -3
  53. package/build-module/components/sidebar/index.js.map +1 -1
  54. package/build-module/components/template-part-converter/convert-to-template-part.js +16 -1
  55. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  56. package/build-module/index.js +4 -1
  57. package/build-module/index.js.map +1 -1
  58. package/build-style/style-rtl.css +28 -16
  59. package/build-style/style.css +28 -16
  60. package/package.json +29 -29
  61. package/src/components/block-editor/index.js +34 -16
  62. package/src/components/block-editor/resizable-editor.js +10 -3
  63. package/src/components/code-editor/style.scss +2 -3
  64. package/src/components/editor/index.js +12 -5
  65. package/src/components/global-styles/gradients-palette-panel.js +25 -12
  66. package/src/components/global-styles/hooks.js +5 -4
  67. package/src/components/global-styles/typography-panel.js +40 -6
  68. package/src/components/global-styles/use-global-styles-output.js +66 -57
  69. package/src/components/header/document-actions/index.js +16 -9
  70. package/src/components/header/index.js +61 -21
  71. package/src/components/header/style.scss +9 -0
  72. package/src/components/list/header.js +15 -5
  73. package/src/components/navigation-sidebar/navigation-panel/index.js +30 -24
  74. package/src/components/sidebar/index.js +23 -20
  75. package/src/components/template-part-converter/convert-to-template-part.js +14 -1
  76. package/src/index.js +4 -0
  77. package/src/style.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["useHasTypographyPanel","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","hasFontStyles","hasFontWeights","TypographyPanel","element","selectedLevel","setCurrentTab","prefix","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","hasFontSizeEnabled","fontFamily","setFontFamily","fontSize","setFontSize","fontStyle","setFontStyle","fontWeight","setFontWeight","lineHeight","setLineHeight","letterSpacing","setLetterSpacing","backgroundColor","gradientValue","color","extraStyles","textDecoration","background","newFontStyle","newFontWeight"],"mappings":";;;;;;;;AAiBA;;AAdA;;AAMA;;AAOA;;AAKA;;AArBA;AACA;AACA;;AAgBA;AACA;AACA;AAGO,SAASA,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAAF,CAA7C;AACA,QAAMG,iBAAiB,GAAGC,uBAAuB,CAAEJ,IAAF,CAAjD;AACA,QAAMK,gBAAgB,GAAGC,0BAA0B,CAAEN,IAAF,CAAnD;AACA,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACCC,aAAa,IACbE,iBADA,IAEAE,gBAFA,IAGAE,QAAQ,CAACC,QAAT,CAAmB,UAAnB,CAJD;AAMA;;AAED,SAASN,uBAAT,CAAkCF,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACC,uBAAY,uBAAZ,EAAqCA,IAArC,EAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD;AAIA;;AAED,SAASJ,uBAAT,CA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FO,KADT;AAKC,IAAA,QAAQ,EAAG,SAGJ;AAAA,UAHM;AACZF,QAAAA,SAAS,EAAEc,YADC;AAEZZ,QAAAA,UAAU,EAAEa;AAFA,OAGN;AACNd,MAAAA,YAAY,CAAEa,YAAF,CAAZ;AACAX,MAAAA,aAAa,CAAEY,aAAF,CAAb;AACA,KAXF;AAYC,IAAA,aAAa,EAAGjC,aAZjB;AAaC,IAAA,cAAc,EAAGC,cAblB;AAcC,IAAA,IAAI,EAAC,kBAdN;AAeC,IAAA,uBAAuB;AAfxB,IArEF,EAuFGS,oBAAoB,IACrB,4BAAC,8BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,oBAAoB,EAAC,MAFtB;AAGC,IAAA,KAAK,EAAGY,UAHT;AAIC,IAAA,QAAQ,EAAGC,aAJZ;AAKC,IAAA,IAAI,EAAC;AALN,IAxFF,EAgGGX,uBAAuB,IACxB,4BAAC,+CAAD;AACC,IAAA,KAAK,EAAGY,aADT;AAEC,IAAA,QAAQ,EAAGC,gBAFZ;AAGC,IAAA,IAAI,EAAC,kBAHN;AAIC,IAAA,oBAAoB,EAAC;AAJtB,IAjGF,CAhBD,CADD;AA4HA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tFontSizePicker,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalGrid as Grid,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nexport function useHasTypographyPanel( name ) {\n\tconst hasLineHeight = useHasLineHeightControl( name );\n\tconst hasFontAppearance = useHasAppearanceControl( name );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( name );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasLineHeightControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.lineHeight', name )[ 0 ] &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useHasLetterSpacingControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.letterSpacing', name )[ 0 ] &&\n\t\tsupports.includes( 'letterSpacing' )\n\t);\n}\n\nexport default function TypographyPanel( { name, element } ) {\n\tconst [ selectedLevel, setCurrentTab ] = useState( 'heading' );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tlet prefix = '';\n\tif ( element === 'heading' ) {\n\t\tprefix = `elements.${ selectedLevel }.`;\n\t} else if ( element && element !== 'text' ) {\n\t\tprefix = `elements.${ element }.`;\n\t}\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t)[ 0 ];\n\tconst [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name );\n\n\t/* Disable font size controls when the option to style all headings is selected. */\n\tlet hasFontSizeEnabled = supports.includes( 'fontSize' );\n\tif ( element === 'heading' && selectedLevel === 'heading' ) {\n\t\thasFontSizeEnabled = false;\n\t}\n\n\tconst [ fontFamily, setFontFamily ] = useStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontSize, setFontSize ] = useStyle(\n\t\tprefix + 'typography.fontSize',\n\t\tname\n\t);\n\n\tconst [ fontStyle, setFontStyle ] = useStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight, setFontWeight ] = useStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ lineHeight, setLineHeight ] = useStyle(\n\t\tprefix + 'typography.lineHeight',\n\t\tname\n\t);\n\tconst [ letterSpacing, setLetterSpacing ] = useStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useStyle( prefix + 'color.background', name );\n\tconst [ gradientValue ] = useStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useStyle( prefix + 'color.text', name );\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\n\treturn (\n\t\t<PanelBody className=\"edit-site-typography-panel\" initialOpen={ true }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-typography-panel__preview\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\tcolor,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tfontStyle,\n\t\t\t\t\tfontWeight,\n\t\t\t\t\tletterSpacing,\n\t\t\t\t\t...extraStyles,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\tAa\n\t\t\t</div>\n\t\t\t<Grid columns={ 2 } rowGap={ 16 } columnGap={ 8 }>\n\t\t\t\t{ element === 'heading' && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ selectedLevel }\n\t\t\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels \n\t\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h1\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H1' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h2\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H2' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h3\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H3' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h4\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H4' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h5\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H5' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h6\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H6' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<FontFamilyControl\n\t\t\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ hasFontSizeEnabled && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<FontSizePicker\n\t\t\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ hasAppearanceControl && (\n\t\t\t\t\t<FontAppearanceControl\n\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\t\t\t\tfontWeight: newFontWeight,\n\t\t\t\t\t\t} ) => {\n\t\t\t\t\t\t\tsetFontStyle( newFontStyle );\n\t\t\t\t\t\t\tsetFontWeight( newFontWeight );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t\t<LineHeightControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t\t<LetterSpacingControl\n\t\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</Grid>\n\t\t</PanelBody>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["useHasTypographyPanel","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","hasFontStyles","hasFontWeights","element","setting","useHasTextTransformControl","TypographyPanel","selectedLevel","setCurrentTab","prefix","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","hasTextTransformControl","hasFontSizeEnabled","fontFamily","setFontFamily","fontSize","setFontSize","fontStyle","setFontStyle","fontWeight","setFontWeight","lineHeight","setLineHeight","letterSpacing","setLetterSpacing","textTransform","setTextTransform","backgroundColor","gradientValue","color","extraStyles","textDecoration","background","newFontStyle","newFontWeight"],"mappings":";;;;;;;;AAkBA;;AAfA;;AAOA;;AAOA;;AAKA;;AAtBA;AACA;AACA;;AAiBA;AACA;AACA;AAGO,SAASA,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAAF,CAA7C;AACA,QAAMG,iBAAiB,GAAGC,uBAAuB,CAAEJ,IAAF,CAAjD;AACA,QAAMK,gBAAgB,GAAGC,0BAA0B,CAAEN,IAAF,CAAnD;AACA,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACCC,aAAa,IACbE,iBADA,IAEAE,gBAFA,IAGAE,QAAQ,CAACC,QAAT,CAAmB,UAAnB,CAJD;AAMA;;AAED,SAASN,uBAAT,CAAkCF,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,SACC,uBAAY,uBAAZ,EAAqCA,IAArC,EAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD;AAIA;;AAED,SAASJ,uBAAT,CAAkCJ,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAG,2CAAgCP,IAAhC,CAAjB;AACA,QAAMS,aAAa,GAClB,uBAAY,sBAAZ,EAAoCT,IAApC,EAA4C,CAA5C,KACAO,QAAQ,CAACC,QAAT,CAAmB,WAAnB,CAFD;AAGA,QAAME,cAAc,GACnB,uBAAY,uBAAZ,EAAqCV,IAArC,EAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD;AAGA,SAAOC,aAAa,IAAIC,cAAxB;AACA;;AAED,SAASJ,0BAAT,CAAqCN,IAArC,EAA2CW,OAA3C,EAAqD;AACpD,QAAMC,OAAO,GAAG,uBAAY,0BAAZ,EAAwCZ,IAAxC,EAAgD,CAAhD,CAAhB;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AA,uBAAuB;AANxB,IADD,CAzGF,CAhBD,CADD;AAwIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n\t__experimentalTextTransformControl as TextTransformControl,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tFontSizePicker,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalGrid as Grid,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nexport function useHasTypographyPanel( name ) {\n\tconst hasLineHeight = useHasLineHeightControl( name );\n\tconst hasFontAppearance = useHasAppearanceControl( name );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( name );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasLineHeightControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.lineHeight', name )[ 0 ] &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useHasLetterSpacingControl( name, element ) {\n\tconst setting = useSetting( 'typography.letterSpacing', name )[ 0 ];\n\tif ( ! setting ) {\n\t\treturn false;\n\t}\n\tif ( ! name && element === 'heading' ) {\n\t\treturn true;\n\t}\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn supports.includes( 'letterSpacing' );\n}\n\nfunction useHasTextTransformControl( name, element ) {\n\tconst setting = useSetting( 'typography.textTransform', name )[ 0 ];\n\tif ( ! setting ) {\n\t\treturn false;\n\t}\n\tif ( ! name && element === 'heading' ) {\n\t\treturn true;\n\t}\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn supports.includes( 'textTransform' );\n}\n\nexport default function TypographyPanel( { name, element } ) {\n\tconst [ selectedLevel, setCurrentTab ] = useState( 'heading' );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tlet prefix = '';\n\tif ( element === 'heading' ) {\n\t\tprefix = `elements.${ selectedLevel }.`;\n\t} else if ( element && element !== 'text' ) {\n\t\tprefix = `elements.${ element }.`;\n\t}\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t)[ 0 ];\n\tconst [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name, element );\n\tconst hasTextTransformControl = useHasTextTransformControl( name, element );\n\n\t/* Disable font size controls when the option to style all headings is selected. */\n\tlet hasFontSizeEnabled = supports.includes( 'fontSize' );\n\tif ( element === 'heading' && selectedLevel === 'heading' ) {\n\t\thasFontSizeEnabled = false;\n\t}\n\n\tconst [ fontFamily, setFontFamily ] = useStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontSize, setFontSize ] = useStyle(\n\t\tprefix + 'typography.fontSize',\n\t\tname\n\t);\n\n\tconst [ fontStyle, setFontStyle ] = useStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight, setFontWeight ] = useStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ lineHeight, setLineHeight ] = useStyle(\n\t\tprefix + 'typography.lineHeight',\n\t\tname\n\t);\n\tconst [ letterSpacing, setLetterSpacing ] = useStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ textTransform, setTextTransform ] = useStyle(\n\t\tprefix + 'typography.textTransform',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useStyle( prefix + 'color.background', name );\n\tconst [ gradientValue ] = useStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useStyle( prefix + 'color.text', name );\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\n\treturn (\n\t\t<PanelBody className=\"edit-site-typography-panel\" initialOpen={ true }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-typography-panel__preview\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\tcolor,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tfontStyle,\n\t\t\t\t\tfontWeight,\n\t\t\t\t\tletterSpacing,\n\t\t\t\t\t...extraStyles,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\tAa\n\t\t\t</div>\n\t\t\t<Grid columns={ 2 } rowGap={ 16 } columnGap={ 8 }>\n\t\t\t\t{ element === 'heading' && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tvalue={ selectedLevel }\n\t\t\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels \n\t\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h1\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H1' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h2\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H2' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h3\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H3' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h4\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H4' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h5\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H5' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"h6\"\n\t\t\t\t\t\t\t\tlabel={ __( 'H6' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<FontFamilyControl\n\t\t\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ hasFontSizeEnabled && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<FontSizePicker\n\t\t\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ hasAppearanceControl && (\n\t\t\t\t\t<FontAppearanceControl\n\t\t\t\t\t\tvalue={ {\n\t\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\t\t\t\tfontWeight: newFontWeight,\n\t\t\t\t\t\t} ) => {\n\t\t\t\t\t\t\tsetFontStyle( newFontStyle );\n\t\t\t\t\t\t\tsetFontWeight( newFontWeight );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t\t<LineHeightControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t\t<LetterSpacingControl\n\t\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__unstableInputWidth=\"auto\"\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ hasTextTransformControl && (\n\t\t\t\t\t<div className=\"edit-site-typography-panel__full-width-control\">\n\t\t\t\t\t\t<TextTransformControl\n\t\t\t\t\t\t\tvalue={ textTransform }\n\t\t\t\t\t\t\tonChange={ setTextTransform }\n\t\t\t\t\t\t\tshowNone\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</Grid>\n\t\t</PanelBody>\n\t);\n}\n"]}
@@ -210,7 +210,7 @@ function getStylesDeclarations() {
210
210
 
211
211
  const pathToValue = value;
212
212
 
213
- if ((0, _lodash.first)(pathToValue) === 'elements' || useEngine) {
213
+ if (pathToValue[0] === 'elements' || useEngine) {
214
214
  return declarations;
215
215
  }
216
216
 
@@ -317,8 +317,8 @@ function getLayoutStyles(_ref6) {
317
317
  spacingStyles
318
318
  } = _ref7;
319
319
 
320
- // Allow skipping default layout for themes that opt-in to block styles, but opt-out of blockGap.
321
- if (!hasBlockGapSupport && 'default' === name) {
320
+ // Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
321
+ if (!hasBlockGapSupport && 'flex' !== name) {
322
322
  return;
323
323
  }
324
324
 
@@ -392,7 +392,7 @@ function getLayoutStyles(_ref6) {
392
392
  }
393
393
 
394
394
  const getNodesWithStyles = (tree, blockSelectors) => {
395
- var _tree$styles3;
395
+ var _tree$styles$blocks, _tree$styles3;
396
396
 
397
397
  const nodes = [];
398
398
 
@@ -412,9 +412,11 @@ const getNodesWithStyles = (tree, blockSelectors) => {
412
412
  });
413
413
  }
414
414
 
415
- (0, _lodash.forEach)(_blocks.__EXPERIMENTAL_ELEMENTS, (selector, name) => {
415
+ Object.entries(_blocks.__EXPERIMENTAL_ELEMENTS).forEach(_ref11 => {
416
416
  var _tree$styles;
417
417
 
418
+ let [name, selector] = _ref11;
419
+
418
420
  if (!!((_tree$styles = tree.styles) !== null && _tree$styles !== void 0 && _tree$styles.elements[name])) {
419
421
  var _tree$styles2;
420
422
 
@@ -425,9 +427,10 @@ const getNodesWithStyles = (tree, blockSelectors) => {
425
427
  }
426
428
  }); // Iterate over blocks: they can have styles & elements.
427
429
 
428
- (0, _lodash.forEach)((_tree$styles3 = tree.styles) === null || _tree$styles3 === void 0 ? void 0 : _tree$styles3.blocks, (node, blockName) => {
429
- var _blockSelectors$block;
430
+ Object.entries((_tree$styles$blocks = (_tree$styles3 = tree.styles) === null || _tree$styles3 === void 0 ? void 0 : _tree$styles3.blocks) !== null && _tree$styles$blocks !== void 0 ? _tree$styles$blocks : {}).forEach(_ref12 => {
431
+ var _blockSelectors$block, _node$elements;
430
432
 
433
+ let [blockName, node] = _ref12;
431
434
  const blockStyles = pickStyleKeys(node);
432
435
 
433
436
  if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) {
@@ -441,7 +444,9 @@ const getNodesWithStyles = (tree, blockSelectors) => {
441
444
  });
442
445
  }
443
446
 
444
- (0, _lodash.forEach)(node === null || node === void 0 ? void 0 : node.elements, (value, elementName) => {
447
+ Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref13 => {
448
+ let [elementName, value] = _ref13;
449
+
445
450
  if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(_blocks.__EXPERIMENTAL_ELEMENTS !== null && _blocks.__EXPERIMENTAL_ELEMENTS !== void 0 && _blocks.__EXPERIMENTAL_ELEMENTS[elementName])) {
446
451
  nodes.push({
447
452
  styles: value,
@@ -460,7 +465,7 @@ const getNodesWithStyles = (tree, blockSelectors) => {
460
465
  exports.getNodesWithStyles = getNodesWithStyles;
461
466
 
462
467
  const getNodesWithSettings = (tree, blockSelectors) => {
463
- var _tree$settings3, _tree$settings4;
468
+ var _tree$settings3, _tree$settings$blocks, _tree$settings4;
464
469
 
465
470
  const nodes = [];
466
471
 
@@ -471,10 +476,10 @@ const getNodesWithSettings = (tree, blockSelectors) => {
471
476
  const pickPresets = treeToPickFrom => {
472
477
  const presets = {};
473
478
 
474
- _utils.PRESET_METADATA.forEach(_ref11 => {
479
+ _utils.PRESET_METADATA.forEach(_ref14 => {
475
480
  let {
476
481
  path
477
- } = _ref11;
482
+ } = _ref14;
478
483
  const value = (0, _lodash.get)(treeToPickFrom, path, false);
479
484
 
480
485
  if (value !== false) {
@@ -498,7 +503,8 @@ const getNodesWithSettings = (tree, blockSelectors) => {
498
503
  } // Blocks.
499
504
 
500
505
 
501
- (0, _lodash.forEach)((_tree$settings4 = tree.settings) === null || _tree$settings4 === void 0 ? void 0 : _tree$settings4.blocks, (node, blockName) => {
506
+ Object.entries((_tree$settings$blocks = (_tree$settings4 = tree.settings) === null || _tree$settings4 === void 0 ? void 0 : _tree$settings4.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(_ref15 => {
507
+ let [blockName, node] = _ref15;
502
508
  const blockPresets = pickPresets(node);
503
509
  const blockCustom = node.custom;
504
510
 
@@ -518,12 +524,12 @@ exports.getNodesWithSettings = getNodesWithSettings;
518
524
  const toCustomProperties = (tree, blockSelectors) => {
519
525
  const settings = getNodesWithSettings(tree, blockSelectors);
520
526
  let ruleset = '';
521
- settings.forEach(_ref12 => {
527
+ settings.forEach(_ref16 => {
522
528
  let {
523
529
  presets,
524
530
  custom,
525
531
  selector
526
- } = _ref12;
532
+ } = _ref16;
527
533
  const declarations = getPresetsDeclarations(presets, tree === null || tree === void 0 ? void 0 : tree.settings);
528
534
  const customProps = flattenTree(custom, '--wp--custom--', '--');
529
535
 
@@ -571,11 +577,17 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
571
577
  }
572
578
 
573
579
  if (useRootPaddingAlign) {
574
- ruleset += 'padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } .has-global-padding > .alignfull > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left);';
580
+ ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
581
+ .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
582
+ .has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
583
+ .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
584
+ .has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
585
+ .has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
586
+ .has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
575
587
  }
576
588
 
577
589
  ruleset += '}';
578
- nodesWithStyles.forEach(_ref13 => {
590
+ nodesWithStyles.forEach(_ref17 => {
579
591
  let {
580
592
  selector,
581
593
  duotoneSelector,
@@ -583,13 +595,13 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
583
595
  fallbackGapValue,
584
596
  hasLayoutSupport,
585
597
  featureSelectors
586
- } = _ref13;
598
+ } = _ref17;
587
599
 
588
600
  // Process styles for block support features with custom feature level
589
601
  // CSS selectors set.
590
602
  if (featureSelectors) {
591
- Object.entries(featureSelectors).forEach(_ref14 => {
592
- let [featureName, featureSelector] = _ref14;
603
+ Object.entries(featureSelectors).forEach(_ref18 => {
604
+ let [featureName, featureSelector] = _ref18;
593
605
 
594
606
  if (styles !== null && styles !== void 0 && styles[featureName]) {
595
607
  const featureStyles = {
@@ -641,14 +653,14 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
641
653
  } // Check for pseudo selector in `styles` and handle separately.
642
654
 
643
655
 
644
- const pseudoSelectorStyles = Object.entries(styles).filter(_ref15 => {
645
- let [key] = _ref15;
656
+ const pseudoSelectorStyles = Object.entries(styles).filter(_ref19 => {
657
+ let [key] = _ref19;
646
658
  return key.startsWith(':');
647
659
  });
648
660
 
649
661
  if (pseudoSelectorStyles !== null && pseudoSelectorStyles !== void 0 && pseudoSelectorStyles.length) {
650
- pseudoSelectorStyles.forEach(_ref16 => {
651
- let [pseudoKey, pseudoStyle] = _ref16;
662
+ pseudoSelectorStyles.forEach(_ref20 => {
663
+ let [pseudoKey, pseudoStyle] = _ref20;
652
664
  const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
653
665
 
654
666
  if (!(pseudoDeclarations !== null && pseudoDeclarations !== void 0 && pseudoDeclarations.length)) {
@@ -684,11 +696,11 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
684
696
  ruleset = ruleset + `.wp-site-blocks > * + * { margin-block-start: ${gapValue}; }`;
685
697
  }
686
698
 
687
- nodesWithSettings.forEach(_ref17 => {
699
+ nodesWithSettings.forEach(_ref21 => {
688
700
  let {
689
701
  selector,
690
702
  presets
691
- } = _ref17;
703
+ } = _ref21;
692
704
 
693
705
  if (_utils.ROOT_BLOCK_SELECTOR === selector) {
694
706
  // Do not add extra specificity for top-level classes.
@@ -708,10 +720,10 @@ exports.toStyles = toStyles;
708
720
 
709
721
  function toSvgFilters(tree, blockSelectors) {
710
722
  const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
711
- return nodesWithSettings.flatMap(_ref18 => {
723
+ return nodesWithSettings.flatMap(_ref22 => {
712
724
  let {
713
725
  presets
714
- } = _ref18;
726
+ } = _ref22;
715
727
  return getPresetsSvgFilters(presets);
716
728
  });
717
729
  }
@@ -728,10 +740,10 @@ const getBlockSelectors = blockTypes => {
728
740
  const fallbackGapValue = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports4 = blockType.supports) === null || _blockType$supports4 === void 0 ? void 0 : (_blockType$supports4$ = _blockType$supports4.spacing) === null || _blockType$supports4$ === void 0 ? void 0 : (_blockType$supports4$2 = _blockType$supports4$.blockGap) === null || _blockType$supports4$2 === void 0 ? void 0 : _blockType$supports4$2.__experimentalDefault; // For each block support feature add any custom selectors.
729
741
 
730
742
  const featureSelectors = {};
731
- Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref19 => {
743
+ Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref23 => {
732
744
  var _blockType$supports5, _blockType$supports5$;
733
745
 
734
- let [featureKey, featureName] = _ref19;
746
+ let [featureKey, featureName] = _ref23;
735
747
  const featureSelector = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports5 = blockType.supports) === null || _blockType$supports5 === void 0 ? void 0 : (_blockType$supports5$ = _blockType$supports5[featureKey]) === null || _blockType$supports5$ === void 0 ? void 0 : _blockType$supports5$.__experimentalSelector;
736
748
 
737
749
  if (featureSelector) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","PRESET_METADATA","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","useRootPaddingAlign","tree","isRoot","ROOT_BLOCK_SELECTOR","output","STYLE_PROPERTY","properties","useEngine","rootOnly","pathToValue","styleValue","entries","entry","name","prop","cssProperty","extraRules","rule","ruleValue","ref","refPath","getLayoutStyles","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","blockGap","settings","layout","definitions","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","getNodesWithStyles","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","ELEMENTS","elements","blocks","node","blockName","duotoneSelector","hasLayoutSupport","featureSelectors","elementName","sel","elementSelectors","elementSelector","getNodesWithSettings","pickPresets","presets","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","featureName","featureSelector","featureStyles","featureDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","__experimentalDuotone","__experimentalLayout","__experimentalDefault","featureKey","undefined","useGlobalStylesOutput","merged","mergedConfig","GlobalStylesContext","select","getSettings","blockEditorStore","customProperties","globalStyles","filters","stylesheets","css","isGlobalStyles"],"mappings":";;;;;;;;;;;;;AAuBA;;AApBA;;AAcA;;AAKA;;AAEA;;AACA;;AASA;;AACA;;AACA;;AApCA;AACA;AACA;;AAYA;AACA;AACA;;AAeA;AACA;AACA;AAKA;AACA;AACA,MAAMA,qCAAqC,GAAG;AAC7CC,EAAAA,oBAAoB,EAAE,QADuB;AAE7CC,EAAAA,KAAK,EAAE,OAFsC;AAG7CC,EAAAA,OAAO,EAAE,SAHoC;AAI7CC,EAAAA,UAAU,EAAE;AAJiC,CAA9C;;AAOA,SAASC,iBAAT,CAA4BC,eAA5B,EAA8C;AAAA;;AAC7C,QAAMC,yBAAyB,GAAG,MAAlC;AACA,QAAMC,uCAAuC,GAAG,GAAhD;AACA,QAAMC,mCAAmC,GAAG,IAA5C;;AAEA,MAAKH,eAAL,aAAKA,eAAL,wCAAKA,eAAe,CAAEI,UAAtB,kDAAK,2BAAAJ,eAAe,EAAgBC,yBAAhB,CAApB,EAAkE;AACjE,UAAMI,QAAQ,GAAGL,eAAe,CAC9BM,KADe,CACRL,yBAAyB,CAACM,MADlB,EAEfC,KAFe,CAERN,uCAFQ,EAGfO,IAHe,CAGTN,mCAHS,CAAjB;AAIA,WAAQ,aAAaE,QAAU,GAA/B;AACA;;AACD,SAAOL,eAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;A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rB,QAAK,EAAE+B,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAEtD,MAAhB,KAA0B,EAAEsD,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAExE,QAAhB,CAA/B,EAA0D;AACzD,aAAO,EAAP;AACA;;AAED,UAAMgB,cAAc,GAAG4C,iBAAiB,CAAE,4BAAF,CAAxC;AACA,UAAMiB,gBAAgB,GAAGvC,kBAAkB,CAC1CkC,YAD0C,EAE1CxD,cAF0C,CAA3C;AAIA,UAAM8D,YAAY,GAAGtC,QAAQ,CAC5BgC,YAD4B,EAE5BxD,cAF4B,EAG5BtB,kBAH4B,EAI5BC,qBAJ4B,EAK5B8C,mBAL4B,CAA7B;AAOA,UAAMsC,OAAO,GAAGpB,YAAY,CAAEa,YAAF,EAAgBxD,cAAhB,CAA5B;AACA,UAAMgE,WAAW,GAAG,CACnB;AACCC,MAAAA,GAAG,EAAEJ,gBADN;AAECK,MAAAA,cAAc,EAAE;AAFjB,KADmB,EAKnB;AACCD,MAAAA,GAAG,EAAEH,YADN;AAECI,MAAAA,cAAc,EAAE;AAFjB,KALmB,CAApB;AAWA,WAAO,CAAEF,WAAF,EAAeR,YAAY,CAACxE,QAA5B,EAAsC+E,OAAtC,CAAP;AACA,GA9BM,EA8BJ,CACFrF,kBADE,EAEFC,qBAFE,EAGF6E,YAHE,EAIF/B,mBAJE,CA9BI,CAAP;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\tisEmpty,\n\tkebabCase,\n\tpickBy,\n\treduce,\n\tset,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport {\n\t__unstablePresetDuotoneFilter as PresetDuotoneFilter,\n\t__experimentalGetGapCSSValue as getGapCSSValue,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR, scopeSelector } from './utils';\nimport { GlobalStylesContext } from './context';\nimport { useSetting } from './hooks';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\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 reduce(\n\t\tPRESET_METADATA,\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 = get( blockPresets, path, [] );\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 = get( blockPresets, metadata.path, {} );\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\t<PresetDuotoneFilter\n\t\t\t\t\t\tpreset={ preset }\n\t\t\t\t\t\tkey={ preset.slug }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t);\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 * 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 * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {}\n) {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties, useEngine, rootOnly }, key ) => {\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 ( first( pathToValue ) === 'elements' || useEngine ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\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 ( ! get( styleValue, [ prop ], false ) ) {\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\tget( 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 ( get( blockStyles, pathToValue, false ) ) {\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\tget( 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.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\tuseRootPaddingAlign &&\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 = get( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || !! ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\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.tree A theme.json tree containing layout definitions.\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\ttree,\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 && tree?.settings?.layout?.definitions ) {\n\t\tObject.values( tree.settings.layout.definitions ).forEach(\n\t\t\t( { className, name, spacingStyles } ) => {\n\t\t\t\t// Allow skipping default layout for themes that opt-in to block styles, but opt-out of blockGap.\n\t\t\t\tif ( ! hasBlockGapSupport && 'default' === name ) {\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? `${ selector } .${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif (\n\t\tselector === ROOT_BLOCK_SELECTOR &&\n\t\ttree?.settings?.layout?.definitions\n\t) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( tree.settings.layout.definitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography', 'filter' ].includes(\n\t\t\t\tkey\n\t\t\t)\n\t\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\tforEach( ELEMENTS, ( selector, name ) => {\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\tforEach( tree.styles?.blocks, ( node, blockName ) => {\n\t\tconst blockStyles = pickStyleKeys( node );\n\t\tif ( !! blockStyles && !! blockSelectors?.[ blockName ]?.selector ) {\n\t\t\tnodes.push( {\n\t\t\t\tduotoneSelector: blockSelectors[ blockName ].duotoneSelector,\n\t\t\t\tfallbackGapValue: blockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\thasLayoutSupport: blockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\tstyles: blockStyles,\n\t\t\t\tfeatureSelectors: blockSelectors[ blockName ].featureSelectors,\n\t\t\t} );\n\t\t}\n\n\t\tforEach( node?.elements, ( value, elementName ) => {\n\t\t\tif (\n\t\t\t\t!! value &&\n\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t!! ELEMENTS?.[ elementName ]\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tstyles: value,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector\n\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t.map( ( sel ) => {\n\t\t\t\t\t\t\tconst elementSelectors =\n\t\t\t\t\t\t\t\tELEMENTS[ elementName ].split( ',' );\n\t\t\t\t\t\t\treturn elementSelectors.map(\n\t\t\t\t\t\t\t\t( elementSelector ) =>\n\t\t\t\t\t\t\t\t\tsel + ' ' + elementSelector\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} )\n\t\t\t\t\t\t.join( ',' ),\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\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( 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 ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tforEach( tree.settings?.blocks, ( node, blockName ) => {\n\t\tconst blockPresets = pickPresets( node );\n\t\tconst blockCustom = node.custom;\n\t\tif ( ! isEmpty( blockPresets ) || !! blockCustom ) {\n\t\t\tnodes.push( {\n\t\t\t\tpresets: blockPresets,\n\t\t\t\tcustom: blockCustom,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\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 = ruleset + `${ 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) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\tif ( useRootPaddingAlign ) {\n\t\truleset +=\n\t\t\t'padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } .has-global-padding > .alignfull > :where([class*=\"wp-block-\"]:not(.alignfull):not([class*=\"__\"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left);';\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tObject.entries( featureSelectors ).forEach(\n\t\t\t\t\t( [ featureName, featureSelector ] ) => {\n\t\t\t\t\t\tif ( styles?.[ featureName ] ) {\n\t\t\t\t\t\t\tconst featureStyles = {\n\t\t\t\t\t\t\t\t[ featureName ]: styles[ featureName ],\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations( featureStyles );\n\t\t\t\t\t\t\tdelete styles[ featureName ];\n\n\t\t\t\t\t\t\tif ( !! featureDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset =\n\t\t\t\t\t\t\t\t\truleset +\n\t\t\t\t\t\t\t\t\t`${ featureSelector }{${ featureDeclarations.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}\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\tconst duotoneStyles = {};\n\t\t\tif ( styles?.filter ) {\n\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\tdelete styles.filter;\n\t\t\t}\n\n\t\t\t// Process duotone styles (they use color.__experimentalDuotone selector).\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length > 0 ) {\n\t\t\t\t\truleset =\n\t\t\t\t\t\truleset +\n\t\t\t\t\t\t`${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\ttree,\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset =\n\t\t\t\t\truleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset = ruleset + pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`.wp-site-blocks > * + * { margin-block-start: ${ gapValue }; }`;\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nexport const getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tconst duotoneSelector =\n\t\t\tblockType?.supports?.color?.__experimentalDuotone ?? null;\n\t\tconst hasLayoutSupport = !! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = {};\n\t\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t\t( [ featureKey, featureName ] ) => {\n\t\t\t\tconst featureSelector =\n\t\t\t\t\tblockType?.supports?.[ featureKey ]?.__experimentalSelector;\n\n\t\t\t\tif ( featureSelector ) {\n\t\t\t\t\tfeatureSelectors[ featureName ] = scopeSelector(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\tfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t);\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};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\tconst [ blockGap ] = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles\n\t\t);\n\t\tconst filters = toSvgFilters( mergedConfig, blockSelectors );\n\t\tconst stylesheets = [\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];\n\n\t\treturn [ stylesheets, mergedConfig.settings, filters ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS","__experimentalBorder","color","spacing","typography","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","startsWith","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","mergedSettings","PRESET_METADATA","declarations","path","valueKey","valueFunc","cssVarInfix","presetByOrigin","forEach","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","getPresetsSvgFilters","filter","metadata","at","flatMap","preset","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","useRootPaddingAlign","tree","isRoot","ROOT_BLOCK_SELECTOR","output","STYLE_PROPERTY","properties","useEngine","rootOnly","pathToValue","styleValue","entries","entry","name","prop","cssProperty","extraRules","rule","ruleValue","ref","refPath","getLayoutStyles","style","hasBlockGapSupport","hasFallbackGapSupport","fallbackGapValue","ruleset","gapValue","blockGap","settings","layout","definitions","values","className","spacingStyles","spacingStyle","rules","cssValue","combinedSelector","validDisplayModes","displayMode","baseStyles","includes","baseStyle","getNodesWithStyles","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","ELEMENTS","elements","blocks","blockName","node","duotoneSelector","hasLayoutSupport","featureSelectors","elementName","sel","elementSelectors","elementSelector","getNodesWithSettings","pickPresets","presets","custom","blockCustom","toCustomProperties","customProps","toStyles","disableLayoutStyles","nodesWithStyles","nodesWithSettings","useRootPaddingAwareAlignments","contentSize","wideSize","featureName","featureSelector","featureStyles","featureDeclarations","duotoneStyles","duotoneDeclarations","pseudoSelectorStyles","pseudoKey","pseudoStyle","pseudoDeclarations","_selector","pseudoRule","toSvgFilters","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","__experimentalDuotone","__experimentalLayout","__experimentalDefault","featureKey","undefined","useGlobalStylesOutput","merged","mergedConfig","GlobalStylesContext","select","getSettings","blockEditorStore","customProperties","globalStyles","filters","stylesheets","css","isGlobalStyles"],"mappings":";;;;;;;;;;;;;AAcA;;AAXA;;AAKA;;AAKA;;AAEA;;AACA;;AASA;;AACA;;AACA;;AA3BA;AACA;AACA;;AAGA;AACA;AACA;;AAeA;AACA;AACA;AAKA;AACA;AACA,MAAMA,qCAAqC,GAAG;AAC7CC,EAAAA,oBAAoB,EAAE,QADuB;AAE7CC,EAAAA,KAAK,EAAE,OAFsC;AAG7CC,EAAAA,OAAO,EAAE,SAHoC;AAI7CC,EAAAA,UAAU,EAAE;AAJiC,CAA9C;;AAOA,SAASC,iBAAT,CAA4BC,eAA5B,EAA8C;AAAA;;AAC7C,QAAMC,yBAAyB,GAAG,MAAlC;AACA,QAAMC,uCAAuC,GAAG,GAAhD;AACA,QAAMC,mCAAmC,GAAG,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AA5B;AACA,UAAMgE,WAAW,GAAG,CACnB;AACCC,MAAAA,GAAG,EAAEJ,gBADN;AAECK,MAAAA,cAAc,EAAE;AAFjB,KADmB,EAKnB;AACCD,MAAAA,GAAG,EAAEH,YADN;AAECI,MAAAA,cAAc,EAAE;AAFjB,KALmB,CAApB;AAWA,WAAO,CAAEF,WAAF,EAAeR,YAAY,CAACxE,QAA5B,EAAsC+E,OAAtC,CAAP;AACA,GA9BM,EA8BJ,CACFrF,kBADE,EAEFC,qBAFE,EAGF6E,YAHE,EAIF/B,mBAJE,CA9BI,CAAP;AAoCA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, isEmpty, kebabCase, pickBy, reduce, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { getCSSRules } from '@wordpress/style-engine';\nimport {\n\t__unstablePresetDuotoneFilter as PresetDuotoneFilter,\n\t__experimentalGetGapCSSValue as getGapCSSValue,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR, scopeSelector } from './utils';\nimport { GlobalStylesContext } from './context';\nimport { useSetting } from './hooks';\n\n// List of block support features that can have their related styles\n// generated under their own feature level selector rather than the block's.\nconst BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = {\n\t__experimentalBorder: 'border',\n\tcolor: 'color',\n\tspacing: 'spacing',\n\ttypography: 'typography',\n};\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\n\tif ( uncompiledValue?.startsWith?.( VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n * @param {Object} mergedSettings Merged theme.json settings.\n *\n * @return {Array<Object>} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {}, mergedSettings ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\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 reduce(\n\t\tPRESET_METADATA,\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 = get( blockPresets, path, [] );\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 = get( blockPresets, metadata.path, {} );\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\t<PresetDuotoneFilter\n\t\t\t\t\t\tpreset={ preset }\n\t\t\t\t\t\tkey={ preset.slug }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t);\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 * 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 * @return {Array} An array of style declarations.\n */\nexport function getStylesDeclarations(\n\tblockStyles = {},\n\tselector = '',\n\tuseRootPaddingAlign,\n\ttree = {}\n) {\n\tconst isRoot = ROOT_BLOCK_SELECTOR === selector;\n\tconst output = reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties, useEngine, rootOnly }, key ) => {\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 = get( blockStyles, pathToValue );\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 ( ! get( styleValue, [ prop ], false ) ) {\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\tget( 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 ( get( blockStyles, pathToValue, false ) ) {\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\tget( 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.\n\t\tif (\n\t\t\tisRoot &&\n\t\t\tuseRootPaddingAlign &&\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 = get( tree, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! ruleValue || !! ruleValue?.ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\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.tree A theme.json tree containing layout definitions.\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\ttree,\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 && tree?.settings?.layout?.definitions ) {\n\t\tObject.values( tree.settings.layout.definitions ).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 ( ! hasBlockGapSupport && 'flex' !== name ) {\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? `${ selector } .${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`\n\t\t\t\t\t\t\t\t\t\t: `${ selector }.${ className }${\n\t\t\t\t\t\t\t\t\t\t\t\tspacingStyle?.selector || ''\n\t\t\t\t\t\t\t\t\t\t }`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t// For backwards compatibility, ensure the legacy block gap CSS variable is still available.\n\t\tif ( selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport ) {\n\t\t\truleset += `${ selector } { --wp--style--block-gap: ${ gapValue }; }`;\n\t\t}\n\t}\n\n\t// Output base styles\n\tif (\n\t\tselector === ROOT_BLOCK_SELECTOR &&\n\t\ttree?.settings?.layout?.definitions\n\t) {\n\t\tconst validDisplayModes = [ 'block', 'flex', 'grid' ];\n\t\tObject.values( tree.settings.layout.definitions ).forEach(\n\t\t\t( { className, displayMode, baseStyles } ) => {\n\t\t\t\tif (\n\t\t\t\t\tdisplayMode &&\n\t\t\t\t\tvalidDisplayModes.includes( displayMode )\n\t\t\t\t) {\n\t\t\t\t\truleset += `${ selector } .${ className } { display:${ displayMode }; }`;\n\t\t\t\t}\n\n\t\t\t\tif ( baseStyles?.length ) {\n\t\t\t\t\tbaseStyles.forEach( ( baseStyle ) => {\n\t\t\t\t\t\tconst declarations = [];\n\n\t\t\t\t\t\tif ( baseStyle.rules ) {\n\t\t\t\t\t\t\tObject.entries( baseStyle.rules ).forEach(\n\t\t\t\t\t\t\t\t( [ cssProperty, cssValue ] ) => {\n\t\t\t\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t\t\t\t`${ cssProperty }: ${ cssValue }`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( declarations.length ) {\n\t\t\t\t\t\t\tconst combinedSelector = `${ selector } .${ className }${\n\t\t\t\t\t\t\t\tbaseStyle?.selector || ''\n\t\t\t\t\t\t\t}`;\n\t\t\t\t\t\t\truleset += `${ combinedSelector } { ${ declarations.join(\n\t\t\t\t\t\t\t\t'; '\n\t\t\t\t\t\t\t) }; }`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\treturn ruleset;\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography', 'filter' ].includes(\n\t\t\t\tkey\n\t\t\t)\n\t\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\t\t\tif (\n\t\t\t\t!! blockStyles &&\n\t\t\t\t!! blockSelectors?.[ blockName ]?.selector\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tduotoneSelector:\n\t\t\t\t\t\tblockSelectors[ blockName ].duotoneSelector,\n\t\t\t\t\tfallbackGapValue:\n\t\t\t\t\t\tblockSelectors[ blockName ].fallbackGapValue,\n\t\t\t\t\thasLayoutSupport:\n\t\t\t\t\t\tblockSelectors[ blockName ].hasLayoutSupport,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t\t\tstyles: blockStyles,\n\t\t\t\t\tfeatureSelectors:\n\t\t\t\t\t\tblockSelectors[ blockName ].featureSelectors,\n\t\t\t\t} );\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\t!! value &&\n\t\t\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t\t\t!! ELEMENTS?.[ 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\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( 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 ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tObject.entries( tree.settings?.blocks ?? {} ).forEach(\n\t\t( [ blockName, node ] ) => {\n\t\t\tconst blockPresets = pickPresets( node );\n\t\t\tconst blockCustom = node.custom;\n\t\t\tif ( ! isEmpty( blockPresets ) || !! 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 = ruleset + `${ 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) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\tconst useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments;\n\tconst { contentSize, wideSize } = tree?.settings?.layout || {};\n\n\t/*\n\t * Reset default browser margin on the root body element.\n\t * This is set on the root selector **before** generating the ruleset\n\t * from the `theme.json`. This is to ensure that if the `theme.json` declares\n\t * `margin` in its `spacing` declaration for the `body` element then these\n\t * user-generated values take precedence in the CSS cascade.\n\t * @link https://github.com/WordPress/gutenberg/issues/36147.\n\t */\n\tlet ruleset = 'body {margin: 0;';\n\n\tif ( contentSize ) {\n\t\truleset += ` --wp--style--global--content-size: ${ contentSize };`;\n\t}\n\n\tif ( wideSize ) {\n\t\truleset += ` --wp--style--global--wide-size: ${ wideSize };`;\n\t}\n\n\tif ( useRootPaddingAlign ) {\n\t\truleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } \n\t\t\t.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } \n\t\t\t.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; } \n\t\t\t.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } \n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; } \n\t\t\t.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*=\"wp-block-\"]:not(.alignfull):not([class*=\"__\"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } \n\t\t\t.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*=\"wp-block-\"]:not(.alignfull):not([class*=\"__\"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;\n\t}\n\n\truleset += '}';\n\n\tnodesWithStyles.forEach(\n\t\t( {\n\t\t\tselector,\n\t\t\tduotoneSelector,\n\t\t\tstyles,\n\t\t\tfallbackGapValue,\n\t\t\thasLayoutSupport,\n\t\t\tfeatureSelectors,\n\t\t} ) => {\n\t\t\t// Process styles for block support features with custom feature level\n\t\t\t// CSS selectors set.\n\t\t\tif ( featureSelectors ) {\n\t\t\t\tObject.entries( featureSelectors ).forEach(\n\t\t\t\t\t( [ featureName, featureSelector ] ) => {\n\t\t\t\t\t\tif ( styles?.[ featureName ] ) {\n\t\t\t\t\t\t\tconst featureStyles = {\n\t\t\t\t\t\t\t\t[ featureName ]: styles[ featureName ],\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tconst featureDeclarations =\n\t\t\t\t\t\t\t\tgetStylesDeclarations( featureStyles );\n\t\t\t\t\t\t\tdelete styles[ featureName ];\n\n\t\t\t\t\t\t\tif ( !! featureDeclarations.length ) {\n\t\t\t\t\t\t\t\truleset =\n\t\t\t\t\t\t\t\t\truleset +\n\t\t\t\t\t\t\t\t\t`${ featureSelector }{${ featureDeclarations.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}\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\tconst duotoneStyles = {};\n\t\t\tif ( styles?.filter ) {\n\t\t\t\tduotoneStyles.filter = styles.filter;\n\t\t\t\tdelete styles.filter;\n\t\t\t}\n\n\t\t\t// Process duotone styles (they use color.__experimentalDuotone selector).\n\t\t\tif ( duotoneSelector ) {\n\t\t\t\tconst duotoneDeclarations =\n\t\t\t\t\tgetStylesDeclarations( duotoneStyles );\n\t\t\t\tif ( duotoneDeclarations.length > 0 ) {\n\t\t\t\t\truleset =\n\t\t\t\t\t\truleset +\n\t\t\t\t\t\t`${ duotoneSelector }{${ duotoneDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process blockGap and layout styles.\n\t\t\tif (\n\t\t\t\t! disableLayoutStyles &&\n\t\t\t\t( ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport )\n\t\t\t) {\n\t\t\t\truleset += getLayoutStyles( {\n\t\t\t\t\ttree,\n\t\t\t\t\tstyle: styles,\n\t\t\t\t\tselector,\n\t\t\t\t\thasBlockGapSupport,\n\t\t\t\t\thasFallbackGapSupport,\n\t\t\t\t\tfallbackGapValue,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// Process the remaining block styles (they use either normal block class or __experimentalSelector).\n\t\t\tconst declarations = getStylesDeclarations(\n\t\t\t\tstyles,\n\t\t\t\tselector,\n\t\t\t\tuseRootPaddingAlign,\n\t\t\t\ttree\n\t\t\t);\n\t\t\tif ( declarations?.length ) {\n\t\t\t\truleset =\n\t\t\t\t\truleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t\t}\n\n\t\t\t// Check for pseudo selector in `styles` and handle separately.\n\t\t\tconst pseudoSelectorStyles = Object.entries( styles ).filter(\n\t\t\t\t( [ key ] ) => key.startsWith( ':' )\n\t\t\t);\n\n\t\t\tif ( pseudoSelectorStyles?.length ) {\n\t\t\t\tpseudoSelectorStyles.forEach(\n\t\t\t\t\t( [ pseudoKey, pseudoStyle ] ) => {\n\t\t\t\t\t\tconst pseudoDeclarations =\n\t\t\t\t\t\t\tgetStylesDeclarations( pseudoStyle );\n\n\t\t\t\t\t\tif ( ! pseudoDeclarations?.length ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// `selector` maybe provided in a form\n\t\t\t\t\t\t// where block level selectors have sub element\n\t\t\t\t\t\t// selectors appended to them as a comma separated\n\t\t\t\t\t\t// string.\n\t\t\t\t\t\t// e.g. `h1 a,h2 a,h3 a,h4 a,h5 a,h6 a`;\n\t\t\t\t\t\t// Split and append pseudo selector to create\n\t\t\t\t\t\t// the proper rules to target the elements.\n\t\t\t\t\t\tconst _selector = selector\n\t\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t\t.map( ( sel ) => sel + pseudoKey )\n\t\t\t\t\t\t\t.join( ',' );\n\n\t\t\t\t\t\tconst pseudoRule = `${ _selector }{${ pseudoDeclarations.join(\n\t\t\t\t\t\t\t';'\n\t\t\t\t\t\t) };}`;\n\n\t\t\t\t\t\truleset = ruleset + pseudoRule;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t);\n\n\t/* Add alignment / layout styles */\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .alignright { float: right; margin-left: 2em; }';\n\truleset =\n\t\truleset +\n\t\t'.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }';\n\n\tif ( hasBlockGapSupport ) {\n\t\t// Use fallback of `0.5em` just in case, however if there is blockGap support, there should nearly always be a real value.\n\t\tconst gapValue =\n\t\t\tgetGapCSSValue( tree?.styles?.spacing?.blockGap ) || '0.5em';\n\t\truleset =\n\t\t\truleset +\n\t\t\t'.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }';\n\t\truleset =\n\t\t\truleset +\n\t\t\t`.wp-site-blocks > * + * { margin-block-start: ${ gapValue }; }`;\n\t}\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport function toSvgFilters( tree, blockSelectors ) {\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\treturn nodesWithSettings.flatMap( ( { presets } ) => {\n\t\treturn getPresetsSvgFilters( presets );\n\t} );\n}\n\nexport const getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tconst duotoneSelector =\n\t\t\tblockType?.supports?.color?.__experimentalDuotone ?? null;\n\t\tconst hasLayoutSupport = !! blockType?.supports?.__experimentalLayout;\n\t\tconst fallbackGapValue =\n\t\t\tblockType?.supports?.spacing?.blockGap?.__experimentalDefault;\n\n\t\t// For each block support feature add any custom selectors.\n\t\tconst featureSelectors = {};\n\t\tObject.entries( BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS ).forEach(\n\t\t\t( [ featureKey, featureName ] ) => {\n\t\t\t\tconst featureSelector =\n\t\t\t\t\tblockType?.supports?.[ featureKey ]?.__experimentalSelector;\n\n\t\t\t\tif ( featureSelector ) {\n\t\t\t\t\tfeatureSelectors[ featureName ] = scopeSelector(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\tfeatureSelector\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t);\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};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\tconst [ blockGap ] = useSetting( 'spacing.blockGap' );\n\tconst hasBlockGapSupport = blockGap !== null;\n\tconst hasFallbackGapSupport = ! hasBlockGapSupport; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback styles support.\n\tconst disableLayoutStyles = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn !! getSettings().disableLayoutStyles;\n\t} );\n\n\treturn useMemo( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors,\n\t\t\thasBlockGapSupport,\n\t\t\thasFallbackGapSupport,\n\t\t\tdisableLayoutStyles\n\t\t);\n\t\tconst filters = toSvgFilters( mergedConfig, blockSelectors );\n\t\tconst stylesheets = [\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];\n\n\t\treturn [ stylesheets, mergedConfig.settings, filters ];\n\t}, [\n\t\thasBlockGapSupport,\n\t\thasFallbackGapSupport,\n\t\tmergedConfig,\n\t\tdisableLayoutStyles,\n\t] );\n}\n"]}
@@ -78,11 +78,16 @@ function DocumentActions(_ref) {
78
78
  } = _ref;
79
79
  const {
80
80
  label
81
- } = useSecondaryText(); // The title ref is passed to the popover as the anchorRef so that the
82
- // dropdown is centered over the whole title area rather than just one
83
- // part of it.
81
+ } = useSecondaryText(); // Use internal state instead of a ref to make sure that the component
82
+ // re-renders when the popover's anchor updates.
84
83
 
85
- const titleRef = (0, _element.useRef)(); // Return a simple loading indicator until we have information to show.
84
+ const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
85
+
86
+ const popoverProps = (0, _element.useMemo)(() => ({
87
+ // Use the title wrapper as the popover anchor so that the dropdown is
88
+ // centered over the whole title area rather than just one part of it.
89
+ anchor: popoverAnchor
90
+ }), [popoverAnchor]); // Return a simple loading indicator until we have information to show.
86
91
 
87
92
  if (!isLoaded) {
88
93
  return (0, _element.createElement)("div", {
@@ -102,7 +107,7 @@ function DocumentActions(_ref) {
102
107
  'has-secondary-label': !!label
103
108
  })
104
109
  }, (0, _element.createElement)("div", {
105
- ref: titleRef,
110
+ ref: setPopoverAnchor,
106
111
  className: "edit-site-document-actions__title-wrapper"
107
112
  }, (0, _element.createElement)(_components.__experimentalText, {
108
113
  size: "body",
@@ -116,9 +121,7 @@ function DocumentActions(_ref) {
116
121
  size: "body",
117
122
  className: "edit-site-document-actions__secondary-item"
118
123
  }, label !== null && label !== void 0 ? label : ''), dropdownContent && (0, _element.createElement)(_components.Dropdown, {
119
- popoverProps: {
120
- anchorRef: titleRef.current
121
- },
124
+ popoverProps: popoverProps,
122
125
  position: "bottom center",
123
126
  renderToggle: _ref2 => {
124
127
  let {