@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/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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA+B;AAC/B,kBAA0B;AAC1B,uBAAmC;AACnC,qBAA6C;AAC7C,qBAA4B;AAK5B,mBAAoD;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;AACz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GA,UAAM,iBAAiB,QAAQ,OAAQ,CAAE,aAAa,OAAQ;AAC7D,YAAM,SAAS,mBAAmB,QAAS,EAAG;AAC9C,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,cAAe,CAAE;AAE/B,QAAM,mBAAe,wBAAS,MAAM;AACnC,QAAK,CAAE,eAAe,QAAS;AAC9B,aAAO;AAAA,IACR;AACA,eAAO;AAAA,UACN,iCAAoB,eAAe,gBAAiB;AAAA,IACrD;AAAA,EACD,GAAG,CAAE,aAAc,CAAE;AAErB,gCAAW,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,
|
|
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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA+B;AAC/B,kBAA0B;AAC1B,uBAAmC;AACnC,qBAA6C;AAC7C,qBAA4B;AAK5B,mBAAoD;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,QAAI,yBAAU,EAAG;AAC3C,QAAM,CAAE,OAAO,QAAS,QAAI,yBAAU,WAAY;AAClD,QAAM,CAAE,aAAa,cAAe,QAAI,yBAAU,WAAY;AAC9D,QAAM,sBAAkB,4BAAa,WAAW,GAAI;AACpD,QAAM,EAAE,eAAe,kBAAkB,QAAI;AAAA,IAC5C,CAAE,WAAY;AACb,UAAK,CAAE,QAAS;AACf,eAAO,EAAE,eAAe,aAAa,mBAAmB,KAAK;AAAA,MAC9D;AACA,YAAM,EAAE,kBAAkB,sBAAsB,IAC/C,OAAQ,iBAAAA,KAAU;AACnB,YAAM,eAAe;AAAA,QACpB;AAAA,QACA;AAAA,QACA;AAAA,UACC,GAAG;AAAA,UACH;AAAA,UACA,SAAS;AAAA,UACT,SAAS;AAAA,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oB;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,WAAQ,gBAAI,SAAU;AAAA,MACtB;AAAA,MACA,eAAgB;AAAA,MAChB;AAAA,MACA,UAAW;AAAA,MACX,MAAK;AAAA;AAAA,EACN;AAEF;AAEA,IAAO,yBAAQ;",
|
|
6
6
|
"names": ["coreStore"]
|
|
7
7
|
}
|
|
@@ -32,7 +32,6 @@ var PerPageControl = ({ perPage, offset = 0, onChange }) => {
|
|
|
32
32
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
33
|
import_components.RangeControl,
|
|
34
34
|
{
|
|
35
|
-
__next40pxDefaultSize: true,
|
|
36
35
|
label: (0, import_i18n.__)("Items per page"),
|
|
37
36
|
min: MIN_POSTS_PER_PAGE,
|
|
38
37
|
max: MAX_POSTS_PER_PAGE,
|
|
@@ -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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA6B;AAC7B,kBAAmB;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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA6B;AAC7B,kBAAmB;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,WAAQ,gBAAI,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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AAWjB;AATF,IAAM,gBAAgB;AAAA,EACrB,EAAE,WAAO,gBAAI,SAAU,GAAG,OAAO,GAAG;AAAA,EACpC,EAAE,WAAO,gBAAI,QAAS,GAAG,OAAO,SAAS;AAAA,EACzC,EAAE,WAAO,gBAAI,SAAU,GAAG,OAAO,UAAU;AAAA,EAC3C,EAAE,WAAO,gBAAI,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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AAWjB;AATF,IAAM,gBAAgB;AAAA,EACrB,EAAE,WAAO,gBAAI,SAAU,GAAG,OAAO,GAAG;AAAA,EACpC,EAAE,WAAO,gBAAI,QAAS,GAAG,OAAO,SAAS;AAAA,EACzC,EAAE,WAAO,gBAAI,SAAU,GAAG,OAAO,UAAU;AAAA,EAC3C,EAAE,WAAO,gBAAI,MAAO,GAAG,OAAO,OAAO;AACtC;AAEe,SAAR,cAAgC,EAAE,OAAO,SAAS,GAAI;AAC5D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAQ,gBAAI,cAAe;AAAA,MAC3B,SAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,UAAO;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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,kBAA0B;AAC1B,uBAAmC;AACnC,qBAA8C;AAC9C,qBAA4B;AAC5B,2BAA+B;AAC/B,kBAA4B;AAK5B,mBAA8B;AA4EzB;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,kBAA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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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAGO;AACP,kBAA0B;AAC1B,uBAAmC;AACnC,qBAA8C;AAC9C,qBAA4B;AAC5B,2BAA+B;AAC/B,kBAA4B;AAK5B,mBAA8B;AA4EzB;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,KA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rowControls({ value, onChange }) {
|
|
|
30
30
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
31
31
|
import_components.__experimentalToggleGroupControl,
|
|
32
32
|
{
|
|
33
|
-
__next40pxDefaultSize: true,
|
|
34
33
|
label: (0, import_i18n.__)("Arrow"),
|
|
35
34
|
value,
|
|
36
35
|
onChange,
|
|
@@ -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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuB;AACvB,wBAGO;AAIL;AAFK,SAAS,6BAA8B,EAAE,OAAO,SAAS,GAAI;AACnE,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,
|
|
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": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuB;AACvB,wBAGO;AAIL;AAFK,SAAS,6BAA8B,EAAE,OAAO,SAAS,GAAI;AACnE,SACC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,OAAQ;AAAA,MACpB;AAAA,MACA;AAAA,MACA,UAAO;AAAA,QACN;AAAA,MACD;AAAA,MACA,SAAO;AAAA,MAEP;AAAA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,OAAM;AAAA,YACN,WAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC,kBAAAA;AAAA,UAAA;AAAA,YACA,OAAM;AAAA,YACN,WAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA;AAAA,QACD;AAAA,QACA;AAAA,UAAC,kBAAAA;AAAA,UAAA;AAAA,YACA,OAAM;AAAA,YACN,WAAQ;AAAA,cACP;AAAA,cACA;AAAA,YACD;AAAA;AAAA,QACD;AAAA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["ToggleGroupControl", "ToggleGroupControlOption"]
|
|
7
7
|
}
|
|
@@ -70,7 +70,6 @@ function QueryPaginationNumbersEdit({
|
|
|
70
70
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
71
|
import_components.RangeControl,
|
|
72
72
|
{
|
|
73
|
-
__next40pxDefaultSize: true,
|
|
74
73
|
label: (0, import_i18n.__)("Number of links"),
|
|
75
74
|
help: (0, import_i18n.__)(
|
|
76
75
|
"Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible."
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/query-pagination-numbers/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tRangeControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst createPaginationItem = ( content, Tag = 'a', extraClass = '' ) => (\n\t<Tag key={ content } className={ `page-numbers ${ extraClass }` }>\n\t\t{ content }\n\t</Tag>\n);\n\nconst previewPaginationNumbers = ( midSize ) => {\n\tconst paginationItems = [];\n\n\t// First set of pagination items.\n\tfor ( let i = 1; i <= midSize; i++ ) {\n\t\tpaginationItems.push( createPaginationItem( i ) );\n\t}\n\n\t// Current pagination item.\n\tpaginationItems.push(\n\t\tcreatePaginationItem( midSize + 1, 'span', 'current' )\n\t);\n\n\t// Second set of pagination items.\n\tfor ( let i = 1; i <= midSize; i++ ) {\n\t\tpaginationItems.push( createPaginationItem( midSize + 1 + i ) );\n\t}\n\n\t// Dots.\n\tpaginationItems.push( createPaginationItem( '...', 'span', 'dots' ) );\n\n\t// Last pagination item.\n\tpaginationItems.push( createPaginationItem( midSize * 2 + 3 ) );\n\n\treturn <>{ paginationItems }</>;\n};\n\nexport default function QueryPaginationNumbersEdit( {\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { midSize } = attributes;\n\tconst paginationNumbers = previewPaginationNumbers(\n\t\tparseInt( midSize, 10 )\n\t);\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={ () => setAttributes( { midSize: 2 } ) }\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={ __( 'Number of links' ) }\n\t\t\t\t\t\thasValue={ () => midSize !== 2 }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { midSize: 2 } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,0BAAiD;AACjD,wBAIO;AAKP,mBAA+C;AAG9C;AADD,IAAM,uBAAuB,CAAE,SAAS,MAAM,KAAK,aAAa,OAC/D,4CAAC,OAAoB,WAAY,gBAAiB,UAAW,IAC1D,qBADQ,OAEX;AAGD,IAAM,2BAA2B,CAAE,YAAa;AAC/C,QAAM,kBAAkB,CAAC;AAGzB,WAAU,IAAI,GAAG,KAAK,SAAS,KAAM;AACpC,oBAAgB,KAAM,qBAAsB,CAAE,CAAE;AAAA,EACjD;AAGA,kBAAgB;AAAA,IACf,qBAAsB,UAAU,GAAG,QAAQ,SAAU;AAAA,EACtD;AAGA,WAAU,IAAI,GAAG,KAAK,SAAS,KAAM;AACpC,oBAAgB,KAAM,qBAAsB,UAAU,IAAI,CAAE,CAAE;AAAA,EAC/D;AAGA,kBAAgB,KAAM,qBAAsB,OAAO,QAAQ,MAAO,CAAE;AAGpE,kBAAgB,KAAM,qBAAsB,UAAU,IAAI,CAAE,CAAE;AAE9D,SAAO,2EAAI,2BAAiB;AAC7B;AAEe,SAAR,2BAA6C;AAAA,EACnD;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,oBAAoB;AAAA,IACzB,SAAU,SAAS,EAAG;AAAA,EACvB;AACA,QAAM,wBAAoB,6CAA+B;AAEzD,SACC,4EACC;AAAA,gDAAC,yCACA;AAAA,MAAC,kBAAAA;AAAA,MAAA;AAAA,QACA,WAAQ,gBAAI,UAAW;AAAA,QACvB,UAAW,MAAM,cAAe,EAAE,SAAS,EAAE,CAAE;AAAA,QAC/C;AAAA,QAEA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,iBAAkB;AAAA,YAC9B,UAAW,MAAM,YAAY;AAAA,YAC7B,YAAa,MAAM,cAAe,EAAE,SAAS,EAAE,CAAE;AAAA,YACjD,kBAAgB;AAAA,YAEhB;AAAA,cAAC;AAAA;AAAA,gBACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tRangeControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst createPaginationItem = ( content, Tag = 'a', extraClass = '' ) => (\n\t<Tag key={ content } className={ `page-numbers ${ extraClass }` }>\n\t\t{ content }\n\t</Tag>\n);\n\nconst previewPaginationNumbers = ( midSize ) => {\n\tconst paginationItems = [];\n\n\t// First set of pagination items.\n\tfor ( let i = 1; i <= midSize; i++ ) {\n\t\tpaginationItems.push( createPaginationItem( i ) );\n\t}\n\n\t// Current pagination item.\n\tpaginationItems.push(\n\t\tcreatePaginationItem( midSize + 1, 'span', 'current' )\n\t);\n\n\t// Second set of pagination items.\n\tfor ( let i = 1; i <= midSize; i++ ) {\n\t\tpaginationItems.push( createPaginationItem( midSize + 1 + i ) );\n\t}\n\n\t// Dots.\n\tpaginationItems.push( createPaginationItem( '...', 'span', 'dots' ) );\n\n\t// Last pagination item.\n\tpaginationItems.push( createPaginationItem( midSize * 2 + 3 ) );\n\n\treturn <>{ paginationItems }</>;\n};\n\nexport default function QueryPaginationNumbersEdit( {\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { midSize } = attributes;\n\tconst paginationNumbers = previewPaginationNumbers(\n\t\tparseInt( midSize, 10 )\n\t);\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={ () => setAttributes( { midSize: 2 } ) }\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={ __( 'Number of links' ) }\n\t\t\t\t\t\thasValue={ () => midSize !== 2 }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { midSize: 2 } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Number of links' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ midSize }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tmidSize: parseInt( value, 10 ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\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Ae,EAAE,SAAS,EAAE,CAAE;AAAA,QAC/C;AAAA,QAEA;AAAA,UAAC,kBAAAC;AAAA,UAAA;AAAA,YACA,WAAQ,gBAAI,iBAAkB;AAAA,YAC9B,UAAW,MAAM,YAAY;AAAA,YAC7B,YAAa,MAAM,cAAe,EAAE,SAAS,EAAE,CAAE;AAAA,YACjD,kBAAgB;AAAA,YAEhB;AAAA,cAAC;AAAA;AAAA,gBACA,WAAQ,gBAAI,iBAAkB;AAAA,gBAC9B,UAAO;AAAA,kBACN;AAAA,gBACD;AAAA,gBACA,OAAQ;AAAA,gBACR,UAAW,CAAE,UAAW;AACvB,gCAAe;AAAA,oBACd,SAAS,SAAU,OAAO,EAAG;AAAA,kBAC9B,CAAE;AAAA,gBACH;AAAA,gBACA,KAAM;AAAA,gBACN,KAAM;AAAA,gBACN,gBAAiB;AAAA;AAAA,YAClB;AAAA;AAAA,QACD;AAAA;AAAA,IACD,GACD;AAAA,IACA,4CAAC,SAAM,OAAG,mCAAc,GAAM,6BAAmB;AAAA,KAClD;AAEF;",
|
|
6
6
|
"names": ["ToolsPanel", "ToolsPanelItem"]
|
|
7
7
|
}
|
|
@@ -110,11 +110,7 @@ var transforms = {
|
|
|
110
110
|
"core/quote",
|
|
111
111
|
{},
|
|
112
112
|
blocks.map(
|
|
113
|
-
(block) => (0, import_blocks.
|
|
114
|
-
block.name,
|
|
115
|
-
block.attributes,
|
|
116
|
-
block.innerBlocks
|
|
117
|
-
)
|
|
113
|
+
(block) => (0, import_blocks.__experimentalCloneSanitizedBlock)(block)
|
|
118
114
|
)
|
|
119
115
|
)
|
|
120
116
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/quote/transforms.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAyB;AACzB,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport {\n\tcreateBlock,\n\t__experimentalCloneSanitizedBlock,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/verse' ],\n\t\t\ttransform: ( { content } ) => {\n\t\t\t\treturn createBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\ttransform: ( {\n\t\t\t\tvalue,\n\t\t\t\talign,\n\t\t\t\tcitation,\n\t\t\t\tanchor,\n\t\t\t\tfontSize,\n\t\t\t\tstyle,\n\t\t\t} ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tcitation,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t},\n\t\t\t\t\t[ createBlock( 'core/paragraph', { content: value } ) ]\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'prefix',\n\t\t\tprefix: '>',\n\t\t\ttransform: ( content ) =>\n\t\t\t\tcreateBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] ),\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tschema: () => ( {\n\t\t\t\tblockquote: {\n\t\t\t\t\tchildren: '*',\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tselector: 'blockquote',\n\t\t\ttransform: ( node, handler ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t// Don't try to parse any `cite` out of this content.\n\t\t\t\t\t// * There may be more than one cite.\n\t\t\t\t\t// * There may be more attribution text than just the cite.\n\t\t\t\t\t// * If the cite is nested in the quoted text, it's wrong to\n\t\t\t\t\t// remove it.\n\t\t\t\t\t{},\n\t\t\t\t\thandler( {\n\t\t\t\t\t\tHTML: node.innerHTML,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\tisMatch: ( {}, blocks ) => {\n\t\t\t\t// When a single block is selected make the transformation\n\t\t\t\t// available only to specific blocks that make sense.\n\t\t\t\tif ( blocks.length === 1 ) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t'core/heading',\n\t\t\t\t\t\t'core/list',\n\t\t\t\t\t\t'core/pullquote',\n\t\t\t\t\t].includes( blocks[ 0 ].name );\n\t\t\t\t}\n\t\t\t\treturn ! blocks.some( ( { name } ) => name === 'core/quote' );\n\t\t\t},\n\t\t\t__experimentalConvert: ( blocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{},\n\t\t\t\t\tblocks.map( ( block ) =>\n\t\t\t\t\t\t__experimentalCloneSanitizedBlock( block )\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\tisMatch: ( {}, block ) => {\n\t\t\t\treturn block.innerBlocks.every(\n\t\t\t\t\t( { name } ) => name === 'core/paragraph'\n\t\t\t\t);\n\t\t\t},\n\t\t\ttransform: (\n\t\t\t\t{ align, citation, anchor, fontSize, style },\n\t\t\t\tinnerBlocks\n\t\t\t) => {\n\t\t\t\tconst value = innerBlocks\n\t\t\t\t\t.map( ( { attributes } ) => `${ attributes.content }` )\n\t\t\t\t\t.join( '<br>' );\n\t\t\t\treturn createBlock( 'core/pullquote', {\n\t\t\t\t\tvalue,\n\t\t\t\t\talign,\n\t\t\t\t\tcitation,\n\t\t\t\t\tanchor,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tstyle,\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/verse' ],\n\t\t\tisMatch: ( {}, block ) => {\n\t\t\t\treturn block.innerBlocks.every( ( innerBlock ) => {\n\t\t\t\t\t// Paragraphs are already in the target format\n\t\t\t\t\tif ( innerBlock.name === 'core/paragraph' ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\t// Check if other blocks can be converted to paragraphs\n\t\t\t\t\tconst converted = switchToBlockType(\n\t\t\t\t\t\tinnerBlock,\n\t\t\t\t\t\t'core/paragraph'\n\t\t\t\t\t);\n\t\t\t\t\treturn converted !== null;\n\t\t\t\t} );\n\t\t\t},\n\t\t\ttransform: ( {}, innerBlocks ) => {\n\t\t\t\tconst paragraphs = innerBlocks.flatMap( ( innerBlock ) => {\n\t\t\t\t\t// If already a paragraph, use it directly\n\t\t\t\t\tif ( innerBlock.name === 'core/paragraph' ) {\n\t\t\t\t\t\treturn innerBlock;\n\t\t\t\t\t}\n\t\t\t\t\t// Otherwise convert to paragraph\n\t\t\t\t\treturn (\n\t\t\t\t\t\tswitchToBlockType( innerBlock, 'core/paragraph' ) || []\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tconst content = paragraphs\n\t\t\t\t\t.map( ( { attributes } ) => attributes.content || '' )\n\t\t\t\t\t.filter( Boolean )\n\t\t\t\t\t.join( '<br>' );\n\t\t\t\treturn createBlock( 'core/verse', { content } );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\tisMatch: ( { citation }, block ) => {\n\t\t\t\tconst innerBlocks = block.innerBlocks;\n\t\t\t\tif ( ! innerBlocks.length ) {\n\t\t\t\t\treturn ! RichText.isEmpty( citation );\n\t\t\t\t}\n\n\t\t\t\treturn innerBlocks.every( ( innerBlock ) => {\n\t\t\t\t\tif ( innerBlock.name === 'core/paragraph' ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tconst converted = switchToBlockType(\n\t\t\t\t\t\tinnerBlock,\n\t\t\t\t\t\t'core/paragraph'\n\t\t\t\t\t);\n\t\t\t\t\treturn converted !== null;\n\t\t\t\t} );\n\t\t\t},\n\t\t\ttransform: ( { citation }, innerBlocks ) => {\n\t\t\t\tconst paragraphs = innerBlocks.flatMap( ( innerBlock ) => {\n\t\t\t\t\tif ( innerBlock.name === 'core/paragraph' ) {\n\t\t\t\t\t\treturn innerBlock;\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\tswitchToBlockType( innerBlock, 'core/paragraph' ) || []\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\treturn RichText.isEmpty( citation )\n\t\t\t\t\t? paragraphs\n\t\t\t\t\t: [\n\t\t\t\t\t\t\t...paragraphs,\n\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t ];\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( { citation, anchor }, innerBlocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ anchor },\n\t\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t\t? innerBlocks\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t ]\n\t\t\t\t),\n\t\t},\n\t],\n\tungroup: ( { citation }, innerBlocks ) =>\n\t\tRichText.isEmpty( citation )\n\t\t\t? innerBlocks\n\t\t\t: [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t ],\n};\n\nexport default transforms;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAyB;AACzB,oBAIO;AAEP,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,IACL;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,YAAa;AAAA,MACvB,WAAW,CAAE,EAAE,QAAQ,MAAO;AAC7B,mBAAO,2BAAa,cAAc,CAAC,GAAG;AAAA,cACrC,2BAAa,kBAAkB,EAAE,QAAQ,CAAE;AAAA,QAC5C,CAAE;AAAA,MACH;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,MAAO;AACN,mBAAO;AAAA,UACN;AAAA,UACA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,UACA,KAAE,2BAAa,kBAAkB,EAAE,SAAS,MAAM,CAAE,CAAE;AAAA,QACvD;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,WAAW,CAAE,gBACZ,2BAAa,cAAc,CAAC,GAAG;AAAA,YAC9B,2BAAa,kBAAkB,EAAE,QAAQ,CAAE;AAAA,MAC5C,CAAE;AAAA,IACJ;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,OAAQ;AAAA,QACf,YAAY;AAAA,UACX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E,eAAgB;AACzD,cAAK,WAAW,SAAS,kBAAmB;AAC3C,mBAAO;AAAA,UACR;AACA,qBACC,iCAAmB,YAAY,gBAAiB,KAAK,CAAC;AAAA,QAExD,CAAE;AACF,eAAO,6BAAS,QAAS,QAAS,IAC/B,aACA;AAAA,UACA,GAAG;AAAA,cACH,2BAAa,kBAAkB;AAAA,YAC9B,SAAS;AAAA,UACV,CAAE;AAAA,QACF;AAAA,MACJ;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,YAAa;AAAA,MACvB,WAAW,CAAE,EAAE,UAAU,OAAO,GAAG,oBAClC;AAAA,QACC;AAAA,QACA,EAAE,OAAO;AAAA,QACT,6BAAS,QAAS,QAAS,IACxB,cACA;AAAA,UACA,GAAG;AAAA,cACH,2BAAa,kBAAkB;AAAA,YAC9B,SAAS;AAAA,UACV,CAAE;AAAA,QACF;AAAA,MACJ;AAAA,IACF;AAAA,EACD;AAAA,EACA,SAAS,CAAE,EAAE,SAAS,GAAG,gBACxB,6BAAS,QAAS,QAAS,IACxB,cACA;AAAA,IACA,GAAG;AAAA,QACH,2BAAa,kBAAkB;AAAA,MAC9B,SAAS;AAAA,IACV,CAAE;AAAA,EACF;AACL;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/rss/edit.cjs
CHANGED
|
@@ -173,7 +173,6 @@ function RSSEdit({ attributes, setAttributes, name }) {
|
|
|
173
173
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
174
174
|
import_components.RangeControl,
|
|
175
175
|
{
|
|
176
|
-
__next40pxDefaultSize: true,
|
|
177
176
|
label: (0, import_i18n.__)("Number of items"),
|
|
178
177
|
value: itemsToShow,
|
|
179
178
|
onChange: (value) => setAttributes({ itemsToShow: value }),
|
|
@@ -245,7 +244,6 @@ function RSSEdit({ attributes, setAttributes, name }) {
|
|
|
245
244
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
246
245
|
import_components.RangeControl,
|
|
247
246
|
{
|
|
248
|
-
__next40pxDefaultSize: true,
|
|
249
247
|
label: (0, import_i18n.__)("Max number of words in excerpt"),
|
|
250
248
|
value: excerptLength,
|
|
251
249
|
onChange: (value) => setAttributes({ excerptLength: value }),
|
|
@@ -266,7 +264,6 @@ function RSSEdit({ attributes, setAttributes, name }) {
|
|
|
266
264
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
267
265
|
import_components.RangeControl,
|
|
268
266
|
{
|
|
269
|
-
__next40pxDefaultSize: true,
|
|
270
267
|
label: (0, import_i18n.__)("Columns"),
|
|
271
268
|
value: columns,
|
|
272
269
|
onChange: (value) => setAttributes({ columns: value }),
|
package/build/rss/edit.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/rss/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tPlaceholder,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n\tTextControl,\n\tExternalLink,\n\t__experimentalInputControl as InputControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createInterpolateElement, useState } from '@wordpress/element';\nimport { grid, list, pencil, rss } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { prependHTTPS } from '@wordpress/url';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { useDisabled } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\n\nconst DEFAULT_MIN_ITEMS = 1;\nconst DEFAULT_MAX_ITEMS = 20;\n\nexport default function RSSEdit( { attributes, setAttributes, name } ) {\n\tconst [ isEditing, setIsEditing ] = useState( ! attributes.feedURL );\n\n\tconst {\n\t\tblockLayout,\n\t\tcolumns,\n\t\tdisplayAuthor,\n\t\tdisplayDate,\n\t\tdisplayExcerpt,\n\t\texcerptLength,\n\t\tfeedURL,\n\t\titemsToShow,\n\t\topenInNewTab,\n\t\trel,\n\t} = attributes;\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tfunction toggleAttribute( propName ) {\n\t\treturn () => {\n\t\t\tconst value = attributes[ propName ];\n\n\t\t\tsetAttributes( { [ propName ]: ! value } );\n\t\t};\n\t}\n\n\tfunction onSubmitURL( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( feedURL ) {\n\t\t\tsetAttributes( { feedURL: prependHTTPS( feedURL ) } );\n\t\t\tsetIsEditing( false );\n\t\t}\n\t}\n\n\tconst { content, status, error } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock: name,\n\t} );\n\n\tconst disabledRef = useDisabled();\n\tconst blockProps = useBlockProps( { ref: isEditing ? null : disabledRef } );\n\n\tconst label = __( 'RSS URL' );\n\n\tif ( isEditing ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ rss }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Display entries from any RSS or Atom feed.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ onSubmitURL }\n\t\t\t\t\t\tclassName=\"wp-block-rss__placeholder-form\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tplaceholder={ __( 'Enter URL here…' ) }\n\t\t\t\t\t\t\tvalue={ feedURL }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { feedURL: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"wp-block-rss__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst toolbarControls = [\n\t\t{\n\t\t\ticon: pencil,\n\t\t\ttitle: __( 'Edit RSS URL' ),\n\t\t\tonClick: () => setIsEditing( true ),\n\t\t},\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'RSS block display setting' ),\n\t\t\tonClick: () => setAttributes( { blockLayout: 'list' } ),\n\t\t\tisActive: blockLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'RSS block display setting' ),\n\t\t\tonClick: () => setAttributes( { blockLayout: 'grid' } ),\n\t\t\tisActive: blockLayout === 'grid',\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ toolbarControls } />\n\t\t\t</BlockControls>\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\titemsToShow: 5,\n\t\t\t\t\t\t\tdisplayAuthor: false,\n\t\t\t\t\t\t\tdisplayDate: false,\n\t\t\t\t\t\t\tdisplayExcerpt: false,\n\t\t\t\t\t\t\texcerptLength: 55,\n\t\t\t\t\t\t\tcolumns: 2,\n\t\t\t\t\t\t\topenInNewTab: false,\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={ __( 'Number of items' ) }\n\t\t\t\t\t\thasValue={ () => itemsToShow !== 5 }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { itemsToShow: 5 } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAIO;AACP,wBAYO;AACP,qBAAmD;AACnD,mBAAwC;AACxC,kBAAgC;AAChC,iBAA6B;AAC7B,gCAAoC;AACpC,qBAA4B;AAK5B,mBAA+C;AAC/C,2BAAyB;AA6DpB;AA3DL,IAAM,oBAAoB;AAC1B,IAAM,oBAAoB;AAEX,SAAR,QAA0B,EAAE,YAAY,eAAe,KAAK,GAAI;AACtE,QAAM,CAAE,WAAW,YAAa,QAAI,yBAAU,CAAE,WAAW,OAAQ;AAEnE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM,wBAAoB,6CAA+B;AAEzD,WAAS,gBAAiB,UAAW;AACpC,WAAO,MAAM;AACZ,YAAM,QAAQ,WAAY,QAAS;AAEnC,oBAAe,EAAE,CAAE,QAAS,GAAG,CAAE,MAAM,CAAE;AAAA,IAC1C;AAAA,EACD;AAEA,WAAS,YAAa,OAAQ;AAC7B,UAAM,eAAe;AAErB,QAAK,SAAU;AACd,oBAAe,EAAE,aAAS,yBAAc,OAAQ,EAAE,CAAE;AACpD,mBAAc,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AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,WAAO,gBAAI,aAAa,2BAA4B;AAAA,MACpD,SAAS,MAAM,cAAe,EAAE,aAAa,OAAO,CAAE;AAAA,MACtD,UAAU,gBAAgB;AAAA,IAC3B;AAAA,EACD;AAEA,SACC,4EACC;AAAA,gDAAC,qCACA,sDAAC,kCAAa,UAAW,iBAAkB,GAC5C;AAAA,IACA,4CAAC,yCACA;AAAA,MAAC,kBAAAC;AAAA,MAAA;AAAA,QACA,WAAQ,gBAAI,UAAW;AAAA,QACvB,UAAW,MAAM;AAChB,wBAAe;AAAA,YACd,aAAa;AAAA,YACb,eAAe;AAAA,YACf,aAAa;AAAA,YACb,gBAAgB;AAAA,YAChB,eAAe;AAAA,YACf,SAAS;AAAA,YACT,cAAc;AAAA,UACf,CAAE;AAAA,QACH;AAAA,QACA;AAAA,QAEA;AAAA;AAAA,YAAC,kBAAAC;AAAA,YAAA;AAAA,cACA,WAAQ,gBAAI,iBAAkB;AAAA,cAC9B,UAAW,MAAM,gBAAgB;AAAA,cACjC,YAAa,MAAM,cAAe,EAAE,aAAa,EAAE,CAAE;AAAA,cACrD,kBAAgB;AAAA,cAEhB;AAAA,gBAAC;AAAA;AAAA,kBACA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport {\n\tButton,\n\tPlaceholder,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n\tTextControl,\n\tExternalLink,\n\t__experimentalInputControl as InputControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { createInterpolateElement, useState } from '@wordpress/element';\nimport { grid, list, pencil, rss } from '@wordpress/icons';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { prependHTTPS } from '@wordpress/url';\nimport { useServerSideRender } from '@wordpress/server-side-render';\nimport { useDisabled } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport HtmlRenderer from '../utils/html-renderer';\n\nconst DEFAULT_MIN_ITEMS = 1;\nconst DEFAULT_MAX_ITEMS = 20;\n\nexport default function RSSEdit( { attributes, setAttributes, name } ) {\n\tconst [ isEditing, setIsEditing ] = useState( ! attributes.feedURL );\n\n\tconst {\n\t\tblockLayout,\n\t\tcolumns,\n\t\tdisplayAuthor,\n\t\tdisplayDate,\n\t\tdisplayExcerpt,\n\t\texcerptLength,\n\t\tfeedURL,\n\t\titemsToShow,\n\t\topenInNewTab,\n\t\trel,\n\t} = attributes;\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tfunction toggleAttribute( propName ) {\n\t\treturn () => {\n\t\t\tconst value = attributes[ propName ];\n\n\t\t\tsetAttributes( { [ propName ]: ! value } );\n\t\t};\n\t}\n\n\tfunction onSubmitURL( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( feedURL ) {\n\t\t\tsetAttributes( { feedURL: prependHTTPS( feedURL ) } );\n\t\t\tsetIsEditing( false );\n\t\t}\n\t}\n\n\tconst { content, status, error } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock: name,\n\t} );\n\n\tconst disabledRef = useDisabled();\n\tconst blockProps = useBlockProps( { ref: isEditing ? null : disabledRef } );\n\n\tconst label = __( 'RSS URL' );\n\n\tif ( isEditing ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Placeholder\n\t\t\t\t\ticon={ rss }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t'Display entries from any RSS or Atom feed.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tonSubmit={ onSubmitURL }\n\t\t\t\t\t\tclassName=\"wp-block-rss__placeholder-form\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tplaceholder={ __( 'Enter URL here…' ) }\n\t\t\t\t\t\t\tvalue={ feedURL }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { feedURL: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tclassName=\"wp-block-rss__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Apply' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tconst toolbarControls = [\n\t\t{\n\t\t\ticon: pencil,\n\t\t\ttitle: __( 'Edit RSS URL' ),\n\t\t\tonClick: () => setIsEditing( true ),\n\t\t},\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: _x( 'List view', 'RSS block display setting' ),\n\t\t\tonClick: () => setAttributes( { blockLayout: 'list' } ),\n\t\t\tisActive: blockLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: _x( 'Grid view', 'RSS block display setting' ),\n\t\t\tonClick: () => setAttributes( { blockLayout: 'grid' } ),\n\t\t\tisActive: blockLayout === 'grid',\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ toolbarControls } />\n\t\t\t</BlockControls>\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\titemsToShow: 5,\n\t\t\t\t\t\t\tdisplayAuthor: false,\n\t\t\t\t\t\t\tdisplayDate: false,\n\t\t\t\t\t\t\tdisplayExcerpt: false,\n\t\t\t\t\t\t\texcerptLength: 55,\n\t\t\t\t\t\t\tcolumns: 2,\n\t\t\t\t\t\t\topenInNewTab: false,\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={ __( 'Number of items' ) }\n\t\t\t\t\t\thasValue={ () => itemsToShow !== 5 }\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { itemsToShow: 5 } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Number of items' ) }\n\t\t\t\t\t\t\tvalue={ itemsToShow }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { itemsToShow: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ DEFAULT_MIN_ITEMS }\n\t\t\t\t\t\t\tmax={ DEFAULT_MAX_ITEMS }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display author' ) }\n\t\t\t\t\t\thasValue={ () => !! displayAuthor }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayAuthor: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display author' ) }\n\t\t\t\t\t\t\tchecked={ displayAuthor }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'displayAuthor' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display date' ) }\n\t\t\t\t\t\thasValue={ () => !! displayDate }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayDate: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display date' ) }\n\t\t\t\t\t\t\tchecked={ displayDate }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'displayDate' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Display excerpt' ) }\n\t\t\t\t\t\thasValue={ () => !! displayExcerpt }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { displayExcerpt: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Display excerpt' ) }\n\t\t\t\t\t\t\tchecked={ displayExcerpt }\n\t\t\t\t\t\t\tonChange={ toggleAttribute( 'displayExcerpt' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t{ displayExcerpt && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Max number of words in excerpt' ) }\n\t\t\t\t\t\t\thasValue={ () => excerptLength !== 55 }\n\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: 55 } )\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<RangeControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Max number of words in excerpt' ) }\n\t\t\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 10 }\n\t\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\t\trequired\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{ blockLayout === 'grid' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\thasValue={ () => columns !== 2 }\n\t\t\t\t\t\t\tonDeselect={ () => setAttributes( { columns: 2 } ) }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\t\t\tmax={ 6 }\n\t\t\t\t\t\t\t\trequired\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<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { openInNewTab: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { rel: value } ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t{ status === 'loading' && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ status === 'error' && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t/* translators: %s: error message returned when rendering the block. */\n\t\t\t\t\t\t\t__( 'Error: %s' ),\n\t\t\t\t\t\t\terror\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ status === 'success' && (\n\t\t\t\t<HtmlRenderer wrapperProps={ blockProps } html={ content } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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A,YAAA;AAAA,cACA,WAAQ,gBAAI,uBAAwB;AAAA,cACpC,UAAW,MAAM,CAAC,CAAE;AAAA,cACpB,YAAa,MACZ,cAAe,EAAE,cAAc,MAAM,CAAE;AAAA,cAExC,kBAAgB;AAAA,cAEhB;AAAA,gBAAC;AAAA;AAAA,kBACA,WAAQ,gBAAI,uBAAwB;AAAA,kBACpC,SAAU;AAAA,kBACV,UAAW,CAAE,UACZ,cAAe,EAAE,cAAc,MAAM,CAAE;AAAA;AAAA,cAEzC;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACA,4CAAC,yCAAkB,OAAM,YACxB;AAAA,MAAC;AAAA;AAAA,QACA,WAAQ,gBAAI,eAAgB;AAAA,QAC5B,UAAO;AAAA,cACN;AAAA,YACC;AAAA,UACD;AAAA,UACA;AAAA,YACC,GACC,4CAAC,kCAAa,MAAK,8DAA6D;AAAA,UAElF;AAAA,QACD;AAAA,QACA,OAAQ,OAAO;AAAA,QACf,UAAW,CAAE,UAAW,cAAe,EAAE,KAAK,MAAM,CAAE;AAAA;AAAA,IACvD,GACD;AAAA,IACE,WAAW,aACZ,4CAAC,SAAM,GAAG,YACT,sDAAC,6BAAQ,GACV;AAAA,IAEC,WAAW,WACZ,4CAAC,SAAM,GAAG,YACT,sDAAC,OACE;AAAA;AAAA,UAED,gBAAI,WAAY;AAAA,MAChB;AAAA,IACD,GACD,GACD;AAAA,IAEC,WAAW,aACZ,4CAAC,qBAAAC,SAAA,EAAa,cAAe,YAAa,MAAO,SAAU;AAAA,KAE7D;AAEF;",
|
|
6
6
|
"names": ["InputControl", "ToolsPanel", "ToolsPanelItem", "HtmlRenderer"]
|
|
7
7
|
}
|
package/build/search/edit.cjs
CHANGED
|
@@ -313,7 +313,6 @@ function SearchEdit({
|
|
|
313
313
|
import_components.SelectControl,
|
|
314
314
|
{
|
|
315
315
|
value: buttonPosition,
|
|
316
|
-
__next40pxDefaultSize: true,
|
|
317
316
|
label: (0, import_i18n.__)("Button position"),
|
|
318
317
|
onChange: (value) => {
|
|
319
318
|
setAttributes({
|
|
@@ -364,7 +363,6 @@ function SearchEdit({
|
|
|
364
363
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
365
364
|
import_components.__experimentalUnitControl,
|
|
366
365
|
{
|
|
367
|
-
__next40pxDefaultSize: true,
|
|
368
366
|
label: (0, import_i18n.__)("Width"),
|
|
369
367
|
id: unitControlInputId,
|
|
370
368
|
min: (0, import_utils.isPercentageUnit)(widthUnit) ? 0 : import_utils.MIN_WIDTH,
|
|
@@ -400,7 +398,6 @@ function SearchEdit({
|
|
|
400
398
|
});
|
|
401
399
|
},
|
|
402
400
|
isBlock: true,
|
|
403
|
-
__next40pxDefaultSize: true,
|
|
404
401
|
children: PERCENTAGE_WIDTHS.map((widthValue) => {
|
|
405
402
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
406
403
|
import_components.__experimentalToggleGroupControlOption,
|
|
@@ -426,7 +423,6 @@ function SearchEdit({
|
|
|
426
423
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
427
424
|
import_components.SelectControl,
|
|
428
425
|
{
|
|
429
|
-
__next40pxDefaultSize: true,
|
|
430
426
|
label: (0, import_i18n.__)("HTML element"),
|
|
431
427
|
value: tagName ?? "",
|
|
432
428
|
options: [
|