@wordpress/block-directory 5.8.12 → 5.8.13
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/build/components/downloadable-block-list-item/index.js +6 -6
- package/build/components/downloadable-block-list-item/index.js.map +1 -1
- package/build-module/components/downloadable-block-list-item/index.js +6 -6
- package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/downloadable-block-list-item/index.js +6 -6
|
@@ -41,24 +41,24 @@ function getDownloadableBlockLabel({
|
|
|
41
41
|
}) {
|
|
42
42
|
const stars = Math.round(rating / 0.5) * 0.5;
|
|
43
43
|
if (!isInstalled && hasNotice) {
|
|
44
|
-
/* translators: %
|
|
44
|
+
/* translators: %s: block title */
|
|
45
45
|
return (0, _i18n.sprintf)('Retry installing %s.', (0, _htmlEntities.decodeEntities)(title));
|
|
46
46
|
}
|
|
47
47
|
if (isInstalled) {
|
|
48
|
-
/* translators: %
|
|
48
|
+
/* translators: %s: block title */
|
|
49
49
|
return (0, _i18n.sprintf)('Add %s.', (0, _htmlEntities.decodeEntities)(title));
|
|
50
50
|
}
|
|
51
51
|
if (isInstalling) {
|
|
52
|
-
/* translators: %
|
|
52
|
+
/* translators: %s: block title */
|
|
53
53
|
return (0, _i18n.sprintf)('Installing %s.', (0, _htmlEntities.decodeEntities)(title));
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// No ratings yet, just use the title.
|
|
57
57
|
if (ratingCount < 1) {
|
|
58
|
-
/* translators: %
|
|
58
|
+
/* translators: %s: block title */
|
|
59
59
|
return (0, _i18n.sprintf)('Install %s.', (0, _htmlEntities.decodeEntities)(title));
|
|
60
60
|
}
|
|
61
|
-
return (0, _i18n.sprintf)( /* translators:
|
|
61
|
+
return (0, _i18n.sprintf)( /* translators: 1: block title, 2: average rating, 3: total ratings count. */
|
|
62
62
|
(0, _i18n._n)('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), (0, _htmlEntities.decodeEntities)(title), stars, ratingCount);
|
|
63
63
|
}
|
|
64
64
|
function DownloadableBlockListItem({
|
|
@@ -131,7 +131,7 @@ function DownloadableBlockListItem({
|
|
|
131
131
|
className: "block-directory-downloadable-block-list-item__details",
|
|
132
132
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
133
133
|
className: "block-directory-downloadable-block-list-item__title",
|
|
134
|
-
children: (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators:
|
|
134
|
+
children: (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: block title. 2: author name. */
|
|
135
135
|
(0, _i18n.__)('%1$s <span>by %2$s</span>'), (0, _htmlEntities.decodeEntities)(title), author), {
|
|
136
136
|
span: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
137
137
|
className: "block-directory-downloadable-block-list-item__author"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_components","_element","_htmlEntities","_blocks","_data","_blockRatings","_downloadableBlockIcon","_downloadableBlockNotice","_store","_jsxRuntime","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","sprintf","decodeEntities","_n","DownloadableBlockListItem","item","onClick","author","description","icon","getBlockType","name","isInstallable","useSelect","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","__","itemLabel","jsx","Tooltip","placement","text","children","jsxs","Composite","Item","className","clsx","accessibleWhenDisabled","disabled","event","preventDefault","type","role","default","Spinner","createInterpolateElement","span","block","Fragment","VisuallyHidden","_default","exports"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tTooltip,\n\tSpinner,\n\tVisuallyHidden,\n\tComposite,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %1$s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: %1$s: block title, %2$s: average rating, %3$s: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\tconst itemLabel = getDownloadableBlockLabel( item, {\n\t\thasNotice,\n\t\tisInstalled,\n\t\tisInstalling,\n\t} );\n\n\treturn (\n\t\t<Tooltip placement=\"top\" text={ itemLabel }>\n\t\t\t<Composite.Item\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-directory-downloadable-block-list-item',\n\t\t\t\t\tisInstalling && 'is-installing'\n\t\t\t\t) }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonClick();\n\t\t\t\t} }\n\t\t\t\taria-label={ itemLabel }\n\t\t\t\ttype=\"button\"\n\t\t\t\trole=\"option\"\n\t\t\t>\n\t\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\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</span>\n\t\t\t</Composite.Item>\n\t\t</Tooltip>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAA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MQ,SAAS,EAAC;YAAsD,CAAE;UAE1E,CACD;QAAC,CACI,CAAC,EACLtC,SAAS,gBACV,IAAAL,WAAA,CAAAmC,GAAA,EAACrC,wBAAA,CAAAqD,OAAuB;UAACI,KAAK,EAAGxC;QAAM,CAAE,CAAC,gBAE1C,IAAAf,WAAA,CAAAwC,IAAA,EAAAxC,WAAA,CAAAwD,QAAA;UAAAjB,QAAA,gBACC,IAAAvC,WAAA,CAAAmC,GAAA;YAAMQ,SAAS,EAAC,oDAAoD;YAAAJ,QAAA,EACjE,CAAC,CAAEP,UAAU,GACZA,UAAU,GACV,IAAApB,4BAAc,EAAEM,WAAY;UAAC,CAC3B,CAAC,EACLI,aAAa,IACd,EAAIhB,WAAW,IAAIC,YAAY,CAAE,iBAChC,IAAAP,WAAA,CAAAmC,GAAA,EAAC5C,WAAA,CAAAkE,cAAc;YAAAlB,QAAA,EACZ,IAAAN,QAAE,EAAE,eAAgB;UAAC,CACR,CAChB;QAAA,CACD,CACF;MAAA,CACI,CAAC;IAAA,CACQ;EAAC,CACT,CAAC;AAEZ;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEcrC,yBAAyB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_components","_element","_htmlEntities","_blocks","_data","_blockRatings","_downloadableBlockIcon","_downloadableBlockNotice","_store","_jsxRuntime","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","sprintf","decodeEntities","_n","DownloadableBlockListItem","item","onClick","author","description","icon","getBlockType","name","isInstallable","useSelect","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","__","itemLabel","jsx","Tooltip","placement","text","children","jsxs","Composite","Item","className","clsx","accessibleWhenDisabled","disabled","event","preventDefault","type","role","default","Spinner","createInterpolateElement","span","block","Fragment","VisuallyHidden","_default","exports"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tTooltip,\n\tSpinner,\n\tVisuallyHidden,\n\tComposite,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: 1: block title, 2: average rating, 3: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\tconst itemLabel = getDownloadableBlockLabel( item, {\n\t\thasNotice,\n\t\tisInstalled,\n\t\tisInstalling,\n\t} );\n\n\treturn (\n\t\t<Tooltip placement=\"top\" text={ itemLabel }>\n\t\t\t<Composite.Item\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-directory-downloadable-block-list-item',\n\t\t\t\t\tisInstalling && 'is-installing'\n\t\t\t\t) }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonClick();\n\t\t\t\t} }\n\t\t\t\taria-label={ itemLabel }\n\t\t\t\ttype=\"button\"\n\t\t\t\trole=\"option\"\n\t\t\t>\n\t\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: 1: block title. 2: author name. */\n\t\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\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</span>\n\t\t\t</Composite.Item>\n\t\t</Tooltip>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAA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QAAE,EAAE,2BAA4B,CAAC,EACjC,IAAArB,4BAAc,EAAEV,KAAM,CAAC,EACvBe,MACD,CAAC,EACD;YACCqC,IAAI,eACH,IAAAtD,WAAA,CAAAmC,GAAA;cAAMQ,SAAS,EAAC;YAAsD,CAAE;UAE1E,CACD;QAAC,CACI,CAAC,EACLtC,SAAS,gBACV,IAAAL,WAAA,CAAAmC,GAAA,EAACrC,wBAAA,CAAAqD,OAAuB;UAACI,KAAK,EAAGxC;QAAM,CAAE,CAAC,gBAE1C,IAAAf,WAAA,CAAAwC,IAAA,EAAAxC,WAAA,CAAAwD,QAAA;UAAAjB,QAAA,gBACC,IAAAvC,WAAA,CAAAmC,GAAA;YAAMQ,SAAS,EAAC,oDAAoD;YAAAJ,QAAA,EACjE,CAAC,CAAEP,UAAU,GACZA,UAAU,GACV,IAAApB,4BAAc,EAAEM,WAAY;UAAC,CAC3B,CAAC,EACLI,aAAa,IACd,EAAIhB,WAAW,IAAIC,YAAY,CAAE,iBAChC,IAAAP,WAAA,CAAAmC,GAAA,EAAC5C,WAAA,CAAAkE,cAAc;YAAAlB,QAAA,EACZ,IAAAN,QAAE,EAAE,eAAgB;UAAC,CACR,CAChB;QAAA,CACD,CACF;MAAA,CACI,CAAC;IAAA,CACQ;EAAC,CACT,CAAC;AAEZ;AAAC,IAAAyB,QAAA,GAAAC,OAAA,CAAAR,OAAA,GAEcrC,yBAAyB","ignoreList":[]}
|
|
@@ -36,24 +36,24 @@ function getDownloadableBlockLabel({
|
|
|
36
36
|
}) {
|
|
37
37
|
const stars = Math.round(rating / 0.5) * 0.5;
|
|
38
38
|
if (!isInstalled && hasNotice) {
|
|
39
|
-
/* translators: %
|
|
39
|
+
/* translators: %s: block title */
|
|
40
40
|
return sprintf('Retry installing %s.', decodeEntities(title));
|
|
41
41
|
}
|
|
42
42
|
if (isInstalled) {
|
|
43
|
-
/* translators: %
|
|
43
|
+
/* translators: %s: block title */
|
|
44
44
|
return sprintf('Add %s.', decodeEntities(title));
|
|
45
45
|
}
|
|
46
46
|
if (isInstalling) {
|
|
47
|
-
/* translators: %
|
|
47
|
+
/* translators: %s: block title */
|
|
48
48
|
return sprintf('Installing %s.', decodeEntities(title));
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// No ratings yet, just use the title.
|
|
52
52
|
if (ratingCount < 1) {
|
|
53
|
-
/* translators: %
|
|
53
|
+
/* translators: %s: block title */
|
|
54
54
|
return sprintf('Install %s.', decodeEntities(title));
|
|
55
55
|
}
|
|
56
|
-
return sprintf( /* translators:
|
|
56
|
+
return sprintf( /* translators: 1: block title, 2: average rating, 3: total ratings count. */
|
|
57
57
|
_n('Install %1$s. %2$s stars with %3$s review.', 'Install %1$s. %2$s stars with %3$s reviews.', ratingCount), decodeEntities(title), stars, ratingCount);
|
|
58
58
|
}
|
|
59
59
|
function DownloadableBlockListItem({
|
|
@@ -126,7 +126,7 @@ function DownloadableBlockListItem({
|
|
|
126
126
|
className: "block-directory-downloadable-block-list-item__details",
|
|
127
127
|
children: [/*#__PURE__*/_jsx("span", {
|
|
128
128
|
className: "block-directory-downloadable-block-list-item__title",
|
|
129
|
-
children: createInterpolateElement(sprintf( /* translators:
|
|
129
|
+
children: createInterpolateElement(sprintf( /* translators: 1: block title. 2: author name. */
|
|
130
130
|
__('%1$s <span>by %2$s</span>'), decodeEntities(title), author), {
|
|
131
131
|
span: /*#__PURE__*/_jsx("span", {
|
|
132
132
|
className: "block-directory-downloadable-block-list-item__author"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","_n","sprintf","Tooltip","Spinner","VisuallyHidden","Composite","createInterpolateElement","decodeEntities","getBlockType","useSelect","BlockRatings","DownloadableBlockIcon","DownloadableBlockNotice","store","blockDirectoryStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","notice","id","hasFatal","isFatal","statusText","itemLabel","placement","text","children","Item","className","accessibleWhenDisabled","disabled","event","preventDefault","type","role","span","block"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tTooltip,\n\tSpinner,\n\tVisuallyHidden,\n\tComposite,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %
|
|
1
|
+
{"version":3,"names":["clsx","__","_n","sprintf","Tooltip","Spinner","VisuallyHidden","Composite","createInterpolateElement","decodeEntities","getBlockType","useSelect","BlockRatings","DownloadableBlockIcon","DownloadableBlockNotice","store","blockDirectoryStore","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","notice","id","hasFatal","isFatal","statusText","itemLabel","placement","text","children","Item","className","accessibleWhenDisabled","disabled","event","preventDefault","type","role","span","block"],"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tTooltip,\n\tSpinner,\n\tVisuallyHidden,\n\tComposite,\n} from '@wordpress/components';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockRatings from '../block-ratings';\nimport DownloadableBlockIcon from '../downloadable-block-icon';\nimport DownloadableBlockNotice from '../downloadable-block-notice';\nimport { store as blockDirectoryStore } from '../../store';\n\n// Return the appropriate block item label, given the block data and status.\nfunction getDownloadableBlockLabel(\n\t{ title, rating, ratingCount },\n\t{ hasNotice, isInstalled, isInstalling }\n) {\n\tconst stars = Math.round( rating / 0.5 ) * 0.5;\n\n\tif ( ! isInstalled && hasNotice ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Retry installing %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalled ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Add %s.', decodeEntities( title ) );\n\t}\n\n\tif ( isInstalling ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Installing %s.', decodeEntities( title ) );\n\t}\n\n\t// No ratings yet, just use the title.\n\tif ( ratingCount < 1 ) {\n\t\t/* translators: %s: block title */\n\t\treturn sprintf( 'Install %s.', decodeEntities( title ) );\n\t}\n\n\treturn sprintf(\n\t\t/* translators: 1: block title, 2: average rating, 3: total ratings count. */\n\t\t_n(\n\t\t\t'Install %1$s. %2$s stars with %3$s review.',\n\t\t\t'Install %1$s. %2$s stars with %3$s reviews.',\n\t\t\tratingCount\n\t\t),\n\t\tdecodeEntities( title ),\n\t\tstars,\n\t\tratingCount\n\t);\n}\n\nfunction DownloadableBlockListItem( { item, onClick } ) {\n\tconst { author, description, icon, rating, title } = item;\n\t// getBlockType returns a block object if this block exists, or null if not.\n\tconst isInstalled = !! getBlockType( item.name );\n\n\tconst { hasNotice, isInstalling, isInstallable } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =\n\t\t\t\tselect( blockDirectoryStore );\n\t\t\tconst notice = getErrorNoticeForBlock( item.id );\n\t\t\tconst hasFatal = notice && notice.isFatal;\n\t\t\treturn {\n\t\t\t\thasNotice: !! notice,\n\t\t\t\tisInstalling: isBlockInstalling( item.id ),\n\t\t\t\tisInstallable: ! hasFatal,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tlet statusText = '';\n\tif ( isInstalled ) {\n\t\tstatusText = __( 'Installed!' );\n\t} else if ( isInstalling ) {\n\t\tstatusText = __( 'Installing…' );\n\t}\n\n\tconst itemLabel = getDownloadableBlockLabel( item, {\n\t\thasNotice,\n\t\tisInstalled,\n\t\tisInstalling,\n\t} );\n\n\treturn (\n\t\t<Tooltip placement=\"top\" text={ itemLabel }>\n\t\t\t<Composite.Item\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'block-directory-downloadable-block-list-item',\n\t\t\t\t\tisInstalling && 'is-installing'\n\t\t\t\t) }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonClick();\n\t\t\t\t} }\n\t\t\t\taria-label={ itemLabel }\n\t\t\t\ttype=\"button\"\n\t\t\t\trole=\"option\"\n\t\t\t>\n\t\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: 1: block title. 2: author name. */\n\t\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__author\" />\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\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</span>\n\t\t\t</Composite.Item>\n\t\t</Tooltip>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QA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,oDAAoD;YAAAF,QAAA,EACjE,CAAC,CAAEJ,UAAU,GACZA,UAAU,GACVvC,cAAc,CAAE4B,WAAY;UAAC,CAC3B,CAAC,EACLG,aAAa,IACd,EAAIZ,WAAW,IAAIC,YAAY,CAAE,iBAChCX,IAAA,CAACZ,cAAc;YAAA8C,QAAA,EACZnD,EAAE,CAAE,eAAgB;UAAC,CACR,CAChB;QAAA,CACD,CACF;MAAA,CACI,CAAC;IAAA,CACQ;EAAC,CACT,CAAC;AAEZ;AAEA,eAAegC,yBAAyB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-directory",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.13",
|
|
4
4
|
"description": "Extend editor with block directory features to search, download and install blocks.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^4.8.2",
|
|
31
31
|
"@wordpress/api-fetch": "^7.8.2",
|
|
32
|
-
"@wordpress/block-editor": "^14.3.
|
|
32
|
+
"@wordpress/block-editor": "^14.3.11",
|
|
33
33
|
"@wordpress/blocks": "^13.8.5",
|
|
34
|
-
"@wordpress/components": "^28.8.
|
|
34
|
+
"@wordpress/components": "^28.8.9",
|
|
35
35
|
"@wordpress/compose": "^7.8.3",
|
|
36
|
-
"@wordpress/core-data": "^7.8.
|
|
36
|
+
"@wordpress/core-data": "^7.8.11",
|
|
37
37
|
"@wordpress/data": "^10.8.3",
|
|
38
|
-
"@wordpress/editor": "^14.8.
|
|
38
|
+
"@wordpress/editor": "^14.8.13",
|
|
39
39
|
"@wordpress/element": "^6.8.1",
|
|
40
40
|
"@wordpress/hooks": "^4.8.2",
|
|
41
41
|
"@wordpress/html-entities": "^4.8.1",
|
|
42
42
|
"@wordpress/i18n": "^5.8.2",
|
|
43
43
|
"@wordpress/icons": "^10.8.2",
|
|
44
44
|
"@wordpress/notices": "^5.8.3",
|
|
45
|
-
"@wordpress/plugins": "^7.8.
|
|
45
|
+
"@wordpress/plugins": "^7.8.9",
|
|
46
46
|
"@wordpress/private-apis": "^1.8.1",
|
|
47
47
|
"@wordpress/url": "^4.8.1",
|
|
48
48
|
"change-case": "^4.1.2",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "e392a1ef96df24a1e3be3b94e91670e0793b8cfe"
|
|
59
59
|
}
|
|
@@ -34,28 +34,28 @@ function getDownloadableBlockLabel(
|
|
|
34
34
|
const stars = Math.round( rating / 0.5 ) * 0.5;
|
|
35
35
|
|
|
36
36
|
if ( ! isInstalled && hasNotice ) {
|
|
37
|
-
/* translators: %
|
|
37
|
+
/* translators: %s: block title */
|
|
38
38
|
return sprintf( 'Retry installing %s.', decodeEntities( title ) );
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if ( isInstalled ) {
|
|
42
|
-
/* translators: %
|
|
42
|
+
/* translators: %s: block title */
|
|
43
43
|
return sprintf( 'Add %s.', decodeEntities( title ) );
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if ( isInstalling ) {
|
|
47
|
-
/* translators: %
|
|
47
|
+
/* translators: %s: block title */
|
|
48
48
|
return sprintf( 'Installing %s.', decodeEntities( title ) );
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// No ratings yet, just use the title.
|
|
52
52
|
if ( ratingCount < 1 ) {
|
|
53
|
-
/* translators: %
|
|
53
|
+
/* translators: %s: block title */
|
|
54
54
|
return sprintf( 'Install %s.', decodeEntities( title ) );
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return sprintf(
|
|
58
|
-
/* translators:
|
|
58
|
+
/* translators: 1: block title, 2: average rating, 3: total ratings count. */
|
|
59
59
|
_n(
|
|
60
60
|
'Install %1$s. %2$s stars with %3$s review.',
|
|
61
61
|
'Install %1$s. %2$s stars with %3$s reviews.',
|
|
@@ -131,7 +131,7 @@ function DownloadableBlockListItem( { item, onClick } ) {
|
|
|
131
131
|
<span className="block-directory-downloadable-block-list-item__title">
|
|
132
132
|
{ createInterpolateElement(
|
|
133
133
|
sprintf(
|
|
134
|
-
/* translators:
|
|
134
|
+
/* translators: 1: block title. 2: author name. */
|
|
135
135
|
__( '%1$s <span>by %2$s</span>' ),
|
|
136
136
|
decodeEntities( title ),
|
|
137
137
|
author
|