@wordpress/edit-site 5.1.0 → 5.3.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 +8 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal.js +8 -10
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal.js +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +5 -9
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/app/index.js +2 -7
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +25 -59
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +237 -0
- package/build/components/block-editor/inserter-media-categories.js.map +1 -0
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/canvas-spinner/index.js +20 -0
- package/build/components/canvas-spinner/index.js.map +1 -0
- package/build/components/create-template-part-modal/index.js +4 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +4 -2
- package/build/components/editor/index.js.map +1 -1
- package/build/components/error-boundary/index.js +2 -12
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +5 -28
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +10 -4
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +18 -9
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +13 -7
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +47 -4
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +65 -14
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +50 -27
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +13 -3
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +17 -11
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +21 -142
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +0 -28
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/palette.js +11 -4
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +18 -15
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +28 -13
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +16 -4
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +17 -9
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +59 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -8
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +24 -16
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +9 -3
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +19 -11
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +25 -9
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +8 -4
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +15 -7
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +23 -11
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- package/build/components/global-styles/shadow-panel.js +196 -0
- package/build/components/global-styles/shadow-panel.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +37 -22
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +19 -9
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +139 -21
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +8 -290
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- package/build/components/global-styles-renderer/index.js +7 -5
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +2 -2
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/layout/index.js +86 -15
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +8 -11
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
- package/build/components/navigation-inspector/index.js.map +1 -0
- package/build/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -15
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -0
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +3 -18
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -14
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +3 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +23 -1
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +35 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +11 -11
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +1 -1
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/style-book/index.js +7 -4
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +5 -9
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/experiments.js +19 -0
- package/build/experiments.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +68 -9
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/index.js +53 -60
- package/build/index.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +7 -27
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +77 -0
- package/build/store/utils.js.map +1 -0
- package/build/utils/template-part-create.js +71 -0
- package/build/utils/template-part-create.js.map +1 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js +9 -11
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +0 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +5 -9
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/app/index.js +2 -7
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +27 -57
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +225 -0
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -0
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/canvas-spinner/index.js +12 -0
- package/build-module/components/canvas-spinner/index.js.map +1 -0
- package/build-module/components/create-template-part-modal/index.js +5 -3
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +3 -2
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -12
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +5 -28
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +10 -4
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +18 -11
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +11 -7
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +46 -8
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +61 -15
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +50 -28
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +7 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +15 -11
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +23 -134
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +0 -2
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +10 -5
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +18 -14
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +27 -15
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +14 -4
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +17 -11
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +56 -27
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +21 -9
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +24 -18
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +8 -3
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +19 -13
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +23 -9
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +5 -2
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +15 -9
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +19 -10
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- package/build-module/components/global-styles/shadow-panel.js +177 -0
- package/build-module/components/global-styles/shadow-panel.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +37 -24
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +17 -9
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +132 -22
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +7 -277
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- package/build-module/components/global-styles-renderer/index.js +5 -5
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +2 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +86 -17
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +9 -12
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -2
- package/build-module/components/navigation-inspector/index.js.map +1 -0
- package/build-module/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +13 -16
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -0
- package/build-module/components/sidebar/index.js +2 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +6 -21
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -13
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +3 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +22 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +23 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +4 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +12 -11
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +1 -1
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/style-book/index.js +8 -5
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +5 -9
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/experiments.js +9 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +65 -6
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/index.js +52 -60
- package/build-module/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -26
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +66 -0
- package/build-module/store/utils.js.map +1 -0
- package/build-module/utils/template-part-create.js +53 -0
- package/build-module/utils/template-part-create.js.map +1 -0
- package/build-style/style-rtl.css +448 -278
- package/build-style/style.css +448 -278
- package/package.json +32 -30
- package/src/components/add-new-template/add-custom-generic-template-modal.js +20 -28
- package/src/components/add-new-template/add-custom-template-modal.js +0 -1
- package/src/components/add-new-template/new-template-part.js +12 -11
- package/src/components/add-new-template/style.scss +0 -4
- package/src/components/app/index.js +2 -2
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +21 -77
- package/src/components/block-editor/inserter-media-categories.js +247 -0
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +55 -7
- package/src/components/canvas-spinner/index.js +12 -0
- package/src/components/canvas-spinner/style.scss +7 -0
- package/src/components/create-template-part-modal/index.js +75 -67
- package/src/components/create-template-part-modal/style.scss +0 -10
- package/src/components/editor/index.js +5 -3
- package/src/components/error-boundary/index.js +2 -10
- package/src/components/error-boundary/warning.js +6 -35
- package/src/components/global-styles/README.md +1 -75
- package/src/components/global-styles/block-preview-panel.js +16 -4
- package/src/components/global-styles/border-panel.js +22 -16
- package/src/components/global-styles/color-palette-panel.js +10 -7
- package/src/components/global-styles/context-menu.js +117 -41
- package/src/components/global-styles/custom-css.js +76 -19
- package/src/components/global-styles/dimensions-panel.js +58 -31
- package/src/components/global-styles/global-styles-provider.js +6 -2
- package/src/components/global-styles/gradients-palette-panel.js +17 -11
- package/src/components/global-styles/hooks.js +31 -155
- package/src/components/global-styles/index.js +0 -2
- package/src/components/global-styles/palette.js +9 -5
- package/src/components/global-styles/preview.js +19 -13
- package/src/components/global-styles/screen-background-color.js +42 -19
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-border.js +13 -5
- package/src/components/global-styles/screen-button-color.js +21 -19
- package/src/components/global-styles/screen-colors.js +66 -22
- package/src/components/global-styles/screen-css.js +30 -14
- package/src/components/global-styles/screen-heading-color.js +32 -27
- package/src/components/global-styles/screen-layout.js +7 -4
- package/src/components/global-styles/screen-link-color.js +34 -22
- package/src/components/global-styles/screen-root.js +24 -9
- package/src/components/global-styles/screen-style-variations.js +7 -2
- package/src/components/global-styles/screen-text-color.js +15 -15
- package/src/components/global-styles/screen-typography.js +34 -12
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/shadow-panel.js +174 -0
- package/src/components/global-styles/style.scss +94 -1
- package/src/components/global-styles/typography-panel.js +58 -23
- package/src/components/global-styles/typography-preview.js +28 -9
- package/src/components/global-styles/ui.js +130 -17
- package/src/components/global-styles/utils.js +7 -330
- package/src/components/global-styles/variations-panel.js +78 -0
- package/src/components/global-styles-renderer/index.js +3 -4
- package/src/components/header-edit-mode/document-actions/index.js +1 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/src/components/layout/index.js +116 -21
- package/src/components/layout/style.scss +29 -5
- package/src/components/list/actions/rename-menu-item.js +14 -23
- package/src/components/list/style.scss +0 -4
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js → navigation-inspector/index.js} +3 -4
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/navigation-menu.js +10 -12
- package/src/components/{sidebar-edit-mode/navigation-menu-sidebar → navigation-inspector}/style.scss +4 -17
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +8 -32
- package/src/components/sidebar-edit-mode/index.js +0 -11
- package/src/components/sidebar-edit-mode/settings-header/style.scss +8 -0
- package/src/components/sidebar-navigation-item/style.scss +28 -3
- package/src/components/sidebar-navigation-screen/index.js +4 -3
- package/src/components/sidebar-navigation-screen/style.scss +2 -0
- package/src/components/sidebar-navigation-screen-main/index.js +23 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +25 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +12 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +12 -19
- package/src/components/site-hub/index.js +120 -109
- package/src/components/site-hub/style.scss +7 -1
- package/src/components/site-icon/index.js +1 -1
- package/src/components/site-icon/style.scss +2 -2
- package/src/components/style-book/index.js +10 -5
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- package/src/components/template-part-converter/convert-to-template-part.js +12 -10
- package/src/experiments.js +10 -0
- package/src/hooks/push-changes-to-global-styles/index.js +66 -8
- package/src/index.js +51 -59
- package/src/store/reducer.js +1 -1
- package/src/store/selectors.js +6 -26
- package/src/store/test/utils.js +181 -0
- package/src/store/utils.js +69 -0
- package/src/style.scss +4 -2
- package/src/utils/template-part-create.js +62 -0
- package/src/utils/test/template-part-create.js +63 -0
- package/build/components/global-styles/context.js +0 -22
- package/build/components/global-styles/context.js.map +0 -1
- package/build/components/global-styles/typography-utils.js +0 -92
- package/build/components/global-styles/typography-utils.js.map +0 -1
- package/build/components/global-styles/use-global-styles-output.js +0 -857
- package/build/components/global-styles/use-global-styles-output.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -42
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/build-module/components/global-styles/context.js +0 -12
- package/build-module/components/global-styles/context.js.map +0 -1
- package/build-module/components/global-styles/typography-utils.js +0 -84
- package/build-module/components/global-styles/typography-utils.js.map +0 -1
- package/build-module/components/global-styles/use-global-styles-output.js +0 -815
- package/build-module/components/global-styles/use-global-styles-output.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -28
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +0 -1
- package/src/components/global-styles/context.js +0 -15
- package/src/components/global-styles/test/typography-utils.js +0 -393
- package/src/components/global-styles/test/use-global-styles-output.js +0 -814
- package/src/components/global-styles/test/utils.js +0 -206
- package/src/components/global-styles/typography-utils.js +0 -87
- package/src/components/global-styles/use-global-styles-output.js +0 -936
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/index.js +0 -37
|
@@ -3,301 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.getPresetVariableFromValue = getPresetVariableFromValue;
|
|
8
|
-
exports.getValueFromVariable = getValueFromVariable;
|
|
9
|
-
exports.scopeSelector = scopeSelector;
|
|
6
|
+
exports.getVariationClassName = getVariationClassName;
|
|
10
7
|
|
|
11
|
-
var _lodash = require("lodash");
|
|
12
|
-
|
|
13
|
-
var _typographyUtils = require("./typography-utils");
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* External dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/* Supporting data. */
|
|
24
|
-
const ROOT_BLOCK_NAME = 'root';
|
|
25
|
-
exports.ROOT_BLOCK_NAME = ROOT_BLOCK_NAME;
|
|
26
|
-
const ROOT_BLOCK_SELECTOR = 'body';
|
|
27
|
-
exports.ROOT_BLOCK_SELECTOR = ROOT_BLOCK_SELECTOR;
|
|
28
|
-
const ROOT_BLOCK_SUPPORTS = ['background', 'backgroundColor', 'color', 'linkColor', 'buttonColor', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'lineHeight', 'textDecoration', 'textTransform', 'padding'];
|
|
29
|
-
exports.ROOT_BLOCK_SUPPORTS = ROOT_BLOCK_SUPPORTS;
|
|
30
|
-
const PRESET_METADATA = [{
|
|
31
|
-
path: ['color', 'palette'],
|
|
32
|
-
valueKey: 'color',
|
|
33
|
-
cssVarInfix: 'color',
|
|
34
|
-
classes: [{
|
|
35
|
-
classSuffix: 'color',
|
|
36
|
-
propertyName: 'color'
|
|
37
|
-
}, {
|
|
38
|
-
classSuffix: 'background-color',
|
|
39
|
-
propertyName: 'background-color'
|
|
40
|
-
}, {
|
|
41
|
-
classSuffix: 'border-color',
|
|
42
|
-
propertyName: 'border-color'
|
|
43
|
-
}]
|
|
44
|
-
}, {
|
|
45
|
-
path: ['color', 'gradients'],
|
|
46
|
-
valueKey: 'gradient',
|
|
47
|
-
cssVarInfix: 'gradient',
|
|
48
|
-
classes: [{
|
|
49
|
-
classSuffix: 'gradient-background',
|
|
50
|
-
propertyName: 'background'
|
|
51
|
-
}]
|
|
52
|
-
}, {
|
|
53
|
-
path: ['color', 'duotone'],
|
|
54
|
-
cssVarInfix: 'duotone',
|
|
55
|
-
valueFunc: _ref => {
|
|
56
|
-
let {
|
|
57
|
-
slug
|
|
58
|
-
} = _ref;
|
|
59
|
-
return `url( '#wp-duotone-${slug}' )`;
|
|
60
|
-
},
|
|
61
|
-
classes: []
|
|
62
|
-
}, {
|
|
63
|
-
path: ['typography', 'fontSizes'],
|
|
64
|
-
valueFunc: (preset, _ref2) => {
|
|
65
|
-
let {
|
|
66
|
-
typography: typographySettings
|
|
67
|
-
} = _ref2;
|
|
68
|
-
return (0, _typographyUtils.getTypographyFontSizeValue)(preset, typographySettings);
|
|
69
|
-
},
|
|
70
|
-
valueKey: 'size',
|
|
71
|
-
cssVarInfix: 'font-size',
|
|
72
|
-
classes: [{
|
|
73
|
-
classSuffix: 'font-size',
|
|
74
|
-
propertyName: 'font-size'
|
|
75
|
-
}]
|
|
76
|
-
}, {
|
|
77
|
-
path: ['typography', 'fontFamilies'],
|
|
78
|
-
valueKey: 'fontFamily',
|
|
79
|
-
cssVarInfix: 'font-family',
|
|
80
|
-
classes: [{
|
|
81
|
-
classSuffix: 'font-family',
|
|
82
|
-
propertyName: 'font-family'
|
|
83
|
-
}]
|
|
84
|
-
}, {
|
|
85
|
-
path: ['spacing', 'spacingSizes'],
|
|
86
|
-
valueKey: 'size',
|
|
87
|
-
cssVarInfix: 'spacing',
|
|
88
|
-
valueFunc: _ref3 => {
|
|
89
|
-
let {
|
|
90
|
-
size
|
|
91
|
-
} = _ref3;
|
|
92
|
-
return size;
|
|
93
|
-
},
|
|
94
|
-
classes: []
|
|
95
|
-
}];
|
|
96
|
-
exports.PRESET_METADATA = PRESET_METADATA;
|
|
97
|
-
const STYLE_PATH_TO_CSS_VAR_INFIX = {
|
|
98
|
-
'color.background': 'color',
|
|
99
|
-
'color.text': 'color',
|
|
100
|
-
'elements.link.color.text': 'color',
|
|
101
|
-
'elements.button.color.text': 'color',
|
|
102
|
-
'elements.button.backgroundColor': 'background-color',
|
|
103
|
-
'elements.heading.color': 'color',
|
|
104
|
-
'elements.heading.backgroundColor': 'background-color',
|
|
105
|
-
'elements.heading.gradient': 'gradient',
|
|
106
|
-
'color.gradient': 'gradient',
|
|
107
|
-
'typography.fontSize': 'font-size',
|
|
108
|
-
'typography.fontFamily': 'font-family'
|
|
109
|
-
}; // A static list of block attributes that store global style preset slugs.
|
|
110
|
-
|
|
111
|
-
exports.STYLE_PATH_TO_CSS_VAR_INFIX = STYLE_PATH_TO_CSS_VAR_INFIX;
|
|
112
|
-
const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
|
|
113
|
-
'color.background': 'backgroundColor',
|
|
114
|
-
'color.text': 'textColor',
|
|
115
|
-
'color.gradient': 'gradient',
|
|
116
|
-
'typography.fontSize': 'fontSize',
|
|
117
|
-
'typography.fontFamily': 'fontFamily'
|
|
118
|
-
};
|
|
119
|
-
exports.STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE;
|
|
120
|
-
|
|
121
|
-
function findInPresetsBy(features, blockName, presetPath, presetProperty, presetValueValue) {
|
|
122
|
-
// Block presets take priority above root level presets.
|
|
123
|
-
const orderedPresetsByOrigin = [(0, _lodash.get)(features, ['blocks', blockName, ...presetPath]), (0, _lodash.get)(features, presetPath)];
|
|
124
|
-
|
|
125
|
-
for (const presetByOrigin of orderedPresetsByOrigin) {
|
|
126
|
-
if (presetByOrigin) {
|
|
127
|
-
// Preset origins ordered by priority.
|
|
128
|
-
const origins = ['custom', 'theme', 'default'];
|
|
129
|
-
|
|
130
|
-
for (const origin of origins) {
|
|
131
|
-
const presets = presetByOrigin[origin];
|
|
132
|
-
|
|
133
|
-
if (presets) {
|
|
134
|
-
const presetObject = presets.find(preset => preset[presetProperty] === presetValueValue);
|
|
135
|
-
|
|
136
|
-
if (presetObject) {
|
|
137
|
-
if (presetProperty === 'slug') {
|
|
138
|
-
return presetObject;
|
|
139
|
-
} // If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const highestPresetObjectWithSameSlug = findInPresetsBy(features, blockName, presetPath, 'slug', presetObject.slug);
|
|
143
|
-
|
|
144
|
-
if (highestPresetObjectWithSameSlug[presetProperty] === presetObject[presetProperty]) {
|
|
145
|
-
return presetObject;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return undefined;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function getPresetVariableFromValue(features, blockName, variableStylePath, presetPropertyValue) {
|
|
157
|
-
if (!presetPropertyValue) {
|
|
158
|
-
return presetPropertyValue;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[variableStylePath];
|
|
162
|
-
const metadata = PRESET_METADATA.find(data => data.cssVarInfix === cssVarInfix);
|
|
163
|
-
|
|
164
|
-
if (!metadata) {
|
|
165
|
-
// The property doesn't have preset data
|
|
166
|
-
// so the value should be returned as it is.
|
|
167
|
-
return presetPropertyValue;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const {
|
|
171
|
-
valueKey,
|
|
172
|
-
path
|
|
173
|
-
} = metadata;
|
|
174
|
-
const presetObject = findInPresetsBy(features, blockName, path, valueKey, presetPropertyValue);
|
|
175
|
-
|
|
176
|
-
if (!presetObject) {
|
|
177
|
-
// Value wasn't found in the presets,
|
|
178
|
-
// so it must be a custom value.
|
|
179
|
-
return presetPropertyValue;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return `var:preset|${cssVarInfix}|${presetObject.slug}`;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function getValueFromPresetVariable(features, blockName, variable, _ref4) {
|
|
186
|
-
let [presetType, slug] = _ref4;
|
|
187
|
-
const metadata = PRESET_METADATA.find(data => data.cssVarInfix === presetType);
|
|
188
|
-
|
|
189
|
-
if (!metadata) {
|
|
190
|
-
return variable;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const presetObject = findInPresetsBy(features.settings, blockName, metadata.path, 'slug', slug);
|
|
194
|
-
|
|
195
|
-
if (presetObject) {
|
|
196
|
-
const {
|
|
197
|
-
valueKey
|
|
198
|
-
} = metadata;
|
|
199
|
-
const result = presetObject[valueKey];
|
|
200
|
-
return getValueFromVariable(features, blockName, result);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return variable;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function getValueFromCustomVariable(features, blockName, variable, path) {
|
|
207
|
-
var _get;
|
|
208
|
-
|
|
209
|
-
const result = (_get = (0, _lodash.get)(features.settings, ['blocks', blockName, 'custom', ...path])) !== null && _get !== void 0 ? _get : (0, _lodash.get)(features.settings, ['custom', ...path]);
|
|
210
|
-
|
|
211
|
-
if (!result) {
|
|
212
|
-
return variable;
|
|
213
|
-
} // A variable may reference another variable so we need recursion until we find the value.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return getValueFromVariable(features, blockName, result);
|
|
217
|
-
}
|
|
218
8
|
/**
|
|
219
|
-
* Attempts to fetch the value of a theme.json CSS variable.
|
|
220
9
|
*
|
|
221
|
-
* @param {
|
|
222
|
-
* @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.
|
|
223
|
-
* @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.
|
|
224
|
-
* @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
function getValueFromVariable(features, blockName, variable) {
|
|
229
|
-
if (!variable || typeof variable !== 'string') {
|
|
230
|
-
var _variable, _variable2;
|
|
231
|
-
|
|
232
|
-
if ((_variable = variable) !== null && _variable !== void 0 && _variable.ref && typeof ((_variable2 = variable) === null || _variable2 === void 0 ? void 0 : _variable2.ref) === 'string') {
|
|
233
|
-
var _variable3;
|
|
234
|
-
|
|
235
|
-
const refPath = variable.ref.split('.');
|
|
236
|
-
variable = (0, _lodash.get)(features, refPath); // Presence of another ref indicates a reference to another dynamic value.
|
|
237
|
-
// Pointing to another dynamic value is not supported.
|
|
238
|
-
|
|
239
|
-
if (!variable || !!((_variable3 = variable) !== null && _variable3 !== void 0 && _variable3.ref)) {
|
|
240
|
-
return variable;
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
return variable;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const USER_VALUE_PREFIX = 'var:';
|
|
248
|
-
const THEME_VALUE_PREFIX = 'var(--wp--';
|
|
249
|
-
const THEME_VALUE_SUFFIX = ')';
|
|
250
|
-
let parsedVar;
|
|
251
|
-
|
|
252
|
-
if (variable.startsWith(USER_VALUE_PREFIX)) {
|
|
253
|
-
parsedVar = variable.slice(USER_VALUE_PREFIX.length).split('|');
|
|
254
|
-
} else if (variable.startsWith(THEME_VALUE_PREFIX) && variable.endsWith(THEME_VALUE_SUFFIX)) {
|
|
255
|
-
parsedVar = variable.slice(THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length).split('--');
|
|
256
|
-
} else {
|
|
257
|
-
// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`
|
|
258
|
-
return variable;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const [type, ...path] = parsedVar;
|
|
262
|
-
|
|
263
|
-
if (type === 'preset') {
|
|
264
|
-
return getValueFromPresetVariable(features, blockName, variable, path);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (type === 'custom') {
|
|
268
|
-
return getValueFromCustomVariable(features, blockName, variable, path);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return variable;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Function that scopes a selector with another one. This works a bit like
|
|
275
|
-
* SCSS nesting except the `&` operator isn't supported.
|
|
10
|
+
* @param {string} variation The variation name.
|
|
276
11
|
*
|
|
277
|
-
* @
|
|
278
|
-
* ```js
|
|
279
|
-
* const scope = '.a, .b .c';
|
|
280
|
-
* const selector = '> .x, .y';
|
|
281
|
-
* const merged = scopeSelector( scope, selector );
|
|
282
|
-
* // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'
|
|
283
|
-
* ```
|
|
284
|
-
*
|
|
285
|
-
* @param {string} scope Selector to scope to.
|
|
286
|
-
* @param {string} selector Original selector.
|
|
287
|
-
*
|
|
288
|
-
* @return {string} Scoped selector.
|
|
12
|
+
* @return {string} The variation class name.
|
|
289
13
|
*/
|
|
14
|
+
function getVariationClassName(variation) {
|
|
15
|
+
if (!variation) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
290
18
|
|
|
291
|
-
|
|
292
|
-
function scopeSelector(scope, selector) {
|
|
293
|
-
const scopes = scope.split(',');
|
|
294
|
-
const selectors = selector.split(',');
|
|
295
|
-
const selectorsScoped = [];
|
|
296
|
-
scopes.forEach(outer => {
|
|
297
|
-
selectors.forEach(inner => {
|
|
298
|
-
selectorsScoped.push(`${outer.trim()} ${inner.trim()}`);
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
return selectorsScoped.join(', ');
|
|
19
|
+
return `is-style-${variation}`;
|
|
302
20
|
}
|
|
303
21
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"names":["ROOT_BLOCK_NAME","ROOT_BLOCK_SELECTOR","ROOT_BLOCK_SUPPORTS","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","valueFunc","slug","preset","typography","typographySettings","size","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","find","highestPresetObjectWithSameSlug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","data","getValueFromPresetVariable","variable","presetType","settings","result","getValueFromVariable","getValueFromCustomVariable","ref","refPath","split","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","endsWith","type","scopeSelector","scope","selector","scopes","selectors","selectorsScoped","forEach","outer","inner","push","trim","join"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACO,MAAMA,eAAe,GAAG,MAAxB;;AACA,MAAMC,mBAAmB,GAAG,MAA5B;;AACA,MAAMC,mBAAmB,GAAG,CAClC,YADkC,EAElC,iBAFkC,EAGlC,OAHkC,EAIlC,WAJkC,EAKlC,aALkC,EAMlC,YANkC,EAOlC,UAPkC,EAQlC,WARkC,EASlC,YATkC,EAUlC,YAVkC,EAWlC,gBAXkC,EAYlC,eAZkC,EAalC,SAbkC,CAA5B;;AAgBA,MAAMC,eAAe,GAAG,CAC9B;AACCC,EAAAA,IAAI,EAAE,CAAE,OAAF,EAAW,SAAX,CADP;AAECC,EAAAA,QAAQ,EAAE,OAFX;AAGCC,EAAAA,WAAW,EAAE,OAHd;AAICC,EAAAA,OAAO,EAAE,CACR;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A,WAAOR,QAAP;AACA;;AAED,QAAM,CAAEiB,IAAF,EAAQ,GAAGpD,IAAX,IAAoB+C,SAA1B;;AACA,MAAKK,IAAI,KAAK,QAAd,EAAyB;AACxB,WAAOlB,0BAA0B,CAChCnB,QADgC,EAEhCC,SAFgC,EAGhCmB,QAHgC,EAIhCnC,IAJgC,CAAjC;AAMA;;AACD,MAAKoD,IAAI,KAAK,QAAd,EAAyB;AACxB,WAAOZ,0BAA0B,CAChCzB,QADgC,EAEhCC,SAFgC,EAGhCmB,QAHgC,EAIhCnC,IAJgC,CAAjC;AAMA;;AACD,SAAOmC,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASkB,aAAT,CAAwBC,KAAxB,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGF,KAAK,CAACX,KAAN,CAAa,GAAb,CAAf;AACA,QAAMc,SAAS,GAAGF,QAAQ,CAACZ,KAAT,CAAgB,GAAhB,CAAlB;AAEA,QAAMe,eAAe,GAAG,EAAxB;AACAF,EAAAA,MAAM,CAACG,OAAP,CAAkBC,KAAF,IAAa;AAC5BH,IAAAA,SAAS,CAACE,OAAV,CAAqBE,KAAF,IAAa;AAC/BH,MAAAA,eAAe,CAACI,IAAhB,CAAuB,GAAGF,KAAK,CAACG,IAAN,EAAc,IAAIF,KAAK,CAACE,IAAN,EAAc,EAA1D;AACA,KAFD;AAGA,GAJD;AAMA,SAAOL,eAAe,CAACM,IAAhB,CAAsB,IAAtB,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport { getTypographyFontSizeValue } from './typography-utils';\n\n/* Supporting data. */\nexport const ROOT_BLOCK_NAME = 'root';\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_BLOCK_SUPPORTS = [\n\t'background',\n\t'backgroundColor',\n\t'color',\n\t'linkColor',\n\t'buttonColor',\n\t'fontFamily',\n\t'fontSize',\n\t'fontStyle',\n\t'fontWeight',\n\t'lineHeight',\n\t'textDecoration',\n\t'textTransform',\n\t'padding',\n];\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'duotone' ],\n\t\tcssVarInfix: 'duotone',\n\t\tvalueFunc: ( { slug } ) => `url( '#wp-duotone-${ slug }' )`,\n\t\tclasses: [],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueFunc: ( preset, { typography: typographySettings } ) =>\n\t\t\tgetTypographyFontSizeValue( preset, typographySettings ),\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'spacing', 'spacingSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'spacing',\n\t\tvalueFunc: ( { size } ) => size,\n\t\tclasses: [],\n\t},\n];\n\nexport const STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.button.color.text': 'color',\n\t'elements.button.backgroundColor': 'background-color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.backgroundColor': 'background-color',\n\t'elements.heading.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// A static list of block attributes that store global style preset slugs.\nexport const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tget( features, [ 'blocks', blockName, ...presetPath ] ),\n\t\tget( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = presets.find(\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === cssVarInfix\n\t);\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = PRESET_METADATA.find(\n\t\t( data ) => data.cssVarInfix === presetType\n\t);\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures.settings,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tget( features.settings, [ 'blocks', blockName, 'custom', ...path ] ) ??\n\t\tget( features.settings, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\n/**\n * Attempts to fetch the value of a theme.json CSS variable.\n *\n * @param {Object} features GlobalStylesContext config, e.g., user, base or merged. Represents the theme.json tree.\n * @param {string} blockName The name of a block as represented in the styles property. E.g., 'root' for root-level, and 'core/${blockName}' for blocks.\n * @param {string|*} variable An incoming style value. A CSS var value is expected, but it could be any value.\n * @return {string|*|{ref}} The value of the CSS var, if found. If not found, the passed variable argument.\n */\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || typeof variable !== 'string' ) {\n\t\tif ( variable?.ref && typeof variable?.ref === 'string' ) {\n\t\t\tconst refPath = variable.ref.split( '.' );\n\t\t\tvariable = get( features, refPath );\n\t\t\t// Presence of another ref indicates a reference to another dynamic value.\n\t\t\t// Pointing to another dynamic value is not supported.\n\t\t\tif ( ! variable || !! variable?.ref ) {\n\t\t\t\treturn variable;\n\t\t\t}\n\t\t} else {\n\t\t\treturn variable;\n\t\t}\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nexport function scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"names":["getVariationClassName","variation"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAAgCC,SAAhC,EAA4C;AAClD,MAAK,CAAEA,SAAP,EAAmB;AAClB,WAAO,EAAP;AACA;;AACD,SAAQ,YAAYA,SAAW,EAA/B;AACA","sourcesContent":["/**\n *\n * @param {string} variation The variation name.\n *\n * @return {string} The variation class name.\n */\nexport function getVariationClassName( variation ) {\n\tif ( ! variation ) {\n\t\treturn '';\n\t}\n\treturn `is-style-${ variation }`;\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.VariationPanel = VariationPanel;
|
|
9
|
+
exports.VariationsPanel = VariationsPanel;
|
|
10
|
+
exports.useHasVariationsPanel = useHasVariationsPanel;
|
|
11
|
+
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
13
|
+
|
|
14
|
+
var _blocks = require("@wordpress/blocks");
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _components = require("@wordpress/components");
|
|
19
|
+
|
|
20
|
+
var _navigationButton = require("./navigation-button");
|
|
21
|
+
|
|
22
|
+
var _contextMenu = _interopRequireDefault(require("./context-menu"));
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
function getCoreBlockStyles(blockStyles) {
|
|
32
|
+
return blockStyles === null || blockStyles === void 0 ? void 0 : blockStyles.filter(style => style.source === 'block');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function useHasVariationsPanel(name) {
|
|
36
|
+
let parentMenu = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
37
|
+
const isInsideVariationsPanel = parentMenu.includes('variations');
|
|
38
|
+
const blockStyles = (0, _data.useSelect)(select => {
|
|
39
|
+
const {
|
|
40
|
+
getBlockStyles
|
|
41
|
+
} = select(_blocks.store);
|
|
42
|
+
return getBlockStyles(name);
|
|
43
|
+
}, [name]);
|
|
44
|
+
const coreBlockStyles = getCoreBlockStyles(blockStyles);
|
|
45
|
+
return !!(coreBlockStyles !== null && coreBlockStyles !== void 0 && coreBlockStyles.length) && !isInsideVariationsPanel;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function VariationsPanel(_ref) {
|
|
49
|
+
let {
|
|
50
|
+
name
|
|
51
|
+
} = _ref;
|
|
52
|
+
const blockStyles = (0, _data.useSelect)(select => {
|
|
53
|
+
const {
|
|
54
|
+
getBlockStyles
|
|
55
|
+
} = select(_blocks.store);
|
|
56
|
+
return getBlockStyles(name);
|
|
57
|
+
}, [name]);
|
|
58
|
+
const coreBlockStyles = getCoreBlockStyles(blockStyles);
|
|
59
|
+
return (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
60
|
+
isBordered: true,
|
|
61
|
+
isSeparated: true
|
|
62
|
+
}, coreBlockStyles.map((style, index) => {
|
|
63
|
+
if (style !== null && style !== void 0 && style.isDefault) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (0, _element.createElement)(_navigationButton.NavigationButtonAsItem, {
|
|
68
|
+
key: index,
|
|
69
|
+
path: '/blocks/' + encodeURIComponent(name) + '/variations/' + encodeURIComponent(style.name),
|
|
70
|
+
"aria-label": style.label
|
|
71
|
+
}, style.label);
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function VariationPanel(_ref2) {
|
|
76
|
+
let {
|
|
77
|
+
blockName,
|
|
78
|
+
styleName
|
|
79
|
+
} = _ref2;
|
|
80
|
+
return (0, _element.createElement)(_contextMenu.default, {
|
|
81
|
+
parentMenu: '/blocks/' + encodeURIComponent(blockName) + '/variations/' + encodeURIComponent(styleName),
|
|
82
|
+
name: blockName
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=variations-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/variations-panel.js"],"names":["getCoreBlockStyles","blockStyles","filter","style","source","useHasVariationsPanel","name","parentMenu","isInsideVariationsPanel","includes","select","getBlockStyles","blocksStore","coreBlockStyles","length","VariationsPanel","map","index","isDefault","encodeURIComponent","label","VariationPanel","blockName","styleName"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,kBAAT,CAA6BC,WAA7B,EAA2C;AAC1C,SAAOA,WAAP,aAAOA,WAAP,uBAAOA,WAAW,CAAEC,MAAb,CAAuBC,KAAF,IAAaA,KAAK,CAACC,MAAN,KAAiB,OAAnD,CAAP;AACA;;AAEM,SAASC,qBAAT,CAAgCC,IAAhC,EAAwD;AAAA,MAAlBC,UAAkB,uEAAL,EAAK;AAC9D,QAAMC,uBAAuB,GAAGD,UAAU,CAACE,QAAX,CAAqB,YAArB,CAAhC;AACA,QAAMR,WAAW,GAAG,qBACjBS,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAqBD,MAAM,CAAEE,aAAF,CAAjC;AACA,WAAOD,cAAc,CAAEL,IAAF,CAArB;AACA,GAJkB,EAKnB,CAAEA,IAAF,CALmB,CAApB;AAOA,QAAMO,eAAe,GAAGb,kBAAkB,CAAEC,WAAF,CAA1C;AACA,SAAO,CAAC,EAAEY,eAAF,aAAEA,eAAF,eAAEA,eAAe,CAAEC,MAAnB,CAAD,IAA8B,CAAEN,uBAAvC;AACA;;AAEM,SAASO,eAAT,OAAqC;AAAA,MAAX;AAAET,IAAAA;AAAF,GAAW;AAC3C,QAAML,WAAW,GAAG,qBACjBS,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAqBD,MAAM,CAAEE,aAAF,CAAjC;AACA,WAAOD,cAAc,CAAEL,IAAF,CAArB;AACA,GAJkB,EAKnB,CAAEA,IAAF,CALmB,CAApB;AAOA,QAAMO,eAAe,GAAGb,kBAAkB,CAAEC,WAAF,CAA1C;AAEA,SACC,4BAAC,mCAAD;AAAW,IAAA,UAAU,MAArB;AAAsB,IAAA,WAAW;AAAjC,KACGY,eAAe,CAACG,GAAhB,CAAqB,CAAEb,KAAF,EAASc,KAAT,KAAoB;AAC1C,QAAKd,KAAL,aAAKA,KAAL,eAAKA,KAAK,CAAEe,SAAZ,EAAwB;AACvB,aAAO,IAAP;AACA;;AACD,WACC,4BAAC,wCAAD;AACC,MAAA,GAAG,EAAGD,KADP;AAEC,MAAA,IAAI,EACH,aACAE,kBAAkB,CAAEb,IAAF,CADlB,GAEA,cAFA,GAGAa,kBAAkB,CAAEhB,KAAK,CAACG,IAAR,CANpB;AAQC,oBAAaH,KAAK,CAACiB;AARpB,OAUGjB,KAAK,CAACiB,KAVT,CADD;AAcA,GAlBC,CADH,CADD;AAuBA;;AAEM,SAASC,cAAT,QAAoD;AAAA,MAA3B;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAA2B;AAC1D,SACC,4BAAC,oBAAD;AACC,IAAA,UAAU,EACT,aACAJ,kBAAkB,CAAEG,SAAF,CADlB,GAEA,cAFA,GAGAH,kBAAkB,CAAEI,SAAF,CALpB;AAOC,IAAA,IAAI,EAAGD;AAPR,IADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n/**\n * Internal dependencies\n */\n\nimport { NavigationButtonAsItem } from './navigation-button';\nimport ContextMenu from './context-menu';\n\nfunction getCoreBlockStyles( blockStyles ) {\n\treturn blockStyles?.filter( ( style ) => style.source === 'block' );\n}\n\nexport function useHasVariationsPanel( name, parentMenu = '' ) {\n\tconst isInsideVariationsPanel = parentMenu.includes( 'variations' );\n\tconst blockStyles = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tconst coreBlockStyles = getCoreBlockStyles( blockStyles );\n\treturn !! coreBlockStyles?.length && ! isInsideVariationsPanel;\n}\n\nexport function VariationsPanel( { name } ) {\n\tconst blockStyles = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockStyles } = select( blocksStore );\n\t\t\treturn getBlockStyles( name );\n\t\t},\n\t\t[ name ]\n\t);\n\tconst coreBlockStyles = getCoreBlockStyles( blockStyles );\n\n\treturn (\n\t\t<ItemGroup isBordered isSeparated>\n\t\t\t{ coreBlockStyles.map( ( style, index ) => {\n\t\t\t\tif ( style?.isDefault ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tpath={\n\t\t\t\t\t\t\t'/blocks/' +\n\t\t\t\t\t\t\tencodeURIComponent( name ) +\n\t\t\t\t\t\t\t'/variations/' +\n\t\t\t\t\t\t\tencodeURIComponent( style.name )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ style.label }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ style.label }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport function VariationPanel( { blockName, styleName } ) {\n\treturn (\n\t\t<ContextMenu\n\t\t\tparentMenu={\n\t\t\t\t'/blocks/' +\n\t\t\t\tencodeURIComponent( blockName ) +\n\t\t\t\t'/variations/' +\n\t\t\t\tencodeURIComponent( styleName )\n\t\t\t}\n\t\t\tname={ blockName }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -9,9 +9,11 @@ var _element = require("@wordpress/element");
|
|
|
9
9
|
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
|
|
12
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
13
|
+
|
|
12
14
|
var _store = require("../../store");
|
|
13
15
|
|
|
14
|
-
var
|
|
16
|
+
var _experiments = require("../../experiments");
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* WordPress dependencies
|
|
@@ -20,12 +22,12 @@ var _useGlobalStylesOutput = require("../global-styles/use-global-styles-output"
|
|
|
20
22
|
/**
|
|
21
23
|
* Internal dependencies
|
|
22
24
|
*/
|
|
25
|
+
const {
|
|
26
|
+
useGlobalStylesOutput
|
|
27
|
+
} = (0, _experiments.unlock)(_blockEditor.experiments);
|
|
23
28
|
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
29
|
function useGlobalStylesRenderer() {
|
|
28
|
-
const [styles, settings, svgFilters] =
|
|
30
|
+
const [styles, settings, svgFilters] = useGlobalStylesOutput();
|
|
29
31
|
const {
|
|
30
32
|
getSettings
|
|
31
33
|
} = (0, _data.useSelect)(_store.store);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles-renderer/index.js"],"names":["useGlobalStylesRenderer","styles","settings","svgFilters","getSettings","editSiteStore","updateSettings","currentStoreSettings","nonGlobalStyles","Object","values","filter","style","isGlobalStyles","__experimentalFeatures","GlobalStylesRenderer"],"mappings":";;;;;;;AAGA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles-renderer/index.js"],"names":["useGlobalStylesOutput","blockEditorExperiments","useGlobalStylesRenderer","styles","settings","svgFilters","getSettings","editSiteStore","updateSettings","currentStoreSettings","nonGlobalStyles","Object","values","filter","style","isGlobalStyles","__experimentalFeatures","GlobalStylesRenderer"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAA4B,yBAAQC,wBAAR,CAAlC;;AAEA,SAASC,uBAAT,GAAmC;AAClC,QAAM,CAAEC,MAAF,EAAUC,QAAV,EAAoBC,UAApB,IAAmCL,qBAAqB,EAA9D;AACA,QAAM;AAAEM,IAAAA;AAAF,MAAkB,qBAAWC,YAAX,CAAxB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAqB,uBAAaD,YAAb,CAA3B;AAEA,0BAAW,MAAM;AAAA;;AAChB,QAAK,CAAEJ,MAAF,IAAY,CAAEC,QAAnB,EAA8B;AAC7B;AACA;;AAED,UAAMK,oBAAoB,GAAGH,WAAW,EAAxC;AACA,UAAMI,eAAe,GAAGC,MAAM,CAACC,MAAP,0BACvBH,oBAAoB,CAACN,MADE,yEACQ,EADR,EAEtBU,MAFsB,CAEZC,KAAF,IAAa,CAAEA,KAAK,CAACC,cAFP,CAAxB;AAGAP,IAAAA,cAAc,CAAE,EACf,GAAGC,oBADY;AAEfN,MAAAA,MAAM,EAAE,CAAE,GAAGO,eAAL,EAAsB,GAAGP,MAAzB,CAFO;AAGfE,MAAAA,UAHe;AAIfW,MAAAA,sBAAsB,EAAEZ;AAJT,KAAF,CAAd;AAMA,GAfD,EAeG,CAAED,MAAF,EAAUC,QAAV,CAfH;AAgBA;;AAEM,SAASa,oBAAT,GAAgC;AACtCf,EAAAA,uBAAuB;AAEvB,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { experiments as blockEditorExperiments } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../experiments';\n\nconst { useGlobalStylesOutput } = unlock( blockEditorExperiments );\n\nfunction useGlobalStylesRenderer() {\n\tconst [ styles, settings, svgFilters ] = useGlobalStylesOutput();\n\tconst { getSettings } = useSelect( editSiteStore );\n\tconst { updateSettings } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( ! styles || ! settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentStoreSettings = getSettings();\n\t\tconst nonGlobalStyles = Object.values(\n\t\t\tcurrentStoreSettings.styles ?? []\n\t\t).filter( ( style ) => ! style.isGlobalStyles );\n\t\tupdateSettings( {\n\t\t\t...currentStoreSettings,\n\t\t\tstyles: [ ...nonGlobalStyles, ...styles ],\n\t\t\tsvgFilters,\n\t\t\t__experimentalFeatures: settings,\n\t\t} );\n\t}, [ styles, settings ] );\n}\n\nexport function GlobalStylesRenderer() {\n\tuseGlobalStylesRenderer();\n\n\treturn null;\n}\n"]}
|
|
@@ -85,7 +85,8 @@ function DocumentActions() {
|
|
|
85
85
|
const popoverProps = (0, _element.useMemo)(() => ({
|
|
86
86
|
// Use the title wrapper as the popover anchor so that the dropdown is
|
|
87
87
|
// centered over the whole title area rather than just one part of it.
|
|
88
|
-
anchor: popoverAnchor
|
|
88
|
+
anchor: popoverAnchor,
|
|
89
|
+
placement: 'bottom'
|
|
89
90
|
}), [popoverAnchor]); // Return a simple loading indicator until we have information to show.
|
|
90
91
|
|
|
91
92
|
if (!isLoaded) {
|
|
@@ -126,7 +127,6 @@ function DocumentActions() {
|
|
|
126
127
|
size: "body"
|
|
127
128
|
}, label !== null && label !== void 0 ? label : '')), (0, _element.createElement)(_components.Dropdown, {
|
|
128
129
|
popoverProps: popoverProps,
|
|
129
|
-
position: "bottom center",
|
|
130
130
|
renderToggle: _ref => {
|
|
131
131
|
let {
|
|
132
132
|
isOpen,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header-edit-mode/document-actions/index.js"],"names":["getBlockDisplayText","block","blockType","name","attributes","useSecondaryText","getBlock","blockEditorStore","activeEntityBlockId","select","__experimentalGetActiveBlockIdByBlockNames","blockInformation","label","isActive","icon","DocumentActions","showIconLabels","preferencesStore","get","isLoaded","record","getTitle","popoverAnchor","setPopoverAnchor","popoverProps","anchor","entityLabel","type","isOpen","onToggle","chevronDown","undefined","onClose"],"mappings":";;;;;;;;;AAqBA;;AAlBA;;AAKA;;AACA;;AA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AYzC;AACA;;AACA,QAAM,CAAEiB,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAU,IAAV,CAA5C,CAdyC,CAgBzC;;AACA,QAAMC,YAAY,GAAG,sBACpB,OAAQ;AACP;AACA;AACAC,IAAAA,MAAM,EAAEH;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header-edit-mode/document-actions/index.js"],"names":["getBlockDisplayText","block","blockType","name","attributes","useSecondaryText","getBlock","blockEditorStore","activeEntityBlockId","select","__experimentalGetActiveBlockIdByBlockNames","blockInformation","label","isActive","icon","DocumentActions","showIconLabels","preferencesStore","get","isLoaded","record","getTitle","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","entityLabel","type","isOpen","onToggle","chevronDown","undefined","onClose"],"mappings":";;;;;;;;;AAqBA;;AAlBA;;AAKA;;AACA;;AAIA;;AACA;;AAMA;;AAEA;;AAKA;;AAKA;;AACA;;AAjCA;AACA;AACA;;AAGA;AACA;AACA;;AAsBA;AACA;AACA;AAIA,SAASA,mBAAT,CAA8BC,KAA9B,EAAsC;AACrC,MAAKA,KAAL,EAAa;AACZ,UAAMC,SAAS,GAAG,0BAAcD,KAAK,CAACE,IAApB,CAAlB;AACA,WAAOD,SAAS,GAAG,yCAAeA,SAAf,EAA0BD,KAAK,CAACG,UAAhC,CAAH,GAAkD,IAAlE;AACA;;AACD,SAAO,IAAP;AACA;;AAED,SAASC,gBAAT,GAA4B;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAWC,kBAAX,CAArB;AACA,QAAMC,mBAAmB,GAAG,qBACzBC,MAAF,IACCA,MAAM,CACLF,kBADK,CAAN,CAEEG,0CAFF,CAE8C,CAC7C,oBAD6C,CAF9C,CAF0B,EAO3B,EAP2B,CAA5B;AAUA,QAAMC,gBAAgB,GAAG,6CAA4BH,mBAA5B,CAAzB;;AAEA,MAAKA,mBAAL,EAA2B;AAC1B,WAAO;AACNI,MAAAA,KAAK,EAAEZ,mBAAmB,CAAEM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,EAAGa;AAFX,QADe;AAAA;AApBjB,IAvBD,CALD,CADD;AA2DA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\t__experimentalGetBlockLabel as getBlockLabel,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\tVisuallyHidden,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\tuseBlockDisplayInformation,\n\tBlockIcon,\n} from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport TemplateDetails from '../../template-details';\nimport useEditedEntityRecord from '../../use-edited-entity-record';\n\nfunction getBlockDisplayText( block ) {\n\tif ( block ) {\n\t\tconst blockType = getBlockType( block.name );\n\t\treturn blockType ? getBlockLabel( blockType, block.attributes ) : null;\n\t}\n\treturn null;\n}\n\nfunction useSecondaryText() {\n\tconst { getBlock } = useSelect( blockEditorStore );\n\tconst activeEntityBlockId = useSelect(\n\t\t( select ) =>\n\t\t\tselect(\n\t\t\t\tblockEditorStore\n\t\t\t).__experimentalGetActiveBlockIdByBlockNames( [\n\t\t\t\t'core/template-part',\n\t\t\t] ),\n\t\t[]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( activeEntityBlockId );\n\n\tif ( activeEntityBlockId ) {\n\t\treturn {\n\t\t\tlabel: getBlockDisplayText( getBlock( activeEntityBlockId ) ),\n\t\t\tisActive: true,\n\t\t\ticon: blockInformation?.icon,\n\t\t};\n\t}\n\n\treturn {};\n}\n\nexport default function DocumentActions() {\n\tconst showIconLabels = useSelect(\n\t\t( select ) =>\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t[]\n\t);\n\tconst { isLoaded, record, getTitle } = useEditedEntityRecord();\n\tconst { label, icon } = useSecondaryText();\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Use the title wrapper as the popover anchor so that the dropdown is\n\t\t\t// centered over the whole title area rather than just one part of it.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'bottom',\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\t// Return a simple loading indicator until we have information to show.\n\tif ( ! isLoaded ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Loading…' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Return feedback that the template does not seem to exist.\n\tif ( ! record ) {\n\t\treturn (\n\t\t\t<div className=\"edit-site-document-actions\">\n\t\t\t\t{ __( 'Template not found' ) }\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst entityLabel =\n\t\trecord.type === 'wp_template_part'\n\t\t\t? __( 'template part' )\n\t\t\t: __( 'template' );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames( 'edit-site-document-actions', {\n\t\t\t\t'has-secondary-label': !! label,\n\t\t\t} ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\tclassName=\"edit-site-document-actions__title-wrapper\"\n\t\t\t>\n\t\t\t\t<Text\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tclassName=\"edit-site-document-actions__title\"\n\t\t\t\t\tas=\"h1\"\n\t\t\t\t>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: the entity being edited, like \"template\"*/\n\t\t\t\t\t\t\t__( 'Editing %s: ' ),\n\t\t\t\t\t\t\tentityLabel\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t{ getTitle() }\n\t\t\t\t</Text>\n\t\t\t\t<div className=\"edit-site-document-actions__secondary-item\">\n\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t\t<Text size=\"body\">{ label ?? '' }</Text>\n\t\t\t\t</div>\n\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-document-actions__get-info\"\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\tvariant={ showIconLabels ? 'tertiary' : undefined }\n\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the entity to see details about, like \"template\"*/\n\t\t\t\t\t\t\t\t__( 'Show %s details' ),\n\t\t\t\t\t\t\t\tentityLabel\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ showIconLabels && __( 'Details' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\tcontentClassName=\"edit-site-document-actions__info-dropdown\"\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<TemplateDetails\n\t\t\t\t\t\t\ttemplate={ record }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -104,7 +104,6 @@ function KeyboardShortcutHelpModal(_ref4) {
|
|
|
104
104
|
return (0, _element.createElement)(_components.Modal, {
|
|
105
105
|
className: "edit-site-keyboard-shortcut-help-modal",
|
|
106
106
|
title: (0, _i18n.__)('Keyboard shortcuts'),
|
|
107
|
-
closeLabel: (0, _i18n.__)('Close'),
|
|
108
107
|
onRequestClose: toggleModal
|
|
109
108
|
}, (0, _element.createElement)(ShortcutSection, {
|
|
110
109
|
className: "edit-site-keyboard-shortcut-help-modal__main-shortcuts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG;AAAA,MAAE;AAAEC,IAAAA;AAAF,GAAF;AAAA;AACpB;AACD;AACA;AACA;;AACC;AACA;AACC,MAAA,SAAS,EAAC,uDADX;AAEC,MAAA,IAAI,EAAC;AAFN,OAIGA,SAAS,CAACC,GAAV,CAAe,CAAEC,QAAF,EAAYC,KAAZ,KAChB;AACC,MAAA,SAAS,EAAC,kDADX;AAEC,MAAA,GAAG,EAAGA;AAFP,OAIG,OAAOD,QAAP,KAAoB,QAApB,GACD,4BAAC,wBAAD;AAAiB,MAAA,IAAI,EAAGA;AAAxB,MADC,GAGD,4BAAC,iBAAD,EAAeA,QAAf,CAPF,CADC,CAJH;AAiBA;;AAvBoB;AAAA,CAArB;;AA0BA,MAAME,eAAe,GAAG;AAAA,MAAE;AAAEC,IAAAA,KAAF;AAASL,IAAAA,SAAT;AAAoBM,IAAAA;AAApB,GAAF;AAAA,SACvB;AACC,IAAA,SAAS,EAAG,yBACX,iDADW,EAEXA,SAFW;AADb,KAMG,CAAC,CAAED,KAAH,IACD;AAAI,IAAA,SAAS,EAAC;AAAd,KACGA,KADH,CAPF,EAWC,4BAAC,YAAD;AAAc,IAAA,SAAS,EAAGL;AAA1B,IAXD,CADuB;AAAA,CAAxB;;AAgBA,MAAMO,uBAAuB,GAAG,SAIzB;AAAA,MAJ2B;AACjCF,IAAAA,KADiC;AAEjCG,IAAAA,YAFiC;AAGjCC,IAAAA,mBAAmB,GAAG;AAHW,GAI3B;AACN,QAAMC,iBAAiB,GAAG,qBACvBC,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEC,wBAAF,CAAN,CAAiCC,oBAAjC,CACNL,YADM,CAAP;AAGA,GALwB,EAMzB,CAAEA,YAAF,CANyB,CAA1B;AASA,SACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAGH,KADT;AAEC,IAAA,SAAS,EAAGK,iBAAiB,CAACI,MAAlB,CAA0BL,mBAA1B;AAFb,IADD;AAMA,CApBD;;AAsBe,SAASM,yBAAT,QAGX;AAAA,MAH+C;AAClDC,IAAAA,aADkD;AAElDC,IAAAA;AAFkD,GAG/C;;AACH,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,KAAK,EAAG,cAAI,oBAAJ,CAFT;AAGC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcut-help-modal/index.js"],"names":["ShortcutList","shortcuts","map","shortcut","index","ShortcutSection","title","className","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","keyCombination","character","description","ariaLabel","textFormattingShortcuts"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKA,MAAMA,YAA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AAA,MAH+C;AAClDC,IAAAA,aADkD;AAElDC,IAAAA;AAFkD,GAG/C;;AACH,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,KAAK,EAAG,cAAI,oBAAJ,CAFT;AAGC,IAAA,cAAc,EAAGC;AAHlB,KAKC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,wDADX;AAEC,IAAA,SAAS,EAAG,CAAE,mCAAF;AAFb,IALD,EASC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IATD,EAcC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,qBAAJ,CADT;AAEC,IAAA,YAAY,EAAC;AAFd,IAdD,EAmBC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,YAAY,EAAC,OAFd;AAGC,IAAA,mBAAmB,EAAG,CACrB;AACCC,MAAAA,cAAc,EAAE;AAAEC,QAAAA,SAAS,EAAE;AAAb,OADjB;AAECC,MAAAA,WAAW,EAAE,cACZ,qDADY,CAFd;;AAKC;AACAC,MAAAA,SAAS,EAAE,cAAI,eAAJ;AANZ,KADqB;AAHvB,IAnBD,EAiCC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,iBAAJ,CADT;AAEC,IAAA,SAAS,EAAGC;AAFb,IAjCD,CADD;AAwCA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-site-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-site-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-site-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-site/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"]}
|