@wordpress/block-library 7.3.5 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/archives/edit.js +1 -1
- package/build/archives/edit.js.map +1 -1
- package/build/audio/edit.js +4 -16
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/button/edit.native.js +7 -3
- package/build/button/edit.native.js.map +1 -1
- package/build/categories/edit.js +8 -3
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +4 -0
- package/build/categories/index.js.map +1 -1
- package/build/column/index.js +10 -0
- package/build/column/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 +2 -2
- 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/cover/edit.js +4 -71
- package/build/cover/edit.js.map +1 -1
- package/build/cover/edit.native.js +36 -15
- package/build/cover/edit.native.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.js +81 -0
- package/build/cover/use-cover-is-dark.js.map +1 -0
- 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/edit.js +12 -18
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -7
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/util.js +29 -4
- package/build/embed/util.js.map +1 -1
- package/build/file/inspector.js +2 -4
- package/build/file/inspector.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/transforms.js +8 -4
- package/build/heading/transforms.js.map +1 -1
- package/build/html/edit.js +2 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.js +4 -6
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +4 -6
- package/build/index.js.map +1 -1
- package/build/index.native.js +14 -3
- package/build/index.native.js.map +1 -1
- package/build/latest-comments/edit.js +1 -1
- package/build/latest-comments/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/loginout/edit.js +1 -1
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/navigation/edit/index.js +5 -28
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +1 -2
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view-modal.js +62 -0
- package/build/navigation/view-modal.js.map +1 -0
- package/build/navigation/view.js +1 -34
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/paragraph/edit.js +10 -0
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/edit.native.js +6 -2
- package/build/paragraph/edit.native.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-comment/index.js +1 -1
- package/build/post-comments/edit.js +13 -34
- package/build/post-comments/edit.js.map +1 -1
- package/build/post-comments/index.js +1 -1
- package/build/post-comments-form/edit.js +37 -24
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +48 -0
- package/build/post-comments-form/form.js.map +1 -0
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-terms/edit.js +25 -3
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/index.js +8 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/quote/index.js +7 -0
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +11 -3
- package/build/quote/v2/edit.js.map +1 -1
- package/build/rss/edit.js +1 -1
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +11 -9
- package/build/search/edit.js.map +1 -1
- package/build/separator/index.js +3 -0
- package/build/separator/index.js.map +1 -1
- package/build/spacer/constants.js +9 -0
- package/build/spacer/constants.js.map +1 -0
- package/build/spacer/controls.js +3 -3
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +2 -2
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +5 -6
- package/build/spacer/edit.js.map +1 -1
- package/build/table/edit.js +8 -2
- package/build/table/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/video/edit.js +4 -8
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build-module/archives/edit.js +1 -1
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/edit.js +4 -16
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +1 -1
- package/build-module/audio/edit.native.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/categories/edit.js +8 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +4 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/column/index.js +10 -0
- package/build-module/column/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 +1 -1
- 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/cover/edit.js +4 -71
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/edit.native.js +35 -16
- package/build-module/cover/edit.native.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.js +70 -0
- package/build-module/cover/use-cover-is-dark.js.map +1 -0
- 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/edit.js +13 -19
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +2 -8
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/util.js +25 -3
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/inspector.js +2 -4
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/v1/edit.js +1 -1
- package/build-module/gallery/v1/edit.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/transforms.js +8 -4
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/html/edit.js +2 -2
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.js +4 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +3 -4
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +14 -3
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -1
- package/build-module/latest-comments/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/loginout/edit.js +1 -1
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +6 -28
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +1 -2
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view-modal.js +56 -0
- package/build-module/navigation/view-modal.js.map +1 -0
- package/build-module/navigation/view.js +1 -30
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +1 -1
- package/build-module/navigation-link/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/edit.native.js +6 -2
- package/build-module/paragraph/edit.native.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-comment/index.js +1 -1
- package/build-module/post-comments/edit.js +13 -35
- package/build-module/post-comments/edit.js.map +1 -1
- package/build-module/post-comments/index.js +1 -1
- package/build-module/post-comments-form/edit.js +38 -26
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +39 -0
- package/build-module/post-comments-form/form.js.map +1 -0
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +26 -4
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/index.js +8 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/quote/index.js +2 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +10 -3
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/rss/edit.js +1 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +11 -9
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/index.js +3 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/spacer/constants.js +2 -0
- package/build-module/spacer/constants.js.map +1 -0
- package/build-module/spacer/controls.js +2 -2
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +1 -1
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/edit.js +9 -3
- package/build-module/table/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/video/edit.js +4 -8
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +1 -1
- package/build-module/video/edit.native.js.map +1 -1
- 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/common-rtl.css +32 -0
- package/build-style/common.css +32 -0
- package/build-style/cover/style-rtl.css +0 -4
- package/build-style/cover/style.css +0 -4
- package/build-style/editor-rtl.css +12 -4
- package/build-style/editor.css +12 -4
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/style-rtl.css +73 -4
- package/build-style/style.css +73 -4
- package/build-style/table/editor-rtl.css +8 -0
- package/build-style/table/editor.css +8 -0
- package/build-style/table/style-rtl.css +38 -0
- package/build-style/table/style.css +38 -0
- package/package.json +28 -28
- package/src/archives/edit.js +1 -1
- package/src/audio/edit.js +3 -8
- package/src/audio/edit.native.js +1 -1
- package/src/button/edit.native.js +6 -3
- package/src/categories/block.json +4 -0
- package/src/categories/edit.js +8 -2
- package/src/categories/index.php +1 -0
- package/src/column/block.json +10 -0
- 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 +1 -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/index.php +4 -0
- package/src/common.scss +24 -1
- package/src/cover/edit.js +2 -67
- package/src/cover/edit.native.js +40 -13
- package/src/cover/style.native.scss +4 -0
- package/src/cover/style.scss +0 -4
- package/src/cover/test/__snapshots__/edit.native.js.snap +6 -6
- package/src/cover/test/transforms.js +301 -0
- package/src/cover/transforms.js +112 -7
- package/src/cover/use-cover-is-dark.js +71 -0
- package/src/cover/use-cover-is-dark.native.js +51 -0
- package/src/editor.scss +1 -1
- package/src/embed/edit.js +19 -24
- package/src/embed/edit.native.js +9 -14
- package/src/embed/util.js +34 -2
- package/src/file/inspector.js +1 -3
- package/src/gallery/edit.js +1 -1
- package/src/gallery/v1/edit.js +1 -1
- package/src/group/block.json +1 -0
- package/src/heading/transforms.js +4 -3
- package/src/html/edit.js +2 -2
- package/src/image/edit.js +2 -4
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +1 -1
- package/src/index.js +2 -5
- package/src/index.native.js +12 -2
- package/src/latest-comments/edit.js +1 -1
- package/src/latest-posts/edit.native.js +56 -1
- package/src/loginout/edit.js +1 -1
- package/src/media-text/edit.js +1 -2
- package/src/media-text/edit.native.js +1 -1
- package/src/navigation/block.json +1 -2
- package/src/navigation/edit/index.js +6 -36
- package/src/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/src/navigation/index.php +5 -0
- package/src/navigation/style.scss +3 -0
- package/src/navigation/view-modal.js +68 -0
- package/src/navigation/view.js +0 -35
- package/src/navigation-link/edit.js +1 -1
- package/src/paragraph/edit.js +6 -0
- package/src/paragraph/edit.native.js +13 -1
- package/src/paragraph/use-enter.js +103 -0
- package/src/post-author/edit.js +1 -1
- package/src/post-author/index.php +1 -1
- package/src/post-comment/block.json +1 -1
- package/src/post-comments/block.json +1 -1
- package/src/post-comments/edit.js +13 -43
- package/src/post-comments/index.php +2 -0
- package/src/post-comments-form/edit.js +50 -58
- package/src/post-comments-form/form.js +43 -0
- package/src/post-comments-form/index.php +5 -1
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-terms/block.json +8 -0
- package/src/post-terms/edit.js +28 -1
- package/src/post-terms/index.php +12 -2
- package/src/quote/block.json +1 -0
- package/src/quote/index.js +1 -1
- package/src/quote/v2/edit.js +3 -0
- package/src/rss/edit.js +1 -1
- package/src/search/edit.js +13 -7
- package/src/search/index.php +84 -33
- package/src/separator/block.json +3 -0
- package/src/spacer/constants.js +1 -0
- package/src/spacer/controls.js +2 -2
- package/src/spacer/controls.native.js +1 -1
- package/src/spacer/edit.js +1 -2
- package/src/table/edit.js +11 -2
- package/src/table/editor.scss +13 -0
- package/src/table/style.scss +52 -0
- package/src/tag-cloud/edit.js +1 -1
- package/src/video/edit.js +4 -5
- package/src/video/edit.native.js +1 -1
- 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/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-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/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/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
|
@@ -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,KAAK,GAAG,QAYP;AAAA;;AAAA,MA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AM;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;AACA;;AA+CA;AACA;AACA;;AAYA;A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M;AAAEnJ,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\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,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -9,6 +11,8 @@ var _blocks = require("@wordpress/blocks");
|
|
|
9
11
|
|
|
10
12
|
var _shared = require("./shared");
|
|
11
13
|
|
|
14
|
+
var _cleanEmptyObject = _interopRequireDefault(require("../utils/clean-empty-object"));
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
17
|
* WordPress dependencies
|
|
14
18
|
*/
|
|
@@ -78,7 +82,7 @@ const transforms = {
|
|
|
78
82
|
type: 'block',
|
|
79
83
|
blocks: ['core/group'],
|
|
80
84
|
transform: (attributes, innerBlocks) => {
|
|
81
|
-
var _style$color2, _style$color3, _style$color4, _style$color5
|
|
85
|
+
var _innerBlocks$, _style$color2, _style$color3, _style$color4, _style$color5;
|
|
82
86
|
|
|
83
87
|
const {
|
|
84
88
|
align,
|
|
@@ -86,10 +90,16 @@ const transforms = {
|
|
|
86
90
|
backgroundColor,
|
|
87
91
|
gradient,
|
|
88
92
|
style
|
|
89
|
-
} = attributes; // If
|
|
93
|
+
} = attributes; // If the Group block being transformed has a Cover block as its
|
|
94
|
+
// only child return that Cover block.
|
|
95
|
+
|
|
96
|
+
if ((innerBlocks === null || innerBlocks === void 0 ? void 0 : innerBlocks.length) === 1 && ((_innerBlocks$ = innerBlocks[0]) === null || _innerBlocks$ === void 0 ? void 0 : _innerBlocks$.name) === 'core/cover') {
|
|
97
|
+
return (0, _blocks.createBlock)('core/cover', innerBlocks[0].attributes, innerBlocks[0].innerBlocks);
|
|
98
|
+
} // If no background or gradient color is provided, default to 50% opacity.
|
|
90
99
|
// This matches the styling of a Cover block with a background image,
|
|
91
100
|
// in the state where a background image has been removed.
|
|
92
101
|
|
|
102
|
+
|
|
93
103
|
const dimRatio = backgroundColor || gradient || style !== null && style !== void 0 && (_style$color2 = style.color) !== null && _style$color2 !== void 0 && _style$color2.background || style !== null && style !== void 0 && (_style$color3 = style.color) !== null && _style$color3 !== void 0 && _style$color3.gradient ? undefined : 50; // Move the background or gradient color to the parent Cover block.
|
|
94
104
|
|
|
95
105
|
const parentAttributes = {
|
|
@@ -104,12 +114,12 @@ const transforms = {
|
|
|
104
114
|
const attributesWithoutBackgroundColors = { ...attributes,
|
|
105
115
|
backgroundColor: undefined,
|
|
106
116
|
gradient: undefined,
|
|
107
|
-
style: { ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
|
|
108
|
-
color:
|
|
117
|
+
style: (0, _cleanEmptyObject.default)({ ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
|
|
118
|
+
color: style !== null && style !== void 0 && style.color ? { ...(style === null || style === void 0 ? void 0 : style.color),
|
|
109
119
|
background: undefined,
|
|
110
120
|
gradient: undefined
|
|
111
|
-
}
|
|
112
|
-
}
|
|
121
|
+
} : undefined
|
|
122
|
+
})
|
|
113
123
|
}; // Preserve the block by nesting it within the Cover block,
|
|
114
124
|
// instead of converting the Group block directly to the Cover block.
|
|
115
125
|
|
|
@@ -200,6 +210,67 @@ const transforms = {
|
|
|
200
210
|
anchor
|
|
201
211
|
});
|
|
202
212
|
}
|
|
213
|
+
}, {
|
|
214
|
+
type: 'block',
|
|
215
|
+
blocks: ['core/group'],
|
|
216
|
+
isMatch: _ref7 => {
|
|
217
|
+
let {
|
|
218
|
+
url
|
|
219
|
+
} = _ref7;
|
|
220
|
+
|
|
221
|
+
// If the Cover block uses background media, skip this transform,
|
|
222
|
+
// and instead use the Group block's default transform.
|
|
223
|
+
if (url) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return true;
|
|
228
|
+
},
|
|
229
|
+
transform: (attributes, innerBlocks) => {
|
|
230
|
+
var _attributes$style, _attributes$style2, _innerBlocks$2;
|
|
231
|
+
|
|
232
|
+
// Convert Cover overlay colors to comparable Group background colors.
|
|
233
|
+
const transformedColorAttributes = {
|
|
234
|
+
backgroundColor: attributes === null || attributes === void 0 ? void 0 : attributes.overlayColor,
|
|
235
|
+
gradient: attributes === null || attributes === void 0 ? void 0 : attributes.gradient,
|
|
236
|
+
style: (0, _cleanEmptyObject.default)({ ...(attributes === null || attributes === void 0 ? void 0 : attributes.style),
|
|
237
|
+
color: attributes !== null && attributes !== void 0 && attributes.customOverlayColor || attributes !== null && attributes !== void 0 && attributes.customGradient || attributes !== null && attributes !== void 0 && (_attributes$style = attributes.style) !== null && _attributes$style !== void 0 && _attributes$style.color ? {
|
|
238
|
+
background: attributes === null || attributes === void 0 ? void 0 : attributes.customOverlayColor,
|
|
239
|
+
gradient: attributes === null || attributes === void 0 ? void 0 : attributes.customGradient,
|
|
240
|
+
...(attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : _attributes$style2.color)
|
|
241
|
+
} : undefined
|
|
242
|
+
})
|
|
243
|
+
}; // If the Cover block contains only a single Group block as a direct child,
|
|
244
|
+
// then attempt to merge the Cover's background colors with the child Group block,
|
|
245
|
+
// and remove the Cover block as the wrapper.
|
|
246
|
+
|
|
247
|
+
if ((innerBlocks === null || innerBlocks === void 0 ? void 0 : innerBlocks.length) === 1 && ((_innerBlocks$2 = innerBlocks[0]) === null || _innerBlocks$2 === void 0 ? void 0 : _innerBlocks$2.name) === 'core/group') {
|
|
248
|
+
var _groupAttributes$styl, _groupAttributes$styl2, _groupAttributes$styl3, _groupAttributes$styl4, _transformedColorAttr, _groupAttributes$styl5, _transformedColorAttr2, _groupAttributes$styl6, _innerBlocks$4;
|
|
249
|
+
|
|
250
|
+
const groupAttributes = (0, _cleanEmptyObject.default)(innerBlocks[0].attributes || {}); // If the Group block contains any kind of background color or gradient,
|
|
251
|
+
// skip merging Cover background colors, and preserve the Group block's colors.
|
|
252
|
+
|
|
253
|
+
if (groupAttributes !== null && groupAttributes !== void 0 && groupAttributes.backgroundColor || groupAttributes !== null && groupAttributes !== void 0 && groupAttributes.gradient || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl = groupAttributes.style) !== null && _groupAttributes$styl !== void 0 && (_groupAttributes$styl2 = _groupAttributes$styl.color) !== null && _groupAttributes$styl2 !== void 0 && _groupAttributes$styl2.background || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl3 = groupAttributes.style) !== null && _groupAttributes$styl3 !== void 0 && (_groupAttributes$styl4 = _groupAttributes$styl3.color) !== null && _groupAttributes$styl4 !== void 0 && _groupAttributes$styl4.gradient) {
|
|
254
|
+
var _innerBlocks$3;
|
|
255
|
+
|
|
256
|
+
return (0, _blocks.createBlock)('core/group', groupAttributes, (_innerBlocks$3 = innerBlocks[0]) === null || _innerBlocks$3 === void 0 ? void 0 : _innerBlocks$3.innerBlocks);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return (0, _blocks.createBlock)('core/group', { ...transformedColorAttributes,
|
|
260
|
+
...groupAttributes,
|
|
261
|
+
style: (0, _cleanEmptyObject.default)({ ...(groupAttributes === null || groupAttributes === void 0 ? void 0 : groupAttributes.style),
|
|
262
|
+
color: transformedColorAttributes !== null && transformedColorAttributes !== void 0 && (_transformedColorAttr = transformedColorAttributes.style) !== null && _transformedColorAttr !== void 0 && _transformedColorAttr.color || groupAttributes !== null && groupAttributes !== void 0 && (_groupAttributes$styl5 = groupAttributes.style) !== null && _groupAttributes$styl5 !== void 0 && _groupAttributes$styl5.color ? { ...(transformedColorAttributes === null || transformedColorAttributes === void 0 ? void 0 : (_transformedColorAttr2 = transformedColorAttributes.style) === null || _transformedColorAttr2 === void 0 ? void 0 : _transformedColorAttr2.color),
|
|
263
|
+
...(groupAttributes === null || groupAttributes === void 0 ? void 0 : (_groupAttributes$styl6 = groupAttributes.style) === null || _groupAttributes$styl6 === void 0 ? void 0 : _groupAttributes$styl6.color)
|
|
264
|
+
} : undefined
|
|
265
|
+
})
|
|
266
|
+
}, (_innerBlocks$4 = innerBlocks[0]) === null || _innerBlocks$4 === void 0 ? void 0 : _innerBlocks$4.innerBlocks);
|
|
267
|
+
} // In all other cases, transform the Cover block directly to a Group block.
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
return (0, _blocks.createBlock)('core/group', { ...attributes,
|
|
271
|
+
...transformedColorAttributes
|
|
272
|
+
}, innerBlocks);
|
|
273
|
+
}
|
|
203
274
|
}]
|
|
204
275
|
};
|
|
205
276
|
var _default = transforms;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/cover/transforms.js"],"names":["transforms","from","type","blocks","transform","caption","url","alt","align","id","anchor","style","dimRatio","color","duotone","content","fontSize","src","backgroundType","VIDEO_BACKGROUND_TYPE","attributes","innerBlocks","backgroundColor","gradient","background","undefined","parentAttributes","overlayColor","customOverlayColor","customGradient","attributesWithoutBackgroundColors","to","isMatch","IMAGE_BACKGROUND_TYPE","title"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAAAA,SAAS,EAAE;AAAA;;AAAA,UAAE;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,GAAX;AAAgBC,QAAAA,GAAhB;AAAqBC,QAAAA,KAArB;AAA4BC,QAAAA,EAA5B;AAAgCC,QAAAA,MAAhC;AAAwCC,QAAAA;AAAxC,OAAF;AAAA,aACV,yBACC,YADD,EAEC;AACCC,QAAAA,QAAQ,EAAE,EADX;AAECN,QAAAA,GAFD;AAGCC,QAAAA,GAHD;AAICC,QAAAA,KAJD;AAKCC,QAAAA,EALD;AAMCC,QAAAA,MAND;AAOCC,QAAAA,KAAK,EAAE;AACNE,UAAAA,KAAK,EAAE;AACNC,YAAAA,OAAO,EAAEH,KAAF,aAAEA,KAAF,uCAAEA,KAAK,CAAEE,KAAT,iDAAE,aAAcC;AADjB;AADD;AAPR,OAFD,EAeC,CACC,yBAAa,gBAAb,EAA+B;AAC9BC,QAAAA,OAAO,EAAEV,OADqB;AAE9BW,QAAAA,QAAQ,EAAE,OAFoB;AAG9BR,QAAAA,KAAK,EAAE;AAHuB,OAA/B,CADD,CAfD,CADU;AAAA;AAHZ,GADK,EA6BL;AACCN,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAAAA,SAAS,EAAE;AAAA,UAAE;AAAEC,QAAAA,OAAF;AAAWY,QAAAA,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QAAAA;AAL0B,OAA3B,CADU;AAAA;AAvBZ,GAvCG;AAjHc,CAAnB;eA2LeV,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { caption, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\talt,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( { caption, src, align, id, anchor } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl: src,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tbackgroundType: VIDEO_BACKGROUND_TYPE,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\tconst {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\tgradient,\n\t\t\t\t\tstyle,\n\t\t\t\t} = attributes;\n\n\t\t\t\t// If no background or gradient color is provided, default to 50% opacity.\n\t\t\t\t// This matches the styling of a Cover block with a background image,\n\t\t\t\t// in the state where a background image has been removed.\n\t\t\t\tconst dimRatio =\n\t\t\t\t\tbackgroundColor ||\n\t\t\t\t\tgradient ||\n\t\t\t\t\tstyle?.color?.background ||\n\t\t\t\t\tstyle?.color?.gradient\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: 50;\n\n\t\t\t\t// Move the background or gradient color to the parent Cover block.\n\t\t\t\tconst parentAttributes = {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tdimRatio,\n\t\t\t\t\toverlayColor: backgroundColor,\n\t\t\t\t\tcustomOverlayColor: style?.color?.background,\n\t\t\t\t\tgradient,\n\t\t\t\t\tcustomGradient: style?.color?.gradient,\n\t\t\t\t};\n\n\t\t\t\tconst attributesWithoutBackgroundColors = {\n\t\t\t\t\t...attributes,\n\t\t\t\t\tbackgroundColor: undefined,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...attributes?.style?.color,\n\t\t\t\t\t\t\tbackground: undefined,\n\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\t// Preserve the block by nesting it within the Cover block,\n\t\t\t\t// instead of converting the Group block directly to the Cover block.\n\t\t\t\treturn createBlock( 'core/cover', parentAttributes, [\n\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\tattributesWithoutBackgroundColors,\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t),\n\t\t\t\t] );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents an image background.\n\t\t\t\t\treturn backgroundType === IMAGE_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\turl,\n\t\t\t\t\talt,\n\t\t\t\t\talign,\n\t\t\t\t\tid,\n\t\t\t\t\tanchor,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents a video background.\n\t\t\t\t\treturn backgroundType === VIDEO_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, align, id, anchor } ) =>\n\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\tsrc: url,\n\t\t\t\t\tid,\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t} ),\n\t\t},\n\t],\n};\n\nexport default transforms;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/transforms.js"],"names":["transforms","from","type","blocks","transform","caption","url","alt","align","id","anchor","style","dimRatio","color","duotone","content","fontSize","src","backgroundType","VIDEO_BACKGROUND_TYPE","attributes","innerBlocks","backgroundColor","gradient","length","name","background","undefined","parentAttributes","overlayColor","customOverlayColor","customGradient","attributesWithoutBackgroundColors","to","isMatch","IMAGE_BACKGROUND_TYPE","title","transformedColorAttributes","groupAttributes"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,UAAU,GAAG;AAClBC,EAAAA,IAAI,EAAE,CACL;AACCC,IAAAA,IAAI,EAAE,OADP;AAECC,IAAAA,MAAM,EAAE,CAAE,YAAF,CAFT;AAGCC,IAAAA,SAAS,EAAE;AAAA;;AAAA,UAAE;AAAEC,QAAAA,OAAF;AAAWC,QAAAA,GAAX;AAAgBC,QAAAA,GAAhB;AAAqBC,QAAAA,KAArB;AAA4BC,QAAAA,EAA5B;AAAgCC,QAAAA,MAAhC;AAAwCC,QAAAA;A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AApB,OAFM,EAGNhB,WAHM,CAAP;AAKA;AAvFF,GAvEG;AAhIc,CAAnB;eAmSerB,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { IMAGE_BACKGROUND_TYPE, VIDEO_BACKGROUND_TYPE } from './shared';\nimport cleanEmptyObject from '../utils/clean-empty-object';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\ttransform: ( { caption, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\talt,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\ttransform: ( { caption, src, align, id, anchor } ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/cover',\n\t\t\t\t\t{\n\t\t\t\t\t\tdimRatio: 50,\n\t\t\t\t\t\turl: src,\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tbackgroundType: VIDEO_BACKGROUND_TYPE,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: caption,\n\t\t\t\t\t\t\tfontSize: 'large',\n\t\t\t\t\t\t\talign: 'center',\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\tconst {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tbackgroundColor,\n\t\t\t\t\tgradient,\n\t\t\t\t\tstyle,\n\t\t\t\t} = attributes;\n\n\t\t\t\t// If the Group block being transformed has a Cover block as its\n\t\t\t\t// only child return that Cover block.\n\t\t\t\tif (\n\t\t\t\t\tinnerBlocks?.length === 1 &&\n\t\t\t\t\tinnerBlocks[ 0 ]?.name === 'core/cover'\n\t\t\t\t) {\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/cover',\n\t\t\t\t\t\tinnerBlocks[ 0 ].attributes,\n\t\t\t\t\t\tinnerBlocks[ 0 ].innerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// If no background or gradient color is provided, default to 50% opacity.\n\t\t\t\t// This matches the styling of a Cover block with a background image,\n\t\t\t\t// in the state where a background image has been removed.\n\t\t\t\tconst dimRatio =\n\t\t\t\t\tbackgroundColor ||\n\t\t\t\t\tgradient ||\n\t\t\t\t\tstyle?.color?.background ||\n\t\t\t\t\tstyle?.color?.gradient\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: 50;\n\n\t\t\t\t// Move the background or gradient color to the parent Cover block.\n\t\t\t\tconst parentAttributes = {\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t\tdimRatio,\n\t\t\t\t\toverlayColor: backgroundColor,\n\t\t\t\t\tcustomOverlayColor: style?.color?.background,\n\t\t\t\t\tgradient,\n\t\t\t\t\tcustomGradient: style?.color?.gradient,\n\t\t\t\t};\n\n\t\t\t\tconst attributesWithoutBackgroundColors = {\n\t\t\t\t\t...attributes,\n\t\t\t\t\tbackgroundColor: undefined,\n\t\t\t\t\tgradient: undefined,\n\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor: style?.color\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\t\t\tbackground: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\n\t\t\t\t// Preserve the block by nesting it within the Cover block,\n\t\t\t\t// instead of converting the Group block directly to the Cover block.\n\t\t\t\treturn createBlock( 'core/cover', parentAttributes, [\n\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\tattributesWithoutBackgroundColors,\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t),\n\t\t\t\t] );\n\t\t\t},\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/image' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents an image background.\n\t\t\t\t\treturn backgroundType === IMAGE_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, alt, align, id, anchor, style } ) =>\n\t\t\t\tcreateBlock( 'core/image', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\turl,\n\t\t\t\t\talt,\n\t\t\t\t\talign,\n\t\t\t\t\tid,\n\t\t\t\t\tanchor,\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\tduotone: style?.color?.duotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/video' ],\n\t\t\tisMatch: ( {\n\t\t\t\tbackgroundType,\n\t\t\t\turl,\n\t\t\t\toverlayColor,\n\t\t\t\tcustomOverlayColor,\n\t\t\t\tgradient,\n\t\t\t\tcustomGradient,\n\t\t\t} ) => {\n\t\t\t\tif ( url ) {\n\t\t\t\t\t// If a url exists the transform could happen if that URL represents a video background.\n\t\t\t\t\treturn backgroundType === VIDEO_BACKGROUND_TYPE;\n\t\t\t\t}\n\t\t\t\t// If a url is not set the transform could happen if the cover has no background color or gradient;\n\t\t\t\treturn (\n\t\t\t\t\t! overlayColor &&\n\t\t\t\t\t! customOverlayColor &&\n\t\t\t\t\t! gradient &&\n\t\t\t\t\t! customGradient\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: ( { title, url, align, id, anchor } ) =>\n\t\t\t\tcreateBlock( 'core/video', {\n\t\t\t\t\tcaption: title,\n\t\t\t\t\tsrc: url,\n\t\t\t\t\tid,\n\t\t\t\t\talign,\n\t\t\t\t\tanchor,\n\t\t\t\t} ),\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\tisMatch: ( { url } ) => {\n\t\t\t\t// If the Cover block uses background media, skip this transform,\n\t\t\t\t// and instead use the Group block's default transform.\n\t\t\t\tif ( url ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\ttransform: ( attributes, innerBlocks ) => {\n\t\t\t\t// Convert Cover overlay colors to comparable Group background colors.\n\t\t\t\tconst transformedColorAttributes = {\n\t\t\t\t\tbackgroundColor: attributes?.overlayColor,\n\t\t\t\t\tgradient: attributes?.gradient,\n\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tattributes?.customOverlayColor ||\n\t\t\t\t\t\t\tattributes?.customGradient ||\n\t\t\t\t\t\t\tattributes?.style?.color\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tbackground:\n\t\t\t\t\t\t\t\t\t\t\tattributes?.customOverlayColor,\n\t\t\t\t\t\t\t\t\t\tgradient: attributes?.customGradient,\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.color,\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t} ),\n\t\t\t\t};\n\n\t\t\t\t// If the Cover block contains only a single Group block as a direct child,\n\t\t\t\t// then attempt to merge the Cover's background colors with the child Group block,\n\t\t\t\t// and remove the Cover block as the wrapper.\n\t\t\t\tif (\n\t\t\t\t\tinnerBlocks?.length === 1 &&\n\t\t\t\t\tinnerBlocks[ 0 ]?.name === 'core/group'\n\t\t\t\t) {\n\t\t\t\t\tconst groupAttributes = cleanEmptyObject(\n\t\t\t\t\t\tinnerBlocks[ 0 ].attributes || {}\n\t\t\t\t\t);\n\n\t\t\t\t\t// If the Group block contains any kind of background color or gradient,\n\t\t\t\t\t// skip merging Cover background colors, and preserve the Group block's colors.\n\t\t\t\t\tif (\n\t\t\t\t\t\tgroupAttributes?.backgroundColor ||\n\t\t\t\t\t\tgroupAttributes?.gradient ||\n\t\t\t\t\t\tgroupAttributes?.style?.color?.background ||\n\t\t\t\t\t\tgroupAttributes?.style?.color?.gradient\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\tgroupAttributes,\n\t\t\t\t\t\t\tinnerBlocks[ 0 ]?.innerBlocks\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...transformedColorAttributes,\n\t\t\t\t\t\t\t...groupAttributes,\n\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t...groupAttributes?.style,\n\t\t\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\t\t\ttransformedColorAttributes?.style?.color ||\n\t\t\t\t\t\t\t\t\tgroupAttributes?.style?.color\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t...transformedColorAttributes\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.style?.color,\n\t\t\t\t\t\t\t\t\t\t\t\t...groupAttributes?.style\n\t\t\t\t\t\t\t\t\t\t\t\t\t?.color,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinnerBlocks[ 0 ]?.innerBlocks\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// In all other cases, transform the Cover block directly to a Group block.\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ ...attributes, ...transformedColorAttributes },\n\t\t\t\t\tinnerBlocks\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\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/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"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useCoverIsDark;
|
|
7
|
+
|
|
8
|
+
var _colord = require("colord");
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* External dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* WordPress dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* useCoverIsDark is a hook that returns a boolean variable specifying if the cover
|
|
22
|
+
* background is dark or not.
|
|
23
|
+
*
|
|
24
|
+
* @param {?boolean} initialValue Initial value.
|
|
25
|
+
* @param {?string} url Url of the media background.
|
|
26
|
+
* @param {?number} dimRatio Transparency of the overlay color. If an image and
|
|
27
|
+
* color are set, dimRatio is used to decide what is used
|
|
28
|
+
* for background darkness checking purposes.
|
|
29
|
+
* @param {?string} overlayColor String containing the overlay color value if one exists.
|
|
30
|
+
*
|
|
31
|
+
* @return {boolean} True if the cover background is considered "dark" and false otherwise.
|
|
32
|
+
*/
|
|
33
|
+
function useCoverIsDark() {
|
|
34
|
+
let initialValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
35
|
+
let url = arguments.length > 1 ? arguments[1] : undefined;
|
|
36
|
+
let dimRatio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
|
|
37
|
+
let overlayColor = arguments.length > 3 ? arguments[3] : undefined;
|
|
38
|
+
const [isDark, setIsDark] = (0, _element.useState)(initialValue);
|
|
39
|
+
(0, _element.useEffect)(() => {
|
|
40
|
+
// If opacity is greater than 50 the dominant color is the overlay color,
|
|
41
|
+
// so use that color for the dark mode computation.
|
|
42
|
+
if (dimRatio > 50 || !url) {
|
|
43
|
+
if (!overlayColor) {
|
|
44
|
+
// If no overlay color exists the overlay color is black (isDark )
|
|
45
|
+
setIsDark(true);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setIsDark((0, _colord.colord)(overlayColor).isDark());
|
|
50
|
+
}
|
|
51
|
+
}, [overlayColor, dimRatio > 50 || !url, setIsDark]);
|
|
52
|
+
(0, _element.useEffect)(() => {
|
|
53
|
+
if (!url && !overlayColor) {
|
|
54
|
+
// Reset isDark.
|
|
55
|
+
setIsDark(false);
|
|
56
|
+
}
|
|
57
|
+
}, [!url && !overlayColor, setIsDark]);
|
|
58
|
+
return isDark;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=use-cover-is-dark.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/cover/use-cover-is-dark.native.js"],"names":["useCoverIsDark","initialValue","url","dimRatio","overlayColor","isDark","setIsDark"],"mappings":";;;;;;;AAIA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,GAKb;AAAA,MAJDC,YAIC,uEAJc,KAId;AAAA,MAHDC,GAGC;AAAA,MAFDC,QAEC,uEAFU,EAEV;AAAA,MADDC,YACC;AACD,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAUL,YAAV,CAA9B;AACA,0BAAW,MAAM;AAChB;AACA;AACA,QAAKE,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAxB,EAA8B;AAC7B,UAAK,CAAEE,YAAP,EAAsB;AACrB;AACAE,QAAAA,SAAS,CAAE,IAAF,CAAT;AACA;AACA;;AACDA,MAAAA,SAAS,CAAE,oBAAQF,YAAR,EAAuBC,MAAvB,EAAF,CAAT;AACA;AACD,GAXD,EAWG,CAAED,YAAF,EAAgBD,QAAQ,GAAG,EAAX,IAAiB,CAAED,GAAnC,EAAwCI,SAAxC,CAXH;AAYA,0BAAW,MAAM;AAChB,QAAK,CAAEJ,GAAF,IAAS,CAAEE,YAAhB,EAA+B;AAC9B;AACAE,MAAAA,SAAS,CAAE,KAAF,CAAT;AACA;AACD,GALD,EAKG,CAAE,CAAEJ,GAAF,IAAS,CAAEE,YAAb,EAA2BE,SAA3B,CALH;AAMA,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\n\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\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 {?boolean} initialValue Initial value.\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 *\n * @return {boolean} True if the cover background is considered \"dark\" and false otherwise.\n */\nexport default function useCoverIsDark(\n\tinitialValue = false,\n\turl,\n\tdimRatio = 50,\n\toverlayColor\n) {\n\tconst [ isDark, setIsDark ] = useState( initialValue );\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"]}
|
package/build/embed/edit.js
CHANGED
|
@@ -111,17 +111,15 @@ const EmbedEdit = props => {
|
|
|
111
111
|
};
|
|
112
112
|
}, [attributesUrl]);
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Returns the attributes derived from the preview, merged with the current attributes.
|
|
115
|
+
*
|
|
116
|
+
* @param {boolean} ignorePreviousClassName Determines if the previous className attribute should be ignored when merging.
|
|
117
|
+
* @return {Object} Merged attributes.
|
|
115
118
|
*/
|
|
116
119
|
|
|
117
|
-
const getMergedAttributes = ()
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
className
|
|
121
|
-
} = attributes;
|
|
122
|
-
return { ...attributes,
|
|
123
|
-
...(0, _util.getAttributesFromPreview)(preview, title, className, responsive, allowResponsive)
|
|
124
|
-
};
|
|
120
|
+
const getMergedAttributes = function () {
|
|
121
|
+
let ignorePreviousClassName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
122
|
+
return (0, _util.getMergedAttributesWithPreview)(attributes, preview, title, responsive, ignorePreviousClassName);
|
|
125
123
|
};
|
|
126
124
|
|
|
127
125
|
const toggleResponsive = () => {
|
|
@@ -156,15 +154,11 @@ const EmbedEdit = props => {
|
|
|
156
154
|
|
|
157
155
|
(0, _element.useEffect)(() => {
|
|
158
156
|
if (preview && !isEditingURL) {
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
// the
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
// clipping or scrollbars. The `getAttributesFromPreview` function
|
|
165
|
-
// that `getMergedAttributes` uses is memoized so that we're not
|
|
166
|
-
// calculating them on every render.
|
|
167
|
-
setAttributes(getMergedAttributes());
|
|
157
|
+
// When obtaining an incoming preview, we set the attributes derived from
|
|
158
|
+
// the preview data. In this case when getting the merged attributes,
|
|
159
|
+
// we ignore the previous classname because it might not match the expected
|
|
160
|
+
// classes by the new preview.
|
|
161
|
+
setAttributes(getMergedAttributes(true));
|
|
168
162
|
|
|
169
163
|
if (onReplace) {
|
|
170
164
|
const upgradedBlock = (0, _util.createUpgradedEmbedBlock)(props, getMergedAttributes());
|