@wordpress/edit-site 6.13.1-next.cd6172eb0.0 → 6.15.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 +4 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-pattern/index.js +7 -10
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-post/index.js +1 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +1 -0
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/index.js +1 -0
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -0
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/editor/index.js +1 -9
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -0
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/confirm-reset-shadow-dialog.js +39 -0
- package/build/components/global-styles/confirm-reset-shadow-dialog.js.map +1 -0
- package/build/components/global-styles/font-families.js +1 -0
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +1 -0
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +1 -0
- 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 +1 -0
- package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +2 -1
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
- 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 +1 -0
- package/build/components/global-styles/font-library-modal/library-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +1 -0
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js +1 -0
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/fonts-outline.js +1 -0
- package/build/components/global-styles/font-library-modal/utils/fonts-outline.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +1 -0
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +1 -0
- package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +1 -0
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/toggleFont.js +1 -0
- package/build/components/global-styles/font-library-modal/utils/toggleFont.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-size.js +18 -14
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-sizes.js +18 -20
- package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build/components/global-styles/highlighted-colors.js +1 -0
- package/build/components/global-styles/highlighted-colors.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -0
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -0
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preset-colors.js +1 -0
- package/build/components/global-styles/preset-colors.js.map +1 -1
- package/build/components/global-styles/preview-colors.js +2 -2
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/preview-styles.js +3 -2
- package/build/components/global-styles/preview-styles.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +2 -2
- package/build/components/global-styles/preview-typography.js.map +1 -1
- package/build/components/global-styles/{preview-iframe.js → preview-wrapper.js} +11 -29
- package/build/components/global-styles/preview-wrapper.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +1 -0
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +1 -1
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -0
- 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/shadow-utils.js +1 -0
- package/build/components/global-styles/shadow-utils.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +36 -34
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/shadows-panel.js +44 -5
- package/build/components/global-styles/shadows-panel.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +1 -0
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typeset.js +1 -0
- package/build/components/global-styles/typeset.js.map +1 -1
- package/build/components/global-styles/typography-example.js +8 -1
- package/build/components/global-styles/typography-example.js.map +1 -1
- package/build/components/global-styles/ui.js +1 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +1 -0
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-panel.js +1 -0
- package/build/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -0
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/layout/index.js +24 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/maybe-editor/index.js +65 -0
- package/build/components/maybe-editor/index.js.map +1 -0
- package/build/components/media/index.js +1 -0
- package/build/components/media/index.js.map +1 -1
- package/build/components/page-patterns/fields.js +8 -82
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-patterns/header.js +1 -0
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +18 -14
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-pattern-settings.js +1 -0
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/fields.js +7 -39
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/page-templates/index.js +38 -41
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/post-edit/index.js +16 -8
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +40 -21
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app-routes/index.js +1 -0
- package/build/components/posts-app-routes/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +9 -1
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/save-button/index.js +1 -0
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +1 -0
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-keyboard-shortcut/index.js +1 -0
- package/build/components/save-keyboard-shortcut/index.js.map +1 -1
- package/build/components/save-panel/index.js +1 -0
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +1 -0
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -7
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +1 -0
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +10 -26
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +2 -0
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +40 -71
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/content.js +12 -38
- package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +38 -23
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -4
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -0
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/site-editor-routes/home.js +4 -2
- package/build/components/site-editor-routes/home.js.map +1 -1
- package/build/components/site-editor-routes/index.js +3 -1
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/site-editor-routes/stylebook.js +37 -0
- package/build/components/site-editor-routes/stylebook.js.map +1 -0
- package/build/components/site-editor-routes/styles.js +7 -1
- package/build/components/site-editor-routes/styles.js.map +1 -1
- package/build/components/site-editor-routes/template-item.js +3 -3
- package/build/components/site-editor-routes/template-item.js.map +1 -1
- package/build/components/site-editor-routes/template-part-item.js +3 -3
- package/build/components/site-editor-routes/template-part-item.js.map +1 -1
- package/build/components/style-book/categories.js +1 -0
- package/build/components/style-book/categories.js.map +1 -1
- package/build/components/style-book/color-examples.js +9 -3
- package/build/components/style-book/color-examples.js.map +1 -1
- package/build/components/style-book/constants.js +36 -3
- package/build/components/style-book/constants.js.map +1 -1
- package/build/components/style-book/duotone-examples.js +1 -0
- package/build/components/style-book/duotone-examples.js.map +1 -1
- package/build/components/style-book/examples.js +48 -30
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/index.js +185 -61
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/style-book/types.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +1 -0
- package/build/posts.js.map +1 -1
- package/build/store/reducer.js +1 -0
- package/build/store/reducer.js.map +1 -1
- package/build/utils/get-filtered-template-parts.js +1 -0
- package/build/utils/get-filtered-template-parts.js.map +1 -1
- package/build/utils/set-nested-value.js +1 -0
- package/build/utils/set-nested-value.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +7 -10
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-post/index.js +1 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +1 -0
- 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 +1 -0
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -0
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/editor/index.js +1 -9
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +1 -0
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/confirm-reset-shadow-dialog.js +32 -0
- package/build-module/components/global-styles/confirm-reset-shadow-dialog.js.map +1 -0
- package/build-module/components/global-styles/font-families.js +1 -0
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +1 -0
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +1 -0
- 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 +1 -0
- package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +2 -1
- 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 +1 -0
- 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 +1 -0
- 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/upload-fonts.js +1 -0
- 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/filter-fonts.js +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/fonts-outline.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js +1 -0
- package/build-module/components/global-styles/font-library-modal/utils/toggleFont.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-size.js +18 -14
- package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-sizes.js +25 -27
- package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build-module/components/global-styles/highlighted-colors.js +1 -0
- package/build-module/components/global-styles/highlighted-colors.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -0
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -0
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preset-colors.js +1 -0
- package/build-module/components/global-styles/preset-colors.js.map +1 -1
- package/build-module/components/global-styles/preview-colors.js +2 -2
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/preview-styles.js +3 -2
- package/build-module/components/global-styles/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +2 -2
- package/build-module/components/global-styles/preview-typography.js.map +1 -1
- package/build-module/components/global-styles/{preview-iframe.js → preview-wrapper.js} +13 -31
- package/build-module/components/global-styles/preview-wrapper.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +1 -0
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +1 -1
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -0
- 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/shadow-utils.js +1 -0
- package/build-module/components/global-styles/shadow-utils.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +37 -35
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/shadows-panel.js +47 -8
- package/build-module/components/global-styles/shadows-panel.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +1 -0
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typeset.js +1 -0
- package/build-module/components/global-styles/typeset.js.map +1 -1
- package/build-module/components/global-styles/typography-example.js +8 -1
- package/build-module/components/global-styles/typography-example.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +1 -0
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-panel.js +1 -0
- package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -0
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/layout/index.js +25 -9
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/maybe-editor/index.js +59 -0
- package/build-module/components/maybe-editor/index.js.map +1 -0
- package/build-module/components/media/index.js +1 -0
- package/build-module/components/media/index.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +10 -84
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-patterns/header.js +1 -0
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +16 -12
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-pattern-settings.js +1 -0
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/fields.js +6 -38
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/page-templates/index.js +37 -40
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +16 -8
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +41 -22
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app-routes/index.js +1 -0
- package/build-module/components/posts-app-routes/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +9 -1
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -0
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +1 -0
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-keyboard-shortcut/index.js +1 -0
- package/build-module/components/save-keyboard-shortcut/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +1 -0
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -0
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -7
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +1 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +10 -26
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +2 -0
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +41 -74
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js +12 -38
- package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +40 -25
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -4
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +2 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/site-editor-routes/home.js +4 -2
- package/build-module/components/site-editor-routes/home.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +3 -1
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/site-editor-routes/stylebook.js +29 -0
- package/build-module/components/site-editor-routes/stylebook.js.map +1 -0
- package/build-module/components/site-editor-routes/styles.js +7 -1
- package/build-module/components/site-editor-routes/styles.js.map +1 -1
- package/build-module/components/site-editor-routes/template-item.js +3 -3
- package/build-module/components/site-editor-routes/template-item.js.map +1 -1
- package/build-module/components/site-editor-routes/template-part-item.js +3 -3
- package/build-module/components/site-editor-routes/template-part-item.js.map +1 -1
- package/build-module/components/style-book/categories.js +1 -0
- package/build-module/components/style-book/categories.js.map +1 -1
- package/build-module/components/style-book/color-examples.js +9 -3
- package/build-module/components/style-book/color-examples.js.map +1 -1
- package/build-module/components/style-book/constants.js +35 -2
- package/build-module/components/style-book/constants.js.map +1 -1
- package/build-module/components/style-book/duotone-examples.js +1 -0
- package/build-module/components/style-book/duotone-examples.js.map +1 -1
- package/build-module/components/style-book/examples.js +48 -30
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/index.js +185 -64
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/style-book/types.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +1 -0
- package/build-module/posts.js.map +1 -1
- package/build-module/store/reducer.js +1 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils/get-filtered-template-parts.js +1 -0
- package/build-module/utils/get-filtered-template-parts.js.map +1 -1
- package/build-module/utils/set-nested-value.js +1 -0
- package/build-module/utils/set-nested-value.js.map +1 -1
- package/build-style/posts-rtl.css +151 -182
- package/build-style/posts.css +151 -182
- package/build-style/style-rtl.css +343 -354
- package/build-style/style.css +343 -354
- package/package.json +42 -41
- package/src/components/add-new-pattern/index.js +10 -7
- package/src/components/add-new-post/index.js +1 -1
- package/src/components/canvas-loader/style.scss +4 -3
- package/src/components/editor/index.js +1 -7
- package/src/components/editor/style.scss +4 -2
- package/src/components/editor-canvas-container/style.scss +7 -1
- package/src/components/global-styles/confirm-reset-shadow-dialog.js +37 -0
- package/src/components/global-styles/font-library-modal/index.js +1 -1
- package/src/components/global-styles/font-library-modal/style.scss +4 -2
- package/src/components/global-styles/font-sizes/font-size.js +28 -19
- package/src/components/global-styles/font-sizes/font-sizes.js +37 -35
- package/src/components/global-styles/preview-colors.js +3 -3
- package/src/components/global-styles/preview-styles.js +3 -3
- package/src/components/global-styles/preview-typography.js +3 -3
- package/src/components/global-styles/{preview-iframe.js → preview-wrapper.js} +9 -35
- package/src/components/global-styles/screen-block.js +3 -2
- package/src/components/global-styles/shadows-edit-panel.js +58 -49
- package/src/components/global-styles/shadows-panel.js +64 -5
- package/src/components/global-styles/style.scss +40 -18
- package/src/components/global-styles/typography-example.js +12 -1
- package/src/components/global-styles/variations/style.scss +4 -3
- package/src/components/layout/index.js +20 -7
- package/src/components/layout/style.scss +8 -3
- package/src/components/maybe-editor/index.js +58 -0
- package/src/components/page/style.scss +8 -5
- package/src/components/page-patterns/fields.js +13 -100
- package/src/components/page-patterns/index.js +23 -11
- package/src/components/page-patterns/style.scss +4 -53
- package/src/components/page-templates/fields.js +6 -33
- package/src/components/page-templates/index.js +38 -55
- package/src/components/page-templates/style.scss +4 -20
- package/src/components/post-edit/index.js +22 -18
- package/src/components/post-list/index.js +59 -44
- package/src/components/post-list/style.scss +0 -36
- package/src/components/resizable-frame/index.js +10 -1
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +7 -6
- package/src/components/sidebar-dataviews/default-views.js +10 -26
- package/src/components/sidebar-dataviews/index.js +1 -1
- package/src/components/sidebar-dataviews/style.scss +9 -1
- package/src/components/sidebar-global-styles-wrapper/index.js +37 -83
- package/src/components/sidebar-global-styles-wrapper/style.scss +22 -0
- package/src/components/sidebar-navigation-item/style.scss +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-global-styles/content.js +7 -35
- package/src/components/sidebar-navigation-screen-main/index.js +67 -38
- package/src/components/sidebar-navigation-screen-main/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +5 -0
- package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
- package/src/components/sidebar-navigation-screen-patterns/style.scss +2 -0
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/style.scss +4 -0
- package/src/components/site-editor-routes/home.js +2 -2
- package/src/components/site-editor-routes/index.js +2 -0
- package/src/components/site-editor-routes/stylebook.js +28 -0
- package/src/components/site-editor-routes/styles.js +5 -1
- package/src/components/site-editor-routes/template-item.js +3 -3
- package/src/components/site-editor-routes/template-part-item.js +3 -3
- package/src/components/site-hub/style.scss +4 -2
- package/src/components/style-book/color-examples.tsx +21 -3
- package/src/components/style-book/constants.ts +49 -2
- package/src/components/style-book/examples.tsx +55 -31
- package/src/components/style-book/index.js +268 -87
- package/src/components/style-book/style.scss +4 -0
- package/src/components/style-book/types.ts +1 -1
- package/src/style.scss +4 -1
- package/build/components/error-boundary/index.js +0 -47
- package/build/components/error-boundary/index.js.map +0 -1
- package/build/components/error-boundary/warning.js +0 -42
- package/build/components/error-boundary/warning.js.map +0 -1
- package/build/components/global-styles/preview-iframe.js.map +0 -1
- package/build-module/components/error-boundary/index.js +0 -38
- package/build-module/components/error-boundary/index.js.map +0 -1
- package/build-module/components/error-boundary/warning.js +0 -35
- package/build-module/components/error-boundary/warning.js.map +0 -1
- package/build-module/components/global-styles/preview-iframe.js.map +0 -1
- package/src/components/error-boundary/index.js +0 -44
- package/src/components/error-boundary/test/error-boundary.js +0 -40
- package/src/components/error-boundary/warning.js +0 -30
|
@@ -17,12 +17,13 @@ import {
|
|
|
17
17
|
privateApis as blockEditorPrivateApis,
|
|
18
18
|
store as blockEditorStore,
|
|
19
19
|
useSettings,
|
|
20
|
+
BlockEditorProvider,
|
|
20
21
|
__unstableEditorStyles as EditorStyles,
|
|
21
22
|
__unstableIframe as Iframe,
|
|
22
23
|
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
|
|
23
24
|
} from '@wordpress/block-editor';
|
|
24
25
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
25
|
-
import { useSelect } from '@wordpress/data';
|
|
26
|
+
import { useSelect, dispatch } from '@wordpress/data';
|
|
26
27
|
import { useResizeObserver } from '@wordpress/compose';
|
|
27
28
|
import {
|
|
28
29
|
useMemo,
|
|
@@ -31,8 +32,11 @@ import {
|
|
|
31
32
|
useContext,
|
|
32
33
|
useRef,
|
|
33
34
|
useLayoutEffect,
|
|
35
|
+
useEffect,
|
|
34
36
|
} from '@wordpress/element';
|
|
35
37
|
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
38
|
+
import { uploadMedia } from '@wordpress/media-utils';
|
|
39
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* Internal dependencies
|
|
@@ -45,6 +49,13 @@ import {
|
|
|
45
49
|
getTopLevelStyleBookCategories,
|
|
46
50
|
} from './categories';
|
|
47
51
|
import { getExamples } from './examples';
|
|
52
|
+
import { store as siteEditorStore } from '../../store';
|
|
53
|
+
import { useSection } from '../sidebar-global-styles-wrapper';
|
|
54
|
+
import { GlobalStylesRenderer } from '../global-styles-renderer';
|
|
55
|
+
import {
|
|
56
|
+
STYLE_BOOK_COLOR_GROUPS,
|
|
57
|
+
STYLE_BOOK_PREVIEW_CATEGORIES,
|
|
58
|
+
} from '../style-book/constants';
|
|
48
59
|
|
|
49
60
|
const {
|
|
50
61
|
ExperimentalBlockEditorProvider,
|
|
@@ -67,11 +78,14 @@ function isObjectEmpty( object ) {
|
|
|
67
78
|
* @param {HTMLIFrameElement} iframe The target iframe.
|
|
68
79
|
*/
|
|
69
80
|
const scrollToSection = ( anchorId, iframe ) => {
|
|
70
|
-
if ( ! iframe || ! iframe?.contentDocument ) {
|
|
81
|
+
if ( ! anchorId || ! iframe || ! iframe?.contentDocument ) {
|
|
71
82
|
return;
|
|
72
83
|
}
|
|
73
84
|
|
|
74
|
-
const element =
|
|
85
|
+
const element =
|
|
86
|
+
anchorId === 'top'
|
|
87
|
+
? iframe.contentDocument.body
|
|
88
|
+
: iframe.contentDocument.getElementById( anchorId );
|
|
75
89
|
if ( element ) {
|
|
76
90
|
element.scrollIntoView( {
|
|
77
91
|
behavior: 'smooth',
|
|
@@ -80,29 +94,24 @@ const scrollToSection = ( anchorId, iframe ) => {
|
|
|
80
94
|
};
|
|
81
95
|
|
|
82
96
|
/**
|
|
83
|
-
* Parses a Block Editor navigation path to
|
|
84
|
-
*
|
|
85
|
-
* representing a style book tab/section.
|
|
97
|
+
* Parses a Block Editor navigation path to build a style book navigation path.
|
|
98
|
+
* The object can be extended to include a category, representing a style book tab/section.
|
|
86
99
|
*
|
|
87
100
|
* @param {string} path An internal Block Editor navigation path.
|
|
88
101
|
* @return {null|{block: string}} An object containing the example to navigate to.
|
|
89
102
|
*/
|
|
90
103
|
const getStyleBookNavigationFromPath = ( path ) => {
|
|
91
104
|
if ( path && typeof path === 'string' ) {
|
|
92
|
-
if (
|
|
105
|
+
if (
|
|
106
|
+
path === '/' ||
|
|
107
|
+
path.startsWith( '/typography' ) ||
|
|
108
|
+
path.startsWith( '/colors' ) ||
|
|
109
|
+
path.startsWith( '/blocks' )
|
|
110
|
+
) {
|
|
93
111
|
return {
|
|
94
|
-
|
|
112
|
+
top: true,
|
|
95
113
|
};
|
|
96
114
|
}
|
|
97
|
-
let block = path.includes( '/blocks/' )
|
|
98
|
-
? decodeURIComponent( path.split( '/blocks/' )[ 1 ] )
|
|
99
|
-
: null;
|
|
100
|
-
// Default to theme-colors if the path ends with /colors.
|
|
101
|
-
block = path.endsWith( '/colors' ) ? 'theme-colors' : block;
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
block,
|
|
105
|
-
};
|
|
106
115
|
}
|
|
107
116
|
return null;
|
|
108
117
|
};
|
|
@@ -182,6 +191,31 @@ function useMultiOriginPalettes() {
|
|
|
182
191
|
return palettes;
|
|
183
192
|
}
|
|
184
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Get deduped examples for single page stylebook.
|
|
196
|
+
* @param {Array} examples Array of examples.
|
|
197
|
+
* @return {Array} Deduped examples.
|
|
198
|
+
*/
|
|
199
|
+
export function getExamplesForSinglePageUse( examples ) {
|
|
200
|
+
const examplesForSinglePageUse = [];
|
|
201
|
+
const overviewCategoryExamples = getExamplesByCategory(
|
|
202
|
+
{ slug: 'overview' },
|
|
203
|
+
examples
|
|
204
|
+
);
|
|
205
|
+
examplesForSinglePageUse.push( ...overviewCategoryExamples.examples );
|
|
206
|
+
const otherExamples = examples.filter( ( example ) => {
|
|
207
|
+
return (
|
|
208
|
+
example.category !== 'overview' &&
|
|
209
|
+
! overviewCategoryExamples.examples.find(
|
|
210
|
+
( overviewExample ) => overviewExample.name === example.name
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
} );
|
|
214
|
+
examplesForSinglePageUse.push( ...otherExamples );
|
|
215
|
+
|
|
216
|
+
return examplesForSinglePageUse;
|
|
217
|
+
}
|
|
218
|
+
|
|
185
219
|
function StyleBook( {
|
|
186
220
|
enableResizing = true,
|
|
187
221
|
isSelected,
|
|
@@ -208,21 +242,7 @@ function StyleBook( {
|
|
|
208
242
|
[ examples ]
|
|
209
243
|
);
|
|
210
244
|
|
|
211
|
-
const examplesForSinglePageUse =
|
|
212
|
-
const overviewCategoryExamples = getExamplesByCategory(
|
|
213
|
-
{ slug: 'overview' },
|
|
214
|
-
examples
|
|
215
|
-
);
|
|
216
|
-
examplesForSinglePageUse.push( ...overviewCategoryExamples.examples );
|
|
217
|
-
const otherExamples = examples.filter( ( example ) => {
|
|
218
|
-
return (
|
|
219
|
-
example.category !== 'overview' &&
|
|
220
|
-
! overviewCategoryExamples.examples.find(
|
|
221
|
-
( overviewExample ) => overviewExample.name === example.name
|
|
222
|
-
)
|
|
223
|
-
);
|
|
224
|
-
} );
|
|
225
|
-
examplesForSinglePageUse.push( ...otherExamples );
|
|
245
|
+
const examplesForSinglePageUse = getExamplesForSinglePageUse( examples );
|
|
226
246
|
|
|
227
247
|
const { base: baseConfig } = useContext( GlobalStylesContext );
|
|
228
248
|
const goTo = getStyleBookNavigationFromPath( path );
|
|
@@ -285,29 +305,43 @@ function StyleBook( {
|
|
|
285
305
|
) ) }
|
|
286
306
|
</Tabs.TabList>
|
|
287
307
|
</div>
|
|
288
|
-
{ tabs.map( ( tab ) =>
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
308
|
+
{ tabs.map( ( tab ) => {
|
|
309
|
+
const categoryDefinition = tab.slug
|
|
310
|
+
? getTopLevelStyleBookCategories().find(
|
|
311
|
+
( _category ) =>
|
|
312
|
+
_category.slug === tab.slug
|
|
313
|
+
)
|
|
314
|
+
: null;
|
|
315
|
+
const filteredExamples = categoryDefinition
|
|
316
|
+
? getExamplesByCategory(
|
|
317
|
+
categoryDefinition,
|
|
318
|
+
examples
|
|
319
|
+
)
|
|
320
|
+
: { examples };
|
|
321
|
+
return (
|
|
322
|
+
<Tabs.TabPanel
|
|
323
|
+
key={ tab.slug }
|
|
324
|
+
tabId={ tab.slug }
|
|
325
|
+
focusable={ false }
|
|
326
|
+
className="edit-site-style-book__tabpanel"
|
|
327
|
+
>
|
|
328
|
+
<StyleBookBody
|
|
329
|
+
category={ tab.slug }
|
|
330
|
+
examples={ filteredExamples }
|
|
331
|
+
isSelected={ isSelected }
|
|
332
|
+
onSelect={ onSelect }
|
|
333
|
+
settings={ settings }
|
|
334
|
+
sizes={ sizes }
|
|
335
|
+
title={ tab.title }
|
|
336
|
+
goTo={ goTo }
|
|
337
|
+
/>
|
|
338
|
+
</Tabs.TabPanel>
|
|
339
|
+
);
|
|
340
|
+
} ) }
|
|
307
341
|
</Tabs>
|
|
308
342
|
) : (
|
|
309
343
|
<StyleBookBody
|
|
310
|
-
examples={ examplesForSinglePageUse }
|
|
344
|
+
examples={ { examples: examplesForSinglePageUse } }
|
|
311
345
|
isSelected={ isSelected }
|
|
312
346
|
onClick={ onClick }
|
|
313
347
|
onSelect={ onSelect }
|
|
@@ -321,8 +355,157 @@ function StyleBook( {
|
|
|
321
355
|
);
|
|
322
356
|
}
|
|
323
357
|
|
|
324
|
-
|
|
325
|
-
|
|
358
|
+
/**
|
|
359
|
+
* Style Book Preview component renders the stylebook without the Editor dependency.
|
|
360
|
+
*
|
|
361
|
+
* @param {Object} props Component props.
|
|
362
|
+
* @param {Object} props.userConfig User configuration.
|
|
363
|
+
* @param {boolean} props.isStatic Whether the stylebook is static or clickable.
|
|
364
|
+
* @return {Object} Style Book Preview component.
|
|
365
|
+
*/
|
|
366
|
+
export const StyleBookPreview = ( { userConfig = {}, isStatic = false } ) => {
|
|
367
|
+
const siteEditorSettings = useSelect(
|
|
368
|
+
( select ) => select( siteEditorStore ).getSettings(),
|
|
369
|
+
[]
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
const canUserUploadMedia = useSelect(
|
|
373
|
+
( select ) =>
|
|
374
|
+
select( coreStore ).canUser( 'create', {
|
|
375
|
+
kind: 'root',
|
|
376
|
+
name: 'media',
|
|
377
|
+
} ),
|
|
378
|
+
[]
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
// Update block editor settings because useMultipleOriginColorsAndGradients fetch colours from there.
|
|
382
|
+
useEffect( () => {
|
|
383
|
+
dispatch( blockEditorStore ).updateSettings( {
|
|
384
|
+
...siteEditorSettings,
|
|
385
|
+
mediaUpload: canUserUploadMedia ? uploadMedia : undefined,
|
|
386
|
+
} );
|
|
387
|
+
}, [ siteEditorSettings, canUserUploadMedia ] );
|
|
388
|
+
|
|
389
|
+
const [ section, onChangeSection ] = useSection();
|
|
390
|
+
|
|
391
|
+
const isSelected = ( blockName ) => {
|
|
392
|
+
// Match '/blocks/core%2Fbutton' and
|
|
393
|
+
// '/blocks/core%2Fbutton/typography', but not
|
|
394
|
+
// '/blocks/core%2Fbuttons'.
|
|
395
|
+
return (
|
|
396
|
+
section === `/blocks/${ encodeURIComponent( blockName ) }` ||
|
|
397
|
+
section.startsWith(
|
|
398
|
+
`/blocks/${ encodeURIComponent( blockName ) }/`
|
|
399
|
+
)
|
|
400
|
+
);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
const onSelect = ( blockName ) => {
|
|
404
|
+
if (
|
|
405
|
+
STYLE_BOOK_COLOR_GROUPS.find(
|
|
406
|
+
( group ) => group.slug === blockName
|
|
407
|
+
)
|
|
408
|
+
) {
|
|
409
|
+
// Go to color palettes Global Styles.
|
|
410
|
+
onChangeSection( '/colors/palette' );
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
if ( blockName === 'typography' ) {
|
|
414
|
+
// Go to typography Global Styles.
|
|
415
|
+
onChangeSection( '/typography' );
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Now go to the selected block.
|
|
420
|
+
onChangeSection( `/blocks/${ encodeURIComponent( blockName ) }` );
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
const [ resizeObserver, sizes ] = useResizeObserver();
|
|
424
|
+
const colors = useMultiOriginPalettes();
|
|
425
|
+
const examples = getExamples( colors );
|
|
426
|
+
const examplesForSinglePageUse = getExamplesForSinglePageUse( examples );
|
|
427
|
+
|
|
428
|
+
let previewCategory = null;
|
|
429
|
+
if ( section.includes( '/colors' ) ) {
|
|
430
|
+
previewCategory = 'colors';
|
|
431
|
+
} else if ( section.includes( '/typography' ) ) {
|
|
432
|
+
previewCategory = 'text';
|
|
433
|
+
} else if ( section.includes( '/blocks' ) ) {
|
|
434
|
+
previewCategory = 'blocks';
|
|
435
|
+
const blockName =
|
|
436
|
+
decodeURIComponent( section ).split( '/blocks/' )[ 1 ];
|
|
437
|
+
if (
|
|
438
|
+
blockName &&
|
|
439
|
+
examples.find( ( example ) => example.name === blockName )
|
|
440
|
+
) {
|
|
441
|
+
previewCategory = blockName;
|
|
442
|
+
}
|
|
443
|
+
} else if ( ! isStatic ) {
|
|
444
|
+
previewCategory = 'overview';
|
|
445
|
+
}
|
|
446
|
+
const categoryDefinition = STYLE_BOOK_PREVIEW_CATEGORIES.find(
|
|
447
|
+
( category ) => category.slug === previewCategory
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
// If there's no category definition there may be a single block.
|
|
451
|
+
const filteredExamples = categoryDefinition
|
|
452
|
+
? getExamplesByCategory( categoryDefinition, examples )
|
|
453
|
+
: {
|
|
454
|
+
examples: [
|
|
455
|
+
examples.find(
|
|
456
|
+
( example ) => example.name === previewCategory
|
|
457
|
+
),
|
|
458
|
+
],
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// If there's no preview category, show all examples.
|
|
462
|
+
const displayedExamples = previewCategory
|
|
463
|
+
? filteredExamples
|
|
464
|
+
: { examples: examplesForSinglePageUse };
|
|
465
|
+
|
|
466
|
+
const { base: baseConfig } = useContext( GlobalStylesContext );
|
|
467
|
+
const goTo = getStyleBookNavigationFromPath( section );
|
|
468
|
+
|
|
469
|
+
const mergedConfig = useMemo( () => {
|
|
470
|
+
if ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {
|
|
471
|
+
return mergeBaseAndUserConfigs( baseConfig, userConfig );
|
|
472
|
+
}
|
|
473
|
+
return {};
|
|
474
|
+
}, [ baseConfig, userConfig ] );
|
|
475
|
+
|
|
476
|
+
const [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );
|
|
477
|
+
|
|
478
|
+
const settings = useMemo(
|
|
479
|
+
() => ( {
|
|
480
|
+
...siteEditorSettings,
|
|
481
|
+
styles:
|
|
482
|
+
! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )
|
|
483
|
+
? globalStyles
|
|
484
|
+
: siteEditorSettings.styles,
|
|
485
|
+
isPreviewMode: true,
|
|
486
|
+
} ),
|
|
487
|
+
[ globalStyles, siteEditorSettings, userConfig ]
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
return (
|
|
491
|
+
<div className="edit-site-style-book">
|
|
492
|
+
{ resizeObserver }
|
|
493
|
+
<BlockEditorProvider settings={ settings }>
|
|
494
|
+
<GlobalStylesRenderer disableRootPadding />
|
|
495
|
+
<StyleBookBody
|
|
496
|
+
examples={ displayedExamples }
|
|
497
|
+
settings={ settings }
|
|
498
|
+
goTo={ goTo }
|
|
499
|
+
sizes={ sizes }
|
|
500
|
+
isSelected={ ! isStatic ? isSelected : null }
|
|
501
|
+
onSelect={ ! isStatic ? onSelect : null }
|
|
502
|
+
/>
|
|
503
|
+
</BlockEditorProvider>
|
|
504
|
+
</div>
|
|
505
|
+
);
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
export const StyleBookBody = ( {
|
|
326
509
|
examples,
|
|
327
510
|
isSelected,
|
|
328
511
|
onClick,
|
|
@@ -365,10 +548,12 @@ const StyleBookBody = ( {
|
|
|
365
548
|
|
|
366
549
|
const handleLoad = () => setHasIframeLoaded( true );
|
|
367
550
|
useLayoutEffect( () => {
|
|
368
|
-
if (
|
|
369
|
-
|
|
551
|
+
if ( hasIframeLoaded && iframeRef?.current ) {
|
|
552
|
+
if ( goTo?.top ) {
|
|
553
|
+
scrollToSection( 'top', iframeRef?.current );
|
|
554
|
+
}
|
|
370
555
|
}
|
|
371
|
-
}, [ iframeRef?.current, goTo
|
|
556
|
+
}, [ iframeRef?.current, goTo, scrollToSection, hasIframeLoaded ] );
|
|
372
557
|
|
|
373
558
|
return (
|
|
374
559
|
<Iframe
|
|
@@ -392,8 +577,7 @@ const StyleBookBody = ( {
|
|
|
392
577
|
className={ clsx( 'edit-site-style-book__examples', {
|
|
393
578
|
'is-wide': sizes.width > 600,
|
|
394
579
|
} ) }
|
|
395
|
-
|
|
396
|
-
category={ category }
|
|
580
|
+
filteredExamples={ examples }
|
|
397
581
|
label={
|
|
398
582
|
title
|
|
399
583
|
? sprintf(
|
|
@@ -405,24 +589,14 @@ const StyleBookBody = ( {
|
|
|
405
589
|
}
|
|
406
590
|
isSelected={ isSelected }
|
|
407
591
|
onSelect={ onSelect }
|
|
408
|
-
key={
|
|
592
|
+
key={ title }
|
|
409
593
|
/>
|
|
410
594
|
</Iframe>
|
|
411
595
|
);
|
|
412
596
|
};
|
|
413
597
|
|
|
414
598
|
const Examples = memo(
|
|
415
|
-
( { className,
|
|
416
|
-
const categoryDefinition = category
|
|
417
|
-
? getTopLevelStyleBookCategories().find(
|
|
418
|
-
( _category ) => _category.slug === category
|
|
419
|
-
)
|
|
420
|
-
: null;
|
|
421
|
-
|
|
422
|
-
const filteredExamples = categoryDefinition
|
|
423
|
-
? getExamplesByCategory( categoryDefinition, examples )
|
|
424
|
-
: { examples };
|
|
425
|
-
|
|
599
|
+
( { className, filteredExamples, label, isSelected, onSelect } ) => {
|
|
426
600
|
return (
|
|
427
601
|
<Composite
|
|
428
602
|
orientation="vertical"
|
|
@@ -439,7 +613,11 @@ const Examples = memo(
|
|
|
439
613
|
content={ example.content }
|
|
440
614
|
blocks={ example.blocks }
|
|
441
615
|
isSelected={ isSelected?.( example.name ) }
|
|
442
|
-
onClick={
|
|
616
|
+
onClick={
|
|
617
|
+
!! onSelect
|
|
618
|
+
? () => onSelect( example.name )
|
|
619
|
+
: null
|
|
620
|
+
}
|
|
443
621
|
/>
|
|
444
622
|
) ) }
|
|
445
623
|
{ !! filteredExamples?.subcategories?.length &&
|
|
@@ -476,9 +654,7 @@ const Subcategory = ( { examples, isSelected, onSelect } ) => {
|
|
|
476
654
|
content={ example.content }
|
|
477
655
|
blocks={ example.blocks }
|
|
478
656
|
isSelected={ isSelected?.( example.name ) }
|
|
479
|
-
onClick={ () =>
|
|
480
|
-
onSelect?.( example.name );
|
|
481
|
-
} }
|
|
657
|
+
onClick={ !! onSelect ? () => onSelect( example.name ) : null }
|
|
482
658
|
/>
|
|
483
659
|
) )
|
|
484
660
|
);
|
|
@@ -506,12 +682,13 @@ const Example = ( { id, title, blocks, isSelected, onClick, content } ) => {
|
|
|
506
682
|
[ blocks ]
|
|
507
683
|
);
|
|
508
684
|
|
|
509
|
-
const disabledProps =
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
685
|
+
const disabledProps =
|
|
686
|
+
disabledExamples.includes( id ) || ! onClick
|
|
687
|
+
? {
|
|
688
|
+
disabled: true,
|
|
689
|
+
accessibleWhenDisabled: !! onClick,
|
|
690
|
+
}
|
|
691
|
+
: {};
|
|
515
692
|
|
|
516
693
|
return (
|
|
517
694
|
<div role="row">
|
|
@@ -522,13 +699,17 @@ const Example = ( { id, title, blocks, isSelected, onClick, content } ) => {
|
|
|
522
699
|
'is-disabled-example': !! disabledProps?.disabled,
|
|
523
700
|
} ) }
|
|
524
701
|
id={ id }
|
|
525
|
-
aria-label={
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
702
|
+
aria-label={
|
|
703
|
+
!! onClick
|
|
704
|
+
? sprintf(
|
|
705
|
+
// translators: %s: Title of a block, e.g. Heading.
|
|
706
|
+
__( 'Open %s styles in Styles panel' ),
|
|
707
|
+
title
|
|
708
|
+
)
|
|
709
|
+
: undefined
|
|
710
|
+
}
|
|
530
711
|
render={ <div /> }
|
|
531
|
-
role=
|
|
712
|
+
role={ !! onClick ? 'button' : null }
|
|
532
713
|
onClick={ onClick }
|
|
533
714
|
{ ...disabledProps }
|
|
534
715
|
>
|
package/src/style.scss
CHANGED
|
@@ -21,9 +21,11 @@
|
|
|
21
21
|
@import "./components/sidebar-navigation-screen-details-footer/style.scss";
|
|
22
22
|
@import "./components/sidebar-navigation-screen-navigation-menu/style.scss";
|
|
23
23
|
@import "./components/sidebar-navigation-screen-patterns/style.scss";
|
|
24
|
+
@import "./components/sidebar-navigation-screen-navigation-menus/style.scss";
|
|
25
|
+
@import "./components/sidebar-navigation-screen-main/style.scss";
|
|
26
|
+
@import "./components/sidebar-navigation-screen-templates-browse/style.scss";
|
|
24
27
|
@import "./components/sidebar-dataviews/style.scss";
|
|
25
28
|
@import "./components/site-hub/style.scss";
|
|
26
|
-
@import "./components/sidebar-navigation-screen-navigation-menus/style.scss";
|
|
27
29
|
@import "./components/site-icon/style.scss";
|
|
28
30
|
@import "./components/style-book/style.scss";
|
|
29
31
|
@import "./components/editor-canvas-container/style.scss";
|
|
@@ -47,6 +49,7 @@
|
|
|
47
49
|
mix-blend-mode: normal;
|
|
48
50
|
display: block;
|
|
49
51
|
}
|
|
52
|
+
|
|
50
53
|
/* stylelint-enable */
|
|
51
54
|
|
|
52
55
|
body.js #wpadminbar {
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
var _i18n = require("@wordpress/i18n");
|
|
10
|
-
var _hooks = require("@wordpress/hooks");
|
|
11
|
-
var _warning = _interopRequireDefault(require("./warning"));
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
class ErrorBoundary extends _element.Component {
|
|
22
|
-
constructor() {
|
|
23
|
-
super(...arguments);
|
|
24
|
-
this.state = {
|
|
25
|
-
error: null
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
componentDidCatch(error) {
|
|
29
|
-
(0, _hooks.doAction)('editor.ErrorBoundary.errorLogged', error);
|
|
30
|
-
}
|
|
31
|
-
static getDerivedStateFromError(error) {
|
|
32
|
-
return {
|
|
33
|
-
error
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
render() {
|
|
37
|
-
if (!this.state.error) {
|
|
38
|
-
return this.props.children;
|
|
39
|
-
}
|
|
40
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_warning.default, {
|
|
41
|
-
message: (0, _i18n.__)('The editor has encountered an unexpected error.'),
|
|
42
|
-
error: this.state.error
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.default = ErrorBoundary;
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_hooks","_warning","_interopRequireDefault","_jsxRuntime","ErrorBoundary","Component","constructor","arguments","state","error","componentDidCatch","doAction","getDerivedStateFromError","render","props","children","jsx","default","message","__","exports"],"sources":["@wordpress/edit-site/src/components/error-boundary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundaryWarning from './warning';\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\trender() {\n\t\tif ( ! this.state.error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ this.state.error }\n\t\t\t/>\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAA6C,IAAAK,WAAA,GAAAL,OAAA;AAV7C;AACA;AACA;;AAKA;AACA;AACA;;AAGe,MAAMM,aAAa,SAASC,kBAAS,CAAC;EACpDC,WAAWA,CAAA,EAAG;IACb,KAAK,CAAE,GAAGC,SAAU,CAAC;IAErB,IAAI,CAACC,KAAK,GAAG;MACZC,KAAK,EAAE;IACR,CAAC;EACF;EAEAC,iBAAiBA,CAAED,KAAK,EAAG;IAC1B,IAAAE,eAAQ,EAAE,kCAAkC,EAAEF,KAAM,CAAC;EACtD;EAEA,OAAOG,wBAAwBA,CAAEH,KAAK,EAAG;IACxC,OAAO;MAAEA;IAAM,CAAC;EACjB;EAEAI,MAAMA,CAAA,EAAG;IACR,IAAK,CAAE,IAAI,CAACL,KAAK,CAACC,KAAK,EAAG;MACzB,OAAO,IAAI,CAACK,KAAK,CAACC,QAAQ;IAC3B;IAEA,oBACC,IAAAZ,WAAA,CAAAa,GAAA,EAACf,QAAA,CAAAgB,OAAoB;MACpBC,OAAO,EAAG,IAAAC,QAAE,EACX,iDACD,CAAG;MACHV,KAAK,EAAG,IAAI,CAACD,KAAK,CAACC;IAAO,CAC1B,CAAC;EAEJ;AACD;AAACW,OAAA,CAAAH,OAAA,GAAAb,aAAA","ignoreList":[]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = ErrorBoundaryWarning;
|
|
7
|
-
var _i18n = require("@wordpress/i18n");
|
|
8
|
-
var _components = require("@wordpress/components");
|
|
9
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
-
var _compose = require("@wordpress/compose");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
function CopyButton({
|
|
17
|
-
text,
|
|
18
|
-
children
|
|
19
|
-
}) {
|
|
20
|
-
const ref = (0, _compose.useCopyToClipboard)(text);
|
|
21
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
22
|
-
__next40pxDefaultSize: true,
|
|
23
|
-
variant: "secondary",
|
|
24
|
-
ref: ref,
|
|
25
|
-
children: children
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function ErrorBoundaryWarning({
|
|
29
|
-
message,
|
|
30
|
-
error
|
|
31
|
-
}) {
|
|
32
|
-
const actions = [/*#__PURE__*/(0, _jsxRuntime.jsx)(CopyButton, {
|
|
33
|
-
text: error.stack,
|
|
34
|
-
children: (0, _i18n.__)('Copy Error')
|
|
35
|
-
}, "copy-error")];
|
|
36
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.Warning, {
|
|
37
|
-
className: "editor-error-boundary",
|
|
38
|
-
actions: actions,
|
|
39
|
-
children: message
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_blockEditor","_compose","_jsxRuntime","CopyButton","text","children","ref","useCopyToClipboard","jsx","Button","__next40pxDefaultSize","variant","ErrorBoundaryWarning","message","error","actions","stack","__","Warning","className"],"sources":["@wordpress/edit-site/src/components/error-boundary/warning.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button __next40pxDefaultSize variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default function ErrorBoundaryWarning( { message, error } ) {\n\tconst actions = [\n\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t{ __( 'Copy Error' ) }\n\t\t</CopyButton>,\n\t];\n\n\treturn (\n\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAwD,IAAAI,WAAA,GAAAJ,OAAA;AANxD;AACA;AACA;;AAMA,SAASK,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEH,IAAK,CAAC;EACtC,oBACC,IAAAF,WAAA,CAAAM,GAAA,EAACT,WAAA,CAAAU,MAAM;IAACC,qBAAqB;IAACC,OAAO,EAAC,WAAW;IAACL,GAAG,EAAGA,GAAK;IAAAD,QAAA,EAC1DA;EAAQ,CACH,CAAC;AAEX;AAEe,SAASO,oBAAoBA,CAAE;EAAEC,OAAO;EAAEC;AAAM,CAAC,EAAG;EAClE,MAAMC,OAAO,GAAG,cACf,IAAAb,WAAA,CAAAM,GAAA,EAACL,UAAU;IAAkBC,IAAI,EAAGU,KAAK,CAACE,KAAO;IAAAX,QAAA,EAC9C,IAAAY,QAAE,EAAE,YAAa;EAAC,GADL,YAEJ,CAAC,CACb;EAED,oBACC,IAAAf,WAAA,CAAAM,GAAA,EAACR,YAAA,CAAAkB,OAAO;IAACC,SAAS,EAAC,uBAAuB;IAACJ,OAAO,EAAGA,OAAS;IAAAV,QAAA,EAC3DQ;EAAO,CACD,CAAC;AAEZ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_compose","_element","_lockUnlock","_jsxRuntime","useGlobalStyle","useGlobalStylesOutput","unlock","blockEditorPrivateApis","normalizedWidth","normalizedHeight","THROTTLE_OPTIONS","leading","trailing","PreviewIframe","children","label","isFocused","withHoverView","backgroundColor","gradientValue","styles","disableMotion","useReducedMotion","isHovered","setIsHovered","useState","containerResizeListener","width","useResizeObserver","throttledWidth","setThrottledWidthState","ratioState","setRatioState","setThrottledWidth","useThrottle","useLayoutEffect","newRatio","ratioDiff","isRatioDiffBigEnough","Math","abs","fallbackRatio","ratio","editorStyles","useMemo","css","isGlobalStyles","isReady","jsxs","Fragment","jsx","style","position","__unstableIframe","className","height","onMouseEnter","onMouseLeave","tabIndex","__unstableEditorStyles","__unstableMotion","div","background","cursor","undefined","initial","animate","concat","map","child","key"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-iframe.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__unstableIframe as Iframe,\n\t__unstableEditorStyles as EditorStyles,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport {\n\tuseThrottle,\n\tuseReducedMotion,\n\tuseResizeObserver,\n} from '@wordpress/compose';\nimport { useLayoutEffect, useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle, useGlobalStylesOutput } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst normalizedWidth = 248;\nconst normalizedHeight = 152;\n\n// Throttle options for useThrottle. Must be defined outside of the component,\n// so that the object reference is the same on each render.\nconst THROTTLE_OPTIONS = {\n\tleading: true,\n\ttrailing: true,\n};\n\nexport default function PreviewIframe( {\n\tchildren,\n\tlabel,\n\tisFocused,\n\twithHoverView,\n} ) {\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\n\tconst [ styles ] = useGlobalStylesOutput();\n\tconst disableMotion = useReducedMotion();\n\tconst [ isHovered, setIsHovered ] = useState( false );\n\tconst [ containerResizeListener, { width } ] = useResizeObserver();\n\tconst [ throttledWidth, setThrottledWidthState ] = useState( width );\n\tconst [ ratioState, setRatioState ] = useState();\n\n\tconst setThrottledWidth = useThrottle(\n\t\tsetThrottledWidthState,\n\t\t250,\n\t\tTHROTTLE_OPTIONS\n\t);\n\n\t// Must use useLayoutEffect to avoid a flash of the iframe at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tif ( width ) {\n\t\t\tsetThrottledWidth( width );\n\t\t}\n\t}, [ width, setThrottledWidth ] );\n\n\t// Must use useLayoutEffect to avoid a flash of the iframe at the wrong\n\t// size before the width is set.\n\tuseLayoutEffect( () => {\n\t\tconst newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;\n\t\tconst ratioDiff = newRatio - ( ratioState || 0 );\n\n\t\t// Only update the ratio state if the difference is big enough\n\t\t// or if the ratio state is not yet set. This is to avoid an\n\t\t// endless loop of updates at particular viewport heights when the\n\t\t// presence of a scrollbar causes the width to change slightly.\n\t\tconst isRatioDiffBigEnough = Math.abs( ratioDiff ) > 0.1;\n\n\t\tif ( isRatioDiffBigEnough || ! ratioState ) {\n\t\t\tsetRatioState( newRatio );\n\t\t}\n\t}, [ throttledWidth, ratioState ] );\n\n\t// Set a fallbackRatio to use before the throttled ratio has been set.\n\tconst fallbackRatio = width ? width / normalizedWidth : 1;\n\t/*\n\t * Use the throttled ratio if it has been calculated, otherwise\n\t * use the fallback ratio. The throttled ratio is used to avoid\n\t * an endless loop of updates at particular viewport heights.\n\t * See: https://github.com/WordPress/gutenberg/issues/55112\n\t */\n\tconst ratio = ratioState ? ratioState : fallbackRatio;\n\n\t/*\n\t * Reset leaked styles from WP common.css and remove main content layout padding and border.\n\t * Add pointer cursor to the body to indicate the iframe is interactive,\n\t * similar to Typography variation previews.\n\t */\n\tconst editorStyles = useMemo( () => {\n\t\tif ( styles ) {\n\t\t\treturn [\n\t\t\t\t...styles,\n\t\t\t\t{\n\t\t\t\t\tcss: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;cursor: pointer;}',\n\t\t\t\t\tisGlobalStyles: true,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn styles;\n\t}, [ styles ] );\n\tconst isReady = !! width;\n\n\treturn (\n\t\t<>\n\t\t\t<div style={ { position: 'relative' } }>\n\t\t\t\t{ containerResizeListener }\n\t\t\t</div>\n\t\t\t{ isReady && (\n\t\t\t\t<Iframe\n\t\t\t\t\tclassName=\"edit-site-global-styles-preview__iframe\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t} }\n\t\t\t\t\tonMouseEnter={ () => setIsHovered( true ) }\n\t\t\t\t\tonMouseLeave={ () => setIsHovered( false ) }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: normalizedHeight * ratio,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\t\tcursor: withHoverView ? 'pointer' : undefined,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tinitial=\"start\"\n\t\t\t\t\t\tanimate={\n\t\t\t\t\t\t\t( isHovered || isFocused ) &&\n\t\t\t\t\t\t\t! disableMotion &&\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t? 'hover'\n\t\t\t\t\t\t\t\t: 'start'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ []\n\t\t\t\t\t\t\t.concat( children ) // This makes sure children is always an array.\n\t\t\t\t\t\t\t.map( ( child, key ) => child( { ratio, key } ) ) }\n\t\t\t\t\t</motion.div>\n\t\t\t\t</Iframe>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"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","ignoreList":[]}
|