@wordpress/edit-site 5.12.5 → 5.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template.js +1 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +10 -5
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +8 -8
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -2
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +1 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page/index.js +3 -1
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-main/index.js +8 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/{page-library → page-patterns}/grid-item.js +52 -27
- package/build/components/page-patterns/grid-item.js.map +1 -0
- package/build/components/{page-library → page-patterns}/grid.js +1 -1
- package/build/components/page-patterns/grid.js.map +1 -0
- package/build/components/{page-library → page-patterns}/index.js +6 -6
- package/build/components/page-patterns/index.js.map +1 -0
- package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build/components/page-patterns/no-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/patterns-list.js +9 -9
- package/build/components/page-patterns/patterns-list.js.map +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -0
- package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build/components/{page-library → page-patterns}/use-patterns.js +4 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/utils.js +3 -3
- package/build/components/page-patterns/utils.js.map +1 -0
- package/build/components/page-template-parts/index.js +103 -0
- package/build/components/page-template-parts/index.js.map +1 -0
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/sidebar/index.js +6 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +63 -11
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +5 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +25 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js +177 -0
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +52 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +1 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +22 -6
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +70 -0
- package/build/components/welcome-guide/page.js.map +1 -0
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +71 -0
- package/build/components/welcome-guide/template.js.map +1 -0
- package/build/hooks/commands/use-common-commands.js +17 -2
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +3 -3
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +2 -2
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +2 -2
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +10 -5
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +8 -8
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -2
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +1 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page/index.js +2 -1
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-main/index.js +6 -3
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/{page-library → page-patterns}/grid-item.js +56 -29
- package/build-module/components/page-patterns/grid-item.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
- package/build-module/components/page-patterns/grid.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build-module/components/page-patterns/no-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/patterns-list.js +9 -9
- package/build-module/components/page-patterns/patterns-list.js.map +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -0
- package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/use-patterns.js +4 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
- package/build-module/components/page-patterns/utils.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +82 -0
- package/build-module/components/page-template-parts/index.js.map +1 -0
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +5 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +62 -11
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +5 -4
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +6 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +15 -5
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -2
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +152 -0
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +43 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +1 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +24 -7
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +59 -0
- package/build-module/components/welcome-guide/page.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +60 -0
- package/build-module/components/welcome-guide/template.js.map +1 -0
- package/build-module/hooks/commands/use-common-commands.js +16 -2
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +3 -3
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +2 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +2 -2
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +90 -32
- package/build-style/style.css +90 -32
- package/package.json +19 -19
- package/src/components/add-new-template/new-template.js +2 -2
- package/src/components/block-editor/editor-canvas.js +3 -1
- package/src/components/block-editor/use-site-editor-settings.js +8 -4
- package/src/components/create-pattern-modal/index.js +10 -11
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/header-edit-mode/document-actions/index.js +9 -1
- package/src/components/header-edit-mode/document-actions/style.scss +8 -0
- package/src/components/header-edit-mode/index.js +17 -9
- package/src/components/layout/index.js +1 -1
- package/src/components/layout/style.scss +0 -11
- package/src/components/page/header.js +1 -1
- package/src/components/page/index.js +5 -1
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-main/index.js +6 -3
- package/src/components/{page-library → page-patterns}/grid-item.js +79 -24
- package/src/components/{page-library → page-patterns}/grid.js +1 -1
- package/src/components/{page-library → page-patterns}/index.js +5 -5
- package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/src/components/{page-library → page-patterns}/patterns-list.js +9 -9
- package/src/components/{page-library → page-patterns}/style.scss +16 -12
- package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
- package/src/components/{page-library → page-patterns}/use-patterns.js +5 -2
- package/src/components/{page-library → page-patterns}/utils.js +3 -3
- package/src/components/page-template-parts/index.js +105 -0
- package/src/components/page-templates/index.js +1 -1
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
- package/src/components/sidebar-navigation-screen/style.scss +19 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +54 -26
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +36 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +2 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +10 -6
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +12 -4
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
- package/src/components/sidebar-navigation-screen-pattern/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +45 -3
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +199 -0
- package/src/components/sidebar-navigation-screen-patterns/style.scss +28 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +55 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
- package/src/components/site-hub/index.js +1 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/src/components/template-actions/index.js +38 -8
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/index.js +4 -0
- package/src/components/welcome-guide/page.js +75 -0
- package/src/components/welcome-guide/style.scss +15 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/components/welcome-guide/template.js +82 -0
- package/src/hooks/commands/use-common-commands.js +13 -1
- package/src/hooks/commands/use-edit-mode-commands.js +5 -2
- package/src/index.js +2 -0
- package/src/store/actions.js +8 -1
- package/src/store/private-actions.js +5 -1
- package/src/style.scss +2 -2
- package/src/utils/get-is-list-page.js +4 -3
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build/components/page-library/grid-item.js.map +0 -1
- package/build/components/page-library/grid.js.map +0 -1
- package/build/components/page-library/index.js.map +0 -1
- package/build/components/page-library/no-patterns.js.map +0 -1
- package/build/components/page-library/patterns-list.js.map +0 -1
- package/build/components/page-library/search-items.js.map +0 -1
- package/build/components/page-library/use-library-settings.js.map +0 -1
- package/build/components/page-library/use-patterns.js.map +0 -1
- package/build/components/page-library/utils.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/index.js +0 -112
- package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -41
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/page-library/grid-item.js.map +0 -1
- package/build-module/components/page-library/grid.js.map +0 -1
- package/build-module/components/page-library/index.js.map +0 -1
- package/build-module/components/page-library/no-patterns.js.map +0 -1
- package/build-module/components/page-library/patterns-list.js.map +0 -1
- package/build-module/components/page-library/search-items.js.map +0 -1
- package/build-module/components/page-library/use-library-settings.js.map +0 -1
- package/build-module/components/page-library/use-patterns.js.map +0 -1
- package/build-module/components/page-library/utils.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/index.js +0 -87
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -34
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/src/components/page-content-focus-manager/constants.js +0 -5
- package/src/components/sidebar-navigation-screen-library/index.js +0 -136
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -3
- package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -33
- /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/search-items.js"],"names":["defaultGetName","item","name","defaultGetTitle","title","defaultGetDescription","description","defaultGetKeywords","keywords","defaultHasCategory","extractWords","input","splitRegexp","stripRegexp","split","filter","Boolean","normalizeSearchInput","replace","toLowerCase","getNormalizedSearchTerms","removeMatchingTerms","unmatchedTerms","unprocessedTerms","term","some","unprocessedTerm","includes","searchItems","items","searchInput","config","normalizedSearchTerms","onlyFilterByCategory","length","searchRankConfig","threshold","rankedItems","map","getItemSearchRank","rank","sort","rank1","rank2","searchTerm","categoryId","getName","getTitle","getDescription","getKeywords","hasCategory","normalizedSearchInput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AK,GAAG,CAAEpD,IAAF,EAAQE,KAAR,EAAeE,WAAf,EAA4B,GAAGE,QAA/B,EAA0C+C,IAA1C,CAAgD,GAAhD,CAAd;AACA,UAAMvB,qBAAqB,GAAGtB,YAAY,CAAEyC,qBAAF,CAA1C;AACA,UAAM7B,cAAc,GAAGD,mBAAmB,CACzCW,qBADyC,EAEzCsB,KAFyC,CAA1C;;AAKA,QAAKhC,cAAc,CAACY,MAAf,KAA0B,CAA/B,EAAmC;AAClCM,MAAAA,IAAI,IAAI,EAAR;AACA;AACD;;AAED,SAAOA,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { noCase } from 'change-case';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultHasCategory = () => false;\n\n/**\n * Extracts words from an input string.\n *\n * @param {string} input The input string.\n *\n * @return {Array} Words, extracted from the input string.\n */\nfunction extractWords( input = '' ) {\n\treturn noCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/([\\p{Ll}\\p{Lo}\\p{N}])([\\p{Lu}\\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.\n\t\t\t/([\\p{Lu}\\p{Lt}])([\\p{Lu}\\p{Lt}][\\p{Ll}\\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.\n\t\t],\n\t\tstripRegexp: /(\\p{C}|\\p{P}|\\p{S})+/giu, // Anything that's not a punctuation, symbol or control/format character.\n\t} )\n\t\t.split( ' ' )\n\t\t.filter( Boolean );\n}\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nfunction normalizeSearchInput( input = '' ) {\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tinput = removeAccents( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tinput = input.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tinput = input.toLowerCase();\n\n\treturn input;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\treturn extractWords( normalizeSearchInput( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\n\t);\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tconst onlyFilterByCategory = ! normalizedSearchTerms.length;\n\tconst searchRankConfig = { ...config, onlyFilterByCategory };\n\n\t// If we aren't filtering on search terms, matching on category is satisfactory.\n\t// If we are, then we need more than a category match.\n\tconst threshold = onlyFilterByCategory ? 0 : 1;\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [\n\t\t\t\titem,\n\t\t\t\tgetItemSearchRank( item, searchInput, searchRankConfig ),\n\t\t\t];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > threshold );\n\n\t// If we didn't have terms to search on, there's no point sorting.\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn rankedItems.map( ( [ item ] ) => item );\n\t}\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nfunction getItemSearchRank( item, searchTerm, config ) {\n\tconst {\n\t\tcategoryId,\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\thasCategory = defaultHasCategory,\n\t\tonlyFilterByCategory,\n\t} = config;\n\n\tlet rank = hasCategory( item, categoryId ) ? 1 : 0;\n\n\t// If an item doesn't belong to the current category or we don't have\n\t// search terms to filter by, return the initial rank value.\n\tif ( ! rank || onlyFilterByCategory ) {\n\t\treturn rank;\n\t}\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\n\tconst normalizedSearchInput = normalizeSearchInput( searchTerm );\n\tconst normalizedTitle = normalizeSearchInput( title );\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, description matches come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [ name, title, description, ...keywords ].join( ' ' );\n\t\tconst normalizedSearchTerms = extractWords( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\treturn rank;\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = usePatternSettings;
|
|
7
7
|
|
|
8
8
|
var _coreData = require("@wordpress/core-data");
|
|
9
9
|
|
|
@@ -24,7 +24,7 @@ var _utils = require("./utils");
|
|
|
24
24
|
/**
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
27
|
+
function usePatternSettings() {
|
|
28
28
|
var _storedSettings$__exp;
|
|
29
29
|
|
|
30
30
|
const storedSettings = (0, _data.useSelect)(select => {
|
|
@@ -50,4 +50,4 @@ function useLibrarySettings() {
|
|
|
50
50
|
}, [storedSettings, blockPatterns]);
|
|
51
51
|
return settings;
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=use-
|
|
53
|
+
//# sourceMappingURL=use-pattern-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/use-pattern-settings.js"],"names":["usePatternSettings","storedSettings","select","getSettings","editSiteStore","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","coreStore","getBlockPatterns","blockPatterns","filter","filterOutDuplicatesByName","settings","restStoredSettings","__unstableIsPreviewMode"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAKe,SAASA,kBAAT,GAA8B;AAAA;;AAC5C,QAAMC,cAAc,GAAG,qBAAaC,MAAF,IAAc;AAC/C,UAAM;AAAEC,MAAAA;AAAF,QAAkB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AACA,WAAOD,WAAW,EAAlB;AACA,GAHsB,EAGpB,EAHoB,CAAvB;AAKA,QAAME,qBAAqB,4BAC1BJ,cAAc,CAACK,qCADW,yEAC8B;AACxDL,EAAAA,cAAc,CAACM,2BAFhB,CAN4C,CAQC;;AAE7C,QAAMC,iBAAiB,GAAG,qBACvBN,MAAF,IAAcA,MAAM,CAAEO,eAAF,CAAN,CAAoBC,gBAApB,EADW,EAEzB,EAFyB,CAA1B;AAKA,QAAMC,aAAa,GAAG,sBACrB,MACC,CACC,IAAKN,qBAAqB,IAAI,EAA9B,CADD,EAEC,IAAKG,iBAAiB,IAAI,EAA1B,CAFD,EAGEI,MAHF,CAGUC,gCAHV,CAFoB,EAMrB,CAAER,qBAAF,EAAyBG,iBAAzB,CANqB,CAAtB;AASA,QAAMM,QAAQ,GAAG,sBAAS,MAAM;AAC/B,UAAM;AAAER,MAAAA,qCAAF;AAAyC,SAAGS;AAA5C,QACLd,cADD;AAGA,WAAO,EACN,GAAGc,kBADG;AAENR,MAAAA,2BAA2B,EAAEI,aAFvB;AAGNK,MAAAA,uBAAuB,EAAE;AAHnB,KAAP;AAKA,GATgB,EASd,CAAEf,cAAF,EAAkBU,aAAlB,CATc,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 { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport { filterOutDuplicatesByName } from './utils';\n\nexport default function usePatternSettings() {\n\tconst storedSettings = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn getSettings();\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\n\tconst restBlockPatterns = useSelect(\n\t\t( select ) => select( coreStore ).getBlockPatterns(),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t].filter( filterOutDuplicatesByName ),\n\t\t[ settingsBlockPatterns, restBlockPatterns ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst { __experimentalAdditionalBlockPatterns, ...restStoredSettings } =\n\t\t\tstoredSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__unstableIsPreviewMode: true,\n\t\t};\n\t}, [ storedSettings, blockPatterns ] );\n\n\treturn settings;\n}\n"]}
|
|
@@ -43,6 +43,8 @@ const templatePartToPattern = templatePart => ({
|
|
|
43
43
|
templatePart
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
+
const templatePartHasCategory = (item, category) => item.templatePart.area === category;
|
|
47
|
+
|
|
46
48
|
const useTemplatePartsAsPatterns = (categoryId, postType = _utils.TEMPLATE_PARTS, filterValue = '') => {
|
|
47
49
|
const {
|
|
48
50
|
templateParts,
|
|
@@ -76,7 +78,7 @@ const useTemplatePartsAsPatterns = (categoryId, postType = _utils.TEMPLATE_PARTS
|
|
|
76
78
|
|
|
77
79
|
return (0, _searchItems.searchItems)(templateParts, filterValue, {
|
|
78
80
|
categoryId,
|
|
79
|
-
hasCategory:
|
|
81
|
+
hasCategory: templatePartHasCategory
|
|
80
82
|
});
|
|
81
83
|
}, [templateParts, filterValue, categoryId]);
|
|
82
84
|
return {
|
|
@@ -119,7 +121,7 @@ const reusableBlockToPattern = reusableBlock => ({
|
|
|
119
121
|
categories: reusableBlock.wp_pattern,
|
|
120
122
|
id: reusableBlock.id,
|
|
121
123
|
name: reusableBlock.slug,
|
|
122
|
-
syncStatus: reusableBlock.
|
|
124
|
+
syncStatus: reusableBlock.wp_pattern_sync_status || _utils.SYNC_TYPES.full,
|
|
123
125
|
title: reusableBlock.title.raw,
|
|
124
126
|
type: reusableBlock.type,
|
|
125
127
|
reusableBlock
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/use-patterns.js"],"names":["EMPTY_PATTERN_LIST","createTemplatePartId","theme","slug","templatePartToPattern","templatePart","blocks","content","raw","categories","area","description","keywords","name","title","rendered","type","templatePartHasCategory","item","category","useTemplatePartsAsPatterns","categoryId","postType","TEMPLATE_PARTS","filterValue","templateParts","isResolving","select","getEntityRecords","_isResolving","coreStore","query","per_page","rawTemplateParts","partsAsPatterns","map","filteredTemplateParts","hasCategory","useThemePatterns","PATTERNS","blockPatterns","getSettings","editSiteStore","settings","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","patterns","filter","pattern","CORE_PATTERN_SOURCES","includes","source","filterOutDuplicatesByName","filteredPatterns","currentCategory","reusableBlockToPattern","reusableBlock","wp_pattern","id","syncStatus","wp_pattern_sync_status","SYNC_TYPES","full","useUserPatterns","categoryType","USER_PATTERNS","unfilteredPatterns","USER_PATTERN_CATEGORY","records","record","length","syncedPatterns","unsyncedPatterns","forEach","push","usePatterns"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AASA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAMA;AACA;AACA;AAcA,MAAMA,kBAAkB,GAAG,EAA3B;;AAEA,MAAMC,oBAAoB,GAAG,CAAEC,KAAF,EAASC,IAAT,KAC5BD,KAAK,IAAIC,IAAT,GAAgBD,KAAK,GAAG,IAAR,GAAeC,IAA/B,GAAsC,IADvC;;AAGA,MAAMC,qBAAqB,GAAKC,YAAF,KAAsB;AACnDC,EAAAA,MAAM,EAAE,mBAAOD,YAAY,CAACE,OAAb,CAAqBC,GAA5B,CAD2C;AAEnDC,EAAAA,UAAU,EAAE,CAAEJ,YAAY,CAACK,IAAf,CAFuC;AAGnDC,EAAAA,WAAW,EAAEN,YAAY,CAACM,WAAb,IAA4B,EAHU;AAInDC,EAAAA,QAAQ,EAAEP,YAAY,CAACO,QAAb,IAAyB,EAJgB;AAKnDC,EAAAA,IAAI,EAAEZ,oBAAoB,CAAEI,YAAY,CAACH,KAAf,EAAsBG,YAAY,CAACF,IAAnC,CALyB;AAMnDW,EAAAA,KAAK,EAAET,YAAY,CAACS,KAAb,CAAmBC,QANyB;AAOnDC,EAAAA,IAAI,EAAEX,YAAY,CAACW,IAPgC;AAQnDX,EAAAA;AARmD,CAAtB,CAA9B;;AAWA,M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jB,UADqC,EAErC6C,YAFqC,EAGrC1C,WAHqC,CAAtC;AAMA,QAAM;AAAEiD,IAAAA,cAAc,GAAG,EAAnB;AAAuBC,IAAAA,gBAAgB,GAAG;AAA1C,MAAiDT,eAAe,CACrE5C,UADqE,EAErE6C,YAFqE,EAGrE1C,WAHqE,CAAtE;AAMA,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAiCN,0BAA0B,CAChEC,UADgE,EAEhE6C,YAFgE,EAGhE1C,WAHgE,CAAjE;AAMA,QAAMwB,QAAQ,GAAG;AAChByB,IAAAA,cAAc,EAAE,CAAE,GAAGhD,aAAL,EAAoB,GAAGgD,cAAvB,CADA;AAEhBC,IAAAA,gBAAgB,EAAE,CAAE,GAAGlC,aAAL,EAAoB,GAAGkC,gBAAvB;AAFF,GAAjB;AAKA,SAAO,CAAE1B,QAAF,EAAYtB,WAAZ,CAAP;AACA,CAzBM;;;eA2BQmD,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCORE_PATTERN_SOURCES,\n\tPATTERNS,\n\tSYNC_TYPES,\n\tTEMPLATE_PARTS,\n\tUSER_PATTERNS,\n\tUSER_PATTERN_CATEGORY,\n\tfilterOutDuplicatesByName,\n} from './utils';\nimport { unlock } from '../../lock-unlock';\nimport { searchItems } from './search-items';\nimport { store as editSiteStore } from '../../store';\n\nconst EMPTY_PATTERN_LIST = [];\n\nconst createTemplatePartId = ( theme, slug ) =>\n\ttheme && slug ? theme + '//' + slug : null;\n\nconst templatePartToPattern = ( templatePart ) => ( {\n\tblocks: parse( templatePart.content.raw ),\n\tcategories: [ templatePart.area ],\n\tdescription: templatePart.description || '',\n\tkeywords: templatePart.keywords || [],\n\tname: createTemplatePartId( templatePart.theme, templatePart.slug ),\n\ttitle: templatePart.title.rendered,\n\ttype: templatePart.type,\n\ttemplatePart,\n} );\n\nconst templatePartHasCategory = ( item, category ) =>\n\titem.templatePart.area === category;\n\nconst useTemplatePartsAsPatterns = (\n\tcategoryId,\n\tpostType = TEMPLATE_PARTS,\n\tfilterValue = ''\n) => {\n\tconst { templateParts, isResolving } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( postType !== TEMPLATE_PARTS ) {\n\t\t\t\treturn {\n\t\t\t\t\ttemplateParts: EMPTY_PATTERN_LIST,\n\t\t\t\t\tisResolving: false,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst { getEntityRecords, isResolving: _isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst query = { per_page: -1 };\n\t\t\tconst rawTemplateParts = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tquery\n\t\t\t);\n\t\t\tconst partsAsPatterns = rawTemplateParts?.map( ( templatePart ) =>\n\t\t\t\ttemplatePartToPattern( templatePart )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\ttemplateParts: partsAsPatterns,\n\t\t\t\tisResolving: _isResolving( 'getEntityRecords', [\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t\tquery,\n\t\t\t\t] ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst filteredTemplateParts = useMemo( () => {\n\t\tif ( ! templateParts ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( templateParts, filterValue, {\n\t\t\tcategoryId,\n\t\t\thasCategory: templatePartHasCategory,\n\t\t} );\n\t}, [ templateParts, filterValue, categoryId ] );\n\n\treturn { templateParts: filteredTemplateParts, isResolving };\n};\n\nconst useThemePatterns = (\n\tcategoryId,\n\tpostType = PATTERNS,\n\tfilterValue = ''\n) => {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\tconst settings = getSettings();\n\t\treturn (\n\t\t\tsettings.__experimentalAdditionalBlockPatterns ??\n\t\t\tsettings.__experimentalBlockPatterns\n\t\t);\n\t} );\n\n\tconst restBlockPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatterns()\n\t);\n\n\tconst patterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]\n\t\t\t\t.filter(\n\t\t\t\t\t( pattern ) =>\n\t\t\t\t\t\t! CORE_PATTERN_SOURCES.includes( pattern.source )\n\t\t\t\t)\n\t\t\t\t.filter( filterOutDuplicatesByName )\n\t\t\t\t.map( ( pattern ) => ( {\n\t\t\t\t\t...pattern,\n\t\t\t\t\tkeywords: pattern.keywords || [],\n\t\t\t\t\ttype: 'pattern',\n\t\t\t\t\tblocks: parse( pattern.content ),\n\t\t\t\t} ) ),\n\t\t[ blockPatterns, restBlockPatterns ]\n\t);\n\n\tconst filteredPatterns = useMemo( () => {\n\t\tif ( postType !== PATTERNS ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( patterns, filterValue, {\n\t\t\tcategoryId,\n\t\t\thasCategory: ( item, currentCategory ) =>\n\t\t\t\titem.categories?.includes( currentCategory ),\n\t\t} );\n\t}, [ patterns, filterValue, categoryId, postType ] );\n\n\treturn filteredPatterns;\n};\n\nconst reusableBlockToPattern = ( reusableBlock ) => ( {\n\tblocks: parse( reusableBlock.content.raw ),\n\tcategories: reusableBlock.wp_pattern,\n\tid: reusableBlock.id,\n\tname: reusableBlock.slug,\n\tsyncStatus: reusableBlock.wp_pattern_sync_status || SYNC_TYPES.full,\n\ttitle: reusableBlock.title.raw,\n\ttype: reusableBlock.type,\n\treusableBlock,\n} );\n\nconst useUserPatterns = (\n\tcategoryId,\n\tcategoryType = PATTERNS,\n\tfilterValue = ''\n) => {\n\tconst postType = categoryType === PATTERNS ? USER_PATTERNS : categoryType;\n\tconst unfilteredPatterns = useSelect(\n\t\t( select ) => {\n\t\t\tif (\n\t\t\t\tpostType !== USER_PATTERNS ||\n\t\t\t\tcategoryId !== USER_PATTERN_CATEGORY\n\t\t\t) {\n\t\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t\t}\n\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst records = getEntityRecords( 'postType', postType, {\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\n\t\t\tif ( ! records ) {\n\t\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t\t}\n\n\t\t\treturn records.map( ( record ) =>\n\t\t\t\treusableBlockToPattern( record )\n\t\t\t);\n\t\t},\n\t\t[ postType, categoryId ]\n\t);\n\n\tconst filteredPatterns = useMemo( () => {\n\t\tif ( ! unfilteredPatterns.length ) {\n\t\t\treturn EMPTY_PATTERN_LIST;\n\t\t}\n\n\t\treturn searchItems( unfilteredPatterns, filterValue, {\n\t\t\t// We exit user pattern retrieval early if we aren't in the\n\t\t\t// catch-all category for user created patterns, so it has\n\t\t\t// to be in the category.\n\t\t\thasCategory: () => true,\n\t\t} );\n\t}, [ unfilteredPatterns, filterValue ] );\n\n\tconst patterns = { syncedPatterns: [], unsyncedPatterns: [] };\n\n\tfilteredPatterns.forEach( ( pattern ) => {\n\t\tif ( pattern.syncStatus === SYNC_TYPES.full ) {\n\t\t\tpatterns.syncedPatterns.push( pattern );\n\t\t} else {\n\t\t\tpatterns.unsyncedPatterns.push( pattern );\n\t\t}\n\t} );\n\n\treturn patterns;\n};\n\nexport const usePatterns = ( categoryType, categoryId, filterValue ) => {\n\tconst blockPatterns = useThemePatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst { syncedPatterns = [], unsyncedPatterns = [] } = useUserPatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst { templateParts, isResolving } = useTemplatePartsAsPatterns(\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tfilterValue\n\t);\n\n\tconst patterns = {\n\t\tsyncedPatterns: [ ...templateParts, ...syncedPatterns ],\n\t\tunsyncedPatterns: [ ...blockPatterns, ...unsyncedPatterns ],\n\t};\n\n\treturn [ patterns, isResolving ];\n};\n\nexport default usePatterns;\n"]}
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.filterOutDuplicatesByName = exports.USER_PATTERN_CATEGORY = exports.USER_PATTERNS = exports.TEMPLATE_PARTS = exports.SYNC_TYPES = exports.PATTERNS = exports.DEFAULT_TYPE = exports.DEFAULT_CATEGORY = exports.CORE_PATTERN_SOURCES = void 0;
|
|
7
|
-
const DEFAULT_CATEGORY = '
|
|
7
|
+
const DEFAULT_CATEGORY = 'my-patterns';
|
|
8
8
|
exports.DEFAULT_CATEGORY = DEFAULT_CATEGORY;
|
|
9
|
-
const DEFAULT_TYPE = '
|
|
9
|
+
const DEFAULT_TYPE = 'wp_block';
|
|
10
10
|
exports.DEFAULT_TYPE = DEFAULT_TYPE;
|
|
11
11
|
const PATTERNS = 'pattern';
|
|
12
12
|
exports.PATTERNS = PATTERNS;
|
|
@@ -14,7 +14,7 @@ const TEMPLATE_PARTS = 'wp_template_part';
|
|
|
14
14
|
exports.TEMPLATE_PARTS = TEMPLATE_PARTS;
|
|
15
15
|
const USER_PATTERNS = 'wp_block';
|
|
16
16
|
exports.USER_PATTERNS = USER_PATTERNS;
|
|
17
|
-
const USER_PATTERN_CATEGORY = '
|
|
17
|
+
const USER_PATTERN_CATEGORY = 'my-patterns';
|
|
18
18
|
exports.USER_PATTERN_CATEGORY = USER_PATTERN_CATEGORY;
|
|
19
19
|
const CORE_PATTERN_SOURCES = ['core', 'pattern-directory/core', 'pattern-directory/featured', 'pattern-directory/theme'];
|
|
20
20
|
exports.CORE_PATTERN_SOURCES = CORE_PATTERN_SOURCES;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/utils.js"],"names":["DEFAULT_CATEGORY","DEFAULT_TYPE","PATTERNS","TEMPLATE_PARTS","USER_PATTERNS","USER_PATTERN_CATEGORY","CORE_PATTERN_SOURCES","SYNC_TYPES","full","unsynced","filterOutDuplicatesByName","currentItem","index","items","findIndex","item","name"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAG,aAAzB;;AACA,MAAMC,YAAY,GAAG,UAArB;;AACA,MAAMC,QAAQ,GAAG,SAAjB;;AACA,MAAMC,cAAc,GAAG,kBAAvB;;AACA,MAAMC,aAAa,GAAG,UAAtB;;AACA,MAAMC,qBAAqB,GAAG,aAA9B;;AAEA,MAAMC,oBAAoB,GAAG,CACnC,MADmC,EAEnC,wBAFmC,EAGnC,4BAHmC,EAInC,yBAJmC,CAA7B;;AAOA,MAAMC,UAAU,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,QAAQ,EAAE;AAFe,CAAnB;;;AAKA,MAAMC,yBAAyB,GAAG,CAAEC,WAAF,EAAeC,KAAf,EAAsBC,KAAtB,KACxCD,KAAK,KAAKC,KAAK,CAACC,SAAN,CAAmBC,IAAF,IAAYJ,WAAW,CAACK,IAAZ,KAAqBD,IAAI,CAACC,IAAvD,CADJ","sourcesContent":["export const DEFAULT_CATEGORY = 'my-patterns';\nexport const DEFAULT_TYPE = 'wp_block';\nexport const PATTERNS = 'pattern';\nexport const TEMPLATE_PARTS = 'wp_template_part';\nexport const USER_PATTERNS = 'wp_block';\nexport const USER_PATTERN_CATEGORY = 'my-patterns';\n\nexport const CORE_PATTERN_SOURCES = [\n\t'core',\n\t'pattern-directory/core',\n\t'pattern-directory/featured',\n\t'pattern-directory/theme',\n];\n\nexport const SYNC_TYPES = {\n\tfull: 'fully',\n\tunsynced: 'unsynced',\n};\n\nexport const filterOutDuplicatesByName = ( currentItem, index, items ) =>\n\tindex === items.findIndex( ( item ) => currentItem.name === item.name );\n"]}
|
|
@@ -0,0 +1,103 @@
|
|
|
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 = PageTemplateParts;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _coreData = require("@wordpress/core-data");
|
|
19
|
+
|
|
20
|
+
var _htmlEntities = require("@wordpress/html-entities");
|
|
21
|
+
|
|
22
|
+
var _page = _interopRequireDefault(require("../page"));
|
|
23
|
+
|
|
24
|
+
var _table = _interopRequireDefault(require("../table"));
|
|
25
|
+
|
|
26
|
+
var _link = _interopRequireDefault(require("../routes/link"));
|
|
27
|
+
|
|
28
|
+
var _addedBy = _interopRequireDefault(require("../list/added-by"));
|
|
29
|
+
|
|
30
|
+
var _templateActions = _interopRequireDefault(require("../template-actions"));
|
|
31
|
+
|
|
32
|
+
var _addNewTemplate = _interopRequireDefault(require("../add-new-template"));
|
|
33
|
+
|
|
34
|
+
var _store = require("../../store");
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* WordPress dependencies
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Internal dependencies
|
|
42
|
+
*/
|
|
43
|
+
function PageTemplateParts() {
|
|
44
|
+
const {
|
|
45
|
+
records: templateParts
|
|
46
|
+
} = (0, _coreData.useEntityRecords)('postType', 'wp_template_part', {
|
|
47
|
+
per_page: -1
|
|
48
|
+
});
|
|
49
|
+
const {
|
|
50
|
+
canCreate
|
|
51
|
+
} = (0, _data.useSelect)(select => {
|
|
52
|
+
const {
|
|
53
|
+
supportsTemplatePartsMode
|
|
54
|
+
} = select(_store.store).getSettings();
|
|
55
|
+
return {
|
|
56
|
+
postType: select(_coreData.store).getPostType('wp_template_part'),
|
|
57
|
+
canCreate: !supportsTemplatePartsMode
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
const columns = [{
|
|
61
|
+
header: (0, _i18n.__)('Template Part'),
|
|
62
|
+
cell: templatePart => (0, _element.createElement)(_components.__experimentalVStack, null, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
63
|
+
as: "h3",
|
|
64
|
+
level: 5
|
|
65
|
+
}, (0, _element.createElement)(_link.default, {
|
|
66
|
+
params: {
|
|
67
|
+
postId: templatePart.id,
|
|
68
|
+
postType: templatePart.type,
|
|
69
|
+
canvas: 'view'
|
|
70
|
+
},
|
|
71
|
+
state: {
|
|
72
|
+
backPath: '/wp_template_part/all'
|
|
73
|
+
}
|
|
74
|
+
}, (0, _htmlEntities.decodeEntities)(templatePart.title?.rendered || templatePart.slug)))),
|
|
75
|
+
maxWidth: 400
|
|
76
|
+
}, {
|
|
77
|
+
header: (0, _i18n.__)('Added by'),
|
|
78
|
+
cell: templatePart => (0, _element.createElement)(_addedBy.default, {
|
|
79
|
+
postType: templatePart.type,
|
|
80
|
+
postId: templatePart.id
|
|
81
|
+
})
|
|
82
|
+
}, {
|
|
83
|
+
header: (0, _element.createElement)(_components.VisuallyHidden, null, (0, _i18n.__)('Actions')),
|
|
84
|
+
cell: templatePart => (0, _element.createElement)(_templateActions.default, {
|
|
85
|
+
postType: templatePart.type,
|
|
86
|
+
postId: templatePart.id
|
|
87
|
+
})
|
|
88
|
+
}];
|
|
89
|
+
return (0, _element.createElement)(_page.default, {
|
|
90
|
+
title: (0, _i18n.__)('Template Parts'),
|
|
91
|
+
actions: canCreate && (0, _element.createElement)(_addNewTemplate.default, {
|
|
92
|
+
templateType: 'wp_template_part',
|
|
93
|
+
showIcon: false,
|
|
94
|
+
toggleProps: {
|
|
95
|
+
variant: 'primary'
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
}, templateParts && (0, _element.createElement)(_table.default, {
|
|
99
|
+
data: templateParts,
|
|
100
|
+
columns: columns
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-template-parts/index.js"],"names":["PageTemplateParts","records","templateParts","per_page","canCreate","select","supportsTemplatePartsMode","editSiteStore","getSettings","postType","coreStore","getPostType","columns","header","cell","templatePart","postId","id","type","canvas","backPath","title","rendered","slug","maxWidth","variant"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAWA;AACA;AACA;AASe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AAAX,MAA6B,gCAClC,UADkC,EAElC,kBAFkC,EAGlC;AACCC,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAHkC,CAAnC;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,qBAAaC,MAAF,IAAc;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QACLD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,EADD;AAEA,WAAO;AACNC,MAAAA,QAAQ,EAAEJ,MAAM,CAAEK,eAAF,CAAN,CAAoBC,WAApB,CAAiC,kBAAjC,CADJ;AAENP,MAAAA,SAAS,EAAE,CAAEE;AAFP,KAAP;AAIA,GAPqB,CAAtB;AASA,QAAMM,OAAO,GAAG,CACf;AACCC,IAAAA,MAAM,EAAE,cAAI,eAAJ,CADT;AAECC,IAAAA,IAAI,EAAIC,YAAF,IACL,4BAAC,gCAAD,QACC,4BAAC,iCAAD;AAAS,MAAA,EAAE,EAAC,IAAZ;AAAiB,MAAA,KAAK,EAAG;AAAzB,OACC,4BAAC,aAAD;AACC,MAAA,MAAM,EAAG;AACRC,QAAAA,MAAM,EAAED,YAAY,CAACE,EADb;AAERR,QAAAA,QAAQ,EAAEM,YAAY,CAACG,IAFf;AAGRC,QAAAA,MAAM,EAAE;AAHA,OADV;AAMC,MAAA,KAAK,EAAG;AAAEC,QAAAA,QAAQ,EAAE;AAAZ;AANT,OAQG,kCACDL,YAAY,CAACM,KAAb,EAAoBC,QAApB,IACCP,YAAY,CAACQ,IAFb,CARH,CADD,CADD,CAHF;AAqBCC,IAAAA,QAAQ,EAAE;AArBX,GADe,EAwBf;AACCX,IAAAA,MAAM,EAAE,cAAI,UAAJ,CADT;AAECC,IAAAA,IAAI,EAAIC,YAAF,IACL,4BAAC,gBAAD;AACC,MAAA,QAAQ,EAAGA,YAAY,CAACG,IADzB;AAEC,MAAA,MAAM,EAAGH,YAAY,CAACE;AAFvB;AAHF,GAxBe,EAiCf;AACCJ,IAAAA,MAAM,EAAE,4BAAC,0BAAD,QAAkB,cAAI,SAAJ,CAAlB,CADT;AAECC,IAAAA,IAAI,EAAIC,YAAF,IACL,4BAAC,wBAAD;AACC,MAAA,QAAQ,EAAGA,YAAY,CAACG,IADzB;AAEC,MAAA,MAAM,EAAGH,YAAY,CAACE;AAFvB;AAHF,GAjCe,CAAhB;AA4CA,SACC,4BAAC,aAAD;AACC,IAAA,KAAK,EAAG,cAAI,gBAAJ,CADT;AAEC,IAAA,OAAO,EACNb,SAAS,IACR,4BAAC,uBAAD;AACC,MAAA,YAAY,EAAG,kBADhB;AAEC,MAAA,QAAQ,EAAG,KAFZ;AAGC,MAAA,WAAW,EAAG;AAAEqB,QAAAA,OAAO,EAAE;AAAX;AAHf;AAJH,KAYGvB,aAAa,IACd,4BAAC,cAAD;AAAO,IAAA,IAAI,EAAGA,aAAd;AAA8B,IAAA,OAAO,EAAGU;AAAxC,IAbF,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Table from '../table';\nimport Link from '../routes/link';\nimport AddedBy from '../list/added-by';\nimport TemplateActions from '../template-actions';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\n\nexport default function PageTemplateParts() {\n\tconst { records: templateParts } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tpostType: select( coreStore ).getPostType( 'wp_template_part' ),\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t} );\n\n\tconst columns = [\n\t\t{\n\t\t\theader: __( 'Template Part' ),\n\t\t\tcell: ( templatePart ) => (\n\t\t\t\t<VStack>\n\t\t\t\t\t<Heading as=\"h3\" level={ 5 }>\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: templatePart.id,\n\t\t\t\t\t\t\t\tpostType: templatePart.type,\n\t\t\t\t\t\t\t\tcanvas: 'view',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tstate={ { backPath: '/wp_template_part/all' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\ttemplatePart.title?.rendered ||\n\t\t\t\t\t\t\t\t\ttemplatePart.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</Heading>\n\t\t\t\t</VStack>\n\t\t\t),\n\t\t\tmaxWidth: 400,\n\t\t},\n\t\t{\n\t\t\theader: __( 'Added by' ),\n\t\t\tcell: ( templatePart ) => (\n\t\t\t\t<AddedBy\n\t\t\t\t\tpostType={ templatePart.type }\n\t\t\t\t\tpostId={ templatePart.id }\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theader: <VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>,\n\t\t\tcell: ( templatePart ) => (\n\t\t\t\t<TemplateActions\n\t\t\t\t\tpostType={ templatePart.type }\n\t\t\t\t\tpostId={ templatePart.id }\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t];\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ __( 'Template Parts' ) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ 'wp_template_part' }\n\t\t\t\t\t\tshowIcon={ false }\n\t\t\t\t\t\ttoggleProps={ { variant: 'primary' } }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{ templateParts && (\n\t\t\t\t<Table data={ templateParts } columns={ columns } />\n\t\t\t) }\n\t\t</Page>\n\t);\n}\n"]}
|
|
@@ -60,6 +60,7 @@ function PageTemplates() {
|
|
|
60
60
|
const columns = [{
|
|
61
61
|
header: (0, _i18n.__)('Template'),
|
|
62
62
|
cell: template => (0, _element.createElement)(_components.__experimentalVStack, null, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
63
|
+
as: "h3",
|
|
63
64
|
level: 5
|
|
64
65
|
}, (0, _element.createElement)(_link.default, {
|
|
65
66
|
params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"names":["PageTemplates","records","templates","per_page","canCreate","select","supportsTemplatePartsMode","editSiteStore","getSettings","postType","coreStore","getPostType","columns","header","cell","template","postId","id","type","canvas","title","rendered","slug","description","maxWidth","variant"],"mappings":";;;;;;;;;;;AAGA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAYA;AACA;AACA;AASe,SAASA,aAAT,GAAyB;AACvC,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AAAX,MAAyB,gCAC9B,UAD8B,EAE9B,aAF8B,EAG9B;AACCC,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAH8B,CAA/B;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,qBAAaC,MAAF,IAAc;AAC9C,UAAM;AAAEC,MAAAA;AAAF,QACLD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,EADD;AAEA,WAAO;AACNC,MAAAA,QAAQ,EAAEJ,MAAM,CAAEK,eAAF,CAAN,CAAoBC,WAApB,CAAiC,aAAjC,CADJ;AAENP,MAAAA,SAAS,EAAE,CAAEE;AAFP,KAAP;AAIA,GAPqB,CAAtB;AASA,QAAMM,OAAO,GAAG,CACf;AACCC,IAAAA,MAAM,EAAE,cAAI,UAAJ,CADT;AAECC,IAAAA,IAAI,EAAIC,QAAF,IACL,4BAAC,gCAAD,QACC,4BAAC,iCAAD;AAAS,MAAA,KAAK,EAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/page-templates/index.js"],"names":["PageTemplates","records","templates","per_page","canCreate","select","supportsTemplatePartsMode","editSiteStore","getSettings","postType","coreStore","getPostType","columns","header","cell","template","postId","id","type","canvas","title","rendered","slug","description","maxWidth","variant"],"mappings":";;;;;;;;;;;AAGA;;AAMA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAYA;AACA;AACA;AASe,SAASA,aAAT,GAAyB;AACvC,QAAM;AAAEC,IAAAA,OAAO,EAAEC;AAAX,MAAyB,gCAC9B,UAD8B,EAE9B,aAF8B,EAG9B;AACCC,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAH8B,CAA/B;AAQA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,qBAAaC,MAAF,IAAc;AAC9C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MAAA,QAAQ,EAAGA,QAAQ,CAACG,IADrB;AAEC,MAAA,MAAM,EAAGH,QAAQ,CAACE;AAFnB;AAHF,GAjCe,CAAhB;AA4CA,SACC,4BAAC,aAAD;AACC,IAAA,KAAK,EAAG,cAAI,WAAJ,CADT;AAEC,IAAA,OAAO,EACNb,SAAS,IACR,4BAAC,uBAAD;AACC,MAAA,YAAY,EAAG,aADhB;AAEC,MAAA,QAAQ,EAAG,KAFZ;AAGC,MAAA,WAAW,EAAG;AAAEqB,QAAAA,OAAO,EAAE;AAAX;AAHf;AAJH,KAYGvB,SAAS,IAAI,4BAAC,cAAD;AAAO,IAAA,IAAI,EAAGA,SAAd;AAA0B,IAAA,OAAO,EAAGU;AAApC,IAZhB,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tVisuallyHidden,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport Table from '../table';\nimport Link from '../routes/link';\nimport AddedBy from '../list/added-by';\nimport TemplateActions from '../template-actions';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\n\nexport default function PageTemplates() {\n\tconst { records: templates } = useEntityRecords(\n\t\t'postType',\n\t\t'wp_template',\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\tconst { supportsTemplatePartsMode } =\n\t\t\tselect( editSiteStore ).getSettings();\n\t\treturn {\n\t\t\tpostType: select( coreStore ).getPostType( 'wp_template' ),\n\t\t\tcanCreate: ! supportsTemplatePartsMode,\n\t\t};\n\t} );\n\n\tconst columns = [\n\t\t{\n\t\t\theader: __( 'Template' ),\n\t\t\tcell: ( template ) => (\n\t\t\t\t<VStack>\n\t\t\t\t\t<Heading as=\"h3\" level={ 5 }>\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: template.id,\n\t\t\t\t\t\t\t\tpostType: template.type,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</Heading>\n\t\t\t\t\t{ template.description && (\n\t\t\t\t\t\t<Text variant=\"muted\">\n\t\t\t\t\t\t\t{ decodeEntities( template.description ) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t) }\n\t\t\t\t</VStack>\n\t\t\t),\n\t\t\tmaxWidth: 400,\n\t\t},\n\t\t{\n\t\t\theader: __( 'Added by' ),\n\t\t\tcell: ( template ) => (\n\t\t\t\t<AddedBy postType={ template.type } postId={ template.id } />\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\theader: <VisuallyHidden>{ __( 'Actions' ) }</VisuallyHidden>,\n\t\t\tcell: ( template ) => (\n\t\t\t\t<TemplateActions\n\t\t\t\t\tpostType={ template.type }\n\t\t\t\t\tpostId={ template.id }\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t];\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ 'wp_template' }\n\t\t\t\t\t\tshowIcon={ false }\n\t\t\t\t\t\ttoggleProps={ { variant: 'primary' } }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{ templates && <Table data={ templates } columns={ columns } /> }\n\t\t</Page>\n\t);\n}\n"]}
|
|
@@ -15,12 +15,12 @@ var _router = require("@wordpress/router");
|
|
|
15
15
|
|
|
16
16
|
var _sidebarNavigationScreenMain = _interopRequireDefault(require("../sidebar-navigation-screen-main"));
|
|
17
17
|
|
|
18
|
-
var _sidebarNavigationScreenLibrary = _interopRequireDefault(require("../sidebar-navigation-screen-library"));
|
|
19
|
-
|
|
20
18
|
var _sidebarNavigationScreenTemplates = _interopRequireDefault(require("../sidebar-navigation-screen-templates"));
|
|
21
19
|
|
|
22
20
|
var _sidebarNavigationScreenTemplate = _interopRequireDefault(require("../sidebar-navigation-screen-template"));
|
|
23
21
|
|
|
22
|
+
var _sidebarNavigationScreenPatterns = _interopRequireDefault(require("../sidebar-navigation-screen-patterns"));
|
|
23
|
+
|
|
24
24
|
var _sidebarNavigationScreenPattern = _interopRequireDefault(require("../sidebar-navigation-screen-pattern"));
|
|
25
25
|
|
|
26
26
|
var _useSyncPathWithUrl = _interopRequireWildcard(require("../sync-state-with-url/use-sync-path-with-url"));
|
|
@@ -73,12 +73,12 @@ function SidebarScreens() {
|
|
|
73
73
|
}, (0, _element.createElement)(_sidebarNavigationScreenPage.default, null)), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
74
74
|
path: "/:postType(wp_template)"
|
|
75
75
|
}, (0, _element.createElement)(_sidebarNavigationScreenTemplates.default, null)), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
76
|
-
path: "/
|
|
77
|
-
}, (0, _element.createElement)(
|
|
76
|
+
path: "/patterns"
|
|
77
|
+
}, (0, _element.createElement)(_sidebarNavigationScreenPatterns.default, null)), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
78
|
+
path: "/:postType(wp_template|wp_template_part)/all"
|
|
79
|
+
}, (0, _element.createElement)(_sidebarNavigationScreenTemplatesBrowse.default, null)), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
78
80
|
path: "/:postType(wp_template_part|wp_block)/:postId"
|
|
79
81
|
}, (0, _element.createElement)(_sidebarNavigationScreenPattern.default, null)), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
80
|
-
path: "/:postType(wp_template)/all"
|
|
81
|
-
}, (0, _element.createElement)(_sidebarNavigationScreenTemplatesBrowse.default, null)), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
82
82
|
path: "/:postType(wp_template)/:postId"
|
|
83
83
|
}, (0, _element.createElement)(_sidebarNavigationScreenTemplate.default, null)));
|
|
84
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["useLocation","routerPrivateApis","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;;;;;;;;AAGA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA5BA;AACA;AACA;;AAQA;AACA;AACA;AAkBA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,wBAAQC,mBAAR,CAAxB;;AAEA,SAASC,cAAT,GAA0B;AACzB;AAEA,SACC,qDACC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,oCAAD,OADD,CADD,EAIC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,+CAAD,OADD,CAJD,EAOC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,8CAAD,OADD,CAPD,EAUC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,4CAAD,OADD,CAVD,EAaC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,qCAAD,OADD,CAbD,EAgBC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,oCAAD,OADD,CAhBD,EAmBC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,yCAAD,OADD,CAnBD,EAsBC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["useLocation","routerPrivateApis","SidebarScreens","Sidebar","params","urlParams","initialPath","current"],"mappings":";;;;;;;;;AAGA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA5BA;AACA;AACA;;AAQA;AACA;AACA;AAkBA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,wBAAQC,mBAAR,CAAxB;;AAEA,SAASC,cAAT,GAA0B;AACzB;AAEA,SACC,qDACC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,oCAAD,OADD,CADD,EAIC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,+CAAD,OADD,CAJD,EAOC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,8CAAD,OADD,CAPD,EAUC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,4CAAD,OADD,CAVD,EAaC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,qCAAD,OADD,CAbD,EAgBC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,oCAAD,OADD,CAhBD,EAmBC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,yCAAD,OADD,CAnBD,EAsBC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,wCAAD,OADD,CAtBD,EAyBC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,+CAAD,OADD,CAzBD,EA4BC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,uCAAD,OADD,CA5BD,EA+BC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,wCAAD,OADD,CA/BD,CADD;AAqCA;;AAED,SAASC,OAAT,GAAmB;AAClB,QAAM;AAAEC,IAAAA,MAAM,EAAEC;AAAV,MAAwBL,WAAW,EAAzC;AACA,QAAMM,WAAW,GAAG,qBAAQ,wCAAgBD,SAAhB,CAAR,CAApB;AAEA,SACC,qDACC,4BAAC,2CAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,WAAW,EAAGC,WAAW,CAACC;AAF3B,KAIC,4BAAC,cAAD,OAJD,CADD,EAOC,4BAAC,gBAAD,OAPD,CADD;AAWA;;eAEc,mBAAMJ,OAAN,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { memo, useRef } from '@wordpress/element';\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';\nimport SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';\nimport SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns';\nimport SidebarNavigationScreenPattern from '../sidebar-navigation-screen-pattern';\nimport useSyncPathWithURL, {\n\tgetPathFromURL,\n} from '../sync-state-with-url/use-sync-path-with-url';\nimport SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';\nimport SidebarNavigationScreenNavigationMenu from '../sidebar-navigation-screen-navigation-menu';\nimport SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles';\nimport SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';\nimport SaveHub from '../save-hub';\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';\nimport SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction SidebarScreens() {\n\tuseSyncPathWithURL();\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<SidebarNavigationScreenMain />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenus />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/navigation/:postType/:postId\">\n\t\t\t\t<SidebarNavigationScreenNavigationMenu />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/wp_global_styles\">\n\t\t\t\t<SidebarNavigationScreenGlobalStyles />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page\">\n\t\t\t\t<SidebarNavigationScreenPages />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/page/:postId\">\n\t\t\t\t<SidebarNavigationScreenPage />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)\">\n\t\t\t\t<SidebarNavigationScreenTemplates />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/patterns\">\n\t\t\t\t<SidebarNavigationScreenPatterns />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template|wp_template_part)/all\">\n\t\t\t\t<SidebarNavigationScreenTemplatesBrowse />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template_part|wp_block)/:postId\">\n\t\t\t\t<SidebarNavigationScreenPattern />\n\t\t\t</NavigatorScreen>\n\t\t\t<NavigatorScreen path=\"/:postType(wp_template)/:postId\">\n\t\t\t\t<SidebarNavigationScreenTemplate />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction Sidebar() {\n\tconst { params: urlParams } = useLocation();\n\tconst initialPath = useRef( getPathFromURL( urlParams ) );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorProvider\n\t\t\t\tclassName=\"edit-site-sidebar__content\"\n\t\t\t\tinitialPath={ initialPath.current }\n\t\t\t>\n\t\t\t\t<SidebarScreens />\n\t\t\t</NavigatorProvider>\n\t\t\t<SaveHub />\n\t\t</>\n\t);\n}\n\nexport default memo( Sidebar );\n"]}
|
|
@@ -11,8 +11,6 @@ var _data = require("@wordpress/data");
|
|
|
11
11
|
|
|
12
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
13
13
|
|
|
14
|
-
var _constants = require("../../page-content-focus-manager/constants");
|
|
15
|
-
|
|
16
14
|
var _lockUnlock = require("../../../lock-unlock");
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -27,7 +25,10 @@ const {
|
|
|
27
25
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
28
26
|
|
|
29
27
|
function PageContent() {
|
|
30
|
-
const
|
|
28
|
+
const clientIdsTree = (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_blockEditor.store)).getEnabledClientIdsTree(), []);
|
|
29
|
+
const clientIds = (0, _element.useMemo)(() => clientIdsTree.map(({
|
|
30
|
+
clientId
|
|
31
|
+
}) => clientId), [clientIdsTree]);
|
|
31
32
|
return (0, _element.createElement)(BlockQuickNavigation, {
|
|
32
33
|
clientIds: clientIds
|
|
33
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-content.js"],"names":["BlockQuickNavigation","blockEditorPrivateApis","PageContent","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-content.js"],"names":["BlockQuickNavigation","blockEditorPrivateApis","PageContent","clientIdsTree","select","blockEditorStore","getEnabledClientIdsTree","clientIds","map","clientId"],"mappings":";;;;;;;AAQA;;AALA;;AACA;;AASA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAA2B,wBAAQC,wBAAR,CAAjC;;AAEe,SAASC,WAAT,GAAuB;AACrC,QAAMC,aAAa,GAAG,qBACnBC,MAAF,IACC,wBAAQA,MAAM,CAAEC,kBAAF,CAAd,EAAqCC,uBAArC,EAFoB,EAGrB,EAHqB,CAAtB;AAKA,QAAMC,SAAS,GAAG,sBACjB,MAAMJ,aAAa,CAACK,GAAd,CAAmB,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAoBA,QAAvC,CADW,EAEjB,CAAEN,aAAF,CAFiB,CAAlB;AAIA,SAAO,4BAAC,oBAAD;AAAsB,IAAA,SAAS,EAAGI;AAAlC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nexport default function PageContent() {\n\tconst clientIdsTree = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getEnabledClientIdsTree(),\n\t\t[]\n\t);\n\tconst clientIds = useMemo(\n\t\t() => clientIdsTree.map( ( { clientId } ) => clientId ),\n\t\t[ clientIdsTree ]\n\t);\n\treturn <BlockQuickNavigation clientIds={ clientIds } />;\n}\n"]}
|
|
@@ -36,6 +36,12 @@ var _store = require("../../../store");
|
|
|
36
36
|
/**
|
|
37
37
|
* Internal dependencies
|
|
38
38
|
*/
|
|
39
|
+
const entityLabels = {
|
|
40
|
+
wp_navigation: (0, _i18n.__)('Navigation'),
|
|
41
|
+
wp_block: (0, _i18n.__)('Pattern'),
|
|
42
|
+
wp_template: (0, _i18n.__)('Template')
|
|
43
|
+
};
|
|
44
|
+
|
|
39
45
|
const SettingsHeader = ({
|
|
40
46
|
sidebarName
|
|
41
47
|
}) => {
|
|
@@ -52,7 +58,7 @@ const SettingsHeader = ({
|
|
|
52
58
|
entityType: getEditedPostType()
|
|
53
59
|
};
|
|
54
60
|
});
|
|
55
|
-
const entityLabel = entityType
|
|
61
|
+
const entityLabel = entityLabels[entityType] || entityLabels.wp_template;
|
|
56
62
|
const {
|
|
57
63
|
enableComplementaryArea
|
|
58
64
|
} = (0, _data.useDispatch)(_interface.store);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/settings-header/index.js"],"names":["SettingsHeader","sidebarName","hasPageContentFocus","entityType","select","getEditedPostType","_hasPageContentFocus","editSiteStore","entityLabel","enableComplementaryArea","interfaceStore","openTemplateSettings","STORE_NAME","SIDEBAR_TEMPLATE","openBlockSettings","SIDEBAR_BLOCK","templateAriaLabel"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKA,MAAMA,cAAc,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAuB;AAC7C,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAAsC,qBAAaC,MAAF,IAAc;AACpE,UAAM;AAAEC,MAAAA,iBAAF;AAAqBH,MAAAA,mBAAmB,EAAEI;AAA1C,QACLF,MAAM,CAAEG,YAAF,CADP;AAGA,WAAO;AACNL,MAAAA,mBAAmB,EAAEI,oBAAoB,EADnC;AAENH,MAAAA,UAAU,EAAEE,iBAAiB;AAFvB,KAAP;AAIA,GAR2C,CAA5C;AAUA,QAAMG,WAAW,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/settings-header/index.js"],"names":["entityLabels","wp_navigation","wp_block","wp_template","SettingsHeader","sidebarName","hasPageContentFocus","entityType","select","getEditedPostType","_hasPageContentFocus","editSiteStore","entityLabel","enableComplementaryArea","interfaceStore","openTemplateSettings","STORE_NAME","SIDEBAR_TEMPLATE","openBlockSettings","SIDEBAR_BLOCK","templateAriaLabel"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AACpBC,EAAAA,aAAa,EAAE,cAAI,YAAJ,CADK;AAEpBC,EAAAA,QAAQ,EAAE,cAAI,SAAJ,CAFU;AAGpBC,EAAAA,WAAW,EAAE,cAAI,UAAJ;AAHO,CAArB;;AAMA,MAAMC,cAAc,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAuB;AAC7C,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MAAsC,qBAAaC,MAAF,IAAc;AACpE,UAAM;AAAEC,MAAAA,iBAAF;AAAqBH,MAAAA,mBAAmB,EAAEI;AAA1C,QACLF,MAAM,CAAEG,YAAF,CADP;AAGA,WAAO;AACNL,MAAAA,mBAAmB,EAAEI,oBAAoB,EADnC;AAENH,MAAAA,UAAU,EAAEE,iBAAiB;AAFvB,KAAP;AAIA,GAR2C,CAA5C;AAUA,QAAMG,WAAW,GAAGZ,YAAY,CAAEO,UAAF,CAAZ,IAA8BP,YAAY,CAACG,WAA/D;AAEA,QAAM;AAAEU,IAAAA;AAAF,MAA8B,uBAAaC,gBAAb,CAApC;;AACA,QAAMC,oBAAoB,GAAG,MAC5BF,uBAAuB,CAAEG,qBAAF,EAAcC,4BAAd,CADxB;;AAEA,QAAMC,iBAAiB,GAAG,MACzBL,uBAAuB,CAAEG,qBAAF,EAAcG,yBAAd,CADxB;;AAGA,MAAIC,iBAAJ;;AACA,MAAKd,mBAAL,EAA2B;AAC1Bc,IAAAA,iBAAiB,GAChBf,WAAW,KAAKY,4BAAhB,GACG;AACA,kBAAI,iBAAJ,CAFH,GAGG;AACA,kBAAI,MAAJ,CALJ;AAMA,GAPD,MAOO;AACNG,IAAAA,iBAAiB,GAChBf,WAAW,KAAKY,4BAAhB,GACG;AACA,uBAAS,cAAI,eAAJ,CAAT,EAAgCL,WAAhC,CAFH,GAGG;AACAA,IAAAA,WALJ;AAMA;AAED;;;AACA,SACC,wCACC,wCACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAGG,oBADX;AAEC,IAAA,SAAS,EAAG,yBACX,wCADW,EAEX;AACC,mBAAaV,WAAW,KAAKY;AAD9B,KAFW,CAFb;AAQC,kBAAaG,iBARd;AASC,kBACCd,mBAAmB,GAAG,cAAI,MAAJ,CAAH,GAAkBM;AAVvC,KAaGN,mBAAmB,GAAG,cAAI,MAAJ,CAAH,GAAkBM,WAbxC,CADD,CADD,EAkBC,wCACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAGM,iBADX;AAEC,IAAA,SAAS,EAAG,yBACX,wCADW,EAEX;AACC,mBAAab,WAAW,KAAKc;AAD9B,KAFW,CAFb;AAQC,kBACCd,WAAW,KAAKc,yBAAhB,GACG;AACA,kBAAI,kBAAJ,CAFH,GAGG;AACA,kBAAI,OAAJ,CAbL;AAeC,kBAAa,cAAI,OAAJ;AAfd,KAiBG,cAAI,OAAJ,CAjBH,CADD,CAlBD,CADD;AA0CA,CA/ED;;eAiFef,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../../../store/constants';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from '../constants';\nimport { store as editSiteStore } from '../../../store';\n\nconst entityLabels = {\n\twp_navigation: __( 'Navigation' ),\n\twp_block: __( 'Pattern' ),\n\twp_template: __( 'Template' ),\n};\n\nconst SettingsHeader = ( { sidebarName } ) => {\n\tconst { hasPageContentFocus, entityType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, hasPageContentFocus: _hasPageContentFocus } =\n\t\t\tselect( editSiteStore );\n\n\t\treturn {\n\t\t\thasPageContentFocus: _hasPageContentFocus(),\n\t\t\tentityType: getEditedPostType(),\n\t\t};\n\t} );\n\n\tconst entityLabel = entityLabels[ entityType ] || entityLabels.wp_template;\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst openTemplateSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\tconst openBlockSettings = () =>\n\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\n\tlet templateAriaLabel;\n\tif ( hasPageContentFocus ) {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t __( 'Page (selected)' )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t __( 'Page' );\n\t} else {\n\t\ttemplateAriaLabel =\n\t\t\tsidebarName === SIDEBAR_TEMPLATE\n\t\t\t\t? // translators: ARIA label for the Template sidebar tab, selected.\n\t\t\t\t sprintf( __( '%s (selected)' ), entityLabel )\n\t\t\t\t: // translators: ARIA label for the Template Settings Sidebar tab, not selected.\n\t\t\t\t entityLabel;\n\t}\n\n\t/* Use a list so screen readers will announce how many tabs there are. */\n\treturn (\n\t\t<ul>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openTemplateSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_TEMPLATE,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ templateAriaLabel }\n\t\t\t\t\tdata-label={\n\t\t\t\t\t\thasPageContentFocus ? __( 'Page' ) : entityLabel\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ hasPageContentFocus ? __( 'Page' ) : entityLabel }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ openBlockSettings }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'edit-site-sidebar-edit-mode__panel-tab',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-active': sidebarName === SIDEBAR_BLOCK,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tsidebarName === SIDEBAR_BLOCK\n\t\t\t\t\t\t\t? // translators: ARIA label for the Block Settings Sidebar tab, selected.\n\t\t\t\t\t\t\t __( 'Block (selected)' )\n\t\t\t\t\t\t\t: // translators: ARIA label for the Block Settings Sidebar tab, not selected.\n\t\t\t\t\t\t\t __( 'Block' )\n\t\t\t\t\t}\n\t\t\t\t\tdata-label={ __( 'Block' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Block' ) }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</ul>\n\t);\n};\n\nexport default SettingsHeader;\n"]}
|
|
@@ -28,6 +28,8 @@ var _date = require("@wordpress/date");
|
|
|
28
28
|
|
|
29
29
|
var _notices = require("@wordpress/notices");
|
|
30
30
|
|
|
31
|
+
var _preferences = require("@wordpress/preferences");
|
|
32
|
+
|
|
31
33
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
32
34
|
|
|
33
35
|
var _styleVariationsContainer = _interopRequireDefault(require("../global-styles/style-variations-container"));
|
|
@@ -55,8 +57,7 @@ const noop = () => {};
|
|
|
55
57
|
|
|
56
58
|
function SidebarNavigationItemGlobalStyles(props) {
|
|
57
59
|
const {
|
|
58
|
-
openGeneralSidebar
|
|
59
|
-
toggleFeature
|
|
60
|
+
openGeneralSidebar
|
|
60
61
|
} = (0, _data.useDispatch)(_store.store);
|
|
61
62
|
const {
|
|
62
63
|
setCanvasMode
|
|
@@ -64,6 +65,25 @@ function SidebarNavigationItemGlobalStyles(props) {
|
|
|
64
65
|
const {
|
|
65
66
|
createNotice
|
|
66
67
|
} = (0, _data.useDispatch)(_notices.store);
|
|
68
|
+
const {
|
|
69
|
+
set: setPreference
|
|
70
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
71
|
+
const {
|
|
72
|
+
get: getPrefference
|
|
73
|
+
} = (0, _data.useSelect)(_preferences.store);
|
|
74
|
+
const turnOffDistractionFreeMode = (0, _element.useCallback)(() => {
|
|
75
|
+
const isDistractionFree = getPrefference(_store.store.name, 'distractionFree');
|
|
76
|
+
|
|
77
|
+
if (!isDistractionFree) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setPreference(_store.store.name, 'distractionFree', false);
|
|
82
|
+
createNotice('info', (0, _i18n.__)('Distraction free mode turned off'), {
|
|
83
|
+
isDismissible: true,
|
|
84
|
+
type: 'snackbar'
|
|
85
|
+
});
|
|
86
|
+
}, [createNotice, setPreference, getPrefference]);
|
|
67
87
|
const hasGlobalStyleVariations = (0, _data.useSelect)(select => !!select(_coreData.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []);
|
|
68
88
|
|
|
69
89
|
if (hasGlobalStyleVariations) {
|
|
@@ -75,12 +95,7 @@ function SidebarNavigationItemGlobalStyles(props) {
|
|
|
75
95
|
|
|
76
96
|
return (0, _element.createElement)(_sidebarNavigationItem.default, { ...props,
|
|
77
97
|
onClick: () => {
|
|
78
|
-
//
|
|
79
|
-
toggleFeature('distractionFree', false);
|
|
80
|
-
createNotice('info', (0, _i18n.__)('Distraction free mode turned off'), {
|
|
81
|
-
isDismissible: true,
|
|
82
|
-
type: 'snackbar'
|
|
83
|
-
}); // Switch to edit mode.
|
|
98
|
+
turnOffDistractionFreeMode(); // Switch to edit mode.
|
|
84
99
|
|
|
85
100
|
setCanvasMode('edit'); // Open global styles sidebar.
|
|
86
101
|
|
|
@@ -177,8 +192,45 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
177
192
|
setCanvasMode,
|
|
178
193
|
setEditorCanvasContainerView
|
|
179
194
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
180
|
-
const
|
|
181
|
-
|
|
195
|
+
const {
|
|
196
|
+
createNotice
|
|
197
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
198
|
+
const {
|
|
199
|
+
set: setPreference
|
|
200
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
201
|
+
const {
|
|
202
|
+
get: getPrefference
|
|
203
|
+
} = (0, _data.useSelect)(_preferences.store);
|
|
204
|
+
const {
|
|
205
|
+
isViewMode,
|
|
206
|
+
isStyleBookOpened
|
|
207
|
+
} = (0, _data.useSelect)(select => {
|
|
208
|
+
const {
|
|
209
|
+
getCanvasMode,
|
|
210
|
+
getEditorCanvasContainerView
|
|
211
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
212
|
+
return {
|
|
213
|
+
isViewMode: 'view' === getCanvasMode(),
|
|
214
|
+
isStyleBookOpened: 'style-book' === getEditorCanvasContainerView()
|
|
215
|
+
};
|
|
216
|
+
}, []);
|
|
217
|
+
const turnOffDistractionFreeMode = (0, _element.useCallback)(() => {
|
|
218
|
+
const isDistractionFree = getPrefference(_store.store.name, 'distractionFree');
|
|
219
|
+
|
|
220
|
+
if (!isDistractionFree) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
setPreference(_store.store.name, 'distractionFree', false);
|
|
225
|
+
createNotice('info', (0, _i18n.__)('Distraction free mode turned off'), {
|
|
226
|
+
isDismissible: true,
|
|
227
|
+
type: 'snackbar'
|
|
228
|
+
});
|
|
229
|
+
}, [createNotice, setPreference, getPrefference]);
|
|
230
|
+
const openGlobalStyles = (0, _element.useCallback)(async () => {
|
|
231
|
+
turnOffDistractionFreeMode();
|
|
232
|
+
return Promise.all([setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
|
|
233
|
+
}, [setCanvasMode, openGeneralSidebar, turnOffDistractionFreeMode]);
|
|
182
234
|
const openStyleBook = (0, _element.useCallback)(async () => {
|
|
183
235
|
await openGlobalStyles(); // Open the Style Book once the canvas mode is set to edit,
|
|
184
236
|
// and the global styles sidebar is open. This ensures that
|
|
@@ -212,7 +264,7 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
212
264
|
label: (0, _i18n.__)('Edit styles'),
|
|
213
265
|
onClick: async () => await openGlobalStyles()
|
|
214
266
|
}))
|
|
215
|
-
}), isStyleBookOpened && !isMobileViewport && (0, _element.createElement)(_styleBook.default, {
|
|
267
|
+
}), isStyleBookOpened && !isMobileViewport && isViewMode && (0, _element.createElement)(_styleBook.default, {
|
|
216
268
|
enableResizing: false,
|
|
217
269
|
isSelected: () => false,
|
|
218
270
|
onClick: openStyleBook,
|