@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* wp:polyfill */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -11,7 +12,7 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
11
12
|
var _hooks = require("./hooks");
|
|
12
13
|
var _typographyExample = _interopRequireDefault(require("./typography-example"));
|
|
13
14
|
var _highlightedColors = _interopRequireDefault(require("./highlighted-colors"));
|
|
14
|
-
var
|
|
15
|
+
var _previewWrapper = _interopRequireDefault(require("./preview-wrapper"));
|
|
15
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
/**
|
|
17
18
|
* WordPress dependencies
|
|
@@ -67,7 +68,7 @@ const PreviewStyles = ({
|
|
|
67
68
|
const {
|
|
68
69
|
paletteColors
|
|
69
70
|
} = (0, _hooks.useStylesPreviewColors)();
|
|
70
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_previewWrapper.default, {
|
|
71
72
|
label: label,
|
|
72
73
|
isFocused: isFocused,
|
|
73
74
|
withHoverView: withHoverView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_lockUnlock","_hooks","_typographyExample","_interopRequireDefault","_highlightedColors","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","_lockUnlock","_hooks","_typographyExample","_interopRequireDefault","_highlightedColors","_previewWrapper","_jsxRuntime","useGlobalStyle","unlock","blockEditorPrivateApis","firstFrameVariants","start","scale","opacity","hover","midFrameVariants","secondFrameVariants","PreviewStyles","label","isFocused","withHoverView","variation","fontWeight","fontFamily","headingFontFamily","headingFontWeight","textColor","headingColor","paletteColors","useStylesPreviewColors","jsxs","default","children","ratio","key","jsx","__unstableMotion","div","variants","style","height","overflow","__experimentalHStack","spacing","justify","fontSize","__experimentalVStack","normalizedColorSwatchSize","width","position","top","filter","slice","map","color","index","background","flexGrow","padding","boxSizing","lineHeight","textAlign","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-styles.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { useStylesPreviewColors } from './hooks';\nimport TypographyExample from './typography-example';\nimport HighlightedColors from './highlighted-colors';\nimport PreviewWrapper from './preview-wrapper';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst firstFrameVariants = {\n\tstart: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\thover: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst midFrameVariants = {\n\thover: {\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\topacity: 0.5,\n\t},\n};\n\nconst secondFrameVariants = {\n\thover: {\n\t\tscale: 1,\n\t\topacity: 1,\n\t},\n\tstart: {\n\t\tscale: 0,\n\t\topacity: 0,\n\t},\n};\n\nconst PreviewStyles = ( { label, isFocused, withHoverView, variation } ) => {\n\tconst [ fontWeight ] = useGlobalStyle( 'typography.fontWeight' );\n\tconst [ fontFamily = 'serif' ] = useGlobalStyle( 'typography.fontFamily' );\n\tconst [ headingFontFamily = fontFamily ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontFamily'\n\t);\n\tconst [ headingFontWeight = fontWeight ] = useGlobalStyle(\n\t\t'elements.h1.typography.fontWeight'\n\t);\n\tconst [ textColor = 'black' ] = useGlobalStyle( 'color.text' );\n\tconst [ headingColor = textColor ] = useGlobalStyle(\n\t\t'elements.h1.color.text'\n\t);\n\n\tconst { paletteColors } = useStylesPreviewColors();\n\n\treturn (\n\t\t<PreviewWrapper\n\t\t\tlabel={ label }\n\t\t\tisFocused={ isFocused }\n\t\t\twithHoverView={ withHoverView }\n\t\t>\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ firstFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TypographyExample\n\t\t\t\t\t\t\tfontSize={ 65 * ratio }\n\t\t\t\t\t\t\tvariation={ variation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VStack spacing={ 4 * ratio }>\n\t\t\t\t\t\t\t<HighlightedColors\n\t\t\t\t\t\t\t\tnormalizedColorSwatchSize={ 32 }\n\t\t\t\t\t\t\t\tratio={ ratio }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t{ ( { key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ withHoverView && midFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tfilter: 'blur(60px)',\n\t\t\t\t\t\topacity: 0.1,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ paletteColors\n\t\t\t\t\t\t\t.slice( 0, 4 )\n\t\t\t\t\t\t\t.map( ( { color }, index ) => (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t\t\tbackground: color,\n\t\t\t\t\t\t\t\t\t\tflexGrow: 1,\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</HStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<motion.div\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tvariants={ secondFrameVariants }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<VStack\n\t\t\t\t\t\tspacing={ 3 * ratio }\n\t\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpadding: 10 * ratio,\n\t\t\t\t\t\t\tboxSizing: 'border-box',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tfontSize: 40 * ratio,\n\t\t\t\t\t\t\t\t\tfontFamily: headingFontFamily,\n\t\t\t\t\t\t\t\t\tcolor: headingColor,\n\t\t\t\t\t\t\t\t\tfontWeight: headingFontWeight,\n\t\t\t\t\t\t\t\t\tlineHeight: '1em',\n\t\t\t\t\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t</PreviewWrapper>\n\t);\n};\n\nexport default PreviewStyles;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,eAAA,GAAAF,sBAAA,CAAAL,OAAA;AAA+C,IAAAQ,WAAA,GAAAR,OAAA;AAjB/C;AACA;AACA;;AAQA;AACA;AACA;;AAOA,MAAM;EAAES;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE3D,MAAMC,kBAAkB,GAAG;EAC1BC,KAAK,EAAE;IACNC,KAAK,EAAE,CAAC;IACRC,OAAO,EAAE;EACV,CAAC;EACDC,KAAK,EAAE;IACNF,KAAK,EAAE,CAAC;IACRC,OAAO,EAAE;EACV;AACD,CAAC;AAED,MAAME,gBAAgB,GAAG;EACxBD,KAAK,EAAE;IACND,OAAO,EAAE;EACV,CAAC;EACDF,KAAK,EA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EAAA,CACc,CAAC;AAEnB,CAAC;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAAhC,OAAA,GAEad,aAAa","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _components = require("@wordpress/components");
|
|
9
9
|
var _typographyExample = _interopRequireDefault(require("./typography-example"));
|
|
10
|
-
var
|
|
10
|
+
var _previewWrapper = _interopRequireDefault(require("./preview-wrapper"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
@@ -22,7 +22,7 @@ const StylesPreviewTypography = ({
|
|
|
22
22
|
isFocused,
|
|
23
23
|
withHoverView
|
|
24
24
|
}) => {
|
|
25
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_previewWrapper.default, {
|
|
26
26
|
label: variation.title,
|
|
27
27
|
isFocused: isFocused,
|
|
28
28
|
withHoverView: withHoverView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_typographyExample","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_components","require","_typographyExample","_interopRequireDefault","_previewWrapper","_jsxRuntime","StylesPreviewTypography","variation","isFocused","withHoverView","jsx","default","label","title","children","ratio","key","__experimentalHStack","spacing","justify","style","height","overflow","fontSize","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-typography.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport TypographyExample from './typography-example';\nimport PreviewWrapper from './preview-wrapper';\n\nconst StylesPreviewTypography = ( { variation, isFocused, withHoverView } ) => {\n\treturn (\n\t\t<PreviewWrapper\n\t\t\tlabel={ variation.title }\n\t\t\tisFocused={ isFocused }\n\t\t\twithHoverView={ withHoverView }\n\t\t>\n\t\t\t{ ( { ratio, key } ) => (\n\t\t\t\t<HStack\n\t\t\t\t\tkey={ key }\n\t\t\t\t\tspacing={ 10 * ratio }\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<TypographyExample\n\t\t\t\t\t\tvariation={ variation }\n\t\t\t\t\t\tfontSize={ 85 * ratio }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</PreviewWrapper>\n\t);\n};\n\nexport default StylesPreviewTypography;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA+C,IAAAI,WAAA,GAAAJ,OAAA;AAT/C;AACA;AACA;;AAGA;AACA;AACA;;AAIA,MAAMK,uBAAuB,GAAGA,CAAE;EAAEC,SAAS;EAAEC,SAAS;EAAEC;AAAc,CAAC,KAAM;EAC9E,oBACC,IAAAJ,WAAA,CAAAK,GAAA,EAACN,eAAA,CAAAO,OAAc;IACdC,KAAK,EAAGL,SAAS,CAACM,KAAO;IACzBL,SAAS,EAAGA,SAAW;IACvBC,aAAa,EAAGA,aAAe;IAAAK,QAAA,EAE7BA,CAAE;MAAEC,KAAK;MAAEC;IAAI,CAAC,kBACjB,IAAAX,WAAA,CAAAK,GAAA,EAACV,WAAA,CAAAiB,oBAAM;MAENC,OAAO,EAAG,EAAE,GAAGH,KAAO;MACtBI,OAAO,EAAC,QAAQ;MAChBC,KAAK,EAAG;QACPC,MAAM,EAAE,MAAM;QACdC,QAAQ,EAAE;MACX,CAAG;MAAAR,QAAA,eAEH,IAAAT,WAAA,CAAAK,GAAA,EAACR,kBAAA,CAAAS,OAAiB;QACjBJ,SAAS,EAAGA,SAAW;QACvBgB,QAAQ,EAAG,EAAE,GAAGR;MAAO,CACvB;IAAC,GAXIC,GAYC;EACR,CACc,CAAC;AAEnB,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAd,OAAA,GAEaL,uBAAuB","ignoreList":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
/* wp:polyfill */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.default =
|
|
7
|
+
exports.default = PreviewWrapper;
|
|
7
8
|
var _blockEditor = require("@wordpress/block-editor");
|
|
8
9
|
var _components = require("@wordpress/components");
|
|
9
10
|
var _compose = require("@wordpress/compose");
|
|
@@ -19,8 +20,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
const {
|
|
22
|
-
useGlobalStyle
|
|
23
|
-
useGlobalStylesOutput
|
|
23
|
+
useGlobalStyle
|
|
24
24
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
25
25
|
const normalizedWidth = 248;
|
|
26
26
|
const normalizedHeight = 152;
|
|
@@ -31,7 +31,7 @@ const THROTTLE_OPTIONS = {
|
|
|
31
31
|
leading: true,
|
|
32
32
|
trailing: true
|
|
33
33
|
};
|
|
34
|
-
function
|
|
34
|
+
function PreviewWrapper({
|
|
35
35
|
children,
|
|
36
36
|
label,
|
|
37
37
|
isFocused,
|
|
@@ -39,7 +39,6 @@ function PreviewIframe({
|
|
|
39
39
|
}) {
|
|
40
40
|
const [backgroundColor = 'white'] = useGlobalStyle('color.background');
|
|
41
41
|
const [gradientValue] = useGlobalStyle('color.gradient');
|
|
42
|
-
const [styles] = useGlobalStylesOutput();
|
|
43
42
|
const disableMotion = (0, _compose.useReducedMotion)();
|
|
44
43
|
const [isHovered, setIsHovered] = (0, _element.useState)(false);
|
|
45
44
|
const [containerResizeListener, {
|
|
@@ -49,7 +48,7 @@ function PreviewIframe({
|
|
|
49
48
|
const [ratioState, setRatioState] = (0, _element.useState)();
|
|
50
49
|
const setThrottledWidth = (0, _compose.useThrottle)(setThrottledWidthState, 250, THROTTLE_OPTIONS);
|
|
51
50
|
|
|
52
|
-
// Must use useLayoutEffect to avoid a flash of the
|
|
51
|
+
// Must use useLayoutEffect to avoid a flash of the container at the wrong
|
|
53
52
|
// size before the width is set.
|
|
54
53
|
(0, _element.useLayoutEffect)(() => {
|
|
55
54
|
if (width) {
|
|
@@ -57,7 +56,7 @@ function PreviewIframe({
|
|
|
57
56
|
}
|
|
58
57
|
}, [width, setThrottledWidth]);
|
|
59
58
|
|
|
60
|
-
// Must use useLayoutEffect to avoid a flash of the
|
|
59
|
+
// Must use useLayoutEffect to avoid a flash of the container at the wrong
|
|
61
60
|
// size before the width is set.
|
|
62
61
|
(0, _element.useLayoutEffect)(() => {
|
|
63
62
|
const newRatio = throttledWidth ? throttledWidth / normalizedWidth : 1;
|
|
@@ -82,21 +81,6 @@ function PreviewIframe({
|
|
|
82
81
|
* See: https://github.com/WordPress/gutenberg/issues/55112
|
|
83
82
|
*/
|
|
84
83
|
const ratio = ratioState ? ratioState : fallbackRatio;
|
|
85
|
-
|
|
86
|
-
/*
|
|
87
|
-
* Reset leaked styles from WP common.css and remove main content layout padding and border.
|
|
88
|
-
* Add pointer cursor to the body to indicate the iframe is interactive,
|
|
89
|
-
* similar to Typography variation previews.
|
|
90
|
-
*/
|
|
91
|
-
const editorStyles = (0, _element.useMemo)(() => {
|
|
92
|
-
if (styles) {
|
|
93
|
-
return [...styles, {
|
|
94
|
-
css: 'html{overflow:hidden}body{min-width: 0;padding: 0;border: none;cursor: pointer;}',
|
|
95
|
-
isGlobalStyles: true
|
|
96
|
-
}];
|
|
97
|
-
}
|
|
98
|
-
return styles;
|
|
99
|
-
}, [styles]);
|
|
100
84
|
const isReady = !!width;
|
|
101
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
102
86
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -104,17 +88,15 @@ function PreviewIframe({
|
|
|
104
88
|
position: 'relative'
|
|
105
89
|
},
|
|
106
90
|
children: containerResizeListener
|
|
107
|
-
}), isReady && /*#__PURE__*/(0, _jsxRuntime.
|
|
108
|
-
className: "edit-site-global-styles-
|
|
91
|
+
}), isReady && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
92
|
+
className: "edit-site-global-styles-preview__wrapper",
|
|
109
93
|
style: {
|
|
110
94
|
height: normalizedHeight * ratio
|
|
111
95
|
},
|
|
112
96
|
onMouseEnter: () => setIsHovered(true),
|
|
113
97
|
onMouseLeave: () => setIsHovered(false),
|
|
114
98
|
tabIndex: -1,
|
|
115
|
-
children:
|
|
116
|
-
styles: editorStyles
|
|
117
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableMotion.div, {
|
|
99
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableMotion.div, {
|
|
118
100
|
style: {
|
|
119
101
|
height: normalizedHeight * ratio,
|
|
120
102
|
width: '100%',
|
|
@@ -128,8 +110,8 @@ function PreviewIframe({
|
|
|
128
110
|
ratio,
|
|
129
111
|
key
|
|
130
112
|
}))
|
|
131
|
-
})
|
|
113
|
+
})
|
|
132
114
|
})]
|
|
133
115
|
});
|
|
134
116
|
}
|
|
135
|
-
//# sourceMappingURL=preview-
|
|
117
|
+
//# sourceMappingURL=preview-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","_compose","_element","_lockUnlock","_jsxRuntime","useGlobalStyle","unlock","blockEditorPrivateApis","normalizedWidth","normalizedHeight","THROTTLE_OPTIONS","leading","trailing","PreviewWrapper","children","label","isFocused","withHoverView","backgroundColor","gradientValue","disableMotion","useReducedMotion","isHovered","setIsHovered","useState","containerResizeListener","width","useResizeObserver","throttledWidth","setThrottledWidthState","ratioState","setRatioState","setThrottledWidth","useThrottle","useLayoutEffect","newRatio","ratioDiff","isRatioDiffBigEnough","Math","abs","fallbackRatio","ratio","isReady","jsxs","Fragment","jsx","style","position","className","height","onMouseEnter","onMouseLeave","tabIndex","__unstableMotion","div","background","cursor","undefined","initial","animate","concat","map","child","key"],"sources":["@wordpress/edit-site/src/components/global-styles/preview-wrapper.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } 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 } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\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 PreviewWrapper( {\n\tchildren,\n\tlabel,\n\tisFocused,\n\twithHoverView,\n} ) {\n\tconst [ backgroundColor = 'white' ] = useGlobalStyle( 'color.background' );\n\tconst [ gradientValue ] = useGlobalStyle( 'color.gradient' );\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 container 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 container 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\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<div\n\t\t\t\t\tclassName=\"edit-site-global-styles-preview__wrapper\"\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<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</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAA2C,IAAAK,WAAA,GAAAL,OAAA;AAf3C;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAM;EAAEM;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE3D,MAAMC,eAAe,GAAG,GAAG;AAC3B,MAAMC,gBAAgB,GAAG,GAAG;;AAE5B;AACA;AACA,MAAMC,gBAAgB,GAAG;EACxBC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;AACX,CAAC;AAEc,SAASC,cAAcA,CAAE;EACvCC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,GAAG,OAAO,CAAE,GAAGb,cAAc,CAAE,kBAAmB,CAAC;EAC1E,MAAM,CAAEc,aAAa,CAAE,GAAGd,cAAc,CAAE,gBAAiB,CAAC;EAC5D,MAAMe,aAAa,GAAG,IAAAC,yBAAgB,EAAC,CAAC;EACxC,M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n","_components","_data","_element","_blockEditor","_compose","_a11y","_variationsPanel","_header","_interopRequireDefault","_navigationButton","_lockUnlock","_jsxRuntime","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","unlock","blockEditorPrivateApis","useSortedBlockTypes","blockItems","useSelect","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","useBlockHasGlobalStyles","blockName","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","useBlockVariations","length","hasGlobalStyles","BlockMenuItem","hasBlockMenuItem","jsx","NavigationButtonAsItem","path","encodeURIComponent","children","jsxs","__experimentalHStack","justify","BlockIcon","icon","FlexItem","title","BlockList","filterValue","sortedBlockTypes","debouncedSpeak","useDebounce","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","useRef","useEffect","count","current","childElementCount","resultsFoundMessage","sprintf","_n","ref","className","map","MemoizedBlockList","memo","ScreenBlockList","setFilterValue","useState","deferredFilterValue","useDeferredValue","Fragment","default","__","description","SearchControl","__nextHasNoMarginBottom","onChange","value","label","placeholder","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseDeferredValue,\n\tmemo,\n} from '@wordpress/element';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useBlockVariations } from './variations/variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = !! useBlockVariations( blockName )?.length;\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction BlockList( { filterValue } ) {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst { isMatchingSearchTerm } = useSelect( blocksStore );\n\n\tconst filteredBlockTypes = ! filterValue\n\t\t? sortedBlockTypes\n\t\t: sortedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ blockTypesListRef }\n\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t>\n\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t<BlockMenuItem\n\t\t\t\t\tblock={ block }\n\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nconst MemoizedBlockList = memo( BlockList );\n\nfunction ScreenBlockList() {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst deferredFilterValue = useDeferredValue( filterValue );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<MemoizedBlockList filterValue={ deferredFilterValue } />\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,YAAA,GAAAL,OAAA;AAIA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAKA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AAA2C,IAAAa,WAAA,GAAAb,OAAA;AA/B3C;AACA;AACA;;AAuBA;AACA;AACA;;AAMA,MAAM;EACLc,qBAAqB;EACrBC,qBAAqB;EACrBC,iBAAiB;EACjBC,gBAAgB;EAChBC,0BAA0B;EAC1BC;AACD,CAAC,GAAG,IAAA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AAK,EAAG,IAAAgC,QAAE,EAAE,QAAS,CAAG;MACxBC,WAAW,EAAG,IAAAD,QAAE,EACf,qEACD;IAAG,CACH,CAAC,eACF,IAAArF,WAAA,CAAA0C,GAAA,EAACrD,WAAA,CAAAkG,aAAa;MACbC,uBAAuB;MACvBd,SAAS,EAAC,8BAA8B;MACxCe,QAAQ,EAAGV,cAAgB;MAC3BW,KAAK,EAAGnC,WAAa;MACrBoC,KAAK,EAAG,IAAAN,QAAE,EAAE,QAAS,CAAG;MACxBO,WAAW,EAAG,IAAAP,QAAE,EAAE,QAAS;IAAG,CAC9B,CAAC,eACF,IAAArF,WAAA,CAAA0C,GAAA,EAACkC,iBAAiB;MAACrB,WAAW,EAAG0B;IAAqB,CAAE,CAAC;EAAA,CACxD,CAAC;AAEL;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAEcN,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_i18n","_components","_data","_element","_blockEditor","_compose","_a11y","_variationsPanel","_header","_interopRequireDefault","_navigationButton","_lockUnlock","_jsxRuntime","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","unlock","blockEditorPrivateApis","useSortedBlockTypes","blockItems","useSelect","select","blocksStore","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","useBlockHasGlobalStyles","blockName","rawSettings","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","useBlockVariations","length","hasGlobalStyles","BlockMenuItem","hasBlockMenuItem","jsx","NavigationButtonAsItem","path","encodeURIComponent","children","jsxs","__experimentalHStack","justify","BlockIcon","icon","FlexItem","title","BlockList","filterValue","sortedBlockTypes","debouncedSpeak","useDebounce","speak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","useRef","useEffect","count","current","childElementCount","resultsFoundMessage","sprintf","_n","ref","className","map","MemoizedBlockList","memo","ScreenBlockList","setFilterValue","useState","deferredFilterValue","useDeferredValue","Fragment","default","__","description","SearchControl","__nextHasNoMarginBottom","onChange","value","label","placeholder","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseDeferredValue,\n\tmemo,\n} from '@wordpress/element';\nimport {\n\tBlockIcon,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useBlockVariations } from './variations/variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nexport function useBlockHasGlobalStyles( blockName ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', blockName );\n\tconst settings = useSettingsForBlockElement( rawSettings, blockName );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = !! useBlockVariations( blockName )?.length;\n\tconst hasGlobalStyles =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\treturn hasGlobalStyles;\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasBlockMenuItem = useBlockHasGlobalStyles( block.name );\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction BlockList( { filterValue } ) {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst { isMatchingSearchTerm } = useSelect( blocksStore );\n\n\tconst filteredBlockTypes = ! filterValue\n\t\t? sortedBlockTypes\n\t\t: sortedBlockTypes.filter( ( blockType ) =>\n\t\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ blockTypesListRef }\n\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t>\n\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t<BlockMenuItem\n\t\t\t\t\tblock={ block }\n\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</div>\n\t);\n}\n\nconst MemoizedBlockList = memo( BlockList );\n\nfunction ScreenBlockList() {\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst deferredFilterValue = useDeferredValue( filterValue );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<MemoizedBlockList filterValue={ deferredFilterValue } />\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"],"mappings":";;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data","_blockEditor","_keycodes","_lockUnlock","_jsxRuntime","DAY_IN_MILLISECONDS","getGlobalStylesChanges","unlock","blockEditorPrivateApis","ChangesSummary","revision","previousRevision","changes","maxResults","length","jsx","className","children","map","change","getRevisionLabel","id","authorDisplayName","formattedModifiedDate","areStylesEqual","__","sprintf","RevisionsButtons","userRevisions","selectedRevisionId","onChange","canApplyRevision","onApplyRevision","currentThemeName","currentUser","useSelect","select","getCurrentTheme","getCurrentUser","coreStore","currentTheme","name","rendered","stylesheet","dateNowInMs","getDate","getTime","datetimeAbbreviated","getSettings","formats","Composite","orientation","role","index","author","modified","isUnsaved","revisionAuthor","authorAvatar","avatar_urls","isFirstItem","isSelected","isReset","modifiedDate","displayDate","dateI18n","humanTimeDiff","revisionLabel","jsxs","Item","onKeyDown","event","keyCode","ENTER","SPACE","onClick","preventDefault","render","dateTime","alt","src","Button","size","variant","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Composite } from '@wordpress/components';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24;\nconst { getGlobalStylesChanges } = unlock( blockEditorPrivateApis );\n\nfunction ChangesSummary( { revision, previousRevision } ) {\n\tconst changes = getGlobalStylesChanges( revision, previousRevision, {\n\t\tmaxResults: 7,\n\t} );\n\n\tif ( ! changes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul\n\t\t\tdata-testid=\"global-styles-revision-changes\"\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__changes\"\n\t\t>\n\t\t\t{ changes.map( ( change ) => (\n\t\t\t\t<li key={ change }>{ change }</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\n/**\n * Returns a button label for the revision.\n *\n * @param {string|number} id A revision object.\n * @param {string} authorDisplayName Author name.\n * @param {string} formattedModifiedDate Revision modified date formatted.\n * @param {boolean} areStylesEqual Whether the revision matches the current editor styles.\n * @return {string} Translated label.\n */\nfunction getRevisionLabel(\n\tid,\n\tauthorDisplayName,\n\tformattedModifiedDate,\n\tareStylesEqual\n) {\n\tif ( 'parent' === id ) {\n\t\treturn __( 'Reset the styles to the theme defaults' );\n\t}\n\n\tif ( 'unsaved' === id ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: author display name */\n\t\t\t__( 'Unsaved changes by %s' ),\n\t\t\tauthorDisplayName\n\t\t);\n\t}\n\n\treturn areStylesEqual\n\t\t? sprintf(\n\t\t\t\t// translators: 1: author display name. 2: revision creation date.\n\t\t\t\t__(\n\t\t\t\t\t'Changes saved by %1$s on %2$s. This revision matches current editor styles.'\n\t\t\t\t),\n\t\t\t\tauthorDisplayName,\n\t\t\t\tformattedModifiedDate\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: 1: author display name. 2: revision creation date.\n\t\t\t\t__( 'Changes saved by %1$s on %2$s' ),\n\t\t\t\tauthorDisplayName,\n\t\t\t\tformattedModifiedDate\n\t\t );\n}\n\n/**\n * Returns a rendered list of revisions buttons.\n *\n * @typedef {Object} props\n * @property {Array<Object>} userRevisions A collection of user revisions.\n * @property {number} selectedRevisionId The id of the currently-selected revision.\n * @property {Function} onChange Callback fired when a revision is selected.\n *\n * @param {props} Component props.\n * @return {JSX.Element} The modal component.\n */\nfunction RevisionsButtons( {\n\tuserRevisions,\n\tselectedRevisionId,\n\tonChange,\n\tcanApplyRevision,\n\tonApplyRevision,\n} ) {\n\tconst { currentThemeName, currentUser } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getCurrentUser } = select( coreStore );\n\t\tconst currentTheme = getCurrentTheme();\n\t\treturn {\n\t\t\tcurrentThemeName:\n\t\t\t\tcurrentTheme?.name?.rendered || currentTheme?.stylesheet,\n\t\t\tcurrentUser: getCurrentUser(),\n\t\t};\n\t}, [] );\n\tconst dateNowInMs = getDate().getTime();\n\tconst { datetimeAbbreviated } = getSettings().formats;\n\n\treturn (\n\t\t<Composite\n\t\t\torientation=\"vertical\"\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revisions-list\"\n\t\t\taria-label={ __( 'Global styles revisions list' ) }\n\t\t\trole=\"listbox\"\n\t\t>\n\t\t\t{ userRevisions.map( ( revision, index ) => {\n\t\t\t\tconst { id, author, modified } = revision;\n\t\t\t\tconst isUnsaved = 'unsaved' === id;\n\t\t\t\t// Unsaved changes are created by the current user.\n\t\t\t\tconst revisionAuthor = isUnsaved ? currentUser : author;\n\t\t\t\tconst authorDisplayName = revisionAuthor?.name || __( 'User' );\n\t\t\t\tconst authorAvatar = revisionAuthor?.avatar_urls?.[ '48' ];\n\t\t\t\tconst isFirstItem = index === 0;\n\t\t\t\tconst isSelected = selectedRevisionId\n\t\t\t\t\t? selectedRevisionId === id\n\t\t\t\t\t: isFirstItem;\n\t\t\t\tconst areStylesEqual = ! canApplyRevision && isSelected;\n\t\t\t\tconst isReset = 'parent' === id;\n\t\t\t\tconst modifiedDate = getDate( modified );\n\t\t\t\tconst displayDate =\n\t\t\t\t\tmodified &&\n\t\t\t\t\tdateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS\n\t\t\t\t\t\t? dateI18n( datetimeAbbreviated, modifiedDate )\n\t\t\t\t\t\t: humanTimeDiff( modified );\n\t\t\t\tconst revisionLabel = getRevisionLabel(\n\t\t\t\t\tid,\n\t\t\t\t\tauthorDisplayName,\n\t\t\t\t\tdateI18n( datetimeAbbreviated, modifiedDate ),\n\t\t\t\t\tareStylesEqual\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revision-item\"\n\t\t\t\t\t\taria-current={ isSelected }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\tconst { keyCode } = event;\n\t\t\t\t\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-selected={ isSelected }\n\t\t\t\t\t\taria-label={ revisionLabel }\n\t\t\t\t\t\trender={ <div /> }\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__revision-item-wrapper\">\n\t\t\t\t\t\t\t{ isReset ? (\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t\t{ __( 'Default styles' ) }\n\t\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t\t{ currentThemeName }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t\t{ isUnsaved ? (\n\t\t\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__date\">\n\t\t\t\t\t\t\t\t\t\t\t{ __( '(Unsaved)' ) }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__date\"\n\t\t\t\t\t\t\t\t\t\t\tdateTime={ modified }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ displayDate }\n\t\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\talt={ authorDisplayName }\n\t\t\t\t\t\t\t\t\t\t\tsrc={ authorAvatar }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ authorDisplayName }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t\t\t<ChangesSummary\n\t\t\t\t\t\t\t\t\t\t\trevision={ revision }\n\t\t\t\t\t\t\t\t\t\t\tpreviousRevision={\n\t\t\t\t\t\t\t\t\t\t\t\tindex < userRevisions.length\n\t\t\t\t\t\t\t\t\t\t\t\t\t? userRevisions[ index + 1 ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isSelected &&\n\t\t\t\t\t\t\t( areStylesEqual ? (\n\t\t\t\t\t\t\t\t<p className=\"edit-site-global-styles-screen-revisions__applied-text\">\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'These styles are already applied to your site.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__apply-button\"\n\t\t\t\t\t\t\t\t\tonClick={ onApplyRevision }\n\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t'Apply the selected revision to your site.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ isReset\n\t\t\t\t\t\t\t\t\t\t? __( 'Reset to defaults' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Apply' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Composite.Item>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default RevisionsButtons;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAIA,IAAAO,WAAA,GAAAP,OAAA;AAA8C,IAAAQ,WAAA,GAAAR,OAAA;AAb9C;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMS,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE;AAC/C,MAAM;EAAEC;AAAuB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEnE,SAASC,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAiB,CAAC,EAAG;EACzD,MAAMC,OAAO,GAAGN,sBAAsB,CAAEI,QAAQ,EAAEC,gBAAgB,EAAE;IACnEE,UAAU,EAAE;EACb,CAAE,CAAC;EAEH,IAAK,CAAED,OAAO,CAACE,MAAM,EAAG;IACvB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAV,WAAA,CAAAW,GAAA;IACC,eAAY,gCAAgC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B,CAAE;EAAC,CACO,CAAC;AAEd;AAAC,IAAA+D,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc3D,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_date","_coreData","_data","_blockEditor","_keycodes","_lockUnlock","_jsxRuntime","DAY_IN_MILLISECONDS","getGlobalStylesChanges","unlock","blockEditorPrivateApis","ChangesSummary","revision","previousRevision","changes","maxResults","length","jsx","className","children","map","change","getRevisionLabel","id","authorDisplayName","formattedModifiedDate","areStylesEqual","__","sprintf","RevisionsButtons","userRevisions","selectedRevisionId","onChange","canApplyRevision","onApplyRevision","currentThemeName","currentUser","useSelect","select","getCurrentTheme","getCurrentUser","coreStore","currentTheme","name","rendered","stylesheet","dateNowInMs","getDate","getTime","datetimeAbbreviated","getSettings","formats","Composite","orientation","role","index","author","modified","isUnsaved","revisionAuthor","authorAvatar","avatar_urls","isFirstItem","isSelected","isReset","modifiedDate","displayDate","dateI18n","humanTimeDiff","revisionLabel","jsxs","Item","onKeyDown","event","keyCode","ENTER","SPACE","onClick","preventDefault","render","dateTime","alt","src","Button","size","variant","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/revisions-buttons.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Composite } from '@wordpress/components';\nimport { dateI18n, getDate, humanTimeDiff, getSettings } from '@wordpress/date';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst DAY_IN_MILLISECONDS = 60 * 60 * 1000 * 24;\nconst { getGlobalStylesChanges } = unlock( blockEditorPrivateApis );\n\nfunction ChangesSummary( { revision, previousRevision } ) {\n\tconst changes = getGlobalStylesChanges( revision, previousRevision, {\n\t\tmaxResults: 7,\n\t} );\n\n\tif ( ! changes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul\n\t\t\tdata-testid=\"global-styles-revision-changes\"\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__changes\"\n\t\t>\n\t\t\t{ changes.map( ( change ) => (\n\t\t\t\t<li key={ change }>{ change }</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\n/**\n * Returns a button label for the revision.\n *\n * @param {string|number} id A revision object.\n * @param {string} authorDisplayName Author name.\n * @param {string} formattedModifiedDate Revision modified date formatted.\n * @param {boolean} areStylesEqual Whether the revision matches the current editor styles.\n * @return {string} Translated label.\n */\nfunction getRevisionLabel(\n\tid,\n\tauthorDisplayName,\n\tformattedModifiedDate,\n\tareStylesEqual\n) {\n\tif ( 'parent' === id ) {\n\t\treturn __( 'Reset the styles to the theme defaults' );\n\t}\n\n\tif ( 'unsaved' === id ) {\n\t\treturn sprintf(\n\t\t\t/* translators: %s: author display name */\n\t\t\t__( 'Unsaved changes by %s' ),\n\t\t\tauthorDisplayName\n\t\t);\n\t}\n\n\treturn areStylesEqual\n\t\t? sprintf(\n\t\t\t\t// translators: 1: author display name. 2: revision creation date.\n\t\t\t\t__(\n\t\t\t\t\t'Changes saved by %1$s on %2$s. This revision matches current editor styles.'\n\t\t\t\t),\n\t\t\t\tauthorDisplayName,\n\t\t\t\tformattedModifiedDate\n\t\t )\n\t\t: sprintf(\n\t\t\t\t// translators: 1: author display name. 2: revision creation date.\n\t\t\t\t__( 'Changes saved by %1$s on %2$s' ),\n\t\t\t\tauthorDisplayName,\n\t\t\t\tformattedModifiedDate\n\t\t );\n}\n\n/**\n * Returns a rendered list of revisions buttons.\n *\n * @typedef {Object} props\n * @property {Array<Object>} userRevisions A collection of user revisions.\n * @property {number} selectedRevisionId The id of the currently-selected revision.\n * @property {Function} onChange Callback fired when a revision is selected.\n *\n * @param {props} Component props.\n * @return {JSX.Element} The modal component.\n */\nfunction RevisionsButtons( {\n\tuserRevisions,\n\tselectedRevisionId,\n\tonChange,\n\tcanApplyRevision,\n\tonApplyRevision,\n} ) {\n\tconst { currentThemeName, currentUser } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getCurrentUser } = select( coreStore );\n\t\tconst currentTheme = getCurrentTheme();\n\t\treturn {\n\t\t\tcurrentThemeName:\n\t\t\t\tcurrentTheme?.name?.rendered || currentTheme?.stylesheet,\n\t\t\tcurrentUser: getCurrentUser(),\n\t\t};\n\t}, [] );\n\tconst dateNowInMs = getDate().getTime();\n\tconst { datetimeAbbreviated } = getSettings().formats;\n\n\treturn (\n\t\t<Composite\n\t\t\torientation=\"vertical\"\n\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revisions-list\"\n\t\t\taria-label={ __( 'Global styles revisions list' ) }\n\t\t\trole=\"listbox\"\n\t\t>\n\t\t\t{ userRevisions.map( ( revision, index ) => {\n\t\t\t\tconst { id, author, modified } = revision;\n\t\t\t\tconst isUnsaved = 'unsaved' === id;\n\t\t\t\t// Unsaved changes are created by the current user.\n\t\t\t\tconst revisionAuthor = isUnsaved ? currentUser : author;\n\t\t\t\tconst authorDisplayName = revisionAuthor?.name || __( 'User' );\n\t\t\t\tconst authorAvatar = revisionAuthor?.avatar_urls?.[ '48' ];\n\t\t\t\tconst isFirstItem = index === 0;\n\t\t\t\tconst isSelected = selectedRevisionId\n\t\t\t\t\t? selectedRevisionId === id\n\t\t\t\t\t: isFirstItem;\n\t\t\t\tconst areStylesEqual = ! canApplyRevision && isSelected;\n\t\t\t\tconst isReset = 'parent' === id;\n\t\t\t\tconst modifiedDate = getDate( modified );\n\t\t\t\tconst displayDate =\n\t\t\t\t\tmodified &&\n\t\t\t\t\tdateNowInMs - modifiedDate.getTime() > DAY_IN_MILLISECONDS\n\t\t\t\t\t\t? dateI18n( datetimeAbbreviated, modifiedDate )\n\t\t\t\t\t\t: humanTimeDiff( modified );\n\t\t\t\tconst revisionLabel = getRevisionLabel(\n\t\t\t\t\tid,\n\t\t\t\t\tauthorDisplayName,\n\t\t\t\t\tdateI18n( datetimeAbbreviated, modifiedDate ),\n\t\t\t\t\tareStylesEqual\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<Composite.Item\n\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__revision-item\"\n\t\t\t\t\t\taria-current={ isSelected }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\tconst { keyCode } = event;\n\t\t\t\t\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tonChange( revision );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-selected={ isSelected }\n\t\t\t\t\t\taria-label={ revisionLabel }\n\t\t\t\t\t\trender={ <div /> }\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__revision-item-wrapper\">\n\t\t\t\t\t\t\t{ isReset ? (\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t\t{ __( 'Default styles' ) }\n\t\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t\t{ currentThemeName }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__description\">\n\t\t\t\t\t\t\t\t\t{ isUnsaved ? (\n\t\t\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__date\">\n\t\t\t\t\t\t\t\t\t\t\t{ __( '(Unsaved)' ) }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__date\"\n\t\t\t\t\t\t\t\t\t\t\tdateTime={ modified }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ displayDate }\n\t\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<span className=\"edit-site-global-styles-screen-revisions__meta\">\n\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\talt={ authorDisplayName }\n\t\t\t\t\t\t\t\t\t\t\tsrc={ authorAvatar }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t{ authorDisplayName }\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t\t\t<ChangesSummary\n\t\t\t\t\t\t\t\t\t\t\trevision={ revision }\n\t\t\t\t\t\t\t\t\t\t\tpreviousRevision={\n\t\t\t\t\t\t\t\t\t\t\t\tindex < userRevisions.length\n\t\t\t\t\t\t\t\t\t\t\t\t\t? userRevisions[ index + 1 ]\n\t\t\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isSelected &&\n\t\t\t\t\t\t\t( areStylesEqual ? (\n\t\t\t\t\t\t\t\t<p className=\"edit-site-global-styles-screen-revisions__applied-text\">\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'These styles are already applied to your site.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles-screen-revisions__apply-button\"\n\t\t\t\t\t\t\t\t\tonClick={ onApplyRevision }\n\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t'Apply the selected revision to your site.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ isReset\n\t\t\t\t\t\t\t\t\t\t? __( 'Reset to defaults' )\n\t\t\t\t\t\t\t\t\t\t: __( 'Apply' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Composite.Item>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default RevisionsButtons;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAIA,IAAAO,WAAA,GAAAP,OAAA;AAA8C,IAAAQ,WAAA,GAAAR,OAAA;AAb9C;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMS,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE;AAC/C,MAAM;EAAEC;AAAuB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEnE,SAASC,cAAcA,CAAE;EAAEC,QAAQ;EAAEC;AAAiB,CAAC,EAAG;EACzD,MAAMC,OAAO,GAAGN,sBAAsB,CAAEI,QAAQ,EAAEC,gBAAgB,EAAE;IACn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G;UAAAR,QAAA,EAED6C,OAAO,GACN,IAAArC,QAAE,EAAE,mBAAoB,CAAC,GACzB,IAAAA,QAAE,EAAE,OAAQ;QAAC,CACT,CACR,CAAE;MAAA,GAjFEJ,EAkFS,CAAC;IAEnB,CAAE;EAAC,CACO,CAAC;AAEd;AAAC,IAAA+D,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc3D,gBAAgB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_lockUnlock","SITE_EDITOR_AUTHORS_QUERY","per_page","_fields","context","capabilities","DEFAULT_QUERY","page","EMPTY_ARRAY","GlobalStylesContext","unlock","blockEditorPrivateApis","useGlobalStylesRevisions","query","user","userConfig","useContext","_query","authors","currentUser","isDirty","revisions","isLoadingGlobalStylesRevisions","revisionsCount","useSelect","select","_globalStyles$_links$","__experimentalGetDirtyEntityRecords","getCurrentUser","getUsers","getRevisions","__experimentalGetCurrentGlobalStylesId","getEntityRecord","isResolving","coreStore","dirtyEntityRecords","_currentUser","_isDirty","length","globalStylesId","globalStyles","undefined","_revisionsCount","_links","count","globalStylesRevisions","_authors","_isResolving","useMemo","hasUnsavedChanges","isLoading","_modifiedRevisions","map","revision","author","find","id","fetchedRevisionsCount","isLatest","Object","keys","unsavedRevision","styles","settings","name","avatar_urls","modified","Date","unshift","Math","ceil","push"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/use-global-styles-revisions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst SITE_EDITOR_AUTHORS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,avatar_urls',\n\tcontext: 'view',\n\tcapabilities: [ 'edit_theme_options' ],\n};\nconst DEFAULT_QUERY = { per_page: 100, page: 1 };\nconst EMPTY_ARRAY = [];\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nexport default function useGlobalStylesRevisions( { query } = {} ) {\n\tconst { user: userConfig } = useContext( GlobalStylesContext );\n\tconst _query = { ...DEFAULT_QUERY, ...query };\n\tconst {\n\t\tauthors,\n\t\tcurrentUser,\n\t\tisDirty,\n\t\trevisions,\n\t\tisLoadingGlobalStylesRevisions,\n\t\trevisionsCount,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tgetCurrentUser,\n\t\t\t\tgetUsers,\n\t\t\t\tgetRevisions,\n\t\t\t\t__experimentalGetCurrentGlobalStylesId,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst _currentUser = getCurrentUser();\n\t\t\tconst _isDirty = dirtyEntityRecords.length > 0;\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\tconst _revisionsCount =\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\t\tconst globalStylesRevisions =\n\t\t\t\tgetRevisions(\n\t\t\t\t\t'root',\n\t\t\t\t\t'globalStyles',\n\t\t\t\t\tglobalStylesId,\n\t\t\t\t\t_query\n\t\t\t\t) || EMPTY_ARRAY;\n\t\t\tconst _authors =\n\t\t\t\tgetUsers( SITE_EDITOR_AUTHORS_QUERY ) || EMPTY_ARRAY;\n\t\t\tconst _isResolving = isResolving( 'getRevisions', [\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t_query,\n\t\t\t] );\n\t\t\treturn {\n\t\t\t\tauthors: _authors,\n\t\t\t\tcurrentUser: _currentUser,\n\t\t\t\tisDirty: _isDirty,\n\t\t\t\trevisions: globalStylesRevisions,\n\t\t\t\tisLoadingGlobalStylesRevisions: _isResolving,\n\t\t\t\trevisionsCount: _revisionsCount,\n\t\t\t};\n\t\t},\n\t\t[ query ]\n\t);\n\treturn useMemo( () => {\n\t\tif ( ! authors.length || isLoadingGlobalStylesRevisions ) {\n\t\t\treturn {\n\t\t\t\trevisions: EMPTY_ARRAY,\n\t\t\t\thasUnsavedChanges: isDirty,\n\t\t\t\tisLoading: true,\n\t\t\t\trevisionsCount,\n\t\t\t};\n\t\t}\n\n\t\t// Adds author details to each revision.\n\t\tconst _modifiedRevisions = revisions.map( ( revision ) => {\n\t\t\treturn {\n\t\t\t\t...revision,\n\t\t\t\tauthor: authors.find(\n\t\t\t\t\t( author ) => author.id === revision.author\n\t\t\t\t),\n\t\t\t};\n\t\t} );\n\n\t\tconst fetchedRevisionsCount = revisions.length;\n\n\t\tif ( fetchedRevisionsCount ) {\n\t\t\t// Flags the most current saved revision.\n\t\t\tif (\n\t\t\t\t_modifiedRevisions[ 0 ].id !== 'unsaved' &&\n\t\t\t\t_query.page === 1\n\t\t\t) {\n\t\t\t\t_modifiedRevisions[ 0 ].isLatest = true;\n\t\t\t}\n\n\t\t\t// Adds an item for unsaved changes.\n\t\t\tif (\n\t\t\t\tisDirty &&\n\t\t\t\tuserConfig &&\n\t\t\t\tObject.keys( userConfig ).length > 0 &&\n\t\t\t\tcurrentUser &&\n\t\t\t\t_query.page === 1\n\t\t\t) {\n\t\t\t\tconst unsavedRevision = {\n\t\t\t\t\tid: 'unsaved',\n\t\t\t\t\tstyles: userConfig?.styles,\n\t\t\t\t\tsettings: userConfig?.settings,\n\t\t\t\t\t_links: userConfig?._links,\n\t\t\t\t\tauthor: {\n\t\t\t\t\t\tname: currentUser?.name,\n\t\t\t\t\t\tavatar_urls: currentUser?.avatar_urls,\n\t\t\t\t\t},\n\t\t\t\t\tmodified: new Date(),\n\t\t\t\t};\n\n\t\t\t\t_modifiedRevisions.unshift( unsavedRevision );\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t_query.page === Math.ceil( revisionsCount / _query.per_page )\n\t\t\t) {\n\t\t\t\t// Adds an item for the default theme styles.\n\t\t\t\t_modifiedRevisions.push( {\n\t\t\t\t\tid: 'parent',\n\t\t\t\t\tstyles: {},\n\t\t\t\t\tsettings: {},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trevisions: _modifiedRevisions,\n\t\t\thasUnsavedChanges: isDirty,\n\t\t\tisLoading: false,\n\t\t\trevisionsCount,\n\t\t};\n\t}, [\n\t\tisDirty,\n\t\trevisions,\n\t\tcurrentUser,\n\t\tauthors,\n\t\tuserConfig,\n\t\tisLoadingGlobalStylesRevisions,\n\t] );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_lockUnlock","SITE_EDITOR_AUTHORS_QUERY","per_page","_fields","context","capabilities","DEFAULT_QUERY","page","EMPTY_ARRAY","GlobalStylesContext","unlock","blockEditorPrivateApis","useGlobalStylesRevisions","query","user","userConfig","useContext","_query","authors","currentUser","isDirty","revisions","isLoadingGlobalStylesRevisions","revisionsCount","useSelect","select","_globalStyles$_links$","__experimentalGetDirtyEntityRecords","getCurrentUser","getUsers","getRevisions","__experimentalGetCurrentGlobalStylesId","getEntityRecord","isResolving","coreStore","dirtyEntityRecords","_currentUser","_isDirty","length","globalStylesId","globalStyles","undefined","_revisionsCount","_links","count","globalStylesRevisions","_authors","_isResolving","useMemo","hasUnsavedChanges","isLoading","_modifiedRevisions","map","revision","author","find","id","fetchedRevisionsCount","isLatest","Object","keys","unsavedRevision","styles","settings","name","avatar_urls","modified","Date","unshift","Math","ceil","push"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-revisions/use-global-styles-revisions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst SITE_EDITOR_AUTHORS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,avatar_urls',\n\tcontext: 'view',\n\tcapabilities: [ 'edit_theme_options' ],\n};\nconst DEFAULT_QUERY = { per_page: 100, page: 1 };\nconst EMPTY_ARRAY = [];\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nexport default function useGlobalStylesRevisions( { query } = {} ) {\n\tconst { user: userConfig } = useContext( GlobalStylesContext );\n\tconst _query = { ...DEFAULT_QUERY, ...query };\n\tconst {\n\t\tauthors,\n\t\tcurrentUser,\n\t\tisDirty,\n\t\trevisions,\n\t\tisLoadingGlobalStylesRevisions,\n\t\trevisionsCount,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\t\tgetCurrentUser,\n\t\t\t\tgetUsers,\n\t\t\t\tgetRevisions,\n\t\t\t\t__experimentalGetCurrentGlobalStylesId,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tisResolving,\n\t\t\t} = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\tconst _currentUser = getCurrentUser();\n\t\t\tconst _isDirty = dirtyEntityRecords.length > 0;\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\tconst _revisionsCount =\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\t\tconst globalStylesRevisions =\n\t\t\t\tgetRevisions(\n\t\t\t\t\t'root',\n\t\t\t\t\t'globalStyles',\n\t\t\t\t\tglobalStylesId,\n\t\t\t\t\t_query\n\t\t\t\t) || EMPTY_ARRAY;\n\t\t\tconst _authors =\n\t\t\t\tgetUsers( SITE_EDITOR_AUTHORS_QUERY ) || EMPTY_ARRAY;\n\t\t\tconst _isResolving = isResolving( 'getRevisions', [\n\t\t\t\t'root',\n\t\t\t\t'globalStyles',\n\t\t\t\tglobalStylesId,\n\t\t\t\t_query,\n\t\t\t] );\n\t\t\treturn {\n\t\t\t\tauthors: _authors,\n\t\t\t\tcurrentUser: _currentUser,\n\t\t\t\tisDirty: _isDirty,\n\t\t\t\trevisions: globalStylesRevisions,\n\t\t\t\tisLoadingGlobalStylesRevisions: _isResolving,\n\t\t\t\trevisionsCount: _revisionsCount,\n\t\t\t};\n\t\t},\n\t\t[ query ]\n\t);\n\treturn useMemo( () => {\n\t\tif ( ! authors.length || isLoadingGlobalStylesRevisions ) {\n\t\t\treturn {\n\t\t\t\trevisions: EMPTY_ARRAY,\n\t\t\t\thasUnsavedChanges: isDirty,\n\t\t\t\tisLoading: true,\n\t\t\t\trevisionsCount,\n\t\t\t};\n\t\t}\n\n\t\t// Adds author details to each revision.\n\t\tconst _modifiedRevisions = revisions.map( ( revision ) => {\n\t\t\treturn {\n\t\t\t\t...revision,\n\t\t\t\tauthor: authors.find(\n\t\t\t\t\t( author ) => author.id === revision.author\n\t\t\t\t),\n\t\t\t};\n\t\t} );\n\n\t\tconst fetchedRevisionsCount = revisions.length;\n\n\t\tif ( fetchedRevisionsCount ) {\n\t\t\t// Flags the most current saved revision.\n\t\t\tif (\n\t\t\t\t_modifiedRevisions[ 0 ].id !== 'unsaved' &&\n\t\t\t\t_query.page === 1\n\t\t\t) {\n\t\t\t\t_modifiedRevisions[ 0 ].isLatest = true;\n\t\t\t}\n\n\t\t\t// Adds an item for unsaved changes.\n\t\t\tif (\n\t\t\t\tisDirty &&\n\t\t\t\tuserConfig &&\n\t\t\t\tObject.keys( userConfig ).length > 0 &&\n\t\t\t\tcurrentUser &&\n\t\t\t\t_query.page === 1\n\t\t\t) {\n\t\t\t\tconst unsavedRevision = {\n\t\t\t\t\tid: 'unsaved',\n\t\t\t\t\tstyles: userConfig?.styles,\n\t\t\t\t\tsettings: userConfig?.settings,\n\t\t\t\t\t_links: userConfig?._links,\n\t\t\t\t\tauthor: {\n\t\t\t\t\t\tname: currentUser?.name,\n\t\t\t\t\t\tavatar_urls: currentUser?.avatar_urls,\n\t\t\t\t\t},\n\t\t\t\t\tmodified: new Date(),\n\t\t\t\t};\n\n\t\t\t\t_modifiedRevisions.unshift( unsavedRevision );\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t_query.page === Math.ceil( revisionsCount / _query.per_page )\n\t\t\t) {\n\t\t\t\t// Adds an item for the default theme styles.\n\t\t\t\t_modifiedRevisions.push( {\n\t\t\t\t\tid: 'parent',\n\t\t\t\t\tstyles: {},\n\t\t\t\t\tsettings: {},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\trevisions: _modifiedRevisions,\n\t\t\thasUnsavedChanges: isDirty,\n\t\t\tisLoading: false,\n\t\t\trevisionsCount,\n\t\t};\n\t}, [\n\t\tisDirty,\n\t\trevisions,\n\t\tcurrentUser,\n\t\tauthors,\n\t\tuserConfig,\n\t\tisLoadingGlobalStylesRevisions,\n\t] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMK,yBAAyB,GAAG;EACjCC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,qBAAqB;EAC9BC,OAAO,EAAE,MAAM;EACfC,YAAY,EAAE,CAAE,oBAAoB;AACrC,CAAC;AACD,MAAMC,aAAa,GAAG;EAA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AAC,CAACuB,MAAM,GAAG,CAAC,IACpCnB,WAAW,IACXF,MAAM,CAACV,IAAI,KAAK,CAAC,EAChB;QACD,MAAMsD,eAAe,GAAG;UACvBL,EAAE,EAAE,SAAS;UACbM,MAAM,EAAE/C,UAAU,EAAE+C,MAAM;UAC1BC,QAAQ,EAAEhD,UAAU,EAAEgD,QAAQ;UAC9BpB,MAAM,EAAE5B,UAAU,EAAE4B,MAAM;UAC1BW,MAAM,EAAE;YACPU,IAAI,EAAE7C,WAAW,EAAE6C,IAAI;YACvBC,WAAW,EAAE9C,WAAW,EAAE8C;UAC3B,CAAC;UACDC,QAAQ,EAAE,IAAIC,IAAI,CAAC;QACpB,CAAC;QAEDhB,kBAAkB,CAACiB,OAAO,CAAEP,eAAgB,CAAC;MAC9C;MAEA,IACC5C,MAAM,CAACV,IAAI,KAAK8D,IAAI,CAACC,IAAI,CAAE/C,cAAc,GAAGN,MAAM,CAACf,QAAS,CAAC,EAC5D;QACD;QACAiD,kBAAkB,CAACoB,IAAI,CAAE;UACxBf,EAAE,EAAE,QAAQ;UACZM,MAAM,EAAE,CAAC,CAAC;UACVC,QAAQ,EAAE,CAAC;QACZ,CAAE,CAAC;MACJ;IACD;IAEA,OAAO;MACN1C,SAAS,EAAE8B,kBAAkB;MAC7BF,iBAAiB,EAAE7B,OAAO;MAC1B8B,SAAS,EAAE,KAAK;MAChB3B;IACD,CAAC;EACF,CAAC,EAAE,CACFH,OAAO,EACPC,SAAS,EACTF,WAAW,EACXD,OAAO,EACPH,UAAU,EACVO,8BAA8B,CAC7B,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CUSTOM_VALUE_SETTINGS","exports","px","max","step","vw","vh","em","rm","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","getShadowParts","shadow","shadowValues","match","map","value","trim","shadowStringToObject","shadowValue","defaultShadow","x","y","blur","spread","color","inset","includes","lengthsRegex","matches","length","lengths","split","filter","insets","hasInset","colorString","replace","colorRegex","colorMatches","shadowObjectToString","shadowObj","shadowString"],"sources":["@wordpress/edit-site/src/components/global-styles/shadow-utils.js"],"sourcesContent":["export const CUSTOM_VALUE_SETTINGS = {\n\tpx: { max: 20, step: 1 },\n\t'%': { max: 100, step: 1 },\n\tvw: { max: 100, step: 1 },\n\tvh: { max: 100, step: 1 },\n\tem: { max: 10, step: 0.1 },\n\trm: { max: 10, step: 0.1 },\n\tsvw: { max: 100, step: 1 },\n\tlvw: { max: 100, step: 1 },\n\tdvw: { max: 100, step: 1 },\n\tsvh: { max: 100, step: 1 },\n\tlvh: { max: 100, step: 1 },\n\tdvh: { max: 100, step: 1 },\n\tvi: { max: 100, step: 1 },\n\tsvi: { max: 100, step: 1 },\n\tlvi: { max: 100, step: 1 },\n\tdvi: { max: 100, step: 1 },\n\tvb: { max: 100, step: 1 },\n\tsvb: { max: 100, step: 1 },\n\tlvb: { max: 100, step: 1 },\n\tdvb: { max: 100, step: 1 },\n\tvmin: { max: 100, step: 1 },\n\tsvmin: { max: 100, step: 1 },\n\tlvmin: { max: 100, step: 1 },\n\tdvmin: { max: 100, step: 1 },\n\tvmax: { max: 100, step: 1 },\n\tsvmax: { max: 100, step: 1 },\n\tlvmax: { max: 100, step: 1 },\n\tdvmax: { max: 100, step: 1 },\n};\n\nexport function getShadowParts( shadow ) {\n\tconst shadowValues = shadow.match( /(?:[^,(]|\\([^)]*\\))+/g ) || [];\n\treturn shadowValues.map( ( value ) => value.trim() );\n}\n\nexport function shadowStringToObject( shadowValue ) {\n\t/*\n\t * Shadow spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow\n\t * Shadow string format: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> [inset]\n\t *\n\t * A shadow to be valid it must satisfy the following.\n\t *\n\t * 1. Should not contain \"none\" keyword.\n\t * 2. Values x, y, blur, spread should be in the order. Color and inset can be anywhere in the string except in between x, y, blur, spread values.\n\t * 3. Should not contain more than one set of x, y, blur, spread values.\n\t * 4. Should contain at least x and y values. Others are optional.\n\t * 5. Should not contain more than one \"inset\" (case insensitive) keyword.\n\t * 6. Should not contain more than one color value.\n\t */\n\n\tconst defaultShadow = {\n\t\tx: '0',\n\t\ty: '0',\n\t\tblur: '0',\n\t\tspread: '0',\n\t\tcolor: '#000',\n\t\tinset: false,\n\t};\n\n\tif ( ! shadowValue ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Rule 1: Should not contain \"none\" keyword.\n\t// if the shadow has \"none\" keyword, it is not a valid shadow string\n\tif ( shadowValue.includes( 'none' ) ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Rule 2: Values x, y, blur, spread should be in the order.\n\t//\t\t Color and inset can be anywhere in the string except in between x, y, blur, spread values.\n\t// Extract length values (x, y, blur, spread) from shadow string\n\t// Regex match groups of 1 to 4 length values.\n\tconst lengthsRegex =\n\t\t/((?:^|\\s+)(-?\\d*\\.?\\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\\s|$)(?![^(]*\\))){1,4}/g;\n\tconst matches = shadowValue.match( lengthsRegex ) || [];\n\n\t// Rule 3: Should not contain more than one set of x, y, blur, spread values.\n\t// if the string doesn't contain exactly 1 set of x, y, blur, spread values,\n\t// it is not a valid shadow string\n\tif ( matches.length !== 1 ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Extract length values (x, y, blur, spread) from shadow string\n\tconst lengths = matches[ 0 ]\n\t\t.split( ' ' )\n\t\t.map( ( value ) => value.trim() )\n\t\t.filter( ( value ) => value );\n\n\t// Rule 4: Should contain at least x and y values. Others are optional.\n\tif ( lengths.length < 2 ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Rule 5: Should not contain more than one \"inset\" (case insensitive) keyword.\n\t// check if the shadow string contains \"inset\" keyword\n\tconst insets = shadowValue.match( /inset/gi ) || [];\n\tif ( insets.length > 1 ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Strip lengths and inset from shadow string, leaving just color.\n\tconst hasInset = insets.length === 1;\n\tlet colorString = shadowValue.replace( lengthsRegex, '' ).trim();\n\tif ( hasInset ) {\n\t\tcolorString = colorString\n\t\t\t.replace( 'inset', '' )\n\t\t\t.replace( 'INSET', '' )\n\t\t\t.trim();\n\t}\n\n\t// Rule 6: Should not contain more than one color value.\n\t// validate color string with regular expression\n\t// check if color has matching hex, rgb or hsl values\n\tconst colorRegex =\n\t\t/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\\(?[\\d*\\.?\\d+%?,?\\/?\\s]*\\)$/gi;\n\tlet colorMatches = ( colorString.match( colorRegex ) || [] )\n\t\t.map( ( value ) => value?.trim() )\n\t\t.filter( ( value ) => value );\n\n\t// If color string has more than one color values, it is not a valid\n\tif ( colorMatches.length > 1 ) {\n\t\treturn defaultShadow;\n\t} else if ( colorMatches.length === 0 ) {\n\t\t// check if color string has multiple named color values separated by space\n\t\tcolorMatches = colorString\n\t\t\t.trim()\n\t\t\t.split( ' ' )\n\t\t\t.filter( ( value ) => value );\n\t\t// If color string has more than one color values, it is not a valid\n\t\tif ( colorMatches.length > 1 ) {\n\t\t\treturn defaultShadow;\n\t\t}\n\t}\n\n\t// Return parsed shadow object.\n\tconst [ x, y, blur, spread ] = lengths;\n\treturn {\n\t\tx,\n\t\ty,\n\t\tblur: blur || defaultShadow.blur,\n\t\tspread: spread || defaultShadow.spread,\n\t\tinset: hasInset,\n\t\tcolor: colorString || defaultShadow.color,\n\t};\n}\n\nexport function shadowObjectToString( shadowObj ) {\n\tconst shadowString = `${ shadowObj.x || '0px' } ${ shadowObj.y || '0px' } ${\n\t\tshadowObj.blur || '0px'\n\t} ${ shadowObj.spread || '0px' }`;\n\n\treturn `${ shadowObj.inset ? 'inset' : '' } ${ shadowString } ${\n\t\tshadowObj.color || ''\n\t}`.trim();\n}\n"],"mappings":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C,IAAI,KAAK,IAAMoB,SAAS,CAACnB,CAAC,IAAI,KAAK,IACtEmB,SAAS,CAAClB,IAAI,IAAI,KAAK,IACnBkB,SAAS,CAACjB,MAAM,IAAI,KAAK,EAAG;EAEjC,OAAO,GAAIiB,SAAS,CAACf,KAAK,GAAG,OAAO,GAAG,EAAE,IAAMgB,YAAY,IAC1DD,SAAS,CAAChB,KAAK,IAAI,EAAE,EACpB,CAACR,IAAI,CAAC,CAAC;AACV","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CUSTOM_VALUE_SETTINGS","exports","px","max","step","vw","vh","em","rm","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","getShadowParts","shadow","shadowValues","match","map","value","trim","shadowStringToObject","shadowValue","defaultShadow","x","y","blur","spread","color","inset","includes","lengthsRegex","matches","length","lengths","split","filter","insets","hasInset","colorString","replace","colorRegex","colorMatches","shadowObjectToString","shadowObj","shadowString"],"sources":["@wordpress/edit-site/src/components/global-styles/shadow-utils.js"],"sourcesContent":["export const CUSTOM_VALUE_SETTINGS = {\n\tpx: { max: 20, step: 1 },\n\t'%': { max: 100, step: 1 },\n\tvw: { max: 100, step: 1 },\n\tvh: { max: 100, step: 1 },\n\tem: { max: 10, step: 0.1 },\n\trm: { max: 10, step: 0.1 },\n\tsvw: { max: 100, step: 1 },\n\tlvw: { max: 100, step: 1 },\n\tdvw: { max: 100, step: 1 },\n\tsvh: { max: 100, step: 1 },\n\tlvh: { max: 100, step: 1 },\n\tdvh: { max: 100, step: 1 },\n\tvi: { max: 100, step: 1 },\n\tsvi: { max: 100, step: 1 },\n\tlvi: { max: 100, step: 1 },\n\tdvi: { max: 100, step: 1 },\n\tvb: { max: 100, step: 1 },\n\tsvb: { max: 100, step: 1 },\n\tlvb: { max: 100, step: 1 },\n\tdvb: { max: 100, step: 1 },\n\tvmin: { max: 100, step: 1 },\n\tsvmin: { max: 100, step: 1 },\n\tlvmin: { max: 100, step: 1 },\n\tdvmin: { max: 100, step: 1 },\n\tvmax: { max: 100, step: 1 },\n\tsvmax: { max: 100, step: 1 },\n\tlvmax: { max: 100, step: 1 },\n\tdvmax: { max: 100, step: 1 },\n};\n\nexport function getShadowParts( shadow ) {\n\tconst shadowValues = shadow.match( /(?:[^,(]|\\([^)]*\\))+/g ) || [];\n\treturn shadowValues.map( ( value ) => value.trim() );\n}\n\nexport function shadowStringToObject( shadowValue ) {\n\t/*\n\t * Shadow spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow\n\t * Shadow string format: <offset-x> <offset-y> <blur-radius> <spread-radius> <color> [inset]\n\t *\n\t * A shadow to be valid it must satisfy the following.\n\t *\n\t * 1. Should not contain \"none\" keyword.\n\t * 2. Values x, y, blur, spread should be in the order. Color and inset can be anywhere in the string except in between x, y, blur, spread values.\n\t * 3. Should not contain more than one set of x, y, blur, spread values.\n\t * 4. Should contain at least x and y values. Others are optional.\n\t * 5. Should not contain more than one \"inset\" (case insensitive) keyword.\n\t * 6. Should not contain more than one color value.\n\t */\n\n\tconst defaultShadow = {\n\t\tx: '0',\n\t\ty: '0',\n\t\tblur: '0',\n\t\tspread: '0',\n\t\tcolor: '#000',\n\t\tinset: false,\n\t};\n\n\tif ( ! shadowValue ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Rule 1: Should not contain \"none\" keyword.\n\t// if the shadow has \"none\" keyword, it is not a valid shadow string\n\tif ( shadowValue.includes( 'none' ) ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Rule 2: Values x, y, blur, spread should be in the order.\n\t//\t\t Color and inset can be anywhere in the string except in between x, y, blur, spread values.\n\t// Extract length values (x, y, blur, spread) from shadow string\n\t// Regex match groups of 1 to 4 length values.\n\tconst lengthsRegex =\n\t\t/((?:^|\\s+)(-?\\d*\\.?\\d+(?:px|%|in|cm|mm|em|rem|ex|pt|pc|vh|vw|vmin|vmax|ch|lh)?)(?=\\s|$)(?![^(]*\\))){1,4}/g;\n\tconst matches = shadowValue.match( lengthsRegex ) || [];\n\n\t// Rule 3: Should not contain more than one set of x, y, blur, spread values.\n\t// if the string doesn't contain exactly 1 set of x, y, blur, spread values,\n\t// it is not a valid shadow string\n\tif ( matches.length !== 1 ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Extract length values (x, y, blur, spread) from shadow string\n\tconst lengths = matches[ 0 ]\n\t\t.split( ' ' )\n\t\t.map( ( value ) => value.trim() )\n\t\t.filter( ( value ) => value );\n\n\t// Rule 4: Should contain at least x and y values. Others are optional.\n\tif ( lengths.length < 2 ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Rule 5: Should not contain more than one \"inset\" (case insensitive) keyword.\n\t// check if the shadow string contains \"inset\" keyword\n\tconst insets = shadowValue.match( /inset/gi ) || [];\n\tif ( insets.length > 1 ) {\n\t\treturn defaultShadow;\n\t}\n\n\t// Strip lengths and inset from shadow string, leaving just color.\n\tconst hasInset = insets.length === 1;\n\tlet colorString = shadowValue.replace( lengthsRegex, '' ).trim();\n\tif ( hasInset ) {\n\t\tcolorString = colorString\n\t\t\t.replace( 'inset', '' )\n\t\t\t.replace( 'INSET', '' )\n\t\t\t.trim();\n\t}\n\n\t// Rule 6: Should not contain more than one color value.\n\t// validate color string with regular expression\n\t// check if color has matching hex, rgb or hsl values\n\tconst colorRegex =\n\t\t/^#([0-9a-f]{3}){1,2}$|^#([0-9a-f]{4}){1,2}$|^(?:rgb|hsl)a?\\(?[\\d*\\.?\\d+%?,?\\/?\\s]*\\)$/gi;\n\tlet colorMatches = ( colorString.match( colorRegex ) || [] )\n\t\t.map( ( value ) => value?.trim() )\n\t\t.filter( ( value ) => value );\n\n\t// If color string has more than one color values, it is not a valid\n\tif ( colorMatches.length > 1 ) {\n\t\treturn defaultShadow;\n\t} else if ( colorMatches.length === 0 ) {\n\t\t// check if color string has multiple named color values separated by space\n\t\tcolorMatches = colorString\n\t\t\t.trim()\n\t\t\t.split( ' ' )\n\t\t\t.filter( ( value ) => value );\n\t\t// If color string has more than one color values, it is not a valid\n\t\tif ( colorMatches.length > 1 ) {\n\t\t\treturn defaultShadow;\n\t\t}\n\t}\n\n\t// Return parsed shadow object.\n\tconst [ x, y, blur, spread ] = lengths;\n\treturn {\n\t\tx,\n\t\ty,\n\t\tblur: blur || defaultShadow.blur,\n\t\tspread: spread || defaultShadow.spread,\n\t\tinset: hasInset,\n\t\tcolor: colorString || defaultShadow.color,\n\t};\n}\n\nexport function shadowObjectToString( shadowObj ) {\n\tconst shadowString = `${ shadowObj.x || '0px' } ${ shadowObj.y || '0px' } ${\n\t\tshadowObj.blur || '0px'\n\t} ${ shadowObj.spread || '0px' }`;\n\n\treturn `${ shadowObj.inset ? 'inset' : '' } ${ shadowString } ${\n\t\tshadowObj.color || ''\n\t}`.trim();\n}\n"],"mappings":";;;;;;;;;;AAAO,MAAMA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EACpCE,EAAE,EAAE;IAAEC,GAAG,EAAE,EAAE;IAAEC,IAAI,EAAE;EAAE,CAAC;EACxB,GAAG,EAAE;IAAED,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EAC1BC,EAAE,EAAE;IAAEF,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EACzBE,EAAE,EAAE;IAAEH,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EACzBG,EAAE,EAAE;IAAEJ,GAAG,EAAE,EAAE;IAAEC,IAAI,EAAE;EAAI,CAAC;EAC1BI,EAAE,EAAE;IAAEL,GAAG,EAAE,EAAE;IAAEC,IAAI,EAAE;EAAI,CAAC;EAC1BK,GAAG,EAAE;IAAEN,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EAC1BM,GAAG,EAAE;IAAEP,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE;EAAE,CAAC;EAC1BO,GAAG,EAAE;IAAER,GAAG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jB,KAAK,IAAMA,KAAM,CAAC;IAC9B;IACA,IAAKuB,YAAY,CAACT,MAAM,GAAG,CAAC,EAAG;MAC9B,OAAOV,aAAa;IACrB;EACD;;EAEA;EACA,MAAM,CAAEC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,MAAM,CAAE,GAAGO,OAAO;EACtC,OAAO;IACNV,CAAC;IACDC,CAAC;IACDC,IAAI,EAAEA,IAAI,IAAIH,aAAa,CAACG,IAAI;IAChCC,MAAM,EAAEA,MAAM,IAAIJ,aAAa,CAACI,MAAM;IACtCE,KAAK,EAAES,QAAQ;IACfV,KAAK,EAAEW,WAAW,IAAIhB,aAAa,CAACK;EACrC,CAAC;AACF;AAEO,SAASe,oBAAoBA,CAAEC,SAAS,EAAG;EACjD,MAAMC,YAAY,GAAG,GAAID,SAAS,CAACpB,CAAC,IAAI,KAAK,IAAMoB,SAAS,CAACnB,CAAC,IAAI,KAAK,IACtEmB,SAAS,CAAClB,IAAI,IAAI,KAAK,IACnBkB,SAAS,CAACjB,MAAM,IAAI,KAAK,EAAG;EAEjC,OAAO,GAAIiB,SAAS,CAACf,KAAK,GAAG,OAAO,GAAG,EAAE,IAAMgB,YAAY,IAC1DD,SAAS,CAAChB,KAAK,IAAI,EAAE,EACpB,CAACR,IAAI,CAAC,CAAC;AACV","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* wp:polyfill */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -233,6 +234,7 @@ function ShadowEditor({
|
|
|
233
234
|
shadow,
|
|
234
235
|
onChange
|
|
235
236
|
}) {
|
|
237
|
+
const addShadowButtonRef = (0, _element.useRef)();
|
|
236
238
|
const shadowParts = (0, _element.useMemo)(() => (0, _shadowUtils.getShadowParts)(shadow), [shadow]);
|
|
237
239
|
const onChangeShadowPart = (index, part) => {
|
|
238
240
|
const newShadowParts = [...shadowParts];
|
|
@@ -244,6 +246,7 @@ function ShadowEditor({
|
|
|
244
246
|
};
|
|
245
247
|
const onRemoveShadowPart = index => {
|
|
246
248
|
onChange(shadowParts.filter((p, i) => i !== index).join(', '));
|
|
249
|
+
addShadowButtonRef.current.focus();
|
|
247
250
|
};
|
|
248
251
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
249
252
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalVStack, {
|
|
@@ -265,7 +268,8 @@ function ShadowEditor({
|
|
|
265
268
|
label: (0, _i18n.__)('Add shadow'),
|
|
266
269
|
onClick: () => {
|
|
267
270
|
onAddShadowPart();
|
|
268
|
-
}
|
|
271
|
+
},
|
|
272
|
+
ref: addShadowButtonRef
|
|
269
273
|
})
|
|
270
274
|
})]
|
|
271
275
|
})
|
|
@@ -317,26 +321,16 @@ function ShadowItem({
|
|
|
317
321
|
}),
|
|
318
322
|
label: (0, _i18n.__)('Remove shadow')
|
|
319
323
|
};
|
|
320
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
icon: _icons.shadow,
|
|
331
|
-
...toggleProps,
|
|
332
|
-
children: shadowObj.inset ? (0, _i18n.__)('Inner shadow') : (0, _i18n.__)('Drop shadow')
|
|
333
|
-
})
|
|
334
|
-
}), canRemove && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
335
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
336
|
-
__next40pxDefaultSize: true,
|
|
337
|
-
icon: _icons.reset,
|
|
338
|
-
...removeButtonProps
|
|
339
|
-
})
|
|
324
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
325
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
326
|
+
__next40pxDefaultSize: true,
|
|
327
|
+
icon: _icons.shadow,
|
|
328
|
+
...toggleProps,
|
|
329
|
+
children: shadowObj.inset ? (0, _i18n.__)('Inner shadow') : (0, _i18n.__)('Drop shadow')
|
|
330
|
+
}), canRemove && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
331
|
+
size: "small",
|
|
332
|
+
icon: _icons.reset,
|
|
333
|
+
...removeButtonProps
|
|
340
334
|
})]
|
|
341
335
|
});
|
|
342
336
|
},
|