@wordpress/edit-site 5.29.0 → 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 +2 -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/editor/index.js +1 -15
- package/build/components/editor/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 +2 -2
- 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 +62 -58
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +10 -15
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +118 -76
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-demo.js +29 -8
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +19 -6
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +151 -79
- 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 +2 -2
- 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 +8 -14
- 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 +38 -4
- 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-revisions/index.js +2 -2
- package/build/components/global-styles/screen-revisions/index.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/ui.js +27 -2
- package/build/components/global-styles/ui.js.map +1 -1
- 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/index.js +12 -11
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +10 -2
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/layout/index.js +4 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/index.js +14 -14
- 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/resizable-frame/index.js +2 -1
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/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-dataviews/default-views.js +2 -0
- package/build/components/sidebar-dataviews/default-views.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/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 +4 -4
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- 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/editor/index.js +2 -16
- package/build-module/components/editor/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 +4 -4
- 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 +63 -59
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +11 -16
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +121 -79
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-demo.js +30 -9
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +19 -6
- 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 +151 -79
- 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 +4 -4
- 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 +9 -15
- 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 +37 -4
- 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-revisions/index.js +2 -2
- package/build-module/components/global-styles/screen-revisions/index.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/ui.js +27 -2
- package/build-module/components/global-styles/ui.js.map +1 -1
- 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/index.js +13 -12
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +13 -5
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/layout/index.js +4 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +14 -14
- 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/resizable-frame/index.js +2 -1
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/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-dataviews/default-views.js +3 -1
- package/build-module/components/sidebar-dataviews/default-views.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/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 +3 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +63 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-style/style-rtl.css +163 -286
- package/build-style/style.css +163 -286
- package/package.json +42 -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/editor/index.js +0 -20
- 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 +5 -5
- package/src/components/global-styles/font-library-modal/context.js +116 -104
- package/src/components/global-styles/font-library-modal/font-card.js +11 -26
- package/src/components/global-styles/font-library-modal/font-collection.js +297 -218
- package/src/components/global-styles/font-library-modal/font-demo.js +38 -4
- package/src/components/global-styles/font-library-modal/index.js +23 -16
- package/src/components/global-styles/font-library-modal/installed-fonts.js +243 -114
- package/src/components/global-styles/font-library-modal/library-font-variant.js +5 -5
- package/src/components/global-styles/font-library-modal/style.scss +15 -8
- package/src/components/global-styles/font-library-modal/upload-fonts.js +17 -19
- package/src/components/global-styles/font-library-modal/utils/index.js +44 -4
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +2 -1
- package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +7 -18
- 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/index.js +5 -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 +0 -34
- package/src/components/global-styles/ui.js +26 -2
- 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/index.js +20 -27
- package/src/components/header-edit-mode/more-menu/index.js +17 -8
- package/src/components/header-edit-mode/style.scss +4 -0
- package/src/components/layout/index.js +5 -0
- package/src/components/page-patterns/index.js +21 -21
- 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/resizable-frame/index.js +1 -0
- package/src/components/revisions/index.js +1 -1
- package/src/components/save-panel/index.js +34 -12
- package/src/components/sidebar/index.js +1 -1
- package/src/components/sidebar-dataviews/default-views.js +3 -1
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -1
- package/src/components/sidebar-edit-mode/template-panel/index.js +1 -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 +3 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +5 -3
- package/src/components/start-template-options/index.js +1 -1
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +173 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +68 -1
- package/src/style.scss +2 -2
- package/build/components/global-styles/font-library-modal/collection-font-details.js +0 -50
- package/build/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -30
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
- package/build/components/global-styles/font-library-modal/library-font-card.js +0 -39
- package/build/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js +0 -67
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
- 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/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/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-module/components/global-styles/font-library-modal/collection-font-details.js +0 -42
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -23
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js +0 -31
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +0 -60
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.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/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/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/src/components/global-styles/font-library-modal/collection-font-details.js +0 -56
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -33
- package/src/components/global-styles/font-library-modal/library-font-card.js +0 -34
- package/src/components/global-styles/font-library-modal/tab-panel-layout.js +0 -85
- package/src/components/global-styles/preview.js +0 -327
- 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/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/components/global-styles/{typogrphy-elements.js → typography-elements.js} +0 -0
|
@@ -73,7 +73,11 @@ function ScreenRevisions() {
|
|
|
73
73
|
|
|
74
74
|
const onCloseRevisions = () => {
|
|
75
75
|
goTo( '/' ); // Return to global styles main panel.
|
|
76
|
-
|
|
76
|
+
const canvasContainerView =
|
|
77
|
+
editorCanvasContainerView === 'global-styles-revisions:style-book'
|
|
78
|
+
? 'style-book'
|
|
79
|
+
: undefined;
|
|
80
|
+
setEditorCanvasContainerView( canvasContainerView );
|
|
77
81
|
};
|
|
78
82
|
|
|
79
83
|
const restoreRevision = ( revision ) => {
|
|
@@ -99,7 +103,6 @@ function ScreenRevisions() {
|
|
|
99
103
|
! editorCanvasContainerView.startsWith( 'global-styles-revisions' )
|
|
100
104
|
) {
|
|
101
105
|
goTo( '/' ); // Return to global styles main panel.
|
|
102
|
-
setEditorCanvasContainerView( editorCanvasContainerView );
|
|
103
106
|
}
|
|
104
107
|
}, [ editorCanvasContainerView ] );
|
|
105
108
|
|
|
@@ -24,7 +24,7 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
24
24
|
import { IconWithCurrentColor } from './icon-with-current-color';
|
|
25
25
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
26
26
|
import RootMenu from './root-menu';
|
|
27
|
-
import
|
|
27
|
+
import PreviewStyles from './preview-styles';
|
|
28
28
|
import { unlock } from '../../lock-unlock';
|
|
29
29
|
|
|
30
30
|
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
@@ -58,7 +58,7 @@ function ScreenRoot() {
|
|
|
58
58
|
<VStack spacing={ 4 }>
|
|
59
59
|
<Card>
|
|
60
60
|
<CardMedia>
|
|
61
|
-
<
|
|
61
|
+
<PreviewStyles />
|
|
62
62
|
</CardMedia>
|
|
63
63
|
</Card>
|
|
64
64
|
{ hasVariations && (
|
|
@@ -9,9 +9,11 @@ import { useSelect } from '@wordpress/data';
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
-
import TypographyElements from './
|
|
12
|
+
import TypographyElements from './typography-elements';
|
|
13
|
+
import TypographyVariations from './variations/variations-typography';
|
|
13
14
|
import FontFamilies from './font-families';
|
|
14
15
|
import ScreenHeader from './header';
|
|
16
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
15
17
|
|
|
16
18
|
function ScreenTypography() {
|
|
17
19
|
const fontLibraryEnabled = useSelect(
|
|
@@ -19,6 +21,14 @@ function ScreenTypography() {
|
|
|
19
21
|
select( editorStore ).getEditorSettings().fontLibraryEnabled,
|
|
20
22
|
[]
|
|
21
23
|
);
|
|
24
|
+
const typographyVariations =
|
|
25
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
26
|
+
property: 'typography',
|
|
27
|
+
filter: ( variation ) =>
|
|
28
|
+
variation?.settings?.typography?.fontFamilies &&
|
|
29
|
+
Object.keys( variation?.settings?.typography?.fontFamilies )
|
|
30
|
+
.length,
|
|
31
|
+
} );
|
|
22
32
|
|
|
23
33
|
return (
|
|
24
34
|
<>
|
|
@@ -30,7 +40,14 @@ function ScreenTypography() {
|
|
|
30
40
|
/>
|
|
31
41
|
<div className="edit-site-global-styles-screen-typography">
|
|
32
42
|
<VStack spacing={ 6 }>
|
|
33
|
-
{
|
|
43
|
+
{ !! typographyVariations.length && (
|
|
44
|
+
<TypographyVariations />
|
|
45
|
+
) }
|
|
46
|
+
{ ! window.__experimentalDisableFontLibrary && (
|
|
47
|
+
<VStack spacing={ 3 }>
|
|
48
|
+
{ fontLibraryEnabled && <FontFamilies /> }
|
|
49
|
+
</VStack>
|
|
50
|
+
) }
|
|
34
51
|
<TypographyElements />
|
|
35
52
|
</VStack>
|
|
36
53
|
</div>
|
|
@@ -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
|
}
|
|
@@ -230,12 +230,14 @@ function GlobalStylesBlockLink() {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
function GlobalStylesEditorCanvasContainerLink() {
|
|
233
|
-
const { goTo } = useNavigator();
|
|
233
|
+
const { goTo, location } = useNavigator();
|
|
234
234
|
const editorCanvasContainerView = useSelect(
|
|
235
235
|
( select ) =>
|
|
236
236
|
unlock( select( editSiteStore ) ).getEditorCanvasContainerView(),
|
|
237
237
|
[]
|
|
238
238
|
);
|
|
239
|
+
const path = location?.path;
|
|
240
|
+
const isRevisionsOpen = path === '/revisions';
|
|
239
241
|
|
|
240
242
|
// If the user switches the editor canvas container view, redirect
|
|
241
243
|
// to the appropriate screen. This effectively allows deep linking to the
|
|
@@ -249,11 +251,33 @@ function GlobalStylesEditorCanvasContainerLink() {
|
|
|
249
251
|
case 'global-styles-css':
|
|
250
252
|
goTo( '/css' );
|
|
251
253
|
break;
|
|
254
|
+
case 'style-book':
|
|
255
|
+
/*
|
|
256
|
+
* The stand-alone style book is open
|
|
257
|
+
* and the revisions panel is open,
|
|
258
|
+
* close the revisions panel.
|
|
259
|
+
* Otherwise keep the style book open while
|
|
260
|
+
* browsing global styles panel.
|
|
261
|
+
*/
|
|
262
|
+
if ( isRevisionsOpen ) {
|
|
263
|
+
goTo( '/' );
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
252
266
|
default:
|
|
267
|
+
/*
|
|
268
|
+
* Example: the user has navigated to "Browse styles" or elsewhere
|
|
269
|
+
* and changes the editorCanvasContainerView, e.g., closes the style book.
|
|
270
|
+
* The panel should not be affected.
|
|
271
|
+
* Exclude revisions panel from this behavior,
|
|
272
|
+
* as it should close when the editorCanvasContainerView doesn't correspond.
|
|
273
|
+
*/
|
|
274
|
+
if ( path !== '/' && ! isRevisionsOpen ) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
253
277
|
goTo( '/' );
|
|
254
278
|
break;
|
|
255
279
|
}
|
|
256
|
-
}, [ editorCanvasContainerView, goTo ] );
|
|
280
|
+
}, [ editorCanvasContainerView, isRevisionsOpen, goTo ] );
|
|
257
281
|
}
|
|
258
282
|
|
|
259
283
|
function GlobalStylesUI() {
|
|
@@ -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
|
+
}
|