@wordpress/edit-site 5.12.5 → 5.12.7
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/build/components/add-new-template/new-template.js +1 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +10 -5
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +8 -8
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -2
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +1 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page/index.js +3 -1
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-main/index.js +8 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/{page-library → page-patterns}/grid-item.js +52 -27
- package/build/components/page-patterns/grid-item.js.map +1 -0
- package/build/components/{page-library → page-patterns}/grid.js +1 -1
- package/build/components/page-patterns/grid.js.map +1 -0
- package/build/components/{page-library → page-patterns}/index.js +6 -6
- package/build/components/page-patterns/index.js.map +1 -0
- package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build/components/page-patterns/no-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/patterns-list.js +9 -9
- package/build/components/page-patterns/patterns-list.js.map +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -0
- package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build/components/{page-library → page-patterns}/use-patterns.js +4 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/utils.js +3 -3
- package/build/components/page-patterns/utils.js.map +1 -0
- package/build/components/page-template-parts/index.js +103 -0
- package/build/components/page-template-parts/index.js.map +1 -0
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/sidebar/index.js +6 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +63 -11
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +5 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +25 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js +177 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +52 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +1 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +22 -6
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +70 -0
- package/build/components/welcome-guide/page.js.map +1 -0
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +71 -0
- package/build/components/welcome-guide/template.js.map +1 -0
- package/build/hooks/commands/use-common-commands.js +17 -2
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +3 -3
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +2 -2
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +2 -2
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +10 -5
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +8 -8
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -2
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +1 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page/index.js +2 -1
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-main/index.js +6 -3
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/{page-library → page-patterns}/grid-item.js +56 -29
- package/build-module/components/page-patterns/grid-item.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
- package/build-module/components/page-patterns/grid.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build-module/components/page-patterns/no-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/patterns-list.js +9 -9
- package/build-module/components/page-patterns/patterns-list.js.map +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -0
- package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/use-patterns.js +4 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
- package/build-module/components/page-patterns/utils.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +82 -0
- package/build-module/components/page-template-parts/index.js.map +1 -0
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +5 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +62 -11
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +5 -4
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +15 -5
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -2
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +152 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +43 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +1 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +24 -7
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +59 -0
- package/build-module/components/welcome-guide/page.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +60 -0
- package/build-module/components/welcome-guide/template.js.map +1 -0
- package/build-module/hooks/commands/use-common-commands.js +16 -2
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +3 -3
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +2 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +2 -2
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +90 -32
- package/build-style/style.css +90 -32
- package/package.json +19 -19
- package/src/components/add-new-template/new-template.js +2 -2
- package/src/components/block-editor/editor-canvas.js +3 -1
- package/src/components/block-editor/use-site-editor-settings.js +8 -4
- package/src/components/create-pattern-modal/index.js +10 -11
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/header-edit-mode/document-actions/index.js +9 -1
- package/src/components/header-edit-mode/document-actions/style.scss +8 -0
- package/src/components/header-edit-mode/index.js +17 -9
- package/src/components/layout/index.js +1 -1
- package/src/components/layout/style.scss +0 -11
- package/src/components/page/header.js +1 -1
- package/src/components/page/index.js +5 -1
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-main/index.js +6 -3
- package/src/components/{page-library → page-patterns}/grid-item.js +79 -24
- package/src/components/{page-library → page-patterns}/grid.js +1 -1
- package/src/components/{page-library → page-patterns}/index.js +5 -5
- package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/src/components/{page-library → page-patterns}/patterns-list.js +9 -9
- package/src/components/{page-library → page-patterns}/style.scss +16 -12
- package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
- package/src/components/{page-library → page-patterns}/use-patterns.js +5 -2
- package/src/components/{page-library → page-patterns}/utils.js +3 -3
- package/src/components/page-template-parts/index.js +105 -0
- package/src/components/page-templates/index.js +1 -1
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
- package/src/components/sidebar-navigation-screen/style.scss +19 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +54 -26
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +36 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +2 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +10 -6
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +12 -4
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
- package/src/components/sidebar-navigation-screen-pattern/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +45 -3
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +199 -0
- package/src/components/sidebar-navigation-screen-patterns/style.scss +28 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +55 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
- package/src/components/site-hub/index.js +1 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/src/components/template-actions/index.js +38 -8
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/index.js +4 -0
- package/src/components/welcome-guide/page.js +75 -0
- package/src/components/welcome-guide/style.scss +15 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/components/welcome-guide/template.js +82 -0
- package/src/hooks/commands/use-common-commands.js +13 -1
- package/src/hooks/commands/use-edit-mode-commands.js +5 -2
- package/src/index.js +2 -0
- package/src/store/actions.js +8 -1
- package/src/store/private-actions.js +5 -1
- package/src/style.scss +2 -2
- package/src/utils/get-is-list-page.js +4 -3
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build/components/page-library/grid-item.js.map +0 -1
- package/build/components/page-library/grid.js.map +0 -1
- package/build/components/page-library/index.js.map +0 -1
- package/build/components/page-library/no-patterns.js.map +0 -1
- package/build/components/page-library/patterns-list.js.map +0 -1
- package/build/components/page-library/search-items.js.map +0 -1
- package/build/components/page-library/use-library-settings.js.map +0 -1
- package/build/components/page-library/use-patterns.js.map +0 -1
- package/build/components/page-library/utils.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/index.js +0 -112
- package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -41
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/page-library/grid-item.js.map +0 -1
- package/build-module/components/page-library/grid.js.map +0 -1
- package/build-module/components/page-library/index.js.map +0 -1
- package/build-module/components/page-library/no-patterns.js.map +0 -1
- package/build-module/components/page-library/patterns-list.js.map +0 -1
- package/build-module/components/page-library/search-items.js.map +0 -1
- package/build-module/components/page-library/use-library-settings.js.map +0 -1
- package/build-module/components/page-library/use-patterns.js.map +0 -1
- package/build-module/components/page-library/utils.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/index.js +0 -87
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -34
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/src/components/page-content-focus-manager/constants.js +0 -5
- package/src/components/sidebar-navigation-screen-library/index.js +0 -136
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -3
- package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -33
- /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","toggleFeature","editSiteStore","setCanvasMode","createNotice","noticesStore","hasGlobalStyleVariations","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","SidebarNavigationItem","isDismissible","type","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","SidebarNavigationScreenGlobalStylesFooter","onClickRevisions","revisions","isLoading","revisionsCount","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","hasRevisions","modified","backup","fill","SidebarNavigationScreenGlobalStyles","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isStyleBookOpened","getEditorCanvasContainerView","openGlobalStyles","Promise","all","openStyleBook","openRevisions","seen","edit"],"mappings":";;;;;;;;;;AAgBA;;AAbA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAiBA;AACA;AACA;AAUA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEO,SAASC,iCAAT,CAA4CC,KAA5C,EAAoD;AAC1D,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MAAwC,uBAAaC,YAAb,CAA9C;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,wBAAQ,uBAAaD,YAAb,CAAR,CAA1B;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAmB,uBAAaC,cAAb,CAAzB;AACA,QAAMC,wBAAwB,GAAG,qBAC9BC,MAAF,IACC,CAAC,CAAEA,MAAM,CACRC,eADQ,CAAN,CAEDC,mDAFC,IAEsDC,MAJ1B,EAKhC,EALgC,CAAjC;;AAOA,MAAKJ,wBAAL,EAAgC;AAC/B,WACC,4BAAC,yCAAD,OACMP,KADN;AAEC,MAAA,EAAE,EAAGY,8BAFN;AAGC,MAAA,IAAI,EAAC;AAHN,MADD;AAOA;;AACD,SACC,4BAAC,8BAAD,OACMZ,KADN;AAEC,IAAA,OAAO,EAAG,MAAM;AACf;AACAE,MAAAA,aAAa,CAAE,iBAAF,EAAqB,KAArB,CAAb;AACAG,MAAAA,YAAY,CACX,MADW,EAEX,cAAI,kCAAJ,CAFW,EAGX;AACCQ,QAAAA,aAAa,EAAE,IADhB;AAECC,QAAAA,IAAI,EAAE;AAFP,OAHW,CAAZ,CAHe,CAWf;;AACAV,MAAAA,aAAa,CAAE,MAAF,CAAb,CAZe,CAaf;;AACAH,MAAAA,kBAAkB,CAAE,yBA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AC,kBAAD;AACC,IAAA,cAAc,EAAG,KADlB;AAEC,IAAA,UAAU,EAAG,MAAM,KAFpB;AAGC,IAAA,OAAO,EAAGO,aAHX;AAIC,IAAA,QAAQ,EAAGA,aAJZ;AAKC,IAAA,eAAe,EAAG,KALnB;AAMC,IAAA,QAAQ,EAAG;AANZ,IArCF,CADD;AAiDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { backup, edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar, toggleFeature } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Disable distraction free mode.\n\t\t\t\ttoggleFeature( 'distractionFree', false );\n\t\t\t\tcreateNotice(\n\t\t\t\t\t'info',\n\t\t\t\t\t__( 'Distraction free mode turned off' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tisDismissible: true,\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {\n\tconst { revisions, isLoading } = useGlobalStylesRevisions();\n\tconst { revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\n\tconst hasRevisions = revisionsCount >= 2;\n\tconst modified = revisions?.[ 0 ]?.modified;\n\n\tif ( ! hasRevisions || isLoading || ! modified ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack className=\"edit-site-sidebar-navigation-screen-global-styles__footer\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-global-styles__revisions\"\n\t\t\t\tlabel={ __( 'Revisions' ) }\n\t\t\t\tonClick={ onClickRevisions }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tas=\"span\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-global-styles__revisions__label\">\n\t\t\t\t\t\t{ __( 'Last modified' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</span>\n\t\t\t\t\t<Icon icon={ backup } style={ { fill: 'currentcolor' } } />\n\t\t\t\t</HStack>\n\t\t\t</SidebarNavigationItem>\n\t\t</VStack>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tconst isStyleBookOpened = useSelect(\n\t\t( select ) =>\n\t\t\t'style-book' ===\n\t\t\tunlock( select( editSiteStore ) ).getEditorCanvasContainerView(),\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = useCallback(\n\t\tasync () =>\n\t\t\tPromise.all( [\n\t\t\t\tsetCanvasMode( 'edit' ),\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t\t] ),\n\t\t[ setCanvasMode, openGeneralSidebar ]\n\t);\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\t<SidebarNavigationScreenGlobalStylesFooter\n\t\t\t\t\t\tonClickRevisions={ openRevisions }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","editSiteStore","setCanvasMode","createNotice","noticesStore","set","setPreference","preferencesStore","get","getPrefference","turnOffDistractionFreeMode","isDistractionFree","name","isDismissible","type","hasGlobalStyleVariations","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","SidebarNavigationItem","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","SidebarNavigationScreenGlobalStylesFooter","onClickRevisions","revisions","isLoading","revisionsCount","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","hasRevisions","modified","backup","fill","SidebarNavigationScreenGlobalStyles","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","getCanvasMode","getEditorCanvasContainerView","openGlobalStyles","Promise","all","openStyleBook","openRevisions","seen","edit"],"mappings":";;;;;;;;;;AAgBA;;AAbA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAkBA;AACA;AACA;AAUA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEO,SAASC,iCAAT,CAA4CC,KAA5C,EAAoD;AAC1D,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,YAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,wBAAQ,uBAAaD,YAAb,CAAR,CAA1B;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAmB,uBAAaC,cAAb,CAAzB;AACA,QAAM;AAAEC,IAAAA,GAAG,EAAEC;AAAP,MAAyB,uBAAaC,kBAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA,GAAG,EAAEC;AAAP,MAA0B,qBAAWF,kBAAX,CAAhC;AAEA,QAAMG,0BAA0B,GAAG,0BAAa,MAAM;AACrD,UAAMC,iBAAiB,GAAGF,cAAc,CACvCR,aAAcW,IADyB,EAEvC,iBAFuC,CAAxC;;AAIA,QAAK,CAAED,iBAAP,EAA2B;AAC1B;AACA;;AACDL,IAAAA,aAAa,CAAEL,aAAcW,IAAhB,EAAsB,iBAAtB,EAAyC,KAAzC,CAAb;AACAT,IAAAA,YAAY,CAAE,MAAF,EAAU,cAAI,kCAAJ,CAAV,EAAoD;AAC/DU,MAAAA,aAAa,EAAE,IADgD;AAE/DC,MAAAA,IAAI,EAAE;AA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GACG,YADH,GAEGZ,SAHwB,CAJ9B;AAUC,MAAA,SAAS,EAAGY;AAVb,MAFF,EAeC,4BAAC,sBAAD;AACC,MAAA,IAAI,EAAGS,WADR;AAEC,MAAA,KAAK,EAAG,cAAI,aAAJ,CAFT;AAGC,MAAA,OAAO,EAAG,YAAY,MAAMN,gBAAgB;AAH7C,MAfD;AAZF,IADD,EAoCGH,iBAAiB,IAAI,CAAEH,gBAAvB,IAA2CE,UAA3C,IACD,4BAAC,kBAAD;AACC,IAAA,cAAc,EAAG,KADlB;AAEC,IAAA,UAAU,EAAG,MAAM,KAFpB;AAGC,IAAA,OAAO,EAAGO,aAHX;AAIC,IAAA,QAAQ,EAAGA,aAJZ;AAKC,IAAA,eAAe,EAAG,KALnB;AAMC,IAAA,QAAQ,EAAG;AANZ,IArCF,CADD;AAiDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { backup, edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { get: getPrefference } = useSelect( preferencesStore );\n\n\tconst turnOffDistractionFreeMode = useCallback( () => {\n\t\tconst isDistractionFree = getPrefference(\n\t\t\teditSiteStore.name,\n\t\t\t'distractionFree'\n\t\t);\n\t\tif ( ! isDistractionFree ) {\n\t\t\treturn;\n\t\t}\n\t\tsetPreference( editSiteStore.name, 'distractionFree', false );\n\t\tcreateNotice( 'info', __( 'Distraction free mode turned off' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}, [ createNotice, setPreference, getPrefference ] );\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\tturnOffDistractionFreeMode();\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {\n\tconst { revisions, isLoading } = useGlobalStylesRevisions();\n\tconst { revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\n\tconst hasRevisions = revisionsCount >= 2;\n\tconst modified = revisions?.[ 0 ]?.modified;\n\n\tif ( ! hasRevisions || isLoading || ! modified ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack className=\"edit-site-sidebar-navigation-screen-global-styles__footer\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-global-styles__revisions\"\n\t\t\t\tlabel={ __( 'Revisions' ) }\n\t\t\t\tonClick={ onClickRevisions }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tas=\"span\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-global-styles__revisions__label\">\n\t\t\t\t\t\t{ __( 'Last modified' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</span>\n\t\t\t\t\t<Icon icon={ backup } style={ { fill: 'currentcolor' } } />\n\t\t\t\t</HStack>\n\t\t\t</SidebarNavigationItem>\n\t\t</VStack>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { get: getPrefference } = useSelect( preferencesStore );\n\tconst { isViewMode, isStyleBookOpened } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\treturn {\n\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\tisStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),\n\t\t};\n\t}, [] );\n\n\tconst turnOffDistractionFreeMode = useCallback( () => {\n\t\tconst isDistractionFree = getPrefference(\n\t\t\teditSiteStore.name,\n\t\t\t'distractionFree'\n\t\t);\n\t\tif ( ! isDistractionFree ) {\n\t\t\treturn;\n\t\t}\n\t\tsetPreference( editSiteStore.name, 'distractionFree', false );\n\t\tcreateNotice( 'info', __( 'Distraction free mode turned off' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}, [ createNotice, setPreference, getPrefference ] );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\tturnOffDistractionFreeMode();\n\t\treturn Promise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, turnOffDistractionFreeMode ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\t<SidebarNavigationScreenGlobalStylesFooter\n\t\t\t\t\t\tonClickRevisions={ openRevisions }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -27,6 +27,8 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
27
27
|
|
|
28
28
|
var _store = require("../../store");
|
|
29
29
|
|
|
30
|
+
var _templatePartHint = _interopRequireDefault(require("./template-part-hint"));
|
|
31
|
+
|
|
30
32
|
/**
|
|
31
33
|
* WordPress dependencies
|
|
32
34
|
*/
|
|
@@ -51,7 +53,7 @@ function SidebarNavigationScreenMain() {
|
|
|
51
53
|
isRoot: true,
|
|
52
54
|
title: (0, _i18n.__)('Design'),
|
|
53
55
|
description: (0, _i18n.__)('Customize the appearance of your website using the block editor.'),
|
|
54
|
-
content: (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_components.__experimentalNavigatorButton, {
|
|
56
|
+
content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_components.__experimentalNavigatorButton, {
|
|
55
57
|
as: _sidebarNavigationItem.default,
|
|
56
58
|
path: "/navigation",
|
|
57
59
|
withChevron: true,
|
|
@@ -71,10 +73,10 @@ function SidebarNavigationScreenMain() {
|
|
|
71
73
|
icon: _icons.layout
|
|
72
74
|
}, (0, _i18n.__)('Templates')), (0, _element.createElement)(_components.__experimentalNavigatorButton, {
|
|
73
75
|
as: _sidebarNavigationItem.default,
|
|
74
|
-
path: "/
|
|
76
|
+
path: "/patterns",
|
|
75
77
|
withChevron: true,
|
|
76
78
|
icon: _icons.symbol
|
|
77
|
-
}, (0, _i18n.__)('
|
|
79
|
+
}, (0, _i18n.__)('Patterns'))), (0, _element.createElement)(_templatePartHint.default, null))
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
82
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","location","setEditorCanvasContainerView","editSiteStore","path","undefined","SidebarNavigationItem","navigation","styles","page","layout","symbol"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","location","setEditorCanvasContainerView","editSiteStore","path","undefined","SidebarNavigationItem","navigation","styles","page","layout","symbol"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAYA;AACA;AACA;AAQe,SAASA,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAe,6CAArB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAmC,wBACxC,uBAAaC,YAAb,CADwC,CAAzC,CAFqD,CAMrD;;AACA,0BAAW,MAAM;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roup,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport TemplatePartHint from './template-part-hint';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { location } = useNavigator();\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tif ( location?.path === '/' ) {\n\t\t\tsetEditorCanvasContainerView( undefined );\n\t\t}\n\t}, [ setEditorCanvasContainerView, location?.path ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Styles' ) }\n\t\t\t\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/page\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ page }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Pages' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/patterns\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t<TemplatePartHint />\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TemplatePartHint;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _preferences = require("@wordpress/preferences");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
const PREFERENCE_NAME = 'isTemplatePartMoveHintVisible';
|
|
22
|
+
|
|
23
|
+
function TemplatePartHint() {
|
|
24
|
+
const showTemplatePartHint = (0, _data.useSelect)(select => {
|
|
25
|
+
var _select$get;
|
|
26
|
+
|
|
27
|
+
return (_select$get = select(_preferences.store).get('core', PREFERENCE_NAME)) !== null && _select$get !== void 0 ? _select$get : true;
|
|
28
|
+
}, []);
|
|
29
|
+
const {
|
|
30
|
+
set: setPreference
|
|
31
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
32
|
+
|
|
33
|
+
if (!showTemplatePartHint) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (0, _element.createElement)(_components.Notice, {
|
|
38
|
+
politeness: "polite",
|
|
39
|
+
className: "edit-site-sidebar__notice",
|
|
40
|
+
onRemove: () => {
|
|
41
|
+
setPreference('core', PREFERENCE_NAME, false);
|
|
42
|
+
}
|
|
43
|
+
}, (0, _i18n.__)('Looking for template parts? You can now find them in the new "Patterns" page.'));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=template-part-hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/template-part-hint.js"],"names":["PREFERENCE_NAME","TemplatePartHint","showTemplatePartHint","select","preferencesStore","get","set","setPreference"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMA,MAAMA,eAAe,GAAG,+BAAxB;;AAEe,SAASC,gBAAT,GAA4B;AAC1C,QAAMC,oBAAoB,GAAG,qBAC1BC,MAAF;AAAA;;AAAA,0BACCA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CAAgC,MAAhC,EAAwCL,eAAxC,CADD,qDAC8D,IAD9D;AAAA,GAD4B,EAG5B,EAH4B,CAA7B;AAMA,QAAM;AAAEM,IAAAA,GAAG,EAAEC;AAAP,MAAyB,uBAAaH,kBAAb,CAA/B;;AACA,MAAK,CAAEF,oBAAP,EAA8B;AAC7B,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,kBAAD;AACC,IAAA,UAAU,EAAC,QADZ;AAEC,IAAA,SAAS,EAAC,2BAFX;AAGC,IAAA,QAAQ,EAAG,MAAM;AAChBK,MAAAA,aAAa,CAAE,MAAF,EAAUP,eAAV,EAA2B,KAA3B,CAAb;AACA;AALF,KAOG,cACD,+EADC,CAPH,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Notice } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nconst PREFERENCE_NAME = 'isTemplatePartMoveHintVisible';\n\nexport default function TemplatePartHint() {\n\tconst showTemplatePartHint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,\n\t\t[]\n\t);\n\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tif ( ! showTemplatePartHint ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Notice\n\t\t\tpoliteness=\"polite\"\n\t\t\tclassName=\"edit-site-sidebar__notice\"\n\t\t\tonRemove={ () => {\n\t\t\t\tsetPreference( 'core', PREFERENCE_NAME, false );\n\t\t\t} }\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'Looking for template parts? You can now find them in the new \"Patterns\" page.'\n\t\t\t) }\n\t\t</Notice>\n\t);\n}\n"]}
|
|
@@ -11,15 +11,11 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _i18n = require("@wordpress/i18n");
|
|
13
13
|
|
|
14
|
-
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
14
|
var _icons = require("@wordpress/icons");
|
|
17
15
|
|
|
18
|
-
var _store = require("../../store");
|
|
19
|
-
|
|
20
16
|
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _link = require("../routes/link");
|
|
23
19
|
|
|
24
20
|
/**
|
|
25
21
|
* WordPress dependencies
|
|
@@ -28,12 +24,15 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
28
24
|
/**
|
|
29
25
|
* Internal dependencies
|
|
30
26
|
*/
|
|
31
|
-
function EditButton(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
function EditButton({
|
|
28
|
+
postId
|
|
29
|
+
}) {
|
|
30
|
+
const linkInfo = (0, _link.useLink)({
|
|
31
|
+
postId,
|
|
32
|
+
postType: 'wp_navigation',
|
|
33
|
+
canvas: 'edit'
|
|
34
|
+
});
|
|
35
|
+
return (0, _element.createElement)(_sidebarButton.default, { ...linkInfo,
|
|
37
36
|
label: (0, _i18n.__)('Edit'),
|
|
38
37
|
icon: _icons.pencil
|
|
39
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js"],"names":["EditButton","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js"],"names":["EditButton","postId","linkInfo","postType","canvas","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,UAAT,CAAqB;AAAEC,EAAAA;AAAF,CAArB,EAAkC;AAChD,QAAMC,QAAQ,GAAG,mBAAS;AACzBD,IAAAA,MADyB;AAEzBE,IAAAA,QAAQ,EAAE,eAFe;AAGzBC,IAAAA,MAAM,EAAE;AAHiB,GAAT,CAAjB;AAKA,SACC,4BAAC,sBAAD,OAAoBF,QAApB;AAA+B,IAAA,KAAK,EAAG,cAAI,MAAJ,CAAvC;AAAsD,IAAA,IAAI,EAAGG;AAA7D,IADD;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport { useLink } from '../routes/link';\n\nexport default function EditButton( { postId } ) {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t\tcanvas: 'edit',\n\t} );\n\treturn (\n\t\t<SidebarButton { ...linkInfo } label={ __( 'Edit' ) } icon={ pencil } />\n\t);\n}\n"]}
|
|
@@ -54,13 +54,11 @@ function SidebarNavigationScreenNavigationMenu() {
|
|
|
54
54
|
} = (0, _data.useSelect)(select => {
|
|
55
55
|
const {
|
|
56
56
|
isSavingEntityRecord,
|
|
57
|
-
isDeletingEntityRecord
|
|
58
|
-
getEditedEntityRecord: getEditedEntityRecordSelector
|
|
57
|
+
isDeletingEntityRecord
|
|
59
58
|
} = select(_coreData.store);
|
|
60
59
|
return {
|
|
61
60
|
isSaving: isSavingEntityRecord('postType', postType, postId),
|
|
62
|
-
isDeleting: isDeletingEntityRecord('postType', postType, postId)
|
|
63
|
-
getEditedEntityRecord: getEditedEntityRecordSelector
|
|
61
|
+
isDeleting: isDeletingEntityRecord('postType', postType, postId)
|
|
64
62
|
};
|
|
65
63
|
}, [postId]);
|
|
66
64
|
const isLoading = isResolving || isSaving || isDeleting;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"names":["postType","SidebarNavigationScreenNavigationMenu","params","postId","record","navigationMenu","isResolving","isSaving","isDeleting","select","isSavingEntityRecord","isDeletingEntityRecord","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"names":["postType","SidebarNavigationScreenNavigationMenu","params","postId","record","navigationMenu","isResolving","isSaving","isDeleting","select","isSavingEntityRecord","isDeletingEntityRecord","coreStore","isLoading","menuTitle","title","rendered","slug","handleSave","handleDelete","handleDuplicate","_handleDelete","_handleSave","edits","_handleDuplicate","content","raw"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAUA;AACA;AACA;AAMO,MAAMA,QAAQ,GAAI,eAAlB;;;AAEQ,SAASC,qCAAT,GAAiD;AAC/D,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEF,6CAFJ;AAIA,QAAM;AAAEC,IAAAA,MAAM,EAAEC,cAAV;AAA0BC,IAAAA;AAA1B,MAA0C,+BAC/C,UAD+C,EAE/CN,QAF+C,EAG/CG,MAH+C,CAAhD;AAMA,QAAM;AAAEI,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA2B,qBAC9BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,oBAAF;AAAwBC,MAAAA;AAAxB,QACLF,MAAM,CAAEG,eAAF,CADP;AAGA,WAAO;AACNL,MAAAA,QAAQ,EAAEG,oBAAoB,CAAE,UAAF,EAAcV,QAAd,EAAwBG,MAAxB,CADxB;AAENK,MAAAA,UAAU,EAAEG,sBAAsB,CACjC,UADiC,EAEjCX,QAFiC,EAGjCG,MAHiC;AAF5B,KAAP;AAQA,GAb+B,EAchC,CAAEA,MAAF,CAdgC,CAAjC;AAiBA,QAAMU,SAAS,GAAGP,WAAW,IAAIC,QAAf,IAA2BC,UAA7C;AAEA,QAAMM,SAAS,GAAGT,cAAc,EAAEU,KAAhB,EAAuBC,QAAvB,IAAmCX,cAAc,EAAEY,IAArE;AAEA,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,YAAd;AAA4BC,IAAAA;AAA5B,MACL,yCADD;;AAGA,QAAMC,aAAa,GAAG,MAAMF,YAAY,CAAEd,cAAF,CAAxC;;AACA,QAAMiB,WAAW,GAAKC,KAAF,IAAaL,UAAU,CAAEb,cAAF,EAAkBkB,KAAlB,CAA3C;;AACA,QAAMC,gBAAgB,GAAG,MAAMJ,eAAe,CAAEf,cAAF,CAA9C;;AAEA,MAAKQ,SAAL,EAAiB;AAChB,WACC,4BAAC,sEAAD;AACC,MAAA,WAAW,EAAG,cACb,kGADa;AADf,OAKC,4BAAC,mBAAD;AAAS,MAAA,SAAS,EAAC;AAAnB,MALD,CADD;AASA;;AAED,MAAK,CAAEA,SAAF,IAAe,CAAER,cAAtB,EAAuC;AACtC,WACC,4BAAC,sEAAD;AACC,MAAA,WAAW,EAAG,cAAI,0BAAJ;AADf,MADD;AAKA;;AAED,MAAK,CAAEA,cAAc,EAAEoB,OAAhB,EAAyBC,GAAhC,EAAsC;AACrC,WACC,4BAAC,sEAAD;AACC,MAAA,OAAO,EACN,4BAAC,iBAAD;AACC,QAAA,SAAS,EAAG,kCAAgBZ,SAAhB,CADb;AAEC,QAAA,QAAQ,EAAGO,aAFZ;AAGC,QAAA,MAAM,EAAGC,WAHV;AAIC,QAAA,WAAW,EAAGE;AAJf,QAFF;AASC,MAAA,KAAK,EAAG,kCAAgBV,SAAhB,CATT;AAUC,MAAA,WAAW,EAAG,cAAI,gCAAJ;AAVf,MADD;AAcA;;AAED,SACC,4BAAC,6BAAD;AACC,IAAA,cAAc,EAAGT,cADlB;AAEC,IAAA,YAAY,EAAGgB,aAFhB;AAGC,IAAA,UAAU,EAAGC,WAHd;AAIC,IAAA,eAAe,EAAGE;AAJnB,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tSpinner,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport SingleNavigationMenu from './single-navigation-menu';\nimport useNavigationMenuHandlers from './use-navigation-menu-handlers';\n\nexport const postType = `wp_navigation`;\n\nexport default function SidebarNavigationScreenNavigationMenu() {\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\n\tconst { record: navigationMenu, isResolving } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\n\tconst { isSaving, isDeleting } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isDeletingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tisSaving: isSavingEntityRecord( 'postType', postType, postId ),\n\t\t\t\tisDeleting: isDeletingEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst isLoading = isResolving || isSaving || isDeleting;\n\n\tconst menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst _handleDelete = () => handleDelete( navigationMenu );\n\tconst _handleSave = ( edits ) => handleSave( navigationMenu, edits );\n\tconst _handleDuplicate = () => handleDuplicate( navigationMenu );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! navigationMenu ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'Navigation Menu missing.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! navigationMenu?.content?.raw ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tactions={\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ _handleDelete }\n\t\t\t\t\t\tonSave={ _handleSave }\n\t\t\t\t\t\tonDuplicate={ _handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ decodeEntities( menuTitle ) }\n\t\t\t\tdescription={ __( 'This Navigation Menu is empty.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SingleNavigationMenu\n\t\t\tnavigationMenu={ navigationMenu }\n\t\t\thandleDelete={ _handleDelete }\n\t\t\thandleSave={ _handleSave }\n\t\t\thandleDuplicate={ _handleDuplicate }\n\t\t/>\n\t);\n}\n"]}
|
package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js
CHANGED
|
@@ -19,6 +19,8 @@ var _moreMenu = _interopRequireDefault(require("./more-menu"));
|
|
|
19
19
|
|
|
20
20
|
var _navigationMenuEditor = _interopRequireDefault(require("./navigation-menu-editor"));
|
|
21
21
|
|
|
22
|
+
var _editButton = _interopRequireDefault(require("./edit-button"));
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* WordPress dependencies
|
|
24
26
|
*/
|
|
@@ -34,12 +36,14 @@ function SingleNavigationMenu({
|
|
|
34
36
|
}) {
|
|
35
37
|
const menuTitle = navigationMenu?.title?.rendered;
|
|
36
38
|
return (0, _element.createElement)(_sidebarNavigationScreenNavigationMenus.SidebarNavigationScreenWrapper, {
|
|
37
|
-
actions: (0, _element.createElement)(
|
|
39
|
+
actions: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_editButton.default, {
|
|
40
|
+
postId: navigationMenu?.id
|
|
41
|
+
}), (0, _element.createElement)(_moreMenu.default, {
|
|
38
42
|
menuTitle: (0, _htmlEntities.decodeEntities)(menuTitle),
|
|
39
43
|
onDelete: handleDelete,
|
|
40
44
|
onSave: handleSave,
|
|
41
45
|
onDuplicate: handleDuplicate
|
|
42
|
-
}),
|
|
46
|
+
})),
|
|
43
47
|
title: (0, _htmlEntities.decodeEntities)(menuTitle),
|
|
44
48
|
description: (0, _i18n.__)('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
|
|
45
49
|
}, (0, _element.createElement)(_navigationMenuEditor.default, {
|
package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"names":["SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","id"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"names":["SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","id"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMe,SAASA,oBAAT,CAA+B;AAC7CC,EAAAA,cAD6C;AAE7CC,EAAAA,YAF6C;AAG7CC,EAAAA,eAH6C;AAI7CC,EAAAA;AAJ6C,CAA/B,EAKX;AACH,QAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAhB,EAAuBC,QAAzC;AAEA,SACC,4BAAC,sEAAD;AACC,IAAA,OAAO,EACN,qDACC,4BAAC,mBAAD;AAAY,MAAA,MAAM,EAAGN,cAAc,EAAEO;AAArC,MADD,EAEC,4BAAC,iBAAD;AACC,MAAA,SAAS,EAAG,kCAAgBH,SAAhB,CADb;AAEC,MAAA,QAAQ,EAAGH,YAFZ;AAGC,MAAA,MAAM,EAAGE,UAHV;AAIC,MAAA,WAAW,EAAGD;AAJf,MAFD,CAFF;AAYC,IAAA,KAAK,EAAG,kCAAgBE,SAAhB,CAZT;AAaC,IAAA,WAAW,EAAG,cACb,kGADa;AAbf,KAiBC,4BAAC,6BAAD;AAAsB,IAAA,gBAAgB,EAAGJ,cAAc,EAAEO;AAAzD,IAjBD,CADD;AAqBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport EditButton from './edit-button';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<EditButton postId={ navigationMenu?.id } />\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\ttitle={ decodeEntities( menuTitle ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"]}
|
|
@@ -34,6 +34,8 @@ var _singleNavigationMenu = _interopRequireDefault(require("../sidebar-navigatio
|
|
|
34
34
|
|
|
35
35
|
var _useNavigationMenuHandlers = _interopRequireDefault(require("../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers"));
|
|
36
36
|
|
|
37
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
38
|
+
|
|
37
39
|
/**
|
|
38
40
|
* WordPress dependencies
|
|
39
41
|
*/
|
|
@@ -54,7 +56,10 @@ function buildMenuLabel(title, id, status) {
|
|
|
54
56
|
|
|
55
57
|
return (0, _i18n.sprintf)( // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
|
|
56
58
|
(0, _i18n.__)('%1$s (%2$s)'), (0, _htmlEntities.decodeEntities)(title?.rendered), status);
|
|
57
|
-
}
|
|
59
|
+
} // Save a boolean to prevent us creating a fallback more than once per session.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
let hasCreatedFallback = false;
|
|
58
63
|
|
|
59
64
|
function SidebarNavigationScreenNavigationMenus() {
|
|
60
65
|
const {
|
|
@@ -63,11 +68,18 @@ function SidebarNavigationScreenNavigationMenus() {
|
|
|
63
68
|
hasResolved: hasResolvedNavigationMenus
|
|
64
69
|
} = (0, _coreData.useEntityRecords)('postType', `wp_navigation`, _constants.PRELOADED_NAVIGATION_MENUS_QUERY);
|
|
65
70
|
const isLoading = isResolvingNavigationMenus && !hasResolvedNavigationMenus;
|
|
66
|
-
const
|
|
67
|
-
|
|
71
|
+
const {
|
|
72
|
+
getNavigationFallbackId
|
|
73
|
+
} = (0, _lockUnlock.unlock)((0, _data.useSelect)(_coreData.store));
|
|
74
|
+
const firstNavigationMenu = navigationMenus?.[0]; // Save a boolean to prevent us creating a fallback more than once per session.
|
|
75
|
+
|
|
76
|
+
if (firstNavigationMenu) {
|
|
77
|
+
hasCreatedFallback = true;
|
|
78
|
+
} // If there is no navigation menu found
|
|
68
79
|
// then trigger fallback algorithm to create one.
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
|
|
82
|
+
if (!firstNavigationMenu && !isResolvingNavigationMenus && hasResolvedNavigationMenus && !hasCreatedFallback) {
|
|
71
83
|
getNavigationFallbackId();
|
|
72
84
|
}
|
|
73
85
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["buildMenuLabel","title","id","status","rendered","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","PRELOADED_NAVIGATION_MENUS_QUERY","isLoading","getNavigationFallbackId","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["buildMenuLabel","title","id","status","rendered","hasCreatedFallback","SidebarNavigationScreenNavigationMenus","records","navigationMenus","isResolving","isResolvingNavigationMenus","hasResolved","hasResolvedNavigationMenus","PRELOADED_NAVIGATION_MENUS_QUERY","isLoading","getNavigationFallbackId","coreStore","firstNavigationMenu","handleSave","handleDelete","handleDuplicate","hasNavigationMenus","length","edits","map","index","navigation","SidebarNavigationScreenWrapper","children","actions","description","NavMenuItem","postId","props","linkInfo","postType"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AACA;;AAEA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAYA;AACA;AACA;AASA;AACA,SAASA,cAAT,CAAyBC,KAAzB,EAAgCC,EAAhC,EAAoCC,MAApC,EAA6C;AAC5C,MAAK,CAAEF,KAAK,EAAEG,QAAd,EAAyB;AACxB;AACA,WAAO,mBAAS,cAAI,eAAJ,CAAT,EAAgCF,EAAhC,CAAP;AACA;;AAED,MAAKC,MAAM,KAAK,SAAhB,EAA4B;AAC3B,WAAO,kCAAgBF,KAAK,EAAEG,QAAvB,CAAP;AACA;;AAED,SAAO,oBACN;AACA,gBAAI,aAAJ,CAFM,EAGN,kCAAgBH,KAAK,EAAEG,QAAvB,CAHM,EAIND,MAJM,CAAP;AAMA,C,CAED;;;AACA,IAAIE,kBAAkB,GAAG,KAAzB;;AAEe,SAASC,sCAAT,GAAkD;AAChE,QAAM;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,IACZL,UAAU,CAAED,mBAAF,EAAuBM,KAAvB;AALZ,MADD;AAUA;;AAED,SACC,4BAAC,8BAAD,QACC,4BAAC,mCAAD,QACGf,eAAe,EAAEgB,GAAjB,CAAsB,CAAE;AAAEtB,IAAAA,EAAF;AAAMD,IAAAA,KAAN;AAAaE,IAAAA;AAAb,GAAF,EAAyBsB,KAAzB,KACvB,4BAAC,WAAD;AACC,IAAA,MAAM,EAAGvB,EADV;AAEC,IAAA,GAAG,EAAGA,EAFP;AAGC,IAAA,WAAW,MAHZ;AAIC,IAAA,IAAI,EAAGwB;AAJR,KAMG1B,cAAc,CAAEC,KAAF,EAASwB,KAAK,GAAG,CAAjB,EAAoBtB,MAApB,CANjB,CADC,CADH,CADD,CADD;AAgBA;;AAEM,SAASwB,8BAAT,CAAyC;AAC/CC,EAAAA,QAD+C;AAE/CC,EAAAA,OAF+C;AAG/C5B,EAAAA,KAH+C;AAI/C6B,EAAAA;AAJ+C,CAAzC,EAKH;AACH,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAG7B,KAAK,IAAI,cAAI,YAAJ,CADlB;AAEC,IAAA,OAAO,EAAG4B,OAFX;AAGC,IAAA,WAAW,EAAGC,WAAW,IAAI,cAAI,+BAAJ,CAH9B;AAIC,IAAA,OAAO,EAAGF;AAJX,IADD;AAQA;;AAED,MAAMG,WAAW,GAAG,CAAE;AAAEC,EAAAA,MAAF;AAAU,KAAGC;AAAb,CAAF,KAA4B;AAC/C,QAAMC,QAAQ,GAAG,mBAAS;AACzBF,IAAAA,MADyB;AAEzBG,IAAAA,QAAQ,EAAE;AAFe,GAAT,CAAjB;AAIA,SAAO,4BAAC,8BAAD,OAA4BD,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tSpinner,\n} from '@wordpress/components';\nimport { navigation } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';\nimport { useLink } from '../routes/link';\nimport SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';\nimport useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';\nimport { unlock } from '../../lock-unlock';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nfunction buildMenuLabel( title, id, status ) {\n\tif ( ! title?.rendered ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title?.rendered );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title?.rendered ),\n\t\tstatus\n\t);\n}\n\n// Save a boolean to prevent us creating a fallback more than once per session.\nlet hasCreatedFallback = false;\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst {\n\t\trecords: navigationMenus,\n\t\tisResolving: isResolvingNavigationMenus,\n\t\thasResolved: hasResolvedNavigationMenus,\n\t} = useEntityRecords(\n\t\t'postType',\n\t\t`wp_navigation`,\n\t\tPRELOADED_NAVIGATION_MENUS_QUERY\n\t);\n\n\tconst isLoading =\n\t\tisResolvingNavigationMenus && ! hasResolvedNavigationMenus;\n\n\tconst { getNavigationFallbackId } = unlock( useSelect( coreStore ) );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ];\n\n\t// Save a boolean to prevent us creating a fallback more than once per session.\n\tif ( firstNavigationMenu ) {\n\t\thasCreatedFallback = true;\n\t}\n\n\t// If there is no navigation menu found\n\t// then trigger fallback algorithm to create one.\n\tif (\n\t\t! firstNavigationMenu &&\n\t\t! isResolvingNavigationMenus &&\n\t\thasResolvedNavigationMenus &&\n\t\t! hasCreatedFallback\n\t) {\n\t\tgetNavigationFallbackId();\n\t}\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'No Navigation Menus found.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\t// if single menu then render it\n\tif ( navigationMenus?.length === 1 ) {\n\t\treturn (\n\t\t\t<SingleNavigationMenu\n\t\t\t\tnavigationMenu={ firstNavigationMenu }\n\t\t\t\thandleDelete={ () => handleDelete( firstNavigationMenu ) }\n\t\t\t\thandleDuplicate={ () => handleDuplicate( firstNavigationMenu ) }\n\t\t\t\thandleSave={ ( edits ) =>\n\t\t\t\t\thandleSave( firstNavigationMenu, edits )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper>\n\t\t\t<ItemGroup>\n\t\t\t\t{ navigationMenus?.map( ( { id, title, status }, index ) => (\n\t\t\t\t\t<NavMenuItem\n\t\t\t\t\t\tpostId={ id }\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ buildMenuLabel( title, index + 1, status ) }\n\t\t\t\t\t</NavMenuItem>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n\nexport function SidebarNavigationScreenWrapper( {\n\tchildren,\n\tactions,\n\ttitle,\n\tdescription,\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title || __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ description || __( 'Manage your Navigation menus.' ) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nconst NavMenuItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["publishedIcon","draftIcon","pendingIcon","StatusLabel","status","date","short","relateToNow","statusLabel","statusIcon","time","formattedDate"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMA,MAAMA,aAAa,GAClB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,4BAAC,gBAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,SAAS,GACd,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,4BAAC,gBAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,WAAW,GAChB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,4BAAC,gBAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;;AAUe,SAASC,WAAT,CAAsB;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,IAAV;AAAgBC,EAAAA;AAAhB,CAAtB,EAAgD;AAC9D,QAAMC,WAAW,GAAG,yBAAeF,IAAf,CAApB;AACA,MAAIG,WAAW,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/status-label.js"],"names":["publishedIcon","draftIcon","pendingIcon","StatusLabel","status","date","short","relateToNow","statusLabel","statusIcon","time","formattedDate"],"mappings":";;;;;;;;;AAUA;;AAPA;;AAKA;;AACA;;AAEA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;AAMA,MAAMA,aAAa,GAClB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,4BAAC,gBAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,SAAS,GACd,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC;AAA5D,GACC,4BAAC,gBAAD;AACC,EAAA,QAAQ,EAAC,SADV;AAEC,EAAA,QAAQ,EAAC,SAFV;AAGC,EAAA,CAAC,EAAC;AAHH,EADD,CADD;AAUA,MAAMC,WAAW,GAChB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC,4BAAvB;AAAoD,EAAA,OAAO,EAAC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ACA;AA1CF;;AA6CA,SACC;AACC,IAAA,SAAS,EAAG,yBACX,kDADW,EAEX;AACC,OAAG,kBAAkBJ,MAAQ,SAA7B,GAAyC,CAAC,CAAEA;AAD7C,KAFW;AADb,KAQGK,UARH,OAQkBD,WARlB,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, getDate, humanTimeDiff } from '@wordpress/date';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { Path, SVG } from '@wordpress/primitives';\n\nconst publishedIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm-1.067-5.6 4.2-5.667.8.6-4.8 6.467-3-2.267.6-.8 2.2 1.667Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst draftIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-8 4a4 4 0 0 0 0-8v8Z\"\n\t\t/>\n\t</SVG>\n);\n\nconst pendingIcon = (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n\t\t<Path\n\t\t\tfillRule=\"evenodd\"\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M14.5 8a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0ZM16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z\"\n\t\t/>\n\t</SVG>\n);\n\nexport default function StatusLabel( { status, date, short } ) {\n\tconst relateToNow = humanTimeDiff( date );\n\tlet statusLabel = status;\n\tlet statusIcon = pendingIcon;\n\tswitch ( status ) {\n\t\tcase 'publish':\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the relative time when the post was published. */\n\t\t\t\t\t\t\t__( 'Published <time>%s</time>' ),\n\t\t\t\t\t\t\trelateToNow\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Published' );\n\t\t\tstatusIcon = publishedIcon;\n\t\t\tbreak;\n\t\tcase 'future':\n\t\t\tconst formattedDate = dateI18n(\n\t\t\t\tshort ? 'M j' : 'F j',\n\t\t\t\tgetDate( date )\n\t\t\t);\n\t\t\tstatusLabel = date\n\t\t\t\t? createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %s: is the formatted date and time on which the post is scheduled to be published. */\n\t\t\t\t\t\t\t__( 'Scheduled: <time>%s</time>' ),\n\t\t\t\t\t\t\tformattedDate\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ time: <time dateTime={ date } /> }\n\t\t\t\t )\n\t\t\t\t: __( 'Scheduled' );\n\t\t\tbreak;\n\t\tcase 'draft':\n\t\t\tstatusLabel = __( 'Draft' );\n\t\t\tstatusIcon = draftIcon;\n\t\t\tbreak;\n\t\tcase 'pending':\n\t\t\tstatusLabel = __( 'Pending' );\n\t\t\tbreak;\n\t\tcase 'private':\n\t\t\tstatusLabel = __( 'Private' );\n\t\t\tbreak;\n\t\tcase 'protected':\n\t\t\tstatusLabel = __( 'Password protected' );\n\t\t\tbreak;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-sidebar-navigation-screen-page__status',\n\t\t\t\t{\n\t\t\t\t\t[ `has-status has-${ status }-status` ]: !! status,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t{ statusIcon } { statusLabel }\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["useHistory","routerPrivateApis","PageItem","postType","postId","props","linkInfo","SidebarNavigationScreenPages","records","pages","isResolving","isLoadingPages","status","per_page","templates","isLoadingTemplates","dynamicPageTemplates","filter","slug","includes","homeTemplate","find","template","pagesAndTemplates","concat","frontPage","postsPage","select","getEntityRecord","coreStore","siteSettings","page_on_front","page_for_posts","isHomePageBlog","reorderedPages","length","homePageIndex","findIndex","item","id","homePage","splice","postsPageIndex","blogPage","showAddPage","setShowAddPage","history","handleNewPage","type","push","canvas","plus","home","title","rendered","map","itemIcon","loop","page","layout","document","location"],"mappings":";;;;;;;;;AASA;;AANA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAeA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,wBAAQC,mBAAR,CAAvB;;AAEA,MAAMC,QAAQ,GAAG,CAAE;AAAEC,EAAAA,QAAQ,GAAG,MAAb;AAAqBC,EAAAA,MAArB;AAA6B,KAAGC;AAAhC,CAAF,KAA+C;AAC/D,QAAMC,QAAQ,GAAG,mBAAS;AACzBH,IAAAA,QADyB;AAEzBC,IAAAA;AAFyB,GAAT,CAAjB;AAIA,SAAO,4BAAC,8BAAD,OAA4BE,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND;;AAQe,SAASE,4BAAT,GAAwC;AACtD,QAAM;AAAEC,IAAAA,OAAO,EAAEC,KAAX;AAAkBC,IAAAA,WAAW,EAAEC;AAA/B,MAAkD,gCACvD,UADuD,EAEvD,MAFuD,EAGvD;AAC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C,EAFZ;AAGC,QAAA,IAAI,EAAGiB,QAHR;AAIC,QAAA,WAAW;AAJZ,SAMC,4BAAC,kCAAD;AAAU,QAAA,aAAa,EAAG;AAA1B,SACG,kCACDlB,IAAI,EAAEe,KAAN,EAAaC,QAAb,IACC,cAAI,YAAJ,CAFA,CADH,CAND,CADD;AAeA,KA3BC,CApBH,CAPF,CAXF;AAsEC,IAAA,MAAM,EACL,4BAAC,gCAAD;AAAQ,MAAA,OAAO,EAAG;AAAlB,OACGtC,oBAAoB,EAAEuC,GAAtB,CAA6BjB,IAAF,IAC5B,4BAAC,QAAD;AACC,MAAA,QAAQ,EAAC,aADV;AAEC,MAAA,MAAM,EAAGA,IAAI,CAACC,EAFf;AAGC,MAAA,GAAG,EAAGD,IAAI,CAACC,EAHZ;AAIC,MAAA,IAAI,EAAGoB,aAJR;AAKC,MAAA,WAAW;AALZ,OAOC,4BAAC,kCAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACG,kCACDrB,IAAI,CAACe,KAAL,EAAYC,QAAZ,IACC,cAAI,YAAJ,CAFA,CADH,CAPD,CADC,CADH,EAiBC,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAC,oDADX;AAEC,MAAA,IAAI,EAAC,yBAFN;AAGC,MAAA,OAAO,EAAG,MAAM;AACfM,QAAAA,QAAQ,CAACC,QAAT,GAAoB,yBAApB;AACA;AALF,OAOG,cAAI,kBAAJ,CAPH,CAjBD;AAvEF,IAPD,CADD;AA8GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { layout, page, home, loop, plus } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarButton from '../sidebar-button';\nimport AddNewPageModal from '../add-new-page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPages() {\n\tconst { records: pages, isResolving: isLoadingPages } = useEntityRecords(\n\t\t'postType',\n\t\t'page',\n\t\t{\n\t\t\tstatus: 'any',\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst { records: templates, isResolving: isLoadingTemplates } =\n\t\tuseEntityRecords( 'postType', 'wp_template', {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst dynamicPageTemplates = templates?.filter( ( { slug } ) =>\n\t\t[ '404', 'search' ].includes( slug )\n\t);\n\n\tconst homeTemplate =\n\t\ttemplates?.find( ( template ) => template.slug === 'front-page' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst pagesAndTemplates = pages?.concat( dynamicPageTemplates, [\n\t\thomeTemplate,\n\t] );\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst isHomePageBlog = frontPage === postsPage;\n\n\tconst reorderedPages = pages && [ ...pages ];\n\n\tif ( ! isHomePageBlog && reorderedPages?.length ) {\n\t\tconst homePageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === frontPage\n\t\t);\n\t\tconst homePage = reorderedPages.splice( homePageIndex, 1 );\n\t\treorderedPages?.splice( 0, 0, ...homePage );\n\n\t\tconst postsPageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === postsPage\n\t\t);\n\n\t\tconst blogPage = reorderedPages.splice( postsPageIndex, 1 );\n\n\t\treorderedPages.splice( 1, 0, ...blogPage );\n\t}\n\n\tconst [ showAddPage, setShowAddPage ] = useState( false );\n\n\tconst history = useHistory();\n\n\tconst handleNewPage = ( { type, id } ) => {\n\t\t// Navigate to the created template editor.\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tsetShowAddPage( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ showAddPage && (\n\t\t\t\t<AddNewPageModal\n\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\tonClose={ () => setShowAddPage( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\tdescription={ __( 'Browse and edit pages on your site.' ) }\n\t\t\t\tactions={\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ __( 'Draft a new page' ) }\n\t\t\t\t\t\tonClick={ () => setShowAddPage( true ) }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<Item>{ __( 'Loading pages' ) }</Item>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ ! pagesAndTemplates?.length && (\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No page found' ) }</Item>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isHomePageBlog && homeTemplate && (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\tpostId={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\tkey={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\ticon={ home }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ reorderedPages?.map( ( item ) => {\n\t\t\t\t\t\t\t\t\tlet itemIcon;\n\t\t\t\t\t\t\t\t\tswitch ( item.id ) {\n\t\t\t\t\t\t\t\t\t\tcase frontPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = home;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase postsPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = loop;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = page;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\t\titem?.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\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</Truncate>\n\t\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t{ dynamicPageTemplates?.map( ( item ) => (\n\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-pages__see-all\"\n\t\t\t\t\t\t\thref=\"edit.php?post_type=page\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tdocument.location = 'edit.php?post_type=page';\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage all pages' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t</VStack>\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["useHistory","routerPrivateApis","PageItem","postType","postId","props","linkInfo","SidebarNavigationScreenPages","records","pages","isResolving","isLoadingPages","status","per_page","templates","isLoadingTemplates","dynamicPageTemplates","filter","slug","includes","homeTemplate","find","template","pagesAndTemplates","concat","frontPage","postsPage","select","getEntityRecord","coreStore","siteSettings","page_on_front","page_for_posts","isHomePageBlog","reorderedPages","length","homePageIndex","findIndex","item","id","homePage","splice","postsPageIndex","blogPage","showAddPage","setShowAddPage","history","handleNewPage","type","push","canvas","plus","home","title","rendered","map","itemIcon","verse","page","layout","document","location"],"mappings":";;;;;;;;;AASA;;AANA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAeA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAiB,wBAAQC,mBAAR,CAAvB;;AAEA,MAAMC,QAAQ,GAAG,CAAE;AAAEC,EAAAA,QAAQ,GAAG,MAAb;AAAqBC,EAAAA,MAArB;AAA6B,KAAGC;AAAhC,CAAF,KAA+C;AAC/D,QAAMC,QAAQ,GAAG,mBAAS;AACzBH,IAAAA,QADyB;AAEzBC,IAAAA;AAFyB,GAAT,CAAjB;AAIA,SAAO,4BAAC,8BAAD,OAA4BE,QAA5B;AAAA,OAA4CD;AAA5C,IAAP;AACA,CAND;;AAQe,SAASE,4BAAT,GAAwC;AACtD,QAAM;AAAEC,IAAAA,OAAO,EAAEC,KAAX;AAAkBC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,QAAA,MAAM,EAAGpB,IAAI,CAACC,EADf;AAEC,QAAA,GAAG,EAAGD,IAAI,CAACC,EAFZ;AAGC,QAAA,IAAI,EAAGiB,QAHR;AAIC,QAAA,WAAW;AAJZ,SAMC,4BAAC,kCAAD;AAAU,QAAA,aAAa,EAAG;AAA1B,SACG,kCACDlB,IAAI,EAAEe,KAAN,EAAaC,QAAb,IACC,cAAI,YAAJ,CAFA,CADH,CAND,CADD;AAeA,KA3BC,CApBH,CAPF,CAXF;AAsEC,IAAA,MAAM,EACL,4BAAC,gCAAD;AAAQ,MAAA,OAAO,EAAG;AAAlB,OACGtC,oBAAoB,EAAEuC,GAAtB,CAA6BjB,IAAF,IAC5B,4BAAC,QAAD;AACC,MAAA,QAAQ,EAAC,aADV;AAEC,MAAA,MAAM,EAAGA,IAAI,CAACC,EAFf;AAGC,MAAA,GAAG,EAAGD,IAAI,CAACC,EAHZ;AAIC,MAAA,IAAI,EAAGoB,aAJR;AAKC,MAAA,WAAW;AALZ,OAOC,4BAAC,kCAAD;AAAU,MAAA,aAAa,EAAG;AAA1B,OACG,kCACDrB,IAAI,CAACe,KAAL,EAAYC,QAAZ,IACC,cAAI,YAAJ,CAFA,CADH,CAPD,CADC,CADH,EAiBC,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAC,oDADX;AAEC,MAAA,IAAI,EAAC,yBAFN;AAGC,MAAA,OAAO,EAAG,MAAM;AACfM,QAAAA,QAAQ,CAACC,QAAT,GAAoB,yBAApB;AACA;AALF,OAOG,cAAI,kBAAJ,CAPH,CAjBD;AAvEF,IAPD,CADD;AA8GA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalTruncate as Truncate,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { layout, page, home, verse, plus } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarButton from '../sidebar-button';\nimport AddNewPageModal from '../add-new-page';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst PageItem = ( { postType = 'page', postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPages() {\n\tconst { records: pages, isResolving: isLoadingPages } = useEntityRecords(\n\t\t'postType',\n\t\t'page',\n\t\t{\n\t\t\tstatus: 'any',\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst { records: templates, isResolving: isLoadingTemplates } =\n\t\tuseEntityRecords( 'postType', 'wp_template', {\n\t\t\tper_page: -1,\n\t\t} );\n\n\tconst dynamicPageTemplates = templates?.filter( ( { slug } ) =>\n\t\t[ '404', 'search' ].includes( slug )\n\t);\n\n\tconst homeTemplate =\n\t\ttemplates?.find( ( template ) => template.slug === 'front-page' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'home' ) ||\n\t\ttemplates?.find( ( template ) => template.slug === 'index' );\n\n\tconst pagesAndTemplates = pages?.concat( dynamicPageTemplates, [\n\t\thomeTemplate,\n\t] );\n\n\tconst { frontPage, postsPage } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\treturn {\n\t\t\tfrontPage: siteSettings?.page_on_front,\n\t\t\tpostsPage: siteSettings?.page_for_posts,\n\t\t};\n\t}, [] );\n\n\tconst isHomePageBlog = frontPage === postsPage;\n\n\tconst reorderedPages = pages && [ ...pages ];\n\n\tif ( ! isHomePageBlog && reorderedPages?.length ) {\n\t\tconst homePageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === frontPage\n\t\t);\n\t\tconst homePage = reorderedPages.splice( homePageIndex, 1 );\n\t\treorderedPages?.splice( 0, 0, ...homePage );\n\n\t\tconst postsPageIndex = reorderedPages.findIndex(\n\t\t\t( item ) => item.id === postsPage\n\t\t);\n\n\t\tconst blogPage = reorderedPages.splice( postsPageIndex, 1 );\n\n\t\treorderedPages.splice( 1, 0, ...blogPage );\n\t}\n\n\tconst [ showAddPage, setShowAddPage ] = useState( false );\n\n\tconst history = useHistory();\n\n\tconst handleNewPage = ( { type, id } ) => {\n\t\t// Navigate to the created template editor.\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tsetShowAddPage( false );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t{ showAddPage && (\n\t\t\t\t<AddNewPageModal\n\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\tonClose={ () => setShowAddPage( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Pages' ) }\n\t\t\t\tdescription={ __( 'Browse and edit pages on your site.' ) }\n\t\t\t\tactions={\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ __( 'Draft a new page' ) }\n\t\t\t\t\t\tonClick={ () => setShowAddPage( true ) }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<Item>{ __( 'Loading pages' ) }</Item>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! ( isLoadingPages || isLoadingTemplates ) && (\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ ! pagesAndTemplates?.length && (\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No page found' ) }</Item>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isHomePageBlog && homeTemplate && (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\t\t\tpostId={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\tkey={ homeTemplate.id }\n\t\t\t\t\t\t\t\t\t\ticon={ home }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\thomeTemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ reorderedPages?.map( ( item ) => {\n\t\t\t\t\t\t\t\t\tlet itemIcon;\n\t\t\t\t\t\t\t\t\tswitch ( item.id ) {\n\t\t\t\t\t\t\t\t\t\tcase frontPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = home;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase postsPage:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = verse;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\titemIcon = page;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\t\t\t\ticon={ itemIcon }\n\t\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\t\t\titem?.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\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</Truncate>\n\t\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t\t\t{ dynamicPageTemplates?.map( ( item ) => (\n\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\tpostType=\"wp_template\"\n\t\t\t\t\t\t\t\tpostId={ item.id }\n\t\t\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\titem.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\t__( '(no title)' )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-pages__see-all\"\n\t\t\t\t\t\t\thref=\"edit.php?post_type=page\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tdocument.location = 'edit.php?post_type=page';\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage all pages' ) }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t</VStack>\n\t\t\t\t}\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -9,13 +9,15 @@ exports.default = SidebarNavigationScreenPattern;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
13
|
|
|
14
14
|
var _data = require("@wordpress/data");
|
|
15
15
|
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
16
18
|
var _icons = require("@wordpress/icons");
|
|
17
19
|
|
|
18
|
-
var
|
|
20
|
+
var _url = require("@wordpress/url");
|
|
19
21
|
|
|
20
22
|
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
21
23
|
|
|
@@ -25,8 +27,6 @@ var _useInitEditedEntityFromUrl = _interopRequireDefault(require("../sync-state-
|
|
|
25
27
|
|
|
26
28
|
var _usePatternDetails = _interopRequireDefault(require("./use-pattern-details"));
|
|
27
29
|
|
|
28
|
-
var _useNavigationMenuContent = _interopRequireDefault(require("./use-navigation-menu-content"));
|
|
29
|
-
|
|
30
30
|
var _store = require("../../store");
|
|
31
31
|
|
|
32
32
|
var _lockUnlock = require("../../lock-unlock");
|
|
@@ -42,6 +42,9 @@ function SidebarNavigationScreenPattern() {
|
|
|
42
42
|
const {
|
|
43
43
|
params
|
|
44
44
|
} = (0, _components.__experimentalUseNavigator)();
|
|
45
|
+
const {
|
|
46
|
+
categoryType
|
|
47
|
+
} = (0, _url.getQueryArgs)(window.location.href);
|
|
45
48
|
const {
|
|
46
49
|
postType,
|
|
47
50
|
postId
|
|
@@ -50,16 +53,18 @@ function SidebarNavigationScreenPattern() {
|
|
|
50
53
|
setCanvasMode
|
|
51
54
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
52
55
|
(0, _useInitEditedEntityFromUrl.default)();
|
|
53
|
-
const patternDetails = (0, _usePatternDetails.default)(postType, postId);
|
|
54
|
-
|
|
56
|
+
const patternDetails = (0, _usePatternDetails.default)(postType, postId); // The absence of a category type in the query params for template parts
|
|
57
|
+
// indicates the user has arrived at the template part via the "manage all"
|
|
58
|
+
// page and the back button should return them to that list page.
|
|
59
|
+
|
|
60
|
+
const backPath = !categoryType && postType === 'wp_template_part' ? '/wp_template_part/all' : '/patterns';
|
|
55
61
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
56
62
|
actions: (0, _element.createElement)(_sidebarButton.default, {
|
|
57
63
|
onClick: () => setCanvasMode('edit'),
|
|
58
64
|
label: (0, _i18n.__)('Edit'),
|
|
59
65
|
icon: _icons.pencil
|
|
60
66
|
}),
|
|
61
|
-
backPath:
|
|
62
|
-
content: content,
|
|
67
|
+
backPath: backPath,
|
|
63
68
|
...patternDetails
|
|
64
69
|
});
|
|
65
70
|
}
|