@wordpress/block-library 11.0.0 → 11.1.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 +29 -0
- package/README.md +7 -7
- package/build/accordion/block.json +4 -1
- package/build/accordion-item/block.json +7 -1
- package/build/accordion-panel/block.json +9 -1
- package/build/archives/block.json +9 -0
- package/build/archives/edit.cjs.map +3 -3
- package/build/audio/block.json +8 -0
- package/build/audio/edit.cjs.map +3 -3
- package/build/avatar/hooks.cjs.map +2 -2
- package/build/breadcrumbs/block.json +3 -0
- package/build/breadcrumbs/edit.cjs.map +3 -3
- package/build/button/edit.cjs.map +2 -2
- package/build/buttons/block.json +9 -0
- package/build/categories/block.json +12 -1
- package/build/categories/edit.cjs.map +3 -3
- package/build/code/block.json +10 -0
- package/build/code/save.cjs.map +2 -2
- package/build/column/block.json +9 -0
- package/build/columns/block.json +9 -0
- 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/comment-template/hooks.cjs.map +2 -2
- package/build/comments/block.json +10 -0
- package/build/comments-pagination/block.json +3 -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/edit/index.cjs +4 -1
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +52 -13
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/cover/transforms.cjs.map +2 -2
- package/build/details/block.json +12 -0
- package/build/details/index.cjs.map +2 -2
- package/build/embed/embed-controls.cjs.map +2 -2
- package/build/file/block.json +9 -0
- package/build/file/deprecated.cjs.map +2 -2
- package/build/file/edit.cjs.map +2 -2
- package/build/file/inspector.cjs.map +3 -3
- package/build/file/save.cjs.map +2 -2
- package/build/footnotes/block.json +10 -0
- package/build/footnotes/edit.cjs.map +2 -2
- package/build/gallery/block.json +9 -0
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +65 -39
- package/build/gallery/edit.cjs.map +3 -3
- package/build/gallery/{flex-styles.cjs → gallery-styles.cjs} +31 -32
- package/build/gallery/gallery-styles.cjs.map +7 -0
- package/build/gallery/responsive-styles.cjs +27 -5
- package/build/gallery/responsive-styles.cjs.map +2 -2
- package/build/group/block.json +1 -0
- package/build/heading/block.json +11 -0
- package/build/heading/index.cjs.map +2 -2
- package/build/home-link/block.json +18 -0
- package/build/home-link/edit.cjs.map +3 -3
- package/build/html/modal.cjs +3 -6
- package/build/html/modal.cjs.map +2 -2
- package/build/image/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 +20 -0
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/index.cjs.map +2 -2
- package/build/latest-comments/block.json +10 -0
- package/build/latest-comments/edit.cjs.map +3 -3
- package/build/latest-posts/block.json +10 -0
- package/build/latest-posts/edit.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs.map +3 -3
- package/build/list-item/hooks/use-enter.cjs.map +2 -2
- package/build/loginout/block.json +10 -0
- package/build/math/block.json +12 -0
- package/build/math/deprecated.cjs +29 -12
- package/build/math/deprecated.cjs.map +2 -2
- package/build/math/edit.cjs +67 -46
- package/build/math/edit.cjs.map +2 -2
- package/build/math/save.cjs +2 -2
- package/build/math/save.cjs.map +2 -2
- package/build/media-text/block.json +1 -0
- package/build/media-text/constants.cjs +3 -0
- package/build/media-text/constants.cjs.map +2 -2
- package/build/media-text/deprecated.cjs.map +2 -2
- package/build/media-text/edit.cjs +40 -0
- package/build/media-text/edit.cjs.map +3 -3
- package/build/media-text/image-fill.cjs.map +2 -2
- package/build/media-text/media-container.cjs +3 -3
- package/build/media-text/media-container.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +1 -4
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/menu-inspector-controls.cjs.map +2 -2
- package/build/navigation/edit/overlay-template-part-selector.cjs.map +3 -3
- package/build/navigation/edit/responsive-wrapper.cjs.map +2 -2
- package/build/navigation/edit/use-generate-default-navigation-title.cjs.map +2 -2
- package/build/navigation/view.cjs +2 -2
- package/build/navigation/view.cjs.map +2 -2
- package/build/navigation-link/edit.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/invalid-draft-display.cjs.map +2 -2
- 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 +10 -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/paragraph/index.cjs +6 -0
- package/build/paragraph/index.cjs.map +3 -3
- package/build/playlist/block.json +1 -0
- package/build/playlist/edit.cjs +2 -1
- package/build/playlist/edit.cjs.map +3 -3
- package/build/post-author/edit.cjs.map +3 -3
- package/build/post-author-biography/block.json +4 -0
- package/build/post-author-name/block.json +5 -0
- package/build/post-author-name/edit.cjs.map +2 -2
- package/build/post-comments-count/block.json +3 -0
- package/build/post-comments-form/block.json +10 -0
- package/build/post-content/block.json +3 -0
- package/build/post-date/block.json +3 -0
- package/build/post-date/edit.cjs.map +2 -2
- package/build/post-excerpt/block.json +6 -0
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +11 -9
- 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 +6 -0
- package/build/post-time-to-read/block.json +6 -0
- package/build/post-time-to-read/edit.cjs.map +2 -2
- package/build/post-title/block.json +10 -0
- package/build/preformatted/block.json +7 -0
- package/build/pullquote/block.json +1 -0
- package/build/pullquote/deprecated.cjs.map +2 -2
- package/build/query/deprecated.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs.map +3 -3
- package/build/query/edit/inspector-controls/order-control.cjs.map +3 -3
- package/build/query/edit/inspector-controls/sticky-control.cjs.map +3 -3
- package/build/query/view.cjs.map +2 -2
- package/build/query-no-results/block.json +10 -2
- package/build/query-pagination/block.json +3 -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-title/use-archive-label.cjs.map +2 -2
- package/build/query-total/block.json +6 -0
- package/build/quote/block.json +1 -0
- package/build/quote/deprecated.cjs.map +2 -2
- package/build/quote/transforms.cjs.map +2 -2
- package/build/read-more/block.json +6 -0
- package/build/rss/block.json +6 -0
- package/build/search/edit.cjs.map +3 -3
- package/build/separator/edit.cjs.map +3 -3
- package/build/site-tagline/block.json +8 -1
- package/build/site-title/block.json +7 -1
- package/build/social-links/block.json +3 -0
- package/build/social-links/edit.cjs +2 -3
- package/build/social-links/edit.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 +18 -1
- package/build/table/state.cjs.map +2 -2
- package/build/table-of-contents/block.json +7 -0
- package/build/table-of-contents/edit.cjs.map +3 -3
- package/build/table-of-contents/utils.cjs.map +2 -2
- package/build/tabs/block.json +24 -1
- package/build/tabs/use-tab-actions.cjs.map +2 -2
- package/build/tag-cloud/block.json +19 -0
- package/build/tag-cloud/edit.cjs.map +3 -3
- package/build/template-part/edit/advanced-controls.cjs.map +3 -3
- package/build/template-part/edit/import-controls.cjs.map +3 -3
- package/build/template-part/edit/index.cjs.map +2 -2
- package/build/template-part/edit/inner-blocks.cjs.map +2 -2
- package/build/template-part/edit/placeholder.cjs.map +2 -2
- package/build/template-part/edit/selection-modal.cjs.map +1 -1
- package/build/term-count/block.json +7 -0
- package/build/term-count/use-term-count.cjs.map +2 -2
- package/build/term-description/block.json +9 -0
- package/build/term-description/use-term-description.cjs.map +2 -2
- package/build/term-name/block.json +10 -0
- package/build/term-name/use-term-name.cjs.map +2 -2
- package/build/term-template/block.json +10 -1
- package/build/terms-query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/inherit-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs.map +3 -3
- package/build/terms-query/edit/inspector-controls/taxonomy-control.cjs.map +3 -3
- package/build/utils/hooks.cjs.map +2 -2
- package/build/utils/media-control.cjs +5 -1
- package/build/utils/media-control.cjs.map +2 -2
- package/build/utils/poster-image.cjs.map +2 -2
- 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/verse/block.json +1 -0
- package/build/video/block.json +6 -0
- package/build/video/edit-common-settings.cjs.map +3 -3
- package/build/video/edit.cjs +23 -15
- 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/video/tracks-editor.cjs.map +3 -3
- package/build-module/accordion/block.json +4 -1
- package/build-module/accordion-item/block.json +7 -1
- package/build-module/accordion-panel/block.json +9 -1
- package/build-module/archives/block.json +9 -0
- package/build-module/archives/edit.mjs +2 -2
- package/build-module/archives/edit.mjs.map +2 -2
- package/build-module/audio/block.json +8 -0
- package/build-module/audio/edit.mjs +2 -2
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/avatar/hooks.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/edit.mjs.map +2 -2
- package/build-module/buttons/block.json +9 -0
- package/build-module/categories/block.json +12 -1
- package/build-module/categories/edit.mjs +2 -2
- package/build-module/categories/edit.mjs.map +2 -2
- package/build-module/code/block.json +10 -0
- package/build-module/code/save.mjs.map +2 -2
- package/build-module/column/block.json +9 -0
- package/build-module/columns/block.json +9 -0
- 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/comment-template/hooks.mjs.map +2 -2
- package/build-module/comments/block.json +10 -0
- package/build-module/comments-pagination/block.json +3 -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/edit/index.mjs +4 -1
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +57 -14
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/cover/transforms.mjs.map +2 -2
- package/build-module/details/block.json +12 -0
- package/build-module/details/index.mjs.map +2 -2
- package/build-module/embed/embed-controls.mjs.map +2 -2
- package/build-module/file/block.json +9 -0
- package/build-module/file/deprecated.mjs.map +2 -2
- package/build-module/file/edit.mjs.map +2 -2
- package/build-module/file/inspector.mjs +2 -2
- package/build-module/file/inspector.mjs.map +2 -2
- package/build-module/file/save.mjs.map +2 -2
- package/build-module/footnotes/block.json +10 -0
- package/build-module/footnotes/edit.mjs.map +2 -2
- package/build-module/gallery/block.json +9 -0
- package/build-module/gallery/dynamic-gallery.mjs +2 -2
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +68 -42
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/{flex-styles.mjs → gallery-styles.mjs} +29 -30
- package/build-module/gallery/gallery-styles.mjs.map +7 -0
- package/build-module/gallery/responsive-styles.mjs +25 -4
- package/build-module/gallery/responsive-styles.mjs.map +2 -2
- package/build-module/group/block.json +1 -0
- package/build-module/heading/block.json +11 -0
- package/build-module/heading/index.mjs.map +2 -2
- package/build-module/home-link/block.json +18 -0
- package/build-module/home-link/edit.mjs +2 -2
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +3 -6
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/image/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 +20 -0
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-comments/block.json +10 -0
- package/build-module/latest-comments/edit.mjs +2 -2
- package/build-module/latest-comments/edit.mjs.map +2 -2
- package/build-module/latest-posts/block.json +10 -0
- package/build-module/latest-posts/edit.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +2 -2
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/loginout/block.json +10 -0
- package/build-module/math/block.json +12 -0
- package/build-module/math/deprecated.mjs +29 -12
- package/build-module/math/deprecated.mjs.map +2 -2
- package/build-module/math/edit.mjs +68 -47
- package/build-module/math/edit.mjs.map +2 -2
- package/build-module/math/save.mjs +2 -2
- package/build-module/math/save.mjs.map +2 -2
- package/build-module/media-text/block.json +1 -0
- package/build-module/media-text/constants.mjs +2 -0
- package/build-module/media-text/constants.mjs.map +2 -2
- package/build-module/media-text/deprecated.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +42 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/media-text/image-fill.mjs.map +2 -2
- package/build-module/media-text/media-container.mjs +1 -1
- package/build-module/media-text/media-container.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +1 -4
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-template-part-selector.mjs +2 -2
- package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
- package/build-module/navigation/edit/responsive-wrapper.mjs.map +2 -2
- package/build-module/navigation/edit/use-generate-default-navigation-title.mjs.map +2 -2
- package/build-module/navigation/view.mjs +2 -2
- package/build-module/navigation/view.mjs.map +2 -2
- package/build-module/navigation-link/edit.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/invalid-draft-display.mjs.map +2 -2
- 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 +10 -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/paragraph/index.mjs +6 -0
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/playlist/block.json +1 -0
- package/build-module/playlist/edit.mjs +5 -4
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/post-author/edit.mjs +2 -2
- package/build-module/post-author/edit.mjs.map +2 -2
- package/build-module/post-author-biography/block.json +4 -0
- package/build-module/post-author-name/block.json +5 -0
- package/build-module/post-author-name/edit.mjs.map +2 -2
- package/build-module/post-comments-count/block.json +3 -0
- package/build-module/post-comments-form/block.json +10 -0
- package/build-module/post-content/block.json +3 -0
- package/build-module/post-date/block.json +3 -0
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/post-excerpt/block.json +6 -0
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +11 -9
- 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 +19 -5
- 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 +6 -0
- package/build-module/post-time-to-read/block.json +6 -0
- package/build-module/post-time-to-read/edit.mjs.map +2 -2
- package/build-module/post-title/block.json +10 -0
- package/build-module/preformatted/block.json +7 -0
- package/build-module/pullquote/block.json +1 -0
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/query/deprecated.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/sticky-control.mjs +2 -2
- package/build-module/query/edit/inspector-controls/sticky-control.mjs.map +2 -2
- package/build-module/query/view.mjs.map +2 -2
- package/build-module/query-no-results/block.json +10 -2
- package/build-module/query-pagination/block.json +3 -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-title/use-archive-label.mjs.map +2 -2
- package/build-module/query-total/block.json +6 -0
- package/build-module/quote/block.json +1 -0
- package/build-module/quote/deprecated.mjs.map +2 -2
- package/build-module/quote/transforms.mjs.map +2 -2
- package/build-module/read-more/block.json +6 -0
- package/build-module/rss/block.json +6 -0
- package/build-module/search/edit.mjs +3 -3
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/separator/edit.mjs +5 -2
- package/build-module/separator/edit.mjs.map +2 -2
- package/build-module/site-tagline/block.json +8 -1
- package/build-module/site-title/block.json +7 -1
- package/build-module/social-links/block.json +3 -0
- package/build-module/social-links/edit.mjs +4 -5
- package/build-module/social-links/edit.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 +18 -1
- package/build-module/table/state.mjs.map +2 -2
- package/build-module/table-of-contents/block.json +7 -0
- package/build-module/table-of-contents/edit.mjs +2 -2
- package/build-module/table-of-contents/edit.mjs.map +2 -2
- package/build-module/table-of-contents/utils.mjs.map +2 -2
- package/build-module/tabs/block.json +24 -1
- package/build-module/tabs/use-tab-actions.mjs.map +2 -2
- package/build-module/tag-cloud/block.json +19 -0
- package/build-module/tag-cloud/edit.mjs +2 -2
- package/build-module/tag-cloud/edit.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +5 -2
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/import-controls.mjs +2 -2
- package/build-module/template-part/edit/import-controls.mjs.map +2 -2
- package/build-module/template-part/edit/index.mjs.map +2 -2
- package/build-module/template-part/edit/inner-blocks.mjs.map +2 -2
- package/build-module/template-part/edit/placeholder.mjs.map +2 -2
- package/build-module/template-part/edit/selection-modal.mjs.map +1 -1
- package/build-module/term-count/block.json +7 -0
- package/build-module/term-count/use-term-count.mjs.map +2 -2
- package/build-module/term-description/block.json +9 -0
- package/build-module/term-description/use-term-description.mjs.map +2 -2
- package/build-module/term-name/block.json +10 -0
- package/build-module/term-name/use-term-name.mjs.map +2 -2
- package/build-module/term-template/block.json +10 -1
- package/build-module/terms-query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/inherit-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs +2 -2
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs.map +2 -2
- package/build-module/utils/hooks.mjs.map +2 -2
- package/build-module/utils/media-control.mjs +5 -1
- package/build-module/utils/media-control.mjs.map +2 -2
- package/build-module/utils/poster-image.mjs.map +2 -2
- 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/verse/block.json +1 -0
- package/build-module/video/block.json +6 -0
- package/build-module/video/edit-common-settings.mjs +2 -2
- package/build-module/video/edit-common-settings.mjs.map +2 -2
- package/build-module/video/edit.mjs +25 -16
- 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-module/video/tracks-editor.mjs +2 -2
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/button/style-rtl.css +2 -1
- package/build-style/button/style.css +2 -1
- package/build-style/columns/style-rtl.css +1 -1
- package/build-style/columns/style.css +1 -1
- package/build-style/comments/editor-rtl.css +1 -1
- package/build-style/comments/editor.css +1 -1
- package/build-style/comments/style-rtl.css +1 -1
- package/build-style/comments/style.css +1 -1
- package/build-style/common-rtl.css +1 -1
- package/build-style/common.css +1 -1
- package/build-style/cover/style-rtl.css +6 -0
- package/build-style/cover/style.css +6 -0
- package/build-style/editor-rtl.css +21 -7
- package/build-style/editor.css +21 -7
- package/build-style/embed/editor-rtl.css +2 -1
- package/build-style/embed/editor.css +2 -1
- package/build-style/gallery/style-rtl.css +1 -2
- package/build-style/gallery/style.css +1 -2
- package/build-style/image/editor-rtl.css +6 -0
- package/build-style/image/editor.css +6 -0
- package/build-style/image/style-rtl.css +6 -9
- package/build-style/image/style.css +6 -9
- package/build-style/math/editor-rtl.css +5 -0
- package/build-style/math/editor.css +5 -0
- package/build-style/navigation/editor-rtl.css +1 -0
- package/build-style/navigation/editor.css +1 -0
- package/build-style/navigation/style-rtl.css +19 -4
- package/build-style/navigation/style.css +19 -4
- 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/post-title/style-rtl.css +2 -2
- package/build-style/post-title/style.css +2 -2
- package/build-style/query-pagination/editor-rtl.css +0 -3
- package/build-style/query-pagination/editor.css +0 -3
- package/build-style/search/theme-rtl.css +1 -1
- package/build-style/search/theme.css +1 -1
- package/build-style/style-rtl.css +47 -23
- package/build-style/style.css +47 -23
- package/build-style/tab-panel/style-rtl.css +2 -0
- package/build-style/tab-panel/style.css +2 -0
- package/build-style/theme-rtl.css +1 -1
- package/build-style/theme.css +1 -1
- package/build-style/verse/style-rtl.css +2 -1
- package/build-style/verse/style.css +2 -1
- package/package.json +42 -43
- package/src/accordion/README.md +3 -0
- package/src/accordion/block.json +4 -1
- 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 +4 -0
- package/src/archives/block.json +9 -0
- package/src/archives/edit.jsx +2 -2
- package/src/audio/README.md +4 -0
- package/src/audio/block.json +8 -0
- package/src/audio/edit.jsx +2 -2
- package/src/avatar/hooks.js +2 -2
- 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/edit.jsx +1 -1
- package/src/button/style.scss +2 -2
- package/src/buttons/README.md +4 -0
- package/src/buttons/block.json +9 -0
- package/src/calendar/index.php +1 -1
- package/src/categories/README.md +6 -0
- package/src/categories/block.json +12 -1
- package/src/categories/edit.jsx +2 -2
- package/src/code/README.md +5 -0
- package/src/code/block.json +10 -0
- package/src/code/save.jsx +1 -1
- package/src/column/README.md +4 -0
- package/src/column/block.json +9 -0
- package/src/columns/README.md +4 -0
- package/src/columns/block.json +9 -0
- package/src/columns/style.scss +2 -3
- 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/comment-template/hooks.js +1 -1
- package/src/comments/README.md +5 -0
- package/src/comments/block.json +10 -0
- package/src/comments/style.scss +1 -1
- package/src/comments-pagination/README.md +2 -0
- package/src/comments-pagination/block.json +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 +1 -2
- package/src/cover/edit/index.jsx +5 -2
- package/src/cover/edit/inspector-controls.jsx +66 -15
- package/src/cover/style.scss +10 -0
- package/src/cover/test/{edit.jsdom.test.js → edit.browser.test.js} +122 -147
- package/src/cover/transforms.js +3 -3
- package/src/details/README.md +7 -0
- package/src/details/block.json +12 -0
- package/src/details/index.js +1 -1
- package/src/embed/editor.scss +2 -2
- package/src/embed/embed-controls.jsx +2 -2
- package/src/file/README.md +4 -0
- package/src/file/block.json +9 -0
- package/src/file/deprecated.jsx +3 -3
- package/src/file/edit.jsx +5 -3
- package/src/file/inspector.jsx +3 -3
- package/src/file/save.jsx +2 -2
- package/src/footnotes/README.md +5 -0
- package/src/footnotes/block.json +10 -0
- package/src/footnotes/edit.jsx +1 -1
- package/src/gallery/README.md +4 -0
- package/src/gallery/block.json +9 -0
- package/src/gallery/dynamic-gallery.jsx +4 -4
- package/src/gallery/edit.jsx +122 -70
- package/src/gallery/gallery-styles.js +117 -0
- package/src/gallery/index.php +181 -67
- package/src/gallery/responsive-styles.js +59 -5
- package/src/gallery/test/edit.jsdom.test.js +71 -3
- package/src/gallery/test/responsive-styles.js +59 -5
- package/src/group/README.md +1 -0
- package/src/group/block.json +1 -0
- package/src/heading/README.md +6 -0
- package/src/heading/block.json +11 -0
- package/src/heading/index.js +2 -2
- package/src/home-link/README.md +5 -0
- package/src/home-link/block.json +18 -0
- package/src/home-link/edit.jsx +2 -2
- package/src/html/modal.jsx +0 -3
- package/src/icon/index.php +9 -0
- package/src/image/edit.jsx +1 -1
- package/src/image/editor.scss +8 -0
- package/src/image/image.jsx +20 -18
- package/src/image/index.php +10 -4
- package/src/image/style.scss +1 -0
- package/src/image/test/use-open-image-media-editor-modal.jsdom.test.js +140 -1
- package/src/image/use-open-image-media-editor-modal.js +37 -0
- package/src/index.jsx +1 -1
- package/src/latest-comments/README.md +5 -0
- package/src/latest-comments/block.json +10 -0
- package/src/latest-comments/edit.jsx +2 -2
- package/src/latest-posts/README.md +5 -0
- package/src/latest-posts/block.json +10 -0
- package/src/latest-posts/edit.jsx +1 -1
- package/src/list/ordered-list-settings.jsx +2 -2
- package/src/list-item/hooks/use-enter.js +1 -1
- package/src/loginout/README.md +5 -0
- package/src/loginout/block.json +10 -0
- package/src/math/README.md +7 -2
- package/src/math/block.json +12 -0
- package/src/math/deprecated.jsx +38 -12
- package/src/math/edit.jsx +49 -20
- package/src/math/editor.scss +5 -0
- package/src/math/save.jsx +20 -4
- package/src/media-text/README.md +1 -0
- package/src/media-text/block.json +1 -0
- package/src/media-text/constants.js +1 -0
- package/src/media-text/deprecated.jsx +3 -3
- package/src/media-text/edit.jsx +48 -3
- package/src/media-text/image-fill.js +2 -2
- package/src/media-text/media-container.jsx +1 -1
- package/src/navigation/edit/index.jsx +3 -5
- package/src/navigation/edit/menu-inspector-controls.jsx +2 -2
- package/src/navigation/edit/overlay-template-part-selector.jsx +3 -3
- package/src/navigation/edit/responsive-wrapper.jsx +1 -1
- package/src/navigation/edit/use-generate-default-navigation-title.js +2 -2
- package/src/navigation/editor.scss +1 -0
- package/src/navigation/index.php +12 -0
- package/src/navigation/style.scss +41 -5
- package/src/navigation/test/use-navigation-menu.jsdom.test.js +6 -28
- package/src/navigation/test/view.jsdom.test.js +23 -0
- package/src/navigation/view.js +9 -6
- package/src/navigation-link/edit.jsx +1 -1
- package/src/navigation-link/editor.scss +6 -1
- package/src/navigation-link/link-ui/page-creator.jsx +2 -2
- package/src/navigation-link/shared/controls.jsx +2 -2
- package/src/navigation-link/shared/invalid-draft-display.jsx +2 -2
- package/src/navigation-link/shared/test/use-link-preview.jsdom.test.js +22 -22
- package/src/navigation-link/shared/use-link-preview.js +15 -14
- package/src/navigation-link/test/__snapshots__/hooks.jsdom.test.js.snap +41 -11
- 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 +12 -2
- package/src/navigation-submenu/editor.scss +6 -1
- package/src/navigation-submenu/index.php +11 -0
- package/src/page-list/README.md +5 -0
- package/src/page-list/block.json +10 -0
- package/src/paragraph/README.md +1 -0
- package/src/paragraph/block.json +1 -0
- package/src/paragraph/edit.jsx +2 -4
- package/src/paragraph/index.js +7 -0
- package/src/pattern/index.php +2 -2
- package/src/playlist/README.md +1 -0
- package/src/playlist/block.json +1 -0
- package/src/playlist/edit.jsx +6 -4
- package/src/playlist-track/test/edit.jsdom.test.jsx +2 -3
- package/src/post-author/edit.jsx +2 -2
- package/src/post-author-biography/README.md +3 -0
- package/src/post-author-biography/block.json +4 -0
- package/src/post-author-name/README.md +4 -0
- package/src/post-author-name/block.json +5 -0
- package/src/post-author-name/edit.jsx +1 -1
- 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 +5 -0
- package/src/post-comments-form/block.json +10 -0
- package/src/post-content/README.md +3 -0
- package/src/post-content/block.json +3 -0
- package/src/post-date/README.md +2 -0
- package/src/post-date/block.json +3 -0
- package/src/post-date/edit.jsx +2 -2
- package/src/post-excerpt/README.md +5 -0
- package/src/post-excerpt/block.json +6 -0
- package/src/post-excerpt/edit.jsx +1 -1
- 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 +27 -6
- 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 +5 -0
- package/src/post-terms/block.json +6 -0
- package/src/post-time-to-read/README.md +5 -0
- package/src/post-time-to-read/block.json +6 -0
- package/src/post-time-to-read/edit.jsx +2 -2
- package/src/post-title/README.md +5 -0
- package/src/post-title/block.json +10 -0
- package/src/post-title/style.scss +2 -3
- package/src/preformatted/README.md +6 -0
- package/src/preformatted/block.json +7 -0
- package/src/pullquote/README.md +1 -0
- package/src/pullquote/block.json +1 -0
- package/src/pullquote/deprecated.jsx +1 -1
- package/src/query/deprecated.jsx +1 -1
- package/src/query/edit/inspector-controls/index.jsx +4 -4
- package/src/query/edit/inspector-controls/order-control.jsx +2 -2
- package/src/query/edit/inspector-controls/sticky-control.jsx +2 -2
- package/src/query/view.js +6 -9
- package/src/query-no-results/README.md +7 -0
- package/src/query-no-results/block.json +10 -2
- package/src/query-pagination/README.md +2 -0
- package/src/query-pagination/block.json +3 -0
- package/src/query-pagination/editor.scss +0 -3
- 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-title/use-archive-label.js +1 -1
- package/src/query-total/README.md +5 -0
- package/src/query-total/block.json +6 -0
- package/src/quote/README.md +1 -0
- package/src/quote/block.json +1 -0
- package/src/quote/deprecated.jsx +2 -2
- package/src/quote/transforms.js +3 -3
- package/src/read-more/README.md +5 -0
- package/src/read-more/block.json +6 -0
- package/src/rss/README.md +5 -0
- package/src/rss/block.json +6 -0
- package/src/search/edit.jsx +6 -6
- package/src/search/theme.scss +1 -1
- package/src/separator/edit.jsx +7 -4
- package/src/site-tagline/README.md +6 -0
- package/src/site-tagline/block.json +8 -1
- package/src/site-title/README.md +5 -0
- package/src/site-title/block.json +7 -1
- package/src/social-links/README.md +2 -0
- package/src/social-links/block.json +3 -0
- package/src/social-links/edit.jsx +4 -5
- 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 +7 -0
- package/src/tab-panels/block.json +18 -1
- package/src/table/state.js +1 -1
- package/src/table-of-contents/README.md +6 -0
- package/src/table-of-contents/block.json +7 -0
- package/src/table-of-contents/edit.jsx +6 -6
- package/src/table-of-contents/utils.ts +2 -2
- package/src/tabs/README.md +9 -0
- package/src/tabs/block.json +24 -1
- package/src/tabs/use-tab-actions.js +1 -1
- package/src/tag-cloud/README.md +9 -0
- package/src/tag-cloud/block.json +19 -0
- package/src/tag-cloud/edit.jsx +2 -2
- package/src/template-part/edit/advanced-controls.jsx +5 -2
- package/src/template-part/edit/import-controls.jsx +2 -2
- package/src/template-part/edit/index.jsx +2 -2
- package/src/template-part/edit/inner-blocks.jsx +1 -1
- package/src/template-part/edit/placeholder.jsx +2 -2
- package/src/template-part/edit/selection-modal.jsx +1 -1
- package/src/term-count/README.md +6 -0
- package/src/term-count/block.json +7 -0
- package/src/term-count/use-term-count.js +1 -1
- package/src/term-description/README.md +5 -0
- package/src/term-description/block.json +9 -0
- package/src/term-description/use-term-description.js +1 -1
- package/src/term-name/README.md +5 -0
- package/src/term-name/block.json +10 -0
- package/src/term-name/index.php +1 -1
- package/src/term-name/use-term-name.js +1 -1
- package/src/term-template/README.md +5 -0
- package/src/term-template/block.json +10 -1
- package/src/terms-query/edit/inspector-controls/index.jsx +2 -2
- package/src/terms-query/edit/inspector-controls/inherit-control.jsx +1 -1
- package/src/terms-query/edit/inspector-controls/order-control.jsx +2 -2
- package/src/terms-query/edit/inspector-controls/taxonomy-control.jsx +2 -2
- package/src/utils/hooks.js +1 -1
- package/src/utils/media-control.jsx +16 -10
- package/src/utils/poster-image.jsx +2 -2
- 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.jsdom.test.jsx +36 -38
- package/src/utils/test/{waveform-utils.jsdom.test.js → waveform-utils.browser.test.js} +64 -44
- package/src/verse/README.md +1 -0
- package/src/verse/block.json +1 -0
- package/src/verse/style.scss +2 -2
- package/src/video/README.md +7 -0
- package/src/video/block.json +6 -0
- package/src/video/edit-common-settings.jsx +3 -3
- package/src/video/edit.jsx +56 -51
- package/src/video/index.js +0 -2
- package/src/video/save.jsx +10 -1
- package/src/video/tracks-editor.jsx +2 -2
- package/build/gallery/flex-styles.cjs.map +0 -7
- package/build/video/variations.cjs +0 -75
- package/build/video/variations.cjs.map +0 -7
- package/build-module/gallery/flex-styles.mjs.map +0 -7
- package/build-module/video/variations.mjs +0 -50
- package/build-module/video/variations.mjs.map +0 -7
- package/src/gallery/flex-styles.js +0 -99
- package/src/video/test/variations.js +0 -63
- package/src/video/variations.js +0 -62
package/src/gallery/index.php
CHANGED
|
@@ -87,6 +87,83 @@ function block_core_gallery_get_column_gap_value( $gap, $fallback_gap ) {
|
|
|
87
87
|
return '0' === $gap_column ? '0px' : $gap_column;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Returns whether a value can be used as a Gallery aspect ratio.
|
|
92
|
+
*
|
|
93
|
+
* Aspect ratios are interpolated into a generated stylesheet instead of being
|
|
94
|
+
* set as an inline style, so only the numeric forms produced by aspect ratio
|
|
95
|
+
* presets (and `auto`) are accepted. A value from saved content that isn't one
|
|
96
|
+
* of those is ignored rather than emitted, so it can't close the rule early and
|
|
97
|
+
* inject declarations of its own. The editor applies the same restriction in
|
|
98
|
+
* `isValidGalleryAspectRatio()`.
|
|
99
|
+
*
|
|
100
|
+
* @since 7.1.0
|
|
101
|
+
*
|
|
102
|
+
* @param mixed $value Value to check.
|
|
103
|
+
* @return bool Whether the value is a valid aspect ratio.
|
|
104
|
+
*/
|
|
105
|
+
function block_core_gallery_is_valid_aspect_ratio( $value ) {
|
|
106
|
+
return is_string( $value ) && 1 === preg_match( '#^(auto|\d+(\.\d+)?(\s*/\s*\d+(\.\d+)?)?)$#', trim( $value ) );
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns Gallery-specific responsive aspect ratio rules for a viewport.
|
|
111
|
+
*
|
|
112
|
+
* Unlike the column and crop rules, these are not scoped to the Flex layout:
|
|
113
|
+
* the aspect ratio applies to the images in every Gallery layout. They also
|
|
114
|
+
* cover dynamic galleries, whose images are rendered by the Gallery rather than
|
|
115
|
+
* carrying their own block attributes.
|
|
116
|
+
*
|
|
117
|
+
* @since 7.1.0
|
|
118
|
+
*
|
|
119
|
+
* @param string $selector Gallery block selector.
|
|
120
|
+
* @param mixed $viewport_style Viewport style data.
|
|
121
|
+
* @param string $media_query Viewport media query.
|
|
122
|
+
* @return array[] Gallery responsive aspect ratio rules.
|
|
123
|
+
*/
|
|
124
|
+
function block_core_gallery_get_responsive_aspect_ratio_style_rules( $selector, $viewport_style, $media_query ) {
|
|
125
|
+
if ( ! is_array( $viewport_style ) || ! is_string( $media_query ) ) {
|
|
126
|
+
return array();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
$aspect_ratio = $viewport_style['aspectRatio'] ?? null;
|
|
130
|
+
if ( ! block_core_gallery_is_valid_aspect_ratio( $aspect_ratio ) ) {
|
|
131
|
+
return array();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
$aspect_ratio = trim( $aspect_ratio );
|
|
135
|
+
|
|
136
|
+
/*
|
|
137
|
+
* The base aspect ratio is an inline style on each image, so these
|
|
138
|
+
* declarations have to be important to win for the viewport.
|
|
139
|
+
*
|
|
140
|
+
* Original cancels the base ratio, which means rolling the declaration out
|
|
141
|
+
* of the cascade rather than giving it a value. `auto` - and `initial`,
|
|
142
|
+
* `unset` and `revert`, which all compute to it - would override the
|
|
143
|
+
* `width`/`height` presentational hint that gives a lazy-loaded image its
|
|
144
|
+
* placeholder ratio, collapsing the image to zero height until it loads:
|
|
145
|
+
* the Featured Image bug fixed in #80386. `revert-layer` drops the
|
|
146
|
+
* declaration instead, so the image falls back to that hint while loading,
|
|
147
|
+
* to its natural ratio once loaded, and to any ratio a theme set in a lower
|
|
148
|
+
* cascade layer. `object-fit` is left as the base set it, so a cropped
|
|
149
|
+
* Gallery still crops.
|
|
150
|
+
*/
|
|
151
|
+
$declarations = 'auto' === $aspect_ratio
|
|
152
|
+
? array( 'aspect-ratio' => 'revert-layer !important' )
|
|
153
|
+
: array(
|
|
154
|
+
'aspect-ratio' => "{$aspect_ratio} !important",
|
|
155
|
+
'object-fit' => 'cover !important',
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
return array(
|
|
159
|
+
array(
|
|
160
|
+
'selector' => "{$selector}.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) img",
|
|
161
|
+
'declarations' => $declarations,
|
|
162
|
+
'rules_group' => $media_query,
|
|
163
|
+
),
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
90
167
|
/**
|
|
91
168
|
* Returns Gallery-specific responsive Flex rules for a viewport.
|
|
92
169
|
*
|
|
@@ -474,96 +551,133 @@ function block_core_gallery_render( $attributes, $content, $block ) {
|
|
|
474
551
|
$processed_content = new WP_HTML_Tag_Processor( $content );
|
|
475
552
|
$processed_content->next_tag();
|
|
476
553
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
554
|
+
$style_attr = is_array( $attributes['style'] ?? null )
|
|
555
|
+
? $attributes['style']
|
|
556
|
+
: array();
|
|
557
|
+
if (
|
|
558
|
+
defined( 'IS_GUTENBERG_PLUGIN' ) &&
|
|
559
|
+
IS_GUTENBERG_PLUGIN &&
|
|
560
|
+
function_exists( 'gutenberg_resolve_style_state_aliases' )
|
|
561
|
+
) {
|
|
562
|
+
$style_attr = gutenberg_resolve_style_state_aliases( $style_attr, 'core/gallery' );
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
$global_settings = wp_get_global_settings();
|
|
566
|
+
$viewport_settings = $global_settings['viewport'] ?? null;
|
|
567
|
+
$responsive_media_queries = array();
|
|
568
|
+
foreach ( array( 'WP_Theme_JSON_Gutenberg', 'WP_Theme_JSON' ) as $theme_json_class_name ) {
|
|
569
|
+
if ( method_exists( $theme_json_class_name, 'get_viewport_media_queries' ) ) {
|
|
570
|
+
$responsive_media_queries = $theme_json_class_name::get_viewport_media_queries( $viewport_settings );
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// Columns and cropping are Flex-only, but the aspect ratio applies in every
|
|
576
|
+
// layout, so a Gallery with a viewport aspect ratio needs the per-instance
|
|
577
|
+
// stylesheet (and the class scoping it) even when it isn't a Flex Gallery.
|
|
578
|
+
$has_viewport_aspect_ratio = false;
|
|
579
|
+
foreach ( $responsive_media_queries as $breakpoint => $media_query ) {
|
|
580
|
+
$viewport_style = $style_attr[ $breakpoint ] ?? null;
|
|
484
581
|
if (
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
function_exists( 'gutenberg_resolve_style_state_aliases' )
|
|
582
|
+
is_array( $viewport_style ) &&
|
|
583
|
+
block_core_gallery_is_valid_aspect_ratio( $viewport_style['aspectRatio'] ?? null )
|
|
488
584
|
) {
|
|
489
|
-
$
|
|
585
|
+
$has_viewport_aspect_ratio = true;
|
|
586
|
+
break;
|
|
490
587
|
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/*
|
|
591
|
+
* Only generate the gap styles — and, when nothing else needs it, the unique
|
|
592
|
+
* classname that exists solely to scope them — if the theme has not opted out
|
|
593
|
+
* of layout styles. The responsive aspect ratio rules are not layout styles,
|
|
594
|
+
* so they keep rendering either way.
|
|
595
|
+
*/
|
|
596
|
+
$should_generate_gap_styles = $is_flex_layout && ! current_theme_supports( 'disable-layout-styles' );
|
|
491
597
|
|
|
598
|
+
if ( $should_generate_gap_styles || $has_viewport_aspect_ratio ) {
|
|
492
599
|
$unique_gallery_classname = wp_unique_id( 'wp-block-gallery-' );
|
|
493
600
|
$processed_content->add_class( $unique_gallery_classname );
|
|
601
|
+
$gallery_styles = array();
|
|
494
602
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
603
|
+
if ( $should_generate_gap_styles ) {
|
|
604
|
+
// Add a style tag for the --wp--style--unstable-gallery-gap var. The
|
|
605
|
+
// Gallery's custom Flex layout recalculates Image block widths based on
|
|
606
|
+
// the current gap so it can maintain the selected number of columns.
|
|
498
607
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
608
|
+
// --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
|
|
609
|
+
// gap on the gallery.
|
|
610
|
+
$fallback_gap = 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
|
|
502
611
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
612
|
+
if ( null === $global_styles ) {
|
|
613
|
+
$global_styles = function_exists( 'wp_get_global_styles' ) ? wp_get_global_styles() : array();
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
$global_gallery_styles = $global_styles['blocks']['core/gallery'] ?? array();
|
|
617
|
+
$global_gallery_gap = $global_gallery_styles['spacing']['blockGap'] ?? $fallback_gap;
|
|
618
|
+
$has_block_gap = is_array( $style_attr['spacing'] ?? null ) && array_key_exists( 'blockGap', $style_attr['spacing'] );
|
|
619
|
+
// Prefer the block's own gap value, then Gallery global styles. Missing
|
|
620
|
+
// values fall back to the Gallery blockGap default.
|
|
621
|
+
$block_gap = $has_block_gap
|
|
622
|
+
? $style_attr['spacing']['blockGap']
|
|
623
|
+
: $global_gallery_gap;
|
|
624
|
+
$gap_column = block_core_gallery_get_column_gap_value( $block_gap, $fallback_gap );
|
|
625
|
+
|
|
626
|
+
// Set the CSS variable to the column value for Gallery's flex width calculations.
|
|
627
|
+
$gallery_styles[] = array(
|
|
516
628
|
'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
|
|
517
629
|
'declarations' => array(
|
|
518
630
|
'--wp--style--unstable-gallery-gap' => $gap_column,
|
|
519
631
|
),
|
|
520
|
-
)
|
|
521
|
-
);
|
|
522
|
-
|
|
523
|
-
$global_settings = wp_get_global_settings();
|
|
524
|
-
$viewport_settings = $global_settings['viewport'] ?? null;
|
|
525
|
-
$responsive_media_queries = array();
|
|
526
|
-
foreach ( array( 'WP_Theme_JSON_Gutenberg', 'WP_Theme_JSON' ) as $theme_json_class_name ) {
|
|
527
|
-
if ( method_exists( $theme_json_class_name, 'get_viewport_media_queries' ) ) {
|
|
528
|
-
$responsive_media_queries = $theme_json_class_name::get_viewport_media_queries( $viewport_settings );
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
632
|
+
);
|
|
531
633
|
}
|
|
532
634
|
|
|
533
635
|
foreach ( $responsive_media_queries as $breakpoint => $media_query ) {
|
|
534
|
-
$viewport_style
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
636
|
+
$viewport_style = $style_attr[ $breakpoint ] ?? null;
|
|
637
|
+
|
|
638
|
+
if ( $should_generate_gap_styles ) {
|
|
639
|
+
$has_viewport_block_gap = is_array( $viewport_style ) &&
|
|
640
|
+
is_array( $viewport_style['spacing'] ?? null ) &&
|
|
641
|
+
array_key_exists( 'blockGap', $viewport_style['spacing'] );
|
|
642
|
+
$has_global_viewport_block_gap = is_array( $global_gallery_styles[ $breakpoint ]['spacing'] ?? null ) &&
|
|
643
|
+
array_key_exists( 'blockGap', $global_gallery_styles[ $breakpoint ]['spacing'] );
|
|
644
|
+
|
|
645
|
+
// Viewport-specific block values win. Gallery global viewport values
|
|
646
|
+
// only apply when the block has no base gap, so they do not override an instance value.
|
|
647
|
+
if ( $has_viewport_block_gap ) {
|
|
648
|
+
$viewport_gap = $viewport_style['spacing']['blockGap'];
|
|
649
|
+
} elseif ( ! $has_block_gap && $has_global_viewport_block_gap ) {
|
|
650
|
+
$viewport_gap = $global_gallery_styles[ $breakpoint ]['spacing']['blockGap'];
|
|
651
|
+
} else {
|
|
652
|
+
$viewport_gap = null;
|
|
653
|
+
}
|
|
550
654
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
655
|
+
if ( null !== $viewport_gap ) {
|
|
656
|
+
$gallery_styles[] = array(
|
|
657
|
+
'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
|
|
658
|
+
'declarations' => array(
|
|
659
|
+
'--wp--style--unstable-gallery-gap' => block_core_gallery_get_column_gap_value(
|
|
660
|
+
$viewport_gap,
|
|
661
|
+
$fallback_gap
|
|
662
|
+
),
|
|
558
663
|
),
|
|
559
|
-
|
|
560
|
-
|
|
664
|
+
'rules_group' => $media_query,
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
$gallery_styles = array_merge(
|
|
669
|
+
$gallery_styles,
|
|
670
|
+
block_core_gallery_get_responsive_flex_style_rules(
|
|
671
|
+
".{$unique_gallery_classname}",
|
|
672
|
+
$viewport_style,
|
|
673
|
+
$media_query
|
|
674
|
+
)
|
|
561
675
|
);
|
|
562
676
|
}
|
|
563
677
|
|
|
564
678
|
$gallery_styles = array_merge(
|
|
565
679
|
$gallery_styles,
|
|
566
|
-
|
|
680
|
+
block_core_gallery_get_responsive_aspect_ratio_style_rules(
|
|
567
681
|
".{$unique_gallery_classname}",
|
|
568
682
|
$viewport_style,
|
|
569
683
|
$media_query
|
|
@@ -8,6 +8,28 @@ export function isValidGalleryColumns( value ) {
|
|
|
8
8
|
return Number.isInteger( value ) && value >= 1 && value <= MAX_COLUMNS;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/*
|
|
12
|
+
* Aspect ratios are interpolated into a generated stylesheet instead of being
|
|
13
|
+
* set as an inline style, so only the numeric forms produced by aspect ratio
|
|
14
|
+
* presets (and `auto`) are accepted. A value from saved content that isn't one
|
|
15
|
+
* of those is ignored rather than emitted, so it can't close the rule early and
|
|
16
|
+
* inject declarations of its own. The frontend applies the same restriction in
|
|
17
|
+
* `block_core_gallery_is_valid_aspect_ratio()`.
|
|
18
|
+
*/
|
|
19
|
+
const ASPECT_RATIO_PATTERN = /^(auto|\d+(\.\d+)?(\s*\/\s*\d+(\.\d+)?)?)$/;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Returns whether a value can be used as a Gallery aspect ratio.
|
|
23
|
+
*
|
|
24
|
+
* @param {*} value Value to check.
|
|
25
|
+
* @return {boolean} Whether the value is a valid aspect ratio.
|
|
26
|
+
*/
|
|
27
|
+
export function isValidGalleryAspectRatio( value ) {
|
|
28
|
+
return (
|
|
29
|
+
typeof value === 'string' && ASPECT_RATIO_PATTERN.test( value.trim() )
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
11
33
|
/**
|
|
12
34
|
* Returns Gallery styles for a viewport.
|
|
13
35
|
*
|
|
@@ -75,11 +97,15 @@ export function getUpdatedGalleryStyle( {
|
|
|
75
97
|
}
|
|
76
98
|
|
|
77
99
|
function getGallerySelector( selector ) {
|
|
78
|
-
return `${ selector }.wp-block-gallery.has-nested-images
|
|
100
|
+
return `${ selector }.wp-block-gallery.has-nested-images`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function getFlexGallerySelector( selector ) {
|
|
104
|
+
return `${ getGallerySelector( selector ) }:where(.is-layout-flex)`;
|
|
79
105
|
}
|
|
80
106
|
|
|
81
107
|
function getImageSelector( selector ) {
|
|
82
|
-
return `${
|
|
108
|
+
return `${ getFlexGallerySelector(
|
|
83
109
|
selector
|
|
84
110
|
) } figure.wp-block-image:not(#individual-image)`;
|
|
85
111
|
}
|
|
@@ -92,7 +118,7 @@ function getColumnsCSS( selector, columns ) {
|
|
|
92
118
|
? '100%'
|
|
93
119
|
: `calc((100% - (var(--wp--style--unstable-gallery-gap, 16px) * ${
|
|
94
120
|
columns - 1
|
|
95
|
-
|
|
121
|
+
})) / ${ columns })`;
|
|
96
122
|
|
|
97
123
|
return `${ getImageSelector( selector ) }{width:${ width } !important;}`;
|
|
98
124
|
}
|
|
@@ -110,15 +136,39 @@ function getImageCropCSS( selector, imageCrop ) {
|
|
|
110
136
|
return `${ imageSelector }{align-self:auto !important;margin-top:0 !important;margin-bottom:auto !important;}${ wrapperSelector }{display:block !important;}${ linkSelector }{display:inline-block !important;}${ mediaSelector }{width:auto !important;flex:0 1 auto !important;height:auto !important;object-fit:fill !important;}`;
|
|
111
137
|
}
|
|
112
138
|
|
|
139
|
+
function getAspectRatioCSS( selector, aspectRatio ) {
|
|
140
|
+
const imageSelector = `${ getGallerySelector(
|
|
141
|
+
selector
|
|
142
|
+
) } figure.wp-block-image:not(#individual-image) img`;
|
|
143
|
+
const ratio = aspectRatio.trim();
|
|
144
|
+
|
|
145
|
+
if ( ratio === 'auto' ) {
|
|
146
|
+
/*
|
|
147
|
+
* We need an explicit value here to cancel out the base aspect ratio. `auto` — and
|
|
148
|
+
* `initial`, `unset` and `revert`, which all compute to it — would
|
|
149
|
+
* override the `width`/`height` presentational hint that gives a
|
|
150
|
+
* lazy-loaded image its placeholder ratio, collapsing the image to zero
|
|
151
|
+
* height until it loads.
|
|
152
|
+
* `revert-layer` drops the declaration instead, so the image falls back
|
|
153
|
+
* to that hint while loading, to its natural ratio once loaded, and to
|
|
154
|
+
* any ratio a theme set in a lower cascade layer. `object-fit` is left
|
|
155
|
+
* as the base set it, so a cropped Gallery still crops.
|
|
156
|
+
*/
|
|
157
|
+
return `${ imageSelector }{aspect-ratio:revert-layer !important;}`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return `${ imageSelector }{aspect-ratio:${ ratio } !important;object-fit:cover !important;}`;
|
|
161
|
+
}
|
|
162
|
+
|
|
113
163
|
/**
|
|
114
|
-
* Generates Gallery-specific responsive
|
|
164
|
+
* Generates Gallery-specific responsive CSS.
|
|
115
165
|
*
|
|
116
166
|
* @param {string} selector Gallery block selector.
|
|
117
167
|
* @param {Object} style Gallery block style attribute.
|
|
118
168
|
* @param {Object} mediaQueries Map of viewport keys to media queries.
|
|
119
169
|
* @return {string} Responsive Gallery CSS.
|
|
120
170
|
*/
|
|
121
|
-
export function
|
|
171
|
+
export function getGalleryResponsiveCSS( selector, style, mediaQueries ) {
|
|
122
172
|
if ( ! isObject( mediaQueries ) ) {
|
|
123
173
|
return '';
|
|
124
174
|
}
|
|
@@ -140,6 +190,10 @@ export function getGalleryResponsiveFlexCSS( selector, style, mediaQueries ) {
|
|
|
140
190
|
css += getImageCropCSS( selector, viewportStyle.imageCrop );
|
|
141
191
|
}
|
|
142
192
|
|
|
193
|
+
if ( isValidGalleryAspectRatio( viewportStyle.aspectRatio ) ) {
|
|
194
|
+
css += getAspectRatioCSS( selector, viewportStyle.aspectRatio );
|
|
195
|
+
}
|
|
196
|
+
|
|
143
197
|
return css ? `${ mediaQuery }{${ css }}` : '';
|
|
144
198
|
} )
|
|
145
199
|
.join( '' );
|
|
@@ -26,6 +26,22 @@ const IMAGE_ATTRIBUTES = {
|
|
|
26
26
|
|
|
27
27
|
const VIEWPORT_STATE_INITIALIZER = 'test/viewport-state-initializer';
|
|
28
28
|
|
|
29
|
+
// The Gallery only offers its aspect ratio control when the theme or the
|
|
30
|
+
// defaults provide ratios to choose from.
|
|
31
|
+
const ASPECT_RATIO_SETTINGS = {
|
|
32
|
+
__experimentalFeatures: {
|
|
33
|
+
dimensions: {
|
|
34
|
+
defaultAspectRatios: true,
|
|
35
|
+
aspectRatios: {
|
|
36
|
+
default: [
|
|
37
|
+
{ name: 'Square - 1:1', slug: 'square', ratio: '1' },
|
|
38
|
+
{ name: 'Wide - 16:9', slug: '16-9', ratio: '16/9' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
29
45
|
function ViewportStateInitializer() {
|
|
30
46
|
const { setResponsiveEditing, setStyleStateViewport } = unlock(
|
|
31
47
|
useDispatch( blockEditorStore )
|
|
@@ -43,10 +59,11 @@ function ViewportStateInitializer() {
|
|
|
43
59
|
* Registers the core blocks up front so inner blocks can be created before the
|
|
44
60
|
* editor is initialized, then renders the given block.
|
|
45
61
|
*
|
|
46
|
-
* @param {Object} block
|
|
62
|
+
* @param {Object} block Block to render, created with `createBlock`.
|
|
63
|
+
* @param {Object} settings Additional editor settings.
|
|
47
64
|
*/
|
|
48
|
-
async function setup( block ) {
|
|
49
|
-
return initializeEditor( block, false );
|
|
65
|
+
async function setup( block, settings ) {
|
|
66
|
+
return initializeEditor( block, false, settings );
|
|
50
67
|
}
|
|
51
68
|
|
|
52
69
|
describe( 'Gallery block', () => {
|
|
@@ -151,6 +168,57 @@ describe( 'Gallery block', () => {
|
|
|
151
168
|
).not.toBeInTheDocument();
|
|
152
169
|
} );
|
|
153
170
|
|
|
171
|
+
test( 'offers the aspect ratio for a viewport state in a non-Flex layout', async () => {
|
|
172
|
+
await setup(
|
|
173
|
+
[
|
|
174
|
+
createGallery( { layout: { type: 'grid' } } ),
|
|
175
|
+
createBlock( VIEWPORT_STATE_INITIALIZER ),
|
|
176
|
+
],
|
|
177
|
+
ASPECT_RATIO_SETTINGS
|
|
178
|
+
);
|
|
179
|
+
await selectBlock( 'Block: Gallery Grid' );
|
|
180
|
+
|
|
181
|
+
// Columns and crop to fit are Flex-only, but the aspect ratio
|
|
182
|
+
// applies in every layout, so the Grid Gallery has a viewport
|
|
183
|
+
// setting to show.
|
|
184
|
+
expect(
|
|
185
|
+
await screen.findByRole( 'combobox', { name: 'Aspect ratio' } )
|
|
186
|
+
).toBeInTheDocument();
|
|
187
|
+
expect(
|
|
188
|
+
screen.queryByLabelText( 'Crop images to fit' )
|
|
189
|
+
).not.toBeInTheDocument();
|
|
190
|
+
} );
|
|
191
|
+
|
|
192
|
+
test( 'stores a viewport aspect ratio on the Gallery instead of the images', async () => {
|
|
193
|
+
await setup(
|
|
194
|
+
[ createGallery(), createBlock( VIEWPORT_STATE_INITIALIZER ) ],
|
|
195
|
+
ASPECT_RATIO_SETTINGS
|
|
196
|
+
);
|
|
197
|
+
await selectBlock( 'Block: Gallery' );
|
|
198
|
+
|
|
199
|
+
await userEvent.selectOptions(
|
|
200
|
+
await screen.findByRole( 'combobox', { name: 'Aspect ratio' } ),
|
|
201
|
+
'16/9'
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
// The ratio is rendered from the Gallery's own responsive CSS for
|
|
205
|
+
// the viewport, so the images keep their base inline style.
|
|
206
|
+
screen.getAllByRole( 'img' ).forEach( ( image ) => {
|
|
207
|
+
// eslint-disable-next-line jest-dom/prefer-to-have-style -- toHaveStyle() is disallowed in jsdom tests.
|
|
208
|
+
expect( image.style.aspectRatio ).not.toBe( '16/9' );
|
|
209
|
+
} );
|
|
210
|
+
// The generated stylesheet has no accessible query to find it by.
|
|
211
|
+
// eslint-disable-next-line testing-library/no-node-access
|
|
212
|
+
const styleElements = document.querySelectorAll( 'style' );
|
|
213
|
+
expect(
|
|
214
|
+
Array.from( styleElements ).some( ( element ) =>
|
|
215
|
+
element.textContent.includes(
|
|
216
|
+
'aspect-ratio:16/9 !important'
|
|
217
|
+
)
|
|
218
|
+
)
|
|
219
|
+
).toBe( true );
|
|
220
|
+
} );
|
|
221
|
+
|
|
154
222
|
test( 'preserves layout settings when switching Gallery variations', async () => {
|
|
155
223
|
await setup(
|
|
156
224
|
createGallery( {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
getGalleryResponsiveCSS,
|
|
4
4
|
getUpdatedGalleryStyle,
|
|
5
5
|
} from '../responsive-styles';
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ const MEDIA_QUERIES = {
|
|
|
9
9
|
'@mobile': '@media (width <= 480px)',
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
describe( 'Gallery responsive
|
|
12
|
+
describe( 'Gallery responsive styles', () => {
|
|
13
13
|
it( 'updates crop to fit for the active viewport', () => {
|
|
14
14
|
expect(
|
|
15
15
|
getUpdatedGalleryStyle( {
|
|
@@ -51,7 +51,7 @@ describe( 'Gallery responsive Flex styles', () => {
|
|
|
51
51
|
} );
|
|
52
52
|
|
|
53
53
|
it( 'applies a viewport-specific column count', () => {
|
|
54
|
-
const css =
|
|
54
|
+
const css = getGalleryResponsiveCSS(
|
|
55
55
|
'#block-test',
|
|
56
56
|
{
|
|
57
57
|
'@mobile': {
|
|
@@ -75,7 +75,7 @@ describe( 'Gallery responsive Flex styles', () => {
|
|
|
75
75
|
] )(
|
|
76
76
|
'applies crop to fit set to %s for a viewport',
|
|
77
77
|
( imageCrop, objectFitRule, wrapperDisplayRule ) => {
|
|
78
|
-
const css =
|
|
78
|
+
const css = getGalleryResponsiveCSS(
|
|
79
79
|
'#block-test',
|
|
80
80
|
{
|
|
81
81
|
'@tablet': {
|
|
@@ -90,13 +90,57 @@ describe( 'Gallery responsive Flex styles', () => {
|
|
|
90
90
|
}
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
+
it( 'removes a viewport aspect ratio that matches the base value', () => {
|
|
94
|
+
expect(
|
|
95
|
+
getUpdatedGalleryStyle( {
|
|
96
|
+
style: { '@mobile': { aspectRatio: '4/3', columns: 1 } },
|
|
97
|
+
viewport: '@mobile',
|
|
98
|
+
baseSettings: { aspectRatio: '16/9' },
|
|
99
|
+
settings: { aspectRatio: '16/9' },
|
|
100
|
+
} )
|
|
101
|
+
).toEqual( { '@mobile': { columns: 1 } } );
|
|
102
|
+
} );
|
|
103
|
+
|
|
104
|
+
it( 'applies a viewport-specific aspect ratio in every Gallery layout', () => {
|
|
105
|
+
const css = getGalleryResponsiveCSS(
|
|
106
|
+
'#block-test',
|
|
107
|
+
{ '@mobile': { aspectRatio: '16/9' } },
|
|
108
|
+
MEDIA_QUERIES
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
expect( css ).toContain( '@media (width <= 480px)' );
|
|
112
|
+
expect( css ).toContain( 'aspect-ratio:16/9 !important' );
|
|
113
|
+
expect( css ).toContain( 'object-fit:cover !important' );
|
|
114
|
+
// Columns and cropping are Flex-only, but an aspect ratio applies to
|
|
115
|
+
// the images whichever layout the Gallery uses.
|
|
116
|
+
expect( css ).not.toContain( 'is-layout-flex' );
|
|
117
|
+
} );
|
|
118
|
+
|
|
119
|
+
it( 'cancels the base aspect ratio for a viewport set to Original', () => {
|
|
120
|
+
const css = getGalleryResponsiveCSS(
|
|
121
|
+
'#block-test',
|
|
122
|
+
{ '@tablet': { aspectRatio: 'auto' } },
|
|
123
|
+
MEDIA_QUERIES
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// `auto` would override the `width`/`height` presentational hint a
|
|
127
|
+
// lazy-loaded image relies on for its placeholder ratio, so the
|
|
128
|
+
// declaration is rolled out of the cascade instead.
|
|
129
|
+
expect( css ).toContain( 'aspect-ratio:revert-layer !important' );
|
|
130
|
+
expect( css ).not.toContain( 'aspect-ratio:auto' );
|
|
131
|
+
// The base `object-fit` is left in place so a cropped Gallery keeps
|
|
132
|
+
// cropping at this viewport.
|
|
133
|
+
expect( css ).not.toContain( 'object-fit' );
|
|
134
|
+
} );
|
|
135
|
+
|
|
93
136
|
it( 'ignores malformed viewport Gallery values', () => {
|
|
94
|
-
const css =
|
|
137
|
+
const css = getGalleryResponsiveCSS(
|
|
95
138
|
'#block-test',
|
|
96
139
|
{
|
|
97
140
|
'@tablet': {
|
|
98
141
|
columns: '3',
|
|
99
142
|
imageCrop: 'false',
|
|
143
|
+
aspectRatio: 16 / 9,
|
|
100
144
|
},
|
|
101
145
|
'@mobile': [],
|
|
102
146
|
},
|
|
@@ -105,4 +149,14 @@ describe( 'Gallery responsive Flex styles', () => {
|
|
|
105
149
|
|
|
106
150
|
expect( css ).toBe( '' );
|
|
107
151
|
} );
|
|
152
|
+
|
|
153
|
+
it( 'ignores an aspect ratio that would break out of the generated rule', () => {
|
|
154
|
+
const css = getGalleryResponsiveCSS(
|
|
155
|
+
'#block-test',
|
|
156
|
+
{ '@mobile': { aspectRatio: '16/9;} body{display:none;' } },
|
|
157
|
+
MEDIA_QUERIES
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
expect( css ).toBe( '' );
|
|
161
|
+
} );
|
|
108
162
|
} );
|
package/src/group/README.md
CHANGED
|
@@ -48,6 +48,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
48
48
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
49
49
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
50
50
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
51
|
+
- `textColumns`: `true`
|
|
51
52
|
- [`layout`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout):
|
|
52
53
|
- [`allowSizingOnChildren`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowsizingonchildren): `true`
|
|
53
54
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
package/src/group/block.json
CHANGED
package/src/heading/README.md
CHANGED
|
@@ -28,9 +28,14 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
28
28
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
29
29
|
- [`className`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#classname): `true`
|
|
30
30
|
- [`splitting`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#splitting): `true`
|
|
31
|
+
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#background):
|
|
32
|
+
- `backgroundImage`: `true`
|
|
33
|
+
- `backgroundSize`: `true`
|
|
34
|
+
- `gradient`: `true`
|
|
31
35
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
32
36
|
- [`gradients`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-gradients): `true`
|
|
33
37
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
38
|
+
- [`shadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#shadow): `true`
|
|
34
39
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
35
40
|
- `margin`: `true`
|
|
36
41
|
- `padding`: `true`
|
|
@@ -38,6 +43,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
38
43
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
39
44
|
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
|
|
40
45
|
- [`textAlign`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-textalign): `true`
|
|
46
|
+
- [`textShadow`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-textshadow): `true`
|
|
41
47
|
- `fitText`: `true`
|
|
42
48
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
|
|
43
49
|
- `clientNavigation`: `true`
|
package/src/heading/block.json
CHANGED
|
@@ -30,6 +30,15 @@
|
|
|
30
30
|
"anchor": true,
|
|
31
31
|
"className": true,
|
|
32
32
|
"splitting": true,
|
|
33
|
+
"background": {
|
|
34
|
+
"backgroundImage": true,
|
|
35
|
+
"backgroundSize": true,
|
|
36
|
+
"gradient": true,
|
|
37
|
+
"__experimentalDefaultControls": {
|
|
38
|
+
"backgroundImage": true,
|
|
39
|
+
"gradient": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
33
42
|
"__experimentalBorder": {
|
|
34
43
|
"color": true,
|
|
35
44
|
"radius": true,
|
|
@@ -44,6 +53,7 @@
|
|
|
44
53
|
"text": true
|
|
45
54
|
}
|
|
46
55
|
},
|
|
56
|
+
"shadow": true,
|
|
47
57
|
"spacing": {
|
|
48
58
|
"margin": true,
|
|
49
59
|
"padding": true,
|
|
@@ -63,6 +73,7 @@
|
|
|
63
73
|
"__experimentalTextTransform": true,
|
|
64
74
|
"__experimentalTextDecoration": true,
|
|
65
75
|
"__experimentalWritingMode": true,
|
|
76
|
+
"textShadow": true,
|
|
66
77
|
"fitText": true,
|
|
67
78
|
"__experimentalDefaultControls": {
|
|
68
79
|
"fontSize": true
|