@wordpress/edit-site 5.30.0 → 5.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/actions/index.js +2 -4
- package/build/components/actions/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +16 -3
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +1 -1
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +0 -9
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +15 -8
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +4 -3
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +44 -10
- 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 +2 -2
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/header.js +1 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +50 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-iframe.js +0 -1
- package/build/components/global-styles/preview-iframe.js.map +1 -1
- package/build/components/global-styles/preview-styles.js +2 -2
- package/build/components/global-styles/preview-styles.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +2 -9
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +1 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +3 -1
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
- package/build/components/global-styles/typography-example.js.map +1 -0
- package/build/components/global-styles/typography-preview.js +3 -1
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +8 -9
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +27 -37
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/header-edit-mode/index.js +2 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/global.js +17 -3
- package/build/components/keyboard-shortcuts/global.js.map +1 -1
- package/build/components/layout/router.js +2 -5
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +6 -11
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +6 -1
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/index.js +1 -4
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +9 -9
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +11 -16
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/save-panel/index.js +14 -9
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +2 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +2 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +12 -6
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +23 -3
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +13 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/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-template/index.js +5 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +44 -27
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +11 -2
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/utils/constants.js +5 -3
- package/build/utils/constants.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/math.js +98 -0
- package/build/utils/math.js.map +1 -0
- package/build-module/components/actions/index.js +3 -5
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +16 -3
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +0 -8
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +16 -9
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +4 -3
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +44 -10
- 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 +2 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/header.js +1 -1
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +48 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-iframe.js +0 -1
- package/build-module/components/global-styles/preview-iframe.js.map +1 -1
- package/build-module/components/global-styles/preview-styles.js +2 -2
- package/build-module/components/global-styles/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +2 -9
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +3 -1
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
- package/build-module/components/global-styles/typography-example.js.map +1 -0
- package/build-module/components/global-styles/typography-preview.js +3 -1
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +8 -9
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +28 -38
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +2 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/global.js +17 -3
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
- package/build-module/components/layout/router.js +2 -5
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +7 -12
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/index.js +2 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +9 -9
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +12 -17
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +14 -9
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +3 -3
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +4 -3
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -3
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +13 -7
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +24 -4
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +14 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/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-template/index.js +5 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +44 -27
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +11 -2
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/utils/constants.js +4 -2
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/math.js +92 -0
- package/build-module/utils/math.js.map +1 -0
- package/build-style/style-rtl.css +41 -37
- package/build-style/style.css +41 -37
- package/package.json +42 -42
- package/src/components/actions/index.js +3 -5
- package/src/components/block-editor/editor-canvas.js +20 -7
- package/src/components/block-editor/use-site-editor-settings.js +0 -2
- package/src/components/global-styles/color-palette-panel.js +0 -11
- package/src/components/global-styles/font-library-modal/context.js +34 -17
- package/src/components/global-styles/font-library-modal/font-collection.js +4 -3
- package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/src/components/global-styles/font-library-modal/style.scss +14 -5
- package/src/components/global-styles/font-library-modal/upload-fonts.js +53 -8
- package/src/components/global-styles/font-library-modal/utils/index.js +4 -4
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +4 -0
- package/src/components/global-styles/header.js +1 -1
- package/src/components/global-styles/hooks.js +68 -1
- package/src/components/global-styles/preview-iframe.js +0 -1
- package/src/components/global-styles/preview-styles.js +2 -2
- package/src/components/global-styles/screen-colors.js +2 -13
- package/src/components/global-styles/screen-typography.js +1 -12
- package/src/components/global-styles/style.scss +4 -1
- package/src/components/global-styles/typography-elements.js +5 -1
- package/src/components/global-styles/{preview-typography.js → typography-example.js} +3 -1
- package/src/components/global-styles/typography-preview.js +3 -1
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/global-styles/variations/style.scss +0 -6
- package/src/components/global-styles/variations/variations-color.js +9 -5
- package/src/components/global-styles/variations/variations-typography.js +37 -59
- package/src/components/header-edit-mode/index.js +1 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/keyboard-shortcuts/global.js +16 -4
- package/src/components/layout/router.js +2 -7
- package/src/components/page-pages/index.js +8 -13
- package/src/components/page-patterns/delete-category-menu-item.js +7 -0
- package/src/components/page-patterns/index.js +2 -3
- package/src/components/page-patterns/use-patterns.js +17 -10
- package/src/components/page-templates-template-parts/index.js +14 -22
- package/src/components/save-panel/index.js +24 -17
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/src/components/sidebar-dataviews/dataview-item.js +2 -2
- package/src/components/sidebar-dataviews/default-views.js +11 -3
- package/src/components/sidebar-dataviews/index.js +4 -3
- package/src/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +30 -11
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +10 -11
- package/src/components/sidebar-edit-mode/template-panel/index.js +24 -5
- package/src/components/sidebar-navigation-screen/style.scss +10 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +35 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +2 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
- package/src/components/sidebar-navigation-screen-template/index.js +6 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
- package/src/components/template-actions/index.js +63 -46
- package/src/components/welcome-guide/editor.js +9 -6
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +21 -4
- package/src/style.scss +0 -1
- package/src/utils/constants.js +4 -2
- package/src/utils/get-is-list-page.js +1 -1
- package/src/utils/math.js +93 -0
- package/build/components/global-styles/preview-typography.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
- package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/build-module/components/global-styles/preview-typography.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
- package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
|
@@ -6,6 +6,7 @@ import { Guide } from '@wordpress/components';
|
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { createInterpolateElement } from '@wordpress/element';
|
|
8
8
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
@@ -15,16 +16,18 @@ import WelcomeGuideImage from './image';
|
|
|
15
16
|
export default function WelcomeGuideEditor() {
|
|
16
17
|
const { toggle } = useDispatch( preferencesStore );
|
|
17
18
|
|
|
18
|
-
const isActive = useSelect(
|
|
19
|
-
|
|
20
|
-
!! select( preferencesStore ).get(
|
|
19
|
+
const { isActive, isBlockBasedTheme } = useSelect( ( select ) => {
|
|
20
|
+
return {
|
|
21
|
+
isActive: !! select( preferencesStore ).get(
|
|
21
22
|
'core/edit-site',
|
|
22
23
|
'welcomeGuide'
|
|
23
24
|
),
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
isBlockBasedTheme:
|
|
26
|
+
select( coreStore ).getCurrentTheme()?.is_block_theme,
|
|
27
|
+
};
|
|
28
|
+
}, [] );
|
|
26
29
|
|
|
27
|
-
if ( ! isActive ) {
|
|
30
|
+
if ( ! isActive || ! isBlockBasedTheme ) {
|
|
28
31
|
return null;
|
|
29
32
|
}
|
|
30
33
|
|
|
@@ -5,6 +5,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
5
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
6
6
|
import { useContext, useMemo } from '@wordpress/element';
|
|
7
7
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
@@ -54,13 +55,29 @@ export function useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
|
54
55
|
property,
|
|
55
56
|
filter,
|
|
56
57
|
} ) {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const { variationsFromTheme } = useSelect( ( select ) => {
|
|
59
|
+
const _variationsFromTheme =
|
|
60
|
+
select(
|
|
61
|
+
coreStore
|
|
62
|
+
).__experimentalGetCurrentThemeGlobalStylesVariations();
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
variationsFromTheme: _variationsFromTheme || [],
|
|
66
|
+
};
|
|
61
67
|
}, [] );
|
|
62
68
|
const { user: baseVariation } = useContext( GlobalStylesContext );
|
|
63
69
|
|
|
70
|
+
const variations = useMemo( () => {
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
title: __( 'Default' ),
|
|
74
|
+
settings: {},
|
|
75
|
+
styles: {},
|
|
76
|
+
},
|
|
77
|
+
...variationsFromTheme,
|
|
78
|
+
];
|
|
79
|
+
}, [ variationsFromTheme ] );
|
|
80
|
+
|
|
64
81
|
return useThemeStyleVariationsByProperty( {
|
|
65
82
|
variations,
|
|
66
83
|
property,
|
package/src/style.scss
CHANGED
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
@import "./components/sidebar-navigation-screen-details-footer/style.scss";
|
|
34
34
|
@import "./components/sidebar-navigation-screen-navigation-menu/style.scss";
|
|
35
35
|
@import "./components/sidebar-navigation-screen-page/style.scss";
|
|
36
|
-
@import "./components/sidebar-navigation-screen-templates/style.scss";
|
|
37
36
|
@import "components/sidebar-navigation-screen-details-panel/style.scss";
|
|
38
37
|
@import "./components/sidebar-navigation-screen-pattern/style.scss";
|
|
39
38
|
@import "./components/sidebar-navigation-screen-patterns/style.scss";
|
package/src/utils/constants.js
CHANGED
|
@@ -50,5 +50,7 @@ export const LAYOUT_GRID = 'grid';
|
|
|
50
50
|
export const LAYOUT_TABLE = 'table';
|
|
51
51
|
export const LAYOUT_LIST = 'list';
|
|
52
52
|
export const ENUMERATION_TYPE = 'enumeration';
|
|
53
|
-
export const
|
|
54
|
-
export const
|
|
53
|
+
export const OPERATOR_IS = 'is';
|
|
54
|
+
export const OPERATOR_IS_NOT = 'isNot';
|
|
55
|
+
export const OPERATOR_IS_ANY = 'isAny';
|
|
56
|
+
export const OPERATOR_IS_NONE = 'isNone';
|
|
@@ -14,7 +14,7 @@ export default function getIsListPage(
|
|
|
14
14
|
isMobileViewport
|
|
15
15
|
) {
|
|
16
16
|
return (
|
|
17
|
-
[ '/wp_template
|
|
17
|
+
[ '/wp_template', '/wp_template_part/all', '/pages' ].includes(
|
|
18
18
|
path
|
|
19
19
|
) ||
|
|
20
20
|
( path === '/patterns' &&
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} WPPoint
|
|
3
|
+
* @property {number} x The horizontal coordinate.
|
|
4
|
+
* @property {number} y The vertical coordinate.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Clamps a value to a range. Uses the CSS `clamp()` ordering for arguments.
|
|
9
|
+
*
|
|
10
|
+
* @param {number} min Minimum range.
|
|
11
|
+
* @param {number} value Value to clamp.
|
|
12
|
+
* @param {number} max Maximum range.
|
|
13
|
+
*
|
|
14
|
+
* @return {number} Clamped value.
|
|
15
|
+
*/
|
|
16
|
+
function clamp( min, value, max ) {
|
|
17
|
+
return Math.max( min, Math.min( value, max ) );
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Evaluates a linear function passing through two points at the given x value.
|
|
22
|
+
*
|
|
23
|
+
* Example:
|
|
24
|
+
* f(x)
|
|
25
|
+
* │ ╲
|
|
26
|
+
* │ * (p0)
|
|
27
|
+
* │ ╲
|
|
28
|
+
* │ ╲
|
|
29
|
+
* │ (p1) *
|
|
30
|
+
* │ ╲
|
|
31
|
+
* └──────────── x
|
|
32
|
+
*
|
|
33
|
+
* @param {WPPoint} p0 First point.
|
|
34
|
+
* @param {WPPoint} p1 Second point.
|
|
35
|
+
* @param {number} x Value to evaluate at.
|
|
36
|
+
*
|
|
37
|
+
* @return {number} Result of the two-point linear function at x.
|
|
38
|
+
*/
|
|
39
|
+
function twoPointLinearFn( p0, p1, x ) {
|
|
40
|
+
return ( ( p1.y - p0.y ) / ( p1.x - p0.x ) ) * ( x - p0.x ) + p0.y;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Evaluates a two-point linear function at a given x value, clamped to the range of the points.
|
|
45
|
+
*
|
|
46
|
+
* Example:
|
|
47
|
+
* f(x)
|
|
48
|
+
* │ ───* (p0)
|
|
49
|
+
* │ ╲
|
|
50
|
+
* │ ╲
|
|
51
|
+
* │ (p1) *───
|
|
52
|
+
* └──────────── x
|
|
53
|
+
*
|
|
54
|
+
* @param {WPPoint} p0 First point.
|
|
55
|
+
* @param {WPPoint} p1 Second point.
|
|
56
|
+
* @param {number} x Value to evaluate at.
|
|
57
|
+
*
|
|
58
|
+
* @return {number} Result of the two-point linear function clamped to the range of the points.
|
|
59
|
+
*/
|
|
60
|
+
function clampedTwoPointLinearFn( p0, p1, x ) {
|
|
61
|
+
return clamp(
|
|
62
|
+
Math.min( p0.y, p1.y ),
|
|
63
|
+
twoPointLinearFn( p0, p1, x ),
|
|
64
|
+
Math.max( p0.y, p1.y )
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Computes the iframe scale using a start and end width/scale pair and the current width.
|
|
70
|
+
*
|
|
71
|
+
* The scale is clamped outside the points and is linearly interpolated between.
|
|
72
|
+
*
|
|
73
|
+
* Example:
|
|
74
|
+
* scale
|
|
75
|
+
* │ ───* (start)
|
|
76
|
+
* │ ╲
|
|
77
|
+
* │ ╲
|
|
78
|
+
* │ (end) *───
|
|
79
|
+
* └──────────── width
|
|
80
|
+
*
|
|
81
|
+
* @param {Object} start First width and scale pair.
|
|
82
|
+
* @param {Object} end Second width and scale pair.
|
|
83
|
+
* @param {number} currentWidth Current width.
|
|
84
|
+
*
|
|
85
|
+
* @return {number} The scale of the current width between the two points.
|
|
86
|
+
*/
|
|
87
|
+
export function computeIFrameScale( start, end, currentWidth ) {
|
|
88
|
+
return clampedTwoPointLinearFn(
|
|
89
|
+
{ x: start.width, y: start.scale },
|
|
90
|
+
{ x: end.width, y: end.scale },
|
|
91
|
+
currentWidth
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_i18n","_blockEditor","_globalStylesProvider","_lockUnlock","_previewStyles","_utils","GlobalStylesContext","unlock","blockEditorPrivateApis","PreviewTypography","fontSize","variation","base","useContext","config","mergeBaseAndUserConfigs","bodyFontFamilies","headingFontFamilies","getFontFamilies","bodyPreviewStyle","getFamilyPreviewStyle","headingPreviewStyle","_react","createElement","__unstableMotion","div","className","animate","scale","opacity","initial","transition","delay","type","style","_x"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from './global-styles-provider';\nimport { unlock } from '../../lock-unlock';\nimport { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';\nimport { getFontFamilies } from './utils';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\nexport default function PreviewTypography( { fontSize, variation } ) {\n\tconst { base } = useContext( GlobalStylesContext );\n\tlet config = base;\n\tif ( variation ) {\n\t\tconfig = mergeBaseAndUserConfigs( base, variation );\n\t}\n\tconst [ bodyFontFamilies, headingFontFamilies ] = getFontFamilies( config );\n\tconst bodyPreviewStyle = bodyFontFamilies\n\t\t? getFamilyPreviewStyle( bodyFontFamilies )\n\t\t: {};\n\tconst headingPreviewStyle = headingFontFamilies\n\t\t? getFamilyPreviewStyle( headingFontFamilies )\n\t\t: {};\n\n\tif ( fontSize ) {\n\t\tbodyPreviewStyle.fontSize = fontSize;\n\t\theadingPreviewStyle.fontSize = fontSize;\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName=\"edit-site-global-styles_preview-typography\"\n\t\t\tanimate={ {\n\t\t\t\tscale: 1,\n\t\t\t\topacity: 1,\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tscale: 0.1,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\ttransition={ {\n\t\t\t\tdelay: 0.3,\n\t\t\t\ttype: 'tween',\n\t\t\t} }\n\t\t>\n\t\t\t<span style={ headingPreviewStyle }>\n\t\t\t\t{ _x( 'A', 'Uppercase letter A' ) }\n\t\t\t</span>\n\t\t\t<span style={ bodyPreviewStyle }>\n\t\t\t\t{ _x( 'a', 'Lowercase letter A' ) }\n\t\t\t</span>\n\t\t</motion.div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AAMA;AACA;AACA;;AAMA,MAAM;EAAEQ;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEjD,SAASC,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAU,CAAC,EAAG;EACpE,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mBAAU,EAAEP,mBAAoB,CAAC;EAClD,IAAIQ,MAAM,GAAGF,IAAI;EACjB,IAAKD,SAAS,EAAG;IAChBG,MAAM,GAAG,IAAAC,6CAAuB,EAAEH,IAAI,EAAED,SAAU,CAAC;EACpD;EACA,MAAM,CAAEK,gBAAgB,EAAEC,mBAAmB,CAAE,GAAG,IAAAC,sBAAe,EAAEJ,MAAO,CAAC;EAC3E,MAAMK,gBAAgB,GAAGH,gBAAgB,GACtC,IAAAI,oCAAqB,EAAEJ,gBAAiB,CAAC,GACzC,CAAC,CAAC;EACL,MAAMK,mBAAmB,GAAGJ,mBAAmB,GAC5C,IAAAG,oCAAqB,EAAEH,mBAAoB,CAAC,GAC5C,CAAC,CAAC;EAEL,IAAKP,QAAQ,EAAG;IACfS,gBAAgB,CAACT,QAAQ,GAAGA,QAAQ;IACpCW,mBAAmB,CAACX,QAAQ,GAAGA,QAAQ;EACxC;EAEA,OACC,IAAAY,MAAA,CAAAC,aAAA,EAACxB,WAAA,CAAAyB,gBAAM,CAACC,GAAG;IACVC,SAAS,EAAC,4CAA4C;IACtDC,OAAO,EAAG;MACTC,KAAK,EAAE,CAAC;MACRC,OAAO,EAAE;IACV,CAAG;IACHC,OAAO,EAAG;MACTF,KAAK,EAAE,GAAG;MACVC,OAAO,EAAE;IACV,CAAG;IACHE,UAAU,EAAG;MACZC,KAAK,EAAE,GAAG;MACVC,IAAI,EAAE;IACP;EAAG,GAEH,IAAAX,MAAA,CAAAC,aAAA;IAAMW,KAAK,EAAGb;EAAqB,GAChC,IAAAc,QAAE,EAAE,GAAG,EAAE,oBAAqB,CAC3B,CAAC,EACP,IAAAb,MAAA,CAAAC,aAAA;IAAMW,KAAK,EAAGf;EAAkB,GAC7B,IAAAgB,QAAE,EAAE,GAAG,EAAE,oBAAqB,CAC3B,CACK,CAAC;AAEf"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = Actions;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _components = require("@wordpress/components");
|
|
12
|
-
var _icons = require("@wordpress/icons");
|
|
13
|
-
var _store = require("../../../store");
|
|
14
|
-
var _isTemplateRevertable = _interopRequireDefault(require("../../../utils/is-template-revertable"));
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
function Actions({
|
|
24
|
-
template
|
|
25
|
-
}) {
|
|
26
|
-
const {
|
|
27
|
-
revertTemplate
|
|
28
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
29
|
-
const isRevertable = (0, _isTemplateRevertable.default)(template);
|
|
30
|
-
if (!isRevertable) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return (0, _react.createElement)(_components.DropdownMenu, {
|
|
34
|
-
icon: _icons.moreVertical,
|
|
35
|
-
label: (0, _i18n.__)('Actions'),
|
|
36
|
-
className: "edit-site-template-card__actions",
|
|
37
|
-
toggleProps: {
|
|
38
|
-
isSmall: true
|
|
39
|
-
}
|
|
40
|
-
}, ({
|
|
41
|
-
onClose
|
|
42
|
-
}) => (0, _react.createElement)(_components.MenuGroup, null, isRevertable && (0, _react.createElement)(_components.MenuItem, {
|
|
43
|
-
info: (0, _i18n.__)('Use the template as supplied by the theme.'),
|
|
44
|
-
onClick: () => {
|
|
45
|
-
revertTemplate(template);
|
|
46
|
-
onClose();
|
|
47
|
-
}
|
|
48
|
-
}, (0, _i18n.__)('Clear customizations'))));
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=template-actions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_components","_icons","_store","_isTemplateRevertable","_interopRequireDefault","Actions","template","revertTemplate","useDispatch","editSiteStore","isRevertable","isTemplateRevertable","_react","createElement","DropdownMenu","icon","moreVertical","label","__","className","toggleProps","isSmall","onClose","MenuGroup","MenuItem","info","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/template-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\n\nexport default function Actions( { template } ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\ttoggleProps={ { isSmall: true } }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASO,OAAOA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC/C,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EACvD,MAAMC,YAAY,GAAG,IAAAC,6BAAoB,EAAEL,QAAS,CAAC;EAErD,IAAK,CAAEI,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAE,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAc,YAAY;IACZC,IAAI,EAAGC,mBAAc;IACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBC,SAAS,EAAC,kCAAkC;IAC5CC,WAAW,EAAG;MAAEC,OAAO,EAAE;IAAK;EAAG,GAE/B,CAAE;IAAEC;EAAQ,CAAC,KACd,IAAAV,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAuB,SAAS,QACPb,YAAY,IACb,IAAAE,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAwB,QAAQ;IACRC,IAAI,EAAG,IAAAP,QAAE,EACR,4CACD,CAAG;IACHQ,OAAO,EAAGA,CAAA,KAAM;MACfnB,cAAc,CAAED,QAAS,CAAC;MAC1BgB,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAAJ,QAAE,EAAE,sBAAuB,CACpB,CAED,CAEC,CAAC;AAEjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","RenameModal","onClose","onConfirm","_react","createElement","__experimentalConfirmDialog","isOpen","e","preventDefault","onCancel","confirmButtonText","__"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function RenameModal( { onClose, onConfirm } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\tonConfirm={ ( e ) => {\n\t\t\t\te.preventDefault();\n\t\t\t\tonConfirm();\n\n\t\t\t\t// Immediate close avoids ability to hit delete multiple times.\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\tonCancel={ onClose }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t>\n\t\t\t{ __( 'Are you sure you want to delete this Navigation menu?' ) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,WAAWA,CAAE;EAAEC,OAAO;EAAEC;AAAU,CAAC,EAAG;EAC7D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACP,WAAA,CAAAQ,2BAAa;IACbC,MAAM;IACNJ,SAAS,EAAKK,CAAC,IAAM;MACpBA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClBN,SAAS,CAAC,CAAC;;MAEX;MACAD,OAAO,CAAC,CAAC;IACV,CAAG;IACHQ,QAAQ,EAAGR,OAAS;IACpBS,iBAAiB,EAAG,IAAAC,QAAE,EAAE,QAAS;EAAG,GAElC,IAAAA,QAAE,EAAE,uDAAwD,CAChD,CAAC;AAElB"}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = SidebarNavigationScreenTemplates;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _coreData = require("@wordpress/core-data");
|
|
12
|
-
var _htmlEntities = require("@wordpress/html-entities");
|
|
13
|
-
var _compose = require("@wordpress/compose");
|
|
14
|
-
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
15
|
-
var _link = require("../routes/link");
|
|
16
|
-
var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
|
|
17
|
-
var _addNewTemplate = _interopRequireDefault(require("../add-new-template"));
|
|
18
|
-
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
19
|
-
var _constants = require("../../utils/constants");
|
|
20
|
-
/**
|
|
21
|
-
* WordPress dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
const TemplateItem = ({
|
|
29
|
-
postType,
|
|
30
|
-
postId,
|
|
31
|
-
...props
|
|
32
|
-
}) => {
|
|
33
|
-
const linkInfo = (0, _link.useLink)({
|
|
34
|
-
postType,
|
|
35
|
-
postId
|
|
36
|
-
});
|
|
37
|
-
return (0, _react.createElement)(_sidebarNavigationItem.default, {
|
|
38
|
-
...linkInfo,
|
|
39
|
-
...props
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
function SidebarNavigationScreenTemplates() {
|
|
43
|
-
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
44
|
-
const {
|
|
45
|
-
records: templates,
|
|
46
|
-
isResolving: isLoading
|
|
47
|
-
} = (0, _coreData.useEntityRecords)('postType', _constants.TEMPLATE_POST_TYPE, {
|
|
48
|
-
per_page: -1
|
|
49
|
-
});
|
|
50
|
-
const browseAllLink = (0, _link.useLink)({
|
|
51
|
-
path: '/wp_template/all'
|
|
52
|
-
});
|
|
53
|
-
const canCreate = !isMobileViewport;
|
|
54
|
-
return (0, _react.createElement)(_sidebarNavigationScreen.default, {
|
|
55
|
-
title: (0, _i18n.__)('Templates'),
|
|
56
|
-
description: (0, _i18n.__)('Express the layout of your site with templates.'),
|
|
57
|
-
actions: canCreate && (0, _react.createElement)(_addNewTemplate.default, {
|
|
58
|
-
templateType: _constants.TEMPLATE_POST_TYPE,
|
|
59
|
-
toggleProps: {
|
|
60
|
-
as: _sidebarButton.default
|
|
61
|
-
}
|
|
62
|
-
}),
|
|
63
|
-
content: (0, _react.createElement)(_react.Fragment, null, isLoading && (0, _i18n.__)('Loading templates…'), !isLoading && (0, _react.createElement)(SidebarTemplatesList, {
|
|
64
|
-
templates: templates
|
|
65
|
-
})),
|
|
66
|
-
footer: !isMobileViewport && (0, _react.createElement)(_sidebarNavigationItem.default, {
|
|
67
|
-
withChevron: true,
|
|
68
|
-
...browseAllLink
|
|
69
|
-
}, (0, _i18n.__)('Manage all templates'))
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function TemplatesGroup({
|
|
73
|
-
title,
|
|
74
|
-
templates
|
|
75
|
-
}) {
|
|
76
|
-
return (0, _react.createElement)(_components.__experimentalItemGroup, null, !!title && (0, _react.createElement)(_components.__experimentalItem, {
|
|
77
|
-
className: "edit-site-sidebar-navigation-screen-templates__templates-group-title"
|
|
78
|
-
}, title), templates.map(template => (0, _react.createElement)(TemplateItem, {
|
|
79
|
-
postType: _constants.TEMPLATE_POST_TYPE,
|
|
80
|
-
postId: template.id,
|
|
81
|
-
key: template.id,
|
|
82
|
-
withChevron: true
|
|
83
|
-
}, (0, _htmlEntities.decodeEntities)(template.title?.rendered || template.slug))));
|
|
84
|
-
}
|
|
85
|
-
function SidebarTemplatesList({
|
|
86
|
-
templates
|
|
87
|
-
}) {
|
|
88
|
-
if (!templates?.length) {
|
|
89
|
-
return (0, _react.createElement)(_components.__experimentalItemGroup, null, (0, _react.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No templates found')));
|
|
90
|
-
}
|
|
91
|
-
const sortedTemplates = templates ? [...templates] : [];
|
|
92
|
-
sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
|
|
93
|
-
const {
|
|
94
|
-
hierarchyTemplates,
|
|
95
|
-
customTemplates,
|
|
96
|
-
...plugins
|
|
97
|
-
} = sortedTemplates.reduce((accumulator, template) => {
|
|
98
|
-
const {
|
|
99
|
-
original_source: originalSource,
|
|
100
|
-
author_text: authorText
|
|
101
|
-
} = template;
|
|
102
|
-
if (originalSource === 'plugin') {
|
|
103
|
-
if (!accumulator[authorText]) {
|
|
104
|
-
accumulator[authorText] = [];
|
|
105
|
-
}
|
|
106
|
-
accumulator[authorText].push(template);
|
|
107
|
-
} else if (template.is_custom) {
|
|
108
|
-
accumulator.customTemplates.push(template);
|
|
109
|
-
} else {
|
|
110
|
-
accumulator.hierarchyTemplates.push(template);
|
|
111
|
-
}
|
|
112
|
-
return accumulator;
|
|
113
|
-
}, {
|
|
114
|
-
hierarchyTemplates: [],
|
|
115
|
-
customTemplates: []
|
|
116
|
-
});
|
|
117
|
-
return (0, _react.createElement)(_components.__experimentalVStack, {
|
|
118
|
-
spacing: 3
|
|
119
|
-
}, !!hierarchyTemplates.length && (0, _react.createElement)(TemplatesGroup, {
|
|
120
|
-
templates: hierarchyTemplates
|
|
121
|
-
}), !!customTemplates.length && (0, _react.createElement)(TemplatesGroup, {
|
|
122
|
-
title: (0, _i18n.__)('Custom'),
|
|
123
|
-
templates: customTemplates
|
|
124
|
-
}), Object.entries(plugins).map(([plugin, pluginTemplates]) => {
|
|
125
|
-
return (0, _react.createElement)(TemplatesGroup, {
|
|
126
|
-
key: plugin,
|
|
127
|
-
title: plugin,
|
|
128
|
-
templates: pluginTemplates
|
|
129
|
-
});
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_coreData","_htmlEntities","_compose","_sidebarNavigationScreen","_interopRequireDefault","_link","_sidebarNavigationItem","_addNewTemplate","_sidebarButton","_constants","TemplateItem","postType","postId","props","linkInfo","useLink","_react","createElement","default","SidebarNavigationScreenTemplates","isMobileViewport","useViewportMatch","records","templates","isResolving","isLoading","useEntityRecords","TEMPLATE_POST_TYPE","per_page","browseAllLink","path","canCreate","title","__","description","actions","templateType","toggleProps","as","SidebarButton","content","Fragment","SidebarTemplatesList","footer","withChevron","TemplatesGroup","__experimentalItemGroup","__experimentalItem","className","map","template","id","key","decodeEntities","rendered","slug","length","sortedTemplates","sort","a","b","localeCompare","hierarchyTemplates","customTemplates","plugins","reduce","accumulator","original_source","originalSource","author_text","authorText","push","is_custom","__experimentalVStack","spacing","Object","entries","plugin","pluginTemplates"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport SidebarButton from '../sidebar-button';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\tconst browseAllLink = useLink( { path: '/wp_template/all' } );\n\tconst canCreate = ! isMobileViewport;\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading templates…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<SidebarTemplatesList templates={ templates } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t{ __( 'Manage all templates' ) }\n\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction TemplatesGroup( { title, templates } ) {\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ !! title && (\n\t\t\t\t<Item className=\"edit-site-sidebar-navigation-screen-templates__templates-group-title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</Item>\n\t\t\t) }\n\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t<TemplateItem\n\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\tkey={ template.id }\n\t\t\t\t\twithChevron\n\t\t\t\t>\n\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t\t\t) }\n\t\t\t\t</TemplateItem>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\nfunction SidebarTemplatesList( { templates } ) {\n\tif ( ! templates?.length ) {\n\t\treturn (\n\t\t\t<ItemGroup>\n\t\t\t\t<Item>{ __( 'No templates found' ) }</Item>\n\t\t\t</ItemGroup>\n\t\t);\n\t}\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\tconst { hierarchyTemplates, customTemplates, ...plugins } =\n\t\tsortedTemplates.reduce(\n\t\t\t( accumulator, template ) => {\n\t\t\t\tconst {\n\t\t\t\t\toriginal_source: originalSource,\n\t\t\t\t\tauthor_text: authorText,\n\t\t\t\t} = template;\n\t\t\t\tif ( originalSource === 'plugin' ) {\n\t\t\t\t\tif ( ! accumulator[ authorText ] ) {\n\t\t\t\t\t\taccumulator[ authorText ] = [];\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ authorText ].push( template );\n\t\t\t\t} else if ( template.is_custom ) {\n\t\t\t\t\taccumulator.customTemplates.push( template );\n\t\t\t\t} else {\n\t\t\t\t\taccumulator.hierarchyTemplates.push( template );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{ hierarchyTemplates: [], customTemplates: [] }\n\t\t);\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t{ !! hierarchyTemplates.length && (\n\t\t\t\t<TemplatesGroup templates={ hierarchyTemplates } />\n\t\t\t) }\n\t\t\t{ !! customTemplates.length && (\n\t\t\t\t<TemplatesGroup\n\t\t\t\t\ttitle={ __( 'Custom' ) }\n\t\t\t\t\ttemplates={ customTemplates }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ Object.entries( plugins ).map(\n\t\t\t\t( [ plugin, pluginTemplates ] ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TemplatesGroup\n\t\t\t\t\t\t\tkey={ plugin }\n\t\t\t\t\t\t\ttitle={ plugin }\n\t\t\t\t\t\t\ttemplates={ pluginTemplates }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n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S,IAAI,CAAErB,QAAS,CAAC;IAChD;IACA,OAAOgB,WAAW;EACnB,CAAC,EACD;IAAEJ,kBAAkB,EAAE,EAAE;IAAEC,eAAe,EAAE;EAAG,CAC/C,CAAC;EACF,OACC,IAAA/C,MAAA,CAAAC,aAAA,EAACpB,WAAA,CAAA4E,oBAAM;IAACC,OAAO,EAAG;EAAG,GAClB,CAAC,CAAEZ,kBAAkB,CAACN,MAAM,IAC7B,IAAAxC,MAAA,CAAAC,aAAA,EAAC4B,cAAc;IAACtB,SAAS,EAAGuC;EAAoB,CAAE,CAClD,EACC,CAAC,CAAEC,eAAe,CAACP,MAAM,IAC1B,IAAAxC,MAAA,CAAAC,aAAA,EAAC4B,cAAc;IACdb,KAAK,EAAG,IAAAC,QAAE,EAAE,QAAS,CAAG;IACxBV,SAAS,EAAGwC;EAAiB,CAC7B,CACD,EACCY,MAAM,CAACC,OAAO,CAAEZ,OAAQ,CAAC,CAACf,GAAG,CAC9B,CAAE,CAAE4B,MAAM,EAAEC,eAAe,CAAE,KAAM;IAClC,OACC,IAAA9D,MAAA,CAAAC,aAAA,EAAC4B,cAAc;MACdO,GAAG,EAAGyB,MAAQ;MACd7C,KAAK,EAAG6C,MAAQ;MAChBtD,SAAS,EAAGuD;IAAiB,CAC7B,CAAC;EAEJ,CACD,CACO,CAAC;AAEX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","__unstableMotion","motion","_x","privateApis","blockEditorPrivateApis","mergeBaseAndUserConfigs","unlock","getFamilyPreviewStyle","getFontFamilies","GlobalStylesContext","PreviewTypography","fontSize","variation","base","config","bodyFontFamilies","headingFontFamilies","bodyPreviewStyle","headingPreviewStyle","createElement","div","className","animate","scale","opacity","initial","transition","delay","type","style"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from './global-styles-provider';\nimport { unlock } from '../../lock-unlock';\nimport { getFamilyPreviewStyle } from './font-library-modal/utils/preview-styles';\nimport { getFontFamilies } from './utils';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\nexport default function PreviewTypography( { fontSize, variation } ) {\n\tconst { base } = useContext( GlobalStylesContext );\n\tlet config = base;\n\tif ( variation ) {\n\t\tconfig = mergeBaseAndUserConfigs( base, variation );\n\t}\n\tconst [ bodyFontFamilies, headingFontFamilies ] = getFontFamilies( config );\n\tconst bodyPreviewStyle = bodyFontFamilies\n\t\t? getFamilyPreviewStyle( bodyFontFamilies )\n\t\t: {};\n\tconst headingPreviewStyle = headingFontFamilies\n\t\t? getFamilyPreviewStyle( headingFontFamilies )\n\t\t: {};\n\n\tif ( fontSize ) {\n\t\tbodyPreviewStyle.fontSize = fontSize;\n\t\theadingPreviewStyle.fontSize = fontSize;\n\t}\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName=\"edit-site-global-styles_preview-typography\"\n\t\t\tanimate={ {\n\t\t\t\tscale: 1,\n\t\t\t\topacity: 1,\n\t\t\t} }\n\t\t\tinitial={ {\n\t\t\t\tscale: 0.1,\n\t\t\t\topacity: 0,\n\t\t\t} }\n\t\t\ttransition={ {\n\t\t\t\tdelay: 0.3,\n\t\t\t\ttype: 'tween',\n\t\t\t} }\n\t\t>\n\t\t\t<span style={ headingPreviewStyle }>\n\t\t\t\t{ _x( 'A', 'Uppercase letter A' ) }\n\t\t\t</span>\n\t\t\t<span style={ bodyPreviewStyle }>\n\t\t\t\t{ _x( 'a', 'Lowercase letter A' ) }\n\t\t\t</span>\n\t\t</motion.div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uB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I,EAAE;IACP;EAAG,GAEHT,aAAA;IAAMU,KAAK,EAAGX;EAAqB,GAChChB,EAAE,CAAE,GAAG,EAAE,oBAAqB,CAC3B,CAAC,EACPiB,aAAA;IAAMU,KAAK,EAAGZ;EAAkB,GAC7Bf,EAAE,CAAE,GAAG,EAAE,oBAAqB,CAC3B,CACK,CAAC;AAEf"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
8
|
-
import { moreVertical } from '@wordpress/icons';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { store as editSiteStore } from '../../../store';
|
|
14
|
-
import isTemplateRevertable from '../../../utils/is-template-revertable';
|
|
15
|
-
export default function Actions({
|
|
16
|
-
template
|
|
17
|
-
}) {
|
|
18
|
-
const {
|
|
19
|
-
revertTemplate
|
|
20
|
-
} = useDispatch(editSiteStore);
|
|
21
|
-
const isRevertable = isTemplateRevertable(template);
|
|
22
|
-
if (!isRevertable) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return createElement(DropdownMenu, {
|
|
26
|
-
icon: moreVertical,
|
|
27
|
-
label: __('Actions'),
|
|
28
|
-
className: "edit-site-template-card__actions",
|
|
29
|
-
toggleProps: {
|
|
30
|
-
isSmall: true
|
|
31
|
-
}
|
|
32
|
-
}, ({
|
|
33
|
-
onClose
|
|
34
|
-
}) => createElement(MenuGroup, null, isRevertable && createElement(MenuItem, {
|
|
35
|
-
info: __('Use the template as supplied by the theme.'),
|
|
36
|
-
onClick: () => {
|
|
37
|
-
revertTemplate(template);
|
|
38
|
-
onClose();
|
|
39
|
-
}
|
|
40
|
-
}, __('Clear customizations'))));
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=template-actions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","__","DropdownMenu","MenuGroup","MenuItem","moreVertical","store","editSiteStore","isTemplateRevertable","Actions","template","revertTemplate","isRevertable","createElement","icon","label","className","toggleProps","isSmall","onClose","info","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/template-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\n\nexport default function Actions( { template } ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\ttoggleProps={ { isSmall: true } }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AACzE,SAASC,YAAY,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,gBAAgB;AACvD,OAAOC,oBAAoB,MAAM,uCAAuC;AAExE,eAAe,SAASC,OAAOA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC/C,MAAM;IAAEC;EAAe,CAAC,GAAGX,WAAW,CAAEO,aAAc,CAAC;EACvD,MAAMK,YAAY,GAAGJ,oBAAoB,CAAEE,QAAS,CAAC;EAErD,IAAK,CAAEE,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAACX,YAAY;IACZY,IAAI,EAAGT,YAAc;IACrBU,KAAK,EAAGd,EAAE,CAAE,SAAU,CAAG;IACzBe,SAAS,EAAC,kCAAkC;IAC5CC,WAAW,EAAG;MAAEC,OAAO,EAAE;IAAK;EAAG,GAE/B,CAAE;IAAEC;EAAQ,CAAC,KACdN,aAAA,CAACV,SAAS,QACPS,YAAY,IACbC,aAAA,CAACT,QAAQ;IACRgB,IAAI,EAAGnB,EAAE,CACR,4CACD,CAAG;IACHoB,OAAO,EAAGA,CAAA,KAAM;MACfV,cAAc,CAAED,QAAS,CAAC;MAC1BS,OAAO,CAAC,CAAC;IACV;EAAG,GAEDlB,EAAE,CAAE,sBAAuB,CACpB,CAED,CAEC,CAAC;AAEjB"}
|
package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalConfirmDialog","ConfirmDialog","__","RenameModal","onClose","onConfirm","createElement","isOpen","e","preventDefault","onCancel","confirmButtonText"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function RenameModal( { onClose, onConfirm } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\tonConfirm={ ( e ) => {\n\t\t\t\te.preventDefault();\n\t\t\t\tonConfirm();\n\n\t\t\t\t// Immediate close avoids ability to hit delete multiple times.\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\tonCancel={ onClose }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t>\n\t\t\t{ __( 'Are you sure you want to delete this Navigation menu?' ) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,eAAe,SAASC,WAAWA,CAAE;EAAEC,OAAO;EAAEC;AAAU,CAAC,EAAG;EAC7D,OACCC,aAAA,CAACL,aAAa;IACbM,MAAM;IACNF,SAAS,EAAKG,CAAC,IAAM;MACpBA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClBJ,SAAS,CAAC,CAAC;;MAEX;MACAD,OAAO,CAAC,CAAC;IACV,CAAG;IACHM,QAAQ,EAAGN,OAAS;IACpBO,iBAAiB,EAAGT,EAAE,CAAE,QAAS;EAAG,GAElCA,EAAE,CAAE,uDAAwD,CAChD,CAAC;AAElB"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useEntityRecords } from '@wordpress/core-data';
|
|
8
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
15
|
-
import { useLink } from '../routes/link';
|
|
16
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
17
|
-
import AddNewTemplate from '../add-new-template';
|
|
18
|
-
import SidebarButton from '../sidebar-button';
|
|
19
|
-
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
20
|
-
const TemplateItem = ({
|
|
21
|
-
postType,
|
|
22
|
-
postId,
|
|
23
|
-
...props
|
|
24
|
-
}) => {
|
|
25
|
-
const linkInfo = useLink({
|
|
26
|
-
postType,
|
|
27
|
-
postId
|
|
28
|
-
});
|
|
29
|
-
return createElement(SidebarNavigationItem, {
|
|
30
|
-
...linkInfo,
|
|
31
|
-
...props
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
export default function SidebarNavigationScreenTemplates() {
|
|
35
|
-
const isMobileViewport = useViewportMatch('medium', '<');
|
|
36
|
-
const {
|
|
37
|
-
records: templates,
|
|
38
|
-
isResolving: isLoading
|
|
39
|
-
} = useEntityRecords('postType', TEMPLATE_POST_TYPE, {
|
|
40
|
-
per_page: -1
|
|
41
|
-
});
|
|
42
|
-
const browseAllLink = useLink({
|
|
43
|
-
path: '/wp_template/all'
|
|
44
|
-
});
|
|
45
|
-
const canCreate = !isMobileViewport;
|
|
46
|
-
return createElement(SidebarNavigationScreen, {
|
|
47
|
-
title: __('Templates'),
|
|
48
|
-
description: __('Express the layout of your site with templates.'),
|
|
49
|
-
actions: canCreate && createElement(AddNewTemplate, {
|
|
50
|
-
templateType: TEMPLATE_POST_TYPE,
|
|
51
|
-
toggleProps: {
|
|
52
|
-
as: SidebarButton
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
content: createElement(Fragment, null, isLoading && __('Loading templates…'), !isLoading && createElement(SidebarTemplatesList, {
|
|
56
|
-
templates: templates
|
|
57
|
-
})),
|
|
58
|
-
footer: !isMobileViewport && createElement(SidebarNavigationItem, {
|
|
59
|
-
withChevron: true,
|
|
60
|
-
...browseAllLink
|
|
61
|
-
}, __('Manage all templates'))
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function TemplatesGroup({
|
|
65
|
-
title,
|
|
66
|
-
templates
|
|
67
|
-
}) {
|
|
68
|
-
return createElement(ItemGroup, null, !!title && createElement(Item, {
|
|
69
|
-
className: "edit-site-sidebar-navigation-screen-templates__templates-group-title"
|
|
70
|
-
}, title), templates.map(template => createElement(TemplateItem, {
|
|
71
|
-
postType: TEMPLATE_POST_TYPE,
|
|
72
|
-
postId: template.id,
|
|
73
|
-
key: template.id,
|
|
74
|
-
withChevron: true
|
|
75
|
-
}, decodeEntities(template.title?.rendered || template.slug))));
|
|
76
|
-
}
|
|
77
|
-
function SidebarTemplatesList({
|
|
78
|
-
templates
|
|
79
|
-
}) {
|
|
80
|
-
if (!templates?.length) {
|
|
81
|
-
return createElement(ItemGroup, null, createElement(Item, null, __('No templates found')));
|
|
82
|
-
}
|
|
83
|
-
const sortedTemplates = templates ? [...templates] : [];
|
|
84
|
-
sortedTemplates.sort((a, b) => a.title.rendered.localeCompare(b.title.rendered));
|
|
85
|
-
const {
|
|
86
|
-
hierarchyTemplates,
|
|
87
|
-
customTemplates,
|
|
88
|
-
...plugins
|
|
89
|
-
} = sortedTemplates.reduce((accumulator, template) => {
|
|
90
|
-
const {
|
|
91
|
-
original_source: originalSource,
|
|
92
|
-
author_text: authorText
|
|
93
|
-
} = template;
|
|
94
|
-
if (originalSource === 'plugin') {
|
|
95
|
-
if (!accumulator[authorText]) {
|
|
96
|
-
accumulator[authorText] = [];
|
|
97
|
-
}
|
|
98
|
-
accumulator[authorText].push(template);
|
|
99
|
-
} else if (template.is_custom) {
|
|
100
|
-
accumulator.customTemplates.push(template);
|
|
101
|
-
} else {
|
|
102
|
-
accumulator.hierarchyTemplates.push(template);
|
|
103
|
-
}
|
|
104
|
-
return accumulator;
|
|
105
|
-
}, {
|
|
106
|
-
hierarchyTemplates: [],
|
|
107
|
-
customTemplates: []
|
|
108
|
-
});
|
|
109
|
-
return createElement(VStack, {
|
|
110
|
-
spacing: 3
|
|
111
|
-
}, !!hierarchyTemplates.length && createElement(TemplatesGroup, {
|
|
112
|
-
templates: hierarchyTemplates
|
|
113
|
-
}), !!customTemplates.length && createElement(TemplatesGroup, {
|
|
114
|
-
title: __('Custom'),
|
|
115
|
-
templates: customTemplates
|
|
116
|
-
}), Object.entries(plugins).map(([plugin, pluginTemplates]) => {
|
|
117
|
-
return createElement(TemplatesGroup, {
|
|
118
|
-
key: plugin,
|
|
119
|
-
title: plugin,
|
|
120
|
-
templates: pluginTemplates
|
|
121
|
-
});
|
|
122
|
-
}));
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalVStack","VStack","__","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","SidebarButton","TEMPLATE_POST_TYPE","TemplateItem","postType","postId","props","linkInfo","createElement","SidebarNavigationScreenTemplates","isMobileViewport","records","templates","isResolving","isLoading","per_page","browseAllLink","path","canCreate","title","description","actions","templateType","toggleProps","as","content","Fragment","SidebarTemplatesList","footer","withChevron","TemplatesGroup","className","map","template","id","key","rendered","slug","length","sortedTemplates","sort","a","b","localeCompare","hierarchyTemplates","customTemplates","plugins","reduce","accumulator","original_source","originalSource","author_text","authorText","push","is_custom","spacing","Object","entries","plugin","pluginTemplates"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport SidebarButton from '../sidebar-button';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tTEMPLATE_POST_TYPE,\n\t\t{ per_page: -1 }\n\t);\n\tconst browseAllLink = useLink( { path: '/wp_template/all' } );\n\tconst canCreate = ! isMobileViewport;\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading templates…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<SidebarTemplatesList templates={ templates } />\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<SidebarNavigationItem withChevron { ...browseAllLink }>\n\t\t\t\t\t\t{ __( 'Manage all templates' ) }\n\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n\nfunction TemplatesGroup( { title, templates } ) {\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ !! title && (\n\t\t\t\t<Item className=\"edit-site-sidebar-navigation-screen-templates__templates-group-title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</Item>\n\t\t\t) }\n\t\t\t{ templates.map( ( template ) => (\n\t\t\t\t<TemplateItem\n\t\t\t\t\tpostType={ TEMPLATE_POST_TYPE }\n\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\tkey={ template.id }\n\t\t\t\t\twithChevron\n\t\t\t\t>\n\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\ttemplate.title?.rendered || template.slug\n\t\t\t\t\t) }\n\t\t\t\t</TemplateItem>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\nfunction SidebarTemplatesList( { templates } ) {\n\tif ( ! templates?.length ) {\n\t\treturn (\n\t\t\t<ItemGroup>\n\t\t\t\t<Item>{ __( 'No templates found' ) }</Item>\n\t\t\t</ItemGroup>\n\t\t);\n\t}\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) =>\n\t\ta.title.rendered.localeCompare( b.title.rendered )\n\t);\n\tconst { hierarchyTemplates, customTemplates, ...plugins } =\n\t\tsortedTemplates.reduce(\n\t\t\t( accumulator, template ) => {\n\t\t\t\tconst {\n\t\t\t\t\toriginal_source: originalSource,\n\t\t\t\t\tauthor_text: authorText,\n\t\t\t\t} = template;\n\t\t\t\tif ( originalSource === 'plugin' ) {\n\t\t\t\t\tif ( ! accumulator[ authorText ] ) {\n\t\t\t\t\t\taccumulator[ authorText ] = [];\n\t\t\t\t\t}\n\t\t\t\t\taccumulator[ authorText ].push( template );\n\t\t\t\t} else if ( template.is_custom ) {\n\t\t\t\t\taccumulator.customTemplates.push( template );\n\t\t\t\t} else {\n\t\t\t\t\taccumulator.hierarchyTemplates.push( template );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t{ hierarchyTemplates: [], customTemplates: [] }\n\t\t);\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t{ !! hierarchyTemplates.length && (\n\t\t\t\t<TemplatesGroup templates={ hierarchyTemplates } />\n\t\t\t) }\n\t\t\t{ !! customTemplates.length && (\n\t\t\t\t<TemplatesGroup\n\t\t\t\t\ttitle={ __( 'Custom' ) }\n\t\t\t\t\ttemplates={ customTemplates }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ Object.entries( plugins ).map(\n\t\t\t\t( [ plugin, pluginTemplates ] ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TemplatesGroup\n\t\t\t\t\t\t\tkey={ plugin }\n\t\t\t\t\t\t\ttitle={ plugin }\n\t\t\t\t\t\t\ttemplates={ pluginTemplates }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAAS,EACpCC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,cAAc,MAAM,qBAAqB;AAChD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,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