@wordpress/edit-site 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/new-template-part.js +21 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/utils.js +9 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +15 -51
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +8 -2
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -4
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +9 -1
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +16 -11
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +6 -5
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +9 -3
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +3 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +50 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +8 -7
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +9 -3
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +8 -7
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +4 -3
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +8 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +9 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +85 -18
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +119 -33
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +49 -2
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- package/build/components/layout/index.js +81 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build/components/site-hub/index.js +9 -9
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +20 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +5 -0
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +17 -49
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +8 -2
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -4
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +7 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +16 -11
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +6 -5
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +8 -3
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -2
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +49 -26
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +8 -7
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +8 -3
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +8 -7
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +7 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +9 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +84 -19
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +121 -35
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +47 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- package/build-module/components/layout/index.js +81 -10
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build-module/components/site-hub/index.js +10 -9
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +93 -21
- package/build-style/style.css +93 -21
- package/package.json +30 -30
- package/src/components/add-new-template/new-template-part.js +23 -1
- package/src/components/add-new-template/utils.js +14 -0
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +11 -54
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +43 -7
- package/src/components/editor/index.js +1 -1
- package/src/components/global-styles/block-preview-panel.js +14 -2
- package/src/components/global-styles/border-panel.js +8 -4
- package/src/components/global-styles/context-menu.js +6 -0
- package/src/components/global-styles/dimensions-panel.js +32 -15
- package/src/components/global-styles/screen-background-color.js +12 -5
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-border.js +7 -4
- package/src/components/global-styles/screen-button-color.js +2 -2
- package/src/components/global-styles/screen-colors.js +82 -21
- package/src/components/global-styles/screen-heading-color.js +7 -7
- package/src/components/global-styles/screen-layout.js +10 -4
- package/src/components/global-styles/screen-link-color.js +19 -7
- package/src/components/global-styles/screen-text-color.js +7 -3
- package/src/components/global-styles/screen-typography.js +11 -4
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/style.scss +9 -0
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +31 -8
- package/src/components/global-styles/ui.js +101 -13
- package/src/components/global-styles/use-global-styles-output.js +137 -14
- package/src/components/global-styles/utils.js +46 -2
- package/src/components/global-styles/variations-panel.js +78 -0
- package/src/components/layout/index.js +107 -19
- package/src/components/layout/style.scss +30 -5
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +4 -0
- package/src/components/site-hub/index.js +120 -109
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -3
- package/src/store/reducer.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["GlobalStylesNavigationScreen","className","props","filter","Boolean","join","ContextScreens","name","parentMenu","undefined","encodeURIComponent","GlobalStylesStyleBook","onClose","navigator","path","location","blockName","startsWith","depth","match","length","i","goBack","goTo","GlobalStylesUI","isStyleBookOp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BAAC,8BAAD,OADD,CARD,EAYC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,wBAAD,OADD,CAZD,EAgBGA,MAAM,CAACC,GAAP,CAAcC,KAAF,IACb,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAG,gBAAgBA,KAAK,CAACtB,IAD7B;AAEC,IAAA,IAAI,EAAG,aAAaG,kBAAkB,CAAEmB,KAAK,CAACtB,IAAR;AAFvC,KAIC,4BAAC,oBAAD;AAAa,IAAA,IAAI,EAAGsB,KAAK,CAACtB;AAA1B,IAJD,CADC,CAhBH,EAyBC,4BAAC,cAAD,OAzBD,EA2BGoB,MAAM,CAACC,GAAP,CAAcC,KAAF,IACb,4BAAC,cAAD;AACC,IAAA,GAAG,EAAG,mBAAmBA,KAAK,CAACtB,IADhC;AAEC,IAAA,IAAI,EAAGsB,KAAK,CAACtB;AAFd,IADC,CA3BH,EAkCGkB,iBAAiB,IAClB,4BAAC,qBAAD;AAAuB,IAAA,OAAO,EAAGC;AAAjC,IAnCF,EAqCC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,kBAAD,OADD,CArCD,CADD;AA2CA;;eAEcF,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { getBlockTypes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenHeadingColor from './screen-heading-color';\nimport ScreenButtonColor from './screen-button-color';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport ScreenBorder from './screen-border';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction ContextScreens( { name } ) {\n\tconst parentMenu =\n\t\tname === undefined ? '' : '/blocks/' + encodeURIComponent( name );\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/heading' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/button' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\t>\n\t\t\t\t<ScreenBackgroundColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/heading' }\n\t\t\t>\n\t\t\t\t<ScreenHeadingColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/button' }\n\t\t\t>\n\t\t\t\t<ScreenButtonColor name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>\n\t\t\t\t<ScreenBorder name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook( { onClose } ) {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Clear navigator history by going back to the root.\n\t\t\t\tconst depth = path.match( /\\//g ).length;\n\t\t\t\tfor ( let i = 0; i < depth; i++ ) {\n\t\t\t\t\tnavigator.goBack();\n\t\t\t\t}\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {\n\tconst blocks = getBlockTypes();\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ isStyleBookOpened && (\n\t\t\t\t<GlobalStylesStyleBook onClose={ onCloseStyleBook } />\n\t\t\t) }\n\t\t\t<GlobalStylesNavigationScreen path=\"/css\">\n\t\t\t\t<ScreenCSS />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStylesUI;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["GlobalStylesNavigationScreen","className","props","filter","Boolean","join","BlockStyleVariationsScreens","name","blockStyleVariations","select","getBlockStyles","blocksStore","length","map","variation","encodeURIComponent","ContextScreens","parentMenu","hasVariationPath","search","variationPath","substring","replace","concat","BlockStylesNavigationScreens","blockStyles","blockName","style","index","GlobalStylesStyleBook","onClose","navigator","path","location","startsWith","depth","match","i","goBack","goTo","GlobalStylesUI","isStyleBookOpened","onCloseStyleBook","blocks","block"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhCA;AACA;AACA;;AAUA;AACA;AACA;AAoBA,SAASA,4BAAT,OAAiE;AAAA,MAA1B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA0B;AAChE,SACC,4BAAC,yCAAD;AACC,IAAA,SAAS,EAAG,CACX,mDADW,EAEXD,SAFW,EAIVE,MAJU,CAIFC,OAJE,EAKVC,IALU,CAKJ,GALI;AADb,KAOMH,KAPN,EADD;AAWA;;AAED,SAASI,2BAAT,QAAiD;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAChD,QAAMC,oBAAoB,GAAG,qBAC1BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAqBD,M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OADD,CAJD,EAQC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,8BAAD,OADD,CARD,EAYC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,wBAAD,OADD,CAZD,EAgBGA,MAAM,CAAC9B,GAAP,CAAc+B,KAAF,IACb,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAG,gBAAgBA,KAAK,CAACrC,IAD7B;AAEC,IAAA,IAAI,EAAG,aAAaQ,kBAAkB,CAAE6B,KAAK,CAACrC,IAAR;AAFvC,KAIC,4BAAC,oBAAD;AAAa,IAAA,IAAI,EAAGqC,KAAK,CAACrC;AAA1B,IAJD,CADC,CAhBH,EAyBC,4BAAC,cAAD,OAzBD,EA2BGoC,MAAM,CAAC9B,GAAP,CAAc+B,KAAF,IACb,4BAAC,cAAD;AACC,IAAA,GAAG,EAAG,mBAAmBA,KAAK,CAACrC,IADhC;AAEC,IAAA,IAAI,EAAGqC,KAAK,CAACrC,IAFd;AAGC,IAAA,UAAU,EAAG,aAAaQ,kBAAkB,CAAE6B,KAAK,CAACrC,IAAR;AAH7C,IADC,CA3BH,EAmCGoC,MAAM,CAAC9B,GAAP,CAAY,CAAE+B,KAAF,EAAShB,KAAT,KAAoB;AACjC,WACC,4BAAC,2BAAD;AACC,MAAA,GAAG,EAAG,0BAA0BgB,KAAK,CAACrC,IAAhC,GAAuCqB,KAD9C;AAEC,MAAA,IAAI,EAAGgB,KAAK,CAACrC;AAFd,MADD;AAMA,GAPC,CAnCH,EA2CGkC,iBAAiB,IAClB,4BAAC,qBAAD;AAAuB,IAAA,OAAO,EAAGC;AAAjC,IA5CF,EA8CC,4BAAC,4BAAD;AAA8B,IAAA,IAAI,EAAC;AAAnC,KACC,4BAAC,kBAAD,OADD,CA9CD,CADD;AAoDA;;eAEcF,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { getBlockTypes, store as blocksStore } from '@wordpress/blocks';\n\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenHeadingColor from './screen-heading-color';\nimport ScreenButtonColor from './screen-button-color';\nimport ScreenLayout from './screen-layout';\nimport ScreenStyleVariations from './screen-style-variations';\nimport { ScreenVariation } from './screen-variations';\nimport ScreenBorder from './screen-border';\nimport StyleBook from '../style-book';\nimport ScreenCSS from './screen-css';\n\nfunction GlobalStylesNavigationScreen( { className, ...props } ) {\n\treturn (\n\t\t<NavigatorScreen\n\t\t\tclassName={ [\n\t\t\t\t'edit-site-global-styles-sidebar__navigator-screen',\n\t\t\t\tclassName,\n\t\t\t]\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ) }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction BlockStyleVariationsScreens( { name } ) {\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tif ( ! blockStyleVariations?.length ) {\n\t\treturn null;\n\t}\n\n\treturn blockStyleVariations.map( ( variation ) => (\n\t\t<ContextScreens\n\t\t\tkey={ variation.name + name }\n\t\t\tname={ name }\n\t\t\tparentMenu={\n\t\t\t\t'/blocks/' +\n\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t'/variations/' +\n\t\t\t\tencodeURIComponent( variation.name )\n\t\t\t}\n\t\t/>\n\t) );\n}\n\nfunction ContextScreens( { name, parentMenu = '' } ) {\n\tconst hasVariationPath = parentMenu.search( 'variations' );\n\tconst variationPath =\n\t\thasVariationPath !== -1\n\t\t\t? parentMenu\n\t\t\t\t\t.substring( hasVariationPath )\n\t\t\t\t\t.replace( '/', '.' )\n\t\t\t\t\t.concat( '', '.' )\n\t\t\t: '';\n\tconst blockStyleVariations = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\n\tconst BlockStylesNavigationScreens = ( { blockStyles, blockName } ) => {\n\t\treturn blockStyles.map( ( style, index ) => (\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tkey={ index }\n\t\t\t\tpath={ parentMenu + '/variations/' + style.name }\n\t\t\t>\n\t\t\t\t<ScreenVariation blockName={ blockName } style={ style } />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t) );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/text' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/link' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/heading' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"heading\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/typography/button' }\n\t\t\t>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"button\" />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/palette' }\n\t\t\t>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\t>\n\t\t\t\t<ScreenBackgroundColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/heading' }\n\t\t\t>\n\t\t\t\t<ScreenHeadingColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\tpath={ parentMenu + '/colors/button' }\n\t\t\t>\n\t\t\t\t<ScreenButtonColor\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t/>\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>\n\t\t\t\t<ScreenBorder name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } variationPath={ variationPath } />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ !! blockStyleVariations?.length && (\n\t\t\t\t<BlockStylesNavigationScreens\n\t\t\t\t\tblockStyles={ blockStyleVariations }\n\t\t\t\t\tblockName={ name }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesStyleBook( { onClose } ) {\n\tconst navigator = useNavigator();\n\tconst { path } = navigator.location;\n\treturn (\n\t\t<StyleBook\n\t\t\tisSelected={ ( blockName ) =>\n\t\t\t\t// Match '/blocks/core%2Fbutton' and\n\t\t\t\t// '/blocks/core%2Fbutton/typography', but not\n\t\t\t\t// '/blocks/core%2Fbuttons'.\n\t\t\t\tpath === `/blocks/${ encodeURIComponent( blockName ) }` ||\n\t\t\t\tpath.startsWith(\n\t\t\t\t\t`/blocks/${ encodeURIComponent( blockName ) }/`\n\t\t\t\t)\n\t\t\t}\n\t\t\tonSelect={ ( blockName ) => {\n\t\t\t\t// Clear navigator history by going back to the root.\n\t\t\t\tconst depth = path.match( /\\//g ).length;\n\t\t\t\tfor ( let i = 0; i < depth; i++ ) {\n\t\t\t\t\tnavigator.goBack();\n\t\t\t\t}\n\t\t\t\t// Now go to the selected block.\n\t\t\t\tnavigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );\n\t\t\t} }\n\t\t\tonClose={ onClose }\n\t\t/>\n\t);\n}\n\nfunction GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider\n\t\t\tclassName=\"edit-site-global-styles-sidebar__navigator-provider\"\n\t\t\tinitialPath=\"/\"\n\t\t>\n\t\t\t<GlobalStylesNavigationScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/variations\">\n\t\t\t\t<ScreenStyleVariations />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t<GlobalStylesNavigationScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</GlobalStylesNavigationScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<GlobalStylesNavigationScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</GlobalStylesNavigationScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t\tparentMenu={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\t\t/>\n\t\t\t) ) }\n\n\t\t\t{ blocks.map( ( block, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<BlockStyleVariationsScreens\n\t\t\t\t\t\tkey={ 'screens-block-styles-' + block.name + index }\n\t\t\t\t\t\tname={ block.name }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ isStyleBookOpened && (\n\t\t\t\t<GlobalStylesStyleBook onClose={ onCloseStyleBook } />\n\t\t\t) }\n\t\t\t<GlobalStylesNavigationScreen path=\"/css\">\n\t\t\t\t<ScreenCSS />\n\t\t\t</GlobalStylesNavigationScreen>\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStylesUI;\n"]}
|
|
@@ -177,6 +177,25 @@ function flattenTree() {
|
|
|
177
177
|
});
|
|
178
178
|
return result;
|
|
179
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Gets variation selector string from feature selector.
|
|
182
|
+
*
|
|
183
|
+
* @param {string} featureSelector The feature selector.
|
|
184
|
+
*
|
|
185
|
+
* @param {string} styleVariationSelector The style variation selector.
|
|
186
|
+
* @return {string} Combined selector string.
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) {
|
|
192
|
+
const featureSelectors = featureSelector.split(',');
|
|
193
|
+
const combinedSelectors = [];
|
|
194
|
+
featureSelectors.forEach(selector => {
|
|
195
|
+
combinedSelectors.push(`${styleVariationSelector.trim()}${selector.trim()}`);
|
|
196
|
+
});
|
|
197
|
+
return combinedSelectors.join(', ');
|
|
198
|
+
}
|
|
180
199
|
/**
|
|
181
200
|
* Transform given style tree into a set of style declarations.
|
|
182
201
|
*
|
|
@@ -418,7 +437,10 @@ const getNodesWithStyles = (tree, blockSelectors) => {
|
|
|
418
437
|
return nodes;
|
|
419
438
|
}
|
|
420
439
|
|
|
421
|
-
const pickStyleKeys = treeToPickFrom => (
|
|
440
|
+
const pickStyleKeys = treeToPickFrom => Object.fromEntries(Object.entries(treeToPickFrom !== null && treeToPickFrom !== void 0 ? treeToPickFrom : {}).filter(_ref11 => {
|
|
441
|
+
let [key] = _ref11;
|
|
442
|
+
return ['border', 'color', 'dimensions', 'spacing', 'typography', 'filter', 'outline', 'shadow'].includes(key);
|
|
443
|
+
})); // Top-level.
|
|
422
444
|
|
|
423
445
|
|
|
424
446
|
const styles = pickStyleKeys(tree.styles);
|
|
@@ -430,10 +452,10 @@ const getNodesWithStyles = (tree, blockSelectors) => {
|
|
|
430
452
|
});
|
|
431
453
|
}
|
|
432
454
|
|
|
433
|
-
Object.entries(_blocks.__EXPERIMENTAL_ELEMENTS).forEach(
|
|
455
|
+
Object.entries(_blocks.__EXPERIMENTAL_ELEMENTS).forEach(_ref12 => {
|
|
434
456
|
var _tree$styles;
|
|
435
457
|
|
|
436
|
-
let [name, selector] =
|
|
458
|
+
let [name, selector] = _ref12;
|
|
437
459
|
|
|
438
460
|
if (!!((_tree$styles = tree.styles) !== null && _tree$styles !== void 0 && _tree$styles.elements[name])) {
|
|
439
461
|
var _tree$styles2;
|
|
@@ -445,12 +467,20 @@ const getNodesWithStyles = (tree, blockSelectors) => {
|
|
|
445
467
|
}
|
|
446
468
|
}); // Iterate over blocks: they can have styles & elements.
|
|
447
469
|
|
|
448
|
-
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(
|
|
470
|
+
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(_ref13 => {
|
|
449
471
|
var _blockSelectors$block, _node$elements;
|
|
450
472
|
|
|
451
|
-
let [blockName, node] =
|
|
473
|
+
let [blockName, node] = _ref13;
|
|
452
474
|
const blockStyles = pickStyleKeys(node);
|
|
453
475
|
|
|
476
|
+
if (node !== null && node !== void 0 && node.variations) {
|
|
477
|
+
const variations = {};
|
|
478
|
+
Object.keys(node.variations).forEach(variation => {
|
|
479
|
+
variations[variation] = pickStyleKeys(node.variations[variation]);
|
|
480
|
+
});
|
|
481
|
+
blockStyles.variations = variations;
|
|
482
|
+
}
|
|
483
|
+
|
|
454
484
|
if (!!blockStyles && !!(blockSelectors !== null && blockSelectors !== void 0 && (_blockSelectors$block = blockSelectors[blockName]) !== null && _blockSelectors$block !== void 0 && _blockSelectors$block.selector)) {
|
|
455
485
|
nodes.push({
|
|
456
486
|
duotoneSelector: blockSelectors[blockName].duotoneSelector,
|
|
@@ -458,12 +488,13 @@ const getNodesWithStyles = (tree, blockSelectors) => {
|
|
|
458
488
|
hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport,
|
|
459
489
|
selector: blockSelectors[blockName].selector,
|
|
460
490
|
styles: blockStyles,
|
|
461
|
-
featureSelectors: blockSelectors[blockName].featureSelectors
|
|
491
|
+
featureSelectors: blockSelectors[blockName].featureSelectors,
|
|
492
|
+
styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors
|
|
462
493
|
});
|
|
463
494
|
}
|
|
464
495
|
|
|
465
|
-
Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(
|
|
466
|
-
let [elementName, value] =
|
|
496
|
+
Object.entries((_node$elements = node === null || node === void 0 ? void 0 : node.elements) !== null && _node$elements !== void 0 ? _node$elements : {}).forEach(_ref14 => {
|
|
497
|
+
let [elementName, value] = _ref14;
|
|
467
498
|
|
|
468
499
|
if (!!value && !!(blockSelectors !== null && blockSelectors !== void 0 && blockSelectors[blockName]) && !!(_blocks.__EXPERIMENTAL_ELEMENTS !== null && _blocks.__EXPERIMENTAL_ELEMENTS !== void 0 && _blocks.__EXPERIMENTAL_ELEMENTS[elementName])) {
|
|
469
500
|
nodes.push({
|
|
@@ -494,10 +525,10 @@ const getNodesWithSettings = (tree, blockSelectors) => {
|
|
|
494
525
|
const pickPresets = treeToPickFrom => {
|
|
495
526
|
const presets = {};
|
|
496
527
|
|
|
497
|
-
_utils.PRESET_METADATA.forEach(
|
|
528
|
+
_utils.PRESET_METADATA.forEach(_ref15 => {
|
|
498
529
|
let {
|
|
499
530
|
path
|
|
500
|
-
} =
|
|
531
|
+
} = _ref15;
|
|
501
532
|
const value = (0, _lodash.get)(treeToPickFrom, path, false);
|
|
502
533
|
|
|
503
534
|
if (value !== false) {
|
|
@@ -521,8 +552,8 @@ const getNodesWithSettings = (tree, blockSelectors) => {
|
|
|
521
552
|
} // Blocks.
|
|
522
553
|
|
|
523
554
|
|
|
524
|
-
Object.entries((_tree$settings$blocks = (_tree$settings5 = tree.settings) === null || _tree$settings5 === void 0 ? void 0 : _tree$settings5.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(
|
|
525
|
-
let [blockName, node] =
|
|
555
|
+
Object.entries((_tree$settings$blocks = (_tree$settings5 = tree.settings) === null || _tree$settings5 === void 0 ? void 0 : _tree$settings5.blocks) !== null && _tree$settings$blocks !== void 0 ? _tree$settings$blocks : {}).forEach(_ref16 => {
|
|
556
|
+
let [blockName, node] = _ref16;
|
|
526
557
|
const blockPresets = pickPresets(node);
|
|
527
558
|
const blockCustom = node.custom;
|
|
528
559
|
|
|
@@ -542,12 +573,12 @@ exports.getNodesWithSettings = getNodesWithSettings;
|
|
|
542
573
|
const toCustomProperties = (tree, blockSelectors) => {
|
|
543
574
|
const settings = getNodesWithSettings(tree, blockSelectors);
|
|
544
575
|
let ruleset = '';
|
|
545
|
-
settings.forEach(
|
|
576
|
+
settings.forEach(_ref17 => {
|
|
546
577
|
let {
|
|
547
578
|
presets,
|
|
548
579
|
custom,
|
|
549
580
|
selector
|
|
550
|
-
} =
|
|
581
|
+
} = _ref17;
|
|
551
582
|
const declarations = getPresetsDeclarations(presets, tree === null || tree === void 0 ? void 0 : tree.settings);
|
|
552
583
|
const customProps = flattenTree(custom, '--wp--custom--', '--');
|
|
553
584
|
|
|
@@ -605,21 +636,22 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
|
|
|
605
636
|
}
|
|
606
637
|
|
|
607
638
|
ruleset += '}';
|
|
608
|
-
nodesWithStyles.forEach(
|
|
639
|
+
nodesWithStyles.forEach(_ref18 => {
|
|
609
640
|
let {
|
|
610
641
|
selector,
|
|
611
642
|
duotoneSelector,
|
|
612
643
|
styles,
|
|
613
644
|
fallbackGapValue,
|
|
614
645
|
hasLayoutSupport,
|
|
615
|
-
featureSelectors
|
|
616
|
-
|
|
646
|
+
featureSelectors,
|
|
647
|
+
styleVariationSelectors
|
|
648
|
+
} = _ref18;
|
|
617
649
|
|
|
618
650
|
// Process styles for block support features with custom feature level
|
|
619
651
|
// CSS selectors set.
|
|
620
652
|
if (featureSelectors) {
|
|
621
|
-
Object.entries(featureSelectors).forEach(
|
|
622
|
-
let [featureName, featureSelector] =
|
|
653
|
+
Object.entries(featureSelectors).forEach(_ref19 => {
|
|
654
|
+
let [featureName, featureSelector] = _ref19;
|
|
623
655
|
|
|
624
656
|
if (styles !== null && styles !== void 0 && styles[featureName]) {
|
|
625
657
|
const featureStyles = {
|
|
@@ -635,6 +667,46 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
|
|
|
635
667
|
});
|
|
636
668
|
}
|
|
637
669
|
|
|
670
|
+
if (styleVariationSelectors) {
|
|
671
|
+
Object.entries(styleVariationSelectors).forEach(_ref20 => {
|
|
672
|
+
var _styles$variations;
|
|
673
|
+
|
|
674
|
+
let [styleVariationName, styleVariationSelector] = _ref20;
|
|
675
|
+
|
|
676
|
+
if (styles !== null && styles !== void 0 && (_styles$variations = styles.variations) !== null && _styles$variations !== void 0 && _styles$variations[styleVariationName]) {
|
|
677
|
+
var _styles$variations3;
|
|
678
|
+
|
|
679
|
+
// If the block uses any custom selectors for block support, add those first.
|
|
680
|
+
if (featureSelectors) {
|
|
681
|
+
Object.entries(featureSelectors).forEach(_ref21 => {
|
|
682
|
+
var _styles$variations2, _styles$variations2$s;
|
|
683
|
+
|
|
684
|
+
let [featureName, featureSelector] = _ref21;
|
|
685
|
+
|
|
686
|
+
if (styles !== null && styles !== void 0 && (_styles$variations2 = styles.variations) !== null && _styles$variations2 !== void 0 && (_styles$variations2$s = _styles$variations2[styleVariationName]) !== null && _styles$variations2$s !== void 0 && _styles$variations2$s[featureName]) {
|
|
687
|
+
const featureStyles = {
|
|
688
|
+
[featureName]: styles.variations[styleVariationName][featureName]
|
|
689
|
+
};
|
|
690
|
+
const featureDeclarations = getStylesDeclarations(featureStyles);
|
|
691
|
+
delete styles.variations[styleVariationName][featureName];
|
|
692
|
+
|
|
693
|
+
if (!!featureDeclarations.length) {
|
|
694
|
+
ruleset = ruleset + `${concatFeatureVariationSelectorString(featureSelector, styleVariationSelector)}{${featureDeclarations.join(';')} }`;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
} // Otherwise add regular selectors.
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
const styleVariationDeclarations = getStylesDeclarations(styles === null || styles === void 0 ? void 0 : (_styles$variations3 = styles.variations) === null || _styles$variations3 === void 0 ? void 0 : _styles$variations3[styleVariationName], styleVariationSelector, useRootPaddingAlign, tree);
|
|
702
|
+
|
|
703
|
+
if (!!styleVariationDeclarations.length) {
|
|
704
|
+
ruleset = ruleset + `${styleVariationSelector}{${styleVariationDeclarations.join(';')}}`;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
|
|
638
710
|
const duotoneStyles = {};
|
|
639
711
|
|
|
640
712
|
if (styles !== null && styles !== void 0 && styles.filter) {
|
|
@@ -671,14 +743,14 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
|
|
|
671
743
|
} // Check for pseudo selector in `styles` and handle separately.
|
|
672
744
|
|
|
673
745
|
|
|
674
|
-
const pseudoSelectorStyles = Object.entries(styles).filter(
|
|
675
|
-
let [key] =
|
|
746
|
+
const pseudoSelectorStyles = Object.entries(styles).filter(_ref22 => {
|
|
747
|
+
let [key] = _ref22;
|
|
676
748
|
return key.startsWith(':');
|
|
677
749
|
});
|
|
678
750
|
|
|
679
751
|
if (pseudoSelectorStyles !== null && pseudoSelectorStyles !== void 0 && pseudoSelectorStyles.length) {
|
|
680
|
-
pseudoSelectorStyles.forEach(
|
|
681
|
-
let [pseudoKey, pseudoStyle] =
|
|
752
|
+
pseudoSelectorStyles.forEach(_ref23 => {
|
|
753
|
+
let [pseudoKey, pseudoStyle] = _ref23;
|
|
682
754
|
const pseudoDeclarations = getStylesDeclarations(pseudoStyle);
|
|
683
755
|
|
|
684
756
|
if (!(pseudoDeclarations !== null && pseudoDeclarations !== void 0 && pseudoDeclarations.length)) {
|
|
@@ -714,11 +786,11 @@ const toStyles = function (tree, blockSelectors, hasBlockGapSupport, hasFallback
|
|
|
714
786
|
ruleset = ruleset + `.wp-site-blocks > * + * { margin-block-start: ${gapValue}; }`;
|
|
715
787
|
}
|
|
716
788
|
|
|
717
|
-
nodesWithSettings.forEach(
|
|
789
|
+
nodesWithSettings.forEach(_ref24 => {
|
|
718
790
|
let {
|
|
719
791
|
selector,
|
|
720
792
|
presets
|
|
721
|
-
} =
|
|
793
|
+
} = _ref24;
|
|
722
794
|
|
|
723
795
|
if (_utils.ROOT_BLOCK_SELECTOR === selector) {
|
|
724
796
|
// Do not add extra specificity for top-level classes.
|
|
@@ -738,15 +810,15 @@ exports.toStyles = toStyles;
|
|
|
738
810
|
|
|
739
811
|
function toSvgFilters(tree, blockSelectors) {
|
|
740
812
|
const nodesWithSettings = getNodesWithSettings(tree, blockSelectors);
|
|
741
|
-
return nodesWithSettings.flatMap(
|
|
813
|
+
return nodesWithSettings.flatMap(_ref25 => {
|
|
742
814
|
let {
|
|
743
815
|
presets
|
|
744
|
-
} =
|
|
816
|
+
} = _ref25;
|
|
745
817
|
return getPresetsSvgFilters(presets);
|
|
746
818
|
});
|
|
747
819
|
}
|
|
748
820
|
|
|
749
|
-
const getBlockSelectors = blockTypes => {
|
|
821
|
+
const getBlockSelectors = (blockTypes, getBlockStyles) => {
|
|
750
822
|
const result = {};
|
|
751
823
|
blockTypes.forEach(blockType => {
|
|
752
824
|
var _blockType$supports$_, _blockType$supports, _blockType$supports$c, _blockType$supports2, _blockType$supports2$, _blockType$supports3, _blockType$supports4, _blockType$supports4$, _blockType$supports4$2;
|
|
@@ -755,13 +827,23 @@ const getBlockSelectors = blockTypes => {
|
|
|
755
827
|
const selector = (_blockType$supports$_ = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports = blockType.supports) === null || _blockType$supports === void 0 ? void 0 : _blockType$supports.__experimentalSelector) !== null && _blockType$supports$_ !== void 0 ? _blockType$supports$_ : '.wp-block-' + name.replace('core/', '').replace('/', '-');
|
|
756
828
|
const duotoneSelector = (_blockType$supports$c = blockType === null || blockType === void 0 ? void 0 : (_blockType$supports2 = blockType.supports) === null || _blockType$supports2 === void 0 ? void 0 : (_blockType$supports2$ = _blockType$supports2.color) === null || _blockType$supports2$ === void 0 ? void 0 : _blockType$supports2$.__experimentalDuotone) !== null && _blockType$supports$c !== void 0 ? _blockType$supports$c : null;
|
|
757
829
|
const hasLayoutSupport = !!(blockType !== null && blockType !== void 0 && (_blockType$supports3 = blockType.supports) !== null && _blockType$supports3 !== void 0 && _blockType$supports3.__experimentalLayout);
|
|
758
|
-
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;
|
|
830
|
+
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;
|
|
831
|
+
const blockStyleVariations = getBlockStyles(name);
|
|
832
|
+
const styleVariationSelectors = {};
|
|
833
|
+
|
|
834
|
+
if (blockStyleVariations !== null && blockStyleVariations !== void 0 && blockStyleVariations.length) {
|
|
835
|
+
blockStyleVariations.forEach(variation => {
|
|
836
|
+
const styleVariationSelector = `.is-style-${variation.name}${selector}`;
|
|
837
|
+
styleVariationSelectors[variation.name] = styleVariationSelector;
|
|
838
|
+
});
|
|
839
|
+
} // For each block support feature add any custom selectors.
|
|
840
|
+
|
|
759
841
|
|
|
760
842
|
const featureSelectors = {};
|
|
761
|
-
Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(
|
|
843
|
+
Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach(_ref26 => {
|
|
762
844
|
var _blockType$supports5, _blockType$supports5$;
|
|
763
845
|
|
|
764
|
-
let [featureKey, featureName] =
|
|
846
|
+
let [featureKey, featureName] = _ref26;
|
|
765
847
|
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;
|
|
766
848
|
|
|
767
849
|
if (featureSelector) {
|
|
@@ -774,7 +856,8 @@ const getBlockSelectors = blockTypes => {
|
|
|
774
856
|
featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : undefined,
|
|
775
857
|
hasLayoutSupport,
|
|
776
858
|
name,
|
|
777
|
-
selector
|
|
859
|
+
selector,
|
|
860
|
+
styleVariationSelectors: Object.keys(styleVariationSelectors).length ? styleVariationSelectors : undefined
|
|
778
861
|
};
|
|
779
862
|
});
|
|
780
863
|
return result;
|
|
@@ -828,6 +911,9 @@ function useGlobalStylesOutput() {
|
|
|
828
911
|
} = select(_blockEditor.store);
|
|
829
912
|
return !!getSettings().disableLayoutStyles;
|
|
830
913
|
});
|
|
914
|
+
const getBlockStyles = (0, _data.useSelect)(select => {
|
|
915
|
+
return select(_blocks.store).getBlockStyles;
|
|
916
|
+
}, []);
|
|
831
917
|
return (0, _element.useMemo)(() => {
|
|
832
918
|
var _mergedConfig, _mergedConfig2, _mergedConfig$styles$;
|
|
833
919
|
|
|
@@ -836,7 +922,7 @@ function useGlobalStylesOutput() {
|
|
|
836
922
|
}
|
|
837
923
|
|
|
838
924
|
mergedConfig = updateConfigWithSeparator(mergedConfig);
|
|
839
|
-
const blockSelectors = getBlockSelectors((0, _blocks.getBlockTypes)());
|
|
925
|
+
const blockSelectors = getBlockSelectors((0, _blocks.getBlockTypes)(), getBlockStyles);
|
|
840
926
|
const customProperties = toCustomProperties(mergedConfig, blockSelectors);
|
|
841
927
|
const globalStyles = toStyles(mergedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles);
|
|
842
928
|
const filters = toSvgFilters(mergedConfig, blockSelectors);
|