@wordpress/block-library 10.1.0 → 10.1.1-next.v.202607070741.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 +9 -0
- package/build/accordion/edit.cjs +0 -1
- package/build/accordion/edit.cjs.map +2 -2
- package/build/accordion/view.cjs +23 -0
- package/build/accordion/view.cjs.map +2 -2
- package/build/accordion-heading/deprecated.cjs +121 -1
- package/build/accordion-heading/deprecated.cjs.map +2 -2
- package/build/accordion-heading/edit.cjs +18 -1
- package/build/accordion-heading/edit.cjs.map +3 -3
- package/build/accordion-heading/save.cjs +18 -1
- package/build/accordion-heading/save.cjs.map +3 -3
- package/build/accordion-panel/edit.cjs +1 -1
- package/build/accordion-panel/edit.cjs.map +2 -2
- package/build/archives/edit.cjs +0 -1
- package/build/archives/edit.cjs.map +2 -2
- package/build/audio/edit.cjs +0 -1
- package/build/audio/edit.cjs.map +2 -2
- package/build/avatar/edit.cjs +0 -1
- package/build/avatar/edit.cjs.map +2 -2
- package/build/avatar/user-control.cjs +0 -1
- package/build/avatar/user-control.cjs.map +2 -2
- package/build/categories/edit.cjs +0 -1
- package/build/categories/edit.cjs.map +2 -2
- package/build/code/transforms.cjs +5 -3
- package/build/code/transforms.cjs.map +2 -2
- package/build/column/edit.cjs +0 -1
- package/build/column/edit.cjs.map +2 -2
- package/build/columns/edit.cjs +0 -1
- package/build/columns/edit.cjs.map +2 -2
- package/build/columns/transforms.cjs +9 -2
- package/build/columns/transforms.cjs.map +2 -2
- package/build/comment-author-avatar/edit.cjs +0 -1
- package/build/comment-author-avatar/edit.cjs.map +2 -2
- package/build/comments-pagination/comments-pagination-arrow-controls.cjs +0 -1
- package/build/comments-pagination/comments-pagination-arrow-controls.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +1 -3
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/details/transforms.cjs +3 -1
- package/build/details/transforms.cjs.map +2 -2
- package/build/embed/edit.cjs +2 -3
- package/build/embed/edit.cjs.map +2 -2
- package/build/embed/embed-placeholder.cjs +20 -20
- package/build/embed/embed-placeholder.cjs.map +3 -3
- package/build/file/inspector.cjs +0 -2
- package/build/file/inspector.cjs.map +2 -2
- package/build/form/edit.cjs +0 -2
- package/build/form/edit.cjs.map +2 -2
- package/build/freeform/convert-to-blocks-button.cjs +52 -0
- package/build/freeform/convert-to-blocks-button.cjs.map +7 -0
- package/build/freeform/edit.cjs +14 -33
- package/build/freeform/edit.cjs.map +3 -3
- package/build/freeform/index.cjs +1 -7
- package/build/freeform/index.cjs.map +3 -3
- package/build/gallery/block.json +4 -1
- package/build/gallery/dynamic-gallery.cjs +263 -0
- package/build/gallery/dynamic-gallery.cjs.map +7 -0
- package/build/gallery/dynamic-source.cjs +85 -0
- package/build/gallery/dynamic-source.cjs.map +7 -0
- package/build/gallery/edit.cjs +285 -205
- package/build/gallery/edit.cjs.map +3 -3
- package/build/gallery/gallery.cjs +0 -3
- package/build/gallery/gallery.cjs.map +2 -2
- package/build/gallery/index.cjs +2 -0
- package/build/gallery/index.cjs.map +3 -3
- package/build/gallery/save.cjs +16 -12
- package/build/gallery/save.cjs.map +2 -2
- package/build/gallery/use-dynamic-gallery.cjs +181 -0
- package/build/gallery/use-dynamic-gallery.cjs.map +7 -0
- package/build/gallery/variations.cjs +54 -0
- package/build/gallery/variations.cjs.map +7 -0
- package/build/group/edit.cjs +1 -2
- package/build/group/edit.cjs.map +2 -2
- package/build/group/transforms.cjs +3 -7
- package/build/group/transforms.cjs.map +2 -2
- package/build/heading/edit.cjs +10 -3
- package/build/heading/edit.cjs.map +2 -2
- package/build/html/block.json +2 -2
- package/build/html/edit.cjs +65 -23
- package/build/html/edit.cjs.map +3 -3
- package/build/html/index.cjs +3 -3
- package/build/html/index.cjs.map +2 -2
- package/build/html/modal.cjs +4 -8
- package/build/html/modal.cjs.map +2 -2
- package/build/html/save.cjs +2 -4
- package/build/html/save.cjs.map +2 -2
- package/build/html/transforms.cjs +7 -5
- package/build/html/transforms.cjs.map +2 -2
- package/build/image/animated-gif-convert-control.cjs +105 -0
- package/build/image/animated-gif-convert-control.cjs.map +7 -0
- package/build/image/edit.cjs +34 -0
- package/build/image/edit.cjs.map +2 -2
- package/build/image/image.cjs +38 -66
- package/build/image/image.cjs.map +3 -3
- package/build/index.cjs.map +2 -2
- package/build/latest-comments/edit.cjs +0 -2
- package/build/latest-comments/edit.cjs.map +2 -2
- package/build/latest-posts/block.json +8 -9
- package/build/latest-posts/constants.cjs +0 -3
- package/build/latest-posts/constants.cjs.map +2 -2
- package/build/latest-posts/deprecated.cjs +100 -8
- package/build/latest-posts/deprecated.cjs.map +2 -2
- package/build/latest-posts/edit.cjs +62 -76
- package/build/latest-posts/edit.cjs.map +2 -2
- package/build/list/ordered-list-settings.cjs +0 -1
- package/build/list/ordered-list-settings.cjs.map +2 -2
- package/build/media-text/edit.cjs +0 -1
- package/build/media-text/edit.cjs.map +2 -2
- package/build/missing/edit.cjs +1 -3
- package/build/missing/edit.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +0 -1
- package/build/navigation/edit/index.cjs.map +2 -2
- package/build/navigation/edit/overlay-menu-preview-controls.cjs +0 -1
- package/build/navigation/edit/overlay-menu-preview-controls.cjs.map +2 -2
- package/build/navigation/edit/overlay-menu-preview.cjs +0 -1
- package/build/navigation/edit/overlay-menu-preview.cjs.map +2 -2
- package/build/navigation/edit/overlay-template-part-selector.cjs +0 -1
- package/build/navigation/edit/overlay-template-part-selector.cjs.map +2 -2
- package/build/navigation/edit/overlay-visibility-control.cjs +0 -1
- package/build/navigation/edit/overlay-visibility-control.cjs.map +2 -2
- package/build/navigation-link/shared/use-link-preview.cjs +11 -1
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/navigation-overlay-close/edit.cjs +0 -1
- package/build/navigation-overlay-close/edit.cjs.map +2 -2
- package/build/page-list/edit.cjs +0 -1
- package/build/page-list/edit.cjs.map +2 -2
- package/build/playlist/block.json +1 -7
- package/build/playlist/context.cjs +36 -0
- package/build/playlist/context.cjs.map +7 -0
- package/build/playlist/edit.cjs +43 -69
- package/build/playlist/edit.cjs.map +3 -3
- package/build/playlist/utils.cjs +0 -3
- package/build/playlist/utils.cjs.map +3 -3
- package/build/playlist/view.cjs +4 -4
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/block.json +1 -4
- package/build/playlist-track/edit.cjs +22 -8
- package/build/playlist-track/edit.cjs.map +3 -3
- package/build/post-author/edit.cjs +0 -2
- package/build/post-author/edit.cjs.map +2 -2
- package/build/post-excerpt/edit.cjs +0 -1
- package/build/post-excerpt/edit.cjs.map +2 -2
- package/build/post-featured-image/overlay-controls.cjs +1 -2
- package/build/post-featured-image/overlay-controls.cjs.map +2 -2
- package/build/post-navigation-link/edit.cjs +0 -2
- package/build/post-navigation-link/edit.cjs.map +2 -2
- package/build/query/edit/inspector-controls/author-control.cjs +1 -2
- package/build/query/edit/inspector-controls/author-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/format-controls.cjs +1 -2
- package/build/query/edit/inspector-controls/format-controls.cjs.map +2 -2
- package/build/query/edit/inspector-controls/index.cjs +0 -3
- package/build/query/edit/inspector-controls/index.cjs.map +2 -2
- package/build/query/edit/inspector-controls/order-control.cjs +0 -1
- package/build/query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/parent-control.cjs +0 -1
- package/build/query/edit/inspector-controls/parent-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/per-page-control.cjs +0 -1
- package/build/query/edit/inspector-controls/per-page-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/sticky-control.cjs +0 -1
- package/build/query/edit/inspector-controls/sticky-control.cjs.map +2 -2
- package/build/query/edit/inspector-controls/taxonomy-controls.cjs +1 -2
- package/build/query/edit/inspector-controls/taxonomy-controls.cjs.map +2 -2
- package/build/query-pagination/query-pagination-arrow-controls.cjs +0 -1
- package/build/query-pagination/query-pagination-arrow-controls.cjs.map +2 -2
- package/build/query-pagination-numbers/edit.cjs +0 -1
- package/build/query-pagination-numbers/edit.cjs.map +2 -2
- package/build/quote/transforms.cjs +1 -5
- package/build/quote/transforms.cjs.map +2 -2
- package/build/rss/edit.cjs +0 -3
- package/build/rss/edit.cjs.map +2 -2
- package/build/search/edit.cjs +0 -4
- package/build/search/edit.cjs.map +2 -2
- package/build/separator/edit.cjs +1 -2
- package/build/separator/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +34 -63
- package/build/site-logo/edit.cjs.map +3 -3
- package/build/social-links/edit.cjs +0 -1
- package/build/social-links/edit.cjs.map +2 -2
- package/build/spacer/controls.cjs +2 -4
- package/build/spacer/controls.cjs.map +2 -2
- package/build/spacer/edit.cjs +1 -2
- package/build/spacer/edit.cjs.map +2 -2
- package/build/tab-list/block.json +3 -2
- package/build/tab-list/edit.cjs +38 -51
- package/build/tab-list/edit.cjs.map +3 -3
- package/build/tab-list/save.cjs +4 -3
- package/build/tab-list/save.cjs.map +2 -2
- package/build/tab-panel/controls.cjs +2 -4
- package/build/tab-panel/controls.cjs.map +3 -3
- package/build/tab-panels/edit.cjs +2 -4
- package/build/tab-panels/edit.cjs.map +3 -3
- package/build/table-of-contents/edit.cjs +0 -1
- package/build/table-of-contents/edit.cjs.map +2 -2
- package/build/tabs/edit.cjs +2 -2
- package/build/tabs/edit.cjs.map +3 -3
- package/build/tabs/tab-toolbar-controls.cjs +74 -0
- package/build/tabs/tab-toolbar-controls.cjs.map +7 -0
- package/build/tabs/use-tab-actions.cjs +87 -0
- package/build/tabs/use-tab-actions.cjs.map +7 -0
- package/build/tabs/use-tab-list-items-sync.cjs +4 -4
- package/build/tabs/use-tab-list-items-sync.cjs.map +2 -2
- package/build/tag-cloud/edit.cjs +2 -6
- package/build/tag-cloud/edit.cjs.map +2 -2
- package/build/template-part/edit/advanced-controls.cjs +0 -1
- package/build/template-part/edit/advanced-controls.cjs.map +2 -2
- package/build/template-part/edit/import-controls.cjs +1 -2
- package/build/template-part/edit/import-controls.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/include-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/include-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/inherit-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/inherit-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/max-terms-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/max-terms-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/order-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/order-control.cjs.map +2 -2
- package/build/terms-query/edit/inspector-controls/taxonomy-control.cjs +0 -1
- package/build/terms-query/edit/inspector-controls/taxonomy-control.cjs.map +2 -2
- package/build/text-columns/edit.cjs +0 -1
- package/build/text-columns/edit.cjs.map +2 -2
- package/build/utils/gif-conversion-attributes.cjs +40 -0
- package/build/utils/gif-conversion-attributes.cjs.map +7 -0
- package/build/verse/block.json +3 -1
- package/build/video/block.json +6 -0
- package/build/video/edit-common-settings.cjs +0 -1
- package/build/video/edit-common-settings.cjs.map +2 -2
- package/build/video/edit.cjs +28 -3
- package/build/video/edit.cjs.map +3 -3
- package/build/video/gif-restore-control.cjs +73 -0
- package/build/video/gif-restore-control.cjs.map +7 -0
- package/build/video/index.cjs +2 -0
- package/build/video/index.cjs.map +3 -3
- package/build/video/save.cjs +7 -1
- package/build/video/save.cjs.map +2 -2
- package/build/video/tracks-editor.cjs +0 -1
- package/build/video/tracks-editor.cjs.map +2 -2
- package/build/video/variations.cjs +75 -0
- package/build/video/variations.cjs.map +7 -0
- package/build-module/accordion/edit.mjs +0 -1
- package/build-module/accordion/edit.mjs.map +2 -2
- package/build-module/accordion/view.mjs +23 -0
- package/build-module/accordion/view.mjs.map +2 -2
- package/build-module/accordion-heading/deprecated.mjs +121 -1
- package/build-module/accordion-heading/deprecated.mjs.map +2 -2
- package/build-module/accordion-heading/edit.mjs +8 -1
- package/build-module/accordion-heading/edit.mjs.map +2 -2
- package/build-module/accordion-heading/save.mjs +8 -1
- package/build-module/accordion-heading/save.mjs.map +2 -2
- package/build-module/accordion-panel/edit.mjs +1 -1
- package/build-module/accordion-panel/edit.mjs.map +2 -2
- package/build-module/archives/edit.mjs +0 -1
- package/build-module/archives/edit.mjs.map +2 -2
- package/build-module/audio/edit.mjs +0 -1
- package/build-module/audio/edit.mjs.map +2 -2
- package/build-module/avatar/edit.mjs +0 -1
- package/build-module/avatar/edit.mjs.map +2 -2
- package/build-module/avatar/user-control.mjs +0 -1
- package/build-module/avatar/user-control.mjs.map +2 -2
- package/build-module/categories/edit.mjs +0 -1
- package/build-module/categories/edit.mjs.map +2 -2
- package/build-module/code/transforms.mjs +6 -4
- package/build-module/code/transforms.mjs.map +2 -2
- package/build-module/column/edit.mjs +0 -1
- package/build-module/column/edit.mjs.map +2 -2
- package/build-module/columns/edit.mjs +0 -1
- package/build-module/columns/edit.mjs.map +2 -2
- package/build-module/columns/transforms.mjs +9 -2
- package/build-module/columns/transforms.mjs.map +2 -2
- package/build-module/comment-author-avatar/edit.mjs +0 -1
- package/build-module/comment-author-avatar/edit.mjs.map +2 -2
- package/build-module/comments-pagination/comments-pagination-arrow-controls.mjs +0 -1
- package/build-module/comments-pagination/comments-pagination-arrow-controls.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +1 -3
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/details/transforms.mjs +7 -2
- package/build-module/details/transforms.mjs.map +2 -2
- package/build-module/embed/edit.mjs +2 -3
- package/build-module/embed/edit.mjs.map +2 -2
- package/build-module/embed/embed-placeholder.mjs +20 -23
- package/build-module/embed/embed-placeholder.mjs.map +2 -2
- package/build-module/file/inspector.mjs +0 -2
- package/build-module/file/inspector.mjs.map +2 -2
- package/build-module/form/edit.mjs +0 -2
- package/build-module/form/edit.mjs.map +2 -2
- package/build-module/freeform/convert-to-blocks-button.mjs +31 -0
- package/build-module/freeform/convert-to-blocks-button.mjs.map +7 -0
- package/build-module/freeform/edit.mjs +15 -34
- package/build-module/freeform/edit.mjs.map +2 -2
- package/build-module/freeform/index.mjs +1 -7
- package/build-module/freeform/index.mjs.map +2 -2
- package/build-module/gallery/block.json +4 -1
- package/build-module/gallery/dynamic-gallery.mjs +253 -0
- package/build-module/gallery/dynamic-gallery.mjs.map +7 -0
- package/build-module/gallery/dynamic-source.mjs +55 -0
- package/build-module/gallery/dynamic-source.mjs.map +7 -0
- package/build-module/gallery/edit.mjs +288 -206
- package/build-module/gallery/edit.mjs.map +2 -2
- package/build-module/gallery/gallery.mjs +0 -3
- package/build-module/gallery/gallery.mjs.map +2 -2
- package/build-module/gallery/index.mjs +2 -0
- package/build-module/gallery/index.mjs.map +2 -2
- package/build-module/gallery/save.mjs +16 -12
- package/build-module/gallery/save.mjs.map +2 -2
- package/build-module/gallery/use-dynamic-gallery.mjs +167 -0
- package/build-module/gallery/use-dynamic-gallery.mjs.map +7 -0
- package/build-module/gallery/variations.mjs +33 -0
- package/build-module/gallery/variations.mjs.map +7 -0
- package/build-module/group/edit.mjs +1 -2
- package/build-module/group/edit.mjs.map +2 -2
- package/build-module/group/transforms.mjs +7 -8
- package/build-module/group/transforms.mjs.map +2 -2
- package/build-module/heading/edit.mjs +11 -4
- package/build-module/heading/edit.mjs.map +2 -2
- package/build-module/html/block.json +2 -2
- package/build-module/html/edit.mjs +69 -25
- package/build-module/html/edit.mjs.map +2 -2
- package/build-module/html/index.mjs +3 -3
- package/build-module/html/index.mjs.map +2 -2
- package/build-module/html/modal.mjs +4 -8
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/html/save.mjs +2 -4
- package/build-module/html/save.mjs.map +2 -2
- package/build-module/html/transforms.mjs +8 -6
- package/build-module/html/transforms.mjs.map +2 -2
- package/build-module/image/animated-gif-convert-control.mjs +87 -0
- package/build-module/image/animated-gif-convert-control.mjs.map +7 -0
- package/build-module/image/edit.mjs +34 -0
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/image/image.mjs +28 -67
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/index.mjs.map +2 -2
- package/build-module/latest-comments/edit.mjs +0 -2
- package/build-module/latest-comments/edit.mjs.map +2 -2
- package/build-module/latest-posts/block.json +8 -9
- package/build-module/latest-posts/constants.mjs +0 -2
- package/build-module/latest-posts/constants.mjs.map +2 -2
- package/build-module/latest-posts/deprecated.mjs +100 -8
- package/build-module/latest-posts/deprecated.mjs.map +2 -2
- package/build-module/latest-posts/edit.mjs +62 -77
- package/build-module/latest-posts/edit.mjs.map +2 -2
- package/build-module/list/ordered-list-settings.mjs +0 -1
- package/build-module/list/ordered-list-settings.mjs.map +2 -2
- package/build-module/media-text/edit.mjs +0 -1
- package/build-module/media-text/edit.mjs.map +2 -2
- package/build-module/missing/edit.mjs +1 -3
- package/build-module/missing/edit.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +0 -1
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-menu-preview-controls.mjs +0 -1
- package/build-module/navigation/edit/overlay-menu-preview-controls.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-menu-preview.mjs +0 -1
- package/build-module/navigation/edit/overlay-menu-preview.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-template-part-selector.mjs +0 -1
- package/build-module/navigation/edit/overlay-template-part-selector.mjs.map +2 -2
- package/build-module/navigation/edit/overlay-visibility-control.mjs +0 -1
- package/build-module/navigation/edit/overlay-visibility-control.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +11 -1
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/navigation-overlay-close/edit.mjs +0 -1
- package/build-module/navigation-overlay-close/edit.mjs.map +2 -2
- package/build-module/page-list/edit.mjs +0 -1
- package/build-module/page-list/edit.mjs.map +2 -2
- package/build-module/playlist/block.json +1 -7
- package/build-module/playlist/context.mjs +11 -0
- package/build-module/playlist/context.mjs.map +7 -0
- package/build-module/playlist/edit.mjs +44 -70
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/utils.mjs +0 -3
- package/build-module/playlist/utils.mjs.map +2 -2
- package/build-module/playlist/view.mjs +4 -4
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/block.json +1 -4
- package/build-module/playlist-track/edit.mjs +23 -9
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-author/edit.mjs +0 -2
- package/build-module/post-author/edit.mjs.map +2 -2
- package/build-module/post-excerpt/edit.mjs +0 -1
- package/build-module/post-excerpt/edit.mjs.map +2 -2
- package/build-module/post-featured-image/overlay-controls.mjs +1 -2
- package/build-module/post-featured-image/overlay-controls.mjs.map +2 -2
- package/build-module/post-navigation-link/edit.mjs +0 -2
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/author-control.mjs +1 -2
- package/build-module/query/edit/inspector-controls/author-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/format-controls.mjs +1 -2
- package/build-module/query/edit/inspector-controls/format-controls.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/index.mjs +0 -3
- package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/order-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/parent-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/parent-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/per-page-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/per-page-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/sticky-control.mjs +0 -1
- package/build-module/query/edit/inspector-controls/sticky-control.mjs.map +2 -2
- package/build-module/query/edit/inspector-controls/taxonomy-controls.mjs +1 -2
- package/build-module/query/edit/inspector-controls/taxonomy-controls.mjs.map +2 -2
- package/build-module/query-pagination/query-pagination-arrow-controls.mjs +0 -1
- package/build-module/query-pagination/query-pagination-arrow-controls.mjs.map +2 -2
- package/build-module/query-pagination-numbers/edit.mjs +0 -1
- package/build-module/query-pagination-numbers/edit.mjs.map +2 -2
- package/build-module/quote/transforms.mjs +6 -6
- package/build-module/quote/transforms.mjs.map +2 -2
- package/build-module/rss/edit.mjs +0 -3
- package/build-module/rss/edit.mjs.map +2 -2
- package/build-module/search/edit.mjs +0 -4
- package/build-module/search/edit.mjs.map +2 -2
- package/build-module/separator/edit.mjs +1 -2
- package/build-module/separator/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +34 -64
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/build-module/social-links/edit.mjs +0 -1
- package/build-module/social-links/edit.mjs.map +2 -2
- package/build-module/spacer/controls.mjs +2 -4
- package/build-module/spacer/controls.mjs.map +2 -2
- package/build-module/spacer/edit.mjs +1 -2
- package/build-module/spacer/edit.mjs.map +2 -2
- package/build-module/tab-list/block.json +3 -2
- package/build-module/tab-list/edit.mjs +39 -52
- package/build-module/tab-list/edit.mjs.map +2 -2
- package/build-module/tab-list/save.mjs +5 -3
- package/build-module/tab-list/save.mjs.map +2 -2
- package/build-module/tab-panel/controls.mjs +2 -4
- package/build-module/tab-panel/controls.mjs.map +2 -2
- package/build-module/tab-panels/edit.mjs +2 -4
- package/build-module/tab-panels/edit.mjs.map +2 -2
- package/build-module/table-of-contents/edit.mjs +0 -1
- package/build-module/table-of-contents/edit.mjs.map +2 -2
- package/build-module/tabs/edit.mjs +2 -2
- package/build-module/tabs/edit.mjs.map +2 -2
- package/build-module/tabs/tab-toolbar-controls.mjs +46 -0
- package/build-module/tabs/tab-toolbar-controls.mjs.map +7 -0
- package/build-module/tabs/use-tab-actions.mjs +66 -0
- package/build-module/tabs/use-tab-actions.mjs.map +7 -0
- package/build-module/tabs/use-tab-list-items-sync.mjs +6 -6
- package/build-module/tabs/use-tab-list-items-sync.mjs.map +2 -2
- package/build-module/tag-cloud/edit.mjs +2 -6
- package/build-module/tag-cloud/edit.mjs.map +2 -2
- package/build-module/template-part/edit/advanced-controls.mjs +0 -1
- package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
- package/build-module/template-part/edit/import-controls.mjs +1 -2
- package/build-module/template-part/edit/import-controls.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/include-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/include-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/inherit-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/inherit-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/max-terms-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/max-terms-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/order-control.mjs.map +2 -2
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs +0 -1
- package/build-module/terms-query/edit/inspector-controls/taxonomy-control.mjs.map +2 -2
- package/build-module/text-columns/edit.mjs +0 -1
- package/build-module/text-columns/edit.mjs.map +2 -2
- package/build-module/utils/gif-conversion-attributes.mjs +15 -0
- package/build-module/utils/gif-conversion-attributes.mjs.map +7 -0
- package/build-module/verse/block.json +3 -1
- package/build-module/video/block.json +6 -0
- package/build-module/video/edit-common-settings.mjs +0 -1
- package/build-module/video/edit-common-settings.mjs.map +2 -2
- package/build-module/video/edit.mjs +28 -3
- package/build-module/video/edit.mjs.map +2 -2
- package/build-module/video/gif-restore-control.mjs +55 -0
- package/build-module/video/gif-restore-control.mjs.map +7 -0
- package/build-module/video/index.mjs +2 -0
- package/build-module/video/index.mjs.map +2 -2
- package/build-module/video/save.mjs +7 -1
- package/build-module/video/save.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-module/video/variations.mjs +50 -0
- package/build-module/video/variations.mjs.map +7 -0
- package/build-style/accordion-panel/style-rtl.css +1 -2
- package/build-style/accordion-panel/style.css +1 -2
- package/build-style/audio/style-rtl.css +6 -0
- package/build-style/audio/style.css +6 -0
- package/build-style/audio/theme-rtl.css +6 -0
- package/build-style/audio/theme.css +6 -0
- package/build-style/columns/style-rtl.css +6 -0
- package/build-style/columns/style.css +6 -0
- package/build-style/common-rtl.css +6 -4
- package/build-style/common.css +6 -4
- package/build-style/editor-rtl.css +38 -3
- package/build-style/editor.css +38 -3
- package/build-style/embed/style-rtl.css +6 -0
- package/build-style/embed/style.css +6 -0
- package/build-style/embed/theme-rtl.css +6 -0
- package/build-style/embed/theme.css +6 -0
- package/build-style/freeform/editor-rtl.css +6 -0
- package/build-style/freeform/editor.css +6 -0
- package/build-style/gallery/editor-rtl.css +27 -3
- package/build-style/gallery/editor.css +27 -3
- package/build-style/gallery/style-rtl.css +6 -0
- package/build-style/gallery/style.css +6 -0
- package/build-style/gallery/theme-rtl.css +6 -0
- package/build-style/gallery/theme.css +6 -0
- package/build-style/html/editor-rtl.css +13 -0
- package/build-style/html/editor.css +13 -0
- package/build-style/image/editor-rtl.css +10 -0
- package/build-style/image/editor.css +10 -0
- package/build-style/image/style-rtl.css +6 -1
- package/build-style/image/style.css +6 -1
- package/build-style/image/theme-rtl.css +6 -0
- package/build-style/image/theme.css +6 -0
- package/build-style/latest-posts/style-rtl.css +26 -15
- package/build-style/latest-posts/style.css +26 -15
- package/build-style/navigation/editor-rtl.css +6 -0
- package/build-style/navigation/editor.css +6 -0
- package/build-style/navigation/style-rtl.css +6 -0
- package/build-style/navigation/style.css +6 -0
- package/build-style/navigation-submenu/editor-rtl.css +6 -0
- package/build-style/navigation-submenu/editor.css +6 -0
- package/build-style/page-list/editor-rtl.css +6 -0
- package/build-style/page-list/editor.css +6 -0
- package/build-style/playlist/style-rtl.css +121 -19
- package/build-style/playlist/style.css +121 -19
- package/build-style/post-template/style-rtl.css +6 -0
- package/build-style/post-template/style.css +6 -0
- package/build-style/query/editor-rtl.css +6 -0
- package/build-style/query/editor.css +6 -0
- package/build-style/rss/style-rtl.css +6 -0
- package/build-style/rss/style.css +6 -0
- package/build-style/shortcode/editor-rtl.css +6 -0
- package/build-style/shortcode/editor.css +6 -0
- package/build-style/style-rtl.css +145 -38
- package/build-style/style.css +145 -38
- package/build-style/table/editor-rtl.css +6 -0
- package/build-style/table/editor.css +6 -0
- package/build-style/table/theme-rtl.css +6 -0
- package/build-style/table/theme.css +6 -0
- package/build-style/template-part/editor-rtl.css +6 -0
- package/build-style/template-part/editor.css +6 -0
- package/build-style/theme-rtl.css +6 -0
- package/build-style/theme.css +6 -0
- package/build-style/video/style-rtl.css +6 -0
- package/build-style/video/style.css +6 -0
- package/build-style/video/theme-rtl.css +6 -0
- package/build-style/video/theme.css +6 -0
- package/package.json +43 -41
- package/src/accordion/README.md +1 -1
- package/src/accordion/edit.js +0 -1
- package/src/accordion/view.js +24 -0
- package/src/accordion-heading/README.md +1 -1
- package/src/accordion-heading/deprecated.js +122 -1
- package/src/accordion-heading/edit.js +12 -1
- package/src/accordion-heading/save.js +12 -1
- package/src/accordion-item/README.md +1 -1
- package/src/accordion-item/index.php +2 -1
- package/src/accordion-panel/edit.js +1 -1
- package/src/accordion-panel/style.scss +1 -4
- package/src/archives/edit.js +0 -1
- package/src/audio/edit.js +0 -1
- package/src/avatar/edit.js +0 -1
- package/src/avatar/user-control.js +0 -1
- package/src/categories/edit.js +0 -1
- package/src/code/transforms.js +6 -4
- package/src/column/edit.js +0 -1
- package/src/columns/edit.js +0 -1
- package/src/columns/transforms.js +9 -2
- package/src/comment-author-avatar/edit.js +0 -1
- package/src/comments-pagination/comments-pagination-arrow-controls.js +0 -1
- package/src/common.scss +0 -4
- package/src/cover/edit/inspector-controls.js +0 -2
- package/src/cover/test/edit.js +4 -4
- package/src/details/transforms.js +7 -2
- package/src/embed/edit.js +4 -5
- package/src/embed/embed-placeholder.js +16 -19
- package/src/file/inspector.js +0 -2
- package/src/form/edit.js +0 -2
- package/src/freeform/convert-to-blocks-button.js +33 -0
- package/src/freeform/edit.js +11 -21
- package/src/freeform/index.js +1 -9
- package/src/gallery/README.md +3 -0
- package/src/gallery/block.json +4 -1
- package/src/gallery/dynamic-gallery.js +384 -0
- package/src/gallery/dynamic-source.js +117 -0
- package/src/gallery/edit.js +152 -46
- package/src/gallery/editor.scss +32 -4
- package/src/gallery/gallery.js +0 -7
- package/src/gallery/index.js +2 -0
- package/src/gallery/index.php +277 -0
- package/src/gallery/save.js +22 -11
- package/src/gallery/test/dynamic-source.js +90 -0
- package/src/gallery/use-dynamic-gallery.js +275 -0
- package/src/gallery/variations.js +37 -0
- package/src/group/edit.js +2 -3
- package/src/group/transforms.js +7 -8
- package/src/heading/edit.js +19 -14
- package/src/home-link/index.php +1 -1
- package/src/html/README.md +2 -1
- package/src/html/block.json +2 -2
- package/src/html/edit.js +86 -14
- package/src/html/editor.scss +10 -0
- package/src/html/index.js +3 -4
- package/src/html/modal.js +5 -9
- package/src/html/save.js +4 -7
- package/src/html/test/index.js +143 -0
- package/src/html/transforms.js +11 -6
- package/src/icon/index.php +38 -45
- package/src/image/animated-gif-convert-control.js +135 -0
- package/src/image/edit.js +52 -0
- package/src/image/editor.scss +9 -0
- package/src/image/image.js +121 -180
- package/src/image/style.scss +0 -1
- package/src/image/test/animated-gif-convert-control.js +276 -0
- package/src/image/test/use-open-image-media-editor-modal.js +19 -4
- package/src/index.js +0 -2
- package/src/latest-comments/edit.js +0 -2
- package/src/latest-posts/README.md +2 -2
- package/src/latest-posts/block.json +8 -9
- package/src/latest-posts/constants.js +0 -1
- package/src/latest-posts/deprecated.js +112 -9
- package/src/latest-posts/edit.js +33 -45
- package/src/latest-posts/index.php +14 -3
- package/src/latest-posts/style.scss +12 -2
- package/src/latest-posts/test/deprecated.js +153 -0
- package/src/list/ordered-list-settings.js +0 -1
- package/src/media-text/edit.js +0 -1
- package/src/missing/edit.js +1 -3
- package/src/navigation/edit/index.js +0 -1
- package/src/navigation/edit/overlay-menu-preview-controls.js +0 -1
- package/src/navigation/edit/overlay-menu-preview.js +0 -1
- package/src/navigation/edit/overlay-template-part-selector.js +0 -1
- package/src/navigation/edit/overlay-visibility-control.js +0 -1
- package/src/navigation-link/shared/test/controls.js +0 -4
- package/src/navigation-link/shared/test/use-entity-binding.js +8 -12
- package/src/navigation-link/shared/test/use-handle-link-change.test.js +0 -4
- package/src/navigation-link/shared/test/use-link-preview.test.js +17 -4
- package/src/navigation-link/shared/use-link-preview.js +24 -4
- package/src/navigation-overlay-close/edit.js +0 -1
- package/src/page-list/edit.js +0 -1
- package/src/page-list/index.php +1 -1
- package/src/playlist/README.md +0 -2
- package/src/playlist/block.json +1 -7
- package/src/playlist/context.js +9 -0
- package/src/playlist/edit.js +51 -82
- package/src/playlist/index.php +37 -26
- package/src/playlist/style.scss +0 -5
- package/src/playlist/test/edit.js +0 -10
- package/src/playlist/utils.js +0 -6
- package/src/playlist/view.js +4 -4
- package/src/playlist-track/README.md +0 -2
- package/src/playlist-track/block.json +1 -4
- package/src/playlist-track/edit.js +25 -16
- package/src/playlist-track/index.php +4 -11
- package/src/post-author/edit.js +0 -2
- package/src/post-excerpt/edit.js +0 -1
- package/src/post-featured-image/overlay-controls.js +0 -1
- package/src/post-navigation-link/edit.js +0 -2
- package/src/query/edit/inspector-controls/author-control.js +0 -1
- package/src/query/edit/inspector-controls/format-controls.js +0 -1
- package/src/query/edit/inspector-controls/index.js +0 -3
- package/src/query/edit/inspector-controls/order-control.js +0 -1
- package/src/query/edit/inspector-controls/parent-control.js +0 -1
- package/src/query/edit/inspector-controls/per-page-control.js +0 -1
- package/src/query/edit/inspector-controls/sticky-control.js +0 -1
- package/src/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/src/query-pagination/query-pagination-arrow-controls.js +0 -1
- package/src/query-pagination-numbers/edit.js +0 -1
- package/src/quote/transforms.js +6 -6
- package/src/rss/edit.js +0 -3
- package/src/search/edit.js +0 -4
- package/src/separator/edit.js +0 -1
- package/src/site-logo/edit.js +38 -78
- package/src/social-links/edit.js +0 -1
- package/src/spacer/controls.js +2 -4
- package/src/spacer/edit.js +2 -3
- package/src/tab-list/block.json +3 -2
- package/src/tab-list/edit.js +53 -55
- package/src/tab-list/save.js +5 -4
- package/src/tab-panel/controls.js +2 -4
- package/src/tab-panels/edit.js +2 -4
- package/src/table-of-contents/edit.js +0 -1
- package/src/tabs/edit.js +2 -2
- package/src/tabs/tab-toolbar-controls.js +58 -0
- package/src/tabs/use-tab-actions.js +102 -0
- package/src/tabs/use-tab-list-items-sync.js +7 -8
- package/src/tag-cloud/edit.js +0 -4
- package/src/tag-cloud/index.php +1 -1
- package/src/template-part/edit/advanced-controls.js +0 -1
- package/src/template-part/edit/import-controls.js +0 -1
- package/src/terms-query/edit/inspector-controls/include-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/inherit-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/max-terms-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/order-control.js +0 -1
- package/src/terms-query/edit/inspector-controls/taxonomy-control.js +0 -1
- package/src/text-columns/edit.js +0 -1
- package/src/utils/gif-conversion-attributes.js +30 -0
- package/src/utils/test/gif-conversion-attributes.js +60 -0
- package/src/utils/test/waveform-player.js +0 -4
- package/src/utils/test/waveform-utils.js +0 -4
- package/src/verse/README.md +1 -0
- package/src/verse/block.json +3 -1
- package/src/video/README.md +2 -0
- package/src/video/block.json +6 -0
- package/src/video/edit-common-settings.js +0 -1
- package/src/video/edit.js +38 -1
- package/src/video/gif-restore-control.js +92 -0
- package/src/video/index.js +2 -0
- package/src/video/save.js +12 -0
- package/src/video/test/variations.js +65 -0
- package/src/video/tracks-editor.js +0 -1
- package/src/video/variations.js +65 -0
- package/build/freeform/migration-notice.cjs +0 -58
- package/build/freeform/migration-notice.cjs.map +0 -7
- package/build/tab-panel/add-tab-toolbar-control.cjs +0 -90
- package/build/tab-panel/add-tab-toolbar-control.cjs.map +0 -7
- package/build/tab-panel/remove-tab-toolbar-control.cjs +0 -99
- package/build/tab-panel/remove-tab-toolbar-control.cjs.map +0 -7
- package/build/tabs/controls.cjs +0 -45
- package/build/tabs/controls.cjs.map +0 -7
- package/build-module/freeform/migration-notice.mjs +0 -37
- package/build-module/freeform/migration-notice.mjs.map +0 -7
- package/build-module/tab-panel/add-tab-toolbar-control.mjs +0 -72
- package/build-module/tab-panel/add-tab-toolbar-control.mjs.map +0 -7
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs +0 -81
- package/build-module/tab-panel/remove-tab-toolbar-control.mjs.map +0 -7
- package/build-module/tabs/controls.mjs +0 -14
- package/build-module/tabs/controls.mjs.map +0 -7
- package/src/freeform/migration-notice.js +0 -49
- package/src/tab-panel/add-tab-toolbar-control.js +0 -90
- package/src/tab-panel/remove-tab-toolbar-control.js +0 -110
- package/src/tabs/controls.js +0 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-featured-image/overlay-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tRangeControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\twithColors,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient as useGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\nconst Overlay = ( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\toverlayColor,\n\tsetOverlayColor,\n} ) => {\n\tconst { dimRatio } = attributes;\n\tconst { gradientValue, setGradient } = useGradient();\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tif ( ! colorGradientSettings.hasColorsOrGradients ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tsettings={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\t{ ...colorGradientSettings }\n\t\t\t/>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => dimRatio !== undefined }\n\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { dimRatio: 0 } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\tdimRatio: 0,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<RangeControl\n\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdimRatio: newDimRatio,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ 100 }\n\t\t\t\t\tstep={ 10 }\n\t\t\t\t\trequired\n\t\t\t\t
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,gCAAgC;AAAA,OAC1B;AACP;AAAA,EACC;AAAA,EACA,+CAA+C;AAAA,EAC/C,6BAA6B;AAAA,EAC7B,qDAAqD;AAAA,OAC/C;AACP,SAAS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tRangeControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\twithColors,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient as useGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport { compose } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\nconst Overlay = ( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\toverlayColor,\n\tsetOverlayColor,\n} ) => {\n\tconst { dimRatio } = attributes;\n\tconst { gradientValue, setGradient } = useGradient();\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tif ( ! colorGradientSettings.hasColorsOrGradients ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tsettings={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t\tpanelId={ clientId }\n\t\t\t\t{ ...colorGradientSettings }\n\t\t\t/>\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => dimRatio !== undefined }\n\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { dimRatio: 0 } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\tdimRatio: 0,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<RangeControl\n\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdimRatio: newDimRatio,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ 100 }\n\t\t\t\t\tstep={ 10 }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t</>\n\t);\n};\n\nexport default compose( [\n\twithColors( { overlayColor: 'background-color' } ),\n] )( Overlay );\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,gCAAgC;AAAA,OAC1B;AACP;AAAA,EACC;AAAA,EACA,+CAA+C;AAAA,EAC/C,6BAA6B;AAAA,EAC7B,qDAAqD;AAAA,OAC/C;AACP,SAAS,eAAe;AACxB,SAAS,UAAU;AAkBjB,mBACC,KADD;AAhBF,IAAM,UAAU,CAAE;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAO;AACN,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,eAAe,YAAY,IAAI,YAAY;AACnD,QAAM,wBAAwB,oCAAoC;AAElE,MAAK,CAAE,sBAAsB,sBAAuB;AACnD,WAAO;AAAA,EACR;AAEA,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,mCAAiC;AAAA,QACjC,UAAW;AAAA,UACV;AAAA,YACC,YAAY,aAAa;AAAA,YACzB;AAAA,YACA,OAAO,GAAI,SAAU;AAAA,YACrB,eAAe;AAAA,YACf,kBAAkB;AAAA,YAClB,kBAAkB;AAAA,YAClB,gBAAgB,OAAQ;AAAA,cACvB,cAAc;AAAA,cACd,oBAAoB;AAAA,cACpB,UAAU;AAAA,cACV,gBAAgB;AAAA,YACjB;AAAA,YACA,WAAW;AAAA,UACZ;AAAA,QACD;AAAA,QACA,SAAU;AAAA,QACR,GAAG;AAAA;AAAA,IACN;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,UAAW,MAAM,aAAa;AAAA,QAC9B,OAAQ,GAAI,iBAAkB;AAAA,QAC9B,YAAa,MAAM,cAAe,EAAE,UAAU,EAAE,CAAE;AAAA,QAClD,gBAAiB,OAAQ;AAAA,UACxB,UAAU;AAAA,QACX;AAAA,QACA,kBAAgB;AAAA,QAChB,SAAU;AAAA,QAEV;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,iBAAkB;AAAA,YAC9B,OAAQ;AAAA,YACR,UAAW,CAAE,gBACZ,cAAe;AAAA,cACd,UAAU;AAAA,YACX,CAAE;AAAA,YAEH,KAAM;AAAA,YACN,KAAM;AAAA,YACN,MAAO;AAAA,YACP,UAAQ;AAAA;AAAA,QACT;AAAA;AAAA,IACD;AAAA,KACD;AAEF;AAEA,IAAO,2BAAQ,QAAS;AAAA,EACvB,WAAY,EAAE,cAAc,mBAAmB,CAAE;AAClD,CAAE,EAAG,OAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -135,7 +135,6 @@ function PostNavigationLinkEdit({
|
|
|
135
135
|
children: /* @__PURE__ */ jsxs(
|
|
136
136
|
ToggleGroupControl,
|
|
137
137
|
{
|
|
138
|
-
__next40pxDefaultSize: true,
|
|
139
138
|
label: __("Arrow"),
|
|
140
139
|
value: arrow,
|
|
141
140
|
onChange: (value) => {
|
|
@@ -187,7 +186,6 @@ function PostNavigationLinkEdit({
|
|
|
187
186
|
/* @__PURE__ */ jsx(InspectorControls, { group: "advanced", children: /* @__PURE__ */ jsx(
|
|
188
187
|
SelectControl,
|
|
189
188
|
{
|
|
190
|
-
__next40pxDefaultSize: true,
|
|
191
189
|
label: __("Filter by taxonomy"),
|
|
192
190
|
value: taxonomy,
|
|
193
191
|
options: getTaxonomyOptions(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-navigation-link/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostNavigationLinkEdit( {\n\tcontext: { postType },\n\tattributes: { type, label, showTitle, linkLabel, arrow, taxonomy },\n\tsetAttributes,\n} ) {\n\tconst isNext = type === 'next';\n\tlet placeholder = isNext ? __( 'Next' ) : __( 'Previous' );\n\n\tconst arrowMap = {\n\t\tnone: '',\n\t\tarrow: isNext ? '→' : '←',\n\t\tchevron: isNext ? '»' : '«',\n\t};\n\n\tconst displayArrow = arrowMap[ arrow ];\n\n\tif ( showTitle ) {\n\t\tplaceholder = isNext\n\t\t\t? /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Next: ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t\t\t: /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Previous: ' ); // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t}\n\n\tconst ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' );\n\tconst blockProps = useBlockProps();\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( 'Unfiltered' ),\n\t\t\tvalue: '',\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( { visibility } ) => !! visibility?.publicly_queryable )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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\tshowTitle: false,\n\t\t\t\t\t\t\tlinkLabel: false,\n\t\t\t\t\t\t\tarrow: 'none',\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={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showTitle }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTitle: 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={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'If you have entered a custom label, it will be prepended before the title.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! showTitle }\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\tshowTitle: ! showTitle,\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\t{ showTitle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! linkLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkLabel: false } )\n\t\t\t\t\t\t\t}\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={ __(\n\t\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ !! linkLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkLabel: ! linkLabel,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => arrow !== 'none' }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { arrow: 'none' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\
|
|
5
|
-
"mappings":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A;AAAA,UACD;AAAA,UAED;AAAA,YAAC;AAAA;AAAA,cACA,OAAQ,GAAI,OAAQ;AAAA,cACpB,kBAAgB;AAAA,cAChB,UAAW,MAAM,UAAU;AAAA,cAC3B,YAAa,MAAM,cAAe,EAAE,OAAO,OAAO,CAAE;AAAA,cAEpD;AAAA,gBAAC;AAAA;AAAA,kBACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tToggleControl,\n\tSelectControl,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostNavigationLinkEdit( {\n\tcontext: { postType },\n\tattributes: { type, label, showTitle, linkLabel, arrow, taxonomy },\n\tsetAttributes,\n} ) {\n\tconst isNext = type === 'next';\n\tlet placeholder = isNext ? __( 'Next' ) : __( 'Previous' );\n\n\tconst arrowMap = {\n\t\tnone: '',\n\t\tarrow: isNext ? '→' : '←',\n\t\tchevron: isNext ? '»' : '«',\n\t};\n\n\tconst displayArrow = arrowMap[ arrow ];\n\n\tif ( showTitle ) {\n\t\tplaceholder = isNext\n\t\t\t? /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Next: ' ) // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t\t\t: /* translators: Label before for next and previous post. There is a space after the colon. */\n\t\t\t __( 'Previous: ' ); // eslint-disable-line @wordpress/i18n-no-flanking-whitespace\n\t}\n\n\tconst ariaLabel = isNext ? __( 'Next post' ) : __( 'Previous post' );\n\tconst blockProps = useBlockProps();\n\tconst taxonomies = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getTaxonomies } = select( coreStore );\n\t\t\tconst filteredTaxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t} );\n\t\t\treturn filteredTaxonomies;\n\t\t},\n\t\t[ postType ]\n\t);\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( 'Unfiltered' ),\n\t\t\tvalue: '',\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( { visibility } ) => !! visibility?.publicly_queryable )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\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\tshowTitle: false,\n\t\t\t\t\t\t\tlinkLabel: false,\n\t\t\t\t\t\t\tarrow: 'none',\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={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => showTitle }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTitle: 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={ __( 'Display the title as a link' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'If you have entered a custom label, it will be prepended before the title.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tchecked={ !! showTitle }\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\tshowTitle: ! showTitle,\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\t{ showTitle && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\thasValue={ () => !! linkLabel }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { linkLabel: false } )\n\t\t\t\t\t\t\t}\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={ __(\n\t\t\t\t\t\t\t\t\t'Include the label as part of the link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tchecked={ !! linkLabel }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlinkLabel: ! linkLabel,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => arrow !== 'none' }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { arrow: 'none' } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\t\t\t\t\tvalue={ arrow }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( { arrow: value } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'A decorative arrow for the next and previous link.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"none\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'None',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"arrow\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Arrow',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\tvalue=\"chevron\"\n\t\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t\t'Chevron',\n\t\t\t\t\t\t\t\t\t'Arrow option for Next/Previous link'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\tlabel={ __( 'Filter by taxonomy' ) }\n\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\ttaxonomy: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Only link to posts that have the same taxonomy terms as the current post. For example the same tags or categories.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ ! isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-previous is-arrow-${ arrow }` }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ showTitle && (\n\t\t\t\t\t<a\n\t\t\t\t\t\thref=\"#post-navigation-pseudo-link\"\n\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'An example title' ) }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ isNext && displayArrow && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ `wp-block-post-navigation-link__arrow-next is-arrow-${ arrow }` }\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t{ displayArrow }\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,EAC1C,4BAA4B;AAAA,EAC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AAW;AAAA,UACX,cAAa;AAAA,UACb;AAAA,UACA,OAAQ;AAAA,UACR,8BAA4B;AAAA,UAC5B,UAAW,CAAE,aACZ,cAAe,EAAE,OAAO,SAAS,CAAE;AAAA;AAAA,MAErC;AAAA,MACE,aACD;AAAA,QAAC;AAAA;AAAA,UACA,MAAK;AAAA,UACL,SAAU,CAAE,UAAW,MAAM,eAAe;AAAA,UAE1C,aAAI,kBAAmB;AAAA;AAAA,MAC1B;AAAA,MAEC,UAAU,gBACX;AAAA,QAAC;AAAA;AAAA,UACA,WAAY,sDAAuD,KAAM;AAAA,UACzE,eAAW;AAAA,UAET;AAAA;AAAA,MACH;AAAA,OAEF;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/author-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo } from '../../utils';\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nfunction AuthorControl( { value, onChange } ) {\n\tconst authorsList = useSelect( ( select ) => {\n\t\tconst { getUsers } = select( coreStore );\n\t\treturn getUsers( AUTHORS_QUERY );\n\t}, [] );\n\n\tif ( ! authorsList ) {\n\t\treturn null;\n\t}\n\tconst authorsInfo = getEntitiesInfo( authorsList );\n\t/**\n\t * We need to normalize the value because the block operates on a\n\t * comma(`,`) separated string value and `FormTokenField` needs an\n\t * array.\n\t */\n\tconst normalizedValue = ! value ? [] : value.toString().split( ',' );\n\t// Returns only the existing authors ids. This prevents the component\n\t// from crashing in the editor, when non existing ids are provided.\n\tconst sanitizedValue = normalizedValue.reduce(\n\t\t( accumulator, authorId ) => {\n\t\t\tconst author = authorsInfo.mapById[ authorId ];\n\t\t\tif ( author ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid: authorId,\n\t\t\t\t\tvalue: author.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\tconst getIdByValue = ( entitiesMappedByName, authorValue ) => {\n\t\tconst id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onAuthorChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, author ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( authorsInfo.mapByName, author );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tonChange( { author: ids.join( ',' ) } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Authors' ) }\n\t\t\tvalue={ sanitizedValue }\n\t\t\tsuggestions={ authorsInfo.names }\n\t\t\tonChange={ onAuthorChange }\n\t\t\thelp=\"\"\n\t\t
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAKnC,SAAS,uBAAuB;AA6D9B;AA3DF,IAAM,gBAAgB;AAAA,EACrB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AACV;AAEA,SAAS,cAAe,EAAE,OAAO,SAAS,GAAI;AAC7C,QAAM,cAAc,UAAW,CAAE,WAAY;AAC5C,UAAM,EAAE,SAAS,IAAI,OAAQ,SAAU;AACvC,WAAO,SAAU,aAAc;AAAA,EAChC,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,aAAc;AACpB,WAAO;AAAA,EACR;AACA,QAAM,cAAc,gBAAiB,WAAY;AAMjD,QAAM,kBAAkB,CAAE,QAAQ,CAAC,IAAI,MAAM,SAAS,EAAE,MAAO,GAAI;AAGnE,QAAM,iBAAiB,gBAAgB;AAAA,IACtC,CAAE,aAAa,aAAc;AAC5B,YAAM,SAAS,YAAY,QAAS,QAAS;AAC7C,UAAK,QAAS;AACb,oBAAY,KAAM;AAAA,UACjB,IAAI;AAAA,UACJ,OAAO,OAAO;AAAA,QACf,CAAE;AAAA,MACH;AACA,aAAO;AAAA,IACR;AAAA,IACA,CAAC;AAAA,EACF;AAEA,QAAM,eAAe,CAAE,sBAAsB,gBAAiB;AAC7D,UAAM,KAAK,aAAa,MAAM,qBAAsB,WAAY,GAAG;AACnE,QAAK,IAAK;AACT,aAAO;AAAA,IACR;AAAA,EACD;AACA,QAAM,iBAAiB,CAAE,aAAc;AACtC,UAAM,MAAM,MAAM;AAAA,MACjB,SAAS,OAAQ,CAAE,aAAa,WAAY;AAE3C,cAAM,KAAK,aAAc,YAAY,WAAW,MAAO;AACvD,YAAK,IAAK;AACT,sBAAY,IAAK,EAAG;AAAA,QACrB;AACA,eAAO;AAAA,MACR,GAAG,oBAAI,IAAI,CAAE;AAAA,IACd;AACA,aAAU,EAAE,QAAQ,IAAI,KAAM,GAAI,EAAE,CAAE;AAAA,EACvC;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,SAAU;AAAA,MACtB,OAAQ;AAAA,MACR,aAAc,YAAY;AAAA,MAC1B,UAAW;AAAA,MACX,MAAK;AAAA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo } from '../../utils';\n\nconst AUTHORS_QUERY = {\n\twho: 'authors',\n\tper_page: -1,\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\nfunction AuthorControl( { value, onChange } ) {\n\tconst authorsList = useSelect( ( select ) => {\n\t\tconst { getUsers } = select( coreStore );\n\t\treturn getUsers( AUTHORS_QUERY );\n\t}, [] );\n\n\tif ( ! authorsList ) {\n\t\treturn null;\n\t}\n\tconst authorsInfo = getEntitiesInfo( authorsList );\n\t/**\n\t * We need to normalize the value because the block operates on a\n\t * comma(`,`) separated string value and `FormTokenField` needs an\n\t * array.\n\t */\n\tconst normalizedValue = ! value ? [] : value.toString().split( ',' );\n\t// Returns only the existing authors ids. This prevents the component\n\t// from crashing in the editor, when non existing ids are provided.\n\tconst sanitizedValue = normalizedValue.reduce(\n\t\t( accumulator, authorId ) => {\n\t\t\tconst author = authorsInfo.mapById[ authorId ];\n\t\t\tif ( author ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid: authorId,\n\t\t\t\t\tvalue: author.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t},\n\t\t[]\n\t);\n\n\tconst getIdByValue = ( entitiesMappedByName, authorValue ) => {\n\t\tconst id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onAuthorChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, author ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( authorsInfo.mapByName, author );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tonChange( { author: ids.join( ',' ) } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Authors' ) }\n\t\t\tvalue={ sanitizedValue }\n\t\t\tsuggestions={ authorsInfo.names }\n\t\t\tonCh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;AACA,eAAO;AAAA,MACR,GAAG,oBAAI,IAAI,CAAE;AAAA,IACd;AACA,aAAU,EAAE,QAAQ,IAAI,KAAM,GAAI,EAAE,CAAE;AAAA,EACvC;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,SAAU;AAAA,MACtB,OAAQ;AAAA,MACR,aAAc,YAAY;AAAA,MAC1B,UAAW;AAAA,MACX,MAAK;AAAA;AAAA,EACN;AAEF;AAEA,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/format-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n// All WP post formats, sorted alphabetically by translated name.\n// Value is the post format slug. Label is the name.\nconst POST_FORMATS = [\n\t{ value: 'aside', label: __( 'Aside' ) },\n\t{ value: 'audio', label: __( 'Audio' ) },\n\t{ value: 'chat', label: __( 'Chat' ) },\n\t{ value: 'gallery', label: __( 'Gallery' ) },\n\t{ value: 'image', label: __( 'Image' ) },\n\t{ value: 'link', label: __( 'Link' ) },\n\t{ value: 'quote', label: __( 'Quote' ) },\n\t{ value: 'standard', label: __( 'Standard' ) },\n\t{ value: 'status', label: __( 'Status' ) },\n\t{ value: 'video', label: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.label.toUpperCase();\n\tconst normalizedB = b.label.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\n// A helper function to convert translatable post format names into their static values.\nfunction formatNamesToValues( names, formats ) {\n\treturn names\n\t\t.map( ( name ) => {\n\t\t\treturn formats.find(\n\t\t\t\t( item ) =>\n\t\t\t\t\titem.label.toLocaleLowerCase() === name.toLocaleLowerCase()\n\t\t\t)?.value;\n\t\t} )\n\t\t.filter( Boolean );\n}\n\nexport default function FormatControls( { onChange, query: { format } } ) {\n\t// 'format' is expected to be an array. If it is not an array, for example\n\t// if a user has manually entered an invalid value in the block markup,\n\t// convert it to an array to prevent JavaScript errors.\n\tconst normalizedFormats = Array.isArray( format ) ? format : [ format ];\n\n\tconst { supportedFormats } = useSelect( ( select ) => {\n\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\treturn {\n\t\t\tsupportedFormats: themeSupports.formats,\n\t\t};\n\t}, [] );\n\n\tconst formats = POST_FORMATS.filter( ( item ) =>\n\t\tsupportedFormats.includes( item.value )\n\t);\n\n\tconst values = normalizedFormats\n\t\t.map(\n\t\t\t( name ) => formats.find( ( item ) => item.value === name )?.label\n\t\t)\n\t\t.filter( Boolean );\n\n\tconst suggestions = formats\n\t\t.filter( ( item ) => ! normalizedFormats.includes( item.value ) )\n\t\t.map( ( item ) => item.label );\n\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Formats' ) }\n\t\t\tvalue={ values }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ ( newValues ) => {\n\t\t\t\tonChange( {\n\t\t\t\t\tformat: formatNamesToValues( newValues, formats ),\n\t\t\t\t} );\n\t\t\t} }\n\t\t\thelp=\"\"\n\t\t\t__experimentalExpandOnFocus\n\t\t
|
|
5
|
-
"mappings": ";AAGA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AAoEjB;AAhEF,IAAM,eAAe;AAAA,EACpB,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,EAAE;AAAA,EACvC,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,EAAE;AAAA,EACvC,EAAE,OAAO,QAAQ,OAAO,GAAI,MAAO,E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AAS,kBACb;AAAA,IACA,CAAE,SAAU,QAAQ,KAAM,CAAE,SAAU,KAAK,UAAU,IAAK,GAAG;AAAA,EAC9D,EACC,OAAQ,OAAQ;AAElB,QAAM,cAAc,QAClB,OAAQ,CAAE,SAAU,CAAE,kBAAkB,SAAU,KAAK,KAAM,CAAE,EAC/D,IAAK,CAAE,SAAU,KAAK,KAAM;AAE9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,SAAU;AAAA,MACtB,OAAQ;AAAA,MACR;AAAA,MACA,UAAW,CAAE,cAAe;AAC3B,iBAAU;AAAA,UACT,QAAQ,oBAAqB,WAAW,OAAQ;AAAA,QACjD,CAAE;AAAA,MACH;AAAA,MACA,MAAK;AAAA,MACL,6BAA2B;AAAA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n// All WP post formats, sorted alphabetically by translated name.\n// Value is the post format slug. Label is the name.\nconst POST_FORMATS = [\n\t{ value: 'aside', label: __( 'Aside' ) },\n\t{ value: 'audio', label: __( 'Audio' ) },\n\t{ value: 'chat', label: __( 'Chat' ) },\n\t{ value: 'gallery', label: __( 'Gallery' ) },\n\t{ value: 'image', label: __( 'Image' ) },\n\t{ value: 'link', label: __( 'Link' ) },\n\t{ value: 'quote', label: __( 'Quote' ) },\n\t{ value: 'standard', label: __( 'Standard' ) },\n\t{ value: 'status', label: __( 'Status' ) },\n\t{ value: 'video', label: __( 'Video' ) },\n].sort( ( a, b ) => {\n\tconst normalizedA = a.label.toUpperCase();\n\tconst normalizedB = b.label.toUpperCase();\n\n\tif ( normalizedA < normalizedB ) {\n\t\treturn -1;\n\t}\n\tif ( normalizedA > normalizedB ) {\n\t\treturn 1;\n\t}\n\treturn 0;\n} );\n\n// A helper function to convert translatable post format names into their static values.\nfunction formatNamesToValues( names, formats ) {\n\treturn names\n\t\t.map( ( name ) => {\n\t\t\treturn formats.find(\n\t\t\t\t( item ) =>\n\t\t\t\t\titem.label.toLocaleLowerCase() === name.toLocaleLowerCase()\n\t\t\t)?.value;\n\t\t} )\n\t\t.filter( Boolean );\n}\n\nexport default function FormatControls( { onChange, query: { format } } ) {\n\t// 'format' is expected to be an array. If it is not an array, for example\n\t// if a user has manually entered an invalid value in the block markup,\n\t// convert it to an array to prevent JavaScript errors.\n\tconst normalizedFormats = Array.isArray( format ) ? format : [ format ];\n\n\tconst { supportedFormats } = useSelect( ( select ) => {\n\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\t\treturn {\n\t\t\tsupportedFormats: themeSupports.formats,\n\t\t};\n\t}, [] );\n\n\tconst formats = POST_FORMATS.filter( ( item ) =>\n\t\tsupportedFormats.includes( item.value )\n\t);\n\n\tconst values = normalizedFormats\n\t\t.map(\n\t\t\t( name ) => formats.find( ( item ) => item.value === name )?.label\n\t\t)\n\t\t.filter( Boolean );\n\n\tconst suggestions = formats\n\t\t.filter( ( item ) => ! normalizedFormats.includes( item.value ) )\n\t\t.map( ( item ) => item.label );\n\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Formats' ) }\n\t\t\tvalue={ values }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ ( newValues ) => {\n\t\t\t\tonChange( {\n\t\t\t\t\tformat: formatNamesToValues( newValues, formats ),\n\t\t\t\t} );\n\t\t\t} }\n\t\t\thelp=\"\"\n\t\t\t__experimentalExpandOnFocus\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AAoEjB;AAhEF,IAAM,eAAe;AAAA,EACpB,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,EAAE;AAAA,EACvC,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,EAAE;AAAA,E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SAAU,KAAK,KAAM;AAAA,EACvC;AAEA,QAAM,SAAS,kBACb;AAAA,IACA,CAAE,SAAU,QAAQ,KAAM,CAAE,SAAU,KAAK,UAAU,IAAK,GAAG;AAAA,EAC9D,EACC,OAAQ,OAAQ;AAElB,QAAM,cAAc,QAClB,OAAQ,CAAE,SAAU,CAAE,kBAAkB,SAAU,KAAK,KAAM,CAAE,EAC/D,IAAK,CAAE,SAAU,KAAK,KAAM;AAE9B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,SAAU;AAAA,MACtB,OAAQ;AAAA,MACR;AAAA,MACA,UAAW,CAAE,cAAe;AAC3B,iBAAU;AAAA,UACT,QAAQ,oBAAqB,WAAW,OAAQ;AAAA,QACjD,CAAE;AAAA,MACH;AAAA,MACA,MAAK;AAAA,MACL,6BAA2B;AAAA;AAAA,EAC5B;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -163,7 +163,6 @@ function QueryInspectorControls(props) {
|
|
|
163
163
|
/* @__PURE__ */ jsxs(
|
|
164
164
|
ToggleGroupControl,
|
|
165
165
|
{
|
|
166
|
-
__next40pxDefaultSize: true,
|
|
167
166
|
label: __("Query type"),
|
|
168
167
|
isBlock: true,
|
|
169
168
|
onChange: (value) => {
|
|
@@ -218,7 +217,6 @@ function QueryInspectorControls(props) {
|
|
|
218
217
|
children: postTypesSelectOptions.length > 2 ? /* @__PURE__ */ jsx(
|
|
219
218
|
SelectControl,
|
|
220
219
|
{
|
|
221
|
-
__next40pxDefaultSize: true,
|
|
222
220
|
options: postTypesSelectOptions,
|
|
223
221
|
value: postType,
|
|
224
222
|
label: postTypeControlLabel,
|
|
@@ -228,7 +226,6 @@ function QueryInspectorControls(props) {
|
|
|
228
226
|
) : /* @__PURE__ */ jsx(
|
|
229
227
|
ToggleGroupControl,
|
|
230
228
|
{
|
|
231
|
-
__next40pxDefaultSize: true,
|
|
232
229
|
isBlock: true,
|
|
233
230
|
value: postType,
|
|
234
231
|
label: postTypeControlLabel,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTextControl,\n\tSelectControl,\n\tNotice,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport FormatControls from './format-controls';\nimport StickyControl from './sticky-control';\nimport PerPageControl from './per-page-control';\nimport OffsetControl from './offset-controls';\nimport PagesControl from './pages-control';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n\tuseOrderByOptions,\n} from '../../utils';\nimport { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, isSingular } = props;\n\tconst { query } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpages,\n\t\tpostType,\n\t\tperPage,\n\t\toffset,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t\tformat,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst showSticky = postType === 'post';\n\tconst {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t} = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tif ( !! supportedTaxonomies?.length && !! taxQuery ) {\n\t\t\t// Shared utility to build taxQuery based on supported taxonomies.\n\t\t\tconst buildTaxQuery = ( _taxQuery ) => {\n\t\t\t\treturn Object.entries( _taxQuery || {} ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomy, terms ] ) => {\n\t\t\t\t\t\tif ( supportedTaxonomies.includes( taxonomy ) ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst updatedTaxQuery = {};\n\t\t\tconst builtIncludeTaxQuery = buildTaxQuery( taxQuery.include );\n\t\t\tif ( !! Object.keys( builtIncludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.include = builtIncludeTaxQuery;\n\t\t\t}\n\t\t\tconst builtExcludeTaxQuery = buildTaxQuery( taxQuery.exclude );\n\t\t\tif ( !! Object.keys( builtExcludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.exclude = builtExcludeTaxQuery;\n\t\t\t}\n\t\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t\t? updatedTaxQuery\n\t\t\t\t: undefined;\n\t\t}\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\t// Post types can register post format support with `add_post_type_support`.\n\t\t// But we need to reset the `format` property when switching to post types\n\t\t// that do not support post formats.\n\t\tconst hasFormatSupport = postTypeFormatSupportMap[ newValue ];\n\t\tif ( ! hasFormatSupport ) {\n\t\t\tupdateQuery.format = [];\n\t\t}\n\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst debouncedQuerySearch = useMemo( () => {\n\t\treturn debounce( ( newQuerySearch ) => {\n\t\t\tsetQuery( { search: newQuerySearch } );\n\t\t}, 250 );\n\t}, [ setQuery ] );\n\n\tconst orderByOptions = useOrderByOptions( postType );\n\tconst showInheritControl = isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'postType' );\n\tconst postTypeControlLabel = __( 'Post type' );\n\tconst postTypeControlHelp = __(\n\t\t'Select the type of content to display: posts, pages, or custom post types.'\n\t);\n\tconst showOrderControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'order' );\n\tconst showStickyControl =\n\t\t! inherit &&\n\t\tshowSticky &&\n\t\tisControlAllowed( allowedControls, 'sticky' );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst postTypeHasFormatSupport = postTypeFormatSupportMap[ postType ];\n\tconst showFormatControl = useSelect(\n\t\t( select ) => {\n\t\t\t// Check if the post type supports post formats and if the control is allowed.\n\t\t\tif (\n\t\t\t\t! postTypeHasFormatSupport ||\n\t\t\t\t! isControlAllowed( allowedControls, 'format' )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\n\t\t\t// If there are no supported formats, getThemeSupports still includes the default 'standard' format,\n\t\t\t// and in this case the control should not be shown since the user has no other formats to choose from.\n\t\t\treturn (\n\t\t\t\tthemeSupports.formats &&\n\t\t\t\tthemeSupports.formats.length > 0 &&\n\t\t\t\tthemeSupports.formats.some( ( type ) => type !== 'standard' )\n\t\t\t);\n\t\t},\n\t\t[ allowedControls, postTypeHasFormatSupport ]\n\t);\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl ||\n\t\tshowFormatControl;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst showPostCountControl = isControlAllowed(\n\t\tallowedControls,\n\t\t'postCount'\n\t);\n\tconst showOffSetControl = isControlAllowed( allowedControls, 'offset' );\n\tconst showPagesControl = isControlAllowed( allowedControls, 'pages' );\n\n\tconst showDisplayPanel =\n\t\tshowPostCountControl || showOffSetControl || showPagesControl;\n\n\t// The block cannot inherit a default WordPress query in singular content (e.g., post, page, 404, blank).\n\t// Warn users but still permit this type of query for exceptional cases in Classic and Hybrid themes.\n\tconst hasInheritanceWarning = isSingular && inherit;\n\n\treturn (\n\t\t<>\n\t\t\t{ showSettingsPanel && (\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\tsetQuery( {\n\t\t\t\t\t\t\tpostType: 'post',\n\t\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\t\tsticky: '',\n\t\t\t\t\t\t\tinherit: true,\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{ showInheritControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => ! inherit }\n\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { inherit: true } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\t\tinherit: value === 'default',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\tinherit\n\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on the current template.'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on specific criteria.'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvalue={ !! inherit ? 'default' : 'custom' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"default\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Default' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"custom\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t\t{ hasInheritanceWarning && (\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Cannot inherit the current template query when placed inside the singular content (e.g., post, page, 404, blank).'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showPostTypeControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => postType !== 'post' }\n\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\tonDeselect={ () => onPostTypeChange( 'post' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postTypesSelectOptions.length > 2 ? (\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ postTypesSelectOptions.map(\n\t\t\t\t\t\t\t\t\t\t( option ) => (\n\t\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\torder !== 'desc' || orderBy !== 'date'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Order by' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetQuery( { order: 'desc', orderBy: 'date' } )\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<OrderControl\n\t\t\t\t\t\t\t\t{ ...{ order, orderBy, orderByOptions } }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! sticky }\n\t\t\t\t\t\t\tlabel={ __( 'Sticky posts' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { sticky: '' } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t\t}\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) }\n\t\t\t{ ! inherit && showDisplayPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__display\"\n\t\t\t\t\tlabel={ __( 'Display' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\t\tpages: 0,\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={ __( 'Items per page' ) }\n\t\t\t\t\t\thasValue={ () => perPage > 0 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PerPageControl\n\t\t\t\t\t\t\tperPage={ perPage }\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\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\tlabel={ __( 'Offset' ) }\n\t\t\t\t\t\thasValue={ () => offset > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { offset: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<OffsetControl\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\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\tlabel={ __( 'Max pages to show' ) }\n\t\t\t\t\t\thasValue={ () => pages > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { pages: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PagesControl pages={ pages } onChange={ setQuery } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\" // unused but kept for backward compatibility\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t\tformat: [],\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( value ) =>\n\t\t\t\t\t\t\t\t\t\tObject.values( value || {} ).some(\n\t\t\t\t\t\t\t\t\t\t\t( termIds ) => !! termIds?.length\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\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\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\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\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetQuery( { search: '' } );\n\t\t\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ ( newQuerySearch ) => {\n\t\t\t\t\t\t\t\t\tdebouncedQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t\tsetQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t} }\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\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\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\t{ showFormatControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! format?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Formats' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { format: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FormatControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\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) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,OACpC;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,UAAU,eAAe;AAKlC,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,OAAO,mBAAmB;AAC1B,SAAS,wBAAwB;AACjC,OAAO,oBAAoB;AAC3B,OAAO,mBAAmB;AAC1B,OAAO,oBAAoB;AAC3B,OAAO,mBAAmB;AAC1B,OAAO,kBAAkB;AACzB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,sCAAsC;AA6J7C,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tTextControl,\n\tSelectControl,\n\tNotice,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { debounce } from '@wordpress/compose';\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport OrderControl from './order-control';\nimport AuthorControl from './author-control';\nimport ParentControl from './parent-control';\nimport { TaxonomyControls } from './taxonomy-controls';\nimport FormatControls from './format-controls';\nimport StickyControl from './sticky-control';\nimport PerPageControl from './per-page-control';\nimport OffsetControl from './offset-controls';\nimport PagesControl from './pages-control';\nimport {\n\tusePostTypes,\n\tuseIsPostTypeHierarchical,\n\tuseAllowedControls,\n\tisControlAllowed,\n\tuseTaxonomies,\n\tuseOrderByOptions,\n} from '../../utils';\nimport { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';\n\nexport default function QueryInspectorControls( props ) {\n\tconst { attributes, setQuery, isSingular } = props;\n\tconst { query } = attributes;\n\tconst {\n\t\torder,\n\t\torderBy,\n\t\tauthor: authorIds,\n\t\tpages,\n\t\tpostType,\n\t\tperPage,\n\t\toffset,\n\t\tsticky,\n\t\tinherit,\n\t\ttaxQuery,\n\t\tparents,\n\t\tformat,\n\t} = query;\n\tconst allowedControls = useAllowedControls( attributes );\n\tconst showSticky = postType === 'post';\n\tconst {\n\t\tpostTypesTaxonomiesMap,\n\t\tpostTypesSelectOptions,\n\t\tpostTypeFormatSupportMap,\n\t} = usePostTypes();\n\tconst taxonomies = useTaxonomies( postType );\n\tconst isPostTypeHierarchical = useIsPostTypeHierarchical( postType );\n\tconst onPostTypeChange = ( newValue ) => {\n\t\tconst updateQuery = { postType: newValue };\n\t\t// We need to dynamically update the `taxQuery` property,\n\t\t// by removing any not supported taxonomy from the query.\n\t\tconst supportedTaxonomies = postTypesTaxonomiesMap[ newValue ];\n\t\tif ( !! supportedTaxonomies?.length && !! taxQuery ) {\n\t\t\t// Shared utility to build taxQuery based on supported taxonomies.\n\t\t\tconst buildTaxQuery = ( _taxQuery ) => {\n\t\t\t\treturn Object.entries( _taxQuery || {} ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomy, terms ] ) => {\n\t\t\t\t\t\tif ( supportedTaxonomies.includes( taxonomy ) ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst updatedTaxQuery = {};\n\t\t\tconst builtIncludeTaxQuery = buildTaxQuery( taxQuery.include );\n\t\t\tif ( !! Object.keys( builtIncludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.include = builtIncludeTaxQuery;\n\t\t\t}\n\t\t\tconst builtExcludeTaxQuery = buildTaxQuery( taxQuery.exclude );\n\t\t\tif ( !! Object.keys( builtExcludeTaxQuery ).length ) {\n\t\t\t\tupdatedTaxQuery.exclude = builtExcludeTaxQuery;\n\t\t\t}\n\t\t\tupdateQuery.taxQuery = !! Object.keys( updatedTaxQuery ).length\n\t\t\t\t? updatedTaxQuery\n\t\t\t\t: undefined;\n\t\t}\n\n\t\tif ( newValue !== 'post' ) {\n\t\t\tupdateQuery.sticky = '';\n\t\t}\n\t\t// We need to reset `parents` because they are tied to each post type.\n\t\tupdateQuery.parents = [];\n\t\t// Post types can register post format support with `add_post_type_support`.\n\t\t// But we need to reset the `format` property when switching to post types\n\t\t// that do not support post formats.\n\t\tconst hasFormatSupport = postTypeFormatSupportMap[ newValue ];\n\t\tif ( ! hasFormatSupport ) {\n\t\t\tupdateQuery.format = [];\n\t\t}\n\n\t\tsetQuery( updateQuery );\n\t};\n\tconst [ querySearch, setQuerySearch ] = useState( query.search );\n\tconst debouncedQuerySearch = useMemo( () => {\n\t\treturn debounce( ( newQuerySearch ) => {\n\t\t\tsetQuery( { search: newQuerySearch } );\n\t\t}, 250 );\n\t}, [ setQuery ] );\n\n\tconst orderByOptions = useOrderByOptions( postType );\n\tconst showInheritControl = isControlAllowed( allowedControls, 'inherit' );\n\tconst showPostTypeControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'postType' );\n\tconst postTypeControlLabel = __( 'Post type' );\n\tconst postTypeControlHelp = __(\n\t\t'Select the type of content to display: posts, pages, or custom post types.'\n\t);\n\tconst showOrderControl =\n\t\t! inherit && isControlAllowed( allowedControls, 'order' );\n\tconst showStickyControl =\n\t\t! inherit &&\n\t\tshowSticky &&\n\t\tisControlAllowed( allowedControls, 'sticky' );\n\tconst showSettingsPanel =\n\t\tshowInheritControl ||\n\t\tshowPostTypeControl ||\n\t\tshowOrderControl ||\n\t\tshowStickyControl;\n\tconst showTaxControl =\n\t\t!! taxonomies?.length &&\n\t\tisControlAllowed( allowedControls, 'taxQuery' );\n\tconst showAuthorControl = isControlAllowed( allowedControls, 'author' );\n\tconst showSearchControl = isControlAllowed( allowedControls, 'search' );\n\tconst showParentControl =\n\t\tisControlAllowed( allowedControls, 'parents' ) &&\n\t\tisPostTypeHierarchical;\n\n\tconst postTypeHasFormatSupport = postTypeFormatSupportMap[ postType ];\n\tconst showFormatControl = useSelect(\n\t\t( select ) => {\n\t\t\t// Check if the post type supports post formats and if the control is allowed.\n\t\t\tif (\n\t\t\t\t! postTypeHasFormatSupport ||\n\t\t\t\t! isControlAllowed( allowedControls, 'format' )\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst themeSupports = select( coreStore ).getThemeSupports();\n\n\t\t\t// If there are no supported formats, getThemeSupports still includes the default 'standard' format,\n\t\t\t// and in this case the control should not be shown since the user has no other formats to choose from.\n\t\t\treturn (\n\t\t\t\tthemeSupports.formats &&\n\t\t\t\tthemeSupports.formats.length > 0 &&\n\t\t\t\tthemeSupports.formats.some( ( type ) => type !== 'standard' )\n\t\t\t);\n\t\t},\n\t\t[ allowedControls, postTypeHasFormatSupport ]\n\t);\n\n\tconst showFiltersPanel =\n\t\tshowTaxControl ||\n\t\tshowAuthorControl ||\n\t\tshowSearchControl ||\n\t\tshowParentControl ||\n\t\tshowFormatControl;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst showPostCountControl = isControlAllowed(\n\t\tallowedControls,\n\t\t'postCount'\n\t);\n\tconst showOffSetControl = isControlAllowed( allowedControls, 'offset' );\n\tconst showPagesControl = isControlAllowed( allowedControls, 'pages' );\n\n\tconst showDisplayPanel =\n\t\tshowPostCountControl || showOffSetControl || showPagesControl;\n\n\t// The block cannot inherit a default WordPress query in singular content (e.g., post, page, 404, blank).\n\t// Warn users but still permit this type of query for exceptional cases in Classic and Hybrid themes.\n\tconst hasInheritanceWarning = isSingular && inherit;\n\n\treturn (\n\t\t<>\n\t\t\t{ showSettingsPanel && (\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\tsetQuery( {\n\t\t\t\t\t\t\tpostType: 'post',\n\t\t\t\t\t\t\torder: 'desc',\n\t\t\t\t\t\t\torderBy: 'date',\n\t\t\t\t\t\t\tsticky: '',\n\t\t\t\t\t\t\tinherit: true,\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{ showInheritControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => ! inherit }\n\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { inherit: true } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Query type' ) }\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\t\t\t\t\tinherit: value === 'default',\n\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\tinherit\n\t\t\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on the current template.'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Display a list of posts or custom post types based on specific criteria.'\n\t\t\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tvalue={ !! inherit ? 'default' : 'custom' }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"default\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Default' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tvalue=\"custom\"\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t\t{ hasInheritanceWarning && (\n\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'Cannot inherit the current template query when placed inside the singular content (e.g., post, page, 404, blank).'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showPostTypeControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => postType !== 'post' }\n\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\tonDeselect={ () => onPostTypeChange( 'post' ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ postTypesSelectOptions.length > 2 ? (\n\t\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\t\toptions={ postTypesSelectOptions }\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\t\t\tvalue={ postType }\n\t\t\t\t\t\t\t\t\tlabel={ postTypeControlLabel }\n\t\t\t\t\t\t\t\t\tonChange={ onPostTypeChange }\n\t\t\t\t\t\t\t\t\thelp={ postTypeControlHelp }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ postTypesSelectOptions.map(\n\t\t\t\t\t\t\t\t\t\t( option ) => (\n\t\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\t\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showOrderControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\torder !== 'desc' || orderBy !== 'date'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Order by' ) }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetQuery( { order: 'desc', orderBy: 'date' } )\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<OrderControl\n\t\t\t\t\t\t\t\t{ ...{ order, orderBy, orderByOptions } }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ showStickyControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! sticky }\n\t\t\t\t\t\t\tlabel={ __( 'Sticky posts' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { sticky: '' } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<StickyControl\n\t\t\t\t\t\t\t\tvalue={ sticky }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetQuery( { sticky: value } )\n\t\t\t\t\t\t\t\t}\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) }\n\t\t\t{ ! inherit && showDisplayPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__display\"\n\t\t\t\t\tlabel={ __( 'Display' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\toffset: 0,\n\t\t\t\t\t\t\tpages: 0,\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={ __( 'Items per page' ) }\n\t\t\t\t\t\thasValue={ () => perPage > 0 }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PerPageControl\n\t\t\t\t\t\t\tperPage={ perPage }\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\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\tlabel={ __( 'Offset' ) }\n\t\t\t\t\t\thasValue={ () => offset > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { offset: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<OffsetControl\n\t\t\t\t\t\t\toffset={ offset }\n\t\t\t\t\t\t\tonChange={ setQuery }\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\tlabel={ __( 'Max pages to show' ) }\n\t\t\t\t\t\thasValue={ () => pages > 0 }\n\t\t\t\t\t\tonDeselect={ () => setQuery( { pages: 0 } ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PagesControl pages={ pages } onChange={ setQuery } />\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t) }\n\t\t\t{ ! inherit && showFiltersPanel && (\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tclassName=\"block-library-query-toolspanel__filters\" // unused but kept for backward compatibility\n\t\t\t\t\tlabel={ __( 'Filters' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetQuery( {\n\t\t\t\t\t\t\tauthor: '',\n\t\t\t\t\t\t\tparents: [],\n\t\t\t\t\t\t\tsearch: '',\n\t\t\t\t\t\t\ttaxQuery: null,\n\t\t\t\t\t\t\tformat: [],\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t{ showTaxControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Taxonomies' ) }\n\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\tObject.values( taxQuery || {} ).some(\n\t\t\t\t\t\t\t\t\t( value ) =>\n\t\t\t\t\t\t\t\t\t\tObject.values( value || {} ).some(\n\t\t\t\t\t\t\t\t\t\t\t( termIds ) => !! termIds?.length\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { taxQuery: null } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TaxonomyControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tquery={ query }\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\t{ showAuthorControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! authorIds }\n\t\t\t\t\t\t\tlabel={ __( 'Authors' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { author: '' } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AuthorControl\n\t\t\t\t\t\t\t\tvalue={ authorIds }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\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\t{ showSearchControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! querySearch }\n\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetQuery( { search: '' } );\n\t\t\t\t\t\t\t\tsetQuerySearch( '' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Keyword' ) }\n\t\t\t\t\t\t\t\tvalue={ querySearch }\n\t\t\t\t\t\t\t\tonChange={ ( newQuerySearch ) => {\n\t\t\t\t\t\t\t\t\tdebouncedQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t\tsetQuerySearch( newQuerySearch );\n\t\t\t\t\t\t\t\t} }\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\t{ showParentControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! parents?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Parents' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { parents: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ParentControl\n\t\t\t\t\t\t\t\tparents={ parents }\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonChange={ setQuery }\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\t{ showFormatControl && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! format?.length }\n\t\t\t\t\t\t\tlabel={ __( 'Formats' ) }\n\t\t\t\t\t\t\tonDeselect={ () => setQuery( { format: [] } ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FormatControls\n\t\t\t\t\t\t\t\tonChange={ setQuery }\n\t\t\t\t\t\t\t\tqu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EC,qBACD;AAAA,YAAC;AAAA;AAAA,cACA,UAAW,MAAM,CAAC,CAAE,QAAQ;AAAA,cAC5B,OAAQ,GAAI,SAAU;AAAA,cACtB,YAAa,MAAM,SAAU,EAAE,QAAQ,CAAC,EAAE,CAAE;AAAA,cAE5C;AAAA,gBAAC;AAAA;AAAA,kBACA,UAAW;AAAA,kBACX;AAAA;AAAA,cACD;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IAEF;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/order-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst defaultOrderByOptions = [\n\t{\n\t\tlabel: __( 'Newest to oldest' ),\n\t\tvalue: 'date/desc',\n\t},\n\t{\n\t\tlabel: __( 'Oldest to newest' ),\n\t\tvalue: 'date/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering posts by title in ascending order. */\n\t\tlabel: __( 'A → Z' ),\n\t\tvalue: 'title/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering posts by title in descending order. */\n\t\tlabel: __( 'Z → A' ),\n\t\tvalue: 'title/desc',\n\t},\n];\n\nfunction OrderControl( {\n\torder,\n\torderBy,\n\torderByOptions = defaultOrderByOptions,\n\tonChange,\n} ) {\n\treturn (\n\t\t<SelectControl\n\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AA8BjB;AA5BF,IAAM,wBAAwB;AAAA,EAC7B;AAAA,IACC,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,OAAO,GAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,OAAO,GAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AACD;AAEA,SAAS,aAAc;AAAA,EACtB;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AACD,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst defaultOrderByOptions = [\n\t{\n\t\tlabel: __( 'Newest to oldest' ),\n\t\tvalue: 'date/desc',\n\t},\n\t{\n\t\tlabel: __( 'Oldest to newest' ),\n\t\tvalue: 'date/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering posts by title in ascending order. */\n\t\tlabel: __( 'A → Z' ),\n\t\tvalue: 'title/asc',\n\t},\n\t{\n\t\t/* translators: Label for ordering posts by title in descending order. */\n\t\tlabel: __( 'Z → A' ),\n\t\tvalue: 'title/desc',\n\t},\n];\n\nfunction OrderControl( {\n\torder,\n\torderBy,\n\torderByOptions = defaultOrderByOptions,\n\tonChange,\n} ) {\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Order by' ) }\n\t\t\tvalue={ `${ orderBy }/${ order }` }\n\t\t\toptions={ orderByOptions }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tconst [ newOrderBy, newOrder ] = value.split( '/' );\n\t\t\t\tonChange( { order: newOrder, orderBy: newOrderBy } );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nexport default OrderControl;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AA8BjB;AA5BF,IAAM,wBAAwB;AAAA,EAC7B;AAAA,IACC,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AAAA,EACA;AAAA,IACC,OAAO,GAAI,kBAAmB;AAAA,IAC9B,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,OAAO,GAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AAAA,EACA;AAAA;AAAA,IAEC,OAAO,GAAI,OAAQ;AAAA,IACnB,OAAO;AAAA,EACR;AACD;AAEA,SAAS,aAAc;AAAA,EACtB;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB;AACD,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,UAAW;AAAA,MACvB,OAAQ,GAAI,OAAQ,IAAK,KAAM;AAAA,MAC/B,SAAU;AAAA,MACV,UAAW,CAAE,UAAW;AACvB,cAAM,CAAE,YAAY,QAAS,IAAI,MAAM,MAAO,GAAI;AAClD,iBAAU,EAAE,OAAO,UAAU,SAAS,WAAW,CAAE;AAAA,MACpD;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/parent-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, mapToIHasNameAndId } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,title',\n\tcontext: 'view',\n};\n\nfunction ParentControl( { parents, postType, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\texclude: parents,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, postType, parents ]\n\t);\n\tconst currentParents = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parents?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', postType, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: parents,\n\t\t\t\tper_page: parents.length,\n\t\t\t} );\n\t\t},\n\t\t[ parents, postType ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing parents.\n\tuseEffect( () => {\n\t\tif ( ! parents?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! currentParents?.length ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentParentsInfo = getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( currentParents, 'title.rendered' )\n\t\t);\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = parents.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = currentParentsInfo.mapById[ id ];\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ parents, currentParents ] );\n\n\tconst entitiesInfo = useMemo( () => {\n\t\tif ( ! searchResults?.length ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( searchResults, 'title.rendered' )\n\t\t);\n\t}, [ searchResults ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( entitiesInfo.names );\n\t}, [ entitiesInfo.names, searchHasResolved ] );\n\n\tconst getIdByValue = ( entitiesMappedByName, entity ) => {\n\t\tconst id = entity?.id || entitiesMappedByName?.[ entity ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onParentChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, entity ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( entitiesInfo.mapByName, entity );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( { parents: ids } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU,WAAW,eAAe;AAC7C,SAAS,mBAAmB;AAK5B,S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AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { FormTokenField } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getEntitiesInfo, mapToIHasNameAndId } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,title',\n\tcontext: 'view',\n};\n\nfunction ParentControl( { parents, postType, onChange } ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst selectorArgs = [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'relevance',\n\t\t\t\t\texclude: parents,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, postType, parents ]\n\t);\n\tconst currentParents = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! parents?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'postType', postType, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: parents,\n\t\t\t\tper_page: parents.length,\n\t\t\t} );\n\t\t},\n\t\t[ parents, postType ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing parents.\n\tuseEffect( () => {\n\t\tif ( ! parents?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! currentParents?.length ) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentParentsInfo = getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( currentParents, 'title.rendered' )\n\t\t);\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = parents.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = currentParentsInfo.mapById[ id ];\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ parents, currentParents ] );\n\n\tconst entitiesInfo = useMemo( () => {\n\t\tif ( ! searchResults?.length ) {\n\t\t\treturn EMPTY_ARRAY;\n\t\t}\n\t\treturn getEntitiesInfo(\n\t\t\tmapToIHasNameAndId( searchResults, 'title.rendered' )\n\t\t);\n\t}, [ searchResults ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( entitiesInfo.names );\n\t}, [ entitiesInfo.names, searchHasResolved ] );\n\n\tconst getIdByValue = ( entitiesMappedByName, entity ) => {\n\t\tconst id = entity?.id || entitiesMappedByName?.[ entity ]?.id;\n\t\tif ( id ) {\n\t\t\treturn id;\n\t\t}\n\t};\n\tconst onParentChange = ( newValue ) => {\n\t\tconst ids = Array.from(\n\t\t\tnewValue.reduce( ( accumulator, entity ) => {\n\t\t\t\t// Verify that new values point to existing entities.\n\t\t\t\tconst id = getIdByValue( entitiesInfo.mapByName, entity );\n\t\t\t\tif ( id ) {\n\t\t\t\t\taccumulator.add( id );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, new Set() )\n\t\t);\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( { parents: ids } );\n\t};\n\treturn (\n\t\t<FormTokenField\n\t\t\tlabel={ __( 'Parents' ) }\n\t\t\tvalue={ value }\n\t\t\tonInputChange={ debouncedSearch }\n\t\t\tsuggestions={ suggestions }\n\t\t\tonChange={ onParentChange }\n\t\t\thelp=\"\"\n\t\t/>\n\t);\n}\n\nexport default ParentControl;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU,WAAW,eAAe;AAC7C,SAAS,mBAAmB;AAK5B,SAAS,iBAAiB,0BAA0B;AAwHlD;AAtHF,IAAM,cAAc,CAAC;AACrB,IAAM,aAAa;AAAA,EAClB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACV;AAEA,SAAS,cAAe,EAAE,SAAS,UAAU,SAAS,GAAI;AACzD,QAAM,CAAE,QAAQ,SAAU,IAAI,SAAU,EAAG;AAC3C,QAAM,CAAE,OAAO,QAAS,IAAI,SAAU,WAAY;AAClD,QAAM,CAAE,aAAa,cAAe,IAAI,SAAU,WAAY;AAC9D,QAAM,kBAAkB,YAAa,WAAW,GAAI;AACpD,QAAM,EAAE,eAAe,kBAAkB,IAAI;AAAA,IAC5C,CAAE,WAAY;AACb,UAAK,CAAE,QAAS;AACf,eAAO,EAAE,eAAe,aAAa,mBAAmB,KAAK;AAAA,MAC9D;AACA,YAAM,EAAE,kBA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A,IACR;AACA,WAAO;AAAA,MACN,mBAAoB,eAAe,gBAAiB;AAAA,IACrD;AAAA,EACD,GAAG,CAAE,aAAc,CAAE;AAErB,YAAW,MAAM;AAChB,QAAK,CAAE,mBAAoB;AAC1B;AAAA,IACD;AACA,mBAAgB,aAAa,KAAM;AAAA,EACpC,GAAG,CAAE,aAAa,OAAO,iBAAkB,CAAE;AAE7C,QAAM,eAAe,CAAE,sBAAsB,WAAY;AACxD,UAAM,KAAK,QAAQ,MAAM,uBAAwB,MAAO,GAAG;AAC3D,QAAK,IAAK;AACT,aAAO;AAAA,IACR;AAAA,EACD;AACA,QAAM,iBAAiB,CAAE,aAAc;AACtC,UAAM,MAAM,MAAM;AAAA,MACjB,SAAS,OAAQ,CAAE,aAAa,WAAY;AAE3C,cAAM,KAAK,aAAc,aAAa,WAAW,MAAO;AACxD,YAAK,IAAK;AACT,sBAAY,IAAK,EAAG;AAAA,QACrB;AACA,eAAO;AAAA,MACR,GAAG,oBAAI,IAAI,CAAE;AAAA,IACd;AACA,mBAAgB,WAAY;AAC5B,aAAU,EAAE,SAAS,IAAI,CAAE;AAAA,EAC5B;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,SAAU;AAAA,MACtB;AAAA,MACA,eAAgB;AAAA,MAChB;AAAA,MACA,UAAW;AAAA,MACX,MAAK;AAAA;AAAA,EACN;AAEF;AAEA,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/per-page-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RangeControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst MIN_POSTS_PER_PAGE = 1;\nconst MAX_POSTS_PER_PAGE = 100;\n\nconst PerPageControl = ( { perPage, offset = 0, onChange } ) => {\n\treturn (\n\t\t<RangeControl\n\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AAOjB;AALF,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAE3B,IAAM,iBAAiB,CAAE,EAAE,SAAS,SAAS,GAAG,SAAS,MAAO;AAC/D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RangeControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst MIN_POSTS_PER_PAGE = 1;\nconst MAX_POSTS_PER_PAGE = 100;\n\nconst PerPageControl = ( { perPage, offset = 0, onChange } ) => {\n\treturn (\n\t\t<RangeControl\n\t\t\tlabel={ __( 'Items per page' ) }\n\t\t\tmin={ MIN_POSTS_PER_PAGE }\n\t\t\tmax={ MAX_POSTS_PER_PAGE }\n\t\t\tonChange={ ( newPerPage ) => {\n\t\t\t\tif (\n\t\t\t\t\tisNaN( newPerPage ) ||\n\t\t\t\t\tnewPerPage < MIN_POSTS_PER_PAGE ||\n\t\t\t\t\tnewPerPage > MAX_POSTS_PER_PAGE\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonChange( { perPage: newPerPage, offset } );\n\t\t\t} }\n\t\t\tvalue={ parseInt( perPage, 10 ) }\n\t\t/>\n\t);\n};\n\nexport default PerPageControl;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AAOjB;AALF,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAE3B,IAAM,iBAAiB,CAAE,EAAE,SAAS,SAAS,GAAG,SAAS,MAAO;AAC/D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,gBAAiB;AAAA,MAC7B,KAAM;AAAA,MACN,KAAM;AAAA,MACN,UAAW,CAAE,eAAgB;AAC5B,YACC,MAAO,UAAW,KAClB,aAAa,sBACb,aAAa,oBACZ;AACD;AAAA,QACD;AACA,iBAAU,EAAE,SAAS,YAAY,OAAO,CAAE;AAAA,MAC3C;AAAA,MACA,OAAQ,SAAU,SAAS,EAAG;AAAA;AAAA,EAC/B;AAEF;AAEA,IAAO,2BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/sticky-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst stickyOptions = [\n\t{ label: __( 'Include' ), value: '' },\n\t{ label: __( 'Ignore' ), value: 'ignore' },\n\t{ label: __( 'Exclude' ), value: 'exclude' },\n\t{ label: __( 'Only' ), value: 'only' },\n];\n\nexport default function StickyControl( { value, onChange } ) {\n\treturn (\n\t\t<SelectControl\n\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AAWjB;AATF,IAAM,gBAAgB;AAAA,EACrB,EAAE,OAAO,GAAI,SAAU,GAAG,OAAO,GAAG;AAAA,EACpC,EAAE,OAAO,GAAI,QAAS,GAAG,OAAO,SAAS;AAAA,EACzC,EAAE,OAAO,GAAI,SAAU,GAAG,OAAO,UAAU;AAAA,EAC3C,EAAE,OAAO,GAAI,MAAO,GAAG,OAAO,OAAO;AACtC;AAEe,SAAR,cAAgC,EAAE,OAAO,SAAS,GAAI;AAC5D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst stickyOptions = [\n\t{ label: __( 'Include' ), value: '' },\n\t{ label: __( 'Ignore' ), value: 'ignore' },\n\t{ label: __( 'Exclude' ), value: 'exclude' },\n\t{ label: __( 'Only' ), value: 'only' },\n];\n\nexport default function StickyControl( { value, onChange } ) {\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Sticky posts' ) }\n\t\t\toptions={ stickyOptions }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\thelp={ __(\n\t\t\t\t'Sticky posts always appear first, regardless of their publish date.'\n\t\t\t) }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AAWjB;AATF,IAAM,gBAAgB;AAAA,EACrB,EAAE,OAAO,GAAI,SAAU,GAAG,OAAO,GAAG;AAAA,EACpC,EAAE,OAAO,GAAI,QAAS,GAAG,OAAO,SAAS;AAAA,EACzC,EAAE,OAAO,GAAI,SAAU,GAAG,OAAO,UAAU;AAAA,EAC3C,EAAE,OAAO,GAAI,MAAO,GAAG,OAAO,OAAO;AACtC;AAEe,SAAR,cAAgC,EAAE,OAAO,SAAS,GAAI;AAC5D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,cAAe;AAAA,MAC3B,SAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,MAAO;AAAA,QACN;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/query/edit/inspector-controls/taxonomy-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tFormTokenField,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, Fragment } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst includeTermIds =\n\t\t\t\t\ttaxQuery?.include?.[ taxonomy.slug ] || [];\n\t\t\t\tconst excludeTermIds =\n\t\t\t\t\ttaxQuery?.exclude?.[ taxonomy.slug ] || [];\n\t\t\t\tconst onChangeTaxQuery = (\n\t\t\t\t\tnewTermIds,\n\t\t\t\t\t/** @type {'include'|'exclude'} */ key\n\t\t\t\t) => {\n\t\t\t\t\tconst newPartialTaxQuery = {\n\t\t\t\t\t\t...taxQuery?.[ key ],\n\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t};\n\t\t\t\t\t// Remove empty arrays from the partial `taxQuery` (include|exclude).\n\t\t\t\t\tif ( ! newTermIds.length ) {\n\t\t\t\t\t\tdelete newPartialTaxQuery[ taxonomy.slug ];\n\t\t\t\t\t}\n\t\t\t\t\tconst newTaxQuery = {\n\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t[ key ]: !! Object.keys( newPartialTaxQuery ).length\n\t\t\t\t\t\t\t? newPartialTaxQuery\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t};\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t// Clean up `taxQuery` if all filters are removed.\n\t\t\t\t\t\ttaxQuery: Object.values( newTaxQuery ).every(\n\t\t\t\t\t\t\t( value ) => ! value\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: newTaxQuery,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t\treturn (\n\t\t\t\t\t<Fragment key={ taxonomy.slug }>\n\t\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\t\ttermIds={ includeTermIds }\n\t\t\t\t\t\t\toppositeTermIds={ excludeTermIds }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tonChangeTaxQuery( value, 'include' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\t\ttermIds={ excludeTermIds }\n\t\t\t\t\t\t\toppositeTermIds={ includeTermIds }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tonChangeTaxQuery( value, 'exclude' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t/* translators: %s: taxonomy name */\n\t\t\t\t\t\t\t\tsprintf( __( 'Exclude: %s' ), taxonomy.name )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Fragment>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {number[]} props.oppositeTermIds An array with the opposite control's term ids (to exclude from suggestions).\n * @param {Function} props.onChange Callback `onChange` function.\n * @param {string} props.label Label of the control.\n * @return {React.JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( {\n\ttaxonomy,\n\ttermIds,\n\toppositeTermIds,\n\tonChange,\n\tlabel,\n} ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\t// Combine current terms and opposite terms for exclusion, to prevent\n\t\t\t// users from selecting the same term in both include and exclude controls.\n\t\t\tconst combinedExclude = [ ...termIds, ...oppositeTermIds ];\n\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: combinedExclude,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, taxonomy.slug, termIds, oppositeTermIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ taxonomy.slug, termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ label }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\thelp=\"\"\n\t\t\t
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,OAClB;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU,WAAW,gBAAgB;AAC9C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,SAAS,UAAU;AAK5B,SAAS,qBAAqB;AA4EzB,SACC,KADD;AA1EL,IAAM,cAAc,CAAC;AACrB,IAAM,aAAa;AAAA,EAClB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACV;AAGA,IAAM,uBAAuB,CAAE,OAAO,cAAe;AAEpD,QAAM,SACL,WAAW,MAAM,OAAO,KAAM,CAAE,SAAU,KAAK,SAAS,SAAU,GAAG;AACtE,MAAK,QAAS;AACb,WAAO;AAAA,EACR;AAWA,QAAM,iBAAiB,UAAU,kBAAkB;AACnD,SAAO,OAAO;AAAA,IACb,CAAE,SAAU,KAAK,KAAK,kBAAkB,MAAM;AAAA,EAC/C,GAAG;AACJ;AAEO,SAAS,iBAAkB,EAAE,UAAU,MAAM,GAAI;AACvD,QAAM,EAAE,UAAU,SAAS,IAAI;AAE/B,QAAM,aAAa,cAAe,QAAS;AAC3C,MAAK,CAAE,YAAY,QAAS;AAC3B,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,UAAO,SA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AAS,cAAc,KAAM,CAAE,SAAU,KAAK,OAAO,EAAG;AAC9D,UAAK,QAAS;AACb,oBAAY,KAAM;AAAA,UACjB;AAAA,UACA,OAAO,OAAO;AAAA,QACf,CAAE;AAAA,MACH;AACA,aAAO;AAAA,IACR,GAAG,CAAC,CAAE;AACN,aAAU,cAAe;AAAA,EAC1B,GAAG,CAAE,SAAS,aAAc,CAAE;AAE9B,YAAW,MAAM;AAChB,QAAK,CAAE,mBAAoB;AAC1B;AAAA,IACD;AACA,mBAAgB,cAAc,IAAK,CAAE,WAAY,OAAO,IAAK,CAAE;AAAA,EAChE,GAAG,CAAE,eAAe,iBAAkB,CAAE;AACxC,QAAM,gBAAgB,CAAE,kBAAmB;AAC1C,UAAM,aAAa,oBAAI,IAAI;AAC3B,eAAY,aAAa,eAAgB;AACxC,YAAM,SAAS,qBAAsB,eAAe,SAAU;AAC9D,UAAK,QAAS;AACb,mBAAW,IAAK,MAAO;AAAA,MACxB;AAAA,IACD;AACA,mBAAgB,WAAY;AAC5B,aAAU,MAAM,KAAM,UAAW,CAAE;AAAA,EACpC;AACA,SACC,oBAAC,SAAI,WAAU,mDACd;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAgB;AAAA,MAChB;AAAA,MACA,kBAAmB;AAAA,MACnB,UAAW;AAAA,MACX,MAAK;AAAA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tFormTokenField,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, useEffect, Fragment } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { sprintf, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useTaxonomies } from '../../utils';\n\nconst EMPTY_ARRAY = [];\nconst BASE_QUERY = {\n\torder: 'asc',\n\t_fields: 'id,name',\n\tcontext: 'view',\n};\n\n// Helper function to get the term id based on user input in terms `FormTokenField`.\nconst getTermIdByTermValue = ( terms, termValue ) => {\n\t// First we check for exact match by `term.id` or case sensitive `term.name` match.\n\tconst termId =\n\t\ttermValue?.id || terms?.find( ( term ) => term.name === termValue )?.id;\n\tif ( termId ) {\n\t\treturn termId;\n\t}\n\n\t/**\n\t * Here we make an extra check for entered terms in a non case sensitive way,\n\t * to match user expectations, due to `FormTokenField` behaviour that shows\n\t * suggestions which are case insensitive.\n\t *\n\t * Although WP tries to discourage users to add terms with the same name (case insensitive),\n\t * it's still possible if you manually change the name, as long as the terms have different slugs.\n\t * In this edge case we always apply the first match from the terms list.\n\t */\n\tconst termValueLower = termValue.toLocaleLowerCase();\n\treturn terms?.find(\n\t\t( term ) => term.name.toLocaleLowerCase() === termValueLower\n\t)?.id;\n};\n\nexport function TaxonomyControls( { onChange, query } ) {\n\tconst { postType, taxQuery } = query;\n\n\tconst taxonomies = useTaxonomies( postType );\n\tif ( ! taxonomies?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 4 }>\n\t\t\t{ taxonomies.map( ( taxonomy ) => {\n\t\t\t\tconst includeTermIds =\n\t\t\t\t\ttaxQuery?.include?.[ taxonomy.slug ] || [];\n\t\t\t\tconst excludeTermIds =\n\t\t\t\t\ttaxQuery?.exclude?.[ taxonomy.slug ] || [];\n\t\t\t\tconst onChangeTaxQuery = (\n\t\t\t\t\tnewTermIds,\n\t\t\t\t\t/** @type {'include'|'exclude'} */ key\n\t\t\t\t) => {\n\t\t\t\t\tconst newPartialTaxQuery = {\n\t\t\t\t\t\t...taxQuery?.[ key ],\n\t\t\t\t\t\t[ taxonomy.slug ]: newTermIds,\n\t\t\t\t\t};\n\t\t\t\t\t// Remove empty arrays from the partial `taxQuery` (include|exclude).\n\t\t\t\t\tif ( ! newTermIds.length ) {\n\t\t\t\t\t\tdelete newPartialTaxQuery[ taxonomy.slug ];\n\t\t\t\t\t}\n\t\t\t\t\tconst newTaxQuery = {\n\t\t\t\t\t\t...taxQuery,\n\t\t\t\t\t\t[ key ]: !! Object.keys( newPartialTaxQuery ).length\n\t\t\t\t\t\t\t? newPartialTaxQuery\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t};\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\t// Clean up `taxQuery` if all filters are removed.\n\t\t\t\t\t\ttaxQuery: Object.values( newTaxQuery ).every(\n\t\t\t\t\t\t\t( value ) => ! value\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: newTaxQuery,\n\t\t\t\t\t} );\n\t\t\t\t};\n\t\t\t\treturn (\n\t\t\t\t\t<Fragment key={ taxonomy.slug }>\n\t\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\t\ttermIds={ includeTermIds }\n\t\t\t\t\t\t\toppositeTermIds={ excludeTermIds }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tonChangeTaxQuery( value, 'include' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ taxonomy.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TaxonomyItem\n\t\t\t\t\t\t\ttaxonomy={ taxonomy }\n\t\t\t\t\t\t\ttermIds={ excludeTermIds }\n\t\t\t\t\t\t\toppositeTermIds={ includeTermIds }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tonChangeTaxQuery( value, 'exclude' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t/* translators: %s: taxonomy name */\n\t\t\t\t\t\t\t\tsprintf( __( 'Exclude: %s' ), taxonomy.name )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Fragment>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Renders a `FormTokenField` for a given taxonomy.\n *\n * @param {Object} props The props for the component.\n * @param {Object} props.taxonomy The taxonomy object.\n * @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.\n * @param {number[]} props.oppositeTermIds An array with the opposite control's term ids (to exclude from suggestions).\n * @param {Function} props.onChange Callback `onChange` function.\n * @param {string} props.label Label of the control.\n * @return {React.JSX.Element} The rendered component.\n */\nfunction TaxonomyItem( {\n\ttaxonomy,\n\ttermIds,\n\toppositeTermIds,\n\tonChange,\n\tlabel,\n} ) {\n\tconst [ search, setSearch ] = useState( '' );\n\tconst [ value, setValue ] = useState( EMPTY_ARRAY );\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tconst debouncedSearch = useDebounce( setSearch, 250 );\n\tconst { searchResults, searchHasResolved } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! search ) {\n\t\t\t\treturn { searchResults: EMPTY_ARRAY, searchHasResolved: true };\n\t\t\t}\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\t// Combine current terms and opposite terms for exclusion, to prevent\n\t\t\t// users from selecting the same term in both include and exclude controls.\n\t\t\tconst combinedExclude = [ ...termIds, ...oppositeTermIds ];\n\n\t\t\tconst selectorArgs = [\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\t{\n\t\t\t\t\t...BASE_QUERY,\n\t\t\t\t\tsearch,\n\t\t\t\t\torderby: 'name',\n\t\t\t\t\texclude: combinedExclude,\n\t\t\t\t\tper_page: 20,\n\t\t\t\t},\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tsearchResults: getEntityRecords( ...selectorArgs ),\n\t\t\t\tsearchHasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tselectorArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ search, taxonomy.slug, termIds, oppositeTermIds ]\n\t);\n\t// `existingTerms` are the ones fetched from the API and their type is `{ id: number; name: string }`.\n\t// They are used to extract the terms' names to populate the `FormTokenField` properly\n\t// and to sanitize the provided `termIds`, by setting only the ones that exist.\n\tconst existingTerms = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! termIds?.length ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\treturn getEntityRecords( 'taxonomy', taxonomy.slug, {\n\t\t\t\t...BASE_QUERY,\n\t\t\t\tinclude: termIds,\n\t\t\t\tper_page: termIds.length,\n\t\t\t} );\n\t\t},\n\t\t[ taxonomy.slug, termIds ]\n\t);\n\t// Update the `value` state only after the selectors are resolved\n\t// to avoid emptying the input when we're changing terms.\n\tuseEffect( () => {\n\t\tif ( ! termIds?.length ) {\n\t\t\tsetValue( EMPTY_ARRAY );\n\t\t}\n\t\tif ( ! existingTerms?.length ) {\n\t\t\treturn;\n\t\t}\n\t\t// Returns only the existing entity ids. This prevents the component\n\t\t// from crashing in the editor, when non existing ids are provided.\n\t\tconst sanitizedValue = termIds.reduce( ( accumulator, id ) => {\n\t\t\tconst entity = existingTerms.find( ( term ) => term.id === id );\n\t\t\tif ( entity ) {\n\t\t\t\taccumulator.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tvalue: entity.name,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, [] );\n\t\tsetValue( sanitizedValue );\n\t}, [ termIds, existingTerms ] );\n\t// Update suggestions only when the query has resolved.\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) {\n\t\t\treturn;\n\t\t}\n\t\tsetSuggestions( searchResults.map( ( result ) => result.name ) );\n\t}, [ searchResults, searchHasResolved ] );\n\tconst onTermsChange = ( newTermValues ) => {\n\t\tconst newTermIds = new Set();\n\t\tfor ( const termValue of newTermValues ) {\n\t\t\tconst termId = getTermIdByTermValue( searchResults, termValue );\n\t\t\tif ( termId ) {\n\t\t\t\tnewTermIds.add( termId );\n\t\t\t}\n\t\t}\n\t\tsetSuggestions( EMPTY_ARRAY );\n\t\tonChange( Array.from( newTermIds ) );\n\t};\n\treturn (\n\t\t<div className=\"block-library-query-inspector__taxonomy-control\">\n\t\t\t<FormTokenField\n\t\t\t\tlabel={ label }\n\t\t\t\tvalue={ value }\n\t\t\t\tonInputChange={ debouncedSearch }\n\t\t\t\tsuggestions={ suggestions }\n\t\t\t\tdisplayTransform={ decodeEntities }\n\t\t\t\tonChange={ onTermsChange }\n\t\t\t\thelp=\"\"\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,OAClB;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU,WAAW,gBAAgB;AAC9C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,SAAS,UAAU;AAK5B,SAAS,qBAAqB;AA4EzB,SACC,KADD;AA1EL,IAAM,cAAc,CAAC;AACrB,IAAM,aAAa;AAAA,EAClB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACV;AAGA,IAAM,uBAAuB,CAAE,OAAO,cAAe;AAEpD,QAAM,SACL,WAAW,MAAM,OAAO,KAAM,CAAE,SAAU,KAAK,SAAS,SAAU,GAAG;AACtE,MAAK,QAAS;AACb,WAAO;AAAA,EACR;AAWA,QAAM,iBAAiB,UAAU,kBAAkB;AACnD,SAAO,OAAO;AAAA,IACb,CAAE,SAAU,KAAK,KAAK,kBAAkB,MAAM;AAAA,EAC/C,GAAG;AACJ;AAEO,SAAS,iBAAkB,EAAE,UAAU,MAAM,GAAI;AACvD,QAAM,EAAE,UAAU,SAAS,IAAI;AAE/B,QAAM,aAAa,cAAe,QAAS;AAC3C,MAAK,CAAE,YAAY,QAAS;AAC3B,WAAO;AAAA,EACR;AAEA,SACC,oBAAC,UAAO,SAAU,GACf,qBAAW,IAAK,CAAE,aAAc;AACjC,UAAM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G;AAC9D,UAAK,QAAS;AACb,oBAAY,KAAM;AAAA,UACjB;AAAA,UACA,OAAO,OAAO;AAAA,QACf,CAAE;AAAA,MACH;AACA,aAAO;AAAA,IACR,GAAG,CAAC,CAAE;AACN,aAAU,cAAe;AAAA,EAC1B,GAAG,CAAE,SAAS,aAAc,CAAE;AAE9B,YAAW,MAAM;AAChB,QAAK,CAAE,mBAAoB;AAC1B;AAAA,IACD;AACA,mBAAgB,cAAc,IAAK,CAAE,WAAY,OAAO,IAAK,CAAE;AAAA,EAChE,GAAG,CAAE,eAAe,iBAAkB,CAAE;AACxC,QAAM,gBAAgB,CAAE,kBAAmB;AAC1C,UAAM,aAAa,oBAAI,IAAI;AAC3B,eAAY,aAAa,eAAgB;AACxC,YAAM,SAAS,qBAAsB,eAAe,SAAU;AAC9D,UAAK,QAAS;AACb,mBAAW,IAAK,MAAO;AAAA,MACxB;AAAA,IACD;AACA,mBAAgB,WAAY;AAC5B,aAAU,MAAM,KAAM,UAAW,CAAE;AAAA,EACpC;AACA,SACC,oBAAC,SAAI,WAAU,mDACd;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,eAAgB;AAAA,MAChB;AAAA,MACA,kBAAmB;AAAA,MACnB,UAAW;AAAA,MACX,MAAK;AAAA;AAAA,EACN,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/query-pagination/query-pagination-arrow-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\n\nexport function QueryPaginationArrowControls( { value, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,IAAI,UAAU;AACvB;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,OACpC;AAIL,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\n\nexport function QueryPaginationArrowControls( { value, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\tlabel={ __( 'Arrow' ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\thelp={ __(\n\t\t\t\t'A decorative arrow appended to the next and previous page link.'\n\t\t\t) }\n\t\t\tisBlock\n\t\t>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tvalue=\"none\"\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'None',\n\t\t\t\t\t'Arrow option for Query Pagination Next/Previous blocks'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tvalue=\"arrow\"\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Arrow',\n\t\t\t\t\t'Arrow option for Query Pagination Next/Previous blocks'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tvalue=\"chevron\"\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Chevron',\n\t\t\t\t\t'Arrow option for Query Pagination Next/Previous blocks'\n\t\t\t\t) }\n\t\t\t/>\n\t\t</ToggleGroupControl>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,UAAU;AACvB;AAAA,EACC,oCAAoC;AAAA,EACpC,0CAA0C;AAAA,OACpC;AAIL,SASC,KATD;AAFK,SAAS,6BAA8B,EAAE,OAAO,SAAS,GAAI;AACnE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,GAAI,OAAQ;AAAA,MACpB;AAAA,MACA;AAAA,MACA,MAAO;AAAA,QACN;AAAA,MACD;AAAA,MACA,SAAO;AAAA,MAEP;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,OAAM;AAAA,YACN,OAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,OAAM;AAAA,YACN,OAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,OAAM;AAAA,YACN,OAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -50,7 +50,6 @@ function QueryPaginationNumbersEdit({
|
|
|
50
50
|
children: /* @__PURE__ */ jsx(
|
|
51
51
|
RangeControl,
|
|
52
52
|
{
|
|
53
|
-
__next40pxDefaultSize: true,
|
|
54
53
|
label: __("Number of links"),
|
|
55
54
|
help: __(
|
|
56
55
|
"Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible."
|