@wordpress/block-library 11.0.2-next.v.202609171837.0 → 11.2.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 +44 -1
- package/build/accordion/block.json +4 -1
- package/build/accordion-heading/block.json +1 -0
- package/build/accordion-item/block.json +7 -1
- package/build/accordion-panel/block.json +9 -1
- package/build/archives/block.json +12 -0
- package/build/audio/block.json +8 -0
- package/build/audio/edit.cjs +2 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/avatar/block.json +4 -0
- package/build/avatar/edit.cjs +31 -1
- package/build/avatar/edit.cjs.map +3 -3
- package/build/breadcrumbs/block.json +3 -0
- package/build/breadcrumbs/edit.cjs.map +3 -3
- package/build/button/block.json +6 -0
- package/build/button/edit.cjs +9 -6
- package/build/button/edit.cjs.map +2 -2
- package/build/buttons/block.json +15 -1
- package/build/categories/block.json +12 -1
- package/build/code/block.json +13 -0
- package/build/column/block.json +9 -0
- package/build/column/edit.cjs +5 -0
- package/build/column/edit.cjs.map +2 -2
- package/build/columns/block.json +13 -0
- package/build/columns/edit.cjs +21 -112
- package/build/columns/edit.cjs.map +3 -3
- package/build/comment-author-name/block.json +3 -0
- package/build/comment-content/block.json +5 -0
- package/build/comment-date/block.json +3 -0
- package/build/comment-edit-link/block.json +3 -0
- package/build/comment-reply-link/block.json +3 -0
- package/build/comments/block.json +10 -0
- package/build/comments/edit/placeholder.cjs +95 -87
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/comments-pagination/block.json +14 -0
- package/build/comments-pagination-next/block.json +3 -0
- package/build/comments-pagination-numbers/block.json +3 -0
- package/build/comments-pagination-previous/block.json +6 -0
- package/build/comments-title/block.json +3 -0
- package/build/cover/block.json +2 -1
- package/build/cover/edit/index.cjs +30 -6
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +56 -14
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/cover/embed-video-utils.cjs +9 -8
- package/build/cover/embed-video-utils.cjs.map +2 -2
- package/build/cover/view.cjs +21 -0
- package/build/cover/view.cjs.map +7 -0
- package/build/details/block.json +14 -0
- package/build/embed/block.json +6 -1
- package/build/file/block.json +14 -0
- package/build/footnotes/block.json +13 -0
- package/build/gallery/block.json +22 -0
- package/build/gallery/dynamic-gallery.cjs +32 -93
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +104 -42
- package/build/gallery/edit.cjs.map +2 -2
- package/build/gallery/order-controls.cjs +107 -0
- package/build/gallery/order-controls.cjs.map +7 -0
- package/build/gallery/order-images.cjs +92 -0
- package/build/gallery/order-images.cjs.map +7 -0
- package/build/gallery/order-options.cjs +62 -0
- package/build/gallery/order-options.cjs.map +7 -0
- package/build/gallery/use-dynamic-gallery.cjs +1 -7
- package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
- package/build/gallery/use-get-media.cjs +2 -3
- package/build/gallery/use-get-media.cjs.map +2 -2
- package/build/group/block.json +1 -0
- package/build/group/edit.cjs +3 -3
- package/build/group/edit.cjs.map +2 -2
- package/build/heading/block.json +14 -0
- package/build/home-link/block.json +30 -0
- package/build/home-link/edit.cjs.map +3 -3
- package/build/icon/components/custom-inserter/index.cjs +3 -1
- package/build/icon/components/custom-inserter/index.cjs.map +2 -2
- package/build/icon/edit.cjs +49 -5
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/image.cjs +10 -8
- package/build/image/image.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +32 -8
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/image/view.cjs +44 -50
- package/build/image/view.cjs.map +2 -2
- package/build/latest-comments/block.json +20 -0
- package/build/latest-posts/block.json +14 -0
- package/build/list/block.json +12 -1
- package/build/list-item/block.json +8 -1
- package/build/list-item/index.cjs +4 -0
- package/build/list-item/index.cjs.map +3 -3
- package/build/loginout/block.json +14 -0
- package/build/math/block.json +14 -0
- package/build/media-text/block.json +19 -0
- package/build/navigation/edit/index.cjs +1 -4
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation-link/link-ui/index.cjs +33 -19
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/navigation-link/link-ui/page-creator.cjs.map +3 -3
- package/build/navigation-link/shared/controls.cjs.map +3 -3
- package/build/navigation-link/shared/index.cjs +5 -0
- package/build/navigation-link/shared/index.cjs.map +2 -2
- package/build/navigation-link/shared/use-block-suggestions.cjs +141 -0
- package/build/navigation-link/shared/use-block-suggestions.cjs.map +7 -0
- package/build/navigation-link/shared/use-link-preview.cjs +13 -13
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/navigation-overlay-close/block.json +7 -0
- package/build/navigation-submenu/block.json +6 -0
- package/build/navigation-submenu/edit.cjs +9 -1
- package/build/navigation-submenu/edit.cjs.map +3 -3
- package/build/page-list/block.json +14 -0
- package/build/paragraph/block.json +1 -0
- package/build/paragraph/edit.cjs +1 -2
- package/build/paragraph/edit.cjs.map +2 -2
- package/build/playlist/block.json +1 -0
- package/build/post-author-biography/block.json +5 -0
- package/build/post-author-name/block.json +5 -0
- package/build/post-comments-count/block.json +3 -0
- package/build/post-comments-form/block.json +15 -0
- package/build/post-content/block.json +4 -1
- package/build/post-date/block.json +3 -0
- package/build/post-excerpt/block.json +9 -0
- package/build/post-featured-image/block.json +1 -0
- package/build/post-featured-image/edit.cjs +12 -10
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-navigation-link/block.json +30 -0
- package/build/post-navigation-link/edit.cjs +13 -2
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-template/block.json +13 -1
- package/build/post-terms/block.json +10 -0
- package/build/post-time-to-read/block.json +10 -0
- package/build/post-title/block.json +14 -0
- package/build/preformatted/block.json +11 -0
- package/build/pullquote/block.json +3 -1
- package/build/query-no-results/block.json +14 -2
- package/build/query-pagination/block.json +20 -0
- package/build/query-pagination-next/block.json +3 -0
- package/build/query-pagination-numbers/block.json +3 -0
- package/build/query-pagination-previous/block.json +3 -0
- package/build/query-title/block.json +3 -0
- package/build/query-total/block.json +10 -0
- package/build/quote/block.json +3 -0
- package/build/read-more/block.json +11 -0
- package/build/rss/block.json +10 -0
- package/build/search/block.json +2 -1
- package/build/site-tagline/block.json +12 -1
- package/build/site-title/block.json +11 -1
- package/build/social-links/block.json +4 -0
- package/build/social-links/edit.cjs +2 -3
- package/build/social-links/edit.cjs.map +2 -2
- package/build/tab-list/block.json +4 -0
- package/build/tab-list/edit.cjs +3 -1
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/save.cjs +3 -1
- package/build/tab-list/save.cjs.map +3 -3
- package/build/tab-panel/block.json +25 -0
- package/build/tab-panel/controls.cjs.map +3 -3
- package/build/tab-panels/block.json +21 -1
- package/build/table-of-contents/block.json +7 -0
- package/build/tabs/block.json +27 -1
- package/build/tag-cloud/block.json +19 -0
- package/build/template-part/edit/selection-modal.cjs.map +1 -1
- package/build/term-count/block.json +12 -0
- package/build/term-description/block.json +13 -0
- package/build/term-name/block.json +16 -1
- package/build/term-template/block.json +14 -1
- package/build/utils/search-patterns.cjs +7 -43
- package/build/utils/search-patterns.cjs.map +3 -3
- package/build/utils/style-state.cjs +4 -6
- package/build/utils/style-state.cjs.map +2 -2
- package/build/utils/waveform-utils.cjs +2 -2
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/verse/block.json +4 -0
- package/build/video/block.json +12 -0
- package/build/video/edit.cjs +30 -14
- package/build/video/edit.cjs.map +3 -3
- package/build/video/index.cjs +0 -2
- package/build/video/index.cjs.map +3 -3
- package/build/video/save.cjs +5 -1
- package/build/video/save.cjs.map +3 -3
- package/build-module/accordion/block.json +4 -1
- package/build-module/accordion-heading/block.json +1 -0
- package/build-module/accordion-item/block.json +7 -1
- package/build-module/accordion-panel/block.json +9 -1
- package/build-module/archives/block.json +12 -0
- package/build-module/audio/block.json +8 -0
- package/build-module/audio/edit.mjs +2 -1
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/avatar/block.json +4 -0
- package/build-module/avatar/edit.mjs +33 -2
- package/build-module/avatar/edit.mjs.map +2 -2
- package/build-module/breadcrumbs/block.json +3 -0
- package/build-module/breadcrumbs/edit.mjs +3 -3
- package/build-module/breadcrumbs/edit.mjs.map +2 -2
- package/build-module/button/block.json +6 -0
- package/build-module/button/edit.mjs +11 -7
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/buttons/block.json +15 -1
- package/build-module/categories/block.json +12 -1
- package/build-module/code/block.json +13 -0
- package/build-module/column/block.json +9 -0
- package/build-module/column/edit.mjs +5 -0
- package/build-module/column/edit.mjs.map +2 -2
- package/build-module/columns/block.json +13 -0
- package/build-module/columns/edit.mjs +22 -122
- package/build-module/columns/edit.mjs.map +2 -2
- package/build-module/comment-author-name/block.json +3 -0
- package/build-module/comment-content/block.json +5 -0
- package/build-module/comment-date/block.json +3 -0
- package/build-module/comment-edit-link/block.json +3 -0
- package/build-module/comment-reply-link/block.json +3 -0
- package/build-module/comments/block.json +10 -0
- package/build-module/comments/edit/placeholder.mjs +95 -87
- package/build-module/comments/edit/placeholder.mjs.map +2 -2
- package/build-module/comments-pagination/block.json +14 -0
- package/build-module/comments-pagination-next/block.json +3 -0
- package/build-module/comments-pagination-numbers/block.json +3 -0
- package/build-module/comments-pagination-previous/block.json +6 -0
- package/build-module/comments-title/block.json +3 -0
- package/build-module/cover/block.json +2 -1
- package/build-module/cover/edit/index.mjs +36 -7
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +62 -16
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/cover/embed-video-utils.mjs +9 -8
- package/build-module/cover/embed-video-utils.mjs.map +2 -2
- package/build-module/cover/view.mjs +19 -0
- package/build-module/cover/view.mjs.map +7 -0
- package/build-module/details/block.json +14 -0
- package/build-module/embed/block.json +6 -1
- package/build-module/file/block.json +14 -0
- package/build-module/footnotes/block.json +13 -0
- package/build-module/gallery/block.json +22 -0
- package/build-module/gallery/dynamic-gallery.mjs +33 -97
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +111 -44
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/order-controls.mjs +87 -0
- package/build-module/gallery/order-controls.mjs.map +7 -0
- package/build-module/gallery/order-images.mjs +66 -0
- package/build-module/gallery/order-images.mjs.map +7 -0
- package/build-module/gallery/order-options.mjs +33 -0
- package/build-module/gallery/order-options.mjs.map +7 -0
- package/build-module/gallery/use-dynamic-gallery.mjs +1 -7
- package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/use-get-media.mjs +2 -3
- package/build-module/gallery/use-get-media.mjs.map +2 -2
- package/build-module/group/block.json +1 -0
- package/build-module/group/edit.mjs +4 -4
- package/build-module/group/edit.mjs.map +2 -2
- package/build-module/heading/block.json +14 -0
- package/build-module/home-link/block.json +30 -0
- package/build-module/home-link/edit.mjs +2 -2
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +3 -1
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +50 -6
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +12 -10
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +32 -8
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/image/view.mjs +44 -50
- package/build-module/image/view.mjs.map +2 -2
- package/build-module/latest-comments/block.json +20 -0
- package/build-module/latest-posts/block.json +14 -0
- package/build-module/list/block.json +12 -1
- package/build-module/list-item/block.json +8 -1
- package/build-module/list-item/index.mjs +4 -0
- package/build-module/list-item/index.mjs.map +2 -2
- package/build-module/loginout/block.json +14 -0
- package/build-module/math/block.json +14 -0
- package/build-module/media-text/block.json +19 -0
- package/build-module/navigation/edit/index.mjs +1 -4
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/index.mjs +39 -20
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs +2 -2
- package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +2 -2
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-link/shared/index.mjs +6 -0
- package/build-module/navigation-link/shared/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-block-suggestions.mjs +120 -0
- package/build-module/navigation-link/shared/use-block-suggestions.mjs.map +7 -0
- package/build-module/navigation-link/shared/use-link-preview.mjs +13 -13
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-overlay-close/block.json +7 -0
- package/build-module/navigation-submenu/block.json +6 -0
- package/build-module/navigation-submenu/edit.mjs +11 -2
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/page-list/block.json +14 -0
- package/build-module/paragraph/block.json +1 -0
- package/build-module/paragraph/edit.mjs +1 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +1 -0
- package/build-module/post-author-biography/block.json +5 -0
- package/build-module/post-author-name/block.json +5 -0
- package/build-module/post-comments-count/block.json +3 -0
- package/build-module/post-comments-form/block.json +15 -0
- package/build-module/post-content/block.json +4 -1
- package/build-module/post-date/block.json +3 -0
- package/build-module/post-excerpt/block.json +9 -0
- package/build-module/post-featured-image/block.json +1 -0
- package/build-module/post-featured-image/edit.mjs +12 -10
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/block.json +30 -0
- package/build-module/post-navigation-link/edit.mjs +17 -3
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-template/block.json +13 -1
- package/build-module/post-terms/block.json +10 -0
- package/build-module/post-time-to-read/block.json +10 -0
- package/build-module/post-title/block.json +14 -0
- package/build-module/preformatted/block.json +11 -0
- package/build-module/pullquote/block.json +3 -1
- package/build-module/query-no-results/block.json +14 -2
- package/build-module/query-pagination/block.json +20 -0
- package/build-module/query-pagination-next/block.json +3 -0
- package/build-module/query-pagination-numbers/block.json +3 -0
- package/build-module/query-pagination-previous/block.json +3 -0
- package/build-module/query-title/block.json +3 -0
- package/build-module/query-total/block.json +10 -0
- package/build-module/quote/block.json +3 -0
- package/build-module/read-more/block.json +11 -0
- package/build-module/rss/block.json +10 -0
- package/build-module/search/block.json +2 -1
- package/build-module/site-tagline/block.json +12 -1
- package/build-module/site-title/block.json +11 -1
- package/build-module/social-links/block.json +4 -0
- package/build-module/social-links/edit.mjs +2 -3
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +4 -0
- package/build-module/tab-list/edit.mjs +4 -1
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/save.mjs +4 -1
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panel/block.json +25 -0
- package/build-module/tab-panel/controls.mjs +2 -2
- package/build-module/tab-panel/controls.mjs.map +2 -2
- package/build-module/tab-panels/block.json +21 -1
- package/build-module/table-of-contents/block.json +7 -0
- package/build-module/tabs/block.json +27 -1
- package/build-module/tag-cloud/block.json +19 -0
- package/build-module/template-part/edit/selection-modal.mjs.map +1 -1
- package/build-module/term-count/block.json +12 -0
- package/build-module/term-description/block.json +13 -0
- package/build-module/term-name/block.json +16 -1
- package/build-module/term-template/block.json +14 -1
- package/build-module/utils/search-patterns.mjs +7 -32
- package/build-module/utils/search-patterns.mjs.map +2 -2
- package/build-module/utils/style-state.mjs +6 -4
- package/build-module/utils/style-state.mjs.map +2 -2
- package/build-module/utils/waveform-utils.mjs +1 -1
- package/build-module/utils/waveform-utils.mjs.map +1 -1
- package/build-module/verse/block.json +4 -0
- package/build-module/video/block.json +12 -0
- package/build-module/video/edit.mjs +32 -15
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/index.mjs +0 -2
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/save.mjs +7 -2
- package/build-module/video/save.mjs.map +2 -2
- package/build-style/avatar/editor-rtl.css +4 -0
- package/build-style/avatar/editor.css +4 -0
- package/build-style/comments-pagination/style-rtl.css +3 -0
- package/build-style/comments-pagination/style.css +3 -0
- package/build-style/common-rtl.css +32 -1
- package/build-style/common.css +35 -2
- package/build-style/editor-rtl.css +23 -6
- package/build-style/editor.css +23 -6
- package/build-style/embed/style-rtl.css +4 -1
- package/build-style/embed/style.css +4 -1
- package/build-style/gallery/editor-rtl.css +1 -3
- package/build-style/gallery/editor.css +1 -3
- package/build-style/image/editor-rtl.css +6 -0
- package/build-style/image/editor.css +6 -0
- package/build-style/image/style-rtl.css +11 -2
- package/build-style/image/style.css +11 -2
- package/build-style/media-text/style-rtl.css +4 -1
- package/build-style/media-text/style.css +4 -1
- package/build-style/navigation/style-rtl.css +18 -3
- package/build-style/navigation/style.css +18 -3
- package/build-style/navigation-link/editor-rtl.css +3 -1
- package/build-style/navigation-link/editor.css +3 -1
- package/build-style/navigation-overlay-close/style-rtl.css +1 -1
- package/build-style/navigation-overlay-close/style.css +1 -1
- package/build-style/navigation-submenu/editor-rtl.css +3 -1
- package/build-style/navigation-submenu/editor.css +3 -1
- package/build-style/post-navigation-link/style-rtl.css +3 -0
- package/build-style/post-navigation-link/style.css +3 -0
- package/build-style/query-pagination/style-rtl.css +3 -0
- package/build-style/query-pagination/style.css +3 -0
- package/build-style/style-rtl.css +94 -13
- package/build-style/style.css +97 -14
- package/build-style/tab-panel/style-rtl.css +2 -0
- package/build-style/tab-panel/style.css +2 -0
- package/build-style/table/editor-rtl.css +6 -1
- package/build-style/table/editor.css +6 -1
- package/build-style/table/style-rtl.css +4 -2
- package/build-style/table/style.css +4 -2
- package/build-style/tag-cloud/style-rtl.css +1 -1
- package/build-style/tag-cloud/style.css +1 -1
- package/build-style/verse/style-rtl.css +8 -1
- package/build-style/verse/style.css +8 -1
- package/build-types/gallery/order-controls.d.ts +58 -0
- package/build-types/gallery/order-controls.d.ts.map +1 -0
- package/build-types/gallery/order-options.d.ts +67 -0
- package/build-types/gallery/order-options.d.ts.map +1 -0
- package/package.json +46 -44
- package/src/accordion/README.md +3 -0
- package/src/accordion/block.json +4 -1
- package/src/accordion-heading/README.md +1 -0
- package/src/accordion-heading/block.json +1 -0
- package/src/accordion-item/README.md +5 -0
- package/src/accordion-item/block.json +7 -1
- package/src/accordion-panel/README.md +7 -0
- package/src/accordion-panel/block.json +9 -1
- package/src/archives/README.md +6 -0
- package/src/archives/block.json +12 -0
- package/src/audio/README.md +4 -0
- package/src/audio/block.json +8 -0
- package/src/audio/edit.jsx +2 -1
- package/src/avatar/README.md +2 -0
- package/src/avatar/block.json +4 -0
- package/src/avatar/edit.jsx +48 -2
- package/src/avatar/editor.scss +4 -0
- package/src/avatar/index.php +5 -3
- package/src/breadcrumbs/README.md +2 -0
- package/src/breadcrumbs/block.json +3 -0
- package/src/breadcrumbs/edit.jsx +3 -3
- package/src/breadcrumbs/index.php +1 -1
- package/src/button/README.md +4 -0
- package/src/button/block.json +6 -0
- package/src/button/edit.jsx +47 -52
- package/src/button/index.php +47 -0
- package/src/buttons/README.md +8 -0
- package/src/buttons/block.json +15 -1
- package/src/categories/README.md +6 -0
- package/src/categories/block.json +12 -1
- package/src/code/README.md +7 -0
- package/src/code/block.json +13 -0
- package/src/column/README.md +4 -0
- package/src/column/block.json +9 -0
- package/src/column/edit.jsx +6 -0
- package/src/columns/README.md +7 -0
- package/src/columns/block.json +13 -0
- package/src/columns/edit.jsx +1 -131
- package/src/comment-author-name/README.md +2 -0
- package/src/comment-author-name/block.json +3 -0
- package/src/comment-content/README.md +4 -0
- package/src/comment-content/block.json +5 -0
- package/src/comment-date/README.md +2 -0
- package/src/comment-date/block.json +3 -0
- package/src/comment-edit-link/README.md +2 -0
- package/src/comment-edit-link/block.json +3 -0
- package/src/comment-reply-link/README.md +2 -0
- package/src/comment-reply-link/block.json +3 -0
- package/src/comments/README.md +5 -0
- package/src/comments/block.json +10 -0
- package/src/comments/edit/placeholder.jsx +5 -1
- package/src/comments-pagination/README.md +6 -0
- package/src/comments-pagination/block.json +14 -0
- package/src/comments-pagination/style.scss +3 -0
- package/src/comments-pagination-next/README.md +2 -0
- package/src/comments-pagination-next/block.json +3 -0
- package/src/comments-pagination-numbers/README.md +2 -0
- package/src/comments-pagination-numbers/block.json +3 -0
- package/src/comments-pagination-previous/README.md +2 -0
- package/src/comments-pagination-previous/block.json +6 -0
- package/src/comments-title/README.md +2 -0
- package/src/comments-title/block.json +3 -0
- package/src/common.scss +38 -0
- package/src/cover/README.md +1 -0
- package/src/cover/block.json +2 -1
- package/src/cover/edit/index.jsx +41 -6
- package/src/cover/edit/inspector-controls.jsx +74 -14
- package/src/cover/embed-video-utils.js +18 -10
- package/src/cover/index.php +44 -15
- package/src/cover/test/edit.browser.test.js +200 -4
- package/src/cover/test/embed-video-utils.test.js +48 -0
- package/src/cover/view.js +22 -0
- package/src/details/README.md +8 -0
- package/src/details/block.json +14 -0
- package/src/embed/README.md +4 -0
- package/src/embed/block.json +6 -1
- package/src/embed/style.scss +7 -1
- package/src/file/README.md +8 -0
- package/src/file/block.json +14 -0
- package/src/footnotes/README.md +7 -0
- package/src/footnotes/block.json +13 -0
- package/src/gallery/README.md +17 -0
- package/src/gallery/block.json +22 -0
- package/src/gallery/dynamic-gallery.jsx +11 -91
- package/src/gallery/edit.jsx +147 -49
- package/src/gallery/editor.scss +5 -9
- package/src/gallery/order-controls.tsx +143 -0
- package/src/gallery/order-images.js +111 -0
- package/src/gallery/order-options.ts +75 -0
- package/src/gallery/test/edit.jsdom.test.js +87 -10
- package/src/gallery/test/order-images.js +162 -0
- package/src/gallery/use-dynamic-gallery.js +1 -9
- package/src/gallery/use-get-media.js +7 -2
- package/src/group/README.md +1 -0
- package/src/group/block.json +1 -0
- package/src/group/edit.jsx +5 -5
- package/src/heading/README.md +8 -0
- package/src/heading/block.json +14 -0
- package/src/home-link/README.md +11 -0
- package/src/home-link/block.json +30 -0
- package/src/home-link/edit.jsx +2 -2
- package/src/icon/components/custom-inserter/index.jsx +5 -1
- package/src/icon/edit.jsx +68 -7
- package/src/icon/index.php +10 -1
- package/src/image/editor.scss +8 -0
- package/src/image/image.jsx +13 -11
- package/src/image/index.php +3 -4
- package/src/image/style.scss +14 -2
- package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +201 -0
- package/src/image/use-open-image-media-editor-modal.js +37 -4
- package/src/image/view.js +64 -68
- package/src/latest-comments/README.md +8 -0
- package/src/latest-comments/block.json +20 -0
- package/src/latest-posts/README.md +8 -0
- package/src/latest-posts/block.json +14 -0
- package/src/list/README.md +6 -0
- package/src/list/block.json +12 -1
- package/src/list-item/README.md +6 -0
- package/src/list-item/block.json +8 -1
- package/src/list-item/index.js +5 -0
- package/src/loginout/README.md +8 -0
- package/src/loginout/block.json +14 -0
- package/src/math/README.md +8 -0
- package/src/math/block.json +14 -0
- package/src/media-text/README.md +18 -0
- package/src/media-text/block.json +19 -0
- package/src/media-text/style.scss +5 -1
- package/src/navigation/edit/index.jsx +2 -4
- package/src/navigation/style.scss +40 -4
- package/src/navigation/test/use-navigation-menu.jsdom.test.js +1 -1
- package/src/navigation-link/README.md +1 -1
- package/src/navigation-link/editor.scss +6 -1
- package/src/navigation-link/link-ui/index.jsx +60 -27
- package/src/navigation-link/link-ui/page-creator.jsx +2 -2
- package/src/navigation-link/link-ui/test/get-suggestions-query.jsdom.test.js +67 -0
- package/src/navigation-link/shared/controls.jsx +2 -2
- package/src/navigation-link/shared/index.js +4 -0
- package/src/navigation-link/shared/test/use-block-suggestions.jsdom.test.js +158 -0
- package/src/navigation-link/shared/test/use-entity-binding.jsdom.test.js +1 -7
- package/src/navigation-link/shared/test/use-link-preview.jsdom.test.js +22 -22
- package/src/navigation-link/shared/use-block-suggestions.js +192 -0
- package/src/navigation-link/shared/use-link-preview.js +15 -14
- package/src/navigation-overlay-close/README.md +1 -0
- package/src/navigation-overlay-close/block.json +7 -0
- package/src/navigation-overlay-close/style.scss +1 -1
- package/src/navigation-submenu/README.md +7 -0
- package/src/navigation-submenu/block.json +6 -0
- package/src/navigation-submenu/edit.jsx +11 -1
- package/src/navigation-submenu/editor.scss +6 -1
- package/src/navigation-submenu/index.php +11 -0
- package/src/page-list/README.md +8 -0
- package/src/page-list/block.json +14 -0
- package/src/paragraph/README.md +1 -0
- package/src/paragraph/block.json +1 -0
- package/src/paragraph/edit.jsx +1 -3
- package/src/playlist/README.md +1 -0
- package/src/playlist/block.json +1 -0
- package/src/playlist/test/edit-component.jsdom.test.jsx +11 -11
- package/src/playlist-track/test/edit.jsdom.test.jsx +3 -3
- package/src/post-author-biography/README.md +4 -0
- package/src/post-author-biography/block.json +5 -0
- package/src/post-author-name/README.md +4 -0
- package/src/post-author-name/block.json +5 -0
- package/src/post-comments-count/README.md +2 -0
- package/src/post-comments-count/block.json +3 -0
- package/src/post-comments-form/README.md +8 -0
- package/src/post-comments-form/block.json +15 -0
- package/src/post-content/README.md +3 -0
- package/src/post-content/block.json +4 -1
- package/src/post-date/README.md +2 -0
- package/src/post-date/block.json +3 -0
- package/src/post-excerpt/README.md +7 -0
- package/src/post-excerpt/block.json +9 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/edit.jsx +13 -11
- package/src/post-navigation-link/README.md +12 -0
- package/src/post-navigation-link/block.json +30 -0
- package/src/post-navigation-link/edit.jsx +23 -2
- package/src/post-navigation-link/index.php +94 -5
- package/src/post-navigation-link/style.scss +2 -0
- package/src/post-template/README.md +7 -0
- package/src/post-template/block.json +13 -1
- package/src/post-terms/README.md +8 -0
- package/src/post-terms/block.json +10 -0
- package/src/post-time-to-read/README.md +8 -0
- package/src/post-time-to-read/block.json +10 -0
- package/src/post-title/README.md +8 -0
- package/src/post-title/block.json +14 -0
- package/src/preformatted/README.md +9 -0
- package/src/preformatted/block.json +11 -0
- package/src/pullquote/README.md +2 -0
- package/src/pullquote/block.json +3 -1
- package/src/query-no-results/README.md +10 -0
- package/src/query-no-results/block.json +14 -2
- package/src/query-pagination/README.md +6 -0
- package/src/query-pagination/block.json +20 -0
- package/src/query-pagination/style.scss +3 -0
- package/src/query-pagination-next/README.md +2 -0
- package/src/query-pagination-next/block.json +3 -0
- package/src/query-pagination-numbers/README.md +2 -0
- package/src/query-pagination-numbers/block.json +3 -0
- package/src/query-pagination-previous/README.md +2 -0
- package/src/query-pagination-previous/block.json +3 -0
- package/src/query-title/README.md +2 -0
- package/src/query-title/block.json +3 -0
- package/src/query-total/README.md +8 -0
- package/src/query-total/block.json +10 -0
- package/src/quote/README.md +3 -0
- package/src/quote/block.json +3 -0
- package/src/read-more/README.md +8 -0
- package/src/read-more/block.json +11 -0
- package/src/rss/README.md +8 -0
- package/src/rss/block.json +10 -0
- package/src/search/README.md +1 -0
- package/src/search/block.json +2 -1
- package/src/site-tagline/README.md +9 -0
- package/src/site-tagline/block.json +12 -1
- package/src/site-title/README.md +8 -0
- package/src/site-title/block.json +11 -1
- package/src/social-links/README.md +3 -0
- package/src/social-links/block.json +4 -0
- package/src/social-links/edit.jsx +2 -3
- package/src/tab-list/README.md +2 -0
- package/src/tab-list/block.json +4 -0
- package/src/tab-list/edit.jsx +3 -0
- package/src/tab-list/save.jsx +3 -0
- package/src/tab-panel/README.md +9 -0
- package/src/tab-panel/block.json +25 -0
- package/src/tab-panel/controls.jsx +2 -2
- package/src/tab-panel/style.scss +5 -2
- package/src/tab-panels/README.md +9 -0
- package/src/tab-panels/block.json +21 -1
- package/src/table/editor.scss +8 -2
- package/src/table/style.scss +4 -4
- package/src/table-of-contents/README.md +6 -0
- package/src/table-of-contents/block.json +7 -0
- package/src/tabs/README.md +11 -0
- package/src/tabs/block.json +27 -1
- package/src/tag-cloud/README.md +9 -0
- package/src/tag-cloud/block.json +19 -0
- package/src/tag-cloud/style.scss +1 -1
- package/src/template-part/edit/selection-modal.jsx +1 -1
- package/src/template-part/index.php +16 -3
- package/src/term-count/README.md +10 -0
- package/src/term-count/block.json +12 -0
- package/src/term-description/README.md +8 -0
- package/src/term-description/block.json +13 -0
- package/src/term-name/README.md +9 -0
- package/src/term-name/block.json +16 -1
- package/src/term-name/index.php +1 -1
- package/src/term-template/README.md +8 -0
- package/src/term-template/block.json +14 -1
- package/src/utils/search-patterns.js +9 -53
- package/src/utils/style-state.js +6 -4
- package/src/utils/test/{search-patterns.js → search-patterns.jsdom.test.js} +1 -22
- package/src/utils/test/waveform-player-auto-init.jsdom.test.js +25 -0
- package/src/utils/test/waveform-player-dependency.jsdom.test.js +7 -60
- package/src/utils/test/waveform-utils.browser.test.js +3 -15
- package/src/utils/waveform-utils.js +1 -1
- package/src/verse/README.md +4 -0
- package/src/verse/block.json +4 -0
- package/src/verse/style.scss +11 -2
- package/src/video/README.md +11 -0
- package/src/video/block.json +12 -0
- package/src/video/edit.jsx +65 -49
- package/src/video/index.js +0 -2
- package/src/video/save.jsx +10 -1
- package/build/columns/utils.cjs +0 -112
- package/build/columns/utils.cjs.map +0 -7
- package/build/video/variations.cjs +0 -75
- package/build/video/variations.cjs.map +0 -7
- package/build-module/columns/utils.mjs +0 -78
- package/build-module/columns/utils.mjs.map +0 -7
- package/build-module/video/variations.mjs +0 -50
- package/build-module/video/variations.mjs.map +0 -7
- package/src/columns/test/utils.js +0 -331
- package/src/columns/utils.js +0 -176
- package/src/video/test/variations.js +0 -63
- package/src/video/variations.js +0 -62
package/build/image/view.cjs
CHANGED
|
@@ -10,6 +10,7 @@ var touchStartEvent = {
|
|
|
10
10
|
startY: 0,
|
|
11
11
|
startTime: 0
|
|
12
12
|
};
|
|
13
|
+
var inertElements = [];
|
|
13
14
|
var focusableSelectors = [
|
|
14
15
|
".wp-lightbox-close-button",
|
|
15
16
|
".wp-lightbox-navigation-button"
|
|
@@ -281,7 +282,7 @@ var { state, actions, callbacks } = (0, import_interactivity.store)(
|
|
|
281
282
|
} = state.selectedImage.imageRef;
|
|
282
283
|
let { x: screenPosX, y: screenPosY } = state.selectedImage.imageRef.getBoundingClientRect();
|
|
283
284
|
const naturalRatio = naturalWidth / naturalHeight;
|
|
284
|
-
|
|
285
|
+
const originalRatio = originalWidth / originalHeight;
|
|
285
286
|
if (state.selectedImage.scaleAttr === "contain") {
|
|
286
287
|
if (naturalRatio > originalRatio) {
|
|
287
288
|
const heightWithoutSpace = originalWidth / naturalRatio;
|
|
@@ -293,47 +294,15 @@ var { state, actions, callbacks } = (0, import_interactivity.store)(
|
|
|
293
294
|
originalWidth = widthWithoutSpace;
|
|
294
295
|
}
|
|
295
296
|
}
|
|
296
|
-
|
|
297
|
-
let imgMaxWidth = parseFloat(
|
|
297
|
+
const imgMaxWidth = parseFloat(
|
|
298
298
|
state.selectedImage.targetWidth && state.selectedImage.targetWidth !== "none" ? state.selectedImage.targetWidth : naturalWidth
|
|
299
299
|
);
|
|
300
|
-
|
|
300
|
+
const imgMaxHeight = parseFloat(
|
|
301
301
|
state.selectedImage.targetHeight && state.selectedImage.targetHeight !== "none" ? state.selectedImage.targetHeight : naturalHeight
|
|
302
302
|
);
|
|
303
|
-
|
|
304
|
-
let containerMaxWidth = imgMaxWidth;
|
|
305
|
-
let containerMaxHeight = imgMaxHeight;
|
|
303
|
+
const fullSizeRatio = imgMaxWidth / imgMaxHeight;
|
|
306
304
|
let containerWidth = imgMaxWidth;
|
|
307
305
|
let containerHeight = imgMaxHeight;
|
|
308
|
-
if (naturalRatio.toFixed(2) !== imgRatio.toFixed(2)) {
|
|
309
|
-
if (naturalRatio > imgRatio) {
|
|
310
|
-
const reducedHeight = imgMaxWidth / naturalRatio;
|
|
311
|
-
if (imgMaxHeight - reducedHeight > imgMaxWidth) {
|
|
312
|
-
imgMaxHeight = reducedHeight;
|
|
313
|
-
imgMaxWidth = reducedHeight * naturalRatio;
|
|
314
|
-
} else {
|
|
315
|
-
imgMaxHeight = imgMaxWidth / naturalRatio;
|
|
316
|
-
}
|
|
317
|
-
} else {
|
|
318
|
-
const reducedWidth = imgMaxHeight * naturalRatio;
|
|
319
|
-
if (imgMaxWidth - reducedWidth > imgMaxHeight) {
|
|
320
|
-
imgMaxWidth = reducedWidth;
|
|
321
|
-
imgMaxHeight = reducedWidth / naturalRatio;
|
|
322
|
-
} else {
|
|
323
|
-
imgMaxWidth = imgMaxHeight * naturalRatio;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
containerWidth = imgMaxWidth;
|
|
327
|
-
containerHeight = imgMaxHeight;
|
|
328
|
-
imgRatio = imgMaxWidth / imgMaxHeight;
|
|
329
|
-
if (originalRatio > imgRatio) {
|
|
330
|
-
containerMaxWidth = imgMaxWidth;
|
|
331
|
-
containerMaxHeight = containerMaxWidth / originalRatio;
|
|
332
|
-
} else {
|
|
333
|
-
containerMaxHeight = imgMaxHeight;
|
|
334
|
-
containerMaxWidth = containerMaxHeight * originalRatio;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
306
|
if (originalWidth > containerWidth || originalHeight > containerHeight) {
|
|
338
307
|
containerWidth = originalWidth;
|
|
339
308
|
containerHeight = originalHeight;
|
|
@@ -357,23 +326,37 @@ var { state, actions, callbacks } = (0, import_interactivity.store)(
|
|
|
357
326
|
containerHeight
|
|
358
327
|
);
|
|
359
328
|
const targetContainerRatio = targetMaxWidth / targetMaxHeight;
|
|
360
|
-
if (
|
|
329
|
+
if (fullSizeRatio > targetContainerRatio) {
|
|
361
330
|
containerWidth = targetMaxWidth;
|
|
362
|
-
containerHeight = containerWidth /
|
|
331
|
+
containerHeight = containerWidth / fullSizeRatio;
|
|
363
332
|
} else {
|
|
364
333
|
containerHeight = targetMaxHeight;
|
|
365
|
-
containerWidth = containerHeight *
|
|
334
|
+
containerWidth = containerHeight * fullSizeRatio;
|
|
366
335
|
}
|
|
367
|
-
const
|
|
368
|
-
const
|
|
369
|
-
const
|
|
336
|
+
const hasCroppedSource = naturalRatio.toFixed(2) !== fullSizeRatio.toFixed(2);
|
|
337
|
+
const sourceRatio = hasCroppedSource ? naturalRatio : fullSizeRatio;
|
|
338
|
+
const containerScale = Math.max(
|
|
339
|
+
originalWidth / containerWidth,
|
|
340
|
+
originalHeight / containerHeight,
|
|
341
|
+
originalWidth / (containerHeight * sourceRatio),
|
|
342
|
+
originalHeight * sourceRatio / containerWidth
|
|
343
|
+
);
|
|
344
|
+
const thumbnailWidth = originalWidth / containerScale;
|
|
345
|
+
const thumbnailHeight = originalHeight / containerScale;
|
|
346
|
+
const cropX = (containerWidth - thumbnailWidth) / 2;
|
|
347
|
+
const cropY = (containerHeight - thumbnailHeight) / 2;
|
|
348
|
+
screenPosX -= cropX * containerScale;
|
|
349
|
+
screenPosY -= cropY * containerScale;
|
|
370
350
|
state.overlayStyles = `
|
|
371
351
|
--wp--lightbox-initial-top-position: ${screenPosY}px;
|
|
372
352
|
--wp--lightbox-initial-left-position: ${screenPosX}px;
|
|
373
353
|
--wp--lightbox-container-width: ${containerWidth + 1}px;
|
|
374
354
|
--wp--lightbox-container-height: ${containerHeight + 1}px;
|
|
375
|
-
--wp--lightbox-image-width: ${
|
|
376
|
-
--wp--lightbox-image-height: ${
|
|
355
|
+
--wp--lightbox-image-width: ${containerWidth}px;
|
|
356
|
+
--wp--lightbox-image-height: ${containerHeight}px;
|
|
357
|
+
--wp--lightbox-initial-clip: inset(${cropY}px ${cropX}px);
|
|
358
|
+
--wp--lightbox-thumbnail-width: ${hasCroppedSource ? thumbnailWidth : containerWidth}px;
|
|
359
|
+
--wp--lightbox-thumbnail-height: ${hasCroppedSource ? thumbnailHeight : containerHeight}px;
|
|
377
360
|
--wp--lightbox-scale: ${containerScale};
|
|
378
361
|
--wp--lightbox-scrollbar-width: ${window.innerWidth - document.documentElement.clientWidth}px;
|
|
379
362
|
`;
|
|
@@ -434,13 +417,24 @@ var { state, actions, callbacks } = (0, import_interactivity.store)(
|
|
|
434
417
|
}
|
|
435
418
|
},
|
|
436
419
|
setInertElements() {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
el.
|
|
440
|
-
|
|
441
|
-
|
|
420
|
+
if (!state.overlayEnabled) {
|
|
421
|
+
inertElements.forEach(
|
|
422
|
+
(el) => el.removeAttribute("inert")
|
|
423
|
+
);
|
|
424
|
+
inertElements = [];
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
const { ref } = (0, import_interactivity.getElement)();
|
|
428
|
+
let node = ref;
|
|
429
|
+
while (node && node !== document.body && node.parentElement) {
|
|
430
|
+
for (const sibling of node.parentElement.children) {
|
|
431
|
+
if (sibling !== node && !sibling.hasAttribute("inert")) {
|
|
432
|
+
sibling.setAttribute("inert", "");
|
|
433
|
+
inertElements.push(sibling);
|
|
434
|
+
}
|
|
442
435
|
}
|
|
443
|
-
|
|
436
|
+
node = node.parentElement;
|
|
437
|
+
}
|
|
444
438
|
},
|
|
445
439
|
initTriggerButton() {
|
|
446
440
|
const { imageId } = (0, import_interactivity.getContext)();
|
package/build/image/view.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/image/view.js"],
|
|
4
|
-
"sourcesContent": ["import {\n\tstore,\n\tgetContext,\n\tgetElement,\n\tgetConfig,\n\twithSyncEvent,\n\twithScope,\n} from '@wordpress/interactivity';\nimport { IMAGE_PRELOAD_DELAY } from './constants';\n\n/**\n * Tracks whether user is touching screen; used to differentiate behavior for\n * touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/**\n * Tracks the last time the screen was touched; used to differentiate behavior\n * for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\nconst touchStartEvent = {\n\tstartX: 0,\n\tstartY: 0,\n\tstartTime: 0,\n};\n\nconst focusableSelectors = [\n\t'.wp-lightbox-close-button',\n\t'.wp-lightbox-navigation-button',\n];\n\n/**\n * Returns the appropriate src URL for an image.\n *\n * @param {string} uploadedSrc - Full size image src.\n * @return {string} The source URL.\n */\nfunction getImageSrc( { uploadedSrc } ) {\n\treturn (\n\t\tuploadedSrc ||\n\t\t'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='\n\t);\n}\n\n/**\n * Returns the appropriate srcset for an image.\n *\n * @param {string} lightboxSrcset - Image srcset.\n * @return {string} The srcset value.\n */\nfunction getImageSrcset( { lightboxSrcset } ) {\n\treturn lightboxSrcset || '';\n}\n\nconst { state, actions, callbacks } = store(\n\t'core/image',\n\t{\n\t\tstate: {\n\t\t\tselectedImageId: null,\n\t\t\tselectedGalleryId: null,\n\t\t\tpreloadTimers: new Map(),\n\t\t\tpreloadedImageIds: new Set(),\n\t\t\tget galleryImages() {\n\t\t\t\tif ( ! state.selectedGalleryId ) {\n\t\t\t\t\treturn [ state.selectedImageId ];\n\t\t\t\t}\n\n\t\t\t\t// Get all images in this gallery and sort by galleryOrder\n\t\t\t\treturn Object.entries( state.metadata )\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( [ , value ] ) =>\n\t\t\t\t\t\t\tvalue.galleryId === state.selectedGalleryId\n\t\t\t\t\t)\n\t\t\t\t\t.sort( ( [ , a ], [ , b ] ) => {\n\t\t\t\t\t\tconst orderA = a.order ?? 0;\n\t\t\t\t\t\tconst orderB = b.order ?? 0;\n\t\t\t\t\t\treturn orderA - orderB;\n\t\t\t\t\t} )\n\t\t\t\t\t.map( ( [ key ] ) => key );\n\t\t\t},\n\t\t\tget selectedImageIndex() {\n\t\t\t\treturn state.galleryImages.findIndex(\n\t\t\t\t\t( id ) => id === state.selectedImageId\n\t\t\t\t);\n\t\t\t},\n\t\t\tget selectedImage() {\n\t\t\t\treturn state.metadata[ state.selectedImageId ];\n\t\t\t},\n\t\t\tget hasNavigationIcon() {\n\t\t\t\tconst { navigationButtonType } = state.selectedImage;\n\t\t\t\treturn (\n\t\t\t\t\tnavigationButtonType === 'icon' ||\n\t\t\t\t\tnavigationButtonType === 'both'\n\t\t\t\t);\n\t\t\t},\n\t\t\tget hasNavigationText() {\n\t\t\t\tconst { navigationButtonType } = state.selectedImage;\n\t\t\t\treturn (\n\t\t\t\t\tnavigationButtonType === 'text' ||\n\t\t\t\t\tnavigationButtonType === 'both'\n\t\t\t\t);\n\t\t\t},\n\t\t\tget thisImage() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ];\n\t\t\t},\n\t\t\tget hasNavigation() {\n\t\t\t\treturn state.galleryImages.length > 1;\n\t\t\t},\n\t\t\tget hasNextImage() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.selectedImageIndex + 1 < state.galleryImages.length\n\t\t\t\t);\n\t\t\t},\n\t\t\tget hasPreviousImage() {\n\t\t\t\treturn state.selectedImageIndex - 1 >= 0;\n\t\t\t},\n\t\t\tget overlayOpened() {\n\t\t\t\treturn state.selectedImageId !== null;\n\t\t\t},\n\t\t\tget roleAttribute() {\n\t\t\t\treturn state.overlayOpened ? 'dialog' : null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\treturn state.overlayOpened ? 'true' : null;\n\t\t\t},\n\t\t\tget ariaLabel() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.selectedImage.customAriaLabel ||\n\t\t\t\t\tgetConfig().defaultAriaLabel\n\t\t\t\t);\n\t\t\t},\n\t\t\tget closeButtonAriaLabel() {\n\t\t\t\treturn state.hasNavigationText\n\t\t\t\t\t? undefined\n\t\t\t\t\t: getConfig().closeButtonText;\n\t\t\t},\n\t\t\tget prevButtonAriaLabel() {\n\t\t\t\treturn state.hasNavigationText\n\t\t\t\t\t? undefined\n\t\t\t\t\t: getConfig().prevButtonText;\n\t\t\t},\n\t\t\tget nextButtonAriaLabel() {\n\t\t\t\treturn state.hasNavigationText\n\t\t\t\t\t? undefined\n\t\t\t\t\t: getConfig().nextButtonText;\n\t\t\t},\n\t\t\tget enlargedSrc() {\n\t\t\t\treturn getImageSrc( state.selectedImage );\n\t\t\t},\n\t\t\tget enlargedSrcset() {\n\t\t\t\treturn getImageSrcset( state.selectedImage );\n\t\t\t},\n\t\t\tget figureStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.selectedImage.figureStyles?.replace(\n\t\t\t\t\t\t/margin[^;]*;?/g,\n\t\t\t\t\t\t''\n\t\t\t\t\t) };`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget imgStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.selectedImage.imgStyles?.replace(\n\t\t\t\t\t\t/;$/,\n\t\t\t\t\t\t''\n\t\t\t\t\t) }; object-fit:cover;`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget isContentHidden() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayEnabled &&\n\t\t\t\t\tstate.selectedImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t\tget isContentVisible() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\t! state.overlayEnabled &&\n\t\t\t\t\tstate.selectedImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tshowLightbox() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\t// Bails out if the image has not loaded yet.\n\t\t\t\tif ( ! state.metadata[ imageId ].imageRef?.complete ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Stores the positions of the scroll to fix it until the overlay is\n\t\t\t\t// closed.\n\t\t\t\tstate.scrollTopReset = document.documentElement.scrollTop;\n\t\t\t\tstate.scrollLeftReset = document.documentElement.scrollLeft;\n\n\t\t\t\t// Sets the selected image and gallery and enables the overlay.\n\t\t\t\tstate.selectedImageId = imageId;\n\t\t\t\tconst { galleryId } = getContext( 'core/gallery' ) || {};\n\t\t\t\tstate.selectedGalleryId = galleryId || null;\n\t\t\t\tstate.overlayEnabled = true;\n\n\t\t\t\t// Computes the styles of the overlay for the animation.\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t},\n\t\t\thideLightbox() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tstate.overlayEnabled = false;\n\n\t\t\t\t\t// Waits until the close animation has completed before allowing a\n\t\t\t\t\t// user to scroll again. The duration of this animation is defined in\n\t\t\t\t\t// the `styles.scss` file, but in any case we should wait a few\n\t\t\t\t\t// milliseconds longer than the duration, otherwise a user may scroll\n\t\t\t\t\t// too soon and cause the animation to look sloppy.\n\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t// Delays before changing the focus. Otherwise the focus ring will\n\t\t\t\t\t\t// appear on Firefox before the image has finished animating, which\n\t\t\t\t\t\t// looks broken.\n\t\t\t\t\t\tstate.selectedImage.buttonRef.focus( {\n\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Resets the selected image and gallery ids.\n\t\t\t\t\t\tstate.selectedImageId = null;\n\t\t\t\t\t\tstate.selectedGalleryId = null;\n\t\t\t\t\t}, 450 );\n\t\t\t\t}\n\t\t\t},\n\t\t\tshowPreviousImage: withSyncEvent( ( event ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tconst nextIndex = state.hasPreviousImage\n\t\t\t\t\t? state.selectedImageIndex - 1\n\t\t\t\t\t: state.galleryImages.length - 1;\n\t\t\t\tstate.selectedImageId = state.galleryImages[ nextIndex ];\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t} ),\n\t\t\tshowNextImage: withSyncEvent( ( event ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tconst nextIndex = state.hasNextImage\n\t\t\t\t\t? state.selectedImageIndex + 1\n\t\t\t\t\t: 0;\n\t\t\t\tstate.selectedImageId = state.galleryImages[ nextIndex ];\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t} ),\n\t\t\thandleKeydown: withSyncEvent( ( event ) => {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tactions.hideLightbox();\n\t\t\t\t\t} else if ( event.key === 'ArrowLeft' ) {\n\t\t\t\t\t\tactions.showPreviousImage( event );\n\t\t\t\t\t} else if ( event.key === 'ArrowRight' ) {\n\t\t\t\t\t\tactions.showNextImage( event );\n\t\t\t\t\t} else if ( event.key === 'Tab' ) {\n\t\t\t\t\t\t// Traps focus within the overlay.\n\t\t\t\t\t\tconst focusableElements = Array.from(\n\t\t\t\t\t\t\tdocument.querySelectorAll( focusableSelectors )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst firstFocusableElement = focusableElements[ 0 ];\n\t\t\t\t\t\tconst lastFocusableElement =\n\t\t\t\t\t\t\tfocusableElements[ focusableElements.length - 1 ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\tevent.target === firstFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tlastFocusableElement.focus();\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\tevent.target === lastFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tfirstFocusableElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchMove: withSyncEvent( ( event ) => {\n\t\t\t\t// On mobile devices, prevents triggering the scroll event because\n\t\t\t\t// otherwise the page jumps around when it resets the scroll position.\n\t\t\t\t// This also means that closing the lightbox requires that a user\n\t\t\t\t// perform a simple tap. This may be changed in the future if there is a\n\t\t\t\t// better alternative to override or reset the scroll position during\n\t\t\t\t// swipe actions.\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchStart( event ) {\n\t\t\t\tisTouching = true;\n\t\t\t\tconst t = event.touches && event.touches[ 0 ];\n\t\t\t\tif ( t ) {\n\t\t\t\t\ttouchStartEvent.startX = t.clientX;\n\t\t\t\t\ttouchStartEvent.startY = t.clientY;\n\t\t\t\t\ttouchStartEvent.startTime = Date.now();\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleTouchEnd: withSyncEvent( ( event ) => {\n\t\t\t\tconst touchEndEvent =\n\t\t\t\t\t( event.changedTouches && event.changedTouches[ 0 ] ) ||\n\t\t\t\t\t( event.touches && event.touches[ 0 ] );\n\t\t\t\tconst now = Date.now();\n\n\t\t\t\tif ( touchEndEvent && state.overlayEnabled ) {\n\t\t\t\t\tconst deltaX =\n\t\t\t\t\t\ttouchEndEvent.clientX - touchStartEvent.startX;\n\t\t\t\t\tconst deltaY =\n\t\t\t\t\t\ttouchEndEvent.clientY - touchStartEvent.startY;\n\t\t\t\t\tconst absDeltaX = Math.abs( deltaX );\n\t\t\t\t\tconst absDeltaY = Math.abs( deltaY );\n\t\t\t\t\tconst elapsedMs = now - touchStartEvent.startTime;\n\t\t\t\t\tconst isHorizontalSwipe =\n\t\t\t\t\t\t// Swipe distance is greater than 50px\n\t\t\t\t\t\tabsDeltaX > 50 &&\n\t\t\t\t\t\t// Horizontal movement is much larger than the vertical movement\n\t\t\t\t\t\tabsDeltaX > absDeltaY * 1.5 &&\n\t\t\t\t\t\t// Fast action of less than 800ms\n\t\t\t\t\t\telapsedMs < 800;\n\n\t\t\t\t\tif ( isHorizontalSwipe ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tif ( deltaX < 0 ) {\n\t\t\t\t\t\t\tactions.showNextImage( event );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tactions.showPreviousImage( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlastTouchTime = now;\n\t\t\t\tisTouching = false;\n\t\t\t} ),\n\t\t\thandleScroll() {\n\t\t\t\t// Prevents scrolling behaviors that trigger content shift while the\n\t\t\t\t// lightbox is open. It would be better to accomplish through CSS alone,\n\t\t\t\t// but using overflow: hidden is currently the only way to do so and\n\t\t\t\t// that causes a layout to shift and prevents the zoom animation from\n\t\t\t\t// working in some cases because it's not possible to account for the\n\t\t\t\t// layout shift when doing the animation calculations. Instead, it uses\n\t\t\t\t// JavaScript to prevent and reset the scrolling behavior.\n\t\t\t\tif ( state.overlayOpened ) {\n\t\t\t\t\t// Avoids overriding the scroll behavior on mobile devices because\n\t\t\t\t\t// doing so breaks the pinch to zoom functionality, and users should\n\t\t\t\t\t// be able to zoom in further on the high-res image.\n\t\t\t\t\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t\t\t\t\t// It doesn't rely on `event.preventDefault()` to prevent scrolling\n\t\t\t\t\t\t// because the scroll event can't be canceled, so it resets the\n\t\t\t\t\t\t// position instead.\n\t\t\t\t\t\twindow.scrollTo(\n\t\t\t\t\t\t\tstate.scrollLeftReset,\n\t\t\t\t\t\t\tstate.scrollTopReset\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpreloadImage() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\t// Bails if it has already been preloaded. This could help\n\t\t\t\t// prevent unnecessary preloading of the same image multiple times,\n\t\t\t\t// leading to duplicate link elements in the document head.\n\t\t\t\tif ( state.preloadedImageIds.has( imageId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Link element to preload the image.\n\t\t\t\tconst imageMetadata = state.metadata[ imageId ];\n\t\t\t\tconst imageLink = document.createElement( 'link' );\n\t\t\t\timageLink.rel = 'preload';\n\t\t\t\timageLink.as = 'image';\n\t\t\t\timageLink.href = getImageSrc( imageMetadata );\n\n\t\t\t\t// Apply srcset if available for responsive preloading\n\t\t\t\tconst srcset = getImageSrcset( imageMetadata );\n\t\t\t\tif ( srcset ) {\n\t\t\t\t\timageLink.setAttribute( 'imagesrcset', srcset );\n\t\t\t\t\timageLink.setAttribute( 'imagesizes', '100vw' );\n\t\t\t\t}\n\n\t\t\t\tdocument.head.appendChild( imageLink );\n\t\t\t\tstate.preloadedImageIds.add( imageId );\n\t\t\t},\n\t\t\tpreloadImageWithDelay() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\tactions.cancelPreload();\n\n\t\t\t\t// Set a new timer to preload the image after a short delay.\n\t\t\t\tconst timerId = setTimeout(\n\t\t\t\t\twithScope( () => {\n\t\t\t\t\t\tactions.preloadImage();\n\t\t\t\t\t\tstate.preloadTimers.delete( imageId );\n\t\t\t\t\t} ),\n\t\t\t\t\tIMAGE_PRELOAD_DELAY\n\t\t\t\t);\n\t\t\t\tstate.preloadTimers.set( imageId, timerId );\n\t\t\t},\n\t\t\tcancelPreload() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tif ( state.preloadTimers.has( imageId ) ) {\n\t\t\t\t\tclearTimeout( state.preloadTimers.get( imageId ) );\n\t\t\t\t\tstate.preloadTimers.delete( imageId );\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\tsetOverlayStyles() {\n\t\t\t\tif ( ! state.overlayEnabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth: originalWidth,\n\t\t\t\t\toffsetHeight: originalHeight,\n\t\t\t\t} = state.selectedImage.imageRef;\n\t\t\t\tlet { x: screenPosX, y: screenPosY } =\n\t\t\t\t\tstate.selectedImage.imageRef.getBoundingClientRect();\n\n\t\t\t\t// Natural ratio of the image clicked to open the lightbox.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Original ratio of the image clicked to open the lightbox.\n\t\t\t\tlet originalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// If it has object-fit: contain, recalculates the original sizes\n\t\t\t\t// and the screen position without the blank spaces.\n\t\t\t\tif ( state.selectedImage.scaleAttr === 'contain' ) {\n\t\t\t\t\tif ( naturalRatio > originalRatio ) {\n\t\t\t\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the top space.\n\t\t\t\t\t\tscreenPosY +=\n\t\t\t\t\t\t\t( originalHeight - heightWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalHeight = heightWithoutSpace;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the left space.\n\t\t\t\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalWidth = widthWithoutSpace;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\toriginalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// Typically, it uses the image's full-sized dimensions. If those\n\t\t\t\t// dimensions have not been set (i.e. an external image with only one\n\t\t\t\t// size), the image's dimensions in the lightbox are the same\n\t\t\t\t// as those of the image in the content.\n\t\t\t\tlet imgMaxWidth = parseFloat(\n\t\t\t\t\tstate.selectedImage.targetWidth &&\n\t\t\t\t\t\tstate.selectedImage.targetWidth !== 'none'\n\t\t\t\t\t\t? state.selectedImage.targetWidth\n\t\t\t\t\t\t: naturalWidth\n\t\t\t\t);\n\t\t\t\tlet imgMaxHeight = parseFloat(\n\t\t\t\t\tstate.selectedImage.targetHeight &&\n\t\t\t\t\t\tstate.selectedImage.targetHeight !== 'none'\n\t\t\t\t\t\t? state.selectedImage.targetHeight\n\t\t\t\t\t\t: naturalHeight\n\t\t\t\t);\n\n\t\t\t\t// Ratio of the biggest image stored in the database.\n\t\t\t\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\t\t\t\tlet containerMaxWidth = imgMaxWidth;\n\t\t\t\tlet containerMaxHeight = imgMaxHeight;\n\t\t\t\tlet containerWidth = imgMaxWidth;\n\t\t\t\tlet containerHeight = imgMaxHeight;\n\n\t\t\t\t// Checks if the target image has a different ratio than the original\n\t\t\t\t// one (thumbnail). Recalculates the width and height.\n\t\t\t\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\t\t\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t\t\t\t// If the width is reached before the height, it keeps the maxWidth\n\t\t\t\t\t\t// and recalculates the height unless the difference between the\n\t\t\t\t\t\t// maxHeight and the reducedHeight is higher than the maxWidth,\n\t\t\t\t\t\t// where it keeps the reducedHeight and recalculate the width.\n\t\t\t\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the height is reached before the width, it keeps the maxHeight\n\t\t\t\t\t\t// and recalculate the width unlesss the difference between the\n\t\t\t\t\t\t// maxWidth and the reducedWidth is higher than the maxHeight, where\n\t\t\t\t\t\t// it keeps the reducedWidth and recalculate the height.\n\t\t\t\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tcontainerWidth = imgMaxWidth;\n\t\t\t\t\tcontainerHeight = imgMaxHeight;\n\t\t\t\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t\t\t\t// Calculates the max size of the container.\n\t\t\t\t\tif ( originalRatio > imgRatio ) {\n\t\t\t\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\t\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\t\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If the image has been pixelated on purpose, it keeps that size.\n\t\t\t\tif (\n\t\t\t\t\toriginalWidth > containerWidth ||\n\t\t\t\t\toriginalHeight > containerHeight\n\t\t\t\t) {\n\t\t\t\t\tcontainerWidth = originalWidth;\n\t\t\t\t\tcontainerHeight = originalHeight;\n\t\t\t\t}\n\n\t\t\t\t// Calculates the final lightbox image size and the scale factor.\n\t\t\t\t// MaxWidth is either the window container (accounting for padding) or\n\t\t\t\t// the image resolution.\n\n\t\t\t\t// 480px width or less\n\t\t\t\tlet horizontalPadding = 0;\n\t\t\t\tlet verticalPadding = 160;\n\t\t\t\t// Greater than 480px wide and less than or equal to 960px\n\t\t\t\tif ( 480 < window.innerWidth ) {\n\t\t\t\t\thorizontalPadding = 80;\n\t\t\t\t\tverticalPadding = 160;\n\t\t\t\t}\n\t\t\t\t// Greater than 960px wide\n\t\t\t\tif ( 960 < window.innerWidth ) {\n\t\t\t\t\thorizontalPadding = state.hasNavigation ? 320 : 80;\n\t\t\t\t\tverticalPadding = 80;\n\t\t\t\t}\n\n\t\t\t\tconst targetMaxWidth = Math.min(\n\t\t\t\t\twindow.innerWidth - horizontalPadding,\n\t\t\t\t\tcontainerWidth\n\t\t\t\t);\n\t\t\t\tconst targetMaxHeight = Math.min(\n\t\t\t\t\twindow.innerHeight - verticalPadding,\n\t\t\t\t\tcontainerHeight\n\t\t\t\t);\n\t\t\t\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\t\t\t\tif ( originalRatio > targetContainerRatio ) {\n\t\t\t\t\t// If targetMaxWidth is reached before targetMaxHeight.\n\t\t\t\t\tcontainerWidth = targetMaxWidth;\n\t\t\t\t\tcontainerHeight = containerWidth / originalRatio;\n\t\t\t\t} else {\n\t\t\t\t\t// If targetMaxHeight is reached before targetMaxWidth.\n\t\t\t\t\tcontainerHeight = targetMaxHeight;\n\t\t\t\t\tcontainerWidth = containerHeight * originalRatio;\n\t\t\t\t}\n\n\t\t\t\tconst containerScale = originalWidth / containerWidth;\n\t\t\t\tconst lightboxImgWidth =\n\t\t\t\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\t\t\t\tconst lightboxImgHeight =\n\t\t\t\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t\t\t\t// As of this writing, using the calculations above will render the\n\t\t\t\t// lightbox with a small, erroneous whitespace on the left side of the\n\t\t\t\t// image in iOS Safari, perhaps due to an inconsistency in how browsers\n\t\t\t\t// handle absolute positioning and CSS transformation. In any case,\n\t\t\t\t// adding 1 pixel to the container width and height solves the problem,\n\t\t\t\t// though this can be removed if the issue is fixed in the future.\n\t\t\t\tstate.overlayStyles = `\n\t\t\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t\t\t}px;\n\t\t\t\t`;\n\t\t\t},\n\t\t\tsetButtonStyles() {\n\t\t\t\tconst { ref } = getElement();\n\n\t\t\t\t// This guard prevents errors in images with the `srcset`\n\t\t\t\t// attribute, which can dispatch `load` events even after DOM\n\t\t\t\t// removal. Preact doesn't automatically clean up `load` event\n\t\t\t\t// listeners on unmounted `img` elements (see\n\t\t\t\t// https://github.com/preactjs/preact/issues/3141).\n\t\t\t\tif ( ! ref ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\tstate.metadata[ imageId ].imageRef = ref;\n\t\t\t\tstate.metadata[ imageId ].currentSrc = ref.currentSrc;\n\n\t\t\t\tconst {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth,\n\t\t\t\t\toffsetHeight,\n\t\t\t\t} = ref;\n\n\t\t\t\t// If the image isn't loaded yet, it can't calculate where the button\n\t\t\t\t// should be.\n\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst figure = ref.parentElement;\n\t\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t\t// It needs special handling for the height because a caption will cause\n\t\t\t\t// the figure to be taller than the image, which means it needs to\n\t\t\t\t// account for that when calculating the placement of the button in the\n\t\t\t\t// top right corner of the image.\n\t\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\t\tif ( caption ) {\n\t\t\t\t\tconst captionComputedStyle =\n\t\t\t\t\t\twindow.getComputedStyle( caption );\n\t\t\t\t\tif (\n\t\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\t\tlet buttonTop = buttonOffsetTop + 16;\n\t\t\t\tlet buttonRight = buttonOffsetRight + 16;\n\n\t\t\t\t// In the case of an image with object-fit: contain, the size of the\n\t\t\t\t// <img> element can be larger than the image itself, so it needs to\n\t\t\t\t// calculate where to place the button.\n\t\t\t\tif ( state.metadata[ imageId ].scaleAttr === 'contain' ) {\n\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t\t// If it reaches the width first, it keeps the width and compute the\n\t\t\t\t\t\t// height.\n\t\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\tbuttonTop =\n\t\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t\tbuttonRight = buttonOffsetRight + 16;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If it reaches the height first, it keeps the height and compute\n\t\t\t\t\t\t// the width.\n\t\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\tbuttonTop = buttonOffsetTop + 16;\n\t\t\t\t\t\tbuttonRight =\n\t\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstate.metadata[ imageId ].buttonTop = buttonTop;\n\t\t\t\tstate.metadata[ imageId ].buttonRight = buttonRight;\n\t\t\t},\n\t\t\tsetOverlayFocus() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Moves the focus to the dialog when it opens.\n\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t\tsetInertElements() {\n\t\t\t\t// Makes all children of the document inert exempt .wp-lightbox-overlay.\n\t\t\t\tdocument\n\t\t\t\t\t.querySelectorAll( 'body > :not(.wp-lightbox-overlay)' )\n\t\t\t\t\t.forEach( ( el ) => {\n\t\t\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t\t\tel.setAttribute( 'inert', '' );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tel.removeAttribute( 'inert' );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t},\n\t\t\tinitTriggerButton() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tstate.metadata[ imageId ].buttonRef = ref;\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],
|
|
5
|
-
"mappings": ";;;AAAA,2BAOO;AACP,uBAAoC;AAQpC,IAAI,aAAa;AAQjB,IAAI,gBAAgB;AAEpB,IAAM,kBAAkB;AAAA,EACvB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,WAAW;AACZ;
|
|
4
|
+
"sourcesContent": ["import {\n\tstore,\n\tgetContext,\n\tgetElement,\n\tgetConfig,\n\twithSyncEvent,\n\twithScope,\n} from '@wordpress/interactivity';\nimport { IMAGE_PRELOAD_DELAY } from './constants';\n\n/**\n * Tracks whether user is touching screen; used to differentiate behavior for\n * touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/**\n * Tracks the last time the screen was touched; used to differentiate behavior\n * for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\nconst touchStartEvent = {\n\tstartX: 0,\n\tstartY: 0,\n\tstartTime: 0,\n};\n\n/**\n * Elements made inert while the lightbox is open, so only those are restored\n * when it closes.\n *\n * @type {Element[]}\n */\nlet inertElements = [];\n\nconst focusableSelectors = [\n\t'.wp-lightbox-close-button',\n\t'.wp-lightbox-navigation-button',\n];\n\n/**\n * Returns the appropriate src URL for an image.\n *\n * @param {string} uploadedSrc - Full size image src.\n * @return {string} The source URL.\n */\nfunction getImageSrc( { uploadedSrc } ) {\n\treturn (\n\t\tuploadedSrc ||\n\t\t'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='\n\t);\n}\n\n/**\n * Returns the appropriate srcset for an image.\n *\n * @param {string} lightboxSrcset - Image srcset.\n * @return {string} The srcset value.\n */\nfunction getImageSrcset( { lightboxSrcset } ) {\n\treturn lightboxSrcset || '';\n}\n\nconst { state, actions, callbacks } = store(\n\t'core/image',\n\t{\n\t\tstate: {\n\t\t\tselectedImageId: null,\n\t\t\tselectedGalleryId: null,\n\t\t\tpreloadTimers: new Map(),\n\t\t\tpreloadedImageIds: new Set(),\n\t\t\tget galleryImages() {\n\t\t\t\tif ( ! state.selectedGalleryId ) {\n\t\t\t\t\treturn [ state.selectedImageId ];\n\t\t\t\t}\n\n\t\t\t\t// Get all images in this gallery and sort by galleryOrder\n\t\t\t\treturn Object.entries( state.metadata )\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( [ , value ] ) =>\n\t\t\t\t\t\t\tvalue.galleryId === state.selectedGalleryId\n\t\t\t\t\t)\n\t\t\t\t\t.sort( ( [ , a ], [ , b ] ) => {\n\t\t\t\t\t\tconst orderA = a.order ?? 0;\n\t\t\t\t\t\tconst orderB = b.order ?? 0;\n\t\t\t\t\t\treturn orderA - orderB;\n\t\t\t\t\t} )\n\t\t\t\t\t.map( ( [ key ] ) => key );\n\t\t\t},\n\t\t\tget selectedImageIndex() {\n\t\t\t\treturn state.galleryImages.findIndex(\n\t\t\t\t\t( id ) => id === state.selectedImageId\n\t\t\t\t);\n\t\t\t},\n\t\t\tget selectedImage() {\n\t\t\t\treturn state.metadata[ state.selectedImageId ];\n\t\t\t},\n\t\t\tget hasNavigationIcon() {\n\t\t\t\tconst { navigationButtonType } = state.selectedImage;\n\t\t\t\treturn (\n\t\t\t\t\tnavigationButtonType === 'icon' ||\n\t\t\t\t\tnavigationButtonType === 'both'\n\t\t\t\t);\n\t\t\t},\n\t\t\tget hasNavigationText() {\n\t\t\t\tconst { navigationButtonType } = state.selectedImage;\n\t\t\t\treturn (\n\t\t\t\t\tnavigationButtonType === 'text' ||\n\t\t\t\t\tnavigationButtonType === 'both'\n\t\t\t\t);\n\t\t\t},\n\t\t\tget thisImage() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\treturn state.metadata[ imageId ];\n\t\t\t},\n\t\t\tget hasNavigation() {\n\t\t\t\treturn state.galleryImages.length > 1;\n\t\t\t},\n\t\t\tget hasNextImage() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.selectedImageIndex + 1 < state.galleryImages.length\n\t\t\t\t);\n\t\t\t},\n\t\t\tget hasPreviousImage() {\n\t\t\t\treturn state.selectedImageIndex - 1 >= 0;\n\t\t\t},\n\t\t\tget overlayOpened() {\n\t\t\t\treturn state.selectedImageId !== null;\n\t\t\t},\n\t\t\tget roleAttribute() {\n\t\t\t\treturn state.overlayOpened ? 'dialog' : null;\n\t\t\t},\n\t\t\tget ariaModal() {\n\t\t\t\treturn state.overlayOpened ? 'true' : null;\n\t\t\t},\n\t\t\tget ariaLabel() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.selectedImage.customAriaLabel ||\n\t\t\t\t\tgetConfig().defaultAriaLabel\n\t\t\t\t);\n\t\t\t},\n\t\t\tget closeButtonAriaLabel() {\n\t\t\t\treturn state.hasNavigationText\n\t\t\t\t\t? undefined\n\t\t\t\t\t: getConfig().closeButtonText;\n\t\t\t},\n\t\t\tget prevButtonAriaLabel() {\n\t\t\t\treturn state.hasNavigationText\n\t\t\t\t\t? undefined\n\t\t\t\t\t: getConfig().prevButtonText;\n\t\t\t},\n\t\t\tget nextButtonAriaLabel() {\n\t\t\t\treturn state.hasNavigationText\n\t\t\t\t\t? undefined\n\t\t\t\t\t: getConfig().nextButtonText;\n\t\t\t},\n\t\t\tget enlargedSrc() {\n\t\t\t\treturn getImageSrc( state.selectedImage );\n\t\t\t},\n\t\t\tget enlargedSrcset() {\n\t\t\t\treturn getImageSrcset( state.selectedImage );\n\t\t\t},\n\t\t\tget figureStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.selectedImage.figureStyles?.replace(\n\t\t\t\t\t\t/margin[^;]*;?/g,\n\t\t\t\t\t\t''\n\t\t\t\t\t) };`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget imgStyles() {\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayOpened &&\n\t\t\t\t\t`${ state.selectedImage.imgStyles?.replace(\n\t\t\t\t\t\t/;$/,\n\t\t\t\t\t\t''\n\t\t\t\t\t) }; object-fit:cover;`\n\t\t\t\t);\n\t\t\t},\n\t\t\tget isContentHidden() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\tstate.overlayEnabled &&\n\t\t\t\t\tstate.selectedImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t\tget isContentVisible() {\n\t\t\t\tconst ctx = getContext();\n\t\t\t\treturn (\n\t\t\t\t\t! state.overlayEnabled &&\n\t\t\t\t\tstate.selectedImageId === ctx.imageId\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tshowLightbox() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\t// Bails out if the image has not loaded yet.\n\t\t\t\tif ( ! state.metadata[ imageId ].imageRef?.complete ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Stores the positions of the scroll to fix it until the overlay is\n\t\t\t\t// closed.\n\t\t\t\tstate.scrollTopReset = document.documentElement.scrollTop;\n\t\t\t\tstate.scrollLeftReset = document.documentElement.scrollLeft;\n\n\t\t\t\t// Sets the selected image and gallery and enables the overlay.\n\t\t\t\tstate.selectedImageId = imageId;\n\t\t\t\tconst { galleryId } = getContext( 'core/gallery' ) || {};\n\t\t\t\tstate.selectedGalleryId = galleryId || null;\n\t\t\t\tstate.overlayEnabled = true;\n\n\t\t\t\t// Computes the styles of the overlay for the animation.\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t},\n\t\t\thideLightbox() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tstate.overlayEnabled = false;\n\n\t\t\t\t\t// Waits until the close animation has completed before allowing a\n\t\t\t\t\t// user to scroll again. The duration of this animation is defined in\n\t\t\t\t\t// the `styles.scss` file, but in any case we should wait a few\n\t\t\t\t\t// milliseconds longer than the duration, otherwise a user may scroll\n\t\t\t\t\t// too soon and cause the animation to look sloppy.\n\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t// Delays before changing the focus. Otherwise the focus ring will\n\t\t\t\t\t\t// appear on Firefox before the image has finished animating, which\n\t\t\t\t\t\t// looks broken.\n\t\t\t\t\t\tstate.selectedImage.buttonRef.focus( {\n\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t// Resets the selected image and gallery ids.\n\t\t\t\t\t\tstate.selectedImageId = null;\n\t\t\t\t\t\tstate.selectedGalleryId = null;\n\t\t\t\t\t}, 450 );\n\t\t\t\t}\n\t\t\t},\n\t\t\tshowPreviousImage: withSyncEvent( ( event ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tconst nextIndex = state.hasPreviousImage\n\t\t\t\t\t? state.selectedImageIndex - 1\n\t\t\t\t\t: state.galleryImages.length - 1;\n\t\t\t\tstate.selectedImageId = state.galleryImages[ nextIndex ];\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t} ),\n\t\t\tshowNextImage: withSyncEvent( ( event ) => {\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tconst nextIndex = state.hasNextImage\n\t\t\t\t\t? state.selectedImageIndex + 1\n\t\t\t\t\t: 0;\n\t\t\t\tstate.selectedImageId = state.galleryImages[ nextIndex ];\n\t\t\t\tcallbacks.setOverlayStyles();\n\t\t\t} ),\n\t\t\thandleKeydown: withSyncEvent( ( event ) => {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tif ( event.key === 'Escape' ) {\n\t\t\t\t\t\tactions.hideLightbox();\n\t\t\t\t\t} else if ( event.key === 'ArrowLeft' ) {\n\t\t\t\t\t\tactions.showPreviousImage( event );\n\t\t\t\t\t} else if ( event.key === 'ArrowRight' ) {\n\t\t\t\t\t\tactions.showNextImage( event );\n\t\t\t\t\t} else if ( event.key === 'Tab' ) {\n\t\t\t\t\t\t// Traps focus within the overlay.\n\t\t\t\t\t\tconst focusableElements = Array.from(\n\t\t\t\t\t\t\tdocument.querySelectorAll( focusableSelectors )\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst firstFocusableElement = focusableElements[ 0 ];\n\t\t\t\t\t\tconst lastFocusableElement =\n\t\t\t\t\t\t\tfocusableElements[ focusableElements.length - 1 ];\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\tevent.target === firstFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tlastFocusableElement.focus();\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\tevent.target === lastFocusableElement\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tfirstFocusableElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchMove: withSyncEvent( ( event ) => {\n\t\t\t\t// On mobile devices, prevents triggering the scroll event because\n\t\t\t\t// otherwise the page jumps around when it resets the scroll position.\n\t\t\t\t// This also means that closing the lightbox requires that a user\n\t\t\t\t// perform a simple tap. This may be changed in the future if there is a\n\t\t\t\t// better alternative to override or reset the scroll position during\n\t\t\t\t// swipe actions.\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} ),\n\t\t\thandleTouchStart( event ) {\n\t\t\t\tisTouching = true;\n\t\t\t\tconst t = event.touches && event.touches[ 0 ];\n\t\t\t\tif ( t ) {\n\t\t\t\t\ttouchStartEvent.startX = t.clientX;\n\t\t\t\t\ttouchStartEvent.startY = t.clientY;\n\t\t\t\t\ttouchStartEvent.startTime = Date.now();\n\t\t\t\t}\n\t\t\t},\n\t\t\thandleTouchEnd: withSyncEvent( ( event ) => {\n\t\t\t\tconst touchEndEvent =\n\t\t\t\t\t( event.changedTouches && event.changedTouches[ 0 ] ) ||\n\t\t\t\t\t( event.touches && event.touches[ 0 ] );\n\t\t\t\tconst now = Date.now();\n\n\t\t\t\tif ( touchEndEvent && state.overlayEnabled ) {\n\t\t\t\t\tconst deltaX =\n\t\t\t\t\t\ttouchEndEvent.clientX - touchStartEvent.startX;\n\t\t\t\t\tconst deltaY =\n\t\t\t\t\t\ttouchEndEvent.clientY - touchStartEvent.startY;\n\t\t\t\t\tconst absDeltaX = Math.abs( deltaX );\n\t\t\t\t\tconst absDeltaY = Math.abs( deltaY );\n\t\t\t\t\tconst elapsedMs = now - touchStartEvent.startTime;\n\t\t\t\t\tconst isHorizontalSwipe =\n\t\t\t\t\t\t// Swipe distance is greater than 50px\n\t\t\t\t\t\tabsDeltaX > 50 &&\n\t\t\t\t\t\t// Horizontal movement is much larger than the vertical movement\n\t\t\t\t\t\tabsDeltaX > absDeltaY * 1.5 &&\n\t\t\t\t\t\t// Fast action of less than 800ms\n\t\t\t\t\t\telapsedMs < 800;\n\n\t\t\t\t\tif ( isHorizontalSwipe ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tif ( deltaX < 0 ) {\n\t\t\t\t\t\t\tactions.showNextImage( event );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tactions.showPreviousImage( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tlastTouchTime = now;\n\t\t\t\tisTouching = false;\n\t\t\t} ),\n\t\t\thandleScroll() {\n\t\t\t\t// Prevents scrolling behaviors that trigger content shift while the\n\t\t\t\t// lightbox is open. It would be better to accomplish through CSS alone,\n\t\t\t\t// but using overflow: hidden is currently the only way to do so and\n\t\t\t\t// that causes a layout to shift and prevents the zoom animation from\n\t\t\t\t// working in some cases because it's not possible to account for the\n\t\t\t\t// layout shift when doing the animation calculations. Instead, it uses\n\t\t\t\t// JavaScript to prevent and reset the scrolling behavior.\n\t\t\t\tif ( state.overlayOpened ) {\n\t\t\t\t\t// Avoids overriding the scroll behavior on mobile devices because\n\t\t\t\t\t// doing so breaks the pinch to zoom functionality, and users should\n\t\t\t\t\t// be able to zoom in further on the high-res image.\n\t\t\t\t\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t\t\t\t\t// It doesn't rely on `event.preventDefault()` to prevent scrolling\n\t\t\t\t\t\t// because the scroll event can't be canceled, so it resets the\n\t\t\t\t\t\t// position instead.\n\t\t\t\t\t\twindow.scrollTo(\n\t\t\t\t\t\t\tstate.scrollLeftReset,\n\t\t\t\t\t\t\tstate.scrollTopReset\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tpreloadImage() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\t// Bails if it has already been preloaded. This could help\n\t\t\t\t// prevent unnecessary preloading of the same image multiple times,\n\t\t\t\t// leading to duplicate link elements in the document head.\n\t\t\t\tif ( state.preloadedImageIds.has( imageId ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Link element to preload the image.\n\t\t\t\tconst imageMetadata = state.metadata[ imageId ];\n\t\t\t\tconst imageLink = document.createElement( 'link' );\n\t\t\t\timageLink.rel = 'preload';\n\t\t\t\timageLink.as = 'image';\n\t\t\t\timageLink.href = getImageSrc( imageMetadata );\n\n\t\t\t\t// Apply srcset if available for responsive preloading\n\t\t\t\tconst srcset = getImageSrcset( imageMetadata );\n\t\t\t\tif ( srcset ) {\n\t\t\t\t\timageLink.setAttribute( 'imagesrcset', srcset );\n\t\t\t\t\timageLink.setAttribute( 'imagesizes', '100vw' );\n\t\t\t\t}\n\n\t\t\t\tdocument.head.appendChild( imageLink );\n\t\t\t\tstate.preloadedImageIds.add( imageId );\n\t\t\t},\n\t\t\tpreloadImageWithDelay() {\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\tactions.cancelPreload();\n\n\t\t\t\t// Set a new timer to preload the image after a short delay.\n\t\t\t\tconst timerId = setTimeout(\n\t\t\t\t\twithScope( () => {\n\t\t\t\t\t\tactions.preloadImage();\n\t\t\t\t\t\tstate.preloadTimers.delete( imageId );\n\t\t\t\t\t} ),\n\t\t\t\t\tIMAGE_PRELOAD_DELAY\n\t\t\t\t);\n\t\t\t\tstate.preloadTimers.set( imageId, timerId );\n\t\t\t},\n\t\t\tcancelPreload() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tif ( state.preloadTimers.has( imageId ) ) {\n\t\t\t\t\tclearTimeout( state.preloadTimers.get( imageId ) );\n\t\t\t\t\tstate.preloadTimers.delete( imageId );\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\tsetOverlayStyles() {\n\t\t\t\tif ( ! state.overlayEnabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth: originalWidth,\n\t\t\t\t\toffsetHeight: originalHeight,\n\t\t\t\t} = state.selectedImage.imageRef;\n\t\t\t\tlet { x: screenPosX, y: screenPosY } =\n\t\t\t\t\tstate.selectedImage.imageRef.getBoundingClientRect();\n\n\t\t\t\t// Natural ratio of the image clicked to open the lightbox.\n\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t// Original ratio of the image clicked to open the lightbox.\n\t\t\t\tconst originalRatio = originalWidth / originalHeight;\n\n\t\t\t\t// If it has object-fit: contain, recalculates the original sizes\n\t\t\t\t// and the screen position without the blank spaces.\n\t\t\t\tif ( state.selectedImage.scaleAttr === 'contain' ) {\n\t\t\t\t\tif ( naturalRatio > originalRatio ) {\n\t\t\t\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the top space.\n\t\t\t\t\t\tscreenPosY +=\n\t\t\t\t\t\t\t( originalHeight - heightWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalHeight = heightWithoutSpace;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t\t\t\t// Recalculates screen position without the left space.\n\t\t\t\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\t\t\t\toriginalWidth = widthWithoutSpace;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Typically, it uses the image's full-sized dimensions. If those\n\t\t\t\t// dimensions have not been set (i.e. an external image with only one\n\t\t\t\t// size), the image's dimensions in the lightbox are the same\n\t\t\t\t// as those of the image in the content.\n\t\t\t\tconst imgMaxWidth = parseFloat(\n\t\t\t\t\tstate.selectedImage.targetWidth &&\n\t\t\t\t\t\tstate.selectedImage.targetWidth !== 'none'\n\t\t\t\t\t\t? state.selectedImage.targetWidth\n\t\t\t\t\t\t: naturalWidth\n\t\t\t\t);\n\t\t\t\tconst imgMaxHeight = parseFloat(\n\t\t\t\t\tstate.selectedImage.targetHeight &&\n\t\t\t\t\t\tstate.selectedImage.targetHeight !== 'none'\n\t\t\t\t\t\t? state.selectedImage.targetHeight\n\t\t\t\t\t\t: naturalHeight\n\t\t\t\t);\n\n\t\t\t\t// Ratio of the biggest image stored in the database.\n\t\t\t\tconst fullSizeRatio = imgMaxWidth / imgMaxHeight;\n\t\t\t\tlet containerWidth = imgMaxWidth;\n\t\t\t\tlet containerHeight = imgMaxHeight;\n\n\t\t\t\t// If the image has been pixelated on purpose, it keeps that size.\n\t\t\t\tif (\n\t\t\t\t\toriginalWidth > containerWidth ||\n\t\t\t\t\toriginalHeight > containerHeight\n\t\t\t\t) {\n\t\t\t\t\tcontainerWidth = originalWidth;\n\t\t\t\t\tcontainerHeight = originalHeight;\n\t\t\t\t}\n\n\t\t\t\t// Calculates the final lightbox image size and the scale factor.\n\t\t\t\t// MaxWidth is either the window container (accounting for padding) or\n\t\t\t\t// the image resolution.\n\n\t\t\t\t// 480px width or less\n\t\t\t\tlet horizontalPadding = 0;\n\t\t\t\tlet verticalPadding = 160;\n\t\t\t\t// Greater than 480px wide and less than or equal to 960px\n\t\t\t\tif ( 480 < window.innerWidth ) {\n\t\t\t\t\thorizontalPadding = 80;\n\t\t\t\t\tverticalPadding = 160;\n\t\t\t\t}\n\t\t\t\t// Greater than 960px wide\n\t\t\t\tif ( 960 < window.innerWidth ) {\n\t\t\t\t\thorizontalPadding = state.hasNavigation ? 320 : 80;\n\t\t\t\t\tverticalPadding = 80;\n\t\t\t\t}\n\n\t\t\t\tconst targetMaxWidth = Math.min(\n\t\t\t\t\twindow.innerWidth - horizontalPadding,\n\t\t\t\t\tcontainerWidth\n\t\t\t\t);\n\t\t\t\tconst targetMaxHeight = Math.min(\n\t\t\t\t\twindow.innerHeight - verticalPadding,\n\t\t\t\t\tcontainerHeight\n\t\t\t\t);\n\t\t\t\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\t\t\t\tif ( fullSizeRatio > targetContainerRatio ) {\n\t\t\t\t\t// If targetMaxWidth is reached before targetMaxHeight.\n\t\t\t\t\tcontainerWidth = targetMaxWidth;\n\t\t\t\t\tcontainerHeight = containerWidth / fullSizeRatio;\n\t\t\t\t} else {\n\t\t\t\t\t// If targetMaxHeight is reached before targetMaxWidth.\n\t\t\t\t\tcontainerHeight = targetMaxHeight;\n\t\t\t\t\tcontainerWidth = containerHeight * fullSizeRatio;\n\t\t\t\t}\n\n\t\t\t\tconst hasCroppedSource =\n\t\t\t\t\tnaturalRatio.toFixed( 2 ) !== fullSizeRatio.toFixed( 2 );\n\t\t\t\tconst sourceRatio = hasCroppedSource\n\t\t\t\t\t? naturalRatio\n\t\t\t\t\t: fullSizeRatio;\n\n\t\t\t\t// Include any crop already applied to the thumbnail file.\n\t\t\t\tconst containerScale = Math.max(\n\t\t\t\t\toriginalWidth / containerWidth,\n\t\t\t\t\toriginalHeight / containerHeight,\n\t\t\t\t\toriginalWidth / ( containerHeight * sourceRatio ),\n\t\t\t\t\t( originalHeight * sourceRatio ) / containerWidth\n\t\t\t\t);\n\t\t\t\tconst thumbnailWidth = originalWidth / containerScale;\n\t\t\t\tconst thumbnailHeight = originalHeight / containerScale;\n\t\t\t\tconst cropX = ( containerWidth - thumbnailWidth ) / 2;\n\t\t\t\tconst cropY = ( containerHeight - thumbnailHeight ) / 2;\n\t\t\t\tscreenPosX -= cropX * containerScale;\n\t\t\t\tscreenPosY -= cropY * containerScale;\n\n\t\t\t\t// As of this writing, using the calculations above will render the\n\t\t\t\t// lightbox with a small, erroneous whitespace on the left side of the\n\t\t\t\t// image in iOS Safari, perhaps due to an inconsistency in how browsers\n\t\t\t\t// handle absolute positioning and CSS transformation. In any case,\n\t\t\t\t// adding 1 pixel to the container width and height solves the problem,\n\t\t\t\t// though this can be removed if the issue is fixed in the future.\n\t\t\t\tstate.overlayStyles = `\n\t\t\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t\t\t--wp--lightbox-image-width: ${ containerWidth }px;\n\t\t\t\t\t--wp--lightbox-image-height: ${ containerHeight }px;\n\t\t\t\t\t--wp--lightbox-initial-clip: inset(${ cropY }px ${ cropX }px);\n\t\t\t\t\t--wp--lightbox-thumbnail-width: ${\n\t\t\t\t\t\thasCroppedSource ? thumbnailWidth : containerWidth\n\t\t\t\t\t}px;\n\t\t\t\t\t--wp--lightbox-thumbnail-height: ${\n\t\t\t\t\t\thasCroppedSource ? thumbnailHeight : containerHeight\n\t\t\t\t\t}px;\n\t\t\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t\t\t\t--wp--lightbox-scrollbar-width: ${\n\t\t\t\t\t\twindow.innerWidth - document.documentElement.clientWidth\n\t\t\t\t\t}px;\n\t\t\t\t`;\n\t\t\t},\n\t\t\tsetButtonStyles() {\n\t\t\t\tconst { ref } = getElement();\n\n\t\t\t\t// This guard prevents errors in images with the `srcset`\n\t\t\t\t// attribute, which can dispatch `load` events even after DOM\n\t\t\t\t// removal. Preact doesn't automatically clean up `load` event\n\t\t\t\t// listeners on unmounted `img` elements (see\n\t\t\t\t// https://github.com/preactjs/preact/issues/3141).\n\t\t\t\tif ( ! ref ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst { imageId } = getContext();\n\n\t\t\t\tstate.metadata[ imageId ].imageRef = ref;\n\t\t\t\tstate.metadata[ imageId ].currentSrc = ref.currentSrc;\n\n\t\t\t\tconst {\n\t\t\t\t\tnaturalWidth,\n\t\t\t\t\tnaturalHeight,\n\t\t\t\t\toffsetWidth,\n\t\t\t\t\toffsetHeight,\n\t\t\t\t} = ref;\n\n\t\t\t\t// If the image isn't loaded yet, it can't calculate where the button\n\t\t\t\t// should be.\n\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst figure = ref.parentElement;\n\t\t\t\tconst figureWidth = ref.parentElement.clientWidth;\n\n\t\t\t\t// It needs special handling for the height because a caption will cause\n\t\t\t\t// the figure to be taller than the image, which means it needs to\n\t\t\t\t// account for that when calculating the placement of the button in the\n\t\t\t\t// top right corner of the image.\n\t\t\t\tlet figureHeight = ref.parentElement.clientHeight;\n\t\t\t\tconst caption = figure.querySelector( 'figcaption' );\n\t\t\t\tif ( caption ) {\n\t\t\t\t\tconst captionComputedStyle =\n\t\t\t\t\t\twindow.getComputedStyle( caption );\n\t\t\t\t\tif (\n\t\t\t\t\t\t! [ 'absolute', 'fixed' ].includes(\n\t\t\t\t\t\t\tcaptionComputedStyle.position\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfigureHeight =\n\t\t\t\t\t\t\tfigureHeight -\n\t\t\t\t\t\t\tcaption.offsetHeight -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginTop ) -\n\t\t\t\t\t\t\tparseFloat( captionComputedStyle.marginBottom );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst buttonOffsetTop = figureHeight - offsetHeight;\n\t\t\t\tconst buttonOffsetRight = figureWidth - offsetWidth;\n\n\t\t\t\tlet buttonTop = buttonOffsetTop + 16;\n\t\t\t\tlet buttonRight = buttonOffsetRight + 16;\n\n\t\t\t\t// In the case of an image with object-fit: contain, the size of the\n\t\t\t\t// <img> element can be larger than the image itself, so it needs to\n\t\t\t\t// calculate where to place the button.\n\t\t\t\tif ( state.metadata[ imageId ].scaleAttr === 'contain' ) {\n\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\tif ( naturalRatio >= offsetRatio ) {\n\t\t\t\t\t\t// If it reaches the width first, it keeps the width and compute the\n\t\t\t\t\t\t// height.\n\t\t\t\t\t\tconst referenceHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\tbuttonTop =\n\t\t\t\t\t\t\t( offsetHeight - referenceHeight ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetTop +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t\tbuttonRight = buttonOffsetRight + 16;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If it reaches the height first, it keeps the height and compute\n\t\t\t\t\t\t// the width.\n\t\t\t\t\t\tconst referenceWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\tbuttonTop = buttonOffsetTop + 16;\n\t\t\t\t\t\tbuttonRight =\n\t\t\t\t\t\t\t( offsetWidth - referenceWidth ) / 2 +\n\t\t\t\t\t\t\tbuttonOffsetRight +\n\t\t\t\t\t\t\t16;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tstate.metadata[ imageId ].buttonTop = buttonTop;\n\t\t\t\tstate.metadata[ imageId ].buttonRight = buttonRight;\n\t\t\t},\n\t\t\tsetOverlayFocus() {\n\t\t\t\tif ( state.overlayEnabled ) {\n\t\t\t\t\t// Moves the focus to the dialog when it opens.\n\t\t\t\t\tconst { ref } = getElement();\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t},\n\t\t\tsetInertElements() {\n\t\t\t\tif ( ! state.overlayEnabled ) {\n\t\t\t\t\tinertElements.forEach( ( el ) =>\n\t\t\t\t\t\tel.removeAttribute( 'inert' )\n\t\t\t\t\t);\n\t\t\t\t\tinertElements = [];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Inerts the overlay's siblings at each level, not its ancestors.\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tlet node = ref;\n\t\t\t\twhile ( node && node !== document.body && node.parentElement ) {\n\t\t\t\t\tfor ( const sibling of node.parentElement.children ) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tsibling !== node &&\n\t\t\t\t\t\t\t! sibling.hasAttribute( 'inert' )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsibling.setAttribute( 'inert', '' );\n\t\t\t\t\t\t\tinertElements.push( sibling );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnode = node.parentElement;\n\t\t\t\t}\n\t\t\t},\n\t\t\tinitTriggerButton() {\n\t\t\t\tconst { imageId } = getContext();\n\t\t\t\tconst { ref } = getElement();\n\t\t\t\tstate.metadata[ imageId ].buttonRef = ref;\n\t\t\t},\n\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
"align": true,
|
|
34
|
+
"background": {
|
|
35
|
+
"backgroundImage": true,
|
|
36
|
+
"backgroundSize": true,
|
|
37
|
+
"gradient": true,
|
|
38
|
+
"__experimentalDefaultControls": {
|
|
39
|
+
"backgroundImage": true,
|
|
40
|
+
"gradient": true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
34
43
|
"color": {
|
|
35
44
|
"gradients": true,
|
|
36
45
|
"link": true,
|
|
@@ -40,11 +49,22 @@
|
|
|
40
49
|
"link": true
|
|
41
50
|
}
|
|
42
51
|
},
|
|
52
|
+
"dimensions": {
|
|
53
|
+
"minHeight": true,
|
|
54
|
+
"minWidth": true
|
|
55
|
+
},
|
|
43
56
|
"html": false,
|
|
44
57
|
"spacing": {
|
|
45
58
|
"margin": true,
|
|
46
59
|
"padding": true
|
|
47
60
|
},
|
|
61
|
+
"__experimentalBorder": {
|
|
62
|
+
"color": true,
|
|
63
|
+
"radius": true,
|
|
64
|
+
"style": true,
|
|
65
|
+
"width": true
|
|
66
|
+
},
|
|
67
|
+
"shadow": true,
|
|
48
68
|
"typography": {
|
|
49
69
|
"fontSize": true,
|
|
50
70
|
"lineHeight": true,
|
|
@@ -79,6 +79,15 @@
|
|
|
79
79
|
"align": true,
|
|
80
80
|
"html": false,
|
|
81
81
|
"layout": true,
|
|
82
|
+
"background": {
|
|
83
|
+
"backgroundImage": true,
|
|
84
|
+
"backgroundSize": true,
|
|
85
|
+
"gradient": true,
|
|
86
|
+
"__experimentalDefaultControls": {
|
|
87
|
+
"backgroundImage": true,
|
|
88
|
+
"gradient": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
82
91
|
"color": {
|
|
83
92
|
"gradients": true,
|
|
84
93
|
"link": true,
|
|
@@ -88,6 +97,10 @@
|
|
|
88
97
|
"link": true
|
|
89
98
|
}
|
|
90
99
|
},
|
|
100
|
+
"dimensions": {
|
|
101
|
+
"minHeight": true,
|
|
102
|
+
"minWidth": true
|
|
103
|
+
},
|
|
91
104
|
"spacing": {
|
|
92
105
|
"margin": true,
|
|
93
106
|
"padding": true,
|
|
@@ -123,6 +136,7 @@
|
|
|
123
136
|
"style": true
|
|
124
137
|
}
|
|
125
138
|
},
|
|
139
|
+
"shadow": true,
|
|
126
140
|
"interactivity": {
|
|
127
141
|
"clientNavigation": true
|
|
128
142
|
}
|
package/build/list/block.json
CHANGED
|
@@ -58,6 +58,15 @@
|
|
|
58
58
|
"fontSize": true
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
|
+
"background": {
|
|
62
|
+
"backgroundImage": true,
|
|
63
|
+
"backgroundSize": true,
|
|
64
|
+
"gradient": true,
|
|
65
|
+
"__experimentalDefaultControls": {
|
|
66
|
+
"backgroundImage": true,
|
|
67
|
+
"gradient": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
61
70
|
"color": {
|
|
62
71
|
"gradients": true,
|
|
63
72
|
"link": true,
|
|
@@ -74,6 +83,7 @@
|
|
|
74
83
|
"padding": false
|
|
75
84
|
}
|
|
76
85
|
},
|
|
86
|
+
"shadow": true,
|
|
77
87
|
"__unstablePasteTextInline": true,
|
|
78
88
|
"__experimentalOnMerge": true,
|
|
79
89
|
"__experimentalSlashInserter": true,
|
|
@@ -83,7 +93,8 @@
|
|
|
83
93
|
"listView": true
|
|
84
94
|
},
|
|
85
95
|
"selectors": {
|
|
86
|
-
"border": ".wp-block-list:not(.wp-block-list .wp-block-list)"
|
|
96
|
+
"border": ".wp-block-list:not(.wp-block-list .wp-block-list)",
|
|
97
|
+
"shadow": ".wp-block-list:not(.wp-block-list .wp-block-list)"
|
|
87
98
|
},
|
|
88
99
|
"editorStyle": "wp-block-list-editor",
|
|
89
100
|
"style": "wp-block-list"
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"html": false,
|
|
25
25
|
"className": false,
|
|
26
26
|
"splitting": true,
|
|
27
|
+
"background": {
|
|
28
|
+
"backgroundImage": true,
|
|
29
|
+
"backgroundSize": true,
|
|
30
|
+
"gradient": true
|
|
31
|
+
},
|
|
27
32
|
"__experimentalBorder": {
|
|
28
33
|
"color": true,
|
|
29
34
|
"radius": true,
|
|
@@ -46,6 +51,7 @@
|
|
|
46
51
|
"padding": false
|
|
47
52
|
}
|
|
48
53
|
},
|
|
54
|
+
"shadow": true,
|
|
49
55
|
"typography": {
|
|
50
56
|
"fontSize": true,
|
|
51
57
|
"lineHeight": true,
|
|
@@ -65,6 +71,7 @@
|
|
|
65
71
|
},
|
|
66
72
|
"selectors": {
|
|
67
73
|
"root": ".wp-block-list > li",
|
|
68
|
-
"border": ".wp-block-list:not(.wp-block-list .wp-block-list) > li"
|
|
74
|
+
"border": ".wp-block-list:not(.wp-block-list .wp-block-list) > li",
|
|
75
|
+
"shadow": ".wp-block-list:not(.wp-block-list .wp-block-list) > li"
|
|
69
76
|
}
|
|
70
77
|
}
|
|
@@ -38,15 +38,19 @@ __export(list_item_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(list_item_exports);
|
|
39
39
|
var import_icons = require("@wordpress/icons");
|
|
40
40
|
var import_block_editor = require("@wordpress/block-editor");
|
|
41
|
+
var import_blocks = require("@wordpress/blocks");
|
|
41
42
|
var import_init_block = __toESM(require("../utils/init-block.cjs"));
|
|
42
43
|
var import_block = __toESM(require("./block.json"));
|
|
43
44
|
var import_edit = __toESM(require("./edit.cjs"));
|
|
44
45
|
var import_save = __toESM(require("./save.cjs"));
|
|
45
46
|
var import_transforms = __toESM(require("./transforms.cjs"));
|
|
46
47
|
var import_lock_unlock = require("../lock-unlock.cjs");
|
|
48
|
+
var { editableRootKey } = (0, import_lock_unlock.unlock)(import_blocks.privateApis);
|
|
47
49
|
var { name } = import_block.default;
|
|
48
50
|
var settings = {
|
|
49
51
|
icon: import_icons.listItem,
|
|
52
|
+
// Opt into the editing host behaviour privately, like the paragraph.
|
|
53
|
+
[editableRootKey]: true,
|
|
50
54
|
edit: import_edit.default,
|
|
51
55
|
save: import_save.default,
|
|
52
56
|
merge(attributes, attributesToMerge) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/list-item/index.js"],
|
|
4
|
-
"sourcesContent": ["import { listItem as icon } from '@wordpress/icons';\nimport { privateApis } from '@wordpress/block-editor';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\t...attributes,\n\t\t\tcontent: attributes.content + attributesToMerge.content,\n\t\t};\n\t},\n\ttransforms,\n\t[ unlock( privateApis ).requiresWrapperOnCopy ]: true,\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { content } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = content?.trim().length > 0;\n\n\t\t// In the list view, use the block's content as the label.\n\t\t// If the content is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || content;\n\t\t}\n\n\t\tif ( context === 'breadcrumb' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,0BAA4B;AAC5B,wBAAsB;AACtB,mBAAqB;AACrB,kBAAiB;AACjB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,KAAK,IAAI,
|
|
6
|
-
"names": ["metadata", "icon", "edit", "save", "transforms", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["import { listItem as icon } from '@wordpress/icons';\nimport { privateApis } from '@wordpress/block-editor';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { editableRootKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\t// Opt into the editing host behaviour privately, like the paragraph.\n\t[ editableRootKey ]: true,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\t...attributes,\n\t\t\tcontent: attributes.content + attributesToMerge.content,\n\t\t};\n\t},\n\ttransforms,\n\t[ unlock( privateApis ).requiresWrapperOnCopy ]: true,\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { content } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = content?.trim().length > 0;\n\n\t\t// In the list view, use the block's content as the label.\n\t\t// If the content is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || content;\n\t\t}\n\n\t\tif ( context === 'breadcrumb' && customName ) {\n\t\t\treturn customName;\n\t\t}\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,0BAA4B;AAC5B,oBAAiD;AACjD,wBAAsB;AACtB,mBAAqB;AACrB,kBAAiB;AACjB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,gBAAgB,QAAI,2BAAQ,cAAAC,WAAkB;AAEtD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA;AAAA,EAEA,CAAE,eAAgB,GAAG;AAAA,EACrB,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,GAAG;AAAA,MACH,SAAS,WAAW,UAAU,kBAAkB;AAAA,IACjD;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,KAAE,2BAAQ,+BAAY,EAAE,qBAAsB,GAAG;AAAA,EACjD,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,QAAQ,IAAI;AAEpB,UAAM,aAAa,YAAY,UAAU;AACzC,UAAM,aAAa,SAAS,KAAK,EAAE,SAAS;AAI5C,QAAK,YAAY,gBAAiB,cAAc,aAAe;AAC9D,aAAO,cAAc;AAAA,IACtB;AAEA,QAAK,YAAY,gBAAgB,YAAa;AAC7C,aAAO;AAAA,IACR;AAAA,EACD;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "blocksPrivateApis", "icon", "edit", "save", "transforms", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -23,12 +23,25 @@
|
|
|
23
23
|
"supports": {
|
|
24
24
|
"anchor": true,
|
|
25
25
|
"className": true,
|
|
26
|
+
"background": {
|
|
27
|
+
"backgroundImage": true,
|
|
28
|
+
"backgroundSize": true,
|
|
29
|
+
"gradient": true,
|
|
30
|
+
"__experimentalDefaultControls": {
|
|
31
|
+
"backgroundImage": true,
|
|
32
|
+
"gradient": true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
26
35
|
"color": {
|
|
27
36
|
"background": true,
|
|
28
37
|
"text": false,
|
|
29
38
|
"gradients": true,
|
|
30
39
|
"link": true
|
|
31
40
|
},
|
|
41
|
+
"dimensions": {
|
|
42
|
+
"minHeight": true,
|
|
43
|
+
"minWidth": true
|
|
44
|
+
},
|
|
32
45
|
"spacing": {
|
|
33
46
|
"margin": true,
|
|
34
47
|
"padding": true,
|
|
@@ -56,6 +69,7 @@
|
|
|
56
69
|
"width": true,
|
|
57
70
|
"style": true
|
|
58
71
|
},
|
|
72
|
+
"shadow": true,
|
|
59
73
|
"interactivity": {
|
|
60
74
|
"clientNavigation": true
|
|
61
75
|
}
|
package/build/math/block.json
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
"style": true,
|
|
17
17
|
"width": true
|
|
18
18
|
},
|
|
19
|
+
"background": {
|
|
20
|
+
"backgroundImage": true,
|
|
21
|
+
"backgroundSize": true,
|
|
22
|
+
"gradient": true,
|
|
23
|
+
"__experimentalDefaultControls": {
|
|
24
|
+
"backgroundImage": true,
|
|
25
|
+
"gradient": true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
19
28
|
"color": {
|
|
20
29
|
"gradients": true,
|
|
21
30
|
"__experimentalDefaultControls": {
|
|
@@ -23,6 +32,11 @@
|
|
|
23
32
|
"text": true
|
|
24
33
|
}
|
|
25
34
|
},
|
|
35
|
+
"dimensions": {
|
|
36
|
+
"minHeight": true,
|
|
37
|
+
"minWidth": true
|
|
38
|
+
},
|
|
39
|
+
"shadow": true,
|
|
26
40
|
"spacing": {
|
|
27
41
|
"margin": true,
|
|
28
42
|
"padding": true,
|
|
@@ -100,6 +100,11 @@
|
|
|
100
100
|
"anchor": true,
|
|
101
101
|
"align": [ "wide", "full" ],
|
|
102
102
|
"html": false,
|
|
103
|
+
"background": {
|
|
104
|
+
"backgroundImage": true,
|
|
105
|
+
"backgroundSize": true,
|
|
106
|
+
"gradient": true
|
|
107
|
+
},
|
|
103
108
|
"__experimentalBorder": {
|
|
104
109
|
"color": true,
|
|
105
110
|
"radius": true,
|
|
@@ -116,15 +121,21 @@
|
|
|
116
121
|
"gradients": true,
|
|
117
122
|
"heading": true,
|
|
118
123
|
"link": true,
|
|
124
|
+
"button": true,
|
|
119
125
|
"__experimentalDefaultControls": {
|
|
120
126
|
"background": true,
|
|
121
127
|
"text": true
|
|
122
128
|
}
|
|
123
129
|
},
|
|
130
|
+
"dimensions": {
|
|
131
|
+
"minHeight": true,
|
|
132
|
+
"minWidth": true
|
|
133
|
+
},
|
|
124
134
|
"spacing": {
|
|
125
135
|
"margin": true,
|
|
126
136
|
"padding": true
|
|
127
137
|
},
|
|
138
|
+
"shadow": true,
|
|
128
139
|
"typography": {
|
|
129
140
|
"fontSize": true,
|
|
130
141
|
"lineHeight": true,
|
|
@@ -138,11 +149,19 @@
|
|
|
138
149
|
"fontSize": true
|
|
139
150
|
}
|
|
140
151
|
},
|
|
152
|
+
"filter": {
|
|
153
|
+
"duotone": true
|
|
154
|
+
},
|
|
141
155
|
"interactivity": {
|
|
142
156
|
"clientNavigation": true
|
|
143
157
|
},
|
|
144
158
|
"allowedBlocks": true
|
|
145
159
|
},
|
|
160
|
+
"selectors": {
|
|
161
|
+
"filter": {
|
|
162
|
+
"duotone": ".wp-block-media-text > .wp-block-media-text__media img, .wp-block-media-text > .wp-block-media-text__media video"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
146
165
|
"editorStyle": "wp-block-media-text-editor",
|
|
147
166
|
"style": "wp-block-media-text"
|
|
148
167
|
}
|
|
@@ -255,10 +255,7 @@ function Navigation({
|
|
|
255
255
|
hasSelectedStyleState
|
|
256
256
|
} = (0, import_data.useSelect)(
|
|
257
257
|
(select) => {
|
|
258
|
-
const {
|
|
259
|
-
getSettings,
|
|
260
|
-
hasSelectedStyleState: hasSelectedBlockStyleState
|
|
261
|
-
} = (0, import_lock_unlock.unlock)(select(import_block_editor.store));
|
|
258
|
+
const { getSettings, hasSelectedBlockStyleState } = select(import_block_editor.store);
|
|
262
259
|
const settings = getSettings();
|
|
263
260
|
return {
|
|
264
261
|
isPreviewMode: settings.isPreviewMode,
|