@wordpress/block-directory 5.10.0 → 5.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- 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/build-style/style-rtl.css +1 -10
- package/build-style/style.css +1 -10
- package/package.json +21 -20
- package/src/components/downloadable-block-list-item/index.js +6 -6
- package/src/components/downloadable-block-list-item/style.scss +1 -11
package/CHANGELOG.md
CHANGED
|
@@ -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,OAA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,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":[]}
|
|
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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A,CAAAmC,GAAA;UAAMQ,SAAS,EAAC,qDAAqD;UAAAJ,QAAA,EAClE,IAAAc,iCAAwB,EACzB,IAAA1C,aAAO,EACN;UACA,IAAAsB,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":[]}
|
|
@@ -34,24 +34,24 @@ function getDownloadableBlockLabel({
|
|
|
34
34
|
}) {
|
|
35
35
|
const stars = Math.round(rating / 0.5) * 0.5;
|
|
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
|
if (isInstalled) {
|
|
41
|
-
/* translators: %
|
|
41
|
+
/* translators: %s: block title */
|
|
42
42
|
return sprintf('Add %s.', decodeEntities(title));
|
|
43
43
|
}
|
|
44
44
|
if (isInstalling) {
|
|
45
|
-
/* translators: %
|
|
45
|
+
/* translators: %s: block title */
|
|
46
46
|
return sprintf('Installing %s.', decodeEntities(title));
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
// No ratings yet, just use the title.
|
|
50
50
|
if (ratingCount < 1) {
|
|
51
|
-
/* translators: %
|
|
51
|
+
/* translators: %s: block title */
|
|
52
52
|
return sprintf('Install %s.', decodeEntities(title));
|
|
53
53
|
}
|
|
54
|
-
return sprintf(/* translators:
|
|
54
|
+
return sprintf(/* translators: 1: block title, 2: average rating, 3: total ratings count. */
|
|
55
55
|
_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);
|
|
56
56
|
}
|
|
57
57
|
function DownloadableBlockListItem({
|
|
@@ -124,7 +124,7 @@ function DownloadableBlockListItem({
|
|
|
124
124
|
className: "block-directory-downloadable-block-list-item__details",
|
|
125
125
|
children: [/*#__PURE__*/_jsx("span", {
|
|
126
126
|
className: "block-directory-downloadable-block-list-item__title",
|
|
127
|
-
children: createInterpolateElement(sprintf(/* translators:
|
|
127
|
+
children: createInterpolateElement(sprintf(/* translators: 1: block title. 2: author name. */
|
|
128
128
|
__('%1$s <span>by %2$s</span>'), decodeEntities(title), author), {
|
|
129
129
|
span: /*#__PURE__*/_jsx("span", {
|
|
130
130
|
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;\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AAK,EAAG5B;QAAM,CAAE,CAAC,gBAE1Cd,KAAA,CAAAE,SAAA;UAAA8B,QAAA,gBACClC,IAAA;YAAMoC,SAAS,EAAC,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":[]}
|
|
@@ -192,16 +192,7 @@
|
|
|
192
192
|
outline: 2px solid transparent;
|
|
193
193
|
}
|
|
194
194
|
.block-directory-downloadable-block-list-item.is-installing .block-directory-downloadable-block-list-item__author {
|
|
195
|
-
|
|
196
|
-
clip: rect(1px, 1px, 1px, 1px);
|
|
197
|
-
clip-path: inset(50%);
|
|
198
|
-
height: 1px;
|
|
199
|
-
margin: -1px;
|
|
200
|
-
overflow: hidden;
|
|
201
|
-
padding: 0;
|
|
202
|
-
position: absolute;
|
|
203
|
-
width: 1px;
|
|
204
|
-
word-wrap: normal !important;
|
|
195
|
+
display: none;
|
|
205
196
|
}
|
|
206
197
|
|
|
207
198
|
.block-directory-downloadable-block-list-item__icon {
|
package/build-style/style.css
CHANGED
|
@@ -192,16 +192,7 @@
|
|
|
192
192
|
outline: 2px solid transparent;
|
|
193
193
|
}
|
|
194
194
|
.block-directory-downloadable-block-list-item.is-installing .block-directory-downloadable-block-list-item__author {
|
|
195
|
-
|
|
196
|
-
clip: rect(1px, 1px, 1px, 1px);
|
|
197
|
-
clip-path: inset(50%);
|
|
198
|
-
height: 1px;
|
|
199
|
-
margin: -1px;
|
|
200
|
-
overflow: hidden;
|
|
201
|
-
padding: 0;
|
|
202
|
-
position: absolute;
|
|
203
|
-
width: 1px;
|
|
204
|
-
word-wrap: normal !important;
|
|
195
|
+
display: none;
|
|
205
196
|
}
|
|
206
197
|
|
|
207
198
|
.block-directory-downloadable-block-list-item__icon {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-directory",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
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",
|
|
@@ -25,26 +25,27 @@
|
|
|
25
25
|
"main": "build/index.js",
|
|
26
26
|
"module": "build-module/index.js",
|
|
27
27
|
"react-native": "src/index",
|
|
28
|
+
"wpScript": true,
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@babel/runtime": "7.25.7",
|
|
30
|
-
"@wordpress/a11y": "
|
|
31
|
-
"@wordpress/api-fetch": "
|
|
32
|
-
"@wordpress/block-editor": "
|
|
33
|
-
"@wordpress/blocks": "
|
|
34
|
-
"@wordpress/components": "
|
|
35
|
-
"@wordpress/compose": "
|
|
36
|
-
"@wordpress/core-data": "
|
|
37
|
-
"@wordpress/data": "
|
|
38
|
-
"@wordpress/editor": "
|
|
39
|
-
"@wordpress/element": "
|
|
40
|
-
"@wordpress/hooks": "
|
|
41
|
-
"@wordpress/html-entities": "
|
|
42
|
-
"@wordpress/i18n": "
|
|
43
|
-
"@wordpress/icons": "
|
|
44
|
-
"@wordpress/notices": "
|
|
45
|
-
"@wordpress/plugins": "
|
|
46
|
-
"@wordpress/private-apis": "
|
|
47
|
-
"@wordpress/url": "
|
|
31
|
+
"@wordpress/a11y": "*",
|
|
32
|
+
"@wordpress/api-fetch": "*",
|
|
33
|
+
"@wordpress/block-editor": "*",
|
|
34
|
+
"@wordpress/blocks": "*",
|
|
35
|
+
"@wordpress/components": "*",
|
|
36
|
+
"@wordpress/compose": "*",
|
|
37
|
+
"@wordpress/core-data": "*",
|
|
38
|
+
"@wordpress/data": "*",
|
|
39
|
+
"@wordpress/editor": "*",
|
|
40
|
+
"@wordpress/element": "*",
|
|
41
|
+
"@wordpress/hooks": "*",
|
|
42
|
+
"@wordpress/html-entities": "*",
|
|
43
|
+
"@wordpress/i18n": "*",
|
|
44
|
+
"@wordpress/icons": "*",
|
|
45
|
+
"@wordpress/notices": "*",
|
|
46
|
+
"@wordpress/plugins": "*",
|
|
47
|
+
"@wordpress/private-apis": "*",
|
|
48
|
+
"@wordpress/url": "*",
|
|
48
49
|
"change-case": "^4.1.2",
|
|
49
50
|
"clsx": "^2.1.1"
|
|
50
51
|
},
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
"publishConfig": {
|
|
56
57
|
"access": "public"
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "510540d99f3d222a96f08d3d7b66c9e7a726f705"
|
|
59
60
|
}
|
|
@@ -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
|
|
@@ -38,17 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
&.is-installing {
|
|
40
40
|
.block-directory-downloadable-block-list-item__author {
|
|
41
|
-
|
|
42
|
-
clip: rect(1px, 1px, 1px, 1px);
|
|
43
|
-
-webkit-clip-path: inset(50%);
|
|
44
|
-
clip-path: inset(50%);
|
|
45
|
-
height: 1px;
|
|
46
|
-
margin: -1px;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
padding: 0;
|
|
49
|
-
position: absolute;
|
|
50
|
-
width: 1px;
|
|
51
|
-
word-wrap: normal !important;
|
|
41
|
+
display: none;
|
|
52
42
|
}
|
|
53
43
|
}
|
|
54
44
|
}
|