@wordpress/edit-site 5.24.1 → 5.25.1-next.79a6196f.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +2 -3
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/back-button.js +3 -2
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +48 -23
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +2 -2
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +5 -54
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-post-link-props.js +27 -0
- package/build/components/block-editor/use-post-link-props.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +15 -23
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +15 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +21 -33
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +9 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +11 -7
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +6 -6
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +8 -4
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +38 -21
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +11 -7
- 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 +26 -10
- package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +6 -6
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build/components/global-styles/font-library-modal/utils/index.js +35 -38
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/preview.js +43 -1
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +16 -12
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +54 -58
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +56 -15
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/ui.js +13 -62
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +15 -106
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +21 -47
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +19 -14
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -36
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +15 -21
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +2 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-main/index.js +4 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +102 -52
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +305 -0
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build/components/page-patterns/dataviews-patterns.js +307 -0
- package/build/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build/components/page-patterns/grid-item.js +4 -3
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +3 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +23 -13
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +312 -36
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/{page-patterns/pagination.js → pagination/index.js} +25 -12
- package/build/components/pagination/index.js.map +1 -0
- package/build/components/{page-pages/side-editor.js → post-preview/index.js} +8 -4
- package/build/components/post-preview/index.js.map +1 -0
- package/build/components/preferences-modal/enable-feature.js +3 -2
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/enable-panel-option.js +33 -0
- package/build/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build/components/preferences-modal/index.js +89 -25
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/revisions/index.js +3 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +6 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +3 -4
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +8 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +26 -20
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -10
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +19 -6
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +3 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +1 -5
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +62 -10
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +10 -4
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +1 -2
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +4 -13
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +69 -0
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +3 -89
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/template-areas.js +117 -0
- package/build/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +63 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +6 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +38 -8
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +3 -0
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +9 -1
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/navigation-menu-edit.js +1 -1
- package/build/hooks/navigation-menu-edit.js.map +1 -1
- package/build/hooks/template-part-edit.js +1 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +12 -7
- package/build/index.js.map +1 -1
- package/build/store/actions.js +54 -52
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +6 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/store/reducer.js +0 -64
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -47
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +15 -1
- package/build/utils/constants.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-module/components/add-new-template/add-custom-template-modal-content.js +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +4 -3
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +50 -25
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +2 -2
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +8 -56
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-post-link-props.js +20 -0
- package/build-module/components/block-editor/use-post-link-props.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +16 -24
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +14 -7
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +25 -37
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +9 -7
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +13 -8
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +8 -8
- 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 +8 -4
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +39 -22
- 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 +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +13 -8
- 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 +27 -11
- 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 +5 -5
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +4 -4
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js +34 -36
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/preview.js +45 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +17 -13
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +55 -59
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +56 -15
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +40 -22
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/ui.js +15 -64
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +19 -109
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +25 -51
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -2
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +20 -15
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -23
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -36
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +15 -21
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +2 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-main/index.js +4 -4
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +101 -51
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +292 -0
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -0
- package/build-module/components/page-patterns/dataviews-patterns.js +299 -0
- package/build-module/components/page-patterns/dataviews-patterns.js.map +1 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/grid-item.js +4 -3
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -3
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +3 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -13
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +314 -38
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/{page-patterns/pagination.js → pagination/index.js} +24 -12
- package/build-module/components/pagination/index.js.map +1 -0
- package/build-module/components/{page-pages/side-editor.js → post-preview/index.js} +7 -3
- package/build-module/components/post-preview/index.js.map +1 -0
- package/build-module/components/preferences-modal/enable-feature.js +3 -2
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel-option.js +26 -0
- package/build-module/components/preferences-modal/enable-panel-option.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +90 -26
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/revisions/index.js +4 -8
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +3 -4
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +8 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +26 -20
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -10
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +17 -5
- 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-edit-mode/default-sidebar.js +1 -5
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +64 -12
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +10 -4
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +2 -3
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -4
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +6 -15
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +3 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +61 -0
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +5 -90
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js +109 -0
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +64 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +6 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +40 -10
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +3 -0
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +9 -1
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +11 -6
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/navigation-menu-edit.js +1 -1
- package/build-module/hooks/navigation-menu-edit.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +1 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +12 -7
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +49 -47
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +6 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -61
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +40 -41
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +8 -0
- package/build-module/utils/constants.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-style/style-rtl.css +607 -561
- package/build-style/style.css +607 -561
- package/package.json +42 -42
- package/src/components/add-new-template/add-custom-template-modal-content.js +1 -1
- package/src/components/add-new-template/style.scss +2 -1
- package/src/components/block-editor/back-button.js +4 -2
- package/src/components/block-editor/editor-canvas.js +63 -47
- package/src/components/block-editor/resizable-editor.js +1 -1
- package/src/components/block-editor/site-editor-canvas.js +32 -96
- package/src/components/block-editor/style.scss +7 -14
- package/src/components/block-editor/use-post-link-props.js +20 -0
- package/src/components/block-editor/use-site-editor-settings.js +38 -58
- package/src/components/code-editor/style.scss +0 -4
- package/src/components/create-template-part-modal/index.js +83 -82
- package/src/components/editor/index.js +34 -47
- package/src/components/editor-canvas-container/index.js +8 -6
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +18 -7
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +3 -3
- package/src/components/global-styles/font-library-modal/context.js +8 -8
- package/src/components/global-styles/font-library-modal/font-collection.js +10 -5
- package/src/components/global-styles/font-library-modal/index.js +44 -24
- package/src/components/global-styles/font-library-modal/installed-fonts.js +3 -3
- package/src/components/global-styles/font-library-modal/library-font-variant.js +18 -7
- package/src/components/global-styles/font-library-modal/local-fonts.js +53 -26
- package/src/components/global-styles/font-library-modal/resolvers.js +5 -5
- package/src/components/global-styles/font-library-modal/style.scss +5 -2
- package/src/components/global-styles/font-library-modal/{tab-layout.js → tab-panel-layout.js} +9 -3
- package/src/components/global-styles/font-library-modal/utils/index.js +21 -23
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +58 -0
- package/src/components/global-styles/preview.js +55 -3
- package/src/components/global-styles/screen-color-palette.js +16 -26
- package/src/components/global-styles/screen-revisions/index.js +93 -101
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +85 -17
- package/src/components/global-styles/screen-revisions/style.scss +86 -21
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +67 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +73 -46
- package/src/components/global-styles/ui.js +13 -74
- package/src/components/header-edit-mode/document-tools/index.js +35 -167
- package/src/components/header-edit-mode/index.js +33 -78
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -4
- package/src/components/header-edit-mode/more-menu/index.js +25 -27
- package/src/components/header-edit-mode/style.scss +46 -68
- package/src/components/keyboard-shortcuts/edit-mode.js +1 -26
- package/src/components/keyboard-shortcuts/register.js +0 -43
- package/src/components/layout/index.js +29 -47
- package/src/components/layout/style.scss +10 -3
- package/src/components/page/header.js +2 -1
- package/src/components/page/style.scss +3 -3
- package/src/components/page-main/index.js +8 -8
- package/src/components/page-pages/index.js +157 -62
- package/src/components/page-pages/style.scss +4 -1
- package/src/components/page-patterns/dataviews-pattern-actions.js +329 -0
- package/src/components/page-patterns/dataviews-patterns.js +380 -0
- package/src/components/page-patterns/duplicate-menu-item.js +1 -1
- package/src/components/page-patterns/grid-item.js +3 -2
- package/src/components/page-patterns/patterns-list.js +7 -3
- package/src/components/page-patterns/rename-menu-item.js +7 -1
- package/src/components/page-patterns/style.scss +89 -26
- package/src/components/page-patterns/use-patterns.js +24 -15
- package/src/components/page-templates/index.js +399 -64
- package/src/components/{page-patterns/pagination.js → pagination/index.js} +21 -10
- package/src/components/pagination/style.scss +5 -0
- package/src/components/post-preview/index.js +16 -0
- package/src/components/preferences-modal/enable-feature.js +9 -5
- package/src/components/preferences-modal/enable-panel-option.js +23 -0
- package/src/components/preferences-modal/index.js +151 -40
- package/src/components/revisions/index.js +8 -15
- package/src/components/routes/link.js +11 -3
- package/src/components/routes/use-title.js +3 -10
- package/src/components/save-button/index.js +17 -3
- package/src/components/sidebar/index.js +45 -35
- package/src/components/sidebar/style.scss +10 -12
- package/src/components/sidebar-dataviews/add-new-view.js +1 -1
- package/src/components/sidebar-dataviews/dataview-item.js +3 -7
- package/src/components/sidebar-dataviews/default-views.js +23 -6
- package/src/components/sidebar-dataviews/index.js +2 -2
- package/src/components/sidebar-edit-mode/default-sidebar.js +0 -12
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +85 -14
- package/src/components/sidebar-edit-mode/page-panels/index.js +53 -25
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/style.scss +1 -42
- package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +0 -12
- package/src/components/sidebar-edit-mode/style.scss +0 -10
- package/src/components/sidebar-edit-mode/template-panel/index.js +44 -40
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-details-footer/index.js +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +3 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +7 -1
- package/src/components/sidebar-navigation-screen-page/index.js +2 -1
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +77 -0
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +1 -96
- package/src/components/sidebar-navigation-screen-template/index.js +8 -2
- package/src/components/sidebar-navigation-screen-template/template-areas.js +135 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +85 -28
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/site-hub/index.js +4 -5
- package/src/components/site-hub/style.scss +5 -2
- package/src/components/style-book/index.js +65 -21
- package/src/components/style-book/style.scss +3 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
- package/src/components/template-actions/rename-menu-item.js +7 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/hooks/commands/use-common-commands.js +10 -5
- package/src/hooks/commands/use-edit-mode-commands.js +8 -12
- package/src/hooks/navigation-menu-edit.js +1 -1
- package/src/hooks/template-part-edit.js +1 -1
- package/src/index.js +11 -5
- package/src/store/actions.js +50 -50
- package/src/store/private-actions.js +7 -3
- package/src/store/reducer.js +0 -62
- package/src/store/selectors.js +47 -41
- package/src/store/test/actions.js +11 -39
- package/src/store/test/reducer.js +1 -82
- package/src/store/test/selectors.js +0 -24
- package/src/style.scss +3 -3
- package/src/utils/constants.js +8 -0
- package/src/utils/get-is-list-page.js +2 -3
- package/build/components/dataviews/add-filter.js +0 -91
- package/build/components/dataviews/add-filter.js.map +0 -1
- package/build/components/dataviews/constants.js +0 -14
- package/build/components/dataviews/constants.js.map +0 -1
- package/build/components/dataviews/dataviews.js +0 -99
- package/build/components/dataviews/dataviews.js.map +0 -1
- package/build/components/dataviews/filter-summary.js +0 -62
- package/build/components/dataviews/filter-summary.js.map +0 -1
- package/build/components/dataviews/filters.js +0 -63
- package/build/components/dataviews/filters.js.map +0 -1
- package/build/components/dataviews/index.js +0 -21
- package/build/components/dataviews/index.js.map +0 -1
- package/build/components/dataviews/item-actions.js +0 -184
- package/build/components/dataviews/item-actions.js.map +0 -1
- package/build/components/dataviews/pagination.js +0 -123
- package/build/components/dataviews/pagination.js.map +0 -1
- package/build/components/dataviews/reset-filters.js +0 -33
- package/build/components/dataviews/reset-filters.js.map +0 -1
- package/build/components/dataviews/search.js +0 -51
- package/build/components/dataviews/search.js.map +0 -1
- package/build/components/dataviews/view-actions.js +0 -244
- package/build/components/dataviews/view-actions.js.map +0 -1
- package/build/components/dataviews/view-grid.js +0 -82
- package/build/components/dataviews/view-grid.js.map +0 -1
- package/build/components/dataviews/view-list.js +0 -399
- package/build/components/dataviews/view-list.js.map +0 -1
- package/build/components/dataviews/view-side-by-side.js +0 -20
- package/build/components/dataviews/view-side-by-side.js.map +0 -1
- package/build/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build/components/header-edit-mode/document-actions/index.js +0 -172
- package/build/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/redo.js +0 -41
- package/build/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build/components/header-edit-mode/undo-redo/undo.js +0 -40
- package/build/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build/components/page-content-focus-notifications/back-to-page-notification.js +0 -61
- package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/edit-template-notification.js +0 -102
- package/build/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build/components/page-content-focus-notifications/index.js +0 -22
- package/build/components/page-content-focus-notifications/index.js.map +0 -1
- package/build/components/page-pages/side-editor.js.map +0 -1
- package/build/components/page-patterns/pagination.js.map +0 -1
- package/build/components/page-templates/dataviews-templates.js +0 -316
- package/build/components/page-templates/dataviews-templates.js.map +0 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +0 -60
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -109
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +0 -101
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +0 -79
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -48
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -84
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -35
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js +0 -73
- package/build/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -219
- package/build/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/build/utils/use-debounced-input.js +0 -22
- package/build/utils/use-debounced-input.js.map +0 -1
- package/build-module/components/dataviews/add-filter.js +0 -84
- package/build-module/components/dataviews/add-filter.js.map +0 -1
- package/build-module/components/dataviews/constants.js +0 -6
- package/build-module/components/dataviews/constants.js.map +0 -1
- package/build-module/components/dataviews/dataviews.js +0 -90
- package/build-module/components/dataviews/dataviews.js.map +0 -1
- package/build-module/components/dataviews/filter-summary.js +0 -55
- package/build-module/components/dataviews/filter-summary.js.map +0 -1
- package/build-module/components/dataviews/filters.js +0 -55
- package/build-module/components/dataviews/filters.js.map +0 -1
- package/build-module/components/dataviews/index.js +0 -2
- package/build-module/components/dataviews/index.js.map +0 -1
- package/build-module/components/dataviews/item-actions.js +0 -177
- package/build-module/components/dataviews/item-actions.js.map +0 -1
- package/build-module/components/dataviews/pagination.js +0 -115
- package/build-module/components/dataviews/pagination.js.map +0 -1
- package/build-module/components/dataviews/reset-filters.js +0 -26
- package/build-module/components/dataviews/reset-filters.js.map +0 -1
- package/build-module/components/dataviews/search.js +0 -43
- package/build-module/components/dataviews/search.js.map +0 -1
- package/build-module/components/dataviews/view-actions.js +0 -237
- package/build-module/components/dataviews/view-actions.js.map +0 -1
- package/build-module/components/dataviews/view-grid.js +0 -74
- package/build-module/components/dataviews/view-grid.js.map +0 -1
- package/build-module/components/dataviews/view-list.js +0 -390
- package/build-module/components/dataviews/view-list.js.map +0 -1
- package/build-module/components/dataviews/view-side-by-side.js +0 -12
- package/build-module/components/dataviews/view-side-by-side.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-layout.js.map +0 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +0 -164
- package/build-module/components/header-edit-mode/document-actions/index.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/redo.js +0 -33
- package/build-module/components/header-edit-mode/undo-redo/redo.js.map +0 -1
- package/build-module/components/header-edit-mode/undo-redo/undo.js +0 -32
- package/build-module/components/header-edit-mode/undo-redo/undo.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js +0 -54
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js +0 -96
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +0 -1
- package/build-module/components/page-content-focus-notifications/index.js +0 -14
- package/build-module/components/page-content-focus-notifications/index.js.map +0 -1
- package/build-module/components/page-pages/side-editor.js.map +0 -1
- package/build-module/components/page-patterns/pagination.js.map +0 -1
- package/build-module/components/page-templates/dataviews-templates.js +0 -308
- package/build-module/components/page-templates/dataviews-templates.js.map +0 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -53
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -102
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +0 -93
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +0 -69
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -41
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -77
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -27
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js +0 -65
- package/build-module/components/sidebar-edit-mode/template-panel/last-revision.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -209
- package/build-module/components/sidebar-edit-mode/template-panel/pattern-categories.js.map +0 -1
- package/build-module/utils/use-debounced-input.js +0 -15
- package/build-module/utils/use-debounced-input.js.map +0 -1
- package/src/components/dataviews/README.md +0 -191
- package/src/components/dataviews/add-filter.js +0 -108
- package/src/components/dataviews/constants.js +0 -5
- package/src/components/dataviews/dataviews.js +0 -99
- package/src/components/dataviews/filter-summary.js +0 -79
- package/src/components/dataviews/filters.js +0 -65
- package/src/components/dataviews/index.js +0 -1
- package/src/components/dataviews/item-actions.js +0 -208
- package/src/components/dataviews/pagination.js +0 -144
- package/src/components/dataviews/reset-filters.js +0 -26
- package/src/components/dataviews/search.js +0 -42
- package/src/components/dataviews/style.scss +0 -131
- package/src/components/dataviews/view-actions.js +0 -319
- package/src/components/dataviews/view-grid.js +0 -90
- package/src/components/dataviews/view-list.js +0 -512
- package/src/components/dataviews/view-side-by-side.js +0 -9
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamilies.spec.js +0 -62
- package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +0 -28
- package/src/components/header-edit-mode/document-actions/index.js +0 -204
- package/src/components/header-edit-mode/document-actions/style.scss +0 -145
- package/src/components/header-edit-mode/undo-redo/redo.js +0 -38
- package/src/components/header-edit-mode/undo-redo/undo.js +0 -34
- package/src/components/page-content-focus-notifications/back-to-page-notification.js +0 -58
- package/src/components/page-content-focus-notifications/edit-template-notification.js +0 -104
- package/src/components/page-content-focus-notifications/index.js +0 -14
- package/src/components/page-pages/side-editor.js +0 -14
- package/src/components/page-templates/dataviews-templates.js +0 -345
- package/src/components/secondary-sidebar/inserter-sidebar.js +0 -66
- package/src/components/secondary-sidebar/list-view-sidebar.js +0 -123
- package/src/components/secondary-sidebar/style.scss +0 -65
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +0 -108
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +0 -99
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +0 -45
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +0 -83
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +0 -26
- package/src/components/sidebar-edit-mode/template-panel/last-revision.js +0 -82
- package/src/components/sidebar-edit-mode/template-panel/pattern-categories.js +0 -279
- package/src/utils/use-debounced-input.js +0 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalText","Text","__experimentalHeading","Heading","__experimentalVStack","VStack","__experimentalSpacer","Spacer","__experimentalHStack","HStack","Button","chevronLeft","TabPanelLayout","title","description","handleBack","children","footer","createElement","className","margin","spacing","justify","variant","onClick","icon","size","level"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/tab-panel-layout.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalText as Text,\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalHStack as HStack,\n\tButton,\n} from '@wordpress/components';\nimport { chevronLeft } from '@wordpress/icons';\n\nfunction TabPanelLayout( {\n\ttitle,\n\tdescription,\n\thandleBack,\n\tchildren,\n\tfooter,\n} ) {\n\treturn (\n\t\t<div className=\"font-library-modal__tabpanel-layout\">\n\t\t\t<Spacer margin={ 4 } />\n\t\t\t<VStack spacing={ 4 } justify=\"space-between\">\n\t\t\t\t<header>\n\t\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t\t\t{ !! handleBack && (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ handleBack }\n\t\t\t\t\t\t\t\t\ticon={ chevronLeft }\n\t\t\t\t\t\t\t\t\tsize=\"small\"\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{ title && (\n\t\t\t\t\t\t\t\t<Heading\n\t\t\t\t\t\t\t\t\tlevel={ 2 }\n\t\t\t\t\t\t\t\t\tsize={ 13 }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-header\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t{ description && <Text>{ description }</Text> }\n\t\t\t\t\t</VStack>\n\t\t\t\t</header>\n\t\t\t\t<main>{ children }</main>\n\t\t\t\t{ footer && <footer>{ footer }</footer> }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default TabPanelLayout;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,kBAAkB,IAAIC,IAAI,EAC1BC,qBAAqB,IAAIC,OAAO,EAChCC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,SAASC,cAAcA,CAAE;EACxBC,KAAK;EACLC,WAAW;EACXC,UAAU;EACVC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,OACCC,aAAA;IAAKC,SAAS,EAAC;EAAqC,GACnDD,aAAA,CAACX,MAAM;IAACa,MAAM,EAAG;EAAG,CAAE,CAAC,EACvBF,aAAA,CAACb,MAAM;IAACgB,OAAO,EAAG,CAAG;IAACC,OAAO,EAAC;EAAe,GAC5CJ,aAAA,iBACCA,aAAA,CAACb,MAAM;IAACgB,OAAO,EAAG;EAAG,GACpBH,aAAA,CAACT,MAAM;IAACa,OAAO,EAAC;EAAY,GACzB,CAAC,CAAEP,UAAU,IACdG,aAAA,CAACR,MAAM;IACNa,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGT,UAAY;IACtBU,IAAI,EAAGd,WAAa;IACpBe,IAAI,EAAC;EAAO,CACZ,CACD,EACCb,KAAK,IACNK,aAAA,CAACf,OAAO;IACPwB,KAAK,EAAG,CAAG;IACXD,IAAI,EAAG,EAAI;IACXP,SAAS,EAAC;EAAgC,GAExCN,KACM,CAEH,CAAC,EACPC,WAAW,IAAII,aAAA,CAACjB,IAAI,QAAGa,WAAmB,CACrC,CACD,CAAC,EACTI,aAAA,eAAQF,QAAgB,CAAC,EACvBC,MAAM,IAAIC,aAAA,iBAAUD,MAAgB,CAC/B,CACJ,CAAC;AAER;AAEA,eAAeL,cAAc"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { FONT_WEIGHTS, FONT_STYLES } from './constants';
|
|
10
|
+
import { unlock } from '../../../../lock-unlock';
|
|
10
11
|
export function setUIValuesNeeded(font, extraValues = {}) {
|
|
11
12
|
if (!font.name && (font.fontFamily || font.slug)) {
|
|
12
13
|
font.name = font.fontFamily || font.slug;
|
|
@@ -116,41 +117,38 @@ export function getDisplaySrcFromFontFace(input, urlPrefix) {
|
|
|
116
117
|
}
|
|
117
118
|
return src;
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
-
// This function replicates one behavior of _wp_to_kebab_case().
|
|
121
|
-
// Additional context: https://github.com/WordPress/gutenberg/issues/53695
|
|
122
|
-
export function wpKebabCase(str) {
|
|
123
|
-
// If a string contains a digit followed by a number, insert a dash between them.
|
|
124
|
-
return kebabCase(str).replace(/([a-zA-Z])(\d)|(\d)([a-zA-Z])/g, '$1$3-$2$4');
|
|
125
|
-
}
|
|
126
|
-
export function makeFormDataFromFontFamilies(fontFamilies) {
|
|
120
|
+
export function makeFormDataFromFontFamily(fontFamily) {
|
|
127
121
|
const formData = new FormData();
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
122
|
+
const {
|
|
123
|
+
kebabCase
|
|
124
|
+
} = unlock(componentsPrivateApis);
|
|
125
|
+
const newFontFamily = {
|
|
126
|
+
...fontFamily,
|
|
127
|
+
slug: kebabCase(fontFamily.slug)
|
|
128
|
+
};
|
|
129
|
+
if (newFontFamily?.fontFace) {
|
|
130
|
+
const newFontFaces = newFontFamily.fontFace.map((face, faceIndex) => {
|
|
131
|
+
if (face.file) {
|
|
132
|
+
// Slugified file name because the it might contain spaces or characters treated differently on the server.
|
|
133
|
+
const fileId = `file-${faceIndex}`;
|
|
134
|
+
// Add the files to the formData
|
|
135
|
+
formData.append(fileId, face.file, face.file.name);
|
|
136
|
+
// remove the file object from the face object the file is referenced by the uploadedFile key
|
|
137
|
+
const {
|
|
138
|
+
file,
|
|
139
|
+
...faceWithoutFileProperty
|
|
140
|
+
} = face;
|
|
141
|
+
const newFace = {
|
|
142
|
+
...faceWithoutFileProperty,
|
|
143
|
+
uploadedFile: fileId
|
|
144
|
+
};
|
|
145
|
+
return newFace;
|
|
146
|
+
}
|
|
147
|
+
return face;
|
|
148
|
+
});
|
|
149
|
+
newFontFamily.fontFace = newFontFaces;
|
|
150
|
+
}
|
|
151
|
+
formData.append('font_family_settings', JSON.stringify(newFontFamily));
|
|
154
152
|
return formData;
|
|
155
153
|
}
|
|
156
154
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["paramCase","kebabCase","FONT_WEIGHTS","FONT_STYLES","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","wpKebabCase","str","makeFormDataFromFontFamilies","fontFamilies","formData","FormData","newFontFamilies","family","familyIndex","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 * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * Internal dependencies\n */\nimport { FONT_WEIGHTS, FONT_STYLES } from './constants';\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\n// This function replicates one behavior of _wp_to_kebab_case().\n// Additional context: https://github.com/WordPress/gutenberg/issues/53695\nexport function wpKebabCase( str ) {\n\t// If a string contains a digit followed by a number, insert a dash between them.\n\treturn kebabCase( str ).replace(\n\t\t/([a-zA-Z])(\\d)|(\\d)([a-zA-Z])/g,\n\t\t'$1$3-$2$4'\n\t);\n}\n\nexport function makeFormDataFromFontFamilies( fontFamilies ) {\n\tconst formData = new FormData();\n\tconst newFontFamilies = fontFamilies.map( ( family, familyIndex ) => {\n\t\tfamily.slug = wpKebabCase( family.slug );\n\t\tif ( family?.fontFace ) {\n\t\t\tfamily.fontFace = family.fontFace.map( ( 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-${ familyIndex }-${ 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\treturn family;\n\t} );\n\tformData.append( 'font_families', JSON.stringify( newFontFamilies ) );\n\treturn formData;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,SAAS,QAAQ,aAAa;;AAEpD;AACA;AACA;AACA,SAASC,YAAY,EAAEC,WAAW,QAAQ,aAAa;AAEvD,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,KA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E,CAAE+C,MAAM,EAAEC,WAAW,KAAM;IACpED,MAAM,CAAC5D,IAAI,GAAGqD,WAAW,CAAEO,MAAM,CAAC5D,IAAK,CAAC;IACxC,IAAK4D,MAAM,EAAEvC,QAAQ,EAAG;MACvBuC,MAAM,CAACvC,QAAQ,GAAGuC,MAAM,CAACvC,QAAQ,CAACR,GAAG,CAAE,CAAER,IAAI,EAAEyD,SAAS,KAAM;QAC7D,IAAKzD,IAAI,CAAC0D,IAAI,EAAG;UAChB;UACA,MAAMC,MAAM,GAAI,QAAQH,WAAa,IAAIC,SAAW,EAAC;UACrD;UACAL,QAAQ,CAACQ,MAAM,CAAED,MAAM,EAAE3D,IAAI,CAAC0D,IAAI,EAAE1D,IAAI,CAAC0D,IAAI,CAACjE,IAAK,CAAC;UACpD;UACA,MAAM;YAAEiE,IAAI;YAAE,GAAGG;UAAwB,CAAC,GAAG7D,IAAI;UACjD,MAAM8D,OAAO,GAAG;YACf,GAAGD,uBAAuB;YAC1BE,YAAY,EAAEJ;UACf,CAAC;UACD,OAAOG,OAAO;QACf;QACA,OAAO9D,IAAI;MACZ,CAAE,CAAC;IACJ;IACA,OAAOuD,MAAM;EACd,CAAE,CAAC;EACHH,QAAQ,CAACQ,MAAM,CAAE,eAAe,EAAEI,IAAI,CAACC,SAAS,CAAEX,eAAgB,CAAE,CAAC;EACrE,OAAOF,QAAQ;AAChB"}
|
|
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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UAAU,EAAG;EACxD,MAAMuD,QAAQ,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC/B,MAAM;IAAEC;EAAU,CAAC,GAAG9D,MAAM,CAAEH,qBAAsB,CAAC;EAErD,MAAMkE,aAAa,GAAG;IACrB,GAAG1D,UAAU;IACbC,IAAI,EAAEwD,SAAS,CAAEzD,UAAU,CAACC,IAAK;EAClC,CAAC;EAED,IAAKyD,aAAa,EAAEpC,QAAQ,EAAG;IAC9B,MAAMqC,YAAY,GAAGD,aAAa,CAACpC,QAAQ,CAACR,GAAG,CAC9C,CAAER,IAAI,EAAEsD,SAAS,KAAM;MACtB,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"}
|
|
@@ -4,8 +4,8 @@ import { createElement, Fragment } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { __unstableIframe as Iframe, __unstableEditorStyles as EditorStyles, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
6
6
|
import { __unstableMotion as motion, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
|
-
import { useReducedMotion, useResizeObserver } from '@wordpress/compose';
|
|
8
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
7
|
+
import { useThrottle, useReducedMotion, useResizeObserver } from '@wordpress/compose';
|
|
8
|
+
import { useLayoutEffect, useState, useMemo } from '@wordpress/element';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
@@ -47,6 +47,13 @@ const secondFrame = {
|
|
|
47
47
|
const normalizedWidth = 248;
|
|
48
48
|
const normalizedHeight = 152;
|
|
49
49
|
const normalizedColorSwatchSize = 32;
|
|
50
|
+
|
|
51
|
+
// Throttle options for useThrottle. Must be defined outside of the component,
|
|
52
|
+
// so that the object reference is the same on each render.
|
|
53
|
+
const THROTTLE_OPTIONS = {
|
|
54
|
+
leading: true,
|
|
55
|
+
trailing: true
|
|
56
|
+
};
|
|
50
57
|
const StylesPreview = ({
|
|
51
58
|
label,
|
|
52
59
|
isFocused,
|
|
@@ -66,7 +73,41 @@ const StylesPreview = ({
|
|
|
66
73
|
const [containerResizeListener, {
|
|
67
74
|
width
|
|
68
75
|
}] = useResizeObserver();
|
|
69
|
-
const
|
|
76
|
+
const [throttledWidth, setThrottledWidthState] = useState(width);
|
|
77
|
+
const [ratioState, setRatioState] = useState();
|
|
78
|
+
const setThrottledWidth = useThrottle(setThrottledWidthState, 250, THROTTLE_OPTIONS);
|
|
79
|
+
|
|
80
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
81
|
+
// size before the width is set.
|
|
82
|
+
useLayoutEffect(() => {
|
|
83
|
+
if (width) {
|
|
84
|
+
setThrottledWidth(width);
|
|
85
|
+
}
|
|
86
|
+
}, [width, setThrottledWidth]);
|
|
87
|
+
|
|
88
|
+
// Must use useLayoutEffect to avoid a flash of the iframe at the wrong
|
|
89
|
+
// size before the width is set.
|
|
90
|
+
useLayoutEffect(() => {
|
|
91
|
+
const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
|
|
92
|
+
const ratioDiff = newRatio - (ratioState || 0);
|
|
93
|
+
|
|
94
|
+
// Only update the ratio state if the difference is big enough
|
|
95
|
+
// or if the ratio state is not yet set. This is to avoid an
|
|
96
|
+
// endless loop of updates at particular viewport heights when the
|
|
97
|
+
// presence of a scrollbar causes the width to change slightly.
|
|
98
|
+
const isRatioDiffBigEnough = Math.abs(ratioDiff) > 0.1;
|
|
99
|
+
if (isRatioDiffBigEnough || !ratioState) {
|
|
100
|
+
setRatioState(newRatio);
|
|
101
|
+
}
|
|
102
|
+
}, [throttledWidth, ratioState]);
|
|
103
|
+
|
|
104
|
+
// Set a fallbackRatio to use before the throttled ratio has been set.
|
|
105
|
+
const fallbackRatio = width ? width / normalizedWidth : 1;
|
|
106
|
+
// Use the throttled ratio if it has been calculated, otherwise
|
|
107
|
+
// use the fallback ratio. The throttled ratio is used to avoid
|
|
108
|
+
// an endless loop of updates at particular viewport heights.
|
|
109
|
+
// See: https://github.com/WordPress/gutenberg/issues/55112
|
|
110
|
+
const ratio = ratioState ? ratioState : fallbackRatio;
|
|
70
111
|
const {
|
|
71
112
|
paletteColors,
|
|
72
113
|
highlightedColors
|
|
@@ -90,6 +131,7 @@ const StylesPreview = ({
|
|
|
90
131
|
}, containerResizeListener), isReady && createElement(Iframe, {
|
|
91
132
|
className: "edit-site-global-styles-preview__iframe",
|
|
92
133
|
style: {
|
|
134
|
+
width: '100%',
|
|
93
135
|
height: normalizedHeight * ratio
|
|
94
136
|
},
|
|
95
137
|
onMouseEnter: () => setIsHovered(true),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__unstableIframe","Iframe","__unstableEditorStyles","EditorStyles","privateApis","blockEditorPrivateApis","__unstableMotion","motion","__experimentalHStack","HStack","__experimentalVStack","VStack","useReducedMotion","useResizeObserver","useState","useMemo","unlock","useStylesPreviewColors","useGlobalStyle","useGlobalStylesOutput","firstFrame","start","scale","opacity","hover","midFrame","secondFrame","normalizedWidth","normalizedHeight","normalizedColorSwatchSize","StylesPreview","label","isFocused","withHoverView","fontWeight","fontFamily","headingFontFamily","headingFontWeight","textColor","headingColor","backgroundColor","gradientValue","styles","disableMotion","isHovered","setIsHovered","containerResizeListener","width","ratio","paletteColors","highlightedColors","editorStyles","css","isGlobalStyles","isReady","createElement","Fragment","style","position","className","height","onMouseEnter","onMouseLeave","tabIndex","div","background","cursor","undefined","initial","animate","variants","overflow","spacing","justify","fontSize","color","transition","delay","type","map","slug","index","key","borderRadius","top","filter","slice","flexGrow","padding","boxSizing","lineHeight","textAlign"],"sources":["@wordpress/edit-site/src/components/global-styles/preview.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__unstableIframe as Iframe,\n\t__unstableEditorStyles as EditorStyles,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\t__unstableMotion as motion,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useReducedMotion, useResizeObserver } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useStylesPreviewColors } from './hooks';\n\nconst { useGlobalStyle, useGlobalStylesOutput } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst firstFrame = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst midFrame = {\n\thover: {\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\topacity: 0.5,\n\t},\n};\n\nconst secondFrame = {\n\thover: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\nconst normalizedColorSwatchSize = 32;\n\nconst StylesPreview = ( { label, isFocused, withHoverView } ) => {\n\tconst [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );\n\tconst [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );\n\tconst [ headingFontFamily = fontFamily ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontFamily'\n\t);\n\tconst [ headingFontWeight = fontWeight ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontWeight'\n\t);\n\tconst [ textColor = 'black' ] = useGlobalStyle( 'color.text' );\n\tconst [ headingColor = textColor ] = useGlobalStyle(\n\t\t'elements.h1.color.text'\n\t);\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\tconst [ styles ] = useGlobalStylesOutput();\n\tconst disableMotion = useReducedMotion();\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst ratio = width ? width / normalizedWidth : 1;\n\n\tconst { paletteColors, highlightedColors } = useStylesPreviewColors();\n\n\t// Reset leaked styles from WP common.css and remove main content layout padding and border.\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}',\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles ] );\n\tconst isReady = !! width;\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t{ isReady && (\n\t\t\t\t<Iframe\n\t\t\t\t\tclassName=\"edit-site-global-styles-preview__iframe\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\t\tcursor: withHoverView ? 'pointer' : undefined,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinitial=\"start\"\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t( isHovered || isFocused ) &&\n\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'start'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tvariants={ firstFrame }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\toverflow: 'hidden',\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<motion.div\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\t\tfontSize: 65 * ratio,\n\t\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tanimate={ { scale: 1, opacity: 1 } }\n\t\t\t\t\t\t\t\t\tinitial={ { scale: 0.1, opacity: 0 } }\n\t\t\t\t\t\t\t\t\ttransition={ { delay: 0.3, type: 'tween' } }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tAa\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 * ratio }>\n\t\t\t\t\t\t\t\t\t{ highlightedColors.map(\n\t\t\t\t\t\t\t\t\t\t( { slug, color }, index ) => (\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\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\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderRadius:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t( normalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tratio ) /\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t2,\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\tanimate={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 1,\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\tinitial={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 0.1,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0,\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\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdelay:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex === 1 ? 0.2 : 0.1,\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)\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tvariants={ withHoverView && midFrame }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tfilter: 'blur(60px)',\n\t\t\t\t\t\t\t\topacity: 0.1,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\toverflow: 'hidden',\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{ paletteColors\n\t\t\t\t\t\t\t\t\t.slice( 0, 4 )\n\t\t\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\t\t\tflexGrow: 1,\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) ) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tvariants={ secondFrame }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\tspacing={ 3 * ratio }\n\t\t\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\t\tpadding: 10 * ratio,\n\t\t\t\t\t\t\t\t\tboxSizing: 'border-box',\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{ label && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\tfontSize: 40 * ratio,\n\t\t\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\t\t\tlineHeight: '1em',\n\t\t\t\t\t\t\t\t\t\t\ttextAlign: 'center',\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\t\t{ label }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</motion.div>\n\t\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,UAAU,EAAEG,iBAAiB;MAC7BqD,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;IACZ;EAAG,GAED5D,KACE,CAEC,CACG,CACD,CACL,CAER,CAAC;AAEL,CAAC;AAED,eAAeD,aAAa"}
|
|
1
|
+
{"version":3,"names":["__unstableIframe","Iframe","__unstableEditorStyles","EditorStyles","privateApis","blockEditorPrivateApis","__unstableMotion","motion","__experimentalHStack","HStack","__experimentalVStack","VStack","useThrottle","useReducedMotion","useResizeObserver","useLayoutEffect","useState","useMemo","unlock","useStylesPreviewColors","useGlobalStyle","useGlobalStylesOutput","firstFrame","start","scale","opacity","hover","midFrame","secondFrame","normalizedWidth","normalizedHeight","normalizedColorSwatchSize","THROTTLE_OPTIONS","leading","trailing","StylesPreview","label","isFocused","withHoverView","fontWeight","fontFamily","headingFontFamily","headingFontWeight","textColor","headingColor","backgroundColor","gradientValue","styles","disableMotion","isHovered","setIsHovered","containerResizeListener","width","throttledWidth","setThrottledWidthState","ratioState","setRatioState","setThrottledWidth","newRatio","ratioDiff","isRatioDiffBigEnough","Math","abs","fallbackRatio","ratio","paletteColors","highlightedColors","editorStyles","css","isGlobalStyles","isReady","createElement","Fragment","style","position","className","height","onMouseEnter","onMouseLeave","tabIndex","div","background","cursor","undefined","initial","animate","variants","overflow","spacing","justify","fontSize","color","transition","delay","type","map","slug","index","key","borderRadius","top","filter","slice","flexGrow","padding","boxSizing","lineHeight","textAlign"],"sources":["@wordpress/edit-site/src/components/global-styles/preview.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__unstableIframe as Iframe,\n\t__unstableEditorStyles as EditorStyles,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\t__unstableMotion as motion,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport {\n\tuseThrottle,\n\tuseReducedMotion,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { useLayoutEffect, useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useStylesPreviewColors } from './hooks';\n\nconst { useGlobalStyle, useGlobalStylesOutput } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst firstFrame = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst midFrame = {\n\thover: {\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\topacity: 0.5,\n\t},\n};\n\nconst secondFrame = {\n\thover: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\nconst normalizedColorSwatchSize = 32;\n\n// Throttle options for useThrottle. Must be defined outside of the component,\n// so that the object reference is the same on each render.\nconst THROTTLE_OPTIONS = {\n\tleading: true,\n\ttrailing: true,\n};\n\nconst StylesPreview = ( { label, isFocused, withHoverView } ) => {\n\tconst [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );\n\tconst [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );\n\tconst [ headingFontFamily = fontFamily ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontFamily'\n\t);\n\tconst [ headingFontWeight = fontWeight ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontWeight'\n\t);\n\tconst [ textColor = 'black' ] = useGlobalStyle( 'color.text' );\n\tconst [ headingColor = textColor ] = useGlobalStyle(\n\t\t'elements.h1.color.text'\n\t);\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\tconst [ styles ] = useGlobalStylesOutput();\n\tconst disableMotion = useReducedMotion();\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst [ throttledWidth, setThrottledWidthState ] = useState( width );\n\tconst [ ratioState, setRatioState ] = useState();\n\n\tconst setThrottledWidth = useThrottle(\n\t\tsetThrottledWidthState,\n\t\t250,\n\t\tTHROTTLE_OPTIONS\n\t);\n\n\t// Must use useLayoutEffect to avoid a flash of the iframe at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tif ( width ) {\n\t\t\tsetThrottledWidth( width );\n\t\t}\n\t}, [ width, setThrottledWidth ] );\n\n\t// Must use useLayoutEffect to avoid a flash of the iframe at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tconst newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;\n\t\tconst ratioDiff = newRatio - ( ratioState || 0 );\n\n\t\t// Only update the ratio state if the difference is big enough\n\t\t// or if the ratio state is not yet set. This is to avoid an\n\t\t// endless loop of updates at particular viewport heights when the\n\t\t// presence of a scrollbar causes the width to change slightly.\n\t\tconst isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;\n\n\t\tif ( isRatioDiffBigEnough || ! ratioState ) {\n\t\t\tsetRatioState( newRatio );\n\t\t}\n\t}, [ throttledWidth, ratioState ] );\n\n\t// Set a fallbackRatio to use before the throttled ratio has been set.\n\tconst fallbackRatio = width ? width / normalizedWidth : 1;\n\t// Use the throttled ratio if it has been calculated, otherwise\n\t// use the fallback ratio. The throttled ratio is used to avoid\n\t// an endless loop of updates at particular viewport heights.\n\t// See: https://github.com/WordPress/gutenberg/issues/55112\n\tconst ratio = ratioState ? ratioState : fallbackRatio;\n\n\tconst { paletteColors, highlightedColors } = useStylesPreviewColors();\n\n\t// Reset leaked styles from WP common.css and remove main content layout padding and border.\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;}',\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles ] );\n\tconst isReady = !! width;\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t{ isReady && (\n\t\t\t\t<Iframe\n\t\t\t\t\tclassName=\"edit-site-global-styles-preview__iframe\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\t\tcursor: withHoverView ? 'pointer' : undefined,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinitial=\"start\"\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t( isHovered || isFocused ) &&\n\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'start'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tvariants={ firstFrame }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\toverflow: 'hidden',\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<motion.div\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\t\tfontSize: 65 * ratio,\n\t\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tanimate={ { scale: 1, opacity: 1 } }\n\t\t\t\t\t\t\t\t\tinitial={ { scale: 0.1, opacity: 0 } }\n\t\t\t\t\t\t\t\t\ttransition={ { delay: 0.3, type: 'tween' } }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tAa\n\t\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 * ratio }>\n\t\t\t\t\t\t\t\t\t{ highlightedColors.map(\n\t\t\t\t\t\t\t\t\t\t( { slug, color }, index ) => (\n\t\t\t\t\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\theight:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\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\tnormalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tratio,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\t\t\t\tborderRadius:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t( normalizedColorSwatchSize *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tratio ) /\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t2,\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\tanimate={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 1,\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\tinitial={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tscale: 0.1,\n\t\t\t\t\t\t\t\t\t\t\t\t\topacity: 0,\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\ttransition={ {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdelay:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tindex === 1 ? 0.2 : 0.1,\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)\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tvariants={ withHoverView && midFrame }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tfilter: 'blur(60px)',\n\t\t\t\t\t\t\t\topacity: 0.1,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\toverflow: 'hidden',\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{ paletteColors\n\t\t\t\t\t\t\t\t\t.slice( 0, 4 )\n\t\t\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\t\t\tflexGrow: 1,\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) ) }\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tvariants={ secondFrame }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\tspacing={ 3 * ratio }\n\t\t\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\t\tpadding: 10 * ratio,\n\t\t\t\t\t\t\t\t\tboxSizing: 'border-box',\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{ label && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\t\tfontSize: 40 * ratio,\n\t\t\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\t\t\tlineHeight: '1em',\n\t\t\t\t\t\t\t\t\t\t\ttextAlign: 'center',\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\t\t{ label }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</motion.div>\n\t\t\t\t</Iframe>\n\t\t\t) }\n\t\t</>\n\t);\n};\n\nexport default StylesPreview;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,gBAAgB,IAAIC,MAAM,EAC1BC,sBAAsB,IAAIC,YAAY,EACtCC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SACCC,gBAAgB,IAAIC,MAAM,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SACCC,WAAW,EACXC,gBAAgB,EAChBC,iBAAiB,QACX,oBAAoB;AAC3B,SAASC,eAAe,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;;AAEvE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,sBAAsB,QAAQ,SAAS;AAEhD,MAAM;EAAEC,cAAc;EAAEC;AAAsB,CAAC,GAAGH,MAAM,CACvDb,sBACD,CAAC;AAED,MAAMiB,UAAU,GAAG;EAClBC,KAAK,EAAE;IACNC,KAAK,EAAE,CAAC;IACRC,OAAO,EAAE;EACV,CAAC;EACDC,KAAK,EAAE;IACNF,KAAK,EAAE,CAAC;IACRC,OAAO,EAAE;EACV;AACD,CAAC;AA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QAAQ;IAChBhB,KAAK,EAAG;MACPG,MAAM,EAAE,MAAM;MACdW,QAAQ,EAAE,QAAQ;MAClBiB,OAAO,EAAE,EAAE,GAAGxC,KAAK;MACnByC,SAAS,EAAE;IACZ;EAAG,GAEDrE,KAAK,IACNmC,aAAA;IACCE,KAAK,EAAG;MACPiB,QAAQ,EAAE,EAAE,GAAG1B,KAAK;MACpBxB,UAAU,EAAEC,iBAAiB;MAC7BkD,KAAK,EAAE/C,YAAY;MACnBL,UAAU,EAAEG,iBAAiB;MAC7BgE,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;IACZ;EAAG,GAEDvE,KACE,CAEC,CACG,CACD,CACL,CAER,CAAC;AAEL,CAAC;AAED,eAAeD,aAAa"}
|
|
@@ -3,7 +3,7 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
@@ -11,25 +11,29 @@ import { TabPanel } from '@wordpress/components';
|
|
|
11
11
|
import ColorPalettePanel from './color-palette-panel';
|
|
12
12
|
import GradientPalettePanel from './gradients-palette-panel';
|
|
13
13
|
import ScreenHeader from './header';
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
const {
|
|
16
|
+
Tabs
|
|
17
|
+
} = unlock(componentsPrivateApis);
|
|
14
18
|
function ScreenColorPalette({
|
|
15
19
|
name
|
|
16
20
|
}) {
|
|
17
21
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
18
22
|
title: __('Palette'),
|
|
19
23
|
description: __('Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.')
|
|
20
|
-
}), createElement(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
value: 'gradient'
|
|
29
|
-
}]
|
|
30
|
-
}, tab => createElement(Fragment, null, tab.value === 'solid' && createElement(ColorPalettePanel, {
|
|
24
|
+
}), createElement(Tabs, null, createElement(Tabs.TabList, null, createElement(Tabs.Tab, {
|
|
25
|
+
tabId: "solid"
|
|
26
|
+
}, "Solid"), createElement(Tabs.Tab, {
|
|
27
|
+
tabId: "gradient"
|
|
28
|
+
}, "Gradient")), createElement(Tabs.TabPanel, {
|
|
29
|
+
tabId: "solid",
|
|
30
|
+
focusable: false
|
|
31
|
+
}, createElement(ColorPalettePanel, {
|
|
31
32
|
name: name
|
|
32
|
-
}),
|
|
33
|
+
})), createElement(Tabs.TabPanel, {
|
|
34
|
+
tabId: "gradient",
|
|
35
|
+
focusable: false
|
|
36
|
+
}, createElement(GradientPalettePanel, {
|
|
33
37
|
name: name
|
|
34
38
|
}))));
|
|
35
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","
|
|
1
|
+
{"version":3,"names":["__","privateApis","componentsPrivateApis","ColorPalettePanel","GradientPalettePanel","ScreenHeader","unlock","Tabs","ScreenColorPalette","name","createElement","Fragment","title","description","TabList","Tab","tabId","TabPanel","focusable"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-color-palette.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ColorPalettePanel from './color-palette-panel';\nimport GradientPalettePanel from './gradients-palette-panel';\nimport ScreenHeader from './header';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction ScreenColorPalette( { name } ) {\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Palette' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<Tabs>\n\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t<Tabs.Tab tabId=\"solid\">Solid</Tabs.Tab>\n\t\t\t\t\t<Tabs.Tab tabId=\"gradient\">Gradient</Tabs.Tab>\n\t\t\t\t</Tabs.TabList>\n\t\t\t\t<Tabs.TabPanel tabId=\"solid\" focusable={ false }>\n\t\t\t\t\t<ColorPalettePanel name={ name } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId=\"gradient\" focusable={ false }>\n\t\t\t\t\t<GradientPalettePanel name={ name } />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs>\n\t\t</>\n\t);\n}\n\nexport default ScreenColorPalette;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,YAAY,MAAM,UAAU;AACnC,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAK,CAAC,GAAGD,MAAM,CAAEJ,qBAAsB,CAAC;AAEhD,SAASM,kBAAkBA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACvC,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACL,YAAY;IACZO,KAAK,EAAGZ,EAAE,CAAE,SAAU,CAAG;IACzBa,WAAW,EAAGb,EAAE,CACf,yIACD;EAAG,CACH,CAAC,EACFU,aAAA,CAACH,IAAI,QACJG,aAAA,CAACH,IAAI,CAACO,OAAO,QACZJ,aAAA,CAACH,IAAI,CAACQ,GAAG;IAACC,KAAK,EAAC;EAAO,GAAC,OAAe,CAAC,EACxCN,aAAA,CAACH,IAAI,CAACQ,GAAG;IAACC,KAAK,EAAC;EAAU,GAAC,UAAkB,CAChC,CAAC,EACfN,aAAA,CAACH,IAAI,CAACU,QAAQ;IAACD,KAAK,EAAC,OAAO;IAACE,SAAS,EAAG;EAAO,GAC/CR,aAAA,CAACP,iBAAiB;IAACM,IAAI,EAAGA;EAAM,CAAE,CACpB,CAAC,EAChBC,aAAA,CAACH,IAAI,CAACU,QAAQ;IAACD,KAAK,EAAC,UAAU;IAACE,SAAS,EAAG;EAAO,GAClDR,aAAA,CAACN,oBAAoB;IAACK,IAAI,EAAGA;EAAM,CAAE,CACvB,CACV,CACL,CAAC;AAEL;AAEA,eAAeD,kBAAkB"}
|
|
@@ -3,9 +3,8 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
6
|
+
import { __experimentalUseNavigator as useNavigator, __experimentalConfirmDialog as ConfirmDialog, Spinner } from '@wordpress/components';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
9
8
|
import { useContext, useState, useEffect } from '@wordpress/element';
|
|
10
9
|
import { privateApis as blockEditorPrivateApis, store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
10
|
|
|
@@ -15,14 +14,16 @@ import { privateApis as blockEditorPrivateApis, store as blockEditorStore } from
|
|
|
15
14
|
import ScreenHeader from '../header';
|
|
16
15
|
import { unlock } from '../../../lock-unlock';
|
|
17
16
|
import Revisions from '../../revisions';
|
|
18
|
-
import SidebarFixedBottom from '../../sidebar-edit-mode/sidebar-fixed-bottom';
|
|
19
17
|
import { store as editSiteStore } from '../../../store';
|
|
20
18
|
import useGlobalStylesRevisions from './use-global-styles-revisions';
|
|
21
19
|
import RevisionsButtons from './revisions-buttons';
|
|
20
|
+
import StyleBook from '../../style-book';
|
|
21
|
+
import Pagination from '../../pagination';
|
|
22
22
|
const {
|
|
23
23
|
GlobalStylesContext,
|
|
24
24
|
areGlobalStyleConfigsEqual
|
|
25
25
|
} = unlock(blockEditorPrivateApis);
|
|
26
|
+
const PAGE_SIZE = 10;
|
|
26
27
|
function ScreenRevisions() {
|
|
27
28
|
const {
|
|
28
29
|
goTo
|
|
@@ -33,35 +34,25 @@ function ScreenRevisions() {
|
|
|
33
34
|
} = useContext(GlobalStylesContext);
|
|
34
35
|
const {
|
|
35
36
|
blocks,
|
|
36
|
-
editorCanvasContainerView
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} = select(coreStore);
|
|
44
|
-
const isDirty = __experimentalGetDirtyEntityRecords().length > 0;
|
|
45
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
46
|
-
const globalStyles = globalStylesId ? getEntityRecord('root', 'globalStyles', globalStylesId) : undefined;
|
|
47
|
-
let _revisionsCount = globalStyles?._links?.['version-history']?.[0]?.count || 0;
|
|
48
|
-
// one for the reset item.
|
|
49
|
-
_revisionsCount++;
|
|
50
|
-
// one for any dirty changes (unsaved).
|
|
51
|
-
if (isDirty) {
|
|
52
|
-
_revisionsCount++;
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
editorCanvasContainerView: unlock(select(editSiteStore)).getEditorCanvasContainerView(),
|
|
56
|
-
blocks: select(blockEditorStore).getBlocks(),
|
|
57
|
-
revisionsCount: _revisionsCount
|
|
58
|
-
};
|
|
59
|
-
}, []);
|
|
37
|
+
editorCanvasContainerView
|
|
38
|
+
} = useSelect(select => ({
|
|
39
|
+
editorCanvasContainerView: unlock(select(editSiteStore)).getEditorCanvasContainerView(),
|
|
40
|
+
blocks: select(blockEditorStore).getBlocks()
|
|
41
|
+
}), []);
|
|
42
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
43
|
+
const [currentRevisions, setCurrentRevisions] = useState([]);
|
|
60
44
|
const {
|
|
61
45
|
revisions,
|
|
62
46
|
isLoading,
|
|
63
|
-
hasUnsavedChanges
|
|
64
|
-
|
|
47
|
+
hasUnsavedChanges,
|
|
48
|
+
revisionsCount
|
|
49
|
+
} = useGlobalStylesRevisions({
|
|
50
|
+
query: {
|
|
51
|
+
per_page: PAGE_SIZE,
|
|
52
|
+
page: currentPage
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const numPages = Math.ceil(revisionsCount / PAGE_SIZE);
|
|
65
56
|
const [currentlySelectedRevision, setCurrentlySelectedRevision] = useState(currentEditorGlobalStyles);
|
|
66
57
|
const [isLoadingRevisionWithUnsavedChanges, setIsLoadingRevisionWithUnsavedChanges] = useState(false);
|
|
67
58
|
const {
|
|
@@ -88,11 +79,16 @@ function ScreenRevisions() {
|
|
|
88
79
|
});
|
|
89
80
|
};
|
|
90
81
|
useEffect(() => {
|
|
91
|
-
if (editorCanvasContainerView
|
|
82
|
+
if (!editorCanvasContainerView || !editorCanvasContainerView.startsWith('global-styles-revisions')) {
|
|
92
83
|
goTo('/'); // Return to global styles main panel.
|
|
93
84
|
setEditorCanvasContainerView(editorCanvasContainerView);
|
|
94
85
|
}
|
|
95
86
|
}, [editorCanvasContainerView]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!isLoading && revisions.length) {
|
|
89
|
+
setCurrentRevisions(revisions);
|
|
90
|
+
}
|
|
91
|
+
}, [revisions, isLoading]);
|
|
96
92
|
const firstRevision = revisions[0];
|
|
97
93
|
const currentlySelectedRevisionId = currentlySelectedRevision?.id;
|
|
98
94
|
const shouldSelectFirstItem = !!firstRevision?.id && !selectedRevisionMatchesEditorStyles && !currentlySelectedRevisionId;
|
|
@@ -113,50 +109,50 @@ function ScreenRevisions() {
|
|
|
113
109
|
}
|
|
114
110
|
}, [shouldSelectFirstItem, firstRevision]);
|
|
115
111
|
|
|
116
|
-
// Only display load button if there is a revision to load
|
|
117
|
-
|
|
118
|
-
const
|
|
112
|
+
// Only display load button if there is a revision to load,
|
|
113
|
+
// and it is different from the current editor styles.
|
|
114
|
+
const isLoadButtonEnabled = !!currentlySelectedRevisionId && currentlySelectedRevisionId !== 'unsaved' && !selectedRevisionMatchesEditorStyles;
|
|
115
|
+
const hasRevisions = !!currentRevisions.length;
|
|
119
116
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
120
117
|
title: revisionsCount &&
|
|
121
118
|
// translators: %s: number of revisions.
|
|
122
119
|
sprintf(__('Revisions (%s)'), revisionsCount),
|
|
123
120
|
description: __('Click on previously saved styles to preview them. To restore a selected version to the editor, hit "Apply." When you\'re ready, use the Save button to save your changes.'),
|
|
124
121
|
onBack: onCloseRevisions
|
|
125
|
-
}),
|
|
122
|
+
}), !hasRevisions && createElement(Spinner, {
|
|
126
123
|
className: "edit-site-global-styles-screen-revisions__loading"
|
|
127
|
-
}),
|
|
124
|
+
}), hasRevisions && (editorCanvasContainerView === 'global-styles-revisions:style-book' ? createElement(StyleBook, {
|
|
125
|
+
userConfig: currentlySelectedRevision,
|
|
126
|
+
isSelected: () => {},
|
|
127
|
+
onClose: () => {
|
|
128
|
+
setEditorCanvasContainerView('global-styles-revisions');
|
|
129
|
+
}
|
|
130
|
+
}) : createElement(Revisions, {
|
|
128
131
|
blocks: blocks,
|
|
129
132
|
userConfig: currentlySelectedRevision,
|
|
130
|
-
|
|
131
|
-
}), createElement(
|
|
132
|
-
className: "edit-site-global-styles-screen-revisions"
|
|
133
|
-
}, createElement(RevisionsButtons, {
|
|
133
|
+
closeButtonLabel: __('Close revisions')
|
|
134
|
+
})), createElement(RevisionsButtons, {
|
|
134
135
|
onChange: selectRevision,
|
|
135
136
|
selectedRevisionId: currentlySelectedRevisionId,
|
|
136
|
-
userRevisions:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
userRevisions: currentRevisions,
|
|
138
|
+
canApplyRevision: isLoadButtonEnabled,
|
|
139
|
+
onApplyRevision: () => hasUnsavedChanges ? setIsLoadingRevisionWithUnsavedChanges(true) : restoreRevision(currentlySelectedRevision)
|
|
140
|
+
}), numPages > 1 && createElement("div", {
|
|
141
|
+
className: "edit-site-global-styles-screen-revisions__footer"
|
|
142
|
+
}, createElement(Pagination, {
|
|
143
|
+
className: "edit-site-global-styles-screen-revisions__pagination",
|
|
144
|
+
currentPage: currentPage,
|
|
145
|
+
numPages: numPages,
|
|
146
|
+
changePage: setCurrentPage,
|
|
147
|
+
totalItems: revisionsCount,
|
|
148
|
+
disabled: isLoading,
|
|
149
|
+
label: __('Global Styles pagination navigation')
|
|
150
|
+
})), isLoadingRevisionWithUnsavedChanges && createElement(ConfirmDialog, {
|
|
149
151
|
isOpen: isLoadingRevisionWithUnsavedChanges,
|
|
150
152
|
confirmButtonText: __('Apply'),
|
|
151
153
|
onConfirm: () => restoreRevision(currentlySelectedRevision),
|
|
152
154
|
onCancel: () => setIsLoadingRevisionWithUnsavedChanges(false)
|
|
153
|
-
}, __('Any unsaved changes will be lost when you apply this revision.')))
|
|
154
|
-
marginX: 4,
|
|
155
|
-
"data-testid": "global-styles-no-revisions"
|
|
156
|
-
},
|
|
157
|
-
// Adding an existing translation here in case these changes are shipped to WordPress 6.3.
|
|
158
|
-
// Later we could update to something better, e.g., "There are currently no style revisions.".
|
|
159
|
-
__('No results found.')));
|
|
155
|
+
}, __('Any unsaved changes will be lost when you apply this revision.')));
|
|
160
156
|
}
|
|
161
157
|
export default ScreenRevisions;
|
|
162
158
|
//# sourceMappingURL=index.js.map
|