@wordpress/block-library 9.48.1 → 10.0.1-next.v.202606191442.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 +11 -0
- package/build/breadcrumbs/edit.cjs +1 -1
- package/build/breadcrumbs/edit.cjs.map +1 -1
- package/build/button/edit.cjs +1 -1
- package/build/button/edit.cjs.map +2 -2
- package/build/categories/edit.cjs +1 -1
- package/build/categories/edit.cjs.map +1 -1
- package/build/code/edit.cjs +1 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/code/index.cjs +1 -1
- package/build/code/index.cjs.map +1 -1
- package/build/columns/utils.cjs.map +1 -1
- package/build/comments/edit/comments-legacy.cjs +1 -1
- package/build/comments/edit/comments-legacy.cjs.map +1 -1
- package/build/comments/edit/placeholder.cjs +4 -4
- package/build/comments/edit/placeholder.cjs.map +1 -1
- package/build/comments-pagination-next/edit.cjs +2 -2
- package/build/comments-pagination-next/edit.cjs.map +1 -1
- package/build/comments-pagination-previous/edit.cjs +2 -2
- package/build/comments-pagination-previous/edit.cjs.map +1 -1
- package/build/cover/deprecated.cjs +3 -3
- package/build/cover/deprecated.cjs.map +2 -2
- package/build/cover/edit/block-controls.cjs +13 -0
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/index.cjs +61 -2
- package/build/cover/edit/index.cjs.map +3 -3
- package/build/cover/edit/inspector-controls.cjs +93 -35
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/edit.cjs +1 -1
- package/build/details/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +1 -1
- package/build/embed/embed-placeholder.cjs.map +2 -2
- package/build/file/edit.cjs +3 -11
- package/build/file/edit.cjs.map +2 -2
- package/build/file/index.cjs +3 -1
- package/build/file/index.cjs.map +3 -3
- package/build/file/transforms.cjs +11 -32
- package/build/file/transforms.cjs.map +2 -2
- package/build/file/variations.cjs +38 -0
- package/build/file/variations.cjs.map +7 -0
- package/build/footnotes/edit.cjs +1 -1
- package/build/footnotes/edit.cjs.map +2 -2
- package/build/form-input/edit.cjs +1 -1
- package/build/form-input/edit.cjs.map +2 -2
- package/build/freeform/edit.cjs +1 -1
- package/build/freeform/edit.cjs.map +1 -1
- package/build/gallery/edit.cjs +2 -2
- package/build/gallery/edit.cjs.map +2 -2
- package/build/home-link/edit.cjs +1 -1
- package/build/home-link/edit.cjs.map +2 -2
- package/build/html/index.cjs +1 -1
- package/build/html/index.cjs.map +2 -2
- package/build/html/modal.cjs +3 -3
- package/build/html/modal.cjs.map +2 -2
- package/build/icon/block.json +12 -0
- package/build/icon/edit.cjs +90 -39
- package/build/icon/edit.cjs.map +3 -3
- package/build/icon/index.cjs +3 -1
- package/build/icon/index.cjs.map +3 -3
- package/build/{tab/save.cjs → icon/variations.cjs} +14 -15
- package/build/icon/variations.cjs.map +7 -0
- package/build/image/block.json +1 -0
- package/build/image/edit.cjs +4 -3
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +91 -27
- package/build/image/image.cjs.map +2 -2
- package/build/image/index.cjs +1 -1
- package/build/image/index.cjs.map +2 -2
- package/build/image/transforms.cjs +9 -3
- package/build/image/transforms.cjs.map +2 -2
- package/build/index.cjs +1 -3
- package/build/index.cjs.map +2 -2
- package/build/latest-posts/edit.cjs +1 -1
- package/build/latest-posts/edit.cjs.map +1 -1
- package/build/math/edit.cjs +1 -1
- package/build/math/index.cjs +1 -1
- package/build/math/index.cjs.map +1 -1
- package/build/media-text/constants.cjs +1 -1
- package/build/media-text/constants.cjs.map +2 -2
- package/build/media-text/index.cjs +1 -1
- package/build/media-text/index.cjs.map +2 -2
- package/build/missing/edit.cjs +2 -2
- package/build/missing/edit.cjs.map +1 -1
- package/build/navigation/edit/index.cjs +14 -8
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/navigation-menu-selector.cjs +1 -1
- package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
- package/build/navigation/edit/placeholder/index.cjs +1 -1
- package/build/navigation/edit/placeholder/index.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +1 -1
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-submenu/block.json +7 -0
- package/build/navigation-submenu/edit.cjs +1 -1
- package/build/navigation-submenu/edit.cjs.map +2 -2
- package/build/page-list/block.json +2 -5
- package/build/page-list/edit.cjs +1 -11
- package/build/page-list/edit.cjs.map +2 -2
- package/build/post-author/edit.cjs +1 -1
- package/build/post-author/edit.cjs.map +2 -2
- package/build/post-author/utils.cjs +1 -1
- package/build/post-author/utils.cjs.map +2 -2
- package/build/post-date/edit.cjs +2 -2
- package/build/post-date/edit.cjs.map +2 -2
- package/build/post-excerpt/edit.cjs +2 -2
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/post-featured-image/block.json +1 -0
- package/build/post-featured-image/dimension-controls.cjs +90 -178
- package/build/post-featured-image/dimension-controls.cjs.map +3 -3
- package/build/post-featured-image/edit.cjs +47 -17
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-navigation-link/edit.cjs +2 -2
- package/build/post-navigation-link/edit.cjs.map +2 -2
- package/build/post-time-to-read/edit.cjs +1 -1
- package/build/post-time-to-read/edit.cjs.map +1 -1
- package/build/preformatted/edit.cjs +1 -1
- package/build/preformatted/edit.cjs.map +2 -2
- package/build/pullquote/block.json +1 -3
- package/build/pullquote/deprecated.cjs +114 -9
- package/build/pullquote/deprecated.cjs.map +3 -3
- package/build/pullquote/edit.cjs +43 -61
- package/build/pullquote/edit.cjs.map +3 -3
- package/build/pullquote/save.cjs +5 -26
- package/build/pullquote/save.cjs.map +3 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.cjs.map +1 -1
- package/build/query/edit/inspector-controls/order-control.cjs +2 -2
- package/build/query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/query/utils.cjs +2 -2
- package/build/query/utils.cjs.map +2 -2
- package/build/query-pagination-next/edit.cjs +2 -2
- package/build/query-pagination-next/edit.cjs.map +1 -1
- package/build/query-pagination-previous/edit.cjs +2 -2
- package/build/query-pagination-previous/edit.cjs.map +1 -1
- package/build/query-title/edit.cjs +1 -1
- package/build/query-title/edit.cjs.map +2 -2
- package/build/query-total/edit.cjs +1 -1
- package/build/query-total/edit.cjs.map +2 -2
- package/build/quote/index.cjs +1 -1
- package/build/quote/index.cjs.map +2 -2
- package/build/read-more/edit.cjs +1 -1
- package/build/read-more/edit.cjs.map +2 -2
- package/build/rss/edit.cjs +1 -1
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/edit.cjs +3 -3
- package/build/search/edit.cjs.map +2 -2
- package/build/shortcode/edit.cjs +1 -1
- package/build/shortcode/edit.cjs.map +2 -2
- package/build/site-tagline/edit.cjs +1 -1
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +1 -1
- package/build/site-title/edit.cjs.map +2 -2
- package/build/tab-list/block.json +34 -21
- package/build/tab-list/edit.cjs +116 -12
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/save.cjs +33 -3
- package/build/tab-list/save.cjs.map +3 -3
- package/build/tab-panel/add-tab-toolbar-control.cjs +19 -8
- package/build/tab-panel/add-tab-toolbar-control.cjs.map +2 -2
- package/build/tab-panel/block.json +2 -6
- package/build/tab-panel/remove-tab-toolbar-control.cjs +9 -14
- package/build/tab-panel/remove-tab-toolbar-control.cjs.map +2 -2
- package/build/tab-panels/block.json +2 -27
- package/build/table/index.cjs +1 -1
- package/build/table/index.cjs.map +2 -2
- package/build/tabs/block.json +3 -17
- package/build/tabs/edit.cjs +7 -21
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/index.cjs +6 -10
- package/build/tabs/index.cjs.map +2 -2
- package/build/tabs/use-tab-list-items-sync.cjs +53 -0
- package/build/tabs/use-tab-list-items-sync.cjs.map +7 -0
- package/build/tabs/view.cjs +2 -10
- package/build/tabs/view.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/utils/style-state.cjs +164 -0
- package/build/utils/style-state.cjs.map +7 -0
- package/build/utils/waveform-player.cjs +1 -1
- package/build/verse/edit.cjs +1 -1
- package/build/verse/edit.cjs.map +2 -2
- package/build-module/breadcrumbs/edit.mjs +1 -1
- package/build-module/breadcrumbs/edit.mjs.map +1 -1
- package/build-module/button/edit.mjs +1 -1
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/categories/edit.mjs +1 -1
- package/build-module/categories/edit.mjs.map +1 -1
- package/build-module/code/edit.mjs +1 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/code/index.mjs +1 -1
- package/build-module/code/index.mjs.map +1 -1
- package/build-module/columns/utils.mjs.map +1 -1
- package/build-module/comments/edit/comments-legacy.mjs +1 -1
- package/build-module/comments/edit/comments-legacy.mjs.map +1 -1
- package/build-module/comments/edit/placeholder.mjs +4 -4
- package/build-module/comments/edit/placeholder.mjs.map +1 -1
- package/build-module/comments-pagination-next/edit.mjs +2 -2
- package/build-module/comments-pagination-next/edit.mjs.map +1 -1
- package/build-module/comments-pagination-previous/edit.mjs +2 -2
- package/build-module/comments-pagination-previous/edit.mjs.map +1 -1
- package/build-module/cover/deprecated.mjs +3 -3
- package/build-module/cover/deprecated.mjs.map +2 -2
- package/build-module/cover/edit/block-controls.mjs +15 -2
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +64 -3
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +98 -35
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/edit.mjs +1 -1
- package/build-module/details/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +1 -1
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/file/edit.mjs +5 -13
- package/build-module/file/edit.mjs.map +2 -2
- package/build-module/file/index.mjs +3 -1
- package/build-module/file/index.mjs.map +2 -2
- package/build-module/file/transforms.mjs +11 -32
- package/build-module/file/transforms.mjs.map +2 -2
- package/build-module/file/variations.mjs +17 -0
- package/build-module/file/variations.mjs.map +7 -0
- package/build-module/footnotes/edit.mjs +1 -1
- package/build-module/footnotes/edit.mjs.map +2 -2
- package/build-module/form-input/edit.mjs +1 -1
- package/build-module/form-input/edit.mjs.map +2 -2
- package/build-module/freeform/edit.mjs +1 -1
- package/build-module/freeform/edit.mjs.map +1 -1
- package/build-module/gallery/edit.mjs +2 -2
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/home-link/edit.mjs +1 -1
- package/build-module/home-link/edit.mjs.map +2 -2
- package/build-module/html/index.mjs +1 -1
- package/build-module/html/index.mjs.map +2 -2
- package/build-module/html/modal.mjs +3 -3
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/block.json +12 -0
- package/build-module/icon/edit.mjs +94 -40
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/icon/index.mjs +3 -1
- package/build-module/icon/index.mjs.map +2 -2
- package/build-module/icon/variations.mjs +13 -0
- package/build-module/icon/variations.mjs.map +7 -0
- package/build-module/image/block.json +1 -0
- package/build-module/image/edit.mjs +4 -3
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +96 -27
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/index.mjs +1 -1
- package/build-module/image/index.mjs.map +2 -2
- package/build-module/image/transforms.mjs +9 -3
- package/build-module/image/transforms.mjs.map +2 -2
- package/build-module/index.mjs +1 -3
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs +1 -1
- package/build-module/latest-posts/edit.mjs.map +1 -1
- package/build-module/math/edit.mjs +1 -1
- package/build-module/math/index.mjs +1 -1
- package/build-module/math/index.mjs.map +1 -1
- package/build-module/media-text/constants.mjs +1 -1
- package/build-module/media-text/constants.mjs.map +2 -2
- package/build-module/media-text/index.mjs +1 -1
- package/build-module/media-text/index.mjs.map +2 -2
- package/build-module/missing/edit.mjs +2 -2
- package/build-module/missing/edit.mjs.map +1 -1
- package/build-module/navigation/edit/index.mjs +14 -8
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.mjs +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs +1 -1
- package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +1 -1
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-submenu/block.json +7 -0
- package/build-module/navigation-submenu/edit.mjs +1 -1
- package/build-module/navigation-submenu/edit.mjs.map +2 -2
- package/build-module/page-list/block.json +2 -5
- package/build-module/page-list/edit.mjs +1 -11
- package/build-module/page-list/edit.mjs.map +2 -2
- package/build-module/post-author/edit.mjs +1 -1
- package/build-module/post-author/edit.mjs.map +2 -2
- package/build-module/post-author/utils.mjs +1 -1
- package/build-module/post-author/utils.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +2 -2
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/post-excerpt/edit.mjs +2 -2
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/post-featured-image/block.json +1 -0
- package/build-module/post-featured-image/dimension-controls.mjs +99 -187
- package/build-module/post-featured-image/dimension-controls.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +47 -17
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/edit.mjs +2 -2
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-time-to-read/edit.mjs +1 -1
- package/build-module/post-time-to-read/edit.mjs.map +1 -1
- package/build-module/preformatted/edit.mjs +1 -1
- package/build-module/preformatted/edit.mjs.map +2 -2
- package/build-module/pullquote/block.json +1 -3
- package/build-module/pullquote/deprecated.mjs +114 -9
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/pullquote/edit.mjs +44 -67
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/pullquote/save.mjs +5 -16
- package/build-module/pullquote/save.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.mjs.map +1 -1
- 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/utils.mjs +2 -2
- package/build-module/query/utils.mjs.map +2 -2
- package/build-module/query-pagination-next/edit.mjs +2 -2
- package/build-module/query-pagination-next/edit.mjs.map +1 -1
- package/build-module/query-pagination-previous/edit.mjs +2 -2
- package/build-module/query-pagination-previous/edit.mjs.map +1 -1
- package/build-module/query-title/edit.mjs +1 -1
- package/build-module/query-title/edit.mjs.map +2 -2
- package/build-module/query-total/edit.mjs +1 -1
- package/build-module/query-total/edit.mjs.map +2 -2
- package/build-module/quote/index.mjs +1 -1
- package/build-module/quote/index.mjs.map +2 -2
- package/build-module/read-more/edit.mjs +1 -1
- package/build-module/read-more/edit.mjs.map +2 -2
- package/build-module/rss/edit.mjs +1 -1
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/edit.mjs +3 -3
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/shortcode/edit.mjs +1 -1
- package/build-module/shortcode/edit.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +1 -1
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +1 -1
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +34 -21
- package/build-module/tab-list/edit.mjs +122 -15
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/save.mjs +29 -4
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panel/add-tab-toolbar-control.mjs +19 -8
- package/build-module/tab-panel/add-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab-panel/block.json +2 -6
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs +9 -14
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs.map +2 -2
- package/build-module/tab-panels/block.json +2 -27
- package/build-module/table/index.mjs +1 -1
- package/build-module/table/index.mjs.map +2 -2
- package/build-module/tabs/block.json +3 -17
- package/build-module/tabs/edit.mjs +7 -21
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/index.mjs +6 -10
- package/build-module/tabs/index.mjs.map +2 -2
- package/build-module/tabs/use-tab-list-items-sync.mjs +32 -0
- package/build-module/tabs/use-tab-list-items-sync.mjs.map +7 -0
- package/build-module/tabs/view.mjs +2 -10
- package/build-module/tabs/view.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/utils/style-state.mjs +132 -0
- package/build-module/utils/style-state.mjs.map +7 -0
- package/build-module/utils/waveform-player.mjs +1 -1
- package/build-module/verse/edit.mjs +1 -1
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-style/editor-rtl.css +12 -16
- package/build-style/editor.css +12 -16
- package/build-style/icon/style-rtl.css +9 -0
- package/build-style/icon/style.css +9 -0
- package/build-style/style-rtl.css +11 -24
- package/build-style/style.css +11 -24
- package/build-style/tab-list/editor-rtl.css +12 -4
- package/build-style/tab-list/editor.css +12 -4
- package/build-style/{tab → tab-list}/style-rtl.css +2 -2
- package/build-style/{tab → tab-list}/style.css +2 -2
- package/build-style/tab-panel/style-rtl.css +0 -17
- package/build-style/tab-panel/style.css +0 -17
- package/package.json +48 -45
- package/src/avatar/index.php +2 -2
- package/src/block/index.php +2 -26
- package/src/comment-author-avatar/index.php +3 -3
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-date/index.php +1 -1
- package/src/cover/edit/block-controls.js +14 -2
- package/src/cover/edit/index.js +86 -0
- package/src/cover/edit/inspector-controls.js +124 -54
- package/src/editor.scss +0 -1
- package/src/file/edit.js +3 -16
- package/src/file/index.js +2 -0
- package/src/file/transforms.js +12 -31
- package/src/file/variations.js +17 -0
- package/src/gallery/edit.js +13 -13
- package/src/icon/README.md +3 -0
- package/src/icon/block.json +12 -0
- package/src/icon/edit.js +86 -36
- package/src/icon/index.js +3 -1
- package/src/icon/index.php +23 -0
- package/src/icon/style.scss +12 -0
- package/src/icon/variations.js +9 -0
- package/src/image/README.md +1 -0
- package/src/image/block.json +1 -0
- package/src/image/edit.js +8 -3
- package/src/image/image.js +120 -54
- package/src/image/index.php +0 -1
- package/src/image/transforms.js +34 -8
- package/src/index.js +4 -11
- package/src/navigation/edit/index.js +23 -10
- package/src/navigation/index.php +58 -0
- package/src/navigation-submenu/README.md +5 -0
- package/src/navigation-submenu/block.json +7 -0
- package/src/page-list/README.md +1 -1
- package/src/page-list/block.json +2 -5
- package/src/page-list/edit.js +0 -11
- package/src/page-list/index.php +1 -1
- package/src/post-date/edit.js +2 -2
- package/src/post-featured-image/README.md +1 -0
- package/src/post-featured-image/block.json +1 -0
- package/src/post-featured-image/dimension-controls.js +105 -184
- package/src/post-featured-image/edit.js +53 -21
- package/src/post-featured-image/index.php +24 -22
- package/src/pullquote/README.md +1 -1
- package/src/pullquote/block.json +1 -3
- package/src/pullquote/deprecated.js +121 -9
- package/src/pullquote/edit.js +7 -31
- package/src/pullquote/save.js +2 -13
- package/src/search/index.php +1 -1
- package/src/style.scss +1 -2
- package/src/tab-list/README.md +19 -17
- package/src/tab-list/block.json +34 -21
- package/src/tab-list/edit.js +147 -15
- package/src/tab-list/editor.scss +13 -6
- package/src/tab-list/index.php +23 -30
- package/src/tab-list/save.js +39 -4
- package/src/{tab → tab-list}/style.scss +1 -1
- package/src/tab-panel/README.md +0 -3
- package/src/tab-panel/add-tab-toolbar-control.js +24 -11
- package/src/tab-panel/block.json +2 -6
- package/src/tab-panel/remove-tab-toolbar-control.js +10 -14
- package/src/tab-panel/style.scss +0 -17
- package/src/tab-panels/README.md +0 -16
- package/src/tab-panels/block.json +2 -27
- package/src/tabs/README.md +1 -7
- package/src/tabs/block.json +3 -17
- package/src/tabs/edit.js +8 -19
- package/src/tabs/index.js +6 -10
- package/src/tabs/index.php +0 -13
- package/src/tabs/use-tab-list-items-sync.js +49 -0
- package/src/tabs/view.js +2 -10
- package/src/utils/style-state.js +151 -0
- package/src/utils/test/style-state.js +307 -0
- package/babel-plugin.cjs +0 -150
- package/build/tab/block.json +0 -56
- package/build/tab/controls.cjs +0 -46
- package/build/tab/controls.cjs.map +0 -7
- package/build/tab/edit.cjs +0 -135
- package/build/tab/edit.cjs.map +0 -7
- package/build/tab/index.cjs +0 -58
- package/build/tab/index.cjs.map +0 -7
- package/build/tab/save.cjs.map +0 -7
- package/build/tabs/use-tab-list-sync.cjs +0 -190
- package/build/tabs/use-tab-list-sync.cjs.map +0 -7
- package/build-module/tab/block.json +0 -56
- package/build-module/tab/controls.mjs +0 -15
- package/build-module/tab/controls.mjs.map +0 -7
- package/build-module/tab/edit.mjs +0 -108
- package/build-module/tab/edit.mjs.map +0 -7
- package/build-module/tab/index.mjs +0 -20
- package/build-module/tab/index.mjs.map +0 -7
- package/build-module/tab/save.mjs +0 -14
- package/build-module/tab/save.mjs.map +0 -7
- package/build-module/tabs/use-tab-list-sync.mjs +0 -169
- package/build-module/tabs/use-tab-list-sync.mjs.map +0 -7
- package/build-style/tab/editor-rtl.css +0 -11
- package/build-style/tab/editor.css +0 -11
- package/build-style/tab-panels/style-rtl.css +0 -4
- package/build-style/tab-panels/style.css +0 -4
- package/src/tab/README.md +0 -69
- package/src/tab/block.json +0 -56
- package/src/tab/controls.js +0 -19
- package/src/tab/edit.js +0 -141
- package/src/tab/editor.scss +0 -14
- package/src/tab/index.js +0 -24
- package/src/tab/index.php +0 -70
- package/src/tab/save.js +0 -13
- package/src/tab-panels/style.scss +0 -4
- package/src/tabs/use-tab-list-sync.js +0 -237
package/src/tab-list/index.php
CHANGED
|
@@ -8,14 +8,15 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* Render callback for core/tab-list.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Injects IAPI directives into the saved button HTML. The buttons already
|
|
12
|
+
* carry color/border/padding styles from save.js; this callback adds
|
|
13
|
+
* tab-specific attributes (id, aria-controls, context) and interactivity
|
|
14
|
+
* directives using data from the tabs-list context.
|
|
14
15
|
*
|
|
15
16
|
* @since 7.0.0
|
|
16
17
|
*
|
|
17
18
|
* @param array $attributes Block attributes.
|
|
18
|
-
* @param string $content Block content (rendered
|
|
19
|
+
* @param string $content Block content (rendered buttons from save.js).
|
|
19
20
|
* @param \WP_Block $block WP_Block instance.
|
|
20
21
|
*
|
|
21
22
|
* @return string Updated HTML.
|
|
@@ -27,41 +28,33 @@ function block_core_tab_list_render_callback( array $attributes, string $content
|
|
|
27
28
|
return $content;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
$buttons_html = '';
|
|
33
|
-
$tab_position = 0;
|
|
31
|
+
$tag_processor = new WP_HTML_Tag_Processor( $content );
|
|
32
|
+
$tab_index = 0;
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
$tab = $tabs_list[ $tab_position ] ?? null;
|
|
41
|
-
$tab_index = $tab_position;
|
|
42
|
-
++$tab_position;
|
|
34
|
+
while ( $tag_processor->next_tag( 'button' ) ) {
|
|
35
|
+
$tab = $tabs_list[ $tab_index ] ?? null;
|
|
43
36
|
|
|
44
|
-
// Skip tabs with no matching tab panel.
|
|
45
37
|
if ( null === $tab ) {
|
|
46
|
-
|
|
38
|
+
break;
|
|
47
39
|
}
|
|
48
40
|
|
|
49
|
-
$
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
$tab_id = $tab['id'] ?? 'tab-' . $tab_index;
|
|
42
|
+
|
|
43
|
+
$tag_processor->set_attribute( 'id', 'tab__' . $tab_id );
|
|
44
|
+
$tag_processor->set_attribute( 'aria-controls', $tab_id );
|
|
45
|
+
$tag_processor->set_attribute( 'data-wp-on--click', 'actions.handleTabClick' );
|
|
46
|
+
$tag_processor->set_attribute( 'data-wp-on--keydown', 'actions.handleTabKeyDown' );
|
|
47
|
+
$tag_processor->set_attribute( 'data-wp-bind--aria-selected', 'state.isActiveTab' );
|
|
48
|
+
$tag_processor->set_attribute( 'data-wp-bind--tabindex', 'state.tabIndexAttribute' );
|
|
49
|
+
$tag_processor->set_attribute(
|
|
50
|
+
'data-wp-context',
|
|
51
|
+
wp_json_encode( array( 'tabIndex' => $tab_index ) )
|
|
56
52
|
);
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
$buttons_html .= $tab_block->render();
|
|
54
|
+
++$tab_index;
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
$wrapper_attributes = get_block_wrapper_attributes( array( 'role' => 'tablist' ) );
|
|
64
|
-
return sprintf( '<div %s>%s</div>', $wrapper_attributes, $buttons_html );
|
|
57
|
+
return $tag_processor->get_updated_html();
|
|
65
58
|
}
|
|
66
59
|
|
|
67
60
|
/**
|
package/src/tab-list/save.js
CHANGED
|
@@ -1,14 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useBlockProps,
|
|
11
|
+
__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,
|
|
12
|
+
__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,
|
|
13
|
+
__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
|
|
14
|
+
} from '@wordpress/block-editor';
|
|
5
15
|
|
|
6
|
-
export default function save() {
|
|
16
|
+
export default function save( { attributes } ) {
|
|
17
|
+
const { tabs } = attributes;
|
|
7
18
|
const blockProps = useBlockProps.save( {
|
|
8
19
|
role: 'tablist',
|
|
9
20
|
} );
|
|
10
21
|
|
|
11
|
-
const
|
|
22
|
+
const colorProps = getColorClassesAndStyles( attributes );
|
|
23
|
+
const borderProps = getBorderClassesAndStyles( attributes );
|
|
24
|
+
const spacingProps = getSpacingClassesAndStyles( attributes );
|
|
25
|
+
|
|
26
|
+
const buttonClassName = clsx( colorProps.className, borderProps.className );
|
|
27
|
+
|
|
28
|
+
const buttonStyle = {
|
|
29
|
+
...colorProps.style,
|
|
30
|
+
...borderProps.style,
|
|
31
|
+
...spacingProps.style,
|
|
32
|
+
};
|
|
12
33
|
|
|
13
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
<div { ...blockProps }>
|
|
36
|
+
{ tabs.map( ( tab, index ) => (
|
|
37
|
+
<button
|
|
38
|
+
key={ index }
|
|
39
|
+
className={ buttonClassName || undefined }
|
|
40
|
+
style={ buttonStyle }
|
|
41
|
+
type="button"
|
|
42
|
+
role="tab"
|
|
43
|
+
>
|
|
44
|
+
{ tab.label }
|
|
45
|
+
</button>
|
|
46
|
+
) ) }
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
14
49
|
}
|
package/src/tab-panel/README.md
CHANGED
|
@@ -29,7 +29,6 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
29
29
|
|
|
30
30
|
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `true`
|
|
31
31
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
32
|
-
- [`reusable`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#reusable): `false`
|
|
33
32
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
34
33
|
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-background): `true`
|
|
35
34
|
- [`text`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-text): `true`
|
|
@@ -37,10 +36,8 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
37
36
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
38
37
|
- `blockGap`: `true`
|
|
39
38
|
- `padding`: `true`
|
|
40
|
-
- `margin`: `false`
|
|
41
39
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
42
40
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
43
|
-
- [`renaming`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#renaming): `true`
|
|
44
41
|
- [`visibility`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#visibility): `false`
|
|
45
42
|
|
|
46
43
|
## Context
|
|
@@ -12,22 +12,28 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* "Add tab" button in the block toolbar for the tabs block.
|
|
15
|
-
* Inserts a new core/tab-panel into the tab-panels
|
|
16
|
-
*
|
|
15
|
+
* Inserts a new core/tab-panel into the tab-panels. The tab-list items
|
|
16
|
+
* attribute is kept in sync automatically via useTabListItemsSync.
|
|
17
17
|
*
|
|
18
18
|
* @param {Object} props
|
|
19
19
|
* @param {string} props.tabsClientId The client ID of the parent tabs block.
|
|
20
20
|
* @return {React.JSX.Element} The toolbar control element.
|
|
21
21
|
*/
|
|
22
22
|
export default function AddTabToolbarControl( { tabsClientId } ) {
|
|
23
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
insertBlock,
|
|
25
|
+
updateBlockAttributes,
|
|
26
|
+
selectBlock,
|
|
27
|
+
__unstableMarkNextChangeAsNotPersistent,
|
|
28
|
+
} = useDispatch( blockEditorStore );
|
|
24
29
|
|
|
25
|
-
const { tabPanelsClientId,
|
|
30
|
+
const { tabPanelsClientId, tabCount, tabListClientId } = useSelect(
|
|
26
31
|
( select ) => {
|
|
27
32
|
if ( ! tabsClientId ) {
|
|
28
33
|
return {
|
|
29
34
|
tabPanelsClientId: null,
|
|
30
|
-
|
|
35
|
+
tabCount: 0,
|
|
36
|
+
tabListClientId: null,
|
|
31
37
|
};
|
|
32
38
|
}
|
|
33
39
|
const { getBlocks } = select( blockEditorStore );
|
|
@@ -40,7 +46,8 @@ export default function AddTabToolbarControl( { tabsClientId } ) {
|
|
|
40
46
|
);
|
|
41
47
|
return {
|
|
42
48
|
tabPanelsClientId: tabPanels?.clientId || null,
|
|
43
|
-
|
|
49
|
+
tabCount: tabPanels?.innerBlocks?.length || 0,
|
|
50
|
+
tabListClientId: tabList?.clientId || null,
|
|
44
51
|
};
|
|
45
52
|
},
|
|
46
53
|
[ tabsClientId ]
|
|
@@ -54,12 +61,18 @@ export default function AddTabToolbarControl( { tabsClientId } ) {
|
|
|
54
61
|
const newTabPanelBlock = createBlock( 'core/tab-panel', {
|
|
55
62
|
label: __( 'Tab' ),
|
|
56
63
|
} );
|
|
57
|
-
insertBlock( newTabPanelBlock, undefined, tabPanelsClientId );
|
|
64
|
+
insertBlock( newTabPanelBlock, undefined, tabPanelsClientId, false );
|
|
58
65
|
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
// Switch editor active tab to the new tab.
|
|
67
|
+
const newIndex = tabCount;
|
|
68
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
69
|
+
updateBlockAttributes( tabsClientId, {
|
|
70
|
+
editorActiveTabIndex: newIndex,
|
|
71
|
+
} );
|
|
72
|
+
|
|
73
|
+
// Select the tab-list block so focus stays in the menu area.
|
|
74
|
+
if ( tabListClientId ) {
|
|
75
|
+
selectBlock( tabListClientId );
|
|
63
76
|
}
|
|
64
77
|
};
|
|
65
78
|
|
package/src/tab-panel/block.json
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"supports": {
|
|
23
23
|
"anchor": true,
|
|
24
24
|
"html": false,
|
|
25
|
-
"reusable": false,
|
|
26
25
|
"color": {
|
|
27
26
|
"background": true,
|
|
28
27
|
"text": true,
|
|
@@ -34,8 +33,7 @@
|
|
|
34
33
|
"layout": true,
|
|
35
34
|
"spacing": {
|
|
36
35
|
"blockGap": true,
|
|
37
|
-
"padding": true
|
|
38
|
-
"margin": false
|
|
36
|
+
"padding": true
|
|
39
37
|
},
|
|
40
38
|
"typography": {
|
|
41
39
|
"fontSize": true,
|
|
@@ -45,12 +43,10 @@
|
|
|
45
43
|
"__experimentalFontFamily": true
|
|
46
44
|
}
|
|
47
45
|
},
|
|
48
|
-
"renaming": true,
|
|
49
46
|
"visibility": false
|
|
50
47
|
},
|
|
51
48
|
"providesContext": {
|
|
52
49
|
"core/tab-label": "label"
|
|
53
50
|
},
|
|
54
|
-
"
|
|
55
|
-
"style": "file:./style-index.css"
|
|
51
|
+
"style": "wp-block-tab-panel"
|
|
56
52
|
}
|
|
@@ -11,8 +11,8 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* "Remove Tab" button in the block toolbar for the tabs block.
|
|
14
|
-
* Removes the currently active core/tab-panel
|
|
15
|
-
*
|
|
14
|
+
* Removes the currently active core/tab-panel. The tab-list items
|
|
15
|
+
* attribute is kept in sync automatically via useTabListItemsSync.
|
|
16
16
|
*
|
|
17
17
|
* @param {Object} props
|
|
18
18
|
* @param {string} props.tabsClientId The client ID of the parent tabs block.
|
|
@@ -28,17 +28,17 @@ export default function RemoveTabToolbarControl( { tabsClientId } ) {
|
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
activeTabPanelClientId,
|
|
31
|
-
activeTabClientId,
|
|
32
31
|
tabCount,
|
|
33
32
|
editorActiveTabIndex,
|
|
33
|
+
tabListClientId,
|
|
34
34
|
} = useSelect(
|
|
35
35
|
( select ) => {
|
|
36
36
|
if ( ! tabsClientId ) {
|
|
37
37
|
return {
|
|
38
38
|
activeTabPanelClientId: null,
|
|
39
|
-
activeTabClientId: null,
|
|
40
39
|
tabCount: 0,
|
|
41
40
|
editorActiveTabIndex: 0,
|
|
41
|
+
tabListClientId: null,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
const { getBlocks, getBlockAttributes } =
|
|
@@ -56,15 +56,13 @@ export default function RemoveTabToolbarControl( { tabsClientId } ) {
|
|
|
56
56
|
( block ) => block.name === 'core/tab-list'
|
|
57
57
|
);
|
|
58
58
|
const tabPanelBlocks = tabPanels?.innerBlocks || [];
|
|
59
|
-
const tabs = tabList?.innerBlocks || [];
|
|
60
59
|
const activeTabPanel = tabPanelBlocks[ activeIndex ];
|
|
61
|
-
const activeTab = tabs[ activeIndex ];
|
|
62
60
|
|
|
63
61
|
return {
|
|
64
62
|
activeTabPanelClientId: activeTabPanel?.clientId || null,
|
|
65
|
-
|
|
66
|
-
tabCount: tabs.length,
|
|
63
|
+
tabCount: tabPanelBlocks.length,
|
|
67
64
|
editorActiveTabIndex: activeIndex,
|
|
65
|
+
tabListClientId: tabList?.clientId || null,
|
|
68
66
|
};
|
|
69
67
|
},
|
|
70
68
|
[ tabsClientId ]
|
|
@@ -86,14 +84,12 @@ export default function RemoveTabToolbarControl( { tabsClientId } ) {
|
|
|
86
84
|
editorActiveTabIndex: newActiveIndex,
|
|
87
85
|
} );
|
|
88
86
|
|
|
89
|
-
// Remove the tab panel
|
|
87
|
+
// Remove the tab panel.
|
|
90
88
|
removeBlock( activeTabPanelClientId, false );
|
|
91
|
-
if ( activeTabClientId ) {
|
|
92
|
-
removeBlock( activeTabClientId, false );
|
|
93
|
-
}
|
|
94
89
|
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
// Select the tab-list so focus moves to the new active tab button.
|
|
91
|
+
if ( tabListClientId ) {
|
|
92
|
+
selectBlock( tabListClientId );
|
|
97
93
|
}
|
|
98
94
|
};
|
|
99
95
|
|
package/src/tab-panel/style.scss
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
.wp-block-tab-panel {
|
|
2
|
-
max-width: 100%;
|
|
3
|
-
flex-basis: 100%;
|
|
4
|
-
flex-grow: 1;
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
|
|
7
|
-
& > *:first-child {
|
|
8
|
-
margin-top: 0;
|
|
9
|
-
}
|
|
10
|
-
& > *:last-child {
|
|
11
|
-
margin-bottom: 0;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
2
|
&[hidden],
|
|
15
3
|
&:empty {
|
|
16
4
|
display: none !important;
|
|
17
5
|
}
|
|
18
6
|
}
|
|
19
|
-
|
|
20
|
-
.wp-block-tab-panel.wp-block.has-background,
|
|
21
|
-
.wp-block-tab-panel:not(.wp-block).has-background {
|
|
22
|
-
padding: var(--wp--preset--spacing--30);
|
|
23
|
-
}
|
package/src/tab-panels/README.md
CHANGED
|
@@ -28,34 +28,18 @@ _This block has no custom attributes._
|
|
|
28
28
|
|
|
29
29
|
_Defined via the [`supports`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/) property in block.json._
|
|
30
30
|
|
|
31
|
-
- [`anchor`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#anchor): `false`
|
|
32
31
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
33
|
-
- [`reusable`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#reusable): `false`
|
|
34
32
|
- [`visibility`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#visibility): `false`
|
|
35
33
|
- [`lock`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#lock): `false`
|
|
36
|
-
- [`dimensions`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#dimensions):
|
|
37
|
-
- `aspectRatio`: `false`
|
|
38
|
-
- `height`: `false`
|
|
39
|
-
- `minHeight`: `false`
|
|
40
|
-
- `width`: `false`
|
|
41
34
|
- [`color`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color):
|
|
42
35
|
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-background): `true`
|
|
43
36
|
- [`text`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-text): `true`
|
|
44
37
|
- [`heading`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-heading): `true`
|
|
45
38
|
- [`link`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-link): `true`
|
|
46
39
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
47
|
-
- `blockGap`: `false`
|
|
48
40
|
- `padding`: `true`
|
|
49
|
-
- `margin`: `true`
|
|
50
41
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
51
42
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
52
|
-
- [`layout`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout):
|
|
53
|
-
- [`default`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-default): `{"type":"flex","flexWrap":"nowrap","justifyContent":"stretch","orientation":"vertical"}`
|
|
54
|
-
- [`allowSwitching`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowswitching): `false`
|
|
55
|
-
- [`allowVerticalAlignment`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowverticalalignment): `false`
|
|
56
|
-
- [`allowOrientation`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-alloworientation): `false`
|
|
57
|
-
- [`allowJustification`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowjustification): `true`
|
|
58
|
-
- [`allowSizingOnChildren`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowsizingonchildren): `false`
|
|
59
43
|
|
|
60
44
|
## Block Markup
|
|
61
45
|
|
|
@@ -11,17 +11,9 @@
|
|
|
11
11
|
"allowedBlocks": [ "core/tab-panel" ],
|
|
12
12
|
"attributes": {},
|
|
13
13
|
"supports": {
|
|
14
|
-
"anchor": false,
|
|
15
14
|
"html": false,
|
|
16
|
-
"reusable": false,
|
|
17
15
|
"visibility": false,
|
|
18
16
|
"lock": false,
|
|
19
|
-
"dimensions": {
|
|
20
|
-
"aspectRatio": false,
|
|
21
|
-
"height": false,
|
|
22
|
-
"minHeight": false,
|
|
23
|
-
"width": false
|
|
24
|
-
},
|
|
25
17
|
"color": {
|
|
26
18
|
"background": true,
|
|
27
19
|
"text": true,
|
|
@@ -33,34 +25,17 @@
|
|
|
33
25
|
}
|
|
34
26
|
},
|
|
35
27
|
"spacing": {
|
|
36
|
-
"
|
|
37
|
-
"padding": true,
|
|
38
|
-
"margin": true
|
|
28
|
+
"padding": true
|
|
39
29
|
},
|
|
40
30
|
"typography": {
|
|
41
31
|
"fontSize": true,
|
|
42
32
|
"__experimentalFontFamily": true
|
|
43
33
|
},
|
|
44
|
-
"layout": {
|
|
45
|
-
"default": {
|
|
46
|
-
"type": "flex",
|
|
47
|
-
"flexWrap": "nowrap",
|
|
48
|
-
"justifyContent": "stretch",
|
|
49
|
-
"orientation": "vertical"
|
|
50
|
-
},
|
|
51
|
-
"allowSwitching": false,
|
|
52
|
-
"allowVerticalAlignment": false,
|
|
53
|
-
"allowOrientation": false,
|
|
54
|
-
"allowJustification": true,
|
|
55
|
-
"allowSizingOnChildren": false
|
|
56
|
-
},
|
|
57
34
|
"__experimentalBorder": {
|
|
58
35
|
"radius": true,
|
|
59
36
|
"color": true,
|
|
60
37
|
"width": true,
|
|
61
38
|
"style": true
|
|
62
39
|
}
|
|
63
|
-
}
|
|
64
|
-
"editorScript": "file:./index.js",
|
|
65
|
-
"style": "file:./style-index.css"
|
|
40
|
+
}
|
|
66
41
|
}
|
package/src/tabs/README.md
CHANGED
|
@@ -35,12 +35,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
35
35
|
- [`text`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-text): `true`
|
|
36
36
|
- [`background`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#color-background): `true`
|
|
37
37
|
- [`layout`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout):
|
|
38
|
-
- [`
|
|
39
|
-
- [`allowSwitching`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowswitching): `false`
|
|
40
|
-
- [`allowVerticalAlignment`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowverticalalignment): `true`
|
|
41
|
-
- [`allowJustification`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowjustification): `true`
|
|
42
|
-
- [`allowOrientation`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-alloworientation): `true`
|
|
43
|
-
- [`allowSizingOnChildren`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowsizingonchildren): `true`
|
|
38
|
+
- [`allowEditing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#layout-allowediting): `false`
|
|
44
39
|
- [`html`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#html): `false`
|
|
45
40
|
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity): `true`
|
|
46
41
|
- [`spacing`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#spacing):
|
|
@@ -49,7 +44,6 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
|
|
|
49
44
|
- `padding`: `true`
|
|
50
45
|
- [`typography`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography):
|
|
51
46
|
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
|
|
52
|
-
- [`renaming`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#renaming): `true`
|
|
53
47
|
|
|
54
48
|
## Context
|
|
55
49
|
|
package/src/tabs/block.json
CHANGED
|
@@ -30,18 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"layout": {
|
|
33
|
-
"
|
|
34
|
-
"type": "flex",
|
|
35
|
-
"flexWrap": "nowrap",
|
|
36
|
-
"justifyContent": "stretch",
|
|
37
|
-
"verticalAlignment": "stretch",
|
|
38
|
-
"orientation": "vertical"
|
|
39
|
-
},
|
|
40
|
-
"allowSwitching": false,
|
|
41
|
-
"allowVerticalAlignment": true,
|
|
42
|
-
"allowJustification": true,
|
|
43
|
-
"allowOrientation": true,
|
|
44
|
-
"allowSizingOnChildren": true
|
|
33
|
+
"allowEditing": false
|
|
45
34
|
},
|
|
46
35
|
"html": false,
|
|
47
36
|
"interactivity": true,
|
|
@@ -53,16 +42,13 @@
|
|
|
53
42
|
"typography": {
|
|
54
43
|
"fontSize": true,
|
|
55
44
|
"__experimentalFontFamily": true
|
|
56
|
-
}
|
|
57
|
-
"renaming": true
|
|
45
|
+
}
|
|
58
46
|
},
|
|
59
47
|
"providesContext": {
|
|
60
48
|
"core/tabs-activeTabIndex": "activeTabIndex",
|
|
61
49
|
"core/tabs-editorActiveTabIndex": "editorActiveTabIndex"
|
|
62
50
|
},
|
|
63
51
|
"usesContext": [ "core/tabs-list", "core/tabs-id" ],
|
|
64
|
-
"
|
|
65
|
-
"editorStyle": "file:./index.css",
|
|
66
|
-
"style": "file:./style-index.css",
|
|
52
|
+
"style": "wp-block-tabs",
|
|
67
53
|
"viewScriptModule": "@wordpress/block-library/tabs/view"
|
|
68
54
|
}
|
package/src/tabs/edit.js
CHANGED
|
@@ -14,7 +14,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import Controls from './controls';
|
|
17
|
-
import
|
|
17
|
+
import useTabListItemsSync from './use-tab-list-items-sync';
|
|
18
18
|
|
|
19
19
|
const EMPTY_ARRAY = [];
|
|
20
20
|
|
|
@@ -32,15 +32,15 @@ const EMPTY_ARRAY = [];
|
|
|
32
32
|
*/
|
|
33
33
|
const TABS_TEMPLATE = [ [ 'core/tab-list' ], [ 'core/tab-panels' ] ];
|
|
34
34
|
|
|
35
|
-
function Edit( { clientId, attributes
|
|
35
|
+
function Edit( { clientId, attributes } ) {
|
|
36
36
|
const { anchor, activeTabIndex, editorActiveTabIndex } = attributes;
|
|
37
37
|
|
|
38
|
-
const { tabPanels,
|
|
38
|
+
const { tabPanels, tabListClientId } = useSelect(
|
|
39
39
|
( select ) => {
|
|
40
40
|
const { getBlocks } = select( blockEditorStore );
|
|
41
41
|
const innerBlocks = getBlocks( clientId );
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const tabPanelsBlock = innerBlocks.find(
|
|
44
44
|
( block ) => block.name === 'core/tab-panels'
|
|
45
45
|
);
|
|
46
46
|
const tabList = innerBlocks.find(
|
|
@@ -48,21 +48,14 @@ function Edit( { clientId, attributes, setAttributes } ) {
|
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
return {
|
|
51
|
-
tabPanels:
|
|
52
|
-
tabPanelsClientId: tabPanelBlocks?.clientId ?? null,
|
|
53
|
-
tabs: tabList?.innerBlocks ?? EMPTY_ARRAY,
|
|
51
|
+
tabPanels: tabPanelsBlock?.innerBlocks ?? EMPTY_ARRAY,
|
|
54
52
|
tabListClientId: tabList?.clientId ?? null,
|
|
55
53
|
};
|
|
56
54
|
},
|
|
57
55
|
[ clientId ]
|
|
58
56
|
);
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
tabPanels,
|
|
62
|
-
tabs,
|
|
63
|
-
tabPanelsClientId,
|
|
64
|
-
tabListClientId,
|
|
65
|
-
} );
|
|
58
|
+
useTabListItemsSync( { tabPanels, tabListClientId } );
|
|
66
59
|
|
|
67
60
|
/**
|
|
68
61
|
* Memoize context value to prevent unnecessary re-renders.
|
|
@@ -70,7 +63,7 @@ function Edit( { clientId, attributes, setAttributes } ) {
|
|
|
70
63
|
const contextValue = useMemo( () => {
|
|
71
64
|
/**
|
|
72
65
|
* Compute tabs list from innerblocks to provide via context.
|
|
73
|
-
* This traverses the tab-
|
|
66
|
+
* This traverses the tab-panels block to find all tab-panel blocks
|
|
74
67
|
* and extracts their label and anchor for the tab-list to consume.
|
|
75
68
|
*/
|
|
76
69
|
const tabList = tabPanels.map( ( tab, index ) => ( {
|
|
@@ -100,11 +93,7 @@ function Edit( { clientId, attributes, setAttributes } ) {
|
|
|
100
93
|
return (
|
|
101
94
|
<BlockContextProvider value={ contextValue }>
|
|
102
95
|
<div { ...innerBlockProps }>
|
|
103
|
-
<Controls
|
|
104
|
-
clientId={ clientId }
|
|
105
|
-
attributes={ attributes }
|
|
106
|
-
setAttributes={ setAttributes }
|
|
107
|
-
/>
|
|
96
|
+
<Controls clientId={ clientId } />
|
|
108
97
|
{ innerBlockProps.children }
|
|
109
98
|
</div>
|
|
110
99
|
</BlockContextProvider>
|
package/src/tabs/index.js
CHANGED
|
@@ -22,16 +22,12 @@ export const settings = {
|
|
|
22
22
|
innerBlocks: [
|
|
23
23
|
{
|
|
24
24
|
name: 'core/tab-list',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
name: 'core/tab',
|
|
32
|
-
attributes: { anchor: 'tab-2-button' },
|
|
33
|
-
},
|
|
34
|
-
],
|
|
25
|
+
attributes: {
|
|
26
|
+
tabs: [
|
|
27
|
+
{ label: __( 'Tab 1' ) },
|
|
28
|
+
{ label: __( 'Tab 2' ) },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
35
31
|
},
|
|
36
32
|
{
|
|
37
33
|
name: 'core/tab-panels',
|
package/src/tabs/index.php
CHANGED
|
@@ -96,30 +96,17 @@ function block_core_tabs_render_block_callback( array $attributes, string $conte
|
|
|
96
96
|
return '';
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
$is_vertical = false;
|
|
100
|
-
|
|
101
99
|
$tag_processor = new WP_HTML_Tag_Processor( $content );
|
|
102
100
|
|
|
103
101
|
$tag_processor->next_tag( array( 'class_name' => 'wp-block-tabs' ) );
|
|
104
102
|
$tag_processor->set_attribute( 'data-wp-interactive', 'core/tabs/private' );
|
|
105
103
|
|
|
106
|
-
// Inspect inside the tab-list to see if its vertical or not.
|
|
107
|
-
$tag_processor->set_bookmark( 'core/tabs_wrapper' );
|
|
108
|
-
while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-tabs-list' ) ) ) {
|
|
109
|
-
if ( $tag_processor->has_class( 'is-vertical' ) ) {
|
|
110
|
-
$is_vertical = true;
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
$tag_processor->seek( 'core/tabs_wrapper' );
|
|
115
|
-
|
|
116
104
|
$tag_processor->set_attribute(
|
|
117
105
|
'data-wp-context',
|
|
118
106
|
wp_json_encode(
|
|
119
107
|
array(
|
|
120
108
|
'tabsId' => $tabs_id,
|
|
121
109
|
'activeTabIndex' => $active_tab_index,
|
|
122
|
-
'isVertical' => $is_vertical,
|
|
123
110
|
)
|
|
124
111
|
)
|
|
125
112
|
);
|