@wordpress/edit-site 5.29.0 → 5.31.0
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/CHANGELOG.md +4 -0
- package/build/components/actions/index.js +3 -5
- package/build/components/actions/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +18 -6
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +1 -1
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +1 -15
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +1 -1
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +2 -2
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +70 -59
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +10 -15
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +121 -78
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-demo.js +29 -8
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +19 -6
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +151 -79
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +51 -23
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +39 -5
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +4 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +2 -2
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/highlighted-colors.js +50 -0
- package/build/components/global-styles/highlighted-colors.js.map +1 -0
- package/build/components/global-styles/hooks.js +50 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-colors.js +62 -0
- package/build/components/global-styles/preview-colors.js.map +1 -0
- package/build/components/global-styles/preview-iframe.js +130 -0
- package/build/components/global-styles/preview-iframe.js.map +1 -0
- package/build/components/global-styles/preview-styles.js +163 -0
- package/build/components/global-styles/preview-styles.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +1 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +3 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +2 -2
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +12 -84
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/{typogrphy-elements.js → typography-elements.js} +4 -2
- package/build/components/global-styles/typography-elements.js.map +1 -0
- package/build/components/global-styles/typography-example.js +67 -0
- package/build/components/global-styles/typography-example.js.map +1 -0
- package/build/components/global-styles/typography-preview.js +3 -1
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +27 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +22 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +90 -0
- package/build/components/global-styles/variations/variation.js.map +1 -0
- package/build/components/global-styles/variations/variations-color.js +35 -0
- package/build/components/global-styles/variations/variations-color.js.map +1 -0
- package/build/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
- package/build/components/global-styles/variations/variations-panel.js.map +1 -0
- package/build/components/global-styles/variations/variations-typography.js +54 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -0
- package/build/components/header-edit-mode/index.js +14 -12
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +10 -2
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/global.js +17 -3
- package/build/components/keyboard-shortcuts/global.js.map +1 -1
- package/build/components/layout/index.js +4 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +2 -5
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +6 -11
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +6 -1
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/index.js +15 -18
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +9 -9
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -61
- package/build/components/page-templates-template-parts/hooks.js.map +1 -0
- package/build/components/page-templates-template-parts/index.js +25 -22
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +2 -1
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +31 -11
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +4 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +12 -6
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +23 -3
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +13 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +2 -2
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +7 -3
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +6 -6
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +44 -27
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +11 -2
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +78 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/utils/constants.js +5 -3
- package/build/utils/constants.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/math.js +98 -0
- package/build/utils/math.js.map +1 -0
- package/build-module/components/actions/index.js +4 -6
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +18 -6
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +2 -16
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +1 -1
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +4 -4
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +72 -61
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +11 -16
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +124 -81
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-demo.js +30 -9
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +19 -6
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +151 -79
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +4 -4
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +52 -24
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +38 -5
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +4 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/highlighted-colors.js +43 -0
- package/build-module/components/global-styles/highlighted-colors.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +48 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-colors.js +54 -0
- package/build-module/components/global-styles/preview-colors.js.map +1 -0
- package/build-module/components/global-styles/preview-iframe.js +123 -0
- package/build-module/components/global-styles/preview-iframe.js.map +1 -0
- package/build-module/components/global-styles/preview-styles.js +155 -0
- package/build-module/components/global-styles/preview-styles.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +1 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +3 -2
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +2 -2
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -2
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +13 -85
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/{typogrphy-elements.js → typography-elements.js} +4 -2
- package/build-module/components/global-styles/typography-elements.js.map +1 -0
- package/build-module/components/global-styles/typography-example.js +60 -0
- package/build-module/components/global-styles/typography-example.js.map +1 -0
- package/build-module/components/global-styles/typography-preview.js +3 -1
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +27 -2
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +21 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +82 -0
- package/build-module/components/global-styles/variations/variation.js.map +1 -0
- package/build-module/components/global-styles/variations/variations-color.js +27 -0
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -0
- package/build-module/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
- package/build-module/components/global-styles/variations/variations-panel.js.map +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js +46 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -0
- package/build-module/components/header-edit-mode/index.js +15 -13
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +13 -5
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/global.js +17 -3
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
- package/build-module/components/layout/index.js +4 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +2 -5
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +7 -12
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/index.js +16 -19
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +9 -9
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/{list/added-by.js → page-templates-template-parts/hooks.js} +2 -59
- package/build-module/components/page-templates-template-parts/hooks.js.map +1 -0
- package/build-module/components/page-templates-template-parts/index.js +25 -22
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +2 -1
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +31 -11
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +6 -4
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +4 -3
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -3
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +13 -7
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +24 -4
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +14 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +1 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -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-menu/use-navigation-menu-handlers.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +6 -2
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +5 -5
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
- 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 +44 -27
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +11 -2
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +76 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/utils/constants.js +4 -2
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/math.js +92 -0
- package/build-module/utils/math.js.map +1 -0
- package/build-style/style-rtl.css +196 -315
- package/build-style/style.css +196 -315
- package/package.json +42 -42
- package/src/components/actions/index.js +4 -6
- package/src/components/block-editor/editor-canvas.js +20 -6
- package/src/components/block-editor/style.scss +0 -3
- package/src/components/block-editor/use-site-editor-settings.js +0 -2
- package/src/components/editor/index.js +0 -20
- package/src/components/global-styles/color-palette-panel.js +0 -1
- package/src/components/global-styles/font-families.js +1 -1
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +5 -5
- package/src/components/global-styles/font-library-modal/context.js +136 -107
- package/src/components/global-styles/font-library-modal/font-card.js +11 -26
- package/src/components/global-styles/font-library-modal/font-collection.js +298 -218
- package/src/components/global-styles/font-library-modal/font-demo.js +38 -4
- package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
- package/src/components/global-styles/font-library-modal/index.js +23 -16
- package/src/components/global-styles/font-library-modal/installed-fonts.js +243 -114
- package/src/components/global-styles/font-library-modal/library-font-variant.js +5 -5
- package/src/components/global-styles/font-library-modal/style.scss +27 -11
- package/src/components/global-styles/font-library-modal/upload-fonts.js +70 -27
- package/src/components/global-styles/font-library-modal/utils/index.js +45 -5
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +6 -1
- package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +7 -18
- package/src/components/global-styles/gradients-palette-panel.js +2 -2
- package/src/components/global-styles/header.js +2 -2
- package/src/components/global-styles/highlighted-colors.js +39 -0
- package/src/components/global-styles/hooks.js +68 -1
- package/src/components/global-styles/preview-colors.js +61 -0
- package/src/components/global-styles/preview-iframe.js +152 -0
- package/src/components/global-styles/preview-styles.js +185 -0
- package/src/components/global-styles/screen-block-list.js +1 -1
- package/src/components/global-styles/screen-block.js +4 -1
- package/src/components/global-styles/screen-colors.js +3 -2
- package/src/components/global-styles/screen-revisions/index.js +5 -2
- package/src/components/global-styles/screen-root.js +2 -2
- package/src/components/global-styles/screen-typography.js +8 -2
- package/src/components/global-styles/style-variations-container.js +14 -92
- package/src/components/global-styles/style.scss +4 -35
- package/src/components/global-styles/{typogrphy-elements.js → typography-elements.js} +5 -1
- package/src/components/global-styles/typography-example.js +64 -0
- package/src/components/global-styles/typography-preview.js +3 -1
- package/src/components/global-styles/ui.js +26 -2
- package/src/components/global-styles/utils.js +37 -0
- package/src/components/global-styles/variations/style.scss +38 -0
- package/src/components/global-styles/variations/variation.js +93 -0
- package/src/components/global-styles/variations/variations-color.js +34 -0
- package/src/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
- package/src/components/global-styles/variations/variations-typography.js +63 -0
- package/src/components/header-edit-mode/index.js +21 -27
- package/src/components/header-edit-mode/more-menu/index.js +17 -8
- package/src/components/header-edit-mode/style.scss +4 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/keyboard-shortcuts/global.js +16 -4
- package/src/components/layout/index.js +5 -0
- package/src/components/layout/router.js +2 -7
- package/src/components/page-pages/index.js +8 -13
- package/src/components/page-patterns/delete-category-menu-item.js +7 -0
- package/src/components/page-patterns/index.js +23 -24
- package/src/components/page-patterns/use-patterns.js +17 -10
- package/src/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -66
- package/src/components/page-templates-template-parts/index.js +34 -25
- package/src/components/page-templates-template-parts/style.scss +48 -0
- package/src/components/resizable-frame/index.js +1 -0
- package/src/components/revisions/index.js +1 -1
- package/src/components/save-panel/index.js +56 -27
- package/src/components/sidebar/index.js +3 -4
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/src/components/sidebar-dataviews/dataview-item.js +2 -2
- package/src/components/sidebar-dataviews/default-views.js +14 -4
- package/src/components/sidebar-dataviews/index.js +4 -3
- package/src/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -1
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +30 -11
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +10 -11
- package/src/components/sidebar-edit-mode/template-panel/index.js +25 -6
- package/src/components/sidebar-navigation-screen/style.scss +10 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +35 -2
- package/src/components/sidebar-navigation-screen-main/index.js +0 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-template/index.js +7 -2
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +5 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +5 -3
- package/src/components/start-template-options/index.js +1 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
- package/src/components/template-actions/index.js +63 -46
- package/src/components/welcome-guide/editor.js +9 -6
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +173 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +85 -1
- package/src/style.scss +2 -3
- package/src/utils/constants.js +4 -2
- package/src/utils/get-is-list-page.js +1 -1
- package/src/utils/math.js +93 -0
- package/build/components/global-styles/font-library-modal/collection-font-details.js +0 -50
- package/build/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -30
- package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
- package/build/components/global-styles/font-library-modal/library-font-card.js +0 -39
- package/build/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js +0 -67
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
- package/build/components/global-styles/preview.js +0 -271
- package/build/components/global-styles/preview.js.map +0 -1
- package/build/components/global-styles/typogrphy-elements.js.map +0 -1
- package/build/components/global-styles/variations-panel.js.map +0 -1
- package/build/components/list/added-by.js.map +0 -1
- package/build/components/list/header.js +0 -55
- package/build/components/list/header.js.map +0 -1
- package/build/components/list/index.js +0 -80
- package/build/components/list/index.js.map +0 -1
- package/build/components/list/table.js +0 -94
- package/build/components/list/table.js.map +0 -1
- package/build/components/list/use-register-shortcuts.js +0 -51
- package/build/components/list/use-register-shortcuts.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +0 -36
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -36
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
- package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js +0 -42
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -23
- package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js +0 -31
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +0 -60
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
- package/build-module/components/global-styles/preview.js +0 -264
- package/build-module/components/global-styles/preview.js.map +0 -1
- package/build-module/components/global-styles/typogrphy-elements.js.map +0 -1
- package/build-module/components/global-styles/variations-panel.js.map +0 -1
- package/build-module/components/list/added-by.js.map +0 -1
- package/build-module/components/list/header.js +0 -47
- package/build-module/components/list/header.js.map +0 -1
- package/build-module/components/list/index.js +0 -72
- package/build-module/components/list/index.js.map +0 -1
- package/build-module/components/list/table.js +0 -86
- package/build-module/components/list/table.js.map +0 -1
- package/build-module/components/list/use-register-shortcuts.js +0 -45
- package/build-module/components/list/use-register-shortcuts.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -29
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -27
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/src/components/global-styles/font-library-modal/collection-font-details.js +0 -56
- package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -33
- package/src/components/global-styles/font-library-modal/library-font-card.js +0 -34
- package/src/components/global-styles/font-library-modal/tab-panel-layout.js +0 -85
- package/src/components/global-styles/preview.js +0 -327
- package/src/components/list/header.js +0 -48
- package/src/components/list/index.js +0 -87
- package/src/components/list/style.scss +0 -188
- package/src/components/list/table.js +0 -140
- package/src/components/list/use-register-shortcuts.js +0 -49
- package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +0 -34
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -22
- package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","useViewportMatch","BlockEditorProvider","useCallback","editorStore","preferencesStore","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","settings","onChange","onInput","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","record","actions","icon","label","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,6BAA6B,IAAIC,eAAe,QAAQ,uBAAuB;AACxF,SAASC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,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BjD,OAAO,EAAGgC,aAAe;IACzBkB,QAAQ,EAAGlB,aAAe;IAC1BmB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","__experimentalVStack","VStack","useViewportMatch","BlockEditorProvider","useCallback","editorStore","preferencesStore","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","ColorVariations","TypographyVariations","useColorVariations","useTypographyVariations","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","colorVariations","typographyVariations","settings","onChange","onInput","spacing","className","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","record","actions","icon","label","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport ColorVariations from '../global-styles/variations/variations-color';\nimport TypographyVariations from '../global-styles/variations/variations-typography';\nimport {\n\tuseColorVariations,\n\tuseTypographyVariations,\n} from '../global-styles/hooks';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst colorVariations = useColorVariations();\n\tconst typographyVariations = useTypographyVariations();\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<VStack\n\t\t\t\tspacing={ 10 }\n\t\t\t\tclassName=\"edit-site-global-styles-variation-container\"\n\t\t\t>\n\t\t\t\t<StyleVariationsContainer />\n\t\t\t\t{ colorVariations?.length && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<h3 className=\"edit-site-global-styles-variation-title\">\n\t\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<ColorVariations />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ typographyVariations?.length && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<h3 className=\"edit-site-global-styles-variation-title\">\n\t\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<TypographyVariations />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,6BAA6B,IAAIC,eAAe,EAChDC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASR,KAAK,IAAIS,WAAW,QAAQ,mBAAmB;AACxD,SAAST,KAAK,IAAIU,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,wBAAwB,MAAM,6CAA6C;AAClF,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASb,KAAK,IAAIc,aAAa,QAAQ,aAAa;AACpD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,qBAAqB,MAAM,4B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E,CAAE,aAAc,CAAG;MAC7ByC,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAMiC,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAd,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,IACtDrB,aAAA,CAAChB,SAAS;IACTuE,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BrD,OAAO,EAAGoC,aAAe;IACzBkB,QAAQ,EAAGlB,aAAe;IAC1BmB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
@@ -16,7 +16,6 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
16
16
|
import { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';
|
|
17
17
|
import { unlock } from '../../lock-unlock';
|
|
18
18
|
import { store as editSiteStore } from '../../store';
|
|
19
|
-
import TemplatePartHint from './template-part-hint';
|
|
20
19
|
export default function SidebarNavigationScreenMain() {
|
|
21
20
|
const {
|
|
22
21
|
location
|
|
@@ -58,7 +57,7 @@ export default function SidebarNavigationScreenMain() {
|
|
|
58
57
|
path: "/patterns",
|
|
59
58
|
withChevron: true,
|
|
60
59
|
icon: symbol
|
|
61
|
-
}, __('Patterns')))
|
|
60
|
+
}, __('Patterns'))))
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__experimentalUseNavigator","useNavigator","__","layout","symbol","navigation","styles","page","useDispatch","useEffect","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationItemGlobalStyles","unlock","store","editSiteStore","
|
|
1
|
+
{"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__experimentalUseNavigator","useNavigator","__","layout","symbol","navigation","styles","page","useDispatch","useEffect","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationItemGlobalStyles","unlock","store","editSiteStore","SidebarNavigationScreenMain","location","setEditorCanvasContainerView","path","undefined","createElement","isRoot","title","description","content","Fragment","as","withChevron","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { location } = useNavigator();\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tif ( location?.path === '/' ) {\n\t\t\tsetEditorCanvasContainerView( undefined );\n\t\t}\n\t}, [ setEditorCanvasContainerView, location?.path ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Styles' ) }\n\t\t\t\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/page\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ page }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Pages' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/patterns\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,6BAA6B,IAAIC,eAAe,EAChDC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,EAAEC,MAAM,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GhB,qBAAuB;MAC5BQ,IAAI,EAAC,OAAO;MACZS,WAAW;MACXC,IAAI,EAAGtB;IAAM,GAEXL,EAAE,CAAE,OAAQ,CACE,CAAC,EAClBmB,aAAA,CAACtB,eAAe;MACf4B,EAAE,EAAGhB,qBAAuB;MAC5BQ,IAAI,EAAC,cAAc;MACnBS,WAAW;MACXC,IAAI,EAAG1B;IAAQ,GAEbD,EAAE,CAAE,WAAY,CACF,CAAC,EAClBmB,aAAA,CAACtB,eAAe;MACf4B,EAAE,EAAGhB,qBAAuB;MAC5BQ,IAAI,EAAC,WAAW;MAChBS,WAAW;MACXC,IAAI,EAAGzB;IAAQ,GAEbF,EAAE,CAAE,UAAW,CACD,CACP,CACV;EACF,CACD,CAAC;AAEJ"}
|
|
@@ -4,14 +4,13 @@ import { createElement } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
export default function
|
|
7
|
+
export default function DeleteConfirmDialog({
|
|
8
8
|
onClose,
|
|
9
9
|
onConfirm
|
|
10
10
|
}) {
|
|
11
11
|
return createElement(ConfirmDialog, {
|
|
12
12
|
isOpen: true,
|
|
13
|
-
onConfirm:
|
|
14
|
-
e.preventDefault();
|
|
13
|
+
onConfirm: () => {
|
|
15
14
|
onConfirm();
|
|
16
15
|
|
|
17
16
|
// Immediate close avoids ability to hit delete multiple times.
|
|
@@ -21,4 +20,4 @@ export default function RenameModal({
|
|
|
21
20
|
confirmButtonText: __('Delete')
|
|
22
21
|
}, __('Are you sure you want to delete this Navigation menu?'));
|
|
23
22
|
}
|
|
24
|
-
//# sourceMappingURL=delete-
|
|
23
|
+
//# sourceMappingURL=delete-confirm-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalConfirmDialog","ConfirmDialog","__","DeleteConfirmDialog","onClose","onConfirm","createElement","isOpen","onCancel","confirmButtonText"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function DeleteConfirmDialog( { onClose, onConfirm } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\tonConfirm={ () => {\n\t\t\t\tonConfirm();\n\n\t\t\t\t// Immediate close avoids ability to hit delete multiple times.\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\tonCancel={ onClose }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t>\n\t\t\t{ __( 'Are you sure you want to delete this Navigation menu?' ) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,eAAe,SAASC,mBAAmBA,CAAE;EAAEC,OAAO;EAAEC;AAAU,CAAC,EAAG;EACrE,OACCC,aAAA,CAACL,aAAa;IACbM,MAAM;IACNF,SAAS,EAAGA,CAAA,KAAM;MACjBA,SAAS,CAAC,CAAC;;MAEX;MACAD,OAAO,CAAC,CAAC;IACV,CAAG;IACHI,QAAQ,EAAGJ,OAAS;IACpBK,iBAAiB,EAAGP,EAAE,CAAE,QAAS;EAAG,GAElCA,EAAE,CAAE,uDAAwD,CAChD,CAAC;AAElB"}
|
|
@@ -11,7 +11,7 @@ import { useState } from '@wordpress/element';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import RenameModal from './rename-modal';
|
|
14
|
-
import
|
|
14
|
+
import DeleteConfirmDialog from './delete-confirm-dialog';
|
|
15
15
|
const POPOVER_PROPS = {
|
|
16
16
|
position: 'bottom right'
|
|
17
17
|
};
|
|
@@ -23,13 +23,13 @@ export default function ScreenNavigationMoreMenu(props) {
|
|
|
23
23
|
menuTitle
|
|
24
24
|
} = props;
|
|
25
25
|
const [renameModalOpen, setRenameModalOpen] = useState(false);
|
|
26
|
-
const [
|
|
26
|
+
const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = useState(false);
|
|
27
27
|
const closeModals = () => {
|
|
28
28
|
setRenameModalOpen(false);
|
|
29
|
-
|
|
29
|
+
setDeleteConfirmDialogOpen(false);
|
|
30
30
|
};
|
|
31
31
|
const openRenameModal = () => setRenameModalOpen(true);
|
|
32
|
-
const
|
|
32
|
+
const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true);
|
|
33
33
|
return createElement(Fragment, null, createElement(DropdownMenu, {
|
|
34
34
|
className: "sidebar-navigation__more-menu",
|
|
35
35
|
label: __('Actions'),
|
|
@@ -51,12 +51,12 @@ export default function ScreenNavigationMoreMenu(props) {
|
|
|
51
51
|
}, __('Duplicate')), createElement(MenuItem, {
|
|
52
52
|
isDestructive: true,
|
|
53
53
|
onClick: () => {
|
|
54
|
-
|
|
54
|
+
openDeleteConfirmDialog();
|
|
55
55
|
|
|
56
56
|
// Close the dropdown after opening the modal.
|
|
57
57
|
onClose();
|
|
58
58
|
}
|
|
59
|
-
}, __('Delete'))))),
|
|
59
|
+
}, __('Delete'))))), deleteConfirmDialogOpen && createElement(DeleteConfirmDialog, {
|
|
60
60
|
onClose: closeModals,
|
|
61
61
|
onConfirm: onDelete
|
|
62
62
|
}), renameModalOpen && createElement(RenameModal, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DropdownMenu","MenuItem","MenuGroup","moreVertical","__","useState","RenameModal","
|
|
1
|
+
{"version":3,"names":["DropdownMenu","MenuItem","MenuGroup","moreVertical","__","useState","RenameModal","DeleteConfirmDialog","POPOVER_PROPS","position","ScreenNavigationMoreMenu","props","onDelete","onSave","onDuplicate","menuTitle","renameModalOpen","setRenameModalOpen","deleteConfirmDialogOpen","setDeleteConfirmDialogOpen","closeModals","openRenameModal","openDeleteConfirmDialog","createElement","Fragment","className","label","icon","popoverProps","onClose","onClick","isDestructive","onConfirm"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RenameModal from './rename-modal';\nimport DeleteConfirmDialog from './delete-confirm-dialog';\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n};\n\nexport default function ScreenNavigationMoreMenu( props ) {\n\tconst { onDelete, onSave, onDuplicate, menuTitle } = props;\n\n\tconst [ renameModalOpen, setRenameModalOpen ] = useState( false );\n\tconst [ deleteConfirmDialogOpen, setDeleteConfirmDialogOpen ] =\n\t\tuseState( false );\n\n\tconst closeModals = () => {\n\t\tsetRenameModalOpen( false );\n\t\tsetDeleteConfirmDialogOpen( false );\n\t};\n\tconst openRenameModal = () => setRenameModalOpen( true );\n\tconst openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen( true );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"sidebar-navigation__more-menu\"\n\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenRenameModal();\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\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{ __( 'Rename' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonDuplicate();\n\t\t\t\t\t\t\t\t\tonClose();\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{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenDeleteConfirmDialog();\n\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\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{ __( 'Delete' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ deleteConfirmDialogOpen && (\n\t\t\t\t<DeleteConfirmDialog\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ renameModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tmenuTitle={ menuTitle }\n\t\t\t\t\tonSave={ onSave }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,uBAAuB;AACzE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,mBAAmB,MAAM,yBAAyB;AAEzD,MAAMC,aAAa,GA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KAAM;MACfR,uBAAuB,CAAC,CAAC;;MAEzB;MACAO,OAAO,CAAC,CAAC;IACV;EAAG,GAEDzB,EAAE,CAAE,QAAS,CACN,CACA,CACP,CAEO,CAAC,EACbc,uBAAuB,IACxBK,aAAA,CAAChB,mBAAmB;IACnBsB,OAAO,EAAGT,WAAa;IACvBY,SAAS,EAAGpB;EAAU,CACtB,CACD,EACCI,eAAe,IAChBO,aAAA,CAACjB,WAAW;IACXuB,OAAO,EAAGT,WAAa;IACvBL,SAAS,EAAGA,SAAW;IACvBF,MAAM,EAAGA;EAAQ,CACjB,CAED,CAAC;AAEL"}
|
package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js
CHANGED
|
@@ -11,7 +11,6 @@ import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-nav
|
|
|
11
11
|
import ScreenNavigationMoreMenu from './more-menu';
|
|
12
12
|
import NavigationMenuEditor from './navigation-menu-editor';
|
|
13
13
|
import buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';
|
|
14
|
-
import EditButton from './edit-button';
|
|
15
14
|
export default function SingleNavigationMenu({
|
|
16
15
|
navigationMenu,
|
|
17
16
|
handleDelete,
|
|
@@ -25,8 +24,6 @@ export default function SingleNavigationMenu({
|
|
|
25
24
|
onDelete: handleDelete,
|
|
26
25
|
onSave: handleSave,
|
|
27
26
|
onDuplicate: handleDuplicate
|
|
28
|
-
}), createElement(EditButton, {
|
|
29
|
-
postId: navigationMenu?.id
|
|
30
27
|
})),
|
|
31
28
|
title: buildNavigationLabel(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
|
|
32
29
|
description: __('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","decodeEntities","SidebarNavigationScreenWrapper","ScreenNavigationMoreMenu","NavigationMenuEditor","buildNavigationLabel","
|
|
1
|
+
{"version":3,"names":["__","decodeEntities","SidebarNavigationScreenWrapper","ScreenNavigationMoreMenu","NavigationMenuEditor","buildNavigationLabel","SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","createElement","actions","Fragment","onDelete","onSave","onDuplicate","id","status","description","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\tnavigationMenu?.title,\n\t\t\t\tnavigationMenu?.id,\n\t\t\t\tnavigationMenu?.status\n\t\t\t) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;AACzD;AACA;AACA;AACA,SAASC,8BAA8B,QAAQ,+CAA+C;AAC9F,OAAOC,wBAAwB,MAAM,aAAa;AAClD,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,oBAAoB,MAAM,sEAAsE;AAEvG,eAAe,SAASC,oBAAoBA,CAAE;EAC7CC,cAAc;EACdC,YAAY;EACZC,eAAe;EACfC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAK,EAAEC,QAAQ;EAEjD,OACCC,aAAA,CAACZ,8BAA8B;IAC9Ba,OAAO,EACND,aAAA,CAAAE,QAAA,QACCF,aAAA,CAACX,wBAAwB;MACxBQ,SAAS,EAAGV,cAAc,CAAEU,SAAU,CAAG;MACzCM,QAAQ,EAAGT,YAAc;MACzBU,MAAM,EAAGR,UAAY;MACrBS,WAAW,EAAGV;IAAiB,CAC/B,CACA,CACF;IACDG,KAAK,EAAGP,oBAAoB,CAC3BE,cAAc,EAAEK,KAAK,EACrBL,cAAc,EAAEa,EAAE,EAClBb,cAAc,EAAEc,MACjB,CAAG;IACHC,WAAW,EAAGtB,EAAE,CACf,kGACD;EAAG,GAEHc,aAAA,CAACV,oBAAoB;IAACmB,gBAAgB,EAAGhB,cAAc,EAAEa;EAAI,CAAE,CAChC,CAAC;AAEnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","coreStore","__experimentalUseNavigator","useNavigator","__","sprintf","useSelect","useDispatch","noticesStore","postType","NAVIGATION_POST_TYPE","useDeleteNavigationMenu","goTo","deleteEntityRecord","createSuccessNotice","createErrorNotice","handleDelete","navigationMenu","postId","id","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice(
|
|
1
|
+
{"version":3,"names":["store","coreStore","__experimentalUseNavigator","useNavigator","__","sprintf","useSelect","useDispatch","noticesStore","postType","NAVIGATION_POST_TYPE","useDeleteNavigationMenu","goTo","deleteEntityRecord","createSuccessNotice","createErrorNotice","handleDelete","navigationMenu","postId","id","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__( 'Navigation menu successfully deleted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\tgoTo( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\teditEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\tconst recordPropertiesToSave = Object.keys( edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\trecordPropertiesToSave,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tgoTo( `/navigation/${ postType }/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,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AAC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","__experimentalHeading","Heading","NavigationMenuEditor","useNavigationMenuTitle","TemplatePartNavigationMenu","id","title","undefined","createElement","Fragment","className","size","upperCase","weight","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuEditor from '../sidebar-navigation-screen-navigation-menu/navigation-menu-editor';\nimport useNavigationMenuTitle from './use-navigation-menu-title';\n\nexport default function TemplatePartNavigationMenu( { id } ) {\n\tconst title = useNavigationMenuTitle( id );\n\n\tif ( ! id || title === undefined ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase
|
|
1
|
+
{"version":3,"names":["__","__experimentalHeading","Heading","NavigationMenuEditor","useNavigationMenuTitle","TemplatePartNavigationMenu","id","title","undefined","createElement","Fragment","className","size","upperCase","weight","navigationMenuId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport NavigationMenuEditor from '../sidebar-navigation-screen-navigation-menu/navigation-menu-editor';\nimport useNavigationMenuTitle from './use-navigation-menu-title';\n\nexport default function TemplatePartNavigationMenu( { id } ) {\n\tconst title = useNavigationMenuTitle( id );\n\n\tif ( ! id || title === undefined ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ title || __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<NavigationMenuEditor navigationMenuId={ id } />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,uBAAuB;;AAExE;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,qEAAqE;AACtG,OAAOC,sBAAsB,MAAM,6BAA6B;AAEhE,eAAe,SAASC,0BAA0BA,CAAE;EAAEC;AAAG,CAAC,EAAG;EAC5D,MAAMC,KAAK,GAAGH,sBAAsB,CAAEE,EAAG,CAAC;EAE1C,IAAK,CAAEA,EAAE,IAAIC,KAAK,KAAKC,SAAS,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACP,OAAO;IACPS,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS;IACTC,MAAM,EAAG;EAAK,GAEZP,KAAK,IAAIP,EAAE,CAAE,YAAa,CACpB,CAAC,EACVS,aAAA,CAACN,oBAAoB;IAACY,gBAAgB,EAAGT;EAAI,CAAE,CAC9C,CAAC;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","__experimentalHeading","Heading","TemplatePartNavigationMenu","TemplatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","createElement","id","Fragment","className","size","upperCase","weight"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) return null;\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase
|
|
1
|
+
{"version":3,"names":["__","__experimentalHeading","Heading","TemplatePartNavigationMenu","TemplatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","createElement","id","Fragment","className","size","upperCase","weight"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) return null;\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,uBAAuB;AACxE;AACA;AACA;AACA,OAAOC,0BAA0B,MAAM,iCAAiC;AACxE,OAAOC,8BAA8B,MAAM,sCAAsC;AAEjF,eAAe,SAASC,2BAA2BA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChE,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG,OAAO,IAAI;;EAEjC;EACA,IAAKD,KAAK,CAACC,MAAM,KAAK,CAAC,EAAG;IACzB,OAAOC,aAAA,CAACL,0BAA0B;MAACM,EAAE,EAAGH,KAAK,CAAE,CAAC;IAAI,CAAE,CAAC;EACxD;;EAEA;EACA,OACCE,aAAA,CAAAE,QAAA,QACCF,aAAA,CAACN,OAAO;IACPS,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS;IACTC,MAAM,EAAG;EAAK,GAEZd,EAAE,CAAE,YAAa,CACX,CAAC,EACVQ,aAAA,CAACJ,8BAA8B;IAACE,KAAK,EAAGA;EAAO,CAAE,CAChD,CAAC;AAEL"}
|
|
@@ -15,7 +15,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
-
import { useAddedBy } from '../
|
|
18
|
+
import { useAddedBy } from '../page-templates-template-parts/hooks';
|
|
19
19
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
20
20
|
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
21
21
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sentenceCase","__","_x","sprintf","store","coreStore","editorStore","useSelect","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_SYNC_TYPES","TEMPLATE_ORIGINS","usePatternDetails","postType","postId","getDescription","getTitle","record","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","user","footer","modified","createElement","details","push","label","value","wp_pattern_sync_status","unsynced","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","className","origin","plugin","has_theme_file","isCustomized","content","Fragment","spacing","key"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\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';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = 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 footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\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</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,aAAa;;AAE1C;AACA;AACA;AACA,SAASC,EAAE,EA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C,QACtCiC,KACuC,CACH,CACvC,CACkC,CAErC,CACF;EAED,OAAO;IAAEV,KAAK;IAAEC,WAAW;IAAEmC,OAAO;IAAEhC;EAAO,CAAC;AAC/C"}
|
|
1
|
+
{"version":3,"names":["sentenceCase","__","_x","sprintf","store","coreStore","editorStore","useSelect","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_SYNC_TYPES","TEMPLATE_ORIGINS","usePatternDetails","postType","postId","getDescription","getTitle","record","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","user","footer","modified","createElement","details","push","label","value","wp_pattern_sync_status","unsynced","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","className","origin","plugin","has_theme_file","isCustomized","content","Fragment","spacing","key"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\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';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = 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 footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\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</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,aAAa;;AAE1C;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,UAAU,QAAQ,wCAAwC;AACnE,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,wBAAwB,MAAM,+BAA+B;AACpE,OAAOC,oCAAoC,MAAM,6CAA6C;AAC9F,SACCC,mCAAmC,EACnCC,sCAAsC,EACtCC,wCAAwC,EACxCC,wCAAwC,QAClC,4CAA4C;AACnD,SACCC,aAAa,EACbC,uBAAuB,EACvBC,kBAAkB,EAClBC,gBAAgB,QACV,uBAAuB;AAE9B,eAAe,SAASC,iBAAiBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC7D,MAAM;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;EAAO,CAAC,GAAGhB,qBAAqB,CACjEY,QAAQ,EACRC,MACD,CAAC;EACD,MAAMI,iBAAiB,GAAGnB,SAAS,CAChCoB,MAAM,IACPA,MAAM,CAAErB,WAAY,CAAC,CAACsB,yCAAyC,CAAC,CAAC,EAClE,EACD,CAAC;EACD,MAAM;IAAEC,YAAY;IAAEC;EAAsB,CAAC,GAAGvB,SAAS,CAAIoB,MAAM,IAAM;IACxE,MAAM;MAAEI,eAAe;MAAEC;IAAyB,CAAC,GAClDL,MAAM,CAAEtB,SAAU,CAAC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AmC;IACnCgE,OAAO,EAAG,CAAG;IACbtC,KAAK,EAAGrC,EAAE,CAAE,SAAU;EAAG,GAEvB4C,OAAO,CAACkB,GAAG,CAAE,CAAE;IAAEhB,KAAK;IAAEC;EAAM,CAAC,KAChCJ,aAAA,CAAC/B,sCAAsC;IAACgE,GAAG,EAAG9B;EAAO,GACpDH,aAAA,CAAC9B,wCAAwC,QACtCiC,KACuC,CAAC,EAC3CH,aAAA,CAAC7B,wCAAwC,QACtCiC,KACuC,CACH,CACvC,CACkC,CAErC,CACF;EAED,OAAO;IAAEV,KAAK;IAAEC,WAAW;IAAEmC,OAAO;IAAEhC;EAAO,CAAC;AAC/C"}
|
|
@@ -16,7 +16,7 @@ import useEditedEntityRecord from '../use-edited-entity-record';
|
|
|
16
16
|
import { unlock } from '../../lock-unlock';
|
|
17
17
|
import { store as editSiteStore } from '../../store';
|
|
18
18
|
import SidebarButton from '../sidebar-button';
|
|
19
|
-
import { useAddedBy } from '../
|
|
19
|
+
import { useAddedBy } from '../page-templates-template-parts/hooks';
|
|
20
20
|
import TemplateActions from '../template-actions';
|
|
21
21
|
import HomeTemplateDetails from './home-template-details';
|
|
22
22
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
@@ -61,6 +61,10 @@ function useTemplateDetails(postType, postId) {
|
|
|
61
61
|
footer
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
const POST_TYPE_PATH = {
|
|
65
|
+
wp_template: '/wp_template',
|
|
66
|
+
wp_template_part: '/wp_template_part/all'
|
|
67
|
+
};
|
|
64
68
|
export default function SidebarNavigationScreenTemplate() {
|
|
65
69
|
const navigator = useNavigator();
|
|
66
70
|
const {
|
|
@@ -87,7 +91,7 @@ export default function SidebarNavigationScreenTemplate() {
|
|
|
87
91
|
as: SidebarButton
|
|
88
92
|
},
|
|
89
93
|
onRemove: () => {
|
|
90
|
-
navigator.goTo(
|
|
94
|
+
navigator.goTo(POST_TYPE_PATH[postType]);
|
|
91
95
|
}
|
|
92
96
|
}), createElement(SidebarButton, {
|
|
93
97
|
onClick: () => setCanvasMode('edit'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","useDispatch","useSelect","pencil","__experimentalUseNavigator","useNavigator","Icon","store","coreStore","TemplateAreas","SidebarNavigationScreen","useEditedEntityRecord","unlock","editSiteStore","SidebarButton","useAddedBy","TemplateActions","HomeTemplateDetails","SidebarNavigationScreenDetailsFooter","useTemplateDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","content","slug","createElement","Fragment","footer","modified","description","className","imageUrl","src","alt","width","height","icon","isCustomized","SidebarNavigationScreenTemplate","navigator","params","setCanvasMode","actions","toggleProps","as","onRemove","goTo","onClick","label"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../
|
|
1
|
+
{"version":3,"names":["__","_x","useDispatch","useSelect","pencil","__experimentalUseNavigator","useNavigator","Icon","store","coreStore","TemplateAreas","SidebarNavigationScreen","useEditedEntityRecord","unlock","editSiteStore","SidebarButton","useAddedBy","TemplateActions","HomeTemplateDetails","SidebarNavigationScreenDetailsFooter","useTemplateDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","content","slug","createElement","Fragment","footer","modified","description","className","imageUrl","src","alt","width","height","icon","isCustomized","POST_TYPE_PATH","wp_template","wp_template_part","SidebarNavigationScreenTemplate","navigator","params","setCanvasMode","actions","toggleProps","as","onRemove","goTo","onClick","label"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nfunction useTemplateDetails( 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 = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\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-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__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-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\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\treturn { title, description, content, footer };\n}\n\nconst POST_TYPE_PATH = {\n\twp_template: '/wp_template',\n\twp_template_part: '/wp_template_part/all',\n};\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst navigator = useNavigator();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = navigator;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tnavigator.goTo( POST_TYPE_PATH[ postType ] );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\t\t\tfooter={ footer }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SACCC,0BAA0B,IAAIC,YAAY,EAC1CC,IAAI,QACE,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,UAAU,QAAQ,wCAAwC;AACnE,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,mBAAmB,MAAM,yBAAyB;AACzD,OAAOC,oCAAoC,MAAM,6C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;MACrC+C,QAAQ,EAAGA,CAAA,KAAM;QAChBN,SAAS,CAACO,IAAI,CAAEX,cAAc,CAAE/B,QAAQ,CAAG,CAAC;MAC7C;IAAG,CACH,CAAC,EACFkB,aAAA,CAACxB,aAAa;MACbiD,OAAO,EAAGA,CAAA,KAAMN,aAAa,CAAE,MAAO,CAAG;MACzCO,KAAK,EAAGjE,EAAE,CAAE,MAAO,CAAG;MACtBkD,IAAI,EAAG9C;IAAQ,CACf,CACA,CACF;IACDuC,WAAW,EAAGA,WAAa;IAC3BN,OAAO,EAAGA,OAAS;IACnBI,MAAM,EAAGA;EAAQ,CACjB,CAAC;AAEJ"}
|
|
@@ -10,7 +10,7 @@ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import DataViewItem from '../sidebar-dataviews/dataview-item';
|
|
13
|
-
import { useAddedBy } from '../
|
|
13
|
+
import { useAddedBy } from '../page-templates-template-parts/hooks';
|
|
14
14
|
import { layout } from '@wordpress/icons';
|
|
15
15
|
const EMPTY_ARRAY = [];
|
|
16
16
|
function TemplateDataviewItem({
|
|
@@ -27,13 +27,13 @@ function TemplateDataviewItem({
|
|
|
27
27
|
title: text,
|
|
28
28
|
icon: icon,
|
|
29
29
|
isActive: isActive,
|
|
30
|
-
isCustom:
|
|
30
|
+
isCustom: false
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
export default function DataviewsTemplatesSidebarContent({
|
|
34
34
|
activeView,
|
|
35
35
|
postType,
|
|
36
|
-
|
|
36
|
+
title
|
|
37
37
|
}) {
|
|
38
38
|
const {
|
|
39
39
|
records
|
|
@@ -53,10 +53,10 @@ export default function DataviewsTemplatesSidebarContent({
|
|
|
53
53
|
}, [records]);
|
|
54
54
|
return createElement(ItemGroup, null, createElement(DataViewItem, {
|
|
55
55
|
slug: 'all',
|
|
56
|
-
title:
|
|
56
|
+
title: title,
|
|
57
57
|
icon: layout,
|
|
58
58
|
isActive: activeView === 'all',
|
|
59
|
-
isCustom:
|
|
59
|
+
isCustom: false
|
|
60
60
|
}), firstItemPerAuthorText.map(template => {
|
|
61
61
|
return createElement(TemplateDataviewItem, {
|
|
62
62
|
key: template.author_text,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","DataViewItem","useAddedBy","layout","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","createElement","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","postType","
|
|
1
|
+
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","DataViewItem","useAddedBy","layout","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","createElement","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","postType","records","per_page","firstItemPerAuthorText","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport { layout } from '@wordpress/icons';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom={ false }\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\tpostType,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', postType, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug={ 'all' }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom={ false }\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,OAAOC,YAAY,MAAM,oCAAoC;AAC7D,SAASC,UAAU,QAAQ,wCAAwC;AACnE,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,MAAMC,WAAW,GAAG,EAAE;AAEtB,SAASC,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGP,UAAU,CAAEI,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACK,EAAG,CAAC;EAC/D,OACCC,aAAA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