@wordpress/edit-site 5.28.5 → 5.30.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 +4 -0
- package/build/components/actions/index.js +1 -1
- package/build/components/actions/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +10 -11
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +2 -1
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/code-editor/index.js +3 -2
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/editor/index.js +5 -19
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +9 -0
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +1 -1
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +11 -0
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +5 -16
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +2 -2
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +27 -0
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +1 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/highlighted-colors.js +50 -0
- package/build/components/global-styles/highlighted-colors.js.map +1 -0
- package/build/components/global-styles/preview-colors.js +62 -0
- package/build/components/global-styles/preview-colors.js.map +1 -0
- package/build/components/global-styles/preview-iframe.js +131 -0
- package/build/components/global-styles/preview-iframe.js.map +1 -0
- package/build/components/global-styles/preview-styles.js +163 -0
- package/build/components/global-styles/preview-styles.js.map +1 -0
- package/build/components/global-styles/preview-typography.js +65 -0
- package/build/components/global-styles/preview-typography.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +1 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +10 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +10 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +12 -84
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/{typogrphy-elements.js → typography-elements.js} +1 -1
- package/build/components/global-styles/typography-elements.js.map +1 -0
- package/build/components/global-styles/utils.js +22 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +90 -0
- package/build/components/global-styles/variations/variation.js.map +1 -0
- package/build/components/global-styles/variations/variations-color.js +36 -0
- package/build/components/global-styles/variations/variations-color.js.map +1 -0
- package/build/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
- package/build/components/global-styles/variations/variations-panel.js.map +1 -0
- package/build/components/global-styles/variations/variations-typography.js +64 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -0
- package/build/components/header-edit-mode/document-tools/index.js +1 -2
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +16 -13
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +17 -6
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -13
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -18
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +4 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +25 -8
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +0 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -61
- package/build/components/page-templates-template-parts/hooks.js.map +1 -0
- package/build/components/page-templates-template-parts/index.js +14 -6
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-button/index.js +2 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-panel/index.js +18 -3
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +1 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +48 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +6 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +2 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +2 -2
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +3 -171
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +4 -5
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +156 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
- package/build/store/actions.js +19 -50
- package/build/store/actions.js.map +1 -1
- package/build/utils/clone-deep.js +15 -0
- package/build/utils/clone-deep.js.map +1 -0
- package/build-module/components/actions/index.js +1 -1
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +10 -11
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +2 -1
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/code-editor/index.js +3 -2
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +6 -20
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +2 -2
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +8 -0
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +1 -1
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +12 -1
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -18
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +2 -2
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +26 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +1 -1
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/highlighted-colors.js +43 -0
- package/build-module/components/global-styles/highlighted-colors.js.map +1 -0
- package/build-module/components/global-styles/preview-colors.js +54 -0
- package/build-module/components/global-styles/preview-colors.js.map +1 -0
- package/build-module/components/global-styles/preview-iframe.js +124 -0
- package/build-module/components/global-styles/preview-iframe.js.map +1 -0
- package/build-module/components/global-styles/preview-styles.js +155 -0
- package/build-module/components/global-styles/preview-styles.js.map +1 -0
- package/build-module/components/global-styles/preview-typography.js +58 -0
- package/build-module/components/global-styles/preview-typography.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +1 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +10 -2
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -2
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +10 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +13 -85
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/{typogrphy-elements.js → typography-elements.js} +1 -1
- package/build-module/components/global-styles/typography-elements.js.map +1 -0
- package/build-module/components/global-styles/utils.js +21 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +82 -0
- package/build-module/components/global-styles/variations/variation.js.map +1 -0
- package/build-module/components/global-styles/variations/variations-color.js +28 -0
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -0
- package/build-module/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
- package/build-module/components/global-styles/variations/variations-panel.js.map +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js +56 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -0
- package/build-module/components/header-edit-mode/document-tools/index.js +1 -2
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +17 -14
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +19 -8
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -13
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -18
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +5 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +25 -8
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +0 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/{list/added-by.js → page-templates-template-parts/hooks.js} +2 -59
- package/build-module/components/page-templates-template-parts/hooks.js.map +1 -0
- package/build-module/components/page-templates-template-parts/index.js +13 -5
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +18 -3
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +50 -7
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +6 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +1 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -172
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +144 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
- package/build-module/store/actions.js +19 -50
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/clone-deep.js +9 -0
- package/build-module/utils/clone-deep.js.map +1 -0
- package/build-style/style-rtl.css +152 -472
- package/build-style/style.css +152 -472
- package/package.json +43 -42
- package/src/components/actions/index.js +1 -1
- package/src/components/block-editor/editor-canvas.js +13 -12
- package/src/components/block-editor/style.scss +0 -3
- package/src/components/block-editor/use-site-editor-settings.js +1 -0
- package/src/components/code-editor/index.js +3 -2
- package/src/components/editor/index.js +10 -27
- package/src/components/editor-canvas-container/index.js +2 -5
- package/src/components/{test → error-boundary/test}/error-boundary.js +7 -5
- package/src/components/global-styles/color-palette-panel.js +11 -1
- package/src/components/global-styles/font-families.js +1 -1
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +1 -1
- package/src/components/global-styles/font-library-modal/context.js +24 -0
- package/src/components/global-styles/font-library-modal/font-collection.js +7 -24
- package/src/components/global-styles/font-library-modal/index.js +2 -2
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/src/components/global-styles/font-library-modal/library-font-variant.js +1 -1
- package/src/components/global-styles/font-library-modal/upload-fonts.js +1 -1
- package/src/components/global-styles/font-library-modal/utils/index.js +34 -0
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +2 -1
- package/src/components/global-styles/gradients-palette-panel.js +2 -2
- package/src/components/global-styles/header.js +1 -1
- package/src/components/global-styles/highlighted-colors.js +39 -0
- package/src/components/global-styles/preview-colors.js +61 -0
- package/src/components/global-styles/preview-iframe.js +153 -0
- package/src/components/global-styles/preview-styles.js +185 -0
- package/src/components/global-styles/preview-typography.js +62 -0
- package/src/components/global-styles/screen-block-list.js +1 -1
- package/src/components/global-styles/screen-block.js +4 -1
- package/src/components/global-styles/screen-colors.js +13 -1
- package/src/components/global-styles/screen-revisions/style.scss +2 -2
- package/src/components/global-styles/screen-root.js +2 -2
- package/src/components/global-styles/screen-typography.js +19 -2
- package/src/components/global-styles/style-variations-container.js +14 -92
- package/src/components/global-styles/style.scss +1 -35
- package/src/components/global-styles/utils.js +37 -0
- package/src/components/global-styles/variations/style.scss +44 -0
- package/src/components/global-styles/variations/variation.js +93 -0
- package/src/components/global-styles/variations/variations-color.js +30 -0
- package/src/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
- package/src/components/global-styles/variations/variations-typography.js +85 -0
- package/src/components/header-edit-mode/document-tools/index.js +1 -2
- package/src/components/header-edit-mode/index.js +22 -31
- package/src/components/header-edit-mode/more-menu/index.js +25 -11
- package/src/components/header-edit-mode/style.scss +4 -0
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -11
- package/src/components/keyboard-shortcuts/register.js +0 -19
- package/src/components/layout/index.js +5 -2
- package/src/components/page-patterns/dataviews-pattern-actions.js +41 -10
- package/src/components/page-patterns/header.js +1 -0
- package/src/components/page-patterns/index.js +1 -2
- package/src/components/page-patterns/style.scss +0 -182
- package/src/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -66
- package/src/components/page-templates-template-parts/index.js +20 -3
- package/src/components/page-templates-template-parts/style.scss +48 -0
- package/src/components/revisions/index.js +1 -1
- package/src/components/save-button/index.js +2 -1
- package/src/components/save-hub/style.scss +1 -1
- package/src/components/save-panel/index.js +34 -12
- package/src/components/sidebar/index.js +1 -1
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +5 -7
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -1
- package/src/components/sidebar-edit-mode/style.scss +4 -0
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +37 -24
- package/src/components/sidebar-edit-mode/template-panel/index.js +76 -18
- package/src/components/sidebar-edit-mode/template-panel/style.scss +5 -14
- package/src/components/sidebar-edit-mode/template-panel/template-actions.js +1 -12
- package/src/components/sidebar-navigation-screen-global-styles/index.js +4 -1
- package/src/components/sidebar-navigation-screen-main/index.js +0 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-template/index.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
- package/src/components/start-template-options/index.js +1 -1
- package/src/hooks/commands/use-edit-mode-commands.js +3 -184
- package/src/hooks/index.js +0 -1
- package/src/hooks/push-changes-to-global-styles/index.js +1 -4
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1137 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +159 -0
- package/src/store/actions.js +21 -85
- package/src/store/test/actions.js +0 -75
- package/src/style.scss +3 -8
- package/src/utils/clone-deep.js +8 -0
- package/build/components/global-styles/preview.js +0 -271
- package/build/components/global-styles/preview.js.map +0 -1
- package/build/components/global-styles/typogrphy-elements.js.map +0 -1
- package/build/components/global-styles/variations-panel.js.map +0 -1
- package/build/components/header-edit-mode/mode-switcher/index.js +0 -62
- package/build/components/header-edit-mode/mode-switcher/index.js.map +0 -1
- package/build/components/list/added-by.js.map +0 -1
- package/build/components/list/header.js +0 -55
- package/build/components/list/header.js.map +0 -1
- package/build/components/list/index.js +0 -80
- package/build/components/list/index.js.map +0 -1
- package/build/components/list/table.js +0 -94
- package/build/components/list/table.js.map +0 -1
- package/build/components/list/use-register-shortcuts.js +0 -51
- package/build/components/list/use-register-shortcuts.js.map +0 -1
- package/build/components/page-patterns/duplicate-menu-item.js +0 -93
- package/build/components/page-patterns/duplicate-menu-item.js.map +0 -1
- package/build/components/page-patterns/grid-item.js +0 -223
- package/build/components/page-patterns/grid-item.js.map +0 -1
- package/build/components/page-patterns/grid.js +0 -31
- package/build/components/page-patterns/grid.js.map +0 -1
- package/build/components/page-patterns/no-patterns.js +0 -18
- package/build/components/page-patterns/no-patterns.js.map +0 -1
- package/build/components/page-patterns/patterns-list.js +0 -168
- package/build/components/page-patterns/patterns-list.js.map +0 -1
- package/build/components/page-patterns/rename-menu-item.js +0 -105
- package/build/components/page-patterns/rename-menu-item.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -83
- package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +0 -36
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -36
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
- package/build/hooks/navigation-menu-edit.js +0 -82
- package/build/hooks/navigation-menu-edit.js.map +0 -1
- package/build-module/components/global-styles/preview.js +0 -264
- package/build-module/components/global-styles/preview.js.map +0 -1
- package/build-module/components/global-styles/typogrphy-elements.js.map +0 -1
- package/build-module/components/global-styles/variations-panel.js.map +0 -1
- package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -56
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +0 -1
- package/build-module/components/list/added-by.js.map +0 -1
- package/build-module/components/list/header.js +0 -47
- package/build-module/components/list/header.js.map +0 -1
- package/build-module/components/list/index.js +0 -72
- package/build-module/components/list/index.js.map +0 -1
- package/build-module/components/list/table.js +0 -86
- package/build-module/components/list/table.js.map +0 -1
- package/build-module/components/list/use-register-shortcuts.js +0 -45
- package/build-module/components/list/use-register-shortcuts.js.map +0 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +0 -85
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +0 -1
- package/build-module/components/page-patterns/grid-item.js +0 -215
- package/build-module/components/page-patterns/grid-item.js.map +0 -1
- package/build-module/components/page-patterns/grid.js +0 -23
- package/build-module/components/page-patterns/grid.js.map +0 -1
- package/build-module/components/page-patterns/no-patterns.js +0 -11
- package/build-module/components/page-patterns/no-patterns.js.map +0 -1
- package/build-module/components/page-patterns/patterns-list.js +0 -160
- package/build-module/components/page-patterns/patterns-list.js.map +0 -1
- package/build-module/components/page-patterns/rename-menu-item.js +0 -98
- package/build-module/components/page-patterns/rename-menu-item.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -76
- package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -29
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -27
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
- package/build-module/hooks/navigation-menu-edit.js +0 -75
- package/build-module/hooks/navigation-menu-edit.js.map +0 -1
- package/src/components/global-styles/preview.js +0 -327
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -60
- package/src/components/list/header.js +0 -48
- package/src/components/list/index.js +0 -87
- package/src/components/list/style.scss +0 -188
- package/src/components/list/table.js +0 -140
- package/src/components/list/use-register-shortcuts.js +0 -49
- package/src/components/page-patterns/duplicate-menu-item.js +0 -105
- package/src/components/page-patterns/grid-item.js +0 -331
- package/src/components/page-patterns/grid.js +0 -22
- package/src/components/page-patterns/no-patterns.js +0 -12
- package/src/components/page-patterns/patterns-list.js +0 -229
- package/src/components/page-patterns/rename-menu-item.js +0 -132
- package/src/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -89
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +0 -34
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -22
- package/src/hooks/navigation-menu-edit.js +0 -92
- /package/src/components/global-styles/{typogrphy-elements.js → typography-elements.js} +0 -0
|
@@ -1,104 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { store as coreStore } from '@wordpress/core-data';
|
|
10
5
|
import { useSelect } from '@wordpress/data';
|
|
11
|
-
import { useMemo
|
|
12
|
-
import { ENTER } from '@wordpress/keycodes';
|
|
6
|
+
import { useMemo } from '@wordpress/element';
|
|
13
7
|
import { __experimentalGrid as Grid } from '@wordpress/components';
|
|
14
|
-
import { __
|
|
15
|
-
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
16
9
|
|
|
17
10
|
/**
|
|
18
11
|
* Internal dependencies
|
|
19
12
|
*/
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { unlock } from '../../lock-unlock';
|
|
23
|
-
|
|
24
|
-
const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
|
|
25
|
-
blockEditorPrivateApis
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
function Variation( { variation } ) {
|
|
29
|
-
const [ isFocused, setIsFocused ] = useState( false );
|
|
30
|
-
const { base, user, setUserConfig } = useContext( GlobalStylesContext );
|
|
31
|
-
const context = useMemo( () => {
|
|
32
|
-
return {
|
|
33
|
-
user: {
|
|
34
|
-
settings: variation.settings ?? {},
|
|
35
|
-
styles: variation.styles ?? {},
|
|
36
|
-
},
|
|
37
|
-
base,
|
|
38
|
-
merged: mergeBaseAndUserConfigs( base, variation ),
|
|
39
|
-
setUserConfig: () => {},
|
|
40
|
-
};
|
|
41
|
-
}, [ variation, base ] );
|
|
42
|
-
|
|
43
|
-
const selectVariation = () => {
|
|
44
|
-
setUserConfig( () => {
|
|
45
|
-
return {
|
|
46
|
-
settings: variation.settings,
|
|
47
|
-
styles: variation.styles,
|
|
48
|
-
};
|
|
49
|
-
} );
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const selectOnEnter = ( event ) => {
|
|
53
|
-
if ( event.keyCode === ENTER ) {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
selectVariation();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const isActive = useMemo( () => {
|
|
60
|
-
return areGlobalStyleConfigsEqual( user, variation );
|
|
61
|
-
}, [ user, variation ] );
|
|
62
|
-
|
|
63
|
-
let label = variation?.title;
|
|
64
|
-
if ( variation?.description ) {
|
|
65
|
-
label = sprintf(
|
|
66
|
-
/* translators: %1$s: variation title. %2$s variation description. */
|
|
67
|
-
__( '%1$s (%2$s)' ),
|
|
68
|
-
variation?.title,
|
|
69
|
-
variation?.description
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<GlobalStylesContext.Provider value={ context }>
|
|
75
|
-
<div
|
|
76
|
-
className={ classnames(
|
|
77
|
-
'edit-site-global-styles-variations_item',
|
|
78
|
-
{
|
|
79
|
-
'is-active': isActive,
|
|
80
|
-
}
|
|
81
|
-
) }
|
|
82
|
-
role="button"
|
|
83
|
-
onClick={ selectVariation }
|
|
84
|
-
onKeyDown={ selectOnEnter }
|
|
85
|
-
tabIndex="0"
|
|
86
|
-
aria-label={ label }
|
|
87
|
-
aria-current={ isActive }
|
|
88
|
-
onFocus={ () => setIsFocused( true ) }
|
|
89
|
-
onBlur={ () => setIsFocused( false ) }
|
|
90
|
-
>
|
|
91
|
-
<div className="edit-site-global-styles-variations_item-preview">
|
|
92
|
-
<StylesPreview
|
|
93
|
-
label={ variation?.title }
|
|
94
|
-
isFocused={ isFocused }
|
|
95
|
-
withHoverView
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</GlobalStylesContext.Provider>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
13
|
+
import PreviewStyles from './preview-styles';
|
|
14
|
+
import Variation from './variations/variation';
|
|
102
15
|
|
|
103
16
|
export default function StyleVariationsContainer() {
|
|
104
17
|
const variations = useSelect( ( select ) => {
|
|
@@ -128,7 +41,16 @@ export default function StyleVariationsContainer() {
|
|
|
128
41
|
className="edit-site-global-styles-style-variations-container"
|
|
129
42
|
>
|
|
130
43
|
{ withEmptyVariation.map( ( variation, index ) => (
|
|
131
|
-
<Variation key={ index } variation={ variation }
|
|
44
|
+
<Variation key={ index } variation={ variation }>
|
|
45
|
+
{ ( isFocused ) => (
|
|
46
|
+
<PreviewStyles
|
|
47
|
+
label={ variation?.title }
|
|
48
|
+
withHoverView
|
|
49
|
+
isFocused={ isFocused }
|
|
50
|
+
variation={ variation }
|
|
51
|
+
/>
|
|
52
|
+
) }
|
|
53
|
+
</Variation>
|
|
132
54
|
) ) }
|
|
133
55
|
</Grid>
|
|
134
56
|
);
|
|
@@ -91,40 +91,6 @@
|
|
|
91
91
|
margin: 0;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.edit-site-global-styles-variations_item {
|
|
95
|
-
box-sizing: border-box;
|
|
96
|
-
// To round the outline in Windows 10 high contrast mode.
|
|
97
|
-
border-radius: $radius-block-ui;
|
|
98
|
-
|
|
99
|
-
.edit-site-global-styles-variations_item-preview {
|
|
100
|
-
padding: $border-width * 2;
|
|
101
|
-
border-radius: $radius-block-ui;
|
|
102
|
-
box-shadow: 0 0 0 $border-width $gray-200;
|
|
103
|
-
// Shown in Windows 10 high contrast mode.
|
|
104
|
-
outline: 1px solid transparent;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
&.is-active .edit-site-global-styles-variations_item-preview {
|
|
108
|
-
box-shadow: 0 0 0 $border-width $gray-900;
|
|
109
|
-
// Shown in Windows 10 high contrast mode.
|
|
110
|
-
outline-width: 3px;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
&:hover .edit-site-global-styles-variations_item-preview {
|
|
114
|
-
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&:focus .edit-site-global-styles-variations_item-preview {
|
|
118
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
&:focus-visible {
|
|
122
|
-
// Shown in Windows 10 high contrast mode.
|
|
123
|
-
outline: 3px solid transparent;
|
|
124
|
-
outline-offset: 0;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
94
|
.edit-site-global-styles-icon-with-current-color {
|
|
129
95
|
fill: currentColor;
|
|
130
96
|
}
|
|
@@ -173,7 +139,7 @@
|
|
|
173
139
|
}
|
|
174
140
|
|
|
175
141
|
.edit-site-global-styles-screen-css-help-link {
|
|
176
|
-
display: block;
|
|
142
|
+
display: inline-block;
|
|
177
143
|
margin-top: $grid-unit-10;
|
|
178
144
|
}
|
|
179
145
|
.edit-site-global-styles-screen-variations {
|
|
@@ -10,3 +10,40 @@ export function getVariationClassName( variation ) {
|
|
|
10
10
|
}
|
|
11
11
|
return `is-style-${ variation }`;
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
function getFontFamilyFromSetting( fontFamilies, setting ) {
|
|
15
|
+
if ( ! setting ) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const fontFamilyVariable = setting.replace( 'var(', '' ).replace( ')', '' );
|
|
20
|
+
const fontFamilySlug = fontFamilyVariable?.split( '--' ).slice( -1 )[ 0 ];
|
|
21
|
+
|
|
22
|
+
return fontFamilies.find(
|
|
23
|
+
( fontFamily ) => fontFamily.slug === fontFamilySlug
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getFontFamilies( themeJson ) {
|
|
28
|
+
const fontFamilies = themeJson?.settings?.typography?.fontFamilies?.theme; // TODO this could not be under theme.
|
|
29
|
+
const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
|
|
30
|
+
const bodyFontFamily = getFontFamilyFromSetting(
|
|
31
|
+
fontFamilies,
|
|
32
|
+
bodyFontFamilySetting
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const headingFontFamilySetting =
|
|
36
|
+
themeJson?.styles?.elements?.heading?.typography?.fontFamily;
|
|
37
|
+
|
|
38
|
+
let headingFontFamily;
|
|
39
|
+
if ( ! headingFontFamilySetting ) {
|
|
40
|
+
headingFontFamily = bodyFontFamily;
|
|
41
|
+
} else {
|
|
42
|
+
headingFontFamily = getFontFamilyFromSetting(
|
|
43
|
+
fontFamilies,
|
|
44
|
+
themeJson?.styles?.elements?.heading?.typography?.fontFamily
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return [ bodyFontFamily, headingFontFamily ];
|
|
49
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
.edit-site-global-styles-variations_item {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
// To round the outline in Windows 10 high contrast mode.
|
|
4
|
+
border-radius: $radius-block-ui;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
|
|
7
|
+
.edit-site-global-styles-variations_item-preview {
|
|
8
|
+
padding: $border-width * 2;
|
|
9
|
+
border-radius: $radius-block-ui;
|
|
10
|
+
box-shadow: 0 0 0 $border-width $gray-200;
|
|
11
|
+
// Shown in Windows 10 high contrast mode.
|
|
12
|
+
outline: 1px solid transparent;
|
|
13
|
+
|
|
14
|
+
.edit-site-global-styles-color-variations & {
|
|
15
|
+
padding: $grid-unit-10;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.is-active .edit-site-global-styles-variations_item-preview {
|
|
20
|
+
box-shadow: 0 0 0 $border-width $gray-900;
|
|
21
|
+
// Shown in Windows 10 high contrast mode.
|
|
22
|
+
outline-width: 3px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:hover .edit-site-global-styles-variations_item-preview {
|
|
26
|
+
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:focus .edit-site-global-styles-variations_item-preview {
|
|
30
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:focus-visible {
|
|
34
|
+
// Shown in Windows 10 high contrast mode.
|
|
35
|
+
outline: 3px solid transparent;
|
|
36
|
+
outline-offset: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.edit-site-global-styles_preview-typography {
|
|
41
|
+
font-size: 22px;
|
|
42
|
+
line-height: 44px;
|
|
43
|
+
text-align: center;
|
|
44
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useMemo, useContext, useState } from '@wordpress/element';
|
|
10
|
+
import { ENTER } from '@wordpress/keycodes';
|
|
11
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { mergeBaseAndUserConfigs } from '../global-styles-provider';
|
|
18
|
+
import { unlock } from '../../../lock-unlock';
|
|
19
|
+
|
|
20
|
+
const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
|
|
21
|
+
blockEditorPrivateApis
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default function Variation( { variation, children } ) {
|
|
25
|
+
const [ isFocused, setIsFocused ] = useState( false );
|
|
26
|
+
const { base, user, setUserConfig } = useContext( GlobalStylesContext );
|
|
27
|
+
const context = useMemo(
|
|
28
|
+
() => ( {
|
|
29
|
+
user: {
|
|
30
|
+
settings: variation.settings ?? {},
|
|
31
|
+
styles: variation.styles ?? {},
|
|
32
|
+
},
|
|
33
|
+
base,
|
|
34
|
+
merged: mergeBaseAndUserConfigs( base, variation ),
|
|
35
|
+
setUserConfig: () => {},
|
|
36
|
+
} ),
|
|
37
|
+
[ variation, base ]
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const selectVariation = () => {
|
|
41
|
+
setUserConfig( () => ( {
|
|
42
|
+
settings: variation.settings,
|
|
43
|
+
styles: variation.styles,
|
|
44
|
+
} ) );
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const selectOnEnter = ( event ) => {
|
|
48
|
+
if ( event.keyCode === ENTER ) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
selectVariation();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const isActive = useMemo(
|
|
55
|
+
() => areGlobalStyleConfigsEqual( user, variation ),
|
|
56
|
+
[ user, variation ]
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
let label = variation?.title;
|
|
60
|
+
if ( variation?.description ) {
|
|
61
|
+
label = sprintf(
|
|
62
|
+
/* translators: %1$s: variation title. %2$s variation description. */
|
|
63
|
+
__( '%1$s (%2$s)' ),
|
|
64
|
+
variation?.title,
|
|
65
|
+
variation?.description
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<GlobalStylesContext.Provider value={ context }>
|
|
71
|
+
<div
|
|
72
|
+
className={ classnames(
|
|
73
|
+
'edit-site-global-styles-variations_item',
|
|
74
|
+
{
|
|
75
|
+
'is-active': isActive,
|
|
76
|
+
}
|
|
77
|
+
) }
|
|
78
|
+
role="button"
|
|
79
|
+
onClick={ selectVariation }
|
|
80
|
+
onKeyDown={ selectOnEnter }
|
|
81
|
+
tabIndex="0"
|
|
82
|
+
aria-label={ label }
|
|
83
|
+
aria-current={ isActive }
|
|
84
|
+
onFocus={ () => setIsFocused( true ) }
|
|
85
|
+
onBlur={ () => setIsFocused( false ) }
|
|
86
|
+
>
|
|
87
|
+
<div className="edit-site-global-styles-variations_item-preview">
|
|
88
|
+
{ children( isFocused ) }
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</GlobalStylesContext.Provider>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalGrid as Grid,
|
|
6
|
+
__experimentalVStack as VStack,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import Subtitle from '../subtitle';
|
|
14
|
+
import Variation from './variation';
|
|
15
|
+
import StylesPreviewColors from '../preview-colors';
|
|
16
|
+
|
|
17
|
+
export default function ColorVariations( { variations } ) {
|
|
18
|
+
return (
|
|
19
|
+
<VStack spacing={ 3 }>
|
|
20
|
+
<Subtitle level={ 3 }>{ __( 'Presets' ) }</Subtitle>
|
|
21
|
+
<Grid columns={ 3 }>
|
|
22
|
+
{ variations.map( ( variation, index ) => (
|
|
23
|
+
<Variation key={ index } variation={ variation }>
|
|
24
|
+
{ () => <StylesPreviewColors /> }
|
|
25
|
+
</Variation>
|
|
26
|
+
) ) }
|
|
27
|
+
</Grid>
|
|
28
|
+
</VStack>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -8,7 +8,7 @@ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { NavigationButtonAsItem } from '
|
|
11
|
+
import { NavigationButtonAsItem } from '../navigation-button';
|
|
12
12
|
|
|
13
13
|
function getCoreBlockStyles( blockStyles ) {
|
|
14
14
|
return blockStyles?.filter( ( style ) => style.source === 'block' );
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useContext } from '@wordpress/element';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalGrid as Grid,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { mergeBaseAndUserConfigs } from '../global-styles-provider';
|
|
16
|
+
import { unlock } from '../../../lock-unlock';
|
|
17
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
18
|
+
import PreviewTypography from '../preview-typography';
|
|
19
|
+
import Subtitle from '../subtitle';
|
|
20
|
+
import { getFontFamilies } from '../utils';
|
|
21
|
+
import Variation from './variation';
|
|
22
|
+
|
|
23
|
+
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
24
|
+
|
|
25
|
+
export default function TypographyVariations() {
|
|
26
|
+
const typographyVariations =
|
|
27
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
28
|
+
property: 'typography',
|
|
29
|
+
filter: ( variation ) =>
|
|
30
|
+
variation?.settings?.typography?.fontFamilies &&
|
|
31
|
+
Object.keys( variation?.settings?.typography?.fontFamilies )
|
|
32
|
+
.length,
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
const { base } = useContext( GlobalStylesContext );
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* Filter duplicate variations based on the font families used in the variation.
|
|
39
|
+
*/
|
|
40
|
+
const uniqueTypographyVariations = typographyVariations?.length
|
|
41
|
+
? Object.values(
|
|
42
|
+
typographyVariations.reduce( ( acc, variation ) => {
|
|
43
|
+
const [ bodyFontFamily, headingFontFamily ] =
|
|
44
|
+
getFontFamilies(
|
|
45
|
+
mergeBaseAndUserConfigs( base, variation )
|
|
46
|
+
);
|
|
47
|
+
if (
|
|
48
|
+
headingFontFamily?.name &&
|
|
49
|
+
bodyFontFamily?.name &&
|
|
50
|
+
! acc[
|
|
51
|
+
`${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
|
|
52
|
+
]
|
|
53
|
+
) {
|
|
54
|
+
acc[
|
|
55
|
+
`${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
|
|
56
|
+
] = variation;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return acc;
|
|
60
|
+
}, {} )
|
|
61
|
+
)
|
|
62
|
+
: [];
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<VStack spacing={ 3 }>
|
|
66
|
+
<Subtitle level={ 3 }>{ __( 'Presets' ) }</Subtitle>
|
|
67
|
+
<Grid
|
|
68
|
+
columns={ 3 }
|
|
69
|
+
className="edit-site-global-styles-style-variations-container"
|
|
70
|
+
>
|
|
71
|
+
{ typographyVariations && typographyVariations.length
|
|
72
|
+
? uniqueTypographyVariations.map( ( variation, index ) => (
|
|
73
|
+
<Variation key={ index } variation={ variation }>
|
|
74
|
+
{ () => (
|
|
75
|
+
<PreviewTypography
|
|
76
|
+
variation={ variation }
|
|
77
|
+
/>
|
|
78
|
+
) }
|
|
79
|
+
</Variation>
|
|
80
|
+
) )
|
|
81
|
+
: null }
|
|
82
|
+
</Grid>
|
|
83
|
+
</VStack>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
-
import { store as editSiteStore } from '../../../store';
|
|
19
18
|
import { unlock } from '../../../lock-unlock';
|
|
20
19
|
|
|
21
20
|
const { DocumentTools: EditorDocumentTools } = unlock( editorPrivateApis );
|
|
@@ -26,7 +25,7 @@ export default function DocumentTools( {
|
|
|
26
25
|
isDistractionFree,
|
|
27
26
|
} ) {
|
|
28
27
|
const { isVisualMode } = useSelect( ( select ) => {
|
|
29
|
-
const { getEditorMode } = select(
|
|
28
|
+
const { getEditorMode } = select( editorStore );
|
|
30
29
|
|
|
31
30
|
return {
|
|
32
31
|
isVisualMode: getEditorMode() === 'visual',
|
|
@@ -9,6 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { useViewportMatch, useReducedMotion } from '@wordpress/compose';
|
|
10
10
|
import {
|
|
11
11
|
BlockToolbar,
|
|
12
|
+
privateApis as blockEditorPrivateApis,
|
|
12
13
|
store as blockEditorStore,
|
|
13
14
|
} from '@wordpress/block-editor';
|
|
14
15
|
import { useSelect } from '@wordpress/data';
|
|
@@ -42,6 +43,7 @@ import {
|
|
|
42
43
|
import { unlock } from '../../lock-unlock';
|
|
43
44
|
import { FOCUSABLE_ENTITIES } from '../../utils/constants';
|
|
44
45
|
|
|
46
|
+
const { useShowBlockTools } = unlock( blockEditorPrivateApis );
|
|
45
47
|
const { PostViewLink, PreviewDropdown } = unlock( editorPrivateApis );
|
|
46
48
|
|
|
47
49
|
export default function HeaderEditMode() {
|
|
@@ -52,8 +54,6 @@ export default function HeaderEditMode() {
|
|
|
52
54
|
blockSelectionStart,
|
|
53
55
|
showIconLabels,
|
|
54
56
|
editorCanvasView,
|
|
55
|
-
hasFixedToolbar,
|
|
56
|
-
isZoomOutMode,
|
|
57
57
|
} = useSelect( ( select ) => {
|
|
58
58
|
const { getEditedPostType } = select( editSiteStore );
|
|
59
59
|
const { getBlockSelectionStart, __unstableGetEditorMode } =
|
|
@@ -70,14 +70,13 @@ export default function HeaderEditMode() {
|
|
|
70
70
|
editorCanvasView: unlock(
|
|
71
71
|
select( editSiteStore )
|
|
72
72
|
).getEditorCanvasContainerView(),
|
|
73
|
-
hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
|
|
74
73
|
isDistractionFree: getPreference( 'core', 'distractionFree' ),
|
|
75
|
-
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
76
74
|
};
|
|
77
75
|
}, [] );
|
|
78
76
|
|
|
79
77
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
80
|
-
const
|
|
78
|
+
const { showFixedToolbar } = useShowBlockTools();
|
|
79
|
+
const showTopToolbar = isLargeViewport && showFixedToolbar;
|
|
81
80
|
const blockToolbarRef = useRef();
|
|
82
81
|
const disableMotion = useReducedMotion();
|
|
83
82
|
|
|
@@ -90,8 +89,6 @@ export default function HeaderEditMode() {
|
|
|
90
89
|
const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
|
|
91
90
|
useState( true );
|
|
92
91
|
|
|
93
|
-
const hasBlockSelected = !! blockSelectionStart;
|
|
94
|
-
|
|
95
92
|
useEffect( () => {
|
|
96
93
|
// If we have a new block selection, show the block tools
|
|
97
94
|
if ( blockSelectionStart ) {
|
|
@@ -128,15 +125,13 @@ export default function HeaderEditMode() {
|
|
|
128
125
|
blockEditorMode={ blockEditorMode }
|
|
129
126
|
isDistractionFree={ isDistractionFree }
|
|
130
127
|
/>
|
|
131
|
-
{
|
|
128
|
+
{ showTopToolbar && (
|
|
132
129
|
<>
|
|
133
130
|
<div
|
|
134
131
|
className={ classnames(
|
|
135
132
|
'selected-block-tools-wrapper',
|
|
136
133
|
{
|
|
137
|
-
'is-collapsed':
|
|
138
|
-
isBlockToolsCollapsed ||
|
|
139
|
-
! hasBlockSelected,
|
|
134
|
+
'is-collapsed': isBlockToolsCollapsed,
|
|
140
135
|
}
|
|
141
136
|
) }
|
|
142
137
|
>
|
|
@@ -146,24 +141,20 @@ export default function HeaderEditMode() {
|
|
|
146
141
|
ref={ blockToolbarRef }
|
|
147
142
|
name="block-toolbar"
|
|
148
143
|
/>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
: __( 'Hide block tools' )
|
|
164
|
-
}
|
|
165
|
-
/>
|
|
166
|
-
) }
|
|
144
|
+
<Button
|
|
145
|
+
className="edit-site-header-edit-mode__block-tools-toggle"
|
|
146
|
+
icon={ isBlockToolsCollapsed ? next : previous }
|
|
147
|
+
onClick={ () => {
|
|
148
|
+
setIsBlockToolsCollapsed(
|
|
149
|
+
( collapsed ) => ! collapsed
|
|
150
|
+
);
|
|
151
|
+
} }
|
|
152
|
+
label={
|
|
153
|
+
isBlockToolsCollapsed
|
|
154
|
+
? __( 'Show block tools' )
|
|
155
|
+
: __( 'Hide block tools' )
|
|
156
|
+
}
|
|
157
|
+
/>
|
|
167
158
|
</>
|
|
168
159
|
) }
|
|
169
160
|
</motion.div>
|
|
@@ -175,7 +166,7 @@ export default function HeaderEditMode() {
|
|
|
175
166
|
'edit-site-header-edit-mode__center',
|
|
176
167
|
{
|
|
177
168
|
'is-collapsed':
|
|
178
|
-
! isBlockToolsCollapsed &&
|
|
169
|
+
! isBlockToolsCollapsed && showTopToolbar,
|
|
179
170
|
}
|
|
180
171
|
) }
|
|
181
172
|
>
|
|
@@ -208,7 +199,7 @@ export default function HeaderEditMode() {
|
|
|
208
199
|
</div>
|
|
209
200
|
) }
|
|
210
201
|
<PostViewLink />
|
|
211
|
-
<SaveButton />
|
|
202
|
+
<SaveButton size="compact" />
|
|
212
203
|
{ ! isDistractionFree && (
|
|
213
204
|
<PinnedItems.Slot scope="core/edit-site" />
|
|
214
205
|
) }
|