@wordpress/edit-site 5.25.1-next.79a6196f.0 → 5.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/actions/index.js +139 -36
- package/build/components/actions/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-families.js +3 -2
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-family-item.js +3 -4
- package/build/components/global-styles/font-family-item.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +80 -41
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +49 -22
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/fonts-grid.js +4 -1
- package/build/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +4 -4
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +16 -8
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-card.js +1 -1
- package/build/components/global-styles/font-library-modal/library-font-card.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/local-fonts.js +13 -4
- package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +49 -20
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +103 -17
- 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 +4 -3
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/layout/hooks.js +6 -5
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +19 -28
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +135 -0
- package/build/components/layout/router.js.map +1 -0
- package/build/components/page-pages/index.js +92 -69
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +11 -6
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/index.js +295 -15
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +51 -23
- package/build/components/page-templates-template-parts/actions.js.map +1 -0
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-templates-template-parts/index.js +395 -0
- package/build/components/page-templates-template-parts/index.js.map +1 -0
- package/build/components/preferences-modal/index.js +9 -134
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/revisions/index.js +1 -1
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-panel/index.js +6 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +3 -1
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +4 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +2 -2
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +8 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +2 -10
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +26 -3
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +76 -0
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -12
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +33 -5
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +13 -6
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +7 -6
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/store/actions.js +11 -29
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +85 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/use-actual-current-theme.js +32 -0
- package/build/utils/use-actual-current-theme.js.map +1 -0
- package/build-module/components/actions/index.js +139 -36
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +3 -2
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-family-item.js +4 -5
- package/build-module/components/global-styles/font-family-item.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +82 -42
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +49 -22
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js +4 -1
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +4 -4
- 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 +16 -8
- 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-card.js +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +2 -2
- 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/local-fonts.js +13 -4
- package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/resolvers.js +45 -18
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +99 -16
- 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 +4 -3
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +4 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/layout/hooks.js +6 -5
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +19 -28
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +127 -0
- package/build-module/components/layout/router.js.map +1 -0
- package/build-module/components/page-pages/index.js +91 -70
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -6
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/index.js +296 -16
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +52 -24
- package/build-module/components/page-templates-template-parts/actions.js.map +1 -0
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-templates-template-parts/index.js +385 -0
- package/build-module/components/page-templates-template-parts/index.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +12 -136
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/revisions/index.js +1 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-button/index.js +4 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +7 -6
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +3 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +4 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +2 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +8 -7
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -10
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +27 -4
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +68 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -11
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +33 -5
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +13 -6
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +7 -6
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +13 -30
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +83 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/use-actual-current-theme.js +24 -0
- package/build-module/utils/use-actual-current-theme.js.map +1 -0
- package/build-style/style-rtl.css +293 -188
- package/build-style/style.css +293 -188
- package/package.json +42 -42
- package/src/components/actions/index.js +236 -84
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/global-styles/font-families.js +14 -8
- package/src/components/global-styles/font-family-item.js +7 -4
- package/src/components/global-styles/font-library-modal/context.js +156 -50
- package/src/components/global-styles/font-library-modal/font-collection.js +56 -21
- package/src/components/global-styles/font-library-modal/fonts-grid.js +6 -2
- package/src/components/global-styles/font-library-modal/index.js +4 -4
- package/src/components/global-styles/font-library-modal/installed-fonts.js +18 -8
- package/src/components/global-styles/font-library-modal/library-font-card.js +2 -1
- package/src/components/global-styles/font-library-modal/library-font-variant.js +10 -9
- package/src/components/global-styles/font-library-modal/local-fonts.js +14 -4
- package/src/components/global-styles/font-library-modal/resolvers.js +50 -17
- package/src/components/global-styles/font-library-modal/style.scss +1 -0
- package/src/components/global-styles/font-library-modal/utils/filter-fonts.js +19 -2
- package/src/components/global-styles/font-library-modal/utils/index.js +136 -29
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +7 -3
- package/src/components/global-styles/font-library-modal/utils/test/filter-fonts.spec.js +40 -10
- package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +5 -5
- package/src/components/global-styles/screen-typography.js +9 -3
- package/src/components/global-styles/style.scss +4 -0
- package/src/components/header-edit-mode/style.scss +15 -5
- package/src/components/layout/hooks.js +6 -5
- package/src/components/layout/index.js +80 -96
- package/src/components/layout/router.js +121 -0
- package/src/components/layout/style.scss +13 -16
- package/src/components/page/style.scss +1 -8
- package/src/components/page-pages/index.js +142 -148
- package/src/components/page-pages/style.scss +41 -2
- package/src/components/page-patterns/dataviews-pattern-actions.js +11 -6
- package/src/components/page-patterns/index.js +392 -14
- package/src/components/page-patterns/style.scss +36 -2
- package/src/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +90 -37
- package/src/components/{page-templates → page-templates-template-parts}/index.js +198 -169
- package/src/components/page-templates-template-parts/style.scss +44 -0
- package/src/components/preferences-modal/index.js +8 -211
- package/src/components/revisions/index.js +1 -1
- package/src/components/save-button/index.js +7 -4
- package/src/components/save-panel/index.js +13 -12
- package/src/components/sidebar/index.js +4 -5
- package/src/components/sidebar-dataviews/dataview-item.js +2 -1
- package/src/components/sidebar-dataviews/default-views.js +4 -2
- package/src/components/sidebar-dataviews/index.js +8 -6
- package/src/components/sidebar-navigation-item/style.scss +1 -1
- package/src/components/sidebar-navigation-screen/index.js +19 -10
- package/src/components/sidebar-navigation-screen-pages/index.js +2 -10
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +32 -6
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +73 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -1
- package/src/components/site-hub/index.js +4 -1
- package/src/components/site-hub/style.scss +1 -12
- package/src/components/site-icon/style.scss +1 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +40 -10
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +32 -0
- package/src/hooks/commands/use-edit-mode-commands.js +50 -3
- package/src/hooks/push-changes-to-global-styles/index.js +29 -23
- package/src/hooks/template-part-edit.js +12 -12
- package/src/index.js +1 -1
- package/src/store/actions.js +17 -51
- package/src/store/private-actions.js +133 -0
- package/src/store/selectors.js +2 -4
- package/src/style.scss +1 -1
- package/src/utils/get-is-list-page.js +3 -2
- package/src/utils/use-actual-current-theme.js +27 -0
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
- package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -71
- package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
- package/build/components/page-main/index.js +0 -44
- package/build/components/page-main/index.js.map +0 -1
- package/build/components/page-patterns/dataviews-patterns.js +0 -307
- package/build/components/page-patterns/dataviews-patterns.js.map +0 -1
- package/build/components/page-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-template-parts/index.js +0 -81
- package/build/components/page-template-parts/index.js.map +0 -1
- package/build/components/page-templates/index.js +0 -352
- package/build/components/page-templates/index.js.map +0 -1
- package/build/components/page-templates/template-actions.js.map +0 -1
- package/build/components/post-preview/index.js +0 -29
- package/build/components/post-preview/index.js.map +0 -1
- package/build/components/preferences-modal/enable-feature.js +0 -36
- package/build/components/preferences-modal/enable-feature.js.map +0 -1
- package/build/components/preferences-modal/enable-panel-option.js +0 -33
- package/build/components/preferences-modal/enable-panel-option.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -52
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -63
- package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
- package/build-module/components/page-main/index.js +0 -36
- package/build-module/components/page-main/index.js.map +0 -1
- package/build-module/components/page-patterns/dataviews-patterns.js +0 -299
- package/build-module/components/page-patterns/dataviews-patterns.js.map +0 -1
- package/build-module/components/page-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-template-parts/index.js +0 -73
- package/build-module/components/page-template-parts/index.js.map +0 -1
- package/build-module/components/page-templates/index.js +0 -344
- package/build-module/components/page-templates/index.js.map +0 -1
- package/build-module/components/page-templates/template-actions.js.map +0 -1
- package/build-module/components/post-preview/index.js +0 -21
- package/build-module/components/post-preview/index.js.map +0 -1
- package/build-module/components/preferences-modal/enable-feature.js +0 -29
- package/build-module/components/preferences-modal/enable-feature.js.map +0 -1
- package/build-module/components/preferences-modal/enable-panel-option.js +0 -26
- package/build-module/components/preferences-modal/enable-panel-option.js.map +0 -1
- package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
- package/src/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -62
- package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +0 -271
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +0 -58
- package/src/components/page-main/index.js +0 -38
- package/src/components/page-patterns/dataviews-patterns.js +0 -380
- package/src/components/page-template-parts/index.js +0 -99
- package/src/components/page-templates/style.scss +0 -13
- package/src/components/post-preview/index.js +0 -16
- package/src/components/preferences-modal/enable-feature.js +0 -31
- package/src/components/preferences-modal/enable-panel-option.js +0 -23
- /package/build/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
- /package/build-module/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
- /package/src/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
|
@@ -8,6 +8,15 @@ import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
|
8
8
|
*/
|
|
9
9
|
import { FONT_WEIGHTS, FONT_STYLES } from './constants';
|
|
10
10
|
import { unlock } from '../../../../lock-unlock';
|
|
11
|
+
import { fetchInstallFontFace } from '../resolvers';
|
|
12
|
+
import { formatFontFamily } from './preview-styles';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Browser dependencies
|
|
16
|
+
*/
|
|
17
|
+
const {
|
|
18
|
+
File
|
|
19
|
+
} = window;
|
|
11
20
|
export function setUIValuesNeeded(font, extraValues = {}) {
|
|
12
21
|
if (!font.name && (font.fontFamily || font.slug)) {
|
|
13
22
|
font.name = font.fontFamily || font.slug;
|
|
@@ -82,10 +91,10 @@ export async function loadFontFaceInBrowser(fontFace, source, addTo = 'all') {
|
|
|
82
91
|
// eslint-disable-next-line no-undef
|
|
83
92
|
} else if (source instanceof File) {
|
|
84
93
|
dataSource = await source.arrayBuffer();
|
|
94
|
+
} else {
|
|
95
|
+
return;
|
|
85
96
|
}
|
|
86
|
-
|
|
87
|
-
// eslint-disable-next-line no-undef
|
|
88
|
-
const newFont = new FontFace(fontFace.fontFamily, dataSource, {
|
|
97
|
+
const newFont = new window.FontFace(formatFontFamily(fontFace.fontFamily), dataSource, {
|
|
89
98
|
style: fontFace.fontStyle,
|
|
90
99
|
weight: fontFace.fontWeight
|
|
91
100
|
});
|
|
@@ -117,38 +126,112 @@ export function getDisplaySrcFromFontFace(input, urlPrefix) {
|
|
|
117
126
|
}
|
|
118
127
|
return src;
|
|
119
128
|
}
|
|
120
|
-
export function
|
|
129
|
+
export function makeFontFamilyFormData(fontFamily) {
|
|
121
130
|
const formData = new FormData();
|
|
122
131
|
const {
|
|
123
132
|
kebabCase
|
|
124
133
|
} = unlock(componentsPrivateApis);
|
|
125
|
-
const
|
|
126
|
-
|
|
134
|
+
const {
|
|
135
|
+
fontFace,
|
|
136
|
+
category,
|
|
137
|
+
...familyWithValidParameters
|
|
138
|
+
} = fontFamily;
|
|
139
|
+
const fontFamilySettings = {
|
|
140
|
+
...familyWithValidParameters,
|
|
127
141
|
slug: kebabCase(fontFamily.slug)
|
|
128
142
|
};
|
|
129
|
-
|
|
130
|
-
|
|
143
|
+
formData.append('font_family_settings', JSON.stringify(fontFamilySettings));
|
|
144
|
+
return formData;
|
|
145
|
+
}
|
|
146
|
+
export function makeFontFacesFormData(font) {
|
|
147
|
+
if (font?.fontFace) {
|
|
148
|
+
const fontFacesFormData = font.fontFace.map((face, faceIndex) => {
|
|
149
|
+
const formData = new FormData();
|
|
131
150
|
if (face.file) {
|
|
132
151
|
// Slugified file name because the it might contain spaces or characters treated differently on the server.
|
|
133
152
|
const fileId = `file-${faceIndex}`;
|
|
134
153
|
// Add the files to the formData
|
|
135
154
|
formData.append(fileId, face.file, face.file.name);
|
|
136
|
-
// remove the file object from the face object the file is referenced
|
|
155
|
+
// remove the file object from the face object the file is referenced in src
|
|
137
156
|
const {
|
|
138
157
|
file,
|
|
139
158
|
...faceWithoutFileProperty
|
|
140
159
|
} = face;
|
|
141
|
-
const
|
|
160
|
+
const fontFaceSettings = {
|
|
142
161
|
...faceWithoutFileProperty,
|
|
143
|
-
|
|
162
|
+
src: fileId
|
|
144
163
|
};
|
|
145
|
-
|
|
164
|
+
formData.append('font_face_settings', JSON.stringify(fontFaceSettings));
|
|
165
|
+
} else {
|
|
166
|
+
formData.append('font_face_settings', JSON.stringify(face));
|
|
146
167
|
}
|
|
147
|
-
return
|
|
168
|
+
return formData;
|
|
148
169
|
});
|
|
149
|
-
|
|
170
|
+
return fontFacesFormData;
|
|
150
171
|
}
|
|
151
|
-
|
|
152
|
-
|
|
172
|
+
}
|
|
173
|
+
export async function batchInstallFontFaces(fontFamilyId, fontFacesData) {
|
|
174
|
+
const promises = fontFacesData.map(faceData => fetchInstallFontFace(fontFamilyId, faceData));
|
|
175
|
+
const responses = await Promise.allSettled(promises);
|
|
176
|
+
const results = {
|
|
177
|
+
errors: [],
|
|
178
|
+
successes: []
|
|
179
|
+
};
|
|
180
|
+
responses.forEach((result, index) => {
|
|
181
|
+
if (result.status === 'fulfilled') {
|
|
182
|
+
const response = result.value;
|
|
183
|
+
if (response.id) {
|
|
184
|
+
results.successes.push(response);
|
|
185
|
+
} else {
|
|
186
|
+
results.errors.push({
|
|
187
|
+
data: fontFacesData[index],
|
|
188
|
+
message: `Error: ${response.message}`
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
// Handle network errors or other fetch-related errors
|
|
193
|
+
results.errors.push({
|
|
194
|
+
data: fontFacesData[index],
|
|
195
|
+
message: `Fetch error: ${result.reason.message}`
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return results;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/*
|
|
203
|
+
* Downloads a font face asset from a URL to the client and returns a File object.
|
|
204
|
+
*/
|
|
205
|
+
export async function downloadFontFaceAsset(url) {
|
|
206
|
+
return fetch(new Request(url)).then(response => {
|
|
207
|
+
if (!response.ok) {
|
|
208
|
+
throw new Error(`Error downloading font face asset from ${url}. Server responded with status: ${response.status}`);
|
|
209
|
+
}
|
|
210
|
+
return response.blob();
|
|
211
|
+
}).then(blob => {
|
|
212
|
+
const filename = url.split('/').pop();
|
|
213
|
+
const file = new File([blob], filename, {
|
|
214
|
+
type: blob.type
|
|
215
|
+
});
|
|
216
|
+
return file;
|
|
217
|
+
}).catch(error => {
|
|
218
|
+
// eslint-disable-next-line no-console
|
|
219
|
+
console.error(`Error downloading font face asset from ${url}:`, error);
|
|
220
|
+
throw error;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/*
|
|
225
|
+
* Determine if a given Font Face is present in a given collection.
|
|
226
|
+
* We determine that a font face has been installed by comparing the fontWeight and fontStyle
|
|
227
|
+
*
|
|
228
|
+
* @param {Object} fontFace The Font Face to seek
|
|
229
|
+
* @param {Array} collection The Collection to seek in
|
|
230
|
+
* @returns True if the font face is found in the collection. Otherwise False.
|
|
231
|
+
*/
|
|
232
|
+
export function checkFontFaceInstalled(fontFace, collection) {
|
|
233
|
+
return -1 !== collection.findIndex(collectionFontFace => {
|
|
234
|
+
return collectionFontFace.fontWeight === fontFace.fontWeight && collectionFontFace.fontStyle === fontFace.fontStyle;
|
|
235
|
+
});
|
|
153
236
|
}
|
|
154
237
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["privateApis","componentsPrivateApis","FONT_WEIGHTS","FONT_STYLES","unlock","setUIValuesNeeded","font","extraValues","name","fontFamily","slug","isUrlEncoded","url","decodeURIComponent","getFontFaceVariantName","face","weightName","fontWeight","styleName","fontStyle","mergeFontFaces","existing","incoming","map","Map","set","Array","from","values","mergeFontFamilies","has","fontFace","incomingFontFaces","restIncoming","existingFont","get","mergedFontFaces","loadFontFaceInBrowser","source","addTo","dataSource","File","arrayBuffer","newFont","FontFace","style","weight","loadedFace","load","document","fonts","add","iframeDocument","querySelector","contentDocument","getDisplaySrcFromFontFace","input","urlPrefix","src","isArray","startsWith","replace","encodeURI","makeFormDataFromFontFamily","formData","FormData","kebabCase","newFontFamily","newFontFaces","faceIndex","file","fileId","append","faceWithoutFileProperty","newFace","uploadedFile","JSON","stringify"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/utils/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { FONT_WEIGHTS, FONT_STYLES } from './constants';\nimport { unlock } from '../../../../lock-unlock';\n\nexport function setUIValuesNeeded( font, extraValues = {} ) {\n\tif ( ! font.name && ( font.fontFamily || font.slug ) ) {\n\t\tfont.name = font.fontFamily || font.slug;\n\t}\n\treturn {\n\t\t...font,\n\t\t...extraValues,\n\t};\n}\n\nexport function isUrlEncoded( url ) {\n\tif ( typeof url !== 'string' ) {\n\t\treturn false;\n\t}\n\treturn url !== decodeURIComponent( url );\n}\n\nexport function getFontFaceVariantName( face ) {\n\tconst weightName = FONT_WEIGHTS[ face.fontWeight ] || face.fontWeight;\n\tconst styleName =\n\t\tface.fontStyle === 'normal'\n\t\t\t? ''\n\t\t\t: FONT_STYLES[ face.fontStyle ] || face.fontStyle;\n\treturn `${ weightName } ${ styleName }`;\n}\n\nexport function mergeFontFaces( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\tfor ( const face of existing ) {\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\tfor ( const face of incoming ) {\n\t\t// This will overwrite if the src already exists, keeping it unique.\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\treturn Array.from( map.values() );\n}\n\nexport function mergeFontFamilies( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\t// Add the existing array to the map.\n\tfor ( const font of existing ) {\n\t\tmap.set( font.slug, { ...font } );\n\t}\n\t// Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged.\n\tfor ( const font of incoming ) {\n\t\tif ( map.has( font.slug ) ) {\n\t\t\tconst { fontFace: incomingFontFaces, ...restIncoming } = font;\n\t\t\tconst existingFont = map.get( font.slug );\n\t\t\t// Merge the fontFaces existing with the incoming fontFaces.\n\t\t\tconst mergedFontFaces = mergeFontFaces(\n\t\t\t\texistingFont.fontFace,\n\t\t\t\tincomingFontFaces\n\t\t\t);\n\t\t\t// Except for the fontFace key all the other keys are overwritten with the incoming values.\n\t\t\tmap.set( font.slug, {\n\t\t\t\t...restIncoming,\n\t\t\t\tfontFace: mergedFontFaces,\n\t\t\t} );\n\t\t} else {\n\t\t\tmap.set( font.slug, { ...font } );\n\t\t}\n\t}\n\treturn Array.from( map.values() );\n}\n\n/*\n * Loads the font face from a URL and adds it to the browser.\n * It also adds it to the iframe document.\n */\nexport async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {\n\tlet dataSource;\n\n\tif ( typeof source === 'string' ) {\n\t\tdataSource = `url(${ source })`;\n\t\t// eslint-disable-next-line no-undef\n\t} else if ( source instanceof File ) {\n\t\tdataSource = await source.arrayBuffer();\n\t}\n\n\t// eslint-disable-next-line no-undef\n\tconst newFont = new FontFace( fontFace.fontFamily, dataSource, {\n\t\tstyle: fontFace.fontStyle,\n\t\tweight: fontFace.fontWeight,\n\t} );\n\n\tconst loadedFace = await newFont.load();\n\n\tif ( addTo === 'document' || addTo === 'all' ) {\n\t\tdocument.fonts.add( loadedFace );\n\t}\n\n\tif ( addTo === 'iframe' || addTo === 'all' ) {\n\t\tconst iframeDocument = document.querySelector(\n\t\t\t'iframe[name=\"editor-canvas\"]'\n\t\t).contentDocument;\n\t\tiframeDocument.fonts.add( loadedFace );\n\t}\n}\n\nexport function getDisplaySrcFromFontFace( input, urlPrefix ) {\n\tif ( ! input ) {\n\t\treturn;\n\t}\n\n\tlet src;\n\tif ( Array.isArray( input ) ) {\n\t\tsrc = input[ 0 ];\n\t} else {\n\t\tsrc = input;\n\t}\n\t// If it is a theme font, we need to make the url absolute\n\tif ( src.startsWith( 'file:.' ) && urlPrefix ) {\n\t\tsrc = src.replace( 'file:.', urlPrefix );\n\t}\n\tif ( ! isUrlEncoded( src ) ) {\n\t\tsrc = encodeURI( src );\n\t}\n\treturn src;\n}\n\nexport function makeFormDataFromFontFamily( fontFamily ) {\n\tconst formData = new FormData();\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\tconst newFontFamily = {\n\t\t...fontFamily,\n\t\tslug: kebabCase( fontFamily.slug ),\n\t};\n\n\tif ( newFontFamily?.fontFace ) {\n\t\tconst newFontFaces = newFontFamily.fontFace.map(\n\t\t\t( face, faceIndex ) => {\n\t\t\t\tif ( face.file ) {\n\t\t\t\t\t// Slugified file name because the it might contain spaces or characters treated differently on the server.\n\t\t\t\t\tconst fileId = `file-${ faceIndex }`;\n\t\t\t\t\t// Add the files to the formData\n\t\t\t\t\tformData.append( fileId, face.file, face.file.name );\n\t\t\t\t\t// remove the file object from the face object the file is referenced by the uploadedFile key\n\t\t\t\t\tconst { file, ...faceWithoutFileProperty } = face;\n\t\t\t\t\tconst newFace = {\n\t\t\t\t\t\t...faceWithoutFileProperty,\n\t\t\t\t\t\tuploadedFile: fileId,\n\t\t\t\t\t};\n\t\t\t\t\treturn newFace;\n\t\t\t\t}\n\t\t\t\treturn face;\n\t\t\t}\n\t\t);\n\t\tnewFontFamily.fontFace = newFontFaces;\n\t}\n\n\tformData.append( 'font_family_settings', JSON.stringify( newFontFamily ) );\n\treturn formData;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,SAASC,YAAY,EAAEC,WAAW,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,OAAO,SAASC,iBAAiBA,CAAEC,IAAI,EAAEC,WAAW,GAAG,CAAC,CAAC,EAAG;EAC3D,IAAK,CAAED,IAAI,CAACE,IAAI,KAAMF,IAAI,CAACG,UAAU,IAAIH,IAAI,CAACI,IAAI,CAAE,EAAG;IACtDJ,IAAI,CAACE,IAAI,GAAGF,IAAI,CAACG,UAAU,IAAIH,IAAI,CAACI,IAAI;EACzC;EACA,OAAO;IACN,GAAGJ,IAAI;IACP,GAAGC;EACJ,CAAC;AACF;AAEA,OAAO,SAASI,YAAYA,CAAEC,GAAG,EAAG;EACnC,IAAK,OAAOA,GAAG,KAAK,QAAQ,EAAG;IAC9B,OAAO,KAAK;EACb;EACA,OAAOA,GAAG,KAAKC,kBAAkB,CAAED,GAAI,CAAC;AACzC;AAEA,OAAO,SAASE,sBAAsBA,CAAEC,IAAI,EAAG;EAC9C,MAAMC,U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IAAKtD,IAAI,CAACuD,IAAI,EAAG;QAChB;QACA,MAAMC,MAAM,GAAI,QAAQF,SAAW,EAAC;QACpC;QACAL,QAAQ,CAACQ,MAAM,CAAED,MAAM,EAAExD,IAAI,CAACuD,IAAI,EAAEvD,IAAI,CAACuD,IAAI,CAAC9D,IAAK,CAAC;QACpD;QACA,MAAM;UAAE8D,IAAI;UAAE,GAAGG;QAAwB,CAAC,GAAG1D,IAAI;QACjD,MAAM2D,OAAO,GAAG;UACf,GAAGD,uBAAuB;UAC1BE,YAAY,EAAEJ;QACf,CAAC;QACD,OAAOG,OAAO;MACf;MACA,OAAO3D,IAAI;IACZ,CACD,CAAC;IACDoD,aAAa,CAACpC,QAAQ,GAAGqC,YAAY;EACtC;EAEAJ,QAAQ,CAACQ,MAAM,CAAE,sBAAsB,EAAEI,IAAI,CAACC,SAAS,CAAEV,aAAc,CAAE,CAAC;EAC1E,OAAOH,QAAQ;AAChB"}
|
|
1
|
+
{"version":3,"names":["privateApis","componentsPrivateApis","FONT_WEIGHTS","FONT_STYLES","unlock","fetchInstallFontFace","formatFontFamily","File","window","setUIValuesNeeded","font","extraValues","name","fontFamily","slug","isUrlEncoded","url","decodeURIComponent","getFontFaceVariantName","face","weightName","fontWeight","styleName","fontStyle","mergeFontFaces","existing","incoming","map","Map","set","Array","from","values","mergeFontFamilies","has","fontFace","incomingFontFaces","restIncoming","existingFont","get","mergedFontFaces","loadFontFaceInBrowser","source","addTo","dataSource","arrayBuffer","newFont","FontFace","style","weight","loadedFace","load","document","fonts","add","iframeDocument","querySelector","contentDocument","getDisplaySrcFromFontFace","input","urlPrefix","src","isArray","startsWith","replace","encodeURI","makeFontFamilyFormData","formData","FormData","kebabCase","category","familyWithValidParameters","fontFamilySettings","append","JSON","stringify","makeFontFacesFormData","fontFacesFormData","faceIndex","file","fileId","faceWithoutFileProperty","fontFaceSettings","batchInstallFontFaces","fontFamilyId","fontFacesData","promises","faceData","responses","Promise","allSettled","results","errors","successes","forEach","result","index","status","response","value","id","push","data","message","reason","downloadFontFaceAsset","fetch","Request","then","ok","Error","blob","filename","split","pop","type","catch","error","console","checkFontFaceInstalled","collection","findIndex","collectionFontFace"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/utils/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { FONT_WEIGHTS, FONT_STYLES } from './constants';\nimport { unlock } from '../../../../lock-unlock';\nimport { fetchInstallFontFace } from '../resolvers';\nimport { formatFontFamily } from './preview-styles';\n\n/**\n * Browser dependencies\n */\nconst { File } = window;\n\nexport function setUIValuesNeeded( font, extraValues = {} ) {\n\tif ( ! font.name && ( font.fontFamily || font.slug ) ) {\n\t\tfont.name = font.fontFamily || font.slug;\n\t}\n\treturn {\n\t\t...font,\n\t\t...extraValues,\n\t};\n}\n\nexport function isUrlEncoded( url ) {\n\tif ( typeof url !== 'string' ) {\n\t\treturn false;\n\t}\n\treturn url !== decodeURIComponent( url );\n}\n\nexport function getFontFaceVariantName( face ) {\n\tconst weightName = FONT_WEIGHTS[ face.fontWeight ] || face.fontWeight;\n\tconst styleName =\n\t\tface.fontStyle === 'normal'\n\t\t\t? ''\n\t\t\t: FONT_STYLES[ face.fontStyle ] || face.fontStyle;\n\treturn `${ weightName } ${ styleName }`;\n}\n\nexport function mergeFontFaces( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\tfor ( const face of existing ) {\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\tfor ( const face of incoming ) {\n\t\t// This will overwrite if the src already exists, keeping it unique.\n\t\tmap.set( `${ face.fontWeight }${ face.fontStyle }`, face );\n\t}\n\treturn Array.from( map.values() );\n}\n\nexport function mergeFontFamilies( existing = [], incoming = [] ) {\n\tconst map = new Map();\n\t// Add the existing array to the map.\n\tfor ( const font of existing ) {\n\t\tmap.set( font.slug, { ...font } );\n\t}\n\t// Add the incoming array to the map, overwriting existing values excepting fontFace that need to be merged.\n\tfor ( const font of incoming ) {\n\t\tif ( map.has( font.slug ) ) {\n\t\t\tconst { fontFace: incomingFontFaces, ...restIncoming } = font;\n\t\t\tconst existingFont = map.get( font.slug );\n\t\t\t// Merge the fontFaces existing with the incoming fontFaces.\n\t\t\tconst mergedFontFaces = mergeFontFaces(\n\t\t\t\texistingFont.fontFace,\n\t\t\t\tincomingFontFaces\n\t\t\t);\n\t\t\t// Except for the fontFace key all the other keys are overwritten with the incoming values.\n\t\t\tmap.set( font.slug, {\n\t\t\t\t...restIncoming,\n\t\t\t\tfontFace: mergedFontFaces,\n\t\t\t} );\n\t\t} else {\n\t\t\tmap.set( font.slug, { ...font } );\n\t\t}\n\t}\n\treturn Array.from( map.values() );\n}\n\n/*\n * Loads the font face from a URL and adds it to the browser.\n * It also adds it to the iframe document.\n */\nexport async function loadFontFaceInBrowser( fontFace, source, addTo = 'all' ) {\n\tlet dataSource;\n\n\tif ( typeof source === 'string' ) {\n\t\tdataSource = `url(${ source })`;\n\t\t// eslint-disable-next-line no-undef\n\t} else if ( source instanceof File ) {\n\t\tdataSource = await source.arrayBuffer();\n\t} else {\n\t\treturn;\n\t}\n\n\tconst newFont = new window.FontFace(\n\t\tformatFontFamily( fontFace.fontFamily ),\n\t\tdataSource,\n\t\t{\n\t\t\tstyle: fontFace.fontStyle,\n\t\t\tweight: fontFace.fontWeight,\n\t\t}\n\t);\n\n\tconst loadedFace = await newFont.load();\n\n\tif ( addTo === 'document' || addTo === 'all' ) {\n\t\tdocument.fonts.add( loadedFace );\n\t}\n\n\tif ( addTo === 'iframe' || addTo === 'all' ) {\n\t\tconst iframeDocument = document.querySelector(\n\t\t\t'iframe[name=\"editor-canvas\"]'\n\t\t).contentDocument;\n\t\tiframeDocument.fonts.add( loadedFace );\n\t}\n}\n\nexport function getDisplaySrcFromFontFace( input, urlPrefix ) {\n\tif ( ! input ) {\n\t\treturn;\n\t}\n\n\tlet src;\n\tif ( Array.isArray( input ) ) {\n\t\tsrc = input[ 0 ];\n\t} else {\n\t\tsrc = input;\n\t}\n\t// If it is a theme font, we need to make the url absolute\n\tif ( src.startsWith( 'file:.' ) && urlPrefix ) {\n\t\tsrc = src.replace( 'file:.', urlPrefix );\n\t}\n\tif ( ! isUrlEncoded( src ) ) {\n\t\tsrc = encodeURI( src );\n\t}\n\treturn src;\n}\n\nexport function makeFontFamilyFormData( fontFamily ) {\n\tconst formData = new FormData();\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\tconst { fontFace, category, ...familyWithValidParameters } = fontFamily;\n\tconst fontFamilySettings = {\n\t\t...familyWithValidParameters,\n\t\tslug: kebabCase( fontFamily.slug ),\n\t};\n\n\tformData.append(\n\t\t'font_family_settings',\n\t\tJSON.stringify( fontFamilySettings )\n\t);\n\treturn formData;\n}\n\nexport function makeFontFacesFormData( font ) {\n\tif ( font?.fontFace ) {\n\t\tconst fontFacesFormData = font.fontFace.map( ( face, faceIndex ) => {\n\t\t\tconst formData = new FormData();\n\t\t\tif ( face.file ) {\n\t\t\t\t// Slugified file name because the it might contain spaces or characters treated differently on the server.\n\t\t\t\tconst fileId = `file-${ faceIndex }`;\n\t\t\t\t// Add the files to the formData\n\t\t\t\tformData.append( fileId, face.file, face.file.name );\n\t\t\t\t// remove the file object from the face object the file is referenced in src\n\t\t\t\tconst { file, ...faceWithoutFileProperty } = face;\n\t\t\t\tconst fontFaceSettings = {\n\t\t\t\t\t...faceWithoutFileProperty,\n\t\t\t\t\tsrc: fileId,\n\t\t\t\t};\n\t\t\t\tformData.append(\n\t\t\t\t\t'font_face_settings',\n\t\t\t\t\tJSON.stringify( fontFaceSettings )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tformData.append( 'font_face_settings', JSON.stringify( face ) );\n\t\t\t}\n\t\t\treturn formData;\n\t\t} );\n\n\t\treturn fontFacesFormData;\n\t}\n}\n\nexport async function batchInstallFontFaces( fontFamilyId, fontFacesData ) {\n\tconst promises = fontFacesData.map( ( faceData ) =>\n\t\tfetchInstallFontFace( fontFamilyId, faceData )\n\t);\n\tconst responses = await Promise.allSettled( promises );\n\n\tconst results = {\n\t\terrors: [],\n\t\tsuccesses: [],\n\t};\n\n\tresponses.forEach( ( result, index ) => {\n\t\tif ( result.status === 'fulfilled' ) {\n\t\t\tconst response = result.value;\n\t\t\tif ( response.id ) {\n\t\t\t\tresults.successes.push( response );\n\t\t\t} else {\n\t\t\t\tresults.errors.push( {\n\t\t\t\t\tdata: fontFacesData[ index ],\n\t\t\t\t\tmessage: `Error: ${ response.message }`,\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\t// Handle network errors or other fetch-related errors\n\t\t\tresults.errors.push( {\n\t\t\t\tdata: fontFacesData[ index ],\n\t\t\t\tmessage: `Fetch error: ${ result.reason.message }`,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn results;\n}\n\n/*\n * Downloads a font face asset from a URL to the client and returns a File object.\n */\nexport async function downloadFontFaceAsset( url ) {\n\treturn fetch( new Request( url ) )\n\t\t.then( ( response ) => {\n\t\t\tif ( ! response.ok ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Error downloading font face asset from ${ url }. Server responded with status: ${ response.status }`\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn response.blob();\n\t\t} )\n\t\t.then( ( blob ) => {\n\t\t\tconst filename = url.split( '/' ).pop();\n\t\t\tconst file = new File( [ blob ], filename, {\n\t\t\t\ttype: blob.type,\n\t\t\t} );\n\t\t\treturn file;\n\t\t} )\n\t\t.catch( ( error ) => {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t`Error downloading font face asset from ${ url }:`,\n\t\t\t\terror\n\t\t\t);\n\t\t\tthrow error;\n\t\t} );\n}\n\n/*\n * Determine if a given Font Face is present in a given collection.\n * We determine that a font face has been installed by comparing the fontWeight and fontStyle\n *\n * @param {Object} fontFace The Font Face to seek\n * @param {Array} collection The Collection to seek in\n * @returns True if the font face is found in the collection. Otherwise False.\n */\nexport function checkFontFaceInstalled( fontFace, collection ) {\n\treturn (\n\t\t-1 !==\n\t\tcollection.findIndex( ( collectionFontFace ) => {\n\t\t\treturn (\n\t\t\t\tcollectionFontFace.fontWeight === fontFace.fontWeight &&\n\t\t\t\tcollectionFontFace.fontStyle === fontFace.fontStyle\n\t\t\t);\n\t\t} )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,SAASC,YAAY,EAAEC,WAAW,QAAQ,aAAa;AACvD,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,oBAAoB,QAAQ,cAAc;AACnD,SAASC,gBAAgB,QAAQ,kBAAkB;;AAEnD;AACA;AACA;AACA,MAAM;EAAEC;AAAK,CAAC,GAAGC,MAAM;AAEvB,OAAO,SAASC,iBAAiBA,CAAEC,IAAI,EAAEC,WAAW,GAAG,CAAC,CAAC,EAAG;EAC3D,IAAK,CAAED,IAAI,CAACE,IAAI,KAAMF,IAAI,CAACG,UAAU,IAAIH,IAAI,CAACI,IAAI,CAAE,EAAG;IACtDJ,IAAI,CAACE,IAAI,GAAGF,IAAI,CAACG,UAAU,IAAIH,IAAI,CAACI,IAAI;EACzC;EACA,OAAO;IACN,GAAGJ,IAAI;IACP,GAAGC;EACJ,CAAC;AACF;AAEA,OAAO,SAASI,YAAYA,CAAEC,GAAG,EAAG;EACnC,IAAK,OAAOA,GAAG,KAAK,QAAQ,EAAG;IAC9B,OAAO,KAAK;EACb;EACA,OAAOA,GAAG,KAAKC,kBAAkB,CAAED,GAAI,CAAC;AACzC;AAEA,OAAO,SAASE,sBAAsBA,CAAEC,IAAI,EAAG;EAC9C,MAAMC,UAAU,GAAGlB,YAAY,CAAEiB,IAAI,CAACE,UAAU,CAAE,IAAIF,IAAI,CAACE,UAAU;EACrE,MAAMC,SAAS,GACdH,IAAI,CAACI,SAAS,KAAK,QAAQ,GACxB,EAAE,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,IAAI,CAACI;IACZ,CAAE,CAAC;IACH,OAAOpC,IAAI;EACZ,CAAE,CAAC,CACFqC,KAAK,CAAIC,KAAK,IAAM;IACpB;IACAC,OAAO,CAACD,KAAK,CACX,0CAA0CrG,GAAK,GAAE,EAClDqG,KACD,CAAC;IACD,MAAMA,KAAK;EACZ,CAAE,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,sBAAsBA,CAAEpF,QAAQ,EAAEqF,UAAU,EAAG;EAC9D,OACC,CAAC,CAAC,KACFA,UAAU,CAACC,SAAS,CAAIC,kBAAkB,IAAM;IAC/C,OACCA,kBAAkB,CAACrG,UAAU,KAAKc,QAAQ,CAACd,UAAU,IACrDqG,kBAAkB,CAACnG,SAAS,KAAKY,QAAQ,CAACZ,SAAS;EAErD,CAAE,CAAC;AAEL"}
|
|
@@ -27,9 +27,10 @@ function extractFontWeights(fontFaces) {
|
|
|
27
27
|
export function formatFontFamily(input) {
|
|
28
28
|
return input.split(',').map(font => {
|
|
29
29
|
font = font.trim(); // Remove any leading or trailing white spaces
|
|
30
|
-
// If the font doesn't
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
// If the font doesn't start with quotes and contains a space, then wrap in quotes.
|
|
31
|
+
// Check that string starts with a single or double quote and not a space
|
|
32
|
+
if (!(font.startsWith('"') || font.startsWith("'")) && font.indexOf(' ') !== -1) {
|
|
33
|
+
return `"${font}"`;
|
|
33
34
|
}
|
|
34
35
|
return font; // Return font as is if no transformation is needed
|
|
35
36
|
}).join(', ');
|
package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["findNearest","input","numbers","length","sort","a","b","Math","abs","extractFontWeights","fontFaces","result","forEach","face","weights","String","fontWeight","split","start","parseInt","end","i","push","formatFontFamily","map","font","trim","startsWith","indexOf","join","getFamilyPreviewStyle","family","style","fontFamily","Array","isArray","fontFace","fontStyle","normalFaces","filter","toLowerCase","normalWeights","nearestWeight","getFacePreviewStyle"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/utils/preview-styles.js"],"sourcesContent":["function findNearest( input, numbers ) {\n\t// If the numbers array is empty, return null\n\tif ( numbers.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Sort the array based on the absolute difference with the input\n\tnumbers.sort( ( a, b ) => Math.abs( input - a ) - Math.abs( input - b ) );\n\t// Return the first element (which will be the nearest) from the sorted array\n\treturn numbers[ 0 ];\n}\n\nfunction extractFontWeights( fontFaces ) {\n\tconst result = [];\n\n\tfontFaces.forEach( ( face ) => {\n\t\tconst weights = String( face.fontWeight ).split( ' ' );\n\n\t\tif ( weights.length === 2 ) {\n\t\t\tconst start = parseInt( weights[ 0 ] );\n\t\t\tconst end = parseInt( weights[ 1 ] );\n\n\t\t\tfor ( let i = start; i <= end; i += 100 ) {\n\t\t\t\tresult.push( i );\n\t\t\t}\n\t\t} else if ( weights.length === 1 ) {\n\t\t\tresult.push( parseInt( weights[ 0 ] ) );\n\t\t}\n\t} );\n\n\treturn result;\n}\n\nexport function formatFontFamily( input ) {\n\treturn input\n\t\t.split( ',' )\n\t\t.map( ( font ) => {\n\t\t\tfont = font.trim(); // Remove any leading or trailing white spaces\n\t\t\t// If the font doesn't
|
|
1
|
+
{"version":3,"names":["findNearest","input","numbers","length","sort","a","b","Math","abs","extractFontWeights","fontFaces","result","forEach","face","weights","String","fontWeight","split","start","parseInt","end","i","push","formatFontFamily","map","font","trim","startsWith","indexOf","join","getFamilyPreviewStyle","family","style","fontFamily","Array","isArray","fontFace","fontStyle","normalFaces","filter","toLowerCase","normalWeights","nearestWeight","getFacePreviewStyle"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/utils/preview-styles.js"],"sourcesContent":["function findNearest( input, numbers ) {\n\t// If the numbers array is empty, return null\n\tif ( numbers.length === 0 ) {\n\t\treturn null;\n\t}\n\t// Sort the array based on the absolute difference with the input\n\tnumbers.sort( ( a, b ) => Math.abs( input - a ) - Math.abs( input - b ) );\n\t// Return the first element (which will be the nearest) from the sorted array\n\treturn numbers[ 0 ];\n}\n\nfunction extractFontWeights( fontFaces ) {\n\tconst result = [];\n\n\tfontFaces.forEach( ( face ) => {\n\t\tconst weights = String( face.fontWeight ).split( ' ' );\n\n\t\tif ( weights.length === 2 ) {\n\t\t\tconst start = parseInt( weights[ 0 ] );\n\t\t\tconst end = parseInt( weights[ 1 ] );\n\n\t\t\tfor ( let i = start; i <= end; i += 100 ) {\n\t\t\t\tresult.push( i );\n\t\t\t}\n\t\t} else if ( weights.length === 1 ) {\n\t\t\tresult.push( parseInt( weights[ 0 ] ) );\n\t\t}\n\t} );\n\n\treturn result;\n}\n\nexport function formatFontFamily( input ) {\n\treturn input\n\t\t.split( ',' )\n\t\t.map( ( font ) => {\n\t\t\tfont = font.trim(); // Remove any leading or trailing white spaces\n\t\t\t// If the font doesn't start with quotes and contains a space, then wrap in quotes.\n\t\t\t// Check that string starts with a single or double quote and not a space\n\t\t\tif (\n\t\t\t\t! ( font.startsWith( '\"' ) || font.startsWith( \"'\" ) ) &&\n\t\t\t\tfont.indexOf( ' ' ) !== -1\n\t\t\t) {\n\t\t\t\treturn `\"${ font }\"`;\n\t\t\t}\n\t\t\treturn font; // Return font as is if no transformation is needed\n\t\t} )\n\t\t.join( ', ' );\n}\n\nexport function getFamilyPreviewStyle( family ) {\n\tconst style = { fontFamily: formatFontFamily( family.fontFamily ) };\n\n\tif ( ! Array.isArray( family.fontFace ) ) {\n\t\tstyle.fontWeight = '400';\n\t\tstyle.fontStyle = 'normal';\n\t\treturn style;\n\t}\n\n\tif ( family.fontFace ) {\n\t\t//get all the font faces with normal style\n\t\tconst normalFaces = family.fontFace.filter(\n\t\t\t( face ) => face.fontStyle.toLowerCase() === 'normal'\n\t\t);\n\t\tif ( normalFaces.length > 0 ) {\n\t\t\tstyle.fontStyle = 'normal';\n\t\t\tconst normalWeights = extractFontWeights( normalFaces );\n\t\t\tconst nearestWeight = findNearest( 400, normalWeights );\n\t\t\tstyle.fontWeight = String( nearestWeight ) || '400';\n\t\t} else {\n\t\t\tstyle.fontStyle =\n\t\t\t\t( family.fontFace.length && family.fontFace[ 0 ].fontStyle ) ||\n\t\t\t\t'normal';\n\t\t\tstyle.fontWeight =\n\t\t\t\t( family.fontFace.length &&\n\t\t\t\t\tString( family.fontFace[ 0 ].fontWeight ) ) ||\n\t\t\t\t'400';\n\t\t}\n\t}\n\n\treturn style;\n}\n\nexport function getFacePreviewStyle( face ) {\n\treturn {\n\t\tfontFamily: formatFontFamily( face.fontFamily ),\n\t\tfontStyle: face.fontStyle || 'normal',\n\t\tfontWeight: face.fontWeight || '400',\n\t};\n}\n"],"mappings":"AAAA,SAASA,WAAWA,CAAEC,KAAK,EAAEC,OAAO,EAAG;EACtC;EACA,IAAKA,OAAO,CAACC,MAAM,KAAK,CAAC,EAAG;IAC3B,OAAO,IAAI;EACZ;EACA;EACAD,OAAO,CAACE,IAAI,CAAE,CAAEC,CAAC,EAAEC,CAAC,KAAMC,IAAI,CAACC,GAAG,CAAEP,KAAK,GAAGI,CAAE,CAAC,GAAGE,IAAI,CAACC,GAAG,CAAEP,KAAK,GAAGK,CAAE,CAAE,CAAC;EACzE;EACA,OAAOJ,OAAO,CAAE,CAAC,CAAE;AACpB;AAEA,SAASO,kBAAkBA,CAAEC,SAAS,EAAG;EACxC,MAAMC,MAAM,GAAG,EAAE;EAEjBD,SAAS,CAACE,OAAO,CAAIC,IAAI,IAAM;IAC9B,MAAMC,OAAO,GAAGC,MAAM,CAAEF,IAAI,CAACG,UAAW,CAAC,CAACC,KAAK,CAAE,GAAI,CAAC;IAEtD,IAAKH,OAAO,CAACX,MAAM,KAAK,CAAC,EAAG;MAC3B,MAAMe,KAAK,GAAGC,QAAQ,CAAEL,OAAO,CAAE,CAAC,CAAG,CAAC;MACtC,MAAMM,GAAG,GAAGD,QAAQ,CAAEL,OAAO,CAAE,CAAC,CAAG,CAAC;MAEpC,KAAM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MAAM,CACvC1B,IAAI,IAAMA,IAAI,CAACwB,SAAS,CAACG,WAAW,CAAC,CAAC,KAAK,QAC9C,CAAC;IACD,IAAKF,WAAW,CAACnC,MAAM,GAAG,CAAC,EAAG;MAC7B6B,KAAK,CAACK,SAAS,GAAG,QAAQ;MAC1B,MAAMI,aAAa,GAAGhC,kBAAkB,CAAE6B,WAAY,CAAC;MACvD,MAAMI,aAAa,GAAG1C,WAAW,CAAE,GAAG,EAAEyC,aAAc,CAAC;MACvDT,KAAK,CAAChB,UAAU,GAAGD,MAAM,CAAE2B,aAAc,CAAC,IAAI,KAAK;IACpD,CAAC,MAAM;MACNV,KAAK,CAACK,SAAS,GACZN,MAAM,CAACK,QAAQ,CAACjC,MAAM,IAAI4B,MAAM,CAACK,QAAQ,CAAE,CAAC,CAAE,CAACC,SAAS,IAC1D,QAAQ;MACTL,KAAK,CAAChB,UAAU,GACbe,MAAM,CAACK,QAAQ,CAACjC,MAAM,IACvBY,MAAM,CAAEgB,MAAM,CAACK,QAAQ,CAAE,CAAC,CAAE,CAACpB,UAAW,CAAC,IAC1C,KAAK;IACP;EACD;EAEA,OAAOgB,KAAK;AACb;AAEA,OAAO,SAASW,mBAAmBA,CAAE9B,IAAI,EAAG;EAC3C,OAAO;IACNoB,UAAU,EAAEV,gBAAgB,CAAEV,IAAI,CAACoB,UAAW,CAAC;IAC/CI,SAAS,EAAExB,IAAI,CAACwB,SAAS,IAAI,QAAQ;IACrCrB,UAAU,EAAEH,IAAI,CAACG,UAAU,IAAI;EAChC,CAAC;AACF"}
|
|
@@ -4,6 +4,8 @@ import { createElement, Fragment } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Internal dependencies
|
|
@@ -12,6 +14,7 @@ import TypographyElements from './typogrphy-elements';
|
|
|
12
14
|
import FontFamilies from './font-families';
|
|
13
15
|
import ScreenHeader from './header';
|
|
14
16
|
function ScreenTypography() {
|
|
17
|
+
const fontLibraryEnabled = useSelect(select => select(editorStore).getEditorSettings().fontLibraryEnabled, []);
|
|
15
18
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
16
19
|
title: __('Typography'),
|
|
17
20
|
description: __('Manage the typography settings for different elements.')
|
|
@@ -19,7 +22,7 @@ function ScreenTypography() {
|
|
|
19
22
|
className: "edit-site-global-styles-screen-typography"
|
|
20
23
|
}, createElement(VStack, {
|
|
21
24
|
spacing: 6
|
|
22
|
-
},
|
|
25
|
+
}, fontLibraryEnabled && createElement(FontFamilies, null), createElement(TypographyElements, null))));
|
|
23
26
|
}
|
|
24
27
|
export default ScreenTypography;
|
|
25
28
|
//# sourceMappingURL=screen-typography.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","__experimentalVStack","VStack","TypographyElements","FontFamilies","ScreenHeader","ScreenTypography","createElement","Fragment","title","description","className","spacing"
|
|
1
|
+
{"version":3,"names":["__","__experimentalVStack","VStack","store","editorStore","useSelect","TypographyElements","FontFamilies","ScreenHeader","ScreenTypography","fontLibraryEnabled","select","getEditorSettings","createElement","Fragment","title","description","className","spacing"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport TypographyElements from './typogrphy-elements';\nimport FontFamilies from './font-families';\nimport ScreenHeader from './header';\n\nfunction ScreenTypography() {\n\tconst fontLibraryEnabled = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getEditorSettings().fontLibraryEnabled,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\n\t\t\t\t<VStack spacing={ 6 }>\n\t\t\t\t\t{ fontLibraryEnabled && <FontFamilies /> }\n\t\t\t\t\t<TypographyElements />\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,YAAY,MAAM,UAAU;AAEnC,SAASC,gBAAgBA,CAAA,EAAG;EAC3B,MAAMC,kBAAkB,GAAGL,SAAS,CACjCM,MAAM,IACPA,MAAM,CAAEP,WAAY,CAAC,CAACQ,iBAAiB,CAAC,CAAC,CAACF,kBAAkB,EAC7D,EACD,CAAC;EAED,OACCG,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACL,YAAY;IACZO,KAAK,EAAGf,EAAE,CAAE,YAAa,CAAG;IAC5BgB,WAAW,EAAGhB,EAAE,CACf,wDACD;EAAG,CACH,CAAC,EACFa,aAAA;IAAKI,SAAS,EAAC;EAA2C,GACzDJ,aAAA,CAACX,MAAM;IAACgB,OAAO,EAAG;EAAG,GAClBR,kBAAkB,IAAIG,aAAA,CAACN,YAAY,MAAE,CAAC,EACxCM,aAAA,CAACP,kBAAkB,MAAE,CACd,CACJ,CACJ,CAAC;AAEL;AAEA,eAAeG,gBAAgB"}
|
|
@@ -40,16 +40,17 @@ export function useIsSiteEditorLoading() {
|
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
if (inLoadingPause) {
|
|
42
42
|
/*
|
|
43
|
-
* We're using an arbitrary
|
|
44
|
-
* without any resolving selectors that would result in
|
|
45
|
-
* brief flickers of loading state and loaded state.
|
|
43
|
+
* We're using an arbitrary 100ms timeout here to catch brief
|
|
44
|
+
* moments without any resolving selectors that would result in
|
|
45
|
+
* displaying brief flickers of loading state and loaded state.
|
|
46
46
|
*
|
|
47
47
|
* It's worth experimenting with different values, since this also
|
|
48
|
-
* adds
|
|
48
|
+
* adds 100ms of artificial delay after loading has finished.
|
|
49
49
|
*/
|
|
50
|
+
const ARTIFICIAL_DELAY = 100;
|
|
50
51
|
const timeout = setTimeout(() => {
|
|
51
52
|
setLoaded(true);
|
|
52
|
-
},
|
|
53
|
+
}, ARTIFICIAL_DELAY);
|
|
53
54
|
return () => {
|
|
54
55
|
clearTimeout(timeout);
|
|
55
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","useSelect","store","coreStore","useEditedEntityRecord","MAX_LOADING_TIME","useIsSiteEditorLoading","isLoaded","hasLoadedPost","loaded","setLoaded","inLoadingPause","select","hasResolvingSelectors","timeout","setTimeout","clearTimeout"],"sources":["@wordpress/edit-site/src/components/layout/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\nconst MAX_LOADING_TIME = 10000; // 10 seconds\n\nexport function useIsSiteEditorLoading() {\n\tconst { isLoaded: hasLoadedPost } = useEditedEntityRecord();\n\tconst [ loaded, setLoaded ] = useState( false );\n\tconst inLoadingPause = useSelect(\n\t\t( select ) => {\n\t\t\tconst hasResolvingSelectors =\n\t\t\t\tselect( coreStore ).hasResolvingSelectors();\n\t\t\treturn ! loaded && ! hasResolvingSelectors;\n\t\t},\n\t\t[ loaded ]\n\t);\n\n\t/*\n\t * If the maximum expected loading time has passed, we're marking the\n\t * editor as loaded, in order to prevent any failed requests from blocking\n\t * the editor canvas from appearing.\n\t */\n\tuseEffect( () => {\n\t\tlet timeout;\n\n\t\tif ( ! loaded ) {\n\t\t\ttimeout = setTimeout( () => {\n\t\t\t\tsetLoaded( true );\n\t\t\t}, MAX_LOADING_TIME );\n\t\t}\n\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ loaded ] );\n\n\tuseEffect( () => {\n\t\tif ( inLoadingPause ) {\n\t\t\t/*\n\t\t\t * We're using an arbitrary
|
|
1
|
+
{"version":3,"names":["useEffect","useState","useSelect","store","coreStore","useEditedEntityRecord","MAX_LOADING_TIME","useIsSiteEditorLoading","isLoaded","hasLoadedPost","loaded","setLoaded","inLoadingPause","select","hasResolvingSelectors","timeout","setTimeout","clearTimeout","ARTIFICIAL_DELAY"],"sources":["@wordpress/edit-site/src/components/layout/hooks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\nconst MAX_LOADING_TIME = 10000; // 10 seconds\n\nexport function useIsSiteEditorLoading() {\n\tconst { isLoaded: hasLoadedPost } = useEditedEntityRecord();\n\tconst [ loaded, setLoaded ] = useState( false );\n\tconst inLoadingPause = useSelect(\n\t\t( select ) => {\n\t\t\tconst hasResolvingSelectors =\n\t\t\t\tselect( coreStore ).hasResolvingSelectors();\n\t\t\treturn ! loaded && ! hasResolvingSelectors;\n\t\t},\n\t\t[ loaded ]\n\t);\n\n\t/*\n\t * If the maximum expected loading time has passed, we're marking the\n\t * editor as loaded, in order to prevent any failed requests from blocking\n\t * the editor canvas from appearing.\n\t */\n\tuseEffect( () => {\n\t\tlet timeout;\n\n\t\tif ( ! loaded ) {\n\t\t\ttimeout = setTimeout( () => {\n\t\t\t\tsetLoaded( true );\n\t\t\t}, MAX_LOADING_TIME );\n\t\t}\n\n\t\treturn () => {\n\t\t\tclearTimeout( timeout );\n\t\t};\n\t}, [ loaded ] );\n\n\tuseEffect( () => {\n\t\tif ( inLoadingPause ) {\n\t\t\t/*\n\t\t\t * We're using an arbitrary 100ms timeout here to catch brief\n\t\t\t * moments without any resolving selectors that would result in\n\t\t\t * displaying brief flickers of loading state and loaded state.\n\t\t\t *\n\t\t\t * It's worth experimenting with different values, since this also\n\t\t\t * adds 100ms of artificial delay after loading has finished.\n\t\t\t */\n\t\t\tconst ARTIFICIAL_DELAY = 100;\n\t\t\tconst timeout = setTimeout( () => {\n\t\t\t\tsetLoaded( true );\n\t\t\t}, ARTIFICIAL_DELAY );\n\n\t\t\treturn () => {\n\t\t\t\tclearTimeout( timeout );\n\t\t\t};\n\t\t}\n\t}, [ inLoadingPause ] );\n\n\treturn ! loaded || ! hasLoadedPost;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,6BAA6B;AAE/D,MAAMC,gBAAgB,GAAG,KAAK,CAAC,CAAC;;AAEhC,OAAO,SAASC,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAEC,QAAQ,EAAEC;EAAc,CAAC,GAAGJ,qBAAqB,CAAC,CAAC;EAC3D,MAAM,CAAEK,MAAM,EAAEC,SAAS,CAAE,GAAGV,QAAQ,CAAE,KAAM,CAAC;EAC/C,MAAMW,cAAc,GAAGV,SAAS,CAC7BW,MAAM,IAAM;IACb,MAAMC,qBAAqB,GAC1BD,MAAM,CAAET,SAAU,CAAC,CAACU,qBAAqB,CAAC,CAAC;IAC5C,OAAO,CAAEJ,MAAM,IAAI,CAAEI,qBAAqB;EAC3C,CAAC,EACD,CAAEJ,MAAM,CACT,CAAC;;EAED;AACD;AACA;AACA;AACA;EACCV,SAAS,CAAE,MAAM;IAChB,IAAIe,OAAO;IAEX,IAAK,CAAEL,MAAM,EAAG;MACfK,OAAO,GAAGC,UAAU,CAAE,MAAM;QAC3BL,SAAS,CAAE,IAAK,CAAC;MAClB,CAAC,EAAEL,gBAAiB,CAAC;IACtB;IAEA,OAAO,MAAM;MACZW,YAAY,CAAEF,OAAQ,CAAC;IACxB,CAAC;EACF,CAAC,EAAE,CAAEL,MAAM,CAAG,CAAC;EAEfV,SAAS,CAAE,MAAM;IAChB,IAAKY,cAAc,EAAG;MACrB;AACH;AACA;AACA;AACA;AACA;AACA;AACA;MACG,MAAMM,gBAAgB,GAAG,GAAG;MAC5B,MAAMH,OAAO,GAAGC,UAAU,CAAE,MAAM;QACjCL,SAAS,CAAE,IAAK,CAAC;MAClB,CAAC,EAAEO,gBAAiB,CAAC;MAErB,OAAO,MAAM;QACZD,YAAY,CAAEF,OAAQ,CAAC;MACxB,CAAC;IACF;EACD,CAAC,EAAE,CAAEH,cAAc,CAAG,CAAC;EAEvB,OAAO,CAAEF,MAAM,IAAI,CAAED,aAAa;AACnC"}
|
|
@@ -17,17 +17,14 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
|
17
17
|
import { CommandMenu, privateApis as commandsPrivateApis } from '@wordpress/commands';
|
|
18
18
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
19
19
|
import { privateApis as blockEditorPrivateApis, useBlockCommands, store as blockEditorStore } from '@wordpress/block-editor';
|
|
20
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
21
20
|
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Internal dependencies
|
|
25
24
|
*/
|
|
26
25
|
import Sidebar from '../sidebar';
|
|
27
|
-
import Editor from '../editor';
|
|
28
26
|
import ErrorBoundary from '../error-boundary';
|
|
29
27
|
import { store as editSiteStore } from '../../store';
|
|
30
|
-
import getIsListPage from '../../utils/get-is-list-page';
|
|
31
28
|
import Header from '../header-edit-mode';
|
|
32
29
|
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
33
30
|
import SiteHub from '../site-hub';
|
|
@@ -39,17 +36,14 @@ import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
|
|
|
39
36
|
import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
|
|
40
37
|
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
|
|
41
38
|
import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
|
|
42
|
-
import PageMain from '../page-main';
|
|
43
39
|
import { useIsSiteEditorLoading } from './hooks';
|
|
40
|
+
import useLayoutAreas from './router';
|
|
44
41
|
const {
|
|
45
42
|
useCommands
|
|
46
43
|
} = unlock(coreCommandsPrivateApis);
|
|
47
44
|
const {
|
|
48
45
|
useCommandContext
|
|
49
46
|
} = unlock(commandsPrivateApis);
|
|
50
|
-
const {
|
|
51
|
-
useLocation
|
|
52
|
-
} = unlock(routerPrivateApis);
|
|
53
47
|
const {
|
|
54
48
|
useGlobalStyle
|
|
55
49
|
} = unlock(blockEditorPrivateApis);
|
|
@@ -62,12 +56,7 @@ export default function Layout() {
|
|
|
62
56
|
useEditModeCommands();
|
|
63
57
|
useCommonCommands();
|
|
64
58
|
useBlockCommands();
|
|
65
|
-
const {
|
|
66
|
-
params
|
|
67
|
-
} = useLocation();
|
|
68
59
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
69
|
-
const isListPage = getIsListPage(params, isMobileViewport);
|
|
70
|
-
const isEditorPage = !isListPage;
|
|
71
60
|
const {
|
|
72
61
|
isDistractionFree,
|
|
73
62
|
hasFixedToolbar,
|
|
@@ -91,19 +80,19 @@ export default function Layout() {
|
|
|
91
80
|
hasBlockSelected: select(blockEditorStore).getBlockSelectionStart()
|
|
92
81
|
};
|
|
93
82
|
}, []);
|
|
94
|
-
const isEditing = canvasMode === 'edit';
|
|
95
83
|
const navigateRegionsProps = useNavigateRegions({
|
|
96
84
|
previous: previousShortcut,
|
|
97
85
|
next: nextShortcut
|
|
98
86
|
});
|
|
99
87
|
const disableMotion = useReducedMotion();
|
|
100
|
-
const showSidebar = isMobileViewport && canvasMode === 'view' && !isListPage || !isMobileViewport && (canvasMode === 'view' || !isEditorPage);
|
|
101
|
-
const showCanvas = isMobileViewport && isEditorPage && isEditing || !isMobileViewport || !isEditorPage;
|
|
102
|
-
const isFullCanvas = isMobileViewport && isListPage || isEditorPage && isEditing;
|
|
103
88
|
const [canvasResizer, canvasSize] = useResizeObserver();
|
|
104
89
|
const [fullResizer] = useResizeObserver();
|
|
105
90
|
const isEditorLoading = useIsSiteEditorLoading();
|
|
106
91
|
const [isResizableFrameOversized, setIsResizableFrameOversized] = useState(false);
|
|
92
|
+
const {
|
|
93
|
+
areas,
|
|
94
|
+
widths
|
|
95
|
+
} = useLayoutAreas();
|
|
107
96
|
|
|
108
97
|
// This determines which animation variant should apply to the header.
|
|
109
98
|
// There is also a `isDistractionFreeHovering` state that gets priority
|
|
@@ -127,7 +116,7 @@ export default function Layout() {
|
|
|
127
116
|
|
|
128
117
|
// Sets the right context for the command palette
|
|
129
118
|
let commandContext = 'site-editor';
|
|
130
|
-
if (canvasMode === 'edit'
|
|
119
|
+
if (canvasMode === 'edit') {
|
|
131
120
|
commandContext = 'site-editor-edit';
|
|
132
121
|
}
|
|
133
122
|
if (hasBlockSelected) {
|
|
@@ -147,9 +136,8 @@ export default function Layout() {
|
|
|
147
136
|
...navigateRegionsProps,
|
|
148
137
|
ref: navigateRegionsProps.ref,
|
|
149
138
|
className: classnames('edit-site-layout', navigateRegionsProps.className, {
|
|
150
|
-
'is-distraction-free': isDistractionFree &&
|
|
151
|
-
'is-full-canvas':
|
|
152
|
-
'is-edit-mode': isEditing,
|
|
139
|
+
'is-distraction-free': isDistractionFree && canvasMode === 'edit',
|
|
140
|
+
'is-full-canvas': canvasMode === 'edit',
|
|
153
141
|
'has-fixed-toolbar': hasFixedToolbar,
|
|
154
142
|
'is-block-toolbar-visible': hasBlockSelected
|
|
155
143
|
})
|
|
@@ -188,7 +176,7 @@ export default function Layout() {
|
|
|
188
176
|
className: "edit-site-layout__hub"
|
|
189
177
|
}), createElement(AnimatePresence, {
|
|
190
178
|
initial: false
|
|
191
|
-
},
|
|
179
|
+
}, canvasMode === 'edit' && createElement(NavigableRegion, {
|
|
192
180
|
key: "header",
|
|
193
181
|
className: "edit-site-layout__header",
|
|
194
182
|
ariaLabel: __('Editor top bar'),
|
|
@@ -228,7 +216,7 @@ export default function Layout() {
|
|
|
228
216
|
}, createElement(NavigableRegion, {
|
|
229
217
|
ariaLabel: __('Navigation'),
|
|
230
218
|
className: "edit-site-layout__sidebar-region"
|
|
231
|
-
}, createElement(AnimatePresence, null,
|
|
219
|
+
}, createElement(AnimatePresence, null, canvasMode === 'view' && createElement(motion.div, {
|
|
232
220
|
initial: {
|
|
233
221
|
opacity: 0
|
|
234
222
|
},
|
|
@@ -246,10 +234,15 @@ export default function Layout() {
|
|
|
246
234
|
ease: 'easeOut'
|
|
247
235
|
},
|
|
248
236
|
className: "edit-site-layout__sidebar"
|
|
249
|
-
}, createElement(Sidebar, null)))), createElement(SavePanel, null),
|
|
237
|
+
}, createElement(Sidebar, null)))), createElement(SavePanel, null), areas.content && canvasMode !== 'edit' && createElement("div", {
|
|
238
|
+
className: "edit-site-layout__area",
|
|
239
|
+
style: {
|
|
240
|
+
maxWidth: widths?.content
|
|
241
|
+
}
|
|
242
|
+
}, areas.content), areas.preview && createElement("div", {
|
|
250
243
|
className: "edit-site-layout__canvas-container"
|
|
251
244
|
}, canvasResizer, !!canvasSize.width && createElement(motion.div, {
|
|
252
|
-
whileHover:
|
|
245
|
+
whileHover: canvasMode === 'view' ? {
|
|
253
246
|
scale: 1.005,
|
|
254
247
|
transition: {
|
|
255
248
|
duration: disableMotion ? 0 : 0.5,
|
|
@@ -268,7 +261,7 @@ export default function Layout() {
|
|
|
268
261
|
}
|
|
269
262
|
}, createElement(ErrorBoundary, null, createElement(ResizableFrame, {
|
|
270
263
|
isReady: !isEditorLoading,
|
|
271
|
-
isFullWidth:
|
|
264
|
+
isFullWidth: canvasMode === 'edit',
|
|
272
265
|
defaultSize: {
|
|
273
266
|
width: canvasSize.width - 24 /* $canvas-padding */,
|
|
274
267
|
height: canvasSize.height
|
|
@@ -278,8 +271,6 @@ export default function Layout() {
|
|
|
278
271
|
innerContentStyle: {
|
|
279
272
|
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor
|
|
280
273
|
}
|
|
281
|
-
},
|
|
282
|
-
isLoading: isEditorLoading
|
|
283
|
-
})))))))));
|
|
274
|
+
}, areas.preview)))))));
|
|
284
275
|
}
|
|
285
276
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__unstableUseNavigateRegions","useNavigateRegions","useReducedMotion","useViewportMatch","useResizeObserver","__","useState","NavigableRegion","store","keyboardShortcutsStore","CommandMenu","privateApis","commandsPrivateApis","preferencesStore","blockEditorPrivateApis","useBlockCommands","blockEditorStore","routerPrivateApis","coreCommandsPrivateApis","Sidebar","Editor","ErrorBoundary","editSiteStore","getIsListPage","Header","useInitEditedEntityFromURL","SiteHub","ResizableFrame","useSyncCanvasModeWithURL","unlock","SavePanel","KeyboardShortcutsRegister","KeyboardShortcutsGlobal","useCommonCommands","useEditModeCommands","PageMain","useIsSiteEditorLoading","useCommands","useCommandContext","useLocation","useGlobalStyle","ANIMATION_DURATION","Layout","params","isMobileViewport","isListPage","isEditorPage","isDistractionFree","hasFixedToolbar","hasBlockSelected","canvasMode","previousShortcut","nextShortcut","select","getAllShortcutKeyCombinations","getCanvasMode","get","getBlockSelectionStart","isEditing","navigateRegionsProps","previous","next","disableMotion","showSidebar","showCanvas","isFullCanvas","canvasResizer","canvasSize","fullResizer","isEditorLoading","isResizableFrameOversized","setIsResizableFrameOversized","headerAnimationState","commandContext","backgroundColor","gradientValue","createElement","Fragment","ref","className","div","variants","opacity","transition","type","delay","delayChildren","isDistractionFreeHovering","view","edit","whileHover","undefined","animate","isTransparent","initial","key","ariaLabel","as","y","exit","duration","ease","width","scale","layout","isReady","isFullWidth","defaultSize","height","isOversized","setIsOversized","innerContentStyle","background","isLoading"],"sources":["@wordpress/edit-site/src/components/layout/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { NavigableRegion } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport {\n\tCommandMenu,\n\tprivateApis as commandsPrivateApis,\n} from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockCommands,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Sidebar from '../sidebar';\nimport Editor from '../editor';\nimport ErrorBoundary from '../error-boundary';\nimport { store as editSiteStore } from '../../store';\nimport getIsListPage from '../../utils/get-is-list-page';\nimport Header from '../header-edit-mode';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport SiteHub from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';\nimport { unlock } from '../../lock-unlock';\nimport SavePanel from '../save-panel';\nimport KeyboardShortcutsRegister from '../keyboard-shortcuts/register';\nimport KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';\nimport PageMain from '../page-main';\nimport { useIsSiteEditorLoading } from './hooks';\n\nconst { useCommands } = unlock( coreCommandsPrivateApis );\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { useLocation } = unlock( routerPrivateApis );\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst ANIMATION_DURATION = 0.5;\n\nexport default function Layout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tuseSyncCanvasModeWithURL();\n\tuseCommands();\n\tuseEditModeCommands();\n\tuseCommonCommands();\n\tuseBlockCommands();\n\n\tconst { params } = useLocation();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isListPage = getIsListPage( params, isMobileViewport );\n\tconst isEditorPage = ! isListPage;\n\n\tconst {\n\t\tisDistractionFree,\n\t\thasFixedToolbar,\n\t\thasBlockSelected,\n\t\tcanvasMode,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getAllShortcutKeyCombinations } = select(\n\t\t\tkeyboardShortcutsStore\n\t\t);\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tpreviousShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/next-region'\n\t\t\t),\n\t\t\thasFixedToolbar: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t\thasBlockSelected:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t};\n\t}, [] );\n\tconst isEditing = canvasMode === 'edit';\n\tconst navigateRegionsProps = useNavigateRegions( {\n\t\tprevious: previousShortcut,\n\t\tnext: nextShortcut,\n\t} );\n\tconst disableMotion = useReducedMotion();\n\tconst showSidebar =\n\t\t( isMobileViewport && canvasMode === 'view' && ! isListPage ) ||\n\t\t( ! isMobileViewport && ( canvasMode === 'view' || ! isEditorPage ) );\n\tconst showCanvas =\n\t\t( isMobileViewport && isEditorPage && isEditing ) ||\n\t\t! isMobileViewport ||\n\t\t! isEditorPage;\n\tconst isFullCanvas =\n\t\t( isMobileViewport && isListPage ) || ( isEditorPage && isEditing );\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst [ fullResizer ] = useResizeObserver();\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\tconst [ isResizableFrameOversized, setIsResizableFrameOversized ] =\n\t\tuseState( false );\n\n\t// This determines which animation variant should apply to the header.\n\t// There is also a `isDistractionFreeHovering` state that gets priority\n\t// when hovering the `edit-site-layout__header-container` in distraction\n\t// free mode. It's set via framer and trickles down to all the children\n\t// so they can use this variant state too.\n\t//\n\t// TODO: The issue with this is we want to have the hover state stick when hovering\n\t// a popover opened via the header. We'll probably need to lift this state to\n\t// handle it ourselves. Also, focusWithin the header needs to be handled.\n\tlet headerAnimationState;\n\n\tif ( canvasMode === 'view' ) {\n\t\t// We need 'view' to always take priority so 'isDistractionFree'\n\t\t// doesn't bleed over into the view (sidebar) state\n\t\theaderAnimationState = 'view';\n\t} else if ( isDistractionFree ) {\n\t\theaderAnimationState = 'isDistractionFree';\n\t} else {\n\t\theaderAnimationState = canvasMode; // edit, view, init\n\t}\n\n\t// Sets the right context for the command palette\n\tlet commandContext = 'site-editor';\n\n\tif ( canvasMode === 'edit' && isEditorPage ) {\n\t\tcommandContext = 'site-editor-edit';\n\t}\n\tif ( hasBlockSelected ) {\n\t\tcommandContext = 'block-selection-edit';\n\t}\n\tuseCommandContext( commandContext );\n\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\n\t// Synchronizing the URL with the store value of canvasMode happens in an effect\n\t// This condition ensures the component is only rendered after the synchronization happens\n\t// which prevents any animations due to potential canvasMode value change.\n\tif ( canvasMode === 'init' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<CommandMenu />\n\t\t\t<KeyboardShortcutsRegister />\n\t\t\t<KeyboardShortcutsGlobal />\n\t\t\t{ fullResizer }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-layout',\n\t\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-distraction-free': isDistractionFree && isEditing,\n\t\t\t\t\t\t'is-full-canvas': isFullCanvas,\n\t\t\t\t\t\t'is-edit-mode': isEditing,\n\t\t\t\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t\t\t\t\t'is-block-toolbar-visible': hasBlockSelected,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-layout__header-container\"\n\t\t\t\t\tvariants={ {\n\t\t\t\t\t\tisDistractionFree: {\n\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.8,\n\t\t\t\t\t\t\t\tdelayChildren: 0.8,\n\t\t\t\t\t\t\t}, // How long to wait before the header exits\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDistractionFreeHovering: {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.2,\n\t\t\t\t\t\t\t\tdelayChildren: 0.2,\n\t\t\t\t\t\t\t}, // How long to wait before the header shows\n\t\t\t\t\t\t},\n\t\t\t\t\t\tview: { opacity: 1 },\n\t\t\t\t\t\tedit: { opacity: 1 },\n\t\t\t\t\t} }\n\t\t\t\t\twhileHover={\n\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t? 'isDistractionFreeHovering'\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tanimate={ headerAnimationState }\n\t\t\t\t>\n\t\t\t\t\t<SiteHub\n\t\t\t\t\t\tisTransparent={ isResizableFrameOversized }\n\t\t\t\t\t\tclassName=\"edit-site-layout__hub\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ isEditorPage && isEditing && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tkey=\"header\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__header\"\n\t\t\t\t\t\t\t\tariaLabel={ __( 'Editor top bar' ) }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\tisDistractionFree: { opacity: 0, y: 0 },\n\t\t\t\t\t\t\t\t\tisDistractionFreeHovering: {\n\t\t\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\t\t\ty: 0,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tview: { opacity: 1, y: '-100%' },\n\t\t\t\t\t\t\t\t\tedit: { opacity: 1, y: 0 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\t\ty: '-100%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\t\topacity: isDistractionFree ? 1 : 0,\n\t\t\t\t\t\t\t\t\ty: isDistractionFree ? 0 : '-100%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Header />\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</motion.div>\n\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tThe NavigableRegion must always be rendered and not use\n\t\t\t\t\t\t`inert` otherwise `useNavigateRegions` will fail.\n\t\t\t\t\t*/ }\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tariaLabel={ __( 'Navigation' ) }\n\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar-region\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t\t{ showSidebar && (\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t// Disable transition in mobile to emulate a full page transition.\n\t\t\t\t\t\t\t\t\t\t\tdisableMotion || isMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Sidebar />\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t</NavigableRegion>\n\n\t\t\t\t\t<SavePanel />\n\n\t\t\t\t\t{ showCanvas && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ isListPage && <PageMain /> }\n\t\t\t\t\t\t\t{ isEditorPage && (\n\t\t\t\t\t\t\t\t<div className=\"edit-site-layout__canvas-container\">\n\t\t\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\t\t\t\t\tisEditorPage &&\n\t\t\t\t\t\t\t\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisableMotion\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\t\t\t\tlayout=\"position\"\n\t\t\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t\t\t'edit-site-layout__canvas',\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t'is-right-aligned':\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\t\t\tisReady={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t! isEditorLoading\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tisFullWidth={ isEditing }\n\t\t\t\t\t\t\t\t\t\t\t\t\tdefaultSize={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcanvasSize.width -\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t24 /* $canvas-padding */,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\theight: canvasSize.height,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t\tisOversized={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsOversized={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tsetIsResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tgradientValue ??\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Editor\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tisLoading={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisEditorLoading\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,gBAAgB,IAAIC,MAAM,EAC1BC,yBAAyB,IAAIC,eAAe,EAC5CC,4BAA4B,IAAIC,kBAAkB,QAC5C,uBAAuB;AAC9B,SACCC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,QACX,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,i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,MAAM,EAAC,UAAU;IACjBzB,SAAS,EAAGrF,UAAU,CACrB,0BAA0B,EAC1B;MACC,kBAAkB,EACjB4E;IACF,CACD,CAAG;IACHa,UAAU,EAAG;MACZC,IAAI,EAAE,OAAO;MACbgB,QAAQ,EAAEtC,aAAa,GACpB,CAAC,GACDrB,kBAAkB;MACrB4D,IAAI,EAAE;IACP;EAAG,GAEHzB,aAAA,CAACvD,aAAa,QACbuD,aAAA,CAACjD,cAAc;IACd8E,OAAO,EACN,CAAEpC,eACF;IACDqC,WAAW,EAAGhD,SAAW;IACzBiD,WAAW,EAAG;MACbL,KAAK,EACJnC,UAAU,CAACmC,KAAK,GAChB,EAAE,CAAC;MACJM,MAAM,EAAEzC,UAAU,CAACyC;IACpB,CAAG;IACHC,WAAW,EACVvC,yBACA;IACDwC,cAAc,EACbvC,4BACA;IACDwC,iBAAiB,EAAG;MACnBC,UAAU,EACTrC,aAAa,aAAbA,aAAa,cAAbA,aAAa,GACbD;IACF;EAAG,GAEHE,aAAA,CAACxD,MAAM;IACN6F,SAAS,EACR5C;EACA,CACD,CACc,CACF,CACJ,CAET,CAEL,CAEC,CACD,CACJ,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","__unstableMotion","motion","__unstableAnimatePresence","AnimatePresence","__unstableUseNavigateRegions","useNavigateRegions","useReducedMotion","useViewportMatch","useResizeObserver","__","useState","NavigableRegion","store","keyboardShortcutsStore","CommandMenu","privateApis","commandsPrivateApis","preferencesStore","blockEditorPrivateApis","useBlockCommands","blockEditorStore","coreCommandsPrivateApis","Sidebar","ErrorBoundary","editSiteStore","Header","useInitEditedEntityFromURL","SiteHub","ResizableFrame","useSyncCanvasModeWithURL","unlock","SavePanel","KeyboardShortcutsRegister","KeyboardShortcutsGlobal","useCommonCommands","useEditModeCommands","useIsSiteEditorLoading","useLayoutAreas","useCommands","useCommandContext","useGlobalStyle","ANIMATION_DURATION","Layout","isMobileViewport","isDistractionFree","hasFixedToolbar","hasBlockSelected","canvasMode","previousShortcut","nextShortcut","select","getAllShortcutKeyCombinations","getCanvasMode","get","getBlockSelectionStart","navigateRegionsProps","previous","next","disableMotion","canvasResizer","canvasSize","fullResizer","isEditorLoading","isResizableFrameOversized","setIsResizableFrameOversized","areas","widths","headerAnimationState","commandContext","backgroundColor","gradientValue","createElement","Fragment","ref","className","div","variants","opacity","transition","type","delay","delayChildren","isDistractionFreeHovering","view","edit","whileHover","undefined","animate","isTransparent","initial","key","ariaLabel","as","y","exit","duration","ease","content","style","maxWidth","preview","width","scale","layout","isReady","isFullWidth","defaultSize","height","isOversized","setIsOversized","innerContentStyle","background"],"sources":["@wordpress/edit-site/src/components/layout/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__unstableUseNavigateRegions as useNavigateRegions,\n} from '@wordpress/components';\nimport {\n\tuseReducedMotion,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { NavigableRegion } from '@wordpress/interface';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport {\n\tCommandMenu,\n\tprivateApis as commandsPrivateApis,\n} from '@wordpress/commands';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockCommands,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';\n\n/**\n * Internal dependencies\n */\nimport Sidebar from '../sidebar';\nimport ErrorBoundary from '../error-boundary';\nimport { store as editSiteStore } from '../../store';\nimport Header from '../header-edit-mode';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport SiteHub from '../site-hub';\nimport ResizableFrame from '../resizable-frame';\nimport useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';\nimport { unlock } from '../../lock-unlock';\nimport SavePanel from '../save-panel';\nimport KeyboardShortcutsRegister from '../keyboard-shortcuts/register';\nimport KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';\nimport { useCommonCommands } from '../../hooks/commands/use-common-commands';\nimport { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';\nimport { useIsSiteEditorLoading } from './hooks';\nimport useLayoutAreas from './router';\n\nconst { useCommands } = unlock( coreCommandsPrivateApis );\nconst { useCommandContext } = unlock( commandsPrivateApis );\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst ANIMATION_DURATION = 0.5;\n\nexport default function Layout() {\n\t// This ensures the edited entity id and type are initialized properly.\n\tuseInitEditedEntityFromURL();\n\tuseSyncCanvasModeWithURL();\n\tuseCommands();\n\tuseEditModeCommands();\n\tuseCommonCommands();\n\tuseBlockCommands();\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tconst {\n\t\tisDistractionFree,\n\t\thasFixedToolbar,\n\t\thasBlockSelected,\n\t\tcanvasMode,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getAllShortcutKeyCombinations } = select(\n\t\t\tkeyboardShortcutsStore\n\t\t);\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tpreviousShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-site/next-region'\n\t\t\t),\n\t\t\thasFixedToolbar: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t\thasBlockSelected:\n\t\t\t\tselect( blockEditorStore ).getBlockSelectionStart(),\n\t\t};\n\t}, [] );\n\tconst navigateRegionsProps = useNavigateRegions( {\n\t\tprevious: previousShortcut,\n\t\tnext: nextShortcut,\n\t} );\n\tconst disableMotion = useReducedMotion();\n\tconst [ canvasResizer, canvasSize ] = useResizeObserver();\n\tconst [ fullResizer ] = useResizeObserver();\n\tconst isEditorLoading = useIsSiteEditorLoading();\n\tconst [ isResizableFrameOversized, setIsResizableFrameOversized ] =\n\t\tuseState( false );\n\tconst { areas, widths } = useLayoutAreas();\n\n\t// This determines which animation variant should apply to the header.\n\t// There is also a `isDistractionFreeHovering` state that gets priority\n\t// when hovering the `edit-site-layout__header-container` in distraction\n\t// free mode. It's set via framer and trickles down to all the children\n\t// so they can use this variant state too.\n\t//\n\t// TODO: The issue with this is we want to have the hover state stick when hovering\n\t// a popover opened via the header. We'll probably need to lift this state to\n\t// handle it ourselves. Also, focusWithin the header needs to be handled.\n\tlet headerAnimationState;\n\n\tif ( canvasMode === 'view' ) {\n\t\t// We need 'view' to always take priority so 'isDistractionFree'\n\t\t// doesn't bleed over into the view (sidebar) state\n\t\theaderAnimationState = 'view';\n\t} else if ( isDistractionFree ) {\n\t\theaderAnimationState = 'isDistractionFree';\n\t} else {\n\t\theaderAnimationState = canvasMode; // edit, view, init\n\t}\n\n\t// Sets the right context for the command palette\n\tlet commandContext = 'site-editor';\n\n\tif ( canvasMode === 'edit' ) {\n\t\tcommandContext = 'site-editor-edit';\n\t}\n\tif ( hasBlockSelected ) {\n\t\tcommandContext = 'block-selection-edit';\n\t}\n\tuseCommandContext( commandContext );\n\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\n\t// Synchronizing the URL with the store value of canvasMode happens in an effect\n\t// This condition ensures the component is only rendered after the synchronization happens\n\t// which prevents any animations due to potential canvasMode value change.\n\tif ( canvasMode === 'init' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<CommandMenu />\n\t\t\t<KeyboardShortcutsRegister />\n\t\t\t<KeyboardShortcutsGlobal />\n\t\t\t{ fullResizer }\n\t\t\t<div\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-layout',\n\t\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-distraction-free':\n\t\t\t\t\t\t\tisDistractionFree && canvasMode === 'edit',\n\t\t\t\t\t\t'is-full-canvas': canvasMode === 'edit',\n\t\t\t\t\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t\t\t\t\t'is-block-toolbar-visible': hasBlockSelected,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-layout__header-container\"\n\t\t\t\t\tvariants={ {\n\t\t\t\t\t\tisDistractionFree: {\n\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.8,\n\t\t\t\t\t\t\t\tdelayChildren: 0.8,\n\t\t\t\t\t\t\t}, // How long to wait before the header exits\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisDistractionFreeHovering: {\n\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tdelay: 0.2,\n\t\t\t\t\t\t\t\tdelayChildren: 0.2,\n\t\t\t\t\t\t\t}, // How long to wait before the header shows\n\t\t\t\t\t\t},\n\t\t\t\t\t\tview: { opacity: 1 },\n\t\t\t\t\t\tedit: { opacity: 1 },\n\t\t\t\t\t} }\n\t\t\t\t\twhileHover={\n\t\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t\t? 'isDistractionFreeHovering'\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tanimate={ headerAnimationState }\n\t\t\t\t>\n\t\t\t\t\t<SiteHub\n\t\t\t\t\t\tisTransparent={ isResizableFrameOversized }\n\t\t\t\t\t\tclassName=\"edit-site-layout__hub\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t\t\t{ canvasMode === 'edit' && (\n\t\t\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\t\t\tkey=\"header\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__header\"\n\t\t\t\t\t\t\t\tariaLabel={ __( 'Editor top bar' ) }\n\t\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\t\tvariants={ {\n\t\t\t\t\t\t\t\t\tisDistractionFree: { opacity: 0, y: 0 },\n\t\t\t\t\t\t\t\t\tisDistractionFreeHovering: {\n\t\t\t\t\t\t\t\t\t\topacity: 1,\n\t\t\t\t\t\t\t\t\t\ty: 0,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tview: { opacity: 1, y: '-100%' },\n\t\t\t\t\t\t\t\t\tedit: { opacity: 1, y: 0 },\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\t\ty: '-100%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\t\topacity: isDistractionFree ? 1 : 0,\n\t\t\t\t\t\t\t\t\ty: isDistractionFree ? 0 : '-100%',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Header />\n\t\t\t\t\t\t\t</NavigableRegion>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</motion.div>\n\n\t\t\t\t<div className=\"edit-site-layout__content\">\n\t\t\t\t\t{ /*\n\t\t\t\t\t\tThe NavigableRegion must always be rendered and not use\n\t\t\t\t\t\t`inert` otherwise `useNavigateRegions` will fail.\n\t\t\t\t\t*/ }\n\t\t\t\t\t<NavigableRegion\n\t\t\t\t\t\tariaLabel={ __( 'Navigation' ) }\n\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar-region\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\tanimate={ { opacity: 1 } }\n\t\t\t\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\tduration:\n\t\t\t\t\t\t\t\t\t\t\t// Disable transition in mobile to emulate a full page transition.\n\t\t\t\t\t\t\t\t\t\t\tdisableMotion || isMobileViewport\n\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-layout__sidebar\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Sidebar />\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t</NavigableRegion>\n\n\t\t\t\t\t<SavePanel />\n\n\t\t\t\t\t{ areas.content && canvasMode !== 'edit' && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__area\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: widths?.content,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ areas.content }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ areas.preview && (\n\t\t\t\t\t\t<div className=\"edit-site-layout__canvas-container\">\n\t\t\t\t\t\t\t{ canvasResizer }\n\t\t\t\t\t\t\t{ !! canvasSize.width && (\n\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\twhileHover={\n\t\t\t\t\t\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 0.5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\t\tlayout=\"position\"\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'edit-site-layout__canvas',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'is-right-aligned':\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t\t: ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t\t\t\t\t\t<ResizableFrame\n\t\t\t\t\t\t\t\t\t\t\tisReady={ ! isEditorLoading }\n\t\t\t\t\t\t\t\t\t\t\tisFullWidth={\n\t\t\t\t\t\t\t\t\t\t\t\tcanvasMode === 'edit'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefaultSize={ {\n\t\t\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t\t\tcanvasSize.width -\n\t\t\t\t\t\t\t\t\t\t\t\t\t24 /* $canvas-padding */,\n\t\t\t\t\t\t\t\t\t\t\t\theight: canvasSize.height,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tisOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tisResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tsetIsOversized={\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsResizableFrameOversized\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tinnerContentStyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\t\t\tgradientValue ??\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor,\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ areas.preview }\n\t\t\t\t\t\t\t\t\t\t</ResizableFrame>\n\t\t\t\t\t\t\t\t\t</ErrorBoundary>\n\t\t\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