@wordpress/edit-site 5.14.0 → 5.16.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-page/index.js +1 -6
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +22 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +10 -8
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/constants.js +1 -1
- package/build/components/block-editor/constants.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +0 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +114 -13
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/code-editor/index.js +60 -28
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +7 -3
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/editor/index.js +5 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +12 -7
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-block.js +16 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +12 -5
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +32 -25
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -3
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +4 -2
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +13 -9
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/layout/index.js +17 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/index.js +3 -3
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-actions/index.js +2 -2
- package/build/components/page-actions/index.js.map +1 -1
- package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
- package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-patterns/duplicate-menu-item.js +163 -0
- package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +83 -58
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/grid.js +5 -18
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/header.js +69 -0
- package/build/components/page-patterns/header.js.map +1 -0
- package/build/components/page-patterns/index.js +3 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/pagination.js +63 -0
- package/build/components/page-patterns/pagination.js.map +1 -0
- package/build/components/page-patterns/patterns-list.js +110 -31
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/rename-menu-item.js +109 -0
- package/build/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build/components/page-patterns/use-patterns.js +116 -118
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/add-new-template-part.js +74 -0
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-template-parts/index.js +3 -25
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/page-templates/index.js +1 -16
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +85 -51
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +10 -4
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +5 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +15 -8
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +31 -15
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +4 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- 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 +8 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -34
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +35 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +9 -7
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +19 -4
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +55 -28
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +72 -60
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +11 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +20 -9
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +29 -13
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
- 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 +1 -1
- 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 +15 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +3 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/template-actions/rename-menu-item.js +12 -8
- package/build/components/template-actions/rename-menu-item.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -1
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +120 -32
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +65 -7
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +138 -57
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +9 -2
- package/build/store/private-actions.js.map +1 -1
- package/build/utils/normalize-record-key.js +19 -0
- package/build/utils/normalize-record-key.js.map +1 -0
- package/build/utils/use-activate-theme.js +1 -1
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build/utils/use-debounced-input.js +5 -7
- package/build/utils/use-debounced-input.js.map +1 -1
- package/build-module/components/add-new-page/index.js +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +20 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +9 -6
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/constants.js +1 -1
- package/build-module/components/block-editor/constants.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +0 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +116 -14
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/code-editor/index.js +62 -30
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +6 -3
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +5 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +12 -7
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +16 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +13 -6
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +28 -21
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -3
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +6 -4
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +13 -9
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/layout/index.js +17 -5
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/index.js +3 -3
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-actions/index.js +2 -2
- package/build-module/components/page-actions/index.js.map +1 -1
- package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -17
- package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +84 -64
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +5 -17
- package/build-module/components/page-patterns/grid.js.map +1 -1
- package/build-module/components/page-patterns/header.js +54 -0
- package/build-module/components/page-patterns/header.js.map +1 -0
- package/build-module/components/page-patterns/index.js +3 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/pagination.js +54 -0
- package/build-module/components/page-patterns/pagination.js.map +1 -0
- package/build-module/components/page-patterns/patterns-list.js +111 -34
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/rename-menu-item.js +97 -0
- package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
- package/build-module/components/page-patterns/use-patterns.js +116 -119
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +4 -24
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +2 -15
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +87 -55
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-button/index.js +4 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +10 -4
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +5 -5
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +15 -9
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +29 -16
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -40
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +4 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- 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 +7 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -32
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +35 -25
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +8 -7
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +18 -4
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +53 -28
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +76 -60
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +9 -5
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +18 -9
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +28 -13
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
- 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 +1 -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 +16 -12
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +2 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/template-actions/rename-menu-item.js +11 -8
- package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +3 -1
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +116 -32
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +65 -9
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +139 -57
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +9 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/utils/normalize-record-key.js +12 -0
- package/build-module/utils/normalize-record-key.js.map +1 -0
- package/build-module/utils/use-activate-theme.js +1 -1
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-module/utils/use-debounced-input.js +5 -7
- package/build-module/utils/use-debounced-input.js.map +1 -1
- package/build-style/style-rtl.css +281 -103
- package/build-style/style.css +281 -103
- package/package.json +39 -40
- package/src/components/add-new-page/index.js +0 -3
- package/src/components/add-new-pattern/index.js +25 -12
- package/src/components/add-new-template/utils.js +9 -6
- package/src/components/block-editor/constants.js +5 -1
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/use-site-editor-settings.js +119 -20
- package/src/components/canvas-spinner/style.scss +14 -0
- package/src/components/code-editor/index.js +51 -33
- package/src/components/create-pattern-modal/index.js +5 -2
- package/src/components/editor/index.js +5 -5
- package/src/components/global-styles/global-styles-provider.js +7 -2
- package/src/components/global-styles/screen-block.js +15 -0
- package/src/components/global-styles/screen-revisions/index.js +64 -58
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +64 -48
- package/src/components/global-styles/style-variations-container.js +2 -0
- package/src/components/header-edit-mode/document-actions/index.js +8 -4
- package/src/components/header-edit-mode/document-actions/style.scss +45 -28
- package/src/components/header-edit-mode/index.js +29 -22
- package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
- package/src/components/layout/index.js +49 -22
- package/src/components/layout/style.scss +4 -3
- package/src/components/page/index.js +8 -8
- package/src/components/page/style.scss +8 -5
- package/src/components/page-actions/index.js +2 -2
- package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -22
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
- package/src/components/page-patterns/duplicate-menu-item.js +196 -0
- package/src/components/page-patterns/grid-item.js +189 -133
- package/src/components/page-patterns/grid.js +3 -20
- package/src/components/page-patterns/header.js +69 -0
- package/src/components/page-patterns/index.js +6 -1
- package/src/components/page-patterns/pagination.js +80 -0
- package/src/components/page-patterns/patterns-list.js +172 -71
- package/src/components/page-patterns/rename-menu-item.js +115 -0
- package/src/components/page-patterns/style.scss +141 -30
- package/src/components/page-patterns/use-patterns.js +115 -169
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -23
- package/src/components/page-templates/index.js +6 -19
- package/src/components/resizable-frame/index.js +104 -51
- package/src/components/resizable-frame/style.scss +9 -9
- package/src/components/save-button/index.js +2 -0
- package/src/components/save-hub/index.js +6 -1
- package/src/components/save-hub/style.scss +1 -1
- package/src/components/save-panel/index.js +10 -4
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
- package/src/components/sidebar-edit-mode/template-panel/index.js +15 -11
- package/src/components/sidebar-navigation-item/style.scss +5 -12
- package/src/components/sidebar-navigation-screen/index.js +30 -15
- package/src/components/sidebar-navigation-screen/style.scss +18 -0
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-global-styles/index.js +48 -44
- package/src/components/sidebar-navigation-screen-main/index.js +44 -40
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +4 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +16 -7
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
- package/src/components/sidebar-navigation-screen-page/index.js +3 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -35
- package/src/components/sidebar-navigation-screen-pages/index.js +48 -33
- package/src/components/sidebar-navigation-screen-pattern/index.js +5 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +23 -3
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +74 -43
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
- package/src/components/sidebar-navigation-screen-patterns/index.js +103 -106
- package/src/components/sidebar-navigation-screen-patterns/style.scss +20 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +7 -6
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +9 -0
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +31 -9
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
- package/src/components/site-hub/index.js +48 -29
- package/src/components/site-hub/style.scss +14 -2
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
- package/src/components/table/style.scss +1 -0
- package/src/components/template-actions/index.js +2 -1
- package/src/components/template-actions/rename-menu-item.js +17 -10
- package/src/components/use-edited-entity-record/index.js +6 -1
- package/src/hooks/commands/use-common-commands.js +105 -32
- package/src/hooks/commands/use-edit-mode-commands.js +94 -23
- package/src/hooks/push-changes-to-global-styles/index.js +141 -50
- package/src/store/private-actions.js +10 -2
- package/src/style.scss +10 -12
- package/src/utils/normalize-record-key.js +11 -0
- package/src/utils/use-activate-theme.js +1 -1
- package/src/utils/use-debounced-input.js +8 -7
- package/build/components/code-editor/code-editor-text-area.js +0 -96
- package/build/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build/components/keyboard-shortcuts/index.js +0 -148
- package/build/components/keyboard-shortcuts/index.js.map +0 -1
- package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build/components/page-content-focus-manager/constants.js +0 -9
- package/build/components/page-content-focus-manager/constants.js.map +0 -1
- package/build-module/components/code-editor/code-editor-text-area.js +0 -84
- package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/index.js +0 -132
- package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
- package/build-module/components/page-content-focus-manager/constants.js +0 -2
- package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
- package/src/components/code-editor/code-editor-text-area.js +0 -84
- package/src/components/keyboard-shortcuts/index.js +0 -137
- package/src/components/page-content-focus-manager/constants.js +0 -5
|
@@ -13,8 +13,12 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _components = require("@wordpress/components");
|
|
15
15
|
|
|
16
|
+
var _compose = require("@wordpress/compose");
|
|
17
|
+
|
|
16
18
|
var _data = require("@wordpress/data");
|
|
17
19
|
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
18
22
|
var _lockUnlock = require("../../lock-unlock");
|
|
19
23
|
|
|
20
24
|
var _store = require("../../store");
|
|
@@ -43,7 +47,7 @@ const HANDLE_STYLES_OVERRIDE = {
|
|
|
43
47
|
left: undefined
|
|
44
48
|
}; // The minimum width of the frame (in px) while resizing.
|
|
45
49
|
|
|
46
|
-
const FRAME_MIN_WIDTH =
|
|
50
|
+
const FRAME_MIN_WIDTH = 320; // The reference width of the frame (in px) used to calculate the aspect ratio.
|
|
47
51
|
|
|
48
52
|
const FRAME_REFERENCE_WIDTH = 1300; // 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.
|
|
49
53
|
|
|
@@ -51,7 +55,12 @@ const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5; // The minimum distance (in px) betw
|
|
|
51
55
|
// viewport's edge. If the frame is resized to be closer to the viewport's edge
|
|
52
56
|
// than this distance, then "canvas mode" will be enabled.
|
|
53
57
|
|
|
54
|
-
const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
|
|
58
|
+
const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200; // Default size for the `frameSize` state.
|
|
59
|
+
|
|
60
|
+
const INITIAL_FRAME_SIZE = {
|
|
61
|
+
width: '100%',
|
|
62
|
+
height: '100%'
|
|
63
|
+
};
|
|
55
64
|
|
|
56
65
|
function calculateNewHeight(width, initialAspectRatio) {
|
|
57
66
|
const lerp = (a, b, amount) => {
|
|
@@ -68,41 +77,32 @@ function calculateNewHeight(width, initialAspectRatio) {
|
|
|
68
77
|
|
|
69
78
|
function ResizableFrame({
|
|
70
79
|
isFullWidth,
|
|
80
|
+
isOversized,
|
|
81
|
+
setIsOversized,
|
|
71
82
|
isReady,
|
|
72
83
|
children,
|
|
73
|
-
|
|
84
|
+
|
|
85
|
+
/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */
|
|
86
|
+
defaultSize,
|
|
74
87
|
innerContentStyle
|
|
75
88
|
}) {
|
|
76
|
-
const [frameSize, setFrameSize] = (0, _element.useState)(
|
|
77
|
-
width: '100%',
|
|
78
|
-
height: '100%'
|
|
79
|
-
}); // The width of the resizable frame when a new resize gesture starts.
|
|
89
|
+
const [frameSize, setFrameSize] = (0, _element.useState)(INITIAL_FRAME_SIZE); // The width of the resizable frame when a new resize gesture starts.
|
|
80
90
|
|
|
81
91
|
const [startingWidth, setStartingWidth] = (0, _element.useState)();
|
|
82
92
|
const [isResizing, setIsResizing] = (0, _element.useState)(false);
|
|
83
|
-
const [
|
|
84
|
-
const [isOversized, setIsOversized] = (0, _element.useState)(false);
|
|
93
|
+
const [shouldShowHandle, setShouldShowHandle] = (0, _element.useState)(false);
|
|
85
94
|
const [resizeRatio, setResizeRatio] = (0, _element.useState)(1);
|
|
95
|
+
const canvasMode = (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_store.store)).getCanvasMode(), []);
|
|
86
96
|
const {
|
|
87
97
|
setCanvasMode
|
|
88
98
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
89
|
-
const initialAspectRatioRef = (0, _element.useRef)(null); // The width of the resizable frame on initial render.
|
|
90
|
-
|
|
91
|
-
const initialComputedWidthRef = (0, _element.useRef)(null);
|
|
92
99
|
const FRAME_TRANSITION = {
|
|
93
100
|
type: 'tween',
|
|
94
101
|
duration: isResizing ? 0 : 0.5
|
|
95
102
|
};
|
|
96
|
-
const frameRef = (0, _element.useRef)(null);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const {
|
|
100
|
-
offsetWidth,
|
|
101
|
-
offsetHeight
|
|
102
|
-
} = frameRef.current.resizable;
|
|
103
|
-
initialComputedWidthRef.current = offsetWidth;
|
|
104
|
-
initialAspectRatioRef.current = offsetWidth / offsetHeight;
|
|
105
|
-
}, []);
|
|
103
|
+
const frameRef = (0, _element.useRef)(null);
|
|
104
|
+
const resizableHandleHelpId = (0, _compose.useInstanceId)(ResizableFrame, 'edit-site-resizable-frame-handle-help');
|
|
105
|
+
const defaultAspectRatio = defaultSize.width / defaultSize.height;
|
|
106
106
|
|
|
107
107
|
const handleResizeStart = (_event, _direction, ref) => {
|
|
108
108
|
// Remember the starting width so we don't have to get `ref.offsetWidth` on
|
|
@@ -116,17 +116,17 @@ function ResizableFrame({
|
|
|
116
116
|
const normalizedDelta = delta.width / resizeRatio;
|
|
117
117
|
const deltaAbs = Math.abs(normalizedDelta);
|
|
118
118
|
const maxDoubledDelta = delta.width < 0 // is shrinking
|
|
119
|
-
? deltaAbs : (
|
|
119
|
+
? deltaAbs : (defaultSize.width - startingWidth) / 2;
|
|
120
120
|
const deltaToDouble = Math.min(deltaAbs, maxDoubledDelta);
|
|
121
121
|
const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;
|
|
122
122
|
const singleSegment = 1 - doubleSegment;
|
|
123
123
|
setResizeRatio(singleSegment + doubleSegment * 2);
|
|
124
124
|
const updatedWidth = startingWidth + delta.width;
|
|
125
|
-
setIsOversized(updatedWidth >
|
|
125
|
+
setIsOversized(updatedWidth > defaultSize.width); // Width will be controlled by the library (via `resizeRatio`),
|
|
126
126
|
// so we only need to update the height.
|
|
127
127
|
|
|
128
128
|
setFrameSize({
|
|
129
|
-
height: isOversized ? '100%' : calculateNewHeight(updatedWidth,
|
|
129
|
+
height: isOversized ? '100%' : calculateNewHeight(updatedWidth, defaultAspectRatio)
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
132
|
|
|
@@ -143,14 +143,27 @@ function ResizableFrame({
|
|
|
143
143
|
if (remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD) {
|
|
144
144
|
// Reset the initial aspect ratio if the frame is resized slightly
|
|
145
145
|
// above the sidebar but not far enough to trigger full screen.
|
|
146
|
-
setFrameSize(
|
|
147
|
-
width: '100%',
|
|
148
|
-
height: '100%'
|
|
149
|
-
});
|
|
146
|
+
setFrameSize(INITIAL_FRAME_SIZE);
|
|
150
147
|
} else {
|
|
151
148
|
// Trigger full screen if the frame is resized far enough to the left.
|
|
152
149
|
setCanvasMode('edit');
|
|
153
150
|
}
|
|
151
|
+
}; // Handle resize by arrow keys
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
const handleResizableHandleKeyDown = event => {
|
|
155
|
+
if (!['ArrowLeft', 'ArrowRight'].includes(event.key)) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
const step = 20 * (event.shiftKey ? 5 : 1);
|
|
161
|
+
const delta = step * (event.key === 'ArrowLeft' ? 1 : -1);
|
|
162
|
+
const newWidth = Math.min(Math.max(FRAME_MIN_WIDTH, frameRef.current.resizable.offsetWidth + delta), defaultSize.width);
|
|
163
|
+
setFrameSize({
|
|
164
|
+
width: newWidth,
|
|
165
|
+
height: calculateNewHeight(newWidth, defaultAspectRatio)
|
|
166
|
+
});
|
|
154
167
|
};
|
|
155
168
|
|
|
156
169
|
const frameAnimationVariants = {
|
|
@@ -164,16 +177,29 @@ function ResizableFrame({
|
|
|
164
177
|
}
|
|
165
178
|
};
|
|
166
179
|
const resizeHandleVariants = {
|
|
167
|
-
|
|
180
|
+
hidden: {
|
|
181
|
+
opacity: 0,
|
|
182
|
+
left: 0
|
|
183
|
+
},
|
|
184
|
+
visible: {
|
|
168
185
|
opacity: 1,
|
|
169
186
|
left: -16
|
|
170
187
|
},
|
|
171
|
-
|
|
188
|
+
active: {
|
|
172
189
|
opacity: 1,
|
|
173
190
|
left: -16,
|
|
174
191
|
scaleY: 1.3
|
|
175
192
|
}
|
|
176
193
|
};
|
|
194
|
+
|
|
195
|
+
const currentResizeHandleVariant = (() => {
|
|
196
|
+
if (isResizing) {
|
|
197
|
+
return 'active';
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return shouldShowHandle ? 'visible' : 'hidden';
|
|
201
|
+
})();
|
|
202
|
+
|
|
177
203
|
return (0, _element.createElement)(_components.ResizableBox, {
|
|
178
204
|
as: _components.__unstableMotion.div,
|
|
179
205
|
ref: frameRef,
|
|
@@ -208,34 +234,42 @@ function ResizableFrame({
|
|
|
208
234
|
minWidth: FRAME_MIN_WIDTH,
|
|
209
235
|
maxWidth: isFullWidth ? '100%' : '150%',
|
|
210
236
|
maxHeight: '100%',
|
|
211
|
-
|
|
212
|
-
|
|
237
|
+
onFocus: () => setShouldShowHandle(true),
|
|
238
|
+
onBlur: () => setShouldShowHandle(false),
|
|
239
|
+
onMouseOver: () => setShouldShowHandle(true),
|
|
240
|
+
onMouseOut: () => setShouldShowHandle(false),
|
|
213
241
|
handleComponent: {
|
|
214
|
-
left:
|
|
242
|
+
left: canvasMode === 'view' && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.Tooltip, {
|
|
243
|
+
text: (0, _i18n.__)('Drag to resize')
|
|
244
|
+
}, (0, _element.createElement)(_components.__unstableMotion.button, {
|
|
215
245
|
key: "handle",
|
|
216
|
-
|
|
246
|
+
role: "separator",
|
|
247
|
+
"aria-orientation": "vertical",
|
|
248
|
+
className: (0, _classnames.default)('edit-site-resizable-frame__handle', {
|
|
249
|
+
'is-resizing': isResizing
|
|
250
|
+
}),
|
|
217
251
|
variants: resizeHandleVariants,
|
|
218
|
-
animate:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
whileHover:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
252
|
+
animate: currentResizeHandleVariant,
|
|
253
|
+
"aria-label": (0, _i18n.__)('Drag to resize'),
|
|
254
|
+
"aria-describedby": resizableHandleHelpId,
|
|
255
|
+
"aria-valuenow": frameRef.current?.resizable?.offsetWidth || undefined,
|
|
256
|
+
"aria-valuemin": FRAME_MIN_WIDTH,
|
|
257
|
+
"aria-valuemax": defaultSize.width,
|
|
258
|
+
onKeyDown: handleResizableHandleKeyDown,
|
|
259
|
+
initial: "hidden",
|
|
260
|
+
exit: "hidden",
|
|
261
|
+
whileFocus: "active",
|
|
262
|
+
whileHover: "active"
|
|
263
|
+
})), (0, _element.createElement)("div", {
|
|
264
|
+
hidden: true,
|
|
265
|
+
id: resizableHandleHelpId
|
|
266
|
+
}, (0, _i18n.__)('Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.')))
|
|
232
267
|
},
|
|
233
268
|
onResizeStart: handleResizeStart,
|
|
234
269
|
onResize: handleResize,
|
|
235
270
|
onResizeStop: handleResizeStop,
|
|
236
271
|
className: (0, _classnames.default)('edit-site-resizable-frame__inner', {
|
|
237
|
-
'is-resizing': isResizing
|
|
238
|
-
[oversizedClassName]: isOversized
|
|
272
|
+
'is-resizing': isResizing
|
|
239
273
|
})
|
|
240
274
|
}, (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
241
275
|
className: "edit-site-resizable-frame__inner-content",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"names":["HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isReady","children","oversizedClassName","innerContentStyle","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","isHovering","setIsHovering","isOversized","setIsOversized","resizeRatio","setResizeRatio","setCanvasMode","editSiteStore","initialAspectRatioRef","initialComputedWidthRef","FRAME_TRANSITION","type","duration","frameRef","offsetWidth","offsetHeight","current","resizable","handleResizeStart","_event","_direction","ref","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","opacity","resizing","scaleY","motion","div","definition","topRight","bottomRight","bottomLeft","topLeft","borderRadius"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAIA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAIA;AACA,MAAMA,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAEC,SADoB;AAE9BC,EAAAA,UAAU,EAAED,SAFkB;AAG9BE,EAAAA,MAAM,EAAEF,SAHsB;AAI9BG,EAAAA,KAAK,EAAEH,SAJuB;AAK9BI,EAAAA,MAAM,EAAEJ,SALsB;AAM9BK,EAAAA,GAAG,EAAEL,SANyB;AAO9BM,EAAAA,KAAK,EAAEN,SAPuB;AAQ9BO,EAAAA,MAAM,EAAEP,SARsB;AAS9BQ,EAAAA,IAAI,EAAER;AATwB,CAA/B,C,CAYA;;AACA,MAAMS,eAAe,GAAG,GAAxB,C,CACA;;AACA,MAAMC,qBAAqB,GAAG,IAA9B,C,CACA;;AACA,MAAMC,yBAAyB,GAAG,IAAI,IAAtC,C,CACA;AACA;AACA;;AACA,MAAMC,kCAAkC,GAAG,GAA3C;;AAEA,SAASC,kBAAT,CAA6BV,KAA7B,EAAoCW,kBAApC,EAAyD;AACxD,QAAMC,IAAI,GAAG,CAAEC,CAAF,EAAKC,CAAL,EAAQC,MAAR,KAAoB;AAChC,WAAOF,CAAC,GAAG,CAAEC,CAAC,GAAGD,CAAN,IAAYE,MAAvB;AACA,GAFD,CADwD,CAKxD;;;AACA,QAAMC,UAAU,GACf,IACAC,IAAI,CAACC,GAAL,CACC,CADD,EAECD,IAAI,CAACE,GAAL,CACC,CADD,EAEC,CAAEnB,KAAK,GAAGM,eAAV,KACGC,qBAAqB,GAAGD,eAD3B,CAFD,CAFD,CAFD,CANwD,CAiBx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AD,CAAQ,GAAR;AACC,QAAA,GAAG,EAAC,QADL;AAEC,QAAA,SAAS,EAAC,mCAFX;AAGC,QAAA,QAAQ,EAAG2C,oBAHZ;AAIC,QAAA,OAAO,EAAG3C,UAAU,GAAG,UAAH,GAAgB,SAJrC;AAKC,QAAA,KAAK,EAAC,gBALP;AAMC,QAAA,OAAO,EAAG;AACT4C,UAAAA,OAAO,EAAE,CADA;AAETtE,UAAAA,IAAI,EAAE;AAFG,SANX;AAUC,QAAA,IAAI,EAAG;AACNsE,UAAAA,OAAO,EAAE,CADH;AAENtE,UAAAA,IAAI,EAAE;AAFA,SAVR;AAcC,QAAA,UAAU,EAAG;AAAEwE,UAAAA,MAAM,EAAE;AAAV;AAdd,QADD,GAiBI;AAnBY,KAlCnB;AAuDC,IAAA,aAAa,EAAG1B,iBAvDjB;AAwDC,IAAA,QAAQ,EAAGI,YAxDZ;AAyDC,IAAA,YAAY,EAAGW,gBAzDhB;AA0DC,IAAA,SAAS,EAAG,yBAAY,kCAAZ,EAAgD;AAC3D,qBAAenC,UAD4C;AAE3D,OAAEN,kBAAF,GAAwBU;AAFmC,KAAhD;AA1Db,KA+DC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG;AACTkD,MAAAA,YAAY,EAAE/D,WAAW,GAAG,CAAH,GAAO;AADvB,KAFX;AAKC,IAAA,UAAU,EAAGqB,gBALd;AAMC,IAAA,KAAK,EAAGjB;AANT,KAQGF,QARH,CA/DD,CADD;AA4EA;;eAEcH,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef, useEffect } from '@wordpress/element';\nimport {\n\tResizableBox,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 340;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisReady,\n\tchildren,\n\toversizedClassName,\n\tinnerContentStyle,\n} ) {\n\tconst [ frameSize, setFrameSize ] = useState( {\n\t\twidth: '100%',\n\t\theight: '100%',\n\t} );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ isHovering, setIsHovering ] = useState( false );\n\tconst [ isOversized, setIsOversized ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst initialAspectRatioRef = useRef( null );\n\t// The width of the resizable frame on initial render.\n\tconst initialComputedWidthRef = useRef( null );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\n\t// Remember frame dimensions on initial render.\n\tuseEffect( () => {\n\t\tconst { offsetWidth, offsetHeight } = frameRef.current.resizable;\n\t\tinitialComputedWidthRef.current = offsetWidth;\n\t\tinitialAspectRatioRef.current = offsetWidth / offsetHeight;\n\t}, [] );\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( initialComputedWidthRef.current - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > initialComputedWidthRef.current );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight(\n\t\t\t\t\t\tupdatedWidth,\n\t\t\t\t\t\tinitialAspectRatioRef.current\n\t\t\t\t ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\tdefault: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t},\n\t\tresizing: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' )\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t} }\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\tleft: isReady,\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight={ '100%' }\n\t\t\tonMouseOver={ () => setIsHovering( true ) }\n\t\t\tonMouseOut={ () => setIsHovering( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\tleft:\n\t\t\t\t\tisHovering || isResizing ? (\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\tclassName=\"edit-site-resizable-frame__handle\"\n\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\tanimate={ isResizing ? 'resizing' : 'default' }\n\t\t\t\t\t\t\ttitle=\"Drag to resize\"\n\t\t\t\t\t\t\tinitial={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t\tleft: 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\tleft: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\twhileHover={ { scaleY: 1.3 } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ classnames( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t[ oversizedClassName ]: isOversized,\n\t\t\t} ) }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tborderRadius: isFullWidth ? 0 : 8,\n\t\t\t\t} }\n\t\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</motion.div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"names":["HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","INITIAL_FRAME_SIZE","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isOversized","setIsOversized","isReady","children","defaultSize","innerContentStyle","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","canvasMode","select","editSiteStore","getCanvasMode","setCanvasMode","FRAME_TRANSITION","type","duration","frameRef","resizableHandleHelpId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","motion","div","definition","topRight","bottomRight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AYC,yBACCD,QAAQ,CAAC+B,OAAT,EAAkBC,SAAlB,EAA6BzB,WAA7B,IACA1D,SAdF;AAgBC,yBAAgBS,eAhBjB;AAiBC,yBAAgBsB,WAAW,CAAC5B,KAjB7B;AAkBC,QAAA,SAAS,EAAGuE,4BAlBb;AAmBC,QAAA,OAAO,EAAC,QAnBT;AAoBC,QAAA,IAAI,EAAC,QApBN;AAqBC,QAAA,UAAU,EAAC,QArBZ;AAsBC,QAAA,UAAU,EAAC;AAtBZ,QAHD,CADD,EA6BC;AAAK,QAAA,MAAM,MAAX;AAAY,QAAA,EAAE,EAAGtB;AAAjB,SACG,cACD,gGADC,CADH,CA7BD;AAFgB,KApCnB;AA2EC,IAAA,aAAa,EAAGE,iBA3EjB;AA4EC,IAAA,QAAQ,EAAGK,YA5EZ;AA6EC,IAAA,YAAY,EAAGW,gBA7EhB;AA8EC,IAAA,SAAS,EAAG,yBAAY,kCAAZ,EAAgD;AAC3D,qBAAejC;AAD4C,KAAhD;AA9Eb,KAkFC,4BAAC,4BAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,OAAO,EAAG;AACTiE,MAAAA,YAAY,EAAE5E,WAAW,GAAG,CAAH,GAAO;AADvB,KAFX;AAKC,IAAA,UAAU,EAAGsB,gBALd;AAMC,IAAA,KAAK,EAAGhB;AANT,KAQGF,QARH,CAlFD,CADD;AA+FA;;eAEcL,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta = step * ( event.key === 'ArrowLeft' ? 1 : -1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\tleft: 0,\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\tleft: -16,\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' )\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t} }\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tright: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\tleft: isReady,\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight={ '100%' }\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\tleft: canvasMode === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t\t\t\t{ /* Disable reason: role=\"separator\" does in fact support aria-valuenow */ }\n\t\t\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }\n\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\tframeRef.current?.resizable?.offsetWidth ||\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResizableHandleKeyDown }\n\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ classnames( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tborderRadius: isFullWidth ? 0 : 8,\n\t\t\t\t} }\n\t\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</motion.div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"]}
|
|
@@ -33,7 +33,8 @@ function SaveButton({
|
|
|
33
33
|
variant = 'primary',
|
|
34
34
|
showTooltip = true,
|
|
35
35
|
defaultLabel,
|
|
36
|
-
icon
|
|
36
|
+
icon,
|
|
37
|
+
__next40pxDefaultSize = false
|
|
37
38
|
}) {
|
|
38
39
|
const {
|
|
39
40
|
isDirty,
|
|
@@ -109,7 +110,8 @@ function SaveButton({
|
|
|
109
110
|
*/
|
|
110
111
|
,
|
|
111
112
|
showTooltip: showTooltip,
|
|
112
|
-
icon: icon
|
|
113
|
+
icon: icon,
|
|
114
|
+
__next40pxDefaultSize: __next40pxDefaultSize
|
|
113
115
|
}, label);
|
|
114
116
|
}
|
|
115
117
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["SaveButton","className","variant","showTooltip","defaultLabel","icon","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","isSaveViewOpened","editSiteStore","length","some","record","kind","name","key","setIsSaveViewOpened","activateSaveEnabled","disabled","getLabel","label","undefined","displayShortcut","primary"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIe,SAASA,UAAT,CAAqB;AACnCC,EAAAA,SAAS,GAAG,+BADuB;AAEnCC,EAAAA,OAAO,GAAG,SAFyB;AAGnCC,EAAAA,WAAW,GAAG,IAHqB;AAInCC,EAAAA,YAJmC;AAKnCC,EAAAA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["SaveButton","className","variant","showTooltip","defaultLabel","icon","__next40pxDefaultSize","isDirty","isSaving","isSaveViewOpen","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","isSaveViewOpened","editSiteStore","length","some","record","kind","name","key","setIsSaveViewOpened","activateSaveEnabled","disabled","getLabel","label","undefined","displayShortcut","primary"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIe,SAASA,UAAT,CAAqB;AACnCC,EAAAA,SAAS,GAAG,+BADuB;AAEnCC,EAAAA,OAAO,GAAG,SAFyB;AAGnCC,EAAAA,WAAW,GAAG,IAHqB;AAInCC,EAAAA,YAJmC;AAKnCC,EAAAA,IALmC;AAMnCC,EAAAA,qBAAqB,GAAG;AANW,CAArB,EAOX;AACH,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA,QAAX;AAAqBC,IAAAA;AAArB,MAAwC,qBAAaC,MAAF,IAAc;AACtE,UAAM;AAAEC,MAAAA,mCAAF;AAAuCC,MAAAA;AAAvC,QACLF,MAAM,CAAEG,eAAF,CADP;;AAEA,UAAMC,kBAAkB,GAAGH,mCAAmC,EAA9D;;AACA,UAAM;AAAEI,MAAAA;AAAF,QAAuBL,MAAM,CAAEM,YAAF,CAAnC;AACA,WAA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AMC,IAAA,OAAO,EAAGiB,QAAQ,GAAGG,SAAH,GAAe,MAAML,mBAAmB,CAAE,IAAF,CAN3D;AAOC,IAAA,KAAK,EAAGI;AACR;AACH;AACA;AACA;AAXE;AAYC,IAAA,QAAQ,EAAGF,QAAQ,GAAGG,SAAH,GAAeC,0BAAgBC,OAAhB,CAAyB,GAAzB;AAClC;AACH;AACA;AACA;AACA;AACA;AAlBE;AAmBC,IAAA,WAAW,EAAG3B,WAnBf;AAoBC,IAAA,IAAI,EAAGE,IApBR;AAqBC,IAAA,qBAAqB,EAAGC;AArBzB,KAuBGqB,KAvBH,CADD;AA2BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tdefaultLabel,\n\ticon,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { isDirty, isSaving, isSaveViewOpen } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t),\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn __( 'Activating' );\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( isDirty ) {\n\t\t\t\treturn __( 'Activate & Save' );\n\t\t\t}\n\t\t\treturn __( 'Activate' );\n\t\t}\n\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t} else if ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t} else if ( defaultLabel ) {\n\t\t\treturn defaultLabel;\n\t\t}\n\t\treturn __( 'Save' );\n\t};\n\tconst label = getLabel();\n\n\treturn (\n\t\t<Button\n\t\t\tvariant={ variant }\n\t\t\tclassName={ className }\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : () => setIsSaveViewOpened( true ) }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t & the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\t\t\ticon={ icon }\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"]}
|
|
@@ -47,6 +47,7 @@ const PUBLISH_ON_SAVE_ENTITIES = [{
|
|
|
47
47
|
}];
|
|
48
48
|
|
|
49
49
|
function SaveHub() {
|
|
50
|
+
const saveNoticeId = 'site-edit-save-notice';
|
|
50
51
|
const {
|
|
51
52
|
params
|
|
52
53
|
} = useLocation();
|
|
@@ -55,7 +56,8 @@ function SaveHub() {
|
|
|
55
56
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
56
57
|
const {
|
|
57
58
|
createSuccessNotice,
|
|
58
|
-
createErrorNotice
|
|
59
|
+
createErrorNotice,
|
|
60
|
+
removeNotice
|
|
59
61
|
} = (0, _data.useDispatch)(_notices.store);
|
|
60
62
|
const {
|
|
61
63
|
dirtyCurrentEntity,
|
|
@@ -105,6 +107,7 @@ function SaveHub() {
|
|
|
105
107
|
|
|
106
108
|
const saveCurrentEntity = async () => {
|
|
107
109
|
if (!dirtyCurrentEntity) return;
|
|
110
|
+
removeNotice(saveNoticeId);
|
|
108
111
|
const {
|
|
109
112
|
kind,
|
|
110
113
|
name,
|
|
@@ -128,7 +131,8 @@ function SaveHub() {
|
|
|
128
131
|
__unstableMarkLastChangeAsPersistent();
|
|
129
132
|
|
|
130
133
|
createSuccessNotice((0, _i18n.__)('Site updated.'), {
|
|
131
|
-
type: 'snackbar'
|
|
134
|
+
type: 'snackbar',
|
|
135
|
+
id: saveNoticeId
|
|
132
136
|
});
|
|
133
137
|
} catch (error) {
|
|
134
138
|
createErrorNotice(`${(0, _i18n.__)('Saving failed.')} ${error}`);
|
|
@@ -145,13 +149,15 @@ function SaveHub() {
|
|
|
145
149
|
isBusy: isSaving,
|
|
146
150
|
disabled: isSaving,
|
|
147
151
|
"aria-disabled": isSaving,
|
|
148
|
-
className: "edit-site-save-hub__button"
|
|
152
|
+
className: "edit-site-save-hub__button",
|
|
153
|
+
__next40pxDefaultSize: true
|
|
149
154
|
}, label) : (0, _element.createElement)(_saveButton.default, {
|
|
150
155
|
className: "edit-site-save-hub__button",
|
|
151
156
|
variant: disabled ? null : 'primary',
|
|
152
157
|
showTooltip: false,
|
|
153
158
|
icon: disabled && !isSaving ? _icons.check : null,
|
|
154
|
-
defaultLabel: label
|
|
159
|
+
defaultLabel: label,
|
|
160
|
+
__next40pxDefaultSize: true
|
|
155
161
|
}));
|
|
156
162
|
}
|
|
157
163
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"names":["useLocation","routerPrivateApis","PUBLISH_ON_SAVE_ENTITIES","kind","name","SaveHub","params","__unstableMarkLastChangeAsPersistent","blockEditorStore","createSuccessNotice","createErrorNotice","noticesStore","dirtyCurrentEntity","countUnsavedChanges","isDirty","isSaving","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","calcDirtyCurrentEntity","length","path","includes","find","record","postId","postType","String","key","some","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","disabled","label","saveCurrentEntity","property","undefined","typeToPublish","status","type","error","check"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAUA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,wBAAQC,mBAAR,CAAxB;AAEA,MAAMC,wBAAwB,GAAG,CAChC;AACCC,EAAAA,IAAI,EAAE,UADP;AAECC,EAAAA,IAAI,EAAE;AAFP,CADgC,CAAjC;;AAOe,SAASC,OAAT,GAAmB;AACjC,QAAM;AAAEC,IAAAA;AAAF,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-hub/index.js"],"names":["useLocation","routerPrivateApis","PUBLISH_ON_SAVE_ENTITIES","kind","name","SaveHub","saveNoticeId","params","__unstableMarkLastChangeAsPersistent","blockEditorStore","createSuccessNotice","createErrorNotice","removeNotice","noticesStore","dirtyCurrentEntity","countUnsavedChanges","isDirty","isSaving","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","coreStore","dirtyEntityRecords","calcDirtyCurrentEntity","length","path","includes","find","record","postId","postType","String","key","some","editEntityRecord","saveEditedEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","disabled","label","saveCurrentEntity","property","undefined","typeToPublish","status","type","id","error","check"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAUA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAkB,wBAAQC,mBAAR,CAAxB;AAEA,MAAMC,wBAAwB,GAAG,CAChC;AACCC,EAAAA,IAAI,EAAE,UADP;AAECC,EAAAA,IAAI,EAAE;AAFP,CADgC,CAAjC;;AAOe,SAASC,OAAT,GAAmB;AACjC,QAAMC,YAAY,GAAG,uBAArB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAaP,WAAW,EAA9B;AAEA,QAAM;AAAEQ,IAAAA;AAAF,MACL,uBAAaC,kBAAb,CADD;AAGA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA,iBAAvB;AAA0CC,IAAAA;AAA1C,MACL,uBAAaC,cAAb,CADD;AAGA,QAAM;AAAEC,IAAAA,kBAAF;AAAsBC,IAAAA,mBAAtB;AAA2CC,IAAAA,OAA3C;AAAoDC,IAAAA;AAApD,MACL,qBACGC,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,mCADK;AAELC,MAAAA;AAFK,QAGFF,MAAM,CAAEG,eAAF,CAHV;;AAIA,UAAMC,kBAAkB,GACvBH,mCAAmC,EADpC;;AAEA,QAAII,sBAAsB,GAAG,IAA7B;;AAEA,QAAKD,kBAAkB,CAACE,MAAnB,KAA8B,CAAnC,EAAuC;AACtC;AACA,UAAKjB,MAAM,CAACkB,IAAP,EAAaC,QAAb,CAAuB,kBAAvB,CAAL,EAAmD;AAClDH,QAAAA,sBAAsB,GAAGD,kBAAkB,CAACK,IAAnB,CACtBC,MAAF,IAAcA,MAAM,CAACxB,IAAP,KAAgB,cADN,CAAzB;AAGA,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AFX;AAGC,IAAA,MAAM,EAAGvB,QAHV;AAIC,IAAA,QAAQ,EAAGA,QAJZ;AAKC,qBAAgBA,QALjB;AAMC,IAAA,SAAS,EAAC,4BANX;AAOC,IAAA,qBAAqB;AAPtB,KASGsB,KATH,CADmB,GAanB,4BAAC,mBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,OAAO,EAAGD,QAAQ,GAAG,IAAH,GAAU,SAF7B;AAGC,IAAA,WAAW,EAAG,KAHf;AAIC,IAAA,IAAI,EAAGA,QAAQ,IAAI,CAAErB,QAAd,GAAyB+B,YAAzB,GAAiC,IAJzC;AAKC,IAAA,YAAY,EAAGT,KALhB;AAMC,IAAA,qBAAqB;AANtB,IAdF,CADD;AA0BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, __experimentalHStack as HStack } from '@wordpress/components';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { check } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst PUBLISH_ON_SAVE_ENTITIES = [\n\t{\n\t\tkind: 'postType',\n\t\tname: 'wp_navigation',\n\t},\n];\n\nexport default function SaveHub() {\n\tconst saveNoticeId = 'site-edit-save-notice';\n\tconst { params } = useLocation();\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { createSuccessNotice, createErrorNotice, removeNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { dirtyCurrentEntity, countUnsavedChanges, isDirty, isSaving } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\t\tisSavingEntityRecord,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tconst dirtyEntityRecords =\n\t\t\t\t\t__experimentalGetDirtyEntityRecords();\n\t\t\t\tlet calcDirtyCurrentEntity = null;\n\n\t\t\t\tif ( dirtyEntityRecords.length === 1 ) {\n\t\t\t\t\t// if we are on global styles\n\t\t\t\t\tif ( params.path?.includes( 'wp_global_styles' ) ) {\n\t\t\t\t\t\tcalcDirtyCurrentEntity = dirtyEntityRecords.find(\n\t\t\t\t\t\t\t( record ) => record.name === 'globalStyles'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\t// if we are on pages\n\t\t\t\t\telse if ( params.postId ) {\n\t\t\t\t\t\tcalcDirtyCurrentEntity = dirtyEntityRecords.find(\n\t\t\t\t\t\t\t( record ) =>\n\t\t\t\t\t\t\t\trecord.name === params.postType &&\n\t\t\t\t\t\t\t\tString( record.key ) === params.postId\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tdirtyCurrentEntity: calcDirtyCurrentEntity,\n\t\t\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\t\t\tisSaving: dirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tcountUnsavedChanges: dirtyEntityRecords.length,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ params.path, params.postType, params.postId ]\n\t\t);\n\n\tconst {\n\t\teditEntityRecord,\n\t\tsaveEditedEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst disabled = isSaving || ( ! isDirty && ! isPreviewingTheme() );\n\n\t// if we have only one unsaved change and it matches current context, we can show a more specific label\n\tlet label = dirtyCurrentEntity\n\t\t? __( 'Save' )\n\t\t: sprintf(\n\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Review %d change…',\n\t\t\t\t\t'Review %d changes…',\n\t\t\t\t\tcountUnsavedChanges\n\t\t\t\t),\n\t\t\t\tcountUnsavedChanges\n\t\t );\n\n\tif ( isSaving ) {\n\t\tlabel = __( 'Saving' );\n\t}\n\n\tconst saveCurrentEntity = async () => {\n\t\tif ( ! dirtyCurrentEntity ) return;\n\n\t\tremoveNotice( saveNoticeId );\n\t\tconst { kind, name, key, property } = dirtyCurrentEntity;\n\n\t\ttry {\n\t\t\tif ( 'root' === dirtyCurrentEntity.kind && 'site' === name ) {\n\t\t\t\tawait saveSpecifiedEntityEdits( 'root', 'site', undefined, [\n\t\t\t\t\tproperty,\n\t\t\t\t] );\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tPUBLISH_ON_SAVE_ENTITIES.some(\n\t\t\t\t\t\t( typeToPublish ) =>\n\t\t\t\t\t\t\ttypeToPublish.kind === kind &&\n\t\t\t\t\t\t\ttypeToPublish.name === name\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\teditEntityRecord( kind, name, key, { status: 'publish' } );\n\t\t\t\t}\n\n\t\t\t\tawait saveEditedEntityRecord( kind, name, key );\n\t\t\t}\n\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\n\t\t\tcreateSuccessNotice( __( 'Site updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: saveNoticeId,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` );\n\t\t}\n\t};\n\n\treturn (\n\t\t<HStack className=\"edit-site-save-hub\" alignment=\"right\" spacing={ 4 }>\n\t\t\t{ dirtyCurrentEntity ? (\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ saveCurrentEntity }\n\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\tdisabled={ isSaving }\n\t\t\t\t\taria-disabled={ isSaving }\n\t\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t>\n\t\t\t\t\t{ label }\n\t\t\t\t</Button>\n\t\t\t) : (\n\t\t\t\t<SaveButton\n\t\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\t\tvariant={ disabled ? null : 'primary' }\n\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\ticon={ disabled && ! isSaving ? check : null }\n\t\t\t\t\tdefaultLabel={ label }\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"]}
|
|
@@ -58,11 +58,11 @@ const EntitiesSavedStatesForPreview = ({
|
|
|
58
58
|
activateSaveLabel = (0, _i18n.__)('Activate');
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const {
|
|
62
|
-
getTheme
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const additionalPrompt = (0, _element.createElement)("p", null, (0, _i18n.sprintf)('Saving your changes will change your active theme to
|
|
61
|
+
const themeName = (0, _data.useSelect)(select => {
|
|
62
|
+
const theme = select(_coreData.store).getTheme((0, _isPreviewingTheme.currentlyPreviewingTheme)());
|
|
63
|
+
return theme?.name?.rendered;
|
|
64
|
+
}, []);
|
|
65
|
+
const additionalPrompt = (0, _element.createElement)("p", null, (0, _i18n.sprintf)('Saving your changes will change your active theme to %s.', themeName));
|
|
66
66
|
const activateTheme = (0, _useActivateTheme.useActivateTheme)();
|
|
67
67
|
|
|
68
68
|
const onSave = async values => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"names":["EntitiesSavedStatesExtensible","privateApis","EntitiesSavedStatesForPreview","onClose","isDirtyProps","activateSaveLabel","isDirty","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"names":["EntitiesSavedStatesExtensible","privateApis","EntitiesSavedStatesForPreview","onClose","isDirtyProps","activateSaveLabel","isDirty","themeName","select","theme","coreStore","getTheme","name","rendered","additionalPrompt","activateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","SavePanel","isSaveViewOpen","canvasMode","isSaveViewOpened","getCanvasMode","editSiteStore","setIsSaveViewOpened"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAoC,wBAAQC,mBAAR,CAA1C;;AAEA,MAAMC,6BAA6B,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAmB;AACxD,QAAMC,YAAY,GAAG,4CAArB;AACA,MAAIC,iBAAJ;;AACA,MAAKD,YAAY,CAACE,OAAlB,EAA4B;AAC3BD,IAAAA,iBAAiB,GAAG,cAAI,iBAAJ,CAApB;AACA,GAFD,MAEO;AACNA,IAAAA,iBAAiB,GAAG,cAAI,UAAJ,CAApB;AACA;;AAED,QAAME,SAAS,GAAG,qBAAaC,MAAF,IAAc;AAC1C,UAAMC,KAAK,GAAGD,MAAM,CAAEE,eAAF,CAAN,CAAoBC,QAApB,CACb,kDADa,CAAd;AAIA,WAAOF,KAAK,EAAEG,IAAP,EAAaC,QAApB;AACA,GANiB,EAMf,EANe,CAAlB;AAQA,QAAMC,gBAAgB,GACrB,uCACG,mBACD,0DADC,EAEDP,SAFC,CADH,CADD;AASA,QAAMQ,aAAa,GAAG,yCAAtB;;AACA,QAAMC,MAAM,GAAG,MAAQC,MAAR,IAAoB;AAClC,UAAMF,aAAa,EAAnB;AACA,WAAOE,MAAP;AACA,GAHD;;AAKA,SACC,4B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A;;AAED,SACC,4BAAC,0BAAD;AACC,IAAA,SAAS,EAAG,yBAAY,2BAAZ,EAAyC;AACpD,kCAA4BoB;AADwB,KAAzC,CADb;AAIC,IAAA,SAAS,EAAG,cAAI,YAAJ;AAJb,KAMGA,cAAc,GACf,4BAAC,oBAAD;AAAsB,IAAA,OAAO,EAAGpB;AAAhC,IADe,GAGf;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,SAAS,EAAC,4CAFX;AAGC,IAAA,OAAO,EAAG,MAAMyB,mBAAmB,CAAE,IAAF,CAHpC;AAIC,qBAAgB;AAJjB,KAMG,cAAI,iBAAJ,CANH,CADD,CATF,CADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport {\n\tEntitiesSavedStates,\n\tuseEntitiesSavedStatesIsDirty,\n\tprivateApis,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { NavigableRegion } from '@wordpress/interface';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useActivateTheme } from '../../utils/use-activate-theme';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\n\nconst { EntitiesSavedStatesExtensible } = unlock( privateApis );\n\nconst EntitiesSavedStatesForPreview = ( { onClose } ) => {\n\tconst isDirtyProps = useEntitiesSavedStatesIsDirty();\n\tlet activateSaveLabel;\n\tif ( isDirtyProps.isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t}\n\n\tconst themeName = useSelect( ( select ) => {\n\t\tconst theme = select( coreStore ).getTheme(\n\t\t\tcurrentlyPreviewingTheme()\n\t\t);\n\n\t\treturn theme?.name?.rendered;\n\t}, [] );\n\n\tconst additionalPrompt = (\n\t\t<p>\n\t\t\t{ sprintf(\n\t\t\t\t'Saving your changes will change your active theme to %s.',\n\t\t\t\tthemeName\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tconst activateTheme = useActivateTheme();\n\tconst onSave = async ( values ) => {\n\t\tawait activateTheme();\n\t\treturn values;\n\t};\n\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\t{ ...{\n\t\t\t\t...isDirtyProps,\n\t\t\t\tadditionalPrompt,\n\t\t\t\tclose: onClose,\n\t\t\t\tonSave,\n\t\t\t\tsaveEnabled: true,\n\t\t\t\tsaveLabel: activateSaveLabel,\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nconst _EntitiesSavedStates = ( { onClose } ) => {\n\tif ( isPreviewingTheme() ) {\n\t\treturn <EntitiesSavedStatesForPreview onClose={ onClose } />;\n\t}\n\treturn <EntitiesSavedStates close={ onClose } />;\n};\n\nexport default function SavePanel() {\n\tconst { isSaveViewOpen, canvasMode } = useSelect( ( select ) => {\n\t\tconst { isSaveViewOpened, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\n\tif ( canvasMode === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ classnames( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save panel' ) }\n\t\t>\n\t\t\t{ isSaveViewOpen ? (\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t) : (\n\t\t\t\t<div className=\"edit-site-editor__toggle-save-panel\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"]}
|
|
@@ -11,8 +11,6 @@ var _data = require("@wordpress/data");
|
|
|
11
11
|
|
|
12
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
13
13
|
|
|
14
|
-
var _constants = require("../../page-content-focus-manager/constants");
|
|
15
|
-
|
|
16
14
|
var _lockUnlock = require("../../../lock-unlock");
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -27,7 +25,10 @@ const {
|
|
|
27
25
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
28
26
|
|
|
29
27
|
function PageContent() {
|
|
30
|
-
const
|
|
28
|
+
const clientIdsTree = (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_blockEditor.store)).getEnabledClientIdsTree(), []);
|
|
29
|
+
const clientIds = (0, _element.useMemo)(() => clientIdsTree.map(({
|
|
30
|
+
clientId
|
|
31
|
+
}) => clientId), [clientIdsTree]);
|
|
31
32
|
return (0, _element.createElement)(BlockQuickNavigation, {
|
|
32
33
|
clientIds: clientIds
|
|
33
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-content.js"],"names":["BlockQuickNavigation","blockEditorPrivateApis","PageContent","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-content.js"],"names":["BlockQuickNavigation","blockEditorPrivateApis","PageContent","clientIdsTree","select","blockEditorStore","getEnabledClientIdsTree","clientIds","map","clientId"],"mappings":";;;;;;;AAQA;;AALA;;AACA;;AASA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA;AAAF,IAA2B,wBAAQC,wBAAR,CAAjC;;AAEe,SAASC,WAAT,GAAuB;AACrC,QAAMC,aAAa,GAAG,qBACnBC,MAAF,IACC,wBAAQA,MAAM,CAAEC,kBAAF,CAAd,EAAqCC,uBAArC,EAFoB,EAGrB,EAHqB,CAAtB;AAKA,QAAMC,SAAS,GAAG,sBACjB,MAAMJ,aAAa,CAACK,GAAd,CAAmB,CAAE;AAAEC,IAAAA;AAAF,GAAF,KAAoBA,QAAvC,CADW,EAEjB,CAAEN,aAAF,CAFiB,CAAlB;AAIA,SAAO,4BAAC,oBAAD;AAAsB,IAAA,SAAS,EAAGI;AAAlC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nexport default function PageContent() {\n\tconst clientIdsTree = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getEnabledClientIdsTree(),\n\t\t[]\n\t);\n\tconst clientIds = useMemo(\n\t\t() => clientIdsTree.map( ( { clientId } ) => clientId ),\n\t\t[ clientIdsTree ]\n\t);\n\treturn <BlockQuickNavigation clientIds={ clientIds } />;\n}\n"]}
|
|
@@ -178,14 +178,9 @@ function PageStatus({
|
|
|
178
178
|
onChange: value => saveStatus({
|
|
179
179
|
password: value
|
|
180
180
|
}),
|
|
181
|
-
value: password
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
autoFocus: !password
|
|
185
|
-
/* eslint-enable jsx-a11y/no-autofocus */
|
|
186
|
-
,
|
|
187
|
-
placeholder: (0, _i18n.__)('Enter a secure password'),
|
|
188
|
-
type: "password"
|
|
181
|
+
value: password,
|
|
182
|
+
placeholder: (0, _i18n.__)('Use a secure password'),
|
|
183
|
+
type: "text"
|
|
189
184
|
})))))
|
|
190
185
|
}));
|
|
191
186
|
}
|