@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-pattern/index.js"],"names":["SidebarNavigationScreenPattern","params","postType","postId","setCanvasMode","editSiteStore","patternDetails","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["SidebarNavigationScreenPattern","params","categoryType","window","location","href","postType","postId","setCanvasMode","editSiteStore","patternDetails","backPath","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAOA;AACA;AACA;AAQe,SAASA,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAa,6CAAnB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAmB,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAAzB;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAuBN,MAA7B;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAoB,wBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AAEA;AAEA,QAAMC,cAAc,GAAG,gCAAmBJ,QAAnB,EAA6BC,MAA7B,CAAvB,CARwD,CAUxD;AACA;AACA;;AACA,QAAMI,QAAQ,GACb,CAAET,YAAF,IAAkBI,QAAQ,KAAK,kBAA/B,GACG,uBADH,GAEG,WAHJ;AAKA,SACC,4BAAC,gCAAD;AACC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAME,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGI;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAGD,QARZ;AAAA,OASMD;AATN,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport usePatternDetails from './use-pattern-details';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst { params } = useNavigator();\n\tconst { categoryType } = getQueryArgs( window.location.href );\n\tconst { postType, postId } = params;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\n\t// The absence of a category type in the query params for template parts\n\t// indicates the user has arrived at the template part via the \"manage all\"\n\t// page and the back button should return them to that list page.\n\tconst backPath =\n\t\t! categoryType && postType === 'wp_template_part'\n\t\t\t? '/wp_template_part/all'\n\t\t\t: '/patterns';\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tbackPath={ backPath }\n\t\t\t{ ...patternDetails }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -21,8 +21,12 @@ var _addedBy = require("../list/added-by");
|
|
|
21
21
|
|
|
22
22
|
var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
|
|
23
23
|
|
|
24
|
+
var _useNavigationMenuContent = _interopRequireDefault(require("./use-navigation-menu-content"));
|
|
25
|
+
|
|
24
26
|
var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
|
|
25
27
|
|
|
28
|
+
var _sidebarNavigationScreenDetailsPanel = require("../sidebar-navigation-screen-details-panel");
|
|
29
|
+
|
|
26
30
|
/**
|
|
27
31
|
* WordPress dependencies
|
|
28
32
|
*/
|
|
@@ -44,12 +48,12 @@ function usePatternDetails(postType, postId) {
|
|
|
44
48
|
|
|
45
49
|
if (!descriptionText && addedBy.text) {
|
|
46
50
|
descriptionText = (0, _i18n.sprintf)( // translators: %s: pattern title e.g: "Header".
|
|
47
|
-
(0, _i18n.__)('This is
|
|
51
|
+
(0, _i18n.__)('This is the %s pattern.'), getTitle());
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
if (!descriptionText && postType === 'wp_block' && record?.title) {
|
|
51
55
|
descriptionText = (0, _i18n.sprintf)( // translators: %s: user created pattern title e.g. "Footer".
|
|
52
|
-
(0, _i18n.__)('This is
|
|
56
|
+
(0, _i18n.__)('This is the %s pattern.'), record.title);
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
const description = (0, _element.createElement)(_element.Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && (0, _element.createElement)("span", {
|
|
@@ -71,9 +75,28 @@ function usePatternDetails(postType, postId) {
|
|
|
71
75
|
const footer = !!record?.modified ? (0, _element.createElement)(_sidebarNavigationScreenDetailsFooter.default, {
|
|
72
76
|
lastModifiedDateTime: record.modified
|
|
73
77
|
}) : null;
|
|
78
|
+
const details = [];
|
|
79
|
+
|
|
80
|
+
if (postType === 'wp_block') {
|
|
81
|
+
details.push({
|
|
82
|
+
label: (0, _i18n.__)('Syncing'),
|
|
83
|
+
value: record.wp_pattern_sync_status === 'unsynced' ? (0, _i18n.__)('Not synced') : (0, _i18n.__)('Fully synced')
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const content = (0, _element.createElement)(_element.Fragment, null, !!details.length && (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanel, {
|
|
88
|
+
spacing: 5,
|
|
89
|
+
title: (0, _i18n.__)('Details')
|
|
90
|
+
}, details.map(({
|
|
91
|
+
label,
|
|
92
|
+
value
|
|
93
|
+
}) => (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelRow, {
|
|
94
|
+
key: label
|
|
95
|
+
}, (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelLabel, null, label), (0, _element.createElement)(_sidebarNavigationScreenDetailsPanel.SidebarNavigationScreenDetailsPanelValue, null, value)))), (0, _useNavigationMenuContent.default)(postType, postId));
|
|
74
96
|
return {
|
|
75
97
|
title,
|
|
76
98
|
description,
|
|
99
|
+
content,
|
|
77
100
|
footer
|
|
78
101
|
};
|
|
79
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified","details","push","label","value","wp_pattern_sync_status","content","length","map"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../list/added-by';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\tgetTitle()\n\t\t);\n\t}\n\n\tif ( ! descriptionText && postType === 'wp_block' && record?.title ) {\n\t\tdescriptionText = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'pattern' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\tconst footer = !! record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\tlastModifiedDateTime={ record.modified }\n\t\t/>\n\t) : null;\n\n\tconst details = [];\n\n\tif ( postType === 'wp_block' ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t? __( 'Not synced' )\n\t\t\t\t\t: __( 'Fully synced' ),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"]}
|
|
@@ -25,14 +25,14 @@ function CategoryItem({
|
|
|
25
25
|
type
|
|
26
26
|
}) {
|
|
27
27
|
const linkInfo = (0, _link.useLink)({
|
|
28
|
-
path: '/
|
|
28
|
+
path: '/patterns',
|
|
29
29
|
categoryType: type,
|
|
30
30
|
categoryId: id
|
|
31
31
|
}, {
|
|
32
32
|
// Keep a record of where we came from in state so we can
|
|
33
|
-
// use the browser's back button to go back to
|
|
33
|
+
// use the browser's back button to go back to Patterns.
|
|
34
34
|
// See the implementation of the back button in patterns-list.
|
|
35
|
-
backPath: '/
|
|
35
|
+
backPath: '/patterns'
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
if (!count) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"names":["CategoryItem","count","icon","id","isActive","label","type","linkInfo","path","categoryType","categoryId","backPath","undefined"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,YAAT,CAAuB;AACrCC,EAAAA,KADqC;AAErCC,EAAAA,IAFqC;AAGrCC,EAAAA,EAHqC;AAIrCC,EAAAA,QAJqC;AAKrCC,EAAAA,KALqC;AAMrCC,EAAAA;AANqC,CAAvB,EAOX;AACH,QAAMC,QAAQ,GAAG,mBAChB;AACCC,IAAAA,IAAI,EAAE,WADP;AAECC,IAAAA,YAAY,EAAEH,IAFf;AAGCI,IAAAA,UAAU,EAAEP;AAHb,GADgB,EAMhB;AACC;AACA;AACA;AACAQ,IAAAA,QAAQ,EAAE;AAJX,GANgB,CAAjB;;AAcA,MAAK,CAAEV,KAAP,EAAe;AACd;AACA;;AAED,SACC,4BAAC,8BAAD,OACMM,QADN;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,MAAM,EAAG,0CAAQD,KAAR,CAHV;AAIC,oBAAeG,QAAQ,GAAG,MAAH,GAAYQ;AAJpC,KAMGP,KANH,CADD;AAUA","sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tconst linkInfo = useLink(\n\t\t{\n\t\t\tpath: '/patterns',\n\t\t\tcategoryType: type,\n\t\t\tcategoryId: id,\n\t\t},\n\t\t{\n\t\t\t// Keep a record of where we came from in state so we can\n\t\t\t// use the browser's back button to go back to Patterns.\n\t\t\t// See the implementation of the back button in patterns-list.\n\t\t\tbackPath: '/patterns',\n\t\t}\n\t);\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = SidebarNavigationScreenPatterns;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _compose = require("@wordpress/compose");
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _editor = require("@wordpress/editor");
|
|
19
|
+
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
22
|
+
var _url = require("@wordpress/url");
|
|
23
|
+
|
|
24
|
+
var _icons = require("@wordpress/icons");
|
|
25
|
+
|
|
26
|
+
var _addNewPattern = _interopRequireDefault(require("../add-new-pattern"));
|
|
27
|
+
|
|
28
|
+
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
29
|
+
|
|
30
|
+
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
31
|
+
|
|
32
|
+
var _categoryItem = _interopRequireDefault(require("./category-item"));
|
|
33
|
+
|
|
34
|
+
var _utils = require("../page-patterns/utils");
|
|
35
|
+
|
|
36
|
+
var _store = require("../../store");
|
|
37
|
+
|
|
38
|
+
var _link = require("../routes/link");
|
|
39
|
+
|
|
40
|
+
var _usePatternCategories = _interopRequireDefault(require("./use-pattern-categories"));
|
|
41
|
+
|
|
42
|
+
var _useMyPatterns = _interopRequireDefault(require("./use-my-patterns"));
|
|
43
|
+
|
|
44
|
+
var _useTemplatePartAreas = _interopRequireDefault(require("./use-template-part-areas"));
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* WordPress dependencies
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Internal dependencies
|
|
52
|
+
*/
|
|
53
|
+
function TemplatePartGroup({
|
|
54
|
+
areas,
|
|
55
|
+
currentArea,
|
|
56
|
+
currentType
|
|
57
|
+
}) {
|
|
58
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
59
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group-header"
|
|
60
|
+
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
61
|
+
level: 2
|
|
62
|
+
}, (0, _i18n.__)('Template parts')), (0, _element.createElement)("p", null, (0, _i18n.__)('Synced patterns for use in template building.'))), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
63
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
64
|
+
}, Object.entries(areas).map(([area, {
|
|
65
|
+
label,
|
|
66
|
+
templateParts
|
|
67
|
+
}]) => (0, _element.createElement)(_categoryItem.default, {
|
|
68
|
+
key: area,
|
|
69
|
+
count: templateParts?.length,
|
|
70
|
+
icon: (0, _editor.getTemplatePartIcon)(area),
|
|
71
|
+
label: label,
|
|
72
|
+
id: area,
|
|
73
|
+
type: "wp_template_part",
|
|
74
|
+
isActive: currentArea === area && currentType === 'wp_template_part'
|
|
75
|
+
}))));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function ThemePatternsGroup({
|
|
79
|
+
categories,
|
|
80
|
+
currentCategory,
|
|
81
|
+
currentType
|
|
82
|
+
}) {
|
|
83
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
84
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group-header"
|
|
85
|
+
}, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
86
|
+
level: 2
|
|
87
|
+
}, (0, _i18n.__)('Theme patterns')), (0, _element.createElement)("p", null, (0, _i18n.__)('For insertion into documents where they can then be customized.'))), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
88
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
89
|
+
}, categories.map(category => (0, _element.createElement)(_categoryItem.default, {
|
|
90
|
+
key: category.name,
|
|
91
|
+
count: category.count,
|
|
92
|
+
label: (0, _element.createElement)(_components.Flex, {
|
|
93
|
+
justify: "left",
|
|
94
|
+
align: "center",
|
|
95
|
+
gap: 0
|
|
96
|
+
}, category.label, (0, _element.createElement)(_components.Tooltip, {
|
|
97
|
+
position: "top center",
|
|
98
|
+
text: (0, _i18n.__)('Theme patterns cannot be edited.')
|
|
99
|
+
}, (0, _element.createElement)("span", {
|
|
100
|
+
className: "edit-site-sidebar-navigation-screen-pattern__lock-icon"
|
|
101
|
+
}, (0, _element.createElement)(_components.Icon, {
|
|
102
|
+
icon: _icons.lockSmall,
|
|
103
|
+
size: 24
|
|
104
|
+
})))),
|
|
105
|
+
icon: _icons.file,
|
|
106
|
+
id: category.name,
|
|
107
|
+
type: "pattern",
|
|
108
|
+
isActive: currentCategory === `${category.name}` && currentType === 'pattern'
|
|
109
|
+
}))));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function SidebarNavigationScreenPatterns() {
|
|
113
|
+
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
114
|
+
const {
|
|
115
|
+
categoryType,
|
|
116
|
+
categoryId
|
|
117
|
+
} = (0, _url.getQueryArgs)(window.location.href);
|
|
118
|
+
const currentCategory = categoryId || _utils.DEFAULT_CATEGORY;
|
|
119
|
+
const currentType = categoryType || _utils.DEFAULT_TYPE;
|
|
120
|
+
const {
|
|
121
|
+
templatePartAreas,
|
|
122
|
+
hasTemplateParts,
|
|
123
|
+
isLoading
|
|
124
|
+
} = (0, _useTemplatePartAreas.default)();
|
|
125
|
+
const {
|
|
126
|
+
patternCategories,
|
|
127
|
+
hasPatterns
|
|
128
|
+
} = (0, _usePatternCategories.default)();
|
|
129
|
+
const {
|
|
130
|
+
myPatterns,
|
|
131
|
+
hasPatterns: hasMyPatterns
|
|
132
|
+
} = (0, _useMyPatterns.default)();
|
|
133
|
+
const isTemplatePartsMode = (0, _data.useSelect)(select => {
|
|
134
|
+
const settings = select(_store.store).getSettings();
|
|
135
|
+
return !!settings.supportsTemplatePartsMode;
|
|
136
|
+
}, []);
|
|
137
|
+
const templatePartsLink = (0, _link.useLink)({
|
|
138
|
+
path: '/wp_template_part/all'
|
|
139
|
+
});
|
|
140
|
+
const footer = !isMobileViewport ? (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_sidebarNavigationItem.default, {
|
|
141
|
+
withChevron: true,
|
|
142
|
+
...templatePartsLink
|
|
143
|
+
}, (0, _i18n.__)('Manage all template parts')), (0, _element.createElement)(_sidebarNavigationItem.default, {
|
|
144
|
+
as: "a",
|
|
145
|
+
href: "edit.php?post_type=wp_block",
|
|
146
|
+
withChevron: true
|
|
147
|
+
}, (0, _i18n.__)('Manage all of my patterns'))) : undefined;
|
|
148
|
+
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
149
|
+
isRoot: isTemplatePartsMode,
|
|
150
|
+
title: (0, _i18n.__)('Patterns'),
|
|
151
|
+
description: (0, _i18n.__)('Manage what patterns are available when editing the site.'),
|
|
152
|
+
actions: (0, _element.createElement)(_addNewPattern.default, null),
|
|
153
|
+
footer: footer,
|
|
154
|
+
content: (0, _element.createElement)(_element.Fragment, null, isLoading && (0, _i18n.__)('Loading patterns'), !isLoading && (0, _element.createElement)(_element.Fragment, null, !hasTemplateParts && !hasPatterns && (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
155
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
156
|
+
}, (0, _element.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No template parts or patterns found'))), hasMyPatterns && (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
157
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
158
|
+
}, (0, _element.createElement)(_categoryItem.default, {
|
|
159
|
+
key: myPatterns.name,
|
|
160
|
+
count: myPatterns.count,
|
|
161
|
+
label: myPatterns.label,
|
|
162
|
+
icon: _icons.starFilled,
|
|
163
|
+
id: myPatterns.name,
|
|
164
|
+
type: "wp_block",
|
|
165
|
+
isActive: currentCategory === `${myPatterns.name}` && currentType === 'wp_block'
|
|
166
|
+
})), hasTemplateParts && (0, _element.createElement)(TemplatePartGroup, {
|
|
167
|
+
areas: templatePartAreas,
|
|
168
|
+
currentArea: currentCategory,
|
|
169
|
+
currentType: currentType
|
|
170
|
+
}), hasPatterns && (0, _element.createElement)(ThemePatternsGroup, {
|
|
171
|
+
categories: patternCategories,
|
|
172
|
+
currentCategory: currentCategory,
|
|
173
|
+
currentType: currentType
|
|
174
|
+
})))
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"names":["TemplatePartGroup","areas","currentArea","currentType","Object","entries","map","area","label","templateParts","length","ThemePatternsGroup","categories","currentCategory","category","name","count","lockSmall","file","SidebarNavigationScreenPatterns","isMobileViewport","categoryType","categoryId","window","location","href","DEFAULT_CATEGORY","DEFAULT_TYPE","templatePartAreas","hasTemplateParts","isLoading","patternCategories","hasPatterns","myPatterns","hasMyPatterns","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","templatePartsLink","path","footer","undefined","starFilled"],"mappings":";;;;;;;;;;;AAGA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA9BA;AACA;AACA;;AAgBA;AACA;AACA;AAYA,SAASA,iBAAT,CAA4B;AAAEC,EAAAA,KAAF;AAASC,EAAAA,WAAT;AAAsBC,EAAAA;AAAtB,CAA5B,EAAkE;AACjE,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuB,cAAI,gBAAJ,CAAvB,CADD,EAEC,uCAAK,cAAI,+CAAJ,CAAL,CAFD,CADD,EAKC,4BAAC,mCAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACGC,MAAM,CAACC,OAAP,CAAgBJ,KAAhB,EAAwBK,GAAxB,CACD,CAAE,CAAEC,IAAF,EAAQ;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAR,CAAF,KACC,4BAAC,qBAAD;AACC,IAAA,GAAG,EAAGF,IADP;AAEC,IAAA,KAAK,EAAGE,aAAa,EAAEC,MAFxB;AAGC,IAAA,IAAI,EAAG,iCAAqBH,IAArB,CAHR;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,EAAE,EAAGD,IALN;AAMC,IAAA,IAAI,EAAC,kBANN;AAOC,IAAA,QAAQ,EACPL,WAAW,KAAKK,IAAhB,IACAJ,WAAW,KAAK;AATlB,IAFA,CADH,CALD,CADD;AA0BA;;AAED,SAASQ,kBAAT,CAA6B;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,eAAd;AAA+BV,EAAAA;AAA/B,CAA7B,EAA4E;AAC3E,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuB,cAAI,gBAAJ,CAAvB,CADD,EAEC,uCACG,cACD,iEADC,CADH,CAFD,CADD,EASC,4BAAC,mCAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACGS,UAAU,CAACN,GAAX,CAAkBQ,QAAF,IACjB,4BAAC,qBAAD;AACC,IAAA,GAAG,EAAGA,QAAQ,CAACC,IADhB;AAEC,IAAA,KAAK,EAAGD,QAAQ,CAACE,KAFlB;AAGC,IAAA,KAAK,EACJ,4BAAC,gBAAD;AAAM,MAAA,OAAO,EAAC,MAAd;AAAqB,MAAA,KAAK,EAAC,QAA3B;AAAoC,MAAA,GAAG,EAAG;AAA1C,OACGF,QAAQ,CAACN,KADZ,EAEC,4BAAC,mBAAD;AACC,MAAA,QAAQ,EAAC,YADV;AAEC,MAAA,IAAI,EAAG,cACN,kCADM;AAFR,OAMC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC,4BAAC,gBAAD;AAAM,MAAA,IAAI,EAAGS,gBAAb;AAAyB,MAAA,IAAI,EAAG;AAAhC,MADD,CAND,CAFD,CAJF;AAkBC,IAAA,IAAI,EAAGC,WAlBR;AAmBC,IAAA,EAAE,EAAGJ,QAAQ,CAACC,IAnBf;AAoBC,IAAA,IAAI,EAAC,SApBN;AAqBC,IAAA,QAAQ,EACPF,eAAe,KAAM,GAAGC,QAAQ,CAACC,IAAM,EAAvC,IACAZ,WAAW,KAAK;AAvBlB,IADC,CADH,CATD,CADD;AA0CA;;AAEc,SAASgB,+BAAT,GAA2C;AACzD,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+B,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAArC;AACA,QAAMZ,eAAe,GAAGS,UAAU,IAAII,uBAAtC;AACA,QAAMvB,WAAW,GAAGkB,YAAY,IAAIM,mBAApC;AAEA,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA,gBAArB;AAAuCC,IAAAA;AAAvC,MACL,oCADD;AAEA,QAAM;AAAEC,IAAAA,iBAAF;AAAqBC,IAAAA;AAArB,MAAqC,oCAA3C;AACA,QAAM;AAAEC,IAAAA,UAAF;AAAcD,IAAAA,WAAW,EAAEE;AAA3B,MAA6C,6BAAnD;AAEA,QAAMC,mBAAmB,GAAG,qBAAaC,MAAF,IAAc;AACpD,UAAMC,QAAQ,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,EAAjB;AACA,WAAO,CAAC,CAAEF,QAAQ,CAACG,yBAAnB;AACA,GAH2B,EAGzB,EAHyB,CAA5B;AAKA,QAAMC,iBAAiB,GAAG,mBAAS;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAAT,CAA1B;AACA,QAAMC,MAAM,GAAG,CAAEvB,gBAAF,GACd,4BAAC,mCAAD,QACC,4BAAC,8BAAD;AAAuB,IAAA,WAAW,MAAlC;AAAA,OAAwCqB;AAAxC,KACG,cAAI,2BAAJ,CADH,CADD,EAIC,4BAAC,8BAAD;AACC,IAAA,EAAE,EAAC,GADJ;AAEC,IAAA,IAAI,EAAC,6BAFN;AAGC,IAAA,WAAW;AAHZ,KAKG,cAAI,2BAAJ,CALH,CAJD,CADc,GAaXG,SAbJ;AAeA,SACC,4BAAC,gCAAD;AACC,IAAA,MAAM,EAAGT,mBADV;AAEC,IAAA,KAAK,EAAG,cAAI,UAAJ,CAFT;AAGC,IAAA,WAAW,EAAG,cACb,2DADa,CAHf;AAMC,IAAA,OAAO,EAAG,4BAAC,sBAAD,OANX;AAOC,IAAA,MAAM,EAAGQ,MAPV;AAQC,IAAA,OAAO,EACN,qDACGb,SAAS,IAAI,cAAI,kBAAJ,CADhB,EAEG,CAAEA,SAAF,IACD,qDACG,CAAED,gBAAF,IAAsB,CAAEG,WAAxB,IACD,4BAAC,mCAAD;AAAW,MAAA,SAAS,EAAC;AAArB,OACC,4BAAC,8BAAD,QACG,cACD,qCADC,CADH,CADD,CAFF,EAUGE,aAAa,IACd,4BAAC,mCAAD;AAAW,MAAA,SAAS,EAAC;AAArB,OACC,4BAAC,qBAAD;AACC,MAAA,GAAG,EAAGD,UAAU,CAAClB,IADlB;AAEC,MAAA,KAAK,EAAGkB,UAAU,CAACjB,KAFpB;AAGC,MAAA,KAAK,EAAGiB,UAAU,CAACzB,KAHpB;AAIC,MAAA,IAAI,EAAGqC,iBAJR;AAKC,MAAA,EAAE,EAAGZ,UAAU,CAAClB,IALjB;AAMC,MAAA,IAAI,EAAC,UANN;AAOC,MAAA,QAAQ,EACPF,eAAe,KACb,GAAGoB,UAAU,CAAClB,IAAM,EADtB,IAEAZ,WAAW,KAAK;AAVlB,MADD,CAXF,EA2BG0B,gBAAgB,IACjB,4BAAC,iBAAD;AACC,MAAA,KAAK,EAAGD,iBADT;AAEC,MAAA,WAAW,EAAGf,eAFf;AAGC,MAAA,WAAW,EAAGV;AAHf,MA5BF,EAkCG6B,WAAW,IACZ,4BAAC,kBAAD;AACC,MAAA,UAAU,EAAGD,iBADd;AAEC,MAAA,eAAe,EAAGlB,eAFnB;AAGC,MAAA,WAAW,EAAGV;AAHf,MAnCF,CAHF;AATF,IADD;AA4DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\tFlex,\n\tIcon,\n\tTooltip,\n\t__experimentalHeading as Heading,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { getQueryArgs } from '@wordpress/url';\nimport { file, starFilled, lockSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';\nimport { store as editSiteStore } from '../../store';\nimport { useLink } from '../routes/link';\nimport usePatternCategories from './use-pattern-categories';\nimport useMyPatterns from './use-my-patterns';\nimport useTemplatePartAreas from './use-template-part-areas';\n\nfunction TemplatePartGroup( { areas, currentArea, currentType } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__group-header\">\n\t\t\t\t<Heading level={ 2 }>{ __( 'Template parts' ) }</Heading>\n\t\t\t\t<p>{ __( 'Synced patterns for use in template building.' ) }</p>\n\t\t\t</div>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ Object.entries( areas ).map(\n\t\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\t\ttype=\"wp_template_part\"\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === area &&\n\t\t\t\t\t\t\t\tcurrentType === 'wp_template_part'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nfunction ThemePatternsGroup( { categories, currentCategory, currentType } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__group-header\">\n\t\t\t\t<Heading level={ 2 }>{ __( 'Theme patterns' ) }</Heading>\n\t\t\t\t<p>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'For insertion into documents where they can then be customized.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ category.name }\n\t\t\t\t\t\tcount={ category.count }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t<Flex justify=\"left\" align=\"center\" gap={ 0 }>\n\t\t\t\t\t\t\t\t{ category.label }\n\t\t\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\t\ttext={ __(\n\t\t\t\t\t\t\t\t\t\t'Theme patterns cannot be edited.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__lock-icon\">\n\t\t\t\t\t\t\t\t\t\t<Icon icon={ lockSmall } size={ 24 } />\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t}\n\t\t\t\t\t\ticon={ file }\n\t\t\t\t\t\tid={ category.name }\n\t\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t\tcurrentType === 'pattern'\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst currentCategory = categoryId || DEFAULT_CATEGORY;\n\tconst currentType = categoryType || DEFAULT_TYPE;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst { myPatterns, hasPatterns: hasMyPatterns } = useMyPatterns();\n\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst templatePartsLink = useLink( { path: '/wp_template_part/all' } );\n\tconst footer = ! isMobileViewport ? (\n\t\t<ItemGroup>\n\t\t\t<SidebarNavigationItem withChevron { ...templatePartsLink }>\n\t\t\t\t{ __( 'Manage all template parts' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t<SidebarNavigationItem\n\t\t\t\tas=\"a\"\n\t\t\t\thref=\"edit.php?post_type=wp_block\"\n\t\t\t\twithChevron\n\t\t\t>\n\t\t\t\t{ __( 'Manage all of my patterns' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t</ItemGroup>\n\t) : undefined;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tfooter={ footer }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading patterns' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No template parts or patterns found'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasMyPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\t\t\t\t\tkey={ myPatterns.name }\n\t\t\t\t\t\t\t\t\t\tcount={ myPatterns.count }\n\t\t\t\t\t\t\t\t\t\tlabel={ myPatterns.label }\n\t\t\t\t\t\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\t\t\t\t\t\tid={ myPatterns.name }\n\t\t\t\t\t\t\t\t\t\ttype=\"wp_block\"\n\t\t\t\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t\t\t\tcurrentCategory ===\n\t\t\t\t\t\t\t\t\t\t\t\t`${ myPatterns.name }` &&\n\t\t\t\t\t\t\t\t\t\t\tcurrentType === 'wp_block'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasTemplateParts && (\n\t\t\t\t\t\t\t\t<TemplatePartGroup\n\t\t\t\t\t\t\t\t\tareas={ templatePartAreas }\n\t\t\t\t\t\t\t\t\tcurrentArea={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t\t\t\t<ThemePatternsGroup\n\t\t\t\t\t\t\t\t\tcategories={ patternCategories }\n\t\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js"],"names":["useDefaultPatternCategories","blockPatternCategories","select","getSettings","editSiteStore","settings","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatternCategories","coreStore","getBlockPatternCategories"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIe,SAASA,2BAAT,GAAuC;AACrD,QAAMC,sBAAsB,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAAkB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AACA,UAAMC,QAAQ,GAAGF,WAAW,EAA5B;AAEA,oCACCE,QAAQ,CAACC,8CADV,yEAECD,QAAQ,CAACE,oCAFV;AAIA,GAR8B,CAA/B;AAUA,QAAMC,0BAA0B,GAAG,qBAAaN,MAAF,IAC7CA,MAAM,CAAEO,eAAF,CAAN,CAAoBC,yBAApB,EADkC,CAAnC;AAIA,SAAO,CACN,IAAKT,sBAAsB,IAAI,EAA/B,CADM,EAEN,IAAKO,0BAA0B,IAAI,EAAnC,CAFM,CAAP;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useDefaultPatternCategories() {\n\tconst blockPatternCategories = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\tconst settings = getSettings();\n\n\t\treturn (\n\t\t\tsettings.__experimentalAdditionalBlockPatternCategories ??\n\t\t\tsettings.__experimentalBlockPatternCategories\n\t\t);\n\t} );\n\n\tconst restBlockPatternCategories = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatternCategories()\n\t);\n\n\treturn [\n\t\t...( blockPatternCategories || [] ),\n\t\t...( restBlockPatternCategories || [] ),\n\t];\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useMyPatterns;
|
|
7
|
+
|
|
8
|
+
var _coreData = require("@wordpress/core-data");
|
|
9
|
+
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
function useMyPatterns() {
|
|
18
|
+
const myPatterns = (0, _data.useSelect)(select => select(_coreData.store).getEntityRecords('postType', 'wp_block', {
|
|
19
|
+
per_page: -1
|
|
20
|
+
}));
|
|
21
|
+
return {
|
|
22
|
+
myPatterns: {
|
|
23
|
+
count: myPatterns?.length || 0,
|
|
24
|
+
name: 'my-patterns',
|
|
25
|
+
label: (0, _i18n.__)('My patterns')
|
|
26
|
+
},
|
|
27
|
+
hasPatterns: !!myPatterns?.length
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=use-my-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js"],"names":["useMyPatterns","myPatterns","select","coreStore","getEntityRecords","per_page","count","length","name","label","hasPatterns"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKe,SAASA,aAAT,GAAyB;AACvC,QAAMC,UAAU,GAAG,qBAAaC,MAAF,IAC7BA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,gBAApB,CAAsC,UAAtC,EAAkD,UAAlD,EAA8D;AAC7DC,IAAAA,QAAQ,EAAE,CAAC;AADkD,GAA9D,CADkB,CAAnB;AAMA,SAAO;AACNJ,IAAAA,UAAU,EAAE;AACXK,MAAAA,KAAK,EAAEL,UAAU,EAAEM,MAAZ,IAAsB,CADlB;AAEXC,MAAAA,IAAI,EAAE,aAFK;AAGXC,MAAAA,KAAK,EAAE,cAAI,aAAJ;AAHI,KADN;AAMNC,IAAAA,WAAW,EAAE,CAAC,CAAET,UAAU,EAAEM;AANtB,GAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\nexport default function useMyPatterns() {\n\tconst myPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\tper_page: -1,\n\t\t} )\n\t);\n\n\treturn {\n\t\tmyPatterns: {\n\t\t\tcount: myPatterns?.length || 0,\n\t\t\tname: 'my-patterns',\n\t\t\tlabel: __( 'My patterns' ),\n\t\t},\n\t\thasPatterns: !! myPatterns?.length,\n\t};\n}\n"]}
|
|
@@ -7,14 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = usePatternCategories;
|
|
9
9
|
|
|
10
|
-
var _coreData = require("@wordpress/core-data");
|
|
11
|
-
|
|
12
|
-
var _data = require("@wordpress/data");
|
|
13
|
-
|
|
14
10
|
var _element = require("@wordpress/element");
|
|
15
11
|
|
|
16
|
-
var _i18n = require("@wordpress/i18n");
|
|
17
|
-
|
|
18
12
|
var _useDefaultPatternCategories = _interopRequireDefault(require("./use-default-pattern-categories"));
|
|
19
13
|
|
|
20
14
|
var _useThemePatterns = _interopRequireDefault(require("./use-theme-patterns"));
|
|
@@ -29,9 +23,6 @@ var _useThemePatterns = _interopRequireDefault(require("./use-theme-patterns"));
|
|
|
29
23
|
function usePatternCategories() {
|
|
30
24
|
const defaultCategories = (0, _useDefaultPatternCategories.default)();
|
|
31
25
|
const themePatterns = (0, _useThemePatterns.default)();
|
|
32
|
-
const userPatterns = (0, _data.useSelect)(select => select(_coreData.store).getEntityRecords('postType', 'wp_block', {
|
|
33
|
-
per_page: -1
|
|
34
|
-
}));
|
|
35
26
|
const patternCategories = (0, _element.useMemo)(() => {
|
|
36
27
|
const categoryMap = {};
|
|
37
28
|
const categoriesWithCounts = []; // Create a map for easier counting of patterns in categories.
|
|
@@ -56,18 +47,9 @@ function usePatternCategories() {
|
|
|
56
47
|
if (categoryMap[category.name].count) {
|
|
57
48
|
categoriesWithCounts.push(categoryMap[category.name]);
|
|
58
49
|
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
if (userPatterns?.length) {
|
|
62
|
-
categoriesWithCounts.push({
|
|
63
|
-
count: userPatterns.length || 0,
|
|
64
|
-
name: 'custom-patterns',
|
|
65
|
-
label: (0, _i18n.__)('Custom patterns')
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
50
|
+
});
|
|
69
51
|
return categoriesWithCounts;
|
|
70
|
-
}, [defaultCategories, themePatterns
|
|
52
|
+
}, [defaultCategories, themePatterns]);
|
|
71
53
|
return {
|
|
72
54
|
patternCategories,
|
|
73
55
|
hasPatterns: !!patternCategories.length
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"names":["usePatternCategories","defaultCategories","themePatterns","patternCategories","categoryMap","categoriesWithCounts","forEach","category","name","count","pattern","categories","push","hasPatterns","length"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,oBAAT,GAAgC;AAC9C,QAAMC,iBAAiB,GAAG,2CAA1B;AACA,QAAMC,aAAa,GAAG,gCAAtB;AAEA,QAAMC,iBAAiB,GAAG,sBAAS,MAAM;AACxC,UAAMC,WAAW,GAAG,EAApB;AACA,UAAMC,oBAAoB,GAAG,EAA7B,CAFwC,CAIxC;;AACAJ,IAAAA,iBAAiB,CAACK,OAAlB,CAA6BC,QAAF,IAAgB;AAC1C,UAAK,CAAEH,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAlB,EAAsC;AACrCJ,QAAAA,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAX,GAA+B,EAAE,GAAGD,QAAL;AAAeE,UAAAA,KAAK,EAAE;AAAtB,SAA/B;AACA;AACD,KAJD,EALwC,CAWxC;;AACAP,IAAAA,aAAa,CAACI,OAAd,CAAyBI,OAAF,IAAe;AACrCA,MAAAA,OAAO,CAACC,UAAR,EAAoBL,OAApB,CAA+BC,QAAF,IAAgB;AAC5C,YAAKH,WAAW,CAAEG,QAAF,CAAhB,EAA+B;AAC9BH,UAAAA,WAAW,CAAEG,QAAF,CAAX,CAAwBE,KAAxB,IAAiC,CAAjC;AACA;AACD,OAJD;AAKA,KAND,EAZwC,CAoBxC;;AACAR,IAAAA,iBAAiB,CAACK,OAAlB,CAA6BC,QAAF,IAAgB;AAC1C,UAAKH,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAX,CAA6BC,KAAlC,EAA0C;AACzCJ,QAAAA,oBAAoB,CAACO,IAArB,CAA2BR,WAAW,CAAEG,QAAQ,CAACC,IAAX,CAAtC;AACA;AACD,KAJD;AAMA,WAAOH,oBAAP;AACA,GA5ByB,EA4BvB,CAAEJ,iBAAF,EAAqBC,aAArB,CA5BuB,CAA1B;AA8BA,SAAO;AAAEC,IAAAA,iBAAF;AAAqBU,IAAAA,WAAW,EAAE,CAAC,CAAEV,iBAAiB,CAACW;AAAvD,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useDefaultPatternCategories from './use-default-pattern-categories';\nimport useThemePatterns from './use-theme-patterns';\n\nexport default function usePatternCategories() {\n\tconst defaultCategories = useDefaultPatternCategories();\n\tconst themePatterns = useThemePatterns();\n\n\tconst patternCategories = useMemo( () => {\n\t\tconst categoryMap = {};\n\t\tconst categoriesWithCounts = [];\n\n\t\t// Create a map for easier counting of patterns in categories.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( ! categoryMap[ category.name ] ) {\n\t\t\t\tcategoryMap[ category.name ] = { ...category, count: 0 };\n\t\t\t}\n\t\t} );\n\n\t\t// Update the category counts to reflect theme registered patterns.\n\t\tthemePatterns.forEach( ( pattern ) => {\n\t\t\tpattern.categories?.forEach( ( category ) => {\n\t\t\t\tif ( categoryMap[ category ] ) {\n\t\t\t\t\tcategoryMap[ category ].count += 1;\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\t// Filter categories so we only have those containing patterns.\n\t\tdefaultCategories.forEach( ( category ) => {\n\t\t\tif ( categoryMap[ category.name ].count ) {\n\t\t\t\tcategoriesWithCounts.push( categoryMap[ category.name ] );\n\t\t\t}\n\t\t} );\n\n\t\treturn categoriesWithCounts;\n\t}, [ defaultCategories, themePatterns ] );\n\n\treturn { patternCategories, hasPatterns: !! patternCategories.length };\n}\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useTemplatePartAreas;
|
|
7
|
+
|
|
8
|
+
var _coreData = require("@wordpress/core-data");
|
|
9
|
+
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
|
|
12
|
+
var _editor = require("@wordpress/editor");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
const useTemplatePartsGroupedByArea = items => {
|
|
18
|
+
const allItems = items || [];
|
|
19
|
+
const templatePartAreas = (0, _data.useSelect)(select => select(_editor.store).__experimentalGetDefaultTemplatePartAreas(), []); // Create map of template areas ensuring that default areas are displayed before
|
|
20
|
+
// any custom registered template part areas.
|
|
21
|
+
|
|
22
|
+
const knownAreas = {
|
|
23
|
+
header: {},
|
|
24
|
+
footer: {},
|
|
25
|
+
sidebar: {},
|
|
26
|
+
uncategorized: {}
|
|
27
|
+
};
|
|
28
|
+
templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { ...templatePartArea,
|
|
29
|
+
templateParts: []
|
|
30
|
+
});
|
|
31
|
+
const groupedByArea = allItems.reduce((accumulator, item) => {
|
|
32
|
+
const key = accumulator[item.area] ? item.area : 'uncategorized';
|
|
33
|
+
accumulator[key].templateParts.push(item);
|
|
34
|
+
return accumulator;
|
|
35
|
+
}, knownAreas);
|
|
36
|
+
return groupedByArea;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function useTemplatePartAreas() {
|
|
40
|
+
const {
|
|
41
|
+
records: templateParts,
|
|
42
|
+
isResolving: isLoading
|
|
43
|
+
} = (0, _coreData.useEntityRecords)('postType', 'wp_template_part', {
|
|
44
|
+
per_page: -1
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
hasTemplateParts: templateParts ? !!templateParts.length : false,
|
|
48
|
+
isLoading,
|
|
49
|
+
templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=use-template-part-areas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"names":["useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","select","editorStore","__experimentalGetDefaultTemplatePartAreas","knownAreas","header","footer","sidebar","uncategorized","forEach","templatePartArea","area","templateParts","groupedByArea","reduce","accumulator","item","key","push","useTemplatePartAreas","records","isResolving","isLoading","per_page","hasTemplateParts","length"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,MAAMA,6BAA6B,GAAKC,KAAF,IAAa;AAClD,QAAMC,QAAQ,GAAGD,KAAK,IAAI,EAA1B;AAEA,QAAME,iBAAiB,GAAG,qBACvBC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,yCAAtB,EAFwB,EAGzB,EAHyB,CAA1B,CAHkD,CASlD;AACA;;AACA,QAAMC,UAAU,GAAG;AAClBC,IAAAA,MAAM,EAAE,EADU;AAElBC,IAAAA,MAAM,EAAE,EAFU;AAGlBC,IAAAA,OAAO,EAAE,EAHS;AAIlBC,IAAAA,aAAa,EAAE;AAJG,GAAnB;AAOAR,EAAAA,iBAAiB,CAACS,OAAlB,CACGC,gBAAF,IACGN,UAAU,CAAEM,gBAAgB,CAACC,IAAnB,CAAV,GAAsC,EACvC,GAAGD,gBADoC;AAEvCE,IAAAA,aAAa,EAAE;AAFwB,GAF1C;AAQA,QAAMC,aAAa,GAAGd,QAAQ,CAACe,MAAT,CAAiB,CAAEC,WAAF,EAAeC,IAAf,KAAyB;AAC/D,UAAMC,GAAG,GAAGF,WAAW,CAAEC,IAAI,CAACL,IAAP,CAAX,GAA2BK,IAAI,CAACL,IAAhC,GAAuC,eAAnD;AACAI,IAAAA,WAAW,CAAEE,GAAF,CAAX,CAAmBL,aAAnB,CAAiCM,IAAjC,CAAuCF,IAAvC;AACA,WAAOD,WAAP;AACA,GAJqB,EAInBX,UAJmB,CAAtB;AAMA,SAAOS,aAAP;AACA,CAjCD;;AAmCe,SAASM,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA,OAAO,EAAER,aAAX;AAA0BS,IAAAA,WAAW,EAAEC;AAAvC,MAAqD,gCAC1D,UAD0D,EAE1D,kBAF0D,EAG1D;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAH0D,CAA3D;AAMA,SAAO;AACNC,IAAAA,gBAAgB,EAAEZ,aAAa,GAAG,CAAC,CAAEA,aAAa,CAACa,MAApB,GAA6B,KADtD;AAENH,IAAAA,SAFM;AAGNtB,IAAAA,iBAAiB,EAAEH,6BAA6B,CAAEe,aAAF;AAH1C,GAAP;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\nconst useTemplatePartsGroupedByArea = ( items ) => {\n\tconst allItems = items || [];\n\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\t// Create map of template areas ensuring that default areas are displayed before\n\t// any custom registered template part areas.\n\tconst knownAreas = {\n\t\theader: {},\n\t\tfooter: {},\n\t\tsidebar: {},\n\t\tuncategorized: {},\n\t};\n\n\ttemplatePartAreas.forEach(\n\t\t( templatePartArea ) =>\n\t\t\t( knownAreas[ templatePartArea.area ] = {\n\t\t\t\t...templatePartArea,\n\t\t\t\ttemplateParts: [],\n\t\t\t} )\n\t);\n\n\tconst groupedByArea = allItems.reduce( ( accumulator, item ) => {\n\t\tconst key = accumulator[ item.area ] ? item.area : 'uncategorized';\n\t\taccumulator[ key ].templateParts.push( item );\n\t\treturn accumulator;\n\t}, knownAreas );\n\n\treturn groupedByArea;\n};\n\nexport default function useTemplatePartAreas() {\n\tconst { records: templateParts, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{ per_page: -1 }\n\t);\n\n\treturn {\n\t\thasTemplateParts: templateParts ? !! templateParts.length : false,\n\t\tisLoading,\n\t\ttemplatePartAreas: useTemplatePartsGroupedByArea( templateParts ),\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js"],"names":["useThemePatterns","blockPatterns","select","getSettings","editSiteStore","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","coreStore","getBlockPatterns","patterns","filter","pattern","CORE_PATTERN_SOURCES","includes","source","filterOutDuplicatesByName"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAIA;;AACA;;AAfA;AACA;AACA;;AAKA;AACA;AACA;AAQe,SAASA,gBAAT,GAA4B;AAC1C,QAAMC,aAAa,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QAAkB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AAEA,oCACCD,WAAW,GAAGE,qCADf,yEAECF,WAAW,GAAGG,2BAFf;AAIA,GAPqB,CAAtB;AASA,QAAMC,iBAAiB,GAAG,qBAAaL,MAAF,IACpCA,MAAM,CAAEM,eAAF,CAAN,CAAoBC,gBAApB,EADyB,CAA1B;AAIA,QAAMC,QAAQ,GAAG,sBAChB,MACC,CAAE,IAAKT,aAAa,IAAI,EAAtB,CAAF,EAA8B,IAAKM,iBAAiB,IAAI,EAA1B,CAA9B,EACEI,MADF,CAEIC,OAAF,IACC,CAAEC,4BAAqBC,QAArB,CAA+BF,OAAO,CAACG,MAAvC,CAHL,EAKEJ,MALF,CAKUK,gCALV,CAFe,EAQhB,CAAEf,aAAF,EAAiBM,iBAAjB,CARgB,CAAjB;AAWA,SAAOG,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 {\n\tCORE_PATTERN_SOURCES,\n\tfilterOutDuplicatesByName,\n} from '../page-patterns/utils';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useThemePatterns() {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn (\n\t\t\tgetSettings().__experimentalAdditionalBlockPatterns ??\n\t\t\tgetSettings().__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[ blockPatterns, restBlockPatterns ]\n\t);\n\n\treturn patterns;\n}\n"]}
|
|
@@ -21,8 +21,6 @@ var _htmlEntities = require("@wordpress/html-entities");
|
|
|
21
21
|
|
|
22
22
|
var _compose = require("@wordpress/compose");
|
|
23
23
|
|
|
24
|
-
var _editor = require("@wordpress/editor");
|
|
25
|
-
|
|
26
24
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
27
25
|
|
|
28
26
|
var _link = require("../routes/link");
|
|
@@ -42,41 +40,6 @@ var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
|
42
40
|
/**
|
|
43
41
|
* Internal dependencies
|
|
44
42
|
*/
|
|
45
|
-
const config = {
|
|
46
|
-
wp_template: {
|
|
47
|
-
labels: {
|
|
48
|
-
title: (0, _i18n.__)('Templates'),
|
|
49
|
-
loading: (0, _i18n.__)('Loading templates'),
|
|
50
|
-
notFound: (0, _i18n.__)('No templates found'),
|
|
51
|
-
manage: (0, _i18n.__)('Manage all templates'),
|
|
52
|
-
description: (0, _i18n.__)('Express the layout of your site with templates.')
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
wp_template_part: {
|
|
56
|
-
labels: {
|
|
57
|
-
title: (0, _i18n.__)('Library'),
|
|
58
|
-
loading: (0, _i18n.__)('Loading library'),
|
|
59
|
-
notFound: (0, _i18n.__)('No patterns found'),
|
|
60
|
-
manage: (0, _i18n.__)('Manage all template parts'),
|
|
61
|
-
reusableBlocks: (0, _i18n.__)('Manage patterns'),
|
|
62
|
-
description: (0, _i18n.__)('Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.')
|
|
63
|
-
},
|
|
64
|
-
sortCallback: items => {
|
|
65
|
-
const groupedByArea = items.reduce((accumulator, item) => {
|
|
66
|
-
const key = accumulator[item.area] ? item.area : 'rest';
|
|
67
|
-
accumulator[key].push(item);
|
|
68
|
-
return accumulator;
|
|
69
|
-
}, {
|
|
70
|
-
header: [],
|
|
71
|
-
footer: [],
|
|
72
|
-
sidebar: [],
|
|
73
|
-
rest: []
|
|
74
|
-
});
|
|
75
|
-
return [...groupedByArea.header, ...groupedByArea.footer, ...groupedByArea.sidebar, ...groupedByArea.rest];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
43
|
const TemplateItem = ({
|
|
81
44
|
postType,
|
|
82
45
|
postId,
|
|
@@ -92,11 +55,6 @@ const TemplateItem = ({
|
|
|
92
55
|
};
|
|
93
56
|
|
|
94
57
|
function SidebarNavigationScreenTemplates() {
|
|
95
|
-
const {
|
|
96
|
-
params: {
|
|
97
|
-
postType
|
|
98
|
-
}
|
|
99
|
-
} = (0, _components.__experimentalUseNavigator)();
|
|
100
58
|
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
101
59
|
const isTemplatePartsMode = (0, _data.useSelect)(select => {
|
|
102
60
|
const settings = select(_store.store).getSettings();
|
|
@@ -105,45 +63,35 @@ function SidebarNavigationScreenTemplates() {
|
|
|
105
63
|
const {
|
|
106
64
|
records: templates,
|
|
107
65
|
isResolving: isLoading
|
|
108
|
-
} = (0, _coreData.useEntityRecords)('postType',
|
|
66
|
+
} = (0, _coreData.useEntityRecords)('postType', 'wp_template', {
|
|
109
67
|
per_page: -1
|
|
110
68
|
});
|
|
111
|
-
|
|
69
|
+
const sortedTemplates = templates ? [...templates] : [];
|
|
112
70
|
sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
|
|
113
|
-
|
|
114
|
-
if (config[postType].sortCallback) {
|
|
115
|
-
sortedTemplates = config[postType].sortCallback(sortedTemplates);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
71
|
const browseAllLink = (0, _link.useLink)({
|
|
119
|
-
path: '/
|
|
72
|
+
path: '/wp_template/all'
|
|
120
73
|
});
|
|
121
74
|
const canCreate = !isMobileViewport && !isTemplatePartsMode;
|
|
122
|
-
const isTemplateList = postType === 'wp_template';
|
|
123
75
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
124
76
|
isRoot: isTemplatePartsMode,
|
|
125
|
-
title:
|
|
126
|
-
description:
|
|
77
|
+
title: (0, _i18n.__)('Templates'),
|
|
78
|
+
description: (0, _i18n.__)('Express the layout of your site with templates'),
|
|
127
79
|
actions: canCreate && (0, _element.createElement)(_addNewTemplate.default, {
|
|
128
|
-
templateType:
|
|
80
|
+
templateType: 'wp_template',
|
|
129
81
|
toggleProps: {
|
|
130
82
|
as: _sidebarButton.default
|
|
131
83
|
}
|
|
132
84
|
}),
|
|
133
|
-
content: (0, _element.createElement)(_element.Fragment, null, isLoading &&
|
|
134
|
-
postType:
|
|
85
|
+
content: (0, _element.createElement)(_element.Fragment, null, isLoading && (0, _i18n.__)('Loading templates'), !isLoading && (0, _element.createElement)(_components.__experimentalItemGroup, null, !templates?.length && (0, _element.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No templates found')), sortedTemplates.map(template => (0, _element.createElement)(TemplateItem, {
|
|
86
|
+
postType: 'wp_template',
|
|
135
87
|
postId: template.id,
|
|
136
88
|
key: template.id,
|
|
137
|
-
withChevron: true
|
|
138
|
-
icon: !isTemplateList && (0, _editor.getTemplatePartIcon)(template.area)
|
|
89
|
+
withChevron: true
|
|
139
90
|
}, (0, _htmlEntities.decodeEntities)(template.title?.rendered || template.slug))))),
|
|
140
|
-
footer: !isMobileViewport && (0, _element.createElement)(
|
|
91
|
+
footer: !isMobileViewport && (0, _element.createElement)(_sidebarNavigationItem.default, {
|
|
141
92
|
withChevron: true,
|
|
142
93
|
...browseAllLink
|
|
143
|
-
},
|
|
144
|
-
as: "a",
|
|
145
|
-
href: "edit.php?post_type=wp_block"
|
|
146
|
-
}, config[postType].labels.reusableBlocks))
|
|
94
|
+
}, (0, _i18n.__)('Manage all templates'))
|
|
147
95
|
});
|
|
148
96
|
}
|
|
149
97
|
//# sourceMappingURL=index.js.map
|