@wordpress/block-library 9.13.1-next.cd6172eb0.0 → 9.15.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 +4 -0
- package/LICENSE.md +1 -1
- package/build/archives/edit.js +83 -36
- package/build/archives/edit.js.map +1 -1
- package/build/avatar/user-control.js +1 -0
- package/build/avatar/user-control.js.map +1 -1
- package/build/block/deprecated.js +1 -0
- package/build/block/deprecated.js.map +1 -1
- package/build/block/edit.js +1 -0
- package/build/block/edit.js.map +1 -1
- package/build/button/deprecated.js +183 -1
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +49 -27
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +8 -2
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +8 -5
- package/build/button/save.js.map +1 -1
- package/build/buttons/transforms.js +1 -0
- package/build/buttons/transforms.js.map +1 -1
- package/build/categories/edit.js +1 -0
- package/build/categories/edit.js.map +1 -1
- package/build/column/column-preview.native.js +1 -0
- package/build/column/column-preview.native.js.map +1 -1
- package/build/column/edit.js +33 -13
- package/build/column/edit.js.map +1 -1
- package/build/columns/columnCalculations.native.js +1 -0
- package/build/columns/columnCalculations.native.js.map +1 -1
- package/build/columns/deprecated.js +1 -0
- package/build/columns/deprecated.js.map +1 -1
- package/build/columns/edit.js +51 -27
- package/build/columns/edit.js.map +1 -1
- package/build/columns/edit.native.js +1 -0
- package/build/columns/edit.native.js.map +1 -1
- package/build/columns/transforms.js +1 -0
- package/build/columns/transforms.js.map +1 -1
- package/build/columns/utils.js +1 -0
- package/build/columns/utils.js.map +1 -1
- package/build/comment-template/edit.js +1 -0
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +1 -0
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comment-template/util.js +1 -0
- package/build/comment-template/util.js.map +1 -1
- package/build/comments/index.js +1 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/edit/index.js +9 -3
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit.native.js +1 -1
- package/build/cover/edit.native.js.map +1 -1
- package/build/details/edit.js +29 -7
- package/build/details/edit.js.map +1 -1
- package/build/details/transforms.js +1 -0
- package/build/details/transforms.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +1 -0
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/embed/util.js +1 -0
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +1 -0
- package/build/embed/variations.js.map +1 -1
- package/build/embed/wp-embed-preview.js +1 -0
- package/build/embed/wp-embed-preview.js.map +1 -1
- package/build/file/transforms.js +1 -0
- package/build/file/transforms.js.map +1 -1
- package/build/footnotes/edit.js +1 -0
- package/build/footnotes/edit.js.map +1 -1
- package/build/form/index.js +1 -2
- package/build/form/index.js.map +1 -1
- package/build/form/view.js +10 -5
- package/build/form/view.js.map +1 -1
- package/build/freeform/modal.js +1 -0
- package/build/freeform/modal.js.map +1 -1
- package/build/gallery/deprecated.js +1 -0
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +1 -0
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/shared.js +1 -0
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +1 -0
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +1 -0
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-get-media.native.js +1 -0
- package/build/gallery/use-get-media.native.js.map +1 -1
- package/build/gallery/use-get-new-images.js +1 -0
- package/build/gallery/use-get-new-images.js.map +1 -1
- package/build/gallery/use-image-sizes.js +1 -0
- package/build/gallery/use-image-sizes.js.map +1 -1
- package/build/group/placeholder.js +1 -0
- package/build/group/placeholder.js.map +1 -1
- package/build/group/transforms.js +1 -0
- package/build/group/transforms.js.map +1 -1
- package/build/heading/transforms.js +1 -0
- package/build/heading/transforms.js.map +1 -1
- package/build/html/preview.js +1 -0
- package/build/html/preview.js.map +1 -1
- package/build/image/edit.js +1 -0
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -0
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +2 -1
- package/build/image/image.js.map +1 -1
- package/build/image/transforms.js +2 -0
- package/build/image/transforms.js.map +1 -1
- package/build/image/utils.js +1 -0
- package/build/image/utils.js.map +1 -1
- package/build/image/view.js +1 -3
- package/build/image/view.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/index.native.js +1 -0
- package/build/index.native.js.map +1 -1
- package/build/latest-posts/deprecated.js +12 -0
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/edit.js +1 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/index.js +12 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/list/transforms.js +1 -0
- package/build/list/transforms.js.map +1 -1
- package/build/list/utils.js +1 -0
- package/build/list/utils.js.map +1 -1
- package/build/list-item/hooks/use-indent-list-item.js +1 -0
- package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build/list-item/transforms.js +1 -0
- package/build/list-item/transforms.js.map +1 -1
- package/build/loginout/edit.js +42 -13
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +60 -31
- package/build/media-text/edit.js.map +1 -1
- package/build/more/edit.js +28 -7
- package/build/more/edit.js.map +1 -1
- package/build/more/save.js +1 -0
- package/build/more/save.js.map +1 -1
- package/build/navigation/deprecated.js +1 -0
- package/build/navigation/deprecated.js.map +1 -1
- package/build/navigation/edit/index.js +1 -0
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +5 -3
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/use-generate-default-navigation-title.js +1 -0
- package/build/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +1 -0
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +1 -0
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation/view.js +1 -0
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +96 -57
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/hooks.js +1 -0
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-link/link-ui.js +3 -3
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-submenu/edit.js +105 -54
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +45 -25
- package/build/page-list/edit.js.map +1 -1
- package/build/page-list/use-convert-to-navigation-links.js +1 -0
- package/build/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build/paragraph/edit.js +22 -6
- package/build/paragraph/edit.js.map +1 -1
- package/build/pattern/edit.js +1 -0
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js +16 -3
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +4 -2
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-name/edit.js +11 -5
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-author-name/index.js +4 -2
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-comments-form/index.js +6 -1
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +8 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-date/edit.js +58 -18
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +2 -1
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/edit.js +42 -18
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +18 -19
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-featured-image/edit.js +45 -11
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +6 -3
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/edit.js +1 -0
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +11 -7
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-navigation-link/variations.js +3 -2
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-template/edit.js +1 -0
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +12 -2
- package/build/post-template/index.js.map +1 -1
- package/build/post-terms/edit.js +1 -0
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/hooks.js +1 -0
- package/build/post-terms/hooks.js.map +1 -1
- package/build/post-title/index.js +6 -3
- package/build/post-title/index.js.map +1 -1
- package/build/pullquote/blockquote.native.js +1 -0
- package/build/pullquote/blockquote.native.js.map +1 -1
- package/build/pullquote/transforms.js +1 -0
- package/build/pullquote/transforms.js.map +1 -1
- package/build/query/deprecated.js +1 -0
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +1 -0
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/format-controls.js +1 -0
- package/build/query/edit/inspector-controls/format-controls.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -0
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +1 -0
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +1 -0
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/utils.js +1 -0
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/index.js +11 -10
- package/build/query-no-results/index.js.map +1 -1
- package/build/query-pagination/edit.js +47 -17
- package/build/query-pagination/edit.js.map +1 -1
- package/build/query-pagination/query-pagination-label-control.js +1 -1
- package/build/query-pagination/query-pagination-label-control.js.map +1 -1
- package/build/query-pagination-numbers/edit.js +33 -15
- package/build/query-pagination-numbers/edit.js.map +1 -1
- package/build/query-title/variations.js +1 -0
- package/build/query-title/variations.js.map +1 -1
- package/build/query-total/edit.js +90 -0
- package/build/query-total/edit.js.map +1 -0
- package/build/query-total/icons.js +46 -0
- package/build/query-total/icons.js.map +1 -0
- package/build/query-total/index.js +81 -0
- package/build/query-total/index.js.map +1 -0
- package/build/query-total/init.js +12 -0
- package/build/query-total/init.js.map +1 -0
- package/build/quote/deprecated.js +1 -0
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/transforms.js +1 -0
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/index.js +7 -1
- package/build/read-more/index.js.map +1 -1
- package/build/site-logo/index.js +4 -2
- package/build/site-logo/index.js.map +1 -1
- package/build/site-title/edit.js +41 -12
- package/build/site-title/edit.js.map +1 -1
- package/build/site-title/index.js +4 -2
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/edit.js +19 -3
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/social-list.js +1 -0
- package/build/social-link/social-list.js.map +1 -1
- package/build/social-link/variations.js +1 -0
- package/build/social-link/variations.js.map +1 -1
- package/build/social-links/edit.js +42 -12
- package/build/social-links/edit.js.map +1 -1
- package/build/social-links/edit.native.js +1 -0
- package/build/social-links/edit.native.js.map +1 -1
- package/build/spacer/controls.js +35 -12
- package/build/spacer/controls.js.map +1 -1
- package/build/table/deprecated.js +1 -0
- package/build/table/deprecated.js.map +1 -1
- package/build/table/edit.js +49 -15
- package/build/table/edit.js.map +1 -1
- package/build/table/index.js +4 -1
- package/build/table/index.js.map +1 -1
- package/build/table/save.js +1 -0
- package/build/table/save.js.map +1 -1
- package/build/table/state.js +1 -0
- package/build/table/state.js.map +1 -1
- package/build/table/transforms.js +1 -0
- package/build/table/transforms.js.map +1 -1
- package/build/table-of-contents/edit.js +1 -1
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +24 -23
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +1 -0
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/utils.js +1 -0
- package/build/table-of-contents/utils.js.map +1 -1
- package/build/tag-cloud/edit.js +57 -11
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +1 -0
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/import-controls.js +1 -0
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +1 -0
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +1 -0
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/template-part/edit/utils/transformers.js +1 -0
- package/build/template-part/edit/utils/transformers.js.map +1 -1
- package/build/template-part/variations.js +1 -0
- package/build/template-part/variations.js.map +1 -1
- package/build/text-columns/edit.js +1 -0
- package/build/text-columns/edit.js.map +1 -1
- package/build/text-columns/save.js +1 -0
- package/build/text-columns/save.js.map +1 -1
- package/build/text-columns/transforms.js +1 -0
- package/build/text-columns/transforms.js.map +1 -1
- package/build/utils/get-transformed-metadata.js +1 -0
- package/build/utils/get-transformed-metadata.js.map +1 -1
- package/build/utils/search-patterns.js +1 -0
- package/build/utils/search-patterns.js.map +1 -1
- package/build/utils/transformation-categories.native.js +1 -0
- package/build/utils/transformation-categories.native.js.map +1 -1
- package/build/video/edit-common-settings.js +90 -30
- package/build/video/edit-common-settings.js.map +1 -1
- package/build/video/edit.js +20 -49
- package/build/video/edit.js.map +1 -1
- package/build/video/poster-image.js +81 -0
- package/build/video/poster-image.js.map +1 -0
- package/build/video/tracks-editor.js +2 -1
- package/build/video/tracks-editor.js.map +1 -1
- package/build/video/tracks.js +1 -0
- package/build/video/tracks.js.map +1 -1
- package/build-module/archives/edit.js +84 -37
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/avatar/user-control.js +1 -0
- package/build-module/avatar/user-control.js.map +1 -1
- package/build-module/block/deprecated.js +1 -0
- package/build-module/block/deprecated.js.map +1 -1
- package/build-module/block/edit.js +1 -0
- package/build-module/block/edit.js.map +1 -1
- package/build-module/button/deprecated.js +184 -2
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +50 -28
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +8 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +9 -6
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/transforms.js +1 -0
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/categories/edit.js +1 -0
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/column/column-preview.native.js +1 -0
- package/build-module/column/column-preview.native.js.map +1 -1
- package/build-module/column/edit.js +34 -14
- package/build-module/column/edit.js.map +1 -1
- package/build-module/columns/columnCalculations.native.js +1 -0
- package/build-module/columns/columnCalculations.native.js.map +1 -1
- package/build-module/columns/deprecated.js +1 -0
- package/build-module/columns/deprecated.js.map +1 -1
- package/build-module/columns/edit.js +53 -29
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +1 -0
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/columns/transforms.js +1 -0
- package/build-module/columns/transforms.js.map +1 -1
- package/build-module/columns/utils.js +1 -0
- package/build-module/columns/utils.js.map +1 -1
- package/build-module/comment-template/edit.js +1 -0
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +1 -0
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comment-template/util.js +1 -0
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/comments/index.js +1 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/edit/index.js +9 -3
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit.native.js +2 -2
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/details/edit.js +30 -8
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/transforms.js +1 -0
- package/build-module/details/transforms.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +1 -0
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/embed/util.js +1 -0
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +1 -0
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/embed/wp-embed-preview.js +1 -0
- package/build-module/embed/wp-embed-preview.js.map +1 -1
- package/build-module/file/transforms.js +1 -0
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/footnotes/edit.js +1 -0
- package/build-module/footnotes/edit.js.map +1 -1
- package/build-module/form/index.js +1 -2
- package/build-module/form/index.js.map +1 -1
- package/build-module/form/view.js +10 -5
- package/build-module/form/view.js.map +1 -1
- package/build-module/freeform/modal.js +1 -0
- package/build-module/freeform/modal.js.map +1 -1
- package/build-module/gallery/deprecated.js +1 -0
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +1 -0
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/shared.js +1 -0
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +1 -0
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +1 -0
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +1 -0
- package/build-module/gallery/use-get-media.native.js.map +1 -1
- package/build-module/gallery/use-get-new-images.js +1 -0
- package/build-module/gallery/use-get-new-images.js.map +1 -1
- package/build-module/gallery/use-image-sizes.js +1 -0
- package/build-module/gallery/use-image-sizes.js.map +1 -1
- package/build-module/group/placeholder.js +1 -0
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/group/transforms.js +1 -0
- package/build-module/group/transforms.js.map +1 -1
- package/build-module/heading/transforms.js +1 -0
- package/build-module/heading/transforms.js.map +1 -1
- package/build-module/html/preview.js +1 -0
- package/build-module/html/preview.js.map +1 -1
- package/build-module/image/edit.js +1 -0
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -0
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +2 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/transforms.js +2 -0
- package/build-module/image/transforms.js.map +1 -1
- package/build-module/image/utils.js +1 -0
- package/build-module/image/utils.js.map +1 -1
- package/build-module/image/view.js +1 -3
- package/build-module/image/view.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +12 -0
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/index.js +12 -0
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/list/transforms.js +1 -0
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/utils.js +1 -0
- package/build-module/list/utils.js.map +1 -1
- package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
- package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
- package/build-module/list-item/transforms.js +1 -0
- package/build-module/list-item/transforms.js.map +1 -1
- package/build-module/loginout/edit.js +42 -14
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +60 -31
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/more/edit.js +28 -8
- package/build-module/more/edit.js.map +1 -1
- package/build-module/more/save.js +1 -0
- package/build-module/more/save.js.map +1 -1
- package/build-module/navigation/deprecated.js +1 -0
- package/build-module/navigation/deprecated.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -0
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +5 -3
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/use-generate-default-navigation-title.js +1 -0
- package/build-module/navigation/edit/use-generate-default-navigation-title.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +1 -0
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +1 -0
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation/view.js +1 -0
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +97 -58
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/hooks.js +1 -0
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +1 -1
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +106 -55
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +46 -26
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/page-list/use-convert-to-navigation-links.js +1 -0
- package/build-module/page-list/use-convert-to-navigation-links.js.map +1 -1
- package/build-module/paragraph/edit.js +23 -8
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/pattern/edit.js +1 -0
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js +17 -4
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +4 -2
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-name/edit.js +12 -6
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-author-name/index.js +4 -2
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +6 -1
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +8 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-date/edit.js +59 -19
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +2 -1
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +44 -20
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +19 -20
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-featured-image/edit.js +47 -13
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +6 -3
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/edit.js +1 -0
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +12 -7
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +3 -2
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-template/edit.js +1 -0
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +12 -2
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-terms/edit.js +1 -0
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/hooks.js +1 -0
- package/build-module/post-terms/hooks.js.map +1 -1
- package/build-module/post-title/index.js +6 -3
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/pullquote/blockquote.native.js +1 -0
- package/build-module/pullquote/blockquote.native.js.map +1 -1
- package/build-module/pullquote/transforms.js +1 -0
- package/build-module/pullquote/transforms.js.map +1 -1
- package/build-module/query/deprecated.js +1 -0
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +1 -0
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/format-controls.js +1 -0
- package/build-module/query/edit/inspector-controls/format-controls.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -0
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +1 -0
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +1 -0
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/utils.js +1 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/index.js +11 -10
- package/build-module/query-no-results/index.js.map +1 -1
- package/build-module/query-pagination/edit.js +49 -19
- package/build-module/query-pagination/edit.js.map +1 -1
- package/build-module/query-pagination/query-pagination-label-control.js +1 -1
- package/build-module/query-pagination/query-pagination-label-control.js.map +1 -1
- package/build-module/query-pagination-numbers/edit.js +34 -16
- package/build-module/query-pagination-numbers/edit.js.map +1 -1
- package/build-module/query-title/variations.js +1 -0
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/query-total/edit.js +83 -0
- package/build-module/query-total/edit.js.map +1 -0
- package/build-module/query-total/icons.js +39 -0
- package/build-module/query-total/icons.js.map +1 -0
- package/build-module/query-total/index.js +74 -0
- package/build-module/query-total/index.js.map +1 -0
- package/build-module/query-total/init.js +6 -0
- package/build-module/query-total/init.js.map +1 -0
- package/build-module/quote/deprecated.js +1 -0
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/transforms.js +1 -0
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/index.js +7 -1
- package/build-module/read-more/index.js.map +1 -1
- package/build-module/site-logo/index.js +4 -2
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-title/edit.js +42 -13
- package/build-module/site-title/edit.js.map +1 -1
- package/build-module/site-title/index.js +4 -2
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/edit.js +20 -4
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/social-list.js +1 -0
- package/build-module/social-link/social-list.js.map +1 -1
- package/build-module/social-link/variations.js +1 -0
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/social-links/edit.js +43 -13
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/social-links/edit.native.js +1 -0
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/spacer/controls.js +36 -13
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/deprecated.js +1 -0
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/edit.js +50 -16
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table/index.js +4 -1
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/save.js +1 -0
- package/build-module/table/save.js.map +1 -1
- package/build-module/table/state.js +1 -0
- package/build-module/table/state.js.map +1 -1
- package/build-module/table/transforms.js +1 -0
- package/build-module/table/transforms.js.map +1 -1
- package/build-module/table-of-contents/edit.js +1 -1
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +26 -25
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +1 -0
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/utils.js +1 -0
- package/build-module/table-of-contents/utils.js.map +1 -1
- package/build-module/tag-cloud/edit.js +58 -12
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -0
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +1 -0
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +1 -0
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +1 -0
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/template-part/edit/utils/transformers.js +1 -0
- package/build-module/template-part/edit/utils/transformers.js.map +1 -1
- package/build-module/template-part/variations.js +1 -0
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/text-columns/edit.js +1 -0
- package/build-module/text-columns/edit.js.map +1 -1
- package/build-module/text-columns/save.js +1 -0
- package/build-module/text-columns/save.js.map +1 -1
- package/build-module/text-columns/transforms.js +1 -0
- package/build-module/text-columns/transforms.js.map +1 -1
- package/build-module/utils/get-transformed-metadata.js +1 -0
- package/build-module/utils/get-transformed-metadata.js.map +1 -1
- package/build-module/utils/search-patterns.js +1 -0
- package/build-module/utils/search-patterns.js.map +1 -1
- package/build-module/utils/transformation-categories.native.js +1 -0
- package/build-module/utils/transformation-categories.native.js.map +1 -1
- package/build-module/video/edit-common-settings.js +91 -31
- package/build-module/video/edit-common-settings.js.map +1 -1
- package/build-module/video/edit.js +24 -53
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/poster-image.js +74 -0
- package/build-module/video/poster-image.js.map +1 -0
- package/build-module/video/tracks-editor.js +2 -1
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-module/video/tracks.js +1 -0
- package/build-module/video/tracks.js.map +1 -1
- package/build-style/button/style-rtl.css +3 -3
- package/build-style/button/style.css +3 -3
- package/build-style/comment-template/style-rtl.css +0 -1
- package/build-style/comment-template/style.css +0 -1
- package/build-style/comments/editor-rtl.css +1 -1
- package/build-style/comments/editor.css +1 -1
- package/build-style/comments/style-rtl.css +1 -1
- package/build-style/comments/style.css +1 -1
- package/build-style/common-rtl.css +17 -17
- package/build-style/common.css +17 -17
- package/build-style/editor-rtl.css +45 -60
- package/build-style/editor.css +45 -60
- package/build-style/form-input/style-rtl.css +0 -2
- package/build-style/form-input/style.css +0 -2
- package/build-style/freeform/editor-rtl.css +4 -8
- package/build-style/freeform/editor.css +4 -8
- package/build-style/gallery/style-rtl.css +2 -2
- package/build-style/gallery/style.css +2 -2
- package/build-style/heading/style-rtl.css +11 -11
- package/build-style/heading/style.css +11 -11
- package/build-style/image/style-rtl.css +1 -1
- package/build-style/image/style.css +1 -1
- package/build-style/latest-comments/style-rtl.css +4 -4
- package/build-style/latest-comments/style.css +4 -4
- package/build-style/latest-posts/style-rtl.css +2 -1
- package/build-style/latest-posts/style.css +2 -1
- package/build-style/more/editor-rtl.css +1 -1
- package/build-style/more/editor.css +1 -1
- package/build-style/nextpage/editor-rtl.css +1 -1
- package/build-style/nextpage/editor.css +1 -1
- package/build-style/post-comments-form/style-rtl.css +2 -2
- package/build-style/post-comments-form/style.css +2 -2
- package/build-style/{post-template/editor.css → post-comments-link/style-rtl.css} +2 -4
- package/build-style/{post-template/editor-rtl.css → post-comments-link/style.css} +2 -4
- package/build-style/post-featured-image/editor-rtl.css +27 -27
- package/build-style/post-featured-image/editor.css +27 -27
- package/build-style/post-template/style-rtl.css +1 -0
- package/build-style/post-template/style.css +1 -0
- package/build-style/query-total/style-rtl.css +103 -0
- package/build-style/query-total/style.css +103 -0
- package/build-style/read-more/style-rtl.css +2 -3
- package/build-style/read-more/style.css +2 -3
- package/build-style/social-link/editor-rtl.css +2 -2
- package/build-style/social-link/editor.css +2 -2
- package/build-style/social-links/editor-rtl.css +2 -2
- package/build-style/social-links/editor.css +2 -2
- package/build-style/social-links/style-rtl.css +2 -2
- package/build-style/social-links/style.css +2 -2
- package/build-style/style-rtl.css +59 -53
- package/build-style/style.css +59 -53
- package/build-style/tag-cloud/editor-rtl.css +0 -5
- package/build-style/tag-cloud/editor.css +0 -5
- package/build-style/text-columns/style-rtl.css +3 -3
- package/build-style/text-columns/style.css +3 -3
- package/package.json +36 -35
- package/src/archives/edit.js +94 -36
- package/src/audio/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/block/index.php +20 -0
- package/src/button/block.json +17 -2
- package/src/button/deprecated.js +189 -0
- package/src/button/edit.js +61 -32
- package/src/button/save.js +6 -1
- package/src/column/edit.js +34 -13
- package/src/columns/edit.js +71 -40
- package/src/comments/index.js +1 -0
- package/src/cover/edit/index.js +12 -5
- package/src/cover/edit.native.js +5 -2
- package/src/cover/test/edit.js +5 -7
- package/src/details/edit.js +40 -11
- package/src/editor.scss +0 -1
- package/src/file/test/__snapshots__/edit.native.js.snap +1 -1
- package/src/form/block.json +1 -2
- package/src/form/index.php +1 -20
- package/src/form/view.js +18 -5
- package/src/image/image.js +1 -1
- package/src/image/index.php +1 -1
- package/src/image/transforms.js +1 -0
- package/src/image/view.js +1 -3
- package/src/index.js +2 -0
- package/src/latest-posts/block.json +12 -0
- package/src/latest-posts/style.scss +2 -1
- package/src/loginout/edit.js +56 -20
- package/src/media-text/edit.js +57 -28
- package/src/more/edit.js +39 -12
- package/src/navigation/edit/navigation-menu-selector.js +9 -2
- package/src/navigation/index.php +2 -2
- package/src/navigation-link/edit.js +101 -67
- package/src/navigation-link/index.php +16 -1
- package/src/navigation-link/link-ui.js +1 -1
- package/src/navigation-submenu/edit.js +113 -63
- package/src/page-list/edit.js +52 -31
- package/src/paragraph/edit.js +29 -5
- package/src/post-author/block.json +4 -2
- package/src/post-author/edit.js +17 -3
- package/src/post-author/index.php +4 -0
- package/src/post-author-name/block.json +4 -2
- package/src/post-author-name/edit.js +17 -4
- package/src/post-author-name/index.php +4 -0
- package/src/post-comments-form/block.json +6 -1
- package/src/post-comments-link/block.json +8 -1
- package/src/post-comments-link/style.scss +4 -0
- package/src/post-content/index.php +23 -0
- package/src/post-date/block.json +2 -1
- package/src/post-date/edit.js +79 -25
- package/src/post-excerpt/edit.js +59 -22
- package/src/post-featured-image/block.json +6 -3
- package/src/post-featured-image/dimension-controls.js +18 -21
- package/src/post-featured-image/edit.js +67 -10
- package/src/post-navigation-link/block.json +0 -6
- package/src/post-navigation-link/index.js +11 -0
- package/src/post-navigation-link/variations.js +2 -2
- package/src/post-template/block.json +12 -2
- package/src/post-template/style.scss +2 -0
- package/src/post-title/block.json +6 -3
- package/src/query-no-results/block.json +1 -11
- package/src/query-no-results/index.js +11 -0
- package/src/query-pagination/edit.js +57 -15
- package/src/query-pagination/query-pagination-label-control.js +1 -3
- package/src/query-pagination-numbers/edit.js +41 -19
- package/src/query-pagination-previous/index.php +21 -14
- package/src/query-total/block.json +52 -0
- package/src/query-total/edit.js +81 -0
- package/src/query-total/icons.js +43 -0
- package/src/query-total/index.js +18 -0
- package/src/query-total/index.php +88 -0
- package/src/query-total/init.js +6 -0
- package/src/query-total/style.scss +4 -0
- package/src/read-more/index.js +6 -0
- package/src/site-logo/block.json +4 -2
- package/src/site-title/block.json +4 -2
- package/src/site-title/edit.js +52 -15
- package/src/social-link/edit.js +21 -6
- package/src/social-links/edit.js +52 -15
- package/src/spacer/controls.js +42 -15
- package/src/style.scss +2 -0
- package/src/table/block.json +4 -1
- package/src/table/edit.js +58 -20
- package/src/table-of-contents/block.json +0 -52
- package/src/table-of-contents/edit.js +1 -1
- package/src/table-of-contents/index.js +53 -0
- package/src/tag-cloud/edit.js +60 -8
- package/src/tag-cloud/editor.scss +0 -8
- package/src/video/edit-common-settings.js +97 -39
- package/src/video/edit.js +29 -75
- package/src/video/poster-image.js +86 -0
- package/src/video/tracks-editor.js +1 -1
- package/tsconfig.json +0 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/src/post-template/editor.scss +0 -7
package/build/table/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["INHERITED_COLUMN_ATTRIBUTES","createTable","rowCount","columnCount","body","Array","from","length","map","cells","content","tag","getFirstRow","state","isEmptyTableSection","head","foot","getCellAttribute","cellLocation","attributeName","sectionName","rowIndex","columnIndex","updateSelectedCell","selection","updateCell","tableSections","Object","fromEntries","entries","filter","key","includes","selectionSectionName","selectionRowIndex","section","row","cellAttributes","isCellSelected","type","insertRow","firstRow","cellCount","undefined","slice","_","index","_firstRow$cells$index","firstCellInColumn","inheritedAttributes","deleteRow","insertColumn","isEmptyRow","deleteColumn","cell","toggleSection","_state$body$0$cells$l","every"],"sources":["@wordpress/block-library/src/table/state.js"],"sourcesContent":["const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];\n\n/**\n * Creates a table state.\n *\n * @param {Object} options\n * @param {number} options.rowCount Row count for the table to create.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function createTable( { rowCount, columnCount } ) {\n\treturn {\n\t\tbody: Array.from( { length: rowCount } ).map( () => ( {\n\t\t\tcells: Array.from( { length: columnCount } ).map( () => ( {\n\t\t\t\tcontent: '',\n\t\t\t\ttag: 'td',\n\t\t\t} ) ),\n\t\t} ) ),\n\t};\n}\n\n/**\n * Returns the first row in the table.\n *\n * @param {Object} state Current table state.\n *\n * @return {Object | undefined} The first table row.\n */\nexport function getFirstRow( state ) {\n\tif ( ! isEmptyTableSection( state.head ) ) {\n\t\treturn state.head[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.body ) ) {\n\t\treturn state.body[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.foot ) ) {\n\t\treturn state.foot[ 0 ];\n\t}\n}\n\n/**\n * Gets an attribute for a cell.\n *\n * @param {Object} state Current table state.\n * @param {Object} cellLocation The location of the cell\n * @param {string} attributeName The name of the attribute to get the value of.\n *\n * @return {*} The attribute value.\n */\nexport function getCellAttribute( state, cellLocation, attributeName ) {\n\tconst { sectionName, rowIndex, columnIndex } = cellLocation;\n\treturn state[ sectionName ]?.[ rowIndex ]?.cells?.[ columnIndex ]?.[\n\t\tattributeName\n\t];\n}\n\n/**\n * Returns updated cell attributes after applying the `updateCell` function to the selection.\n *\n * @param {Object} state The block attributes.\n * @param {Object} selection The selection of cells to update.\n * @param {Function} updateCell A function to update the selected cell attributes.\n *\n * @return {Object} New table state including the updated cells.\n */\nexport function updateSelectedCell( state, selection, updateCell ) {\n\tif ( ! selection ) {\n\t\treturn state;\n\t}\n\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\tconst { sectionName: selectionSectionName, rowIndex: selectionRowIndex } =\n\t\tselection;\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\tif (\n\t\t\t\tselectionSectionName &&\n\t\t\t\tselectionSectionName !== sectionName\n\t\t\t) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row, rowIndex ) => {\n\t\t\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: row.cells.map(\n\t\t\t\t\t\t\t( cellAttributes, columnIndex ) => {\n\t\t\t\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! isCellSelected( cellLocation, selection )\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn updateCell( cellAttributes );\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} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Returns whether the cell at `cellLocation` is included in the selection `selection`.\n *\n * @param {Object} cellLocation An object containing cell location properties.\n * @param {Object} selection An object containing selection properties.\n *\n * @return {boolean} True if the cell is selected, false otherwise.\n */\nexport function isCellSelected( cellLocation, selection ) {\n\tif ( ! cellLocation || ! selection ) {\n\t\treturn false;\n\t}\n\n\tswitch ( selection.type ) {\n\t\tcase 'column':\n\t\t\treturn (\n\t\t\t\tselection.type === 'column' &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex\n\t\t\t);\n\t\tcase 'cell':\n\t\t\treturn (\n\t\t\t\tselection.type === 'cell' &&\n\t\t\t\tcellLocation.sectionName === selection.sectionName &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex &&\n\t\t\t\tcellLocation.rowIndex === selection.rowIndex\n\t\t\t);\n\t}\n}\n\n/**\n * Inserts a row in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to insert the row.\n * @param {number} options.rowIndex Row index at which to insert the row.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function insertRow( state, { sectionName, rowIndex, columnCount } ) {\n\tconst firstRow = getFirstRow( state );\n\tconst cellCount =\n\t\tcolumnCount === undefined ? firstRow?.cells?.length : columnCount;\n\n\t// Bail early if the function cannot determine how many cells to add.\n\tif ( ! cellCount ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t[ sectionName ]: [\n\t\t\t...state[ sectionName ].slice( 0, rowIndex ),\n\t\t\t{\n\t\t\t\tcells: Array.from( { length: cellCount } ).map(\n\t\t\t\t\t( _, index ) => {\n\t\t\t\t\t\tconst firstCellInColumn =\n\t\t\t\t\t\t\tfirstRow?.cells?.[ index ] ?? {};\n\n\t\t\t\t\t\tconst inheritedAttributes = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( firstCellInColumn ).filter(\n\t\t\t\t\t\t\t\t( [ key ] ) =>\n\t\t\t\t\t\t\t\t\tINHERITED_COLUMN_ATTRIBUTES.includes( key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...inheritedAttributes,\n\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t\t...state[ sectionName ].slice( rowIndex ),\n\t\t],\n\t};\n}\n\n/**\n * Deletes a row from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to delete the row.\n * @param {number} options.rowIndex Row index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteRow( state, { sectionName, rowIndex } ) {\n\treturn {\n\t\t[ sectionName ]: state[ sectionName ].filter(\n\t\t\t( row, index ) => index !== rowIndex\n\t\t),\n\t};\n}\n\n/**\n * Inserts a column in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index at which to insert the column.\n *\n * @return {Object} New table state.\n */\nexport function insertColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row ) => {\n\t\t\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t\t\t// the last possible index of the array.\n\t\t\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: [\n\t\t\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...row.cells.slice( columnIndex ),\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Deletes a column from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection\n\t\t\t\t\t.map( ( row ) => ( {\n\t\t\t\t\t\tcells:\n\t\t\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: row.cells,\n\t\t\t\t\t} ) )\n\t\t\t\t\t.filter( ( row ) => row.cells.length ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Toggles the existence of a section.\n *\n * @param {Object} state Current table state.\n * @param {string} sectionName Name of the section to toggle.\n *\n * @return {Object} New table state.\n */\nexport function toggleSection( state, sectionName ) {\n\t// Section exists, replace it with an empty row to remove it.\n\tif ( ! isEmptyTableSection( state[ sectionName ] ) ) {\n\t\treturn { [ sectionName ]: [] };\n\t}\n\n\t// Get the length of the first row of the body to use when creating the header.\n\tconst columnCount = state.body?.[ 0 ]?.cells?.length ?? 1;\n\n\t// Section doesn't exist, insert an empty row to create the section.\n\treturn insertRow( state, { sectionName, rowIndex: 0, columnCount } );\n}\n\n/**\n * Determines whether a table section is empty.\n *\n * @param {Object} section Table section state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyTableSection( section ) {\n\treturn ! section || ! section.length || section.every( isEmptyRow );\n}\n\n/**\n * Determines whether a table row is empty.\n *\n * @param {Object} row Table row state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyRow( row ) {\n\treturn ! ( row.cells && row.cells.length );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,MAAMA,2BAA2B,GAAG,CAAE,OAAO,CAAE;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACxD,OAAO;IACNC,IAAI,EAAEC,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEL;IAAS,CAAE,CAAC,CAACM,GAAG,CAAE,OAAQ;MACrDC,KAAK,EAAEJ,KAAK,CAACC,IAAI,CAAE;QAAEC,MAAM,EAAEJ;MAAY,CAAE,CAAC,CAACK,GAAG,CAAE,OAAQ;QACzDE,OAAO,EAAE,EAAE;QACXC,GAAG,EAAE;MACN,CAAC,CAAG;IACL,CAAC,CAAG;EACL,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SA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A;AACO,SAASgD,aAAaA,CAAE1C,KAAK,EAAEO,WAAW,EAAG;EAAA,IAAAoC,qBAAA;EACnD;EACA,IAAK,CAAE1C,mBAAmB,CAAED,KAAK,CAAEO,WAAW,CAAG,CAAC,EAAG;IACpD,OAAO;MAAE,CAAEA,WAAW,GAAI;IAAG,CAAC;EAC/B;;EAEA;EACA,MAAMjB,WAAW,IAAAqD,qBAAA,GAAG3C,KAAK,CAACT,IAAI,GAAI,CAAC,CAAE,EAAEK,KAAK,EAAEF,MAAM,cAAAiD,qBAAA,cAAAA,qBAAA,GAAI,CAAC;;EAEzD;EACA,OAAOhB,SAAS,CAAE3B,KAAK,EAAE;IAAEO,WAAW;IAAEC,QAAQ,EAAE,CAAC;IAAElB;EAAY,CAAE,CAAC;AACrE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,mBAAmBA,CAAEqB,OAAO,EAAG;EAC9C,OAAO,CAAEA,OAAO,IAAI,CAAEA,OAAO,CAAC5B,MAAM,IAAI4B,OAAO,CAACsB,KAAK,CAAEL,UAAW,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,CAAEhB,GAAG,EAAG;EACjC,OAAO,EAAIA,GAAG,CAAC3B,KAAK,IAAI2B,GAAG,CAAC3B,KAAK,CAACF,MAAM,CAAE;AAC3C","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["INHERITED_COLUMN_ATTRIBUTES","createTable","rowCount","columnCount","body","Array","from","length","map","cells","content","tag","getFirstRow","state","isEmptyTableSection","head","foot","getCellAttribute","cellLocation","attributeName","sectionName","rowIndex","columnIndex","updateSelectedCell","selection","updateCell","tableSections","Object","fromEntries","entries","filter","key","includes","selectionSectionName","selectionRowIndex","section","row","cellAttributes","isCellSelected","type","insertRow","firstRow","cellCount","undefined","slice","_","index","_firstRow$cells$index","firstCellInColumn","inheritedAttributes","deleteRow","insertColumn","isEmptyRow","deleteColumn","cell","toggleSection","_state$body$0$cells$l","every"],"sources":["@wordpress/block-library/src/table/state.js"],"sourcesContent":["const INHERITED_COLUMN_ATTRIBUTES = [ 'align' ];\n\n/**\n * Creates a table state.\n *\n * @param {Object} options\n * @param {number} options.rowCount Row count for the table to create.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function createTable( { rowCount, columnCount } ) {\n\treturn {\n\t\tbody: Array.from( { length: rowCount } ).map( () => ( {\n\t\t\tcells: Array.from( { length: columnCount } ).map( () => ( {\n\t\t\t\tcontent: '',\n\t\t\t\ttag: 'td',\n\t\t\t} ) ),\n\t\t} ) ),\n\t};\n}\n\n/**\n * Returns the first row in the table.\n *\n * @param {Object} state Current table state.\n *\n * @return {Object | undefined} The first table row.\n */\nexport function getFirstRow( state ) {\n\tif ( ! isEmptyTableSection( state.head ) ) {\n\t\treturn state.head[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.body ) ) {\n\t\treturn state.body[ 0 ];\n\t}\n\tif ( ! isEmptyTableSection( state.foot ) ) {\n\t\treturn state.foot[ 0 ];\n\t}\n}\n\n/**\n * Gets an attribute for a cell.\n *\n * @param {Object} state Current table state.\n * @param {Object} cellLocation The location of the cell\n * @param {string} attributeName The name of the attribute to get the value of.\n *\n * @return {*} The attribute value.\n */\nexport function getCellAttribute( state, cellLocation, attributeName ) {\n\tconst { sectionName, rowIndex, columnIndex } = cellLocation;\n\treturn state[ sectionName ]?.[ rowIndex ]?.cells?.[ columnIndex ]?.[\n\t\tattributeName\n\t];\n}\n\n/**\n * Returns updated cell attributes after applying the `updateCell` function to the selection.\n *\n * @param {Object} state The block attributes.\n * @param {Object} selection The selection of cells to update.\n * @param {Function} updateCell A function to update the selected cell attributes.\n *\n * @return {Object} New table state including the updated cells.\n */\nexport function updateSelectedCell( state, selection, updateCell ) {\n\tif ( ! selection ) {\n\t\treturn state;\n\t}\n\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\tconst { sectionName: selectionSectionName, rowIndex: selectionRowIndex } =\n\t\tselection;\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\tif (\n\t\t\t\tselectionSectionName &&\n\t\t\t\tselectionSectionName !== sectionName\n\t\t\t) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row, rowIndex ) => {\n\t\t\t\t\tif ( selectionRowIndex && selectionRowIndex !== rowIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: row.cells.map(\n\t\t\t\t\t\t\t( cellAttributes, columnIndex ) => {\n\t\t\t\t\t\t\t\tconst cellLocation = {\n\t\t\t\t\t\t\t\t\tsectionName,\n\t\t\t\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t! isCellSelected( cellLocation, selection )\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\treturn cellAttributes;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn updateCell( cellAttributes );\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} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Returns whether the cell at `cellLocation` is included in the selection `selection`.\n *\n * @param {Object} cellLocation An object containing cell location properties.\n * @param {Object} selection An object containing selection properties.\n *\n * @return {boolean} True if the cell is selected, false otherwise.\n */\nexport function isCellSelected( cellLocation, selection ) {\n\tif ( ! cellLocation || ! selection ) {\n\t\treturn false;\n\t}\n\n\tswitch ( selection.type ) {\n\t\tcase 'column':\n\t\t\treturn (\n\t\t\t\tselection.type === 'column' &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex\n\t\t\t);\n\t\tcase 'cell':\n\t\t\treturn (\n\t\t\t\tselection.type === 'cell' &&\n\t\t\t\tcellLocation.sectionName === selection.sectionName &&\n\t\t\t\tcellLocation.columnIndex === selection.columnIndex &&\n\t\t\t\tcellLocation.rowIndex === selection.rowIndex\n\t\t\t);\n\t}\n}\n\n/**\n * Inserts a row in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to insert the row.\n * @param {number} options.rowIndex Row index at which to insert the row.\n * @param {number} options.columnCount Column count for the table to create.\n *\n * @return {Object} New table state.\n */\nexport function insertRow( state, { sectionName, rowIndex, columnCount } ) {\n\tconst firstRow = getFirstRow( state );\n\tconst cellCount =\n\t\tcolumnCount === undefined ? firstRow?.cells?.length : columnCount;\n\n\t// Bail early if the function cannot determine how many cells to add.\n\tif ( ! cellCount ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t[ sectionName ]: [\n\t\t\t...state[ sectionName ].slice( 0, rowIndex ),\n\t\t\t{\n\t\t\t\tcells: Array.from( { length: cellCount } ).map(\n\t\t\t\t\t( _, index ) => {\n\t\t\t\t\t\tconst firstCellInColumn =\n\t\t\t\t\t\t\tfirstRow?.cells?.[ index ] ?? {};\n\n\t\t\t\t\t\tconst inheritedAttributes = Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( firstCellInColumn ).filter(\n\t\t\t\t\t\t\t\t( [ key ] ) =>\n\t\t\t\t\t\t\t\t\tINHERITED_COLUMN_ATTRIBUTES.includes( key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...inheritedAttributes,\n\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t},\n\t\t\t...state[ sectionName ].slice( rowIndex ),\n\t\t],\n\t};\n}\n\n/**\n * Deletes a row from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {string} options.sectionName Section in which to delete the row.\n * @param {number} options.rowIndex Row index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteRow( state, { sectionName, rowIndex } ) {\n\treturn {\n\t\t[ sectionName ]: state[ sectionName ].filter(\n\t\t\t( row, index ) => index !== rowIndex\n\t\t),\n\t};\n}\n\n/**\n * Inserts a column in the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index at which to insert the column.\n *\n * @return {Object} New table state.\n */\nexport function insertColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection.map( ( row ) => {\n\t\t\t\t\t// Bail early if the row is empty or it's an attempt to insert past\n\t\t\t\t\t// the last possible index of the array.\n\t\t\t\t\tif ( isEmptyRow( row ) || row.cells.length < columnIndex ) {\n\t\t\t\t\t\treturn row;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcells: [\n\t\t\t\t\t\t\t...row.cells.slice( 0, columnIndex ),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t\t\t\ttag: sectionName === 'head' ? 'th' : 'td',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...row.cells.slice( columnIndex ),\n\t\t\t\t\t\t],\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Deletes a column from the table state.\n *\n * @param {Object} state Current table state.\n * @param {Object} options\n * @param {number} options.columnIndex Column index to delete.\n *\n * @return {Object} New table state.\n */\nexport function deleteColumn( state, { columnIndex } ) {\n\tconst tableSections = Object.fromEntries(\n\t\tObject.entries( state ).filter( ( [ key ] ) =>\n\t\t\t[ 'head', 'body', 'foot' ].includes( key )\n\t\t)\n\t);\n\n\treturn Object.fromEntries(\n\t\tObject.entries( tableSections ).map( ( [ sectionName, section ] ) => {\n\t\t\t// Bail early if the table section is empty.\n\t\t\tif ( isEmptyTableSection( section ) ) {\n\t\t\t\treturn [ sectionName, section ];\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\tsectionName,\n\t\t\t\tsection\n\t\t\t\t\t.map( ( row ) => ( {\n\t\t\t\t\t\tcells:\n\t\t\t\t\t\t\trow.cells.length >= columnIndex\n\t\t\t\t\t\t\t\t? row.cells.filter(\n\t\t\t\t\t\t\t\t\t\t( cell, index ) => index !== columnIndex\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: row.cells,\n\t\t\t\t\t} ) )\n\t\t\t\t\t.filter( ( row ) => row.cells.length ),\n\t\t\t];\n\t\t} )\n\t);\n}\n\n/**\n * Toggles the existence of a section.\n *\n * @param {Object} state Current table state.\n * @param {string} sectionName Name of the section to toggle.\n *\n * @return {Object} New table state.\n */\nexport function toggleSection( state, sectionName ) {\n\t// Section exists, replace it with an empty row to remove it.\n\tif ( ! isEmptyTableSection( state[ sectionName ] ) ) {\n\t\treturn { [ sectionName ]: [] };\n\t}\n\n\t// Get the length of the first row of the body to use when creating the header.\n\tconst columnCount = state.body?.[ 0 ]?.cells?.length ?? 1;\n\n\t// Section doesn't exist, insert an empty row to create the section.\n\treturn insertRow( state, { sectionName, rowIndex: 0, columnCount } );\n}\n\n/**\n * Determines whether a table section is empty.\n *\n * @param {Object} section Table section state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyTableSection( section ) {\n\treturn ! section || ! section.length || section.every( isEmptyRow );\n}\n\n/**\n * Determines whether a table row is empty.\n *\n * @param {Object} row Table row state.\n *\n * @return {boolean} True if the table section is empty, false otherwise.\n */\nexport function isEmptyRow( row ) {\n\treturn ! ( row.cells && row.cells.length );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,MAAMA,2BAA2B,GAAG,CAAE,OAAO,CAAE;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACxD,OAAO;IACNC,IAAI,EAAEC,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEL;IAAS,CAAE,CAAC,CAACM,GAAG,CAAE,OAAQ;MACrDC,KAAK,EAAEJ,KAAK,CAACC,IAAI,CAAE;QAAEC,MAAM,EAAEJ;MAAY,CAAE,CAAC,CAACK,GAAG,CAAE,OAAQ;QACzDE,OAAO,EAAE,EAAE;QACXC,GAAG,EAAE;MACN,CAAC,CAAG;IACL,CAAC,CAAG;EACL,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,KAAK,EAAG;EACpC,IAAK,CAAEC,mBAAmB,CAAED,KAAK,CAACE,IAAK,CAAC,EAAG;IAC1C,OAAOF,KAAK,CAACE,IAAI,CAAE,CAAC,CAAE;EACvB;EACA,IAAK,CAAED,mBAAmB,CAAED,KAAK,CAACT,IAAK,CAAC,EAAG;IAC1C,OAAOS,KAAK,CAACT,IAAI,CAAE,CAAC,CAAE;EACvB;EACA,IAAK,CAAEU,mBAAmB,CAAED,KAAK,CAACG,IAAK,CAAC,EAAG;IAC1C,OAAOH,KAAK,CAACG,IAAI,CAAE,CAAC,CAAE;EACvB;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAAEJ,KAAK,EAAEK,YAAY,EAAEC,aAAa,EAAG;EACtE,MAA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;AACA;AACO,SAASW,mBAAmBA,CAAEqB,OAAO,EAAG;EAC9C,OAAO,CAAEA,OAAO,IAAI,CAAEA,OAAO,CAAC5B,MAAM,IAAI4B,OAAO,CAACsB,KAAK,CAAEL,UAAW,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAUA,CAAEhB,GAAG,EAAG;EACjC,OAAO,EAAIA,GAAG,CAAC3B,KAAK,IAAI2B,GAAG,CAAC3B,KAAK,CAACF,MAAM,CAAE;AAC3C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_utils","tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","normalizeRowColSpan","getAttribute","colspan","push","tag","content","innerHTML","cells","createBlock","_default","exports","default"],"sources":["@wordpress/block-library/src/table/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { normalizeRowColSpan } from './utils';\n\nconst tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst attributes = Array.from( node.children ).reduce(\n\t\t\t\t\t( sectionAcc, section ) => {\n\t\t\t\t\t\tif ( ! section.children.length ) {\n\t\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sectionName = section.nodeName\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.slice( 1 );\n\n\t\t\t\t\t\tconst sectionAttributes = Array.from(\n\t\t\t\t\t\t\tsection.children\n\t\t\t\t\t\t).reduce( ( rowAcc, row ) => {\n\t\t\t\t\t\t\tif ( ! row.children.length ) {\n\t\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rowAttributes = Array.from(\n\t\t\t\t\t\t\t\trow.children\n\t\t\t\t\t\t\t).reduce( ( colAcc, col ) => {\n\t\t\t\t\t\t\t\tconst rowspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'rowspan' )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst colspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'colspan' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tcolAcc.push( {\n\t\t\t\t\t\t\t\t\ttag: col.nodeName.toLowerCase(),\n\t\t\t\t\t\t\t\t\tcontent: col.innerHTML,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn colAcc;\n\t\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\t\trowAcc.push( {\n\t\t\t\t\t\t\t\tcells: rowAttributes,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\tsectionAcc[ sectionName ] = sectionAttributes;\n\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/table', attributes );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_blocks","require","_utils","tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","normalizeRowColSpan","getAttribute","colspan","push","tag","content","innerHTML","cells","createBlock","_default","exports","default"],"sources":["@wordpress/block-library/src/table/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { normalizeRowColSpan } from './utils';\n\nconst tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst attributes = Array.from( node.children ).reduce(\n\t\t\t\t\t( sectionAcc, section ) => {\n\t\t\t\t\t\tif ( ! section.children.length ) {\n\t\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sectionName = section.nodeName\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.slice( 1 );\n\n\t\t\t\t\t\tconst sectionAttributes = Array.from(\n\t\t\t\t\t\t\tsection.children\n\t\t\t\t\t\t).reduce( ( rowAcc, row ) => {\n\t\t\t\t\t\t\tif ( ! row.children.length ) {\n\t\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rowAttributes = Array.from(\n\t\t\t\t\t\t\t\trow.children\n\t\t\t\t\t\t\t).reduce( ( colAcc, col ) => {\n\t\t\t\t\t\t\t\tconst rowspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'rowspan' )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst colspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'colspan' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tcolAcc.push( {\n\t\t\t\t\t\t\t\t\ttag: col.nodeName.toLowerCase(),\n\t\t\t\t\t\t\t\t\tcontent: col.innerHTML,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn colAcc;\n\t\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\t\trowAcc.push( {\n\t\t\t\t\t\t\t\tcells: rowAttributes,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\tsectionAcc[ sectionName ] = sectionAttributes;\n\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/table', attributes );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAME,uBAAuB,GAAGA,CAAE;EAAEC;AAAsB,CAAC,MAAQ;EAClEC,EAAE,EAAE;IACHC,UAAU,EAAE,IAAI;IAChBC,QAAQ,EAAE;MACTC,EAAE,EAAE;QACHF,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAEH,qBAAqB;QAC/BK,UAAU,EAAE,CAAE,OAAO,EAAE,SAAS,EAAE,SAAS;MAC5C,CAAC;MACDC,EAAE,EAAE;QACHJ,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAEH,qBAAqB;QAC/BK,UAAU,EAAE,CAAE,SAAS,EAAE,SAAS;MACnC;IACD;EACD;AACD,CAAC,CAAE;AAEH,MAAME,gBAAgB,GAAKC,IAAI,KAAQ;EACtCC,KAAK,EAAE;IACNN,QAAQ,EAAE;MACTO,KAAK,EAAE;QACNR,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAEJ,uBAAuB,CAAES,IA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AAC;YAEDJ,MAAM,CAACM,IAAI,CAAE;cACZC,GAAG,EAAEN,GAAG,CAACR,QAAQ,CAACC,WAAW,CAAC,CAAC;cAC/Bc,OAAO,EAAEP,GAAG,CAACQ,SAAS;cACtBP,OAAO;cACPG;YACD,CAAE,CAAC;YAEH,OAAOL,MAAM;UACd,CAAC,EAAE,EAAG,CAAC;UAEPH,MAAM,CAACS,IAAI,CAAE;YACZI,KAAK,EAAEX;UACR,CAAE,CAAC;UAEH,OAAOF,MAAM;QACd,CAAC,EAAE,EAAG,CAAC;QAEPR,UAAU,CAAEG,WAAW,CAAE,GAAGI,iBAAiB;QAC7C,OAAOP,UAAU;MAClB,CAAC,EACD,CAAC,CACF,CAAC;MAED,OAAO,IAAAsB,mBAAW,EAAE,YAAY,EAAEvC,UAAW,CAAC;IAC/C;EACD,CAAC;AAEH,CAAC;AAAC,IAAAwC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalC,UAAU","ignoreList":[]}
|
|
@@ -97,7 +97,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
97
97
|
onChange: value => setAttributes({
|
|
98
98
|
onlyIncludeCurrentPage: value
|
|
99
99
|
}),
|
|
100
|
-
help: onlyIncludeCurrentPage ? (0, _i18n.__)('Only including headings from the current page (if the post is paginated).') : (0, _i18n.__)('
|
|
100
|
+
help: onlyIncludeCurrentPage ? (0, _i18n.__)('Only including headings from the current page (if the post is paginated).') : (0, _i18n.__)('Include headings from all pages (if the post is paginated).')
|
|
101
101
|
})
|
|
102
102
|
})
|
|
103
103
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","value","help","length","jsxs","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","label","checked","onChange","value","help","length","jsxs","Fragment","Placeholder","icon","BlockIcon","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Include headings from all pages (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAA6C,IAAAa,WAAA,GAAAb,OAAA;AA9B7C;AACA;AACA;;AAuBA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASc,mBAAmBA,CA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ACnB,IAAAlC,WAAA,CAAAgC,GAAA,EAAC3C,WAAA,CAAAqE,WAAW;UACXC,IAAI,eAAG,IAAA3D,WAAA,CAAAgC,GAAA,EAAC9C,YAAA,CAAA0E,SAAS;YAACD,IAAI,EAAGA;UAAM,CAAE,CAAG;UACpCT,KAAK,EAAG,IAAAhC,QAAE,EAAE,mBAAoB,CAAG;UACnC2C,YAAY,EAAG,IAAA3C,QAAE,EAChB,4GACD;QAAG,CACH;MAAC,CACE,CAAC,EACJ0B,iBAAiB;IAAA,CAClB,CAAC;EAEL;EAEA,oBACC,IAAA5C,WAAA,CAAAwD,IAAA,EAAAxD,WAAA,CAAAyD,QAAA;IAAAvB,QAAA,gBACC,IAAAlC,WAAA,CAAAgC,GAAA;MAAA,GAAUxB,UAAU;MAAA0B,QAAA,eACnB,IAAAlC,WAAA,CAAAgC,GAAA;QAAAE,QAAA,eACC,IAAAlC,WAAA,CAAAgC,GAAA,EAACpC,KAAA,CAAA8C,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjCiC,qBAAqB;UACrBzB,OAAO,EAAGtB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJgB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.settings = exports.name = exports.metadata = exports.init = void 0;
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
9
|
var _icons = require("@wordpress/icons");
|
|
9
10
|
var _initBlock = _interopRequireDefault(require("../utils/init-block"));
|
|
10
11
|
var _edit = _interopRequireDefault(require("./edit"));
|
|
@@ -79,58 +80,58 @@ const metadata = exports.metadata = {
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
},
|
|
83
|
+
style: "wp-block-table-of-contents"
|
|
84
|
+
};
|
|
85
|
+
const {
|
|
86
|
+
name
|
|
87
|
+
} = metadata;
|
|
88
|
+
exports.name = name;
|
|
89
|
+
const settings = exports.settings = {
|
|
90
|
+
icon: _icons.tableOfContents,
|
|
91
|
+
edit: _edit.default,
|
|
92
|
+
save: _save.default,
|
|
82
93
|
example: {
|
|
83
94
|
innerBlocks: [{
|
|
84
|
-
name:
|
|
95
|
+
name: 'core/heading',
|
|
85
96
|
attributes: {
|
|
86
97
|
level: 2,
|
|
87
|
-
content:
|
|
98
|
+
content: (0, _i18n.__)('Heading')
|
|
88
99
|
}
|
|
89
100
|
}, {
|
|
90
|
-
name:
|
|
101
|
+
name: 'core/heading',
|
|
91
102
|
attributes: {
|
|
92
103
|
level: 3,
|
|
93
|
-
content:
|
|
104
|
+
content: (0, _i18n.__)('Subheading')
|
|
94
105
|
}
|
|
95
106
|
}, {
|
|
96
|
-
name:
|
|
107
|
+
name: 'core/heading',
|
|
97
108
|
attributes: {
|
|
98
109
|
level: 2,
|
|
99
|
-
content:
|
|
110
|
+
content: (0, _i18n.__)('Heading')
|
|
100
111
|
}
|
|
101
112
|
}, {
|
|
102
|
-
name:
|
|
113
|
+
name: 'core/heading',
|
|
103
114
|
attributes: {
|
|
104
115
|
level: 3,
|
|
105
|
-
content:
|
|
116
|
+
content: (0, _i18n.__)('Subheading')
|
|
106
117
|
}
|
|
107
118
|
}],
|
|
108
119
|
attributes: {
|
|
109
120
|
headings: [{
|
|
110
|
-
content:
|
|
121
|
+
content: (0, _i18n.__)('Heading'),
|
|
111
122
|
level: 2
|
|
112
123
|
}, {
|
|
113
|
-
content:
|
|
124
|
+
content: (0, _i18n.__)('Subheading'),
|
|
114
125
|
level: 3
|
|
115
126
|
}, {
|
|
116
|
-
content:
|
|
127
|
+
content: (0, _i18n.__)('Heading'),
|
|
117
128
|
level: 2
|
|
118
129
|
}, {
|
|
119
|
-
content:
|
|
130
|
+
content: (0, _i18n.__)('Subheading'),
|
|
120
131
|
level: 3
|
|
121
132
|
}]
|
|
122
133
|
}
|
|
123
|
-
}
|
|
124
|
-
style: "wp-block-table-of-contents"
|
|
125
|
-
};
|
|
126
|
-
const {
|
|
127
|
-
name
|
|
128
|
-
} = metadata;
|
|
129
|
-
exports.name = name;
|
|
130
|
-
const settings = exports.settings = {
|
|
131
|
-
icon: _icons.tableOfContents,
|
|
132
|
-
edit: _edit.default,
|
|
133
|
-
save: _save.default
|
|
134
|
+
}
|
|
134
135
|
};
|
|
135
136
|
const init = () => (0, _initBlock.default)({
|
|
136
137
|
name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_edit","_save","metadata","exports","$schema","apiVersion","__experimental","name","title","category","description","keywords","textdomain","attributes","headings","type","items","onlyIncludeCurrentPage","supports","html","color","text","background","gradients","link","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","interactivity","clientNavigation","__experimentalBorder","radius","width","style","settings","icon","edit","save","example","innerBlocks","level","content","__","init","initBlock"],"sources":["@wordpress/block-library/src/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tattributes: {\n\t\t\theadings: [\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAZA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAM,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,QAAA;MAAAC,IAAA;MAAAC,KAAA;QAAAD,IAAA;MAAA;MAAA;IAAA;IAAAE,sBA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I,EAAE,cAAc;MACpBM,UAAU,EAAE;QACXqC,KAAK,EAAE,CAAC;QACRC,OAAO,EAAE,IAAAC,QAAE,EAAE,YAAa;MAC3B;IACD,CAAC,CACD;IACDvC,UAAU,EAAE;MACXC,QAAQ,EAAE,CACT;QACCqC,OAAO,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;QACxBF,KAAK,EAAE;MACR,CAAC,EACD;QACCC,OAAO,EAAE,IAAAC,QAAE,EAAE,YAAa,CAAC;QAC3BF,KAAK,EAAE;MACR,CAAC,EACD;QACCC,OAAO,EAAE,IAAAC,QAAE,EAAE,SAAU,CAAC;QACxBF,KAAK,EAAE;MACR,CAAC,EACD;QACCC,OAAO,EAAE,IAAAC,QAAE,EAAE,YAAa,CAAC;QAC3BF,KAAK,EAAE;MACR,CAAC;IAEH;EACD;AACD,CAAC;AAEM,MAAMG,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAE/C,IAAI;EAAEL,QAAQ;EAAE0C;AAAS,CAAE,CAAC;AAACzC,OAAA,CAAAkD,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ENTRY_CLASS_NAME","TableOfContentsList","nestedHeadingList","disableLinkActivation","onClick","_jsxRuntime","jsx","Fragment","children","map","node","index","content","link","heading","entry","className","href","undefined","jsxs"],"sources":["@wordpress/block-library/src/table-of-contents/list.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { MouseEvent, ReactElement } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { NestedHeadingData } from './utils';\n\nconst ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';\n\nexport default function TableOfContentsList( {\n\tnestedHeadingList,\n\tdisableLinkActivation,\n\tonClick,\n}: {\n\tnestedHeadingList: NestedHeadingData[];\n\tdisableLinkActivation?: boolean;\n\tonClick?: ( event: MouseEvent< HTMLAnchorElement > ) => void;\n} ): ReactElement {\n\treturn (\n\t\t<>\n\t\t\t{ nestedHeadingList.map( ( node, index ) => {\n\t\t\t\tconst { content, link } = node.heading;\n\n\t\t\t\tconst entry = link ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ ENTRY_CLASS_NAME }\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\taria-disabled={ disableLinkActivation || undefined }\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tdisableLinkActivation &&\n\t\t\t\t\t\t\t'function' === typeof onClick\n\t\t\t\t\t\t\t\t? onClick\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span className={ ENTRY_CLASS_NAME }>{ content }</span>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t{ entry }\n\t\t\t\t\t\t{ node.children ? (\n\t\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\tnestedHeadingList={ node.children }\n\t\t\t\t\t\t\t\t\tdisableLinkActivation={\n\t\t\t\t\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\tdisableLinkActivation &&\n\t\t\t\t\t\t\t\t\t\t'function' === typeof onClick\n\t\t\t\t\t\t\t\t\t\t\t? onClick\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</li>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ENTRY_CLASS_NAME","TableOfContentsList","nestedHeadingList","disableLinkActivation","onClick","_jsxRuntime","jsx","Fragment","children","map","node","index","content","link","heading","entry","className","href","undefined","jsxs"],"sources":["@wordpress/block-library/src/table-of-contents/list.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { MouseEvent, ReactElement } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { NestedHeadingData } from './utils';\n\nconst ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry';\n\nexport default function TableOfContentsList( {\n\tnestedHeadingList,\n\tdisableLinkActivation,\n\tonClick,\n}: {\n\tnestedHeadingList: NestedHeadingData[];\n\tdisableLinkActivation?: boolean;\n\tonClick?: ( event: MouseEvent< HTMLAnchorElement > ) => void;\n} ): ReactElement {\n\treturn (\n\t\t<>\n\t\t\t{ nestedHeadingList.map( ( node, index ) => {\n\t\t\t\tconst { content, link } = node.heading;\n\n\t\t\t\tconst entry = link ? (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ ENTRY_CLASS_NAME }\n\t\t\t\t\t\thref={ link }\n\t\t\t\t\t\taria-disabled={ disableLinkActivation || undefined }\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tdisableLinkActivation &&\n\t\t\t\t\t\t\t'function' === typeof onClick\n\t\t\t\t\t\t\t\t? onClick\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span className={ ENTRY_CLASS_NAME }>{ content }</span>\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t{ entry }\n\t\t\t\t\t\t{ node.children ? (\n\t\t\t\t\t\t\t<ol>\n\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\tnestedHeadingList={ node.children }\n\t\t\t\t\t\t\t\t\tdisableLinkActivation={\n\t\t\t\t\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\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IAAAH,WAAA,CAAAC,GAAA,EAACL,mBAAmB;YACnBC,iBAAiB,EAAGQ,IAAI,CAACF,QAAU;YACnCL,qBAAqB,EACpBA,qBACA;YACDC,OAAO,EACND,qBAAqB,IACrB,UAAU,KAAK,OAAOC,OAAO,GAC1BA,OAAO,GACPc;UACH,CACD;QAAC,CACC,CAAC,GACF,IAAI;MAAA,GAjBCP,KAkBN,CAAC;IAEP,CAAE;EAAC,CACF,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["linearToNestedHeadingList","headingList","nestedHeadingList","forEach","heading","key","content","level","endOfSlice","length","i","push","children","slice"],"sources":["@wordpress/block-library/src/table-of-contents/utils.ts"],"sourcesContent":["export interface HeadingData {\n\t/** The plain text content of the heading. */\n\tcontent: string;\n\t/** The heading level. */\n\tlevel: number;\n\t/** Link to the heading. */\n\tlink: string;\n}\n\nexport interface NestedHeadingData {\n\t/** The heading content, level, and link. */\n\theading: HeadingData;\n\t/** The sub-headings of this heading, if any. */\n\tchildren: NestedHeadingData[] | null;\n}\n\n/**\n * Takes a flat list of heading parameters and nests them based on each header's\n * immediate parent's level.\n *\n * @param headingList The flat list of headings to nest.\n *\n * @return The nested list of headings.\n */\nexport function linearToNestedHeadingList(\n\theadingList: HeadingData[]\n): NestedHeadingData[] {\n\tconst nestedHeadingList: NestedHeadingData[] = [];\n\n\theadingList.forEach( ( heading, key ) => {\n\t\tif ( heading.content === '' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure we are only working with the same level as the first iteration in our set.\n\t\tif ( heading.level === headingList[ 0 ].level ) {\n\t\t\t// Check that the next iteration will return a value.\n\t\t\t// If it does and the next level is greater than the current level,\n\t\t\t// the next iteration becomes a child of the current iteration.\n\t\t\tif ( headingList[ key + 1 ]?.level > heading.level ) {\n\t\t\t\t// We must calculate the last index before the next iteration that\n\t\t\t\t// has the same level (siblings). We then use this index to slice\n\t\t\t\t// the array for use in recursion. This prevents duplicate nodes.\n\t\t\t\tlet endOfSlice = headingList.length;\n\t\t\t\tfor ( let i = key + 1; i < headingList.length; i++ ) {\n\t\t\t\t\tif ( headingList[ i ].level === heading.level ) {\n\t\t\t\t\t\tendOfSlice = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We found a child node: Push a new node onto the return array\n\t\t\t\t// with children.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: linearToNestedHeadingList(\n\t\t\t\t\t\theadingList.slice( key + 1, endOfSlice )\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\t// No child node: Push a new node onto the return array.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn nestedHeadingList;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["linearToNestedHeadingList","headingList","nestedHeadingList","forEach","heading","key","content","level","endOfSlice","length","i","push","children","slice"],"sources":["@wordpress/block-library/src/table-of-contents/utils.ts"],"sourcesContent":["export interface HeadingData {\n\t/** The plain text content of the heading. */\n\tcontent: string;\n\t/** The heading level. */\n\tlevel: number;\n\t/** Link to the heading. */\n\tlink: string;\n}\n\nexport interface NestedHeadingData {\n\t/** The heading content, level, and link. */\n\theading: HeadingData;\n\t/** The sub-headings of this heading, if any. */\n\tchildren: NestedHeadingData[] | null;\n}\n\n/**\n * Takes a flat list of heading parameters and nests them based on each header's\n * immediate parent's level.\n *\n * @param headingList The flat list of headings to nest.\n *\n * @return The nested list of headings.\n */\nexport function linearToNestedHeadingList(\n\theadingList: HeadingData[]\n): NestedHeadingData[] {\n\tconst nestedHeadingList: NestedHeadingData[] = [];\n\n\theadingList.forEach( ( heading, key ) => {\n\t\tif ( heading.content === '' ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure we are only working with the same level as the first iteration in our set.\n\t\tif ( heading.level === headingList[ 0 ].level ) {\n\t\t\t// Check that the next iteration will return a value.\n\t\t\t// If it does and the next level is greater than the current level,\n\t\t\t// the next iteration becomes a child of the current iteration.\n\t\t\tif ( headingList[ key + 1 ]?.level > heading.level ) {\n\t\t\t\t// We must calculate the last index before the next iteration that\n\t\t\t\t// has the same level (siblings). We then use this index to slice\n\t\t\t\t// the array for use in recursion. This prevents duplicate nodes.\n\t\t\t\tlet endOfSlice = headingList.length;\n\t\t\t\tfor ( let i = key + 1; i < headingList.length; i++ ) {\n\t\t\t\t\tif ( headingList[ i ].level === heading.level ) {\n\t\t\t\t\t\tendOfSlice = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We found a child node: Push a new node onto the return array\n\t\t\t\t// with children.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: linearToNestedHeadingList(\n\t\t\t\t\t\theadingList.slice( key + 1, endOfSlice )\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\t// No child node: Push a new node onto the return array.\n\t\t\t\tnestedHeadingList.push( {\n\t\t\t\t\theading,\n\t\t\t\t\tchildren: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn nestedHeadingList;\n}\n"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAyBA,CACxCC,WAA0B,EACJ;EACtB,MAAMC,iBAAsC,GAAG,EAAE;EAEjDD,WAAW,CAACE,OAAO,CAAE,CAAEC,OAAO,EAAEC,GAAG,KAAM;IACxC,IAAKD,OAAO,CAACE,OAAO,KAAK,EAAE,EAAG;MAC7B;IACD;;IAEA;IACA,IAAKF,OAAO,CAACG,KAAK,KAAKN,WAAW,CAAE,CAAC,CAAE,CAACM,KAAK,EAAG;MAC/C;MACA;MACA;MACA,IAAKN,WAAW,CAAEI,GAAG,GAAG,CAAC,CAAE,EAAEE,KAAK,GAAGH,OAAO,CAACG,KAAK,EAAG;QACpD;QACA;QACA;QACA,IAAIC,UAAU,GAAGP,WAAW,CAACQ,MAAM;QACnC,KAAM,IAAIC,CAAC,GAAGL,GAAG,GAAG,CAAC,EAAEK,CAAC,GAAGT,WAAW,CAACQ,MAAM,EAAEC,CAAC,EAAE,EAAG;UACpD,IAAKT,WAAW,CAAES,CAAC,CAAE,CAACH,KAAK,KAAKH,OAAO,CAACG,KAAK,EAAG;YAC/CC,UAAU,GAAGE,CAAC;YACd;UACD;QACD;;QAEA;QACA;QACAR,iBAAiB,CAACS,IAAI,CAAE;UACvBP,OAAO;UACPQ,QAAQ,EAAEZ,yBAAyB,CAClCC,WAAW,CAACY,KAAK,CAAER,GAAG,GAAG,CAAC,EAAEG,UAAW,CACxC;QACD,CAAE,CAAC;MACJ,CAAC,MAAM;QACN;QACAN,iBAAiB,CAACS,IAAI,CAAE;UACvBP,OAAO;UACPQ,QAAQ,EAAE;QACX,CAAE,CAAC;MACJ;IACD;EACD,CAAE,CAAC;EAEH,OAAOV,iBAAiB;AACzB","ignoreList":[]}
|
package/build/tag-cloud/edit.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* wp:polyfill */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -11,11 +12,16 @@ var _i18n = require("@wordpress/i18n");
|
|
|
11
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
12
13
|
var _serverSideRender = _interopRequireDefault(require("@wordpress/server-side-render"));
|
|
13
14
|
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
var _hooks = require("../utils/hooks");
|
|
14
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
17
|
/**
|
|
16
18
|
* WordPress dependencies
|
|
17
19
|
*/
|
|
18
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
|
|
19
25
|
/**
|
|
20
26
|
* Minimum number of tags a user can show using this block.
|
|
21
27
|
*
|
|
@@ -42,6 +48,7 @@ function TagCloudEdit({
|
|
|
42
48
|
largestFontSize
|
|
43
49
|
} = attributes;
|
|
44
50
|
const [availableUnits] = (0, _blockEditor.useSettings)('spacing.units');
|
|
51
|
+
const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
|
|
45
52
|
|
|
46
53
|
// The `pt` unit is used as the default value and is therefore
|
|
47
54
|
// always considered an available unit.
|
|
@@ -98,12 +105,26 @@ function TagCloudEdit({
|
|
|
98
105
|
}
|
|
99
106
|
};
|
|
100
107
|
const inspectorControls = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
101
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
|
|
109
|
+
label: (0, _i18n.__)('Settings'),
|
|
110
|
+
resetAll: () => {
|
|
111
|
+
setAttributes({
|
|
112
|
+
taxonomy: 'post_tag',
|
|
113
|
+
showTagCounts: false,
|
|
114
|
+
numberOfTags: 45,
|
|
115
|
+
smallestFontSize: '8pt',
|
|
116
|
+
largestFontSize: '22pt'
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
dropdownMenuProps: dropdownMenuProps,
|
|
120
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
121
|
+
hasValue: () => taxonomy !== 'post_tag',
|
|
122
|
+
label: (0, _i18n.__)('Taxonomy'),
|
|
123
|
+
onDeselect: () => setAttributes({
|
|
124
|
+
taxonomy: 'post_tag'
|
|
125
|
+
}),
|
|
126
|
+
isShownByDefault: true,
|
|
127
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
|
|
107
128
|
__nextHasNoMarginBottom: true,
|
|
108
129
|
__next40pxDefaultSize: true,
|
|
109
130
|
label: (0, _i18n.__)('Taxonomy'),
|
|
@@ -112,7 +133,16 @@ function TagCloudEdit({
|
|
|
112
133
|
onChange: selectedTaxonomy => setAttributes({
|
|
113
134
|
taxonomy: selectedTaxonomy
|
|
114
135
|
})
|
|
115
|
-
})
|
|
136
|
+
})
|
|
137
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
138
|
+
hasValue: () => smallestFontSize !== '8pt' || largestFontSize !== '22pt',
|
|
139
|
+
label: (0, _i18n.__)('Font size'),
|
|
140
|
+
onDeselect: () => setAttributes({
|
|
141
|
+
smallestFontSize: '8pt',
|
|
142
|
+
largestFontSize: '22pt'
|
|
143
|
+
}),
|
|
144
|
+
isShownByDefault: true,
|
|
145
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, {
|
|
116
146
|
gap: 4,
|
|
117
147
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
118
148
|
isBlock: true,
|
|
@@ -141,7 +171,15 @@ function TagCloudEdit({
|
|
|
141
171
|
size: "__unstable-large"
|
|
142
172
|
})
|
|
143
173
|
})]
|
|
144
|
-
})
|
|
174
|
+
})
|
|
175
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
176
|
+
hasValue: () => numberOfTags !== 45,
|
|
177
|
+
label: (0, _i18n.__)('Number of tags'),
|
|
178
|
+
onDeselect: () => setAttributes({
|
|
179
|
+
numberOfTags: 45
|
|
180
|
+
}),
|
|
181
|
+
isShownByDefault: true,
|
|
182
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.RangeControl, {
|
|
145
183
|
__nextHasNoMarginBottom: true,
|
|
146
184
|
__next40pxDefaultSize: true,
|
|
147
185
|
label: (0, _i18n.__)('Number of tags'),
|
|
@@ -152,15 +190,23 @@ function TagCloudEdit({
|
|
|
152
190
|
min: MIN_TAGS,
|
|
153
191
|
max: MAX_TAGS,
|
|
154
192
|
required: true
|
|
155
|
-
})
|
|
193
|
+
})
|
|
194
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
195
|
+
hasValue: () => showTagCounts !== false,
|
|
196
|
+
label: (0, _i18n.__)('Show tag counts'),
|
|
197
|
+
onDeselect: () => setAttributes({
|
|
198
|
+
showTagCounts: false
|
|
199
|
+
}),
|
|
200
|
+
isShownByDefault: true,
|
|
201
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
|
|
156
202
|
__nextHasNoMarginBottom: true,
|
|
157
203
|
label: (0, _i18n.__)('Show tag counts'),
|
|
158
204
|
checked: showTagCounts,
|
|
159
205
|
onChange: () => setAttributes({
|
|
160
206
|
showTagCounts: !showTagCounts
|
|
161
207
|
})
|
|
162
|
-
})
|
|
163
|
-
})
|
|
208
|
+
})
|
|
209
|
+
})]
|
|
164
210
|
})
|
|
165
211
|
});
|
|
166
212
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_blockEditor","_serverSideRender","_interopRequireDefault","_coreData","_jsxRuntime","MIN_TAGS","MAX_TAGS","MIN_FONT_SIZE","MAX_FONT_SIZE","TagCloudEdit","attributes","setAttributes","taxonomy","showTagCounts","numberOfTags","smallestFontSize","largestFontSize","availableUnits","useSettings","units","useCustomUnits","taxonomies","useSelect","select","coreStore","getTaxonomies","per_page","getTaxonomyOptions","selectOption","label","__","value","disabled","taxonomyOptions","filter","tax","show_cloud","map","item","slug","name","onFontSizeChange","fontSizeLabel","newValue","quantity","newUnit","parseQuantityAndUnitFromRawValue","Number","isFinite","updateObj","Object","entries","forEach","attribute","currentValue","currentQuantity","currentUnit","serverSideAttributes","style","border","undefined","inspectorControls","jsx","InspectorControls","children","PanelBody","title","jsxs","__experimentalVStack","spacing","className","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","options","onChange","selectedTaxonomy","Flex","gap","FlexItem","isBlock","__experimentalUnitControl","min","max","size","RangeControl","required","ToggleControl","checked","Fragment","useBlockProps","Disabled","default","skipBlockSupportAttributes","block","_default","exports"],"sources":["@wordpress/block-library/src/tag-cloud/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFlex,\n\tFlexItem,\n\tPanelBody,\n\tToggleControl,\n\tSelectControl,\n\tRangeControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalVStack as VStack,\n\tDisabled,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Minimum number of tags a user can show using this block.\n *\n * @type {number}\n */\nconst MIN_TAGS = 1;\n\n/**\n * Maximum number of tags a user can show using this block.\n *\n * @type {number}\n */\nconst MAX_TAGS = 100;\n\nconst MIN_FONT_SIZE = 0.1;\nconst MAX_FONT_SIZE = 100;\n\nfunction TagCloudEdit( { attributes, setAttributes } ) {\n\tconst {\n\t\ttaxonomy,\n\t\tshowTagCounts,\n\t\tnumberOfTags,\n\t\tsmallestFontSize,\n\t\tlargestFontSize,\n\t} = attributes;\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\n\t// The `pt` unit is used as the default value and is therefore\n\t// always considered an available unit.\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits\n\t\t\t? [ ...availableUnits, 'pt' ]\n\t\t\t: [ '%', 'px', 'em', 'rem', 'pt' ],\n\t} );\n\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( '- Select -' ),\n\t\t\tvalue: '',\n\t\t\tdisabled: true,\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( tax ) => !! tax.show_cloud )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\tconst onFontSizeChange = ( fontSizeLabel, newValue ) => {\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst [ quantity, newUnit ] =\n\t\t\tparseQuantityAndUnitFromRawValue( newValue );\n\t\tif ( ! Number.isFinite( quantity ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst updateObj = { [ fontSizeLabel ]: newValue };\n\t\t// We need to keep in sync the `unit` changes to both `smallestFontSize`\n\t\t// and `largestFontSize` attributes.\n\t\tObject.entries( {\n\t\t\tsmallestFontSize,\n\t\t\tlargestFontSize,\n\t\t} ).forEach( ( [ attribute, currentValue ] ) => {\n\t\t\tconst [ currentQuantity, currentUnit ] =\n\t\t\t\tparseQuantityAndUnitFromRawValue( currentValue );\n\t\t\t// Only add an update if the other font size attribute has a different unit.\n\t\t\tif ( attribute !== fontSizeLabel && currentUnit !== newUnit ) {\n\t\t\t\tupdateObj[ attribute ] = `${ currentQuantity }${ newUnit }`;\n\t\t\t}\n\t\t} );\n\t\tsetAttributes( updateObj );\n\t};\n\n\t// Remove border styles from the server-side attributes to prevent duplicate border.\n\tconst serverSideAttributes = {\n\t\t...attributes,\n\t\tstyle: {\n\t\t\t...attributes?.style,\n\t\t\tborder: undefined,\n\t\t},\n\t};\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<VStack\n\t\t\t\t\tspacing={ 4 }\n\t\t\t\t\tclassName=\"wp-block-tag-cloud__inspector-settings\"\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\t\tsetAttributes( { taxonomy: selectedTaxonomy } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Smallest size' ) }\n\t\t\t\t\t\t\t\tvalue={ smallestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'smallestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Largest size' ) }\n\t\t\t\t\t\t\t\tvalue={ largestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'largestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Number of tags' ) }\n\t\t\t\t\t\tvalue={ numberOfTags }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { numberOfTags: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ MIN_TAGS }\n\t\t\t\t\t\tmax={ MAX_TAGS }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show tag counts' ) }\n\t\t\t\t\t\tchecked={ showTagCounts }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTagCounts: ! showTagCounts } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tblock=\"core/tag-cloud\"\n\t\t\t\t\t\tattributes={ serverSideAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\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A,EAAA/D,WAAA,CAAAqF,QAAA;IAAAzB,QAAA,GACGH,iBAAiB,eACnB,IAAAzD,WAAA,CAAA0D,GAAA;MAAA,GAAU,IAAA4B,0BAAa,EAAC,CAAC;MAAA1B,QAAA,eACxB,IAAA5D,WAAA,CAAA0D,GAAA,EAAClE,WAAA,CAAA+F,QAAQ;QAAA3B,QAAA,eACR,IAAA5D,WAAA,CAAA0D,GAAA,EAAC7D,iBAAA,CAAA2F,OAAgB;UAChBC,0BAA0B;UAC1BC,KAAK,EAAC,gBAAgB;UACtBpF,UAAU,EAAG+C;QAAsB,CACnC;MAAC,CACO;IAAC,CACP,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAsC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEcnF,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_i18n","_blockEditor","_serverSideRender","_interopRequireDefault","_coreData","_hooks","_jsxRuntime","MIN_TAGS","MAX_TAGS","MIN_FONT_SIZE","MAX_FONT_SIZE","TagCloudEdit","attributes","setAttributes","taxonomy","showTagCounts","numberOfTags","smallestFontSize","largestFontSize","availableUnits","useSettings","dropdownMenuProps","useToolsPanelDropdownMenuProps","units","useCustomUnits","taxonomies","useSelect","select","coreStore","getTaxonomies","per_page","getTaxonomyOptions","selectOption","label","__","value","disabled","taxonomyOptions","filter","tax","show_cloud","map","item","slug","name","onFontSizeChange","fontSizeLabel","newValue","quantity","newUnit","parseQuantityAndUnitFromRawValue","Number","isFinite","updateObj","Object","entries","forEach","attribute","currentValue","currentQuantity","currentUnit","serverSideAttributes","style","border","undefined","inspectorControls","jsx","InspectorControls","children","jsxs","__experimentalToolsPanel","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","options","onChange","selectedTaxonomy","Flex","gap","FlexItem","isBlock","__experimentalUnitControl","min","max","size","RangeControl","required","ToggleControl","checked","Fragment","useBlockProps","Disabled","default","skipBlockSupportAttributes","block","_default","exports"],"sources":["@wordpress/block-library/src/tag-cloud/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tFlex,\n\tFlexItem,\n\tToggleControl,\n\tSelectControl,\n\tRangeControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tDisabled,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport ServerSideRender from '@wordpress/server-side-render';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/**\n * Minimum number of tags a user can show using this block.\n *\n * @type {number}\n */\nconst MIN_TAGS = 1;\n\n/**\n * Maximum number of tags a user can show using this block.\n *\n * @type {number}\n */\nconst MAX_TAGS = 100;\n\nconst MIN_FONT_SIZE = 0.1;\nconst MAX_FONT_SIZE = 100;\n\nfunction TagCloudEdit( { attributes, setAttributes } ) {\n\tconst {\n\t\ttaxonomy,\n\t\tshowTagCounts,\n\t\tnumberOfTags,\n\t\tsmallestFontSize,\n\t\tlargestFontSize,\n\t} = attributes;\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// The `pt` unit is used as the default value and is therefore\n\t// always considered an available unit.\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits\n\t\t\t? [ ...availableUnits, 'pt' ]\n\t\t\t: [ '%', 'px', 'em', 'rem', 'pt' ],\n\t} );\n\n\tconst taxonomies = useSelect(\n\t\t( select ) => select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t[]\n\t);\n\n\tconst getTaxonomyOptions = () => {\n\t\tconst selectOption = {\n\t\t\tlabel: __( '- Select -' ),\n\t\t\tvalue: '',\n\t\t\tdisabled: true,\n\t\t};\n\t\tconst taxonomyOptions = ( taxonomies ?? [] )\n\t\t\t.filter( ( tax ) => !! tax.show_cloud )\n\t\t\t.map( ( item ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: item.slug,\n\t\t\t\t\tlabel: item.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\treturn [ selectOption, ...taxonomyOptions ];\n\t};\n\n\tconst onFontSizeChange = ( fontSizeLabel, newValue ) => {\n\t\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\tconst [ quantity, newUnit ] =\n\t\t\tparseQuantityAndUnitFromRawValue( newValue );\n\t\tif ( ! Number.isFinite( quantity ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst updateObj = { [ fontSizeLabel ]: newValue };\n\t\t// We need to keep in sync the `unit` changes to both `smallestFontSize`\n\t\t// and `largestFontSize` attributes.\n\t\tObject.entries( {\n\t\t\tsmallestFontSize,\n\t\t\tlargestFontSize,\n\t\t} ).forEach( ( [ attribute, currentValue ] ) => {\n\t\t\tconst [ currentQuantity, currentUnit ] =\n\t\t\t\tparseQuantityAndUnitFromRawValue( currentValue );\n\t\t\t// Only add an update if the other font size attribute has a different unit.\n\t\t\tif ( attribute !== fontSizeLabel && currentUnit !== newUnit ) {\n\t\t\t\tupdateObj[ attribute ] = `${ currentQuantity }${ newUnit }`;\n\t\t\t}\n\t\t} );\n\t\tsetAttributes( updateObj );\n\t};\n\n\t// Remove border styles from the server-side attributes to prevent duplicate border.\n\tconst serverSideAttributes = {\n\t\t...attributes,\n\t\tstyle: {\n\t\t\t...attributes?.style,\n\t\t\tborder: undefined,\n\t\t},\n\t};\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\ttaxonomy: 'post_tag',\n\t\t\t\t\t\tshowTagCounts: false,\n\t\t\t\t\t\tnumberOfTags: 45,\n\t\t\t\t\t\tsmallestFontSize: '8pt',\n\t\t\t\t\t\tlargestFontSize: '22pt',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => taxonomy !== 'post_tag' }\n\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { taxonomy: 'post_tag' } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Taxonomy' ) }\n\t\t\t\t\t\toptions={ getTaxonomyOptions() }\n\t\t\t\t\t\tvalue={ taxonomy }\n\t\t\t\t\t\tonChange={ ( selectedTaxonomy ) =>\n\t\t\t\t\t\t\tsetAttributes( { taxonomy: selectedTaxonomy } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\tsmallestFontSize !== '8pt' || largestFontSize !== '22pt'\n\t\t\t\t\t}\n\t\t\t\t\tlabel={ __( 'Font size' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tsmallestFontSize: '8pt',\n\t\t\t\t\t\t\tlargestFontSize: '22pt',\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Smallest size' ) }\n\t\t\t\t\t\t\t\tvalue={ smallestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'smallestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Largest size' ) }\n\t\t\t\t\t\t\t\tvalue={ largestFontSize }\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonFontSizeChange(\n\t\t\t\t\t\t\t\t\t\t'largestFontSize',\n\t\t\t\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tmin={ MIN_FONT_SIZE }\n\t\t\t\t\t\t\t\tmax={ MAX_FONT_SIZE }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => numberOfTags !== 45 }\n\t\t\t\t\tlabel={ __( 'Number of tags' ) }\n\t\t\t\t\tonDeselect={ () => setAttributes( { numberOfTags: 45 } ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Number of tags' ) }\n\t\t\t\t\t\tvalue={ numberOfTags }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { numberOfTags: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ MIN_TAGS }\n\t\t\t\t\t\tmax={ MAX_TAGS }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => showTagCounts !== false }\n\t\t\t\t\tlabel={ __( 'Show tag counts' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { showTagCounts: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show tag counts' ) }\n\t\t\t\t\t\tchecked={ showTagCounts }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showTagCounts: ! showTagCounts } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...useBlockProps() }>\n\t\t\t\t<Disabled>\n\t\t\t\t\t<ServerSideRender\n\t\t\t\t\t\tskipBlockSupportAttributes\n\t\t\t\t\t\tblock=\"core/tag-cloud\"\n\t\t\t\t\t\tattributes={ serverSideAttributes }\n\t\t\t\t\t/>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default TagCloudEdit;\n"],"mappings":";;;;;;;;AA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,EAAGA,CAAA,KACVnE,aAAa,CAAE;YAAEE,aAAa,EAAE,CAAEA;UAAc,CAAE;QAClD,CACD;MAAC,CACa,CAAC;IAAA,CACN;EAAC,CACK,CACnB;EAED,oBACC,IAAAT,WAAA,CAAA+D,IAAA,EAAA/D,WAAA,CAAAwF,QAAA;IAAA1B,QAAA,GACGH,iBAAiB,eACnB,IAAA3D,WAAA,CAAA4D,GAAA;MAAA,GAAU,IAAA6B,0BAAa,EAAC,CAAC;MAAA3B,QAAA,eACxB,IAAA9D,WAAA,CAAA4D,GAAA,EAACrE,WAAA,CAAAmG,QAAQ;QAAA5B,QAAA,eACR,IAAA9D,WAAA,CAAA4D,GAAA,EAAChE,iBAAA,CAAA+F,OAAgB;UAChBC,0BAA0B;UAC1BC,KAAK,EAAC,gBAAgB;UACtBvF,UAAU,EAAGiD;QAAsB,CACnC;MAAC,CACO;IAAC,CACP,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAuC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEctF,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_jsxRuntime","htmlElementMessages","header","__","main","section","article","aside","footer","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getEntityRecord","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\n\nconst htmlElementMessages = {\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n};\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_coreData","require","_components","_i18n","_data","_importControls","_jsxRuntime","htmlElementMessages","header","__","main","section","article","aside","footer","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","useEntityProp","title","setTitle","defaultTemplatePartAreas","useSelect","select","coreStore","getEntityRecord","default_template_part_areas","areaOptions","map","label","_area","value","jsxs","Fragment","children","jsx","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","onChange","onFocus","event","target","SelectControl","labelPosition","options","sprintf","help","TemplatePartImportControls"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\n\nconst htmlElementMessages = {\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n};\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', '__unstableBase' )\n\t\t\t\t?.default_template_part_areas || [],\n\t\t[]\n\t);\n\n\tconst areaOptions = defaultTemplatePartAreas.map(\n\t\t( { label, area: _area } ) => ( {\n\t\t\tlabel,\n\t\t\tvalue: _area,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,eAAA,GAAAJ,OAAA;AAA+D,IAAAK,WAAA,GAAAL,OAAA;AAX/D;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMM,mBAAmB,GAAG;EAC3BC,MAAM,EAAE,IAAAC,QAAE,EACT,qHACD,CAAC;EACDC,IAAI,EAAE,IAAAD,QAAE,EACP,kFACD,CAAC;EACDE,OAAO,EAAE,IAAAF,QAAE,EACV,kIACD,CAAC;EACDG,OAAO,EAAE,IAAAH,QAAE,EACV,gGACD,CAAC;EACDI,KAAK,EAAE,IAAAJ,QAAE,EACR,uIACD,CAAC;EACDK,MAAM,EAAE,IAAAL,QAAE,EACT,8HACD;AACD,CAAC;AAEM,SAASM,4BAA4BA,CAAE;EAC7CC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,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