@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/search-items.js"],"names":["removeAccents","noCase","defaultGetName","item","name","defaultGetTitle","title","defaultGetDescription","description","defaultGetKeywords","keywords","defaultHasCategory","extractWords","input","splitRegexp","stripRegexp","split","filter","Boolean","normalizeSearchInput","replace","toLowerCase","getNormalizedSearchTerms","removeMatchingTerms","unmatchedTerms","unprocessedTerms","term","some","unprocessedTerm","includes","searchItems","items","searchInput","config","normalizedSearchTerms","onlyFilterByCategory","length","searchRankConfig","threshold","rankedItems","map","getItemSearchRank","rank","sort","rank1","rank2","searchTerm","categoryId","getName","getTitle","getDescription","getKeywords","hasCategory","normalizedSearchInput","normalizedTitle","startsWith","terms","join"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AACA,SAASC,MAAT,QAAuB,aAAvB,C,CAEA;;AACA,MAAMC,cAAc,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,IAAa,EAAhD;;AACA,MAAMC,eAAe,GAAKF,IAAF,IAAYA,IAAI,CAACG,KAAzC;;AACA,MAAMC,qBAAqB,GAAKJ,IAAF,IAAYA,IAAI,CAACK,WAAL,IAAoB,EAA9D;;AACA,MAAMC,kBAAkB,GAAKN,IAAF,IAAYA,IAAI,CAACO,QAAL,IAAiB,EAAxD;;AACA,MAAMC,kBAAkB,GAAG,MAAM,KAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,YAAT,CAAuBC,KAAK,GAAG,EAA/B,EAAoC;AACnC,SAAOZ,MAAM,CAAEY,KAAF,EAAS;AACrBC,IAAAA,WAAW,EAAE,CACZ,yCADY,EAC+B;AAC3C,sDAFY,CAEwC;AAFxC,KADQ;AAKrBC,IAAAA,WAAW,EAAE,yBALQ,CAKmB;;AALnB,GAAT,CAAN,CAOLC,KAPK,CAOE,GAPF,EAQLC,MARK,CAQGC,OARH,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BN,KAAK,GAAG,EAAvC,EAA4C;AAC3C;AACA;AACAA,EAAAA,KAAK,GAAGb,aAAa,CAAEa,KAAF,CAArB,CAH2C,CAK3C;AACA;;AACAA,EAAAA,KAAK,GAAGA,KAAK,CAACO,OAAN,CAAe,KAAf,EAAsB,EAAtB,CAAR,CAP2C,CAS3C;AACA;;AACAP,EAAAA,KAAK,GAAGA,KAAK,CAACQ,WAAN,EAAR;AAEA,SAAOR,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMS,wBAAwB,GAAG,CAAET,KAAK,GAAG,EAAV,KAAkB;A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AA5B,CAAL,EAA2D;AACjEX,IAAAA,IAAI,IAAI,EAAR;AACA,GAFM,MAEA;AACN,UAAMc,KAAK,GAAG,CAAEpD,IAAF,EAAQE,KAAR,EAAeE,WAAf,EAA4B,GAAGE,QAA/B,EAA0C+C,IAA1C,CAAgD,GAAhD,CAAd;AACA,UAAMvB,qBAAqB,GAAGtB,YAAY,CAAEyC,qBAAF,CAA1C;AACA,UAAM7B,cAAc,GAAGD,mBAAmB,CACzCW,qBADyC,EAEzCsB,KAFyC,CAA1C;;AAKA,QAAKhC,cAAc,CAACY,MAAf,KAA0B,CAA/B,EAAmC;AAClCM,MAAAA,IAAI,IAAI,EAAR;AACA;AACD;;AAED,SAAOA,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { noCase } from 'change-case';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultHasCategory = () => false;\n\n/**\n * Extracts words from an input string.\n *\n * @param {string} input The input string.\n *\n * @return {Array} Words, extracted from the input string.\n */\nfunction extractWords( input = '' ) {\n\treturn noCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/([\\p{Ll}\\p{Lo}\\p{N}])([\\p{Lu}\\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.\n\t\t\t/([\\p{Lu}\\p{Lt}])([\\p{Lu}\\p{Lt}][\\p{Ll}\\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.\n\t\t],\n\t\tstripRegexp: /(\\p{C}|\\p{P}|\\p{S})+/giu, // Anything that's not a punctuation, symbol or control/format character.\n\t} )\n\t\t.split( ' ' )\n\t\t.filter( Boolean );\n}\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nfunction normalizeSearchInput( input = '' ) {\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tinput = removeAccents( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tinput = input.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tinput = input.toLowerCase();\n\n\treturn input;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\treturn extractWords( normalizeSearchInput( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\n\t);\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tconst onlyFilterByCategory = ! normalizedSearchTerms.length;\n\tconst searchRankConfig = { ...config, onlyFilterByCategory };\n\n\t// If we aren't filtering on search terms, matching on category is satisfactory.\n\t// If we are, then we need more than a category match.\n\tconst threshold = onlyFilterByCategory ? 0 : 1;\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [\n\t\t\t\titem,\n\t\t\t\tgetItemSearchRank( item, searchInput, searchRankConfig ),\n\t\t\t];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > threshold );\n\n\t// If we didn't have terms to search on, there's no point sorting.\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn rankedItems.map( ( [ item ] ) => item );\n\t}\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nfunction getItemSearchRank( item, searchTerm, config ) {\n\tconst {\n\t\tcategoryId,\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\thasCategory = defaultHasCategory,\n\t\tonlyFilterByCategory,\n\t} = config;\n\n\tlet rank = hasCategory( item, categoryId ) ? 1 : 0;\n\n\t// If an item doesn't belong to the current category or we don't have\n\t// search terms to filter by, return the initial rank value.\n\tif ( ! rank || onlyFilterByCategory ) {\n\t\treturn rank;\n\t}\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\n\tconst normalizedSearchInput = normalizeSearchInput( searchTerm );\n\tconst normalizedTitle = normalizeSearchInput( title );\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, description matches come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [ name, title, description, ...keywords ].join( ' ' );\n\t\tconst normalizedSearchTerms = extractWords( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\treturn rank;\n}\n"]}
|
|
@@ -11,7 +11,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
11
11
|
import { unlock } from '../../lock-unlock';
|
|
12
12
|
import { store as editSiteStore } from '../../store';
|
|
13
13
|
import { filterOutDuplicatesByName } from './utils';
|
|
14
|
-
export default function
|
|
14
|
+
export default function usePatternSettings() {
|
|
15
15
|
var _storedSettings$__exp;
|
|
16
16
|
|
|
17
17
|
const storedSettings = useSelect(select => {
|
|
@@ -37,4 +37,4 @@ export default function useLibrarySettings() {
|
|
|
37
37
|
}, [storedSettings, blockPatterns]);
|
|
38
38
|
return settings;
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=use-
|
|
40
|
+
//# sourceMappingURL=use-pattern-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/use-pattern-settings.js"],"names":["store","coreStore","useSelect","useMemo","unlock","editSiteStore","filterOutDuplicatesByName","usePatternSettings","storedSettings","select","getSettings","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","blockPatterns","filter","settings","restStoredSettings","__unstableIsPreviewMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;AACA,SAASC,yBAAT,QAA0C,SAA1C;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAAA;;AAC5C,QAAMC,cAAc,GAAGN,SAAS,CAAIO,MAAF,IAAc;AAC/C,UAAM;AAAEC,MAAAA;AAAF,QAAkBN,MAAM,CAAEK,MAAM,CAAEJ,aAAF,CAAR,CAA9B;AACA,WAAOK,WAAW,EAAlB;AACA,GAH+B,EAG7B,EAH6B,CAAhC;AAKA,QAAMC,qBAAqB,4BAC1BH,cAAc,CAACI,qCADW,yEAC8B;AACxDJ,EAAAA,cAAc,CAACK,2BAFhB,CAN4C,CAQC;;AAE7C,QAAMC,iBAAiB,GAAGZ,SAAS,CAChCO,MAAF,IAAcA,MAAM,CAAER,SAAF,CAAN,CAAoBc,gBAApB,EADoB,EAElC,EAFkC,CAAnC;AAKA,QAAMC,aAAa,GAAGb,OAAO,CAC5B,MACC,CACC,IAAKQ,qBAAqB,IAAI,EAA9B,CADD,EAEC,IAAKG,iBAAiB,IAAI,EAA1B,CAFD,EAGEG,MAHF,CAGUX,yBAHV,CAF2B,EAM5B,CAAEK,qBAAF,EAAyBG,iBAAzB,CAN4B,CAA7B;AASA,QAAMI,QAAQ,GAAGf,OAAO,CAAE,MAAM;AAC/B,UAAM;AAAES,MAAAA,qCAAF;AAAyC,SAAGO;AAA5C,QACLX,cADD;AAGA,WAAO,EACN,GAAGW,kBADG;AAENN,MAAAA,2BAA2B,EAAEG,aAFvB;AAGNI,MAAAA,uBAAuB,EAAE;AAHnB,KAAP;AAKA,GATuB,EASrB,CAAEZ,cAAF,EAAkBQ,aAAlB,CATqB,CAAxB;AAWA,SAAOE,QAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport { filterOutDuplicatesByName } from './utils';\n\nexport default function usePatternSettings() {\n\tconst storedSettings = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn getSettings();\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\n\tconst restBlockPatterns = useSelect(\n\t\t( select ) => select( coreStore ).getBlockPatterns(),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t].filter( filterOutDuplicatesByName ),\n\t\t[ settingsBlockPatterns, restBlockPatterns ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst { __experimentalAdditionalBlockPatterns, ...restStoredSettings } =\n\t\t\tstoredSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__unstableIsPreviewMode: true,\n\t\t};\n\t}, [ storedSettings, blockPatterns ] );\n\n\treturn settings;\n}\n"]}
|
|
@@ -28,6 +28,8 @@ const templatePartToPattern = templatePart => ({
|
|
|
28
28
|
templatePart
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
+
const templatePartHasCategory = (item, category) => item.templatePart.area === category;
|
|
32
|
+
|
|
31
33
|
const useTemplatePartsAsPatterns = (categoryId, postType = TEMPLATE_PARTS, filterValue = '') => {
|
|
32
34
|
const {
|
|
33
35
|
templateParts,
|
|
@@ -61,7 +63,7 @@ const useTemplatePartsAsPatterns = (categoryId, postType = TEMPLATE_PARTS, filte
|
|
|
61
63
|
|
|
62
64
|
return searchItems(templateParts, filterValue, {
|
|
63
65
|
categoryId,
|
|
64
|
-
hasCategory:
|
|
66
|
+
hasCategory: templatePartHasCategory
|
|
65
67
|
});
|
|
66
68
|
}, [templateParts, filterValue, categoryId]);
|
|
67
69
|
return {
|
|
@@ -104,7 +106,7 @@ const reusableBlockToPattern = reusableBlock => ({
|
|
|
104
106
|
categories: reusableBlock.wp_pattern,
|
|
105
107
|
id: reusableBlock.id,
|
|
106
108
|
name: reusableBlock.slug,
|
|
107
|
-
syncStatus: reusableBlock.
|
|
109
|
+
syncStatus: reusableBlock.wp_pattern_sync_status || SYNC_TYPES.full,
|
|
108
110
|
title: reusableBlock.title.raw,
|
|
109
111
|
type: reusableBlock.type,
|
|
110
112
|
reusableBlock
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/use-patterns.js"],"names":["parse","useSelect","store","coreStore","useMemo","CORE_PATTERN_SOURCES","PATTERNS","SYNC_TYPES","TEMPLATE_PARTS","USER_PATTERNS","USER_PATTERN_CATEGORY","filterOutDuplicatesByName","unlock","searchItems","editSiteStore","EMPTY_PATTERN_LIST","createTemplatePartId","theme","slug","templatePartToPattern","templatePart","blocks","content","raw","categories","area","description","keywords","name","title","rendered","type","templatePartHasCategory","item","category","useTemplatePartsAsPatterns","categoryId","postType","filterValue","templateParts","isResolving","select","getEntityRecords","_isResolving","query","per_page","rawTemplateParts","partsAsPatterns","map","filteredTemplateParts","hasCategory","useThemePatterns","blockPatterns","getSettings","settings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","patterns","filter","pattern","includes","source","filteredPatterns","currentCategory","reusableBlockToPattern","reusableBlock","wp_pattern","id","syncStatus","wp_pattern_sync_status","full","useUserPatterns","categoryType","unfilteredPatterns","records","record","length","syncedPatterns","unsyncedPatterns","forEach","push","usePatterns"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,mBAAtB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SACCC,oBADD,EAECC,QAFD,EAGCC,UAHD,EAICC,cAJD,EAKCC,aALD,EAMCC,qBAND,EAOCC,yBAPD,QAQO,SARP;AASA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASC,WAAT,QAA4B,gBAA5B;AACA,SAASX,KAAK,IAAIY,aAAlB,QAAuC,aAAvC;AAEA,MAAMC,kBAAkB,GAAG,EAA3B;;AAEA,MAAMC,oBAAoB,GAAG,CAAEC,KAAF,EAASC,IAAT,KAC5BD,KAAK,IAAIC,IAAT,GAAgBD,KAAK,GAAG,IAAR,GAAeC,IAA/B,GAAsC,IADvC;;AAGA,MAAMC,qBAAqB,GAAKC,YAAF,KAAsB;AACnDC,EAAAA,MAA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cesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCORE_PATTERN_SOURCES,\n\tPATTERNS,\n\tSYNC_TYPES,\n\tTEMPLATE_PARTS,\n\tUSER_PATTERNS,\n\tUSER_PATTERN_CATEGORY,\n\tfilterOutDuplicatesByName,\n} from './utils';\nimport { unlock } from '../../lock-unlock';\nimport { searchItems } from './search-items';\nimport { store as editSiteStore } from '../../store';\n\nconst EMPTY_PATTERN_LIST = [];\n\nconst createTemplatePartId = ( theme, slug ) =>\n\ttheme && slug ? theme + '//' + slug : null;\n\nconst templatePartToPattern = ( templatePart ) => ( {\n\tblocks: parse( templatePart.content.raw ),\n\tcategories: [ templatePart.area ],\n\tdescription: templatePart.description || '',\n\tkeywords: templatePart.keywords || [],\n\tname: createTemplatePartId( templatePart.theme, templatePart.slug ),\n\ttitle: templatePart.title.rendered,\n\ttype: templatePart.type,\n\ttemplatePart,\n} );\n\nconst templatePartHasCategory = ( item, category ) =>\n\titem.templatePart.area === category;\n\nconst useTemplatePartsAsPatterns = (\n\tcategoryId,\n\tpostType = TEMPLATE_PARTS,\n\tfilterValue = ''\n) => {\n\tconst { templateParts, isResolving } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( postType !== TEMPLATE_PARTS ) {\n\t\t\t\treturn {\n\t\t\t\t\ttemplateParts: EMPTY_PATTERN_LIST,\n\t\t\t\t\tisResolving: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst query = { per_page: -1 };\n\t\t\tconst rawTemplateParts = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tquery\n\t\t\t);\n\t\t\tconst partsAsPatterns = rawTemplateParts?.map( ( templatePart ) =>\n\t\t\t\ttemplatePartToPattern( templatePart )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ttemplateParts: partsAsPatterns,\n\t\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( templateParts, filterValue, {\n\t\t\tcategoryId,\n\t\t\thasCategory: templatePartHasCategory,\n\t\t} );\n\t}, [ templateParts, filterValue, categoryId ] );\n\n\treturn { templateParts: filteredTemplateParts, isResolving };\n};\n\nconst useThemePatterns = (\n\tcategoryId,\n\tpostType = PATTERNS,\n\tfilterValue = ''\n) => {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\tconst settings = getSettings();\n\t\treturn (\n\t\t\tsettings.__experimentalAdditionalBlockPatterns ??\n\t\t\tsettings.__experimentalBlockPatterns\n\t\t);\n\t} );\n\n\tconst restBlockPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatterns()\n\t);\n\n\tconst patterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]\n\t\t\t\t.filter(\n\t\t\t\t\t( pattern ) =>\n\t\t\t\t\t\t! CORE_PATTERN_SOURCES.includes( pattern.source )\n\t\t\t\t)\n\t\t\t\t.filter( filterOutDuplicatesByName )\n\t\t\t\t.map( ( pattern ) => ( {\n\t\t\t\t\t...pattern,\n\t\t\t\t\tkeywords: pattern.keywords || [],\n\t\t\t\t\ttype: 'pattern',\n\t\t\t\t\tblocks: parse( pattern.content ),\n\t\t\t\t} ) ),\n\t\t[ blockPatterns, restBlockPatterns ]\n\t);\n\n\tconst filteredPatterns = useMemo( () => {\n\t\tif ( postType !== PATTERNS ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( patterns, filterValue, {\n\t\t\tcategoryId,\n\t\t\thasCategory: ( item, currentCategory ) =>\n\t\t\t\titem.categories?.includes( currentCategory ),\n\t\t} );\n\t}, [ patterns, filterValue, categoryId, postType ] );\n\n\treturn filteredPatterns;\n};\n\nconst reusableBlockToPattern = ( reusableBlock ) => ( {\n\tblocks: parse( reusableBlock.content.raw ),\n\tcategories: reusableBlock.wp_pattern,\n\tid: reusableBlock.id,\n\tname: reusableBlock.slug,\n\tsyncStatus: reusableBlock.wp_pattern_sync_status || SYNC_TYPES.full,\n\ttitle: reusableBlock.title.raw,\n\ttype: reusableBlock.type,\n\treusableBlock,\n} );\n\nconst useUserPatterns = (\n\tcategoryId,\n\tcategoryType = PATTERNS,\n\tfilterValue = ''\n) => {\n\tconst postType = categoryType === PATTERNS ? USER_PATTERNS : categoryType;\n\tconst unfilteredPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tif (\n\t\t\t\tpostType !== USER_PATTERNS ||\n\t\t\t\tcategoryId !== USER_PATTERN_CATEGORY\n\t\t\t) {\n\t\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t\t}\n\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst records = getEntityRecords( 'postType', postType, {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\n\t\t\tif ( ! records ) {\n\t\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t\t}\n\n\t\t\treturn records.map( ( record ) =>\n\t\t\t\treusableBlockToPattern( record )\n\t\t\t);\n\t\t},\n\t\t[ postType, categoryId ]\n\t);\n\n\tconst filteredPatterns = useMemo( () => {\n\t\tif ( ! unfilteredPatterns.length ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( unfilteredPatterns, filterValue, {\n\t\t\t// We exit user pattern retrieval early if we aren't in the\n\t\t\t// catch-all category for user created patterns, so it has\n\t\t\t// to be in the category.\n\t\t\thasCategory: () => true,\n\t\t} );\n\t}, [ unfilteredPatterns, filterValue ] );\n\n\tconst patterns = { syncedPatterns: [], unsyncedPatterns: [] };\n\n\tfilteredPatterns.forEach( ( pattern ) => {\n\t\tif ( pattern.syncStatus === SYNC_TYPES.full ) {\n\t\t\tpatterns.syncedPatterns.push( pattern );\n\t\t} else {\n\t\t\tpatterns.unsyncedPatterns.push( pattern );\n\t\t}\n\t} );\n\n\treturn patterns;\n};\n\nexport const usePatterns = ( categoryType, categoryId, filterValue ) => {\n\tconst blockPatterns = useThemePatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst { syncedPatterns = [], unsyncedPatterns = [] } = useUserPatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst { templateParts, isResolving } = useTemplatePartsAsPatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst patterns = {\n\t\tsyncedPatterns: [ ...templateParts, ...syncedPatterns ],\n\t\tunsyncedPatterns: [ ...blockPatterns, ...unsyncedPatterns ],\n\t};\n\n\treturn [ patterns, isResolving ];\n};\n\nexport default usePatterns;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export const DEFAULT_CATEGORY = '
|
|
2
|
-
export const DEFAULT_TYPE = '
|
|
1
|
+
export const DEFAULT_CATEGORY = 'my-patterns';
|
|
2
|
+
export const DEFAULT_TYPE = 'wp_block';
|
|
3
3
|
export const PATTERNS = 'pattern';
|
|
4
4
|
export const TEMPLATE_PARTS = 'wp_template_part';
|
|
5
5
|
export const USER_PATTERNS = 'wp_block';
|
|
6
|
-
export const USER_PATTERN_CATEGORY = '
|
|
6
|
+
export const USER_PATTERN_CATEGORY = 'my-patterns';
|
|
7
7
|
export const CORE_PATTERN_SOURCES = ['core', 'pattern-directory/core', 'pattern-directory/featured', 'pattern-directory/theme'];
|
|
8
8
|
export const SYNC_TYPES = {
|
|
9
9
|
full: 'fully',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/utils.js"],"names":["DEFAULT_CATEGORY","DEFAULT_TYPE","PATTERNS","TEMPLATE_PARTS","USER_PATTERNS","USER_PATTERN_CATEGORY","CORE_PATTERN_SOURCES","SYNC_TYPES","full","unsynced","filterOutDuplicatesByName","currentItem","index","items","findIndex","item","name"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,aAAzB;AACP,OAAO,MAAMC,YAAY,GAAG,UAArB;AACP,OAAO,MAAMC,QAAQ,GAAG,SAAjB;AACP,OAAO,MAAMC,cAAc,GAAG,kBAAvB;AACP,OAAO,MAAMC,aAAa,GAAG,UAAtB;AACP,OAAO,MAAMC,qBAAqB,GAAG,aAA9B;AAEP,OAAO,MAAMC,oBAAoB,GAAG,CACnC,MADmC,EAEnC,wBAFmC,EAGnC,4BAHmC,EAInC,yBAJmC,CAA7B;AAOP,OAAO,MAAMC,UAAU,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,QAAQ,EAAE;AAFe,CAAnB;AAKP,OAAO,MAAMC,yBAAyB,GAAG,CAAEC,WAAF,EAAeC,KAAf,EAAsBC,KAAtB,KACxCD,KAAK,KAAKC,KAAK,CAACC,SAAN,CAAmBC,IAAF,IAAYJ,WAAW,CAACK,IAAZ,KAAqBD,IAAI,CAACC,IAAvD,CADJ","sourcesContent":["export const DEFAULT_CATEGORY = 'my-patterns';\nexport const DEFAULT_TYPE = 'wp_block';\nexport const PATTERNS = 'pattern';\nexport const TEMPLATE_PARTS = 'wp_template_part';\nexport const USER_PATTERNS = 'wp_block';\nexport const USER_PATTERN_CATEGORY = 'my-patterns';\n\nexport const CORE_PATTERN_SOURCES = [\n\t'core',\n\t'pattern-directory/core',\n\t'pattern-directory/featured',\n\t'pattern-directory/theme',\n];\n\nexport const SYNC_TYPES = {\n\tfull: 'fully',\n\tunsynced: 'unsynced',\n};\n\nexport const filterOutDuplicatesByName = ( currentItem, index, items ) =>\n\tindex === items.findIndex( ( item ) => currentItem.name === item.name );\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { VisuallyHidden, __experimentalHeading as Heading, __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
|
|
10
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import Page from '../page';
|
|
16
|
+
import Table from '../table';
|
|
17
|
+
import Link from '../routes/link';
|
|
18
|
+
import AddedBy from '../list/added-by';
|
|
19
|
+
import TemplateActions from '../template-actions';
|
|
20
|
+
import AddNewTemplate from '../add-new-template';
|
|
21
|
+
import { store as editSiteStore } from '../../store';
|
|
22
|
+
export default function PageTemplateParts() {
|
|
23
|
+
const {
|
|
24
|
+
records: templateParts
|
|
25
|
+
} = useEntityRecords('postType', 'wp_template_part', {
|
|
26
|
+
per_page: -1
|
|
27
|
+
});
|
|
28
|
+
const {
|
|
29
|
+
canCreate
|
|
30
|
+
} = useSelect(select => {
|
|
31
|
+
const {
|
|
32
|
+
supportsTemplatePartsMode
|
|
33
|
+
} = select(editSiteStore).getSettings();
|
|
34
|
+
return {
|
|
35
|
+
postType: select(coreStore).getPostType('wp_template_part'),
|
|
36
|
+
canCreate: !supportsTemplatePartsMode
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
const columns = [{
|
|
40
|
+
header: __('Template Part'),
|
|
41
|
+
cell: templatePart => createElement(VStack, null, createElement(Heading, {
|
|
42
|
+
as: "h3",
|
|
43
|
+
level: 5
|
|
44
|
+
}, createElement(Link, {
|
|
45
|
+
params: {
|
|
46
|
+
postId: templatePart.id,
|
|
47
|
+
postType: templatePart.type,
|
|
48
|
+
canvas: 'view'
|
|
49
|
+
},
|
|
50
|
+
state: {
|
|
51
|
+
backPath: '/wp_template_part/all'
|
|
52
|
+
}
|
|
53
|
+
}, decodeEntities(templatePart.title?.rendered || templatePart.slug)))),
|
|
54
|
+
maxWidth: 400
|
|
55
|
+
}, {
|
|
56
|
+
header: __('Added by'),
|
|
57
|
+
cell: templatePart => createElement(AddedBy, {
|
|
58
|
+
postType: templatePart.type,
|
|
59
|
+
postId: templatePart.id
|
|
60
|
+
})
|
|
61
|
+
}, {
|
|
62
|
+
header: createElement(VisuallyHidden, null, __('Actions')),
|
|
63
|
+
cell: templatePart => createElement(TemplateActions, {
|
|
64
|
+
postType: templatePart.type,
|
|
65
|
+
postId: templatePart.id
|
|
66
|
+
})
|
|
67
|
+
}];
|
|
68
|
+
return createElement(Page, {
|
|
69
|
+
title: __('Template Parts'),
|
|
70
|
+
actions: canCreate && createElement(AddNewTemplate, {
|
|
71
|
+
templateType: 'wp_template_part',
|
|
72
|
+
showIcon: false,
|
|
73
|
+
toggleProps: {
|
|
74
|
+
variant: 'primary'
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}, templateParts && createElement(Table, {
|
|
78
|
+
data: templateParts,
|
|
79
|
+
columns: columns
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-template-parts/index.js"],"names":["VisuallyHidden","__experimentalHeading","Heading","__experimentalVStack","VStack","__","useSelect","store","coreStore","useEntityRecords","decodeEntities","Page","Table","Link","AddedBy","TemplateActions","AddNewTemplate","editSiteStore","PageTemplateParts","records","templateParts","per_page","canCreate","select","supportsTemplatePartsMode","getSettings","postType","getPostType","columns","header","cell","templatePart","postId","id","type","canvas","backPath","title","rendered","slug","maxWidth","variant"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,qBAAqB,IAAIC,OAF1B,EAGCC,oBAAoB,IAAIC,MAHzB,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,gBAA7B,QAAqD,sBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,OAAP,MAAoB,kBAApB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAAST,KAAK,IAAIU,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AAAX,MAA6BX,gBAAgB,CAClD,UADkD,EAElD,kBAFkD,EAGlD;AACCY,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAHkD,CAAnD;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAgBhB,SAAS,CAAIiB,MAAF,IAAc;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QACLD,MAAM,CAAEN,aAAF,CAAN,CAAwBQ,WAAxB,EADD;AAEA,WAAO;AACNC,MAAAA,QAAQ,EAAEH,MAAM,CAAEf,SAAF,CAAN,CAAoBmB,WAApB,CAAiC,kBAAjC,CADJ;AAENL,MAAAA,SAAS,EAAE,CAAEE;AAFP,KAAP;AAIA,GAP8B,CAA/B;AASA,QAAMI,OAAO,GAAG,CACf;AACCC,IAAAA,MAAM,EAAExB,EAAE,CAAE,eAAF,CADX;AAECyB,IAAAA,IAAI,EAAIC,YAAF,IACL,cAAC,M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AA,OAAO,EAAGQ;AAAxC,IAbF,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Table from '../table';\nimport Link from '../routes/link';\nimport AddedBy from '../list/added-by';\nimport TemplateActions from '../template-actions';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\n\nexport default function PageTemplateParts() {\n\tconst { records: templateParts } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tpostType: select( coreStore ).getPostType( 'wp_template_part' ),\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t} );\n\n\tconst columns = [\n\t\t{\n\t\t\theader: __( 'Template Part' ),\n\t\t\tcell: ( templatePart ) => (\n\t\t\t\t<VStack>\n\t\t\t\t\t<Heading as=\"h3\" level={ 5 }>\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: templatePart.id,\n\t\t\t\t\t\t\t\tpostType: templatePart.type,\n\t\t\t\t\t\t\t\tcanvas: 'view',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tstate={ { backPath: '/wp_template_part/all' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\ttemplatePart.title?.rendered ||\n\t\t\t\t\t\t\t\t\ttemplatePart.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</Heading>\n\t\t\t\t</VStack>\n\t\t\t),\n\t\t\tmaxWidth: 400,\n\t\t},\n\t\t{\n\t\t\theader: __( 'Added by' ),\n\t\t\tcell: ( templatePart ) => (\n\t\t\t\t<AddedBy\n\t\t\t\t\tpostType={ templatePart.type }\n\t\t\t\t\tpostId={ templatePart.id }\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theader: <VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>,\n\t\t\tcell: ( templatePart ) => (\n\t\t\t\t<TemplateActions\n\t\t\t\t\tpostType={ templatePart.type }\n\t\t\t\t\tpostId={ templatePart.id }\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t];\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ __( 'Template Parts' ) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ 'wp_template_part' }\n\t\t\t\t\t\tshowIcon={ false }\n\t\t\t\t\t\ttoggleProps={ { variant: 'primary' } }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{ templateParts && (\n\t\t\t\t<Table data={ templateParts } columns={ columns } />\n\t\t\t) }\n\t\t</Page>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"names":["VisuallyHidden","__experimentalHeading","Heading","__experimentalText","Text","__experimentalVStack","VStack","__","useSelect","store","coreStore","useEntityRecords","decodeEntities","Page","Table","Link","AddedBy","TemplateActions","AddNewTemplate","editSiteStore","PageTemplates","records","templates","per_page","canCreate","select","supportsTemplatePartsMode","getSettings","postType","getPostType","columns","header","cell","template","postId","id","type","canvas","title","rendered","slug","description","maxWidth","variant"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,qBAAqB,IAAIC,OAF1B,EAGCC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","__experimentalHeading","Heading","__experimentalText","Text","__experimentalVStack","VStack","__","useSelect","store","coreStore","useEntityRecords","decodeEntities","Page","Table","Link","AddedBy","TemplateActions","AddNewTemplate","editSiteStore","PageTemplates","records","templates","per_page","canCreate","select","supportsTemplatePartsMode","getSettings","postType","getPostType","columns","header","cell","template","postId","id","type","canvas","title","rendered","slug","description","maxWidth","variant"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,cADD,EAECC,qBAAqB,IAAIC,OAF1B,EAGCC,kBAAkB,IAAIC,IAHvB,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,EAA6BC,gBAA7B,QAAqD,sBAArD;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,IAAP,MAAiB,gBAAjB;AACA,OAAOC,OAAP,MAAoB,kBAApB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAAST,KAAK,IAAIU,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AAAX,MAAyBX,gBAAgB,CAC9C,UAD8C,EAE9C,aAF8C,EAG9C;AACCY,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAH8C,CAA/C;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAgBhB,SAAS,CAAIiB,MAAF,IAAc;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QACLD,MAAM,CAAEN,aAAF,CAAN,CAAwBQ,WAAxB,EADD;AAEA,WAAO;AACNC,MAAAA,QAAQ,EAAEH,MAAM,CAAEf,SAAF,CAAN,CAAoBmB,WAApB,CAAiC,aAAjC,CAD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EAAE,CAAE,WAAF,CADX;AAEC,IAAA,OAAO,EACNiB,SAAS,IACR,cAAC,cAAD;AACC,MAAA,YAAY,EAAG,aADhB;AAEC,MAAA,QAAQ,EAAG,KAFZ;AAGC,MAAA,WAAW,EAAG;AAAEmB,QAAAA,OAAO,EAAE;AAAX;AAHf;AAJH,KAYGrB,SAAS,IAAI,cAAC,KAAD;AAAO,IAAA,IAAI,EAAGA,SAAd;AAA0B,IAAA,OAAO,EAAGQ;AAApC,IAZhB,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Table from '../table';\nimport Link from '../routes/link';\nimport AddedBy from '../list/added-by';\nimport TemplateActions from '../template-actions';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\n\nexport default function PageTemplates() {\n\tconst { records: templates } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template',\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tpostType: select( coreStore ).getPostType( 'wp_template' ),\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t} );\n\n\tconst columns = [\n\t\t{\n\t\t\theader: __( 'Template' ),\n\t\t\tcell: ( template ) => (\n\t\t\t\t<VStack>\n\t\t\t\t\t<Heading as=\"h3\" level={ 5 }>\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\tpostType: template.type,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ template.description && (\n\t\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t\t{ decodeEntities( template.description ) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t),\n\t\t\tmaxWidth: 400,\n\t\t},\n\t\t{\n\t\t\theader: __( 'Added by' ),\n\t\t\tcell: ( template ) => (\n\t\t\t\t<AddedBy postType={ template.type } postId={ template.id } />\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theader: <VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>,\n\t\t\tcell: ( template ) => (\n\t\t\t\t<TemplateActions\n\t\t\t\t\tpostType={ template.type }\n\t\t\t\t\tpostId={ template.id }\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t];\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ 'wp_template' }\n\t\t\t\t\t\tshowIcon={ false }\n\t\t\t\t\t\ttoggleProps={ { variant: 'primary' } }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{ templates && <Table data={ templates } columns={ columns } /> }\n\t\t</Page>\n\t);\n}\n"]}
|
|
@@ -11,9 +11,9 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
|
|
14
|
-
import SidebarNavigationScreenLibrary from '../sidebar-navigation-screen-library';
|
|
15
14
|
import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
|
|
16
15
|
import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
|
|
16
|
+
import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';
|
|
17
17
|
import SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';
|
|
18
18
|
import useSyncPathWithURL, { getPathFromURL } from '../sync-state-with-url/use-sync-path-with-url';
|
|
19
19
|
import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
|
|
@@ -45,12 +45,12 @@ function SidebarScreens() {
|
|
|
45
45
|
}, createElement(SidebarNavigationScreenPage, null)), createElement(NavigatorScreen, {
|
|
46
46
|
path: "/:postType(wp_template)"
|
|
47
47
|
}, createElement(SidebarNavigationScreenTemplates, null)), createElement(NavigatorScreen, {
|
|
48
|
-
path: "/
|
|
49
|
-
}, createElement(
|
|
48
|
+
path: "/patterns"
|
|
49
|
+
}, createElement(SidebarNavigationScreenPatterns, null)), createElement(NavigatorScreen, {
|
|
50
|
+
path: "/:postType(wp_template|wp_template_part)/all"
|
|
51
|
+
}, createElement(SidebarNavigationScreenTemplatesBrowse, null)), createElement(NavigatorScreen, {
|
|
50
52
|
path: "/:postType(wp_template_part|wp_block)/:postId"
|
|
51
53
|
}, createElement(SidebarNavigationScreenPattern, null)), createElement(NavigatorScreen, {
|
|
52
|
-
path: "/:postType(wp_template)/all"
|
|
53
|
-
}, createElement(SidebarNavigationScreenTemplatesBrowse, null)), createElement(NavigatorScreen, {
|
|
54
54
|
path: "/:postType(wp_template)/:postId"
|
|
55
55
|
}, createElement(SidebarNavigationScreenTemplate, null)));
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["memo","useRef","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","privateApis","routerPrivateApis","SidebarNavigationScreenMain","SidebarNavigationScreenTemplates","SidebarNavigationScreenTemplate","SidebarNavigationScreenPatterns","SidebarNavigationScreenPattern","useSyncPathWithURL","getPathFromURL","SidebarNavigationScreenNavigationMenus","SidebarNavigationScreenNavigationMenu","SidebarNavigationScreenGlobalStyles","SidebarNavigationScreenTemplatesBrowse","SaveHub","unlock","SidebarNavigationScreenPages","SidebarNavigationScreenPage","useLocation","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,MAAf,QAA6B,oBAA7B;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,WAAW,IAAIC,iBAAxB,QAAiD,mBAAjD;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AACA,OAAOC,gCAAP,MAA6C,wCAA7C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,+BAAP,MAA4C,uCAA5C;AACA,OAAOC,8BAAP,MAA2C,sCAA3C;AACA,OAAOC,kBAAP,IACCC,cADD,QAEO,+CAFP;AAGA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,qCAAP,MAAkD,8CAAlD;AACA,OAAOC,mCAAP,MAAgD,4CAAhD;AACA,OAAOC,sCAAP,MAAmD,+CAAnD;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,OAAOC,4BAAP,MAAyC,oCAAzC;AACA,OAAOC,2BAAP,MAAwC,mCAAxC;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAkBH,MAAM,CAAEb,iBAAF,CAA9B;;AAEA,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AC,cAAD,OAJD,CADD,EAOC,cAAC,OAAD,OAPD,CADD;AAWA;;AAED,eAAe7B,IAAI,CAAEyB,OAAF,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/patterns\">\n\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
|
|
@@ -5,17 +5,20 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import { store as blockEditorStore, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
|
+
import { useMemo } from '@wordpress/element';
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
import { PAGE_CONTENT_BLOCK_TYPES } from '../../page-content-focus-manager/constants';
|
|
13
13
|
import { unlock } from '../../../lock-unlock';
|
|
14
14
|
const {
|
|
15
15
|
BlockQuickNavigation
|
|
16
16
|
} = unlock(blockEditorPrivateApis);
|
|
17
17
|
export default function PageContent() {
|
|
18
|
-
const
|
|
18
|
+
const clientIdsTree = useSelect(select => unlock(select(blockEditorStore)).getEnabledClientIdsTree(), []);
|
|
19
|
+
const clientIds = useMemo(() => clientIdsTree.map(({
|
|
20
|
+
clientId
|
|
21
|
+
}) => clientId), [clientIdsTree]);
|
|
19
22
|
return createElement(BlockQuickNavigation, {
|
|
20
23
|
clientIds: clientIds
|
|
21
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-content.js"],"names":["useSelect","store","blockEditorStore","privateApis","blockEditorPrivateApis","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-content.js"],"names":["useSelect","store","blockEditorStore","privateApis","blockEditorPrivateApis","useMemo","unlock","BlockQuickNavigation","PageContent","clientIdsTree","select","getEnabledClientIdsTree","clientIds","map","clientId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,KAAK,IAAIC,gBADV,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,sBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAA2BD,MAAM,CAAEF,sBAAF,CAAvC;AAEA,eAAe,SAASI,WAAT,GAAuB;AACrC,QAAMC,aAAa,GAAGT,SAAS,CAC5BU,MAAF,IACCJ,MAAM,CAAEI,MAAM,CAAER,gBAAF,CAAR,CAAN,CAAqCS,uBAArC,EAF6B,EAG9B,EAH8B,CAA/B;AAKA,QAAMC,SAAS,GAAGP,OAAO,CACxB,MAAMI,aAAa,CAACI,GAAd,CAAmB,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAoBA,QAAvC,CADkB,EAExB,CAAEL,aAAF,CAFwB,CAAzB;AAIA,SAAO,cAAC,oBAAD;AAAsB,IAAA,SAAS,EAAGG;AAAlC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nexport default function PageContent() {\n\tconst clientIdsTree = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getEnabledClientIdsTree(),\n\t\t[]\n\t);\n\tconst clientIds = useMemo(\n\t\t() => clientIdsTree.map( ( { clientId } ) => clientId ),\n\t\t[ clientIdsTree ]\n\t);\n\treturn <BlockQuickNavigation clientIds={ clientIds } />;\n}\n"]}
|
|
@@ -19,6 +19,11 @@ import { store as interfaceStore } from '@wordpress/interface';
|
|
|
19
19
|
import { STORE_NAME } from '../../../store/constants';
|
|
20
20
|
import { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';
|
|
21
21
|
import { store as editSiteStore } from '../../../store';
|
|
22
|
+
const entityLabels = {
|
|
23
|
+
wp_navigation: __('Navigation'),
|
|
24
|
+
wp_block: __('Pattern'),
|
|
25
|
+
wp_template: __('Template')
|
|
26
|
+
};
|
|
22
27
|
|
|
23
28
|
const SettingsHeader = ({
|
|
24
29
|
sidebarName
|
|
@@ -36,7 +41,7 @@ const SettingsHeader = ({
|
|
|
36
41
|
entityType: getEditedPostType()
|
|
37
42
|
};
|
|
38
43
|
});
|
|
39
|
-
const entityLabel = entityType
|
|
44
|
+
const entityLabel = entityLabels[entityType] || entityLabels.wp_template;
|
|
40
45
|
const {
|
|
41
46
|
enableComplementaryArea
|
|
42
47
|
} = useDispatch(interfaceStore);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/settings-header/index.js"],"names":["classnames","Button","__","sprintf","useSelect","useDispatch","store","interfaceStore","STORE_NAME","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","SettingsHeader","sidebarName","hasPageContentFocus","entityType","select","getEditedPostType","_hasPageContentFocus","entityLabel","enableComplementaryArea","openTemplateSettings","openBlockSettings","templateAriaLabel"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,0BAA3B;AACA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,cAAhD;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,gBAAvC
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/settings-header/index.js"],"names":["classnames","Button","__","sprintf","useSelect","useDispatch","store","interfaceStore","STORE_NAME","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","editSiteStore","entityLabels","wp_navigation","wp_block","wp_template","SettingsHeader","sidebarName","hasPageContentFocus","entityType","select","getEditedPostType","_hasPageContentFocus","entityLabel","enableComplementaryArea","openTemplateSettings","openBlockSettings","templateAriaL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,uBAAuB,CAAEhB,UAAF,EAAcC,aAAd,CADxB;;AAGA,MAAIkB,iBAAJ;;AACA,MAAKT,mBAAL,EAA2B;AAC1BS,IAAAA,iBAAiB,GAChBV,WAAW,KAAKP,gBAAhB,GACG;AACAR,IAAAA,EAAE,CAAE,iBAAF,CAFL,GAGG;AACAA,IAAAA,EAAE,CAAE,MAAF,CALN;AAMA,GAPD,MAOO;AACNyB,IAAAA,iBAAiB,GAChBV,WAAW,KAAKP,gBAAhB,GACG;AACAP,IAAAA,OAAO,CAAED,EAAE,CAAE,eAAF,CAAJ,EAAyBqB,WAAzB,CAFV,GAGG;AACAA,IAAAA,WALJ;AAMA;AAED;;;AACA,SACC,0BACC,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGE,oBADX;AAEC,IAAA,SAAS,EAAGzB,UAAU,CACrB,wCADqB,EAErB;AACC,mBAAaiB,WAAW,KAAKP;AAD9B,KAFqB,CAFvB;AAQC,kBAAaiB,iBARd;AASC,kBACCT,mBAAmB,GAAGhB,EAAE,CAAE,MAAF,CAAL,GAAkBqB;AAVvC,KAaGL,mBAAmB,GAAGhB,EAAE,CAAE,MAAF,CAAL,GAAkBqB,WAbxC,CADD,CADD,EAkBC,0BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAGG,iBADX;AAEC,IAAA,SAAS,EAAG1B,UAAU,CACrB,wCADqB,EAErB;AACC,mBAAaiB,WAAW,KAAKR;AAD9B,KAFqB,CAFvB;AAQC,kBACCQ,WAAW,KAAKR,aAAhB,GACG;AACAP,IAAAA,EAAE,CAAE,kBAAF,CAFL,GAGG;AACAA,IAAAA,EAAE,CAAE,OAAF,CAbP;AAeC,kBAAaA,EAAE,CAAE,OAAF;AAfhB,KAiBGA,EAAE,CAAE,OAAF,CAjBL,CADD,CAlBD,CADD;AA0CA,CA/ED;;AAiFA,eAAec,cAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../../../store/constants';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';\nimport { store as editSiteStore } from '../../../store';\n\nconst entityLabels = {\n\twp_navigation: __( 'Navigation' ),\n\twp_block: __( 'Pattern' ),\n\twp_template: __( 'Template' ),\n};\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { hasPageContentFocus, entityType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, hasPageContentFocus: _hasPageContentFocus } =\n\t\t\tselect( editSiteStore );\n\n\t\treturn {\n\t\t\thasPageContentFocus: _hasPageContentFocus(),\n\t\t\tentityType: getEditedPostType(),\n\t\t};\n\t} );\n\n\tconst entityLabel = entityLabels[ entityType ] || entityLabels.wp_template;\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openTemplateSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\tconst openBlockSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\n\tlet templateAriaLabel;\n\tif ( hasPageContentFocus ) {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t __( 'Page (selected)' )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t __( 'Page' );\n\t} else {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t sprintf( __( '%s (selected)' ), entityLabel )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t entityLabel;\n\t}\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openTemplateSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_TEMPLATE,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\tdata-label={\n\t\t\t\t\t\thasPageContentFocus ? __( 'Page' ) : entityLabel\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ hasPageContentFocus ? __( 'Page' ) : entityLabel }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_BLOCK,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tsidebarName === SIDEBAR_BLOCK\n\t\t\t\t\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t\t\t\t\t __( 'Block (selected)' )\n\t\t\t\t\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t\t\t\t\t __( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Block' ) }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"]}
|
|
@@ -13,6 +13,7 @@ import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
|
13
13
|
import { humanTimeDiff } from '@wordpress/date';
|
|
14
14
|
import { useCallback } from '@wordpress/element';
|
|
15
15
|
import { store as noticesStore } from '@wordpress/notices';
|
|
16
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
16
17
|
/**
|
|
17
18
|
* Internal dependencies
|
|
18
19
|
*/
|
|
@@ -30,8 +31,7 @@ const noop = () => {};
|
|
|
30
31
|
|
|
31
32
|
export function SidebarNavigationItemGlobalStyles(props) {
|
|
32
33
|
const {
|
|
33
|
-
openGeneralSidebar
|
|
34
|
-
toggleFeature
|
|
34
|
+
openGeneralSidebar
|
|
35
35
|
} = useDispatch(editSiteStore);
|
|
36
36
|
const {
|
|
37
37
|
setCanvasMode
|
|
@@ -39,6 +39,25 @@ export function SidebarNavigationItemGlobalStyles(props) {
|
|
|
39
39
|
const {
|
|
40
40
|
createNotice
|
|
41
41
|
} = useDispatch(noticesStore);
|
|
42
|
+
const {
|
|
43
|
+
set: setPreference
|
|
44
|
+
} = useDispatch(preferencesStore);
|
|
45
|
+
const {
|
|
46
|
+
get: getPrefference
|
|
47
|
+
} = useSelect(preferencesStore);
|
|
48
|
+
const turnOffDistractionFreeMode = useCallback(() => {
|
|
49
|
+
const isDistractionFree = getPrefference(editSiteStore.name, 'distractionFree');
|
|
50
|
+
|
|
51
|
+
if (!isDistractionFree) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setPreference(editSiteStore.name, 'distractionFree', false);
|
|
56
|
+
createNotice('info', __('Distraction free mode turned off'), {
|
|
57
|
+
isDismissible: true,
|
|
58
|
+
type: 'snackbar'
|
|
59
|
+
});
|
|
60
|
+
}, [createNotice, setPreference, getPrefference]);
|
|
42
61
|
const hasGlobalStyleVariations = useSelect(select => !!select(coreStore).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []);
|
|
43
62
|
|
|
44
63
|
if (hasGlobalStyleVariations) {
|
|
@@ -50,12 +69,7 @@ export function SidebarNavigationItemGlobalStyles(props) {
|
|
|
50
69
|
|
|
51
70
|
return createElement(SidebarNavigationItem, { ...props,
|
|
52
71
|
onClick: () => {
|
|
53
|
-
//
|
|
54
|
-
toggleFeature('distractionFree', false);
|
|
55
|
-
createNotice('info', __('Distraction free mode turned off'), {
|
|
56
|
-
isDismissible: true,
|
|
57
|
-
type: 'snackbar'
|
|
58
|
-
}); // Switch to edit mode.
|
|
72
|
+
turnOffDistractionFreeMode(); // Switch to edit mode.
|
|
59
73
|
|
|
60
74
|
setCanvasMode('edit'); // Open global styles sidebar.
|
|
61
75
|
|
|
@@ -152,8 +166,45 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
152
166
|
setCanvasMode,
|
|
153
167
|
setEditorCanvasContainerView
|
|
154
168
|
} = unlock(useDispatch(editSiteStore));
|
|
155
|
-
const
|
|
156
|
-
|
|
169
|
+
const {
|
|
170
|
+
createNotice
|
|
171
|
+
} = useDispatch(noticesStore);
|
|
172
|
+
const {
|
|
173
|
+
set: setPreference
|
|
174
|
+
} = useDispatch(preferencesStore);
|
|
175
|
+
const {
|
|
176
|
+
get: getPrefference
|
|
177
|
+
} = useSelect(preferencesStore);
|
|
178
|
+
const {
|
|
179
|
+
isViewMode,
|
|
180
|
+
isStyleBookOpened
|
|
181
|
+
} = useSelect(select => {
|
|
182
|
+
const {
|
|
183
|
+
getCanvasMode,
|
|
184
|
+
getEditorCanvasContainerView
|
|
185
|
+
} = unlock(select(editSiteStore));
|
|
186
|
+
return {
|
|
187
|
+
isViewMode: 'view' === getCanvasMode(),
|
|
188
|
+
isStyleBookOpened: 'style-book' === getEditorCanvasContainerView()
|
|
189
|
+
};
|
|
190
|
+
}, []);
|
|
191
|
+
const turnOffDistractionFreeMode = useCallback(() => {
|
|
192
|
+
const isDistractionFree = getPrefference(editSiteStore.name, 'distractionFree');
|
|
193
|
+
|
|
194
|
+
if (!isDistractionFree) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
setPreference(editSiteStore.name, 'distractionFree', false);
|
|
199
|
+
createNotice('info', __('Distraction free mode turned off'), {
|
|
200
|
+
isDismissible: true,
|
|
201
|
+
type: 'snackbar'
|
|
202
|
+
});
|
|
203
|
+
}, [createNotice, setPreference, getPrefference]);
|
|
204
|
+
const openGlobalStyles = useCallback(async () => {
|
|
205
|
+
turnOffDistractionFreeMode();
|
|
206
|
+
return Promise.all([setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
|
|
207
|
+
}, [setCanvasMode, openGeneralSidebar, turnOffDistractionFreeMode]);
|
|
157
208
|
const openStyleBook = useCallback(async () => {
|
|
158
209
|
await openGlobalStyles(); // Open the Style Book once the canvas mode is set to edit,
|
|
159
210
|
// and the global styles sidebar is open. This ensures that
|
|
@@ -187,7 +238,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
187
238
|
label: __('Edit styles'),
|
|
188
239
|
onClick: async () => await openGlobalStyles()
|
|
189
240
|
}))
|
|
190
|
-
}), isStyleBookOpened && !isMobileViewport && createElement(StyleBook, {
|
|
241
|
+
}), isStyleBookOpened && !isMobileViewport && isViewMode && createElement(StyleBook, {
|
|
191
242
|
enableResizing: false,
|
|
192
243
|
isSelected: () => false,
|
|
193
244
|
onClick: openStyleBook,
|