@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
|
@@ -121,7 +121,47 @@ export async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
/*
|
|
125
|
+
* Unloads the font face and remove it from the browser.
|
|
126
|
+
* It also removes it from the iframe document.
|
|
127
|
+
*
|
|
128
|
+
* Note that Font faces that were added to the set using the CSS @font-face rule
|
|
129
|
+
* remain connected to the corresponding CSS, and cannot be deleted.
|
|
130
|
+
*
|
|
131
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/delete.
|
|
132
|
+
*/
|
|
133
|
+
export function unloadFontFaceInBrowser( fontFace, removeFrom = 'all' ) {
|
|
134
|
+
const unloadFontFace = ( fonts ) => {
|
|
135
|
+
fonts.forEach( ( f ) => {
|
|
136
|
+
if (
|
|
137
|
+
f.family === formatFontFaceName( fontFace.fontFamily ) &&
|
|
138
|
+
f.weight === fontFace.fontWeight &&
|
|
139
|
+
f.style === fontFace.fontStyle
|
|
140
|
+
) {
|
|
141
|
+
fonts.delete( f );
|
|
142
|
+
}
|
|
143
|
+
} );
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
if ( removeFrom === 'document' || removeFrom === 'all' ) {
|
|
147
|
+
unloadFontFace( document.fonts );
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if ( removeFrom === 'iframe' || removeFrom === 'all' ) {
|
|
151
|
+
const iframeDocument = document.querySelector(
|
|
152
|
+
'iframe[name="editor-canvas"]'
|
|
153
|
+
).contentDocument;
|
|
154
|
+
unloadFontFace( iframeDocument.fonts );
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Retrieves the display source from a font face src.
|
|
160
|
+
*
|
|
161
|
+
* @param {string|string[]} input - The font face src.
|
|
162
|
+
* @return {string|undefined} The display source or undefined if the input is invalid.
|
|
163
|
+
*/
|
|
164
|
+
export function getDisplaySrcFromFontFace( input ) {
|
|
125
165
|
if ( ! input ) {
|
|
126
166
|
return;
|
|
127
167
|
}
|
|
@@ -132,9 +172,9 @@ export function getDisplaySrcFromFontFace( input, urlPrefix ) {
|
|
|
132
172
|
} else {
|
|
133
173
|
src = input;
|
|
134
174
|
}
|
|
135
|
-
//
|
|
136
|
-
if ( src.startsWith( 'file:.' )
|
|
137
|
-
|
|
175
|
+
// It's expected theme fonts will already be loaded in the browser.
|
|
176
|
+
if ( src.startsWith( 'file:.' ) ) {
|
|
177
|
+
return;
|
|
138
178
|
}
|
|
139
179
|
if ( ! isUrlEncoded( src ) ) {
|
|
140
180
|
src = encodeURI( src );
|
|
@@ -117,7 +117,8 @@ export function getFamilyPreviewStyle( family ) {
|
|
|
117
117
|
if ( family.fontFace ) {
|
|
118
118
|
//get all the font faces with normal style
|
|
119
119
|
const normalFaces = family.fontFace.filter(
|
|
120
|
-
( face ) =>
|
|
120
|
+
( face ) =>
|
|
121
|
+
face?.fontStyle && face.fontStyle.toLowerCase() === 'normal'
|
|
121
122
|
);
|
|
122
123
|
if ( normalFaces.length > 0 ) {
|
|
123
124
|
style.fontStyle = 'normal';
|
package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js
CHANGED
|
@@ -21,33 +21,22 @@ describe( 'getDisplaySrcFromFontFace', () => {
|
|
|
21
21
|
);
|
|
22
22
|
} );
|
|
23
23
|
|
|
24
|
-
it( '
|
|
25
|
-
const input = 'file:./font1';
|
|
26
|
-
|
|
27
|
-
expect( getDisplaySrcFromFontFace( input, urlPrefix ) ).toBe(
|
|
28
|
-
'http://example.com/font1'
|
|
29
|
-
);
|
|
30
|
-
} );
|
|
31
|
-
|
|
32
|
-
it( 'does not modify URL if it does not start with file:.', () => {
|
|
33
|
-
const input = [ 'http://some-other-place.com/font1' ];
|
|
34
|
-
const urlPrefix = 'http://example.com';
|
|
35
|
-
expect( getDisplaySrcFromFontFace( input, urlPrefix ) ).toBe(
|
|
36
|
-
'http://some-other-place.com/font1'
|
|
37
|
-
);
|
|
24
|
+
it( 'return undefined when the url starts with file:', () => {
|
|
25
|
+
const input = 'file:./theme/assets/font1.ttf';
|
|
26
|
+
expect( getDisplaySrcFromFontFace( input ) ).toBe( undefined );
|
|
38
27
|
} );
|
|
39
28
|
|
|
40
29
|
it( 'encodes the URL if it is not encoded', () => {
|
|
41
|
-
const input = '
|
|
30
|
+
const input = 'https://example.org/font one with spaces.ttf';
|
|
42
31
|
expect( getDisplaySrcFromFontFace( input ) ).toBe(
|
|
43
|
-
'
|
|
32
|
+
'https://example.org/font%20one%20with%20spaces.ttf'
|
|
44
33
|
);
|
|
45
34
|
} );
|
|
46
35
|
|
|
47
36
|
it( 'does not encode the URL if it is already encoded', () => {
|
|
48
|
-
const input = '
|
|
37
|
+
const input = 'https://example.org/fonts/font%20one.ttf';
|
|
49
38
|
expect( getDisplaySrcFromFontFace( input ) ).toBe(
|
|
50
|
-
'
|
|
39
|
+
'https://example.org/fonts/font%20one.ttf'
|
|
51
40
|
);
|
|
52
41
|
} );
|
|
53
42
|
} );
|
|
@@ -114,8 +114,8 @@ export default function GradientPalettePanel( { name } ) {
|
|
|
114
114
|
<Spacer margin={ 3 } />
|
|
115
115
|
<DuotonePicker
|
|
116
116
|
duotonePalette={ duotonePalette }
|
|
117
|
-
disableCustomDuotone
|
|
118
|
-
disableCustomColors
|
|
117
|
+
disableCustomDuotone
|
|
118
|
+
disableCustomColors
|
|
119
119
|
clearable={ false }
|
|
120
120
|
onChange={ noop }
|
|
121
121
|
/>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __unstableMotion as motion } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useStylesPreviewColors } from './hooks';
|
|
10
|
+
|
|
11
|
+
export default function HighlightedColors( {
|
|
12
|
+
normalizedColorSwatchSize,
|
|
13
|
+
ratio,
|
|
14
|
+
} ) {
|
|
15
|
+
const { highlightedColors } = useStylesPreviewColors();
|
|
16
|
+
const scaledSwatchSize = normalizedColorSwatchSize * ratio;
|
|
17
|
+
return highlightedColors.map( ( { slug, color }, index ) => (
|
|
18
|
+
<motion.div
|
|
19
|
+
key={ slug }
|
|
20
|
+
style={ {
|
|
21
|
+
height: scaledSwatchSize,
|
|
22
|
+
width: scaledSwatchSize,
|
|
23
|
+
background: color,
|
|
24
|
+
borderRadius: scaledSwatchSize / 2,
|
|
25
|
+
} }
|
|
26
|
+
animate={ {
|
|
27
|
+
scale: 1,
|
|
28
|
+
opacity: 1,
|
|
29
|
+
} }
|
|
30
|
+
initial={ {
|
|
31
|
+
scale: 0.1,
|
|
32
|
+
opacity: 0,
|
|
33
|
+
} }
|
|
34
|
+
transition={ {
|
|
35
|
+
delay: index === 1 ? 0.2 : 0.1,
|
|
36
|
+
} }
|
|
37
|
+
/>
|
|
38
|
+
) );
|
|
39
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalHStack as HStack,
|
|
6
|
+
__unstableMotion as motion,
|
|
7
|
+
} from '@wordpress/components';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import HighlightedColors from './highlighted-colors';
|
|
13
|
+
import PreviewIframe from './preview-iframe';
|
|
14
|
+
|
|
15
|
+
const firstFrameVariants = {
|
|
16
|
+
start: {
|
|
17
|
+
scale: 1,
|
|
18
|
+
opacity: 1,
|
|
19
|
+
},
|
|
20
|
+
hover: {
|
|
21
|
+
scale: 0,
|
|
22
|
+
opacity: 0,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const StylesPreviewColors = ( { label, isFocused, withHoverView } ) => {
|
|
27
|
+
return (
|
|
28
|
+
<PreviewIframe
|
|
29
|
+
label={ label }
|
|
30
|
+
isFocused={ isFocused }
|
|
31
|
+
withHoverView={ withHoverView }
|
|
32
|
+
>
|
|
33
|
+
{ ( { ratio, key } ) => (
|
|
34
|
+
<motion.div
|
|
35
|
+
key={ key }
|
|
36
|
+
variants={ firstFrameVariants }
|
|
37
|
+
style={ {
|
|
38
|
+
height: '100%',
|
|
39
|
+
overflow: 'hidden',
|
|
40
|
+
} }
|
|
41
|
+
>
|
|
42
|
+
<HStack
|
|
43
|
+
spacing={ 10 * ratio }
|
|
44
|
+
justify="center"
|
|
45
|
+
style={ {
|
|
46
|
+
height: '100%',
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
} }
|
|
49
|
+
>
|
|
50
|
+
<HighlightedColors
|
|
51
|
+
normalizedColorSwatchSize={ 66 }
|
|
52
|
+
ratio={ ratio }
|
|
53
|
+
/>
|
|
54
|
+
</HStack>
|
|
55
|
+
</motion.div>
|
|
56
|
+
) }
|
|
57
|
+
</PreviewIframe>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default StylesPreviewColors;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__unstableIframe as Iframe,
|
|
6
|
+
__unstableEditorStyles as EditorStyles,
|
|
7
|
+
privateApis as blockEditorPrivateApis,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import { __unstableMotion as motion } from '@wordpress/components';
|
|
10
|
+
import {
|
|
11
|
+
useThrottle,
|
|
12
|
+
useReducedMotion,
|
|
13
|
+
useResizeObserver,
|
|
14
|
+
} from '@wordpress/compose';
|
|
15
|
+
import { useLayoutEffect, useState, useMemo } from '@wordpress/element';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
import { unlock } from '../../lock-unlock';
|
|
21
|
+
|
|
22
|
+
const { useGlobalStyle, useGlobalStylesOutput } = unlock(
|
|
23
|
+
blockEditorPrivateApis
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const normalizedWidth = 248;
|
|
27
|
+
const normalizedHeight = 152;
|
|
28
|
+
|
|
29
|
+
// Throttle options for useThrottle. Must be defined outside of the component,
|
|
30
|
+
// so that the object reference is the same on each render.
|
|
31
|
+
const THROTTLE_OPTIONS = {
|
|
32
|
+
leading: true,
|
|
33
|
+
trailing: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default function PreviewIframe( {
|
|
37
|
+
children,
|
|
38
|
+
label,
|
|
39
|
+
isFocused,
|
|
40
|
+
withHoverView,
|
|
41
|
+
} ) {
|
|
42
|
+
const [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );
|
|
43
|
+
const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
|
|
44
|
+
const [ styles ] = useGlobalStylesOutput();
|
|
45
|
+
const disableMotion = useReducedMotion();
|
|
46
|
+
const [ isHovered, setIsHovered ] = useState( false );
|
|
47
|
+
const [ containerResizeListener, { width } ] = useResizeObserver();
|
|
48
|
+
const [ throttledWidth, setThrottledWidthState ] = useState( width );
|
|
49
|
+
const [ ratioState, setRatioState ] = useState();
|
|
50
|
+
|
|
51
|
+
const setThrottledWidth = useThrottle(
|
|
52
|
+
setThrottledWidthState,
|
|
53
|
+
250,
|
|
54
|
+
THROTTLE_OPTIONS
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
58
|
+
// size before the width is set.
|
|
59
|
+
useLayoutEffect( () => {
|
|
60
|
+
if ( width ) {
|
|
61
|
+
setThrottledWidth( width );
|
|
62
|
+
}
|
|
63
|
+
}, [ width, setThrottledWidth ] );
|
|
64
|
+
|
|
65
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
66
|
+
// size before the width is set.
|
|
67
|
+
useLayoutEffect( () => {
|
|
68
|
+
const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
|
|
69
|
+
const ratioDiff = newRatio - ( ratioState || 0 );
|
|
70
|
+
|
|
71
|
+
// Only update the ratio state if the difference is big enough
|
|
72
|
+
// or if the ratio state is not yet set. This is to avoid an
|
|
73
|
+
// endless loop of updates at particular viewport heights when the
|
|
74
|
+
// presence of a scrollbar causes the width to change slightly.
|
|
75
|
+
const isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;
|
|
76
|
+
|
|
77
|
+
if ( isRatioDiffBigEnough || ! ratioState ) {
|
|
78
|
+
setRatioState( newRatio );
|
|
79
|
+
}
|
|
80
|
+
}, [ throttledWidth, ratioState ] );
|
|
81
|
+
|
|
82
|
+
// Set a fallbackRatio to use before the throttled ratio has been set.
|
|
83
|
+
const fallbackRatio = width ? width / normalizedWidth : 1;
|
|
84
|
+
/*
|
|
85
|
+
* Use the throttled ratio if it has been calculated, otherwise
|
|
86
|
+
* use the fallback ratio. The throttled ratio is used to avoid
|
|
87
|
+
* an endless loop of updates at particular viewport heights.
|
|
88
|
+
* See: https://github.com/WordPress/gutenberg/issues/55112
|
|
89
|
+
*/
|
|
90
|
+
const ratio = ratioState ? ratioState : fallbackRatio;
|
|
91
|
+
|
|
92
|
+
/*
|
|
93
|
+
* Reset leaked styles from WP common.css and remove main content layout padding and border.
|
|
94
|
+
* Add pointer cursor to the body to indicate the iframe is interactive,
|
|
95
|
+
* similar to Typography variation previews.
|
|
96
|
+
*/
|
|
97
|
+
const editorStyles = useMemo( () => {
|
|
98
|
+
if ( styles ) {
|
|
99
|
+
return [
|
|
100
|
+
...styles,
|
|
101
|
+
{
|
|
102
|
+
css: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;cursor: pointer;}',
|
|
103
|
+
isGlobalStyles: true,
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return styles;
|
|
109
|
+
}, [ styles ] );
|
|
110
|
+
const isReady = !! width;
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<>
|
|
114
|
+
<div style={ { position: 'relative' } }>
|
|
115
|
+
{ containerResizeListener }
|
|
116
|
+
</div>
|
|
117
|
+
{ isReady && (
|
|
118
|
+
<Iframe
|
|
119
|
+
className="edit-site-global-styles-preview__iframe"
|
|
120
|
+
style={ {
|
|
121
|
+
width: '100%',
|
|
122
|
+
height: normalizedHeight * ratio,
|
|
123
|
+
} }
|
|
124
|
+
onMouseEnter={ () => setIsHovered( true ) }
|
|
125
|
+
onMouseLeave={ () => setIsHovered( false ) }
|
|
126
|
+
tabIndex={ -1 }
|
|
127
|
+
>
|
|
128
|
+
<EditorStyles styles={ editorStyles } />
|
|
129
|
+
<motion.div
|
|
130
|
+
style={ {
|
|
131
|
+
height: normalizedHeight * ratio,
|
|
132
|
+
width: '100%',
|
|
133
|
+
background: gradientValue ?? backgroundColor,
|
|
134
|
+
cursor: withHoverView ? 'pointer' : undefined,
|
|
135
|
+
} }
|
|
136
|
+
initial="start"
|
|
137
|
+
animate={
|
|
138
|
+
( isHovered || isFocused ) &&
|
|
139
|
+
! disableMotion &&
|
|
140
|
+
label
|
|
141
|
+
? 'hover'
|
|
142
|
+
: 'start'
|
|
143
|
+
}
|
|
144
|
+
>
|
|
145
|
+
{ []
|
|
146
|
+
.concat( children ) // This makes sure children is always an array.
|
|
147
|
+
.map( ( child, key ) => child( { ratio, key } ) ) }
|
|
148
|
+
</motion.div>
|
|
149
|
+
</Iframe>
|
|
150
|
+
) }
|
|
151
|
+
</>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalHStack as HStack,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
8
|
+
__unstableMotion as motion,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
import { useStylesPreviewColors } from './hooks';
|
|
16
|
+
import PreviewTypography from './preview-typography';
|
|
17
|
+
import HighlightedColors from './highlighted-colors';
|
|
18
|
+
import PreviewIframe from './preview-iframe';
|
|
19
|
+
|
|
20
|
+
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
21
|
+
|
|
22
|
+
const firstFrameVariants = {
|
|
23
|
+
start: {
|
|
24
|
+
scale: 1,
|
|
25
|
+
opacity: 1,
|
|
26
|
+
},
|
|
27
|
+
hover: {
|
|
28
|
+
scale: 0,
|
|
29
|
+
opacity: 0,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const midFrameVariants = {
|
|
34
|
+
hover: {
|
|
35
|
+
opacity: 1,
|
|
36
|
+
},
|
|
37
|
+
start: {
|
|
38
|
+
opacity: 0.5,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const secondFrameVariants = {
|
|
43
|
+
hover: {
|
|
44
|
+
scale: 1,
|
|
45
|
+
opacity: 1,
|
|
46
|
+
},
|
|
47
|
+
start: {
|
|
48
|
+
scale: 0,
|
|
49
|
+
opacity: 0,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const PreviewStyles = ( { label, isFocused, withHoverView, variation } ) => {
|
|
54
|
+
const [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );
|
|
55
|
+
const [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );
|
|
56
|
+
const [ headingFontFamily = fontFamily ] = useGlobalStyle(
|
|
57
|
+
'elements.h1.typography.fontFamily'
|
|
58
|
+
);
|
|
59
|
+
const [ headingFontWeight = fontWeight ] = useGlobalStyle(
|
|
60
|
+
'elements.h1.typography.fontWeight'
|
|
61
|
+
);
|
|
62
|
+
const [ textColor = 'black' ] = useGlobalStyle( 'color.text' );
|
|
63
|
+
const [ headingColor = textColor ] = useGlobalStyle(
|
|
64
|
+
'elements.h1.color.text'
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const { paletteColors } = useStylesPreviewColors();
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<PreviewIframe
|
|
71
|
+
label={ label }
|
|
72
|
+
isFocused={ isFocused }
|
|
73
|
+
withHoverView={ withHoverView }
|
|
74
|
+
>
|
|
75
|
+
{ ( { ratio, key } ) => (
|
|
76
|
+
<motion.div
|
|
77
|
+
key={ key }
|
|
78
|
+
variants={ firstFrameVariants }
|
|
79
|
+
style={ {
|
|
80
|
+
height: '100%',
|
|
81
|
+
overflow: 'hidden',
|
|
82
|
+
} }
|
|
83
|
+
>
|
|
84
|
+
<HStack
|
|
85
|
+
spacing={ 10 * ratio }
|
|
86
|
+
justify="center"
|
|
87
|
+
style={ {
|
|
88
|
+
height: '100%',
|
|
89
|
+
overflow: 'hidden',
|
|
90
|
+
} }
|
|
91
|
+
>
|
|
92
|
+
<PreviewTypography
|
|
93
|
+
fontSize={ 65 * ratio }
|
|
94
|
+
variation={ variation }
|
|
95
|
+
/>
|
|
96
|
+
<VStack spacing={ 4 * ratio }>
|
|
97
|
+
<HighlightedColors
|
|
98
|
+
normalizedColorSwatchSize={ 32 }
|
|
99
|
+
ratio={ ratio }
|
|
100
|
+
/>
|
|
101
|
+
</VStack>
|
|
102
|
+
</HStack>
|
|
103
|
+
</motion.div>
|
|
104
|
+
) }
|
|
105
|
+
{ ( { key } ) => (
|
|
106
|
+
<motion.div
|
|
107
|
+
key={ key }
|
|
108
|
+
variants={ withHoverView && midFrameVariants }
|
|
109
|
+
style={ {
|
|
110
|
+
height: '100%',
|
|
111
|
+
width: '100%',
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
top: 0,
|
|
114
|
+
overflow: 'hidden',
|
|
115
|
+
filter: 'blur(60px)',
|
|
116
|
+
opacity: 0.1,
|
|
117
|
+
} }
|
|
118
|
+
>
|
|
119
|
+
<HStack
|
|
120
|
+
spacing={ 0 }
|
|
121
|
+
justify="flex-start"
|
|
122
|
+
style={ {
|
|
123
|
+
height: '100%',
|
|
124
|
+
overflow: 'hidden',
|
|
125
|
+
} }
|
|
126
|
+
>
|
|
127
|
+
{ paletteColors
|
|
128
|
+
.slice( 0, 4 )
|
|
129
|
+
.map( ( { color }, index ) => (
|
|
130
|
+
<div
|
|
131
|
+
key={ index }
|
|
132
|
+
style={ {
|
|
133
|
+
height: '100%',
|
|
134
|
+
background: color,
|
|
135
|
+
flexGrow: 1,
|
|
136
|
+
} }
|
|
137
|
+
/>
|
|
138
|
+
) ) }
|
|
139
|
+
</HStack>
|
|
140
|
+
</motion.div>
|
|
141
|
+
) }
|
|
142
|
+
{ ( { ratio, key } ) => (
|
|
143
|
+
<motion.div
|
|
144
|
+
key={ key }
|
|
145
|
+
variants={ secondFrameVariants }
|
|
146
|
+
style={ {
|
|
147
|
+
height: '100%',
|
|
148
|
+
width: '100%',
|
|
149
|
+
overflow: 'hidden',
|
|
150
|
+
position: 'absolute',
|
|
151
|
+
top: 0,
|
|
152
|
+
} }
|
|
153
|
+
>
|
|
154
|
+
<VStack
|
|
155
|
+
spacing={ 3 * ratio }
|
|
156
|
+
justify="center"
|
|
157
|
+
style={ {
|
|
158
|
+
height: '100%',
|
|
159
|
+
overflow: 'hidden',
|
|
160
|
+
padding: 10 * ratio,
|
|
161
|
+
boxSizing: 'border-box',
|
|
162
|
+
} }
|
|
163
|
+
>
|
|
164
|
+
{ label && (
|
|
165
|
+
<div
|
|
166
|
+
style={ {
|
|
167
|
+
fontSize: 40 * ratio,
|
|
168
|
+
fontFamily: headingFontFamily,
|
|
169
|
+
color: headingColor,
|
|
170
|
+
fontWeight: headingFontWeight,
|
|
171
|
+
lineHeight: '1em',
|
|
172
|
+
textAlign: 'center',
|
|
173
|
+
} }
|
|
174
|
+
>
|
|
175
|
+
{ label }
|
|
176
|
+
</div>
|
|
177
|
+
) }
|
|
178
|
+
</VStack>
|
|
179
|
+
</motion.div>
|
|
180
|
+
) }
|
|
181
|
+
</PreviewIframe>
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export default PreviewStyles;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useContext } from '@wordpress/element';
|
|
5
|
+
import { __unstableMotion as motion } from '@wordpress/components';
|
|
6
|
+
import { _x } from '@wordpress/i18n';
|
|
7
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { mergeBaseAndUserConfigs } from './global-styles-provider';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';
|
|
15
|
+
import { getFontFamilies } from './utils';
|
|
16
|
+
|
|
17
|
+
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
18
|
+
|
|
19
|
+
export default function PreviewTypography( { fontSize, variation } ) {
|
|
20
|
+
const { base } = useContext( GlobalStylesContext );
|
|
21
|
+
let config = base;
|
|
22
|
+
if ( variation ) {
|
|
23
|
+
config = mergeBaseAndUserConfigs( base, variation );
|
|
24
|
+
}
|
|
25
|
+
const [ bodyFontFamilies, headingFontFamilies ] = getFontFamilies( config );
|
|
26
|
+
const bodyPreviewStyle = bodyFontFamilies
|
|
27
|
+
? getFamilyPreviewStyle( bodyFontFamilies )
|
|
28
|
+
: {};
|
|
29
|
+
const headingPreviewStyle = headingFontFamilies
|
|
30
|
+
? getFamilyPreviewStyle( headingFontFamilies )
|
|
31
|
+
: {};
|
|
32
|
+
|
|
33
|
+
if ( fontSize ) {
|
|
34
|
+
bodyPreviewStyle.fontSize = fontSize;
|
|
35
|
+
headingPreviewStyle.fontSize = fontSize;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<motion.div
|
|
40
|
+
className="edit-site-global-styles_preview-typography"
|
|
41
|
+
animate={ {
|
|
42
|
+
scale: 1,
|
|
43
|
+
opacity: 1,
|
|
44
|
+
} }
|
|
45
|
+
initial={ {
|
|
46
|
+
scale: 0.1,
|
|
47
|
+
opacity: 0,
|
|
48
|
+
} }
|
|
49
|
+
transition={ {
|
|
50
|
+
delay: 0.3,
|
|
51
|
+
type: 'tween',
|
|
52
|
+
} }
|
|
53
|
+
>
|
|
54
|
+
<span style={ headingPreviewStyle }>
|
|
55
|
+
{ _x( 'A', 'Uppercase letter A' ) }
|
|
56
|
+
</span>
|
|
57
|
+
<span style={ bodyPreviewStyle }>
|
|
58
|
+
{ _x( 'a', 'Lowercase letter A' ) }
|
|
59
|
+
</span>
|
|
60
|
+
</motion.div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -26,7 +26,7 @@ import { speak } from '@wordpress/a11y';
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
|
-
import { useBlockVariations } from './variations-panel';
|
|
29
|
+
import { useBlockVariations } from './variations/variations-panel';
|
|
30
30
|
import ScreenHeader from './header';
|
|
31
31
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
32
32
|
import { unlock } from '../../lock-unlock';
|
|
@@ -20,7 +20,10 @@ import ScreenHeader from './header';
|
|
|
20
20
|
import BlockPreviewPanel from './block-preview-panel';
|
|
21
21
|
import { unlock } from '../../lock-unlock';
|
|
22
22
|
import Subtitle from './subtitle';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
useBlockVariations,
|
|
25
|
+
VariationsPanel,
|
|
26
|
+
} from './variations/variations-panel';
|
|
24
27
|
|
|
25
28
|
function applyFallbackStyle( border ) {
|
|
26
29
|
if ( ! border ) {
|
|
@@ -11,6 +11,8 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
|
11
11
|
import ScreenHeader from './header';
|
|
12
12
|
import Palette from './palette';
|
|
13
13
|
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import ColorVariations from './variations/variations-color';
|
|
15
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
14
16
|
|
|
15
17
|
const {
|
|
16
18
|
useGlobalStyle,
|
|
@@ -29,6 +31,12 @@ function ScreenColors() {
|
|
|
29
31
|
const [ rawSettings ] = useGlobalSetting( '' );
|
|
30
32
|
const settings = useSettingsForBlockElement( rawSettings );
|
|
31
33
|
|
|
34
|
+
const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
35
|
+
property: 'color',
|
|
36
|
+
filter: ( variation ) =>
|
|
37
|
+
variation?.settings?.color &&
|
|
38
|
+
Object.keys( variation?.settings?.color ).length,
|
|
39
|
+
} );
|
|
32
40
|
return (
|
|
33
41
|
<>
|
|
34
42
|
<ScreenHeader
|
|
@@ -38,7 +46,11 @@ function ScreenColors() {
|
|
|
38
46
|
) }
|
|
39
47
|
/>
|
|
40
48
|
<div className="edit-site-global-styles-screen-colors">
|
|
41
|
-
<VStack spacing={
|
|
49
|
+
<VStack spacing={ 3 }>
|
|
50
|
+
{ !! colorVariations.length && (
|
|
51
|
+
<ColorVariations variations={ colorVariations } />
|
|
52
|
+
) }
|
|
53
|
+
|
|
42
54
|
<Palette />
|
|
43
55
|
|
|
44
56
|
<StylesColorPanel
|