@wordpress/block-directory 5.17.1 → 5.19.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/components/auto-block-uninstaller/index.js +0 -1
- package/build/components/auto-block-uninstaller/index.js.map +1 -1
- package/build/components/block-ratings/stars.js +0 -1
- package/build/components/block-ratings/stars.js.map +1 -1
- package/build/components/compact-list/index.js +0 -1
- package/build/components/compact-list/index.js.map +1 -1
- package/build/components/downloadable-blocks-list/index.js +0 -1
- package/build/components/downloadable-blocks-list/index.js.map +1 -1
- package/build/components/downloadable-blocks-panel/index.js +0 -1
- package/build/components/downloadable-blocks-panel/index.js.map +1 -1
- package/build/components/downloadable-blocks-panel/no-results.js +3 -7
- package/build/components/downloadable-blocks-panel/no-results.js.map +1 -1
- package/build/plugins/get-install-missing/index.js +0 -1
- package/build/plugins/get-install-missing/index.js.map +1 -1
- package/build/plugins/index.js +3 -0
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/installed-blocks-pre-publish-panel/index.js +0 -2
- package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
- package/build/store/actions.js +0 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/load-assets.js +0 -1
- package/build/store/load-assets.js.map +1 -1
- package/build/store/reducer.js +0 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +0 -1
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +0 -1
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/has-block-type.js +0 -1
- package/build/store/utils/has-block-type.js.map +1 -1
- package/build-module/components/auto-block-uninstaller/index.js +0 -1
- package/build-module/components/auto-block-uninstaller/index.js.map +1 -1
- package/build-module/components/block-ratings/stars.js +0 -1
- package/build-module/components/block-ratings/stars.js.map +1 -1
- package/build-module/components/compact-list/index.js +0 -1
- package/build-module/components/compact-list/index.js.map +1 -1
- package/build-module/components/downloadable-blocks-list/index.js +0 -1
- package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
- package/build-module/components/downloadable-blocks-panel/index.js +0 -1
- package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
- package/build-module/components/downloadable-blocks-panel/no-results.js +3 -7
- package/build-module/components/downloadable-blocks-panel/no-results.js.map +1 -1
- package/build-module/plugins/get-install-missing/index.js +0 -1
- package/build-module/plugins/get-install-missing/index.js.map +1 -1
- package/build-module/plugins/index.js +3 -0
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +0 -2
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
- package/build-module/store/actions.js +0 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/load-assets.js +0 -1
- package/build-module/store/load-assets.js.map +1 -1
- package/build-module/store/reducer.js +0 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +0 -1
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +0 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/has-block-type.js +0 -1
- package/build-module/store/utils/has-block-type.js.map +1 -1
- package/package.json +20 -20
- package/src/components/downloadable-blocks-panel/no-results.js +0 -5
- package/src/plugins/index.js +3 -0
- package/src/plugins/installed-blocks-pre-publish-panel/index.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_data","_element","_editor","_store","AutoBlockUninstaller","uninstallBlockType","useDispatch","blockDirectoryStore","shouldRemoveBlockTypes","useSelect","select","isAutosavingPost","isSavingPost","editorStore","unusedBlockTypes","getUnusedBlockTypes","useEffect","length","forEach","blockType","unregisterBlockType","name"],"sources":["@wordpress/block-directory/src/components/auto-block-uninstaller/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_blocks","require","_data","_element","_editor","_store","AutoBlockUninstaller","uninstallBlockType","useDispatch","blockDirectoryStore","shouldRemoveBlockTypes","useSelect","select","isAutosavingPost","isSavingPost","editorStore","unusedBlockTypes","getUnusedBlockTypes","useEffect","length","forEach","blockType","unregisterBlockType","name"],"sources":["@wordpress/block-directory/src/components/auto-block-uninstaller/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGe,SAASK,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAoB,CAAC;EAEjE,MAAMC,sBAAsB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACvD,MAAM;MAAEC,gBAAgB;MAAEC;IAAa,CAAC,GAAGF,MAAM,CAAEG,aAAY,CAAC;IAChE,OAAOD,YAAY,CAAC,CAAC,IAAI,CAAED,gBAAgB,CAAC,CAAC;EAC9C,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMG,gBAAgB,GAAG,IAAAL,eAAS,EAC/BC,MAAM,IAAMA,MAAM,CAAEH,YAAoB,CAAC,CAACQ,mBAAmB,CAAC,CAAC,EACjE,EACD,CAAC;EAED,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKR,sBAAsB,IAAIM,gBAAgB,CAACG,MAAM,EAAG;MACxDH,gBAAgB,CAACI,OAAO,CAAIC,SAAS,IAAM;QAC1Cd,kBAAkB,CAAEc,SAAU,CAAC;QAC/B,IAAAC,2BAAmB,EAAED,SAAS,CAACE,IAAK,CAAC;MACtC,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAEb,sBAAsB,CAAG,CAAC;EAE/B,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_jsxRuntime","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","jsxs","sprintf","__","children","Array","from","length","map","_","i","jsx","Icon","className","icon","starFilled","size","starHalf","starEmpty","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';\n\nfunction Stars( { rating } ) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tconst fullStarCount = Math.floor( rating );\n\tconst halfStarCount = Math.ceil( rating - fullStarCount );\n\tconst emptyStarCount = 5 - ( fullStarCount + halfStarCount );\n\n\treturn (\n\t\t<span\n\t\t\taria-label={ sprintf(\n\t\t\t\t/* translators: %s: number of stars. */\n\t\t\t\t__( '%s out of 5 stars' ),\n\t\t\t\tstars\n\t\t\t) }\n\t\t>\n\t\t\t{ Array.from( { length: fullStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `full_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-full\"\n\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: halfStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `half_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-half-full\"\n\t\t\t\t\ticon={ starHalf }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: emptyStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `empty_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-empty\"\n\t\t\t\t\ticon={ starEmpty }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</span>\n\t);\n}\n\nexport default Stars;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_jsxRuntime","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","jsxs","sprintf","__","children","Array","from","length","map","_","i","jsx","Icon","className","icon","starFilled","size","starHalf","starEmpty","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';\n\nfunction Stars( { rating } ) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tconst fullStarCount = Math.floor( rating );\n\tconst halfStarCount = Math.ceil( rating - fullStarCount );\n\tconst emptyStarCount = 5 - ( fullStarCount + halfStarCount );\n\n\treturn (\n\t\t<span\n\t\t\taria-label={ sprintf(\n\t\t\t\t/* translators: %s: number of stars. */\n\t\t\t\t__( '%s out of 5 stars' ),\n\t\t\t\tstars\n\t\t\t) }\n\t\t>\n\t\t\t{ Array.from( { length: fullStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `full_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-full\"\n\t\t\t\t\ticon={ starFilled }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: halfStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `half_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-half-full\"\n\t\t\t\t\ticon={ starHalf }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ Array.from( { length: emptyStarCount } ).map( ( _, i ) => (\n\t\t\t\t<Icon\n\t\t\t\t\tkey={ `empty_stars_${ i }` }\n\t\t\t\t\tclassName=\"block-directory-block-ratings__star-empty\"\n\t\t\t\t\ticon={ starEmpty }\n\t\t\t\t\tsize={ 16 }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</span>\n\t);\n}\n\nexport default Stars;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAyE,IAAAE,WAAA,GAAAF,OAAA;AAJzE;AACA;AACA;;AAIA,SAASG,KAAKA,CAAE;EAAEC;AAAO,CAAC,EAAG;EAC5B,MAAMC,KAAK,GAAGC,IAAI,CAACC,KAAK,CAAEH,MAAM,GAAG,GAAI,CAAC,GAAG,GAAG;EAE9C,MAAMI,aAAa,GAAGF,IAAI,CAACG,KAAK,CAAEL,MAAO,CAAC;EAC1C,MAAMM,aAAa,GAAGJ,IAAI,CAACK,IAAI,CAAEP,MAAM,GAAGI,aAAc,CAAC;EACzD,MAAMI,cAAc,GAAG,CAAC,IAAKJ,aAAa,GAAGE,aAAa,CAAE;EAE5D,oBACC,IAAAR,WAAA,CAAAW,IAAA;IACC,cAAa,IAAAC,aAAO,EACnB;IACA,IAAAC,QAAE,EAAE,mBAAoB,CAAC,EACzBV,KACD,CAAG;IAAAW,QAAA,GAEDC,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEX;IAAc,CAAE,CAAC,CAACY,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACpD,IAAApB,WAAA,CAAAqB,GAAA,EAACtB,MAAA,CAAAuB,IAAI;MAEJC,SAAS,EAAC,0CAA0C;MACpDC,IAAI,EAAGC,iBAAY;MACnBC,IAAI,EAAG;IAAI,GAHL,cAAeN,CAAC,EAItB,CACA,CAAC,EACDL,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAET;IAAc,CAAE,CAAC,CAACU,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACpD,IAAApB,WAAA,CAAAqB,GAAA,EAACtB,MAAA,CAAAuB,IAAI;MAEJC,SAAS,EAAC,+CAA+C;MACzDC,IAAI,EAAGG,eAAU;MACjBD,IAAI,EAAG;IAAI,GAHL,cAAeN,CAAC,EAItB,CACA,CAAC,EACDL,KAAK,CAACC,IAAI,CAAE;MAAEC,MAAM,EAAEP;IAAe,CAAE,CAAC,CAACQ,GAAG,CAAE,CAAEC,CAAC,EAAEC,CAAC,kBACrD,IAAApB,WAAA,CAAAqB,GAAA,EAACtB,MAAA,CAAAuB,IAAI;MAEJC,SAAS,EAAC,2CAA2C;MACrDC,IAAI,EAAGI,gBAAW;MAClBF,IAAI,EAAG;IAAI,GAHL,eAAgBN,CAAC,EAIvB,CACA,CAAC;EAAA,CACE,CAAC;AAET;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc9B,KAAK","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_downloadableBlockIcon","_interopRequireDefault","_jsxRuntime","CompactList","items","length","jsx","className","children","map","icon","id","title","author","jsxs","default","sprintf","__"],"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockIcon from '../downloadable-block-icon';\n\nexport default function CompactList( { items } ) {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul className=\"block-directory-compact-list\">\n\t\t\t{ items.map( ( { icon, id, title, author } ) => (\n\t\t\t\t<li key={ id } className=\"block-directory-compact-list__item\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\n\t\t\t\t\t<div className=\"block-directory-compact-list__item-details\">\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-author\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Name of the block author. */\n\t\t\t\t\t\t\t\t__( 'By %s' ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_downloadableBlockIcon","_interopRequireDefault","_jsxRuntime","CompactList","items","length","jsx","className","children","map","icon","id","title","author","jsxs","default","sprintf","__"],"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockIcon from '../downloadable-block-icon';\n\nexport default function CompactList( { items } ) {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ul className=\"block-directory-compact-list\">\n\t\t\t{ items.map( ( { icon, id, title, author } ) => (\n\t\t\t\t<li key={ id } className=\"block-directory-compact-list__item\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\n\t\t\t\t\t<div className=\"block-directory-compact-list__item-details\">\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"block-directory-compact-list__item-author\">\n\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: Name of the block author. */\n\t\t\t\t\t\t\t\t__( 'By %s' ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+D,IAAAG,WAAA,GAAAH,OAAA;AAR/D;AACA;AACA;;AAGA;AACA;AACA;;AAGe,SAASI,WAAWA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChD,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAH,WAAA,CAAAI,GAAA;IAAIC,SAAS,EAAC,8BAA8B;IAAAC,QAAA,EACzCJ,KAAK,CAACK,GAAG,CAAE,CAAE;MAAEC,IAAI;MAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAO,CAAC,kBACzC,IAAAX,WAAA,CAAAY,IAAA;MAAeP,SAAS,EAAC,oCAAoC;MAAAC,QAAA,gBAC5D,IAAAN,WAAA,CAAAI,GAAA,EAACN,sBAAA,CAAAe,OAAqB;QAACL,IAAI,EAAGA,IAAM;QAACE,KAAK,EAAGA;MAAO,CAAE,CAAC,eAEvD,IAAAV,WAAA,CAAAY,IAAA;QAAKP,SAAS,EAAC,4CAA4C;QAAAC,QAAA,gBAC1D,IAAAN,WAAA,CAAAI,GAAA;UAAKC,SAAS,EAAC,0CAA0C;UAAAC,QAAA,EACtDI;QAAK,CACH,CAAC,eACN,IAAAV,WAAA,CAAAI,GAAA;UAAKC,SAAS,EAAC,2CAA2C;UAAAC,QAAA,EACvD,IAAAQ,aAAO,EACR;UACA,IAAAC,QAAE,EAAE,OAAQ,CAAC,EACbJ,MACD;QAAC,CACG,CAAC;MAAA,CACF,CAAC;IAAA,GAdGF,EAeN,CACH;EAAC,CACA,CAAC;AAEP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_blocks","_data","_downloadableBlockListItem","_interopRequireDefault","_store","_jsxRuntime","noop","DownloadableBlocksList","items","onHover","onSelect","installBlockType","useDispatch","blockDirectoryStore","length","jsx","Composite","role","className","__","children","map","item","default","onClick","getBlockType","name","then","success","id","_default","exports"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Composite } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonHover( null );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\titem={ item }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Composite>\n\t);\n}\n\nexport default DownloadableBlocksList;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_blocks","_data","_downloadableBlockListItem","_interopRequireDefault","_store","_jsxRuntime","noop","DownloadableBlocksList","items","onHover","onSelect","installBlockType","useDispatch","blockDirectoryStore","length","jsx","Composite","role","className","__","children","map","item","default","onClick","getBlockType","name","then","success","id","_default","exports"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Composite } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlockListItem from '../downloadable-block-list-item';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst noop = () => {};\n\nfunction DownloadableBlocksList( { items, onHover = noop, onSelect } ) {\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Composite\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-directory-downloadable-blocks-list\"\n\t\t\taria-label={ __( 'Blocks available for install' ) }\n\t\t>\n\t\t\t{ items.map( ( item ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlockListItem\n\t\t\t\t\t\tkey={ item.id }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t// Check if the block is registered (`getBlockType`\n\t\t\t\t\t\t\t// will return an object). If so, insert the block.\n\t\t\t\t\t\t\t// This prevents installing existing plugins.\n\t\t\t\t\t\t\tif ( getBlockType( item.name ) ) {\n\t\t\t\t\t\t\t\tonSelect( item );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tinstallBlockType( item ).then( ( success ) => {\n\t\t\t\t\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\t\t\t\t\tonSelect( item );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EAAG;YAChChB,QAAQ,CAAEY,IAAK,CAAC;UACjB,CAAC,MAAM;YACNX,gBAAgB,CAAEW,IAAK,CAAC,CAACK,IAAI,CAAIC,OAAO,IAAM;cAC7C,IAAKA,OAAO,EAAG;gBACdlB,QAAQ,CAAEY,IAAK,CAAC;cACjB;YACD,CAAE,CAAC;UACJ;UACAb,OAAO,CAAE,IAAK,CAAC;QAChB,CAAG;QACHA,OAAO,EAAGA,OAAS;QACnBa,IAAI,EAAGA;MAAM,GAjBPA,IAAI,CAACO,EAkBX,CAAC;IAEJ,CAAE;EAAC,CACO,CAAC;AAEd;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEchB,sBAAsB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_coreData","_data","_blocks","_downloadableBlocksList","_interopRequireDefault","_inserterPanel","_noResults","_store","_jsxRuntime","EMPTY_ARRAY","useDownloadableBlocks","filterValue","useSelect","select","getDownloadableBlocks","isRequestingDownloadableBlocks","getInstalledBlockTypes","blockDirectoryStore","hasPermission","coreStore","canUser","downloadableBlocks","installedBlockTypes","installableBlocks","filter","name","isJustInstalled","some","blockType","isPreviouslyInstalled","getBlockType","length","isLoading","DownloadableBlocksPanel","onSelect","onHover","hasLocalBlocks","isTyping","undefined","jsxs","Fragment","children","jsx","className","__","Spinner","default","downloadableItems","items"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksList from '../downloadable-blocks-list';\nimport DownloadableBlocksInserterPanel from './inserter-panel';\nimport DownloadableBlocksNoResults from './no-results';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nconst useDownloadableBlocks = ( filterValue ) =>\n\tuseSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDownloadableBlocks,\n\t\t\t\tisRequestingDownloadableBlocks,\n\t\t\t\tgetInstalledBlockTypes,\n\t\t\t} = select( blockDirectoryStore );\n\n\t\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t\t'read',\n\t\t\t\t'block-directory/search'\n\t\t\t);\n\n\t\t\tlet downloadableBlocks = EMPTY_ARRAY;\n\t\t\tif ( hasPermission ) {\n\t\t\t\tdownloadableBlocks = getDownloadableBlocks( filterValue );\n\n\t\t\t\t// Filter out blocks that are already installed.\n\t\t\t\tconst installedBlockTypes = getInstalledBlockTypes();\n\t\t\t\tconst installableBlocks = downloadableBlocks.filter(\n\t\t\t\t\t( { name } ) => {\n\t\t\t\t\t\t// Check if the block has just been installed, in which case it\n\t\t\t\t\t\t// should still show in the list to avoid suddenly disappearing.\n\t\t\t\t\t\t// `installedBlockTypes` only returns blocks stored in state\n\t\t\t\t\t\t// immediately after installation, not all installed blocks.\n\t\t\t\t\t\tconst isJustInstalled = installedBlockTypes.some(\n\t\t\t\t\t\t\t( blockType ) => blockType.name === name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isPreviouslyInstalled = getBlockType( name );\n\t\t\t\t\t\treturn isJustInstalled || ! isPreviouslyInstalled;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Keep identity of the `downloadableBlocks` array if nothing was filtered out\n\t\t\t\tif ( installableBlocks.length !== downloadableBlocks.length ) {\n\t\t\t\t\tdownloadableBlocks = installableBlocks;\n\t\t\t\t}\n\n\t\t\t\t// Return identical empty array when there are no blocks\n\t\t\t\tif ( downloadableBlocks.length === 0 ) {\n\t\t\t\t\tdownloadableBlocks = EMPTY_ARRAY;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasPermission,\n\t\t\t\tdownloadableBlocks,\n\t\t\t\tisLoading: isRequestingDownloadableBlocks( filterValue ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\nexport default function DownloadableBlocksPanel( {\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\tisTyping,\n\tfilterValue,\n} ) {\n\tconst { hasPermission, downloadableBlocks, isLoading } =\n\t\tuseDownloadableBlocks( filterValue );\n\n\tif ( hasPermission === undefined || isLoading || isTyping ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasPermission && ! hasLocalBlocks && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'No results available from your installed blocks.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel has-blocks-loading\">\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( false === hasPermission ) {\n\t\tif ( ! hasLocalBlocks ) {\n\t\t\treturn <DownloadableBlocksNoResults />;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( downloadableBlocks.length === 0 ) {\n\t\treturn hasLocalBlocks ? null : <DownloadableBlocksNoResults />;\n\t}\n\n\treturn (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableBlocks }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableBlocks }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_coreData","_data","_blocks","_downloadableBlocksList","_interopRequireDefault","_inserterPanel","_noResults","_store","_jsxRuntime","EMPTY_ARRAY","useDownloadableBlocks","filterValue","useSelect","select","getDownloadableBlocks","isRequestingDownloadableBlocks","getInstalledBlockTypes","blockDirectoryStore","hasPermission","coreStore","canUser","downloadableBlocks","installedBlockTypes","installableBlocks","filter","name","isJustInstalled","some","blockType","isPreviouslyInstalled","getBlockType","length","isLoading","DownloadableBlocksPanel","onSelect","onHover","hasLocalBlocks","isTyping","undefined","jsxs","Fragment","children","jsx","className","__","Spinner","default","downloadableItems","items"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksList from '../downloadable-blocks-list';\nimport DownloadableBlocksInserterPanel from './inserter-panel';\nimport DownloadableBlocksNoResults from './no-results';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst EMPTY_ARRAY = [];\n\nconst useDownloadableBlocks = ( filterValue ) =>\n\tuseSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetDownloadableBlocks,\n\t\t\t\tisRequestingDownloadableBlocks,\n\t\t\t\tgetInstalledBlockTypes,\n\t\t\t} = select( blockDirectoryStore );\n\n\t\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t\t'read',\n\t\t\t\t'block-directory/search'\n\t\t\t);\n\n\t\t\tlet downloadableBlocks = EMPTY_ARRAY;\n\t\t\tif ( hasPermission ) {\n\t\t\t\tdownloadableBlocks = getDownloadableBlocks( filterValue );\n\n\t\t\t\t// Filter out blocks that are already installed.\n\t\t\t\tconst installedBlockTypes = getInstalledBlockTypes();\n\t\t\t\tconst installableBlocks = downloadableBlocks.filter(\n\t\t\t\t\t( { name } ) => {\n\t\t\t\t\t\t// Check if the block has just been installed, in which case it\n\t\t\t\t\t\t// should still show in the list to avoid suddenly disappearing.\n\t\t\t\t\t\t// `installedBlockTypes` only returns blocks stored in state\n\t\t\t\t\t\t// immediately after installation, not all installed blocks.\n\t\t\t\t\t\tconst isJustInstalled = installedBlockTypes.some(\n\t\t\t\t\t\t\t( blockType ) => blockType.name === name\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst isPreviouslyInstalled = getBlockType( name );\n\t\t\t\t\t\treturn isJustInstalled || ! isPreviouslyInstalled;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\t// Keep identity of the `downloadableBlocks` array if nothing was filtered out\n\t\t\t\tif ( installableBlocks.length !== downloadableBlocks.length ) {\n\t\t\t\t\tdownloadableBlocks = installableBlocks;\n\t\t\t\t}\n\n\t\t\t\t// Return identical empty array when there are no blocks\n\t\t\t\tif ( downloadableBlocks.length === 0 ) {\n\t\t\t\t\tdownloadableBlocks = EMPTY_ARRAY;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasPermission,\n\t\t\t\tdownloadableBlocks,\n\t\t\t\tisLoading: isRequestingDownloadableBlocks( filterValue ),\n\t\t\t};\n\t\t},\n\t\t[ filterValue ]\n\t);\n\nexport default function DownloadableBlocksPanel( {\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\tisTyping,\n\tfilterValue,\n} ) {\n\tconst { hasPermission, downloadableBlocks, isLoading } =\n\t\tuseDownloadableBlocks( filterValue );\n\n\tif ( hasPermission === undefined || isLoading || isTyping ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ hasPermission && ! hasLocalBlocks && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'No results available from your installed blocks.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel has-blocks-loading\">\n\t\t\t\t\t<Spinner />\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tif ( false === hasPermission ) {\n\t\tif ( ! hasLocalBlocks ) {\n\t\t\treturn <DownloadableBlocksNoResults />;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tif ( downloadableBlocks.length === 0 ) {\n\t\treturn hasLocalBlocks ? null : <DownloadableBlocksNoResults />;\n\t}\n\n\treturn (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableBlocks }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableBlocks }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,uBAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,cAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,UAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAA2D,IAAAU,WAAA,GAAAV,OAAA;AAf3D;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAMW,WAAW,GAAG,EAAE;AAEtB,MAAMC,qBAAqB,GAAKC,WAAW,IAC1C,IAAAC,eAAS,EACNC,MAAM,IAAM;EACb,MAAM;IACLC,qBAAqB;IACrBC,8BAA8B;IAC9BC;EACD,CAAC,GAAGH,MAAM,CAAEI,YAAoB,CAAC;EAEjC,MAAMC,aAAa,GA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":[]}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _i18n = require("@wordpress/i18n");
|
|
8
|
-
var _icons = require("@wordpress/icons");
|
|
9
8
|
var _components = require("@wordpress/components");
|
|
10
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
10
|
/**
|
|
@@ -14,14 +13,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
14
13
|
|
|
15
14
|
function DownloadableBlocksNoResults() {
|
|
16
15
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
17
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
16
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
18
17
|
className: "block-editor-inserter__no-results",
|
|
19
|
-
children:
|
|
20
|
-
className: "block-editor-inserter__no-results-icon",
|
|
21
|
-
icon: _icons.blockDefault
|
|
22
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
18
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
23
19
|
children: (0, _i18n.__)('No results found.')
|
|
24
|
-
})
|
|
20
|
+
})
|
|
25
21
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
26
22
|
className: "block-editor-inserter__tips",
|
|
27
23
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Tip, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_jsxRuntime","DownloadableBlocksNoResults","jsxs","Fragment","children","jsx","className","__","Tip","ExternalLink","href","_default","exports","default"],"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAA0D,IAAAE,WAAA,GAAAF,OAAA;AAJ1D;AACA;AACA;;AAIA,SAASG,2BAA2BA,CAAA,EAAG;EACtC,oBACC,IAAAD,WAAA,CAAAE,IAAA,EAAAF,WAAA,CAAAG,QAAA;IAAAC,QAAA,gBACC,IAAAJ,WAAA,CAAAK,GAAA;MAAKC,SAAS,EAAC,mCAAmC;MAAAF,QAAA,eACjD,IAAAJ,WAAA,CAAAK,GAAA;QAAAD,QAAA,EAAK,IAAAG,QAAE,EAAE,mBAAoB;MAAC,CAAK;IAAC,CAChC,CAAC,eACN,IAAAP,WAAA,CAAAK,GAAA;MAAKC,SAAS,EAAC,6BAA6B;MAAAF,QAAA,eAC3C,IAAAJ,WAAA,CAAAE,IAAA,EAACH,WAAA,CAAAS,GAAG;QAAAJ,QAAA,GACD,IAAAG,QAAE,EAAE,wCAAyC,CAAC,eAChD,IAAAP,WAAA,CAAAK,GAAA,UAAK,CAAC,eACN,IAAAL,WAAA,CAAAE,IAAA,EAACH,WAAA,CAAAU,YAAY;UAACC,IAAI,EAAC,+CAA+C;UAAAN,QAAA,GAC/D,IAAAG,QAAE,EAAE,kBAAmB,CAAC,EAAE,GAC7B;QAAA,CAAc,CAAC;MAAA,CACX;IAAC,CACF,CAAC;EAAA,CACL,CAAC;AAEL;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcZ,2BAA2B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_blocks","_element","_data","_coreData","_blockEditor","_installButton","_interopRequireDefault","_store","_jsxRuntime","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","useSelect","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","jsx","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","useDispatch","blockEditorStore","convertToHTML","createBlock","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","sprintf","__","title","actions","default","push","Button","__next40pxDefaultSize","onClick","variant","children","jsxs","useBlockProps","Warning","RawHTML","_default","exports"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_blocks","_element","_data","_coreData","_blockEditor","_installButton","_interopRequireDefault","_store","_jsxRuntime","getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","useSelect","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","jsx","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","useDispatch","blockEditorStore","convertToHTML","createBlock","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","sprintf","__","title","actions","default","push","Button","__next40pxDefaultSize","onClick","variant","children","jsxs","useBlockProps","Warning","RawHTML","_default","exports"],"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { RawHTML } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tWarning,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport InstallButton from './install-button';\nimport { store as blockDirectoryStore } from '../../store';\n\nconst getInstallMissing = ( OriginalComponent ) => ( props ) => {\n\tconst { originalName } = props.attributes;\n\t// Disable reason: This is a valid component, but it's mistaken for a callback.\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst { block, hasPermission } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getDownloadableBlocks } = select( blockDirectoryStore );\n\t\t\tconst blocks = getDownloadableBlocks(\n\t\t\t\t'block:' + originalName\n\t\t\t).filter( ( { name } ) => originalName === name );\n\t\t\treturn {\n\t\t\t\thasPermission: select( coreStore ).canUser(\n\t\t\t\t\t'read',\n\t\t\t\t\t'block-directory/search'\n\t\t\t\t),\n\t\t\t\tblock: blocks.length && blocks[ 0 ],\n\t\t\t};\n\t\t},\n\t\t[ originalName ]\n\t);\n\n\t// The user can't install blocks, or the block isn't available for download.\n\tif ( ! hasPermission || ! block ) {\n\t\treturn <OriginalComponent { ...props } />;\n\t}\n\n\treturn <ModifiedWarning { ...props } originalBlock={ block } />;\n};\n\nconst ModifiedWarning = ( { originalBlock, ...props } ) => {\n\tconst { originalName, originalUndelimitedContent, clientId } =\n\t\tprops.attributes;\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\tconst convertToHTML = () => {\n\t\treplaceBlock(\n\t\t\tprops.clientId,\n\t\t\tcreateBlock( 'core/html', {\n\t\t\t\tcontent: originalUndelimitedContent,\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst hasContent = !! originalUndelimitedContent;\n\tconst hasHTMLBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canInsertBlockType, getBlockRootClientId } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn canInsertBlockType(\n\t\t\t\t'core/html',\n\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tlet messageHTML = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__(\n\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block or remove it entirely.'\n\t\t),\n\t\toriginalBlock.title || originalName\n\t);\n\tconst actions = [\n\t\t<InstallButton\n\t\t\tkey=\"install\"\n\t\t\tblock={ originalBlock }\n\t\t\tattributes={ props.attributes }\n\t\t\tclientId={ props.clientId }\n\t\t/>,\n\t];\n\n\tif ( hasContent && hasHTMLBlock ) {\n\t\tmessageHTML = sprintf(\n\t\t\t/* translators: %s: block name */\n\t\t\t__(\n\t\t\t\t'Your site doesn’t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely.'\n\t\t\t),\n\t\t\toriginalBlock.title || originalName\n\t\t);\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tkey=\"convert\"\n\t\t\t\tonClick={ convertToHTML }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t>\n\t\t\t\t{ __( 'Keep as HTML' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...useBlockProps() }>\n\t\t\t<Warning actions={ actions }>{ messageHTML }</Warning>\n\t\t\t<RawHTML>{ originalUndelimitedContent }</RawHTML>\n\t\t</div>\n\t);\n};\n\nexport default getInstallMissing;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AASA,IAAAO,cAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAA2D,IAAAU,WAAA,GAAAV,OAAA;AAnB3D;AACA;AACA;;AAaA;AACA;AACA;;AAIA,MAAMW,iBAAiB,GAAKC,iBAAiB,IAAQC,KAAK,IAAM;EAC/D,MAAM;IAAEC;EAAa,CAAC,GAAGD,KAAK,CAACE,UAAU;EACzC;EACA;EACA,MAAM;IAAEC,KAAK;IAAEC;EAAc,CAA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AAuD,OAAO;MAAAJ,QAAA,EAAGvB;IAA0B,CAAW,CAAC;EAAA,CAC7C,CAAC;AAER,CAAC;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEarC,iBAAiB","ignoreList":[]}
|
package/build/plugins/index.js
CHANGED
|
@@ -17,6 +17,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
(0, _plugins.registerPlugin)('block-directory', {
|
|
20
|
+
// The icon is explicitly set to undefined to prevent PluginPrePublishPanel
|
|
21
|
+
// from rendering the fallback icon pluginIcon.
|
|
22
|
+
icon: undefined,
|
|
20
23
|
render() {
|
|
21
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
22
25
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_autoBlockUninstaller.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_inserterMenuDownloadableBlocksPanel.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_installedBlocksPrePublishPanel.default, {})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_plugins","require","_hooks","_autoBlockUninstaller","_interopRequireDefault","_inserterMenuDownloadableBlocksPanel","_installedBlocksPrePublishPanel","_getInstallMissing","_jsxRuntime","registerPlugin","render","jsxs","Fragment","children","jsx","default","addFilter","settings","name","edit","getInstallMissing"],"sources":["@wordpress/block-directory/src/plugins/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport AutoBlockUninstaller from '../components/auto-block-uninstaller';\nimport InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';\nimport InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';\nimport getInstallMissing from './get-install-missing';\n\nregisterPlugin( 'block-directory', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AutoBlockUninstaller />\n\t\t\t\t<InserterMenuDownloadableBlocksPanel />\n\t\t\t\t<InstalledBlocksPrePublishPanel />\n\t\t\t</>\n\t\t);\n\t},\n} );\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-directory/fallback',\n\t( settings, name ) => {\n\t\tif ( name !== 'core/missing' ) {\n\t\t\treturn settings;\n\t\t}\n\t\tsettings.edit = getInstallMissing( settings.edit );\n\n\t\treturn settings;\n\t}\n);\n"],"mappings":";;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,+BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,kBAAA,GAAAH,sBAAA,CAAAH,OAAA;AAAsD,IAAAO,WAAA,GAAAP,OAAA;AAZtD;AACA;AACA;;AAIA;AACA;AACA;;AAMA,IAAAQ,uBAAc,EAAE,iBAAiB,EAAE;
|
|
1
|
+
{"version":3,"names":["_plugins","require","_hooks","_autoBlockUninstaller","_interopRequireDefault","_inserterMenuDownloadableBlocksPanel","_installedBlocksPrePublishPanel","_getInstallMissing","_jsxRuntime","registerPlugin","icon","undefined","render","jsxs","Fragment","children","jsx","default","addFilter","settings","name","edit","getInstallMissing"],"sources":["@wordpress/block-directory/src/plugins/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport AutoBlockUninstaller from '../components/auto-block-uninstaller';\nimport InserterMenuDownloadableBlocksPanel from './inserter-menu-downloadable-blocks-panel';\nimport InstalledBlocksPrePublishPanel from './installed-blocks-pre-publish-panel';\nimport getInstallMissing from './get-install-missing';\n\nregisterPlugin( 'block-directory', {\n\t// The icon is explicitly set to undefined to prevent PluginPrePublishPanel\n\t// from rendering the fallback icon pluginIcon.\n\ticon: undefined,\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<AutoBlockUninstaller />\n\t\t\t\t<InserterMenuDownloadableBlocksPanel />\n\t\t\t\t<InstalledBlocksPrePublishPanel />\n\t\t\t</>\n\t\t);\n\t},\n} );\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'block-directory/fallback',\n\t( settings, name ) => {\n\t\tif ( name !== 'core/missing' ) {\n\t\t\treturn settings;\n\t\t}\n\t\tsettings.edit = getInstallMissing( settings.edit );\n\n\t\treturn settings;\n\t}\n);\n"],"mappings":";;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,oCAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,+BAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,kBAAA,GAAAH,sBAAA,CAAAH,OAAA;AAAsD,IAAAO,WAAA,GAAAP,OAAA;AAZtD;AACA;AACA;;AAIA;AACA;AACA;;AAMA,IAAAQ,uBAAc,EAAE,iBAAiB,EAAE;EAClC;EACA;EACAC,IAAI,EAAEC,SAAS;EACfC,MAAMA,CAAA,EAAG;IACR,oBACC,IAAAJ,WAAA,CAAAK,IAAA,EAAAL,WAAA,CAAAM,QAAA;MAAAC,QAAA,gBACC,IAAAP,WAAA,CAAAQ,GAAA,EAACb,qBAAA,CAAAc,OAAoB,IAAE,CAAC,eACxB,IAAAT,WAAA,CAAAQ,GAAA,EAACX,oCAAA,CAAAY,OAAmC,IAAE,CAAC,eACvC,IAAAT,WAAA,CAAAQ,GAAA,EAACV,+BAAA,CAAAW,OAA8B,IAAE,CAAC;IAAA,CACjC,CAAC;EAEL;AACD,CAAE,CAAC;AAEH,IAAAC,gBAAS,EACR,0BAA0B,EAC1B,0BAA0B,EAC1B,CAAEC,QAAQ,EAAEC,IAAI,KAAM;EACrB,IAAKA,IAAI,KAAK,cAAc,EAAG;IAC9B,OAAOD,QAAQ;EAChB;EACAA,QAAQ,CAACE,IAAI,GAAG,IAAAC,0BAAiB,EAAEH,QAAQ,CAACE,IAAK,CAAC;EAElD,OAAOF,QAAQ;AAChB,CACD,CAAC","ignoreList":[]}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = InstalledBlocksPrePublishPanel;
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _data = require("@wordpress/data");
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
10
|
var _editor = require("@wordpress/editor");
|
|
12
11
|
var _compactList = _interopRequireDefault(require("../../components/compact-list"));
|
|
13
12
|
var _store = require("../../store");
|
|
@@ -26,7 +25,6 @@ function InstalledBlocksPrePublishPanel() {
|
|
|
26
25
|
return null;
|
|
27
26
|
}
|
|
28
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_editor.PluginPrePublishPanel, {
|
|
29
|
-
icon: _icons.blockDefault,
|
|
30
28
|
title: (0, _i18n.sprintf)(
|
|
31
29
|
// translators: %d: number of blocks (number).
|
|
32
30
|
(0, _i18n._n)('Added: %d block', 'Added: %d blocks', newBlockTypes.length), newBlockTypes.length),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_data","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_data","_editor","_compactList","_interopRequireDefault","_store","_jsxRuntime","InstalledBlocksPrePublishPanel","newBlockTypes","useSelect","select","blockDirectoryStore","getNewBlockTypes","length","jsxs","PluginPrePublishPanel","title","sprintf","_n","initialOpen","children","jsx","className","default","items"],"sources":["@wordpress/block-directory/src/plugins/installed-blocks-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _n, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PluginPrePublishPanel } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport CompactList from '../../components/compact-list';\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstalledBlocksPrePublishPanel() {\n\tconst newBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getNewBlockTypes(),\n\t\t[]\n\t);\n\n\tif ( ! newBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PluginPrePublishPanel\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %d: number of blocks (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Added: %d block',\n\t\t\t\t\t'Added: %d blocks',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t),\n\t\t\t\tnewBlockTypes.length\n\t\t\t) }\n\t\t\tinitialOpen\n\t\t>\n\t\t\t<p className=\"installed-blocks-pre-publish-panel__copy\">\n\t\t\t\t{ _n(\n\t\t\t\t\t'The following block has been added to your site.',\n\t\t\t\t\t'The following blocks have been added to your site.',\n\t\t\t\t\tnewBlockTypes.length\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<CompactList items={ newBlockTypes } />\n\t\t</PluginPrePublishPanel>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,YAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2D,IAAAM,WAAA,GAAAN,OAAA;AAX3D;AACA;AACA;;AAKA;AACA;AACA;;AAIe,SAASO,8BAA8BA,CAAA,EAAG;EACxD,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM,IAAMA,MAAM,CAAEC,YAAoB,CAAC,CAACC,gBAAgB,CAAC,CAAC,EAC9D,EACD,CAAC;EAED,IAAK,CAAEJ,aAAa,CAACK,MAAM,EAAG;IAC7B,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAP,WAAA,CAAAQ,IAAA,EAACZ,OAAA,CAAAa,qBAAqB;IACrBC,KAAK,EAAG,IAAAC,aAAO;IACd;IACA,IAAAC,QAAE,EACD,iBAAiB,EACjB,kBAAkB,EAClBV,aAAa,CAACK,MACf,CAAC,EACDL,aAAa,CAACK,MACf,CAAG;IACHM,WAAW;IAAAC,QAAA,gBAEX,IAAAd,WAAA,CAAAe,GAAA;MAAGC,SAAS,EAAC,0CAA0C;MAAAF,QAAA,EACpD,IAAAF,QAAE,EACH,kDAAkD,EAClD,oDAAoD,EACpDV,aAAa,CAACK,MACf;IAAC,CACC,CAAC,eACJ,IAAAP,WAAA,CAAAe,GAAA,EAAClB,YAAA,CAAAoB,OAAW;MAACC,KAAK,EAAGhB;IAAe,CAAE,CAAC;EAAA,CACjB,CAAC;AAE1B","ignoreList":[]}
|
package/build/store/actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_i18n","_apiFetch","_interopRequireDefault","_notices","_url","_loadAssets","_getPluginUrl","fetchDownloadableBlocks","filterValue","type","receiveDownloadableBlocks","downloadableBlocks","installBlockType","block","registry","dispatch","id","name","success","clearErrorNotice","setIsInstalling","url","getPluginUrl","links","apiFetch","method","data","status","response","path","slug","_links","addInstalledBlockType","metadataFields","addQueryArgs","_fields","catch","then","unstable__bootstrapServerSideBlockDefinitions","Object","fromEntries","entries","filter","key","includes","loadAssets","registeredBlocks","select","blocksStore","getBlockTypes","some","i","Error","__","noticesStore","createInfoNotice","sprintf","title","speak","error","message","isFatal","fatalAPIErrors","folder_exists","unable_to_connect_to_filesystem","code","setErrorNotice","createErrorNotice","isDismissible","exports","uninstallBlockType","removeInstalledBlockType","item","blockId","isInstalling"],"sources":["@wordpress/block-directory/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore as blocksStore,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n} from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { loadAssets } from './load-assets';\nimport getPluginUrl from './utils/get-plugin-url';\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been requested and are loading.\n *\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function fetchDownloadableBlocks( filterValue ) {\n\treturn { type: 'FETCH_DOWNLOADABLE_BLOCKS', filterValue };\n}\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been updated.\n *\n * @param {Array} downloadableBlocks Downloadable blocks.\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function receiveDownloadableBlocks( downloadableBlocks, filterValue ) {\n\treturn {\n\t\ttype: 'RECEIVE_DOWNLOADABLE_BLOCKS',\n\t\tdownloadableBlocks,\n\t\tfilterValue,\n\t};\n}\n\n/**\n * Action triggered to install a block plugin.\n *\n * @param {Object} block The block item returned by search.\n *\n * @return {boolean} Whether the block was successfully installed & loaded.\n */\nexport const installBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst { id, name } = block;\n\t\tlet success = false;\n\t\tdispatch.clearErrorNotice( id );\n\t\ttry {\n\t\t\tdispatch.setIsInstalling( id, true );\n\n\t\t\t// If we have a wp:plugin link, the plugin is installed but inactive.\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tlet links = {};\n\t\t\tif ( url ) {\n\t\t\t\tawait apiFetch( {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\turl,\n\t\t\t\t\tdata: { status: 'active' },\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst response = await apiFetch( {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tpath: 'wp/v2/plugins',\n\t\t\t\t\tdata: { slug: id, status: 'active' },\n\t\t\t\t} );\n\t\t\t\t// Add the `self` link for newly-installed blocks.\n\t\t\t\tlinks = response._links;\n\t\t\t}\n\n\t\t\tdispatch.addInstalledBlockType( {\n\t\t\t\t...block,\n\t\t\t\tlinks: { ...block.links, ...links },\n\t\t\t} );\n\n\t\t\t// Ensures that the block metadata is propagated to the editor when registered on the server.\n\t\t\tconst metadataFields = [\n\t\t\t\t'api_version',\n\t\t\t\t'title',\n\t\t\t\t'category',\n\t\t\t\t'parent',\n\t\t\t\t'icon',\n\t\t\t\t'description',\n\t\t\t\t'keywords',\n\t\t\t\t'attributes',\n\t\t\t\t'provides_context',\n\t\t\t\t'uses_context',\n\t\t\t\t'supports',\n\t\t\t\t'styles',\n\t\t\t\t'example',\n\t\t\t\t'variations',\n\t\t\t];\n\t\t\tawait apiFetch( {\n\t\t\t\tpath: addQueryArgs( `/wp/v2/block-types/${ name }`, {\n\t\t\t\t\t_fields: metadataFields,\n\t\t\t\t} ),\n\t\t\t} )\n\t\t\t\t// Ignore when the block is not registered on the server.\n\t\t\t\t.catch( () => {} )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( ! response ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tunstable__bootstrapServerSideBlockDefinitions( {\n\t\t\t\t\t\t[ name ]: Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( response ).filter( ( [ key ] ) =>\n\t\t\t\t\t\t\t\tmetadataFields.includes( key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\t\t\t\t} );\n\n\t\t\tawait loadAssets();\n\t\t\tconst registeredBlocks = registry\n\t\t\t\t.select( blocksStore )\n\t\t\t\t.getBlockTypes();\n\t\t\tif ( ! registeredBlocks.some( ( i ) => i.name === name ) ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t__( 'Error registering block. Try reloading the page.' )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createInfoNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s is the block title.\n\t\t\t\t\t__( 'Block %s installed and added.' ),\n\t\t\t\t\tblock.title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tspeak: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\tsuccess = true;\n\t\t} catch ( error ) {\n\t\t\tlet message = error.message || __( 'An error occurred.' );\n\n\t\t\t// Errors we throw are fatal.\n\t\t\tlet isFatal = error instanceof Error;\n\n\t\t\t// Specific API errors that are fatal.\n\t\t\tconst fatalAPIErrors = {\n\t\t\t\tfolder_exists: __(\n\t\t\t\t\t'This block is already installed. Try reloading the page.'\n\t\t\t\t),\n\t\t\t\tunable_to_connect_to_filesystem: __(\n\t\t\t\t\t'Error installing block. You can reload the page and try again.'\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tif ( fatalAPIErrors[ error.code ] ) {\n\t\t\t\tisFatal = true;\n\t\t\t\tmessage = fatalAPIErrors[ error.code ];\n\t\t\t}\n\n\t\t\tdispatch.setErrorNotice( id, message, isFatal );\n\t\t\tregistry.dispatch( noticesStore ).createErrorNotice( message, {\n\t\t\t\tspeak: true,\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t}\n\t\tdispatch.setIsInstalling( id, false );\n\t\treturn success;\n\t};\n\n/**\n * Action triggered to uninstall a block plugin.\n *\n * @param {Object} block The blockType object.\n */\nexport const uninstallBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\ttry {\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'PUT',\n\t\t\t\turl,\n\t\t\t\tdata: { status: 'inactive' },\n\t\t\t} );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\turl,\n\t\t\t} );\n\t\t\tdispatch.removeInstalledBlockType( block );\n\t\t} catch ( error ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\terror.message || __( 'An error occurred.' )\n\t\t\t\t);\n\t\t}\n\t};\n\n/**\n * Returns an action object used to add a block type to the \"newly installed\"\n * tracking list.\n *\n * @param {Object} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function addInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'ADD_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to remove a block type from the \"newly installed\"\n * tracking list.\n *\n * @param {string} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function removeInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'REMOVE_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to indicate install in progress.\n *\n * @param {string} blockId\n * @param {boolean} isInstalling\n *\n * @return {Object} Action object.\n */\nexport function setIsInstalling( blockId, isInstalling ) {\n\treturn {\n\t\ttype: 'SET_INSTALLING_BLOCK',\n\t\tblockId,\n\t\tisInstalling,\n\t};\n}\n\n/**\n * Sets an error notice to be displayed to the user for a given block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n * @param {string} message The message shown in the notice.\n * @param {boolean} isFatal Whether the user can recover from the error.\n *\n * @return {Object} Action object.\n */\nexport function setErrorNotice( blockId, message, isFatal = false ) {\n\treturn {\n\t\ttype: 'SET_ERROR_NOTICE',\n\t\tblockId,\n\t\tmessage,\n\t\tisFatal,\n\t};\n}\n\n/**\n * Sets the error notice to empty for specific block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {Object} Action object.\n */\nexport function clearErrorNotice( blockId ) {\n\treturn {\n\t\ttype: 'CLEAR_ERROR_NOTICE',\n\t\tblockId,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;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E,OAAO;IACPb,OAAO;IACPC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS1C,gBAAgBA,CAAEsD,OAAO,EAAG;EAC3C,OAAO;IACNhE,IAAI,EAAE,oBAAoB;IAC1BgE;EACD,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_i18n","_apiFetch","_interopRequireDefault","_notices","_url","_loadAssets","_getPluginUrl","fetchDownloadableBlocks","filterValue","type","receiveDownloadableBlocks","downloadableBlocks","installBlockType","block","registry","dispatch","id","name","success","clearErrorNotice","setIsInstalling","url","getPluginUrl","links","apiFetch","method","data","status","response","path","slug","_links","addInstalledBlockType","metadataFields","addQueryArgs","_fields","catch","then","unstable__bootstrapServerSideBlockDefinitions","Object","fromEntries","entries","filter","key","includes","loadAssets","registeredBlocks","select","blocksStore","getBlockTypes","some","i","Error","__","noticesStore","createInfoNotice","sprintf","title","speak","error","message","isFatal","fatalAPIErrors","folder_exists","unable_to_connect_to_filesystem","code","setErrorNotice","createErrorNotice","isDismissible","exports","uninstallBlockType","removeInstalledBlockType","item","blockId","isInstalling"],"sources":["@wordpress/block-directory/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore as blocksStore,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n} from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { loadAssets } from './load-assets';\nimport getPluginUrl from './utils/get-plugin-url';\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been requested and are loading.\n *\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function fetchDownloadableBlocks( filterValue ) {\n\treturn { type: 'FETCH_DOWNLOADABLE_BLOCKS', filterValue };\n}\n\n/**\n * Returns an action object used in signalling that the downloadable blocks\n * have been updated.\n *\n * @param {Array} downloadableBlocks Downloadable blocks.\n * @param {string} filterValue Search string.\n *\n * @return {Object} Action object.\n */\nexport function receiveDownloadableBlocks( downloadableBlocks, filterValue ) {\n\treturn {\n\t\ttype: 'RECEIVE_DOWNLOADABLE_BLOCKS',\n\t\tdownloadableBlocks,\n\t\tfilterValue,\n\t};\n}\n\n/**\n * Action triggered to install a block plugin.\n *\n * @param {Object} block The block item returned by search.\n *\n * @return {boolean} Whether the block was successfully installed & loaded.\n */\nexport const installBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst { id, name } = block;\n\t\tlet success = false;\n\t\tdispatch.clearErrorNotice( id );\n\t\ttry {\n\t\t\tdispatch.setIsInstalling( id, true );\n\n\t\t\t// If we have a wp:plugin link, the plugin is installed but inactive.\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tlet links = {};\n\t\t\tif ( url ) {\n\t\t\t\tawait apiFetch( {\n\t\t\t\t\tmethod: 'PUT',\n\t\t\t\t\turl,\n\t\t\t\t\tdata: { status: 'active' },\n\t\t\t\t} );\n\t\t\t} else {\n\t\t\t\tconst response = await apiFetch( {\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tpath: 'wp/v2/plugins',\n\t\t\t\t\tdata: { slug: id, status: 'active' },\n\t\t\t\t} );\n\t\t\t\t// Add the `self` link for newly-installed blocks.\n\t\t\t\tlinks = response._links;\n\t\t\t}\n\n\t\t\tdispatch.addInstalledBlockType( {\n\t\t\t\t...block,\n\t\t\t\tlinks: { ...block.links, ...links },\n\t\t\t} );\n\n\t\t\t// Ensures that the block metadata is propagated to the editor when registered on the server.\n\t\t\tconst metadataFields = [\n\t\t\t\t'api_version',\n\t\t\t\t'title',\n\t\t\t\t'category',\n\t\t\t\t'parent',\n\t\t\t\t'icon',\n\t\t\t\t'description',\n\t\t\t\t'keywords',\n\t\t\t\t'attributes',\n\t\t\t\t'provides_context',\n\t\t\t\t'uses_context',\n\t\t\t\t'supports',\n\t\t\t\t'styles',\n\t\t\t\t'example',\n\t\t\t\t'variations',\n\t\t\t];\n\t\t\tawait apiFetch( {\n\t\t\t\tpath: addQueryArgs( `/wp/v2/block-types/${ name }`, {\n\t\t\t\t\t_fields: metadataFields,\n\t\t\t\t} ),\n\t\t\t} )\n\t\t\t\t// Ignore when the block is not registered on the server.\n\t\t\t\t.catch( () => {} )\n\t\t\t\t.then( ( response ) => {\n\t\t\t\t\tif ( ! response ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tunstable__bootstrapServerSideBlockDefinitions( {\n\t\t\t\t\t\t[ name ]: Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( response ).filter( ( [ key ] ) =>\n\t\t\t\t\t\t\t\tmetadataFields.includes( key )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\t\t\t\t} );\n\n\t\t\tawait loadAssets();\n\t\t\tconst registeredBlocks = registry\n\t\t\t\t.select( blocksStore )\n\t\t\t\t.getBlockTypes();\n\t\t\tif ( ! registeredBlocks.some( ( i ) => i.name === name ) ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t__( 'Error registering block. Try reloading the page.' )\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createInfoNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s is the block title.\n\t\t\t\t\t__( 'Block %s installed and added.' ),\n\t\t\t\t\tblock.title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tspeak: true,\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\tsuccess = true;\n\t\t} catch ( error ) {\n\t\t\tlet message = error.message || __( 'An error occurred.' );\n\n\t\t\t// Errors we throw are fatal.\n\t\t\tlet isFatal = error instanceof Error;\n\n\t\t\t// Specific API errors that are fatal.\n\t\t\tconst fatalAPIErrors = {\n\t\t\t\tfolder_exists: __(\n\t\t\t\t\t'This block is already installed. Try reloading the page.'\n\t\t\t\t),\n\t\t\t\tunable_to_connect_to_filesystem: __(\n\t\t\t\t\t'Error installing block. You can reload the page and try again.'\n\t\t\t\t),\n\t\t\t};\n\n\t\t\tif ( fatalAPIErrors[ error.code ] ) {\n\t\t\t\tisFatal = true;\n\t\t\t\tmessage = fatalAPIErrors[ error.code ];\n\t\t\t}\n\n\t\t\tdispatch.setErrorNotice( id, message, isFatal );\n\t\t\tregistry.dispatch( noticesStore ).createErrorNotice( message, {\n\t\t\t\tspeak: true,\n\t\t\t\tisDismissible: true,\n\t\t\t} );\n\t\t}\n\t\tdispatch.setIsInstalling( id, false );\n\t\treturn success;\n\t};\n\n/**\n * Action triggered to uninstall a block plugin.\n *\n * @param {Object} block The blockType object.\n */\nexport const uninstallBlockType =\n\t( block ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\ttry {\n\t\t\tconst url = getPluginUrl( block );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'PUT',\n\t\t\t\turl,\n\t\t\t\tdata: { status: 'inactive' },\n\t\t\t} );\n\t\t\tawait apiFetch( {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\turl,\n\t\t\t} );\n\t\t\tdispatch.removeInstalledBlockType( block );\n\t\t} catch ( error ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\terror.message || __( 'An error occurred.' )\n\t\t\t\t);\n\t\t}\n\t};\n\n/**\n * Returns an action object used to add a block type to the \"newly installed\"\n * tracking list.\n *\n * @param {Object} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function addInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'ADD_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to remove a block type from the \"newly installed\"\n * tracking list.\n *\n * @param {string} item The block item with the block id and name.\n *\n * @return {Object} Action object.\n */\nexport function removeInstalledBlockType( item ) {\n\treturn {\n\t\ttype: 'REMOVE_INSTALLED_BLOCK_TYPE',\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used to indicate install in progress.\n *\n * @param {string} blockId\n * @param {boolean} isInstalling\n *\n * @return {Object} Action object.\n */\nexport function setIsInstalling( blockId, isInstalling ) {\n\treturn {\n\t\ttype: 'SET_INSTALLING_BLOCK',\n\t\tblockId,\n\t\tisInstalling,\n\t};\n}\n\n/**\n * Sets an error notice to be displayed to the user for a given block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n * @param {string} message The message shown in the notice.\n * @param {boolean} isFatal Whether the user can recover from the error.\n *\n * @return {Object} Action object.\n */\nexport function setErrorNotice( blockId, message, isFatal = false ) {\n\treturn {\n\t\ttype: 'SET_ERROR_NOTICE',\n\t\tblockId,\n\t\tmessage,\n\t\tisFatal,\n\t};\n}\n\n/**\n * Sets the error notice to empty for specific block.\n *\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {Object} Action object.\n */\nexport function clearErrorNotice( blockId ) {\n\treturn {\n\t\ttype: 'CLEAR_ERROR_NOTICE',\n\t\tblockId,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,uBAAuBA,CAAEC,WAAW,EAAG;EACtD,OAAO;IAAEC,IAAI,EAAE,2BAA2B;IAAED;EAAY,CAAC;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,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C,OAAQ8C,KAAK,EAAG;IACjB7C,QAAQ,CACNC,QAAQ,CAAEuC,cAAa,CAAC,CACxBa,iBAAiB,CACjBR,KAAK,CAACC,OAAO,IAAI,IAAAP,QAAE,EAAE,oBAAqB,CAC3C,CAAC;EACH;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAgB,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAQO,SAAStC,qBAAqBA,CAAEwC,IAAI,EAAG;EAC7C,OAAO;IACN/D,IAAI,EAAE,0BAA0B;IAChC+D;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASD,wBAAwBA,CAAEC,IAAI,EAAG;EAChD,OAAO;IACN/D,IAAI,EAAE,6BAA6B;IACnC+D;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASpD,eAAeA,CAAEqD,OAAO,EAAEC,YAAY,EAAG;EACxD,OAAO;IACNjE,IAAI,EAAE,sBAAsB;IAC5BgE,OAAO;IACPC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASR,cAAcA,CAAEO,OAAO,EAAEb,OAAO,EAAEC,OAAO,GAAG,KAAK,EAAG;EACnE,OAAO;IACNpD,IAAI,EAAE,kBAAkB;IACxBgE,OAAO;IACPb,OAAO;IACPC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS1C,gBAAgBA,CAAEsD,OAAO,EAAG;EAC3C,OAAO;IACNhE,IAAI,EAAE,oBAAoB;IAC1BgE;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","loadAsset","el","Promise","resolve","reject","newNode","document","createElement","nodeName","forEach","attr","innerHTML","appendChild","createTextNode","onload","onerror","Error","body","toLowerCase","src","exports","loadAssets","response","apiFetch","url","location","href","parse","data","text","doc","window","DOMParser","parseFromString","newAssets","Array","from","querySelectorAll","filter","asset","id","getElementById","newAsset"],"sources":["@wordpress/block-directory/src/store/load-assets.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Load an asset for a block.\n *\n * This function returns a Promise that will resolve once the asset is loaded,\n * or in the case of Stylesheets and Inline JavaScript, will resolve immediately.\n *\n * @param {HTMLElement} el A HTML Element asset to inject.\n *\n * @return {Promise} Promise which will resolve when the asset is loaded.\n */\nexport const loadAsset = ( el ) => {\n\treturn new Promise( ( resolve, reject ) => {\n\t\t/*\n\t\t * Reconstruct the passed element, this is required as inserting the Node directly\n\t\t * won't always fire the required onload events, even if the asset wasn't already loaded.\n\t\t */\n\t\tconst newNode = document.createElement( el.nodeName );\n\n\t\t[ 'id', 'rel', 'src', 'href', 'type' ].forEach( ( attr ) => {\n\t\t\tif ( el[ attr ] ) {\n\t\t\t\tnewNode[ attr ] = el[ attr ];\n\t\t\t}\n\t\t} );\n\n\t\t// Append inline <script> contents.\n\t\tif ( el.innerHTML ) {\n\t\t\tnewNode.appendChild( document.createTextNode( el.innerHTML ) );\n\t\t}\n\n\t\tnewNode.onload = () => resolve( true );\n\t\tnewNode.onerror = () => reject( new Error( 'Error loading asset.' ) );\n\n\t\tdocument.body.appendChild( newNode );\n\n\t\t// Resolve Stylesheets and Inline JavaScript immediately.\n\t\tif (\n\t\t\t'link' === newNode.nodeName.toLowerCase() ||\n\t\t\t( 'script' === newNode.nodeName.toLowerCase() && ! newNode.src )\n\t\t) {\n\t\t\tresolve();\n\t\t}\n\t} );\n};\n\n/**\n * Load the asset files for a block\n */\nexport async function loadAssets() {\n\t/*\n\t * Fetch the current URL (post-new.php, or post.php?post=1&action=edit) and compare the\n\t * JavaScript and CSS assets loaded between the pages. This imports the required assets\n\t * for the block into the current page while not requiring that we know them up-front.\n\t * In the future this can be improved by reliance upon block.json and/or a script-loader\n\t * dependency API.\n\t */\n\tconst response = await apiFetch( {\n\t\turl: document.location.href,\n\t\tparse: false,\n\t} );\n\n\tconst data = await response.text();\n\n\tconst doc = new window.DOMParser().parseFromString( data, 'text/html' );\n\n\tconst newAssets = Array.from(\n\t\tdoc.querySelectorAll( 'link[rel=\"stylesheet\"],script' )\n\t).filter( ( asset ) => asset.id && ! document.getElementById( asset.id ) );\n\n\t/*\n\t * Load each asset in order, as they may depend upon an earlier loaded script.\n\t * Stylesheets and Inline Scripts will resolve immediately upon insertion.\n\t */\n\tfor ( const newAsset of newAssets ) {\n\t\tawait loadAsset( newAsset );\n\t}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","loadAsset","el","Promise","resolve","reject","newNode","document","createElement","nodeName","forEach","attr","innerHTML","appendChild","createTextNode","onload","onerror","Error","body","toLowerCase","src","exports","loadAssets","response","apiFetch","url","location","href","parse","data","text","doc","window","DOMParser","parseFromString","newAssets","Array","from","querySelectorAll","filter","asset","id","getElementById","newAsset"],"sources":["@wordpress/block-directory/src/store/load-assets.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Load an asset for a block.\n *\n * This function returns a Promise that will resolve once the asset is loaded,\n * or in the case of Stylesheets and Inline JavaScript, will resolve immediately.\n *\n * @param {HTMLElement} el A HTML Element asset to inject.\n *\n * @return {Promise} Promise which will resolve when the asset is loaded.\n */\nexport const loadAsset = ( el ) => {\n\treturn new Promise( ( resolve, reject ) => {\n\t\t/*\n\t\t * Reconstruct the passed element, this is required as inserting the Node directly\n\t\t * won't always fire the required onload events, even if the asset wasn't already loaded.\n\t\t */\n\t\tconst newNode = document.createElement( el.nodeName );\n\n\t\t[ 'id', 'rel', 'src', 'href', 'type' ].forEach( ( attr ) => {\n\t\t\tif ( el[ attr ] ) {\n\t\t\t\tnewNode[ attr ] = el[ attr ];\n\t\t\t}\n\t\t} );\n\n\t\t// Append inline <script> contents.\n\t\tif ( el.innerHTML ) {\n\t\t\tnewNode.appendChild( document.createTextNode( el.innerHTML ) );\n\t\t}\n\n\t\tnewNode.onload = () => resolve( true );\n\t\tnewNode.onerror = () => reject( new Error( 'Error loading asset.' ) );\n\n\t\tdocument.body.appendChild( newNode );\n\n\t\t// Resolve Stylesheets and Inline JavaScript immediately.\n\t\tif (\n\t\t\t'link' === newNode.nodeName.toLowerCase() ||\n\t\t\t( 'script' === newNode.nodeName.toLowerCase() && ! newNode.src )\n\t\t) {\n\t\t\tresolve();\n\t\t}\n\t} );\n};\n\n/**\n * Load the asset files for a block\n */\nexport async function loadAssets() {\n\t/*\n\t * Fetch the current URL (post-new.php, or post.php?post=1&action=edit) and compare the\n\t * JavaScript and CSS assets loaded between the pages. This imports the required assets\n\t * for the block into the current page while not requiring that we know them up-front.\n\t * In the future this can be improved by reliance upon block.json and/or a script-loader\n\t * dependency API.\n\t */\n\tconst response = await apiFetch( {\n\t\turl: document.location.href,\n\t\tparse: false,\n\t} );\n\n\tconst data = await response.text();\n\n\tconst doc = new window.DOMParser().parseFromString( data, 'text/html' );\n\n\tconst newAssets = Array.from(\n\t\tdoc.querySelectorAll( 'link[rel=\"stylesheet\"],script' )\n\t).filter( ( asset ) => asset.id && ! document.getElementById( asset.id ) );\n\n\t/*\n\t * Load each asset in order, as they may depend upon an earlier loaded script.\n\t * Stylesheets and Inline Scripts will resolve immediately upon insertion.\n\t */\n\tfor ( const newAsset of newAssets ) {\n\t\tawait loadAsset( newAsset );\n\t}\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GAAKC,EAAE,IAAM;EAClC,OAAO,IAAIC,OAAO,CAAE,CAAEC,OAAO,EAAEC,MAAM,KAAM;IAC1C;AACF;AACA;AACA;IACE,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa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C,SAAS,CAAC,CAAC,CAACC,eAAe,CAAEL,IAAI,EAAE,WAAY,CAAC;EAEvE,MAAMM,SAAS,GAAGC,KAAK,CAACC,IAAI,CAC3BN,GAAG,CAACO,gBAAgB,CAAE,+BAAgC,CACvD,CAAC,CAACC,MAAM,CAAIC,KAAK,IAAMA,KAAK,CAACC,EAAE,IAAI,CAAElC,QAAQ,CAACmC,cAAc,CAAEF,KAAK,CAACC,EAAG,CAAE,CAAC;;EAE1E;AACD;AACA;AACA;EACC,KAAM,MAAME,QAAQ,IAAIR,SAAS,EAAG;IACnC,MAAMlC,SAAS,CAAE0C,QAAS,CAAC;EAC5B;AACD","ignoreList":[]}
|
package/build/store/reducer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","downloadableBlocks","state","action","type","filterValue","isRequesting","results","exports","blockManagement","installedBlockTypes","isInstalling","item","filter","blockType","name","blockId","errorNotices","message","isFatal","restState","_default","default","combineReducers"],"sources":["@wordpress/block-directory/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning an array of downloadable blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const downloadableBlocks = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'FETCH_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tisRequesting: true,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'RECEIVE_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tresults: action.downloadableBlocks,\n\t\t\t\t\tisRequesting: false,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer managing the installation and deletion of blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const blockManagement = (\n\tstate = {\n\t\tinstalledBlockTypes: [],\n\t\tisInstalling: {},\n\t},\n\taction\n) => {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: [\n\t\t\t\t\t...state.installedBlockTypes,\n\t\t\t\t\taction.item,\n\t\t\t\t],\n\t\t\t};\n\t\tcase 'REMOVE_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: state.installedBlockTypes.filter(\n\t\t\t\t\t( blockType ) => blockType.name !== action.item.name\n\t\t\t\t),\n\t\t\t};\n\t\tcase 'SET_INSTALLING_BLOCK':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisInstalling: {\n\t\t\t\t\t...state.isInstalling,\n\t\t\t\t\t[ action.blockId ]: action.isInstalling,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer returning an object of error notices.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const errorNotices = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'SET_ERROR_NOTICE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.blockId ]: {\n\t\t\t\t\tmessage: action.message,\n\t\t\t\t\tisFatal: action.isFatal,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'CLEAR_ERROR_NOTICE':\n\t\t\tconst { [ action.blockId ]: blockId, ...restState } = state;\n\t\t\treturn restState;\n\t}\n\treturn state;\n};\n\nexport default combineReducers( {\n\tdownloadableBlocks,\n\tblockManagement,\n\terrorNotices,\n} );\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_data","require","downloadableBlocks","state","action","type","filterValue","isRequesting","results","exports","blockManagement","installedBlockTypes","isInstalling","item","filter","blockType","name","blockId","errorNotices","message","isFatal","restState","_default","default","combineReducers"],"sources":["@wordpress/block-directory/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning an array of downloadable blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const downloadableBlocks = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'FETCH_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tisRequesting: true,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'RECEIVE_DOWNLOADABLE_BLOCKS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.filterValue ]: {\n\t\t\t\t\tresults: action.downloadableBlocks,\n\t\t\t\t\tisRequesting: false,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer managing the installation and deletion of blocks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const blockManagement = (\n\tstate = {\n\t\tinstalledBlockTypes: [],\n\t\tisInstalling: {},\n\t},\n\taction\n) => {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: [\n\t\t\t\t\t...state.installedBlockTypes,\n\t\t\t\t\taction.item,\n\t\t\t\t],\n\t\t\t};\n\t\tcase 'REMOVE_INSTALLED_BLOCK_TYPE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tinstalledBlockTypes: state.installedBlockTypes.filter(\n\t\t\t\t\t( blockType ) => blockType.name !== action.item.name\n\t\t\t\t),\n\t\t\t};\n\t\tcase 'SET_INSTALLING_BLOCK':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisInstalling: {\n\t\t\t\t\t...state.isInstalling,\n\t\t\t\t\t[ action.blockId ]: action.isInstalling,\n\t\t\t\t},\n\t\t\t};\n\t}\n\treturn state;\n};\n\n/**\n * Reducer returning an object of error notices.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const errorNotices = ( state = {}, action ) => {\n\tswitch ( action.type ) {\n\t\tcase 'SET_ERROR_NOTICE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.blockId ]: {\n\t\t\t\t\tmessage: action.message,\n\t\t\t\t\tisFatal: action.isFatal,\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'CLEAR_ERROR_NOTICE':\n\t\t\tconst { [ action.blockId ]: blockId, ...restState } = state;\n\t\t\treturn restState;\n\t}\n\treturn state;\n};\n\nexport default combineReducers( {\n\tdownloadableBlocks,\n\tblockManagement,\n\terrorNotices,\n} );\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAAGA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,KAAM;EAC3D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,2BAA2B;MAC/B,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,WAAW,GAAI;UACvBC,YAAY,EAAE;QACf;MACD,CAAC;IACF,KAAK,6BAA6B;MACjC,OAAO;QACN,GAAGJ,KAAK;QACR,CAAEC,MAAM,CAACE,WAAW,GAAI;UACvBE,OAAO,EAAEJ,MAAM,CAACF,kBAAkB;UAClCK,YAAY,EAAE;QACf;MACD,CAAC;EACH;EACA,OAAOJ,KAAK;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAM,OAAA,CAAAP,kBAAA,GAAAA,kBAAA;AAQO,MAAMQ,eAAe,GA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AS,YAAA,GAAAA,YAAA;AAAA,IAAAI,QAAA,GAAAb,OAAA,CAAAc,OAAA,GAEa,IAAAC,qBAAe,EAAE;EAC/BtB,kBAAkB;EAClBQ,eAAe;EACfQ;AACD,CAAE,CAAC","ignoreList":[]}
|
package/build/store/resolvers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_changeCase","require","_apiFetch","_interopRequireDefault","_actions","getDownloadableBlocks","filterValue","dispatch","fetchDownloadableBlocks","results","apiFetch","path","blocks","map","result","Object","fromEntries","entries","key","value","camelCase","receiveDownloadableBlocks","exports"],"sources":["@wordpress/block-directory/src/store/resolvers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( result ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {\n\t\t\tdispatch( receiveDownloadableBlocks( [], filterValue ) );\n\t\t}\n\t};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_changeCase","require","_apiFetch","_interopRequireDefault","_actions","getDownloadableBlocks","filterValue","dispatch","fetchDownloadableBlocks","results","apiFetch","path","blocks","map","result","Object","fromEntries","entries","key","value","camelCase","receiveDownloadableBlocks","exports"],"sources":["@wordpress/block-directory/src/store/resolvers.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( result ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {\n\t\t\tdispatch( receiveDownloadableBlocks( [], filterValue ) );\n\t\t}\n\t};\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAGO,MAAMI,qBAAqB,GAC/BC,WAAW,IACb,OAAQ;EAAEC;AAAS,CAAC,KAAM;EACzB,IAAK,CAAED,WAAW,EAAG;IACpB;EACD;EAEA,IAAI;IACHC,QAAQ,CAAE,IAAAC,gCAAuB,EAAEF,WAAY,CAAE,CAAC;IAClD,MAAMG,OAAO,GAAG,MAAM,IAAAC,iBAAQ,EAAE;MAC/BC,IAAI,EAAE,qCAAsCL,WAAW;IACxD,CAAE,CAAC;IACH,MAAMM,MAAM,GAAGH,OAAO,CAACI,GAAG,CAAIC,MAAM,IACnCC,MAAM,CAACC,WAAW,CACjBD,MAAM,CAACE,OAAO,CAAEH,MAAO,CAAC,CAACD,GAAG,CAAE,CAAE,CAAEK,GAAG,EAAEC,KAAK,CAAE,KAAM,CACnD,IAAAC,qBAAS,EAAEF,GAAI,CAAC,EAChBC,KAAK,CACJ,CACH,CACD,CAAC;IAEDZ,QAAQ,CAAE,IAAAc,kCAAyB,EAAET,MAAM,EAAEN,WAAY,CAAE,CAAC;EAC7D,CAAC,CAAC,MAAM;IACPC,QAAQ,CAAE,IAAAc,kCAAyB,EAAE,EAAE,EAAEf,WAAY,CAAE,CAAC;EACzD;AACD,CAAC;AAACgB,OAAA,CAAAjB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
package/build/store/selectors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_hasBlockType","_interopRequireDefault","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","exports","createRegistrySelector","select","createSelector","usedBlockTree","blockEditorStore","getBlocks","filter","blockType","hasBlockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter( ( blockType ) =>\n\t\t\t\thasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter(\n\t\t\t\t( blockType ) => ! hasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_hasBlockType","_interopRequireDefault","isRequestingDownloadableBlocks","state","filterValue","_state$downloadableBl","downloadableBlocks","isRequesting","getDownloadableBlocks","_state$downloadableBl2","results","getInstalledBlockTypes","blockManagement","installedBlockTypes","getNewBlockTypes","exports","createRegistrySelector","select","createSelector","usedBlockTree","blockEditorStore","getBlocks","filter","blockType","hasBlockType","getUnusedBlockTypes","isInstalling","blockId","getErrorNotices","errorNotices","getErrorNoticeForBlock"],"sources":["@wordpress/block-directory/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport hasBlockType from './utils/has-block-type';\n\n/**\n * Returns true if application is requesting for downloadable blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {boolean} Whether a request is in progress for the blocks list.\n */\nexport function isRequestingDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.isRequesting ?? false;\n}\n\n/**\n * Returns the available uninstalled blocks.\n *\n * @param {Object} state Global application state.\n * @param {string} filterValue Search string.\n *\n * @return {Array} Downloadable blocks.\n */\nexport function getDownloadableBlocks( state, filterValue ) {\n\treturn state.downloadableBlocks[ filterValue ]?.results ?? [];\n}\n\n/**\n * Returns the block types that have been installed on the server in this\n * session.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items\n */\nexport function getInstalledBlockTypes( state ) {\n\treturn state.blockManagement.installedBlockTypes;\n}\n\n/**\n * Returns block types that have been installed on the server and used in the\n * current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getNewBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter( ( blockType ) =>\n\t\t\t\thasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns the block types that have been installed on the server but are not\n * used in the current post.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} Block type items.\n */\nexport const getUnusedBlockTypes = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state ) => {\n\t\t\tconst usedBlockTree = select( blockEditorStore ).getBlocks();\n\t\t\tconst installedBlockTypes = getInstalledBlockTypes( state );\n\n\t\t\treturn installedBlockTypes.filter(\n\t\t\t\t( blockType ) => ! hasBlockType( blockType, usedBlockTree )\n\t\t\t);\n\t\t},\n\t\t( state ) => [\n\t\t\tgetInstalledBlockTypes( state ),\n\t\t\tselect( blockEditorStore ).getBlocks(),\n\t\t]\n\t)\n);\n\n/**\n * Returns true if a block plugin install is in progress.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId Id of the block.\n *\n * @return {boolean} Whether this block is currently being installed.\n */\nexport function isInstalling( state, blockId ) {\n\treturn state.blockManagement.isInstalling[ blockId ] || false;\n}\n\n/**\n * Returns all block error notices.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Object with error notices.\n */\nexport function getErrorNotices( state ) {\n\treturn state.errorNotices;\n}\n\n/**\n * Returns the error notice for a given block.\n *\n * @param {Object} state Global application state.\n * @param {string} blockId The ID of the block plugin. eg: my-block\n *\n * @return {string|boolean} The error text, or false if no error.\n */\nexport function getErrorNoticeForBlock( state, blockId ) {\n\treturn state.errorNotices[ blockId ];\n}\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAKA,IAAAE,aAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,8BAA8BA,CAAEC,KAAK,EAAEC,WAAW,EAAG;EAAA,IAAAC,qBAAA;EACpE,QAAAA,qBAAA,GAAOF,KAAK,CAACG,kBAAkB,CAAEF,WAAW,CAAE,EAAEG,YAAY,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,KAAK;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,qBAAqBA,CAAEL,KAAK,EAAEC,WAAW,EAAG;EAAA,IAAAK,sBAAA;EAC3D,QAAAA,sBAAA,GAAON,KAAK,CAACG,kBAAkB,CAAEF,WAAW,CAAE,EAAEM,OAAO,cAAAD,sBAAA,cAAAA,sBAAA,GAAI,EAAE;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,sBAAsBA,CAAER,KAAK,EAAG;EAC/C,OAAOA,KAAK,CAACS,eAAe,CAACC,mBAAmB;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,IAAAE,4BAAsB,EAAIC,MAAM,IAC/D,IAAAC,oBAAc,EACXf,KAAK,IAAM;EACZ,MAAMgB,aAAa,GAAG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AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CAAE3B,KAAK,EAAEwB,OAAO,EAAG;EACxD,OAAOxB,KAAK,CAAC0B,YAAY,CAAEF,OAAO,CAAE;AACrC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hasBlockType","blockType","blocks","length","some","name","i","innerBlocks"],"sources":["@wordpress/block-directory/src/store/utils/has-block-type.js"],"sourcesContent":["/**\n * Check if a block list contains a specific block type. Recursively searches\n * through `innerBlocks` if they exist.\n *\n * @param {Object} blockType A block object to search for.\n * @param {Object[]} blocks The list of blocks to look through.\n *\n * @return {boolean} Whether the blockType is found.\n */\nexport default function hasBlockType( blockType, blocks = [] ) {\n\tif ( ! blocks.length ) {\n\t\treturn false;\n\t}\n\tif ( blocks.some( ( { name } ) => name === blockType.name ) ) {\n\t\treturn true;\n\t}\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( hasBlockType( blockType, blocks[ i ].innerBlocks ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["hasBlockType","blockType","blocks","length","some","name","i","innerBlocks"],"sources":["@wordpress/block-directory/src/store/utils/has-block-type.js"],"sourcesContent":["/**\n * Check if a block list contains a specific block type. Recursively searches\n * through `innerBlocks` if they exist.\n *\n * @param {Object} blockType A block object to search for.\n * @param {Object[]} blocks The list of blocks to look through.\n *\n * @return {boolean} Whether the blockType is found.\n */\nexport default function hasBlockType( blockType, blocks = [] ) {\n\tif ( ! blocks.length ) {\n\t\treturn false;\n\t}\n\tif ( blocks.some( ( { name } ) => name === blockType.name ) ) {\n\t\treturn true;\n\t}\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( hasBlockType( blockType, blocks[ i ].innerBlocks ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,YAAYA,CAAEC,SAAS,EAAEC,MAAM,GAAG,EAAE,EAAG;EAC9D,IAAK,CAAEA,MAAM,CAACC,MAAM,EAAG;IACtB,OAAO,KAAK;EACb;EACA,IAAKD,MAAM,CAACE,IAAI,CAAE,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,KAAKJ,SAAS,CAACI,IAAK,CAAC,EAAG;IAC7D,OAAO,IAAI;EACZ;EACA,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,MAAM,CAACC,MAAM,EAAEG,CAAC,EAAE,EAAG;IACzC,IAAKN,YAAY,CAAEC,SAAS,EAAEC,MAAM,CAAEI,CAAC,CAAE,CAACC,WAAY,CAAC,EAAG;MACzD,OAAO,IAAI;IACZ;EACD;EAEA,OAAO,KAAK;AACb","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["unregisterBlockType","useDispatch","useSelect","useEffect","store","editorStore","blockDirectoryStore","AutoBlockUninstaller","uninstallBlockType","shouldRemoveBlockTypes","select","isAutosavingPost","isSavingPost","unusedBlockTypes","getUnusedBlockTypes","length","forEach","blockType","name"],"sources":["@wordpress/block-directory/src/components/auto-block-uninstaller/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["unregisterBlockType","useDispatch","useSelect","useEffect","store","editorStore","blockDirectoryStore","AutoBlockUninstaller","uninstallBlockType","shouldRemoveBlockTypes","select","isAutosavingPost","isSavingPost","unusedBlockTypes","getUnusedBlockTypes","length","forEach","blockType","name"],"sources":["@wordpress/block-directory/src/components/auto-block-uninstaller/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { unregisterBlockType } from '@wordpress/blocks';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function AutoBlockUninstaller() {\n\tconst { uninstallBlockType } = useDispatch( blockDirectoryStore );\n\n\tconst shouldRemoveBlockTypes = useSelect( ( select ) => {\n\t\tconst { isAutosavingPost, isSavingPost } = select( editorStore );\n\t\treturn isSavingPost() && ! isAutosavingPost();\n\t}, [] );\n\n\tconst unusedBlockTypes = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).getUnusedBlockTypes(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( shouldRemoveBlockTypes && unusedBlockTypes.length ) {\n\t\t\tunusedBlockTypes.forEach( ( blockType ) => {\n\t\t\t\tuninstallBlockType( blockType );\n\t\t\t\tunregisterBlockType( blockType.name );\n\t\t\t} );\n\t\t}\n\t}, [ shouldRemoveBlockTypes ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,mBAAmB,QAAQ,aAAa;AAE1D,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC;EAAmB,CAAC,GAAGP,WAAW,CAAEK,mBAAoB,CAAC;EAEjE,MAAMG,sBAAsB,GAAGP,SAAS,CAAIQ,MAAM,IAAM;IACvD,MAAM;MAAEC,gBAAgB;MAAEC;IAAa,CAAC,GAAGF,MAAM,CAAEL,WAAY,CAAC;IAChE,OAAOO,YAAY,CAAC,CAAC,IAAI,CAAED,gBAAgB,CAAC,CAAC;EAC9C,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,gBAAgB,GAAGX,SAAS,CAC/BQ,MAAM,IAAMA,MAAM,CAAEJ,mBAAoB,CAAC,CAACQ,mBAAmB,CAAC,CAAC,EACjE,EACD,CAAC;EAEDX,SAAS,CAAE,MAAM;IAChB,IAAKM,sBAAsB,IAAII,gBAAgB,CAACE,MAAM,EAAG;MACxDF,gBAAgB,CAACG,OAAO,CAAIC,SAAS,IAAM;QAC1CT,kBAAkB,CAAES,SAAU,CAAC;QAC/BjB,mBAAmB,CAAEiB,SAAS,CAACC,IAAK,CAAC;MACtC,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CAAET,sBAAsB,CAAG,CAAC;EAE/B,OAAO,IAAI;AACZ","ignoreList":[]}
|