@wordpress/edit-site 6.13.1-next.cd6172eb0.0 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-pattern/index.js +1 -0
- 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-canvas-container/index.js +1 -0
- package/build/components/editor-canvas-container/index.js.map +1 -1
- 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 +1 -0
- 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 +1 -0
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-sizes.js +1 -0
- 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-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 +15 -21
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/shadows-panel.js +1 -0
- 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 +14 -7
- 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 +2 -47
- 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 +2 -21
- 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 +30 -19
- 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 +1 -0
- 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 +7 -24
- 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 +1 -0
- 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 +37 -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 +33 -0
- package/build/components/site-editor-routes/stylebook.js.map +1 -0
- 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 +0 -1
- 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 +103 -24
- 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 +1 -0
- 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-canvas-container/index.js +1 -0
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- 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-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 +16 -22
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/shadows-panel.js +1 -0
- 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 +14 -7
- 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 +3 -48
- 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 +1 -20
- 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 +31 -20
- 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 +1 -0
- 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 +7 -24
- 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 +1 -0
- 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 +39 -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 +25 -0
- package/build-module/components/site-editor-routes/stylebook.js.map +1 -0
- 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 +0 -1
- 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 +102 -26
- 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 +92 -117
- package/build-style/posts.css +92 -117
- package/build-style/style-rtl.css +205 -195
- package/build-style/style.css +205 -195
- package/package.json +40 -40
- package/src/components/add-new-post/index.js +1 -1
- 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/shadows-edit-panel.js +20 -21
- package/src/components/global-styles/style.scss +32 -18
- package/src/components/global-styles/typography-example.js +12 -1
- package/src/components/layout/index.js +8 -6
- package/src/components/maybe-editor/index.js +58 -0
- package/src/components/page-patterns/fields.js +2 -59
- package/src/components/page-patterns/index.js +23 -11
- package/src/components/page-patterns/style.scss +0 -28
- package/src/components/page-templates/fields.js +1 -18
- package/src/components/page-templates/index.js +38 -55
- package/src/components/post-edit/index.js +22 -18
- package/src/components/post-list/index.js +49 -43
- package/src/components/post-list/style.scss +0 -36
- package/src/components/resizable-frame/index.js +10 -1
- package/src/components/sidebar-dataviews/default-views.js +7 -24
- package/src/components/sidebar-dataviews/index.js +1 -1
- package/src/components/sidebar-dataviews/style.scss +5 -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 +66 -37
- 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/template-item.js +3 -3
- package/src/components/site-editor-routes/template-part-item.js +3 -3
- package/src/components/style-book/color-examples.tsx +21 -3
- package/src/components/style-book/constants.ts +0 -1
- package/src/components/style-book/examples.tsx +55 -31
- package/src/components/style-book/index.js +145 -38
- 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,
|
|
@@ -45,6 +46,7 @@ import {
|
|
|
45
46
|
getTopLevelStyleBookCategories,
|
|
46
47
|
} from './categories';
|
|
47
48
|
import { getExamples } from './examples';
|
|
49
|
+
import { store as siteEditorStore } from '../../store';
|
|
48
50
|
|
|
49
51
|
const {
|
|
50
52
|
ExperimentalBlockEditorProvider,
|
|
@@ -67,11 +69,14 @@ function isObjectEmpty( object ) {
|
|
|
67
69
|
* @param {HTMLIFrameElement} iframe The target iframe.
|
|
68
70
|
*/
|
|
69
71
|
const scrollToSection = ( anchorId, iframe ) => {
|
|
70
|
-
if ( ! iframe || ! iframe?.contentDocument ) {
|
|
72
|
+
if ( ! anchorId || ! iframe || ! iframe?.contentDocument ) {
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
const element =
|
|
76
|
+
const element =
|
|
77
|
+
anchorId === 'top'
|
|
78
|
+
? iframe.contentDocument.body
|
|
79
|
+
: iframe.contentDocument.getElementById( anchorId );
|
|
75
80
|
if ( element ) {
|
|
76
81
|
element.scrollIntoView( {
|
|
77
82
|
behavior: 'smooth',
|
|
@@ -89,6 +94,12 @@ const scrollToSection = ( anchorId, iframe ) => {
|
|
|
89
94
|
*/
|
|
90
95
|
const getStyleBookNavigationFromPath = ( path ) => {
|
|
91
96
|
if ( path && typeof path === 'string' ) {
|
|
97
|
+
if ( path === '/' ) {
|
|
98
|
+
return {
|
|
99
|
+
top: true,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
92
103
|
if ( path.startsWith( '/typography' ) ) {
|
|
93
104
|
return {
|
|
94
105
|
block: 'typography',
|
|
@@ -182,6 +193,31 @@ function useMultiOriginPalettes() {
|
|
|
182
193
|
return palettes;
|
|
183
194
|
}
|
|
184
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Get deduped examples for single page stylebook.
|
|
198
|
+
* @param {Array} examples Array of examples.
|
|
199
|
+
* @return {Array} Deduped examples.
|
|
200
|
+
*/
|
|
201
|
+
export function getExamplesForSinglePageUse( examples ) {
|
|
202
|
+
const examplesForSinglePageUse = [];
|
|
203
|
+
const overviewCategoryExamples = getExamplesByCategory(
|
|
204
|
+
{ slug: 'overview' },
|
|
205
|
+
examples
|
|
206
|
+
);
|
|
207
|
+
examplesForSinglePageUse.push( ...overviewCategoryExamples.examples );
|
|
208
|
+
const otherExamples = examples.filter( ( example ) => {
|
|
209
|
+
return (
|
|
210
|
+
example.category !== 'overview' &&
|
|
211
|
+
! overviewCategoryExamples.examples.find(
|
|
212
|
+
( overviewExample ) => overviewExample.name === example.name
|
|
213
|
+
)
|
|
214
|
+
);
|
|
215
|
+
} );
|
|
216
|
+
examplesForSinglePageUse.push( ...otherExamples );
|
|
217
|
+
|
|
218
|
+
return examplesForSinglePageUse;
|
|
219
|
+
}
|
|
220
|
+
|
|
185
221
|
function StyleBook( {
|
|
186
222
|
enableResizing = true,
|
|
187
223
|
isSelected,
|
|
@@ -208,21 +244,7 @@ function StyleBook( {
|
|
|
208
244
|
[ examples ]
|
|
209
245
|
);
|
|
210
246
|
|
|
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 );
|
|
247
|
+
const examplesForSinglePageUse = getExamplesForSinglePageUse( examples );
|
|
226
248
|
|
|
227
249
|
const { base: baseConfig } = useContext( GlobalStylesContext );
|
|
228
250
|
const goTo = getStyleBookNavigationFromPath( path );
|
|
@@ -321,7 +343,76 @@ function StyleBook( {
|
|
|
321
343
|
);
|
|
322
344
|
}
|
|
323
345
|
|
|
324
|
-
|
|
346
|
+
/**
|
|
347
|
+
* Style Book Preview component renders the stylebook without the Editor dependency.
|
|
348
|
+
*
|
|
349
|
+
* @param {Object} props Component props.
|
|
350
|
+
* @param {string} props.path Path to the selected block.
|
|
351
|
+
* @param {Object} props.userConfig User configuration.
|
|
352
|
+
* @param {Function} props.isSelected Function to check if a block is selected.
|
|
353
|
+
* @param {Function} props.onSelect Function to select a block.
|
|
354
|
+
* @return {Object} Style Book Preview component.
|
|
355
|
+
*/
|
|
356
|
+
export const StyleBookPreview = ( {
|
|
357
|
+
path = '',
|
|
358
|
+
userConfig = {},
|
|
359
|
+
isSelected,
|
|
360
|
+
onSelect,
|
|
361
|
+
} ) => {
|
|
362
|
+
const siteEditorSettings = useSelect(
|
|
363
|
+
( select ) => select( siteEditorStore ).getSettings(),
|
|
364
|
+
[]
|
|
365
|
+
);
|
|
366
|
+
// Update block editor settings because useMultipleOriginColorsAndGradients fetch colours from there.
|
|
367
|
+
dispatch( blockEditorStore ).updateSettings( siteEditorSettings );
|
|
368
|
+
|
|
369
|
+
const [ resizeObserver, sizes ] = useResizeObserver();
|
|
370
|
+
const colors = useMultiOriginPalettes();
|
|
371
|
+
const examples = getExamples( colors );
|
|
372
|
+
const examplesForSinglePageUse = getExamplesForSinglePageUse( examples );
|
|
373
|
+
|
|
374
|
+
const { base: baseConfig } = useContext( GlobalStylesContext );
|
|
375
|
+
const goTo = getStyleBookNavigationFromPath( path );
|
|
376
|
+
|
|
377
|
+
const mergedConfig = useMemo( () => {
|
|
378
|
+
if ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {
|
|
379
|
+
return mergeBaseAndUserConfigs( baseConfig, userConfig );
|
|
380
|
+
}
|
|
381
|
+
return {};
|
|
382
|
+
}, [ baseConfig, userConfig ] );
|
|
383
|
+
|
|
384
|
+
const [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );
|
|
385
|
+
|
|
386
|
+
const settings = useMemo(
|
|
387
|
+
() => ( {
|
|
388
|
+
...siteEditorSettings,
|
|
389
|
+
styles:
|
|
390
|
+
! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )
|
|
391
|
+
? globalStyles
|
|
392
|
+
: siteEditorSettings.styles,
|
|
393
|
+
isPreviewMode: true,
|
|
394
|
+
} ),
|
|
395
|
+
[ globalStyles, siteEditorSettings, userConfig ]
|
|
396
|
+
);
|
|
397
|
+
|
|
398
|
+
return (
|
|
399
|
+
<div className="edit-site-style-book">
|
|
400
|
+
{ resizeObserver }
|
|
401
|
+
<BlockEditorProvider settings={ settings }>
|
|
402
|
+
<StyleBookBody
|
|
403
|
+
examples={ examplesForSinglePageUse }
|
|
404
|
+
settings={ settings }
|
|
405
|
+
goTo={ goTo }
|
|
406
|
+
sizes={ sizes }
|
|
407
|
+
isSelected={ isSelected }
|
|
408
|
+
onSelect={ onSelect }
|
|
409
|
+
/>
|
|
410
|
+
</BlockEditorProvider>
|
|
411
|
+
</div>
|
|
412
|
+
);
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export const StyleBookBody = ( {
|
|
325
416
|
category,
|
|
326
417
|
examples,
|
|
327
418
|
isSelected,
|
|
@@ -365,10 +456,19 @@ const StyleBookBody = ( {
|
|
|
365
456
|
|
|
366
457
|
const handleLoad = () => setHasIframeLoaded( true );
|
|
367
458
|
useLayoutEffect( () => {
|
|
368
|
-
if (
|
|
369
|
-
|
|
459
|
+
if ( hasIframeLoaded && iframeRef?.current ) {
|
|
460
|
+
if ( goTo?.top ) {
|
|
461
|
+
scrollToSection( 'top', iframeRef?.current );
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if ( goTo?.block ) {
|
|
465
|
+
scrollToSection(
|
|
466
|
+
`example-${ goTo?.block }`,
|
|
467
|
+
iframeRef?.current
|
|
468
|
+
);
|
|
469
|
+
}
|
|
370
470
|
}
|
|
371
|
-
}, [ iframeRef?.current, goTo
|
|
471
|
+
}, [ iframeRef?.current, goTo, scrollToSection, hasIframeLoaded ] );
|
|
372
472
|
|
|
373
473
|
return (
|
|
374
474
|
<Iframe
|
|
@@ -439,7 +539,11 @@ const Examples = memo(
|
|
|
439
539
|
content={ example.content }
|
|
440
540
|
blocks={ example.blocks }
|
|
441
541
|
isSelected={ isSelected?.( example.name ) }
|
|
442
|
-
onClick={
|
|
542
|
+
onClick={
|
|
543
|
+
!! onSelect
|
|
544
|
+
? () => onSelect( example.name )
|
|
545
|
+
: null
|
|
546
|
+
}
|
|
443
547
|
/>
|
|
444
548
|
) ) }
|
|
445
549
|
{ !! filteredExamples?.subcategories?.length &&
|
|
@@ -476,9 +580,7 @@ const Subcategory = ( { examples, isSelected, onSelect } ) => {
|
|
|
476
580
|
content={ example.content }
|
|
477
581
|
blocks={ example.blocks }
|
|
478
582
|
isSelected={ isSelected?.( example.name ) }
|
|
479
|
-
onClick={ () =>
|
|
480
|
-
onSelect?.( example.name );
|
|
481
|
-
} }
|
|
583
|
+
onClick={ !! onSelect ? () => onSelect( example.name ) : null }
|
|
482
584
|
/>
|
|
483
585
|
) )
|
|
484
586
|
);
|
|
@@ -506,12 +608,13 @@ const Example = ( { id, title, blocks, isSelected, onClick, content } ) => {
|
|
|
506
608
|
[ blocks ]
|
|
507
609
|
);
|
|
508
610
|
|
|
509
|
-
const disabledProps =
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
611
|
+
const disabledProps =
|
|
612
|
+
disabledExamples.includes( id ) || ! onClick
|
|
613
|
+
? {
|
|
614
|
+
disabled: true,
|
|
615
|
+
accessibleWhenDisabled: !! onClick,
|
|
616
|
+
}
|
|
617
|
+
: {};
|
|
515
618
|
|
|
516
619
|
return (
|
|
517
620
|
<div role="row">
|
|
@@ -522,13 +625,17 @@ const Example = ( { id, title, blocks, isSelected, onClick, content } ) => {
|
|
|
522
625
|
'is-disabled-example': !! disabledProps?.disabled,
|
|
523
626
|
} ) }
|
|
524
627
|
id={ id }
|
|
525
|
-
aria-label={
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
628
|
+
aria-label={
|
|
629
|
+
!! onClick
|
|
630
|
+
? sprintf(
|
|
631
|
+
// translators: %s: Title of a block, e.g. Heading.
|
|
632
|
+
__( 'Open %s styles in Styles panel' ),
|
|
633
|
+
title
|
|
634
|
+
)
|
|
635
|
+
: undefined
|
|
636
|
+
}
|
|
530
637
|
render={ <div /> }
|
|
531
|
-
role=
|
|
638
|
+
role={ !! onClick ? 'button' : null }
|
|
532
639
|
onClick={ onClick }
|
|
533
640
|
{ ...disabledProps }
|
|
534
641
|
>
|
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.\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B;QAAI,CAAE,CAAE;MAAC,CACvC,CAAC;IAAA,CACN,CACR;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Component } from '@wordpress/element';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { doAction } from '@wordpress/hooks';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import ErrorBoundaryWarning from './warning';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export default class ErrorBoundary extends Component {
|
|
14
|
-
constructor() {
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.state = {
|
|
17
|
-
error: null
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
componentDidCatch(error) {
|
|
21
|
-
doAction('editor.ErrorBoundary.errorLogged', error);
|
|
22
|
-
}
|
|
23
|
-
static getDerivedStateFromError(error) {
|
|
24
|
-
return {
|
|
25
|
-
error
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
render() {
|
|
29
|
-
if (!this.state.error) {
|
|
30
|
-
return this.props.children;
|
|
31
|
-
}
|
|
32
|
-
return /*#__PURE__*/_jsx(ErrorBoundaryWarning, {
|
|
33
|
-
message: __('The editor has encountered an unexpected error.'),
|
|
34
|
-
error: this.state.error
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Component","__","doAction","ErrorBoundaryWarning","jsx","_jsx","ErrorBoundary","constructor","arguments","state","error","componentDidCatch","getDerivedStateFromError","render","props","children","message"],"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":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,kBAAkB;;AAE3C;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE7C,eAAe,MAAMC,aAAa,SAASN,SAAS,CAAC;EACpDO,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;IAC1BR,QAAQ,CAAE,kCAAkC,EAAEQ,KAAM,CAAC;EACtD;EAEA,OAAOE,wBAAwBA,CAAEF,KAAK,EAAG;IACxC,OAAO;MAAEA;IAAM,CAAC;EACjB;EAEAG,MAAMA,CAAA,EAAG;IACR,IAAK,CAAE,IAAI,CAACJ,KAAK,CAACC,KAAK,EAAG;MACzB,OAAO,IAAI,CAACI,KAAK,CAACC,QAAQ;IAC3B;IAEA,oBACCV,IAAA,CAACF,oBAAoB;MACpBa,OAAO,EAAGf,EAAE,CACX,iDACD,CAAG;MACHS,KAAK,EAAG,IAAI,CAACD,KAAK,CAACC;IAAO,CAC1B,CAAC;EAEJ;AACD","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { Button } from '@wordpress/components';
|
|
6
|
-
import { Warning } from '@wordpress/block-editor';
|
|
7
|
-
import { useCopyToClipboard } from '@wordpress/compose';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
function CopyButton({
|
|
10
|
-
text,
|
|
11
|
-
children
|
|
12
|
-
}) {
|
|
13
|
-
const ref = useCopyToClipboard(text);
|
|
14
|
-
return /*#__PURE__*/_jsx(Button, {
|
|
15
|
-
__next40pxDefaultSize: true,
|
|
16
|
-
variant: "secondary",
|
|
17
|
-
ref: ref,
|
|
18
|
-
children: children
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export default function ErrorBoundaryWarning({
|
|
22
|
-
message,
|
|
23
|
-
error
|
|
24
|
-
}) {
|
|
25
|
-
const actions = [/*#__PURE__*/_jsx(CopyButton, {
|
|
26
|
-
text: error.stack,
|
|
27
|
-
children: __('Copy Error')
|
|
28
|
-
}, "copy-error")];
|
|
29
|
-
return /*#__PURE__*/_jsx(Warning, {
|
|
30
|
-
className: "editor-error-boundary",
|
|
31
|
-
actions: actions,
|
|
32
|
-
children: message
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","Button","Warning","useCopyToClipboard","jsx","_jsx","CopyButton","text","children","ref","__next40pxDefaultSize","variant","ErrorBoundaryWarning","message","error","actions","stack","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":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,kBAAkB,QAAQ,oBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExD,SAASC,UAAUA,CAAE;EAAEC,IAAI;EAAEC;AAAS,CAAC,EAAG;EACzC,MAAMC,GAAG,GAAGN,kBAAkB,CAAEI,IAAK,CAAC;EACtC,oBACCF,IAAA,CAACJ,MAAM;IAACS,qBAAqB;IAACC,OAAO,EAAC,WAAW;IAACF,GAAG,EAAGA,GAAK;IAAAD,QAAA,EAC1DA;EAAQ,CACH,CAAC;AAEX;AAEA,eAAe,SAASI,oBAAoBA,CAAE;EAAEC,OAAO;EAAEC;AAAM,CAAC,EAAG;EAClE,MAAMC,OAAO,GAAG,cACfV,IAAA,CAACC,UAAU;IAAkBC,IAAI,EAAGO,KAAK,CAACE,KAAO;IAAAR,QAAA,EAC9CR,EAAE,CAAE,YAAa;EAAC,GADL,YAEJ,CAAC,CACb;EAED,oBACCK,IAAA,CAACH,OAAO;IAACe,SAAS,EAAC,uBAAuB;IAACF,OAAO,EAAGA,OAAS;IAAAP,QAAA,EAC3DK;EAAO,CACD,CAAC;AAEZ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__unstableIframe","Iframe","__unstableEditorStyles","EditorStyles","privateApis","blockEditorPrivateApis","__unstableMotion","motion","useThrottle","useReducedMotion","useResizeObserver","useLayoutEffect","useState","useMemo","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useGlobalStyle","useGlobalStylesOutput","normalizedWidth","normalizedHeight","THROTTLE_OPTIONS","leading","trailing","PreviewIframe","children","label","isFocused","withHoverView","backgroundColor","gradientValue","styles","disableMotion","isHovered","setIsHovered","containerResizeListener","width","throttledWidth","setThrottledWidthState","ratioState","setRatioState","setThrottledWidth","newRatio","ratioDiff","isRatioDiffBigEnough","Math","abs","fallbackRatio","ratio","editorStyles","css","isGlobalStyles","isReady","style","position","className","height","onMouseEnter","onMouseLeave","tabIndex","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":"AAAA;AACA;AACA;AACA,SACCA,gBAAgB,IAAIC,MAAM,EAC1BC,sBAAsB,IAAIC,YAAY,EACtCC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAClE,SACCC,WAAW,EACXC,gBAAgB,EAChBC,iBAAiB,QACX,oBAAoB;AAC3B,SAASC,eAAe,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;;AAEvE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAE3C,MAAM;EAAEC,cAAc;EAAEC;AAAsB,CAAC,GAAGR,MAAM,CACvDT,sBACD,CAAC;AAED,MAAMkB,eAAe,GAAG,GAAG;AAC3B,MAAMC,gBAAgB,GAAG,GAAG;;AAE5B;AACA;AACA,MAAMC,gBAAgB,GAAG;EACxBC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;AACX,CAAC;AAED,eAAe,SAASC,aAAaA,CAAE;EACtCC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,GAAG,OAAO,CAAE,GAAGZ,cAAc,CAAE,kBAAmB,CAAC;EAC1E,MAAM,CAAEa,aAAa,CAAE,GAAGb,cAAc,CAAE,gBAAiB,CAAC;EAC5D,MAAM,CAAEc,MAAM,CAAE,GAAGb,qBAAqB,CAAC,CAAC;EAC1C,MAAMc,aAAa,GAAG3B,gBAAgB,CAAC,CAAC;EACxC,MAAM,CAAE4B,SAAS,EAAEC,YAAY,CAAE,GAAG1B,QAAQ,CAAE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qB;QAAI,CAAE,CAAE;MAAC,CACvC,CAAC;IAAA,CACN,CACR;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Component } from '@wordpress/element';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { doAction } from '@wordpress/hooks';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import ErrorBoundaryWarning from './warning';
|
|
12
|
-
|
|
13
|
-
export default class ErrorBoundary extends Component {
|
|
14
|
-
constructor() {
|
|
15
|
-
super( ...arguments );
|
|
16
|
-
|
|
17
|
-
this.state = {
|
|
18
|
-
error: null,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
componentDidCatch( error ) {
|
|
23
|
-
doAction( 'editor.ErrorBoundary.errorLogged', error );
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static getDerivedStateFromError( error ) {
|
|
27
|
-
return { error };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
render() {
|
|
31
|
-
if ( ! this.state.error ) {
|
|
32
|
-
return this.props.children;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<ErrorBoundaryWarning
|
|
37
|
-
message={ __(
|
|
38
|
-
'The editor has encountered an unexpected error.'
|
|
39
|
-
) }
|
|
40
|
-
error={ this.state.error }
|
|
41
|
-
/>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import * as wpHooks from '@wordpress/hooks';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import ErrorBoundary from '../index';
|
|
15
|
-
|
|
16
|
-
const theError = new Error( 'Kaboom' );
|
|
17
|
-
|
|
18
|
-
const ChildComponent = () => {
|
|
19
|
-
throw theError;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
describe( 'Error Boundary', () => {
|
|
23
|
-
describe( 'when error is thrown from a Child component', () => {
|
|
24
|
-
it( 'calls the `editor.ErrorBoundary.errorLogged` hook action with the error object', () => {
|
|
25
|
-
const doAction = jest.spyOn( wpHooks, 'doAction' );
|
|
26
|
-
|
|
27
|
-
render(
|
|
28
|
-
<ErrorBoundary>
|
|
29
|
-
<ChildComponent />
|
|
30
|
-
</ErrorBoundary>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
expect( doAction ).toHaveBeenCalledWith(
|
|
34
|
-
'editor.ErrorBoundary.errorLogged',
|
|
35
|
-
theError
|
|
36
|
-
);
|
|
37
|
-
expect( console ).toHaveErrored();
|
|
38
|
-
} );
|
|
39
|
-
} );
|
|
40
|
-
} );
|