@wordpress/block-library 8.8.0 → 8.10.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/build/comment-author-name/edit.js +1 -1
- package/build/comment-author-name/edit.js.map +1 -1
- package/build/comment-edit-link/edit.js +1 -1
- package/build/comment-edit-link/edit.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/index.js +1 -1
- package/build/cover/transforms.js +10 -7
- package/build/cover/transforms.js.map +1 -1
- package/build/cover/variations.js +1 -1
- package/build/cover/variations.js.map +1 -1
- package/build/details/edit.js +19 -5
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +14 -10
- package/build/details/index.js.map +1 -1
- package/build/details/save.js +4 -1
- package/build/details/save.js.map +1 -1
- package/build/embed/variations.js +2 -2
- package/build/embed/variations.js.map +1 -1
- package/build/file/view.js +1 -1
- package/build/file/view.js.map +1 -1
- package/build/gallery/edit.js +2 -8
- package/build/gallery/edit.js.map +1 -1
- package/build/group/edit.js +3 -1
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +3 -0
- package/build/group/index.js.map +1 -1
- package/build/image/edit.js +16 -13
- package/build/image/edit.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/index.js +0 -6
- package/build/index.js.map +1 -1
- package/build/index.native.js +10 -6
- package/build/index.native.js.map +1 -1
- package/build/list-item/utils.js +5 -1
- package/build/list-item/utils.js.map +1 -1
- package/build/loginout/index.js +11 -1
- package/build/loginout/index.js.map +1 -1
- package/build/media-text/edit.js +4 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +3 -0
- package/build/media-text/index.js.map +1 -1
- package/build/navigation/constants.js +13 -0
- package/build/navigation/constants.js.map +1 -0
- package/build/navigation/edit/index.js +26 -68
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +4 -7
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +4 -6
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js +1 -1
- package/build/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build/navigation/interactivity.js +139 -0
- package/build/navigation/interactivity.js.map +1 -0
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +1 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/paragraph/index.js +5 -1
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +5 -1
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-author-name/edit.js +1 -1
- package/build/post-author-name/edit.js.map +1 -1
- package/build/post-date/edit.js +4 -2
- package/build/post-date/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +2 -2
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +6 -4
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-featured-image/overlay.js +5 -0
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-title/edit.js +14 -4
- package/build/post-title/edit.js.map +1 -1
- package/build/preformatted/edit.native.js +3 -2
- package/build/preformatted/edit.native.js.map +1 -1
- package/build/query/deprecated.js +8 -6
- package/build/query/deprecated.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +41 -0
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build/query/edit/inspector-controls/index.js +14 -6
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +2 -1
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/index.js +5 -12
- package/build/query/index.js.map +1 -1
- package/build/quote/transforms.js +16 -27
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/edit.js +1 -1
- package/build/read-more/edit.js.map +1 -1
- package/build/search/edit.js +9 -1
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +114 -16
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-logo/index.js +1 -1
- package/build/site-title/edit/index.js +1 -1
- package/build/site-title/edit/index.js.map +1 -1
- package/build/social-link/icons/chain.js +1 -1
- package/build/social-link/icons/chain.js.map +1 -1
- package/build/social-link/icons/mail.js +1 -1
- package/build/social-link/icons/mail.js.map +1 -1
- package/build/social-links/edit.js +2 -2
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/edit.js +117 -11
- package/build/spacer/edit.js.map +1 -1
- package/build/template-part/edit/index.js +2 -1
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/utils/hooks.js +2 -2
- package/build/template-part/edit/utils/hooks.js.map +1 -1
- package/build/utils/interactivity/constants.js +9 -0
- package/build/utils/interactivity/constants.js.map +1 -0
- package/build/utils/interactivity/directives.js +208 -0
- package/build/utils/interactivity/directives.js.map +1 -0
- package/build/utils/interactivity/hooks.js +112 -0
- package/build/utils/interactivity/hooks.js.map +1 -0
- package/build/utils/interactivity/hydration.js +34 -0
- package/build/utils/interactivity/hydration.js.map +1 -0
- package/build/utils/interactivity/index.js +34 -0
- package/build/utils/interactivity/index.js.map +1 -0
- package/build/utils/interactivity/store.js +67 -0
- package/build/utils/interactivity/store.js.map +1 -0
- package/build/utils/interactivity/utils.js +87 -0
- package/build/utils/interactivity/utils.js.map +1 -0
- package/build/utils/interactivity/vdom.js +109 -0
- package/build/utils/interactivity/vdom.js.map +1 -0
- package/build/utils/migrate-font-family.js +12 -5
- package/build/utils/migrate-font-family.js.map +1 -1
- package/build/video/edit.native.js +4 -3
- package/build/video/edit.native.js.map +1 -1
- package/build-module/comment-author-name/edit.js +1 -1
- package/build-module/comment-author-name/edit.js.map +1 -1
- package/build-module/comment-edit-link/edit.js +1 -1
- package/build-module/comment-edit-link/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/index.js +1 -1
- package/build-module/cover/transforms.js +5 -1
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/cover/variations.js +1 -1
- package/build-module/cover/variations.js.map +1 -1
- package/build-module/details/edit.js +20 -6
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +14 -10
- package/build-module/details/index.js.map +1 -1
- package/build-module/details/save.js +5 -2
- package/build-module/details/save.js.map +1 -1
- package/build-module/embed/variations.js +2 -2
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/file/view.js +1 -1
- package/build-module/file/view.js.map +1 -1
- package/build-module/gallery/edit.js +2 -8
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/group/edit.js +3 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +3 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/image/edit.js +16 -13
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/index.js +0 -4
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +10 -6
- package/build-module/index.native.js.map +1 -1
- package/build-module/list-item/utils.js +5 -1
- package/build-module/list-item/utils.js.map +1 -1
- package/build-module/loginout/index.js +11 -1
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/media-text/edit.js +4 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +3 -0
- package/build-module/media-text/index.js.map +1 -1
- package/build-module/navigation/constants.js +5 -0
- package/build-module/navigation/constants.js.map +1 -0
- package/build-module/navigation/edit/index.js +28 -69
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +1 -4
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js +1 -1
- package/build-module/navigation/edit/use-convert-classic-menu-to-block-menu.js.map +1 -1
- package/build-module/navigation/interactivity.js +136 -0
- package/build-module/navigation/interactivity.js.map +1 -0
- package/build-module/navigation-link/edit.js +1 -1
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/paragraph/index.js +5 -1
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +5 -1
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-author-name/edit.js +1 -1
- package/build-module/post-author-name/edit.js.map +1 -1
- package/build-module/post-date/edit.js +4 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-excerpt/edit.js +2 -2
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +6 -4
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-featured-image/overlay.js +5 -0
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-title/edit.js +13 -4
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/preformatted/edit.native.js +3 -2
- package/build-module/preformatted/edit.native.js.map +1 -1
- package/build-module/query/deprecated.js +5 -2
- package/build-module/query/deprecated.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +33 -0
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -0
- package/build-module/query/edit/inspector-controls/index.js +12 -7
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +2 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/index.js +5 -10
- package/build-module/query/index.js.map +1 -1
- package/build-module/quote/transforms.js +16 -27
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +1 -1
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/search/edit.js +9 -1
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +115 -18
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-logo/index.js +1 -1
- package/build-module/site-title/edit/index.js +1 -1
- package/build-module/site-title/edit/index.js.map +1 -1
- package/build-module/social-link/icons/chain.js +1 -1
- package/build-module/social-link/icons/chain.js.map +1 -1
- package/build-module/social-link/icons/mail.js +1 -1
- package/build-module/social-link/icons/mail.js.map +1 -1
- package/build-module/social-links/edit.js +2 -2
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/edit.js +118 -12
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +2 -1
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/utils/hooks.js +2 -2
- package/build-module/template-part/edit/utils/hooks.js.map +1 -1
- package/build-module/utils/interactivity/constants.js +2 -0
- package/build-module/utils/interactivity/constants.js.map +1 -0
- package/build-module/utils/interactivity/directives.js +193 -0
- package/build-module/utils/interactivity/directives.js.map +1 -0
- package/build-module/utils/interactivity/hooks.js +98 -0
- package/build-module/utils/interactivity/hooks.js.map +1 -0
- package/build-module/utils/interactivity/hydration.js +21 -0
- package/build-module/utils/interactivity/hydration.js.map +1 -0
- package/build-module/utils/interactivity/index.js +17 -0
- package/build-module/utils/interactivity/index.js.map +1 -0
- package/build-module/utils/interactivity/store.js +56 -0
- package/build-module/utils/interactivity/store.js.map +1 -0
- package/build-module/utils/interactivity/utils.js +75 -0
- package/build-module/utils/interactivity/utils.js.map +1 -0
- package/build-module/utils/interactivity/vdom.js +97 -0
- package/build-module/utils/interactivity/vdom.js.map +1 -0
- package/build-module/utils/migrate-font-family.js +9 -1
- package/build-module/utils/migrate-font-family.js.map +1 -1
- package/build-module/video/edit.native.js +4 -3
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/cover/editor-rtl.css +3 -3
- package/build-style/cover/editor.css +3 -3
- package/build-style/cover/style-rtl.css +2 -1
- package/build-style/cover/style.css +2 -1
- package/build-style/{details-summary → details}/editor-rtl.css +1 -1
- package/build-style/{details-summary → details}/editor.css +1 -1
- package/build-style/details/style-rtl.css +14 -0
- package/build-style/details/style.css +14 -0
- package/build-style/editor-rtl.css +74 -39
- package/build-style/editor.css +74 -39
- package/build-style/gallery/editor-rtl.css +0 -4
- package/build-style/gallery/editor.css +0 -4
- package/build-style/html/editor-rtl.css +2 -2
- package/build-style/html/editor.css +2 -2
- package/build-style/image/editor-rtl.css +1 -1
- package/build-style/image/editor.css +1 -1
- package/build-style/query/editor-rtl.css +8 -12
- package/build-style/query/editor.css +8 -12
- package/build-style/search/editor-rtl.css +1 -0
- package/build-style/search/editor.css +1 -0
- package/build-style/search/style-rtl.css +2 -0
- package/build-style/search/style.css +2 -0
- package/build-style/shortcode/editor-rtl.css +3 -4
- package/build-style/shortcode/editor.css +3 -4
- package/build-style/site-logo/editor-rtl.css +47 -0
- package/build-style/site-logo/editor.css +47 -0
- package/build-style/style-rtl.css +15 -2
- package/build-style/style.css +15 -2
- package/build-style/template-part/editor-rtl.css +8 -12
- package/build-style/template-part/editor.css +8 -12
- package/package.json +36 -32
- package/src/buttons/test/__snapshots__/edit.native.js.snap +18 -0
- package/src/buttons/test/edit.native.js +123 -2
- package/src/comment-author-name/edit.js +1 -1
- package/src/comment-edit-link/edit.js +1 -1
- package/src/comment-template/index.php +8 -7
- package/src/cover/block.json +1 -1
- package/src/cover/edit/inspector-controls.js +56 -54
- package/src/cover/editor.scss +1 -1
- package/src/cover/style.scss +4 -0
- package/src/cover/test/edit.js +56 -2
- package/src/cover/transforms.js +4 -1
- package/src/cover/variations.js +1 -3
- package/src/details/block.json +8 -6
- package/src/details/edit.js +27 -5
- package/src/details/editor.scss +3 -0
- package/src/details/index.js +10 -5
- package/src/details/save.js +5 -1
- package/src/details/style.scss +16 -0
- package/src/editor.scss +1 -1
- package/src/embed/variations.js +2 -2
- package/src/file/view.js +4 -1
- package/src/gallery/edit.js +5 -8
- package/src/gallery/editor.scss +0 -6
- package/src/gallery/test/index.native.js +52 -7
- package/src/group/block.json +3 -0
- package/src/group/edit.js +8 -2
- package/src/heading/test/__snapshots__/index.native.js.snap +12 -0
- package/src/heading/test/index.native.js +71 -0
- package/src/html/editor.scss +2 -21
- package/src/image/block.json +1 -1
- package/src/image/edit.js +21 -17
- package/src/image/editor.scss +1 -1
- package/src/image/test/edit.native.js +38 -16
- package/src/index.js +0 -4
- package/src/index.native.js +10 -5
- package/src/list/test/edit.native.js +7 -7
- package/src/loginout/block.json +11 -1
- package/src/media-text/block.json +3 -0
- package/src/media-text/edit.js +2 -1
- package/src/navigation/constants.js +16 -0
- package/src/navigation/edit/index.js +77 -163
- package/src/navigation/edit/inner-blocks.js +1 -16
- package/src/navigation/edit/unsaved-inner-blocks.js +1 -16
- package/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +1 -1
- package/src/navigation/index.php +210 -197
- package/src/navigation/interactivity.js +144 -0
- package/src/navigation-link/edit.js +1 -1
- package/src/navigation-submenu/edit.js +1 -1
- package/src/paragraph/block.json +5 -1
- package/src/paragraph/test/edit.native.js +288 -28
- package/src/post-author-name/edit.js +1 -1
- package/src/post-date/edit.js +4 -0
- package/src/post-date/index.php +17 -8
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/edit.js +5 -4
- package/src/post-featured-image/overlay.js +4 -0
- package/src/post-terms/index.php +2 -2
- package/src/post-title/edit.js +8 -1
- package/src/preformatted/edit.native.js +1 -3
- package/src/preformatted/test/edit.native.js +6 -9
- package/src/pullquote/test/edit.native.js +7 -12
- package/src/query/deprecated.js +4 -1
- package/src/query/edit/inspector-controls/create-new-post-link.js +26 -0
- package/src/query/edit/inspector-controls/index.js +13 -6
- package/src/query/edit/pattern-selection-modal.js +1 -0
- package/src/query/editor.scss +8 -11
- package/src/query/index.js +1 -7
- package/src/quote/test/edit.native.js +6 -10
- package/src/quote/transforms.js +0 -6
- package/src/read-more/edit.js +1 -1
- package/src/search/edit.js +9 -4
- package/src/search/editor.scss +1 -0
- package/src/search/style.scss +3 -0
- package/src/shortcode/editor.scss +1 -21
- package/src/site-logo/block.json +1 -1
- package/src/site-logo/edit.js +123 -9
- package/src/site-logo/editor.scss +58 -0
- package/src/site-title/edit/index.js +1 -1
- package/src/social-link/icons/chain.js +1 -1
- package/src/social-link/icons/mail.js +1 -1
- package/src/social-link/index.php +2 -2
- package/src/social-links/edit.js +33 -31
- package/src/spacer/edit.js +157 -18
- package/src/style.scss +0 -1
- package/src/template-part/edit/index.js +1 -0
- package/src/template-part/edit/utils/hooks.js +2 -2
- package/src/template-part/editor.scss +9 -11
- package/src/template-part/index.php +20 -5
- package/src/utils/interactivity/constants.js +1 -0
- package/src/utils/interactivity/directives.js +179 -0
- package/src/utils/interactivity/hooks.js +76 -0
- package/src/utils/interactivity/hydration.js +22 -0
- package/src/utils/interactivity/index.js +17 -0
- package/src/utils/interactivity/store.js +45 -0
- package/src/utils/interactivity/utils.js +66 -0
- package/src/utils/interactivity/vdom.js +94 -0
- package/src/utils/migrate-font-family.js +8 -1
- package/src/verse/test/edit.native.js +4 -9
- package/src/video/edit.native.js +2 -2
- package/tsconfig.json +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/details-content/edit.js +0 -34
- package/build/details-content/edit.js.map +0 -1
- package/build/details-content/index.js +0 -94
- package/build/details-content/index.js.map +0 -1
- package/build/details-content/save.js +0 -20
- package/build/details-content/save.js.map +0 -1
- package/build/details-summary/edit.js +0 -42
- package/build/details-summary/edit.js.map +0 -1
- package/build/details-summary/index.js +0 -97
- package/build/details-summary/index.js.map +0 -1
- package/build/details-summary/save.js +0 -24
- package/build/details-summary/save.js.map +0 -1
- package/build/query/hooks.js +0 -72
- package/build/query/hooks.js.map +0 -1
- package/build/utils/clean-empty-object.js +0 -37
- package/build/utils/clean-empty-object.js.map +0 -1
- package/build-module/details-content/edit.js +0 -23
- package/build-module/details-content/edit.js.map +0 -1
- package/build-module/details-content/index.js +0 -76
- package/build-module/details-content/index.js.map +0 -1
- package/build-module/details-content/save.js +0 -11
- package/build-module/details-content/save.js.map +0 -1
- package/build-module/details-summary/edit.js +0 -30
- package/build-module/details-summary/edit.js.map +0 -1
- package/build-module/details-summary/index.js +0 -79
- package/build-module/details-summary/index.js.map +0 -1
- package/build-module/details-summary/save.js +0 -16
- package/build-module/details-summary/save.js.map +0 -1
- package/build-module/query/hooks.js +0 -59
- package/build-module/query/hooks.js.map +0 -1
- package/build-module/utils/clean-empty-object.js +0 -28
- package/build-module/utils/clean-empty-object.js.map +0 -1
- package/build-style/details-summary/style-rtl.css +0 -91
- package/build-style/details-summary/style.css +0 -91
- package/src/details-content/block.json +0 -50
- package/src/details-content/edit.js +0 -29
- package/src/details-content/index.js +0 -23
- package/src/details-content/save.js +0 -12
- package/src/details-summary/block.json +0 -53
- package/src/details-summary/edit.js +0 -27
- package/src/details-summary/editor.scss +0 -3
- package/src/details-summary/index.js +0 -23
- package/src/details-summary/save.js +0 -13
- package/src/details-summary/style.scss +0 -3
- package/src/query/hooks.js +0 -53
- package/src/utils/clean-empty-object.js +0 -28
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.settings = exports.name = exports.metadata = exports.init = void 0;
|
|
9
|
-
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
|
|
12
|
-
var _initBlock = _interopRequireDefault(require("../utils/init-block"));
|
|
13
|
-
|
|
14
|
-
var _edit = _interopRequireDefault(require("./edit"));
|
|
15
|
-
|
|
16
|
-
var _save = _interopRequireDefault(require("./save"));
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
const metadata = {
|
|
26
|
-
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
27
|
-
apiVersion: 2,
|
|
28
|
-
__experimental: true,
|
|
29
|
-
name: "core/details-summary",
|
|
30
|
-
title: "Details Summary",
|
|
31
|
-
category: "text",
|
|
32
|
-
parent: ["core/details"],
|
|
33
|
-
description: "Provide summary text used to toggle the display of content inside a Details block.",
|
|
34
|
-
textdomain: "default",
|
|
35
|
-
attributes: {
|
|
36
|
-
summary: {
|
|
37
|
-
type: "string"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
supports: {
|
|
41
|
-
align: false,
|
|
42
|
-
color: {
|
|
43
|
-
gradients: true,
|
|
44
|
-
__experimentalDefaultControls: {
|
|
45
|
-
background: true,
|
|
46
|
-
text: true
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
__experimentalBorder: {
|
|
50
|
-
radius: true,
|
|
51
|
-
color: true,
|
|
52
|
-
width: true,
|
|
53
|
-
style: true
|
|
54
|
-
},
|
|
55
|
-
html: false,
|
|
56
|
-
lock: false,
|
|
57
|
-
multiple: false,
|
|
58
|
-
reusable: false,
|
|
59
|
-
spacing: {
|
|
60
|
-
margin: true,
|
|
61
|
-
padding: true
|
|
62
|
-
},
|
|
63
|
-
typography: {
|
|
64
|
-
fontSize: true,
|
|
65
|
-
lineHeight: true,
|
|
66
|
-
__experimentalFontFamily: true,
|
|
67
|
-
__experimentalFontWeight: true,
|
|
68
|
-
__experimentalFontStyle: true,
|
|
69
|
-
__experimentalTextTransform: true,
|
|
70
|
-
__experimentalTextDecoration: true,
|
|
71
|
-
__experimentalLetterSpacing: true,
|
|
72
|
-
__experimentalDefaultControls: {
|
|
73
|
-
fontSize: true
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
exports.metadata = metadata;
|
|
79
|
-
const {
|
|
80
|
-
name
|
|
81
|
-
} = metadata;
|
|
82
|
-
exports.name = name;
|
|
83
|
-
const settings = {
|
|
84
|
-
icon: _icons.heading,
|
|
85
|
-
save: _save.default,
|
|
86
|
-
edit: _edit.default
|
|
87
|
-
};
|
|
88
|
-
exports.settings = settings;
|
|
89
|
-
|
|
90
|
-
const init = () => (0, _initBlock.default)({
|
|
91
|
-
name,
|
|
92
|
-
metadata,
|
|
93
|
-
settings
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
exports.init = init;
|
|
97
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-summary/index.js"],"names":["name","metadata","settings","icon","save","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,cADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA;AAHuB,CAAjB;;;AAMA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEN,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { heading 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;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tsave,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = save;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
function save(_ref) {
|
|
16
|
-
let {
|
|
17
|
-
attributes
|
|
18
|
-
} = _ref;
|
|
19
|
-
const summary = attributes.summary ? attributes.summary : 'Details';
|
|
20
|
-
return (0, _element.createElement)("summary", _blockEditor.useBlockProps.save(), (0, _element.createElement)(_blockEditor.RichText.Content, {
|
|
21
|
-
value: summary
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=save.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-summary/save.js"],"names":["save","attributes","summary","useBlockProps"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,IAAT,OAAgC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AAC9C,QAAMC,OAAO,GAAGD,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAhC,GAA0C,SAA1D;AACA,SACC,uCAAcC,2BAAcH,IAAd,EAAd,EACC,4BAAC,qBAAD,CAAU,OAAV;AAAkB,IAAA,KAAK,EAAGE;AAA1B,IADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst summary = attributes.summary ? attributes.summary : 'Details';\n\treturn (\n\t\t<summary { ...useBlockProps.save() }>\n\t\t\t<RichText.Content value={ summary } />\n\t\t</summary>\n\t);\n}\n"]}
|
package/build/query/hooks.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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 = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _i18n = require("@wordpress/i18n");
|
|
15
|
-
|
|
16
|
-
var _url = require("@wordpress/url");
|
|
17
|
-
|
|
18
|
-
var _compose = require("@wordpress/compose");
|
|
19
|
-
|
|
20
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* WordPress dependencies
|
|
24
|
-
*/
|
|
25
|
-
const CreateNewPostLink = _ref => {
|
|
26
|
-
let {
|
|
27
|
-
attributes: {
|
|
28
|
-
query: {
|
|
29
|
-
postType
|
|
30
|
-
} = {}
|
|
31
|
-
} = {}
|
|
32
|
-
} = _ref;
|
|
33
|
-
if (!postType) return null;
|
|
34
|
-
const newPostUrl = (0, _url.addQueryArgs)('post-new.php', {
|
|
35
|
-
post_type: postType
|
|
36
|
-
});
|
|
37
|
-
return (0, _element.createElement)("div", {
|
|
38
|
-
className: "wp-block-query__create-new-link"
|
|
39
|
-
}, (0, _element.createInterpolateElement)((0, _i18n.__)('<a>Create a new post</a> for this feed.'), // eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
40
|
-
{
|
|
41
|
-
a: (0, _element.createElement)("a", {
|
|
42
|
-
href: newPostUrl
|
|
43
|
-
})
|
|
44
|
-
}));
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Override the default edit UI to include layout controls
|
|
48
|
-
*
|
|
49
|
-
* @param {Function} BlockEdit Original component
|
|
50
|
-
* @return {Function} Wrapped component
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const queryTopInspectorControls = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
|
|
55
|
-
const {
|
|
56
|
-
name,
|
|
57
|
-
isSelected
|
|
58
|
-
} = props;
|
|
59
|
-
|
|
60
|
-
if (name !== 'core/query' || !isSelected) {
|
|
61
|
-
return (0, _element.createElement)(BlockEdit, (0, _extends2.default)({
|
|
62
|
-
key: "edit"
|
|
63
|
-
}, props));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.InspectorControls, null, (0, _element.createElement)(CreateNewPostLink, props)), (0, _element.createElement)(BlockEdit, (0, _extends2.default)({
|
|
67
|
-
key: "edit"
|
|
68
|
-
}, props)));
|
|
69
|
-
}, 'withInspectorControls');
|
|
70
|
-
var _default = queryTopInspectorControls;
|
|
71
|
-
exports.default = _default;
|
|
72
|
-
//# sourceMappingURL=hooks.js.map
|
package/build/query/hooks.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/hooks.js"],"names":["CreateNewPostLink","attributes","query","postType","newPostUrl","post_type","a","queryTopInspectorControls","BlockEdit","props","name","isSelected"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAEA;;AACA;;AACA;;AAPA;AACA;AACA;AAOA,MAAMA,iBAAiB,GAAG,QAEnB;AAAA,MAFqB;AAC3BC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAK,EAAE;AAAEC,QAAAA;AAAF,UAAe;AAAxB,QAA+B;AADhB,GAErB;AACN,MAAK,CAAEA,QAAP,EAAkB,OAAO,IAAP;AAClB,QAAMC,UAAU,GAAG,uBAAc,cAAd,EAA8B;AAChDC,IAAAA,SAAS,EAAEF;AADqC,GAA9B,CAAnB;AAGA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,uCACD,cAAI,yCAAJ,CADC,EAED;AACA;AAAEG,IAAAA,CAAC,EAAE;AAAG,MAAA,IAAI,EAAGF;AAAV;AAAL,GAHC,CADH,CADD;AASA,CAhBD;AAkBA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,yBAAyB,GAAG,yCAC/BC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAuBF,KAA7B;;AACA,MAAKC,IAAI,KAAK,YAAT,IAAyB,CAAEC,UAAhC,EAA6C;AAC5C,WAAO,4BAAC,SAAD;AAAW,MAAA,GAAG,EAAC;AAAf,OAA2BF,KAA3B,EAAP;AACA;;AAED,SACC,qDACC,4BAAC,8BAAD,QACC,4BAAC,iBAAD,EAAwBA,KAAxB,CADD,CADD,EAIC,4BAAC,SAAD;AAAW,IAAA,GAAG,EAAC;AAAf,KAA2BA,KAA3B,EAJD,CADD;AAQA,CAfgC,EAgBjC,uBAhBiC,CAAlC;eAmBeF,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { InspectorControls } from '@wordpress/block-editor';\n\nconst CreateNewPostLink = ( {\n\tattributes: { query: { postType } = {} } = {},\n} ) => {\n\tif ( ! postType ) return null;\n\tconst newPostUrl = addQueryArgs( 'post-new.php', {\n\t\tpost_type: postType,\n\t} );\n\treturn (\n\t\t<div className=\"wp-block-query__create-new-link\">\n\t\t\t{ createInterpolateElement(\n\t\t\t\t__( '<a>Create a new post</a> for this feed.' ),\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t{ a: <a href={ newPostUrl } /> }\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component\n * @return {Function} Wrapped component\n */\nconst queryTopInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name, isSelected } = props;\n\t\tif ( name !== 'core/query' || ! isSelected ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<CreateNewPostLink { ...props } />\n\t\t\t\t</InspectorControls>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withInspectorControls'\n);\n\nexport default queryTopInspectorControls;\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _lodash = require("lodash");
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* External dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Removed empty nodes from nested objects.
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} object
|
|
18
|
-
* @return {Object} Object cleaned from empty nodes.
|
|
19
|
-
*/
|
|
20
|
-
const cleanEmptyObject = object => {
|
|
21
|
-
if (object === null || typeof object !== 'object' || Array.isArray(object)) {
|
|
22
|
-
return object;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const cleanedNestedObjects = Object.fromEntries(Object.entries(object).map(_ref => {
|
|
26
|
-
let [key, value] = _ref;
|
|
27
|
-
return [key, cleanEmptyObject(value)];
|
|
28
|
-
}).filter(_ref2 => {
|
|
29
|
-
let [, value] = _ref2;
|
|
30
|
-
return Boolean(value);
|
|
31
|
-
}));
|
|
32
|
-
return (0, _lodash.isEmpty)(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var _default = cleanEmptyObject;
|
|
36
|
-
exports.default = _default;
|
|
37
|
-
//# sourceMappingURL=clean-empty-object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/utils/clean-empty-object.js"],"names":["cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","map","key","value","filter","Boolean","undefined"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,gBAAgB,GAAKC,MAAF,IAAc;AACtC,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AACD,QAAMG,oBAAoB,GAAGC,MAAM,CAACC,WAAP,CAC5BD,MAAM,CAACE,OAAP,CAAgBN,MAAhB,EACEO,GADF,CACO;AAAA,QAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF;AAAA,WAAsB,CAAED,GAAF,EAAOT,gBAAgB,CAAEU,KAAF,CAAvB,CAAtB;AAAA,GADP,EAEEC,MAFF,CAEU;AAAA,QAAE,GAAID,KAAJ,CAAF;AAAA,WAAmBE,OAAO,CAAEF,KAAF,CAA1B;AAAA,GAFV,CAD4B,CAA7B;AAKA,SAAO,qBAASN,oBAAT,IAAkCS,SAAlC,GAA8CT,oBAArD;AACA,CAdD;;eAgBeJ,gB","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * Removed empty nodes from nested objects.\n *\n * @param {Object} object\n * @return {Object} Object cleaned from empty nodes.\n */\nconst cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( object )\n\t\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t\t.filter( ( [ , value ] ) => Boolean( value ) )\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport default cleanEmptyObject;\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { View } from '@wordpress/primitives';
|
|
9
|
-
const TEMPLATE = [['core/paragraph', {
|
|
10
|
-
placeholder: __('Add text or blocks that will display when the details block is opened.')
|
|
11
|
-
}]];
|
|
12
|
-
|
|
13
|
-
function DetailsContentEdit() {
|
|
14
|
-
const blockProps = useBlockProps();
|
|
15
|
-
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
16
|
-
template: TEMPLATE,
|
|
17
|
-
templateLock: false
|
|
18
|
-
});
|
|
19
|
-
return createElement(View, innerBlocksProps);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default DetailsContentEdit;
|
|
23
|
-
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-content/edit.js"],"names":["useBlockProps","useInnerBlocksProps","__","View","TEMPLATE","placeholder","DetailsContentEdit","blockProps","innerBlocksProps","template","templateLock"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,mBAAxB,QAAmD,yBAAnD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA,MAAMC,QAAQ,GAAG,CAChB,CACC,gBADD,EAEC;AACCC,EAAAA,WAAW,EAAEH,EAAE,CACd,wEADc;AADhB,CAFD,CADgB,CAAjB;;AAWA,SAASI,kBAAT,GAA8B;AAC7B,QAAMC,UAAU,GAAGP,aAAa,EAAhC;AACA,QAAMQ,gBAAgB,GAAGP,mBAAmB,CAAEM,UAAF,EAAc;AACzDE,IAAAA,QAAQ,EAAEL,QAD+C;AAEzDM,IAAAA,YAAY,EAAE;AAF2C,GAAd,CAA5C;AAKA,SAAO,cAAC,IAAD,EAAWF,gBAAX,CAAP;AACA;;AAED,eAAeF,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { View } from '@wordpress/primitives';\n\nconst TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\tplaceholder: __(\n\t\t\t\t'Add text or blocks that will display when the details block is opened.'\n\t\t\t),\n\t\t},\n\t],\n];\n\nfunction DetailsContentEdit() {\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: false,\n\t} );\n\n\treturn <View { ...innerBlocksProps }></View>;\n}\n\nexport default DetailsContentEdit;\n"]}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { postContent as icon } from '@wordpress/icons';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import initBlock from '../utils/init-block';
|
|
10
|
-
const metadata = {
|
|
11
|
-
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
12
|
-
apiVersion: 2,
|
|
13
|
-
__experimental: true,
|
|
14
|
-
name: "core/details-content",
|
|
15
|
-
title: "Details Content",
|
|
16
|
-
category: "text",
|
|
17
|
-
parent: ["core/details"],
|
|
18
|
-
description: "Add content that may be shown or hidden via a Details block.",
|
|
19
|
-
textdomain: "default",
|
|
20
|
-
supports: {
|
|
21
|
-
align: false,
|
|
22
|
-
color: {
|
|
23
|
-
gradients: true,
|
|
24
|
-
link: true,
|
|
25
|
-
__experimentalDefaultControls: {
|
|
26
|
-
background: true,
|
|
27
|
-
text: true,
|
|
28
|
-
link: true
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
__experimentalBorder: {
|
|
32
|
-
radius: true,
|
|
33
|
-
color: true,
|
|
34
|
-
width: true,
|
|
35
|
-
style: true
|
|
36
|
-
},
|
|
37
|
-
html: false,
|
|
38
|
-
lock: false,
|
|
39
|
-
multiple: false,
|
|
40
|
-
reusable: false,
|
|
41
|
-
spacing: {
|
|
42
|
-
margin: true,
|
|
43
|
-
padding: true
|
|
44
|
-
},
|
|
45
|
-
typography: {
|
|
46
|
-
fontSize: true,
|
|
47
|
-
lineHeight: true,
|
|
48
|
-
__experimentalFontFamily: true,
|
|
49
|
-
__experimentalFontWeight: true,
|
|
50
|
-
__experimentalFontStyle: true,
|
|
51
|
-
__experimentalTextTransform: true,
|
|
52
|
-
__experimentalTextDecoration: true,
|
|
53
|
-
__experimentalLetterSpacing: true,
|
|
54
|
-
__experimentalDefaultControls: {
|
|
55
|
-
fontSize: true
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
import edit from './edit';
|
|
61
|
-
import save from './save';
|
|
62
|
-
const {
|
|
63
|
-
name
|
|
64
|
-
} = metadata;
|
|
65
|
-
export { metadata, name };
|
|
66
|
-
export const settings = {
|
|
67
|
-
icon,
|
|
68
|
-
save,
|
|
69
|
-
edit
|
|
70
|
-
};
|
|
71
|
-
export const init = () => initBlock({
|
|
72
|
-
name,
|
|
73
|
-
metadata,
|
|
74
|
-
settings
|
|
75
|
-
});
|
|
76
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-content/index.js"],"names":["postContent","icon","initBlock","edit","save","name","metadata","settings","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,IAAxB,QAAoC,kBAApC;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBN,EAAAA,IADuB;AAEvBG,EAAAA,IAFuB;AAGvBD,EAAAA;AAHuB,CAAjB;AAMP,OAAO,MAAMK,IAAI,GAAG,MAAMN,SAAS,CAAE;AAAEG,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postContent 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;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tsave,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { useBlockProps, InnerBlocks } from '@wordpress/block-editor';
|
|
7
|
-
export default function save() {
|
|
8
|
-
const blockProps = useBlockProps.save();
|
|
9
|
-
return createElement("div", blockProps, createElement(InnerBlocks.Content, null));
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=save.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-content/save.js"],"names":["useBlockProps","InnerBlocks","save","blockProps"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,WAAxB,QAA2C,yBAA3C;AACA,eAAe,SAASC,IAAT,GAAgB;AAC9B,QAAMC,UAAU,GAAGH,aAAa,CAACE,IAAd,EAAnB;AACA,SACC,qBAAUC,UAAV,EACC,cAAC,WAAD,CAAa,OAAb,OADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, InnerBlocks } from '@wordpress/block-editor';\nexport default function save() {\n\tconst blockProps = useBlockProps.save();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<InnerBlocks.Content />\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement } from "@wordpress/element";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* WordPress dependencies
|
|
6
|
-
*/
|
|
7
|
-
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
|
|
10
|
-
function DetailsSummaryEdit(_ref) {
|
|
11
|
-
let {
|
|
12
|
-
attributes,
|
|
13
|
-
setAttributes
|
|
14
|
-
} = _ref;
|
|
15
|
-
const summary = attributes.summary ? attributes.summary : __('Details');
|
|
16
|
-
return createElement("summary", _extends({}, useBlockProps(), {
|
|
17
|
-
onClick: event => event.preventDefault()
|
|
18
|
-
}), createElement(RichText, {
|
|
19
|
-
"aria-label": __('Add summary'),
|
|
20
|
-
allowedFormats: [],
|
|
21
|
-
withoutInteractiveFormatting: true,
|
|
22
|
-
value: summary,
|
|
23
|
-
onChange: newSummary => setAttributes({
|
|
24
|
-
summary: newSummary
|
|
25
|
-
})
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default DetailsSummaryEdit;
|
|
30
|
-
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-summary/edit.js"],"names":["RichText","useBlockProps","__","DetailsSummaryEdit","attributes","setAttributes","summary","event","preventDefault","newSummary"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,aAAnB,QAAwC,yBAAxC;AACA,SAASC,EAAT,QAAmB,iBAAnB;;AAEA,SAASC,kBAAT,OAA6D;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAAgC;AAC5D,QAAMC,OAAO,GAAGF,UAAU,CAACE,OAAX,GAAqBF,UAAU,CAACE,OAAhC,GAA0CJ,EAAE,CAAE,SAAF,CAA5D;AACA,SACC,sCACMD,aAAa,EADnB;AAEC,IAAA,OAAO,EAAKM,KAAF,IAAaA,KAAK,CAACC,cAAN;AAFxB,MAIC,cAAC,QAAD;AACC,kBAAaN,EAAE,CAAE,aAAF,CADhB;AAEC,IAAA,cAAc,EAAG,EAFlB;AAGC,IAAA,4BAA4B,MAH7B;AAIC,IAAA,KAAK,EAAGI,OAJT;AAKC,IAAA,QAAQ,EAAKG,UAAF,IACVJ,aAAa,CAAE;AAAEC,MAAAA,OAAO,EAAEG;AAAX,KAAF;AANf,IAJD,CADD;AAgBA;;AAED,eAAeN,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nfunction DetailsSummaryEdit( { attributes, setAttributes } ) {\n\tconst summary = attributes.summary ? attributes.summary : __( 'Details' );\n\treturn (\n\t\t<summary\n\t\t\t{ ...useBlockProps() }\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t<RichText\n\t\t\t\taria-label={ __( 'Add summary' ) }\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tvalue={ summary }\n\t\t\t\tonChange={ ( newSummary ) =>\n\t\t\t\t\tsetAttributes( { summary: newSummary } )\n\t\t\t\t}\n\t\t\t/>\n\t\t</summary>\n\t);\n}\n\nexport default DetailsSummaryEdit;\n"]}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { heading as icon } from '@wordpress/icons';
|
|
5
|
-
/**
|
|
6
|
-
* Internal dependencies
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import initBlock from '../utils/init-block';
|
|
10
|
-
const metadata = {
|
|
11
|
-
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
12
|
-
apiVersion: 2,
|
|
13
|
-
__experimental: true,
|
|
14
|
-
name: "core/details-summary",
|
|
15
|
-
title: "Details Summary",
|
|
16
|
-
category: "text",
|
|
17
|
-
parent: ["core/details"],
|
|
18
|
-
description: "Provide summary text used to toggle the display of content inside a Details block.",
|
|
19
|
-
textdomain: "default",
|
|
20
|
-
attributes: {
|
|
21
|
-
summary: {
|
|
22
|
-
type: "string"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
supports: {
|
|
26
|
-
align: false,
|
|
27
|
-
color: {
|
|
28
|
-
gradients: true,
|
|
29
|
-
__experimentalDefaultControls: {
|
|
30
|
-
background: true,
|
|
31
|
-
text: true
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
__experimentalBorder: {
|
|
35
|
-
radius: true,
|
|
36
|
-
color: true,
|
|
37
|
-
width: true,
|
|
38
|
-
style: true
|
|
39
|
-
},
|
|
40
|
-
html: false,
|
|
41
|
-
lock: false,
|
|
42
|
-
multiple: false,
|
|
43
|
-
reusable: false,
|
|
44
|
-
spacing: {
|
|
45
|
-
margin: true,
|
|
46
|
-
padding: true
|
|
47
|
-
},
|
|
48
|
-
typography: {
|
|
49
|
-
fontSize: true,
|
|
50
|
-
lineHeight: true,
|
|
51
|
-
__experimentalFontFamily: true,
|
|
52
|
-
__experimentalFontWeight: true,
|
|
53
|
-
__experimentalFontStyle: true,
|
|
54
|
-
__experimentalTextTransform: true,
|
|
55
|
-
__experimentalTextDecoration: true,
|
|
56
|
-
__experimentalLetterSpacing: true,
|
|
57
|
-
__experimentalDefaultControls: {
|
|
58
|
-
fontSize: true
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
import edit from './edit';
|
|
64
|
-
import save from './save';
|
|
65
|
-
const {
|
|
66
|
-
name
|
|
67
|
-
} = metadata;
|
|
68
|
-
export { metadata, name };
|
|
69
|
-
export const settings = {
|
|
70
|
-
icon,
|
|
71
|
-
save,
|
|
72
|
-
edit
|
|
73
|
-
};
|
|
74
|
-
export const init = () => initBlock({
|
|
75
|
-
name,
|
|
76
|
-
metadata,
|
|
77
|
-
settings
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-summary/index.js"],"names":["heading","icon","initBlock","edit","save","name","metadata","settings","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,IAAIC,IAApB,QAAgC,kBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBN,EAAAA,IADuB;AAEvBG,EAAAA,IAFuB;AAGvBD,EAAAA;AAHuB,CAAjB;AAMP,OAAO,MAAMK,IAAI,GAAG,MAAMN,SAAS,CAAE;AAAEG,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { heading 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;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tsave,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
7
|
-
export default function save(_ref) {
|
|
8
|
-
let {
|
|
9
|
-
attributes
|
|
10
|
-
} = _ref;
|
|
11
|
-
const summary = attributes.summary ? attributes.summary : 'Details';
|
|
12
|
-
return createElement("summary", useBlockProps.save(), createElement(RichText.Content, {
|
|
13
|
-
value: summary
|
|
14
|
-
}));
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=save.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/details-summary/save.js"],"names":["RichText","useBlockProps","save","attributes","summary"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,aAAnB,QAAwC,yBAAxC;AAEA,eAAe,SAASC,IAAT,OAAgC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AAC9C,QAAMC,OAAO,GAAGD,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAhC,GAA0C,SAA1D;AACA,SACC,yBAAcH,aAAa,CAACC,IAAd,EAAd,EACC,cAAC,QAAD,CAAU,OAAV;AAAkB,IAAA,KAAK,EAAGE;AAA1B,IADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst summary = attributes.summary ? attributes.summary : 'Details';\n\treturn (\n\t\t<summary { ...useBlockProps.save() }>\n\t\t\t<RichText.Content value={ summary } />\n\t\t</summary>\n\t);\n}\n"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement, Fragment } from "@wordpress/element";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* WordPress dependencies
|
|
6
|
-
*/
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
9
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
10
|
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
11
|
-
import { InspectorControls } from '@wordpress/block-editor';
|
|
12
|
-
|
|
13
|
-
const CreateNewPostLink = _ref => {
|
|
14
|
-
let {
|
|
15
|
-
attributes: {
|
|
16
|
-
query: {
|
|
17
|
-
postType
|
|
18
|
-
} = {}
|
|
19
|
-
} = {}
|
|
20
|
-
} = _ref;
|
|
21
|
-
if (!postType) return null;
|
|
22
|
-
const newPostUrl = addQueryArgs('post-new.php', {
|
|
23
|
-
post_type: postType
|
|
24
|
-
});
|
|
25
|
-
return createElement("div", {
|
|
26
|
-
className: "wp-block-query__create-new-link"
|
|
27
|
-
}, createInterpolateElement(__('<a>Create a new post</a> for this feed.'), // eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
28
|
-
{
|
|
29
|
-
a: createElement("a", {
|
|
30
|
-
href: newPostUrl
|
|
31
|
-
})
|
|
32
|
-
}));
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Override the default edit UI to include layout controls
|
|
36
|
-
*
|
|
37
|
-
* @param {Function} BlockEdit Original component
|
|
38
|
-
* @return {Function} Wrapped component
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const queryTopInspectorControls = createHigherOrderComponent(BlockEdit => props => {
|
|
43
|
-
const {
|
|
44
|
-
name,
|
|
45
|
-
isSelected
|
|
46
|
-
} = props;
|
|
47
|
-
|
|
48
|
-
if (name !== 'core/query' || !isSelected) {
|
|
49
|
-
return createElement(BlockEdit, _extends({
|
|
50
|
-
key: "edit"
|
|
51
|
-
}, props));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return createElement(Fragment, null, createElement(InspectorControls, null, createElement(CreateNewPostLink, props)), createElement(BlockEdit, _extends({
|
|
55
|
-
key: "edit"
|
|
56
|
-
}, props)));
|
|
57
|
-
}, 'withInspectorControls');
|
|
58
|
-
export default queryTopInspectorControls;
|
|
59
|
-
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/query/hooks.js"],"names":["__","createInterpolateElement","addQueryArgs","createHigherOrderComponent","InspectorControls","CreateNewPostLink","attributes","query","postType","newPostUrl","post_type","a","queryTopInspectorControls","BlockEdit","props","name","isSelected"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,iBAAT,QAAkC,yBAAlC;;AAEA,MAAMC,iBAAiB,GAAG,QAEnB;AAAA,MAFqB;AAC3BC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAK,EAAE;AAAEC,QAAAA;AAAF,UAAe;AAAxB,QAA+B;AADhB,GAErB;AACN,MAAK,CAAEA,QAAP,EAAkB,OAAO,IAAP;AAClB,QAAMC,UAAU,GAAGP,YAAY,CAAE,cAAF,EAAkB;AAChDQ,IAAAA,SAAS,EAAEF;AADqC,GAAlB,CAA/B;AAGA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGP,wBAAwB,CACzBD,EAAE,CAAE,yCAAF,CADuB,EAEzB;AACA;AAAEW,IAAAA,CAAC,EAAE;AAAG,MAAA,IAAI,EAAGF;AAAV;AAAL,GAHyB,CAD3B,CADD;AASA,CAhBD;AAkBA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,yBAAyB,GAAGT,0BAA0B,CACzDU,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAuBF,KAA7B;;AACA,MAAKC,IAAI,KAAK,YAAT,IAAyB,CAAEC,UAAhC,EAA6C;AAC5C,WAAO,cAAC,SAAD;AAAW,MAAA,GAAG,EAAC;AAAf,OAA2BF,KAA3B,EAAP;AACA;;AAED,SACC,8BACC,cAAC,iBAAD,QACC,cAAC,iBAAD,EAAwBA,KAAxB,CADD,CADD,EAIC,cAAC,SAAD;AAAW,IAAA,GAAG,EAAC;AAAf,KAA2BA,KAA3B,EAJD,CADD;AAQA,CAf0D,EAgB3D,uBAhB2D,CAA5D;AAmBA,eAAeF,yBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { InspectorControls } from '@wordpress/block-editor';\n\nconst CreateNewPostLink = ( {\n\tattributes: { query: { postType } = {} } = {},\n} ) => {\n\tif ( ! postType ) return null;\n\tconst newPostUrl = addQueryArgs( 'post-new.php', {\n\t\tpost_type: postType,\n\t} );\n\treturn (\n\t\t<div className=\"wp-block-query__create-new-link\">\n\t\t\t{ createInterpolateElement(\n\t\t\t\t__( '<a>Create a new post</a> for this feed.' ),\n\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t{ a: <a href={ newPostUrl } /> }\n\t\t\t) }\n\t\t</div>\n\t);\n};\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component\n * @return {Function} Wrapped component\n */\nconst queryTopInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name, isSelected } = props;\n\t\tif ( name !== 'core/query' || ! isSelected ) {\n\t\t\treturn <BlockEdit key=\"edit\" { ...props } />;\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<CreateNewPostLink { ...props } />\n\t\t\t\t</InspectorControls>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withInspectorControls'\n);\n\nexport default queryTopInspectorControls;\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { isEmpty } from 'lodash';
|
|
5
|
-
/**
|
|
6
|
-
* Removed empty nodes from nested objects.
|
|
7
|
-
*
|
|
8
|
-
* @param {Object} object
|
|
9
|
-
* @return {Object} Object cleaned from empty nodes.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const cleanEmptyObject = object => {
|
|
13
|
-
if (object === null || typeof object !== 'object' || Array.isArray(object)) {
|
|
14
|
-
return object;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const cleanedNestedObjects = Object.fromEntries(Object.entries(object).map(_ref => {
|
|
18
|
-
let [key, value] = _ref;
|
|
19
|
-
return [key, cleanEmptyObject(value)];
|
|
20
|
-
}).filter(_ref2 => {
|
|
21
|
-
let [, value] = _ref2;
|
|
22
|
-
return Boolean(value);
|
|
23
|
-
}));
|
|
24
|
-
return isEmpty(cleanedNestedObjects) ? undefined : cleanedNestedObjects;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default cleanEmptyObject;
|
|
28
|
-
//# sourceMappingURL=clean-empty-object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/utils/clean-empty-object.js"],"names":["isEmpty","cleanEmptyObject","object","Array","isArray","cleanedNestedObjects","Object","fromEntries","entries","map","key","value","filter","Boolean","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,gBAAgB,GAAKC,MAAF,IAAc;AACtC,MACCA,MAAM,KAAK,IAAX,IACA,OAAOA,MAAP,KAAkB,QADlB,IAEAC,KAAK,CAACC,OAAN,CAAeF,MAAf,CAHD,EAIE;AACD,WAAOA,MAAP;AACA;;AACD,QAAMG,oBAAoB,GAAGC,MAAM,CAACC,WAAP,CAC5BD,MAAM,CAACE,OAAP,CAAgBN,MAAhB,EACEO,GADF,CACO;AAAA,QAAE,CAAEC,GAAF,EAAOC,KAAP,CAAF;AAAA,WAAsB,CAAED,GAAF,EAAOT,gBAAgB,CAAEU,KAAF,CAAvB,CAAtB;AAAA,GADP,EAEEC,MAFF,CAEU;AAAA,QAAE,GAAID,KAAJ,CAAF;AAAA,WAAmBE,OAAO,CAAEF,KAAF,CAA1B;AAAA,GAFV,CAD4B,CAA7B;AAKA,SAAOX,OAAO,CAAEK,oBAAF,CAAP,GAAkCS,SAAlC,GAA8CT,oBAArD;AACA,CAdD;;AAgBA,eAAeJ,gBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { isEmpty } from 'lodash';\n\n/**\n * Removed empty nodes from nested objects.\n *\n * @param {Object} object\n * @return {Object} Object cleaned from empty nodes.\n */\nconst cleanEmptyObject = ( object ) => {\n\tif (\n\t\tobject === null ||\n\t\ttypeof object !== 'object' ||\n\t\tArray.isArray( object )\n\t) {\n\t\treturn object;\n\t}\n\tconst cleanedNestedObjects = Object.fromEntries(\n\t\tObject.entries( object )\n\t\t\t.map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )\n\t\t\t.filter( ( [ , value ] ) => Boolean( value ) )\n\t);\n\treturn isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;\n};\n\nexport default cleanEmptyObject;\n"]}
|