@wordpress/edit-site 5.34.0 → 6.0.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 +16 -3
- package/build/components/add-new-page/index.js +33 -27
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +95 -78
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +35 -30
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +119 -95
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +89 -73
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +36 -17
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +13 -5
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/block-inspector-button.js +5 -4
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +88 -0
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -0
- package/build/components/canvas-loader/index.js +13 -12
- package/build/components/canvas-loader/index.js.map +1 -1
- package/build/components/dataviews-actions/index.js +49 -0
- package/build/components/dataviews-actions/index.js.map +1 -0
- package/build/components/editor/index.js +107 -140
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +27 -29
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/error-boundary/index.js +2 -2
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +13 -11
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/background-panel.js +19 -6
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +19 -17
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +4 -4
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +32 -28
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +55 -39
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-family-item.js +17 -13
- package/build/components/global-styles/font-family-item.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +25 -22
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +7 -30
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +24 -16
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +195 -152
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-demo.js +14 -12
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +29 -20
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +41 -36
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +153 -109
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-details.js +16 -14
- package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +25 -22
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +40 -34
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +3 -3
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +41 -38
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +37 -28
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/highlighted-colors.js +3 -4
- package/build/components/global-styles/highlighted-colors.js.map +1 -1
- package/build/components/global-styles/hooks.js +11 -20
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +4 -4
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +15 -11
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +39 -32
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preset-colors.js +28 -0
- package/build/components/global-styles/preset-colors.js.map +1 -0
- package/build/components/global-styles/preview-colors.js +23 -25
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/preview-iframe.js +34 -29
- package/build/components/global-styles/preview-iframe.js.map +1 -1
- package/build/components/global-styles/preview-styles.js +95 -90
- package/build/components/global-styles/preview-styles.js.map +1 -1
- package/build/components/global-styles/root-menu.js +28 -21
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-background.js +6 -4
- package/build/components/global-styles/screen-background.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +33 -27
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +62 -53
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +29 -19
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +18 -17
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -14
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +9 -4
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +52 -42
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +82 -71
- 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 +1 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +76 -42
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-shadows.js +22 -0
- package/build/components/global-styles/screen-shadows.js.map +1 -0
- package/build/components/global-styles/screen-style-variations.js +14 -9
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +50 -45
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +15 -11
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-utils.js +230 -0
- package/build/components/global-styles/shadow-utils.js.map +1 -0
- package/build/components/global-styles/shadows-edit-panel.js +458 -0
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -0
- package/build/components/global-styles/shadows-panel.js +128 -0
- package/build/components/global-styles/shadows-panel.js.map +1 -0
- package/build/components/global-styles/style-variations-container.js +67 -18
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/subtitle.js +5 -4
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +53 -45
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/typography-example.js +16 -10
- package/build/components/global-styles/typography-example.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +5 -4
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +124 -89
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +28 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +36 -25
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +19 -14
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-panel.js +27 -17
- package/build/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +37 -31
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +5 -1
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/global-styles-sidebar/default-sidebar.js +56 -0
- package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +37 -26
- package/build/components/global-styles-sidebar/index.js.map +1 -0
- package/build/components/layout/index.js +113 -99
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +110 -75
- package/build/components/layout/router.js.map +1 -1
- package/build/components/media/index.js +2 -2
- package/build/components/media/index.js.map +1 -1
- package/build/components/{header-edit-mode/more-menu → more-menu}/index.js +7 -3
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/{header-edit-mode/more-menu → more-menu}/site-export.js +5 -4
- package/build/components/more-menu/site-export.js.map +1 -0
- package/build/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +5 -4
- package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/page/header.js +24 -20
- package/build/components/page/header.js.map +1 -1
- package/build/components/page/index.js +14 -12
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-pages/index.js +136 -66
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +23 -20
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/header.js +47 -32
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +120 -125
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +14 -11
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +7 -6
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +83 -72
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +51 -42
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +4 -2
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +48 -34
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +31 -22
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +5 -4
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +5 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +12 -11
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +36 -30
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +68 -35
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +4 -4
- package/build/components/sidebar-button/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +56 -48
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +106 -89
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +14 -12
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +48 -0
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +21 -22
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +32 -28
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +56 -70
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +24 -17
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/index.js +9 -7
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +5 -4
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +7 -7
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +5 -4
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +57 -45
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +45 -22
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +5 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +20 -12
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +61 -35
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +10 -8
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +42 -36
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +18 -12
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +36 -22
- 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 +48 -40
- 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 +12 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +12 -10
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +62 -77
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +17 -17
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -5
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +83 -74
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +9 -8
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/style-book/index.js +122 -103
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -30
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/table/index.js +23 -15
- package/build/components/table/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +5 -4
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +23 -17
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +30 -11
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +20 -15
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/image.js +13 -12
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +18 -13
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/styles.js +45 -28
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +18 -13
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +4 -4
- package/build/deprecated.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +12 -24
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +2 -116
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +25 -16
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +7 -3
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/template-part-create.js +0 -62
- package/build/utils/template-part-create.js.map +1 -1
- package/build/utils/use-activate-theme.js +9 -7
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-page/index.js +34 -27
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +98 -78
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +36 -30
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +121 -95
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/index.js +91 -73
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +36 -17
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +15 -6
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/block-inspector-button.js +5 -4
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +80 -0
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -0
- package/build-module/components/canvas-loader/index.js +14 -13
- package/build-module/components/canvas-loader/index.js.map +1 -1
- package/build-module/components/dataviews-actions/index.js +41 -0
- package/build-module/components/dataviews-actions/index.js.map +1 -0
- package/build-module/components/editor/index.js +113 -144
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +29 -30
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -2
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +13 -11
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +18 -6
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +19 -17
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +4 -4
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +32 -28
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +2 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +58 -40
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-family-item.js +18 -13
- package/build-module/components/global-styles/font-family-item.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +26 -22
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +7 -30
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +25 -16
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +198 -153
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-demo.js +14 -12
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +30 -20
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +42 -36
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +157 -111
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-details.js +18 -14
- package/build-module/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +26 -22
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +42 -35
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +3 -3
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +42 -38
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +38 -28
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/highlighted-colors.js +3 -4
- package/build-module/components/global-styles/highlighted-colors.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +11 -20
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +4 -4
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +16 -11
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +42 -34
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preset-colors.js +21 -0
- package/build-module/components/global-styles/preset-colors.js.map +1 -0
- package/build-module/components/global-styles/preview-colors.js +23 -25
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/preview-iframe.js +36 -29
- package/build-module/components/global-styles/preview-iframe.js.map +1 -1
- package/build-module/components/global-styles/preview-styles.js +96 -90
- package/build-module/components/global-styles/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +31 -22
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-background.js +8 -4
- package/build-module/components/global-styles/screen-background.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +35 -27
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +64 -53
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +31 -19
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +20 -17
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +22 -14
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +11 -4
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +54 -42
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +83 -71
- 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 +1 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +78 -42
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-shadows.js +13 -0
- package/build-module/components/global-styles/screen-shadows.js.map +1 -0
- package/build-module/components/global-styles/screen-style-variations.js +16 -9
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +52 -45
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +17 -11
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-utils.js +221 -0
- package/build-module/components/global-styles/shadow-utils.js.map +1 -0
- package/build-module/components/global-styles/shadows-edit-panel.js +452 -0
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -0
- package/build-module/components/global-styles/shadows-panel.js +121 -0
- package/build-module/components/global-styles/shadows-panel.js.map +1 -0
- package/build-module/components/global-styles/style-variations-container.js +68 -19
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +5 -4
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +54 -45
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/typography-example.js +16 -9
- package/build-module/components/global-styles/typography-example.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +2 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +5 -4
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +126 -89
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +27 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +35 -24
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +21 -15
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-panel.js +28 -18
- package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +38 -31
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +5 -1
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js +51 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +38 -26
- package/build-module/components/global-styles-sidebar/index.js.map +1 -0
- package/build-module/components/layout/index.js +116 -100
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +110 -76
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/media/index.js +2 -2
- package/build-module/components/media/index.js.map +1 -1
- package/build-module/components/{header-edit-mode/more-menu → more-menu}/index.js +9 -3
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/{header-edit-mode/more-menu → more-menu}/site-export.js +5 -4
- package/build-module/components/more-menu/site-export.js.map +1 -0
- package/build-module/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +5 -4
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/page/header.js +25 -19
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page/index.js +16 -13
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +141 -69
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +25 -20
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/header.js +48 -32
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +121 -125
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +16 -11
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +7 -6
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +85 -72
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +52 -42
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +4 -2
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +51 -35
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +31 -21
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -4
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +12 -11
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +37 -30
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +69 -36
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +4 -4
- package/build-module/components/sidebar-button/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +58 -48
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +108 -89
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +15 -12
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +49 -1
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +23 -22
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +33 -28
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +58 -70
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +25 -17
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +10 -7
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +5 -4
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +7 -7
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +5 -4
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +59 -45
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +47 -22
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +5 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +20 -12
- 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 +63 -35
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +10 -8
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +43 -36
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +19 -12
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +36 -22
- 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 +50 -40
- 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 +14 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +12 -10
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +64 -77
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +18 -17
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +8 -5
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +85 -75
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +9 -8
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/style-book/index.js +122 -102
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -30
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/table/index.js +24 -15
- package/build-module/components/table/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +5 -4
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +25 -16
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +30 -11
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +22 -15
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +14 -12
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +6 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +20 -13
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +47 -28
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +20 -13
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +4 -4
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +12 -23
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -118
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +27 -16
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +6 -2
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +3 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/template-part-create.js +0 -52
- package/build-module/utils/template-part-create.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +9 -7
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +486 -981
- package/build-style/style.css +486 -981
- package/package.json +44 -47
- package/src/components/add-new-pattern/index.js +46 -37
- package/src/components/add-new-template/index.js +4 -2
- package/src/components/add-new-template/utils.js +77 -39
- package/src/components/app/index.js +5 -2
- package/src/components/block-editor/style.scss +4 -139
- package/src/components/block-editor/use-editor-iframe-props.js +79 -0
- package/src/components/canvas-loader/index.js +5 -2
- package/src/components/dataviews-actions/index.js +43 -0
- package/src/components/editor/index.js +129 -215
- package/src/components/editor/style.scss +2 -17
- package/src/components/editor-canvas-container/index.js +30 -35
- package/src/components/editor-canvas-container/style.scss +16 -0
- package/src/components/global-styles/background-panel.js +20 -4
- package/src/components/global-styles/color-indicator-wrapper.js +2 -2
- package/src/components/global-styles/color-palette-panel.js +3 -4
- package/src/components/global-styles/font-families.js +25 -18
- package/src/components/global-styles/font-family-item.js +2 -2
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +2 -1
- package/src/components/global-styles/font-library-modal/context.js +6 -44
- package/src/components/global-styles/font-library-modal/font-collection.js +3 -5
- package/src/components/global-styles/font-library-modal/installed-fonts.js +42 -12
- package/src/components/global-styles/font-library-modal/library-font-variant.js +2 -1
- package/src/components/global-styles/font-library-modal/upload-fonts.js +1 -4
- package/src/components/global-styles/font-library-modal/utils/index.js +1 -1
- package/src/components/global-styles/gradients-palette-panel.js +1 -4
- package/src/components/global-styles/hooks.js +10 -36
- package/src/components/global-styles/icon-with-current-color.js +2 -2
- package/src/components/global-styles/palette.js +9 -18
- package/src/components/global-styles/preset-colors.js +18 -0
- package/src/components/global-styles/preview-colors.js +4 -7
- package/src/components/global-styles/root-menu.js +16 -12
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-color-palette.js +4 -4
- package/src/components/global-styles/screen-colors.js +0 -2
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-revisions/index.js +6 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -0
- package/src/components/global-styles/screen-shadows.js +13 -0
- package/src/components/global-styles/screen-typography.js +1 -1
- package/src/components/global-styles/shadow-utils.js +158 -0
- package/src/components/global-styles/shadows-edit-panel.js +555 -0
- package/src/components/global-styles/shadows-panel.js +147 -0
- package/src/components/global-styles/stories/index.story.js +2 -1
- package/src/components/global-styles/style-variations-container.js +73 -10
- package/src/components/global-styles/style.scss +54 -5
- package/src/components/global-styles/test/shadow-utils.spec.js +251 -0
- package/src/components/global-styles/test/utils.spec.js +59 -0
- package/src/components/global-styles/typography-example.js +2 -1
- package/src/components/global-styles/ui.js +15 -7
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/global-styles/variations/style.scss +17 -30
- package/src/components/global-styles/variations/variation.js +15 -10
- package/src/components/global-styles/variations/variations-color.js +7 -9
- package/src/components/global-styles/variations/variations-panel.js +16 -5
- package/src/components/global-styles/variations/variations-typography.js +2 -1
- package/src/components/global-styles-renderer/index.js +7 -1
- package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
- package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
- package/src/components/layout/index.js +10 -10
- package/src/components/layout/router.js +96 -61
- package/src/components/layout/style.scss +10 -6
- package/src/components/{header-edit-mode/more-menu → more-menu}/index.js +1 -1
- package/src/components/page/header.js +17 -13
- package/src/components/page/index.js +3 -7
- package/src/components/page/style.scss +21 -7
- package/src/components/page-pages/index.js +162 -68
- package/src/components/page-pages/style.scss +14 -10
- package/src/components/page-patterns/delete-category-menu-item.js +1 -2
- package/src/components/page-patterns/header.js +45 -33
- package/src/components/page-patterns/index.js +25 -81
- package/src/components/page-patterns/style.scss +21 -14
- package/src/components/page-patterns/use-patterns.js +13 -6
- package/src/components/page-templates/index.js +10 -29
- package/src/components/pagination/index.js +2 -2
- package/src/components/resizable-frame/index.js +17 -5
- package/src/components/revisions/index.js +2 -1
- package/src/components/save-panel/index.js +5 -7
- package/src/components/sidebar/index.js +61 -37
- package/src/components/sidebar-button/index.js +2 -5
- package/src/components/sidebar-dataviews/add-new-view.js +5 -5
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +5 -7
- package/src/components/sidebar-dataviews/dataview-item.js +6 -9
- package/src/components/sidebar-dataviews/default-views.js +61 -1
- package/src/components/sidebar-dataviews/index.js +4 -9
- package/src/components/sidebar-navigation-item/index.js +10 -10
- package/src/components/sidebar-navigation-screen/index.js +7 -31
- package/src/components/sidebar-navigation-screen/style.scss +11 -9
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +10 -3
- package/src/components/sidebar-navigation-screen-main/index.js +14 -4
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +6 -13
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -61
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +8 -29
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +3 -2
- package/src/components/site-hub/index.js +14 -15
- package/src/components/site-hub/style.scss +46 -9
- package/src/components/site-icon/index.js +2 -2
- package/src/components/style-book/index.js +8 -7
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +18 -23
- package/src/components/template-part-converter/convert-to-template-part.js +4 -1
- package/src/components/template-part-converter/index.js +16 -3
- package/src/hooks/commands/use-common-commands.js +12 -23
- package/src/hooks/commands/use-edit-mode-commands.js +4 -118
- package/src/hooks/index.js +0 -1
- package/src/hooks/push-changes-to-global-styles/index.js +2 -1
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +7 -2
- package/src/index.js +1 -1
- package/src/store/private-actions.js +9 -1
- package/src/store/selectors.js +2 -2
- package/src/style.scss +1 -17
- package/src/utils/template-part-create.js +0 -67
- package/src/utils/use-activate-theme.js +5 -5
- package/build/components/block-editor/editor-canvas.js +0 -153
- package/build/components/block-editor/editor-canvas.js.map +0 -1
- package/build/components/block-editor/resizable-editor.js +0 -86
- package/build/components/block-editor/resizable-editor.js.map +0 -1
- package/build/components/block-editor/resize-handle.js +0 -57
- package/build/components/block-editor/resize-handle.js.map +0 -1
- package/build/components/block-editor/site-editor-canvas.js +0 -95
- package/build/components/block-editor/site-editor-canvas.js.map +0 -1
- package/build/components/code-editor/index.js +0 -111
- package/build/components/code-editor/index.js.map +0 -1
- package/build/components/create-template-part-modal/index.js +0 -151
- package/build/components/create-template-part-modal/index.js.map +0 -1
- package/build/components/global-styles/global-styles-provider.js +0 -129
- package/build/components/global-styles/global-styles-provider.js.map +0 -1
- package/build/components/header-edit-mode/document-tools/index.js +0 -68
- package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build/components/header-edit-mode/index.js +0 -150
- package/build/components/header-edit-mode/index.js.map +0 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +0 -1
- package/build/components/header-edit-mode/more-menu/site-export.js.map +0 -1
- package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +0 -387
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +0 -1
- package/build/components/pattern-modal/duplicate.js +0 -70
- package/build/components/pattern-modal/duplicate.js.map +0 -1
- package/build/components/pattern-modal/index.js +0 -23
- package/build/components/pattern-modal/index.js.map +0 -1
- package/build/components/pattern-modal/rename.js +0 -45
- package/build/components/pattern-modal/rename.js.map +0 -1
- package/build/components/rename-post-menu-item/index.js +0 -109
- package/build/components/rename-post-menu-item/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +0 -52
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/index.js +0 -147
- package/build/components/sidebar-edit-mode/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +0 -129
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -46
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +0 -127
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-page/index.js +0 -163
- package/build/components/sidebar-navigation-screen-page/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +0 -127
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +0 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +0 -65
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +0 -72
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -38
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -29
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -37
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -45
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -88
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -29
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -138
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +0 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +0 -110
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +0 -1
- package/build/components/sidebar-navigation-screen-template/index.js +0 -118
- package/build/components/sidebar-navigation-screen-template/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-template/template-areas.js +0 -117
- package/build/components/sidebar-navigation-screen-template/template-areas.js.map +0 -1
- package/build/components/start-template-options/index.js +0 -191
- package/build/components/start-template-options/index.js.map +0 -1
- package/build/components/template-actions/index.js +0 -131
- package/build/components/template-actions/index.js.map +0 -1
- package/build/hooks/components.js +0 -10
- package/build/hooks/components.js.map +0 -1
- package/build/utils/get-is-list-page.js +0 -28
- package/build/utils/get-is-list-page.js.map +0 -1
- package/build/utils/math.js +0 -98
- package/build/utils/math.js.map +0 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -145
- package/build-module/components/block-editor/editor-canvas.js.map +0 -1
- package/build-module/components/block-editor/resizable-editor.js +0 -79
- package/build-module/components/block-editor/resizable-editor.js.map +0 -1
- package/build-module/components/block-editor/resize-handle.js +0 -50
- package/build-module/components/block-editor/resize-handle.js.map +0 -1
- package/build-module/components/block-editor/site-editor-canvas.js +0 -86
- package/build-module/components/block-editor/site-editor-canvas.js.map +0 -1
- package/build-module/components/code-editor/index.js +0 -103
- package/build-module/components/code-editor/index.js.map +0 -1
- package/build-module/components/create-template-part-modal/index.js +0 -143
- package/build-module/components/create-template-part-modal/index.js.map +0 -1
- package/build-module/components/global-styles/global-styles-provider.js +0 -120
- package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
- package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build-module/components/header-edit-mode/index.js +0 -142
- package/build-module/components/header-edit-mode/index.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/site-export.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +0 -380
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +0 -1
- package/build-module/components/pattern-modal/duplicate.js +0 -62
- package/build-module/components/pattern-modal/duplicate.js.map +0 -1
- package/build-module/components/pattern-modal/index.js +0 -14
- package/build-module/components/pattern-modal/index.js.map +0 -1
- package/build-module/components/pattern-modal/rename.js +0 -37
- package/build-module/components/pattern-modal/rename.js.map +0 -1
- package/build-module/components/rename-post-menu-item/index.js +0 -102
- package/build-module/components/rename-post-menu-item/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +0 -45
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/index.js +0 -138
- package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -121
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -119
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +0 -155
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +0 -120
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +0 -57
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +0 -64
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -30
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -20
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -29
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -36
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -80
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -22
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -130
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +0 -103
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +0 -110
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js +0 -109
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +0 -1
- package/build-module/components/start-template-options/index.js +0 -184
- package/build-module/components/start-template-options/index.js.map +0 -1
- package/build-module/components/template-actions/index.js +0 -123
- package/build-module/components/template-actions/index.js.map +0 -1
- package/build-module/hooks/components.js +0 -7
- package/build-module/hooks/components.js.map +0 -1
- package/build-module/utils/get-is-list-page.js +0 -22
- package/build-module/utils/get-is-list-page.js.map +0 -1
- package/build-module/utils/math.js +0 -92
- package/build-module/utils/math.js.map +0 -1
- package/src/components/block-editor/editor-canvas.js +0 -178
- package/src/components/block-editor/resizable-editor.js +0 -82
- package/src/components/block-editor/resize-handle.js +0 -66
- package/src/components/block-editor/site-editor-canvas.js +0 -107
- package/src/components/code-editor/index.js +0 -94
- package/src/components/code-editor/style.scss +0 -95
- package/src/components/create-template-part-modal/index.js +0 -199
- package/src/components/create-template-part-modal/style.scss +0 -69
- package/src/components/global-styles/global-styles-provider.js +0 -162
- package/src/components/header-edit-mode/document-tools/index.js +0 -68
- package/src/components/header-edit-mode/index.js +0 -190
- package/src/components/header-edit-mode/style.scss +0 -201
- package/src/components/page-patterns/dataviews-pattern-actions.js +0 -439
- package/src/components/pattern-modal/duplicate.js +0 -55
- package/src/components/pattern-modal/index.js +0 -19
- package/src/components/pattern-modal/rename.js +0 -30
- package/src/components/rename-post-menu-item/index.js +0 -138
- package/src/components/sidebar-edit-mode/index.js +0 -173
- package/src/components/sidebar-edit-mode/page-panels/index.js +0 -133
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -61
- package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
- package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
- package/src/components/sidebar-edit-mode/template-panel/index.js +0 -134
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
- package/src/components/sidebar-navigation-screen-page/index.js +0 -204
- package/src/components/sidebar-navigation-screen-page/page-details.js +0 -161
- package/src/components/sidebar-navigation-screen-page/status-label.js +0 -71
- package/src/components/sidebar-navigation-screen-page/style.scss +0 -69
- package/src/components/sidebar-navigation-screen-pattern/index.js +0 -63
- package/src/components/sidebar-navigation-screen-pattern/style.scss +0 -26
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -31
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -21
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -33
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -36
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -98
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -32
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -205
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +0 -144
- package/src/components/sidebar-navigation-screen-template/index.js +0 -133
- package/src/components/sidebar-navigation-screen-template/style.scss +0 -53
- package/src/components/sidebar-navigation-screen-template/template-areas.js +0 -135
- package/src/components/start-template-options/index.js +0 -231
- package/src/components/start-template-options/style.scss +0 -55
- package/src/components/template-actions/index.js +0 -165
- package/src/hooks/components.js +0 -11
- package/src/utils/get-is-list-page.js +0 -25
- package/src/utils/math.js +0 -93
- package/src/utils/test/template-part-create.js +0 -63
- /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
- /package/src/components/{header-edit-mode/more-menu → more-menu}/site-export.js +0 -0
- /package/src/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +0 -0
package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { parse } from '@wordpress/blocks';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import TemplatePartNavigationMenus from './template-part-navigation-menus';
|
|
11
|
-
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
12
|
-
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
13
|
-
function getBlocksFromRecord(record) {
|
|
14
|
-
if (record?.blocks) {
|
|
15
|
-
return record?.blocks;
|
|
16
|
-
}
|
|
17
|
-
return record?.content && typeof record.content !== 'function' ? parse(record.content) : [];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Retrieves a list of specific blocks from a given tree of blocks.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} targetBlockType The name of the block type to find.
|
|
24
|
-
* @param {Array} blocks A list of blocks from a template part entity.
|
|
25
|
-
*
|
|
26
|
-
* @return {Array} A list of any navigation blocks found in the blocks.
|
|
27
|
-
*/
|
|
28
|
-
function getBlocksOfTypeFromBlocks(targetBlockType, blocks) {
|
|
29
|
-
if (!targetBlockType || !blocks?.length) {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
const findInBlocks = _blocks => {
|
|
33
|
-
if (!_blocks) {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
const navigationBlocks = [];
|
|
37
|
-
for (const block of _blocks) {
|
|
38
|
-
if (block.name === targetBlockType) {
|
|
39
|
-
navigationBlocks.push(block);
|
|
40
|
-
}
|
|
41
|
-
if (block?.innerBlocks) {
|
|
42
|
-
const innerNavigationBlocks = findInBlocks(block.innerBlocks);
|
|
43
|
-
if (innerNavigationBlocks.length) {
|
|
44
|
-
navigationBlocks.push(...innerNavigationBlocks);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return navigationBlocks;
|
|
49
|
-
};
|
|
50
|
-
return findInBlocks(blocks);
|
|
51
|
-
}
|
|
52
|
-
export default function useNavigationMenuContent(postType, postId) {
|
|
53
|
-
const {
|
|
54
|
-
record
|
|
55
|
-
} = useEditedEntityRecord(postType, postId);
|
|
56
|
-
|
|
57
|
-
// Only managing navigation menus in template parts is supported
|
|
58
|
-
// to match previous behaviour. This could potentially be expanded
|
|
59
|
-
// to patterns as well.
|
|
60
|
-
if (postType !== TEMPLATE_PART_POST_TYPE) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const blocks = getBlocksFromRecord(record);
|
|
64
|
-
const navigationBlocks = getBlocksOfTypeFromBlocks('core/navigation', blocks);
|
|
65
|
-
if (!navigationBlocks.length) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const navigationMenuIds = navigationBlocks?.map(block => block.attributes.ref);
|
|
69
|
-
|
|
70
|
-
// Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.
|
|
71
|
-
// Also, filter out undefined values, as blocks don't have an id when initially added.
|
|
72
|
-
const uniqueNavigationMenuIds = [...new Set(navigationMenuIds)].filter(menuId => menuId);
|
|
73
|
-
if (!uniqueNavigationMenuIds?.length) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
return createElement(TemplatePartNavigationMenus, {
|
|
77
|
-
menus: uniqueNavigationMenuIds
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=use-navigation-menu-content.js.map
|
package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["parse","TemplatePartNavigationMenus","useEditedEntityRecord","TEMPLATE_PART_POST_TYPE","getBlocksFromRecord","record","blocks","content","getBlocksOfTypeFromBlocks","targetBlockType","length","findInBlocks","_blocks","navigationBlocks","block","name","push","innerBlocks","innerNavigationBlocks","useNavigationMenuContent","postType","postId","navigationMenuIds","map","attributes","ref","uniqueNavigationMenuIds","Set","filter","menuId","createElement","menus"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenus from './template-part-navigation-menus';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';\n\nfunction getBlocksFromRecord( record ) {\n\tif ( record?.blocks ) {\n\t\treturn record?.blocks;\n\t}\n\n\treturn record?.content && typeof record.content !== 'function'\n\t\t? parse( record.content )\n\t\t: [];\n}\n\n/**\n * Retrieves a list of specific blocks from a given tree of blocks.\n *\n * @param {string} targetBlockType The name of the block type to find.\n * @param {Array} blocks A list of blocks from a template part entity.\n *\n * @return {Array} A list of any navigation blocks found in the blocks.\n */\nfunction getBlocksOfTypeFromBlocks( targetBlockType, blocks ) {\n\tif ( ! targetBlockType || ! blocks?.length ) {\n\t\treturn [];\n\t}\n\n\tconst findInBlocks = ( _blocks ) => {\n\t\tif ( ! _blocks ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst navigationBlocks = [];\n\n\t\tfor ( const block of _blocks ) {\n\t\t\tif ( block.name === targetBlockType ) {\n\t\t\t\tnavigationBlocks.push( block );\n\t\t\t}\n\n\t\t\tif ( block?.innerBlocks ) {\n\t\t\t\tconst innerNavigationBlocks = findInBlocks( block.innerBlocks );\n\n\t\t\t\tif ( innerNavigationBlocks.length ) {\n\t\t\t\t\tnavigationBlocks.push( ...innerNavigationBlocks );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn navigationBlocks;\n\t};\n\n\treturn findInBlocks( blocks );\n}\n\nexport default function useNavigationMenuContent( postType, postId ) {\n\tconst { record } = useEditedEntityRecord( postType, postId );\n\n\t// Only managing navigation menus in template parts is supported\n\t// to match previous behaviour. This could potentially be expanded\n\t// to patterns as well.\n\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\treturn;\n\t}\n\n\tconst blocks = getBlocksFromRecord( record );\n\tconst navigationBlocks = getBlocksOfTypeFromBlocks(\n\t\t'core/navigation',\n\t\tblocks\n\t);\n\n\tif ( ! navigationBlocks.length ) {\n\t\treturn;\n\t}\n\n\tconst navigationMenuIds = navigationBlocks?.map(\n\t\t( block ) => block.attributes.ref\n\t);\n\n\t// Dedupe the Navigation blocks, as you can have multiple navigation blocks in the template.\n\t// Also, filter out undefined values, as blocks don't have an id when initially added.\n\tconst uniqueNavigationMenuIds = [ ...new Set( navigationMenuIds ) ].filter(\n\t\t( menuId ) => menuId\n\t);\n\n\tif ( ! uniqueNavigationMenuIds?.length ) {\n\t\treturn;\n\t}\n\n\treturn <TemplatePartNavigationMenus menus={ uniqueNavigationMenuIds } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,mBAAmB;;AAEzC;AACA;AACA;AACA,OAAOC,2BAA2B,MAAM,kCAAkC;AAC1E,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,S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,uBAAuB,EAAG;IAC3C;EACD;EAEA,MAAMG,MAAM,GAAGF,mBAAmB,CAAEC,MAAO,CAAC;EAC5C,MAAMQ,gBAAgB,GAAGL,yBAAyB,CACjD,iBAAiB,EACjBF,MACD,CAAC;EAED,IAAK,CAAEO,gBAAgB,CAACH,MAAM,EAAG;IAChC;EACD;EAEA,MAAMY,iBAAiB,GAAGT,gBAAgB,EAAEU,GAAG,CAC5CT,KAAK,IAAMA,KAAK,CAACU,UAAU,CAACC,GAC/B,CAAC;;EAED;EACA;EACA,MAAMC,uBAAuB,GAAG,CAAE,GAAG,IAAIC,GAAG,CAAEL,iBAAkB,CAAC,CAAE,CAACM,MAAM,CACvEC,MAAM,IAAMA,MACf,CAAC;EAED,IAAK,CAAEH,uBAAuB,EAAEhB,MAAM,EAAG;IACxC;EACD;EAEA,OAAOoB,aAAA,CAAC7B,2BAA2B;IAAC8B,KAAK,EAAGL;EAAyB,CAAE,CAAC;AACzE","ignoreList":[]}
|
package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { NAVIGATION_POST_TYPE } from '../../utils/constants';
|
|
11
|
-
export default function useNavigationMenuTitle(id) {
|
|
12
|
-
return useSelect(select => {
|
|
13
|
-
if (!id) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
const editedRecord = select(coreStore).getEditedEntityRecord('postType', NAVIGATION_POST_TYPE, id);
|
|
17
|
-
|
|
18
|
-
// Do not display a 'trashed' navigation menu.
|
|
19
|
-
return editedRecord.status === 'trash' ? undefined : editedRecord.title;
|
|
20
|
-
}, [id]);
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=use-navigation-menu-title.js.map
|
package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","store","coreStore","NAVIGATION_POST_TYPE","useNavigationMenuTitle","id","select","undefined","editedRecord","getEditedEntityRecord","status","title"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nexport default function useNavigationMenuTitle( id ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst editedRecord = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\tid\n\t\t\t);\n\n\t\t\t// Do not display a 'trashed' navigation menu.\n\t\t\treturn editedRecord.status === 'trash'\n\t\t\t\t? undefined\n\t\t\t\t: editedRecord.title;\n\t\t},\n\t\t[ id ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,oBAAoB,QAAQ,uBAAuB;AAE5D,eAAe,SAASC,sBAAsBA,CAAEC,EAAE,EAAG;EACpD,OAAOL,SAAS,CACbM,MAAM,IAAM;IACb,IAAK,CAAED,EAAE,EAAG;MACX,OAAOE,SAAS;IACjB;IAEA,MAAMC,YAAY,GAAGF,MAAM,CAAEJ,SAAU,CAAC,CAACO,qBAAqB,CAC7D,UAAU,EACVN,oBAAoB,EACpBE,EACD,CAAC;;IAED;IACA,OAAOG,YAAY,CAACE,MAAM,KAAK,OAAO,GACnCH,SAAS,GACTC,YAAY,CAACG,KAAK;EACtB,CAAC,EACD,CAAEN,EAAE,CACL,CAAC;AACF","ignoreList":[]}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { sentenceCase } from 'change-case';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
11
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { useAddedBy } from '../page-templates/hooks';
|
|
19
|
-
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
20
|
-
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
21
|
-
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
22
|
-
import { SidebarNavigationScreenDetailsPanel, SidebarNavigationScreenDetailsPanelRow, SidebarNavigationScreenDetailsPanelLabel, SidebarNavigationScreenDetailsPanelValue } from '../sidebar-navigation-screen-details-panel';
|
|
23
|
-
import { PATTERN_TYPES, TEMPLATE_PART_POST_TYPE, PATTERN_SYNC_TYPES, TEMPLATE_ORIGINS } from '../../utils/constants';
|
|
24
|
-
export default function usePatternDetails(postType, postId) {
|
|
25
|
-
const {
|
|
26
|
-
getDescription,
|
|
27
|
-
getTitle,
|
|
28
|
-
record
|
|
29
|
-
} = useEditedEntityRecord(postType, postId);
|
|
30
|
-
const templatePartAreas = useSelect(select => select(editorStore).__experimentalGetDefaultTemplatePartAreas(), []);
|
|
31
|
-
const {
|
|
32
|
-
currentTheme,
|
|
33
|
-
userPatternCategories
|
|
34
|
-
} = useSelect(select => {
|
|
35
|
-
const {
|
|
36
|
-
getCurrentTheme,
|
|
37
|
-
getUserPatternCategories
|
|
38
|
-
} = select(coreStore);
|
|
39
|
-
return {
|
|
40
|
-
currentTheme: getCurrentTheme(),
|
|
41
|
-
userPatternCategories: getUserPatternCategories()
|
|
42
|
-
};
|
|
43
|
-
}, []);
|
|
44
|
-
const addedBy = useAddedBy(postType, postId);
|
|
45
|
-
const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
|
|
46
|
-
const title = getTitle();
|
|
47
|
-
let description = getDescription();
|
|
48
|
-
if (!description && addedBy.text) {
|
|
49
|
-
description = postType === PATTERN_TYPES.user ? sprintf(
|
|
50
|
-
// translators: %s: pattern title e.g: "Header".
|
|
51
|
-
__('This is the %s pattern.'), getTitle()) : sprintf(
|
|
52
|
-
// translators: %s: template part title e.g: "Header".
|
|
53
|
-
__('This is the %s template part.'), getTitle());
|
|
54
|
-
}
|
|
55
|
-
if (!description && postType === PATTERN_TYPES.user && record?.title) {
|
|
56
|
-
description = sprintf(
|
|
57
|
-
// translators: %s: user created pattern title e.g. "Footer".
|
|
58
|
-
__('This is the %s pattern.'), record.title);
|
|
59
|
-
}
|
|
60
|
-
const footer = record?.modified ? createElement(SidebarNavigationScreenDetailsFooter, {
|
|
61
|
-
record: record
|
|
62
|
-
}) : null;
|
|
63
|
-
const details = [];
|
|
64
|
-
if (postType === PATTERN_TYPES.user || postType === TEMPLATE_PART_POST_TYPE) {
|
|
65
|
-
details.push({
|
|
66
|
-
label: __('Syncing'),
|
|
67
|
-
value: record.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced ? _x('Not synced', 'Text that indicates that the pattern is not synchronized') : _x('Synced', 'Text that indicates that the pattern is synchronized')
|
|
68
|
-
});
|
|
69
|
-
if (record.wp_pattern_category?.length === 0) {
|
|
70
|
-
details.push({
|
|
71
|
-
label: __('Categories'),
|
|
72
|
-
value: __('Uncategorized')
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
if (record.wp_pattern_category?.length > 0) {
|
|
76
|
-
const patternCategories = new Map();
|
|
77
|
-
userPatternCategories.forEach(userCategory => patternCategories.set(userCategory.id, userCategory));
|
|
78
|
-
const categories = record.wp_pattern_category.filter(category => patternCategories.get(category)).map(category => patternCategories.get(category).label);
|
|
79
|
-
details.push({
|
|
80
|
-
label: __('Categories'),
|
|
81
|
-
value: categories.length > 0 ? categories.join(', ') : ''
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (postType === TEMPLATE_PART_POST_TYPE) {
|
|
86
|
-
const templatePartArea = templatePartAreas.find(area => area.area === record.area);
|
|
87
|
-
let areaDetailValue = templatePartArea?.label;
|
|
88
|
-
if (!areaDetailValue) {
|
|
89
|
-
areaDetailValue = record.area ? sprintf(
|
|
90
|
-
// translators: %s: Sentenced cased template part area e.g: "My custom area".
|
|
91
|
-
__('%s (removed)'), sentenceCase(record.area)) : __('None');
|
|
92
|
-
}
|
|
93
|
-
details.push({
|
|
94
|
-
label: __('Area'),
|
|
95
|
-
value: areaDetailValue
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (postType === TEMPLATE_PART_POST_TYPE && addedBy.text && !isAddedByActiveTheme) {
|
|
99
|
-
details.push({
|
|
100
|
-
label: __('Added by'),
|
|
101
|
-
value: createElement("span", {
|
|
102
|
-
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-author"
|
|
103
|
-
}, addedBy.text)
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
if (postType === TEMPLATE_PART_POST_TYPE && addedBy.text && (record.origin === TEMPLATE_ORIGINS.plugin || record.has_theme_file === true)) {
|
|
107
|
-
details.push({
|
|
108
|
-
label: __('Customized'),
|
|
109
|
-
value: createElement("span", {
|
|
110
|
-
className: "edit-site-sidebar-navigation-screen-pattern__added-by-description-customized"
|
|
111
|
-
}, addedBy.isCustomized ? __('Yes') : __('No'))
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
const content = createElement(Fragment, null, useNavigationMenuContent(postType, postId), !!details.length && createElement(SidebarNavigationScreenDetailsPanel, {
|
|
115
|
-
spacing: 5,
|
|
116
|
-
title: __('Details')
|
|
117
|
-
}, details.map(({
|
|
118
|
-
label,
|
|
119
|
-
value
|
|
120
|
-
}) => createElement(SidebarNavigationScreenDetailsPanelRow, {
|
|
121
|
-
key: label
|
|
122
|
-
}, createElement(SidebarNavigationScreenDetailsPanelLabel, null, label), createElement(SidebarNavigationScreenDetailsPanelValue, null, value)))));
|
|
123
|
-
return {
|
|
124
|
-
title,
|
|
125
|
-
description,
|
|
126
|
-
content,
|
|
127
|
-
footer
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=use-pattern-details.js.map
|
package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["sentenceCase","__","_x","sprintf","store","coreStore","editorStore","useSelect","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_SYNC_TYPES","TEMPLATE_ORIGINS","usePatternDetails","postType","postId","getDescription","getTitle","record","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","user","footer","modified","createElement","details","push","label","value","wp_pattern_sync_status","unsynced","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","className","origin","plugin","has_theme_file","isCustomized","content","Fragment","spacing","key"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../page-templates/hooks';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,aAAa;;AAE1C;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,UAAU,QAAQ,yBAAyB;AACpD,OAAOC,qBAAqB,MAAM,6BAA6B;AAC/D,OAAOC,wBAAwB,MAAM,+BAA+B;AACpE,OAAOC,oCAAoC,MAAM,6CAA6C;AAC9F,SACCC,mCAAmC,EACnCC,sCAAsC,EACtCC,wCAAwC,EACxCC,wCAAwC,QAClC,4CAA4C;AACnD,SACCC,aAAa,EACbC,uBAAuB,EACvBC,kBAAkB,EAClBC,gBAAgB,QACV,uBAAuB;AAE9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CAAC+C,cAAc,KAAK,IAAI,CAAE,EAChC;IACD3B,OAAO,CAACC,IAAI,CAAE;MACbC,KAAK,EAAE9C,EAAE,CAAE,YAAa,CAAC;MACzB+C,KAAK,EACJJ,aAAA;QAAMyB,SAAS,EAAC;MAA8E,GAC3FpC,OAAO,CAACwC,YAAY,GAAGxE,EAAE,CAAE,KAAM,CAAC,GAAGA,EAAE,CAAE,IAAK,CAC3C;IAER,CAAE,CAAC;EACJ;EAEA,MAAMyE,OAAO,GACZ9B,aAAA,CAAA+B,QAAA,QACGjE,wBAAwB,CAAEW,QAAQ,EAAEC,MAAO,CAAC,EAC5C,CAAC,CAAEuB,OAAO,CAACO,MAAM,IAClBR,aAAA,CAAChC,mCAAmC;IACnCgE,OAAO,EAAG,CAAG;IACbtC,KAAK,EAAGrC,EAAE,CAAE,SAAU;EAAG,GAEvB4C,OAAO,CAACkB,GAAG,CAAE,CAAE;IAAEhB,KAAK;IAAEC;EAAM,CAAC,KAChCJ,aAAA,CAAC/B,sCAAsC;IAACgE,GAAG,EAAG9B;EAAO,GACpDH,aAAA,CAAC9B,wCAAwC,QACtCiC,KACuC,CAAC,EAC3CH,aAAA,CAAC7B,wCAAwC,QACtCiC,KACuC,CACH,CACvC,CACkC,CAErC,CACF;EAED,OAAO;IAAEV,KAAK;IAAEC,WAAW;IAAEmC,OAAO;IAAEhC;EAAO,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { debounce } from '@wordpress/compose';
|
|
7
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
import { CheckboxControl, __experimentalInputControl as InputControl, __experimentalNumberControl as NumberControl } from '@wordpress/components';
|
|
10
|
-
import { useState, useEffect } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { SidebarNavigationScreenDetailsPanel, SidebarNavigationScreenDetailsPanelRow } from '../sidebar-navigation-screen-details-panel';
|
|
16
|
-
const EMPTY_OBJECT = {};
|
|
17
|
-
export default function HomeTemplateDetails() {
|
|
18
|
-
const {
|
|
19
|
-
editEntityRecord
|
|
20
|
-
} = useDispatch(coreStore);
|
|
21
|
-
const {
|
|
22
|
-
allowCommentsOnNewPosts,
|
|
23
|
-
postsPerPage,
|
|
24
|
-
postsPageTitle,
|
|
25
|
-
postsPageId
|
|
26
|
-
} = useSelect(select => {
|
|
27
|
-
const {
|
|
28
|
-
getEntityRecord
|
|
29
|
-
} = select(coreStore);
|
|
30
|
-
const siteSettings = getEntityRecord('root', 'site');
|
|
31
|
-
const _postsPageRecord = siteSettings?.page_for_posts ? getEntityRecord('postType', 'page', siteSettings?.page_for_posts) : EMPTY_OBJECT;
|
|
32
|
-
return {
|
|
33
|
-
allowCommentsOnNewPosts: siteSettings?.default_comment_status === 'open',
|
|
34
|
-
postsPageTitle: _postsPageRecord?.title?.rendered,
|
|
35
|
-
postsPageId: _postsPageRecord?.id,
|
|
36
|
-
postsPerPage: siteSettings?.posts_per_page
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
const [commentsOnNewPostsValue, setCommentsOnNewPostsValue] = useState('');
|
|
40
|
-
const [postsCountValue, setPostsCountValue] = useState(1);
|
|
41
|
-
const [postsPageTitleValue, setPostsPageTitleValue] = useState('');
|
|
42
|
-
|
|
43
|
-
/*
|
|
44
|
-
* This hook serves to set the server-retrieved values,
|
|
45
|
-
* postsPageTitle, allowCommentsOnNewPosts, postsPerPage,
|
|
46
|
-
* to local state.
|
|
47
|
-
*/
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
setCommentsOnNewPostsValue(allowCommentsOnNewPosts);
|
|
50
|
-
setPostsPageTitleValue(postsPageTitle);
|
|
51
|
-
setPostsCountValue(postsPerPage);
|
|
52
|
-
}, [postsPageTitle, allowCommentsOnNewPosts, postsPerPage]);
|
|
53
|
-
const setAllowCommentsOnNewPosts = newValue => {
|
|
54
|
-
setCommentsOnNewPostsValue(newValue);
|
|
55
|
-
editEntityRecord('root', 'site', undefined, {
|
|
56
|
-
default_comment_status: newValue ? 'open' : null
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
const setPostsPageTitle = newValue => {
|
|
60
|
-
setPostsPageTitleValue(newValue);
|
|
61
|
-
editEntityRecord('postType', 'page', postsPageId, {
|
|
62
|
-
title: newValue
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const setPostsPerPage = newValue => {
|
|
66
|
-
setPostsCountValue(newValue);
|
|
67
|
-
editEntityRecord('root', 'site', undefined, {
|
|
68
|
-
posts_per_page: newValue
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
return createElement(Fragment, null, createElement(SidebarNavigationScreenDetailsPanel, {
|
|
72
|
-
spacing: 6
|
|
73
|
-
}, postsPageId && createElement(SidebarNavigationScreenDetailsPanelRow, null, createElement(InputControl, {
|
|
74
|
-
className: "edit-site-sidebar-navigation-screen__input-control",
|
|
75
|
-
placeholder: __('No Title'),
|
|
76
|
-
size: '__unstable-large',
|
|
77
|
-
value: postsPageTitleValue,
|
|
78
|
-
onChange: debounce(setPostsPageTitle, 300),
|
|
79
|
-
label: __('Blog title'),
|
|
80
|
-
help: __('Set the Posts Page title. Appears in search results, and when the page is shared on social media.')
|
|
81
|
-
})), createElement(SidebarNavigationScreenDetailsPanelRow, null, createElement(NumberControl, {
|
|
82
|
-
className: "edit-site-sidebar-navigation-screen__input-control",
|
|
83
|
-
placeholder: 0,
|
|
84
|
-
value: postsCountValue,
|
|
85
|
-
size: '__unstable-large',
|
|
86
|
-
spinControls: "custom",
|
|
87
|
-
step: "1",
|
|
88
|
-
min: "1",
|
|
89
|
-
onChange: setPostsPerPage,
|
|
90
|
-
label: __('Posts per page'),
|
|
91
|
-
help: __('Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.')
|
|
92
|
-
}))), createElement(SidebarNavigationScreenDetailsPanel, {
|
|
93
|
-
title: __('Discussion'),
|
|
94
|
-
spacing: 3
|
|
95
|
-
}, createElement(SidebarNavigationScreenDetailsPanelRow, null, createElement(CheckboxControl, {
|
|
96
|
-
className: "edit-site-sidebar-navigation-screen__input-control",
|
|
97
|
-
label: __('Allow comments on new posts'),
|
|
98
|
-
help: __('Changes will apply to new posts only. Individual posts may override these settings.'),
|
|
99
|
-
checked: commentsOnNewPostsValue,
|
|
100
|
-
onChange: setAllowCommentsOnNewPosts
|
|
101
|
-
}))));
|
|
102
|
-
}
|
|
103
|
-
//# sourceMappingURL=home-template-details.js.map
|
package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","debounce","useSelect","useDispatch","store","coreStore","CheckboxControl","__experimentalInputControl","InputControl","__experimentalNumberControl","NumberControl","useState","useEffect","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","EMPTY_OBJECT","HomeTemplateDetails","editEntityRecord","allowCommentsOnNewPosts","postsPerPage","postsPageTitle","postsPageId","select","getEntityRecord","siteSettings","_postsPageRecord","page_for_posts","default_comment_status","title","rendered","id","posts_per_page","commentsOnNewPostsValue","setCommentsOnNewPostsValue","postsCountValue","setPostsCountValue","postsPageTitleValue","setPostsPageTitleValue","setAllowCommentsOnNewPosts","newValue","undefined","setPostsPageTitle","setPostsPerPage","createElement","Fragment","spacing","className","placeholder","size","value","onChange","label","help","spinControls","step","min","checked"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/home-template-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { debounce } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tCheckboxControl,\n\t__experimentalInputControl as InputControl,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n} from '../sidebar-navigation-screen-details-panel';\n\nconst EMPTY_OBJECT = {};\n\nexport default function HomeTemplateDetails() {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst {\n\t\tallowCommentsOnNewPosts,\n\t\tpostsPerPage,\n\t\tpostsPageTitle,\n\t\tpostsPageId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\tconst _postsPageRecord = siteSettings?.page_for_posts\n\t\t\t? getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'page',\n\t\t\t\t\tsiteSettings?.page_for_posts\n\t\t\t )\n\t\t\t: EMPTY_OBJECT;\n\n\t\treturn {\n\t\t\tallowCommentsOnNewPosts:\n\t\t\t\tsiteSettings?.default_comment_status === 'open',\n\t\t\tpostsPageTitle: _postsPageRecord?.title?.rendered,\n\t\t\tpostsPageId: _postsPageRecord?.id,\n\t\t\tpostsPerPage: siteSettings?.posts_per_page,\n\t\t};\n\t}, [] );\n\n\tconst [ commentsOnNewPostsValue, setCommentsOnNewPostsValue ] =\n\t\tuseState( '' );\n\tconst [ postsCountValue, setPostsCountValue ] = useState( 1 );\n\tconst [ postsPageTitleValue, setPostsPageTitleValue ] = useState( '' );\n\n\t/*\n\t * This hook serves to set the server-retrieved values,\n\t * postsPageTitle, allowCommentsOnNewPosts, postsPerPage,\n\t * to local state.\n\t */\n\tuseEffect( () => {\n\t\tsetCommentsOnNewPostsValue( allowCommentsOnNewPosts );\n\t\tsetPostsPageTitleValue( postsPageTitle );\n\t\tsetPostsCountValue( postsPerPage );\n\t}, [ postsPageTitle, allowCommentsOnNewPosts, postsPerPage ] );\n\n\tconst setAllowCommentsOnNewPosts = ( newValue ) => {\n\t\tsetCommentsOnNewPostsValue( newValue );\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tdefault_comment_status: newValue ? 'open' : null,\n\t\t} );\n\t};\n\n\tconst setPostsPageTitle = ( newValue ) => {\n\t\tsetPostsPageTitleValue( newValue );\n\t\teditEntityRecord( 'postType', 'page', postsPageId, {\n\t\t\ttitle: newValue,\n\t\t} );\n\t};\n\n\tconst setPostsPerPage = ( newValue ) => {\n\t\tsetPostsCountValue( newValue );\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\tposts_per_page: newValue,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreenDetailsPanel spacing={ 6 }>\n\t\t\t\t{ postsPageId && (\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__input-control\"\n\t\t\t\t\t\t\tplaceholder={ __( 'No Title' ) }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t\tvalue={ postsPageTitleValue }\n\t\t\t\t\t\t\tonChange={ debounce( setPostsPageTitle, 300 ) }\n\t\t\t\t\t\t\tlabel={ __( 'Blog title' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Set the Posts Page title. Appears in search results, and when the page is shared on social media.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t) }\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t<NumberControl\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__input-control\"\n\t\t\t\t\t\tplaceholder={ 0 }\n\t\t\t\t\t\tvalue={ postsCountValue }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tspinControls=\"custom\"\n\t\t\t\t\t\tstep=\"1\"\n\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\tonChange={ setPostsPerPage }\n\t\t\t\t\t\tlabel={ __( 'Posts per page' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Set the default number of posts to display on blog pages, including categories and tags. Some templates may override this setting.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t</SidebarNavigationScreenDetailsPanel>\n\n\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\ttitle={ __( 'Discussion' ) }\n\t\t\t\tspacing={ 3 }\n\t\t\t>\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__input-control\"\n\t\t\t\t\t\tlabel={ __( 'Allow comments on new posts' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Changes will apply to new posts only. Individual posts may override these settings.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ commentsOnNewPostsValue }\n\t\t\t\t\t\tonChange={ setAllowCommentsOnNewPosts }\n\t\t\t\t\t/>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,eAAe,EACfC,0BAA0B,IAAIC,YAAY,EAC1CC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;AAC9B,SAASC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;;AAExD;AACA;AAC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jBE,KAAK,EAAGf,eAAiB;IACzBc,IAAI,EAAG,kBAAoB;IAC3BK,YAAY,EAAC,QAAQ;IACrBC,IAAI,EAAC,GAAG;IACRC,GAAG,EAAC,GAAG;IACPL,QAAQ,EAAGR,eAAiB;IAC5BS,KAAK,EAAGnD,EAAE,CAAE,gBAAiB,CAAG;IAChCoD,IAAI,EAAGpD,EAAE,CACR,oIACD;EAAG,CACH,CACsC,CACJ,CAAC,EAEtC2C,aAAA,CAAC9B,mCAAmC;IACnCe,KAAK,EAAG5B,EAAE,CAAE,YAAa,CAAG;IAC5B6C,OAAO,EAAG;EAAG,GAEbF,aAAA,CAAC7B,sCAAsC,QACtC6B,aAAA,CAACrC,eAAe;IACfwC,SAAS,EAAC,oDAAoD;IAC9DK,KAAK,EAAGnD,EAAE,CAAE,6BAA8B,CAAG;IAC7CoD,IAAI,EAAGpD,EAAE,CACR,qFACD,CAAG;IACHwD,OAAO,EAAGxB,uBAAyB;IACnCkB,QAAQ,EAAGZ;EAA4B,CACvC,CACsC,CACJ,CACpC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __, _x } from '@wordpress/i18n';
|
|
6
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
|
-
import { pencil } from '@wordpress/icons';
|
|
8
|
-
import { Icon } from '@wordpress/components';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import TemplateAreas from './template-areas';
|
|
16
|
-
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
17
|
-
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
18
|
-
import { unlock } from '../../lock-unlock';
|
|
19
|
-
import { store as editSiteStore } from '../../store';
|
|
20
|
-
import SidebarButton from '../sidebar-button';
|
|
21
|
-
import { useAddedBy } from '../page-templates/hooks';
|
|
22
|
-
import TemplateActions from '../template-actions';
|
|
23
|
-
import HomeTemplateDetails from './home-template-details';
|
|
24
|
-
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
25
|
-
const {
|
|
26
|
-
useHistory,
|
|
27
|
-
useLocation
|
|
28
|
-
} = unlock(routerPrivateApis);
|
|
29
|
-
function useTemplateDetails(postType, postId) {
|
|
30
|
-
const {
|
|
31
|
-
getDescription,
|
|
32
|
-
getTitle,
|
|
33
|
-
record
|
|
34
|
-
} = useEditedEntityRecord(postType, postId);
|
|
35
|
-
const currentTheme = useSelect(select => select(coreStore).getCurrentTheme(), []);
|
|
36
|
-
const addedBy = useAddedBy(postType, postId);
|
|
37
|
-
const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;
|
|
38
|
-
const title = getTitle();
|
|
39
|
-
let descriptionText = getDescription();
|
|
40
|
-
if (!descriptionText && addedBy.text) {
|
|
41
|
-
descriptionText = __('This is a custom template that can be applied manually to any Post or Page.');
|
|
42
|
-
}
|
|
43
|
-
const content = record?.slug === 'home' || record?.slug === 'index' ? createElement(Fragment, null, createElement(HomeTemplateDetails, null), createElement(TemplateAreas, null)) : createElement(TemplateAreas, null);
|
|
44
|
-
const footer = record?.modified ? createElement(SidebarNavigationScreenDetailsFooter, {
|
|
45
|
-
record: record
|
|
46
|
-
}) : null;
|
|
47
|
-
const description = createElement(Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && createElement("span", {
|
|
48
|
-
className: "edit-site-sidebar-navigation-screen-template__added-by-description"
|
|
49
|
-
}, createElement("span", {
|
|
50
|
-
className: "edit-site-sidebar-navigation-screen-template__added-by-description-author"
|
|
51
|
-
}, createElement("span", {
|
|
52
|
-
className: "edit-site-sidebar-navigation-screen-template__added-by-description-author-icon"
|
|
53
|
-
}, addedBy.imageUrl ? createElement("img", {
|
|
54
|
-
src: addedBy.imageUrl,
|
|
55
|
-
alt: "",
|
|
56
|
-
width: "24",
|
|
57
|
-
height: "24"
|
|
58
|
-
}) : createElement(Icon, {
|
|
59
|
-
icon: addedBy.icon
|
|
60
|
-
})), addedBy.text), addedBy.isCustomized && createElement("span", {
|
|
61
|
-
className: "edit-site-sidebar-navigation-screen-template__added-by-description-customized"
|
|
62
|
-
}, _x('(Customized)', 'template'))));
|
|
63
|
-
return {
|
|
64
|
-
title,
|
|
65
|
-
description,
|
|
66
|
-
content,
|
|
67
|
-
footer
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export default function SidebarNavigationScreenTemplate() {
|
|
71
|
-
const history = useHistory();
|
|
72
|
-
const {
|
|
73
|
-
params: {
|
|
74
|
-
postType,
|
|
75
|
-
postId
|
|
76
|
-
}
|
|
77
|
-
} = useLocation();
|
|
78
|
-
const {
|
|
79
|
-
setCanvasMode
|
|
80
|
-
} = unlock(useDispatch(editSiteStore));
|
|
81
|
-
const {
|
|
82
|
-
title,
|
|
83
|
-
content,
|
|
84
|
-
description,
|
|
85
|
-
footer
|
|
86
|
-
} = useTemplateDetails(postType, postId);
|
|
87
|
-
return createElement(SidebarNavigationScreen, {
|
|
88
|
-
title: title,
|
|
89
|
-
actions: createElement(Fragment, null, createElement(TemplateActions, {
|
|
90
|
-
postType: postType,
|
|
91
|
-
postId: postId,
|
|
92
|
-
toggleProps: {
|
|
93
|
-
as: SidebarButton
|
|
94
|
-
},
|
|
95
|
-
onRemove: () => {
|
|
96
|
-
history.push({
|
|
97
|
-
path: '/' + postType
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}), createElement(SidebarButton, {
|
|
101
|
-
onClick: () => setCanvasMode('edit'),
|
|
102
|
-
label: __('Edit'),
|
|
103
|
-
icon: pencil
|
|
104
|
-
})),
|
|
105
|
-
description: description,
|
|
106
|
-
content: content,
|
|
107
|
-
footer: footer
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","useDispatch","useSelect","pencil","Icon","store","coreStore","privateApis","routerPrivateApis","TemplateAreas","SidebarNavigationScreen","useEditedEntityRecord","unlock","editSiteStore","SidebarButton","useAddedBy","TemplateActions","HomeTemplateDetails","SidebarNavigationScreenDetailsFooter","useHistory","useLocation","useTemplateDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","content","slug","createElement","Fragment","footer","modified","description","className","imageUrl","src","alt","width","height","icon","isCustomized","SidebarNavigationScreenTemplate","history","params","setCanvasMode","actions","toggleProps","as","onRemove","push","path","onClick","label"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nfunction useTemplateDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useLocation();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( { path: '/' + postType } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\t\t\tfooter={ footer }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,IAAI,QAAQ,uBAAuB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,uBAAuB,M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IAAEM,WAAW;IAAEF;EAAO,CAAC,GAAGrB,kBAAkB,CACjEC,QAAQ,EACRC,MACD,CAAC;EAED,OACCiB,aAAA,CAAC9B,uBAAuB;IACvByB,KAAK,EAAGA,KAAO;IACfsB,OAAO,EACNjB,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACxB,eAAe;MACfM,QAAQ,EAAGA,QAAU;MACrBC,MAAM,EAAGA,MAAQ;MACjBmC,WAAW,EAAG;QAAEC,EAAE,EAAE7C;MAAc,CAAG;MACrC8C,QAAQ,EAAGA,CAAA,KAAM;QAChBN,OAAO,CAACO,IAAI,CAAE;UAAEC,IAAI,EAAE,GAAG,GAAGxC;QAAS,CAAE,CAAC;MACzC;IAAG,CACH,CAAC,EACFkB,aAAA,CAAC1B,aAAa;MACbiD,OAAO,EAAGA,CAAA,KAAMP,aAAa,CAAE,MAAO,CAAG;MACzCQ,KAAK,EAAGjE,EAAE,CAAE,MAAO,CAAG;MACtBoD,IAAI,EAAGhD;IAAQ,CACf,CACA,CACF;IACDyC,WAAW,EAAGA,WAAa;IAC3BN,OAAO,EAAGA,OAAS;IACnBI,MAAM,EAAGA;EAAQ,CACjB,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { __experimentalTruncate as Truncate, __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
8
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
-
import { useMemo } from '@wordpress/element';
|
|
10
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { SidebarNavigationScreenDetailsPanel, SidebarNavigationScreenDetailsPanelRow } from '../sidebar-navigation-screen-details-panel';
|
|
16
|
-
import { unlock } from '../../lock-unlock';
|
|
17
|
-
import { store as editSiteStore } from '../../store';
|
|
18
|
-
import { useLink } from '../routes/link';
|
|
19
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
20
|
-
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
21
|
-
function TemplateAreaButton({
|
|
22
|
-
postId,
|
|
23
|
-
area,
|
|
24
|
-
title
|
|
25
|
-
}) {
|
|
26
|
-
const templatePartArea = useSelect(select => {
|
|
27
|
-
const defaultAreas = select(editorStore).__experimentalGetDefaultTemplatePartAreas();
|
|
28
|
-
return defaultAreas.find(defaultArea => defaultArea.area === area);
|
|
29
|
-
}, [area]);
|
|
30
|
-
const linkInfo = useLink({
|
|
31
|
-
postType: TEMPLATE_PART_POST_TYPE,
|
|
32
|
-
postId
|
|
33
|
-
});
|
|
34
|
-
return createElement(SidebarNavigationItem, {
|
|
35
|
-
className: "edit-site-sidebar-navigation-screen-template__template-area-button",
|
|
36
|
-
...linkInfo,
|
|
37
|
-
icon: templatePartArea?.icon,
|
|
38
|
-
withChevron: true
|
|
39
|
-
}, createElement(Truncate, {
|
|
40
|
-
limit: 20,
|
|
41
|
-
ellipsizeMode: "tail",
|
|
42
|
-
numberOfLines: 1,
|
|
43
|
-
className: "edit-site-sidebar-navigation-screen-template__template-area-label-text"
|
|
44
|
-
}, decodeEntities(title)));
|
|
45
|
-
}
|
|
46
|
-
export default function TemplateAreas() {
|
|
47
|
-
const {
|
|
48
|
-
templatePartAreas,
|
|
49
|
-
currentTemplateParts
|
|
50
|
-
} = useSelect(select => {
|
|
51
|
-
const {
|
|
52
|
-
getSettings,
|
|
53
|
-
getCurrentTemplateTemplateParts
|
|
54
|
-
} = unlock(select(editSiteStore));
|
|
55
|
-
return {
|
|
56
|
-
templatePartAreas: getSettings()?.defaultTemplatePartAreas,
|
|
57
|
-
currentTemplateParts: getCurrentTemplateTemplateParts()
|
|
58
|
-
};
|
|
59
|
-
}, []);
|
|
60
|
-
|
|
61
|
-
/*
|
|
62
|
-
* Merge data in currentTemplateParts with templatePartAreas,
|
|
63
|
-
* which contains the template icon and fallback labels
|
|
64
|
-
*/
|
|
65
|
-
const templateAreas = useMemo(() => {
|
|
66
|
-
// Keep track of template part IDs that have already been added to the array.
|
|
67
|
-
const templatePartIds = new Set();
|
|
68
|
-
const filterOutDuplicateTemplateParts = currentTemplatePart => {
|
|
69
|
-
// If the template part has already been added to the array, skip it.
|
|
70
|
-
if (templatePartIds.has(currentTemplatePart.templatePart.id)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// Add to the array of template part IDs.
|
|
74
|
-
templatePartIds.add(currentTemplatePart.templatePart.id);
|
|
75
|
-
return currentTemplatePart;
|
|
76
|
-
};
|
|
77
|
-
return currentTemplateParts.length && templatePartAreas ? currentTemplateParts.filter(filterOutDuplicateTemplateParts).map(({
|
|
78
|
-
templatePart,
|
|
79
|
-
block
|
|
80
|
-
}) => ({
|
|
81
|
-
...templatePartAreas?.find(({
|
|
82
|
-
area
|
|
83
|
-
}) => area === templatePart?.area),
|
|
84
|
-
...templatePart,
|
|
85
|
-
clientId: block.clientId
|
|
86
|
-
})) : [];
|
|
87
|
-
}, [currentTemplateParts, templatePartAreas]);
|
|
88
|
-
if (!templateAreas.length) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return createElement(SidebarNavigationScreenDetailsPanel, {
|
|
92
|
-
title: __('Areas'),
|
|
93
|
-
spacing: 3
|
|
94
|
-
}, createElement(ItemGroup, null, templateAreas.map(({
|
|
95
|
-
clientId,
|
|
96
|
-
label,
|
|
97
|
-
area,
|
|
98
|
-
theme,
|
|
99
|
-
slug,
|
|
100
|
-
title
|
|
101
|
-
}) => createElement(SidebarNavigationScreenDetailsPanelRow, {
|
|
102
|
-
key: clientId
|
|
103
|
-
}, createElement(TemplateAreaButton, {
|
|
104
|
-
postId: `${theme}//${slug}`,
|
|
105
|
-
title: title?.rendered || label,
|
|
106
|
-
area: area
|
|
107
|
-
})))));
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=template-areas.js.map
|