@wordpress/edit-site 5.9.0 → 5.11.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/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +7 -22
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +32 -27
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/new-template-part.js +8 -2
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +104 -68
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +8 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/back-button.js +10 -3
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +39 -6
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +1 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +6 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +20 -11
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +27 -6
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +1 -1
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +14 -3
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +17 -18
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +14 -3
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/root-menu.js +61 -0
- package/build/components/global-styles/root-menu.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +3 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +235 -7
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +9 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -15
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -17
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +141 -0
- package/build/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +130 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +121 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build/components/global-styles/screen-root.js +6 -6
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -3
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +11 -39
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +9 -18
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +7 -11
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +70 -117
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +4 -28
- package/build/components/global-styles/variations-panel.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +28 -103
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +15 -2
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +1 -1
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/hooks.js +54 -0
- package/build/components/layout/hooks.js.map +1 -0
- package/build/components/layout/index.js +57 -104
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -2
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/index.js +9 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +1 -1
- package/build/components/list/table.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +44 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build/components/resizable-frame/index.js +242 -0
- package/build/components/resizable-frame/index.js.map +1 -0
- package/build/components/revisions/index.js +96 -0
- package/build/components/revisions/index.js.map +1 -0
- package/build/components/routes/link.js +17 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +8 -2
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +31 -6
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +14 -31
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +20 -7
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -10
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +19 -5
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +9 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build/components/sidebar-navigation-item/index.js +5 -7
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -4
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +75 -11
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +31 -23
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +162 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +55 -93
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +87 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -71
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +53 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build/components/sidebar-navigation-screen-page/index.js +67 -0
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +39 -12
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-subtitle/index.js +18 -0
- package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build/components/site-hub/index.js +34 -6
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +12 -16
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +93 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
- 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-canvas-mode-with-url.js +9 -4
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +8 -4
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +105 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build/hooks/template-part-edit.js +8 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -3
- package/build/store/actions.js.map +1 -1
- package/build/utils/is-previewing-theme.js +27 -0
- package/build/utils/is-previewing-theme.js.map +1 -0
- package/build/utils/use-activate-theme.js +46 -0
- package/build/utils/use-activate-theme.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +8 -20
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +34 -28
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +5 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +102 -68
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +6 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +6 -1
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +37 -6
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +1 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +7 -8
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +18 -11
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +27 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +1 -1
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +13 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -18
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +47 -0
- package/build-module/components/global-styles/root-menu.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +4 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +229 -7
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +9 -25
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +20 -15
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -16
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +121 -0
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +118 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +107 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +6 -6
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -3
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +11 -37
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +10 -18
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +7 -11
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +71 -115
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +3 -22
- package/build-module/components/global-styles/variations-panel.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +31 -107
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +16 -4
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +1 -1
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/hooks.js +41 -0
- package/build-module/components/layout/hooks.js.map +1 -0
- package/build-module/components/layout/index.js +53 -102
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +6 -3
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/index.js +5 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +1 -1
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +35 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build-module/components/resizable-frame/index.js +228 -0
- package/build-module/components/resizable-frame/index.js.map +1 -0
- package/build-module/components/revisions/index.js +78 -0
- package/build-module/components/revisions/index.js.map +1 -0
- package/build-module/components/routes/link.js +13 -1
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +5 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +28 -6
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +13 -32
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +19 -7
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -11
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +14 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +10 -5
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-item/index.js +6 -8
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +13 -5
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +70 -14
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +30 -24
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +141 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +52 -93
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +71 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +13 -72
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +40 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +38 -12
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +32 -6
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +13 -17
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +93 -20
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -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-canvas-mode-with-url.js +5 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +8 -4
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +86 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build-module/hooks/template-part-edit.js +5 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +17 -0
- package/build-module/utils/is-previewing-theme.js.map +1 -0
- package/build-module/utils/use-activate-theme.js +36 -0
- package/build-module/utils/use-activate-theme.js.map +1 -0
- package/build-style/style-rtl.css +409 -265
- package/build-style/style.css +410 -265
- package/package.json +37 -35
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
- package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +44 -34
- package/src/components/add-new-template/new-template-part.js +4 -1
- package/src/components/add-new-template/new-template.js +142 -154
- package/src/components/add-new-template/style.scss +120 -103
- package/src/components/app/index.js +6 -3
- package/src/components/block-editor/back-button.js +4 -1
- package/src/components/block-editor/editor-canvas.js +36 -8
- package/src/components/block-editor/index.js +2 -3
- package/src/components/block-editor/style.scss +15 -8
- package/src/components/create-template-part-modal/index.js +19 -25
- package/src/components/editor/index.js +20 -8
- package/src/components/editor/style.scss +21 -6
- package/src/components/editor-canvas-container/index.js +43 -21
- package/src/components/global-styles/block-preview-panel.js +1 -1
- package/src/components/global-styles/color-palette-panel.js +9 -0
- package/src/components/global-styles/dimensions-panel.js +15 -15
- package/src/components/global-styles/gradients-palette-panel.js +8 -0
- package/src/components/global-styles/root-menu.js +66 -0
- package/src/components/global-styles/screen-block-list.js +2 -2
- package/src/components/global-styles/screen-block.js +255 -7
- package/src/components/global-styles/screen-colors.js +9 -16
- package/src/components/global-styles/screen-css.js +21 -21
- package/src/components/global-styles/screen-layout.js +5 -9
- package/src/components/global-styles/screen-revisions/index.js +169 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +139 -0
- package/src/components/global-styles/screen-revisions/style.scss +100 -0
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +138 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +99 -0
- package/src/components/global-styles/screen-root.js +7 -5
- package/src/components/global-styles/screen-typography-element.js +1 -3
- package/src/components/global-styles/screen-typography.js +44 -79
- package/src/components/global-styles/style-variations-container.js +17 -28
- package/src/components/global-styles/style.scss +4 -23
- package/src/components/global-styles/typography-panel.js +12 -13
- package/src/components/global-styles/ui.js +83 -110
- package/src/components/global-styles/variations-panel.js +3 -26
- package/src/components/header-edit-mode/document-actions/index.js +26 -129
- package/src/components/header-edit-mode/document-actions/style.scss +28 -59
- package/src/components/header-edit-mode/index.js +23 -2
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/keyboard-shortcuts/register.js +1 -1
- package/src/components/layout/hooks.js +46 -0
- package/src/components/layout/index.js +60 -125
- package/src/components/layout/style.scss +9 -5
- package/src/components/list/actions/index.js +12 -5
- package/src/components/list/index.js +4 -1
- package/src/components/list/style.scss +5 -0
- package/src/components/list/table.js +3 -1
- package/src/components/plugin-template-setting-panel/index.js +33 -0
- package/src/components/resizable-frame/index.js +253 -0
- package/src/components/resizable-frame/style.scss +69 -0
- package/src/components/revisions/index.js +105 -0
- package/src/components/routes/link.js +16 -1
- package/src/components/routes/use-title.js +4 -1
- package/src/components/save-button/index.js +27 -6
- package/src/components/save-hub/index.js +17 -35
- package/src/components/save-panel/index.js +15 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +4 -7
- package/src/components/sidebar/index.js +15 -4
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +9 -7
- package/src/components/sidebar-edit-mode/index.js +17 -6
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
- package/src/components/sidebar-edit-mode/style.scss +10 -0
- package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
- package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -2
- package/src/components/sidebar-navigation-item/index.js +13 -14
- package/src/components/sidebar-navigation-item/style.scss +17 -1
- package/src/components/sidebar-navigation-screen/index.js +26 -5
- package/src/components/sidebar-navigation-screen/style.scss +1 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +106 -21
- package/src/components/sidebar-navigation-screen-main/index.js +39 -35
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -105
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +8 -74
- package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +6 -20
- package/src/components/sidebar-navigation-screen-page/index.js +59 -0
- package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
- package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +57 -14
- package/src/components/sidebar-navigation-subtitle/index.js +5 -0
- package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
- package/src/components/site-hub/index.js +88 -58
- package/src/components/site-hub/style.scss +8 -0
- package/src/components/start-template-options/index.js +19 -27
- package/src/components/start-template-options/style.scss +28 -21
- package/src/components/style-book/index.js +132 -43
- package/src/components/style-book/style.scss +19 -0
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
- package/src/components/use-edited-entity-record/index.js +12 -3
- package/src/hooks/commands/use-edit-mode-commands.js +79 -0
- package/src/hooks/template-part-edit.js +4 -1
- package/src/index.js +1 -0
- package/src/store/actions.js +4 -5
- package/src/store/test/actions.js +6 -14
- package/src/store/test/utils.js +15 -5
- package/src/style.scss +5 -2
- package/src/utils/is-previewing-theme.js +18 -0
- package/src/utils/use-activate-theme.js +38 -0
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build/components/global-styles/border-panel.js +0 -133
- package/build/components/global-styles/border-panel.js.map +0 -1
- package/build/components/global-styles/context-menu.js +0 -126
- package/build/components/global-styles/context-menu.js.map +0 -1
- package/build/components/global-styles/custom-css.js +0 -113
- package/build/components/global-styles/custom-css.js.map +0 -1
- package/build/components/global-styles/effects-panel.js +0 -53
- package/build/components/global-styles/effects-panel.js.map +0 -1
- package/build/components/global-styles/filters-panel.js +0 -50
- package/build/components/global-styles/filters-panel.js.map +0 -1
- package/build/components/global-styles/screen-border.js +0 -61
- package/build/components/global-styles/screen-border.js.map +0 -1
- package/build/components/global-styles/screen-effects.js +0 -61
- package/build/components/global-styles/screen-effects.js.map +0 -1
- package/build/components/global-styles/screen-filters.js +0 -46
- package/build/components/global-styles/screen-filters.js.map +0 -1
- package/build/components/global-styles/screen-variations.js +0 -71
- package/build/components/global-styles/screen-variations.js.map +0 -1
- package/build/components/navigate-to-link/index.js +0 -51
- package/build/components/navigate-to-link/index.js.map +0 -1
- package/build/components/routes/index.js +0 -60
- package/build/components/routes/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build/components/template-details/edit-template-title.js +0 -42
- package/build/components/template-details/edit-template-title.js.map +0 -1
- package/build/components/template-details/index.js +0 -103
- package/build/components/template-details/index.js.map +0 -1
- package/build/components/template-details/template-areas.js +0 -160
- package/build/components/template-details/template-areas.js.map +0 -1
- package/build/components/template-details/template-part-area-selector.js +0 -48
- package/build/components/template-details/template-part-area-selector.js.map +0 -1
- package/build/hooks/commands/index.js +0 -19
- package/build/hooks/commands/index.js.map +0 -1
- package/build/hooks/commands/use-navigation-commands.js +0 -126
- package/build/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build/hooks/commands/use-wp-admin-commands.js +0 -97
- package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build/utils/history.js +0 -41
- package/build/utils/history.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build-module/components/global-styles/border-panel.js +0 -123
- package/build-module/components/global-styles/border-panel.js.map +0 -1
- package/build-module/components/global-styles/context-menu.js +0 -107
- package/build-module/components/global-styles/context-menu.js.map +0 -1
- package/build-module/components/global-styles/custom-css.js +0 -98
- package/build-module/components/global-styles/custom-css.js.map +0 -1
- package/build-module/components/global-styles/effects-panel.js +0 -43
- package/build-module/components/global-styles/effects-panel.js.map +0 -1
- package/build-module/components/global-styles/filters-panel.js +0 -40
- package/build-module/components/global-styles/filters-panel.js.map +0 -1
- package/build-module/components/global-styles/screen-border.js +0 -44
- package/build-module/components/global-styles/screen-border.js.map +0 -1
- package/build-module/components/global-styles/screen-effects.js +0 -44
- package/build-module/components/global-styles/screen-effects.js.map +0 -1
- package/build-module/components/global-styles/screen-filters.js +0 -33
- package/build-module/components/global-styles/screen-filters.js.map +0 -1
- package/build-module/components/global-styles/screen-variations.js +0 -54
- package/build-module/components/global-styles/screen-variations.js.map +0 -1
- package/build-module/components/navigate-to-link/index.js +0 -39
- package/build-module/components/navigate-to-link/index.js.map +0 -1
- package/build-module/components/routes/index.js +0 -47
- package/build-module/components/routes/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build-module/components/template-details/edit-template-title.js +0 -33
- package/build-module/components/template-details/edit-template-title.js.map +0 -1
- package/build-module/components/template-details/index.js +0 -83
- package/build-module/components/template-details/index.js.map +0 -1
- package/build-module/components/template-details/template-areas.js +0 -141
- package/build-module/components/template-details/template-areas.js.map +0 -1
- package/build-module/components/template-details/template-part-area-selector.js +0 -36
- package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
- package/build-module/hooks/commands/index.js +0 -10
- package/build-module/hooks/commands/index.js.map +0 -1
- package/build-module/hooks/commands/use-navigation-commands.js +0 -109
- package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build-module/hooks/commands/use-wp-admin-commands.js +0 -81
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build-module/utils/history.js +0 -31
- package/build-module/utils/history.js.map +0 -1
- package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
- package/src/components/global-styles/border-panel.js +0 -112
- package/src/components/global-styles/context-menu.js +0 -175
- package/src/components/global-styles/custom-css.js +0 -131
- package/src/components/global-styles/effects-panel.js +0 -40
- package/src/components/global-styles/filters-panel.js +0 -39
- package/src/components/global-styles/screen-border.js +0 -35
- package/src/components/global-styles/screen-effects.js +0 -35
- package/src/components/global-styles/screen-filters.js +0 -27
- package/src/components/global-styles/screen-variations.js +0 -46
- package/src/components/navigate-to-link/index.js +0 -46
- package/src/components/routes/index.js +0 -53
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
- package/src/components/template-details/edit-template-title.js +0 -41
- package/src/components/template-details/index.js +0 -113
- package/src/components/template-details/style.scss +0 -72
- package/src/components/template-details/template-areas.js +0 -164
- package/src/components/template-details/template-part-area-selector.js +0 -39
- package/src/hooks/commands/index.js +0 -10
- package/src/hooks/commands/use-navigation-commands.js +0 -112
- package/src/hooks/commands/use-wp-admin-commands.js +0 -79
- package/src/utils/history.js +0 -39
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = SidebarNavigationScreenPage;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
|
|
14
|
+
var _data = require("@wordpress/data");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _coreData = require("@wordpress/core-data");
|
|
19
|
+
|
|
20
|
+
var _htmlEntities = require("@wordpress/html-entities");
|
|
21
|
+
|
|
22
|
+
var _icons = require("@wordpress/icons");
|
|
23
|
+
|
|
24
|
+
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
25
|
+
|
|
26
|
+
var _privateApis = require("../../private-apis");
|
|
27
|
+
|
|
28
|
+
var _store = require("../../store");
|
|
29
|
+
|
|
30
|
+
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* WordPress dependencies
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Internal dependencies
|
|
38
|
+
*/
|
|
39
|
+
function SidebarNavigationScreenPage() {
|
|
40
|
+
var _record$title, _record$description;
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
setCanvasMode
|
|
44
|
+
} = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
|
|
45
|
+
const {
|
|
46
|
+
params: {
|
|
47
|
+
postId
|
|
48
|
+
}
|
|
49
|
+
} = (0, _components.__experimentalUseNavigator)();
|
|
50
|
+
const {
|
|
51
|
+
record
|
|
52
|
+
} = (0, _coreData.useEntityRecord)('postType', 'page', postId);
|
|
53
|
+
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
54
|
+
title: record ? (0, _htmlEntities.decodeEntities)(record === null || record === void 0 ? void 0 : (_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) : null,
|
|
55
|
+
actions: (0, _element.createElement)(_sidebarButton.default, {
|
|
56
|
+
onClick: () => setCanvasMode('edit'),
|
|
57
|
+
label: (0, _i18n.__)('Edit'),
|
|
58
|
+
icon: _icons.pencil
|
|
59
|
+
}),
|
|
60
|
+
description: (0, _i18n.__)('Pages are static and are not listed by date. Pages do not use tags or categories.'),
|
|
61
|
+
content: (0, _element.createElement)(_element.Fragment, null, record !== null && record !== void 0 && record.link ? (0, _element.createElement)(_components.ExternalLink, {
|
|
62
|
+
className: "edit-site-sidebar-navigation-screen__page-link",
|
|
63
|
+
href: record.link
|
|
64
|
+
}, record.link) : null, record ? (0, _htmlEntities.decodeEntities)(record === null || record === void 0 ? void 0 : (_record$description = record.description) === null || _record$description === void 0 ? void 0 : _record$description.rendered) : null)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"names":["SidebarNavigationScreenPage","setCanvasMode","editSiteStore","params","postId","record","title","rendered","pencil","link","description"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAWA;AACA;AACA;AAMe,SAASA,2BAAT,GAAuC;AAAA;;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAoB,yBAAQ,uBAAaC,YAAb,CAAR,CAA1B;AACA,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEF,6CAFJ;AAGA,QAAM;AAAEC,IAAAA;AAAF,MAAa,+BAAiB,UAAjB,EAA6B,MAA7B,EAAqCD,MAArC,CAAnB;AAEA,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAGC,MAAM,GAAG,kCAAgBA,MAAhB,aAAgBA,MAAhB,wCAAgBA,MAAM,CAAEC,KAAxB,kDAAgB,cAAeC,QAA/B,CAAH,GAA+C,IAD9D;AAEC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAMN,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGO;AAHR,MAHF;AASC,IAAA,WAAW,EAAG,cACb,mFADa,CATf;AAYC,IAAA,OAAO,EACN,qDACGH,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEI,IAAR,GACD,4BAAC,wBAAD;AACC,MAAA,SAAS,EAAC,gDADX;AAEC,MAAA,IAAI,EAAGJ,MAAM,CAACI;AAFf,OAIGJ,MAAM,CAACI,IAJV,CADC,GAOE,IARL,EASGJ,MAAM,GACL,kCAAgBA,MAAhB,aAAgBA,MAAhB,8CAAgBA,MAAM,CAAEK,WAAxB,wDAAgB,oBAAqBH,QAArC,CADK,GAEL,IAXJ;AAbF,IADD;AA8BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenPage() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\tconst { record } = useEntityRecord( 'postType', 'page', postId );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ record ? decodeEntities( record?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={ __(\n\t\t\t\t'Pages are static and are not listed by date. Pages do not use tags or categories.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ record?.link ? (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\t\t\thref={ record.link }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ record.link }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) : null }\n\t\t\t\t\t{ record\n\t\t\t\t\t\t? decodeEntities( record?.description?.rendered )\n\t\t\t\t\t\t: null }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = SidebarNavigationScreenPages;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _components = require("@wordpress/components");
|
|
15
|
+
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
18
|
+
var _coreData = require("@wordpress/core-data");
|
|
19
|
+
|
|
20
|
+
var _htmlEntities = require("@wordpress/html-entities");
|
|
21
|
+
|
|
22
|
+
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
23
|
+
|
|
24
|
+
var _link = require("../routes/link");
|
|
25
|
+
|
|
26
|
+
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
27
|
+
|
|
28
|
+
var _sidebarNavigationSubtitle = _interopRequireDefault(require("../sidebar-navigation-subtitle"));
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* WordPress dependencies
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Internal dependencies
|
|
36
|
+
*/
|
|
37
|
+
const PageItem = _ref => {
|
|
38
|
+
let {
|
|
39
|
+
postId,
|
|
40
|
+
...props
|
|
41
|
+
} = _ref;
|
|
42
|
+
const linkInfo = (0, _link.useLink)({
|
|
43
|
+
postType: 'page',
|
|
44
|
+
postId
|
|
45
|
+
});
|
|
46
|
+
return (0, _element.createElement)(_sidebarNavigationItem.default, (0, _extends2.default)({}, linkInfo, props));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function SidebarNavigationScreenPages() {
|
|
50
|
+
const {
|
|
51
|
+
records: pages,
|
|
52
|
+
isResolving: isLoading
|
|
53
|
+
} = (0, _coreData.useEntityRecords)('postType', 'page');
|
|
54
|
+
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
55
|
+
title: (0, _i18n.__)('Pages'),
|
|
56
|
+
description: (0, _i18n.__)('Browse and edit pages on your site.'),
|
|
57
|
+
content: (0, _element.createElement)(_element.Fragment, null, isLoading && (0, _element.createElement)(_components.__experimentalItemGroup, null, (0, _element.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('Loading pages'))), !isLoading && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_sidebarNavigationSubtitle.default, null, (0, _i18n.__)('Recent')), (0, _element.createElement)(_components.__experimentalItemGroup, null, !(pages !== null && pages !== void 0 && pages.length) && (0, _element.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No page found')), pages === null || pages === void 0 ? void 0 : pages.map(page => {
|
|
58
|
+
var _decodeEntities, _page$title;
|
|
59
|
+
|
|
60
|
+
return (0, _element.createElement)(PageItem, {
|
|
61
|
+
postId: page.id,
|
|
62
|
+
key: page.id,
|
|
63
|
+
withChevron: true
|
|
64
|
+
}, (_decodeEntities = (0, _htmlEntities.decodeEntities)((_page$title = page.title) === null || _page$title === void 0 ? void 0 : _page$title.rendered)) !== null && _decodeEntities !== void 0 ? _decodeEntities : (0, _i18n.__)('(no title)'));
|
|
65
|
+
}), (0, _element.createElement)(_sidebarNavigationItem.default, {
|
|
66
|
+
className: "edit-site-sidebar-navigation-screen-pages__see-all",
|
|
67
|
+
href: "edit.php?post_type=page",
|
|
68
|
+
onClick: () => {
|
|
69
|
+
document.location = 'edit.php?post_type=page';
|
|
70
|
+
}
|
|
71
|
+
}, (0, _i18n.__)('Manage all pages')))))
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pages/index.js"],"names":["PageItem","postId","props","linkInfo","postType","SidebarNavigationScreenPages","records","pages","isResolving","isLoading","length","map","page","id","title","rendered","document","location"],"mappings":";;;;;;;;;;;;;AAGA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AASA;AACA;AACA;AAMA,MAAMA,QAAQ,GAAG,QAA4B;AAAA,MAA1B;AAAEC,IAAAA,MAAF;AAAU,OAAGC;AAAb,GAA0B;AAC5C,QAAMC,QAAQ,GAAG,mBAAS;AACzBC,IAAAA,QAAQ,EAAE,MADe;AAEzBH,IAAAA;AAFyB,GAAT,CAAjB;AAIA,SAAO,4BAAC,8BAAD,6BAA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Item as Item,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationSubtitle from '../sidebar-navigation-subtitle';\n\nconst PageItem = ( { postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType: 'page',\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenPages() {\n\tconst { records: pages, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\t'page'\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Pages' ) }\n\t\t\tdescription={ __( 'Browse and edit pages on your site.' ) }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t<Item>{ __( 'Loading pages' ) }</Item>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<SidebarNavigationSubtitle>\n\t\t\t\t\t\t\t\t{ __( 'Recent' ) }\n\t\t\t\t\t\t\t</SidebarNavigationSubtitle>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ ! pages?.length && (\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No page found' ) }</Item>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ pages?.map( ( page ) => (\n\t\t\t\t\t\t\t\t\t<PageItem\n\t\t\t\t\t\t\t\t\t\tpostId={ page.id }\n\t\t\t\t\t\t\t\t\t\tkey={ page.id }\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tpage.title?.rendered\n\t\t\t\t\t\t\t\t\t\t) ?? __( '(no title)' ) }\n\t\t\t\t\t\t\t\t\t</PageItem>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-pages__see-all\"\n\t\t\t\t\t\t\t\t\thref=\"edit.php?post_type=page\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tdocument.location =\n\t\t\t\t\t\t\t\t\t\t\t'edit.php?post_type=page';\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Manage all pages' ) }\n\t\t\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -23,6 +23,8 @@ var _htmlEntities = require("@wordpress/html-entities");
|
|
|
23
23
|
|
|
24
24
|
var _compose = require("@wordpress/compose");
|
|
25
25
|
|
|
26
|
+
var _editor = require("@wordpress/editor");
|
|
27
|
+
|
|
26
28
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
27
29
|
|
|
28
30
|
var _link = require("../routes/link");
|
|
@@ -54,11 +56,25 @@ const config = {
|
|
|
54
56
|
},
|
|
55
57
|
wp_template_part: {
|
|
56
58
|
labels: {
|
|
57
|
-
title: (0, _i18n.__)('
|
|
58
|
-
loading: (0, _i18n.__)('Loading
|
|
59
|
-
notFound: (0, _i18n.__)('No
|
|
59
|
+
title: (0, _i18n.__)('Library'),
|
|
60
|
+
loading: (0, _i18n.__)('Loading library'),
|
|
61
|
+
notFound: (0, _i18n.__)('No patterns found'),
|
|
60
62
|
manage: (0, _i18n.__)('Manage all template parts'),
|
|
61
|
-
|
|
63
|
+
reusableBlocks: (0, _i18n.__)('Manage reusable blocks'),
|
|
64
|
+
description: (0, _i18n.__)('Manage what patterns are available when editing your site.')
|
|
65
|
+
},
|
|
66
|
+
sortCallback: items => {
|
|
67
|
+
const groupedByArea = items.reduce((accumulator, item) => {
|
|
68
|
+
const key = accumulator[item.area] ? item.area : 'rest';
|
|
69
|
+
accumulator[key].push(item);
|
|
70
|
+
return accumulator;
|
|
71
|
+
}, {
|
|
72
|
+
header: [],
|
|
73
|
+
footer: [],
|
|
74
|
+
sidebar: [],
|
|
75
|
+
rest: []
|
|
76
|
+
});
|
|
77
|
+
return [...groupedByArea.header, ...groupedByArea.footer, ...groupedByArea.sidebar, ...groupedByArea.rest];
|
|
62
78
|
}
|
|
63
79
|
}
|
|
64
80
|
};
|
|
@@ -93,12 +109,18 @@ function SidebarNavigationScreenTemplates() {
|
|
|
93
109
|
} = (0, _coreData.useEntityRecords)('postType', postType, {
|
|
94
110
|
per_page: -1
|
|
95
111
|
});
|
|
96
|
-
|
|
97
|
-
sortedTemplates.sort((a, b) => a.
|
|
112
|
+
let sortedTemplates = templates ? [...templates] : [];
|
|
113
|
+
sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
|
|
114
|
+
|
|
115
|
+
if (config[postType].sortCallback) {
|
|
116
|
+
sortedTemplates = config[postType].sortCallback(sortedTemplates);
|
|
117
|
+
}
|
|
118
|
+
|
|
98
119
|
const browseAllLink = (0, _link.useLink)({
|
|
99
120
|
path: '/' + postType + '/all'
|
|
100
121
|
});
|
|
101
122
|
const canCreate = !isMobileViewport && !isTemplatePartsMode;
|
|
123
|
+
const isTemplateList = postType === 'wp_template';
|
|
102
124
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
103
125
|
isRoot: isTemplatePartsMode,
|
|
104
126
|
title: config[postType].labels.title,
|
|
@@ -115,13 +137,18 @@ function SidebarNavigationScreenTemplates() {
|
|
|
115
137
|
return (0, _element.createElement)(TemplateItem, {
|
|
116
138
|
postType: postType,
|
|
117
139
|
postId: template.id,
|
|
118
|
-
key: template.id
|
|
140
|
+
key: template.id,
|
|
141
|
+
withChevron: true,
|
|
142
|
+
icon: !isTemplateList && (0, _editor.getTemplatePartIcon)(template.area)
|
|
119
143
|
}, (0, _htmlEntities.decodeEntities)(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug));
|
|
120
|
-
}), !isMobileViewport && (0, _element.createElement)(_sidebarNavigationItem.default, (0, _extends2.default)({
|
|
121
|
-
className: "edit-site-sidebar-navigation-screen-templates__see-all"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
144
|
+
}), !isMobileViewport && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_sidebarNavigationItem.default, (0, _extends2.default)({
|
|
145
|
+
className: "edit-site-sidebar-navigation-screen-templates__see-all",
|
|
146
|
+
withChevron: true
|
|
147
|
+
}, browseAllLink), config[postType].labels.manage), !!config[postType].labels.reusableBlocks && (0, _element.createElement)(_sidebarNavigationItem.default, {
|
|
148
|
+
as: "a",
|
|
149
|
+
href: "edit.php?post_type=wp_block",
|
|
150
|
+
withChevron: true
|
|
151
|
+
}, config[postType].labels.reusableBlocks))))
|
|
125
152
|
});
|
|
126
153
|
}
|
|
127
154
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","labels","title","loading","notFound","manage","description","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","slug","localeCompare","browseAllLink","path","canCreate","as","SidebarButton","length","map","template","id","rendered"],"mappings":";;;;;;;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D,QACG,EAAEF,SAAF,aAAEA,SAAF,eAAEA,SAAS,CAAEe,MAAb,KACD,4BAAC,8BAAD,QACGvC,MAAM,CAAEU,QAAF,CAAN,CAAmBR,MAAnB,CAA0BG,QAD7B,CAFF,EAMGuB,eAAe,CAACY,GAAhB,CAAuBC,QAAF;AAAA;;AAAA,aACtB,4BAAC,YAAD;AACC,QAAA,QAAQ,EAAG/B,QADZ;AAEC,QAAA,MAAM,EAAG+B,QAAQ,CAACC,EAFnB;AAGC,QAAA,GAAG,EAAGD,QAAQ,CAACC;AAHhB,SAKG,kCACD,oBAAAD,QAAQ,CAACtC,KAAT,oEAAgBwC,QAAhB,KACCF,QAAQ,CAACT,IAFT,CALH,CADsB;AAAA,KAArB,CANH,EAkBG,CAAEhB,gBAAF,IACD,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAC;AADX,OAEMkB,aAFN;AAGC,MAAA,QAAQ,EACPlC,MAAM,CAAEU,QAAF,CAAN,CAAmBR,MAAnB,CAA0BI;AAJ5B,OAnBF,CAHF;AAfF,IADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst config = {\n\twp_template: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t\tdescription: __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t\tdescription: __(\n\t\t\t\t'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.'\n\t\t\t),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );\n\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tdescription={ config[ postType ].labels.description }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\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\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\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) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","labels","title","loading","notFound","manage","description","wp_template_part","reusableBlocks","sortCallback","items","groupedByArea","reduce","accumulator","item","key","area","push","header","footer","sidebar","rest","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","rendered","localeCompare","browseAllLink","path","canCreate","isTemplateList","as","SidebarButton","length","map","template","id","slug"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAaA;AACA;AACA;AAQA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,cAAI,WAAJ,CADA;AAEPC,MAAAA,OAAO,EAAE,cAAI,mBAAJ,CAFF;AAGPC,MAAAA,QAAQ,EAAE,cAAI,oBAAJ,CAHH;AAIPC,MAAAA,MAAM,EAAE,cAAI,sBAAJ,CAJD;AAKPC,MAAAA,WAAW,EAAE,cACZ,iDADY;AALN;AADI,GADC;AAYdC,EAAAA,gBAAgB,EAAE;AACjBN,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,cAAI,SAAJ,CADA;AAEPC,MAAAA,OAAO,EAAE,cAAI,iBAAJ,CAFF;AAGPC,MAAAA,QAAQ,EAAE,cAAI,mBAAJ,CAHH;AAIPC,MAAAA,MAAM,EAAE,cAAI,2BAAJ,CAJD;AAKPG,MAAAA,cAAc,EAAE,cAAI,wBAAJ,CALT;AAMPF,MAAAA,WAAW,EAAE,cACZ,4DADY;AANN,KADS;AAWjBG,IAAAA,YAAY,EAAIC,KAAF,IAAa;AAC1B,YAAMC,aAAa,GAAGD,KAAK,CAACE,MAAN,CACrB,CAAEC,WAAF,EAAeC,IAAf,KAAyB;AACxB,c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AD1C,EAEG,CAAEoC,SAAF,IACD,4BAAC,mCAAD,QACG,EAAEF,SAAF,aAAEA,SAAF,eAAEA,SAAS,CAAEgB,MAAb,KACD,4BAAC,8BAAD,QACGtD,MAAM,CAAEwB,QAAF,CAAN,CAAmBtB,MAAnB,CAA0BG,QAD7B,CAFF,EAMGqC,eAAe,CAACa,GAAhB,CAAuBC,QAAF;AAAA;;AAAA,aACtB,4BAAC,YAAD;AACC,QAAA,QAAQ,EAAGhC,QADZ;AAEC,QAAA,MAAM,EAAGgC,QAAQ,CAACC,EAFnB;AAGC,QAAA,GAAG,EAAGD,QAAQ,CAACC,EAHhB;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,IAAI,EACH,CAAEN,cAAF,IACA,iCAAqBK,QAAQ,CAACvC,IAA9B;AAPF,SAUG,kCACD,oBAAAuC,QAAQ,CAACrD,KAAT,oEAAgB2C,QAAhB,KACCU,QAAQ,CAACE,IAFT,CAVH,CADsB;AAAA,KAArB,CANH,EAuBG,CAAE5B,gBAAF,IACD,qDACC,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAC,wDADX;AAEC,MAAA,WAAW;AAFZ,OAGMkB,aAHN,GAKGhD,MAAM,CAAEwB,QAAF,CAAN,CAAmBtB,MAAnB,CAA0BI,MAL7B,CADD,EAQG,CAAC,CAAEN,MAAM,CAAEwB,QAAF,CAAN,CAAmBtB,MAAnB,CACHO,cADA,IAED,4BAAC,8BAAD;AACC,MAAA,EAAE,EAAC,GADJ;AAEC,MAAA,IAAI,EAAC,6BAFN;AAGC,MAAA,WAAW;AAHZ,OAMET,MAAM,CAAEwB,QAAF,CAAN,CAAmBtB,MAAnB,CACEO,cAPJ,CAVF,CAxBF,CAHF;AAfF,IADD;AAwEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getTemplatePartIcon } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst config = {\n\twp_template: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t\tdescription: __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Library' ),\n\t\t\tloading: __( 'Loading library' ),\n\t\t\tnotFound: __( 'No patterns found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t\treusableBlocks: __( 'Manage reusable blocks' ),\n\t\t\tdescription: __(\n\t\t\t\t'Manage what patterns are available when editing your site.'\n\t\t\t),\n\t\t},\n\t\tsortCallback: ( items ) => {\n\t\t\tconst groupedByArea = items.reduce(\n\t\t\t\t( accumulator, item ) => {\n\t\t\t\t\tconst key = accumulator[ item.area ] ? item.area : 'rest';\n\t\t\t\t\taccumulator[ key ].push( item );\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ header: [], footer: [], sidebar: [], rest: [] }\n\t\t\t);\n\t\t\treturn [\n\t\t\t\t...groupedByArea.header,\n\t\t\t\t...groupedByArea.footer,\n\t\t\t\t...groupedByArea.sidebar,\n\t\t\t\t...groupedByArea.rest,\n\t\t\t];\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tlet sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\tif ( config[ postType ].sortCallback ) {\n\t\tsortedTemplates = config[ postType ].sortCallback( sortedTemplates );\n\t}\n\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\tconst isTemplateList = postType === 'wp_template';\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tdescription={ config[ postType ].labels.description }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\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\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t! isTemplateList &&\n\t\t\t\t\t\t\t\t\t\tgetTemplatePartIcon( template.area )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.manage }\n\t\t\t\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t\t\t\t\t{ !! config[ postType ].labels\n\t\t\t\t\t\t\t\t\t\t.reusableBlocks && (\n\t\t\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\t\t\tas=\"a\"\n\t\t\t\t\t\t\t\t\t\t\thref=\"edit.php?post_type=wp_block\"\n\t\t\t\t\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels\n\t\t\t\t\t\t\t\t\t\t\t\t\t.reusableBlocks\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t</SidebarNavigationItem>\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) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = SidebarNavigationSubtitle;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
function SidebarNavigationSubtitle(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
children
|
|
13
|
+
} = _ref;
|
|
14
|
+
return (0, _element.createElement)("h3", {
|
|
15
|
+
className: "edit-site-sidebar-navigation-subtitle"
|
|
16
|
+
}, children);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-subtitle/index.js"],"names":["SidebarNavigationSubtitle","children"],"mappings":";;;;;;;;;AAAe,SAASA,yBAAT,OAAmD;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACjE,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KAAwDA,QAAxD,CADD;AAGA","sourcesContent":["export default function SidebarNavigationSubtitle( { children } ) {\n\treturn (\n\t\t<h3 className=\"edit-site-sidebar-navigation-subtitle\">{ children }</h3>\n\t);\n}\n"]}
|
|
@@ -27,6 +27,10 @@ var _coreData = require("@wordpress/core-data");
|
|
|
27
27
|
|
|
28
28
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
29
29
|
|
|
30
|
+
var _icons = require("@wordpress/icons");
|
|
31
|
+
|
|
32
|
+
var _commands = require("@wordpress/commands");
|
|
33
|
+
|
|
30
34
|
var _store = require("../../store");
|
|
31
35
|
|
|
32
36
|
var _siteIcon = _interopRequireDefault(require("../site-icon"));
|
|
@@ -44,10 +48,14 @@ var _privateApis = require("../../private-apis");
|
|
|
44
48
|
/**
|
|
45
49
|
* Internal dependencies
|
|
46
50
|
*/
|
|
51
|
+
const {
|
|
52
|
+
store: commandsStore
|
|
53
|
+
} = (0, _privateApis.unlock)(_commands.privateApis);
|
|
47
54
|
const HUB_ANIMATION_DURATION = 0.3;
|
|
48
55
|
const SiteHub = (0, _element.forwardRef)((props, ref) => {
|
|
49
56
|
const {
|
|
50
|
-
canvasMode
|
|
57
|
+
canvasMode,
|
|
58
|
+
dashboardLink
|
|
51
59
|
} = (0, _data.useSelect)(select => {
|
|
52
60
|
const {
|
|
53
61
|
getCanvasMode,
|
|
@@ -55,9 +63,12 @@ const SiteHub = (0, _element.forwardRef)((props, ref) => {
|
|
|
55
63
|
} = (0, _privateApis.unlock)(select(_store.store));
|
|
56
64
|
return {
|
|
57
65
|
canvasMode: getCanvasMode(),
|
|
58
|
-
dashboardLink: getSettings().__experimentalDashboardLink
|
|
66
|
+
dashboardLink: getSettings().__experimentalDashboardLink || 'index.php'
|
|
59
67
|
};
|
|
60
68
|
}, []);
|
|
69
|
+
const {
|
|
70
|
+
open: openCommandCenter
|
|
71
|
+
} = (0, _data.useDispatch)(commandsStore);
|
|
61
72
|
const disableMotion = (0, _compose.useReducedMotion)();
|
|
62
73
|
const {
|
|
63
74
|
setCanvasMode
|
|
@@ -65,9 +76,18 @@ const SiteHub = (0, _element.forwardRef)((props, ref) => {
|
|
|
65
76
|
const {
|
|
66
77
|
clearSelectedBlock
|
|
67
78
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
const isBackToDashboardButton = canvasMode === 'view';
|
|
80
|
+
const siteIconButtonProps = isBackToDashboardButton ? {
|
|
81
|
+
href: dashboardLink,
|
|
82
|
+
label: (0, _i18n.__)('Go back to the Dashboard')
|
|
83
|
+
} : {
|
|
84
|
+
href: dashboardLink,
|
|
85
|
+
// We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
|
|
86
|
+
role: 'button',
|
|
87
|
+
label: (0, _i18n.__)('Open Navigation'),
|
|
88
|
+
onClick: event => {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
|
|
71
91
|
if (canvasMode === 'edit') {
|
|
72
92
|
clearSelectedBlock();
|
|
73
93
|
setCanvasMode('view');
|
|
@@ -90,6 +110,9 @@ const SiteHub = (0, _element.forwardRef)((props, ref) => {
|
|
|
90
110
|
ease: 'easeOut'
|
|
91
111
|
}
|
|
92
112
|
}), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
113
|
+
justify: "space-between",
|
|
114
|
+
alignment: "center"
|
|
115
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
93
116
|
justify: "flex-start",
|
|
94
117
|
className: "edit-site-site-hub__text-content",
|
|
95
118
|
spacing: "0"
|
|
@@ -133,7 +156,12 @@ const SiteHub = (0, _element.forwardRef)((props, ref) => {
|
|
|
133
156
|
ease: 'easeOut',
|
|
134
157
|
delay: canvasMode === 'view' ? 0.1 : 0
|
|
135
158
|
}
|
|
136
|
-
}, (0, _htmlEntities.decodeEntities)(siteTitle)))))
|
|
159
|
+
}, (0, _htmlEntities.decodeEntities)(siteTitle)))), canvasMode === 'view' && (0, _element.createElement)(_components.Button, {
|
|
160
|
+
className: "edit-site-site-hub_toggle-command-center",
|
|
161
|
+
icon: _icons.search,
|
|
162
|
+
onClick: () => openCommandCenter(),
|
|
163
|
+
label: (0, _i18n.__)('Open command center')
|
|
164
|
+
})));
|
|
137
165
|
});
|
|
138
166
|
var _default = SiteHub;
|
|
139
167
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","select","getCanvasMode","getSettings","editSiteStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["store","commandsStore","commandsPrivateApis","HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","select","getCanvasMode","getSettings","editSiteStore","__experimentalDashboardLink","open","openCommandCenter","disableMotion","setCanvasMode","clearSelectedBlock","blockEditorStore","isBackToDashboardButton","siteIconButtonProps","href","label","role","onClick","event","preventDefault","siteTitle","coreStore","getEntityRecord","title","className","type","duration","ease","scale","opacity","delay","search"],"mappings":";;;;;;;;;AAoBA;;;;AAjBA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAGA;AACA;AACA;;AAiBA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA,KAAK,EAAEC;AAAT,IAA2B,yBAAQC,qBAAR,CAAjC;AAEA,MAAMC,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAG,yBAAY,CAAEC,KAAF,EAASC,GAAT,KAAkB;AAC7C,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAgC,qBAAaC,MAAF,IAAc;AAC9D,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAiC,yBACtCF,MAAM,CAAEG,YAAF,CADgC,CAAvC;AAIA,WAAO;AACNL,MAAAA,UAAU,EAAEG,aAAa,EADnB;AAENF,MAAAA,aAAa,EACZG,WAAW,GAAGE,2BAAd,IAA6C;AAHxC,KAAP;AAKA,GAVqC,EAUnC,EAVmC,CAAtC;AAWA,QAAM;AAAEC,IAAAA,IAAI,EAAEC;AAAR,MAA8B,uBAAad,aAAb,CAAp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AAQC,IAAA,SAAS,EAAC,gCARX;AASC,IAAA,UAAU,EAAG;AACZJ,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAElB,aAAa,GAAG,CAAH,GAAO,GAFlB;AAGZmB,MAAAA,IAAI,EAAE,SAHM;AAIZG,MAAAA,KAAK,EAAE/B,UAAU,KAAK,MAAf,GAAwB,GAAxB,GAA8B;AAJzB;AATd,KAgBG,kCAAgBqB,SAAhB,CAhBH,CADD,CAzCD,CADD,EA+DGrB,UAAU,KAAK,MAAf,IACD,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,IAAI,EAAGgC,aAFR;AAGC,IAAA,OAAO,EAAG,MAAMxB,iBAAiB,EAHlC;AAIC,IAAA,KAAK,EAAG,cAAI,qBAAJ;AAJT,IAhEF,CAXD,CADD;AAsFA,CAhIe,CAAhB;eAkIeX,O","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { forwardRef } from '@wordpress/element';\nimport { search } from '@wordpress/icons';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../private-apis';\n\nconst { store: commandsStore } = unlock( commandsPrivateApis );\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef( ( props, ref ) => {\n\tconst { canvasMode, dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tdashboardLink:\n\t\t\t\tgetSettings().__experimentalDashboardLink || 'index.php',\n\t\t};\n\t}, [] );\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tconst disableMotion = useReducedMotion();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink,\n\t\t\t\tlabel: __( 'Go back to the Dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\thref: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.\n\t\t\t\trole: 'button',\n\t\t\t\tlabel: __( 'Open Navigation' ),\n\t\t\t\tonClick: ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( canvasMode === 'edit' ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t };\n\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames( 'edit-site-site-hub', props.className ) }\n\t\t\tinitial={ false }\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack justify=\"space-between\" alignment=\"center\">\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\t\tspacing=\"0\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\t\tlayout\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 1,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\twhileHover={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 0.96,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\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<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ canvasMode === 'edit' }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: canvasMode === 'view' ? 1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__site-title\"\n\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\tdelay: canvasMode === 'view' ? 0.1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</HStack>\n\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-site-hub_toggle-command-center\"\n\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\t\tlabel={ __( 'Open command center' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"]}
|
|
@@ -58,8 +58,6 @@ function useFallbackTemplateContent(slug) {
|
|
|
58
58
|
return templateContent;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const START_BLANK_TITLE = (0, _i18n.__)('Start blank');
|
|
62
|
-
|
|
63
61
|
function useStartPatterns(fallbackContent) {
|
|
64
62
|
const {
|
|
65
63
|
slug,
|
|
@@ -95,11 +93,7 @@ function useStartPatterns(fallbackContent) {
|
|
|
95
93
|
return { ...pattern,
|
|
96
94
|
blocks: (0, _blocks.parse)(pattern.content)
|
|
97
95
|
};
|
|
98
|
-
})
|
|
99
|
-
name: 'start-blank',
|
|
100
|
-
blocks: (0, _blocks.parse)('<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->'),
|
|
101
|
-
title: START_BLANK_TITLE
|
|
102
|
-
}];
|
|
96
|
+
})];
|
|
103
97
|
}, [fallbackContent, slug, patterns]);
|
|
104
98
|
}
|
|
105
99
|
|
|
@@ -112,21 +106,16 @@ function PatternSelection(_ref2) {
|
|
|
112
106
|
const [,, onChange] = (0, _coreData.useEntityBlockEditor)('postType', postType);
|
|
113
107
|
const blockPatterns = useStartPatterns(fallbackContent);
|
|
114
108
|
const shownBlockPatterns = (0, _compose.useAsyncList)(blockPatterns);
|
|
115
|
-
return (0, _element.createElement)(
|
|
116
|
-
className: "edit-site-start-template-options__pattern-container",
|
|
117
|
-
style: {
|
|
118
|
-
'--wp-edit-site-start-template-options-start-blank': `"${START_BLANK_TITLE}"`
|
|
119
|
-
}
|
|
120
|
-
}, (0, _element.createElement)(_blockEditor.__experimentalBlockPatternsList, {
|
|
109
|
+
return (0, _element.createElement)(_blockEditor.__experimentalBlockPatternsList, {
|
|
121
110
|
blockPatterns: blockPatterns,
|
|
122
111
|
shownPatterns: shownBlockPatterns,
|
|
123
112
|
onClickPattern: (pattern, blocks) => {
|
|
124
|
-
onChange(
|
|
113
|
+
onChange(blocks, {
|
|
125
114
|
selection: undefined
|
|
126
115
|
});
|
|
127
116
|
onChoosePattern();
|
|
128
117
|
}
|
|
129
|
-
})
|
|
118
|
+
});
|
|
130
119
|
}
|
|
131
120
|
|
|
132
121
|
function StartModal(_ref3) {
|
|
@@ -159,7 +148,14 @@ function StartModal(_ref3) {
|
|
|
159
148
|
onChoosePattern: () => {
|
|
160
149
|
onClose();
|
|
161
150
|
}
|
|
162
|
-
})))
|
|
151
|
+
})), (0, _element.createElement)(_components.Flex, {
|
|
152
|
+
className: "edit-site-start-template-options__modal__actions",
|
|
153
|
+
justify: "flex-end",
|
|
154
|
+
expanded: false
|
|
155
|
+
}, (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_components.Button, {
|
|
156
|
+
variant: "tertiary",
|
|
157
|
+
onClick: onClose
|
|
158
|
+
}, (0, _i18n.__)('Skip')))));
|
|
163
159
|
}
|
|
164
160
|
|
|
165
161
|
const START_TEMPLATE_MODAL_STATES = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/start-template-options/index.js"],"names":["useFallbackTemplateContent","slug","isCustom","templateContent","setTemplateContent","path","is_custom","ignore_empty","then","content","raw","START_BLANK_TITLE","useStartPatterns","fallbackContent","patterns","select","getEditedPostType","getEditedPostId","editSiteStore","getEntityRecord","coreStore","postId","postType","record","getSettings","blockEditorStore","__experimentalBlockPatterns","name","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","map","PatternSelection","onChoosePattern","onChange","blockPatterns","shownBlockPatterns","selection","undefined","StartModal","onClose","START_TEMPLATE_MODAL_STATES","INITIAL","CLOSED","StartTemplateOptions","modalState","setModalState","shouldOpenModal","_postType","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits","preferencesStore","get"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA,SAASA,0BAAT,CAAqCC,IAArC,EAA8D;AAAA,MAAnBC,QAAmB,uEAAR,KAAQ;AAC7D,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAU,EAAV,CAAhD;AAEA,0BAAW,MAAM;AAChB,2BAAU;AACTC,MAAAA,IAAI,EAAE,uBAAc,yBAAd,EAAyC;AAC9CJ,QAAAA,IAD8C;AAE9CK,QAAAA,SAAS,EAAEJ,QAFmC;AAG9CK,QAAAA,YAAY,EAAE;AAHgC,OAAzC;AADG,KAAV,EAMIC,IANJ,CAMU;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aAAmBL,kBAAkB,CAAEK,OAAO,CAACC,GAAV,CAArC;AAAA,KAN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D2C,EAE3CD,SAF2C,EAG3ClC,MAH2C,CAA5C;AAKA,UAAMsC,QAAQ,GAAGF,uBAAuB,CACvC,UADuC,EAEvCF,SAFuC,EAGvClC,MAHuC,CAAxC;AAMA,WAAO;AACNiC,MAAAA,eAAe,EACd,CAAEK,QAAF,IACA,OAAOD,cAAc,CAACjD,OADtB,IAEA,kBAAkB8C,SAFlB,IAGA,CAAExC,MAAM,CAAE6C,kBAAF,CAAN,CAA2BC,GAA3B,CACD,gBADC,EAED,cAFC,CALG;AASN5D,MAAAA,IAAI,EAAEyD,cAAc,CAACzD,IATf;AAUNC,MAAAA,QAAQ,EAAEwD,cAAc,CAACpD,SAVnB;AAWNgB,MAAAA,QAAQ,EAAEiC;AAXJ,KAAP;AAaA,GAhCoD,EAiCrD,EAjCqD,CAAtD;;AAoCA,MACGH,UAAU,KAAKJ,2BAA2B,CAACC,OAA3C,IACD,CAAEK,eADH,IAEAF,UAAU,KAAKJ,2BAA2B,CAACE,MAH5C,EAIE;AACD,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,UAAD;AACC,IAAA,IAAI,EAAGjD,IADR;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGoB,QAHZ;AAIC,IAAA,OAAO,EAAG,MACT+B,aAAa,CAAEL,2BAA2B,CAACE,MAA9B;AALf,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\tconst [ templateContent, setTemplateContent ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} ),\n\t\t} ).then( ( { content } ) => setTemplateContent( content.raw ) );\n\t}, [ isCustom, slug ] );\n\treturn templateContent;\n}\n\nconst START_BLANK_TITLE = __( 'Start blank' );\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst postId = getEditedPostId();\n\t\tconst postType = getEditedPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getSettings().__experimentalBlockPatterns,\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn { ...pattern, blocks: parse( pattern.content ) };\n\t\t\t\t} ),\n\t\t\t{\n\t\t\t\tname: 'start-blank',\n\t\t\t\tblocks: parse(\n\t\t\t\t\t'<!-- wp:paragraph --><p></p><!-- /wp:paragraph -->'\n\t\t\t\t),\n\t\t\t\ttitle: START_BLANK_TITLE,\n\t\t\t},\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"edit-site-start-template-options__pattern-container\"\n\t\t\tstyle={ {\n\t\t\t\t'--wp-edit-site-start-template-options-start-blank': `\"${ START_BLANK_TITLE }\"`,\n\t\t\t} }\n\t\t>\n\t\t\t<BlockPatternsList\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\t\tonChange( 'start-blank' === pattern.name ? [] : blocks, {\n\t\t\t\t\t\tselection: undefined,\n\t\t\t\t\t} );\n\t\t\t\t\tonChoosePattern();\n\t\t\t\t} }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen={ true }\n\t\t>\n\t\t\t<div className=\"edit-site-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nconst START_TEMPLATE_MODAL_STATES = {\n\tINITIAL: 'INITIAL',\n\tCLOSED: 'CLOSED',\n};\n\nexport default function StartTemplateOptions() {\n\tconst [ modalState, setModalState ] = useState(\n\t\tSTART_TEMPLATE_MODAL_STATES.INITIAL\n\t);\n\tconst { shouldOpenModal, slug, isCustom, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst _postType = getEditedPostType();\n\t\t\tconst postId = getEditedPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\t'wp_template' === _postType &&\n\t\t\t\t\t! select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t),\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&\n\t\t\t! shouldOpenModal ) ||\n\t\tmodalState === START_TEMPLATE_MODAL_STATES.CLOSED\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () =>\n\t\t\t\tsetModalState( START_TEMPLATE_MODAL_STATES.CLOSED )\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/start-template-options/index.js"],"names":["useFallbackTemplateContent","slug","isCustom","templateContent","setTemplateContent","path","is_custom","ignore_empty","then","content","raw","useStartPatterns","fallbackContent","patterns","select","getEditedPostType","getEditedPostId","editSiteStore","getEntityRecord","coreStore","postId","postType","record","getSettings","blockEditorStore","__experimentalBlockPatterns","name","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","map","PatternSelection","onChoosePattern","onChange","blockPatterns","shownBlockPatterns","selection","undefined","StartModal","onClose","START_TEMPLATE_MODAL_STATES","INITIAL","CLOSED","StartTemplateOptions","modalState","setModalState","shouldOpenModal","_postType","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits","preferencesStore","get"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAEA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA,SAASA,0BAAT,CAAqCC,IAArC,EAA8D;AAAA,MAAnBC,QAAmB,uEAAR,KAAQ;AAC7D,QAAM,CAAEC,eAAF,EAAmBC,kBAAnB,IAA0C,uBAAU,EAAV,CAAhD;AAEA,0BAAW,MAAM;AAChB,2BAAU;AACTC,MAAAA,IAAI,EAAE,uBAAc,yBAAd,EAAyC;AAC9CJ,QAAAA,IAD8C;AAE9CK,QAAAA,SAAS,EAAEJ,QAFmC;AAG9CK,QAAAA,YAAY,EAAE;AAHgC,OAAzC;AADG,KAAV,EAMIC,IANJ,CAMU;AAAA,UAAE;AAAEC,QAAAA;AAAF,OAAF;AAAA,aAAmBL,kBAAkB,CAAEK,OAAO,CAACC,GAAV,CAArC;AAAA,KANV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,UADuC,EAEvCF,SAFuC,EAGvClC,MAHuC,CAAxC;AAMA,WAAO;AACNiC,MAAAA,eAAe,EACd,CAAEK,QAAF,IACA,OAAOD,cAAc,CAAChD,OADtB,IAEA,kBAAkB6C,SAFlB,IAGA,CAAExC,MAAM,CAAE6C,kBAAF,CAAN,CAA2BC,GAA3B,CACD,gBADC,EAED,cAFC,CALG;AASN3D,MAAAA,IAAI,EAAEwD,cAAc,CAACxD,IATf;AAUNC,MAAAA,QAAQ,EAAEuD,cAAc,CAACnD,SAVnB;AAWNe,MAAAA,QAAQ,EAAEiC;AAXJ,KAAP;AAaA,GAhCoD,EAiCrD,EAjCqD,CAAtD;;AAoCA,MACGH,UAAU,KAAKJ,2BAA2B,CAACC,OAA3C,IACD,CAAEK,eADH,IAEAF,UAAU,KAAKJ,2BAA2B,CAACE,MAH5C,EAIE;AACD,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,UAAD;AACC,IAAA,IAAI,EAAGhD,IADR;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,QAAQ,EAAGmB,QAHZ;AAIC,IAAA,OAAO,EAAG,MACT+B,aAAa,CAAEL,2BAA2B,CAACE,MAA9B;AALf,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\tconst [ templateContent, setTemplateContent ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} ),\n\t\t} ).then( ( { content } ) => setTemplateContent( content.raw ) );\n\t}, [ isCustom, slug ] );\n\treturn templateContent;\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst postId = getEditedPostId();\n\t\tconst postType = getEditedPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getSettings().__experimentalBlockPatterns,\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn { ...pattern, blocks: parse( pattern.content ) };\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen={ true }\n\t\t>\n\t\t\t<div className=\"edit-site-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"edit-site-start-template-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nconst START_TEMPLATE_MODAL_STATES = {\n\tINITIAL: 'INITIAL',\n\tCLOSED: 'CLOSED',\n};\n\nexport default function StartTemplateOptions() {\n\tconst [ modalState, setModalState ] = useState(\n\t\tSTART_TEMPLATE_MODAL_STATES.INITIAL\n\t);\n\tconst { shouldOpenModal, slug, isCustom, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst _postType = getEditedPostType();\n\t\t\tconst postId = getEditedPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\t'wp_template' === _postType &&\n\t\t\t\t\t! select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t),\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&\n\t\t\t! shouldOpenModal ) ||\n\t\tmodalState === START_TEMPLATE_MODAL_STATES.CLOSED\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () =>\n\t\t\t\tsetModalState( START_TEMPLATE_MODAL_STATES.CLOSED )\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|