@wordpress/edit-site 5.34.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -3
- package/build/components/add-new-page/index.js +33 -27
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +95 -78
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +35 -30
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +119 -95
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +89 -73
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +36 -17
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +13 -5
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/block-inspector-button.js +5 -4
- package/build/components/block-editor/block-inspector-button.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +88 -0
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -0
- package/build/components/canvas-loader/index.js +13 -12
- package/build/components/canvas-loader/index.js.map +1 -1
- package/build/components/dataviews-actions/index.js +49 -0
- package/build/components/dataviews-actions/index.js.map +1 -0
- package/build/components/editor/index.js +107 -140
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +27 -29
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/error-boundary/index.js +2 -2
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/warning.js +13 -11
- package/build/components/error-boundary/warning.js.map +1 -1
- package/build/components/global-styles/background-panel.js +19 -6
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +19 -17
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +4 -4
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +32 -28
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +55 -39
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-family-item.js +17 -13
- package/build/components/global-styles/font-family-item.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-variant.js +25 -22
- package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +7 -30
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-card.js +24 -16
- package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +195 -152
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-demo.js +14 -12
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +29 -20
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +41 -36
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +153 -109
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-details.js +16 -14
- package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +25 -22
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +40 -34
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +3 -3
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +41 -38
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +37 -28
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/highlighted-colors.js +3 -4
- package/build/components/global-styles/highlighted-colors.js.map +1 -1
- package/build/components/global-styles/hooks.js +11 -20
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +4 -4
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +15 -11
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +39 -32
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preset-colors.js +28 -0
- package/build/components/global-styles/preset-colors.js.map +1 -0
- package/build/components/global-styles/preview-colors.js +23 -25
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/preview-iframe.js +34 -29
- package/build/components/global-styles/preview-iframe.js.map +1 -1
- package/build/components/global-styles/preview-styles.js +95 -90
- package/build/components/global-styles/preview-styles.js.map +1 -1
- package/build/components/global-styles/root-menu.js +28 -21
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-background.js +6 -4
- package/build/components/global-styles/screen-background.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +33 -27
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +62 -53
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +29 -19
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +18 -17
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -14
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +9 -4
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +52 -42
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +82 -71
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/screen-root.js +76 -42
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-shadows.js +22 -0
- package/build/components/global-styles/screen-shadows.js.map +1 -0
- package/build/components/global-styles/screen-style-variations.js +14 -9
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +50 -45
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +15 -11
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-utils.js +230 -0
- package/build/components/global-styles/shadow-utils.js.map +1 -0
- package/build/components/global-styles/shadows-edit-panel.js +458 -0
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -0
- package/build/components/global-styles/shadows-panel.js +128 -0
- package/build/components/global-styles/shadows-panel.js.map +1 -0
- package/build/components/global-styles/style-variations-container.js +67 -18
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/subtitle.js +5 -4
- package/build/components/global-styles/subtitle.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +53 -45
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/typography-example.js +16 -10
- package/build/components/global-styles/typography-example.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +5 -4
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +124 -89
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +28 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +36 -25
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +19 -14
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-panel.js +27 -17
- package/build/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +37 -31
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +5 -1
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/global-styles-sidebar/default-sidebar.js +56 -0
- package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +37 -26
- package/build/components/global-styles-sidebar/index.js.map +1 -0
- package/build/components/layout/index.js +113 -99
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +110 -75
- package/build/components/layout/router.js.map +1 -1
- package/build/components/media/index.js +2 -2
- package/build/components/media/index.js.map +1 -1
- package/build/components/{header-edit-mode/more-menu → more-menu}/index.js +7 -3
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/{header-edit-mode/more-menu → more-menu}/site-export.js +5 -4
- package/build/components/more-menu/site-export.js.map +1 -0
- package/build/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +5 -4
- package/build/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/page/header.js +24 -20
- package/build/components/page/header.js.map +1 -1
- package/build/components/page/index.js +14 -12
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-pages/index.js +136 -66
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +23 -20
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/header.js +47 -32
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +120 -125
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +14 -11
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +7 -6
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +83 -72
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +51 -42
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +4 -2
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +48 -34
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +31 -22
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/routes/link.js +5 -4
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +5 -4
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +12 -11
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +36 -30
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +68 -35
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +4 -4
- package/build/components/sidebar-button/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +56 -48
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +106 -89
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +14 -12
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +48 -0
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +21 -22
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-item/index.js +32 -28
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +56 -70
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +24 -17
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/index.js +9 -7
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +5 -4
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +7 -7
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +5 -4
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +57 -45
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +45 -22
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +5 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +20 -12
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +61 -35
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +10 -8
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +42 -36
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +18 -12
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +36 -22
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +48 -40
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +12 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +12 -10
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +62 -77
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +17 -17
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -5
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +83 -74
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +9 -8
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/style-book/index.js +122 -103
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -30
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/table/index.js +23 -15
- package/build/components/table/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +5 -4
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +23 -17
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +30 -11
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +20 -15
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/image.js +13 -12
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +18 -13
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/styles.js +45 -28
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +18 -13
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +4 -4
- package/build/deprecated.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +12 -24
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +2 -116
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +25 -16
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +7 -3
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/store/private-actions.js +7 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/template-part-create.js +0 -62
- package/build/utils/template-part-create.js.map +1 -1
- package/build/utils/use-activate-theme.js +9 -7
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-page/index.js +34 -27
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +98 -78
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +36 -30
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +121 -95
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/index.js +91 -73
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +36 -17
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +15 -6
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/block-inspector-button.js +5 -4
- package/build-module/components/block-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +80 -0
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -0
- package/build-module/components/canvas-loader/index.js +14 -13
- package/build-module/components/canvas-loader/index.js.map +1 -1
- package/build-module/components/dataviews-actions/index.js +41 -0
- package/build-module/components/dataviews-actions/index.js.map +1 -0
- package/build-module/components/editor/index.js +113 -144
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +29 -30
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +2 -2
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/warning.js +13 -11
- package/build-module/components/error-boundary/warning.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +18 -6
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +19 -17
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +4 -4
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +32 -28
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +2 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +58 -40
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-family-item.js +18 -13
- package/build-module/components/global-styles/font-family-item.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +26 -22
- package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +7 -30
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-card.js +25 -16
- package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +198 -153
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-demo.js +14 -12
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +30 -20
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +42 -36
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +157 -111
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-details.js +18 -14
- package/build-module/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +26 -22
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +42 -35
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +3 -3
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +42 -38
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +38 -28
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/highlighted-colors.js +3 -4
- package/build-module/components/global-styles/highlighted-colors.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +11 -20
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +4 -4
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +16 -11
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +42 -34
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preset-colors.js +21 -0
- package/build-module/components/global-styles/preset-colors.js.map +1 -0
- package/build-module/components/global-styles/preview-colors.js +23 -25
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/preview-iframe.js +36 -29
- package/build-module/components/global-styles/preview-iframe.js.map +1 -1
- package/build-module/components/global-styles/preview-styles.js +96 -90
- package/build-module/components/global-styles/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +31 -22
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-background.js +8 -4
- package/build-module/components/global-styles/screen-background.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +35 -27
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +64 -53
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +31 -19
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +20 -17
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +22 -14
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +11 -4
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +54 -42
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +83 -71
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +78 -42
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-shadows.js +13 -0
- package/build-module/components/global-styles/screen-shadows.js.map +1 -0
- package/build-module/components/global-styles/screen-style-variations.js +16 -9
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +52 -45
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +17 -11
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-utils.js +221 -0
- package/build-module/components/global-styles/shadow-utils.js.map +1 -0
- package/build-module/components/global-styles/shadows-edit-panel.js +452 -0
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -0
- package/build-module/components/global-styles/shadows-panel.js +121 -0
- package/build-module/components/global-styles/shadows-panel.js.map +1 -0
- package/build-module/components/global-styles/style-variations-container.js +68 -19
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/subtitle.js +5 -4
- package/build-module/components/global-styles/subtitle.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +54 -45
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/typography-example.js +16 -9
- package/build-module/components/global-styles/typography-example.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +2 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +5 -4
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +126 -89
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +27 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +35 -24
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +21 -15
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-panel.js +28 -18
- package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +38 -31
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +5 -1
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js +51 -0
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +38 -26
- package/build-module/components/global-styles-sidebar/index.js.map +1 -0
- package/build-module/components/layout/index.js +116 -100
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +110 -76
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/media/index.js +2 -2
- package/build-module/components/media/index.js.map +1 -1
- package/build-module/components/{header-edit-mode/more-menu → more-menu}/index.js +9 -3
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/{header-edit-mode/more-menu → more-menu}/site-export.js +5 -4
- package/build-module/components/more-menu/site-export.js.map +1 -0
- package/build-module/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +5 -4
- package/build-module/components/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/page/header.js +25 -19
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page/index.js +16 -13
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +141 -69
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +25 -20
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/header.js +48 -32
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +121 -125
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +16 -11
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +7 -6
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +85 -72
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +52 -42
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +4 -2
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +51 -35
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +31 -21
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -4
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +12 -11
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +37 -30
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +69 -36
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +4 -4
- package/build-module/components/sidebar-button/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +58 -48
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +108 -89
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +15 -12
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +49 -1
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +23 -22
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-item/index.js +33 -28
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +58 -70
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +25 -17
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +10 -7
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +5 -4
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +7 -7
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +5 -4
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +59 -45
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +47 -22
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +5 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +20 -12
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +63 -35
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +10 -8
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +43 -36
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +19 -12
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +36 -22
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +50 -40
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +12 -10
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +64 -77
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +18 -17
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +8 -5
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +85 -75
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +9 -8
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/style-book/index.js +122 -102
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -30
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/table/index.js +24 -15
- package/build-module/components/table/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +5 -4
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +25 -16
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +30 -11
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +22 -15
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/image.js +14 -12
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +6 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +20 -13
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +47 -28
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +20 -13
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +4 -4
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +12 -23
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -118
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +27 -16
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +6 -2
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +3 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/private-actions.js +7 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/template-part-create.js +0 -52
- package/build-module/utils/template-part-create.js.map +1 -1
- package/build-module/utils/use-activate-theme.js +9 -7
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +486 -981
- package/build-style/style.css +486 -981
- package/package.json +44 -47
- package/src/components/add-new-pattern/index.js +46 -37
- package/src/components/add-new-template/index.js +4 -2
- package/src/components/add-new-template/utils.js +77 -39
- package/src/components/app/index.js +5 -2
- package/src/components/block-editor/style.scss +4 -139
- package/src/components/block-editor/use-editor-iframe-props.js +79 -0
- package/src/components/canvas-loader/index.js +5 -2
- package/src/components/dataviews-actions/index.js +43 -0
- package/src/components/editor/index.js +129 -215
- package/src/components/editor/style.scss +2 -17
- package/src/components/editor-canvas-container/index.js +30 -35
- package/src/components/editor-canvas-container/style.scss +16 -0
- package/src/components/global-styles/background-panel.js +20 -4
- package/src/components/global-styles/color-indicator-wrapper.js +2 -2
- package/src/components/global-styles/color-palette-panel.js +3 -4
- package/src/components/global-styles/font-families.js +25 -18
- package/src/components/global-styles/font-family-item.js +2 -2
- package/src/components/global-styles/font-library-modal/collection-font-variant.js +2 -1
- package/src/components/global-styles/font-library-modal/context.js +6 -44
- package/src/components/global-styles/font-library-modal/font-collection.js +3 -5
- package/src/components/global-styles/font-library-modal/installed-fonts.js +42 -12
- package/src/components/global-styles/font-library-modal/library-font-variant.js +2 -1
- package/src/components/global-styles/font-library-modal/upload-fonts.js +1 -4
- package/src/components/global-styles/font-library-modal/utils/index.js +1 -1
- package/src/components/global-styles/gradients-palette-panel.js +1 -4
- package/src/components/global-styles/hooks.js +10 -36
- package/src/components/global-styles/icon-with-current-color.js +2 -2
- package/src/components/global-styles/palette.js +9 -18
- package/src/components/global-styles/preset-colors.js +18 -0
- package/src/components/global-styles/preview-colors.js +4 -7
- package/src/components/global-styles/root-menu.js +16 -12
- package/src/components/global-styles/screen-block.js +1 -1
- package/src/components/global-styles/screen-color-palette.js +4 -4
- package/src/components/global-styles/screen-colors.js +0 -2
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-revisions/index.js +6 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +1 -0
- package/src/components/global-styles/screen-shadows.js +13 -0
- package/src/components/global-styles/screen-typography.js +1 -1
- package/src/components/global-styles/shadow-utils.js +158 -0
- package/src/components/global-styles/shadows-edit-panel.js +555 -0
- package/src/components/global-styles/shadows-panel.js +147 -0
- package/src/components/global-styles/stories/index.story.js +2 -1
- package/src/components/global-styles/style-variations-container.js +73 -10
- package/src/components/global-styles/style.scss +54 -5
- package/src/components/global-styles/test/shadow-utils.spec.js +251 -0
- package/src/components/global-styles/test/utils.spec.js +59 -0
- package/src/components/global-styles/typography-example.js +2 -1
- package/src/components/global-styles/ui.js +15 -7
- package/src/components/global-styles/utils.js +27 -0
- package/src/components/global-styles/variations/style.scss +17 -30
- package/src/components/global-styles/variations/variation.js +15 -10
- package/src/components/global-styles/variations/variations-color.js +7 -9
- package/src/components/global-styles/variations/variations-panel.js +16 -5
- package/src/components/global-styles/variations/variations-typography.js +2 -1
- package/src/components/global-styles-renderer/index.js +7 -1
- package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
- package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
- package/src/components/layout/index.js +10 -10
- package/src/components/layout/router.js +96 -61
- package/src/components/layout/style.scss +10 -6
- package/src/components/{header-edit-mode/more-menu → more-menu}/index.js +1 -1
- package/src/components/page/header.js +17 -13
- package/src/components/page/index.js +3 -7
- package/src/components/page/style.scss +21 -7
- package/src/components/page-pages/index.js +162 -68
- package/src/components/page-pages/style.scss +14 -10
- package/src/components/page-patterns/delete-category-menu-item.js +1 -2
- package/src/components/page-patterns/header.js +45 -33
- package/src/components/page-patterns/index.js +25 -81
- package/src/components/page-patterns/style.scss +21 -14
- package/src/components/page-patterns/use-patterns.js +13 -6
- package/src/components/page-templates/index.js +10 -29
- package/src/components/pagination/index.js +2 -2
- package/src/components/resizable-frame/index.js +17 -5
- package/src/components/revisions/index.js +2 -1
- package/src/components/save-panel/index.js +5 -7
- package/src/components/sidebar/index.js +61 -37
- package/src/components/sidebar-button/index.js +2 -5
- package/src/components/sidebar-dataviews/add-new-view.js +5 -5
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +5 -7
- package/src/components/sidebar-dataviews/dataview-item.js +6 -9
- package/src/components/sidebar-dataviews/default-views.js +61 -1
- package/src/components/sidebar-dataviews/index.js +4 -9
- package/src/components/sidebar-navigation-item/index.js +10 -10
- package/src/components/sidebar-navigation-screen/index.js +7 -31
- package/src/components/sidebar-navigation-screen/style.scss +11 -9
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +10 -3
- package/src/components/sidebar-navigation-screen-main/index.js +14 -4
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +6 -13
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -61
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -3
- package/src/components/sidebar-navigation-screen-patterns/index.js +8 -29
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +3 -2
- package/src/components/site-hub/index.js +14 -15
- package/src/components/site-hub/style.scss +46 -9
- package/src/components/site-icon/index.js +2 -2
- package/src/components/style-book/index.js +8 -7
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +18 -23
- package/src/components/template-part-converter/convert-to-template-part.js +4 -1
- package/src/components/template-part-converter/index.js +16 -3
- package/src/hooks/commands/use-common-commands.js +12 -23
- package/src/hooks/commands/use-edit-mode-commands.js +4 -118
- package/src/hooks/index.js +0 -1
- package/src/hooks/push-changes-to-global-styles/index.js +2 -1
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +7 -2
- package/src/index.js +1 -1
- package/src/store/private-actions.js +9 -1
- package/src/store/selectors.js +2 -2
- package/src/style.scss +1 -17
- package/src/utils/template-part-create.js +0 -67
- package/src/utils/use-activate-theme.js +5 -5
- package/build/components/block-editor/editor-canvas.js +0 -153
- package/build/components/block-editor/editor-canvas.js.map +0 -1
- package/build/components/block-editor/resizable-editor.js +0 -86
- package/build/components/block-editor/resizable-editor.js.map +0 -1
- package/build/components/block-editor/resize-handle.js +0 -57
- package/build/components/block-editor/resize-handle.js.map +0 -1
- package/build/components/block-editor/site-editor-canvas.js +0 -95
- package/build/components/block-editor/site-editor-canvas.js.map +0 -1
- package/build/components/code-editor/index.js +0 -111
- package/build/components/code-editor/index.js.map +0 -1
- package/build/components/create-template-part-modal/index.js +0 -151
- package/build/components/create-template-part-modal/index.js.map +0 -1
- package/build/components/global-styles/global-styles-provider.js +0 -129
- package/build/components/global-styles/global-styles-provider.js.map +0 -1
- package/build/components/header-edit-mode/document-tools/index.js +0 -68
- package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build/components/header-edit-mode/index.js +0 -150
- package/build/components/header-edit-mode/index.js.map +0 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +0 -1
- package/build/components/header-edit-mode/more-menu/site-export.js.map +0 -1
- package/build/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +0 -387
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +0 -1
- package/build/components/pattern-modal/duplicate.js +0 -70
- package/build/components/pattern-modal/duplicate.js.map +0 -1
- package/build/components/pattern-modal/index.js +0 -23
- package/build/components/pattern-modal/index.js.map +0 -1
- package/build/components/pattern-modal/rename.js +0 -45
- package/build/components/pattern-modal/rename.js.map +0 -1
- package/build/components/rename-post-menu-item/index.js +0 -109
- package/build/components/rename-post-menu-item/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +0 -52
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/index.js +0 -147
- package/build/components/sidebar-edit-mode/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +0 -129
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -46
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +0 -127
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-page/index.js +0 -163
- package/build/components/sidebar-navigation-screen-page/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +0 -127
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +0 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +0 -65
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +0 -72
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -38
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -29
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -37
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -45
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -88
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -29
- package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -138
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +0 -1
- package/build/components/sidebar-navigation-screen-template/home-template-details.js +0 -110
- package/build/components/sidebar-navigation-screen-template/home-template-details.js.map +0 -1
- package/build/components/sidebar-navigation-screen-template/index.js +0 -118
- package/build/components/sidebar-navigation-screen-template/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-template/template-areas.js +0 -117
- package/build/components/sidebar-navigation-screen-template/template-areas.js.map +0 -1
- package/build/components/start-template-options/index.js +0 -191
- package/build/components/start-template-options/index.js.map +0 -1
- package/build/components/template-actions/index.js +0 -131
- package/build/components/template-actions/index.js.map +0 -1
- package/build/hooks/components.js +0 -10
- package/build/hooks/components.js.map +0 -1
- package/build/utils/get-is-list-page.js +0 -28
- package/build/utils/get-is-list-page.js.map +0 -1
- package/build/utils/math.js +0 -98
- package/build/utils/math.js.map +0 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -145
- package/build-module/components/block-editor/editor-canvas.js.map +0 -1
- package/build-module/components/block-editor/resizable-editor.js +0 -79
- package/build-module/components/block-editor/resizable-editor.js.map +0 -1
- package/build-module/components/block-editor/resize-handle.js +0 -50
- package/build-module/components/block-editor/resize-handle.js.map +0 -1
- package/build-module/components/block-editor/site-editor-canvas.js +0 -86
- package/build-module/components/block-editor/site-editor-canvas.js.map +0 -1
- package/build-module/components/code-editor/index.js +0 -103
- package/build-module/components/code-editor/index.js.map +0 -1
- package/build-module/components/create-template-part-modal/index.js +0 -143
- package/build-module/components/create-template-part-modal/index.js.map +0 -1
- package/build-module/components/global-styles/global-styles-provider.js +0 -120
- package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
- package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build-module/components/header-edit-mode/index.js +0 -142
- package/build-module/components/header-edit-mode/index.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/site-export.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/welcome-guide-menu-item.js.map +0 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +0 -380
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +0 -1
- package/build-module/components/pattern-modal/duplicate.js +0 -62
- package/build-module/components/pattern-modal/duplicate.js.map +0 -1
- package/build-module/components/pattern-modal/index.js +0 -14
- package/build-module/components/pattern-modal/index.js.map +0 -1
- package/build-module/components/pattern-modal/rename.js +0 -37
- package/build-module/components/pattern-modal/rename.js.map +0 -1
- package/build-module/components/rename-post-menu-item/index.js +0 -102
- package/build-module/components/rename-post-menu-item/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +0 -45
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/index.js +0 -138
- package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -121
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -119
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +0 -155
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +0 -120
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +0 -57
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +0 -64
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -30
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -20
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -29
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -36
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -80
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -22
- package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -130
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js +0 -103
- package/build-module/components/sidebar-navigation-screen-template/home-template-details.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +0 -110
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js +0 -109
- package/build-module/components/sidebar-navigation-screen-template/template-areas.js.map +0 -1
- package/build-module/components/start-template-options/index.js +0 -184
- package/build-module/components/start-template-options/index.js.map +0 -1
- package/build-module/components/template-actions/index.js +0 -123
- package/build-module/components/template-actions/index.js.map +0 -1
- package/build-module/hooks/components.js +0 -7
- package/build-module/hooks/components.js.map +0 -1
- package/build-module/utils/get-is-list-page.js +0 -22
- package/build-module/utils/get-is-list-page.js.map +0 -1
- package/build-module/utils/math.js +0 -92
- package/build-module/utils/math.js.map +0 -1
- package/src/components/block-editor/editor-canvas.js +0 -178
- package/src/components/block-editor/resizable-editor.js +0 -82
- package/src/components/block-editor/resize-handle.js +0 -66
- package/src/components/block-editor/site-editor-canvas.js +0 -107
- package/src/components/code-editor/index.js +0 -94
- package/src/components/code-editor/style.scss +0 -95
- package/src/components/create-template-part-modal/index.js +0 -199
- package/src/components/create-template-part-modal/style.scss +0 -69
- package/src/components/global-styles/global-styles-provider.js +0 -162
- package/src/components/header-edit-mode/document-tools/index.js +0 -68
- package/src/components/header-edit-mode/index.js +0 -190
- package/src/components/header-edit-mode/style.scss +0 -201
- package/src/components/page-patterns/dataviews-pattern-actions.js +0 -439
- package/src/components/pattern-modal/duplicate.js +0 -55
- package/src/components/pattern-modal/index.js +0 -19
- package/src/components/pattern-modal/rename.js +0 -30
- package/src/components/rename-post-menu-item/index.js +0 -138
- package/src/components/sidebar-edit-mode/index.js +0 -173
- package/src/components/sidebar-edit-mode/page-panels/index.js +0 -133
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -61
- package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
- package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
- package/src/components/sidebar-edit-mode/template-panel/index.js +0 -134
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
- package/src/components/sidebar-navigation-screen-page/index.js +0 -204
- package/src/components/sidebar-navigation-screen-page/page-details.js +0 -161
- package/src/components/sidebar-navigation-screen-page/status-label.js +0 -71
- package/src/components/sidebar-navigation-screen-page/style.scss +0 -69
- package/src/components/sidebar-navigation-screen-pattern/index.js +0 -63
- package/src/components/sidebar-navigation-screen-pattern/style.scss +0 -26
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list-item.js +0 -31
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu-list.js +0 -21
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +0 -33
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +0 -36
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +0 -98
- package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-title.js +0 -32
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +0 -205
- package/src/components/sidebar-navigation-screen-template/home-template-details.js +0 -144
- package/src/components/sidebar-navigation-screen-template/index.js +0 -133
- package/src/components/sidebar-navigation-screen-template/style.scss +0 -53
- package/src/components/sidebar-navigation-screen-template/template-areas.js +0 -135
- package/src/components/start-template-options/index.js +0 -231
- package/src/components/start-template-options/style.scss +0 -55
- package/src/components/template-actions/index.js +0 -165
- package/src/hooks/components.js +0 -11
- package/src/utils/get-is-list-page.js +0 -25
- package/src/utils/math.js +0 -93
- package/src/utils/test/template-part-create.js +0 -63
- /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
- /package/src/components/{header-edit-mode/more-menu → more-menu}/site-export.js +0 -0
- /package/src/components/{header-edit-mode/more-menu → more-menu}/welcome-guide-menu-item.js +0 -0
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.FontLibraryContext = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _element = require("@wordpress/element");
|
|
10
9
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
10
|
var _data = require("@wordpress/data");
|
|
@@ -16,6 +15,7 @@ var _lockUnlock = require("../../../lock-unlock");
|
|
|
16
15
|
var _utils = require("./utils");
|
|
17
16
|
var _toggleFont = require("./utils/toggleFont");
|
|
18
17
|
var _setNestedValue = _interopRequireDefault(require("../../../utils/set-nested-value"));
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
19
|
/**
|
|
20
20
|
* WordPress dependencies
|
|
21
21
|
*/
|
|
@@ -45,7 +45,6 @@ function FontLibraryProvider({
|
|
|
45
45
|
};
|
|
46
46
|
});
|
|
47
47
|
const globalStyles = (0, _coreData.useEntityRecord)('root', 'globalStyles', globalStylesId);
|
|
48
|
-
const fontFamiliesHasChanges = !!globalStyles?.edits?.settings?.typography?.fontFamilies;
|
|
49
48
|
const [isInstalling, setIsInstalling] = (0, _element.useState)(false);
|
|
50
49
|
const [refreshKey, setRefreshKey] = (0, _element.useState)(0);
|
|
51
50
|
const [notice, setNotice] = (0, _element.useState)(null);
|
|
@@ -54,8 +53,7 @@ function FontLibraryProvider({
|
|
|
54
53
|
};
|
|
55
54
|
const {
|
|
56
55
|
records: libraryPosts = [],
|
|
57
|
-
isResolving: isResolvingLibrary
|
|
58
|
-
hasResolved: hasResolvedLibrary
|
|
56
|
+
isResolving: isResolvingLibrary
|
|
59
57
|
} = (0, _coreData.useEntityRecords)('postType', 'wp_font_family', {
|
|
60
58
|
refreshKey,
|
|
61
59
|
_embed: true
|
|
@@ -70,8 +68,6 @@ function FontLibraryProvider({
|
|
|
70
68
|
|
|
71
69
|
// Global Styles (settings) font families
|
|
72
70
|
const [fontFamilies, setFontFamilies] = useGlobalSetting('typography.fontFamilies');
|
|
73
|
-
// theme.json file font families
|
|
74
|
-
const [baseFontFamilies] = useGlobalSetting('typography.fontFamilies', undefined, 'base');
|
|
75
71
|
|
|
76
72
|
/*
|
|
77
73
|
* Save the font families to the database.
|
|
@@ -102,18 +98,6 @@ function FontLibraryProvider({
|
|
|
102
98
|
const themeFonts = fontFamilies?.theme ? fontFamilies.theme.map(f => (0, _utils.setUIValuesNeeded)(f, {
|
|
103
99
|
source: 'theme'
|
|
104
100
|
})).sort((a, b) => a.name.localeCompare(b.name)) : [];
|
|
105
|
-
const themeFontsSlugs = new Set(themeFonts.map(f => f.slug));
|
|
106
|
-
|
|
107
|
-
/*
|
|
108
|
-
* Base Theme Fonts are the fonts defined in the theme.json *file*.
|
|
109
|
-
*
|
|
110
|
-
* Uses the fonts from global styles + the ones from the theme.json file that hasn't repeated slugs.
|
|
111
|
-
* Avoids inconsistencies with the fonts listed in the font library modal as base (inactivated).
|
|
112
|
-
* These inconsistencies can happen when the active theme fonts in global styles aren't defined in theme.json file as when a theme style variation is applied.
|
|
113
|
-
*/
|
|
114
|
-
const baseThemeFonts = baseFontFamilies?.theme ? themeFonts.concat(baseFontFamilies.theme.filter(f => !themeFontsSlugs.has(f.slug)).map(f => (0, _utils.setUIValuesNeeded)(f, {
|
|
115
|
-
source: 'theme'
|
|
116
|
-
})).sort((a, b) => a.name.localeCompare(b.name))) : [];
|
|
117
101
|
const customFonts = fontFamilies?.custom ? fontFamilies.custom.map(f => (0, _utils.setUIValuesNeeded)(f, {
|
|
118
102
|
source: 'custom'
|
|
119
103
|
})).sort((a, b) => a.name.localeCompare(b.name)) : [];
|
|
@@ -143,9 +127,6 @@ function FontLibraryProvider({
|
|
|
143
127
|
source: font.source
|
|
144
128
|
});
|
|
145
129
|
};
|
|
146
|
-
const toggleModal = tabName => {
|
|
147
|
-
setModalTabOpen(tabName || null);
|
|
148
|
-
};
|
|
149
130
|
|
|
150
131
|
// Demo
|
|
151
132
|
const [loadedFontUrls] = (0, _element.useState)(new Set());
|
|
@@ -393,14 +374,11 @@ function FontLibraryProvider({
|
|
|
393
374
|
(0, _element.useEffect)(() => {
|
|
394
375
|
getFontCollections();
|
|
395
376
|
}, []);
|
|
396
|
-
return (0,
|
|
377
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FontLibraryContext.Provider, {
|
|
397
378
|
value: {
|
|
398
379
|
libraryFontSelected,
|
|
399
380
|
handleSetLibraryFontSelected,
|
|
400
381
|
fontFamilies,
|
|
401
|
-
themeFonts,
|
|
402
|
-
baseThemeFonts,
|
|
403
|
-
customFonts,
|
|
404
382
|
baseCustomFonts,
|
|
405
383
|
isFontActivated,
|
|
406
384
|
getFontFacesActivated,
|
|
@@ -410,19 +388,18 @@ function FontLibraryProvider({
|
|
|
410
388
|
toggleActivateFont,
|
|
411
389
|
getAvailableFontsOutline,
|
|
412
390
|
modalTabOpen,
|
|
413
|
-
|
|
391
|
+
setModalTabOpen,
|
|
414
392
|
refreshLibrary,
|
|
415
393
|
notice,
|
|
416
394
|
setNotice,
|
|
417
395
|
saveFontFamilies,
|
|
418
|
-
fontFamiliesHasChanges,
|
|
419
396
|
isResolvingLibrary,
|
|
420
|
-
hasResolvedLibrary,
|
|
421
397
|
isInstalling,
|
|
422
398
|
collections,
|
|
423
399
|
getFontCollection
|
|
424
|
-
}
|
|
425
|
-
|
|
400
|
+
},
|
|
401
|
+
children: children
|
|
402
|
+
});
|
|
426
403
|
}
|
|
427
404
|
var _default = exports.default = FontLibraryProvider;
|
|
428
405
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_blockEditor","_data","_coreData","_i18n","_resolvers","_lockUnlock","_utils","_toggleFont","_setNestedValue","_interopRequireDefault","useGlobalSetting","unlock","blockEditorPrivateApis","FontLibraryContext","exports","createContext","FontLibraryProvider","children","saveEntityRecord","useDispatch","coreStore","globalStylesId","useSelect","select","__experimentalGetCurrentGlobalStylesId","globalStyles","useEntityRecord","fontFamiliesHasChanges","edits","settings","typography","fontFamilies","isInstalling","setIsInstalling","useState","refreshKey","setRefreshKey","notice","setNotice","refreshLibrary","Date","now","records","libraryPosts","isResolving","isResolvingLibrary","hasResolved","hasResolvedLibrary","useEntityRecords","_embed","libraryFonts","map","fontFamilyPost","id","font_family_settings","fontFace","_embedded","font_faces","face","font_face_settings","setFontFamilies","baseFontFamilies","undefined","saveFontFamilies","fonts","updatedGlobalStyles","record","setNestedValue","modalTabOpen","setModalTabOpen","libraryFontSelected","setLibraryFontSelected","themeFonts","theme","f","setUIValuesNeeded","source","sort","a","b","name","localeCompare","themeFontsSlugs","Set","slug","baseThemeFonts","concat","filter","has","customFonts","custom","baseCustomFonts","useEffect","handleSetLibraryFontSelected","font","fontSelected","find","toggleModal","tabName","loadedFontUrls","getAvailableFontsOutline","availableFontFamilies","outline","reduce","acc","availableFontFaces","length","fontStyle","fontWeight","getActivatedFontsOutline","isFontActivated","style","weight","includes","getFontFacesActivated","installFonts","fontFamiliesToInstall","fontFamiliesToActivate","installationErrors","fontFamilyToInstall","isANewFontFamily","installedFontFamily","fetchGetFontFamilyBySlug","fetchInstallFontFamily","makeFontFamilyFormData","alreadyInstalledFontFaces","fontFaceToInstall","checkFontFaceInstalled","successfullyInstalledFontFaces","unsuccessfullyInstalledFontFaces","response","batchInstallFontFaces","makeFontFacesFormData","successes","errors","push","fetchUninstallFontFamily","unique","item","message","activeFonts","activateCustomFontFamilies","installError","Error","__","uninstallFontFamily","fontFamilyToUninstall","uninstalledFontFamily","deleted","deactivateFontFamily","error","console","_fontFamilies$font$so","initialCustomFonts","newCustomFonts","forEach","unloadFontFaceInBrowser","fontsToAdd","fontsToActivate","cleanFontsForSave","mergeFontFamilies","loadFontsInBrowser","_familyDbId","_faceDbId","loadFontFaceInBrowser","getDisplaySrcFromFontFace","src","toggleActivateFont","_fontFamilies$font$so2","initialFonts","newFonts","toggleFont","isFaceActivated","loadFontFaceAsset","add","collections","setFontCollections","getFontCollections","fetchFontCollections","getFontCollection","hasData","collection","font_families","fetchFontCollection","updatedCollections","e","_react","createElement","Provider","value","_default","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useState, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseEntityRecord,\n\tuseEntityRecords,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tfetchGetFontFamilyBySlug,\n\tfetchInstallFontFamily,\n\tfetchUninstallFontFamily,\n\tfetchFontCollections,\n\tfetchFontCollection,\n} from './resolvers';\nimport { unlock } from '../../../lock-unlock';\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\nimport {\n\tsetUIValuesNeeded,\n\tmergeFontFamilies,\n\tloadFontFaceInBrowser,\n\tunloadFontFaceInBrowser,\n\tgetDisplaySrcFromFontFace,\n\tmakeFontFacesFormData,\n\tmakeFontFamilyFormData,\n\tbatchInstallFontFaces,\n\tcheckFontFaceInstalled,\n} from './utils';\nimport { toggleFont } from './utils/toggleFont';\nimport setNestedValue from '../../../utils/set-nested-value';\n\nexport const FontLibraryContext = createContext( {} );\n\nfunction FontLibraryProvider( { children } ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { globalStylesId } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentGlobalStylesId } = select( coreStore );\n\t\treturn { globalStylesId: __experimentalGetCurrentGlobalStylesId() };\n\t} );\n\n\tconst globalStyles = useEntityRecord(\n\t\t'root',\n\t\t'globalStyles',\n\t\tglobalStylesId\n\t);\n\tconst fontFamiliesHasChanges =\n\t\t!! globalStyles?.edits?.settings?.typography?.fontFamilies;\n\n\tconst [ isInstalling, setIsInstalling ] = useState( false );\n\tconst [ refreshKey, setRefreshKey ] = useState( 0 );\n\tconst [ notice, setNotice ] = useState( null );\n\n\tconst refreshLibrary = () => {\n\t\tsetRefreshKey( Date.now() );\n\t};\n\n\tconst {\n\t\trecords: libraryPosts = [],\n\t\tisResolving: isResolvingLibrary,\n\t\thasResolved: hasResolvedLibrary,\n\t} = useEntityRecords( 'postType', 'wp_font_family', {\n\t\trefreshKey,\n\t\t_embed: true,\n\t} );\n\n\tconst libraryFonts =\n\t\t( libraryPosts || [] ).map( ( fontFamilyPost ) => {\n\t\t\treturn {\n\t\t\t\tid: fontFamilyPost.id,\n\t\t\t\t...fontFamilyPost.font_family_settings,\n\t\t\t\tfontFace:\n\t\t\t\t\tfontFamilyPost?._embedded?.font_faces.map(\n\t\t\t\t\t\t( face ) => face.font_face_settings\n\t\t\t\t\t) || [],\n\t\t\t};\n\t\t} ) || [];\n\n\t// Global Styles (settings) font families\n\tconst [ fontFamilies, setFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies'\n\t);\n\t// theme.json file font families\n\tconst [ baseFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies',\n\t\tundefined,\n\t\t'base'\n\t);\n\n\t/*\n\t * Save the font families to the database.\n\n\t * This function is called when the user activates or deactivates a font family.\n\t * It only updates the global styles post content in the database for new font families.\n\t * This avoids saving other styles/settings changed by the user using other parts of the editor.\n\t *\n\t * It uses the font families from the param to avoid using the font families from an outdated state.\n\t *\n\t * @param {Array} fonts - The font families that will be saved to the database.\n\t */\n\tconst saveFontFamilies = async ( fonts ) => {\n\t\t// Gets the global styles database post content.\n\t\tconst updatedGlobalStyles = globalStyles.record;\n\n\t\t// Updates the database version of global styles with the edited font families in the client.\n\t\tsetNestedValue(\n\t\t\tupdatedGlobalStyles,\n\t\t\t[ 'settings', 'typography', 'fontFamilies' ],\n\t\t\tfonts\n\t\t);\n\n\t\t// Saves a new version of the global styles in the database.\n\t\tawait saveEntityRecord( 'root', 'globalStyles', updatedGlobalStyles );\n\t};\n\n\t// Library Fonts\n\tconst [ modalTabOpen, setModalTabOpen ] = useState( false );\n\tconst [ libraryFontSelected, setLibraryFontSelected ] = useState( null );\n\n\t// Themes Fonts are the fonts defined in the global styles (database persisted theme.json data).\n\tconst themeFonts = fontFamilies?.theme\n\t\t? fontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst themeFontsSlugs = new Set( themeFonts.map( ( f ) => f.slug ) );\n\n\t/*\n\t * Base Theme Fonts are the fonts defined in the theme.json *file*.\n\t *\n\t * Uses the fonts from global styles + the ones from the theme.json file that hasn't repeated slugs.\n\t * Avoids inconsistencies with the fonts listed in the font library modal as base (inactivated).\n\t * These inconsistencies can happen when the active theme fonts in global styles aren't defined in theme.json file as when a theme style variation is applied.\n\t */\n\tconst baseThemeFonts = baseFontFamilies?.theme\n\t\t? themeFonts.concat(\n\t\t\t\tbaseFontFamilies.theme\n\t\t\t\t\t.filter( ( f ) => ! themeFontsSlugs.has( f.slug ) )\n\t\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t )\n\t\t: [];\n\n\tconst customFonts = fontFamilies?.custom\n\t\t? fontFamilies.custom\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst baseCustomFonts = libraryFonts\n\t\t? libraryFonts\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tuseEffect( () => {\n\t\tif ( ! modalTabOpen ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t}\n\t}, [ modalTabOpen ] );\n\n\tconst handleSetLibraryFontSelected = ( font ) => {\n\t\tsetNotice( null );\n\n\t\t// If font is null, reset the selected font\n\t\tif ( ! font ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst fonts = font.source === 'theme' ? themeFonts : baseCustomFonts;\n\n\t\t// Tries to find the font in the installed fonts\n\t\tconst fontSelected = fonts.find( ( f ) => f.slug === font.slug );\n\t\t// If the font is not found (it is only defined in custom styles), use the font from custom styles\n\t\tsetLibraryFontSelected( {\n\t\t\t...( fontSelected || font ),\n\t\t\tsource: font.source,\n\t\t} );\n\t};\n\n\tconst toggleModal = ( tabName ) => {\n\t\tsetModalTabOpen( tabName || null );\n\t};\n\n\t// Demo\n\tconst [ loadedFontUrls ] = useState( new Set() );\n\n\tconst getAvailableFontsOutline = ( availableFontFamilies ) => {\n\t\tconst outline = availableFontFamilies.reduce( ( acc, font ) => {\n\t\t\tconst availableFontFaces =\n\t\t\t\tfont?.fontFace && font.fontFace?.length > 0\n\t\t\t\t\t? font?.fontFace.map(\n\t\t\t\t\t\t\t( face ) => `${ face.fontStyle + face.fontWeight }`\n\t\t\t\t\t )\n\t\t\t\t\t: [ 'normal400' ]; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400\n\n\t\t\tacc[ font.slug ] = availableFontFaces;\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn outline;\n\t};\n\n\tconst getActivatedFontsOutline = ( source ) => {\n\t\tswitch ( source ) {\n\t\t\tcase 'theme':\n\t\t\t\treturn getAvailableFontsOutline( themeFonts );\n\t\t\tcase 'custom':\n\t\t\tdefault:\n\t\t\t\treturn getAvailableFontsOutline( customFonts );\n\t\t}\n\t};\n\n\tconst isFontActivated = ( slug, style, weight, source ) => {\n\t\tif ( ! style && ! weight ) {\n\t\t\treturn !! getActivatedFontsOutline( source )[ slug ];\n\t\t}\n\t\treturn !! getActivatedFontsOutline( source )[ slug ]?.includes(\n\t\t\tstyle + weight\n\t\t);\n\t};\n\n\tconst getFontFacesActivated = ( slug, source ) => {\n\t\treturn getActivatedFontsOutline( source )[ slug ] || [];\n\t};\n\n\tasync function installFonts( fontFamiliesToInstall ) {\n\t\tsetIsInstalling( true );\n\t\ttry {\n\t\t\tconst fontFamiliesToActivate = [];\n\t\t\tlet installationErrors = [];\n\n\t\t\tfor ( const fontFamilyToInstall of fontFamiliesToInstall ) {\n\t\t\t\tlet isANewFontFamily = false;\n\n\t\t\t\t// Get the font family if it already exists.\n\t\t\t\tlet installedFontFamily = await fetchGetFontFamilyBySlug(\n\t\t\t\t\tfontFamilyToInstall.slug\n\t\t\t\t);\n\n\t\t\t\t// Otherwise create it.\n\t\t\t\tif ( ! installedFontFamily ) {\n\t\t\t\t\tisANewFontFamily = true;\n\t\t\t\t\t// Prepare font family form data to install.\n\t\t\t\t\tinstalledFontFamily = await fetchInstallFontFamily(\n\t\t\t\t\t\tmakeFontFamilyFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Collect font faces that have already been installed (to be activated later)\n\t\t\t\tconst alreadyInstalledFontFaces =\n\t\t\t\t\tinstalledFontFamily.fontFace && fontFamilyToInstall.fontFace\n\t\t\t\t\t\t? installedFontFamily.fontFace.filter(\n\t\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t\tcheckFontFaceInstalled(\n\t\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: [];\n\n\t\t\t\t// Filter out Font Faces that have already been installed (so that they are not re-installed)\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily.fontFace &&\n\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t) {\n\t\t\t\t\tfontFamilyToInstall.fontFace =\n\t\t\t\t\t\tfontFamilyToInstall.fontFace.filter(\n\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t! checkFontFaceInstalled(\n\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\tinstalledFontFamily.fontFace\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Install the fonts (upload the font files to the server and create the post in the database).\n\t\t\t\tlet successfullyInstalledFontFaces = [];\n\t\t\t\tlet unsuccessfullyInstalledFontFaces = [];\n\t\t\t\tif ( fontFamilyToInstall?.fontFace?.length > 0 ) {\n\t\t\t\t\tconst response = await batchInstallFontFaces(\n\t\t\t\t\t\tinstalledFontFamily.id,\n\t\t\t\t\t\tmakeFontFacesFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t\tsuccessfullyInstalledFontFaces = response?.successes;\n\t\t\t\t\tunsuccessfullyInstalledFontFaces = response?.errors;\n\t\t\t\t}\n\n\t\t\t\t// Use the successfully installed font faces\n\t\t\t\t// As well as any font faces that were already installed (those will be activated)\n\t\t\t\tif (\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length > 0 ||\n\t\t\t\t\talreadyInstalledFontFaces?.length > 0\n\t\t\t\t) {\n\t\t\t\t\t// Use font data from REST API not from client to ensure\n\t\t\t\t\t// correct font information is used.\n\t\t\t\t\tinstalledFontFamily.fontFace = [\n\t\t\t\t\t\t...successfullyInstalledFontFaces,\n\t\t\t\t\t];\n\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If it's a system font but was installed successfully, activate it.\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily &&\n\t\t\t\t\t! fontFamilyToInstall?.fontFace?.length\n\t\t\t\t) {\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If the font family is new and is not a system font, delete it to avoid having font families without font faces.\n\t\t\t\tif (\n\t\t\t\t\tisANewFontFamily &&\n\t\t\t\t\tfontFamilyToInstall?.fontFace?.length > 0 &&\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length === 0\n\t\t\t\t) {\n\t\t\t\t\tawait fetchUninstallFontFamily( installedFontFamily.id );\n\t\t\t\t}\n\n\t\t\t\tinstallationErrors = installationErrors.concat(\n\t\t\t\t\tunsuccessfullyInstalledFontFaces\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tinstallationErrors = installationErrors.reduce(\n\t\t\t\t( unique, item ) =>\n\t\t\t\t\tunique.includes( item.message )\n\t\t\t\t\t\t? unique\n\t\t\t\t\t\t: [ ...unique, item.message ],\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\tif ( fontFamiliesToActivate.length > 0 ) {\n\t\t\t\t// Activate the font family (add the font family to the global styles).\n\t\t\t\tconst activeFonts = activateCustomFontFamilies(\n\t\t\t\t\tfontFamiliesToActivate\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\n\t\t\t\trefreshLibrary();\n\t\t\t}\n\n\t\t\tif ( installationErrors.length > 0 ) {\n\t\t\t\tconst installError = new Error(\n\t\t\t\t\t__( 'There was an error installing fonts.' )\n\t\t\t\t);\n\n\t\t\t\tinstallError.installationErrors = installationErrors;\n\n\t\t\t\tthrow installError;\n\t\t\t}\n\t\t} finally {\n\t\t\tsetIsInstalling( false );\n\t\t}\n\t}\n\n\tasync function uninstallFontFamily( fontFamilyToUninstall ) {\n\t\ttry {\n\t\t\t// Uninstall the font family.\n\t\t\t// (Removes the font files from the server and the posts from the database).\n\t\t\tconst uninstalledFontFamily = await fetchUninstallFontFamily(\n\t\t\t\tfontFamilyToUninstall.id\n\t\t\t);\n\n\t\t\t// Deactivate the font family if delete request is successful\n\t\t\t// (Removes the font family from the global styles).\n\t\t\tif ( uninstalledFontFamily.deleted ) {\n\t\t\t\tconst activeFonts = deactivateFontFamily(\n\t\t\t\t\tfontFamilyToUninstall\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\t\t\t}\n\n\t\t\t// Refresh the library (the library font families from database).\n\t\t\trefreshLibrary();\n\n\t\t\treturn uninstalledFontFamily;\n\t\t} catch ( error ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t`There was an error uninstalling the font family:`,\n\t\t\t\terror\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tconst deactivateFontFamily = ( font ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialCustomFonts = fontFamilies?.[ font.source ] ?? [];\n\t\tconst newCustomFonts = initialCustomFonts.filter(\n\t\t\t( f ) => f.slug !== font.slug\n\t\t);\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newCustomFonts,\n\t\t};\n\t\tsetFontFamilies( activeFonts );\n\n\t\tif ( font.fontFace ) {\n\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t\t} );\n\t\t}\n\t\treturn activeFonts;\n\t};\n\n\tconst activateCustomFontFamilies = ( fontsToAdd ) => {\n\t\tconst fontsToActivate = cleanFontsForSave( fontsToAdd );\n\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t// Merge the existing custom fonts with the new fonts.\n\t\t\tcustom: mergeFontFamilies( fontFamilies?.custom, fontsToActivate ),\n\t\t};\n\n\t\t// Activate the fonts by set the new custom fonts array.\n\t\tsetFontFamilies( activeFonts );\n\n\t\tloadFontsInBrowser( fontsToActivate );\n\n\t\treturn activeFonts;\n\t};\n\n\t// Removes the id from the families and faces to avoid saving that to global styles post content.\n\tconst cleanFontsForSave = ( fonts ) => {\n\t\treturn fonts.map( ( { id: _familyDbId, fontFace, ...font } ) => ( {\n\t\t\t...font,\n\t\t\t...( fontFace && fontFace.length > 0\n\t\t\t\t? {\n\t\t\t\t\t\tfontFace: fontFace.map(\n\t\t\t\t\t\t\t( { id: _faceDbId, ...face } ) => face\n\t\t\t\t\t\t),\n\t\t\t\t }\n\t\t\t\t: {} ),\n\t\t} ) );\n\t};\n\n\tconst loadFontsInBrowser = ( fonts ) => {\n\t\t// Add custom fonts to the browser.\n\t\tfonts.forEach( ( font ) => {\n\t\t\tif ( font.fontFace ) {\n\t\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\t\t// Load font faces just in the iframe because they already are in the document.\n\t\t\t\t\tloadFontFaceInBrowser(\n\t\t\t\t\t\tface,\n\t\t\t\t\t\tgetDisplaySrcFromFontFace( face.src ),\n\t\t\t\t\t\t'all'\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst toggleActivateFont = ( font, face ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialFonts = fontFamilies?.[ font.source ] ?? [];\n\t\t// Toggles the received font family or font face\n\t\tconst newFonts = toggleFont( font, face, initialFonts );\n\t\t// Updates the font families activated in global settings:\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newFonts,\n\t\t} );\n\n\t\tconst isFaceActivated = isFontActivated(\n\t\t\tfont.slug,\n\t\t\tface?.fontStyle,\n\t\t\tface?.fontWeight,\n\t\t\tfont.source\n\t\t);\n\n\t\tif ( isFaceActivated ) {\n\t\t\tloadFontFaceInBrowser(\n\t\t\t\tface,\n\t\t\t\tgetDisplaySrcFromFontFace( face?.src ),\n\t\t\t\t'all'\n\t\t\t);\n\t\t} else {\n\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t}\n\t};\n\n\tconst loadFontFaceAsset = async ( fontFace ) => {\n\t\t// If the font doesn't have a src, don't load it.\n\t\tif ( ! fontFace.src ) {\n\t\t\treturn;\n\t\t}\n\t\t// Get the src of the font.\n\t\tconst src = getDisplaySrcFromFontFace( fontFace.src );\n\t\t// If the font is already loaded, don't load it again.\n\t\tif ( ! src || loadedFontUrls.has( src ) ) {\n\t\t\treturn;\n\t\t}\n\t\t// Load the font in the browser.\n\t\tloadFontFaceInBrowser( fontFace, src, 'document' );\n\t\t// Add the font to the loaded fonts list.\n\t\tloadedFontUrls.add( src );\n\t};\n\n\t// Font Collections\n\tconst [ collections, setFontCollections ] = useState( [] );\n\tconst getFontCollections = async () => {\n\t\tconst response = await fetchFontCollections();\n\t\tsetFontCollections( response );\n\t};\n\tconst getFontCollection = async ( slug ) => {\n\t\ttry {\n\t\t\tconst hasData = !! collections.find(\n\t\t\t\t( collection ) => collection.slug === slug\n\t\t\t)?.font_families;\n\t\t\tif ( hasData ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst response = await fetchFontCollection( slug );\n\t\t\tconst updatedCollections = collections.map( ( collection ) =>\n\t\t\t\tcollection.slug === slug\n\t\t\t\t\t? { ...collection, ...response }\n\t\t\t\t\t: collection\n\t\t\t);\n\t\t\tsetFontCollections( updatedCollections );\n\t\t} catch ( e ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( e );\n\t\t\tthrow e;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tgetFontCollections();\n\t}, [] );\n\n\treturn (\n\t\t<FontLibraryContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tlibraryFontSelected,\n\t\t\t\thandleSetLibraryFontSelected,\n\t\t\t\tfontFamilies,\n\t\t\t\tthemeFonts,\n\t\t\t\tbaseThemeFonts,\n\t\t\t\tcustomFonts,\n\t\t\t\tbaseCustomFonts,\n\t\t\t\tisFontActivated,\n\t\t\t\tgetFontFacesActivated,\n\t\t\t\tloadFontFaceAsset,\n\t\t\t\tinstallFonts,\n\t\t\t\tuninstallFontFamily,\n\t\t\t\ttoggleActivateFont,\n\t\t\t\tgetAvailableFontsOutline,\n\t\t\t\tmodalTabOpen,\n\t\t\t\ttoggleModal,\n\t\t\t\trefreshLibrary,\n\t\t\t\tnotice,\n\t\t\t\tsetNotice,\n\t\t\t\tsaveFontFamilies,\n\t\t\t\tfontFamiliesHasChanges,\n\t\t\t\tisResolvingLibrary,\n\t\t\t\thasResolvedLibrary,\n\t\t\t\tisInstalling,\n\t\t\t\tcollections,\n\t\t\t\tgetFontCollection,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</FontLibraryContext.Provider>\n\t);\n}\n\nexport default FontLibraryProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAL,OAAA;AAOA,IAAAM,WAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAWA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAC,sBAAA,CAAAV,OAAA;AArCA;AACA;AACA;;AAWA;AACA;AACA;;AASA,MAAM;EAAEW;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAetD,MAAMC,kBAAkB,GAAAC,OA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,GAEDlK,QAC0B,CAAC;AAEhC;AAAC,IAAA6K,QAAA,GAAAhL,OAAA,CAAAiL,OAAA,GAEc/K,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_element","require","_blockEditor","_data","_coreData","_i18n","_resolvers","_lockUnlock","_utils","_toggleFont","_setNestedValue","_interopRequireDefault","_jsxRuntime","useGlobalSetting","unlock","blockEditorPrivateApis","FontLibraryContext","exports","createContext","FontLibraryProvider","children","saveEntityRecord","useDispatch","coreStore","globalStylesId","useSelect","select","__experimentalGetCurrentGlobalStylesId","globalStyles","useEntityRecord","isInstalling","setIsInstalling","useState","refreshKey","setRefreshKey","notice","setNotice","refreshLibrary","Date","now","records","libraryPosts","isResolving","isResolvingLibrary","useEntityRecords","_embed","libraryFonts","map","fontFamilyPost","id","font_family_settings","fontFace","_embedded","font_faces","face","font_face_settings","fontFamilies","setFontFamilies","saveFontFamilies","fonts","updatedGlobalStyles","record","setNestedValue","modalTabOpen","setModalTabOpen","libraryFontSelected","setLibraryFontSelected","themeFonts","theme","f","setUIValuesNeeded","source","sort","a","b","name","localeCompare","customFonts","custom","baseCustomFonts","useEffect","handleSetLibraryFontSelected","font","fontSelected","find","slug","loadedFontUrls","Set","getAvailableFontsOutline","availableFontFamilies","outline","reduce","acc","availableFontFaces","length","fontStyle","fontWeight","getActivatedFontsOutline","isFontActivated","style","weight","includes","getFontFacesActivated","installFonts","fontFamiliesToInstall","fontFamiliesToActivate","installationErrors","fontFamilyToInstall","isANewFontFamily","installedFontFamily","fetchGetFontFamilyBySlug","fetchInstallFontFamily","makeFontFamilyFormData","alreadyInstalledFontFaces","filter","fontFaceToInstall","checkFontFaceInstalled","successfullyInstalledFontFaces","unsuccessfullyInstalledFontFaces","response","batchInstallFontFaces","makeFontFacesFormData","successes","errors","push","fetchUninstallFontFamily","concat","unique","item","message","activeFonts","activateCustomFontFamilies","installError","Error","__","uninstallFontFamily","fontFamilyToUninstall","uninstalledFontFamily","deleted","deactivateFontFamily","error","console","_fontFamilies$font$so","initialCustomFonts","newCustomFonts","forEach","unloadFontFaceInBrowser","fontsToAdd","fontsToActivate","cleanFontsForSave","mergeFontFamilies","loadFontsInBrowser","_familyDbId","_faceDbId","loadFontFaceInBrowser","getDisplaySrcFromFontFace","src","toggleActivateFont","_fontFamilies$font$so2","initialFonts","newFonts","toggleFont","isFaceActivated","loadFontFaceAsset","has","add","collections","setFontCollections","getFontCollections","fetchFontCollections","getFontCollection","hasData","collection","font_families","fetchFontCollection","updatedCollections","e","jsx","Provider","value","_default","default"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useState, useEffect } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseEntityRecord,\n\tuseEntityRecords,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tfetchGetFontFamilyBySlug,\n\tfetchInstallFontFamily,\n\tfetchUninstallFontFamily,\n\tfetchFontCollections,\n\tfetchFontCollection,\n} from './resolvers';\nimport { unlock } from '../../../lock-unlock';\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\nimport {\n\tsetUIValuesNeeded,\n\tmergeFontFamilies,\n\tloadFontFaceInBrowser,\n\tunloadFontFaceInBrowser,\n\tgetDisplaySrcFromFontFace,\n\tmakeFontFacesFormData,\n\tmakeFontFamilyFormData,\n\tbatchInstallFontFaces,\n\tcheckFontFaceInstalled,\n} from './utils';\nimport { toggleFont } from './utils/toggleFont';\nimport setNestedValue from '../../../utils/set-nested-value';\n\nexport const FontLibraryContext = createContext( {} );\n\nfunction FontLibraryProvider( { children } ) {\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { globalStylesId } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetCurrentGlobalStylesId } = select( coreStore );\n\t\treturn { globalStylesId: __experimentalGetCurrentGlobalStylesId() };\n\t} );\n\n\tconst globalStyles = useEntityRecord(\n\t\t'root',\n\t\t'globalStyles',\n\t\tglobalStylesId\n\t);\n\n\tconst [ isInstalling, setIsInstalling ] = useState( false );\n\tconst [ refreshKey, setRefreshKey ] = useState( 0 );\n\tconst [ notice, setNotice ] = useState( null );\n\n\tconst refreshLibrary = () => {\n\t\tsetRefreshKey( Date.now() );\n\t};\n\n\tconst { records: libraryPosts = [], isResolving: isResolvingLibrary } =\n\t\tuseEntityRecords( 'postType', 'wp_font_family', {\n\t\t\trefreshKey,\n\t\t\t_embed: true,\n\t\t} );\n\n\tconst libraryFonts =\n\t\t( libraryPosts || [] ).map( ( fontFamilyPost ) => {\n\t\t\treturn {\n\t\t\t\tid: fontFamilyPost.id,\n\t\t\t\t...fontFamilyPost.font_family_settings,\n\t\t\t\tfontFace:\n\t\t\t\t\tfontFamilyPost?._embedded?.font_faces.map(\n\t\t\t\t\t\t( face ) => face.font_face_settings\n\t\t\t\t\t) || [],\n\t\t\t};\n\t\t} ) || [];\n\n\t// Global Styles (settings) font families\n\tconst [ fontFamilies, setFontFamilies ] = useGlobalSetting(\n\t\t'typography.fontFamilies'\n\t);\n\n\t/*\n\t * Save the font families to the database.\n\n\t * This function is called when the user activates or deactivates a font family.\n\t * It only updates the global styles post content in the database for new font families.\n\t * This avoids saving other styles/settings changed by the user using other parts of the editor.\n\t *\n\t * It uses the font families from the param to avoid using the font families from an outdated state.\n\t *\n\t * @param {Array} fonts - The font families that will be saved to the database.\n\t */\n\tconst saveFontFamilies = async ( fonts ) => {\n\t\t// Gets the global styles database post content.\n\t\tconst updatedGlobalStyles = globalStyles.record;\n\n\t\t// Updates the database version of global styles with the edited font families in the client.\n\t\tsetNestedValue(\n\t\t\tupdatedGlobalStyles,\n\t\t\t[ 'settings', 'typography', 'fontFamilies' ],\n\t\t\tfonts\n\t\t);\n\n\t\t// Saves a new version of the global styles in the database.\n\t\tawait saveEntityRecord( 'root', 'globalStyles', updatedGlobalStyles );\n\t};\n\n\t// Library Fonts\n\tconst [ modalTabOpen, setModalTabOpen ] = useState( false );\n\tconst [ libraryFontSelected, setLibraryFontSelected ] = useState( null );\n\n\t// Themes Fonts are the fonts defined in the global styles (database persisted theme.json data).\n\tconst themeFonts = fontFamilies?.theme\n\t\t? fontFamilies.theme\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst customFonts = fontFamilies?.custom\n\t\t? fontFamilies.custom\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tconst baseCustomFonts = libraryFonts\n\t\t? libraryFonts\n\t\t\t\t.map( ( f ) => setUIValuesNeeded( f, { source: 'custom' } ) )\n\t\t\t\t.sort( ( a, b ) => a.name.localeCompare( b.name ) )\n\t\t: [];\n\n\tuseEffect( () => {\n\t\tif ( ! modalTabOpen ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t}\n\t}, [ modalTabOpen ] );\n\n\tconst handleSetLibraryFontSelected = ( font ) => {\n\t\tsetNotice( null );\n\n\t\t// If font is null, reset the selected font\n\t\tif ( ! font ) {\n\t\t\tsetLibraryFontSelected( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst fonts = font.source === 'theme' ? themeFonts : baseCustomFonts;\n\n\t\t// Tries to find the font in the installed fonts\n\t\tconst fontSelected = fonts.find( ( f ) => f.slug === font.slug );\n\t\t// If the font is not found (it is only defined in custom styles), use the font from custom styles\n\t\tsetLibraryFontSelected( {\n\t\t\t...( fontSelected || font ),\n\t\t\tsource: font.source,\n\t\t} );\n\t};\n\n\t// Demo\n\tconst [ loadedFontUrls ] = useState( new Set() );\n\n\tconst getAvailableFontsOutline = ( availableFontFamilies ) => {\n\t\tconst outline = availableFontFamilies.reduce( ( acc, font ) => {\n\t\t\tconst availableFontFaces =\n\t\t\t\tfont?.fontFace && font.fontFace?.length > 0\n\t\t\t\t\t? font?.fontFace.map(\n\t\t\t\t\t\t\t( face ) => `${ face.fontStyle + face.fontWeight }`\n\t\t\t\t\t )\n\t\t\t\t\t: [ 'normal400' ]; // If the font doesn't have fontFace, we assume it is a system font and we add the defaults: normal 400\n\n\t\t\tacc[ font.slug ] = availableFontFaces;\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn outline;\n\t};\n\n\tconst getActivatedFontsOutline = ( source ) => {\n\t\tswitch ( source ) {\n\t\t\tcase 'theme':\n\t\t\t\treturn getAvailableFontsOutline( themeFonts );\n\t\t\tcase 'custom':\n\t\t\tdefault:\n\t\t\t\treturn getAvailableFontsOutline( customFonts );\n\t\t}\n\t};\n\n\tconst isFontActivated = ( slug, style, weight, source ) => {\n\t\tif ( ! style && ! weight ) {\n\t\t\treturn !! getActivatedFontsOutline( source )[ slug ];\n\t\t}\n\t\treturn !! getActivatedFontsOutline( source )[ slug ]?.includes(\n\t\t\tstyle + weight\n\t\t);\n\t};\n\n\tconst getFontFacesActivated = ( slug, source ) => {\n\t\treturn getActivatedFontsOutline( source )[ slug ] || [];\n\t};\n\n\tasync function installFonts( fontFamiliesToInstall ) {\n\t\tsetIsInstalling( true );\n\t\ttry {\n\t\t\tconst fontFamiliesToActivate = [];\n\t\t\tlet installationErrors = [];\n\n\t\t\tfor ( const fontFamilyToInstall of fontFamiliesToInstall ) {\n\t\t\t\tlet isANewFontFamily = false;\n\n\t\t\t\t// Get the font family if it already exists.\n\t\t\t\tlet installedFontFamily = await fetchGetFontFamilyBySlug(\n\t\t\t\t\tfontFamilyToInstall.slug\n\t\t\t\t);\n\n\t\t\t\t// Otherwise create it.\n\t\t\t\tif ( ! installedFontFamily ) {\n\t\t\t\t\tisANewFontFamily = true;\n\t\t\t\t\t// Prepare font family form data to install.\n\t\t\t\t\tinstalledFontFamily = await fetchInstallFontFamily(\n\t\t\t\t\t\tmakeFontFamilyFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Collect font faces that have already been installed (to be activated later)\n\t\t\t\tconst alreadyInstalledFontFaces =\n\t\t\t\t\tinstalledFontFamily.fontFace && fontFamilyToInstall.fontFace\n\t\t\t\t\t\t? installedFontFamily.fontFace.filter(\n\t\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t\tcheckFontFaceInstalled(\n\t\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: [];\n\n\t\t\t\t// Filter out Font Faces that have already been installed (so that they are not re-installed)\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily.fontFace &&\n\t\t\t\t\tfontFamilyToInstall.fontFace\n\t\t\t\t) {\n\t\t\t\t\tfontFamilyToInstall.fontFace =\n\t\t\t\t\t\tfontFamilyToInstall.fontFace.filter(\n\t\t\t\t\t\t\t( fontFaceToInstall ) =>\n\t\t\t\t\t\t\t\t! checkFontFaceInstalled(\n\t\t\t\t\t\t\t\t\tfontFaceToInstall,\n\t\t\t\t\t\t\t\t\tinstalledFontFamily.fontFace\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Install the fonts (upload the font files to the server and create the post in the database).\n\t\t\t\tlet successfullyInstalledFontFaces = [];\n\t\t\t\tlet unsuccessfullyInstalledFontFaces = [];\n\t\t\t\tif ( fontFamilyToInstall?.fontFace?.length > 0 ) {\n\t\t\t\t\tconst response = await batchInstallFontFaces(\n\t\t\t\t\t\tinstalledFontFamily.id,\n\t\t\t\t\t\tmakeFontFacesFormData( fontFamilyToInstall )\n\t\t\t\t\t);\n\t\t\t\t\tsuccessfullyInstalledFontFaces = response?.successes;\n\t\t\t\t\tunsuccessfullyInstalledFontFaces = response?.errors;\n\t\t\t\t}\n\n\t\t\t\t// Use the successfully installed font faces\n\t\t\t\t// As well as any font faces that were already installed (those will be activated)\n\t\t\t\tif (\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length > 0 ||\n\t\t\t\t\talreadyInstalledFontFaces?.length > 0\n\t\t\t\t) {\n\t\t\t\t\t// Use font data from REST API not from client to ensure\n\t\t\t\t\t// correct font information is used.\n\t\t\t\t\tinstalledFontFamily.fontFace = [\n\t\t\t\t\t\t...successfullyInstalledFontFaces,\n\t\t\t\t\t];\n\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If it's a system font but was installed successfully, activate it.\n\t\t\t\tif (\n\t\t\t\t\tinstalledFontFamily &&\n\t\t\t\t\t! fontFamilyToInstall?.fontFace?.length\n\t\t\t\t) {\n\t\t\t\t\tfontFamiliesToActivate.push( installedFontFamily );\n\t\t\t\t}\n\n\t\t\t\t// If the font family is new and is not a system font, delete it to avoid having font families without font faces.\n\t\t\t\tif (\n\t\t\t\t\tisANewFontFamily &&\n\t\t\t\t\tfontFamilyToInstall?.fontFace?.length > 0 &&\n\t\t\t\t\tsuccessfullyInstalledFontFaces?.length === 0\n\t\t\t\t) {\n\t\t\t\t\tawait fetchUninstallFontFamily( installedFontFamily.id );\n\t\t\t\t}\n\n\t\t\t\tinstallationErrors = installationErrors.concat(\n\t\t\t\t\tunsuccessfullyInstalledFontFaces\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tinstallationErrors = installationErrors.reduce(\n\t\t\t\t( unique, item ) =>\n\t\t\t\t\tunique.includes( item.message )\n\t\t\t\t\t\t? unique\n\t\t\t\t\t\t: [ ...unique, item.message ],\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\tif ( fontFamiliesToActivate.length > 0 ) {\n\t\t\t\t// Activate the font family (add the font family to the global styles).\n\t\t\t\tconst activeFonts = activateCustomFontFamilies(\n\t\t\t\t\tfontFamiliesToActivate\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\n\t\t\t\trefreshLibrary();\n\t\t\t}\n\n\t\t\tif ( installationErrors.length > 0 ) {\n\t\t\t\tconst installError = new Error(\n\t\t\t\t\t__( 'There was an error installing fonts.' )\n\t\t\t\t);\n\n\t\t\t\tinstallError.installationErrors = installationErrors;\n\n\t\t\t\tthrow installError;\n\t\t\t}\n\t\t} finally {\n\t\t\tsetIsInstalling( false );\n\t\t}\n\t}\n\n\tasync function uninstallFontFamily( fontFamilyToUninstall ) {\n\t\ttry {\n\t\t\t// Uninstall the font family.\n\t\t\t// (Removes the font files from the server and the posts from the database).\n\t\t\tconst uninstalledFontFamily = await fetchUninstallFontFamily(\n\t\t\t\tfontFamilyToUninstall.id\n\t\t\t);\n\n\t\t\t// Deactivate the font family if delete request is successful\n\t\t\t// (Removes the font family from the global styles).\n\t\t\tif ( uninstalledFontFamily.deleted ) {\n\t\t\t\tconst activeFonts = deactivateFontFamily(\n\t\t\t\t\tfontFamilyToUninstall\n\t\t\t\t);\n\t\t\t\t// Save the global styles to the database.\n\t\t\t\tawait saveFontFamilies( activeFonts );\n\t\t\t}\n\n\t\t\t// Refresh the library (the library font families from database).\n\t\t\trefreshLibrary();\n\n\t\t\treturn uninstalledFontFamily;\n\t\t} catch ( error ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t`There was an error uninstalling the font family:`,\n\t\t\t\terror\n\t\t\t);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tconst deactivateFontFamily = ( font ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialCustomFonts = fontFamilies?.[ font.source ] ?? [];\n\t\tconst newCustomFonts = initialCustomFonts.filter(\n\t\t\t( f ) => f.slug !== font.slug\n\t\t);\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newCustomFonts,\n\t\t};\n\t\tsetFontFamilies( activeFonts );\n\n\t\tif ( font.fontFace ) {\n\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t\t} );\n\t\t}\n\t\treturn activeFonts;\n\t};\n\n\tconst activateCustomFontFamilies = ( fontsToAdd ) => {\n\t\tconst fontsToActivate = cleanFontsForSave( fontsToAdd );\n\n\t\tconst activeFonts = {\n\t\t\t...fontFamilies,\n\t\t\t// Merge the existing custom fonts with the new fonts.\n\t\t\tcustom: mergeFontFamilies( fontFamilies?.custom, fontsToActivate ),\n\t\t};\n\n\t\t// Activate the fonts by set the new custom fonts array.\n\t\tsetFontFamilies( activeFonts );\n\n\t\tloadFontsInBrowser( fontsToActivate );\n\n\t\treturn activeFonts;\n\t};\n\n\t// Removes the id from the families and faces to avoid saving that to global styles post content.\n\tconst cleanFontsForSave = ( fonts ) => {\n\t\treturn fonts.map( ( { id: _familyDbId, fontFace, ...font } ) => ( {\n\t\t\t...font,\n\t\t\t...( fontFace && fontFace.length > 0\n\t\t\t\t? {\n\t\t\t\t\t\tfontFace: fontFace.map(\n\t\t\t\t\t\t\t( { id: _faceDbId, ...face } ) => face\n\t\t\t\t\t\t),\n\t\t\t\t }\n\t\t\t\t: {} ),\n\t\t} ) );\n\t};\n\n\tconst loadFontsInBrowser = ( fonts ) => {\n\t\t// Add custom fonts to the browser.\n\t\tfonts.forEach( ( font ) => {\n\t\t\tif ( font.fontFace ) {\n\t\t\t\tfont.fontFace.forEach( ( face ) => {\n\t\t\t\t\t// Load font faces just in the iframe because they already are in the document.\n\t\t\t\t\tloadFontFaceInBrowser(\n\t\t\t\t\t\tface,\n\t\t\t\t\t\tgetDisplaySrcFromFontFace( face.src ),\n\t\t\t\t\t\t'all'\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t};\n\n\tconst toggleActivateFont = ( font, face ) => {\n\t\t// If the user doesn't have custom fonts defined, include as custom fonts all the theme fonts\n\t\t// We want to save as active all the theme fonts at the beginning\n\t\tconst initialFonts = fontFamilies?.[ font.source ] ?? [];\n\t\t// Toggles the received font family or font face\n\t\tconst newFonts = toggleFont( font, face, initialFonts );\n\t\t// Updates the font families activated in global settings:\n\t\tsetFontFamilies( {\n\t\t\t...fontFamilies,\n\t\t\t[ font.source ]: newFonts,\n\t\t} );\n\n\t\tconst isFaceActivated = isFontActivated(\n\t\t\tfont.slug,\n\t\t\tface?.fontStyle,\n\t\t\tface?.fontWeight,\n\t\t\tfont.source\n\t\t);\n\n\t\tif ( isFaceActivated ) {\n\t\t\tloadFontFaceInBrowser(\n\t\t\t\tface,\n\t\t\t\tgetDisplaySrcFromFontFace( face?.src ),\n\t\t\t\t'all'\n\t\t\t);\n\t\t} else {\n\t\t\tunloadFontFaceInBrowser( face, 'all' );\n\t\t}\n\t};\n\n\tconst loadFontFaceAsset = async ( fontFace ) => {\n\t\t// If the font doesn't have a src, don't load it.\n\t\tif ( ! fontFace.src ) {\n\t\t\treturn;\n\t\t}\n\t\t// Get the src of the font.\n\t\tconst src = getDisplaySrcFromFontFace( fontFace.src );\n\t\t// If the font is already loaded, don't load it again.\n\t\tif ( ! src || loadedFontUrls.has( src ) ) {\n\t\t\treturn;\n\t\t}\n\t\t// Load the font in the browser.\n\t\tloadFontFaceInBrowser( fontFace, src, 'document' );\n\t\t// Add the font to the loaded fonts list.\n\t\tloadedFontUrls.add( src );\n\t};\n\n\t// Font Collections\n\tconst [ collections, setFontCollections ] = useState( [] );\n\tconst getFontCollections = async () => {\n\t\tconst response = await fetchFontCollections();\n\t\tsetFontCollections( response );\n\t};\n\tconst getFontCollection = async ( slug ) => {\n\t\ttry {\n\t\t\tconst hasData = !! collections.find(\n\t\t\t\t( collection ) => collection.slug === slug\n\t\t\t)?.font_families;\n\t\t\tif ( hasData ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst response = await fetchFontCollection( slug );\n\t\t\tconst updatedCollections = collections.map( ( collection ) =>\n\t\t\t\tcollection.slug === slug\n\t\t\t\t\t? { ...collection, ...response }\n\t\t\t\t\t: collection\n\t\t\t);\n\t\t\tsetFontCollections( updatedCollections );\n\t\t} catch ( e ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( e );\n\t\t\tthrow e;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\tgetFontCollections();\n\t}, [] );\n\n\treturn (\n\t\t<FontLibraryContext.Provider\n\t\t\tvalue={ {\n\t\t\t\tlibraryFontSelected,\n\t\t\t\thandleSetLibraryFontSelected,\n\t\t\t\tfontFamilies,\n\t\t\t\tbaseCustomFonts,\n\t\t\t\tisFontActivated,\n\t\t\t\tgetFontFacesActivated,\n\t\t\t\tloadFontFaceAsset,\n\t\t\t\tinstallFonts,\n\t\t\t\tuninstallFontFamily,\n\t\t\t\ttoggleActivateFont,\n\t\t\t\tgetAvailableFontsOutline,\n\t\t\t\tmodalTabOpen,\n\t\t\t\tsetModalTabOpen,\n\t\t\t\trefreshLibrary,\n\t\t\t\tnotice,\n\t\t\t\tsetNotice,\n\t\t\t\tsaveFontFamilies,\n\t\t\t\tisResolvingLibrary,\n\t\t\t\tisInstalling,\n\t\t\t\tcollections,\n\t\t\t\tgetFontCollection,\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</FontLibraryContext.Provider>\n\t);\n}\n\nexport default FontLibraryProvider;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAL,OAAA;AAOA,IAAAM,WAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAWA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAC,sBAAA,CAAAV,OAAA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ACC,IAAA5J,WAAA,CAAAqK,GAAA,EAACjK,kBAAkB,CAACkK,QAAQ;IAC3BC,KAAK,EAAG;MACPlH,mBAAmB;MACnBgB,4BAA4B;MAC5BzB,YAAY;MACZuB,eAAe;MACfmB,eAAe;MACfI,qBAAqB;MACrB6D,iBAAiB;MACjB5D,YAAY;MACZgC,mBAAmB;MACnBsB,kBAAkB;MAClBrE,wBAAwB;MACxBzB,YAAY;MACZC,eAAe;MACf3B,cAAc;MACdF,MAAM;MACNC,SAAS;MACTsB,gBAAgB;MAChBf,kBAAkB;MAClBb,YAAY;MACZwI,WAAW;MACXI;IACD,CAAG;IAAAtJ,QAAA,EAEDA;EAAQ,CACkB,CAAC;AAEhC;AAAC,IAAAgK,QAAA,GAAAnK,OAAA,CAAAoK,OAAA,GAEclK,mBAAmB","ignoreList":[]}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _i18n = require("@wordpress/i18n");
|
|
10
9
|
var _components = require("@wordpress/components");
|
|
11
10
|
var _fontDemo = _interopRequireDefault(require("./font-demo"));
|
|
12
11
|
var _icons = require("@wordpress/icons");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
/**
|
|
14
14
|
* WordPress dependencies
|
|
15
15
|
*/
|
|
@@ -29,7 +29,7 @@ function FontCard({
|
|
|
29
29
|
cursor: !!onClick ? 'pointer' : 'default'
|
|
30
30
|
};
|
|
31
31
|
const navigator = (0, _components.__experimentalUseNavigator)();
|
|
32
|
-
return (0,
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
33
33
|
onClick: () => {
|
|
34
34
|
onClick();
|
|
35
35
|
if (navigatorPath) {
|
|
@@ -37,20 +37,28 @@ function FontCard({
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
style: style,
|
|
40
|
-
className: "font-library-modal__font-card"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
className: "font-library-modal__font-card",
|
|
41
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, {
|
|
42
|
+
justify: "space-between",
|
|
43
|
+
wrap: false,
|
|
44
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_fontDemo.default, {
|
|
45
|
+
font: font
|
|
46
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, {
|
|
47
|
+
justify: "flex-end",
|
|
48
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
49
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
50
|
+
className: "font-library-modal__font-card__count",
|
|
51
|
+
children: variantsText || (0, _i18n.sprintf)( /* translators: %d: Number of font variants. */
|
|
52
|
+
(0, _i18n._n)('%d variant', '%d variants', variantsCount), variantsCount)
|
|
53
|
+
})
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
|
|
56
|
+
icon: _icons.chevronRight
|
|
57
|
+
})
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
});
|
|
54
62
|
}
|
|
55
63
|
var _default = exports.default = FontCard;
|
|
56
64
|
//# sourceMappingURL=font-card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_fontDemo","_interopRequireDefault","_icons","FontCard","font","onClick","variantsText","navigatorPath","variantsCount","fontFace","length","style","cursor","navigator","useNavigator","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_fontDemo","_interopRequireDefault","_icons","_jsxRuntime","FontCard","font","onClick","variantsText","navigatorPath","variantsCount","fontFace","length","style","cursor","navigator","useNavigator","jsx","Button","goTo","className","children","jsxs","Flex","justify","wrap","default","FlexItem","__experimentalText","sprintf","_n","Icon","icon","chevronRight","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/font-card.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalText as Text,\n\tButton,\n\tFlex,\n\tFlexItem,\n\tIcon,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport FontDemo from './font-demo';\nimport { chevronRight } from '@wordpress/icons';\n\nfunction FontCard( { font, onClick, variantsText, navigatorPath } ) {\n\tconst variantsCount = font.fontFace?.length || 1;\n\n\tconst style = {\n\t\tcursor: !! onClick ? 'pointer' : 'default',\n\t};\n\n\tconst navigator = useNavigator();\n\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () => {\n\t\t\t\tonClick();\n\t\t\t\tif ( navigatorPath ) {\n\t\t\t\t\tnavigator.goTo( navigatorPath );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tstyle={ style }\n\t\t\tclassName=\"font-library-modal__font-card\"\n\t\t>\n\t\t\t<Flex justify=\"space-between\" wrap={ false }>\n\t\t\t\t<FontDemo font={ font } />\n\t\t\t\t<Flex justify=\"flex-end\">\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Text className=\"font-library-modal__font-card__count\">\n\t\t\t\t\t\t\t{ variantsText ||\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %d: Number of font variants. */\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'%d variant',\n\t\t\t\t\t\t\t\t\t\t'%d variants',\n\t\t\t\t\t\t\t\t\t\tvariantsCount\n\t\t\t\t\t\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