@wordpress/block-library 10.1.1-next.v.202607070741.0 → 10.3.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 +25 -0
- package/build/accordion/block.json +1 -0
- package/build/accordion-panel/block.json +1 -0
- package/build/button/edit.cjs +18 -8
- package/build/button/edit.cjs.map +2 -2
- package/build/code/edit.cjs +3 -1
- package/build/code/edit.cjs.map +2 -2
- package/build/cover/block.json +12 -0
- package/build/cover/edit/block-controls.cjs +14 -5
- package/build/cover/edit/block-controls.cjs.map +2 -2
- package/build/cover/edit/embed-video-url-input.cjs +5 -3
- package/build/cover/edit/embed-video-url-input.cjs.map +3 -3
- package/build/cover/edit/index.cjs +76 -32
- package/build/cover/edit/index.cjs.map +2 -2
- package/build/cover/embed-video-utils.cjs +17 -7
- package/build/cover/embed-video-utils.cjs.map +2 -2
- package/build/details/transforms.cjs +1 -3
- package/build/details/transforms.cjs.map +2 -2
- package/build/embed/edit.cjs +1 -1
- package/build/embed/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +1 -2
- package/build/embed/embed-placeholder.cjs.map +2 -2
- package/build/file/edit.cjs +4 -3
- package/build/file/edit.cjs.map +2 -2
- package/build/file/transforms.cjs +25 -60
- package/build/file/transforms.cjs.map +2 -2
- package/build/gallery/block.json +4 -2
- package/build/gallery/dynamic-gallery.cjs +104 -61
- package/build/gallery/dynamic-gallery.cjs.map +3 -3
- package/build/gallery/edit.cjs +1 -1
- package/build/gallery/edit.cjs.map +3 -3
- package/build/gallery/gap-styles.cjs +49 -13
- package/build/gallery/gap-styles.cjs.map +3 -3
- package/build/gallery/use-dynamic-gallery.cjs +15 -8
- package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
- package/build/group/transforms.cjs +1 -1
- package/build/group/transforms.cjs.map +2 -2
- package/build/heading/edit.cjs +1 -1
- package/build/heading/edit.cjs.map +2 -2
- package/build/html/modal.cjs +63 -54
- package/build/html/modal.cjs.map +3 -3
- package/build/icon/block.json +5 -3
- package/build/icon/components/custom-inserter/icon-grid.cjs +25 -12
- package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
- package/build/icon/components/custom-inserter/index.cjs +100 -31
- package/build/icon/components/custom-inserter/index.cjs.map +3 -3
- package/build/icon/edit.cjs +11 -12
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/block.json +1 -1
- package/build/image/edit.cjs +1 -35
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +23 -18
- package/build/image/image.cjs.map +3 -3
- package/build/image/transforms.cjs +78 -0
- package/build/image/transforms.cjs.map +3 -3
- package/build/image/use-open-image-media-editor-modal.cjs +6 -2
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/index.cjs +18 -8
- package/build/index.cjs.map +2 -2
- package/build/latest-posts/edit.cjs +5 -8
- package/build/latest-posts/edit.cjs.map +2 -2
- package/build/list-item/edit.cjs +1 -1
- package/build/list-item/edit.cjs.map +2 -2
- package/build/list-item/hooks/use-enter.cjs +14 -17
- package/build/list-item/hooks/use-enter.cjs.map +3 -3
- package/build/list-item/hooks/use-indent-list-item.cjs +10 -2
- package/build/list-item/hooks/use-indent-list-item.cjs.map +2 -2
- package/build/list-item/hooks/use-space.cjs +3 -2
- package/build/list-item/hooks/use-space.cjs.map +3 -3
- package/build/math/edit.cjs +39 -56
- package/build/math/edit.cjs.map +3 -3
- package/build/media-text/edit.cjs +2 -1
- package/build/media-text/edit.cjs.map +2 -2
- package/build/more/edit.cjs +2 -2
- package/build/more/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +30 -16
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/use-layout-custom-properties.cjs +72 -0
- package/build/navigation/edit/use-layout-custom-properties.cjs.map +7 -0
- package/build/navigation/view.cjs +9 -6
- package/build/navigation/view.cjs.map +2 -2
- package/build/navigation-link/edit.cjs +3 -3
- package/build/navigation-link/edit.cjs.map +2 -2
- package/build/navigation-link/link-ui/index.cjs +2 -2
- package/build/navigation-link/link-ui/index.cjs.map +2 -2
- package/build/paragraph/edit.cjs +5 -2
- package/build/paragraph/edit.cjs.map +3 -3
- package/build/paragraph/index.cjs +4 -1
- package/build/paragraph/index.cjs.map +2 -2
- package/build/paragraph/use-enter.cjs +3 -7
- package/build/paragraph/use-enter.cjs.map +3 -3
- package/build/playlist/block.json +29 -10
- package/build/playlist/context.cjs +2 -1
- package/build/playlist/context.cjs.map +2 -2
- package/build/playlist/edit.cjs +328 -39
- package/build/playlist/edit.cjs.map +3 -3
- package/build/playlist/index.cjs +1 -1
- package/build/playlist/index.cjs.map +2 -2
- package/build/playlist/utils.cjs +37 -8
- package/build/playlist/utils.cjs.map +2 -2
- package/build/playlist/view.cjs +83 -13
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/block.json +4 -2
- package/build/playlist-track/edit.cjs +115 -70
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-content/block.json +1 -0
- package/build/post-content/edit.cjs +36 -15
- package/build/post-content/edit.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +3 -2
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/post-template/block.json +2 -1
- package/build/post-template/edit.cjs +10 -1
- package/build/post-template/edit.cjs.map +2 -2
- package/build/post-terms/edit.cjs +2 -2
- package/build/post-terms/edit.cjs.map +2 -2
- package/build/post-title/edit.cjs +2 -2
- package/build/post-title/edit.cjs.map +2 -2
- package/build/preformatted/edit.cjs +3 -1
- package/build/preformatted/edit.cjs.map +2 -2
- package/build/pullquote/block.json +3 -1
- package/build/pullquote/edit.cjs +5 -3
- package/build/pullquote/edit.cjs.map +2 -2
- package/build/query/block.json +3 -2
- package/build/query/edit/inspector-controls/index.cjs +42 -5
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/offset-controls.cjs +1 -2
- package/build/query/edit/inspector-controls/offset-controls.cjs.map +2 -2
- package/build/query/edit/inspector-controls/pages-control.cjs +0 -1
- package/build/query/edit/inspector-controls/pages-control.cjs.map +2 -2
- package/build/query/edit/query-content.cjs +10 -3
- package/build/query/edit/query-content.cjs.map +2 -2
- package/build/query/index.cjs +2 -1
- package/build/query/index.cjs.map +2 -2
- package/build/quote/block.json +3 -1
- package/build/quote/transforms.cjs +1 -3
- package/build/quote/transforms.cjs.map +2 -2
- package/build/read-more/edit.cjs +3 -1
- package/build/read-more/edit.cjs.map +2 -2
- package/build/rss/edit.cjs +0 -1
- package/build/rss/edit.cjs.map +2 -2
- package/build/site-tagline/edit.cjs +3 -1
- package/build/site-tagline/edit.cjs.map +2 -2
- package/build/site-title/edit.cjs +3 -1
- package/build/site-title/edit.cjs.map +2 -2
- package/build/social-links/edit.cjs +11 -4
- package/build/social-links/edit.cjs.map +2 -2
- package/build/tab-list/block.json +4 -3
- package/build/tab-list/edit.cjs +67 -11
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/tab-movers.cjs +87 -0
- package/build/tab-list/tab-movers.cjs.map +7 -0
- package/build/tab-panel/block.json +1 -6
- package/build/tab-panel/edit.cjs +16 -24
- package/build/tab-panel/edit.cjs.map +2 -2
- package/build/tab-panels/block.json +0 -1
- package/build/table/edit.cjs +1 -1
- package/build/table/edit.cjs.map +2 -2
- package/build/tabs/block.json +0 -5
- package/build/tabs/edit.cjs +4 -39
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/use-tab-actions.cjs +23 -1
- package/build/tabs/use-tab-actions.cjs.map +2 -2
- package/build/tabs/use-tab-list-items-sync.cjs +19 -1
- package/build/tabs/use-tab-list-items-sync.cjs.map +2 -2
- package/build/term-name/block.json +1 -3
- package/build/term-name/deprecated.cjs +105 -0
- package/build/term-name/deprecated.cjs.map +7 -0
- package/build/term-name/edit.cjs +11 -37
- package/build/term-name/edit.cjs.map +3 -3
- package/build/term-name/index.cjs +3 -1
- package/build/term-name/index.cjs.map +3 -3
- package/build/utils/caption.cjs +2 -2
- package/build/utils/caption.cjs.map +2 -2
- package/build/utils/waveform-player.cjs +138 -22
- package/build/utils/waveform-player.cjs.map +2 -2
- package/build/utils/waveform-utils.cjs +315 -17
- package/build/utils/waveform-utils.cjs.map +2 -2
- package/build/verse/edit.cjs +3 -1
- package/build/verse/edit.cjs.map +2 -2
- package/build/video/edit.cjs +2 -11
- package/build/video/edit.cjs.map +3 -3
- package/build/video/tracks-editor.cjs +0 -1
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build-module/accordion/block.json +1 -0
- package/build-module/accordion-panel/block.json +1 -0
- package/build-module/button/edit.mjs +19 -14
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/code/edit.mjs +3 -1
- package/build-module/code/edit.mjs.map +2 -2
- package/build-module/cover/block.json +12 -0
- package/build-module/cover/edit/block-controls.mjs +14 -5
- package/build-module/cover/edit/block-controls.mjs.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.mjs +5 -4
- package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
- package/build-module/cover/edit/index.mjs +79 -35
- package/build-module/cover/edit/index.mjs.map +2 -2
- package/build-module/cover/embed-video-utils.mjs +16 -7
- package/build-module/cover/embed-video-utils.mjs.map +2 -2
- package/build-module/details/transforms.mjs +2 -7
- package/build-module/details/transforms.mjs.map +2 -2
- package/build-module/embed/edit.mjs +1 -1
- package/build-module/embed/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +1 -2
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/file/edit.mjs +4 -3
- package/build-module/file/edit.mjs.map +2 -2
- package/build-module/file/transforms.mjs +25 -60
- package/build-module/file/transforms.mjs.map +2 -2
- package/build-module/gallery/block.json +4 -2
- package/build-module/gallery/dynamic-gallery.mjs +104 -61
- package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
- package/build-module/gallery/edit.mjs +3 -3
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/gap-styles.mjs +53 -14
- package/build-module/gallery/gap-styles.mjs.map +2 -2
- package/build-module/gallery/use-dynamic-gallery.mjs +16 -9
- package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
- package/build-module/group/transforms.mjs +2 -5
- package/build-module/group/transforms.mjs.map +2 -2
- package/build-module/heading/edit.mjs +1 -1
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/html/modal.mjs +68 -55
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/icon/block.json +5 -3
- package/build-module/icon/components/custom-inserter/icon-grid.mjs +25 -12
- package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +102 -33
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +11 -12
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/block.json +1 -1
- package/build-module/image/edit.mjs +1 -35
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +23 -18
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/transforms.mjs +78 -0
- package/build-module/image/transforms.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +6 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/index.mjs +18 -8
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs +5 -8
- package/build-module/latest-posts/edit.mjs.map +2 -2
- package/build-module/list-item/edit.mjs +1 -1
- package/build-module/list-item/edit.mjs.map +2 -2
- package/build-module/list-item/hooks/use-enter.mjs +15 -21
- package/build-module/list-item/hooks/use-enter.mjs.map +2 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs +10 -2
- package/build-module/list-item/hooks/use-indent-list-item.mjs.map +2 -2
- package/build-module/list-item/hooks/use-space.mjs +4 -6
- package/build-module/list-item/hooks/use-space.mjs.map +2 -2
- package/build-module/math/edit.mjs +41 -60
- package/build-module/math/edit.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +2 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/more/edit.mjs +2 -2
- package/build-module/more/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +30 -16
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/use-layout-custom-properties.mjs +51 -0
- package/build-module/navigation/edit/use-layout-custom-properties.mjs.map +7 -0
- package/build-module/navigation/view.mjs +9 -6
- package/build-module/navigation/view.mjs.map +2 -2
- package/build-module/navigation-link/edit.mjs +3 -3
- package/build-module/navigation-link/edit.mjs.map +2 -2
- package/build-module/navigation-link/link-ui/index.mjs +2 -2
- package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
- package/build-module/paragraph/edit.mjs +6 -2
- package/build-module/paragraph/edit.mjs.map +2 -2
- package/build-module/paragraph/index.mjs +4 -1
- package/build-module/paragraph/index.mjs.map +2 -2
- package/build-module/paragraph/use-enter.mjs +4 -11
- package/build-module/paragraph/use-enter.mjs.map +2 -2
- package/build-module/playlist/block.json +29 -10
- package/build-module/playlist/context.mjs +2 -1
- package/build-module/playlist/context.mjs.map +2 -2
- package/build-module/playlist/edit.mjs +331 -41
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/index.mjs +1 -1
- package/build-module/playlist/index.mjs.map +2 -2
- package/build-module/playlist/utils.mjs +35 -7
- package/build-module/playlist/utils.mjs.map +2 -2
- package/build-module/playlist/view.mjs +89 -14
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/block.json +4 -2
- package/build-module/playlist-track/edit.mjs +117 -71
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-content/block.json +1 -0
- package/build-module/post-content/edit.mjs +37 -15
- package/build-module/post-content/edit.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +3 -2
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/post-template/block.json +2 -1
- package/build-module/post-template/edit.mjs +10 -1
- package/build-module/post-template/edit.mjs.map +2 -2
- package/build-module/post-terms/edit.mjs +2 -2
- package/build-module/post-terms/edit.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +2 -2
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/preformatted/edit.mjs +3 -1
- package/build-module/preformatted/edit.mjs.map +2 -2
- package/build-module/pullquote/block.json +3 -1
- package/build-module/pullquote/edit.mjs +5 -3
- package/build-module/pullquote/edit.mjs.map +2 -2
- package/build-module/query/block.json +3 -2
- package/build-module/query/edit/inspector-controls/index.mjs +44 -6
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/offset-controls.mjs +2 -3
- package/build-module/query/edit/inspector-controls/offset-controls.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/pages-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/pages-control.mjs.map +2 -2
- package/build-module/query/edit/query-content.mjs +10 -3
- package/build-module/query/edit/query-content.mjs.map +2 -2
- package/build-module/query/index.mjs +2 -1
- package/build-module/query/index.mjs.map +2 -2
- package/build-module/quote/block.json +3 -1
- package/build-module/quote/transforms.mjs +2 -4
- package/build-module/quote/transforms.mjs.map +2 -2
- package/build-module/read-more/edit.mjs +3 -1
- package/build-module/read-more/edit.mjs.map +2 -2
- package/build-module/rss/edit.mjs +0 -1
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +3 -1
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +3 -1
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/social-links/edit.mjs +11 -4
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +4 -3
- package/build-module/tab-list/edit.mjs +74 -13
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/tab-movers.mjs +59 -0
- package/build-module/tab-list/tab-movers.mjs.map +7 -0
- package/build-module/tab-panel/block.json +1 -6
- package/build-module/tab-panel/edit.mjs +17 -25
- package/build-module/tab-panel/edit.mjs.map +2 -2
- package/build-module/tab-panels/block.json +0 -1
- package/build-module/table/edit.mjs +1 -1
- package/build-module/table/edit.mjs.map +2 -2
- package/build-module/tabs/block.json +0 -5
- package/build-module/tabs/edit.mjs +5 -45
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/use-tab-actions.mjs +23 -1
- package/build-module/tabs/use-tab-actions.mjs.map +2 -2
- package/build-module/tabs/use-tab-list-items-sync.mjs +19 -1
- package/build-module/tabs/use-tab-list-items-sync.mjs.map +2 -2
- package/build-module/term-name/block.json +1 -3
- package/build-module/term-name/deprecated.mjs +74 -0
- package/build-module/term-name/deprecated.mjs.map +7 -0
- package/build-module/term-name/edit.mjs +11 -28
- package/build-module/term-name/edit.mjs.map +2 -2
- package/build-module/term-name/index.mjs +3 -1
- package/build-module/term-name/index.mjs.map +2 -2
- package/build-module/utils/caption.mjs +2 -2
- package/build-module/utils/caption.mjs.map +2 -2
- package/build-module/utils/waveform-player.mjs +144 -23
- package/build-module/utils/waveform-player.mjs.map +2 -2
- package/build-module/utils/waveform-utils.mjs +310 -16
- package/build-module/utils/waveform-utils.mjs.map +2 -2
- package/build-module/verse/edit.mjs +3 -1
- package/build-module/verse/edit.mjs.map +2 -2
- package/build-module/video/edit.mjs +2 -11
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/tracks-editor.mjs +0 -1
- package/build-module/video/tracks-editor.mjs.map +2 -2
- package/build-style/cover/editor-rtl.css +3 -0
- package/build-style/cover/editor.css +3 -0
- package/build-style/editor-rtl.css +61 -59
- package/build-style/editor.css +61 -59
- package/build-style/icon/editor-rtl.css +80 -10
- package/build-style/icon/editor.css +80 -10
- package/build-style/image/editor-rtl.css +3 -32
- package/build-style/image/editor.css +3 -32
- package/build-style/more/editor-rtl.css +2 -2
- package/build-style/more/editor.css +2 -2
- package/build-style/navigation/editor-rtl.css +3 -4
- package/build-style/navigation/editor.css +3 -4
- package/build-style/navigation-link/editor-rtl.css +1 -1
- package/build-style/navigation-link/editor.css +1 -1
- package/build-style/nextpage/editor-rtl.css +2 -2
- package/build-style/nextpage/editor.css +2 -2
- package/build-style/playlist/editor-rtl.css +4 -3
- package/build-style/playlist/editor.css +4 -3
- package/build-style/playlist/style-rtl.css +81 -5
- package/build-style/playlist/style.css +81 -5
- package/build-style/playlist-track/style-rtl.css +10 -0
- package/build-style/playlist-track/style.css +10 -0
- package/build-style/pullquote/editor-rtl.css +4 -0
- package/build-style/pullquote/editor.css +4 -0
- package/build-style/style-rtl.css +91 -5
- package/build-style/style.css +91 -5
- package/build-style/tab-list/editor-rtl.css +101 -0
- package/build-style/tab-list/editor.css +101 -0
- package/build-style/video/editor-rtl.css +1 -1
- package/build-style/video/editor.css +1 -1
- package/build-types/table-of-contents/list.d.ts +1 -1
- package/build-types/table-of-contents/list.d.ts.map +1 -1
- package/package.json +47 -45
- package/src/accordion/README.md +1 -0
- package/src/accordion/block.json +1 -0
- package/src/accordion-panel/block.json +1 -0
- package/src/breadcrumbs/index.php +3 -1
- package/src/button/edit.js +21 -15
- package/src/button/index.php +1 -1
- package/src/code/edit.js +7 -2
- package/src/cover/README.md +60 -0
- package/src/cover/block.json +12 -0
- package/src/cover/edit/block-controls.js +26 -11
- package/src/cover/edit/embed-video-url-input.js +5 -4
- package/src/cover/edit/index.js +109 -46
- package/src/cover/editor.scss +6 -0
- package/src/cover/embed-video-utils.js +38 -13
- package/src/cover/index.php +9 -2
- package/src/details/transforms.js +2 -7
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +3 -1
- package/src/embed/embed-placeholder.js +9 -8
- package/src/file/edit.js +8 -8
- package/src/file/transforms.js +28 -60
- package/src/form/index.php +6 -4
- package/src/gallery/README.md +1 -1
- package/src/gallery/block.json +4 -2
- package/src/gallery/dynamic-gallery.js +133 -74
- package/src/gallery/edit.js +3 -3
- package/src/gallery/gap-styles.js +79 -20
- package/src/gallery/index.php +103 -43
- package/src/gallery/use-dynamic-gallery.js +27 -12
- package/src/group/transforms.js +2 -5
- package/src/heading/edit.js +1 -1
- package/src/html/modal.js +13 -2
- package/src/icon/README.md +1 -3
- package/src/icon/block.json +5 -3
- package/src/icon/components/custom-inserter/icon-grid.js +40 -11
- package/src/icon/components/custom-inserter/index.js +98 -25
- package/src/icon/edit.js +11 -17
- package/src/icon/editor.scss +33 -11
- package/src/image/README.md +1 -1
- package/src/image/block.json +1 -1
- package/src/image/edit.js +1 -57
- package/src/image/editor.scss +6 -44
- package/src/image/image.js +56 -27
- package/src/image/test/use-open-image-media-editor-modal.js +37 -1
- package/src/image/transforms.js +128 -0
- package/src/image/use-open-image-media-editor-modal.js +8 -1
- package/src/index.js +19 -7
- package/src/latest-posts/edit.js +5 -8
- package/src/latest-posts/index.php +49 -18
- package/src/list-item/edit.js +1 -1
- package/src/list-item/hooks/use-enter.js +15 -22
- package/src/list-item/hooks/use-indent-list-item.js +10 -1
- package/src/list-item/hooks/use-space.js +4 -6
- package/src/math/edit.js +42 -59
- package/src/media-text/edit.js +1 -0
- package/src/media-text/editor.scss +1 -0
- package/src/media-text/index.php +11 -2
- package/src/more/edit.js +7 -4
- package/src/more/editor.scss +1 -1
- package/src/navigation/edit/index.js +52 -36
- package/src/navigation/edit/test/layout-custom-properties.js +138 -0
- package/src/navigation/edit/use-layout-custom-properties.js +84 -0
- package/src/navigation/editor.scss +1 -2
- package/src/navigation/index.php +123 -12
- package/src/navigation/test/view.js +51 -0
- package/src/navigation/view.js +15 -14
- package/src/navigation-link/edit.js +11 -7
- package/src/navigation-link/editor.scss +1 -1
- package/src/navigation-link/index.php +70 -3
- package/src/navigation-link/link-ui/index.js +2 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +1 -1
- package/src/navigation-submenu/index.php +6 -3
- package/src/nextpage/editor.scss +1 -1
- package/src/page-list/index.php +4 -3
- package/src/paragraph/edit.js +9 -2
- package/src/paragraph/index.js +4 -1
- package/src/paragraph/use-enter.js +4 -11
- package/src/pattern/index.php +5 -5
- package/src/playlist/README.md +17 -18
- package/src/playlist/block.json +29 -10
- package/src/playlist/context.js +1 -0
- package/src/playlist/edit.js +395 -59
- package/src/playlist/editor.scss +4 -5
- package/src/playlist/index.js +1 -1
- package/src/playlist/index.php +71 -22
- package/src/playlist/style.scss +54 -1
- package/src/playlist/test/edit-component.js +139 -0
- package/src/playlist/test/edit.js +43 -2
- package/src/playlist/utils.js +49 -10
- package/src/playlist/view.js +97 -16
- package/src/playlist-track/README.md +3 -3
- package/src/playlist-track/block.json +4 -2
- package/src/playlist-track/edit.js +116 -75
- package/src/playlist-track/index.php +26 -11
- package/src/playlist-track/style.scss +10 -0
- package/src/playlist-track/test/edit.js +253 -0
- package/src/post-content/README.md +1 -0
- package/src/post-content/block.json +1 -0
- package/src/post-content/edit.js +45 -16
- package/src/post-excerpt/index.php +4 -1
- package/src/post-featured-image/edit.js +3 -2
- package/src/post-featured-image/index.php +4 -1
- package/src/post-template/README.md +1 -0
- package/src/post-template/block.json +2 -1
- package/src/post-template/edit.js +9 -0
- package/src/post-terms/edit.js +7 -4
- package/src/post-title/edit.js +5 -3
- package/src/preformatted/edit.js +7 -2
- package/src/pullquote/README.md +1 -0
- package/src/pullquote/block.json +3 -1
- package/src/pullquote/edit.js +9 -4
- package/src/pullquote/editor.scss +6 -0
- package/src/query/README.md +2 -1
- package/src/query/block.json +3 -2
- package/src/query/edit/inspector-controls/index.js +47 -4
- package/src/query/edit/inspector-controls/offset-controls.js +2 -3
- package/src/query/edit/inspector-controls/pages-control.js +0 -1
- package/src/query/edit/query-content.js +19 -3
- package/src/query/index.js +1 -0
- package/src/quote/README.md +1 -0
- package/src/quote/block.json +3 -1
- package/src/quote/transforms.js +2 -4
- package/src/read-more/edit.js +7 -2
- package/src/rss/edit.js +0 -1
- package/src/rss/index.php +10 -4
- package/src/site-tagline/edit.js +7 -2
- package/src/site-title/edit.js +7 -2
- package/src/social-link/index.php +19 -9
- package/src/social-links/edit.js +21 -12
- package/src/tab-list/README.md +4 -5
- package/src/tab-list/block.json +4 -3
- package/src/tab-list/edit.js +92 -28
- package/src/tab-list/editor.scss +9 -0
- package/src/tab-list/index.php +9 -4
- package/src/tab-list/tab-movers.js +72 -0
- package/src/tab-panel/README.md +4 -6
- package/src/tab-panel/block.json +1 -6
- package/src/tab-panel/edit.js +20 -33
- package/src/tab-panels/README.md +5 -3
- package/src/tab-panels/block.json +0 -1
- package/src/table/edit.js +1 -1
- package/src/table-of-contents/index.php +386 -1
- package/src/tabs/README.md +18 -9
- package/src/tabs/block.json +0 -5
- package/src/tabs/edit.js +7 -64
- package/src/tabs/use-tab-actions.js +32 -3
- package/src/tabs/use-tab-list-items-sync.js +24 -4
- package/src/tag-cloud/index.php +3 -2
- package/src/template-part/index.php +3 -17
- package/src/term-name/README.md +1 -1
- package/src/term-name/block.json +1 -3
- package/src/term-name/deprecated.js +74 -0
- package/src/term-name/edit.js +2 -18
- package/src/term-name/index.js +2 -0
- package/src/utils/caption.js +7 -4
- package/src/utils/media-control.scss +1 -5
- package/src/utils/test/waveform-player.js +297 -34
- package/src/utils/test/waveform-utils.js +473 -5
- package/src/utils/waveform-player.js +189 -59
- package/src/utils/waveform-utils.js +443 -40
- package/src/verse/edit.js +7 -2
- package/src/video/edit.js +0 -8
- package/src/video/editor.scss +1 -1
- package/src/video/index.php +2 -2
- package/src/video/tracks-editor.js +0 -1
- package/build/image/animated-gif-convert-control.cjs +0 -105
- package/build/image/animated-gif-convert-control.cjs.map +0 -7
- package/build/utils/gif-conversion-attributes.cjs +0 -40
- package/build/utils/gif-conversion-attributes.cjs.map +0 -7
- package/build/video/gif-restore-control.cjs +0 -73
- package/build/video/gif-restore-control.cjs.map +0 -7
- package/build-module/image/animated-gif-convert-control.mjs +0 -87
- package/build-module/image/animated-gif-convert-control.mjs.map +0 -7
- package/build-module/utils/gif-conversion-attributes.mjs +0 -15
- package/build-module/utils/gif-conversion-attributes.mjs.map +0 -7
- package/build-module/video/gif-restore-control.mjs +0 -55
- package/build-module/video/gif-restore-control.mjs.map +0 -7
- package/src/image/animated-gif-convert-control.js +0 -135
- package/src/image/test/animated-gif-convert-control.js +0 -276
- package/src/utils/gif-conversion-attributes.js +0 -30
- package/src/utils/test/gif-conversion-attributes.js +0 -60
- package/src/video/gif-restore-control.js +0 -92
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-title/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tRichText,\n\tInspectorControls,\n\tBlockControls,\n\tuseBlockProps,\n\tHeadingLevelDropdown,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nexport default function SiteTitleEdit( props ) {\n\tuseDeprecatedTextAlign( props );\n\n\tconst { attributes, setAttributes, insertBlocksAfter } = props;\n\n\tconst { level, levelOptions, isLink, linkTarget } = attributes;\n\tconst { canUserEdit, title } = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst canEdit = canUser( 'update', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst settings = canEdit ? getEditedEntityRecord( 'root', 'site' ) : {};\n\t\tconst readOnlySettings = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tcanUserEdit: canEdit,\n\t\t\ttitle: canEdit ? settings?.title : readOnlySettings?.name,\n\t\t};\n\t}, [] );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tfunction setTitle( newTitle ) {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\ttitle: newTitle.trim(),\n\t\t} );\n\t}\n\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst blockProps = useBlockProps( {\n\t\tclassName:\n\t\t\t! canUserEdit && ! title && 'wp-block-site-title__placeholder',\n\t} );\n\tconst siteTitleContent = canUserEdit ? (\n\t\t<TagName { ...blockProps }>\n\t\t\t<RichText\n\t\t\t\ttagName={ isLink ? 'a' : 'span' }\n\t\t\t\thref={ isLink ? '#site-title-pseudo-link' : undefined }\n\t\t\t\taria-label={ __( 'Site title text' ) }\n\t\t\t\tplaceholder={ __( 'Write site title…' ) }\n\t\t\t\tvalue={ title }\n\t\t\t\tonChange={ setTitle }\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\tdisableLineBreaks\n\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\tinsertBlocksAfter(
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,uBAAmC;AACnC,kBAAmB;AACnB,0BAOO;AACP,wBAIO;AACP,oBAAiD;AACjD,2BAA+B;AAK/B,mBAA+C;AAC/C,8CAAmC;AAwChC;AAtCY,SAAR,cAAgC,OAAQ;AAC9C,8CAAAA,SAAwB,KAAM;AAE9B,QAAM,EAAE,YAAY,eAAe,kBAAkB,IAAI;AAEzD,QAAM,EAAE,OAAO,cAAc,QAAQ,WAAW,IAAI;AACpD,QAAM,EAAE,aAAa,MAAM,QAAI,uBAAW,CAAE,WAAY;AACvD,UAAM,EAAE,SAAS,iBAAiB,sBAAsB,IACvD,OAAQ,iBAAAC,KAAU;AACnB,UAAM,UAAU,QAAS,UAAU;AAAA,MAClC,MAAM;AAAA,MACN,MAAM;AAAA,IACP,CAAE;AACF,UAAM,WAAW,UAAU,sBAAuB,QAAQ,MAAO,IAAI,CAAC;AACtE,UAAM,mBAAmB,gBAAiB,QAAQ,gBAAiB;AAEnE,WAAO;AAAA,MACN,aAAa;AAAA,MACb,OAAO,UAAU,UAAU,QAAQ,kBAAkB;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,CAAE;AACN,QAAM,EAAE,iBAAiB,QAAI,yBAAa,iBAAAA,KAAU;AACpD,QAAM,wBAAoB,6CAA+B;AACzD,QAAM,uBAAmB,yCAAoB;AAE7C,WAAS,SAAU,UAAW;AAC7B,qBAAkB,QAAQ,QAAQ,QAAW;AAAA,MAC5C,OAAO,SAAS,KAAK;AAAA,IACtB,CAAE;AAAA,EACH;AAEA,QAAM,UAAU,UAAU,IAAI,MAAM,IAAK,KAAM;AAC/C,QAAM,iBAAa,mCAAe;AAAA,IACjC,WACC,CAAE,eAAe,CAAE,SAAS;AAAA,EAC9B,CAAE;AACF,QAAM,mBAAmB,cACxB,4CAAC,WAAU,GAAG,YACb;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,SAAS,MAAM;AAAA,MACzB,MAAO,SAAS,4BAA4B;AAAA,MAC5C,kBAAa,gBAAI,iBAAkB;AAAA,MACnC,iBAAc,gBAAI,mBAAoB;AAAA,MACtC,OAAQ;AAAA,MACR,UAAW;AAAA,MACX,gBAAiB,CAAC;AAAA,MAClB,mBAAiB;AAAA,MACjB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tRichText,\n\tInspectorControls,\n\tBlockControls,\n\tuseBlockProps,\n\tHeadingLevelDropdown,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nexport default function SiteTitleEdit( props ) {\n\tuseDeprecatedTextAlign( props );\n\n\tconst { attributes, setAttributes, insertBlocksAfter } = props;\n\n\tconst { level, levelOptions, isLink, linkTarget } = attributes;\n\tconst { canUserEdit, title } = useSelect( ( select ) => {\n\t\tconst { canUser, getEntityRecord, getEditedEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst canEdit = canUser( 'update', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} );\n\t\tconst settings = canEdit ? getEditedEntityRecord( 'root', 'site' ) : {};\n\t\tconst readOnlySettings = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tcanUserEdit: canEdit,\n\t\t\ttitle: canEdit ? settings?.title : readOnlySettings?.name,\n\t\t};\n\t}, [] );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tfunction setTitle( newTitle ) {\n\t\teditEntityRecord( 'root', 'site', undefined, {\n\t\t\ttitle: newTitle.trim(),\n\t\t} );\n\t}\n\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst blockProps = useBlockProps( {\n\t\tclassName:\n\t\t\t! canUserEdit && ! title && 'wp-block-site-title__placeholder',\n\t} );\n\tconst siteTitleContent = canUserEdit ? (\n\t\t<TagName { ...blockProps }>\n\t\t\t<RichText\n\t\t\t\ttagName={ isLink ? 'a' : 'span' }\n\t\t\t\thref={ isLink ? '#site-title-pseudo-link' : undefined }\n\t\t\t\taria-label={ __( 'Site title text' ) }\n\t\t\t\tplaceholder={ __( 'Write site title…' ) }\n\t\t\t\tvalue={ title }\n\t\t\t\tonChange={ setTitle }\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\tdisableLineBreaks\n\t\t\t\t__unstableOnSplitAtEnd={\n\t\t\t\t\tinsertBlocksAfter\n\t\t\t\t\t\t? () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t/>\n\t\t</TagName>\n\t) : (\n\t\t<TagName { ...blockProps }>\n\t\t\t{ isLink ? (\n\t\t\t\t<a\n\t\t\t\t\thref=\"#site-title-pseudo-link\"\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t>\n\t\t\t\t\t{ decodeEntities( title ) ||\n\t\t\t\t\t\t__( 'Site Title placeholder' ) }\n\t\t\t\t</a>\n\t\t\t) : (\n\t\t\t\t<span>\n\t\t\t\t\t{ decodeEntities( title ) ||\n\t\t\t\t\t\t__( 'Site Title placeholder' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</TagName>\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\t\tvalue={ level }\n\t\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\t\tlabel={ __( 'Make title link to home' ) }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: true } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Make title link to home' ) }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkTarget: '_self' } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ siteTitleContent }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA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AU;AAAA;AAAA,cACX;AAAA;AAAA,UACD;AAAA,UACE,UACD;AAAA,YAAC,kBAAAA;AAAA,YAAA;AAAA,cACA,UAAW,MAAM,eAAe;AAAA,cAChC,WAAQ,gBAAI,iBAAkB;AAAA,cAC9B,YAAa,MACZ,cAAe,EAAE,YAAY,QAAQ,CAAE;AAAA,cAExC,kBAAgB;AAAA,cAEhB;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAQ,gBAAI,iBAAkB;AAAA,kBAC9B,UAAW,CAAE,UACZ,cAAe;AAAA,oBACd,YAAY,QAAQ,WAAW;AAAA,kBAChC,CAAE;AAAA,kBAEH,SAAU,eAAe;AAAA;AAAA,cAC1B;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IAEF,GACD;AAAA,IACE;AAAA,KACH;AAEF;",
|
|
6
6
|
"names": ["useDeprecatedTextAlign", "coreStore", "ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
|
@@ -40,6 +40,7 @@ var import_block_editor = require("@wordpress/block-editor");
|
|
|
40
40
|
var import_components = require("@wordpress/components");
|
|
41
41
|
var import_i18n = require("@wordpress/i18n");
|
|
42
42
|
var import_data = require("@wordpress/data");
|
|
43
|
+
var import_lock_unlock = require("../lock-unlock.cjs");
|
|
43
44
|
var import_hooks = require("../utils/hooks.cjs");
|
|
44
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
46
|
var sizeOptions = [
|
|
@@ -67,12 +68,17 @@ function SocialLinksEdit(props) {
|
|
|
67
68
|
showLabels,
|
|
68
69
|
size
|
|
69
70
|
} = attributes;
|
|
70
|
-
const { hasSocialIcons, hasSelectedChild } = (0, import_data.useSelect)(
|
|
71
|
+
const { hasSocialIcons, hasSelectedChild, hasSelectedStyleState } = (0, import_data.useSelect)(
|
|
71
72
|
(select) => {
|
|
72
|
-
const {
|
|
73
|
+
const {
|
|
74
|
+
getBlockCount,
|
|
75
|
+
hasSelectedInnerBlock,
|
|
76
|
+
hasSelectedStyleState: hasSelectedBlockStyleState
|
|
77
|
+
} = (0, import_lock_unlock.unlock)(select(import_block_editor.store));
|
|
73
78
|
return {
|
|
74
79
|
hasSocialIcons: getBlockCount(clientId) > 0,
|
|
75
|
-
hasSelectedChild: hasSelectedInnerBlock(clientId)
|
|
80
|
+
hasSelectedChild: hasSelectedInnerBlock(clientId),
|
|
81
|
+
hasSelectedStyleState: hasSelectedBlockStyleState(clientId)
|
|
76
82
|
};
|
|
77
83
|
},
|
|
78
84
|
[clientId]
|
|
@@ -145,6 +151,7 @@ function SocialLinksEdit(props) {
|
|
|
145
151
|
});
|
|
146
152
|
}
|
|
147
153
|
const colorGradientSettings = (0, import_block_editor.__experimentalUseMultipleOriginColorsAndGradients)();
|
|
154
|
+
const showColorControls = colorGradientSettings.hasColorsOrGradients && !hasSelectedStyleState;
|
|
148
155
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
149
156
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
150
157
|
import_components.__experimentalToolsPanel,
|
|
@@ -220,7 +227,7 @@ function SocialLinksEdit(props) {
|
|
|
220
227
|
]
|
|
221
228
|
}
|
|
222
229
|
) }),
|
|
223
|
-
|
|
230
|
+
showColorControls && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_block_editor.InspectorControls, { group: "color", children: [
|
|
224
231
|
colorSettings.map(
|
|
225
232
|
({ onChange, label, value, resetAllFilter }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
226
233
|
import_block_editor.__experimentalColorGradientSettingsDropdown,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/social-links/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ label: __( 'Default' ), value: '' },\n\t{ label: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ label: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ label: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ label: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild }
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA0B;AAC1B,0BAUO;AACP,wBAKO;AACP,kBAAmB;AACnB,kBAA0B;AAK1B,mBAA+C;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ label: __( 'Default' ), value: '' },\n\t{ label: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ label: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ label: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ label: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild, hasSelectedStyleState } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockCount,\n\t\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t\thasSelectedStyleState: hasSelectedBlockStyleState,\n\t\t\t\t} = unlock( select( blockEditorStore ) );\n\t\t\t\treturn {\n\t\t\t\t\thasSocialIcons: getBlockCount( clientId ) > 0,\n\t\t\t\t\thasSelectedChild: hasSelectedInnerBlock( clientId ),\n\t\t\t\t\thasSelectedStyleState:\n\t\t\t\t\t\thasSelectedBlockStyleState( clientId ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tlet restore;\n\t\t\tsetAttributes( ( prev ) => {\n\t\t\t\trestore = {\n\t\t\t\t\ticonBackgroundColor: prev.iconBackgroundColor,\n\t\t\t\t\ticonBackgroundColorValue: prev.iconBackgroundColorValue,\n\t\t\t\t\tcustomIconBackgroundColor: prev.customIconBackgroundColor,\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn () => setAttributes( { ...restore } );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender:\n\t\t\t! hasSocialIcons || hasAnySelected\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: undefined,\n\t} );\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst showColorControls =\n\t\tcolorGradientSettings.hasColorsOrGradients && ! hasSelectedStyleState;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t\tsize: undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! size }\n\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { size: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tsize: newSize === '' ? undefined : newSize,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ size ?? '' }\n\t\t\t\t\t\t\toptions={ sizeOptions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ showColorControls && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA0B;AAC1B,0BAUO;AACP,wBAKO;AACP,kBAAmB;AACnB,kBAA0B;AAK1B,yBAAuB;AACvB,mBAA+C;AAyI7C;AAvIF,IAAM,cAAc;AAAA,EACnB,EAAE,WAAO,gBAAI,SAAU,GAAG,OAAO,GAAG;AAAA,EACpC,EAAE,WAAO,gBAAI,OAAQ,GAAG,OAAO,sBAAsB;AAAA,EACrD,EAAE,WAAO,gBAAI,QAAS,GAAG,OAAO,uBAAuB;AAAA,EACvD,EAAE,WAAO,gBAAI,OAAQ,GAAG,OAAO,sBAAsB;AAAA,EACrD,EAAE,WAAO,gBAAI,MAAO,GAAG,OAAO,qBAAqB;AACpD;AAEO,SAAS,gBAAiB,OAAQ;AACxC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM,EAAE,gBAAgB,kBAAkB,sBAAsB,QAC/D;AAAA,IACC,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA,uBAAuB;AAAA,MACxB,QAAI,2BAAQ,OAAQ,oBAAAA,K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EF;AAAA,MACE,CAAE,aACH;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,YACJ,WAAW;AAAA,YACX,iBAAiB;AAAA,UAClB;AAAA,UACA,aAAc;AAAA;AAAA,MACf;AAAA,OAEF;AAAA,IAED,4CAAC,QAAK,GAAG,kBAAmB;AAAA,KAC7B;AAEF;AAEA,IAAM,sBAAsB;AAAA,EAC3B,WAAW;AAAA,EACX,qBAAqB;AACtB;AAEA,IAAO,mBAAQ,gCAAY,mBAAoB,EAAG,eAAgB;",
|
|
6
6
|
"names": ["blockEditorStore", "clsx", "useMultipleOriginColorsAndGradients", "ToolsPanel", "ToolsPanelItem", "ColorGradientSettingsDropdown"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
-
"__experimental": true,
|
|
4
3
|
"apiVersion": 3,
|
|
5
4
|
"name": "core/tab-list",
|
|
6
5
|
"title": "Tab List",
|
|
@@ -26,6 +25,7 @@
|
|
|
26
25
|
},
|
|
27
26
|
"supports": {
|
|
28
27
|
"html": false,
|
|
28
|
+
"ariaLabel": true,
|
|
29
29
|
"visibility": false,
|
|
30
30
|
"lock": false,
|
|
31
31
|
"color": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"layout": {
|
|
52
52
|
"default": {
|
|
53
53
|
"type": "flex",
|
|
54
|
-
"flexWrap": "
|
|
54
|
+
"flexWrap": "wrap"
|
|
55
55
|
},
|
|
56
56
|
"allowVerticalAlignment": false,
|
|
57
57
|
"allowOrientation": false,
|
|
@@ -77,5 +77,6 @@
|
|
|
77
77
|
"padding": ".wp-block-tab-list button"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
"style": "wp-block-tab-list"
|
|
80
|
+
"style": "wp-block-tab-list",
|
|
81
|
+
"editorStyle": "wp-block-tab-list-editor"
|
|
81
82
|
}
|
package/build/tab-list/edit.cjs
CHANGED
|
@@ -36,44 +36,67 @@ module.exports = __toCommonJS(edit_exports);
|
|
|
36
36
|
var import_clsx = __toESM(require("clsx"));
|
|
37
37
|
var import_i18n = require("@wordpress/i18n");
|
|
38
38
|
var import_block_editor = require("@wordpress/block-editor");
|
|
39
|
+
var import_components = require("@wordpress/components");
|
|
39
40
|
var import_data = require("@wordpress/data");
|
|
40
41
|
var import_element = require("@wordpress/element");
|
|
41
42
|
var import_tab_toolbar_controls = __toESM(require("../tabs/tab-toolbar-controls.cjs"));
|
|
43
|
+
var import_tab_movers = __toESM(require("./tab-movers.cjs"));
|
|
42
44
|
var import_use_tab_actions = __toESM(require("../tabs/use-tab-actions.cjs"));
|
|
45
|
+
var import_hooks = require("../utils/hooks.cjs");
|
|
43
46
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
47
|
var EMPTY_ARRAY = [];
|
|
45
48
|
function Edit({
|
|
46
49
|
attributes,
|
|
47
50
|
clientId,
|
|
48
|
-
|
|
51
|
+
setAttributes,
|
|
49
52
|
__unstableLayoutClassNames: layoutClassNames
|
|
50
53
|
}) {
|
|
51
|
-
const
|
|
54
|
+
const { ariaLabel } = attributes;
|
|
52
55
|
const colorProps = (0, import_block_editor.__experimentalUseColorProps)(attributes);
|
|
53
56
|
const borderProps = (0, import_block_editor.__experimentalUseBorderProps)(attributes);
|
|
54
57
|
const spacingProps = (0, import_block_editor.__experimentalGetSpacingClassesAndStyles)(attributes);
|
|
55
|
-
const
|
|
58
|
+
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
59
|
+
const { tabsClientId, tabPanels, editorActiveTabIndex, activeTabIndex } = (0, import_data.useSelect)(
|
|
56
60
|
(select) => {
|
|
57
|
-
const { getBlockRootClientId, getBlockAttributes } = select(import_block_editor.store);
|
|
58
|
-
const
|
|
59
|
-
const tabsAttributes =
|
|
61
|
+
const { getBlockRootClientId, getBlockAttributes, getBlocks } = select(import_block_editor.store);
|
|
62
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
63
|
+
const tabsAttributes = getBlockAttributes(rootClientId);
|
|
64
|
+
const tabPanelsBlock = getBlocks(rootClientId)?.find(
|
|
65
|
+
(block) => block.name === "core/tab-panels"
|
|
66
|
+
);
|
|
60
67
|
return {
|
|
61
|
-
tabsClientId:
|
|
68
|
+
tabsClientId: rootClientId,
|
|
69
|
+
tabPanels: tabPanelsBlock?.innerBlocks ?? EMPTY_ARRAY,
|
|
62
70
|
editorActiveTabIndex: tabsAttributes?.editorActiveTabIndex,
|
|
63
71
|
activeTabIndex: tabsAttributes?.activeTabIndex ?? 0
|
|
64
72
|
};
|
|
65
73
|
},
|
|
66
74
|
[clientId]
|
|
67
75
|
);
|
|
76
|
+
const registry = (0, import_data.useRegistry)();
|
|
68
77
|
const { isBlockSelected, hasSelectedInnerBlock } = (0, import_data.useSelect)(import_block_editor.store);
|
|
69
|
-
const {
|
|
78
|
+
const {
|
|
79
|
+
updateBlockAttributes,
|
|
80
|
+
selectBlock,
|
|
81
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
82
|
+
} = (0, import_data.useDispatch)(import_block_editor.store);
|
|
70
83
|
const { insertTab, removeTab } = (0, import_use_tab_actions.default)(tabsClientId);
|
|
71
84
|
const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
|
|
85
|
+
const tabsList = (0, import_element.useMemo)(
|
|
86
|
+
() => tabPanels.map((tab) => ({
|
|
87
|
+
label: tab.attributes.label || "",
|
|
88
|
+
clientId: tab.clientId
|
|
89
|
+
})),
|
|
90
|
+
[tabPanels]
|
|
91
|
+
);
|
|
72
92
|
function selectTabPanel(tabIndex) {
|
|
73
93
|
if (tabsClientId && tabIndex !== effectiveActiveIndex) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
94
|
+
registry.batch(() => {
|
|
95
|
+
selectBlock(clientId);
|
|
96
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
97
|
+
updateBlockAttributes(tabsClientId, {
|
|
98
|
+
editorActiveTabIndex: tabIndex
|
|
99
|
+
});
|
|
77
100
|
});
|
|
78
101
|
}
|
|
79
102
|
}
|
|
@@ -122,6 +145,39 @@ function Edit({
|
|
|
122
145
|
...spacingProps.style
|
|
123
146
|
};
|
|
124
147
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { group: "settings", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
+
import_components.__experimentalToolsPanel,
|
|
150
|
+
{
|
|
151
|
+
label: (0, import_i18n.__)("Settings"),
|
|
152
|
+
resetAll: () => setAttributes({
|
|
153
|
+
ariaLabel: void 0
|
|
154
|
+
}),
|
|
155
|
+
dropdownMenuProps,
|
|
156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
157
|
+
import_components.__experimentalToolsPanelItem,
|
|
158
|
+
{
|
|
159
|
+
label: (0, import_i18n.__)("Label"),
|
|
160
|
+
isShownByDefault: true,
|
|
161
|
+
hasValue: () => !!ariaLabel,
|
|
162
|
+
onDeselect: () => setAttributes({ ariaLabel: void 0 }),
|
|
163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
164
|
+
import_components.TextControl,
|
|
165
|
+
{
|
|
166
|
+
label: (0, import_i18n.__)("Label"),
|
|
167
|
+
help: (0, import_i18n.__)(
|
|
168
|
+
"Briefly describe this tab section for screen reader users. Examples: Event information, Product details, and Account settings."
|
|
169
|
+
),
|
|
170
|
+
value: ariaLabel || "",
|
|
171
|
+
onChange: (value) => setAttributes({
|
|
172
|
+
ariaLabel: value || void 0
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
) }),
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tab_movers.default, { tabsClientId }),
|
|
125
181
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tab_toolbar_controls.default, { tabsClientId }),
|
|
126
182
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...blockProps, children: tabsList.map((tab, index) => {
|
|
127
183
|
const isActive = index === effectiveActiveIndex;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tab-list/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TabToolbarControls from '../tabs/tab-toolbar-controls';\nimport useTabActions from '../tabs/use-tab-actions';\n\nconst EMPTY_ARRAY = [];\n\nfunction Edit( {\n\tattributes,\n\tclientId,\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,
|
|
6
|
-
"names": ["useColorProps", "useBorderProps", "getSpacingClassesAndStyles", "blockEditorStore", "useTabActions", "clsx", "TabToolbarControls"]
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n} from '@wordpress/block-editor';\nimport {\n\tTextControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { useEffect, useMemo, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TabToolbarControls from '../tabs/tab-toolbar-controls';\nimport TabMovers from './tab-movers';\nimport useTabActions from '../tabs/use-tab-actions';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst EMPTY_ARRAY = [];\n\nfunction Edit( {\n\tattributes,\n\tclientId,\n\tsetAttributes,\n\t__unstableLayoutClassNames: layoutClassNames,\n} ) {\n\tconst { ariaLabel } = attributes;\n\n\tconst colorProps = useColorProps( attributes );\n\tconst borderProps = useBorderProps( attributes );\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { tabsClientId, tabPanels, editorActiveTabIndex, activeTabIndex } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getBlockRootClientId, getBlockAttributes, getBlocks } =\n\t\t\t\t\tselect( blockEditorStore );\n\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\tconst tabsAttributes = getBlockAttributes( rootClientId );\n\t\t\t\tconst tabPanelsBlock = getBlocks( rootClientId )?.find(\n\t\t\t\t\t( block ) => block.name === 'core/tab-panels'\n\t\t\t\t);\n\n\t\t\t\treturn {\n\t\t\t\t\ttabsClientId: rootClientId,\n\t\t\t\t\ttabPanels: tabPanelsBlock?.innerBlocks ?? EMPTY_ARRAY,\n\t\t\t\t\teditorActiveTabIndex: tabsAttributes?.editorActiveTabIndex,\n\t\t\t\t\tactiveTabIndex: tabsAttributes?.activeTabIndex ?? 0,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\tconst registry = useRegistry();\n\tconst { isBlockSelected, hasSelectedInnerBlock } =\n\t\tuseSelect( blockEditorStore );\n\tconst {\n\t\tupdateBlockAttributes,\n\t\tselectBlock,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\tconst { insertTab, removeTab } = useTabActions( tabsClientId );\n\n\tconst effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;\n\tconst tabsList = useMemo(\n\t\t() =>\n\t\t\ttabPanels.map( ( tab ) => ( {\n\t\t\t\tlabel: tab.attributes.label || '',\n\t\t\t\tclientId: tab.clientId,\n\t\t\t} ) ),\n\t\t[ tabPanels ]\n\t);\n\n\tfunction selectTabPanel( tabIndex ) {\n\t\tif ( tabsClientId && tabIndex !== effectiveActiveIndex ) {\n\t\t\t// Batch the selection and index update so the sync effect in\n\t\t\t// the tab-panel block can't revert the switch from a stale\n\t\t\t// inner-block selection in the previously active panel.\n\t\t\tregistry.batch( () => {\n\t\t\t\tselectBlock( clientId );\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\t\teditorActiveTabIndex: tabIndex,\n\t\t\t\t} );\n\t\t\t} );\n\t\t}\n\t}\n\n\tfunction handleLabelChange( tabIndex, newLabel ) {\n\t\tconst tab = tabsList[ tabIndex ];\n\t\tif ( tab?.clientId ) {\n\t\t\tupdateBlockAttributes( tab.clientId, { label: newLabel } );\n\t\t}\n\t}\n\n\tconst menuRef = useRef();\n\tconst prevTabCountRef = useRef( tabsList.length );\n\n\t// When tabs are added or removed, focus the appropriate button.\n\tuseEffect( () => {\n\t\tconst prevCount = prevTabCountRef.current;\n\t\tprevTabCountRef.current = tabsList.length;\n\n\t\tif ( ! menuRef.current || tabsList.length === prevCount ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Only move focus during active editing, not external data changes.\n\t\tif (\n\t\t\t! isBlockSelected( tabsClientId ) &&\n\t\t\t! hasSelectedInnerBlock( tabsClientId, true )\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst focusButtonAt = ( index ) => {\n\t\t\twindow.requestAnimationFrame( () => {\n\t\t\t\tconst button =\n\t\t\t\t\tmenuRef.current?.querySelectorAll( 'button' )?.[ index ];\n\t\t\t\t(\n\t\t\t\t\tbutton?.querySelector( '[contenteditable]' ) ?? button\n\t\t\t\t)?.focus();\n\t\t\t} );\n\t\t};\n\n\t\tfocusButtonAt( effectiveActiveIndex );\n\t}, [\n\t\teffectiveActiveIndex,\n\t\thasSelectedInnerBlock,\n\t\tisBlockSelected,\n\t\ttabsClientId,\n\t\ttabsList.length,\n\t] );\n\n\tconst blockProps = useBlockProps( {\n\t\trole: 'tablist',\n\t\tref: menuRef,\n\t\t// Applied manually since this block has no inner blocks for the layout\n\t\t// support to add its container classes to.\n\t\tclassName: layoutClassNames,\n\t} );\n\n\tconst buttonClassName = clsx( colorProps.className, borderProps.className );\n\n\tconst buttonStyle = {\n\t\t...colorProps.style,\n\t\t...borderProps.style,\n\t\t...spacingProps.style,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"settings\">\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tariaLabel: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! ariaLabel }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { ariaLabel: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe this tab section for screen reader users. Examples: Event information, Product details, and Account settings.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ ariaLabel || '' }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tariaLabel: value || undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<TabMovers tabsClientId={ tabsClientId } />\n\t\t\t<TabToolbarControls tabsClientId={ tabsClientId } />\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ tabsList.map( ( tab, index ) => {\n\t\t\t\t\tconst isActive = index === effectiveActiveIndex;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tkey={ tab.clientId || index }\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\taria-selected={ isActive }\n\t\t\t\t\t\t\tclassName={ buttonClassName || undefined }\n\t\t\t\t\t\t\tstyle={ buttonStyle }\n\t\t\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t\t\t// Activate the matching panel whenever this tab\n\t\t\t\t\t\t\t// receives focus — whether from a click or the caret\n\t\t\t\t\t\t\t// moving into the label via the keyboard.\n\t\t\t\t\t\t\tonFocus={ () => {\n\t\t\t\t\t\t\t\tselectTabPanel( index );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\tplaceholder={ __( 'Tab title' ) }\n\t\t\t\t\t\t\t\tvalue={ tab.label }\n\t\t\t\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\t\t\t\thandleLabelChange( index, newLabel )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\tinsertTab( index + 1 )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonRemove={ () => removeTab( index ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Edit;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAmB;AACnB,0BAQO;AACP,wBAIO;AACP,kBAAoD;AACpD,qBAA2C;AAK3C,kCAA+B;AAC/B,wBAAsB;AACtB,6BAA0B;AAC1B,mBAA+C;AAwI7C;AAtIF,IAAM,cAAc,CAAC;AAErB,SAAS,KAAM;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAC7B,GAAI;AACH,QAAM,EAAE,UAAU,IAAI;AAEtB,QAAM,iBAAa,oBAAAA,6BAAe,UAAW;AAC7C,QAAM,kBAAc,oBAAAC,8BAAgB,UAAW;AAC/C,QAAM,mBAAe,oBAAAC,0CAA4B,UAAW;AAC5D,QAAM,wBAAoB,6CAA+B;AAEzD,QAAM,EAAE,cAAc,WAAW,sBAAsB,eAAe,QACrE;AAAA,IACC,CAAE,WAAY;AACb,YAAM,EAAE,sBAAsB,oBAAoB,UAAU,IAC3D,OAAQ,oBAAAC,KAAiB;AAE1B,YAAM,eAAe,qBAAsB,QAAS;AACpD,YAAM,iBAAiB,mBAAoB,YAAa;AACxD,YAAM,iBAAiB,UAAW,YAAa,GAAG;AAAA,QACjD,CAAE,UAAW,MAAM,SAAS;AAAA,MAC7B;AAEA,aAAO;AAAA,QACN,cAAc;AAAA,QACd,WAAW,gBAAgB,eAAe;AAA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IACA,4CAAC,kBAAAC,SAAA,EAAU,cAA8B;AAAA,IACzC,4CAAC,4BAAAC,SAAA,EAAmB,cAA8B;AAAA,IAClD,4CAAC,SAAM,GAAG,YACP,mBAAS,IAAK,CAAE,KAAK,UAAW;AACjC,YAAM,WAAW,UAAU;AAC3B,aACC;AAAA,QAAC;AAAA;AAAA,UAEA,MAAK;AAAA,UACL,MAAK;AAAA,UACL,iBAAgB;AAAA,UAChB,WAAY,mBAAmB;AAAA,UAC/B,OAAQ;AAAA,UACR,UAAW;AAAA,UAIX,SAAU,MAAM;AACf,2BAAgB,KAAM;AAAA,UACvB;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACA,SAAQ;AAAA,cACR,8BAA4B;AAAA,cAC5B,iBAAc,gBAAI,WAAY;AAAA,cAC9B,OAAQ,IAAI;AAAA,cACZ,UAAW,CAAE,aACZ,kBAAmB,OAAO,QAAS;AAAA,cAEpC,wBAAyB,MACxB,UAAW,QAAQ,CAAE;AAAA,cAEtB,UAAW,MAAM,UAAW,KAAM;AAAA;AAAA,UACnC;AAAA;AAAA,QA1BM,IAAI,YAAY;AAAA,MA2BvB;AAAA,IAEF,CAAE,GACH;AAAA,KACD;AAEF;AAEA,IAAO,eAAQ;",
|
|
6
|
+
"names": ["useColorProps", "useBorderProps", "getSpacingClassesAndStyles", "blockEditorStore", "useTabActions", "clsx", "ToolsPanel", "ToolsPanelItem", "TabMovers", "TabToolbarControls"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/block-library/src/tab-list/tab-movers.js
|
|
31
|
+
var tab_movers_exports = {};
|
|
32
|
+
__export(tab_movers_exports, {
|
|
33
|
+
default: () => TabMovers
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(tab_movers_exports);
|
|
36
|
+
var import_i18n = require("@wordpress/i18n");
|
|
37
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
38
|
+
var import_components = require("@wordpress/components");
|
|
39
|
+
var import_icons = require("@wordpress/icons");
|
|
40
|
+
var import_data = require("@wordpress/data");
|
|
41
|
+
var import_use_tab_actions = __toESM(require("../tabs/use-tab-actions.cjs"));
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
function TabMovers({ tabsClientId }) {
|
|
44
|
+
const { moveTab } = (0, import_use_tab_actions.default)(tabsClientId);
|
|
45
|
+
const { tabCount, activeIndex } = (0, import_data.useSelect)(
|
|
46
|
+
(select) => {
|
|
47
|
+
if (!tabsClientId) {
|
|
48
|
+
return { tabCount: 0, activeIndex: 0 };
|
|
49
|
+
}
|
|
50
|
+
const { getBlocks, getBlockAttributes } = select(import_block_editor.store);
|
|
51
|
+
const tabsAttributes = getBlockAttributes(tabsClientId);
|
|
52
|
+
const tabPanels = getBlocks(tabsClientId).find(
|
|
53
|
+
(block) => block.name === "core/tab-panels"
|
|
54
|
+
);
|
|
55
|
+
return {
|
|
56
|
+
tabCount: tabPanels?.innerBlocks.length ?? 0,
|
|
57
|
+
activeIndex: tabsAttributes?.editorActiveTabIndex ?? tabsAttributes?.activeTabIndex ?? 0
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
[tabsClientId]
|
|
61
|
+
);
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_block_editor.BlockControls, { group: "parent", children: [
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_components.ToolbarButton,
|
|
65
|
+
{
|
|
66
|
+
className: "wp-block-tab-list__mover-button",
|
|
67
|
+
icon: (0, import_i18n.isRTL)() ? import_icons.chevronRight : import_icons.chevronLeft,
|
|
68
|
+
label: (0, import_i18n.__)("Move tab before"),
|
|
69
|
+
onClick: () => moveTab(-1),
|
|
70
|
+
disabled: activeIndex <= 0,
|
|
71
|
+
accessibleWhenDisabled: true
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
+
import_components.ToolbarButton,
|
|
76
|
+
{
|
|
77
|
+
className: "wp-block-tab-list__mover-button",
|
|
78
|
+
icon: (0, import_i18n.isRTL)() ? import_icons.chevronLeft : import_icons.chevronRight,
|
|
79
|
+
label: (0, import_i18n.__)("Move tab after"),
|
|
80
|
+
onClick: () => moveTab(1),
|
|
81
|
+
disabled: activeIndex >= tabCount - 1,
|
|
82
|
+
accessibleWhenDisabled: true
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] });
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=tab-movers.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/tab-list/tab-movers.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { ToolbarButton } from '@wordpress/components';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport useTabActions from '../tabs/use-tab-actions';\n\n/**\n * Block toolbar buttons that reorder the active tab one position before or after.\n * Reordering acts on the underlying core/tab-panel blocks; the tab-list labels\n * follow their panel automatically via useTabListItemsSync. The buttons are\n * disabled at the first/last position.\n *\n * @param {Object} props\n * @param {string} props.tabsClientId The client ID of the parent tabs block.\n * @return {React.JSX.Element} The toolbar control element.\n */\nexport default function TabMovers( { tabsClientId } ) {\n\tconst { moveTab } = useTabActions( tabsClientId );\n\tconst { tabCount, activeIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! tabsClientId ) {\n\t\t\t\treturn { tabCount: 0, activeIndex: 0 };\n\t\t\t}\n\t\t\tconst { getBlocks, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst tabsAttributes = getBlockAttributes( tabsClientId );\n\t\t\tconst tabPanels = getBlocks( tabsClientId ).find(\n\t\t\t\t( block ) => block.name === 'core/tab-panels'\n\t\t\t);\n\t\t\treturn {\n\t\t\t\ttabCount: tabPanels?.innerBlocks.length ?? 0,\n\t\t\t\tactiveIndex:\n\t\t\t\t\ttabsAttributes?.editorActiveTabIndex ??\n\t\t\t\t\ttabsAttributes?.activeTabIndex ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[ tabsClientId ]\n\t);\n\n\treturn (\n\t\t<BlockControls group=\"parent\">\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"wp-block-tab-list__mover-button\"\n\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\tlabel={ __( 'Move tab before' ) }\n\t\t\t\tonClick={ () => moveTab( -1 ) }\n\t\t\t\tdisabled={ activeIndex <= 0 }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t\t<ToolbarButton\n\t\t\t\tclassName=\"wp-block-tab-list__mover-button\"\n\t\t\t\ticon={ isRTL() ? chevronLeft : chevronRight }\n\t\t\t\tlabel={ __( 'Move tab after' ) }\n\t\t\t\tonClick={ () => moveTab( 1 ) }\n\t\t\t\tdisabled={ activeIndex >= tabCount - 1 }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,0BAGO;AACP,wBAA8B;AAC9B,mBAA0C;AAC1C,kBAA0B;AAK1B,6BAA0B;AAqCxB;AAzBa,SAAR,UAA4B,EAAE,aAAa,GAAI;AACrD,QAAM,EAAE,QAAQ,QAAI,uBAAAA,SAAe,YAAa;AAChD,QAAM,EAAE,UAAU,YAAY,QAAI;AAAA,IACjC,CAAE,WAAY;AACb,UAAK,CAAE,cAAe;AACrB,eAAO,EAAE,UAAU,GAAG,aAAa,EAAE;AAAA,MACtC;AACA,YAAM,EAAE,WAAW,mBAAmB,IACrC,OAAQ,oBAAAC,KAAiB;AAC1B,YAAM,iBAAiB,mBAAoB,YAAa;AACxD,YAAM,YAAY,UAAW,YAAa,EAAE;AAAA,QAC3C,CAAE,UAAW,MAAM,SAAS;AAAA,MAC7B;AACA,aAAO;AAAA,QACN,UAAU,WAAW,YAAY,UAAU;AAAA,QAC3C,aACC,gBAAgB,wBAChB,gBAAgB,kBAChB;AAAA,MACF;AAAA,IACD;AAAA,IACA,CAAE,YAAa;AAAA,EAChB;AAEA,SACC,6CAAC,qCAAc,OAAM,UACpB;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,UAAO,mBAAM,IAAI,4BAAe;AAAA,QAChC,WAAQ,gBAAI,iBAAkB;AAAA,QAC9B,SAAU,MAAM,QAAS,EAAG;AAAA,QAC5B,UAAW,eAAe;AAAA,QAC1B,wBAAsB;AAAA;AAAA,IACvB;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,UAAO,mBAAM,IAAI,2BAAc;AAAA,QAC/B,WAAQ,gBAAI,gBAAiB;AAAA,QAC7B,SAAU,MAAM,QAAS,CAAE;AAAA,QAC3B,UAAW,eAAe,WAAW;AAAA,QACrC,wBAAsB;AAAA;AAAA,IACvB;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": ["useTabActions", "blockEditorStore"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
|
-
"__experimental": true,
|
|
4
3
|
"apiVersion": 3,
|
|
5
4
|
"name": "core/tab-panel",
|
|
6
5
|
"title": "Tab Panel",
|
|
@@ -14,11 +13,7 @@
|
|
|
14
13
|
}
|
|
15
14
|
},
|
|
16
15
|
"parent": [ "core/tab-panels" ],
|
|
17
|
-
"usesContext": [
|
|
18
|
-
"core/tabs-activeTabIndex",
|
|
19
|
-
"core/tabs-editorActiveTabIndex",
|
|
20
|
-
"core/tabs-id"
|
|
21
|
-
],
|
|
16
|
+
"usesContext": [ "core/tabs-id" ],
|
|
22
17
|
"supports": {
|
|
23
18
|
"anchor": true,
|
|
24
19
|
"html": false,
|
package/build/tab-panel/edit.cjs
CHANGED
|
@@ -33,39 +33,38 @@ __export(edit_exports, {
|
|
|
33
33
|
default: () => Edit
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(edit_exports);
|
|
36
|
-
var import_i18n = require("@wordpress/i18n");
|
|
37
36
|
var import_block_editor = require("@wordpress/block-editor");
|
|
38
37
|
var import_data = require("@wordpress/data");
|
|
39
38
|
var import_element = require("@wordpress/element");
|
|
40
39
|
var import_controls = __toESM(require("./controls.cjs"));
|
|
41
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
-
var TEMPLATE = [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const activeTabIndex = context["core/tabs-activeTabIndex"];
|
|
52
|
-
const editorActiveTabIndex = context["core/tabs-editorActiveTabIndex"];
|
|
53
|
-
const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
|
|
54
|
-
const { blockIndex, hasInnerBlocksSelected, tabsClientId } = (0, import_data.useSelect)(
|
|
41
|
+
var TEMPLATE = [["core/paragraph"]];
|
|
42
|
+
function Edit({ clientId, isSelected }) {
|
|
43
|
+
const {
|
|
44
|
+
activeTabIndex,
|
|
45
|
+
editorActiveTabIndex,
|
|
46
|
+
blockIndex,
|
|
47
|
+
hasInnerBlocksSelected,
|
|
48
|
+
tabsClientId
|
|
49
|
+
} = (0, import_data.useSelect)(
|
|
55
50
|
(select) => {
|
|
56
51
|
const {
|
|
57
52
|
getBlockRootClientId,
|
|
58
53
|
getBlockIndex,
|
|
59
|
-
hasSelectedInnerBlock
|
|
54
|
+
hasSelectedInnerBlock,
|
|
55
|
+
getBlockAttributes
|
|
60
56
|
} = select(import_block_editor.store);
|
|
61
57
|
const tabPanelsClientId = getBlockRootClientId(clientId);
|
|
62
58
|
const _tabsClientId = getBlockRootClientId(tabPanelsClientId);
|
|
59
|
+
const tabsAttributes = getBlockAttributes(_tabsClientId) ?? {};
|
|
63
60
|
const _blockIndex = getBlockIndex(clientId);
|
|
64
61
|
const _hasInnerBlocksSelected = hasSelectedInnerBlock(
|
|
65
62
|
clientId,
|
|
66
63
|
true
|
|
67
64
|
);
|
|
68
65
|
return {
|
|
66
|
+
activeTabIndex: tabsAttributes.activeTabIndex,
|
|
67
|
+
editorActiveTabIndex: tabsAttributes.editorActiveTabIndex,
|
|
69
68
|
blockIndex: _blockIndex,
|
|
70
69
|
hasInnerBlocksSelected: _hasInnerBlocksSelected,
|
|
71
70
|
tabsClientId: _tabsClientId
|
|
@@ -73,6 +72,7 @@ function Edit({ clientId, context, isSelected }) {
|
|
|
73
72
|
},
|
|
74
73
|
[clientId]
|
|
75
74
|
);
|
|
75
|
+
const effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;
|
|
76
76
|
const { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
77
77
|
(0, import_element.useEffect)(() => {
|
|
78
78
|
const isTabSelected = isSelected || hasInnerBlocksSelected;
|
|
@@ -93,15 +93,7 @@ function Edit({ clientId, context, isSelected }) {
|
|
|
93
93
|
]);
|
|
94
94
|
const isActiveTab = effectiveActiveIndex === blockIndex;
|
|
95
95
|
const isDefaultTab = activeTabIndex === blockIndex;
|
|
96
|
-
const isSelectedTab =
|
|
97
|
-
if (isSelected || hasInnerBlocksSelected) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
if (isActiveTab) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
104
|
-
}, [isSelected, hasInnerBlocksSelected, isActiveTab]);
|
|
96
|
+
const isSelectedTab = isSelected || hasInnerBlocksSelected || isActiveTab;
|
|
105
97
|
const blockProps = (0, import_block_editor.useBlockProps)({
|
|
106
98
|
hidden: !isSelectedTab,
|
|
107
99
|
tabIndex: isSelectedTab ? 0 : -1
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tab-panel/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Controls from './controls';\n\nconst TEMPLATE = [ [ 'core/paragraph' ] ];\n\nexport default function Edit( { clientId, isSelected } ) {\n\tconst {\n\t\tactiveTabIndex,\n\t\teditorActiveTabIndex,\n\t\tblockIndex,\n\t\thasInnerBlocksSelected,\n\t\ttabsClientId,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockIndex,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// Get the tab-panel parent first\n\t\t\tconst tabPanelsClientId = getBlockRootClientId( clientId );\n\t\t\t// Then get the tabs parent\n\t\t\tconst _tabsClientId = getBlockRootClientId( tabPanelsClientId );\n\n\t\t\t// Read the active tab indices directly from the tabs block.\n\t\t\tconst tabsAttributes = getBlockAttributes( _tabsClientId ) ?? {};\n\n\t\t\t// Get data about this instance of core/tab.\n\t\t\tconst _blockIndex = getBlockIndex( clientId );\n\t\t\tconst _hasInnerBlocksSelected = hasSelectedInnerBlock(\n\t\t\t\tclientId,\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tactiveTabIndex: tabsAttributes.activeTabIndex,\n\t\t\t\teditorActiveTabIndex: tabsAttributes.editorActiveTabIndex,\n\t\t\t\tblockIndex: _blockIndex,\n\t\t\t\thasInnerBlocksSelected: _hasInnerBlocksSelected,\n\t\t\t\ttabsClientId: _tabsClientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst effectiveActiveIndex = editorActiveTabIndex ?? activeTabIndex;\n\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Sync editorActiveTabIndex when this tab is selected directly\n\tuseEffect( () => {\n\t\t// Only update if this tab is selected and not already the active index\n\t\tconst isTabSelected = isSelected || hasInnerBlocksSelected;\n\t\tif (\n\t\t\tisTabSelected &&\n\t\t\ttabsClientId &&\n\t\t\teffectiveActiveIndex !== blockIndex\n\t\t) {\n\t\t\t// Mark as non-persistent so it doesn't add to undo history\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( tabsClientId, {\n\t\t\t\teditorActiveTabIndex: blockIndex,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tisSelected,\n\t\thasInnerBlocksSelected,\n\t\ttabsClientId,\n\t\teffectiveActiveIndex,\n\t\tblockIndex,\n\t\tupdateBlockAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\t// Determine if this is the currently active tab (for editor visibility)\n\tconst isActiveTab = effectiveActiveIndex === blockIndex;\n\n\t// Determine if this is the default tab (for the \"Default Tab\" toggle in controls)\n\tconst isDefaultTab = activeTabIndex === blockIndex;\n\n\t// Visible when selected, containing the selection, or the active tab.\n\tconst isSelectedTab = isSelected || hasInnerBlocksSelected || isActiveTab;\n\n\tconst blockProps = useBlockProps( {\n\t\thidden: ! isSelectedTab,\n\t\ttabIndex: isSelectedTab ? 0 : -1,\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\n\treturn (\n\t\t<section { ...innerBlocksProps }>\n\t\t\t<Controls\n\t\t\t\ttabsClientId={ tabsClientId }\n\t\t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