@wordpress/block-library 7.9.0 → 7.12.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 +6 -0
- package/build/archives/edit.js +7 -0
- package/build/archives/edit.js.map +1 -1
- package/build/archives/index.js +4 -0
- package/build/archives/index.js.map +1 -1
- package/build/block/edit.js +4 -2
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +4 -2
- package/build/block/edit.native.js.map +1 -1
- package/build/button/edit.js +2 -1
- package/build/button/edit.js.map +1 -1
- package/build/buttons/edit.js +1 -1
- package/build/buttons/edit.js.map +1 -1
- package/build/calendar/edit.js +12 -5
- package/build/calendar/edit.js.map +1 -1
- package/build/columns/edit.native.js +3 -2
- package/build/columns/edit.native.js.map +1 -1
- package/build/comment-template/index.js +1 -1
- package/build/comments/deprecated.js +65 -0
- package/build/comments/deprecated.js.map +1 -0
- package/build/comments/edit/comments-legacy.js +73 -0
- package/build/comments/edit/comments-legacy.js.map +1 -0
- package/build/comments/{edit.js → edit/index.js} +17 -38
- package/build/comments/edit/index.js.map +1 -0
- package/build/comments/edit/placeholder.js +117 -0
- package/build/comments/edit/placeholder.js.map +1 -0
- package/build/comments/edit/template.js +39 -0
- package/build/comments/edit/template.js.map +1 -0
- package/build/comments/index.js +11 -3
- package/build/comments/index.js.map +1 -1
- package/build/comments/save.js +12 -4
- package/build/comments/save.js.map +1 -1
- package/build/comments-pagination/index.js +1 -1
- package/build/comments-title/deprecated.js +1 -1
- package/build/comments-title/index.js +1 -1
- package/build/cover/edit/block-controls.js +2 -12
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +3 -1
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +19 -4
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/resizable-cover.js +6 -0
- package/build/cover/edit/resizable-cover.js.map +1 -1
- package/build/cover/transforms.js +3 -2
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/embed-placeholder.native.js +1 -3
- package/build/embed/embed-placeholder.native.js.map +1 -1
- package/build/gallery/edit.js +11 -19
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/transforms.js +30 -20
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-get-media.js +7 -18
- package/build/gallery/use-get-media.js.map +1 -1
- package/build/gallery/use-get-media.native.js +59 -0
- package/build/gallery/use-get-media.native.js.map +1 -0
- package/build/group/edit.js +1 -3
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/group/transforms.js +5 -0
- package/build/group/transforms.js.map +1 -1
- package/build/group/variations.js +1 -1
- package/build/group/variations.js.map +1 -1
- package/build/heading/heading-level-dropdown.js +2 -1
- package/build/heading/heading-level-dropdown.js.map +1 -1
- package/build/heading/index.js +9 -4
- package/build/heading/index.js.map +1 -1
- package/build/image/deprecated.js +77 -9
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +3 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +18 -8
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +27 -20
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +7 -1
- package/build/image/index.js.map +1 -1
- package/build/image/save.js +8 -2
- package/build/image/save.js.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/index.native.js +10 -7
- package/build/index.native.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/list/index.js +6 -0
- package/build/list/index.js.map +1 -1
- package/build/list/transforms.js +4 -63
- package/build/list/transforms.js.map +1 -1
- package/build/list/v2/edit.js +16 -5
- package/build/list/v2/edit.js.map +1 -1
- package/build/list/v2/tag-name.js +31 -0
- package/build/list/v2/tag-name.js.map +1 -0
- package/build/list/v2/tag-name.native.js +32 -0
- package/build/list/v2/tag-name.native.js.map +1 -0
- package/build/list/v2/transforms.js +1 -38
- package/build/list/v2/transforms.js.map +1 -1
- package/build/list-item/edit.js +15 -9
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/edit.native.js +158 -0
- package/build/list-item/edit.native.js.map +1 -0
- package/build/list-item/hooks/index.js +8 -8
- package/build/list-item/hooks/index.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +174 -0
- package/build/list-item/hooks/use-merge.js.map +1 -0
- package/build/list-item/hooks/use-outdent-list-item.js +86 -50
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/list-item/icons.native.js +53 -0
- package/build/list-item/icons.native.js.map +1 -0
- package/build/list-item/list-style-type.native.js +136 -0
- package/build/list-item/list-style-type.native.js.map +1 -0
- package/build/list-item/utils.js +125 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/media-text/deprecated.js +265 -16
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +4 -3
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/media-container.js +1 -1
- package/build/media-text/media-container.js.map +1 -1
- package/build/media-text/save.js +13 -0
- package/build/media-text/save.js.map +1 -1
- package/build/more/edit.js +2 -4
- package/build/more/edit.js.map +1 -1
- package/build/more/save.js +1 -7
- package/build/more/save.js.map +1 -1
- package/build/navigation/edit/index.js +68 -123
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +11 -14
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +4 -2
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +13 -3
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/use-create-navigation-menu.js +5 -1
- package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build/navigation/edit/use-inner-blocks.js +43 -0
- package/build/navigation/edit/use-inner-blocks.js.map +1 -0
- package/build/navigation/edit/utils.js +28 -0
- package/build/navigation/edit/utils.js.map +1 -0
- package/build/navigation/use-navigation-menu.js +7 -3
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation/view.js +7 -4
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +5 -4
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/hooks.js +0 -16
- package/build/navigation-link/hooks.js.map +1 -1
- package/build/navigation-link/index.js +1 -1
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-submenu/edit.js +2 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/view.js +7 -4
- package/build/navigation-submenu/view.js.map +1 -1
- package/build/nextpage/edit.js +1 -3
- package/build/nextpage/edit.js.map +1 -1
- package/build/page-list/edit.js +10 -3
- package/build/page-list/edit.js.map +1 -1
- package/build/paragraph/edit.js +7 -11
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-author/edit.js +5 -2
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author-biography/edit.js +7 -1
- package/build/post-author-biography/edit.js.map +1 -1
- package/build/post-comments-form/edit.js +4 -47
- package/build/post-comments-form/edit.js.map +1 -1
- package/build/post-comments-form/form.js +47 -3
- package/build/post-comments-form/form.js.map +1 -1
- package/build/post-content/edit.js +4 -2
- package/build/post-content/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +16 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/index.js +9 -0
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-terms/edit.js +3 -2
- package/build/post-terms/edit.js.map +1 -1
- package/build/post-terms/index.js +1 -1
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +1 -0
- package/build/post-title/index.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +43 -10
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +21 -14
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/index.js +1 -1
- package/build/query/index.js.map +1 -1
- package/build/query-no-results/edit.js +1 -1
- package/build/query-no-results/edit.js.map +1 -1
- package/build/query-pagination-next/edit.js +2 -1
- package/build/query-pagination-next/edit.js.map +1 -1
- package/build/query-pagination-previous/edit.js +2 -1
- package/build/query-pagination-previous/edit.js.map +1 -1
- package/build/query-title/edit.js +20 -7
- package/build/query-title/edit.js.map +1 -1
- package/build/query-title/index.js +4 -0
- package/build/query-title/index.js.map +1 -1
- package/build/query-title/variations.js +10 -0
- package/build/query-title/variations.js.map +1 -1
- package/build/quote/deprecated.js +168 -36
- package/build/quote/deprecated.js.map +1 -1
- package/build/quote/edit.js +76 -39
- package/build/quote/edit.js.map +1 -1
- package/build/quote/index.js +9 -45
- package/build/quote/index.js.map +1 -1
- package/build/quote/save.js +1 -5
- package/build/quote/save.js.map +1 -1
- package/build/quote/transforms.js +110 -158
- package/build/quote/transforms.js.map +1 -1
- package/build/separator/edit.js +1 -1
- package/build/separator/edit.js.map +1 -1
- package/build/site-logo/edit.js +5 -13
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-title/edit/level-toolbar.js +2 -1
- package/build/site-title/edit/level-toolbar.js.map +1 -1
- package/build/social-link/icons/index.js +13 -0
- package/build/social-link/icons/index.js.map +1 -1
- package/build/social-link/icons/whatsapp.js +25 -0
- package/build/social-link/icons/whatsapp.js.map +1 -0
- package/build/social-link/variations.js +7 -0
- package/build/social-link/variations.js.map +1 -1
- package/build/social-links/edit.js +1 -0
- package/build/social-links/edit.js.map +1 -1
- package/build/template-part/edit/index.js +21 -10
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +33 -13
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/template-part/edit/utils/search.js +94 -0
- package/build/template-part/edit/utils/search.js.map +1 -0
- package/build/template-part/index.js +1 -1
- package/build/template-part/index.js.map +1 -1
- package/build/template-part/variations.js +0 -16
- package/build/template-part/variations.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -3
- package/build/utils/clean-empty-object.js.map +1 -1
- package/build/video/tracks-editor.js +9 -11
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/edit.js +7 -0
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/archives/index.js +4 -0
- package/build-module/archives/index.js.map +1 -1
- package/build-module/block/edit.js +5 -3
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +5 -3
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/button/edit.js +2 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/buttons/edit.js +2 -2
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/calendar/edit.js +12 -4
- package/build-module/calendar/edit.js.map +1 -1
- package/build-module/columns/edit.native.js +4 -3
- package/build-module/columns/edit.native.js.map +1 -1
- package/build-module/comment-template/index.js +1 -1
- package/build-module/comments/deprecated.js +54 -0
- package/build-module/comments/deprecated.js.map +1 -0
- package/build-module/comments/edit/comments-legacy.js +59 -0
- package/build-module/comments/edit/comments-legacy.js.map +1 -0
- package/build-module/comments/edit/index.js +37 -0
- package/build-module/comments/edit/index.js.map +1 -0
- package/build-module/comments/edit/placeholder.js +102 -0
- package/build-module/comments/edit/placeholder.js.map +1 -0
- package/build-module/comments/edit/template.js +32 -0
- package/build-module/comments/edit/template.js.map +1 -0
- package/build-module/comments/index.js +10 -3
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments/save.js +9 -4
- package/build-module/comments/save.js.map +1 -1
- package/build-module/comments-pagination/index.js +1 -1
- package/build-module/comments-title/deprecated.js +1 -1
- package/build-module/comments-title/index.js +1 -1
- package/build-module/cover/edit/block-controls.js +3 -13
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +3 -1
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +19 -4
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/resizable-cover.js +6 -0
- package/build-module/cover/edit/resizable-cover.js.map +1 -1
- package/build-module/cover/transforms.js +3 -2
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/embed-placeholder.native.js +1 -2
- package/build-module/embed/embed-placeholder.native.js.map +1 -1
- package/build-module/gallery/edit.js +11 -18
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/transforms.js +30 -20
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-get-media.js +6 -16
- package/build-module/gallery/use-get-media.js.map +1 -1
- package/build-module/gallery/use-get-media.native.js +50 -0
- package/build-module/gallery/use-get-media.native.js.map +1 -0
- package/build-module/group/edit.js +1 -3
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/transforms.js +5 -0
- package/build-module/group/transforms.js.map +1 -1
- package/build-module/group/variations.js +2 -2
- package/build-module/group/variations.js.map +1 -1
- package/build-module/heading/heading-level-dropdown.js +2 -1
- package/build-module/heading/heading-level-dropdown.js.map +1 -1
- package/build-module/heading/index.js +9 -4
- package/build-module/heading/index.js.map +1 -1
- package/build-module/image/deprecated.js +77 -9
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +5 -3
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +18 -8
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +29 -22
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +7 -1
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/save.js +9 -3
- package/build-module/image/save.js.map +1 -1
- package/build-module/index.js +1 -2
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +9 -7
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/list/index.js +1 -1
- package/build-module/list/index.js.map +1 -1
- package/build-module/list/transforms.js +4 -63
- package/build-module/list/transforms.js.map +1 -1
- package/build-module/list/v2/edit.js +15 -5
- package/build-module/list/v2/edit.js.map +1 -1
- package/build-module/list/v2/tag-name.js +21 -0
- package/build-module/list/v2/tag-name.js.map +1 -0
- package/build-module/list/v2/tag-name.native.js +21 -0
- package/build-module/list/v2/tag-name.native.js.map +1 -0
- package/build-module/list/v2/transforms.js +3 -39
- package/build-module/list/v2/transforms.js.map +1 -1
- package/build-module/list-item/edit.js +15 -13
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/edit.native.js +141 -0
- package/build-module/list-item/edit.native.js.map +1 -0
- package/build-module/list-item/hooks/index.js +1 -1
- package/build-module/list-item/hooks/index.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +160 -0
- package/build-module/list-item/hooks/use-merge.js.map +1 -0
- package/build-module/list-item/hooks/use-outdent-list-item.js +82 -46
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/list-item/icons.native.js +37 -0
- package/build-module/list-item/icons.native.js.map +1 -0
- package/build-module/list-item/list-style-type.native.js +124 -0
- package/build-module/list-item/list-style-type.native.js.map +1 -0
- package/build-module/list-item/utils.js +123 -2
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/media-text/deprecated.js +267 -17
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +4 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/media-container.js +1 -1
- package/build-module/media-text/media-container.js.map +1 -1
- package/build-module/media-text/save.js +13 -0
- package/build-module/media-text/save.js.map +1 -1
- package/build-module/more/edit.js +2 -4
- package/build-module/more/edit.js.map +1 -1
- package/build-module/more/save.js +1 -6
- package/build-module/more/save.js.map +1 -1
- package/build-module/navigation/edit/index.js +66 -122
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +12 -15
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +4 -2
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +12 -3
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js +5 -1
- package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
- package/build-module/navigation/edit/use-inner-blocks.js +33 -0
- package/build-module/navigation/edit/use-inner-blocks.js.map +1 -0
- package/build-module/navigation/edit/utils.js +21 -0
- package/build-module/navigation/edit/utils.js.map +1 -0
- package/build-module/navigation/use-navigation-menu.js +7 -3
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation/view.js +7 -4
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +5 -4
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/hooks.js +0 -13
- package/build-module/navigation-link/hooks.js.map +1 -1
- package/build-module/navigation-link/index.js +1 -1
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +2 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/view.js +7 -4
- package/build-module/navigation-submenu/view.js.map +1 -1
- package/build-module/nextpage/edit.js +1 -3
- package/build-module/nextpage/edit.js.map +1 -1
- package/build-module/page-list/edit.js +10 -3
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/paragraph/edit.js +8 -12
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-author/edit.js +5 -2
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author-biography/edit.js +6 -1
- package/build-module/post-author-biography/edit.js.map +1 -1
- package/build-module/post-comments-form/edit.js +5 -44
- package/build-module/post-comments-form/edit.js.map +1 -1
- package/build-module/post-comments-form/form.js +46 -5
- package/build-module/post-comments-form/form.js.map +1 -1
- package/build-module/post-content/edit.js +5 -3
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +17 -3
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +9 -0
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-terms/edit.js +3 -2
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/post-terms/index.js +1 -1
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +1 -0
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +43 -10
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +16 -12
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/index.js +1 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query-no-results/edit.js +2 -2
- package/build-module/query-no-results/edit.js.map +1 -1
- package/build-module/query-pagination-next/edit.js +2 -1
- package/build-module/query-pagination-next/edit.js.map +1 -1
- package/build-module/query-pagination-previous/edit.js +2 -1
- package/build-module/query-pagination-previous/edit.js.map +1 -1
- package/build-module/query-title/edit.js +20 -8
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/query-title/index.js +4 -0
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/query-title/variations.js +10 -0
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/quote/deprecated.js +162 -36
- package/build-module/quote/deprecated.js.map +1 -1
- package/build-module/quote/edit.js +77 -43
- package/build-module/quote/edit.js.map +1 -1
- package/build-module/quote/index.js +9 -39
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/save.js +4 -8
- package/build-module/quote/save.js.map +1 -1
- package/build-module/quote/transforms.js +111 -158
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/separator/edit.js +1 -1
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +5 -13
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-title/edit/level-toolbar.js +2 -1
- package/build-module/site-title/edit/level-toolbar.js.map +1 -1
- package/build-module/social-link/icons/index.js +1 -0
- package/build-module/social-link/icons/index.js.map +1 -1
- package/build-module/social-link/icons/whatsapp.js +15 -0
- package/build-module/social-link/icons/whatsapp.js.map +1 -0
- package/build-module/social-link/variations.js +8 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/social-links/edit.js +1 -0
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +24 -13
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +33 -15
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/template-part/edit/utils/search.js +84 -0
- package/build-module/template-part/edit/utils/search.js.map +1 -0
- package/build-module/template-part/index.js +1 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/template-part/variations.js +0 -13
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +5 -2
- package/build-module/utils/clean-empty-object.js.map +1 -1
- package/build-module/video/tracks-editor.js +9 -11
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/button/style-rtl.css +1 -1
- package/build-style/button/style.css +1 -1
- package/build-style/comment-template/style-rtl.css +12 -0
- package/build-style/comment-template/style.css +12 -0
- package/build-style/comments/editor-rtl.css +122 -0
- package/build-style/comments/editor.css +122 -0
- package/build-style/{post-comments → comments}/style-rtl.css +1 -0
- package/build-style/{post-comments → comments}/style.css +1 -0
- package/build-style/common-rtl.css +7 -0
- package/build-style/common.css +7 -0
- package/build-style/cover/style-rtl.css +2 -2
- package/build-style/cover/style.css +2 -2
- package/build-style/editor-elements-rtl.css +85 -0
- package/build-style/editor-elements.css +85 -0
- package/build-style/editor-rtl.css +162 -11
- package/build-style/editor.css +162 -11
- package/build-style/{post-comments/editor-rtl.css → elements-rtl.css} +5 -2
- package/build-style/{post-comments/editor.css → elements.css} +5 -2
- package/build-style/gallery/style-rtl.css +7 -2
- package/build-style/gallery/style.css +7 -2
- package/build-style/image/editor-rtl.css +4 -3
- package/build-style/image/editor.css +4 -3
- package/build-style/image/style-rtl.css +33 -3
- package/build-style/image/style.css +33 -3
- package/build-style/latest-posts/editor-rtl.css +3 -0
- package/build-style/latest-posts/editor.css +3 -0
- package/build-style/navigation/style-rtl.css +17 -19
- package/build-style/navigation/style.css +17 -19
- package/build-style/post-comments-form/style-rtl.css +0 -1
- package/build-style/post-comments-form/style.css +0 -1
- package/build-style/query/editor-rtl.css +8 -1
- package/build-style/query/editor.css +8 -1
- package/build-style/query-pagination/style-rtl.css +6 -0
- package/build-style/query-pagination/style.css +6 -0
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/search/theme-rtl.css +5 -0
- package/build-style/search/theme.css +5 -0
- package/build-style/social-link/editor-rtl.css +1 -0
- package/build-style/social-link/editor.css +1 -0
- package/build-style/social-links/style-rtl.css +8 -0
- package/build-style/social-links/style.css +8 -0
- package/build-style/style-rtl.css +208 -139
- package/build-style/style.css +208 -139
- package/build-style/tag-cloud/style-rtl.css +1 -0
- package/build-style/tag-cloud/style.css +1 -0
- package/build-style/template-part/editor-rtl.css +14 -3
- package/build-style/template-part/editor.css +14 -3
- package/build-style/theme-rtl.css +5 -0
- package/build-style/theme.css +5 -0
- package/package.json +28 -29
- package/src/archives/block.json +4 -0
- package/src/archives/edit.js +12 -1
- package/src/archives/index.php +5 -3
- package/src/audio/test/__snapshots__/edit.native.js.snap +16 -2
- package/src/block/edit.js +4 -4
- package/src/block/edit.native.js +4 -4
- package/src/button/edit.js +1 -0
- package/src/button/style.scss +3 -1
- package/src/buttons/edit.js +1 -5
- package/src/calendar/edit.js +11 -4
- package/src/columns/edit.native.js +5 -3
- package/src/comment-template/block.json +1 -1
- package/src/comment-template/style.scss +14 -0
- package/src/comments/block.json +7 -2
- package/src/comments/deprecated.js +53 -0
- package/src/comments/edit/comments-legacy.js +71 -0
- package/src/comments/edit/index.js +35 -0
- package/src/comments/edit/placeholder.js +124 -0
- package/src/comments/{edit.js → edit/template.js} +1 -28
- package/src/comments/editor.scss +9 -0
- package/src/comments/index.js +2 -0
- package/src/comments/index.php +219 -0
- package/src/comments/save.js +8 -7
- package/src/{post-comments → comments}/style.scss +7 -0
- package/src/comments-pagination/block.json +1 -1
- package/src/comments-title/block.json +1 -1
- package/src/common.scss +2 -0
- package/src/cover/edit/block-controls.js +4 -20
- package/src/cover/edit/cover-placeholder.js +2 -0
- package/src/cover/edit/index.js +16 -0
- package/src/cover/edit/resizable-cover.js +6 -0
- package/src/cover/index.php +2 -2
- package/src/cover/style.scss +2 -2
- package/src/cover/transforms.js +2 -2
- package/src/editor-elements.scss +10 -0
- package/src/editor.scss +2 -1
- package/src/elements.scss +6 -0
- package/src/embed/embed-placeholder.native.js +2 -3
- package/src/file/test/__snapshots__/edit.native.js.snap +32 -4
- package/src/gallery/edit.js +12 -23
- package/src/gallery/index.php +1 -1
- package/src/gallery/style.scss +10 -1
- package/src/gallery/transforms.js +25 -10
- package/src/gallery/use-get-media.js +11 -28
- package/src/gallery/use-get-media.native.js +44 -0
- package/src/group/block.json +1 -0
- package/src/group/edit.js +1 -3
- package/src/group/transforms.js +7 -0
- package/src/group/variations.js +2 -2
- package/src/heading/heading-level-dropdown.js +1 -0
- package/src/heading/index.js +8 -2
- package/src/home-link/index.php +8 -17
- package/src/image/block.json +7 -1
- package/src/image/deprecated.js +86 -0
- package/src/image/edit.js +6 -1
- package/src/image/edit.native.js +18 -7
- package/src/image/editor.scss +9 -4
- package/src/image/image.js +26 -16
- package/src/image/save.js +10 -1
- package/src/image/style.scss +39 -3
- package/src/image/test/edit.native.js +6 -10
- package/src/index.js +0 -2
- package/src/index.native.js +11 -7
- package/src/latest-posts/edit.js +2 -6
- package/src/latest-posts/editor.scss +5 -0
- package/src/list/index.js +1 -1
- package/src/list/test/__snapshots__/edit.native.js.snap +133 -0
- package/src/list/test/edit.native.js +511 -7
- package/src/list/transforms.js +0 -47
- package/src/list/v2/edit.js +12 -4
- package/src/list/v2/tag-name.js +13 -0
- package/src/list/v2/tag-name.native.js +12 -0
- package/src/list/v2/transforms.js +3 -49
- package/src/list-item/edit.js +11 -13
- package/src/list-item/edit.native.js +148 -0
- package/src/list-item/hooks/index.js +1 -1
- package/src/list-item/hooks/use-merge.js +141 -0
- package/src/list-item/hooks/use-outdent-list-item.js +72 -74
- package/src/list-item/icons.native.js +34 -0
- package/src/list-item/list-style-type.native.js +139 -0
- package/src/list-item/style.native.scss +45 -0
- package/src/list-item/utils.js +27 -3
- package/src/media-text/deprecated.js +581 -288
- package/src/media-text/edit.js +3 -1
- package/src/media-text/media-container.js +3 -1
- package/src/media-text/save.js +18 -0
- package/src/media-text/test/media-container.js +24 -0
- package/src/more/edit.js +9 -11
- package/src/more/save.js +3 -6
- package/src/navigation/edit/index.js +83 -164
- package/src/navigation/edit/navigation-menu-selector.js +12 -26
- package/src/navigation/edit/placeholder/index.js +4 -2
- package/src/navigation/edit/responsive-wrapper.js +24 -3
- package/src/navigation/edit/use-create-navigation-menu.js +4 -0
- package/src/navigation/edit/use-inner-blocks.js +39 -0
- package/src/navigation/edit/utils.js +30 -0
- package/src/navigation/index.php +6 -0
- package/src/navigation/style.scss +13 -23
- package/src/navigation/use-navigation-menu.js +9 -5
- package/src/navigation/view.js +6 -6
- package/src/navigation-link/edit.js +4 -3
- package/src/navigation-link/hooks.js +0 -14
- package/src/navigation-link/index.js +1 -1
- package/src/navigation-link/index.php +1 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +0 -93
- package/src/navigation-link/test/hooks.js +0 -12
- package/src/navigation-submenu/edit.js +1 -0
- package/src/navigation-submenu/index.php +1 -1
- package/src/navigation-submenu/view.js +6 -6
- package/src/nextpage/edit.js +1 -3
- package/src/page-list/edit.js +12 -5
- package/src/page-list/index.php +4 -4
- package/src/paragraph/edit.js +8 -14
- package/src/post-author/edit.js +6 -3
- package/src/post-author-biography/edit.js +4 -1
- package/src/post-comments-form/edit.js +2 -74
- package/src/post-comments-form/form.js +80 -5
- package/src/post-comments-form/index.php +1 -1
- package/src/post-comments-form/style.scss +0 -1
- package/src/post-content/edit.js +4 -4
- package/src/post-featured-image/block.json +9 -0
- package/src/post-featured-image/edit.js +23 -1
- package/src/post-featured-image/index.php +3 -1
- package/src/post-template/index.php +8 -14
- package/src/post-terms/edit.js +3 -2
- package/src/post-terms/index.js +1 -1
- package/src/post-title/block.json +1 -0
- package/src/post-title/index.php +2 -1
- package/src/preformatted/test/__snapshots__/edit.native.js.snap +16 -2
- package/src/query/edit/inspector-controls/index.js +129 -65
- package/src/query/edit/inspector-controls/taxonomy-controls.js +17 -10
- package/src/query/editor.scss +10 -1
- package/src/query/index.js +1 -1
- package/src/query-no-results/edit.js +2 -5
- package/src/query-no-results/index.php +10 -8
- package/src/query-pagination/style.scss +14 -0
- package/src/query-pagination-next/edit.js +1 -0
- package/src/query-pagination-previous/edit.js +1 -0
- package/src/query-title/block.json +4 -0
- package/src/query-title/edit.js +33 -6
- package/src/query-title/index.php +17 -1
- package/src/query-title/variations.js +13 -0
- package/src/quote/deprecated.js +213 -99
- package/src/quote/edit.js +77 -52
- package/src/quote/index.js +10 -33
- package/src/quote/save.js +5 -5
- package/src/quote/{v2/test → test}/migrate.js +2 -7
- package/src/quote/transforms.js +113 -147
- package/src/search/style.scss +2 -0
- package/src/search/test/__snapshots__/edit.native.js.snap +56 -7
- package/src/search/theme.scss +5 -0
- package/src/separator/edit.js +1 -1
- package/src/separator/test/edit.js +5 -3
- package/src/site-logo/edit.js +2 -11
- package/src/site-title/edit/level-toolbar.js +1 -0
- package/src/site-title/index.php +8 -9
- package/src/social-link/editor.scss +3 -0
- package/src/social-link/icons/index.js +1 -0
- package/src/social-link/icons/whatsapp.js +10 -0
- package/src/social-link/index.php +21 -1
- package/src/social-link/socials-with-bg.scss +5 -0
- package/src/social-link/socials-without-bg.scss +5 -0
- package/src/social-link/variations.js +7 -0
- package/src/social-links/edit.js +1 -0
- package/src/style.scss +1 -1
- package/src/tag-cloud/style.scss +1 -0
- package/src/template-part/edit/index.js +40 -27
- package/src/template-part/edit/selection-modal.js +68 -40
- package/src/template-part/edit/utils/search.js +76 -0
- package/src/template-part/editor.scss +21 -9
- package/src/template-part/index.js +1 -1
- package/src/template-part/index.php +56 -2
- package/src/template-part/variations.js +0 -11
- package/src/utils/clean-empty-object.js +8 -2
- package/src/video/tracks-editor.js +1 -1
- package/build/comments/edit.js.map +0 -1
- package/build/gallery/use-short-code-transform.js +0 -64
- package/build/gallery/use-short-code-transform.js.map +0 -1
- package/build/list-item/hooks/use-backspace.js +0 -59
- package/build/list-item/hooks/use-backspace.js.map +0 -1
- package/build/navigation-link/fallback-variations.js +0 -75
- package/build/navigation-link/fallback-variations.js.map +0 -1
- package/build/post-comments/edit.js +0 -184
- package/build/post-comments/edit.js.map +0 -1
- package/build/post-comments/index.js +0 -72
- package/build/post-comments/index.js.map +0 -1
- package/build/quote/v2/deprecated.js +0 -133
- package/build/quote/v2/deprecated.js.map +0 -1
- package/build/quote/v2/edit.js +0 -139
- package/build/quote/v2/edit.js.map +0 -1
- package/build/quote/v2/index.js +0 -49
- package/build/quote/v2/index.js.map +0 -1
- package/build/quote/v2/save.js +0 -43
- package/build/quote/v2/save.js.map +0 -1
- package/build/quote/v2/transforms.js +0 -156
- package/build/quote/v2/transforms.js.map +0 -1
- package/build/template-part/fallback-variations.js +0 -59
- package/build/template-part/fallback-variations.js.map +0 -1
- package/build-module/comments/edit.js +0 -59
- package/build-module/comments/edit.js.map +0 -1
- package/build-module/gallery/use-short-code-transform.js +0 -54
- package/build-module/gallery/use-short-code-transform.js.map +0 -1
- package/build-module/list-item/hooks/use-backspace.js +0 -44
- package/build-module/list-item/hooks/use-backspace.js.map +0 -1
- package/build-module/navigation-link/fallback-variations.js +0 -65
- package/build-module/navigation-link/fallback-variations.js.map +0 -1
- package/build-module/post-comments/edit.js +0 -171
- package/build-module/post-comments/edit.js.map +0 -1
- package/build-module/post-comments/index.js +0 -59
- package/build-module/post-comments/index.js.map +0 -1
- package/build-module/quote/v2/deprecated.js +0 -116
- package/build-module/quote/v2/deprecated.js.map +0 -1
- package/build-module/quote/v2/edit.js +0 -122
- package/build-module/quote/v2/edit.js.map +0 -1
- package/build-module/quote/v2/index.js +0 -33
- package/build-module/quote/v2/index.js.map +0 -1
- package/build-module/quote/v2/save.js +0 -30
- package/build-module/quote/v2/save.js.map +0 -1
- package/build-module/quote/v2/transforms.js +0 -147
- package/build-module/quote/v2/transforms.js.map +0 -1
- package/build-module/template-part/fallback-variations.js +0 -47
- package/build-module/template-part/fallback-variations.js.map +0 -1
- package/src/gallery/use-short-code-transform.js +0 -55
- package/src/list-item/hooks/use-backspace.js +0 -51
- package/src/navigation-link/fallback-variations.js +0 -65
- package/src/post-comments/block.json +0 -45
- package/src/post-comments/edit.js +0 -247
- package/src/post-comments/editor.scss +0 -3
- package/src/post-comments/index.js +0 -18
- package/src/post-comments/index.php +0 -87
- package/src/quote/v2/deprecated.js +0 -107
- package/src/quote/v2/edit.js +0 -139
- package/src/quote/v2/index.js +0 -36
- package/src/quote/v2/save.js +0 -26
- package/src/quote/v2/transforms.js +0 -155
- package/src/template-part/fallback-variations.js +0 -51
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = useMerge;
|
|
9
|
+
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
|
|
12
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
13
|
+
|
|
14
|
+
var _blocks = require("@wordpress/blocks");
|
|
15
|
+
|
|
16
|
+
var _useOutdentListItem = _interopRequireDefault(require("./use-outdent-list-item"));
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
const {
|
|
26
|
+
name: listItemName
|
|
27
|
+
} = {
|
|
28
|
+
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
29
|
+
apiVersion: 2,
|
|
30
|
+
__experimental: "list-v2",
|
|
31
|
+
name: "core/list-item",
|
|
32
|
+
title: "List item",
|
|
33
|
+
category: "text",
|
|
34
|
+
parent: ["core/list"],
|
|
35
|
+
description: "Create a list item.",
|
|
36
|
+
textdomain: "default",
|
|
37
|
+
attributes: {
|
|
38
|
+
placeholder: {
|
|
39
|
+
type: "string"
|
|
40
|
+
},
|
|
41
|
+
content: {
|
|
42
|
+
type: "string",
|
|
43
|
+
source: "html",
|
|
44
|
+
selector: "li",
|
|
45
|
+
"default": "",
|
|
46
|
+
__experimentalRole: "content"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
supports: {
|
|
50
|
+
className: false,
|
|
51
|
+
__experimentalSelector: "li"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function useMerge(clientId) {
|
|
56
|
+
const registry = (0, _data.useRegistry)();
|
|
57
|
+
const {
|
|
58
|
+
getPreviousBlockClientId,
|
|
59
|
+
getNextBlockClientId,
|
|
60
|
+
getBlockOrder,
|
|
61
|
+
getBlockRootClientId,
|
|
62
|
+
getBlockName,
|
|
63
|
+
getBlock
|
|
64
|
+
} = (0, _data.useSelect)(_blockEditor.store);
|
|
65
|
+
const {
|
|
66
|
+
mergeBlocks,
|
|
67
|
+
moveBlocksToPosition,
|
|
68
|
+
replaceBlock,
|
|
69
|
+
selectBlock
|
|
70
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
71
|
+
const [, outdentListItem] = (0, _useOutdentListItem.default)(clientId);
|
|
72
|
+
|
|
73
|
+
function getTrailingId(id) {
|
|
74
|
+
const order = getBlockOrder(id);
|
|
75
|
+
|
|
76
|
+
if (!order.length) {
|
|
77
|
+
return id;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return getTrailingId(order[order.length - 1]);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function getParentListItemId(id) {
|
|
84
|
+
const listId = getBlockRootClientId(id);
|
|
85
|
+
const parentListItemId = getBlockRootClientId(listId);
|
|
86
|
+
if (!parentListItemId) return;
|
|
87
|
+
if (getBlockName(parentListItemId) !== listItemName) return;
|
|
88
|
+
return parentListItemId;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Return the next list item with respect to the given list item. If none,
|
|
92
|
+
* return the next list item of the parent list item if it exists.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} id A list item client ID.
|
|
95
|
+
* @return {string?} The client ID of the next list item.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
function _getNextId(id) {
|
|
100
|
+
const next = getNextBlockClientId(id);
|
|
101
|
+
if (next) return next;
|
|
102
|
+
const parentListItemId = getParentListItemId(id);
|
|
103
|
+
if (!parentListItemId) return;
|
|
104
|
+
return _getNextId(parentListItemId);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Given a client ID, return the client ID of the list item on the next
|
|
108
|
+
* line, regardless of indentation level.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} id The client ID of the current list item.
|
|
111
|
+
* @return {string?} The client ID of the next list item.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
function getNextId(id) {
|
|
116
|
+
const order = getBlockOrder(id); // If the list item does not have a nested list, return the next list
|
|
117
|
+
// item.
|
|
118
|
+
|
|
119
|
+
if (!order.length) {
|
|
120
|
+
return _getNextId(id);
|
|
121
|
+
} // Get the first list item in the nested list.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
return getBlockOrder(order[0])[0];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function switchToDefaultBlockType(forward) {
|
|
128
|
+
const rootClientId = getBlockRootClientId(clientId);
|
|
129
|
+
const replacement = (0, _blocks.switchToBlockType)(getBlock(rootClientId), (0, _blocks.getDefaultBlockName)());
|
|
130
|
+
const indexToSelect = forward ? replacement.length - 1 : 0;
|
|
131
|
+
const initialPosition = forward ? -1 : 0;
|
|
132
|
+
registry.batch(() => {
|
|
133
|
+
replaceBlock(rootClientId, replacement);
|
|
134
|
+
selectBlock(replacement[indexToSelect].clientId, initialPosition);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return forward => {
|
|
139
|
+
if (forward) {
|
|
140
|
+
const nextBlockClientId = getNextId(clientId);
|
|
141
|
+
|
|
142
|
+
if (!nextBlockClientId) {
|
|
143
|
+
switchToDefaultBlockType(forward);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (getParentListItemId(nextBlockClientId)) {
|
|
148
|
+
outdentListItem(nextBlockClientId);
|
|
149
|
+
} else {
|
|
150
|
+
registry.batch(() => {
|
|
151
|
+
moveBlocksToPosition(getBlockOrder(nextBlockClientId), nextBlockClientId, getPreviousBlockClientId(nextBlockClientId));
|
|
152
|
+
mergeBlocks(clientId, nextBlockClientId);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
// Merging is only done from the top level. For lowel levels, the
|
|
157
|
+
// list item is outdented instead.
|
|
158
|
+
const previousBlockClientId = getPreviousBlockClientId(clientId);
|
|
159
|
+
|
|
160
|
+
if (getParentListItemId(clientId)) {
|
|
161
|
+
outdentListItem(clientId);
|
|
162
|
+
} else if (previousBlockClientId) {
|
|
163
|
+
const trailingId = getTrailingId(previousBlockClientId);
|
|
164
|
+
registry.batch(() => {
|
|
165
|
+
moveBlocksToPosition(getBlockOrder(clientId), clientId, previousBlockClientId);
|
|
166
|
+
mergeBlocks(trailingId, clientId);
|
|
167
|
+
});
|
|
168
|
+
} else {
|
|
169
|
+
switchToDefaultBlockType(forward);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=use-merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/list-item/hooks/use-merge.js"],"names":["useMerge","clientId","registry","getPreviousBlockClientId","getNextBlockClientId","getBlockOrder","getBlockRootClientId","getBlockName","getBlock","blockEditorStore","mergeBlocks","moveBlocksToPosition","replaceBlock","selectBlock","outdentListItem","getTrailingId","id","order","length","getParentListItemId","listId","parentListItemId","listItemName","_getNextId","next","getNextId","switchToDefaultBlockType","forward","rootClientId","replacement","indexToSelect","initialPosition","batch","nextBlockClientId","previousBlockClientId","trailingId"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKe,SAASA,QAAT,CAAmBC,QAAnB,EAA8B;AAC5C,QAAMC,QAAQ,GAAG,wBAAjB;AACA,QAAM;AACLC,IAAAA,wBADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,aAHK;AAILC,IAAAA,oBAJK;AAKLC,IAAAA,YALK;AAMLC,IAAAA;AANK,MAOF,qBAAWC,kBAAX,CAPJ;AAQA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,oBAAf;AAAqCC,IAAAA,YAArC;AAAmDC,IAAAA;AAAnD,MACL,uBAAaJ,kBAAb,CADD;AAEA,QAAM,GAAIK,eAAJ,IAAwB,iCAAoBb,QAApB,CAA9B;;AAEA,WAASc,aAAT,CAAwBC,EAAxB,EAA6B;AAC5B,UAAMC,KAAK,GAAGZ,aAAa,CAAEW,EAAF,CAA3B;;AAEA,QAAK,CAAEC,KAAK,CAACC,MAAb,EAAsB;AACrB,aAAOF,EAAP;AACA;;AAED,WAAOD,aAAa,CAAEE,KAAK,CAAEA,KAAK,CAACC,MAAN,GAAe,CAAjB,CAAP,CAApB;AACA;;AAED,WAASC,mBAAT,CAA8BH,EAA9B,EAAmC;AAClC,UAAMI,MAAM,GAAGd,oBAAoB,CAAEU,EAAF,CAAnC;AACA,UAAMK,gBAAgB,GAAGf,oBAAoB,CAAEc,MAAF,CAA7C;AACA,QAAK,CAAEC,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atch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getDefaultBlockName, switchToBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport useOutdentListItem from './use-outdent-list-item';\n\nimport { name as listItemName } from '../block.json';\n\nexport default function useMerge( clientId ) {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetPreviousBlockClientId,\n\t\tgetNextBlockClientId,\n\t\tgetBlockOrder,\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tgetBlock,\n\t} = useSelect( blockEditorStore );\n\tconst { mergeBlocks, moveBlocksToPosition, replaceBlock, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ , outdentListItem ] = useOutdentListItem( clientId );\n\n\tfunction getTrailingId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn id;\n\t\t}\n\n\t\treturn getTrailingId( order[ order.length - 1 ] );\n\t}\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== listItemName ) return;\n\t\treturn parentListItemId;\n\t}\n\n\t/**\n\t * Return the next list item with respect to the given list item. If none,\n\t * return the next list item of the parent list item if it exists.\n\t *\n\t * @param {string} id A list item client ID.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction _getNextId( id ) {\n\t\tconst next = getNextBlockClientId( id );\n\t\tif ( next ) return next;\n\t\tconst parentListItemId = getParentListItemId( id );\n\t\tif ( ! parentListItemId ) return;\n\t\treturn _getNextId( parentListItemId );\n\t}\n\n\t/**\n\t * Given a client ID, return the client ID of the list item on the next\n\t * line, regardless of indentation level.\n\t *\n\t * @param {string} id The client ID of the current list item.\n\t * @return {string?} The client ID of the next list item.\n\t */\n\tfunction getNextId( id ) {\n\t\tconst order = getBlockOrder( id );\n\n\t\t// If the list item does not have a nested list, return the next list\n\t\t// item.\n\t\tif ( ! order.length ) {\n\t\t\treturn _getNextId( id );\n\t\t}\n\n\t\t// Get the first list item in the nested list.\n\t\treturn getBlockOrder( order[ 0 ] )[ 0 ];\n\t}\n\n\tfunction switchToDefaultBlockType( forward ) {\n\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\tconst replacement = switchToBlockType(\n\t\t\tgetBlock( rootClientId ),\n\t\t\tgetDefaultBlockName()\n\t\t);\n\t\tconst indexToSelect = forward ? replacement.length - 1 : 0;\n\t\tconst initialPosition = forward ? -1 : 0;\n\t\tregistry.batch( () => {\n\t\t\treplaceBlock( rootClientId, replacement );\n\t\t\tselectBlock(\n\t\t\t\treplacement[ indexToSelect ].clientId,\n\t\t\t\tinitialPosition\n\t\t\t);\n\t\t} );\n\t}\n\n\treturn ( forward ) => {\n\t\tif ( forward ) {\n\t\t\tconst nextBlockClientId = getNextId( clientId );\n\n\t\t\tif ( ! nextBlockClientId ) {\n\t\t\t\tswitchToDefaultBlockType( forward );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( getParentListItemId( nextBlockClientId ) ) {\n\t\t\t\toutdentListItem( nextBlockClientId );\n\t\t\t} else {\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( nextBlockClientId ),\n\t\t\t\t\t\tnextBlockClientId,\n\t\t\t\t\t\tgetPreviousBlockClientId( nextBlockClientId )\n\t\t\t\t\t);\n\t\t\t\t\tmergeBlocks( clientId, nextBlockClientId );\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\t\t\t// Merging is only done from the top level. For lowel levels, the\n\t\t\t// list item is outdented instead.\n\t\t\tconst previousBlockClientId = getPreviousBlockClientId( clientId );\n\t\t\tif ( getParentListItemId( clientId ) ) {\n\t\t\t\toutdentListItem( clientId );\n\t\t\t} else if ( previousBlockClientId ) {\n\t\t\t\tconst trailingId = getTrailingId( previousBlockClientId );\n\t\t\t\tregistry.batch( () => {\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tgetBlockOrder( clientId ),\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tpreviousBlockClientId\n\t\t\t\t\t);\n\t\t\t\t\tmergeBlocks( trailingId, clientId );\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tswitchToDefaultBlockType( forward );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
|
|
@@ -15,8 +15,6 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
15
15
|
|
|
16
16
|
var _blocks = require("@wordpress/blocks");
|
|
17
17
|
|
|
18
|
-
var _utils = require("../utils");
|
|
19
|
-
|
|
20
18
|
/**
|
|
21
19
|
* External dependencies
|
|
22
20
|
*/
|
|
@@ -28,7 +26,38 @@ var _utils = require("../utils");
|
|
|
28
26
|
/**
|
|
29
27
|
* Internal dependencies
|
|
30
28
|
*/
|
|
29
|
+
const {
|
|
30
|
+
name: listItemName
|
|
31
|
+
} = {
|
|
32
|
+
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
33
|
+
apiVersion: 2,
|
|
34
|
+
__experimental: "list-v2",
|
|
35
|
+
name: "core/list-item",
|
|
36
|
+
title: "List item",
|
|
37
|
+
category: "text",
|
|
38
|
+
parent: ["core/list"],
|
|
39
|
+
description: "Create a list item.",
|
|
40
|
+
textdomain: "default",
|
|
41
|
+
attributes: {
|
|
42
|
+
placeholder: {
|
|
43
|
+
type: "string"
|
|
44
|
+
},
|
|
45
|
+
content: {
|
|
46
|
+
type: "string",
|
|
47
|
+
source: "html",
|
|
48
|
+
selector: "li",
|
|
49
|
+
"default": "",
|
|
50
|
+
__experimentalRole: "content"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
supports: {
|
|
54
|
+
className: false,
|
|
55
|
+
__experimentalSelector: "li"
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
31
59
|
function useOutdentListItem(clientId) {
|
|
60
|
+
const registry = (0, _data.useRegistry)();
|
|
32
61
|
const {
|
|
33
62
|
canOutdent
|
|
34
63
|
} = (0, _data.useSelect)(innerSelect => {
|
|
@@ -41,58 +70,65 @@ function useOutdentListItem(clientId) {
|
|
|
41
70
|
};
|
|
42
71
|
}, [clientId]);
|
|
43
72
|
const {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
73
|
+
moveBlocksToPosition,
|
|
74
|
+
removeBlock,
|
|
75
|
+
insertBlock,
|
|
76
|
+
updateBlockListSettings
|
|
47
77
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
48
78
|
const {
|
|
49
79
|
getBlockRootClientId,
|
|
50
|
-
|
|
51
|
-
|
|
80
|
+
getBlockName,
|
|
81
|
+
getBlockOrder,
|
|
52
82
|
getBlockIndex,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
getMultiSelectedBlockClientIds
|
|
83
|
+
getSelectedBlockClientIds,
|
|
84
|
+
getBlock,
|
|
85
|
+
getBlockListSettings
|
|
57
86
|
} = (0, _data.useSelect)(_blockEditor.store);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
|
|
88
|
+
function getParentListItemId(id) {
|
|
89
|
+
const listId = getBlockRootClientId(id);
|
|
90
|
+
const parentListItemId = getBlockRootClientId(listId);
|
|
91
|
+
if (!parentListItemId) return;
|
|
92
|
+
if (getBlockName(parentListItemId) !== listItemName) return;
|
|
93
|
+
return parentListItemId;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return [canOutdent, (0, _element.useCallback)(function () {
|
|
97
|
+
let clientIds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getSelectedBlockClientIds();
|
|
98
|
+
clientIds = (0, _lodash.castArray)(clientIds);
|
|
99
|
+
if (!clientIds.length) return;
|
|
100
|
+
const firstClientId = (0, _lodash.first)(clientIds); // Can't outdent if it's not a list item.
|
|
101
|
+
|
|
102
|
+
if (getBlockName(firstClientId) !== listItemName) return;
|
|
103
|
+
const parentListItemId = getParentListItemId(firstClientId); // Can't outdent if it's at the top level.
|
|
104
|
+
|
|
105
|
+
if (!parentListItemId) return;
|
|
106
|
+
const parentListId = getBlockRootClientId(firstClientId);
|
|
107
|
+
const lastClientId = (0, _lodash.last)(clientIds);
|
|
108
|
+
const order = getBlockOrder(parentListId);
|
|
109
|
+
const followingListItems = order.slice(getBlockIndex(lastClientId) + 1);
|
|
110
|
+
registry.batch(() => {
|
|
111
|
+
if (followingListItems.length) {
|
|
112
|
+
let nestedListId = (0, _lodash.first)(getBlockOrder(firstClientId));
|
|
113
|
+
|
|
114
|
+
if (!nestedListId) {
|
|
115
|
+
const nestedListBlock = (0, _blocks.cloneBlock)(getBlock(parentListId), {}, []);
|
|
116
|
+
nestedListId = nestedListBlock.clientId;
|
|
117
|
+
insertBlock(nestedListBlock, 0, firstClientId, false); // Immediately update the block list settings, otherwise
|
|
118
|
+
// blocks can't be moved here due to canInsert checks.
|
|
119
|
+
|
|
120
|
+
updateBlockListSettings(nestedListId, getBlockListSettings(parentListId));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
moveBlocksToPosition(followingListItems, parentListId, nestedListId);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
moveBlocksToPosition(clientIds, parentListId, getBlockRootClientId(parentListItemId), getBlockIndex(parentListItemId) + 1);
|
|
127
|
+
|
|
128
|
+
if (!getBlockOrder(parentListId).length) {
|
|
129
|
+
removeBlock(parentListId);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}, [])];
|
|
97
133
|
}
|
|
98
134
|
//# sourceMappingURL=use-outdent-list-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/list-item/hooks/use-outdent-list-item.js"],"names":["useOutdentListItem","clientId","canOutdent","innerSelect","getBlockRootClientId","blockEditorStore","grandParentId","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/list-item/hooks/use-outdent-list-item.js"],"names":["useOutdentListItem","clientId","registry","canOutdent","innerSelect","getBlockRootClientId","blockEditorStore","grandParentId","moveBlocksToPosition","removeBlock","insertBlock","updateBlockListSettings","getBlockName","getBlockOrder","getBlockIndex","getSelectedBlockClientIds","getBlock","getBlockListSettings","getParentListItemId","id","listId","parentListItemId","listItemName","clientIds","length","firstClientId","parentListId","lastClientId","order","followingListItems","slice","batch","nestedListId","nestedListBlock"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGe,SAASA,kBAAT,CAA6BC,QAA7B,EAAwC;AACtD,QAAMC,QAAQ,GAAG,wBAAjB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBACpBC,WAAF,IAAmB;AAClB,UAAM;AAAEC,MAAAA;AAAF,QAA2BD,WAAW,CAAEE,kBAAF,CAA5C;AACA,UAAMC,aAAa,GAAGF,oBAAoB,CACzCA,oBAAoB,CAAEJ,QAAF,CADqB,CAA1C;AAGA,WAAO;AACNE,MAAAA,UAAU,EAAE,CAAC,CAAEI;AADT,KAAP;AAGA,GATqB,EAUtB,CAAEN,QAAF,CAVsB,CAAvB;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AAgC,CADN,CAA3B;AAIAzB,IAAAA,QAAQ,CAAC6B,KAAT,CAAgB,MAAM;AACrB,UAAKF,kBAAkB,CAACL,MAAxB,EAAiC;AAChC,YAAIQ,YAAY,GAAG,mBAAOnB,aAAa,CAAEY,aAAF,CAApB,CAAnB;;AAEA,YAAK,CAAEO,YAAP,EAAsB;AACrB,gBAAMC,eAAe,GAAG,wBACvBjB,QAAQ,CAAEU,YAAF,CADe,EAEvB,EAFuB,EAGvB,EAHuB,CAAxB;AAKAM,UAAAA,YAAY,GAAGC,eAAe,CAAChC,QAA/B;AACAS,UAAAA,WAAW,CAAEuB,eAAF,EAAmB,CAAnB,EAAsBR,aAAtB,EAAqC,KAArC,CAAX,CAPqB,CAQrB;AACA;;AACAd,UAAAA,uBAAuB,CACtBqB,YADsB,EAEtBf,oBAAoB,CAAES,YAAF,CAFE,CAAvB;AAIA;;AAEDlB,QAAAA,oBAAoB,CACnBqB,kBADmB,EAEnBH,YAFmB,EAGnBM,YAHmB,CAApB;AAKA;;AACDxB,MAAAA,oBAAoB,CACnBe,SADmB,EAEnBG,YAFmB,EAGnBrB,oBAAoB,CAAEgB,gBAAF,CAHD,EAInBP,aAAa,CAAEO,gBAAF,CAAb,GAAoC,CAJjB,CAApB;;AAMA,UAAK,CAAER,aAAa,CAAEa,YAAF,CAAb,CAA8BF,MAArC,EAA8C;AAC7Cf,QAAAA,WAAW,CAAEiB,YAAF,CAAX;AACA;AACD,KAnCD;AAoCA,GA1DD,EA0DG,EA1DH,CAFM,CAAP;AA8DA","sourcesContent":["/**\n * External dependencies\n */\nimport { first, last, castArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback } from '@wordpress/element';\nimport { useSelect, useDispatch, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { cloneBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { name as listItemName } from '../block.json';\n\nexport default function useOutdentListItem( clientId ) {\n\tconst registry = useRegistry();\n\tconst { canOutdent } = useSelect(\n\t\t( innerSelect ) => {\n\t\t\tconst { getBlockRootClientId } = innerSelect( blockEditorStore );\n\t\t\tconst grandParentId = getBlockRootClientId(\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tcanOutdent: !! grandParentId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst {\n\t\tmoveBlocksToPosition,\n\t\tremoveBlock,\n\t\tinsertBlock,\n\t\tupdateBlockListSettings,\n\t} = useDispatch( blockEditorStore );\n\tconst {\n\t\tgetBlockRootClientId,\n\t\tgetBlockName,\n\t\tgetBlockOrder,\n\t\tgetBlockIndex,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlock,\n\t\tgetBlockListSettings,\n\t} = useSelect( blockEditorStore );\n\n\tfunction getParentListItemId( id ) {\n\t\tconst listId = getBlockRootClientId( id );\n\t\tconst parentListItemId = getBlockRootClientId( listId );\n\t\tif ( ! parentListItemId ) return;\n\t\tif ( getBlockName( parentListItemId ) !== listItemName ) return;\n\t\treturn parentListItemId;\n\t}\n\n\treturn [\n\t\tcanOutdent,\n\t\tuseCallback( ( clientIds = getSelectedBlockClientIds() ) => {\n\t\t\tclientIds = castArray( clientIds );\n\n\t\t\tif ( ! clientIds.length ) return;\n\n\t\t\tconst firstClientId = first( clientIds );\n\n\t\t\t// Can't outdent if it's not a list item.\n\t\t\tif ( getBlockName( firstClientId ) !== listItemName ) return;\n\n\t\t\tconst parentListItemId = getParentListItemId( firstClientId );\n\n\t\t\t// Can't outdent if it's at the top level.\n\t\t\tif ( ! parentListItemId ) return;\n\n\t\t\tconst parentListId = getBlockRootClientId( firstClientId );\n\t\t\tconst lastClientId = last( clientIds );\n\t\t\tconst order = getBlockOrder( parentListId );\n\t\t\tconst followingListItems = order.slice(\n\t\t\t\tgetBlockIndex( lastClientId ) + 1\n\t\t\t);\n\n\t\t\tregistry.batch( () => {\n\t\t\t\tif ( followingListItems.length ) {\n\t\t\t\t\tlet nestedListId = first( getBlockOrder( firstClientId ) );\n\n\t\t\t\t\tif ( ! nestedListId ) {\n\t\t\t\t\t\tconst nestedListBlock = cloneBlock(\n\t\t\t\t\t\t\tgetBlock( parentListId ),\n\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\tnestedListId = nestedListBlock.clientId;\n\t\t\t\t\t\tinsertBlock( nestedListBlock, 0, firstClientId, false );\n\t\t\t\t\t\t// Immediately update the block list settings, otherwise\n\t\t\t\t\t\t// blocks can't be moved here due to canInsert checks.\n\t\t\t\t\t\tupdateBlockListSettings(\n\t\t\t\t\t\t\tnestedListId,\n\t\t\t\t\t\t\tgetBlockListSettings( parentListId )\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\tfollowingListItems,\n\t\t\t\t\t\tparentListId,\n\t\t\t\t\t\tnestedListId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\tclientIds,\n\t\t\t\t\tparentListId,\n\t\t\t\t\tgetBlockRootClientId( parentListItemId ),\n\t\t\t\t\tgetBlockIndex( parentListItemId ) + 1\n\t\t\t\t);\n\t\t\t\tif ( ! getBlockOrder( parentListId ).length ) {\n\t\t\t\t\tremoveBlock( parentListId );\n\t\t\t\t}\n\t\t\t} );\n\t\t}, [] ),\n\t];\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.square = exports.circleOutline = exports.circle = void 0;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
const circle = (size, color) => (0, _element.createElement)(_components.SVG, {
|
|
16
|
+
fill: "none",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
18
|
+
}, (0, _element.createElement)(_components.Rect, {
|
|
19
|
+
width: size,
|
|
20
|
+
height: size,
|
|
21
|
+
rx: size / 2,
|
|
22
|
+
fill: color
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
exports.circle = circle;
|
|
26
|
+
|
|
27
|
+
const circleOutline = (size, color) => (0, _element.createElement)(_components.SVG, {
|
|
28
|
+
width: size,
|
|
29
|
+
height: size,
|
|
30
|
+
fill: "none",
|
|
31
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
32
|
+
}, (0, _element.createElement)(_components.Rect, {
|
|
33
|
+
x: "0.5",
|
|
34
|
+
y: "0.5",
|
|
35
|
+
width: size - 1,
|
|
36
|
+
height: size - 1,
|
|
37
|
+
rx: size / 2,
|
|
38
|
+
stroke: color
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
exports.circleOutline = circleOutline;
|
|
42
|
+
|
|
43
|
+
const square = (size, color) => (0, _element.createElement)(_components.SVG, {
|
|
44
|
+
fill: "none",
|
|
45
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
46
|
+
}, (0, _element.createElement)(_components.Rect, {
|
|
47
|
+
width: size,
|
|
48
|
+
height: size,
|
|
49
|
+
fill: color
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
exports.square = square;
|
|
53
|
+
//# sourceMappingURL=icons.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/list-item/icons.native.js"],"names":["circle","size","color","circleOutline","square"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,MAAM,GAAG,CAAEC,IAAF,EAAQC,KAAR,KACrB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC;AAAvB,GACC,4BAAC,gBAAD;AAAM,EAAA,KAAK,EAAGD,IAAd;AAAqB,EAAA,MAAM,EAAGA,IAA9B;AAAqC,EAAA,EAAE,EAAGA,IAAI,GAAG,CAAjD;AAAqD,EAAA,IAAI,EAAGC;AAA5D,EADD,CADM;;;;AAMA,MAAMC,aAAa,GAAG,CAAEF,IAAF,EAAQC,KAAR,KAC5B,4BAAC,eAAD;AACC,EAAA,KAAK,EAAGD,IADT;AAEC,EAAA,MAAM,EAAGA,IAFV;AAGC,EAAA,IAAI,EAAC,MAHN;AAIC,EAAA,KAAK,EAAC;AAJP,GAMC,4BAAC,gBAAD;AACC,EAAA,CAAC,EAAC,KADH;AAEC,EAAA,CAAC,EAAC,KAFH;AAGC,EAAA,KAAK,EAAGA,IAAI,GAAG,CAHhB;AAIC,EAAA,MAAM,EAAGA,IAAI,GAAG,CAJjB;AAKC,EAAA,EAAE,EAAGA,IAAI,GAAG,CALb;AAMC,EAAA,MAAM,EAAGC;AANV,EAND,CADM;;;;AAkBA,MAAME,MAAM,GAAG,CAAEH,IAAF,EAAQC,KAAR,KACrB,4BAAC,eAAD;AAAK,EAAA,IAAI,EAAC,MAAV;AAAiB,EAAA,KAAK,EAAC;AAAvB,GACC,4BAAC,gBAAD;AAAM,EAAA,KAAK,EAAGD,IAAd;AAAqB,EAAA,MAAM,EAAGA,IAA9B;AAAqC,EAAA,IAAI,EAAGC;AAA5C,EADD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SVG, Rect } from '@wordpress/components';\n\nexport const circle = ( size, color ) => (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Rect width={ size } height={ size } rx={ size / 2 } fill={ color } />\n\t</SVG>\n);\n\nexport const circleOutline = ( size, color ) => (\n\t<SVG\n\t\twidth={ size }\n\t\theight={ size }\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t>\n\t\t<Rect\n\t\t\tx=\"0.5\"\n\t\t\ty=\"0.5\"\n\t\t\twidth={ size - 1 }\n\t\t\theight={ size - 1 }\n\t\t\trx={ size / 2 }\n\t\t\tstroke={ color }\n\t\t/>\n\t</SVG>\n);\n\nexport const square = ( size, color ) => (\n\t<SVG fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<Rect width={ size } height={ size } fill={ color } />\n\t</SVG>\n);\n"]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = ListStyleType;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _reactNative = require("react-native");
|
|
13
|
+
|
|
14
|
+
var _components = require("@wordpress/components");
|
|
15
|
+
|
|
16
|
+
var _style = _interopRequireDefault(require("./style.scss"));
|
|
17
|
+
|
|
18
|
+
var _icons = require("./icons");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* External dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* WordPress dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Internal dependencies
|
|
30
|
+
*/
|
|
31
|
+
const DEFAULT_ICON_SIZE = 6;
|
|
32
|
+
|
|
33
|
+
function getListNumberIndex(start, blockIndex, reversed, numberOfListItems) {
|
|
34
|
+
if (start) {
|
|
35
|
+
return reversed ? numberOfListItems - 1 + start - blockIndex : start + blockIndex;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (reversed) {
|
|
39
|
+
return numberOfListItems - blockIndex;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return blockIndex + 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function OrderedList(_ref) {
|
|
46
|
+
let {
|
|
47
|
+
blockIndex,
|
|
48
|
+
color,
|
|
49
|
+
fontSize,
|
|
50
|
+
numberOfListItems,
|
|
51
|
+
reversed,
|
|
52
|
+
start,
|
|
53
|
+
style
|
|
54
|
+
} = _ref;
|
|
55
|
+
const orderedStyles = [_style.default['wp-block-list-item__list-item-container--ordered'], _element.Platform.isIOS && _style.default['wp-block-list-item__list-item-ordered--default'], _element.Platform.isIOS && (style === null || style === void 0 ? void 0 : style.fontSize) && _style.default['wp-block-list-item__list-item-ordered--custom']];
|
|
56
|
+
const numberStyle = [{
|
|
57
|
+
fontSize,
|
|
58
|
+
color
|
|
59
|
+
}];
|
|
60
|
+
const currentIndex = getListNumberIndex(start, blockIndex, reversed, numberOfListItems);
|
|
61
|
+
return (0, _element.createElement)(_reactNative.View, {
|
|
62
|
+
style: orderedStyles
|
|
63
|
+
}, (0, _element.createElement)(_reactNative.Text, {
|
|
64
|
+
style: numberStyle
|
|
65
|
+
}, currentIndex, "."));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function IconList(_ref2) {
|
|
69
|
+
let {
|
|
70
|
+
fontSize,
|
|
71
|
+
color,
|
|
72
|
+
defaultFontSize,
|
|
73
|
+
indentationLevel
|
|
74
|
+
} = _ref2;
|
|
75
|
+
const iconSize = parseInt(fontSize * DEFAULT_ICON_SIZE / defaultFontSize, 10);
|
|
76
|
+
let listIcon = (0, _icons.circle)(iconSize, color);
|
|
77
|
+
|
|
78
|
+
if (indentationLevel === 1) {
|
|
79
|
+
listIcon = (0, _icons.circleOutline)(iconSize, color);
|
|
80
|
+
} else if (indentationLevel > 1) {
|
|
81
|
+
listIcon = (0, _icons.square)(iconSize, color);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const listStyles = [_style.default['wp-block-list-item__list-item-container'], {
|
|
85
|
+
marginTop: fontSize / 2
|
|
86
|
+
}];
|
|
87
|
+
return (0, _element.createElement)(_reactNative.View, {
|
|
88
|
+
style: listStyles
|
|
89
|
+
}, (0, _element.createElement)(_components.Icon, {
|
|
90
|
+
icon: listIcon,
|
|
91
|
+
size: iconSize
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function ListStyleType(_ref3) {
|
|
96
|
+
var _style$baseColors, _style$baseColors$typ, _style$baseColors2, _style$baseColors2$co;
|
|
97
|
+
|
|
98
|
+
let {
|
|
99
|
+
blockIndex,
|
|
100
|
+
indentationLevel,
|
|
101
|
+
numberOfListItems,
|
|
102
|
+
ordered,
|
|
103
|
+
reversed,
|
|
104
|
+
start,
|
|
105
|
+
style
|
|
106
|
+
} = _ref3;
|
|
107
|
+
let defaultFontSize = _style.default['wp-block-list-item__list-item--default'].fontSize;
|
|
108
|
+
|
|
109
|
+
if (style !== null && style !== void 0 && (_style$baseColors = style.baseColors) !== null && _style$baseColors !== void 0 && (_style$baseColors$typ = _style$baseColors.typography) !== null && _style$baseColors$typ !== void 0 && _style$baseColors$typ.fontSize) {
|
|
110
|
+
defaultFontSize = parseInt(style.baseColors.typography.fontSize, 10);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const fontSize = parseInt(style !== null && style !== void 0 && style.fontSize ? style.fontSize : defaultFontSize, 10);
|
|
114
|
+
const defaultColor = style !== null && style !== void 0 && (_style$baseColors2 = style.baseColors) !== null && _style$baseColors2 !== void 0 && (_style$baseColors2$co = _style$baseColors2.color) !== null && _style$baseColors2$co !== void 0 && _style$baseColors2$co.text ? style.baseColors.color.text : _style.default['wp-block-list-item__list-item--default'].color;
|
|
115
|
+
const color = style !== null && style !== void 0 && style.color ? style.color : defaultColor;
|
|
116
|
+
|
|
117
|
+
if (ordered) {
|
|
118
|
+
return (0, _element.createElement)(OrderedList, {
|
|
119
|
+
blockIndex: blockIndex,
|
|
120
|
+
color: color,
|
|
121
|
+
fontSize: fontSize,
|
|
122
|
+
numberOfListItems: numberOfListItems,
|
|
123
|
+
reversed: reversed,
|
|
124
|
+
start: start,
|
|
125
|
+
style: style
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return (0, _element.createElement)(IconList, {
|
|
130
|
+
color: color,
|
|
131
|
+
defaultFontSize: defaultFontSize,
|
|
132
|
+
fontSize: fontSize,
|
|
133
|
+
indentationLevel: indentationLevel
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=list-style-type.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/list-item/list-style-type.native.js"],"names":["DEFAULT_ICON_SIZE","getListNumberIndex","start","blockIndex","reversed","numberOfListItems","OrderedList","color","fontSize","style","orderedStyles","styles","Platform","isIOS","numberStyle","currentIndex","IconList","defaultFontSize","indentationLevel","iconSize","parseInt","listIcon","listStyles","marginTop","ListStyleType","ordered","baseColors","typography","defaultColor","text"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAMA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG,CAA1B;;AAEA,SAASC,kBAAT,CAA6BC,KAA7B,EAAoCC,UAApC,EAAgDC,QAAhD,EAA0DC,iBAA1D,EAA8E;AAC7E,MAAKH,KAAL,EAAa;AACZ,WAAOE,QAAQ,GACZC,iBAAiB,GAAG,CAApB,GAAwBH,KAAxB,GAAgCC,UADpB,GAEZD,KAAK,GAAGC,UAFX;AAGA;;AAED,MAAKC,QAAL,EAAgB;AACf,WAAOC,iBAAiB,GAAGF,UAA3B;AACA;;AAED,SAAOA,UAAU,GAAG,CAApB;AACA;;AAED,SAASG,WAAT,OAQI;AAAA,MARkB;AACrBH,IAAAA,UADqB;AAErBI,IAAAA,KAFqB;AAGrBC,IAAAA,QAHqB;AAIrBH,IAAAA,iBAJqB;AAKrBD,IAAAA,QALqB;AAMrBF,IAAAA,KANqB;AAOrBO,IAAAA;AAPqB,GAQlB;AACH,QAAMC,aAAa,GAAG,CACrBC,eAAQ,k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A,iBAAiB,EAAGH,iBAJrB;AAKC,MAAA,QAAQ,EAAGD,QALZ;AAMC,MAAA,KAAK,EAAGF,KANT;AAOC,MAAA,KAAK,EAAGO;AAPT,MADD;AAWA;;AAED,SACC,4BAAC,QAAD;AACC,IAAA,KAAK,EAAGF,KADT;AAEC,IAAA,eAAe,EAAGU,eAFnB;AAGC,IAAA,QAAQ,EAAGT,QAHZ;AAIC,IAAA,gBAAgB,EAAGU;AAJpB,IADD;AAQA","sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\nimport { circle, circleOutline, square } from './icons';\n\nconst DEFAULT_ICON_SIZE = 6;\n\nfunction getListNumberIndex( start, blockIndex, reversed, numberOfListItems ) {\n\tif ( start ) {\n\t\treturn reversed\n\t\t\t? numberOfListItems - 1 + start - blockIndex\n\t\t\t: start + blockIndex;\n\t}\n\n\tif ( reversed ) {\n\t\treturn numberOfListItems - blockIndex;\n\t}\n\n\treturn blockIndex + 1;\n}\n\nfunction OrderedList( {\n\tblockIndex,\n\tcolor,\n\tfontSize,\n\tnumberOfListItems,\n\treversed,\n\tstart,\n\tstyle,\n} ) {\n\tconst orderedStyles = [\n\t\tstyles[ 'wp-block-list-item__list-item-container--ordered' ],\n\t\tPlatform.isIOS &&\n\t\t\tstyles[ 'wp-block-list-item__list-item-ordered--default' ],\n\t\tPlatform.isIOS &&\n\t\t\tstyle?.fontSize &&\n\t\t\tstyles[ 'wp-block-list-item__list-item-ordered--custom' ],\n\t];\n\tconst numberStyle = [ { fontSize, color } ];\n\n\tconst currentIndex = getListNumberIndex(\n\t\tstart,\n\t\tblockIndex,\n\t\treversed,\n\t\tnumberOfListItems\n\t);\n\n\treturn (\n\t\t<View style={ orderedStyles }>\n\t\t\t<Text style={ numberStyle }>{ currentIndex }.</Text>\n\t\t</View>\n\t);\n}\n\nfunction IconList( { fontSize, color, defaultFontSize, indentationLevel } ) {\n\tconst iconSize = parseInt(\n\t\t( fontSize * DEFAULT_ICON_SIZE ) / defaultFontSize,\n\t\t10\n\t);\n\n\tlet listIcon = circle( iconSize, color );\n\tif ( indentationLevel === 1 ) {\n\t\tlistIcon = circleOutline( iconSize, color );\n\t} else if ( indentationLevel > 1 ) {\n\t\tlistIcon = square( iconSize, color );\n\t}\n\n\tconst listStyles = [\n\t\tstyles[ 'wp-block-list-item__list-item-container' ],\n\t\t{ marginTop: fontSize / 2 },\n\t];\n\n\treturn (\n\t\t<View style={ listStyles }>\n\t\t\t<Icon icon={ listIcon } size={ iconSize } />\n\t\t</View>\n\t);\n}\n\nexport default function ListStyleType( {\n\tblockIndex,\n\tindentationLevel,\n\tnumberOfListItems,\n\tordered,\n\treversed,\n\tstart,\n\tstyle,\n} ) {\n\tlet defaultFontSize =\n\t\tstyles[ 'wp-block-list-item__list-item--default' ].fontSize;\n\n\tif ( style?.baseColors?.typography?.fontSize ) {\n\t\tdefaultFontSize = parseInt( style.baseColors.typography.fontSize, 10 );\n\t}\n\n\tconst fontSize = parseInt(\n\t\tstyle?.fontSize ? style.fontSize : defaultFontSize,\n\t\t10\n\t);\n\tconst defaultColor = style?.baseColors?.color?.text\n\t\t? style.baseColors.color.text\n\t\t: styles[ 'wp-block-list-item__list-item--default' ].color;\n\tconst color = style?.color ? style.color : defaultColor;\n\n\tif ( ordered ) {\n\t\treturn (\n\t\t\t<OrderedList\n\t\t\t\tblockIndex={ blockIndex }\n\t\t\t\tcolor={ color }\n\t\t\t\tfontSize={ fontSize }\n\t\t\t\tnumberOfListItems={ numberOfListItems }\n\t\t\t\treversed={ reversed }\n\t\t\t\tstart={ start }\n\t\t\t\tstyle={ style }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<IconList\n\t\t\tcolor={ color }\n\t\t\tdefaultFontSize={ defaultFontSize }\n\t\t\tfontSize={ fontSize }\n\t\t\tindentationLevel={ indentationLevel }\n\t\t/>\n\t);\n}\n"]}
|