@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
|
@@ -3,10 +3,11 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
7
7
|
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
8
9
|
import { pencil } from '@wordpress/icons';
|
|
9
|
-
import {
|
|
10
|
+
import { getQueryArgs } from '@wordpress/url';
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
12
13
|
*/
|
|
@@ -15,13 +16,15 @@ import SidebarButton from '../sidebar-button';
|
|
|
15
16
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
16
17
|
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
17
18
|
import usePatternDetails from './use-pattern-details';
|
|
18
|
-
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
19
19
|
import { store as editSiteStore } from '../../store';
|
|
20
20
|
import { unlock } from '../../lock-unlock';
|
|
21
21
|
export default function SidebarNavigationScreenPattern() {
|
|
22
22
|
const {
|
|
23
23
|
params
|
|
24
24
|
} = useNavigator();
|
|
25
|
+
const {
|
|
26
|
+
categoryType
|
|
27
|
+
} = getQueryArgs(window.location.href);
|
|
25
28
|
const {
|
|
26
29
|
postType,
|
|
27
30
|
postId
|
|
@@ -30,16 +33,18 @@ export default function SidebarNavigationScreenPattern() {
|
|
|
30
33
|
setCanvasMode
|
|
31
34
|
} = unlock(useDispatch(editSiteStore));
|
|
32
35
|
useInitEditedEntityFromURL();
|
|
33
|
-
const patternDetails = usePatternDetails(postType, postId);
|
|
34
|
-
|
|
36
|
+
const patternDetails = usePatternDetails(postType, postId); // The absence of a category type in the query params for template parts
|
|
37
|
+
// indicates the user has arrived at the template part via the "manage all"
|
|
38
|
+
// page and the back button should return them to that list page.
|
|
39
|
+
|
|
40
|
+
const backPath = !categoryType && postType === 'wp_template_part' ? '/wp_template_part/all' : '/patterns';
|
|
35
41
|
return createElement(SidebarNavigationScreen, {
|
|
36
42
|
actions: createElement(SidebarButton, {
|
|
37
43
|
onClick: () => setCanvasMode('edit'),
|
|
38
44
|
label: __('Edit'),
|
|
39
45
|
icon: pencil
|
|
40
46
|
}),
|
|
41
|
-
backPath:
|
|
42
|
-
content: content,
|
|
47
|
+
backPath: backPath,
|
|
43
48
|
...patternDetails
|
|
44
49
|
});
|
|
45
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"names":["__experimentalUseNavigator","useNavigator","useDispatch","__","pencil","getQueryArgs","SidebarButton","SidebarNavigationScreen","useInitEditedEntityFromURL","usePatternDetails","store","editSiteStore","unlock","SidebarNavigationScreenPattern","params","categoryType","window","location","href","postType","postId","setCanvasMode","patternDetails","backPath"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,0BAAP,MAAuC,wDAAvC;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,mBAAvB;AAEA,eAAe,SAASC,8BAAT,GAA0C;AACxD,QAAM;AAAEC,IAAAA;AAAF,MAAab,YAAY,EAA/B;AACA,QAAM;AAAEc,IAAAA;AAAF,MAAmBV,YAAY,CAAEW,MAAM,CAACC,QAAP,CAAgBC,IAAlB,CAArC;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAuBN,MAA7B;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAoBT,MAAM,CAAEV,WAAW,CAAES,aAAF,CAAb,CAAhC;AAEAH,EAAAA,0BAA0B;AAE1B,QAAMc,cAAc,GAAGb,iBAAiB,CAAEU,QAAF,EAAYC,MAAZ,CAAxC,CARwD,CAUxD;AACA;AACA;;AACA,QAAMG,QAAQ,GACb,CAAER,YAAF,IAAkBI,QAAQ,KAAK,kBAA/B,GACG,uBADH,GAEG,WAHJ;AAKA,SACC,cAAC,uBAAD;AACC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAME,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGlB,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGC;AAHR,MAFF;AAQC,IAAA,QAAQ,EAAGmB,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"]}
|
|
@@ -13,7 +13,9 @@ import { Icon } from '@wordpress/components';
|
|
|
13
13
|
|
|
14
14
|
import { useAddedBy } from '../list/added-by';
|
|
15
15
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
16
|
+
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
16
17
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
18
|
+
import { SidebarNavigationScreenDetailsPanel, SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
|
|
17
19
|
export default function usePatternDetails(postType, postId) {
|
|
18
20
|
const {
|
|
19
21
|
getDescription,
|
|
@@ -28,12 +30,12 @@ export default function usePatternDetails(postType, postId) {
|
|
|
28
30
|
|
|
29
31
|
if (!descriptionText && addedBy.text) {
|
|
30
32
|
descriptionText = sprintf( // translators: %s: pattern title e.g: "Header".
|
|
31
|
-
__('This is
|
|
33
|
+
__('This is the %s pattern.'), getTitle());
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
if (!descriptionText && postType === 'wp_block' && record?.title) {
|
|
35
37
|
descriptionText = sprintf( // translators: %s: user created pattern title e.g. "Footer".
|
|
36
|
-
__('This is
|
|
38
|
+
__('This is the %s pattern.'), record.title);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
const description = createElement(Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && createElement("span", {
|
|
@@ -55,9 +57,28 @@ export default function usePatternDetails(postType, postId) {
|
|
|
55
57
|
const footer = !!record?.modified ? createElement(SidebarNavigationScreenDetailsFooter, {
|
|
56
58
|
lastModifiedDateTime: record.modified
|
|
57
59
|
}) : null;
|
|
60
|
+
const details = [];
|
|
61
|
+
|
|
62
|
+
if (postType === 'wp_block') {
|
|
63
|
+
details.push({
|
|
64
|
+
label: __('Syncing'),
|
|
65
|
+
value: record.wp_pattern_sync_status === 'unsynced' ? __('Not synced') : __('Fully synced')
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const content = createElement(Fragment, null, !!details.length && createElement(SidebarNavigationScreenDetailsPanel, {
|
|
70
|
+
spacing: 5,
|
|
71
|
+
title: __('Details')
|
|
72
|
+
}, details.map(({
|
|
73
|
+
label,
|
|
74
|
+
value
|
|
75
|
+
}) => createElement(SidebarNavigationScreenDetailsPanelRow, {
|
|
76
|
+
key: label
|
|
77
|
+
}, createElement(SidebarNavigationScreenDetailsPanelLabel, null, label), createElement(SidebarNavigationScreenDetailsPanelValue, null, value)))), useNavigationMenuContent(postType, postId));
|
|
58
78
|
return {
|
|
59
79
|
title,
|
|
60
80
|
description,
|
|
81
|
+
content,
|
|
61
82
|
footer
|
|
62
83
|
};
|
|
63
84
|
}
|
package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["__","sprintf","_x","store","coreStore","useSelect","Icon","useAddedBy","useEditedEntityRecord","SidebarNavigationScreenDetailsFooter","usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","description","imageUrl","icon","isCustomized","footer","modified"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,oCAAP,MAAiD,6CAAjD;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"names":["__","sprintf","_x","store","coreStore","useSelect","Icon","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","usePatternDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","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":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AACA,OAAOC,oCAAP,MAAiD,6CAAjD;AACA,SACCC,mCADD,EAECC,sCAFD,EAGCC,wCAHD,EAICC,wCAJD,QAKO,4CALP;AAOA,eAAe,SAASC,iBAAT,CAA4BC,QAA5B,EAAsCC,MAAtC,EAA+C;AAC7D,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCZ,qBAAqB,CACjEQ,QADiE,EAEjEC,MAFiE,CAAlE;AAIA,QAAMI,YAAY,GAAGhB,SAAS,CAC3BiB,MAAF,IAAcA,MAAM,CAAElB,SAAF,CAAN,CAAoBmB,eAApB,EADe,EAE7B,EAF6B,CAA9B;AAIA,QAAMC,OAAO,GAAGjB,UAAU,CAAES,QAAF,EAAYC,MAAZ,CAA1B;AACA,QAAMQ,oBAAoB,GACzBD,OAAO,CAACE,IAAR,KAAiB,OAAjB,IAA4BN,MAAM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AIX,IAJJ;AAMA,QAAMC,OAAO,GAAG,EAAhB;;AAEA,MAAKtB,QAAQ,KAAK,UAAlB,EAA+B;AAC9BsB,IAAAA,OAAO,CAACC,IAAR,CAAc;AACbC,MAAAA,KAAK,EAAExC,EAAE,CAAE,SAAF,CADI;AAEbyC,MAAAA,KAAK,EACJrB,MAAM,CAACsB,sBAAP,KAAkC,UAAlC,GACG1C,EAAE,CAAE,YAAF,CADL,GAEGA,EAAE,CAAE,cAAF;AALO,KAAd;AAOA;;AAED,QAAM2C,OAAO,GACZ,8BACG,CAAC,CAAEL,OAAO,CAACM,MAAX,IACD,cAAC,mCAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,KAAK,EAAG5C,EAAE,CAAE,SAAF;AAFX,KAIGsC,OAAO,CAACO,GAAR,CAAa,CAAE;AAAEL,IAAAA,KAAF;AAASC,IAAAA;AAAT,GAAF,KACd,cAAC,sCAAD;AAAwC,IAAA,GAAG,EAAGD;AAA9C,KACC,cAAC,wCAAD,QACGA,KADH,CADD,EAIC,cAAC,wCAAD,QACGC,KADH,CAJD,CADC,CAJH,CAFF,EAkBGhC,wBAAwB,CAAEO,QAAF,EAAYC,MAAZ,CAlB3B,CADD;AAuBA,SAAO;AAAEY,IAAAA,KAAF;AAASG,IAAAA,WAAT;AAAsBW,IAAAA,OAAtB;AAA+BP,IAAAA;AAA/B,GAAP;AACA","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"]}
|
|
@@ -14,14 +14,14 @@ export default function CategoryItem({
|
|
|
14
14
|
type
|
|
15
15
|
}) {
|
|
16
16
|
const linkInfo = useLink({
|
|
17
|
-
path: '/
|
|
17
|
+
path: '/patterns',
|
|
18
18
|
categoryType: type,
|
|
19
19
|
categoryId: id
|
|
20
20
|
}, {
|
|
21
21
|
// Keep a record of where we came from in state so we can
|
|
22
|
-
// use the browser's back button to go back to
|
|
22
|
+
// use the browser's back button to go back to Patterns.
|
|
23
23
|
// See the implementation of the back button in patterns-list.
|
|
24
|
-
backPath: '/
|
|
24
|
+
backPath: '/patterns'
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
if (!count) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"names":["SidebarNavigationItem","useLink","CategoryItem","count","icon","id","isActive","label","type","linkInfo","path","categoryType","categoryId","backPath","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,qBAAP,MAAkC,4BAAlC;AACA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,eAAe,SAASC,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,GAAGR,OAAO,CACvB;AACCS,IAAAA,IAAI,EAAE,WADP;AAECC,IAAAA,YAAY,EAAEH,IAFf;AAGCI,IAAAA,UAAU,EAAEP;AAHb,GADuB,EAMvB;AACC;AACA;AACA;AACAQ,IAAAA,QAAQ,EAAE;AAJX,GANuB,CAAxB;;AAcA,MAAK,CAAEV,KAAP,EAAe;AACd;AACA;;AAED,SACC,cAAC,qBAAD,OACMM,QADN;AAEC,IAAA,IAAI,EAAGL,IAFR;AAGC,IAAA,MAAM,EAAG,4BAAQD,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,152 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, Flex, Icon, Tooltip, __experimentalHeading as Heading } from '@wordpress/components';
|
|
7
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
10
|
+
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { getQueryArgs } from '@wordpress/url';
|
|
12
|
+
import { file, starFilled, lockSmall } from '@wordpress/icons';
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import AddNewPattern from '../add-new-pattern';
|
|
18
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
20
|
+
import CategoryItem from './category-item';
|
|
21
|
+
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';
|
|
22
|
+
import { store as editSiteStore } from '../../store';
|
|
23
|
+
import { useLink } from '../routes/link';
|
|
24
|
+
import usePatternCategories from './use-pattern-categories';
|
|
25
|
+
import useMyPatterns from './use-my-patterns';
|
|
26
|
+
import useTemplatePartAreas from './use-template-part-areas';
|
|
27
|
+
|
|
28
|
+
function TemplatePartGroup({
|
|
29
|
+
areas,
|
|
30
|
+
currentArea,
|
|
31
|
+
currentType
|
|
32
|
+
}) {
|
|
33
|
+
return createElement(Fragment, null, createElement("div", {
|
|
34
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group-header"
|
|
35
|
+
}, createElement(Heading, {
|
|
36
|
+
level: 2
|
|
37
|
+
}, __('Template parts')), createElement("p", null, __('Synced patterns for use in template building.'))), createElement(ItemGroup, {
|
|
38
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
39
|
+
}, Object.entries(areas).map(([area, {
|
|
40
|
+
label,
|
|
41
|
+
templateParts
|
|
42
|
+
}]) => createElement(CategoryItem, {
|
|
43
|
+
key: area,
|
|
44
|
+
count: templateParts?.length,
|
|
45
|
+
icon: getTemplatePartIcon(area),
|
|
46
|
+
label: label,
|
|
47
|
+
id: area,
|
|
48
|
+
type: "wp_template_part",
|
|
49
|
+
isActive: currentArea === area && currentType === 'wp_template_part'
|
|
50
|
+
}))));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function ThemePatternsGroup({
|
|
54
|
+
categories,
|
|
55
|
+
currentCategory,
|
|
56
|
+
currentType
|
|
57
|
+
}) {
|
|
58
|
+
return createElement(Fragment, null, createElement("div", {
|
|
59
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group-header"
|
|
60
|
+
}, createElement(Heading, {
|
|
61
|
+
level: 2
|
|
62
|
+
}, __('Theme patterns')), createElement("p", null, __('For insertion into documents where they can then be customized.'))), createElement(ItemGroup, {
|
|
63
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
64
|
+
}, categories.map(category => createElement(CategoryItem, {
|
|
65
|
+
key: category.name,
|
|
66
|
+
count: category.count,
|
|
67
|
+
label: createElement(Flex, {
|
|
68
|
+
justify: "left",
|
|
69
|
+
align: "center",
|
|
70
|
+
gap: 0
|
|
71
|
+
}, category.label, createElement(Tooltip, {
|
|
72
|
+
position: "top center",
|
|
73
|
+
text: __('Theme patterns cannot be edited.')
|
|
74
|
+
}, createElement("span", {
|
|
75
|
+
className: "edit-site-sidebar-navigation-screen-pattern__lock-icon"
|
|
76
|
+
}, createElement(Icon, {
|
|
77
|
+
icon: lockSmall,
|
|
78
|
+
size: 24
|
|
79
|
+
})))),
|
|
80
|
+
icon: file,
|
|
81
|
+
id: category.name,
|
|
82
|
+
type: "pattern",
|
|
83
|
+
isActive: currentCategory === `${category.name}` && currentType === 'pattern'
|
|
84
|
+
}))));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default function SidebarNavigationScreenPatterns() {
|
|
88
|
+
const isMobileViewport = useViewportMatch('medium', '<');
|
|
89
|
+
const {
|
|
90
|
+
categoryType,
|
|
91
|
+
categoryId
|
|
92
|
+
} = getQueryArgs(window.location.href);
|
|
93
|
+
const currentCategory = categoryId || DEFAULT_CATEGORY;
|
|
94
|
+
const currentType = categoryType || DEFAULT_TYPE;
|
|
95
|
+
const {
|
|
96
|
+
templatePartAreas,
|
|
97
|
+
hasTemplateParts,
|
|
98
|
+
isLoading
|
|
99
|
+
} = useTemplatePartAreas();
|
|
100
|
+
const {
|
|
101
|
+
patternCategories,
|
|
102
|
+
hasPatterns
|
|
103
|
+
} = usePatternCategories();
|
|
104
|
+
const {
|
|
105
|
+
myPatterns,
|
|
106
|
+
hasPatterns: hasMyPatterns
|
|
107
|
+
} = useMyPatterns();
|
|
108
|
+
const isTemplatePartsMode = useSelect(select => {
|
|
109
|
+
const settings = select(editSiteStore).getSettings();
|
|
110
|
+
return !!settings.supportsTemplatePartsMode;
|
|
111
|
+
}, []);
|
|
112
|
+
const templatePartsLink = useLink({
|
|
113
|
+
path: '/wp_template_part/all'
|
|
114
|
+
});
|
|
115
|
+
const footer = !isMobileViewport ? createElement(ItemGroup, null, createElement(SidebarNavigationItem, {
|
|
116
|
+
withChevron: true,
|
|
117
|
+
...templatePartsLink
|
|
118
|
+
}, __('Manage all template parts')), createElement(SidebarNavigationItem, {
|
|
119
|
+
as: "a",
|
|
120
|
+
href: "edit.php?post_type=wp_block",
|
|
121
|
+
withChevron: true
|
|
122
|
+
}, __('Manage all of my patterns'))) : undefined;
|
|
123
|
+
return createElement(SidebarNavigationScreen, {
|
|
124
|
+
isRoot: isTemplatePartsMode,
|
|
125
|
+
title: __('Patterns'),
|
|
126
|
+
description: __('Manage what patterns are available when editing the site.'),
|
|
127
|
+
actions: createElement(AddNewPattern, null),
|
|
128
|
+
footer: footer,
|
|
129
|
+
content: createElement(Fragment, null, isLoading && __('Loading patterns'), !isLoading && createElement(Fragment, null, !hasTemplateParts && !hasPatterns && createElement(ItemGroup, {
|
|
130
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
131
|
+
}, createElement(Item, null, __('No template parts or patterns found'))), hasMyPatterns && createElement(ItemGroup, {
|
|
132
|
+
className: "edit-site-sidebar-navigation-screen-patterns__group"
|
|
133
|
+
}, createElement(CategoryItem, {
|
|
134
|
+
key: myPatterns.name,
|
|
135
|
+
count: myPatterns.count,
|
|
136
|
+
label: myPatterns.label,
|
|
137
|
+
icon: starFilled,
|
|
138
|
+
id: myPatterns.name,
|
|
139
|
+
type: "wp_block",
|
|
140
|
+
isActive: currentCategory === `${myPatterns.name}` && currentType === 'wp_block'
|
|
141
|
+
})), hasTemplateParts && createElement(TemplatePartGroup, {
|
|
142
|
+
areas: templatePartAreas,
|
|
143
|
+
currentArea: currentCategory,
|
|
144
|
+
currentType: currentType
|
|
145
|
+
}), hasPatterns && createElement(ThemePatternsGroup, {
|
|
146
|
+
categories: patternCategories,
|
|
147
|
+
currentCategory: currentCategory,
|
|
148
|
+
currentType: currentType
|
|
149
|
+
})))
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","Flex","Icon","Tooltip","__experimentalHeading","Heading","useViewportMatch","useSelect","getTemplatePartIcon","__","getQueryArgs","file","starFilled","lockSmall","AddNewPattern","SidebarNavigationItem","SidebarNavigationScreen","CategoryItem","DEFAULT_CATEGORY","DEFAULT_TYPE","store","editSiteStore","useLink","usePatternCategories","useMyPatterns","useTemplatePartAreas","TemplatePartGroup","areas","currentArea","currentType","Object","entries","map","area","label","templateParts","length","ThemePatternsGroup","categories","currentCategory","category","name","count","SidebarNavigationScreenPatterns","isMobileViewport","categoryType","categoryId","window","location","href","templatePartAreas","hasTemplateParts","isLoading","patternCategories","hasPatterns","myPatterns","hasMyPatterns","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","templatePartsLink","path","footer","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,IAHD,EAICC,IAJD,EAKCC,OALD,EAMCC,qBAAqB,IAAIC,OAN1B,QAOO,uBAPP;AAQA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,mBAAT,QAAoC,mBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,gBAA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,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,2DADe,CAHjB;AAMC,IAAA,OAAO,EAAG,cAAC,aAAD,OANX;AAOC,IAAA,MAAM,EAAGuD,MAPV;AAQC,IAAA,OAAO,EACN,8BACGZ,SAAS,IAAI3C,EAAE,CAAE,kBAAF,CADlB,EAEG,CAAE2C,SAAF,IACD,8BACG,CAAED,gBAAF,IAAsB,CAAEG,WAAxB,IACD,cAAC,SAAD;AAAW,MAAA,SAAS,EAAC;AAArB,OACC,cAAC,IAAD,QACG7C,EAAE,CACH,qCADG,CADL,CADD,CAFF,EAUG+C,aAAa,IACd,cAAC,SAAD;AAAW,MAAA,SAAS,EAAC;AAArB,OACC,cAAC,YAAD;AACC,MAAA,GAAG,EAAGD,UAAU,CAACd,IADlB;AAEC,MAAA,KAAK,EAAGc,UAAU,CAACb,KAFpB;AAGC,MAAA,KAAK,EAAGa,UAAU,CAACrB,KAHpB;AAIC,MAAA,IAAI,EAAGtB,UAJR;AAKC,MAAA,EAAE,EAAG2C,UAAU,CAACd,IALjB;AAMC,MAAA,IAAI,EAAC,UANN;AAOC,MAAA,QAAQ,EACPF,eAAe,KACb,GAAGgB,UAAU,CAACd,IAAM,EADtB,IAEAZ,WAAW,KAAK;AAVlB,MADD,CAXF,EA2BGsB,gBAAgB,IACjB,cAAC,iBAAD;AACC,MAAA,KAAK,EAAGD,iBADT;AAEC,MAAA,WAAW,EAAGX,eAFf;AAGC,MAAA,WAAW,EAAGV;AAHf,MA5BF,EAkCGyB,WAAW,IACZ,cAAC,kBAAD;AACC,MAAA,UAAU,EAAGD,iBADd;AAEC,MAAA,eAAe,EAAGd,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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js"],"names":["store","coreStore","useSelect","unlock","editSiteStore","useDefaultPatternCategories","blockPatternCategories","select","getSettings","settings","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatternCategories","getBlockPatternCategories"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAMC,sBAAsB,GAAGJ,SAAS,CAAIK,MAAF,IAAc;AAAA;;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEI,MAAM,CAAEH,aAAF,CAAR,CAA9B;AACA,UAAMK,QAAQ,GAAGD,WAAW,EAA5B;AAEA,oCACCC,QAAQ,CAACC,8CADV,yEAECD,QAAQ,CAACE,oCAFV;AAIA,GARuC,CAAxC;AAUA,QAAMC,0BAA0B,GAAGV,SAAS,CAAIK,MAAF,IAC7CA,MAAM,CAAEN,SAAF,CAAN,CAAoBY,yBAApB,EAD2C,CAA5C;AAIA,SAAO,CACN,IAAKP,sBAAsB,IAAI,EAA/B,CADM,EAEN,IAAKM,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,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
export default function useMyPatterns() {
|
|
8
|
+
const myPatterns = useSelect(select => select(coreStore).getEntityRecords('postType', 'wp_block', {
|
|
9
|
+
per_page: -1
|
|
10
|
+
}));
|
|
11
|
+
return {
|
|
12
|
+
myPatterns: {
|
|
13
|
+
count: myPatterns?.length || 0,
|
|
14
|
+
name: 'my-patterns',
|
|
15
|
+
label: __('My patterns')
|
|
16
|
+
},
|
|
17
|
+
hasPatterns: !!myPatterns?.length
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# 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":["store","coreStore","useSelect","__","useMyPatterns","myPatterns","select","getEntityRecords","per_page","count","length","name","label","hasPatterns"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,eAAe,SAASC,aAAT,GAAyB;AACvC,QAAMC,UAAU,GAAGH,SAAS,CAAII,MAAF,IAC7BA,MAAM,CAAEL,SAAF,CAAN,CAAoBM,gBAApB,CAAsC,UAAtC,EAAkD,UAAlD,EAA8D;AAC7DC,IAAAA,QAAQ,EAAE,CAAC;AADkD,GAA9D,CAD2B,CAA5B;AAMA,SAAO;AACNH,IAAAA,UAAU,EAAE;AACXI,MAAAA,KAAK,EAAEJ,UAAU,EAAEK,MAAZ,IAAsB,CADlB;AAEXC,MAAAA,IAAI,EAAE,aAFK;AAGXC,MAAAA,KAAK,EAAET,EAAE,CAAE,aAAF;AAHE,KADN;AAMNU,IAAAA,WAAW,EAAE,CAAC,CAAER,UAAU,EAAEK;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"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
4
|
import { useMemo } from '@wordpress/element';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
5
|
/**
|
|
9
6
|
* Internal dependencies
|
|
10
7
|
*/
|
|
@@ -14,9 +11,6 @@ import useThemePatterns from './use-theme-patterns';
|
|
|
14
11
|
export default function usePatternCategories() {
|
|
15
12
|
const defaultCategories = useDefaultPatternCategories();
|
|
16
13
|
const themePatterns = useThemePatterns();
|
|
17
|
-
const userPatterns = useSelect(select => select(coreStore).getEntityRecords('postType', 'wp_block', {
|
|
18
|
-
per_page: -1
|
|
19
|
-
}));
|
|
20
14
|
const patternCategories = useMemo(() => {
|
|
21
15
|
const categoryMap = {};
|
|
22
16
|
const categoriesWithCounts = []; // Create a map for easier counting of patterns in categories.
|
|
@@ -41,18 +35,9 @@ export default function usePatternCategories() {
|
|
|
41
35
|
if (categoryMap[category.name].count) {
|
|
42
36
|
categoriesWithCounts.push(categoryMap[category.name]);
|
|
43
37
|
}
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (userPatterns?.length) {
|
|
47
|
-
categoriesWithCounts.push({
|
|
48
|
-
count: userPatterns.length || 0,
|
|
49
|
-
name: 'custom-patterns',
|
|
50
|
-
label: __('Custom patterns')
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
38
|
+
});
|
|
54
39
|
return categoriesWithCounts;
|
|
55
|
-
}, [defaultCategories, themePatterns
|
|
40
|
+
}, [defaultCategories, themePatterns]);
|
|
56
41
|
return {
|
|
57
42
|
patternCategories,
|
|
58
43
|
hasPatterns: !!patternCategories.length
|
package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js"],"names":["useMemo","useDefaultPatternCategories","useThemePatterns","usePatternCategories","defaultCategories","themePatterns","patternCategories","categoryMap","categoriesWithCounts","forEach","category","name","count","pattern","categories","push","hasPatterns","length"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,2BAAP,MAAwC,kCAAxC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AAEA,eAAe,SAASC,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ordPress 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,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
+
|
|
8
|
+
const useTemplatePartsGroupedByArea = items => {
|
|
9
|
+
const allItems = items || [];
|
|
10
|
+
const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []); // Create map of template areas ensuring that default areas are displayed before
|
|
11
|
+
// any custom registered template part areas.
|
|
12
|
+
|
|
13
|
+
const knownAreas = {
|
|
14
|
+
header: {},
|
|
15
|
+
footer: {},
|
|
16
|
+
sidebar: {},
|
|
17
|
+
uncategorized: {}
|
|
18
|
+
};
|
|
19
|
+
templatePartAreas.forEach(templatePartArea => knownAreas[templatePartArea.area] = { ...templatePartArea,
|
|
20
|
+
templateParts: []
|
|
21
|
+
});
|
|
22
|
+
const groupedByArea = allItems.reduce((accumulator, item) => {
|
|
23
|
+
const key = accumulator[item.area] ? item.area : 'uncategorized';
|
|
24
|
+
accumulator[key].templateParts.push(item);
|
|
25
|
+
return accumulator;
|
|
26
|
+
}, knownAreas);
|
|
27
|
+
return groupedByArea;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default function useTemplatePartAreas() {
|
|
31
|
+
const {
|
|
32
|
+
records: templateParts,
|
|
33
|
+
isResolving: isLoading
|
|
34
|
+
} = useEntityRecords('postType', 'wp_template_part', {
|
|
35
|
+
per_page: -1
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
hasTemplateParts: templateParts ? !!templateParts.length : false,
|
|
39
|
+
isLoading,
|
|
40
|
+
templatePartAreas: useTemplatePartsGroupedByArea(templateParts)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=use-template-part-areas.js.map
|
package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js"],"names":["useEntityRecords","useSelect","store","editorStore","useTemplatePartsGroupedByArea","items","allItems","templatePartAreas","select","__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":"AAAA;AACA;AACA;A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AE,CAAC;AAAb,GAH0E,CAA3E;AAMA,SAAO;AACNC,IAAAA,gBAAgB,EAAEZ,aAAa,GAAG,CAAC,CAAEA,aAAa,CAACa,MAApB,GAA6B,KADtD;AAENH,IAAAA,SAFM;AAGNrB,IAAAA,iBAAiB,EAAEH,6BAA6B,CAAEc,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"]}
|
|
@@ -8,7 +8,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { CORE_PATTERN_SOURCES, filterOutDuplicatesByName } from '../page-
|
|
11
|
+
import { CORE_PATTERN_SOURCES, filterOutDuplicatesByName } from '../page-patterns/utils';
|
|
12
12
|
import { unlock } from '../../lock-unlock';
|
|
13
13
|
import { store as editSiteStore } from '../../store';
|
|
14
14
|
export default function useThemePatterns() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js"],"names":["store","coreStore","useSelect","useMemo","CORE_PATTERN_SOURCES","filterOutDuplicatesByName","unlock","editSiteStore","useThemePatterns","blockPatterns","select","getSettings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","patterns","filter","pattern","includes","source"],"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,SACCC,oBADD,EAECC,yBAFD,QAGO,wBAHP;AAIA,SAASC,MAAT,QAAuB,mBAAvB;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,gBAAT,GAA4B;AAC1C,QAAMC,aAAa,GAAGP,SAAS,CAAIQ,MAAF,IAAc;AAAA;;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QAAkBL,MAAM,CAAEI,MAAM,CAAEH,aAAF,CAAR,CAA9B;AAEA,oCACCI,WAAW,GAAGC,qCADf,yEAECD,WAAW,GAAGE,2BAFf;AAIA,GAP8B,CAA/B;AASA,QAAMC,iBAAiB,GAAGZ,SAAS,CAAIQ,MAAF,IACpCA,MAAM,CAAET,SAAF,CAAN,CAAoBc,gBAApB,EADkC,CAAnC;AAIA,QAAMC,QAAQ,GAAGb,OAAO,CACvB,MACC,CAAE,IAAKM,aAAa,IAAI,EAAtB,CAAF,EAA8B,IAAKK,iBAAiB,IAAI,EAA1B,CAA9B,EACEG,MADF,CAEIC,OAAF,IACC,CAAEd,oBAAoB,CAACe,QAArB,CAA+BD,OAAO,CAACE,MAAvC,CAHL,EAKEH,MALF,CAKUZ,yBALV,CAFsB,EAQvB,CAAEI,aAAF,EAAiBK,iBAAjB,CARuB,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 {\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"]}
|