@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
|
@@ -344,8 +344,9 @@ function FontCollection( { slug } ) {
|
|
|
344
344
|
size="small"
|
|
345
345
|
onClick={ () => {
|
|
346
346
|
setSelectedFont( null );
|
|
347
|
+
setNotice( null );
|
|
347
348
|
} }
|
|
348
|
-
|
|
349
|
+
label={ __( 'Back' ) }
|
|
349
350
|
/>
|
|
350
351
|
<Heading
|
|
351
352
|
level={ 2 }
|
|
@@ -441,13 +442,13 @@ function FontCollection( { slug } ) {
|
|
|
441
442
|
sprintf(
|
|
442
443
|
// translators: %s: Total number of pages.
|
|
443
444
|
_x(
|
|
444
|
-
'Page <
|
|
445
|
+
'Page <CurrentPageControl /> of %s',
|
|
445
446
|
'paging'
|
|
446
447
|
),
|
|
447
448
|
totalPages
|
|
448
449
|
),
|
|
449
450
|
{
|
|
450
|
-
|
|
451
|
+
CurrentPageControl: (
|
|
451
452
|
<SelectControl
|
|
452
453
|
aria-label={ __( 'Current page' ) }
|
|
453
454
|
value={ page }
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Button,
|
|
7
7
|
Card,
|
|
8
8
|
CardBody,
|
|
9
|
+
__experimentalHeading as Heading,
|
|
9
10
|
__experimentalText as Text,
|
|
10
11
|
__experimentalSpacer as Spacer,
|
|
11
12
|
} from '@wordpress/components';
|
|
@@ -24,7 +25,9 @@ function GoogleFontsConfirmDialog() {
|
|
|
24
25
|
<div className="font-library__google-fonts-confirm">
|
|
25
26
|
<Card>
|
|
26
27
|
<CardBody>
|
|
27
|
-
<
|
|
28
|
+
<Heading level={ 2 }>
|
|
29
|
+
{ __( 'Connect to Google Fonts' ) }
|
|
30
|
+
</Heading>
|
|
28
31
|
<Spacer margin={ 6 } />
|
|
29
32
|
<Text as="p">
|
|
30
33
|
{ __(
|
|
@@ -38,7 +41,11 @@ function GoogleFontsConfirmDialog() {
|
|
|
38
41
|
) }
|
|
39
42
|
</Text>
|
|
40
43
|
<Spacer margin={ 6 } />
|
|
41
|
-
<Button
|
|
44
|
+
<Button
|
|
45
|
+
__next40pxDefaultSize
|
|
46
|
+
variant="primary"
|
|
47
|
+
onClick={ handleConfirm }
|
|
48
|
+
>
|
|
42
49
|
{ __( 'Allow access to Google Fonts' ) }
|
|
43
50
|
</Button>
|
|
44
51
|
</CardBody>
|
|
@@ -125,13 +125,22 @@ button.font-library-modal__upload-area {
|
|
|
125
125
|
align-items: center;
|
|
126
126
|
margin-top: $grid-unit-80;
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
p {
|
|
129
|
+
line-height: $default-line-height;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
h2 {
|
|
133
|
+
font-size: 1.2rem;
|
|
134
|
+
font-weight: 400;
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
.components-card {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
padding: $grid-unit-20;
|
|
139
|
+
width: 400px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.components-button {
|
|
143
|
+
width: 100%;
|
|
144
|
+
justify-content: center;
|
|
136
145
|
}
|
|
137
146
|
}
|
|
@@ -45,29 +45,48 @@ function UploadFonts() {
|
|
|
45
45
|
* @param {Array} files The files to be filtered
|
|
46
46
|
* @return {void}
|
|
47
47
|
*/
|
|
48
|
-
const handleFilesUpload = ( files ) => {
|
|
48
|
+
const handleFilesUpload = async ( files ) => {
|
|
49
49
|
setNotice( null );
|
|
50
50
|
setIsUploading( true );
|
|
51
51
|
const uniqueFilenames = new Set();
|
|
52
52
|
const selectedFiles = [ ...files ];
|
|
53
|
-
|
|
53
|
+
let hasInvalidFiles = false;
|
|
54
|
+
|
|
55
|
+
// Use map to create a promise for each file check, then filter with Promise.all.
|
|
56
|
+
const checkFilesPromises = selectedFiles.map( async ( file ) => {
|
|
57
|
+
const isFont = await isFontFile( file );
|
|
58
|
+
if ( ! isFont ) {
|
|
59
|
+
hasInvalidFiles = true;
|
|
60
|
+
return null; // Return null for invalid files.
|
|
61
|
+
}
|
|
62
|
+
// Check for duplicates
|
|
54
63
|
if ( uniqueFilenames.has( file.name ) ) {
|
|
55
|
-
return
|
|
64
|
+
return null; // Return null for duplicates.
|
|
56
65
|
}
|
|
57
|
-
//
|
|
66
|
+
// Check if the file extension is allowed.
|
|
58
67
|
const fileExtension = file.name.split( '.' ).pop().toLowerCase();
|
|
59
68
|
if ( ALLOWED_FILE_EXTENSIONS.includes( fileExtension ) ) {
|
|
60
69
|
uniqueFilenames.add( file.name );
|
|
61
|
-
return
|
|
70
|
+
return file; // Return the file if it passes all checks.
|
|
62
71
|
}
|
|
63
|
-
return
|
|
72
|
+
return null; // Return null for disallowed file extensions.
|
|
64
73
|
} );
|
|
74
|
+
|
|
75
|
+
// Filter out the nulls after all promises have resolved.
|
|
76
|
+
const allowedFiles = ( await Promise.all( checkFilesPromises ) ).filter(
|
|
77
|
+
( file ) => null !== file
|
|
78
|
+
);
|
|
79
|
+
|
|
65
80
|
if ( allowedFiles.length > 0 ) {
|
|
66
81
|
loadFiles( allowedFiles );
|
|
67
82
|
} else {
|
|
83
|
+
const message = hasInvalidFiles
|
|
84
|
+
? __( 'Sorry, you are not allowed to upload this file type.' )
|
|
85
|
+
: __( 'No fonts found to install.' );
|
|
86
|
+
|
|
68
87
|
setNotice( {
|
|
69
88
|
type: 'error',
|
|
70
|
-
message
|
|
89
|
+
message,
|
|
71
90
|
} );
|
|
72
91
|
setIsUploading( false );
|
|
73
92
|
}
|
|
@@ -94,6 +113,23 @@ function UploadFonts() {
|
|
|
94
113
|
handleInstall( fontFacesLoaded );
|
|
95
114
|
};
|
|
96
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Checks if a file is a valid Font file.
|
|
118
|
+
*
|
|
119
|
+
* @param {File} file The file to be checked.
|
|
120
|
+
* @return {boolean} Whether the file is a valid font file.
|
|
121
|
+
*/
|
|
122
|
+
async function isFontFile( file ) {
|
|
123
|
+
const font = new Font( 'Uploaded Font' );
|
|
124
|
+
try {
|
|
125
|
+
const buffer = await readFileAsArrayBuffer( file );
|
|
126
|
+
await font.fromDataBuffer( buffer, 'font' );
|
|
127
|
+
return true;
|
|
128
|
+
} catch ( error ) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
97
133
|
// Create a function to read the file as array buffer
|
|
98
134
|
async function readFileAsArrayBuffer( file ) {
|
|
99
135
|
return new Promise( ( resolve, reject ) => {
|
|
@@ -154,6 +190,7 @@ function UploadFonts() {
|
|
|
154
190
|
setNotice( {
|
|
155
191
|
type: 'error',
|
|
156
192
|
message: error.message,
|
|
193
|
+
errors: error?.installationErrors,
|
|
157
194
|
} );
|
|
158
195
|
}
|
|
159
196
|
|
|
@@ -167,9 +204,17 @@ function UploadFonts() {
|
|
|
167
204
|
{ notice && (
|
|
168
205
|
<Notice
|
|
169
206
|
status={ notice.type }
|
|
207
|
+
__unstableHTML
|
|
170
208
|
onRemove={ () => setNotice( null ) }
|
|
171
209
|
>
|
|
172
210
|
{ notice.message }
|
|
211
|
+
{ notice.errors && (
|
|
212
|
+
<ul>
|
|
213
|
+
{ notice.errors.map( ( error, index ) => (
|
|
214
|
+
<li key={ index }>{ error }</li>
|
|
215
|
+
) ) }
|
|
216
|
+
</ul>
|
|
217
|
+
) }
|
|
173
218
|
</Notice>
|
|
174
219
|
) }
|
|
175
220
|
{ isUploading && (
|
|
@@ -199,7 +244,7 @@ function UploadFonts() {
|
|
|
199
244
|
<Spacer margin={ 2 } />
|
|
200
245
|
<Text className="font-library-modal__upload-area__text">
|
|
201
246
|
{ __(
|
|
202
|
-
'Uploaded fonts appear in your library and can be used in your theme. Supported formats: .
|
|
247
|
+
'Uploaded fonts appear in your library and can be used in your theme. Supported formats: .ttf, .otf, .woff, and .woff2.'
|
|
203
248
|
) }
|
|
204
249
|
</Text>
|
|
205
250
|
</VStack>
|
|
@@ -134,9 +134,9 @@ export function unloadFontFaceInBrowser( fontFace, removeFrom = 'all' ) {
|
|
|
134
134
|
const unloadFontFace = ( fonts ) => {
|
|
135
135
|
fonts.forEach( ( f ) => {
|
|
136
136
|
if (
|
|
137
|
-
f.family === formatFontFaceName( fontFace
|
|
138
|
-
f.weight === fontFace
|
|
139
|
-
f.style === fontFace
|
|
137
|
+
f.family === formatFontFaceName( fontFace?.fontFamily ) &&
|
|
138
|
+
f.weight === fontFace?.fontWeight &&
|
|
139
|
+
f.style === fontFace?.fontStyle
|
|
140
140
|
) {
|
|
141
141
|
fonts.delete( f );
|
|
142
142
|
}
|
|
@@ -259,7 +259,7 @@ export async function batchInstallFontFaces( fontFamilyId, fontFacesData ) {
|
|
|
259
259
|
// Handle network errors or other fetch-related errors
|
|
260
260
|
results.errors.push( {
|
|
261
261
|
data: fontFacesData[ index ],
|
|
262
|
-
message:
|
|
262
|
+
message: result.reason.message,
|
|
263
263
|
} );
|
|
264
264
|
}
|
|
265
265
|
} );
|
|
@@ -87,6 +87,10 @@ export function formatFontFamily( input ) {
|
|
|
87
87
|
* formatFontFaceName(", 'Open Sans', 'Helvetica Neue', sans-serif") => "Open Sans"
|
|
88
88
|
*/
|
|
89
89
|
export function formatFontFaceName( input ) {
|
|
90
|
+
if ( ! input ) {
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
|
|
90
94
|
let output = input.trim();
|
|
91
95
|
if ( output.includes( ',' ) ) {
|
|
92
96
|
output = output
|
|
@@ -9,14 +9,21 @@ import a11yPlugin from 'colord/plugins/a11y';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
11
11
|
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
12
|
+
import { useContext } from '@wordpress/element';
|
|
13
|
+
import { __ } from '@wordpress/i18n';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
15
17
|
*/
|
|
18
|
+
import { mergeBaseAndUserConfigs } from './global-styles-provider';
|
|
19
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
20
|
+
import { getFontFamilies } from './utils';
|
|
16
21
|
import { unlock } from '../../lock-unlock';
|
|
17
22
|
import { useSelect } from '@wordpress/data';
|
|
18
23
|
|
|
19
|
-
const { useGlobalSetting, useGlobalStyle } = unlock(
|
|
24
|
+
const { useGlobalSetting, useGlobalStyle, GlobalStylesContext } = unlock(
|
|
25
|
+
blockEditorPrivateApis
|
|
26
|
+
);
|
|
20
27
|
|
|
21
28
|
// Enable colord's a11y plugin.
|
|
22
29
|
extend( [ a11yPlugin ] );
|
|
@@ -92,3 +99,63 @@ export function useSupportedStyles( name, element ) {
|
|
|
92
99
|
|
|
93
100
|
return supportedPanels;
|
|
94
101
|
}
|
|
102
|
+
|
|
103
|
+
export function useColorVariations() {
|
|
104
|
+
const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
105
|
+
property: 'color',
|
|
106
|
+
} );
|
|
107
|
+
/*
|
|
108
|
+
* Filter out variations with no settings or styles.
|
|
109
|
+
*/
|
|
110
|
+
return colorVariations?.length
|
|
111
|
+
? colorVariations.filter( ( variation ) => {
|
|
112
|
+
const { settings, styles, title } = variation;
|
|
113
|
+
return (
|
|
114
|
+
title === __( 'Default' ) || // Always preseve the default variation.
|
|
115
|
+
Object.keys( settings ).length > 0 ||
|
|
116
|
+
Object.keys( styles ).length > 0
|
|
117
|
+
);
|
|
118
|
+
} )
|
|
119
|
+
: [];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function useTypographyVariations() {
|
|
123
|
+
const typographyVariations =
|
|
124
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
125
|
+
property: 'typography',
|
|
126
|
+
} );
|
|
127
|
+
|
|
128
|
+
const { base } = useContext( GlobalStylesContext );
|
|
129
|
+
/*
|
|
130
|
+
* Filter duplicate variations based on whether the variaitons
|
|
131
|
+
* have different heading and body font families.
|
|
132
|
+
*/
|
|
133
|
+
return typographyVariations?.length
|
|
134
|
+
? Object.values(
|
|
135
|
+
typographyVariations.reduce( ( acc, variation ) => {
|
|
136
|
+
const [ bodyFontFamily, headingFontFamily ] =
|
|
137
|
+
getFontFamilies(
|
|
138
|
+
mergeBaseAndUserConfigs( base, variation )
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
// Always preseve the default variation.
|
|
142
|
+
if ( variation?.title === 'Default' ) {
|
|
143
|
+
acc[
|
|
144
|
+
`${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
|
|
145
|
+
] = variation;
|
|
146
|
+
} else if (
|
|
147
|
+
headingFontFamily?.name &&
|
|
148
|
+
bodyFontFamily?.name &&
|
|
149
|
+
! acc[
|
|
150
|
+
`${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
|
|
151
|
+
]
|
|
152
|
+
) {
|
|
153
|
+
acc[
|
|
154
|
+
`${ headingFontFamily?.name }:${ bodyFontFamily?.name }`
|
|
155
|
+
] = variation;
|
|
156
|
+
}
|
|
157
|
+
return acc;
|
|
158
|
+
}, {} )
|
|
159
|
+
)
|
|
160
|
+
: [];
|
|
161
|
+
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
*/
|
|
14
14
|
import { unlock } from '../../lock-unlock';
|
|
15
15
|
import { useStylesPreviewColors } from './hooks';
|
|
16
|
-
import
|
|
16
|
+
import TypographyExample from './typography-example';
|
|
17
17
|
import HighlightedColors from './highlighted-colors';
|
|
18
18
|
import PreviewIframe from './preview-iframe';
|
|
19
19
|
|
|
@@ -89,7 +89,7 @@ const PreviewStyles = ( { label, isFocused, withHoverView, variation } ) => {
|
|
|
89
89
|
overflow: 'hidden',
|
|
90
90
|
} }
|
|
91
91
|
>
|
|
92
|
-
<
|
|
92
|
+
<TypographyExample
|
|
93
93
|
fontSize={ 65 * ratio }
|
|
94
94
|
variation={ variation }
|
|
95
95
|
/>
|
|
@@ -12,7 +12,6 @@ import ScreenHeader from './header';
|
|
|
12
12
|
import Palette from './palette';
|
|
13
13
|
import { unlock } from '../../lock-unlock';
|
|
14
14
|
import ColorVariations from './variations/variations-color';
|
|
15
|
-
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
16
15
|
|
|
17
16
|
const {
|
|
18
17
|
useGlobalStyle,
|
|
@@ -31,12 +30,6 @@ function ScreenColors() {
|
|
|
31
30
|
const [ rawSettings ] = useGlobalSetting( '' );
|
|
32
31
|
const settings = useSettingsForBlockElement( rawSettings );
|
|
33
32
|
|
|
34
|
-
const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
35
|
-
property: 'color',
|
|
36
|
-
filter: ( variation ) =>
|
|
37
|
-
variation?.settings?.color &&
|
|
38
|
-
Object.keys( variation?.settings?.color ).length,
|
|
39
|
-
} );
|
|
40
33
|
return (
|
|
41
34
|
<>
|
|
42
35
|
<ScreenHeader
|
|
@@ -46,13 +39,9 @@ function ScreenColors() {
|
|
|
46
39
|
) }
|
|
47
40
|
/>
|
|
48
41
|
<div className="edit-site-global-styles-screen-colors">
|
|
49
|
-
<VStack spacing={
|
|
50
|
-
|
|
51
|
-
<ColorVariations variations={ colorVariations } />
|
|
52
|
-
) }
|
|
53
|
-
|
|
42
|
+
<VStack spacing={ 6 }>
|
|
43
|
+
<ColorVariations />
|
|
54
44
|
<Palette />
|
|
55
|
-
|
|
56
45
|
<StylesColorPanel
|
|
57
46
|
inheritedValue={ inheritedStyle }
|
|
58
47
|
value={ style }
|
|
@@ -13,7 +13,6 @@ import TypographyElements from './typography-elements';
|
|
|
13
13
|
import TypographyVariations from './variations/variations-typography';
|
|
14
14
|
import FontFamilies from './font-families';
|
|
15
15
|
import ScreenHeader from './header';
|
|
16
|
-
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
17
16
|
|
|
18
17
|
function ScreenTypography() {
|
|
19
18
|
const fontLibraryEnabled = useSelect(
|
|
@@ -21,14 +20,6 @@ function ScreenTypography() {
|
|
|
21
20
|
select( editorStore ).getEditorSettings().fontLibraryEnabled,
|
|
22
21
|
[]
|
|
23
22
|
);
|
|
24
|
-
const typographyVariations =
|
|
25
|
-
useCurrentMergeThemeStyleVariationsWithUserConfig( {
|
|
26
|
-
property: 'typography',
|
|
27
|
-
filter: ( variation ) =>
|
|
28
|
-
variation?.settings?.typography?.fontFamilies &&
|
|
29
|
-
Object.keys( variation?.settings?.typography?.fontFamilies )
|
|
30
|
-
.length,
|
|
31
|
-
} );
|
|
32
23
|
|
|
33
24
|
return (
|
|
34
25
|
<>
|
|
@@ -40,9 +31,7 @@ function ScreenTypography() {
|
|
|
40
31
|
/>
|
|
41
32
|
<div className="edit-site-global-styles-screen-typography">
|
|
42
33
|
<VStack spacing={ 6 }>
|
|
43
|
-
|
|
44
|
-
<TypographyVariations />
|
|
45
|
-
) }
|
|
34
|
+
<TypographyVariations />
|
|
46
35
|
{ ! window.__experimentalDisableFontLibrary && (
|
|
47
36
|
<VStack spacing={ 3 }>
|
|
48
37
|
{ fontLibraryEnabled && <FontFamilies /> }
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.edit-site-global-styles-preview__iframe {
|
|
10
|
-
|
|
10
|
+
border-radius: $radius-block-ui;
|
|
11
11
|
display: block;
|
|
12
|
+
max-width: 100%;
|
|
13
|
+
width: 100%;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
.edit-site-typography-preview {
|
|
@@ -165,3 +167,4 @@
|
|
|
165
167
|
.edit-site-global-styles-sidebar__panel .block-editor-block-icon svg {
|
|
166
168
|
fill: currentColor;
|
|
167
169
|
}
|
|
170
|
+
|
|
@@ -35,6 +35,7 @@ function ElementItem( { parentMenu, element, label } ) {
|
|
|
35
35
|
prefix + 'typography.letterSpacing'
|
|
36
36
|
);
|
|
37
37
|
const [ backgroundColor ] = useGlobalStyle( prefix + 'color.background' );
|
|
38
|
+
const [ fallbackBackgroundColor ] = useGlobalStyle( 'color.background' );
|
|
38
39
|
const [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient' );
|
|
39
40
|
const [ color ] = useGlobalStyle( prefix + 'color.text' );
|
|
40
41
|
|
|
@@ -54,7 +55,10 @@ function ElementItem( { parentMenu, element, label } ) {
|
|
|
54
55
|
className="edit-site-global-styles-screen-typography__indicator"
|
|
55
56
|
style={ {
|
|
56
57
|
fontFamily: fontFamily ?? 'serif',
|
|
57
|
-
background:
|
|
58
|
+
background:
|
|
59
|
+
gradientValue ??
|
|
60
|
+
backgroundColor ??
|
|
61
|
+
fallbackBackgroundColor,
|
|
58
62
|
color,
|
|
59
63
|
fontStyle,
|
|
60
64
|
fontWeight,
|
|
@@ -37,7 +37,6 @@ export default function PreviewTypography( { fontSize, variation } ) {
|
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
39
|
<motion.div
|
|
40
|
-
className="edit-site-global-styles_preview-typography"
|
|
41
40
|
animate={ {
|
|
42
41
|
scale: 1,
|
|
43
42
|
opacity: 1,
|
|
@@ -50,6 +49,9 @@ export default function PreviewTypography( { fontSize, variation } ) {
|
|
|
50
49
|
delay: 0.3,
|
|
51
50
|
type: 'tween',
|
|
52
51
|
} }
|
|
52
|
+
style={ {
|
|
53
|
+
textAlign: 'center',
|
|
54
|
+
} }
|
|
53
55
|
>
|
|
54
56
|
<span style={ headingPreviewStyle }>
|
|
55
57
|
{ _x( 'A', 'Uppercase letter A' ) }
|
|
@@ -27,6 +27,7 @@ export default function TypographyPreview( { name, element, headingLevel } ) {
|
|
|
27
27
|
prefix + 'color.background',
|
|
28
28
|
name
|
|
29
29
|
);
|
|
30
|
+
const [ fallbackBackgroundColor ] = useGlobalStyle( 'color.background' );
|
|
30
31
|
const [ color ] = useGlobalStyle( prefix + 'color.text', name );
|
|
31
32
|
const [ fontSize ] = useGlobalStyle( prefix + 'typography.fontSize', name );
|
|
32
33
|
const [ fontStyle ] = useGlobalStyle(
|
|
@@ -53,7 +54,8 @@ export default function TypographyPreview( { name, element, headingLevel } ) {
|
|
|
53
54
|
className="edit-site-typography-preview"
|
|
54
55
|
style={ {
|
|
55
56
|
fontFamily: fontFamily ?? 'serif',
|
|
56
|
-
background:
|
|
57
|
+
background:
|
|
58
|
+
gradientValue ?? backgroundColor ?? fallbackBackgroundColor,
|
|
57
59
|
color,
|
|
58
60
|
fontSize,
|
|
59
61
|
fontStyle,
|
|
@@ -5,21 +5,25 @@ import {
|
|
|
5
5
|
__experimentalGrid as Grid,
|
|
6
6
|
__experimentalVStack as VStack,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
12
11
|
*/
|
|
13
|
-
import Subtitle from '../subtitle';
|
|
14
12
|
import Variation from './variation';
|
|
15
13
|
import StylesPreviewColors from '../preview-colors';
|
|
14
|
+
import { useColorVariations } from '../hooks';
|
|
15
|
+
|
|
16
|
+
export default function ColorVariations() {
|
|
17
|
+
const colorVariations = useColorVariations();
|
|
18
|
+
|
|
19
|
+
if ( ! colorVariations?.length ) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
16
22
|
|
|
17
|
-
export default function ColorVariations( { variations } ) {
|
|
18
23
|
return (
|
|
19
24
|
<VStack spacing={ 3 }>
|
|
20
|
-
<Subtitle level={ 3 }>{ __( 'Presets' ) }</Subtitle>
|
|
21
25
|
<Grid columns={ 3 }>
|
|
22
|
-
{
|
|
26
|
+
{ colorVariations.map( ( variation, index ) => (
|
|
23
27
|
<Variation key={ index } variation={ variation }>
|
|
24
28
|
{ () => <StylesPreviewColors /> }
|
|
25
29
|
</Variation>
|