@wordpress/block-library 7.4.0 → 7.7.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 +10 -0
- package/README.md +3 -2
- package/babel-plugin.js +154 -0
- package/build/audio/edit.js +4 -16
- package/build/audio/edit.js.map +1 -1
- package/build/block/edit.js +10 -9
- package/build/block/edit.js.map +1 -1
- package/build/button/deprecated.js +175 -35
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js +7 -3
- package/build/button/edit.native.js.map +1 -1
- package/build/button/index.js +1 -0
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +1 -1
- package/build/button/save.js.map +1 -1
- package/build/categories/edit.js +1 -1
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +1 -1
- package/build/columns/index.js +3 -1
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +1 -0
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-template/edit.js +1 -3
- package/build/comment-template/edit.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/{build-module/comments-query-loop → build/comments}/edit/comments-inspector-controls.js.map +1 -1
- package/build/{comments-query-loop → comments}/edit.js +3 -3
- package/build/comments/edit.js.map +1 -0
- package/build/{comments-query-loop → comments}/index.js +1 -1
- package/build/comments/index.js.map +1 -0
- package/build/{comments-query-loop → comments}/save.js +2 -2
- package/build/comments/save.js.map +1 -0
- package/build/comments-title/deprecated.js +110 -0
- package/build/comments-title/deprecated.js.map +1 -0
- package/build/comments-title/edit.js +35 -35
- package/build/comments-title/edit.js.map +1 -1
- package/build/comments-title/index.js +5 -8
- package/build/comments-title/index.js.map +1 -1
- package/build/cover/controls.native.js +2 -3
- package/build/cover/controls.native.js.map +1 -1
- package/build/cover/deprecated.js +212 -207
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +115 -0
- package/build/cover/edit/block-controls.js.map +1 -0
- package/build/cover/edit/cover-placeholder.js +49 -0
- package/build/cover/edit/cover-placeholder.js.map +1 -0
- package/build/cover/edit/index.js +343 -0
- package/build/cover/edit/index.js.map +1 -0
- package/build/cover/edit/inspector-controls.js +224 -0
- package/build/cover/edit/inspector-controls.js.map +1 -0
- package/build/cover/edit/resizable-cover.js +67 -0
- package/build/cover/edit/resizable-cover.js.map +1 -0
- package/build/cover/edit/use-cover-is-dark.js +81 -0
- package/build/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build/cover/edit.native.js +36 -16
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/focal-point-settings-button.native.js.map +1 -1
- package/build/cover/save.js +18 -5
- package/build/cover/save.js.map +1 -1
- package/build/cover/shared.js +15 -9
- package/build/cover/shared.js.map +1 -1
- package/build/cover/transforms.js +77 -6
- package/build/cover/transforms.js.map +1 -1
- package/build/cover/use-cover-is-dark.native.js +60 -0
- package/build/cover/use-cover-is-dark.native.js.map +1 -0
- package/build/embed/embed-preview.js +1 -1
- package/build/embed/embed-preview.js.map +1 -1
- package/build/file/edit.js +1 -1
- package/build/file/edit.js.map +1 -1
- package/build/file/edit.native.js +0 -1
- package/build/file/edit.native.js.map +1 -1
- package/build/file/save.js +9 -1
- package/build/file/save.js.map +1 -1
- package/build/gallery/edit.js +2 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/gallery.js +1 -1
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/gap-styles.js +14 -4
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/gallery/index.js +1 -1
- package/build/gallery/shared.js +2 -2
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/use-get-media.js +2 -1
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-short-code-transform.js +19 -18
- package/build/gallery/use-short-code-transform.js.map +1 -1
- package/build/gallery/v1/gallery.js +1 -1
- package/build/gallery/v1/gallery.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/edit.js +6 -2
- package/build/heading/edit.js.map +1 -1
- package/build/heading/index.js +1 -0
- package/build/heading/index.js.map +1 -1
- package/build/heading/transforms.js +9 -4
- package/build/heading/transforms.js.map +1 -1
- package/build/image/edit.js +5 -56
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +56 -4
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +4 -14
- package/build/image/image.js.map +1 -1
- package/build/index.js +48 -14
- package/build/index.js.map +1 -1
- package/build/is-block-metadata-experimental.js +18 -0
- package/build/is-block-metadata-experimental.js.map +1 -0
- package/build/latest-posts/edit.js +30 -4
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/edit.native.js +49 -0
- package/build/latest-posts/edit.native.js.map +1 -1
- package/build/list/transforms.js +6 -0
- package/build/list/transforms.js.map +1 -1
- package/build/list/v2/edit.js +2 -1
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/migrate.js +1 -0
- package/build/list/v2/migrate.js.map +1 -1
- package/build/list/v2/transforms.js +46 -9
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/edit.js +7 -9
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/index.js +24 -0
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-backspace.js +59 -0
- package/build/list-item/hooks/use-backspace.js.map +1 -0
- package/build/list-item/hooks/use-enter.js +6 -9
- package/build/list-item/hooks/use-enter.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +33 -39
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/hooks/use-space.js +54 -0
- package/build/list-item/hooks/use-space.js.map +1 -0
- package/build/list-item/hooks/use-split.js +44 -0
- package/build/list-item/hooks/use-split.js.map +1 -0
- package/build/list-item/index.js +1 -0
- package/build/list-item/index.js.map +1 -1
- package/build/list-item/utils.js +1 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/edit.native.js +2 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/media-text/media-container.native.js +2 -4
- package/build/media-text/media-container.native.js.map +1 -1
- package/build/media-text/transforms.js +137 -8
- package/build/media-text/transforms.js.map +1 -1
- package/build/navigation/edit/index.js +91 -109
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +6 -12
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-navigation-entities.js +3 -3
- package/build/navigation/use-navigation-entities.js.map +1 -1
- package/build/navigation/view-modal.js +25 -0
- package/build/navigation/view-modal.js.map +1 -1
- package/build/navigation-link/edit.js +60 -35
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/fallback-variations.js +1 -1
- package/build/navigation-link/fallback-variations.js.map +1 -1
- package/build/navigation-link/hooks.js +1 -1
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-submenu/edit.js +14 -14
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +1 -1
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +1 -1
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +10 -0
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/use-enter.js +94 -0
- package/build/paragraph/use-enter.js.map +1 -0
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-name/index.js +4 -0
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-author-name/transforms.js +41 -0
- package/build/post-author-name/transforms.js.map +1 -0
- package/build/post-comment/index.js +2 -1
- package/build/post-comment/index.js.map +1 -1
- package/build/post-comments/edit.js +138 -35
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments/index.js +3 -2
- package/build/post-comments/index.js.map +1 -1
- package/build/post-comments-count/index.js +1 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/edit.js +38 -4
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +58 -0
- package/build/post-comments-form/form.js.map +1 -0
- package/build/post-comments-form/index.js +1 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +1 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +1 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-date/edit.js +13 -7
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +1 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-template/edit.js +7 -2
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +35 -4
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/hooks.js +33 -0
- package/build/post-terms/hooks.js.map +1 -0
- package/build/post-terms/index.js +20 -5
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -1
- package/build/post-title/index.js.map +1 -1
- package/build/pullquote/edit.js +1 -1
- package/build/pullquote/edit.js.map +1 -1
- package/build/pullquote/edit.native.js +1 -1
- package/build/pullquote/edit.native.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +26 -17
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +148 -0
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -0
- package/build/query/edit/inspector-controls/sticky-control.js +41 -0
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -0
- package/build/query/index.js +2 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +28 -2
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-title/index.js +1 -1
- package/build/query-title/index.js.map +1 -1
- package/build/query-title/variations.js +1 -1
- package/build/query-title/variations.js.map +1 -1
- package/build/quote/edit.js +3 -2
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +1 -1
- package/build/quote/v2/edit.js.map +1 -1
- package/build/search/edit.js +2 -1
- package/build/search/edit.js.map +1 -1
- package/build/search/index.js +4 -0
- package/build/search/index.js.map +1 -1
- package/build/separator/index.js +3 -0
- package/build/separator/index.js.map +1 -1
- package/build/shortcode/edit.native.js +16 -13
- package/build/shortcode/edit.native.js.map +1 -1
- package/build/site-logo/edit.js +1 -1
- package/build/site-logo/edit.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/table/edit.js +15 -2
- package/build/table/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +145 -65
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +13 -3
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +16 -9
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +40 -0
- package/build/table-of-contents/save.js.map +1 -0
- package/build/table-of-contents/utils.js +11 -77
- package/build/table-of-contents/utils.js.map +1 -1
- package/build/template-part/edit/index.js +7 -3
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/inner-blocks.js +3 -8
- package/build/template-part/edit/inner-blocks.js.map +1 -1
- package/build/video/edit.js +4 -8
- package/build/video/edit.js.map +1 -1
- package/build-module/audio/edit.js +5 -17
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/block/edit.js +11 -10
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/deprecated.js +175 -35
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +2 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +7 -3
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/button/index.js +1 -0
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +2 -2
- package/build-module/button/save.js.map +1 -1
- package/build-module/categories/edit.js +1 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +1 -1
- package/build-module/columns/index.js +3 -1
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +1 -0
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-template/edit.js +1 -3
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/edit.js +2 -2
- package/build-module/comments/edit.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/index.js +1 -1
- package/build-module/comments/index.js.map +1 -0
- package/build-module/{comments-query-loop → comments}/save.js +1 -1
- package/build-module/comments/save.js.map +1 -0
- package/build-module/comments-title/deprecated.js +102 -0
- package/build-module/comments-title/deprecated.js.map +1 -0
- package/build-module/comments-title/edit.js +38 -38
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/comments-title/index.js +4 -8
- package/build-module/comments-title/index.js.map +1 -1
- package/build-module/cover/controls.native.js +2 -3
- package/build-module/cover/controls.native.js.map +1 -1
- package/build-module/cover/deprecated.js +206 -198
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +104 -0
- package/build-module/cover/edit/block-controls.js.map +1 -0
- package/build-module/cover/edit/cover-placeholder.js +38 -0
- package/build-module/cover/edit/cover-placeholder.js.map +1 -0
- package/build-module/cover/edit/index.js +317 -0
- package/build-module/cover/edit/index.js.map +1 -0
- package/build-module/cover/edit/inspector-controls.js +215 -0
- package/build-module/cover/edit/inspector-controls.js.map +1 -0
- package/build-module/cover/edit/resizable-cover.js +55 -0
- package/build-module/cover/edit/resizable-cover.js.map +1 -0
- package/build-module/cover/edit/use-cover-is-dark.js +70 -0
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -0
- package/build-module/cover/edit.native.js +35 -17
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/focal-point-settings-button.native.js.map +1 -1
- package/build-module/cover/save.js +19 -6
- package/build-module/cover/save.js.map +1 -1
- package/build-module/cover/shared.js +11 -5
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/cover/transforms.js +74 -6
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/cover/use-cover-is-dark.native.js +51 -0
- package/build-module/cover/use-cover-is-dark.native.js.map +1 -0
- package/build-module/embed/embed-preview.js +2 -2
- package/build-module/embed/embed-preview.js.map +1 -1
- package/build-module/file/edit.js +2 -2
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/edit.native.js +0 -1
- package/build-module/file/edit.native.js.map +1 -1
- package/build-module/file/save.js +7 -2
- package/build-module/file/save.js.map +1 -1
- package/build-module/gallery/edit.js +2 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/gap-styles.js +14 -4
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/gallery/index.js +1 -1
- package/build-module/gallery/shared.js +2 -2
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/use-get-media.js +2 -1
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-short-code-transform.js +19 -18
- package/build-module/gallery/use-short-code-transform.js.map +1 -1
- package/build-module/gallery/v1/gallery.js +2 -2
- package/build-module/gallery/v1/gallery.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/edit.js +6 -2
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/heading/index.js +1 -0
- package/build-module/heading/index.js.map +1 -1
- package/build-module/heading/transforms.js +9 -4
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/image/edit.js +4 -52
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +57 -6
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +6 -16
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +43 -12
- package/build-module/index.js.map +1 -1
- package/build-module/is-block-metadata-experimental.js +16 -0
- package/build-module/is-block-metadata-experimental.js.map +1 -0
- package/build-module/latest-posts/edit.js +29 -5
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/edit.native.js +51 -2
- package/build-module/latest-posts/edit.native.js.map +1 -1
- package/build-module/list/transforms.js +6 -0
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/v2/edit.js +2 -1
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/migrate.js +1 -3
- package/build-module/list/v2/migrate.js.map +1 -1
- package/build-module/list/v2/transforms.js +46 -9
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +8 -9
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/index.js +3 -0
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-backspace.js +44 -0
- package/build-module/list-item/hooks/use-backspace.js.map +1 -0
- package/build-module/list-item/hooks/use-enter.js +6 -9
- package/build-module/list-item/hooks/use-enter.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +33 -38
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/hooks/use-space.js +40 -0
- package/build-module/list-item/hooks/use-space.js.map +1 -0
- package/build-module/list-item/hooks/use-split.js +33 -0
- package/build-module/list-item/hooks/use-split.js.map +1 -0
- package/build-module/list-item/index.js +1 -0
- package/build-module/list-item/index.js.map +1 -1
- package/build-module/list-item/utils.js +1 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/edit.native.js +2 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/media-text/media-container.native.js +2 -4
- package/build-module/media-text/media-container.native.js.map +1 -1
- package/build-module/media-text/transforms.js +137 -8
- package/build-module/media-text/transforms.js.map +1 -1
- package/build-module/navigation/edit/index.js +93 -110
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +7 -13
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-navigation-entities.js +1 -1
- package/build-module/navigation/use-navigation-entities.js.map +1 -1
- package/build-module/navigation/view-modal.js +24 -0
- package/build-module/navigation/view-modal.js.map +1 -1
- package/build-module/navigation-link/edit.js +60 -36
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/fallback-variations.js +1 -1
- package/build-module/navigation-link/fallback-variations.js.map +1 -1
- package/build-module/navigation-link/hooks.js +2 -2
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +14 -14
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +1 -1
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +1 -1
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +9 -0
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/use-enter.js +81 -0
- package/build-module/paragraph/use-enter.js.map +1 -0
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +3 -0
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-author-name/transforms.js +32 -0
- package/build-module/post-author-name/transforms.js.map +1 -0
- package/build-module/post-comment/index.js +2 -1
- package/build-module/post-comment/index.js.map +1 -1
- package/build-module/post-comments/edit.js +139 -37
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments/index.js +3 -2
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-comments-count/index.js +1 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/edit.js +38 -6
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +45 -0
- package/build-module/post-comments-form/form.js.map +1 -0
- package/build-module/post-comments-form/index.js +1 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +1 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +1 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-date/edit.js +15 -9
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-template/edit.js +7 -2
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +35 -6
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/hooks.js +25 -0
- package/build-module/post-terms/hooks.js.map +1 -0
- package/build-module/post-terms/index.js +18 -8
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/pullquote/edit.js +2 -2
- package/build-module/pullquote/edit.js.map +1 -1
- package/build-module/pullquote/edit.native.js +2 -2
- package/build-module/pullquote/edit.native.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +24 -17
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +135 -0
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -0
- package/build-module/query/edit/inspector-controls/sticky-control.js +31 -0
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -0
- package/build-module/query/index.js +2 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +21 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/edit.js +1 -1
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-title/index.js +1 -1
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/query-title/variations.js +2 -2
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/quote/edit.js +4 -3
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +2 -2
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/search/edit.js +3 -2
- package/build-module/search/edit.js.map +1 -1
- package/build-module/search/index.js +4 -0
- package/build-module/search/index.js.map +1 -1
- package/build-module/separator/index.js +3 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/shortcode/edit.native.js +17 -13
- package/build-module/shortcode/edit.native.js.map +1 -1
- package/build-module/site-logo/edit.js +1 -1
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/social-links/edit.js +2 -2
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/table/edit.js +17 -4
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +144 -68
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +12 -3
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +18 -10
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +28 -0
- package/build-module/table-of-contents/save.js.map +1 -0
- package/build-module/table-of-contents/utils.js +11 -73
- package/build-module/table-of-contents/utils.js.map +1 -1
- package/build-module/template-part/edit/index.js +8 -4
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/inner-blocks.js +4 -9
- package/build-module/template-part/edit/inner-blocks.js.map +1 -1
- package/build-module/video/edit.js +5 -9
- package/build-module/video/edit.js.map +1 -1
- package/build-style/comment-content/style-rtl.css +81 -0
- package/build-style/comment-content/style.css +81 -0
- package/build-style/{comments-query-loop → comments}/editor-rtl.css +0 -0
- package/build-style/{comments-query-loop → comments}/editor.css +0 -0
- package/build-style/cover/style-rtl.css +32 -27
- package/build-style/cover/style.css +32 -27
- package/build-style/editor-rtl.css +16 -10
- package/build-style/editor.css +16 -10
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/latest-posts/style-rtl.css +2 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/post-comments/editor-rtl.css +79 -0
- package/build-style/post-comments/editor.css +79 -0
- package/build-style/post-comments/style-rtl.css +27 -3
- package/build-style/post-comments/style.css +27 -3
- package/build-style/post-comments-form/editor-rtl.css +79 -0
- package/build-style/post-comments-form/editor.css +79 -0
- package/build-style/post-comments-form/style-rtl.css +1 -3
- package/build-style/post-comments-form/style.css +1 -3
- package/build-style/separator/editor-rtl.css +1 -0
- package/build-style/separator/editor.css +1 -0
- package/build-style/site-logo/style-rtl.css +4 -0
- package/build-style/site-logo/style.css +4 -0
- package/build-style/style-rtl.css +69 -33
- package/build-style/style.css +71 -33
- package/build-style/video/editor-rtl.css +2 -5
- package/build-style/video/editor.css +2 -5
- package/build-types/table-of-contents/list.d.ts +12 -0
- package/build-types/table-of-contents/list.d.ts.map +1 -0
- package/build-types/table-of-contents/utils.d.ts +24 -0
- package/build-types/table-of-contents/utils.d.ts.map +1 -0
- package/package.json +30 -29
- package/src/audio/edit.js +6 -9
- package/src/avatar/block.json +0 -1
- package/src/avatar/index.php +2 -2
- package/src/block/edit.js +39 -42
- package/src/block/test/edit.native.js +1 -1
- package/src/button/block.json +1 -0
- package/src/button/deprecated.js +145 -0
- package/src/button/edit.js +3 -1
- package/src/button/edit.native.js +6 -3
- package/src/button/save.js +3 -1
- package/src/buttons/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/buttons/test/edit.native.js +1 -1
- package/src/categories/block.json +1 -1
- package/src/categories/edit.js +1 -1
- package/src/columns/block.json +3 -1
- package/src/comment-author-avatar/block.json +1 -0
- package/src/comment-author-name/index.php +7 -5
- package/src/comment-content/index.php +25 -3
- package/src/comment-content/style.scss +5 -0
- package/src/comment-edit-link/index.php +1 -4
- package/src/comment-reply-link/index.php +1 -4
- package/src/comment-template/edit.js +1 -5
- package/src/comment-template/index.php +4 -0
- package/src/{comments-query-loop → comments}/block.json +1 -1
- package/src/{comments-query-loop → comments}/edit/comments-inspector-controls.js +0 -0
- package/src/{comments-query-loop → comments}/edit.js +2 -1
- package/src/{comments-query-loop → comments}/editor.scss +0 -0
- package/src/{comments-query-loop → comments}/index.js +0 -0
- package/src/{comments-query-loop → comments}/save.js +1 -3
- package/src/comments-pagination/index.php +4 -0
- package/src/comments-title/block.json +0 -6
- package/src/comments-title/deprecated.js +34 -0
- package/src/comments-title/edit.js +44 -84
- package/src/comments-title/index.js +3 -1
- package/src/comments-title/index.php +51 -22
- package/src/cover/controls.native.js +1 -2
- package/src/cover/deprecated.js +230 -183
- package/src/cover/edit/block-controls.js +119 -0
- package/src/cover/edit/cover-placeholder.js +39 -0
- package/src/cover/edit/index.js +393 -0
- package/src/cover/edit/inspector-controls.js +286 -0
- package/src/cover/edit/resizable-cover.js +55 -0
- package/src/cover/edit/use-cover-is-dark.js +71 -0
- package/src/cover/edit.native.js +40 -14
- package/src/cover/editor.scss +1 -1
- package/src/cover/focal-point-settings-button.native.js +1 -1
- package/src/cover/index.php +20 -37
- package/src/cover/save.js +26 -13
- package/src/cover/shared.js +5 -3
- package/src/cover/style.native.scss +4 -0
- package/src/cover/style.scss +27 -26
- package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
- package/src/cover/test/block-controls.js +62 -0
- package/src/cover/test/transforms.js +301 -0
- package/src/cover/transforms.js +112 -7
- package/src/cover/use-cover-is-dark.native.js +51 -0
- package/src/editor.scss +3 -1
- package/src/embed/embed-preview.js +4 -2
- package/src/file/edit.js +5 -1
- package/src/file/edit.native.js +0 -1
- package/src/file/save.js +14 -2
- package/src/gallery/block.json +1 -1
- package/src/gallery/edit.js +2 -1
- package/src/gallery/gallery.js +2 -2
- package/src/gallery/gap-styles.js +21 -6
- package/src/gallery/index.php +23 -12
- package/src/gallery/shared.js +3 -2
- package/src/gallery/use-get-media.js +2 -1
- package/src/gallery/use-short-code-transform.js +19 -16
- package/src/gallery/v1/gallery.js +2 -2
- package/src/group/block.json +1 -0
- package/src/heading/block.json +1 -0
- package/src/heading/edit.js +5 -2
- package/src/heading/transforms.js +4 -3
- package/src/image/edit.js +0 -44
- package/src/image/edit.native.js +65 -4
- package/src/image/editor.scss +1 -1
- package/src/image/image.js +10 -13
- package/src/image/styles.native.scss +11 -0
- package/src/image/test/edit.native.js +7 -7
- package/src/index.js +53 -33
- package/src/is-block-metadata-experimental.js +19 -0
- package/src/latest-posts/edit.js +27 -2
- package/src/latest-posts/edit.native.js +56 -1
- package/src/latest-posts/index.php +12 -6
- package/src/latest-posts/style.scss +4 -0
- package/src/list/transforms.js +7 -0
- package/src/list/v2/edit.js +1 -0
- package/src/list/v2/migrate.js +1 -1
- package/src/list/v2/transforms.js +35 -0
- package/src/list-item/block.json +2 -1
- package/src/list-item/edit.js +17 -10
- package/src/list-item/hooks/index.js +3 -0
- package/src/list-item/hooks/use-backspace.js +52 -0
- package/src/list-item/hooks/use-enter.js +9 -16
- package/src/list-item/hooks/use-indent-list-item.js +50 -63
- package/src/list-item/hooks/use-space.js +48 -0
- package/src/list-item/hooks/use-split.js +33 -0
- package/src/list-item/utils.js +1 -1
- package/src/media-text/edit.native.js +3 -1
- package/src/media-text/media-container.native.js +2 -4
- package/src/media-text/transforms.js +154 -0
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +181 -205
- package/src/navigation/edit/inner-blocks.js +6 -15
- package/src/navigation/index.php +40 -0
- package/src/navigation/style.scss +3 -0
- package/src/navigation/use-navigation-entities.js +1 -1
- package/src/navigation/view-modal.js +32 -0
- package/src/navigation-link/edit.js +75 -48
- package/src/navigation-link/fallback-variations.js +1 -1
- package/src/navigation-link/hooks.js +2 -2
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +4 -4
- package/src/navigation-link/test/edit.js +0 -20
- package/src/navigation-submenu/edit.js +13 -17
- package/src/page-list/convert-to-links-modal.js +1 -1
- package/src/page-list/edit.js +1 -4
- package/src/paragraph/edit.js +6 -0
- package/src/paragraph/use-enter.js +103 -0
- package/src/post-author/edit.js +24 -22
- package/src/post-author/index.php +4 -3
- package/src/post-author-name/block.json +1 -0
- package/src/post-author-name/index.js +2 -0
- package/src/post-author-name/index.php +1 -1
- package/src/post-author-name/transforms.js +25 -0
- package/src/post-comment/block.json +2 -1
- package/src/post-comments/block.json +3 -2
- package/src/post-comments/edit.js +206 -44
- package/src/post-comments/editor.scss +3 -0
- package/src/post-comments/index.php +3 -1
- package/src/post-comments/style.scss +30 -5
- package/src/post-comments-count/block.json +1 -0
- package/src/post-comments-form/block.json +1 -0
- package/src/post-comments-form/edit.js +52 -23
- package/src/post-comments-form/editor.scss +3 -0
- package/src/post-comments-form/form.js +50 -0
- package/src/post-comments-form/index.php +10 -3
- package/src/post-comments-form/style.scss +1 -4
- package/src/post-comments-link/block.json +1 -0
- package/src/post-content/edit.js +15 -1
- package/src/post-date/edit.js +4 -3
- package/src/post-excerpt/edit.js +14 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-template/edit.js +5 -0
- package/src/post-template/index.php +30 -0
- package/src/post-terms/block.json +8 -0
- package/src/post-terms/edit.js +47 -1
- package/src/post-terms/hooks.js +27 -0
- package/src/post-terms/index.js +14 -7
- package/src/post-terms/index.php +50 -2
- package/src/post-title/index.js +1 -1
- package/src/pullquote/edit.js +2 -2
- package/src/pullquote/edit.native.js +2 -2
- package/src/query/block.json +2 -1
- package/src/query/edit/inspector-controls/index.js +25 -11
- package/src/query/edit/inspector-controls/parent-control.js +133 -0
- package/src/query/edit/inspector-controls/sticky-control.js +25 -0
- package/src/query/utils.js +22 -0
- package/src/query-no-results/edit.js +1 -1
- package/src/query-pagination/index.php +0 -1
- package/src/query-title/index.js +1 -1
- package/src/query-title/variations.js +2 -2
- package/src/quote/block.json +1 -0
- package/src/quote/edit.js +5 -2
- package/src/quote/v2/edit.js +4 -2
- package/src/search/block.json +4 -0
- package/src/search/edit.js +4 -1
- package/src/search/index.php +29 -16
- package/src/separator/block.json +3 -0
- package/src/separator/editor.scss +1 -0
- package/src/shortcode/edit.native.js +29 -15
- package/src/shortcode/style.native.scss +11 -4
- package/src/shortcode/test/__snapshots__/edit.native.js.snap +9 -0
- package/src/shortcode/test/edit.native.js +58 -40
- package/src/site-logo/edit.js +1 -1
- package/src/site-logo/style.scss +6 -0
- package/src/social-links/edit.js +11 -10
- package/src/table/edit.js +19 -4
- package/src/table-of-contents/block.json +9 -2
- package/src/table-of-contents/edit.js +170 -77
- package/src/table-of-contents/index.js +2 -0
- package/src/table-of-contents/list.tsx +46 -0
- package/src/table-of-contents/save.js +25 -0
- package/src/table-of-contents/utils.ts +71 -0
- package/src/tag-cloud/block.json +1 -1
- package/src/template-part/edit/index.js +25 -15
- package/src/template-part/edit/inner-blocks.js +2 -10
- package/src/video/edit.js +7 -6
- package/src/video/editor.scss +3 -6
- package/test/babel-plugin.js +67 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +0 -1
- package/build/comments-query-loop/edit.js.map +0 -1
- package/build/comments-query-loop/index.js.map +0 -1
- package/build/comments-query-loop/save.js.map +0 -1
- package/build/cover/edit.js +0 -665
- package/build/cover/edit.js.map +0 -1
- package/build/navigation-area/edit.js +0 -110
- package/build/navigation-area/edit.js.map +0 -1
- package/build/navigation-area/index.js +0 -62
- package/build/navigation-area/index.js.map +0 -1
- package/build/navigation-area/inner-blocks.js +0 -34
- package/build/navigation-area/inner-blocks.js.map +0 -1
- package/build/navigation-area/save.js +0 -18
- package/build/navigation-area/save.js.map +0 -1
- package/build/post-terms/variations.js +0 -37
- package/build/post-terms/variations.js.map +0 -1
- package/build-module/comments-query-loop/edit.js.map +0 -1
- package/build-module/comments-query-loop/index.js.map +0 -1
- package/build-module/comments-query-loop/save.js.map +0 -1
- package/build-module/cover/edit.js +0 -642
- package/build-module/cover/edit.js.map +0 -1
- package/build-module/navigation-area/edit.js +0 -94
- package/build-module/navigation-area/edit.js.map +0 -1
- package/build-module/navigation-area/index.js +0 -48
- package/build-module/navigation-area/index.js.map +0 -1
- package/build-module/navigation-area/inner-blocks.js +0 -26
- package/build-module/navigation-area/inner-blocks.js.map +0 -1
- package/build-module/navigation-area/save.js +0 -10
- package/build-module/navigation-area/save.js.map +0 -1
- package/build-module/post-terms/variations.js +0 -27
- package/build-module/post-terms/variations.js.map +0 -1
- package/src/cover/edit.js +0 -822
- package/src/navigation-area/block.json +0 -23
- package/src/navigation-area/edit.js +0 -111
- package/src/navigation-area/index.js +0 -26
- package/src/navigation-area/index.php +0 -22
- package/src/navigation-area/inner-blocks.js +0 -24
- package/src/navigation-area/save.js +0 -8
- package/src/post-terms/variations.js +0 -28
- package/src/table-of-contents/index.php +0 -346
- package/src/table-of-contents/list.js +0 -28
- package/src/table-of-contents/utils.js +0 -126
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = ResizableCover;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* External dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
const RESIZABLE_BOX_ENABLE_OPTION = {
|
|
26
|
+
top: false,
|
|
27
|
+
right: false,
|
|
28
|
+
bottom: true,
|
|
29
|
+
left: false,
|
|
30
|
+
topRight: false,
|
|
31
|
+
bottomRight: false,
|
|
32
|
+
bottomLeft: false,
|
|
33
|
+
topLeft: false
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function ResizableCover(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
className,
|
|
39
|
+
onResizeStart,
|
|
40
|
+
onResize,
|
|
41
|
+
onResizeStop,
|
|
42
|
+
...props
|
|
43
|
+
} = _ref;
|
|
44
|
+
const [isResizing, setIsResizing] = (0, _element.useState)(false);
|
|
45
|
+
return (0, _element.createElement)(_components.ResizableBox, (0, _extends2.default)({
|
|
46
|
+
className: (0, _classnames.default)(className, {
|
|
47
|
+
'is-resizing': isResizing
|
|
48
|
+
}),
|
|
49
|
+
enable: RESIZABLE_BOX_ENABLE_OPTION,
|
|
50
|
+
onResizeStart: (_event, _direction, elt) => {
|
|
51
|
+
onResizeStart(elt.clientHeight);
|
|
52
|
+
onResize(elt.clientHeight);
|
|
53
|
+
},
|
|
54
|
+
onResize: (_event, _direction, elt) => {
|
|
55
|
+
onResize(elt.clientHeight);
|
|
56
|
+
|
|
57
|
+
if (!isResizing) {
|
|
58
|
+
setIsResizing(true);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
onResizeStop: (_event, _direction, elt) => {
|
|
62
|
+
onResizeStop(elt.clientHeight);
|
|
63
|
+
setIsResizing(false);
|
|
64
|
+
}
|
|
65
|
+
}, props));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=resizable-cover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/edit/resizable-cover.js"],"names":["RESIZABLE_BOX_ENABLE_OPTION","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft","ResizableCover","className","onResizeStart","onResize","onResizeStop","props","isResizing","setIsResizing","_event","_direction","elt","clientHeight"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;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b;AACA;AAlBF,KAmBMF,KAnBN,EADD;AAuBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { ResizableBox } from '@wordpress/components';\n\nconst RESIZABLE_BOX_ENABLE_OPTION = {\n\ttop: false,\n\tright: false,\n\tbottom: true,\n\tleft: false,\n\ttopRight: false,\n\tbottomRight: false,\n\tbottomLeft: false,\n\ttopLeft: false,\n};\n\nexport default function ResizableCover( {\n\tclassName,\n\tonResizeStart,\n\tonResize,\n\tonResizeStop,\n\t...props\n} ) {\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ classnames( className, {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tenable={ RESIZABLE_BOX_ENABLE_OPTION }\n\t\t\tonResizeStart={ ( _event, _direction, elt ) => {\n\t\t\t\tonResizeStart( elt.clientHeight );\n\t\t\t\tonResize( elt.clientHeight );\n\t\t\t} }\n\t\t\tonResize={ ( _event, _direction, elt ) => {\n\t\t\t\tonResize( elt.clientHeight );\n\t\t\t\tif ( ! isResizing ) {\n\t\t\t\t\tsetIsResizing( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonResizeStop={ ( _event, _direction, elt ) => {\n\t\t\t\tonResizeStop( elt.clientHeight );\n\t\t\t\tsetIsResizing( false );\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = useCoverIsDark;
|
|
9
|
+
|
|
10
|
+
var _fastAverageColor = _interopRequireDefault(require("fast-average-color"));
|
|
11
|
+
|
|
12
|
+
var _colord = require("colord");
|
|
13
|
+
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* External dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
function retrieveFastAverageColor() {
|
|
24
|
+
if (!retrieveFastAverageColor.fastAverageColor) {
|
|
25
|
+
retrieveFastAverageColor.fastAverageColor = new _fastAverageColor.default();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return retrieveFastAverageColor.fastAverageColor;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* useCoverIsDark is a hook that returns a boolean variable specifying if the cover
|
|
32
|
+
* background is dark or not.
|
|
33
|
+
*
|
|
34
|
+
* @param {?string} url Url of the media background.
|
|
35
|
+
* @param {?number} dimRatio Transparency of the overlay color. If an image and
|
|
36
|
+
* color are set, dimRatio is used to decide what is used
|
|
37
|
+
* for background darkness checking purposes.
|
|
38
|
+
* @param {?string} overlayColor String containing the overlay color value if one exists.
|
|
39
|
+
* @param {?Object} elementRef If a media background is set, elementRef should contain a reference to a
|
|
40
|
+
* dom element that renders that media.
|
|
41
|
+
*
|
|
42
|
+
* @return {boolean} True if the cover background is considered "dark" and false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
function useCoverIsDark(url) {
|
|
47
|
+
let dimRatio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
|
|
48
|
+
let overlayColor = arguments.length > 2 ? arguments[2] : undefined;
|
|
49
|
+
let elementRef = arguments.length > 3 ? arguments[3] : undefined;
|
|
50
|
+
const [isDark, setIsDark] = (0, _element.useState)(false);
|
|
51
|
+
(0, _element.useEffect)(() => {
|
|
52
|
+
// If opacity is lower than 50 the dominant color is the image or video color,
|
|
53
|
+
// so use that color for the dark mode computation.
|
|
54
|
+
if (url && dimRatio <= 50 && elementRef.current) {
|
|
55
|
+
retrieveFastAverageColor().getColorAsync(elementRef.current, color => {
|
|
56
|
+
setIsDark(color.isDark);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}, [url, url && dimRatio <= 50 && elementRef.current, setIsDark]);
|
|
60
|
+
(0, _element.useEffect)(() => {
|
|
61
|
+
// If opacity is greater than 50 the dominant color is the overlay color,
|
|
62
|
+
// so use that color for the dark mode computation.
|
|
63
|
+
if (dimRatio > 50 || !url) {
|
|
64
|
+
if (!overlayColor) {
|
|
65
|
+
// If no overlay color exists the overlay color is black (isDark )
|
|
66
|
+
setIsDark(true);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
setIsDark((0, _colord.colord)(overlayColor).isDark());
|
|
71
|
+
}
|
|
72
|
+
}, [overlayColor, dimRatio > 50 || !url, setIsDark]);
|
|
73
|
+
(0, _element.useEffect)(() => {
|
|
74
|
+
if (!url && !overlayColor) {
|
|
75
|
+
// Reset isDark.
|
|
76
|
+
setIsDark(false);
|
|
77
|
+
}
|
|
78
|
+
}, [!url && !overlayColor, setIsDark]);
|
|
79
|
+
return isDark;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=use-cover-is-dark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/edit/use-cover-is-dark.js"],"names":["retrieveFastAverageColor","fastAverageColor","FastAverageColor","useCoverIsDark","url","dimRatio","overlayColor","elementRef","isDark","setIsDark","current","getColorAsync","color"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,wBAAT,GAAoC;AACnC,MAAK,CAAEA,wBAAwB,CAACC,gBAAhC,EAAmD;AAClDD,IAAAA,wBAAwB,CAACC,gBAAzB,GAA4C,IAAIC,yBAAJ,EAA5C;AACA;;AACD,SAAOF,wBAAwB,CAACC,gBAAhC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACe,SAASE,cAAT,CACdC,GADc,EAKb;AAAA,MAHDC,QAGC,uEAHU,EAGV;AAAA,MAFDC,YAEC;AAAA,MADDC,UACC;AACD,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,KAAV,CAA9B;AACA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKL,GAAG,IAAIC,QAAQ,IAAI,EAAnB,IAAyBE,UAAU,CAACG,OAAzC,EAAmD;AAClDV,MAAAA,wBAAwB,GAAGW,aAA3B,CACCJ,UAAU,CAACG,OADZ,EAEGE,KAAF,IAAa;AACZH,QAAAA,SAAS,CAAEG,KAAK,CAACJ,MAAR,CAAT;AACA,OAJF;AAMA;AACD,GAXD,EAWG,CAAEJ,GAAF,EAAOA,GAAG,IAAIC,QAAQ,IAAI,EAAnB,IAAyBE,UAAU,CAACG,OAA3C,EAAoDD,SAApD,CAXH;AAYA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKJ,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAxB,EAA8B;AAC7B,UAAK,CAAEE,YAAP,EAAsB;AACrB;AACAG,QAAAA,SAAS,CAAE,IAAF,CAAT;AACA;AACA;;AACDA,MAAAA,SAAS,CAAE,oBAAQH,YAAR,EAAuBE,MAAvB,EAAF,CAAT;AACA;AACD,GAXD,EAWG,CAAEF,YAAF,EAAgBD,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAnC,EAAwCK,SAAxC,CAXH;AAYA,0BAAW,MAAM;AAChB,QAAK,CAAEL,GAAF,IAAS,CAAEE,YAAhB,EAA+B;AAC9B;AACAG,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GALD,EAKG,CAAE,CAAEL,GAAF,IAAS,CAAEE,YAAb,EAA2BG,SAA3B,CALH;AAMA,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport FastAverageColor from 'fast-average-color';\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\n\nfunction retrieveFastAverageColor() {\n\tif ( ! retrieveFastAverageColor.fastAverageColor ) {\n\t\tretrieveFastAverageColor.fastAverageColor = new FastAverageColor();\n\t}\n\treturn retrieveFastAverageColor.fastAverageColor;\n}\n\n/**\n * useCoverIsDark is a hook that returns a boolean variable specifying if the cover\n * background is dark or not.\n *\n * @param {?string} url Url of the media background.\n * @param {?number} dimRatio Transparency of the overlay color. If an image and\n * color are set, dimRatio is used to decide what is used\n * for background darkness checking purposes.\n * @param {?string} overlayColor String containing the overlay color value if one exists.\n * @param {?Object} elementRef If a media background is set, elementRef should contain a reference to a\n * dom element that renders that media.\n *\n * @return {boolean} True if the cover background is considered \"dark\" and false otherwise.\n */\nexport default function useCoverIsDark(\n\turl,\n\tdimRatio = 50,\n\toverlayColor,\n\telementRef\n) {\n\tconst [ isDark, setIsDark ] = useState( false );\n\tuseEffect( () => {\n\t\t// If opacity is lower than 50 the dominant color is the image or video color,\n\t\t// so use that color for the dark mode computation.\n\t\tif ( url && dimRatio <= 50 && elementRef.current ) {\n\t\t\tretrieveFastAverageColor().getColorAsync(\n\t\t\t\telementRef.current,\n\t\t\t\t( color ) => {\n\t\t\t\t\tsetIsDark( color.isDark );\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [ url, url && dimRatio <= 50 && elementRef.current, setIsDark ] );\n\tuseEffect( () => {\n\t\t// If opacity is greater than 50 the dominant color is the overlay color,\n\t\t// so use that color for the dark mode computation.\n\t\tif ( dimRatio > 50 || ! url ) {\n\t\t\tif ( ! overlayColor ) {\n\t\t\t\t// If no overlay color exists the overlay color is black (isDark )\n\t\t\t\tsetIsDark( true );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetIsDark( colord( overlayColor ).isDark() );\n\t\t}\n\t}, [ overlayColor, dimRatio > 50 || ! url, setIsDark ] );\n\tuseEffect( () => {\n\t\tif ( ! url && ! overlayColor ) {\n\t\t\t// Reset isDark.\n\t\t\tsetIsDark( false );\n\t\t}\n\t}, [ ! url && ! overlayColor, setIsDark ] );\n\treturn isDark;\n}\n"]}
|
|
@@ -15,6 +15,8 @@ var _reactNative = require("react-native");
|
|
|
15
15
|
|
|
16
16
|
var _reactNativeVideo = _interopRequireDefault(require("react-native-video"));
|
|
17
17
|
|
|
18
|
+
var _dedupe = _interopRequireDefault(require("classnames/dedupe"));
|
|
19
|
+
|
|
18
20
|
var _reactNativeBridge = require("@wordpress/react-native-bridge");
|
|
19
21
|
|
|
20
22
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -39,6 +41,8 @@ var _shared = require("./shared");
|
|
|
39
41
|
|
|
40
42
|
var _controls = _interopRequireDefault(require("./controls"));
|
|
41
43
|
|
|
44
|
+
var _useCoverIsDark = _interopRequireDefault(require("./use-cover-is-dark"));
|
|
45
|
+
|
|
42
46
|
/**
|
|
43
47
|
* External dependencies
|
|
44
48
|
*/
|
|
@@ -89,7 +93,8 @@ const Cover = _ref => {
|
|
|
89
93
|
templateLock,
|
|
90
94
|
customGradient,
|
|
91
95
|
gradient,
|
|
92
|
-
overlayColor
|
|
96
|
+
overlayColor,
|
|
97
|
+
isDark
|
|
93
98
|
} = attributes;
|
|
94
99
|
const [isScreenReaderEnabled, setIsScreenReaderEnabled] = (0, _element.useState)(false);
|
|
95
100
|
(0, _element.useEffect)(() => {
|
|
@@ -125,20 +130,7 @@ const Cover = _ref => {
|
|
|
125
130
|
const hasBackground = !!(url || style && style.color && style.color.background || attributes.overlayColor || overlayColorValue.color || customOverlayColor || gradientValue);
|
|
126
131
|
const hasOnlyColorBackground = !url && (hasBackground || hasInnerBlocks);
|
|
127
132
|
const [isCustomColorPickerShowing, setCustomColorPickerShowing] = (0, _element.useState)(false);
|
|
128
|
-
const openMediaOptionsRef = (0, _element.useRef)(); //
|
|
129
|
-
// since there's no system to inherit styles yet
|
|
130
|
-
// the RichText component will check if there are
|
|
131
|
-
// parent styles for the current block. If there are,
|
|
132
|
-
// it will use that color instead.
|
|
133
|
-
|
|
134
|
-
(0, _element.useEffect)(() => {
|
|
135
|
-
// While we don't support theme colors.
|
|
136
|
-
if (!attributes.overlayColor || !attributes.overlay && url) {
|
|
137
|
-
setAttributes({
|
|
138
|
-
childrenStyles: _style.default.defaultColor
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}, [setAttributes]); // Initialize uploading flag to false, awaiting sync.
|
|
133
|
+
const openMediaOptionsRef = (0, _element.useRef)(); // Initialize uploading flag to false, awaiting sync.
|
|
142
134
|
|
|
143
135
|
const [isUploadInProgress, setIsUploadInProgress] = (0, _element.useState)(false); // Initialize upload failure flag to true if url is local.
|
|
144
136
|
|
|
@@ -201,6 +193,35 @@ const Cover = _ref => {
|
|
|
201
193
|
openGeneralSidebar();
|
|
202
194
|
}
|
|
203
195
|
|
|
196
|
+
const {
|
|
197
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
198
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
199
|
+
const isCoverDark = (0, _useCoverIsDark.default)(isDark, url, dimRatio, overlayColorValue === null || overlayColorValue === void 0 ? void 0 : overlayColorValue.color);
|
|
200
|
+
(0, _element.useEffect)(() => {
|
|
201
|
+
var _attributes$className;
|
|
202
|
+
|
|
203
|
+
// This side-effect should not create an undo level.
|
|
204
|
+
__unstableMarkNextChangeAsNotPersistent(); // Used to set a default color for its InnerBlocks
|
|
205
|
+
// since there's no system to inherit styles yet
|
|
206
|
+
// the RichText component will check if there are
|
|
207
|
+
// parent styles for the current block. If there are,
|
|
208
|
+
// it will use that color instead.
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
setAttributes({
|
|
212
|
+
isDark: isCoverDark,
|
|
213
|
+
childrenStyles: isCoverDark ? _style.default.defaultColor : _style.default.defaultColorLightMode
|
|
214
|
+
}); // Ensure that "is-light" is removed from "className" attribute if cover background is dark.
|
|
215
|
+
|
|
216
|
+
if (isCoverDark && (_attributes$className = attributes.className) !== null && _attributes$className !== void 0 && _attributes$className.includes('is-light')) {
|
|
217
|
+
const className = (0, _dedupe.default)(attributes.className, {
|
|
218
|
+
'is-light': false
|
|
219
|
+
});
|
|
220
|
+
setAttributes({
|
|
221
|
+
className: className !== '' ? className : undefined
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}, [isCoverDark]);
|
|
204
225
|
const backgroundColor = getStylesFromColorScheme(_style.default.backgroundSolid, _style.default.backgroundSolidDark);
|
|
205
226
|
const overlayStyles = [_style.default.overlay, url && {
|
|
206
227
|
opacity: dimRatio / 100
|
|
@@ -271,7 +292,6 @@ const Cover = _ref => {
|
|
|
271
292
|
return (0, _element.createElement)(_reactNative.TouchableWithoutFeedback, {
|
|
272
293
|
accessible: !isParentSelected,
|
|
273
294
|
onPress: onMediaPressed,
|
|
274
|
-
onLongPress: openMediaOptionsRef.current,
|
|
275
295
|
disabled: !isParentSelected
|
|
276
296
|
}, (0, _element.createElement)(_reactNative.View, {
|
|
277
297
|
style: [_style.default.background, backgroundColor]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/edit.native.js"],"names":["INNER_BLOCKS_TEMPLATE","align","placeholder","Cover","attributes","getStylesFromColorScheme","isParentSelected","onFocus","setAttributes","openGeneralSidebar","closeSettingsBottomSheet","isSelected","selectBlock","blockWidth","hasInnerBlocks","backgroundType","dimRatio","focalPoint","minHeight","url","id","style","customOverlayColor","minHeightUnit","allowedBlocks","templateLock","customGradient","gradient","overlayColor","isScreenReaderEnabled","setIsScreenReaderEnabled","isCurrent","a11yInfoChangeSubscription","AccessibilityInfo","addEventListener","then","remove","convertedMinHeight","COVER_DEFAULT_HEIGHT","isImage","MEDIA_TYPE_IMAGE","THEME_COLORS_COUNT","colorsDefault","coverDefaultPalette","colors","slice","gradients","gradientValue","overlayColorValue","hasBackground","color","background","hasOnlyColorBackground","isCustomColorPickerShowing","setCustomColorPickerShowing","openMediaOptionsRef","overlay","childrenStyles","styles","defaultColor","isUploadInProgress","setIsUploadInProgress","didUploadFail","setDidUploadFail","shouldShowFailure","onSelectMedia","media","onSelect","onMediaPressed","isVideoLoading","setIsVideoLoading","onVideoLoadStart","onVideoLoad","onClearMedia","undefined","hasParallax","setColor","colorValue","slug","openColorPicker","backgroundColor","backgroundSolid","backgroundSolidDark","overlayStyles","opacity","overlaySelected","placeholderIconStyle","icon","iconDark","placeholderIcon","toolbarControls","open","replace","accessibilityHint","Platform","OS","addMediaButton","current","selectImageContainer","selectImage","image","selectImageIcon","onBottomSheetClosed","InteractionManager","runAfterInteractions","colorPickerControls","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","onHandleHardwareButtonPress","isBottomSheetContentScrolling","renderContent","getMediaOptions","renderBackground","VIDEO_BACKGROUND_TYPE","mediaServerId","mediaUrl","IMAGE_BACKGROUND_TYPE","imageContainer","IMAGE_DEFAULT_FOCAL_POINT","width","uri","mediaPlaceholderEmptyStateContainer","height","title","ALLOWED_MEDIA_TYPES","colorPaletteWrapper","paletteColorIndicator","paletteCustomIndicatorWrapper","backgroundContainer","content","overlayContainer","imageEditButton","destructiveButton","label","onPress","separated","value","uploadFailedContainer","uploadFailed","warning","uploadFailedIcon","select","clientId","getSelectedBlockClientId","getBlock","blockEditorStore","selectedBlockClientId","getSettings","innerBlocks","length","settings","dispatch","editPostStore","closeGeneralSidebar","withPreferredColorScheme"],"mappings":";;;;;;;;;AAkDA;;;;AA/CA;;AAOA;;AAKA;;AAMA;;AACA;;AAaA;;AAaA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AAOA;;AAxEA;AACA;AACA;;AAUA;AACA;AACA;;AA+CA;AACA;AACA;;AAWA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAG,CAC7B,CACC,gBADD,EAEC;AACCC,EAAAA,KAAK,EAAE,QADR;AAECC,EAAAA,WAAW,EAAE,cAAI,cAAJ;AAFd,CAFD,CAD6B,CAA9B;;AAUA,MAAMC,K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,GAAGH,wBAAwB,EAAtD;AAEA,QAAM;AAAEI,IAAAA;AAAF,MAAkBN,MAAM,CAAEI,kBAAF,CAA9B;AAEA,QAAMpI,cAAc,GAAG,cAAAmI,QAAQ,CAAEF,QAAF,CAAR,wDAAsBM,WAAtB,CAAkCC,MAAlC,IAA2C,CAAlE;AAEA,SAAO;AACNC,IAAAA,QAAQ,EAAEH,WAAW,EADf;AAEN9I,IAAAA,gBAAgB,EAAE6I,qBAAqB,KAAKJ,QAFtC;AAGNjI,IAAAA;AAHM,GAAP;AAKA,CAhBD,CADuB,EAkBvB,wBAAc,CAAE0I,QAAF,YAA8B;AAAA,MAAlB;AAAET,IAAAA;AAAF,GAAkB;AAC3C,QAAM;AAAEtI,IAAAA;AAAF,MAAyB+I,QAAQ,CAAEC,eAAF,CAAvC;AACA,QAAM;AAAE7I,IAAAA;AAAF,MAAkB4I,QAAQ,CAAEN,kBAAF,CAAhC;AAEA,SAAO;AACNzI,IAAAA,kBAAkB,EAAE,MAAMA,kBAAkB,CAAE,iBAAF,CADtC;;AAENC,IAAAA,wBAAwB,GAAG;AAC1B8I,MAAAA,QAAQ,CAAEC,eAAF,CAAR,CAA0BC,mBAA1B;AACA,KAJK;;AAKN9I,IAAAA,WAAW,EAAE,MAAMA,WAAW,CAAEmI,QAAF;AALxB,GAAP;AAOA,CAXD,CAlBuB,EA8BvBY,iCA9BuB,CAAT,EA+BVxJ,KA/BU,C","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tInteractionManager,\n\tAccessibilityInfo,\n\tPlatform,\n} from 'react-native';\nimport Video from 'react-native-video';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trequestImageFailedRetryDialog,\n\trequestImageUploadCancelDialog,\n\trequestImageFullscreenPreview,\n\tmediaUploadSync,\n} from '@wordpress/react-native-bridge';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tImage,\n\tImageEditingButton,\n\tIMAGE_DEFAULT_FOCAL_POINT,\n\tToolbarButton,\n\tGradient,\n\tColorPalette,\n\tColorPicker,\n\tBottomSheetConsumer,\n\tuseConvertUnitToMobile,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tInspectorControls,\n\tMEDIA_TYPE_IMAGE,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetGradientValueBySlug,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { cover as icon, replace, image, warning } from '@wordpress/icons';\nimport { getProtocol } from '@wordpress/url';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tattributesFromMedia,\n\tALLOWED_MEDIA_TYPES,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tCOVER_DEFAULT_HEIGHT,\n} from './shared';\nimport Controls from './controls';\n\n/**\n * Constants\n */\nconst INNER_BLOCKS_TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\talign: 'center',\n\t\t\tplaceholder: __( 'Write title…' ),\n\t\t},\n\t],\n];\n\nconst Cover = ( {\n\tattributes,\n\tgetStylesFromColorScheme,\n\tisParentSelected,\n\tonFocus,\n\tsetAttributes,\n\topenGeneralSidebar,\n\tcloseSettingsBottomSheet,\n\tisSelected,\n\tselectBlock,\n\tblockWidth,\n\thasInnerBlocks,\n} ) => {\n\tconst {\n\t\tbackgroundType,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tminHeight,\n\t\turl,\n\t\tid,\n\t\tstyle,\n\t\tcustomOverlayColor,\n\t\tminHeightUnit = 'px',\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\tcustomGradient,\n\t\tgradient,\n\t\toverlayColor,\n\t} = attributes;\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] = useState(\n\t\tfalse\n\t);\n\n\tuseEffect( () => {\n\t\tlet isCurrent = true;\n\n\t\t// Sync with local media store.\n\t\tmediaUploadSync();\n\t\tconst a11yInfoChangeSubscription = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tsetIsScreenReaderEnabled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then( () => {\n\t\t\tif ( isCurrent ) {\n\t\t\t\tsetIsScreenReaderEnabled();\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCurrent = false;\n\t\t\ta11yInfoChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tconst convertedMinHeight = useConvertUnitToMobile(\n\t\tminHeight || COVER_DEFAULT_HEIGHT,\n\t\tminHeightUnit\n\t);\n\n\tconst isImage = backgroundType === MEDIA_TYPE_IMAGE;\n\n\tconst THEME_COLORS_COUNT = 4;\n\tconst colorsDefault = useMobileGlobalStylesColors();\n\tconst coverDefaultPalette = useMemo( () => {\n\t\treturn {\n\t\t\tcolors: colorsDefault.slice( 0, THEME_COLORS_COUNT ),\n\t\t};\n\t}, [ colorsDefault ] );\n\tconst gradients = useMobileGlobalStylesColors( 'gradients' );\n\tconst gradientValue =\n\t\tcustomGradient || getGradientValueBySlug( gradients, gradient );\n\tconst overlayColorValue = getColorObjectByAttributeValues(\n\t\tcolorsDefault,\n\t\toverlayColor\n\t);\n\n\tconst hasBackground = !! (\n\t\turl ||\n\t\t( style && style.color && style.color.background ) ||\n\t\tattributes.overlayColor ||\n\t\toverlayColorValue.color ||\n\t\tcustomOverlayColor ||\n\t\tgradientValue\n\t);\n\n\tconst hasOnlyColorBackground = ! url && ( hasBackground || hasInnerBlocks );\n\n\tconst [\n\t\tisCustomColorPickerShowing,\n\t\tsetCustomColorPickerShowing,\n\t] = useState( false );\n\n\tconst openMediaOptionsRef = useRef();\n\n\t// Used to set a default color for its InnerBlocks\n\t// since there's no system to inherit styles yet\n\t// the RichText component will check if there are\n\t// parent styles for the current block. If there are,\n\t// it will use that color instead.\n\tuseEffect( () => {\n\t\t// While we don't support theme colors.\n\t\tif ( ! attributes.overlayColor || ( ! attributes.overlay && url ) ) {\n\t\t\tsetAttributes( { childrenStyles: styles.defaultColor } );\n\t\t}\n\t}, [ setAttributes ] );\n\n\t// Initialize uploading flag to false, awaiting sync.\n\tconst [ isUploadInProgress, setIsUploadInProgress ] = useState( false );\n\n\t// Initialize upload failure flag to true if url is local.\n\tconst [ didUploadFail, setDidUploadFail ] = useState(\n\t\tid && getProtocol( url ) === 'file:'\n\t);\n\n\t// Don't show failure if upload is in progress.\n\tconst shouldShowFailure = didUploadFail && ! isUploadInProgress;\n\n\tconst onSelectMedia = ( media ) => {\n\t\tsetDidUploadFail( false );\n\t\tconst onSelect = attributesFromMedia( setAttributes, dimRatio );\n\t\tonSelect( media );\n\t};\n\n\tconst onMediaPressed = () => {\n\t\tif ( isUploadInProgress ) {\n\t\t\trequestImageUploadCancelDialog( id );\n\t\t} else if ( shouldShowFailure ) {\n\t\t\trequestImageFailedRetryDialog( id );\n\t\t} else if ( isImage && url ) {\n\t\t\trequestImageFullscreenPreview( url );\n\t\t}\n\t};\n\n\tconst [ isVideoLoading, setIsVideoLoading ] = useState( true );\n\n\tconst onVideoLoadStart = () => {\n\t\tsetIsVideoLoading( true );\n\t};\n\n\tconst onVideoLoad = () => {\n\t\tsetIsVideoLoading( false );\n\t};\n\n\tconst onClearMedia = useCallback( () => {\n\t\tsetAttributes( {\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tcloseSettingsBottomSheet();\n\t}, [ closeSettingsBottomSheet ] );\n\n\tfunction setColor( color ) {\n\t\tconst colorValue = getColorObjectByColorValue( colorsDefault, color );\n\n\t\tsetAttributes( {\n\t\t\t// Clear all related attributes (only one should be set).\n\t\t\toverlayColor: colorValue?.slug ?? undefined,\n\t\t\tcustomOverlayColor: ( ! colorValue?.slug && color ) ?? undefined,\n\t\t\tgradient: undefined,\n\t\t\tcustomGradient: undefined,\n\t\t} );\n\t}\n\n\tfunction openColorPicker() {\n\t\tselectBlock();\n\t\tsetCustomColorPickerShowing( true );\n\t\topenGeneralSidebar();\n\t}\n\n\tconst backgroundColor = getStylesFromColorScheme(\n\t\tstyles.backgroundSolid,\n\t\tstyles.backgroundSolidDark\n\t);\n\n\tconst overlayStyles = [\n\t\tstyles.overlay,\n\t\turl && { opacity: dimRatio / 100 },\n\t\t! gradientValue && {\n\t\t\tbackgroundColor:\n\t\t\t\tcustomOverlayColor ||\n\t\t\t\toverlayColorValue?.color ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\tstyles.overlay?.color,\n\t\t},\n\t\t// While we don't support theme colors we add a default bg color.\n\t\t! overlayColorValue.color && ! url ? backgroundColor : {},\n\t\tisImage &&\n\t\t\tisParentSelected &&\n\t\t\t! isUploadInProgress &&\n\t\t\t! didUploadFail &&\n\t\t\tstyles.overlaySelected,\n\t];\n\n\tconst placeholderIconStyle = getStylesFromColorScheme(\n\t\tstyles.icon,\n\t\tstyles.iconDark\n\t);\n\n\tconst placeholderIcon = <Icon icon={ icon } { ...placeholderIconStyle } />;\n\n\tconst toolbarControls = ( open ) => (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ __( 'Edit cover media' ) }\n\t\t\t\ticon={ replace }\n\t\t\t\tonClick={ open }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet to add image or video' )\n\t\t\t: __( 'Double tap to open Bottom Sheet to add image or video' );\n\n\tconst addMediaButton = () => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\taccessibilityLabel={ __( 'Add image or video' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\tonPress={ openMediaOptionsRef.current }\n\t\t>\n\t\t\t<View style={ styles.selectImageContainer }>\n\t\t\t\t<View style={ styles.selectImage }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\ticon={ image }\n\t\t\t\t\t\t{ ...styles.selectImageIcon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tconst onBottomSheetClosed = useCallback( () => {\n\t\tInteractionManager.runAfterInteractions( () => {\n\t\t\tsetCustomColorPickerShowing( false );\n\t\t} );\n\t}, [] );\n\n\tconst colorPickerControls = (\n\t\t<InspectorControls>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( {\n\t\t\t\t\tshouldEnableBottomSheetScroll,\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight,\n\t\t\t\t\tonHandleClosingBottomSheet,\n\t\t\t\t\tonHandleHardwareButtonPress,\n\t\t\t\t\tisBottomSheetContentScrolling,\n\t\t\t\t} ) => (\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\tonNavigationBack={ closeSettingsBottomSheet }\n\t\t\t\t\t\tonHandleClosingBottomSheet={\n\t\t\t\t\t\t\tonHandleClosingBottomSheet\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonHandleHardwareButtonPress={\n\t\t\t\t\t\t\tonHandleHardwareButtonPress\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonBottomSheetClosed={ onBottomSheetClosed }\n\t\t\t\t\t\tisBottomSheetContentScrolling={\n\t\t\t\t\t\t\tisBottomSheetContentScrolling\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbottomLabelText={ __( 'Select a color' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</InspectorControls>\n\t);\n\n\tconst renderContent = ( getMediaOptions ) => (\n\t\t<>\n\t\t\t{ renderBackground( getMediaOptions ) }\n\t\t\t{ isParentSelected && hasOnlyColorBackground && addMediaButton() }\n\t\t</>\n\t);\n\n\tconst renderBackground = ( getMediaOptions ) => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isParentSelected }\n\t\t\tonPress={ onMediaPressed }\n\t\t\tonLongPress={ openMediaOptionsRef.current }\n\t\t\tdisabled={ ! isParentSelected }\n\t\t>\n\t\t\t<View style={ [ styles.background, backgroundColor ] }>\n\t\t\t\t{ getMediaOptions() }\n\t\t\t\t{ isParentSelected &&\n\t\t\t\t\tbackgroundType === VIDEO_BACKGROUND_TYPE &&\n\t\t\t\t\ttoolbarControls( openMediaOptionsRef.current ) }\n\t\t\t\t<MediaUploadProgress\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tonUpdateMediaProgress={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithSuccess={ ( {\n\t\t\t\t\t\tmediaServerId,\n\t\t\t\t\t\tmediaUrl,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tid: mediaServerId,\n\t\t\t\t\t\t\turl: mediaUrl,\n\t\t\t\t\t\t\tbackgroundType,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithFailure={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonMediaUploadStateReset={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( { id: undefined, url: undefined } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\n\t\t\t\t{ IMAGE_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<View style={ styles.imageContainer }>\n\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\teditButton={ false }\n\t\t\t\t\t\t\tfocalPoint={\n\t\t\t\t\t\t\t\tfocalPoint || IMAGE_DEFAULT_FOCAL_POINT\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isParentSelected }\n\t\t\t\t\t\t\tisUploadFailed={ didUploadFail }\n\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\twidth={ styles.image?.width }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t\t{ VIDEO_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<Video\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tdisableFocus\n\t\t\t\t\t\trepeat\n\t\t\t\t\t\tresizeMode={ 'cover' }\n\t\t\t\t\t\tsource={ { uri: url } }\n\t\t\t\t\t\tonLoad={ onVideoLoad }\n\t\t\t\t\t\tonLoadStart={ onVideoLoadStart }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.background,\n\t\t\t\t\t\t\t// Hide Video component since it has black background while loading the source.\n\t\t\t\t\t\t\t{ opacity: isVideoLoading ? 0 : 1 },\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tif (\n\t\t( ! hasBackground && ! hasInnerBlocks ) ||\n\t\tisCustomColorPickerShowing\n\t) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t{ isCustomColorPickerShowing && colorPickerControls }\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\theight={\n\t\t\t\t\t\tstyles.mediaPlaceholderEmptyStateContainer?.height\n\t\t\t\t\t}\n\t\t\t\t\tbackgroundColor={ customOverlayColor }\n\t\t\t\t\thideContent={\n\t\t\t\t\t\tcustomOverlayColor !== '' &&\n\t\t\t\t\t\tcustomOverlayColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\ticon={ placeholderIcon }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.colorPaletteWrapper }\n\t\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\t\tisScreenReaderEnabled ? 'none' : 'auto'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { shouldEnableBottomSheetScroll } ) => (\n\t\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteColorIndicator\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcustomIndicatorWrapperStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteCustomIndicatorWrapper\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\t\t\tonCustomPress={ openColorPicker }\n\t\t\t\t\t\t\t\t\tdefaultSettings={ coverDefaultPalette }\n\t\t\t\t\t\t\t\t\tshouldShowCustomLabel={ false }\n\t\t\t\t\t\t\t\t\tshouldShowCustomVerticalSeparator={ false }\n\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\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\t</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</MediaPlaceholder>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ styles.backgroundContainer }>\n\t\t\t{ isSelected && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<Controls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tdidUploadFail={ didUploadFail }\n\t\t\t\t\t\thasOnlyColorBackground={ hasOnlyColorBackground }\n\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\tonClearMedia={ onClearMedia }\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\n\t\t\t<View\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ [ styles.content, { minHeight: convertedMinHeight } ] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\tallowedBlocks={ allowedBlocks }\n\t\t\t\t\ttemplate={ INNER_BLOCKS_TEMPLATE }\n\t\t\t\t\ttemplateLock={ templateLock }\n\t\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\n\t\t\t<View pointerEvents=\"none\" style={ styles.overlayContainer }>\n\t\t\t\t<View style={ overlayStyles }>\n\t\t\t\t\t{ gradientValue && (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ styles.background }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</View>\n\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tisReplacingMedia={ ! hasOnlyColorBackground }\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\topenMediaOptionsRef.current = open;\n\t\t\t\t\treturn renderContent( getMediaOptions );\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t{ isImage &&\n\t\t\t\turl &&\n\t\t\t\topenMediaOptionsRef.current &&\n\t\t\t\tisParentSelected &&\n\t\t\t\t! isUploadInProgress &&\n\t\t\t\t! didUploadFail && (\n\t\t\t\t\t<View style={ styles.imageEditButton }>\n\t\t\t\t\t\t<ImageEditingButton\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\tpickerOptions={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdestructiveButton: true,\n\t\t\t\t\t\t\t\t\tid: 'clearMedia',\n\t\t\t\t\t\t\t\t\tlabel: __( 'Clear Media' ),\n\t\t\t\t\t\t\t\t\tonPress: onClearMedia,\n\t\t\t\t\t\t\t\t\tseparated: true,\n\t\t\t\t\t\t\t\t\tvalue: 'clearMedia',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t{ shouldShowFailure && (\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\tstyle={ styles.uploadFailedContainer }\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.uploadFailed }>\n\t\t\t\t\t\t<Icon icon={ warning } { ...styles.uploadFailedIcon } />\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getSelectedBlockClientId, getBlock } = select(\n\t\t\tblockEditorStore\n\t\t);\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst { getSettings } = select( blockEditorStore );\n\n\t\tconst hasInnerBlocks = getBlock( clientId )?.innerBlocks.length > 0;\n\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t\tisParentSelected: selectedBlockClientId === clientId,\n\t\t\thasInnerBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientId } ) => {\n\t\tconst { openGeneralSidebar } = dispatch( editPostStore );\n\t\tconst { selectBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\topenGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ),\n\t\t\tcloseSettingsBottomSheet() {\n\t\t\t\tdispatch( editPostStore ).closeGeneralSidebar();\n\t\t\t},\n\t\t\tselectBlock: () => selectBlock( clientId ),\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Cover );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/edit.native.js"],"names":["INNER_BLOCKS_TEMPLATE","align","placeholder","Cover","attributes","getStylesFromColorScheme","isParentSelected","onFocus","setAttributes","openGeneralSidebar","closeSettingsBottomSheet","isSelected","selectBlock","blockWidth","hasInnerBlocks","backgroundType","dimRatio","focalPoint","minHeight","url","id","style","customOverlayColor","minHeightUnit","allowedBlocks","templateLock","customGradient","gradient","overlayColor","isDark","isScreenReaderEnabled","setIsScreenReaderEnabled","isCurrent","a11yInfoChangeSubscription","AccessibilityInfo","addEventListener","then","remove","convertedMinHeight","COVER_DEFAULT_HEIGHT","isImage","MEDIA_TYPE_IMAGE","THEME_COLORS_COUNT","colorsDefault","coverDefaultPalette","colors","slice","gradients","gradientValue","overlayColorValue","hasBackground","color","background","hasOnlyColorBackground","isCustomColorPickerShowing","setCustomColorPickerShowing","openMediaOptionsRef","isUploadInProgress","setIsUploadInProgress","didUploadFail","setDidUploadFail","shouldShowFailure","onSelectMedia","media","onSelect","onMediaPressed","isVideoLoading","setIsVideoLoading","onVideoLoadStart","onVideoLoad","onClearMedia","undefined","hasParallax","setColor","colorValue","slug","openColorPicker","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","isCoverDark","childrenStyles","styles","defaultColor","defaultColorLightMode","className","includes","backgroundColor","backgroundSolid","backgroundSolidDark","overlayStyles","overlay","opacity","overlaySelected","placeholderIconStyle","icon","iconDark","placeholderIcon","toolbarControls","open","replace","accessibilityHint","Platform","OS","addMediaButton","current","selectImageContainer","selectImage","image","selectImageIcon","onBottomSheetClosed","InteractionManager","runAfterInteractions","colorPickerControls","shouldEnableBottomSheetScroll","shouldEnableBottomSheetMaxHeight","onHandleClosingBottomSheet","onHandleHardwareButtonPress","isBottomSheetContentScrolling","renderContent","getMediaOptions","renderBackground","VIDEO_BACKGROUND_TYPE","mediaServerId","mediaUrl","IMAGE_BACKGROUND_TYPE","imageContainer","IMAGE_DEFAULT_FOCAL_POINT","width","uri","mediaPlaceholderEmptyStateContainer","height","title","ALLOWED_MEDIA_TYPES","colorPaletteWrapper","paletteColorIndicator","paletteCustomIndicatorWrapper","backgroundContainer","content","overlayContainer","imageEditButton","destructiveButton","label","onPress","separated","value","uploadFailedContainer","uploadFailed","warning","uploadFailedIcon","select","clientId","getSelectedBlockClientId","getBlock","selectedBlockClientId","getSettings","innerBlocks","length","settings","dispatch","editPostStore","closeGeneralSidebar","withPreferredColorScheme"],"mappings":";;;;;;;;;AAmDA;;;;AAhDA;;AAOA;;AACA;;AAKA;;AAMA;;AACA;;AAaA;;AAaA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AAOA;;AACA;;AA1EA;AACA;AACA;;AAWA;AACA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IAAAA;AAAF,MAAkBkJ,QAAQ,CAAEhF,kBAAF,CAAhC;AAEA,SAAO;AACNrE,IAAAA,kBAAkB,EAAE,MAAMA,kBAAkB,CAAE,iBAAF,CADtC;;AAENC,IAAAA,wBAAwB,GAAG;AAC1BoJ,MAAAA,QAAQ,CAAEC,eAAF,CAAR,CAA0BC,mBAA1B;AACA,KAJK;;AAKNpJ,IAAAA,WAAW,EAAE,MAAMA,WAAW,CAAE0I,QAAF;AALxB,GAAP;AAOA,CAXD,CAlBuB,EA8BvBW,iCA9BuB,CAAT,EA+BV9J,KA/BU,C","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tView,\n\tTouchableWithoutFeedback,\n\tInteractionManager,\n\tAccessibilityInfo,\n\tPlatform,\n} from 'react-native';\nimport Video from 'react-native-video';\nimport classnames from 'classnames/dedupe';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trequestImageFailedRetryDialog,\n\trequestImageUploadCancelDialog,\n\trequestImageFullscreenPreview,\n\tmediaUploadSync,\n} from '@wordpress/react-native-bridge';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tImage,\n\tImageEditingButton,\n\tIMAGE_DEFAULT_FOCAL_POINT,\n\tToolbarButton,\n\tGradient,\n\tColorPalette,\n\tColorPicker,\n\tBottomSheetConsumer,\n\tuseConvertUnitToMobile,\n\tuseMobileGlobalStylesColors,\n} from '@wordpress/components';\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tInspectorControls,\n\tMEDIA_TYPE_IMAGE,\n\tMediaPlaceholder,\n\tMediaUpload,\n\tMediaUploadProgress,\n\tgetColorObjectByColorValue,\n\tgetColorObjectByAttributeValues,\n\tgetGradientValueBySlug,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { compose, withPreferredColorScheme } from '@wordpress/compose';\nimport { useDispatch, withSelect, withDispatch } from '@wordpress/data';\nimport {\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\nimport { cover as icon, replace, image, warning } from '@wordpress/icons';\nimport { getProtocol } from '@wordpress/url';\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport {\n\tattributesFromMedia,\n\tALLOWED_MEDIA_TYPES,\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tCOVER_DEFAULT_HEIGHT,\n} from './shared';\nimport Controls from './controls';\nimport useCoverIsDark from './use-cover-is-dark';\n\n/**\n * Constants\n */\nconst INNER_BLOCKS_TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\talign: 'center',\n\t\t\tplaceholder: __( 'Write title…' ),\n\t\t},\n\t],\n];\n\nconst Cover = ( {\n\tattributes,\n\tgetStylesFromColorScheme,\n\tisParentSelected,\n\tonFocus,\n\tsetAttributes,\n\topenGeneralSidebar,\n\tcloseSettingsBottomSheet,\n\tisSelected,\n\tselectBlock,\n\tblockWidth,\n\thasInnerBlocks,\n} ) => {\n\tconst {\n\t\tbackgroundType,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tminHeight,\n\t\turl,\n\t\tid,\n\t\tstyle,\n\t\tcustomOverlayColor,\n\t\tminHeightUnit = 'px',\n\t\tallowedBlocks,\n\t\ttemplateLock,\n\t\tcustomGradient,\n\t\tgradient,\n\t\toverlayColor,\n\t\tisDark,\n\t} = attributes;\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] = useState(\n\t\tfalse\n\t);\n\n\tuseEffect( () => {\n\t\tlet isCurrent = true;\n\n\t\t// Sync with local media store.\n\t\tmediaUploadSync();\n\t\tconst a11yInfoChangeSubscription = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tsetIsScreenReaderEnabled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then( () => {\n\t\t\tif ( isCurrent ) {\n\t\t\t\tsetIsScreenReaderEnabled();\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tisCurrent = false;\n\t\t\ta11yInfoChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tconst convertedMinHeight = useConvertUnitToMobile(\n\t\tminHeight || COVER_DEFAULT_HEIGHT,\n\t\tminHeightUnit\n\t);\n\n\tconst isImage = backgroundType === MEDIA_TYPE_IMAGE;\n\n\tconst THEME_COLORS_COUNT = 4;\n\tconst colorsDefault = useMobileGlobalStylesColors();\n\tconst coverDefaultPalette = useMemo( () => {\n\t\treturn {\n\t\t\tcolors: colorsDefault.slice( 0, THEME_COLORS_COUNT ),\n\t\t};\n\t}, [ colorsDefault ] );\n\tconst gradients = useMobileGlobalStylesColors( 'gradients' );\n\tconst gradientValue =\n\t\tcustomGradient || getGradientValueBySlug( gradients, gradient );\n\tconst overlayColorValue = getColorObjectByAttributeValues(\n\t\tcolorsDefault,\n\t\toverlayColor\n\t);\n\n\tconst hasBackground = !! (\n\t\turl ||\n\t\t( style && style.color && style.color.background ) ||\n\t\tattributes.overlayColor ||\n\t\toverlayColorValue.color ||\n\t\tcustomOverlayColor ||\n\t\tgradientValue\n\t);\n\n\tconst hasOnlyColorBackground = ! url && ( hasBackground || hasInnerBlocks );\n\n\tconst [\n\t\tisCustomColorPickerShowing,\n\t\tsetCustomColorPickerShowing,\n\t] = useState( false );\n\n\tconst openMediaOptionsRef = useRef();\n\n\t// Initialize uploading flag to false, awaiting sync.\n\tconst [ isUploadInProgress, setIsUploadInProgress ] = useState( false );\n\n\t// Initialize upload failure flag to true if url is local.\n\tconst [ didUploadFail, setDidUploadFail ] = useState(\n\t\tid && getProtocol( url ) === 'file:'\n\t);\n\n\t// Don't show failure if upload is in progress.\n\tconst shouldShowFailure = didUploadFail && ! isUploadInProgress;\n\n\tconst onSelectMedia = ( media ) => {\n\t\tsetDidUploadFail( false );\n\t\tconst onSelect = attributesFromMedia( setAttributes, dimRatio );\n\t\tonSelect( media );\n\t};\n\n\tconst onMediaPressed = () => {\n\t\tif ( isUploadInProgress ) {\n\t\t\trequestImageUploadCancelDialog( id );\n\t\t} else if ( shouldShowFailure ) {\n\t\t\trequestImageFailedRetryDialog( id );\n\t\t} else if ( isImage && url ) {\n\t\t\trequestImageFullscreenPreview( url );\n\t\t}\n\t};\n\n\tconst [ isVideoLoading, setIsVideoLoading ] = useState( true );\n\n\tconst onVideoLoadStart = () => {\n\t\tsetIsVideoLoading( true );\n\t};\n\n\tconst onVideoLoad = () => {\n\t\tsetIsVideoLoading( false );\n\t};\n\n\tconst onClearMedia = useCallback( () => {\n\t\tsetAttributes( {\n\t\t\tfocalPoint: undefined,\n\t\t\thasParallax: undefined,\n\t\t\tid: undefined,\n\t\t\turl: undefined,\n\t\t} );\n\t\tcloseSettingsBottomSheet();\n\t}, [ closeSettingsBottomSheet ] );\n\n\tfunction setColor( color ) {\n\t\tconst colorValue = getColorObjectByColorValue( colorsDefault, color );\n\n\t\tsetAttributes( {\n\t\t\t// Clear all related attributes (only one should be set).\n\t\t\toverlayColor: colorValue?.slug ?? undefined,\n\t\t\tcustomOverlayColor: ( ! colorValue?.slug && color ) ?? undefined,\n\t\t\tgradient: undefined,\n\t\t\tcustomGradient: undefined,\n\t\t} );\n\t}\n\n\tfunction openColorPicker() {\n\t\tselectBlock();\n\t\tsetCustomColorPickerShowing( true );\n\t\topenGeneralSidebar();\n\t}\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } = useDispatch(\n\t\tblockEditorStore\n\t);\n\tconst isCoverDark = useCoverIsDark(\n\t\tisDark,\n\t\turl,\n\t\tdimRatio,\n\t\toverlayColorValue?.color\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t// Used to set a default color for its InnerBlocks\n\t\t// since there's no system to inherit styles yet\n\t\t// the RichText component will check if there are\n\t\t// parent styles for the current block. If there are,\n\t\t// it will use that color instead.\n\t\tsetAttributes( {\n\t\t\tisDark: isCoverDark,\n\t\t\tchildrenStyles: isCoverDark\n\t\t\t\t? styles.defaultColor\n\t\t\t\t: styles.defaultColorLightMode,\n\t\t} );\n\n\t\t// Ensure that \"is-light\" is removed from \"className\" attribute if cover background is dark.\n\t\tif ( isCoverDark && attributes.className?.includes( 'is-light' ) ) {\n\t\t\tconst className = classnames( attributes.className, {\n\t\t\t\t'is-light': false,\n\t\t\t} );\n\t\t\tsetAttributes( {\n\t\t\t\tclassName: className !== '' ? className : undefined,\n\t\t\t} );\n\t\t}\n\t}, [ isCoverDark ] );\n\n\tconst backgroundColor = getStylesFromColorScheme(\n\t\tstyles.backgroundSolid,\n\t\tstyles.backgroundSolidDark\n\t);\n\n\tconst overlayStyles = [\n\t\tstyles.overlay,\n\t\turl && { opacity: dimRatio / 100 },\n\t\t! gradientValue && {\n\t\t\tbackgroundColor:\n\t\t\t\tcustomOverlayColor ||\n\t\t\t\toverlayColorValue?.color ||\n\t\t\t\tstyle?.color?.background ||\n\t\t\t\tstyles.overlay?.color,\n\t\t},\n\t\t// While we don't support theme colors we add a default bg color.\n\t\t! overlayColorValue.color && ! url ? backgroundColor : {},\n\t\tisImage &&\n\t\t\tisParentSelected &&\n\t\t\t! isUploadInProgress &&\n\t\t\t! didUploadFail &&\n\t\t\tstyles.overlaySelected,\n\t];\n\n\tconst placeholderIconStyle = getStylesFromColorScheme(\n\t\tstyles.icon,\n\t\tstyles.iconDark\n\t);\n\n\tconst placeholderIcon = <Icon icon={ icon } { ...placeholderIconStyle } />;\n\n\tconst toolbarControls = ( open ) => (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\ttitle={ __( 'Edit cover media' ) }\n\t\t\t\ticon={ replace }\n\t\t\t\tonClick={ open }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n\n\tconst accessibilityHint =\n\t\tPlatform.OS === 'ios'\n\t\t\t? __( 'Double tap to open Action Sheet to add image or video' )\n\t\t\t: __( 'Double tap to open Bottom Sheet to add image or video' );\n\n\tconst addMediaButton = () => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessibilityHint={ accessibilityHint }\n\t\t\taccessibilityLabel={ __( 'Add image or video' ) }\n\t\t\taccessibilityRole=\"button\"\n\t\t\tonPress={ openMediaOptionsRef.current }\n\t\t>\n\t\t\t<View style={ styles.selectImageContainer }>\n\t\t\t\t<View style={ styles.selectImage }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\ticon={ image }\n\t\t\t\t\t\t{ ...styles.selectImageIcon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tconst onBottomSheetClosed = useCallback( () => {\n\t\tInteractionManager.runAfterInteractions( () => {\n\t\t\tsetCustomColorPickerShowing( false );\n\t\t} );\n\t}, [] );\n\n\tconst colorPickerControls = (\n\t\t<InspectorControls>\n\t\t\t<BottomSheetConsumer>\n\t\t\t\t{ ( {\n\t\t\t\t\tshouldEnableBottomSheetScroll,\n\t\t\t\t\tshouldEnableBottomSheetMaxHeight,\n\t\t\t\t\tonHandleClosingBottomSheet,\n\t\t\t\t\tonHandleHardwareButtonPress,\n\t\t\t\t\tisBottomSheetContentScrolling,\n\t\t\t\t} ) => (\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\n\t\t\t\t\t\t}\n\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight={\n\t\t\t\t\t\t\tshouldEnableBottomSheetMaxHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\tonNavigationBack={ closeSettingsBottomSheet }\n\t\t\t\t\t\tonHandleClosingBottomSheet={\n\t\t\t\t\t\t\tonHandleClosingBottomSheet\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonHandleHardwareButtonPress={\n\t\t\t\t\t\t\tonHandleHardwareButtonPress\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonBottomSheetClosed={ onBottomSheetClosed }\n\t\t\t\t\t\tisBottomSheetContentScrolling={\n\t\t\t\t\t\t\tisBottomSheetContentScrolling\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbottomLabelText={ __( 'Select a color' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</BottomSheetConsumer>\n\t\t</InspectorControls>\n\t);\n\n\tconst renderContent = ( getMediaOptions ) => (\n\t\t<>\n\t\t\t{ renderBackground( getMediaOptions ) }\n\t\t\t{ isParentSelected && hasOnlyColorBackground && addMediaButton() }\n\t\t</>\n\t);\n\n\tconst renderBackground = ( getMediaOptions ) => (\n\t\t<TouchableWithoutFeedback\n\t\t\taccessible={ ! isParentSelected }\n\t\t\tonPress={ onMediaPressed }\n\t\t\tdisabled={ ! isParentSelected }\n\t\t>\n\t\t\t<View style={ [ styles.background, backgroundColor ] }>\n\t\t\t\t{ getMediaOptions() }\n\t\t\t\t{ isParentSelected &&\n\t\t\t\t\tbackgroundType === VIDEO_BACKGROUND_TYPE &&\n\t\t\t\t\ttoolbarControls( openMediaOptionsRef.current ) }\n\t\t\t\t<MediaUploadProgress\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tonUpdateMediaProgress={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithSuccess={ ( {\n\t\t\t\t\t\tmediaServerId,\n\t\t\t\t\t\tmediaUrl,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tid: mediaServerId,\n\t\t\t\t\t\t\turl: mediaUrl,\n\t\t\t\t\t\t\tbackgroundType,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tonFinishMediaUploadWithFailure={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( true );\n\t\t\t\t\t} }\n\t\t\t\t\tonMediaUploadStateReset={ () => {\n\t\t\t\t\t\tsetIsUploadInProgress( false );\n\t\t\t\t\t\tsetDidUploadFail( false );\n\t\t\t\t\t\tsetAttributes( { id: undefined, url: undefined } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\n\t\t\t\t{ IMAGE_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<View style={ styles.imageContainer }>\n\t\t\t\t\t\t<Image\n\t\t\t\t\t\t\teditButton={ false }\n\t\t\t\t\t\t\tfocalPoint={\n\t\t\t\t\t\t\t\tfocalPoint || IMAGE_DEFAULT_FOCAL_POINT\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisSelected={ isParentSelected }\n\t\t\t\t\t\t\tisUploadFailed={ didUploadFail }\n\t\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\twidth={ styles.image?.width }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t\t{ VIDEO_BACKGROUND_TYPE === backgroundType && (\n\t\t\t\t\t<Video\n\t\t\t\t\t\tmuted\n\t\t\t\t\t\tdisableFocus\n\t\t\t\t\t\trepeat\n\t\t\t\t\t\tresizeMode={ 'cover' }\n\t\t\t\t\t\tsource={ { uri: url } }\n\t\t\t\t\t\tonLoad={ onVideoLoad }\n\t\t\t\t\t\tonLoadStart={ onVideoLoadStart }\n\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\tstyles.background,\n\t\t\t\t\t\t\t// Hide Video component since it has black background while loading the source.\n\t\t\t\t\t\t\t{ opacity: isVideoLoading ? 0 : 1 },\n\t\t\t\t\t\t] }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</View>\n\t\t</TouchableWithoutFeedback>\n\t);\n\n\tif (\n\t\t( ! hasBackground && ! hasInnerBlocks ) ||\n\t\tisCustomColorPickerShowing\n\t) {\n\t\treturn (\n\t\t\t<View>\n\t\t\t\t{ isCustomColorPickerShowing && colorPickerControls }\n\t\t\t\t<MediaPlaceholder\n\t\t\t\t\theight={\n\t\t\t\t\t\tstyles.mediaPlaceholderEmptyStateContainer?.height\n\t\t\t\t\t}\n\t\t\t\t\tbackgroundColor={ customOverlayColor }\n\t\t\t\t\thideContent={\n\t\t\t\t\t\tcustomOverlayColor !== '' &&\n\t\t\t\t\t\tcustomOverlayColor !== undefined\n\t\t\t\t\t}\n\t\t\t\t\ticon={ placeholderIcon }\n\t\t\t\t\tlabels={ {\n\t\t\t\t\t\ttitle: __( 'Cover' ),\n\t\t\t\t\t} }\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t>\n\t\t\t\t\t<View\n\t\t\t\t\t\tstyle={ styles.colorPaletteWrapper }\n\t\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\t\tisScreenReaderEnabled ? 'none' : 'auto'\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BottomSheetConsumer>\n\t\t\t\t\t\t\t{ ( { shouldEnableBottomSheetScroll } ) => (\n\t\t\t\t\t\t\t\t<ColorPalette\n\t\t\t\t\t\t\t\t\tcustomColorIndicatorStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteColorIndicator\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcustomIndicatorWrapperStyles={\n\t\t\t\t\t\t\t\t\t\tstyles.paletteCustomIndicatorWrapper\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tsetColor={ setColor }\n\t\t\t\t\t\t\t\t\tonCustomPress={ openColorPicker }\n\t\t\t\t\t\t\t\t\tdefaultSettings={ coverDefaultPalette }\n\t\t\t\t\t\t\t\t\tshouldShowCustomLabel={ false }\n\t\t\t\t\t\t\t\t\tshouldShowCustomVerticalSeparator={ false }\n\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll={\n\t\t\t\t\t\t\t\t\t\tshouldEnableBottomSheetScroll\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\t</BottomSheetConsumer>\n\t\t\t\t\t</View>\n\t\t\t\t</MediaPlaceholder>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<View style={ styles.backgroundContainer }>\n\t\t\t{ isSelected && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<Controls\n\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\tdidUploadFail={ didUploadFail }\n\t\t\t\t\t\thasOnlyColorBackground={ hasOnlyColorBackground }\n\t\t\t\t\t\tisUploadInProgress={ isUploadInProgress }\n\t\t\t\t\t\tonClearMedia={ onClearMedia }\n\t\t\t\t\t\tonSelectMedia={ onSelectMedia }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\n\t\t\t<View\n\t\t\t\tpointerEvents=\"box-none\"\n\t\t\t\tstyle={ [ styles.content, { minHeight: convertedMinHeight } ] }\n\t\t\t>\n\t\t\t\t<InnerBlocks\n\t\t\t\t\tallowedBlocks={ allowedBlocks }\n\t\t\t\t\ttemplate={ INNER_BLOCKS_TEMPLATE }\n\t\t\t\t\ttemplateLock={ templateLock }\n\t\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</View>\n\n\t\t\t<View pointerEvents=\"none\" style={ styles.overlayContainer }>\n\t\t\t\t<View style={ overlayStyles }>\n\t\t\t\t\t{ gradientValue && (\n\t\t\t\t\t\t<Gradient\n\t\t\t\t\t\t\tgradientValue={ gradientValue }\n\t\t\t\t\t\t\tstyle={ styles.background }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</View>\n\t\t\t</View>\n\n\t\t\t<MediaUpload\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tisReplacingMedia={ ! hasOnlyColorBackground }\n\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\trender={ ( { open, getMediaOptions } ) => {\n\t\t\t\t\topenMediaOptionsRef.current = open;\n\t\t\t\t\treturn renderContent( getMediaOptions );\n\t\t\t\t} }\n\t\t\t/>\n\n\t\t\t{ isImage &&\n\t\t\t\turl &&\n\t\t\t\topenMediaOptionsRef.current &&\n\t\t\t\tisParentSelected &&\n\t\t\t\t! isUploadInProgress &&\n\t\t\t\t! didUploadFail && (\n\t\t\t\t\t<View style={ styles.imageEditButton }>\n\t\t\t\t\t\t<ImageEditingButton\n\t\t\t\t\t\t\tonSelectMediaUploadOption={ onSelectMedia }\n\t\t\t\t\t\t\topenMediaOptions={ openMediaOptionsRef.current }\n\t\t\t\t\t\t\tpickerOptions={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tdestructiveButton: true,\n\t\t\t\t\t\t\t\t\tid: 'clearMedia',\n\t\t\t\t\t\t\t\t\tlabel: __( 'Clear Media' ),\n\t\t\t\t\t\t\t\t\tonPress: onClearMedia,\n\t\t\t\t\t\t\t\t\tseparated: true,\n\t\t\t\t\t\t\t\t\tvalue: 'clearMedia',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</View>\n\t\t\t\t) }\n\n\t\t\t{ shouldShowFailure && (\n\t\t\t\t<View\n\t\t\t\t\tpointerEvents=\"none\"\n\t\t\t\t\tstyle={ styles.uploadFailedContainer }\n\t\t\t\t>\n\t\t\t\t\t<View style={ styles.uploadFailed }>\n\t\t\t\t\t\t<Icon icon={ warning } { ...styles.uploadFailedIcon } />\n\t\t\t\t\t</View>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t</View>\n\t);\n};\n\nexport default compose( [\n\twithSelect( ( select, { clientId } ) => {\n\t\tconst { getSelectedBlockClientId, getBlock } = select(\n\t\t\tblockEditorStore\n\t\t);\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\tconst { getSettings } = select( blockEditorStore );\n\n\t\tconst hasInnerBlocks = getBlock( clientId )?.innerBlocks.length > 0;\n\n\t\treturn {\n\t\t\tsettings: getSettings(),\n\t\t\tisParentSelected: selectedBlockClientId === clientId,\n\t\t\thasInnerBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { clientId } ) => {\n\t\tconst { openGeneralSidebar } = dispatch( editPostStore );\n\t\tconst { selectBlock } = dispatch( blockEditorStore );\n\n\t\treturn {\n\t\t\topenGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ),\n\t\t\tcloseSettingsBottomSheet() {\n\t\t\t\tdispatch( editPostStore ).closeGeneralSidebar();\n\t\t\t},\n\t\t\tselectBlock: () => selectBlock( clientId ),\n\t\t};\n\t} ),\n\twithPreferredColorScheme,\n] )( Cover );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/focal-point-settings-button.native.js"],"names":["FocalPointSettingsButton","disabled","focalPoint","onFocalPointChange","url","navigation","styles","dimmedActionButton","navigate","blockSettingsScreens","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,UAFkC;AAGlCC,IAAAA,kBAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,UAAU,GAAG,4BAAnB;AACA,SACC,4BAAC,uBAAD,CAAa,IAAb;AACC,IAAA,kBAAkB,MADnB;AAEC,IAAA,QAAQ,EAAGJ,QAFZ;AAGC,IAAA,UAAU,EAAGA,QAAQ,IAAIK,eAAOC,kBAHjC;AAIC,IAAA,SAAS,MAJV;AAKC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CALT;AAMC,IAAA,OAAO,EAAG,MAAM;AACfF,MAAAA,UAAU,CAACG,QAAX,CAAqBC,kCAAqBP,UAA1C,EAAsD;AACrDA,QAAAA,UADqD;AAErDC,QAAAA,kBAFqD;AAGrDC,QAAAA;AAHqD,OAAtD;AAKA;AAZF,KAkBC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGH,QAAQ,IAAIK,eAAOC;AAAjC,KACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAGG;AAAb,IADD,CAlBD,CADD;AAwBA;;eAEcV,wB","sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation } from '@react-navigation/native';\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, BottomSheet } from '@wordpress/components';\nimport { blockSettingsScreens } from '@wordpress/block-editor';\nimport { chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction FocalPointSettingsButton( {\n\tdisabled,\n\tfocalPoint,\n\tonFocalPointChange,\n\turl,\n} ) {\n\tconst navigation = useNavigation();\n\treturn (\n\t\t<BottomSheet.Cell\n\t\t\tcustomActionButton\n\t\t\tdisabled={ disabled }\n\t\t\tlabelStyle={ disabled && styles.dimmedActionButton }\n\t\t\tleftAlign\n\t\t\tlabel={ __( 'Edit focal point' ) }\n\t\t\tonPress={ () => {\n\t\t\t\tnavigation.navigate( blockSettingsScreens.focalPoint, {\n\t\t\t\t\tfocalPoint,\n\t\t\t\t\tonFocalPointChange,\n\t\t\t\t\turl,\n\t\t\t\t} );\n\t\t\t} }\n\t\t>\n\t\t\t{ /*\n\t\t\t * Wrapper View element used around Icon as workaround for SVG opacity\n\t\t\t * issue: https://
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/focal-point-settings-button.native.js"],"names":["FocalPointSettingsButton","disabled","focalPoint","onFocalPointChange","url","navigation","styles","dimmedActionButton","navigate","blockSettingsScreens","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,UAFkC;AAGlCC,IAAAA,kBAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,UAAU,GAAG,4BAAnB;AACA,SACC,4BAAC,uBAAD,CAAa,IAAb;AACC,IAAA,kBAAkB,MADnB;AAEC,IAAA,QAAQ,EAAGJ,QAFZ;AAGC,IAAA,UAAU,EAAGA,QAAQ,IAAIK,eAAOC,kBAHjC;AAIC,IAAA,SAAS,MAJV;AAKC,IAAA,KAAK,EAAG,cAAI,kBAAJ,CALT;AAMC,IAAA,OAAO,EAAG,MAAM;AACfF,MAAAA,UAAU,CAACG,QAAX,CAAqBC,kCAAqBP,UAA1C,EAAsD;AACrDA,QAAAA,UADqD;AAErDC,QAAAA,kBAFqD;AAGrDC,QAAAA;AAHqD,OAAtD;AAKA;AAZF,KAkBC,4BAAC,iBAAD;AAAM,IAAA,KAAK,EAAGH,QAAQ,IAAIK,eAAOC;AAAjC,KACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAGG;AAAb,IADD,CAlBD,CADD;AAwBA;;eAEcV,wB","sourcesContent":["/**\n * External dependencies\n */\nimport { useNavigation } from '@react-navigation/native';\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, BottomSheet } from '@wordpress/components';\nimport { blockSettingsScreens } from '@wordpress/block-editor';\nimport { chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction FocalPointSettingsButton( {\n\tdisabled,\n\tfocalPoint,\n\tonFocalPointChange,\n\turl,\n} ) {\n\tconst navigation = useNavigation();\n\treturn (\n\t\t<BottomSheet.Cell\n\t\t\tcustomActionButton\n\t\t\tdisabled={ disabled }\n\t\t\tlabelStyle={ disabled && styles.dimmedActionButton }\n\t\t\tleftAlign\n\t\t\tlabel={ __( 'Edit focal point' ) }\n\t\t\tonPress={ () => {\n\t\t\t\tnavigation.navigate( blockSettingsScreens.focalPoint, {\n\t\t\t\t\tfocalPoint,\n\t\t\t\t\tonFocalPointChange,\n\t\t\t\t\turl,\n\t\t\t\t} );\n\t\t\t} }\n\t\t>\n\t\t\t{ /*\n\t\t\t * Wrapper View element used around Icon as workaround for SVG opacity\n\t\t\t * issue: https://github.com/react-native-svg/react-native-svg/issues/1345\n\t\t\t */ }\n\t\t\t<View style={ disabled && styles.dimmedActionButton }>\n\t\t\t\t<Icon icon={ chevronRight } />\n\t\t\t</View>\n\t\t</BottomSheet.Cell>\n\t);\n}\n\nexport default FocalPointSettingsButton;\n"]}
|
package/build/cover/save.js
CHANGED
|
@@ -55,7 +55,7 @@ function save(_ref) {
|
|
|
55
55
|
const isImageBackground = _shared.IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
56
56
|
const isVideoBackground = _shared.VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
57
57
|
const isImgElement = !(hasParallax || isRepeated);
|
|
58
|
-
const style = {
|
|
58
|
+
const style = {
|
|
59
59
|
minHeight: minHeight || undefined
|
|
60
60
|
};
|
|
61
61
|
const bgStyle = {
|
|
@@ -63,13 +63,19 @@ function save(_ref) {
|
|
|
63
63
|
background: customGradient ? customGradient : undefined
|
|
64
64
|
};
|
|
65
65
|
const objectPosition = // prettier-ignore
|
|
66
|
-
focalPoint && isImgElement ?
|
|
66
|
+
focalPoint && isImgElement ? (0, _shared.mediaPosition)(focalPoint) : undefined;
|
|
67
|
+
const backgroundImage = url ? `url(${url})` : undefined;
|
|
68
|
+
const backgroundPosition = (0, _shared.mediaPosition)(focalPoint);
|
|
67
69
|
const classes = (0, _classnames.default)({
|
|
68
70
|
'is-light': !isDark,
|
|
69
71
|
'has-parallax': hasParallax,
|
|
70
72
|
'is-repeated': isRepeated,
|
|
71
73
|
'has-custom-content-position': !(0, _shared.isContentPositionCenter)(contentPosition)
|
|
72
74
|
}, (0, _shared.getPositionClassName)(contentPosition));
|
|
75
|
+
const imgClasses = (0, _classnames.default)('wp-block-cover__image-background', id ? `wp-image-${id}` : null, {
|
|
76
|
+
'has-parallax': hasParallax,
|
|
77
|
+
'is-repeated': isRepeated
|
|
78
|
+
});
|
|
73
79
|
const gradientValue = gradient || customGradient;
|
|
74
80
|
return (0, _element.createElement)("div", _blockEditor.useBlockProps.save({
|
|
75
81
|
className: classes,
|
|
@@ -86,8 +92,8 @@ function save(_ref) {
|
|
|
86
92
|
[gradientClass]: gradientClass
|
|
87
93
|
}),
|
|
88
94
|
style: bgStyle
|
|
89
|
-
}), !useFeaturedImage && isImageBackground &&
|
|
90
|
-
className:
|
|
95
|
+
}), !useFeaturedImage && isImageBackground && url && (isImgElement ? (0, _element.createElement)("img", {
|
|
96
|
+
className: imgClasses,
|
|
91
97
|
alt: alt,
|
|
92
98
|
src: url,
|
|
93
99
|
style: {
|
|
@@ -95,7 +101,14 @@ function save(_ref) {
|
|
|
95
101
|
},
|
|
96
102
|
"data-object-fit": "cover",
|
|
97
103
|
"data-object-position": objectPosition
|
|
98
|
-
})
|
|
104
|
+
}) : (0, _element.createElement)("div", {
|
|
105
|
+
role: "img",
|
|
106
|
+
className: imgClasses,
|
|
107
|
+
style: {
|
|
108
|
+
backgroundPosition,
|
|
109
|
+
backgroundImage
|
|
110
|
+
}
|
|
111
|
+
})), isVideoBackground && url && (0, _element.createElement)("video", {
|
|
99
112
|
className: (0, _classnames.default)('wp-block-cover__video-background', 'intrinsic-ignore'),
|
|
100
113
|
autoPlay: true,
|
|
101
114
|
muted: true,
|
package/build/cover/save.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/save.js"],"names":["save","attributes","backgroundType","gradient","contentPosition","customGradient","customOverlayColor","dimRatio","focalPoint","useFeaturedImage","hasParallax","isDark","isRepeated","overlayColor","url","alt","id","minHeight","minHeightProp","minHeightUnit","overlayColorClass","gradientClass","isImageBackground","IMAGE_BACKGROUND_TYPE","isVideoBackground","VIDEO_BACKGROUND_TYPE","isImgElement","style","undefined","bgStyle","backgroundColor","background","objectPosition","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/save.js"],"names":["save","attributes","backgroundType","gradient","contentPosition","customGradient","customOverlayColor","dimRatio","focalPoint","useFeaturedImage","hasParallax","isDark","isRepeated","overlayColor","url","alt","id","minHeight","minHeightProp","minHeightUnit","overlayColorClass","gradientClass","isImageBackground","IMAGE_BACKGROUND_TYPE","isVideoBackground","VIDEO_BACKGROUND_TYPE","isImgElement","style","undefined","bgStyle","backgroundColor","background","objectPosition","backgroundImage","backgroundPosition","classes","imgClasses","gradientValue","useBlockProps","className","useInnerBlocksProps"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAUA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAUe,SAASA,IAAT,OAAgC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AAC9C,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,QAFK;AAGLC,IAAAA,eAHK;AAILC,IAAAA,cAJK;AAKLC,IAAAA,kBALK;AAMLC,IAAAA,QANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,gBARK;AASLC,IAAAA,WATK;AAULC,IAAAA,MAVK;AAWLC,IAAAA,UAXK;AAYLC,IAAAA,YAZK;AAaLC,IAAAA,GAbK;AAcLC,IAAAA,GAdK;AAeLC,IAAAA,EAfK;AAgBLC,IAAA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,mCACMQ,iCAAoBxC,IAApB,CAA0B;AAC9BuC,IAAAA,SAAS,EAAE;AADmB,GAA1B,CADN,CAxDD,CADD;AAgEA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInnerBlocksProps,\n\tgetColorClassName,\n\t__experimentalGetGradientClass,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from './shared';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\tbackgroundType,\n\t\tgradient,\n\t\tcontentPosition,\n\t\tcustomGradient,\n\t\tcustomOverlayColor,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tuseFeaturedImage,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\toverlayColor,\n\t\turl,\n\t\talt,\n\t\tid,\n\t\tminHeight: minHeightProp,\n\t\tminHeightUnit,\n\t} = attributes;\n\tconst overlayColorClass = getColorClassName(\n\t\t'background-color',\n\t\toverlayColor\n\t);\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst minHeight =\n\t\tminHeightProp && minHeightUnit\n\t\t\t? `${ minHeightProp }${ minHeightUnit }`\n\t\t\t: minHeightProp;\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeight || undefined,\n\t};\n\n\tconst bgStyle = {\n\t\tbackgroundColor: ! overlayColorClass ? customOverlayColor : undefined,\n\t\tbackground: customGradient ? customGradient : undefined,\n\t};\n\n\tconst objectPosition =\n\t\t// prettier-ignore\n\t\tfocalPoint && isImgElement\n\t\t\t ? mediaPosition(focalPoint)\n\t\t\t : undefined;\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst classes = classnames(\n\t\t{\n\t\t\t'is-light': ! isDark,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position': ! isContentPositionCenter(\n\t\t\t\tcontentPosition\n\t\t\t),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\tconst imgClasses = classnames(\n\t\t'wp-block-cover__image-background',\n\t\tid ? `wp-image-${ id }` : null,\n\t\t{\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t}\n\t);\n\n\tconst gradientValue = gradient || customGradient;\n\n\treturn (\n\t\t<div { ...useBlockProps.save( { className: classes, style } ) }>\n\t\t\t<span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-cover__background',\n\t\t\t\t\toverlayColorClass,\n\t\t\t\t\tdimRatioToClass( dimRatio ),\n\t\t\t\t\t{\n\t\t\t\t\t\t'has-background-dim': dimRatio !== undefined,\n\t\t\t\t\t\t// For backwards compatibility. Former versions of the Cover Block applied\n\t\t\t\t\t\t// `.wp-block-cover__gradient-background` in the presence of\n\t\t\t\t\t\t// media, a gradient and a dim.\n\t\t\t\t\t\t'wp-block-cover__gradient-background':\n\t\t\t\t\t\t\turl && gradientValue && dimRatio !== 0,\n\t\t\t\t\t\t'has-background-gradient': gradientValue,\n\t\t\t\t\t\t[ gradientClass ]: gradientClass,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tstyle={ bgStyle }\n\t\t\t/>\n\n\t\t\t{ ! useFeaturedImage &&\n\t\t\t\tisImageBackground &&\n\t\t\t\turl &&\n\t\t\t\t( isImgElement ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName={ imgClasses }\n\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\tstyle={ { objectPosition } }\n\t\t\t\t\t\tdata-object-fit=\"cover\"\n\t\t\t\t\t\tdata-object-position={ objectPosition }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\tclassName={ imgClasses }\n\t\t\t\t\t\tstyle={ { backgroundPosition, backgroundImage } }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ isVideoBackground && url && (\n\t\t\t\t<video\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'wp-block-cover__video-background',\n\t\t\t\t\t\t'intrinsic-ignore'\n\t\t\t\t\t) }\n\t\t\t\t\tautoPlay\n\t\t\t\t\tmuted\n\t\t\t\t\tloop\n\t\t\t\t\tplaysInline\n\t\t\t\t\tsrc={ url }\n\t\t\t\t\tstyle={ { objectPosition } }\n\t\t\t\t\tdata-object-fit=\"cover\"\n\t\t\t\t\tdata-object-position={ objectPosition }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\t{ ...useInnerBlocksProps.save( {\n\t\t\t\t\tclassName: 'wp-block-cover__inner-container',\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
|
package/build/cover/shared.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VIDEO_BACKGROUND_TYPE = exports.IMAGE_BACKGROUND_TYPE = exports.COVER_MIN_HEIGHT = exports.COVER_MAX_HEIGHT = exports.COVER_DEFAULT_HEIGHT = exports.ALLOWED_MEDIA_TYPES = void 0;
|
|
6
|
+
exports.VIDEO_BACKGROUND_TYPE = exports.IMAGE_BACKGROUND_TYPE = exports.DEFAULT_FOCAL_POINT = exports.COVER_MIN_HEIGHT = exports.COVER_MAX_HEIGHT = exports.COVER_DEFAULT_HEIGHT = exports.ALLOWED_MEDIA_TYPES = void 0;
|
|
7
7
|
exports.attributesFromMedia = attributesFromMedia;
|
|
8
|
-
exports.backgroundImageStyles = backgroundImageStyles;
|
|
9
8
|
exports.dimRatioToClass = dimRatioToClass;
|
|
10
9
|
exports.getPositionClassName = getPositionClassName;
|
|
11
10
|
exports.isContentPositionCenter = isContentPositionCenter;
|
|
11
|
+
exports.mediaPosition = mediaPosition;
|
|
12
12
|
|
|
13
13
|
var _blob = require("@wordpress/blob");
|
|
14
14
|
|
|
@@ -37,16 +37,22 @@ const COVER_MAX_HEIGHT = 1000;
|
|
|
37
37
|
exports.COVER_MAX_HEIGHT = COVER_MAX_HEIGHT;
|
|
38
38
|
const COVER_DEFAULT_HEIGHT = 300;
|
|
39
39
|
exports.COVER_DEFAULT_HEIGHT = COVER_DEFAULT_HEIGHT;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
40
|
+
const DEFAULT_FOCAL_POINT = {
|
|
41
|
+
x: 0.5,
|
|
42
|
+
y: 0.5
|
|
43
|
+
};
|
|
44
|
+
exports.DEFAULT_FOCAL_POINT = DEFAULT_FOCAL_POINT;
|
|
47
45
|
const ALLOWED_MEDIA_TYPES = ['image', 'video'];
|
|
48
46
|
exports.ALLOWED_MEDIA_TYPES = ALLOWED_MEDIA_TYPES;
|
|
49
47
|
|
|
48
|
+
function mediaPosition() {
|
|
49
|
+
let {
|
|
50
|
+
x,
|
|
51
|
+
y
|
|
52
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_FOCAL_POINT;
|
|
53
|
+
return `${Math.round(x * 100)}% ${Math.round(y * 100)}%`;
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
function dimRatioToClass(ratio) {
|
|
51
57
|
return ratio === 50 || !ratio === undefined ? null : 'has-background-dim-' + 10 * Math.round(ratio / 10);
|
|
52
58
|
}
|