@wordpress/block-directory 4.11.0 → 4.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 +2 -0
- package/build/components/block-ratings/index.js +7 -10
- package/build/components/block-ratings/index.js.map +1 -1
- package/build/components/block-ratings/stars.js +3 -4
- package/build/components/block-ratings/stars.js.map +1 -1
- package/build/components/compact-list/index.js +23 -28
- package/build/components/compact-list/index.js.map +1 -1
- package/build/components/downloadable-block-icon/index.js +3 -4
- package/build/components/downloadable-block-icon/index.js.map +1 -1
- package/build/components/downloadable-block-list-item/index.js +14 -17
- package/build/components/downloadable-block-list-item/index.js.map +1 -1
- package/build/components/downloadable-block-notice/index.js +3 -4
- package/build/components/downloadable-block-notice/index.js.map +1 -1
- package/build/components/downloadable-blocks-list/index.js +5 -6
- package/build/components/downloadable-blocks-list/index.js.map +1 -1
- package/build/components/downloadable-blocks-panel/index.js +13 -16
- package/build/components/downloadable-blocks-panel/index.js.map +1 -1
- package/build/components/downloadable-blocks-panel/inserter-panel.js +5 -6
- package/build/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
- package/build/plugins/get-install-missing/index.js +7 -11
- package/build/plugins/get-install-missing/index.js.map +1 -1
- package/build/plugins/get-install-missing/install-button.js +5 -6
- package/build/plugins/get-install-missing/install-button.js.map +1 -1
- package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js +7 -9
- package/build/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
- package/build/plugins/installed-blocks-pre-publish-panel/index.js +2 -2
- package/build/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
- package/build/store/actions.js +10 -17
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +6 -15
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +4 -9
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +4 -4
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/has-block-type.js +4 -9
- package/build/store/utils/has-block-type.js.map +1 -1
- package/build-module/components/block-ratings/index.js +7 -10
- package/build-module/components/block-ratings/index.js.map +1 -1
- package/build-module/components/block-ratings/stars.js +3 -4
- package/build-module/components/block-ratings/stars.js.map +1 -1
- package/build-module/components/compact-list/index.js +23 -28
- package/build-module/components/compact-list/index.js.map +1 -1
- package/build-module/components/downloadable-block-icon/index.js +3 -4
- package/build-module/components/downloadable-block-icon/index.js.map +1 -1
- package/build-module/components/downloadable-block-list-item/index.js +14 -17
- package/build-module/components/downloadable-block-list-item/index.js.map +1 -1
- package/build-module/components/downloadable-block-notice/index.js +3 -4
- package/build-module/components/downloadable-block-notice/index.js.map +1 -1
- package/build-module/components/downloadable-blocks-list/index.js +5 -6
- package/build-module/components/downloadable-blocks-list/index.js.map +1 -1
- package/build-module/components/downloadable-blocks-panel/index.js +13 -16
- package/build-module/components/downloadable-blocks-panel/index.js.map +1 -1
- package/build-module/components/downloadable-blocks-panel/inserter-panel.js +5 -6
- package/build-module/components/downloadable-blocks-panel/inserter-panel.js.map +1 -1
- package/build-module/plugins/get-install-missing/index.js +7 -11
- package/build-module/plugins/get-install-missing/index.js.map +1 -1
- package/build-module/plugins/get-install-missing/install-button.js +5 -6
- package/build-module/plugins/get-install-missing/install-button.js.map +1 -1
- package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js +7 -9
- package/build-module/plugins/inserter-menu-downloadable-blocks-panel/index.js.map +1 -1
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js +2 -2
- package/build-module/plugins/installed-blocks-pre-publish-panel/index.js.map +1 -1
- package/build-module/store/actions.js +10 -17
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +6 -15
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +4 -9
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +4 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/has-block-type.js +4 -9
- package/build-module/store/utils/has-block-type.js.map +1 -1
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -14,16 +14,13 @@ var _stars = _interopRequireDefault(require("./stars"));
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
const BlockRatings =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rating: rating
|
|
25
|
-
}));
|
|
26
|
-
};
|
|
17
|
+
const BlockRatings = ({
|
|
18
|
+
rating
|
|
19
|
+
}) => (0, _element.createElement)("span", {
|
|
20
|
+
className: "block-directory-block-ratings"
|
|
21
|
+
}, (0, _element.createElement)(_stars.default, {
|
|
22
|
+
rating: rating
|
|
23
|
+
}));
|
|
27
24
|
|
|
28
25
|
exports.BlockRatings = BlockRatings;
|
|
29
26
|
var _default = BlockRatings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/index.js"],"names":["BlockRatings","rating"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,YAAY,GAAG
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/index.js"],"names":["BlockRatings","rating"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAMA,YAAY,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAC3B;AAAM,EAAA,SAAS,EAAC;AAAhB,GACC,4BAAC,cAAD;AAAO,EAAA,MAAM,EAAGA;AAAhB,EADD,CADM;;;eAMQD,Y","sourcesContent":["/**\n * Internal dependencies\n */\nimport Stars from './stars';\n\nexport const BlockRatings = ( { rating } ) => (\n\t<span className=\"block-directory-block-ratings\">\n\t\t<Stars rating={ rating } />\n\t</span>\n);\n\nexport default BlockRatings;\n"]}
|
|
@@ -14,10 +14,9 @@ var _icons = require("@wordpress/icons");
|
|
|
14
14
|
/**
|
|
15
15
|
* WordPress dependencies
|
|
16
16
|
*/
|
|
17
|
-
function Stars(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
17
|
+
function Stars({
|
|
18
|
+
rating
|
|
19
|
+
}) {
|
|
21
20
|
const stars = Math.round(rating / 0.5) * 0.5;
|
|
22
21
|
const fullStarCount = Math.floor(rating);
|
|
23
22
|
const halfStarCount = Math.ceil(rating - fullStarCount);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"names":["Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","Array","from","length","map","_","i","starFilled","starHalf","starEmpty"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,KAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"names":["Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","Array","from","length","map","_","i","starFilled","starHalf","starEmpty"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,SAASA,KAAT,CAAgB;AAAEC,EAAAA;AAAF,CAAhB,EAA6B;AAC5B,QAAMC,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAYH,MAAM,GAAG,GAArB,IAA6B,GAA3C;AAEA,QAAMI,aAAa,GAAGF,IAAI,CAACG,KAAL,CAAYL,MAAZ,CAAtB;AACA,QAAMM,aAAa,GAAGJ,IAAI,CAACK,IAAL,CAAWP,MAAM,GAAGI,aAApB,CAAtB;AACA,QAAMI,cAAc,GAAG,KAAMJ,aAAa,GAAGE,aAAtB,CAAvB;AAEA,SACC;AACC,kBAAa;AACZ;AACA,kBAAI,mBAAJ,CAFY,EAGZL,KAHY;AADd,KAOGQ,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEP;AAAV,GAAZ,EAAwCQ,GAAxC,CAA6C,CAAEC,CAAF,EAAKC,CAAL,KAC9C,4BAAC,WAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,IAAI,EAAGC,iBAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAPH,EAeGN,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEL;AAAV,GAAZ,EAAwCM,GAAxC,CAA6C,CAAEC,CAAF,EAAKC,CAAL,KAC9C,4BAAC,WAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGE,eAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAfH,EAuBGP,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEH;AAAV,GAAZ,EAAyCI,GAAzC,CAA8C,CAAEC,CAAF,EAAKC,CAAL,KAC/C,4BAAC,WAAD;AACC,IAAA,GAAG,EAAI,eAAeA,CAAG,EAD1B;AAEC,IAAA,SAAS,EAAC,2CAFX;AAGC,IAAA,IAAI,EAAGG,gBAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAvBH,CADD;AAkCA;;eAEclB,K","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"]}
|
|
@@ -20,39 +20,34 @@ var _downloadableBlockIcon = _interopRequireDefault(require("../downloadable-blo
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
|
-
function CompactList(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
27
|
-
|
|
23
|
+
function CompactList({
|
|
24
|
+
items
|
|
25
|
+
}) {
|
|
28
26
|
if (!items.length) {
|
|
29
27
|
return null;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
return (0, _element.createElement)("ul", {
|
|
33
31
|
className: "block-directory-compact-list"
|
|
34
|
-
}, items.map(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/* translators: %s: Name of the block author. */
|
|
55
|
-
(0, _i18n.__)('By %s'), author))));
|
|
56
|
-
}));
|
|
32
|
+
}, items.map(({
|
|
33
|
+
icon,
|
|
34
|
+
id,
|
|
35
|
+
title,
|
|
36
|
+
author
|
|
37
|
+
}) => (0, _element.createElement)("li", {
|
|
38
|
+
key: id,
|
|
39
|
+
className: "block-directory-compact-list__item"
|
|
40
|
+
}, (0, _element.createElement)(_downloadableBlockIcon.default, {
|
|
41
|
+
icon: icon,
|
|
42
|
+
title: title
|
|
43
|
+
}), (0, _element.createElement)("div", {
|
|
44
|
+
className: "block-directory-compact-list__item-details"
|
|
45
|
+
}, (0, _element.createElement)("div", {
|
|
46
|
+
className: "block-directory-compact-list__item-title"
|
|
47
|
+
}, title), (0, _element.createElement)("div", {
|
|
48
|
+
className: "block-directory-compact-list__item-author"
|
|
49
|
+
}, (0, _i18n.sprintf)(
|
|
50
|
+
/* translators: %s: Name of the block author. */
|
|
51
|
+
(0, _i18n.__)('By %s'), author))))));
|
|
57
52
|
}
|
|
58
53
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"names":["CompactList","items","length","map","icon","id","title","author"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,WAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/compact-list/index.js"],"names":["CompactList","items","length","map","icon","id","title","author"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,WAAT,CAAsB;AAAEC,EAAAA;AAAF,CAAtB,EAAkC;AAChD,MAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGD,KAAK,CAACE,GAAN,CAAW,CAAE;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,EAAR;AAAYC,IAAAA,KAAZ;AAAmBC,IAAAA;AAAnB,GAAF,KACZ;AAAI,IAAA,GAAG,EAAGF,EAAV;AAAe,IAAA,SAAS,EAAC;AAAzB,KACC,4BAAC,8BAAD;AAAuB,IAAA,IAAI,EAAGD,IAA9B;AAAqC,IAAA,KAAK,EAAGE;AAA7C,IADD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,KADH,CADD,EAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG;AACD;AACA,gBAAI,OAAJ,CAFC,EAGDC,MAHC,CADH,CAJD,CAHD,CADC,CADH,CADD;AAsBA","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"]}
|
|
@@ -12,10 +12,9 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
15
|
-
function DownloadableBlockIcon(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
15
|
+
function DownloadableBlockIcon({
|
|
16
|
+
icon
|
|
17
|
+
}) {
|
|
19
18
|
const className = 'block-directory-downloadable-block-icon';
|
|
20
19
|
return icon.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/) !== null ? (0, _element.createElement)("img", {
|
|
21
20
|
className: className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-icon/index.js"],"names":["DownloadableBlockIcon","icon","className","match"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,qBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-icon/index.js"],"names":["DownloadableBlockIcon","icon","className","match"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,qBAAT,CAAgC;AAAEC,EAAAA;AAAF,CAAhC,EAA2C;AAC1C,QAAMC,SAAS,GAAG,yCAAlB;AACA,SAAOD,IAAI,CAACE,KAAL,CAAY,oCAAZ,MAAuD,IAAvD,GACN;AAAK,IAAA,SAAS,EAAGD,SAAjB;AAA6B,IAAA,GAAG,EAAGD,IAAnC;AAA0C,IAAA,GAAG,EAAC;AAA9C,IADM,GAGN,4BAAC,sBAAD;AAAW,IAAA,SAAS,EAAGC,SAAvB;AAAmC,IAAA,IAAI,EAAGD,IAA1C;AAAiD,IAAA,UAAU;AAA3D,IAHD;AAKA;;eAEcD,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\n\nfunction DownloadableBlockIcon( { icon } ) {\n\tconst className = 'block-directory-downloadable-block-icon';\n\treturn icon.match( /\\.(jpeg|jpg|gif|png|svg)(?:\\?.*)?$/ ) !== null ? (\n\t\t<img className={ className } src={ icon } alt=\"\" />\n\t) : (\n\t\t<BlockIcon className={ className } icon={ icon } showColors />\n\t);\n}\n\nexport default DownloadableBlockIcon;\n"]}
|
|
@@ -37,17 +37,15 @@ var _store = require("../../store");
|
|
|
37
37
|
* Internal dependencies
|
|
38
38
|
*/
|
|
39
39
|
// Return the appropriate block item label, given the block data and status.
|
|
40
|
-
function getDownloadableBlockLabel(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
isInstalling
|
|
50
|
-
} = _ref2;
|
|
40
|
+
function getDownloadableBlockLabel({
|
|
41
|
+
title,
|
|
42
|
+
rating,
|
|
43
|
+
ratingCount
|
|
44
|
+
}, {
|
|
45
|
+
hasNotice,
|
|
46
|
+
isInstalled,
|
|
47
|
+
isInstalling
|
|
48
|
+
}) {
|
|
51
49
|
const stars = Math.round(rating / 0.5) * 0.5;
|
|
52
50
|
|
|
53
51
|
if (!isInstalled && hasNotice) {
|
|
@@ -76,12 +74,11 @@ function getDownloadableBlockLabel(_ref, _ref2) {
|
|
|
76
74
|
(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);
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
function DownloadableBlockListItem(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} = _ref3;
|
|
77
|
+
function DownloadableBlockListItem({
|
|
78
|
+
composite,
|
|
79
|
+
item,
|
|
80
|
+
onClick
|
|
81
|
+
}) {
|
|
85
82
|
const {
|
|
86
83
|
author,
|
|
87
84
|
description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"names":["getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","Button","event","preventDefault","span"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA;AACA,SAASA,yBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-list-item/index.js"],"names":["getDownloadableBlockLabel","title","rating","ratingCount","hasNotice","isInstalled","isInstalling","stars","Math","round","DownloadableBlockListItem","composite","item","onClick","author","description","icon","name","isInstallable","select","getErrorNoticeForBlock","isBlockInstalling","blockDirectoryStore","notice","id","hasFatal","isFatal","statusText","Button","event","preventDefault","span"],"mappings":";;;;;;;;;AAUA;;;;AAPA;;AACA;;AAOA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAaA;AACA;AACA;AAMA;AACA,SAASA,yBAAT,CACC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,MAAT;AAAiBC,EAAAA;AAAjB,CADD,EAEC;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,WAAb;AAA0BC,EAAAA;AAA1B,CAFD,EAGE;AACD,QAAMC,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAYP,MAAM,GAAG,GAArB,IAA6B,GAA3C;;AAEA,MAAK,CAAEG,WAAF,IAAiBD,SAAtB,EAAkC;AACjC;AACA,WAAO,mBAAS,sBAAT,EAAiC,kCAAgBH,KAAhB,CAAjC,CAAP;AACA;;AAED,MAAKI,WAAL,EAAmB;AAClB;AACA,WAAO,mBAAS,SAAT,EAAoB,kCAAgBJ,KAAhB,CAApB,CAAP;AACA;;AAED,MAAKK,YAAL,EAAoB;AACnB;A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AAS,GACV,4BAAC,gCAAD;AAAyB,IAAA,KAAK,EAAGQ;AAAjC,IADU,GAGV,qDACC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG,CAAC,CAAEe,UAAH,GACCA,UADD,GAEC,kCAAgBZ,WAAhB,CAHJ,CADD,EAMGG,aAAa,IACd,EAAIb,WAAW,IAAIC,YAAnB,CADC,IAEA,4BAAC,0BAAD,QACG,cAAI,eAAJ,CADH,CARH,CAnBF,CA9BD,CADD;AAmEA;;eAEcI,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tSpinner,\n\tVisuallyHidden,\n\t__unstableCompositeItem as CompositeItem,\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( { composite, 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\treturn (\n\t\t<CompositeItem\n\t\t\t__experimentalIsFocusable\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName=\"block-directory-downloadable-block-list-item\"\n\t\t\tonClick={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tisBusy={ isInstalling }\n\t\t\tdisabled={ isInstalling || ! isInstallable }\n\t\t\tlabel={ getDownloadableBlockLabel( item, {\n\t\t\t\thasNotice,\n\t\t\t\tisInstalled,\n\t\t\t\tisInstalling,\n\t\t\t} ) }\n\t\t\tshowTooltip={ true }\n\t\t\ttooltipPosition=\"top center\"\n\t\t>\n\t\t\t<div className=\"block-directory-downloadable-block-list-item__icon\">\n\t\t\t\t<DownloadableBlockIcon icon={ icon } title={ title } />\n\t\t\t\t{ isInstalling ? (\n\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__spinner\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</span>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockRatings rating={ rating } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t<span className=\"block-directory-downloadable-block-list-item__details\">\n\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__title\">\n\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: %1$s: block title, %2$s: author name. */\n\t\t\t\t\t\t\t__( '%1$s <span>by %2$s</span>' ),\n\t\t\t\t\t\t\tdecodeEntities( title ),\n\t\t\t\t\t\t\tauthor\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tspan: (\n\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),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t\t{ hasNotice ? (\n\t\t\t\t\t<DownloadableBlockNotice block={ item } />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className=\"block-directory-downloadable-block-list-item__desc\">\n\t\t\t\t\t\t\t{ !! statusText\n\t\t\t\t\t\t\t\t? statusText\n\t\t\t\t\t\t\t\t: decodeEntities( description ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ isInstallable &&\n\t\t\t\t\t\t\t! ( isInstalled || isInstalling ) && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( 'Install block' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</CompositeItem>\n\t);\n}\n\nexport default DownloadableBlockListItem;\n"]}
|
|
@@ -20,10 +20,9 @@ var _store = require("../../store");
|
|
|
20
20
|
/**
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
|
-
const DownloadableBlockNotice =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
23
|
+
const DownloadableBlockNotice = ({
|
|
24
|
+
block
|
|
25
|
+
}) => {
|
|
27
26
|
const errorNotice = (0, _data.useSelect)(select => select(_store.store).getErrorNoticeForBlock(block.id), [block]);
|
|
28
27
|
|
|
29
28
|
if (!errorNotice) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-notice/index.js"],"names":["DownloadableBlockNotice","block","errorNotice","select","blockDirectoryStore","getErrorNoticeForBlock","id","message","isFatal"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,MAAMA,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-block-notice/index.js"],"names":["DownloadableBlockNotice","block","errorNotice","select","blockDirectoryStore","getErrorNoticeForBlock","id","message","isFatal"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGO,MAAMA,uBAAuB,GAAG,CAAE;AAAEC,EAAAA;AAAF,CAAF,KAAiB;AACvD,QAAMC,WAAW,GAAG,qBACjBC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAA8BC,sBAA9B,CAAsDJ,KAAK,CAACK,EAA5D,CAFkB,EAGnB,CAAEL,KAAF,CAHmB,CAApB;;AAMA,MAAK,CAAEC,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,WAAW,CAACK,OADf,EAEGL,WAAW,CAACM,OAAZ,GACC,MAAM,cAAI,yBAAJ,CADP,GAEC,IAJJ,CADD,CADD;AAUA,CArBM;;;eAuBQR,uB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport const DownloadableBlockNotice = ( { block } ) => {\n\tconst errorNotice = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockDirectoryStore ).getErrorNoticeForBlock( block.id ),\n\t\t[ block ]\n\t);\n\n\tif ( ! errorNotice ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className=\"block-directory-downloadable-block-notice\">\n\t\t\t<div className=\"block-directory-downloadable-block-notice__content\">\n\t\t\t\t{ errorNotice.message }\n\t\t\t\t{ errorNotice.isFatal\n\t\t\t\t\t? ' ' + __( 'Try reloading the page.' )\n\t\t\t\t\t: null }\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default DownloadableBlockNotice;\n"]}
|
|
@@ -32,12 +32,11 @@ var _store = require("../../store");
|
|
|
32
32
|
*/
|
|
33
33
|
const noop = () => {};
|
|
34
34
|
|
|
35
|
-
function DownloadableBlocksList(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} = _ref;
|
|
35
|
+
function DownloadableBlocksList({
|
|
36
|
+
items,
|
|
37
|
+
onHover = noop,
|
|
38
|
+
onSelect
|
|
39
|
+
}) {
|
|
41
40
|
const composite = (0, _components.__unstableUseCompositeState)();
|
|
42
41
|
const {
|
|
43
42
|
installBlockType
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","blockDirectoryStore","length","map","item","id","name","then","success"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,sBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-list/index.js"],"names":["noop","DownloadableBlocksList","items","onHover","onSelect","composite","installBlockType","blockDirectoryStore","length","map","item","id","name","then","success"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,SAASC,sBAAT,CAAiC;AAAEC,EAAAA,KAAF;AAASC,EAAAA,OAAO,GAAGH,IAAnB;AAAyBI,EAAAA;AAAzB,CAAjC,EAAuE;AACtE,QAAMC,SAAS,GAAG,8CAAlB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,YAAb,CAA7B;;AAEA,MAAK,CAAEL,KAAK,CAACM,MAAb,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,+BAAD,6BACMH,SADN;AAEC,IAAA,IAAI,EAAC,SAFN;AAGC,IAAA,SAAS,EAAC,0CAHX;AAIC,kBAAa,cAAI,8BAAJ;AAJd,MAMGH,KAAK,CAACO,GAAN,CAAaC,IAAF,IAAY;AACxB,WACC,4BAAC,kCAAD;AACC,MAAA,GAAG,EAAGA,IAAI,CAACC,EADZ;AAEC,MAAA,SAAS,EAAGN,SAFb;AAGC,MAAA,OAAO,EAAG,MAAM;AACf;AACA;AACA;AACA,YAAK,0BAAcK,IAAI,CAACE,IAAnB,CAAL,EAAiC;AAChCR,UAAAA,QAAQ,CAAEM,IAAF,CAAR;AACA,SAFD,MAEO;AACNJ,UAAAA,gBAAgB,CAAEI,IAAF,CAAhB,CAAyBG,IAAzB,CAAiCC,OAAF,IAAe;AAC7C,gBAAKA,OAAL,EAAe;AACdV,cAAAA,QAAQ,CAAEM,IAAF,CAAR;AACA;AACD,WAJD;AAKA;;AACDP,QAAAA,OAAO,CAAE,IAAF,CAAP;AACA,OAjBF;AAkBC,MAAA,OAAO,EAAGA,OAlBX;AAmBC,MAAA,IAAI,EAAGO;AAnBR,MADD;AAuBA,GAxBC,CANH,CADD;AAkCA;;eAEcT,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n} 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 composite = useCompositeState();\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\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\tcomposite={ composite }\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"]}
|
|
@@ -38,17 +38,15 @@ var _store = require("../../store");
|
|
|
38
38
|
*/
|
|
39
39
|
const EMPTY_ARRAY = [];
|
|
40
40
|
|
|
41
|
-
function DownloadableBlocksPanel(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} = _ref;
|
|
51
|
-
|
|
41
|
+
function DownloadableBlocksPanel({
|
|
42
|
+
downloadableItems,
|
|
43
|
+
onSelect,
|
|
44
|
+
onHover,
|
|
45
|
+
hasLocalBlocks,
|
|
46
|
+
hasPermission,
|
|
47
|
+
isLoading,
|
|
48
|
+
isTyping
|
|
49
|
+
}) {
|
|
52
50
|
if (typeof hasPermission === 'undefined' || isLoading || isTyping) {
|
|
53
51
|
return (0, _element.createElement)(_element.Fragment, null, hasPermission && !hasLocalBlocks && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("p", {
|
|
54
52
|
className: "block-directory-downloadable-blocks-panel__no-local"
|
|
@@ -77,11 +75,10 @@ function DownloadableBlocksPanel(_ref) {
|
|
|
77
75
|
})) : !hasLocalBlocks && (0, _element.createElement)(_noResults.default, null);
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
var _default = (0, _compose.compose)([(0, _data.withSelect)((select,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} = _ref2;
|
|
78
|
+
var _default = (0, _compose.compose)([(0, _data.withSelect)((select, {
|
|
79
|
+
filterValue,
|
|
80
|
+
rootClientId = null
|
|
81
|
+
}) => {
|
|
85
82
|
const {
|
|
86
83
|
getDownloadableBlocks,
|
|
87
84
|
isRequestingDownloadableBlocks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"names":["EMPTY_ARRAY","DownloadableBlocksPanel","downloadableItems","onSelect","onHover","hasLocalBlocks","hasPermission","isLoading","isTyping","length","select","filterValue","rootClientId","getDownloadableBlocks","isRequestingDownloadableBlocks","blockDirectoryStore","canInsertBlockType","blockEditorStore","coreStore","canUser","getInstallableBlocks","term","downloadableBlocks","installableBlocks","filter","block"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMA,MAAMA,WAAW,GAAG,EAApB;;AAEA,SAASC,uBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/index.js"],"names":["EMPTY_ARRAY","DownloadableBlocksPanel","downloadableItems","onSelect","onHover","hasLocalBlocks","hasPermission","isLoading","isTyping","length","select","filterValue","rootClientId","getDownloadableBlocks","isRequestingDownloadableBlocks","blockDirectoryStore","canInsertBlockType","blockEditorStore","coreStore","canUser","getInstallableBlocks","term","downloadableBlocks","installableBlocks","filter","block"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMA,MAAMA,WAAW,GAAG,EAApB;;AAEA,SAASC,uBAAT,CAAkC;AACjCC,EAAAA,iBADiC;AAEjCC,EAAAA,QAFiC;AAGjCC,EAAAA,OAHiC;AAIjCC,EAAAA,cAJiC;AAKjCC,EAAAA,aALiC;AAMjCC,EAAAA,SANiC;AAOjCC,EAAAA;AAPiC,CAAlC,EAQI;AACH,MAAK,OAAOF,aAAP,KAAyB,WAAzB,IAAwCC,SAA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F,IACpDT,kBAAkB,CAAES,KAAF,EAASb,YAAT,EAAuB,IAAvB,CADO,CAA1B;;AAIA,QAAKU,kBAAkB,CAACb,MAAnB,KAA8Bc,iBAAiB,CAACd,MAArD,EAA8D;AAC7D,aAAOa,kBAAP;AACA;;AACD,WAAOC,iBAAP;AACA;;AAED,MAAIrB,iBAAiB,GAAGI,aAAa,GAClCc,oBAAoB,CAAET,WAAF,CADc,GAElC,EAFH;;AAIA,MAAKT,iBAAiB,CAACO,MAAlB,KAA6B,CAAlC,EAAsC;AACrCP,IAAAA,iBAAiB,GAAGF,WAApB;AACA;;AAED,QAAMO,SAAS,GAAGO,8BAA8B,CAAEH,WAAF,CAAhD;AAEA,SAAO;AACNT,IAAAA,iBADM;AAENI,IAAAA,aAFM;AAGNC,IAAAA;AAHM,GAAP;AAKA,CArCD,CADuB,CAAT,EAuCVN,uBAvCU,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Spinner } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { withSelect } from '@wordpress/data';\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\nfunction DownloadableBlocksPanel( {\n\tdownloadableItems,\n\tonSelect,\n\tonHover,\n\thasLocalBlocks,\n\thasPermission,\n\tisLoading,\n\tisTyping,\n} ) {\n\tif ( typeof 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\treturn !! downloadableItems.length ? (\n\t\t<DownloadableBlocksInserterPanel\n\t\t\tdownloadableItems={ downloadableItems }\n\t\t\thasLocalBlocks={ hasLocalBlocks }\n\t\t>\n\t\t\t<DownloadableBlocksList\n\t\t\t\titems={ downloadableItems }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tonHover={ onHover }\n\t\t\t/>\n\t\t</DownloadableBlocksInserterPanel>\n\t) : (\n\t\t! hasLocalBlocks && <DownloadableBlocksNoResults />\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select, { filterValue, rootClientId = null } ) => {\n\t\tconst { getDownloadableBlocks, isRequestingDownloadableBlocks } =\n\t\t\tselect( blockDirectoryStore );\n\t\tconst { canInsertBlockType } = select( blockEditorStore );\n\n\t\tconst hasPermission = select( coreStore ).canUser(\n\t\t\t'read',\n\t\t\t'block-directory/search'\n\t\t);\n\n\t\tfunction getInstallableBlocks( term ) {\n\t\t\tconst downloadableBlocks = getDownloadableBlocks( term );\n\t\t\tconst installableBlocks = downloadableBlocks.filter( ( block ) =>\n\t\t\t\tcanInsertBlockType( block, rootClientId, true )\n\t\t\t);\n\n\t\t\tif ( downloadableBlocks.length === installableBlocks.length ) {\n\t\t\t\treturn downloadableBlocks;\n\t\t\t}\n\t\t\treturn installableBlocks;\n\t\t}\n\n\t\tlet downloadableItems = hasPermission\n\t\t\t? getInstallableBlocks( filterValue )\n\t\t\t: [];\n\n\t\tif ( downloadableItems.length === 0 ) {\n\t\t\tdownloadableItems = EMPTY_ARRAY;\n\t\t}\n\n\t\tconst isLoading = isRequestingDownloadableBlocks( filterValue );\n\n\t\treturn {\n\t\t\tdownloadableItems,\n\t\t\thasPermission,\n\t\t\tisLoading,\n\t\t};\n\t} ),\n] )( DownloadableBlocksPanel );\n"]}
|
|
@@ -14,12 +14,11 @@ var _a11y = require("@wordpress/a11y");
|
|
|
14
14
|
/**
|
|
15
15
|
* WordPress dependencies
|
|
16
16
|
*/
|
|
17
|
-
function DownloadableBlocksInserterPanel(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
17
|
+
function DownloadableBlocksInserterPanel({
|
|
18
|
+
children,
|
|
19
|
+
downloadableItems,
|
|
20
|
+
hasLocalBlocks
|
|
21
|
+
}) {
|
|
23
22
|
const count = downloadableItems.length;
|
|
24
23
|
(0, _element.useEffect)(() => {
|
|
25
24
|
(0, _a11y.speak)((0, _i18n.sprintf)(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/inserter-panel.js"],"names":["DownloadableBlocksInserterPanel","children","downloadableItems","hasLocalBlocks","count","length"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AALA;AACA;AACA;AAKA,SAASA,+BAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/inserter-panel.js"],"names":["DownloadableBlocksInserterPanel","children","downloadableItems","hasLocalBlocks","count","length"],"mappings":";;;;;;;AAIA;;AADA;;AAEA;;AALA;AACA;AACA;AAKA,SAASA,+BAAT,CAA0C;AACzCC,EAAAA,QADyC;AAEzCC,EAAAA,iBAFyC;AAGzCC,EAAAA;AAHyC,CAA1C,EAII;AACH,QAAMC,KAAK,GAAGF,iBAAiB,CAACG,MAAhC;AACA,0BAAW,MAAM;AAChB,qBACC;AACC;AACA,kBACC,8CADD,EAEC,gDAFD,EAGCD,KAHD,CAFD,EAOCA,KAPD,CADD;AAWA,GAZD,EAYG,CAAEA,KAAF,CAZH;AAcA,SACC,qDACG,CAAED,cAAF,IACD;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cAAI,kDAAJ,CADH,CAFF,EAOC;AAAK,IAAA,SAAS,EAAC;AAAf,IAPD,EASC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KACG,cAAI,sBAAJ,CADH,CADD,EAIC;AAAG,IAAA,SAAS,EAAC;AAAb,KACG,cACD,oDADC,CADH,CAJD,CADD,EAWGF,QAXH,CATD,CADD;AAyBA;;eAEcD,+B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\nfunction DownloadableBlocksInserterPanel( {\n\tchildren,\n\tdownloadableItems,\n\thasLocalBlocks,\n} ) {\n\tconst count = downloadableItems.length;\n\tuseEffect( () => {\n\t\tspeak(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %d: number of available blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'%d additional block is available to install.',\n\t\t\t\t\t'%d additional blocks are available to install.',\n\t\t\t\t\tcount\n\t\t\t\t),\n\t\t\t\tcount\n\t\t\t)\n\t\t);\n\t}, [ count ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! hasLocalBlocks && (\n\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__no-local\">\n\t\t\t\t\t{ __( 'No results available from your installed blocks.' ) }\n\t\t\t\t</p>\n\t\t\t) }\n\n\t\t\t<div className=\"block-editor-inserter__quick-inserter-separator\" />\n\n\t\t\t<div className=\"block-directory-downloadable-blocks-panel\">\n\t\t\t\t<div className=\"block-directory-downloadable-blocks-panel__header\">\n\t\t\t\t\t<h2 className=\"block-directory-downloadable-blocks-panel__title\">\n\t\t\t\t\t\t{ __( 'Available to install' ) }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p className=\"block-directory-downloadable-blocks-panel__description\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select a block to install and add it to your post.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksInserterPanel;\n"]}
|
|
@@ -47,12 +47,9 @@ const getInstallMissing = OriginalComponent => props => {
|
|
|
47
47
|
const {
|
|
48
48
|
getDownloadableBlocks
|
|
49
49
|
} = select(_store.store);
|
|
50
|
-
const blocks = getDownloadableBlocks('block:' + originalName).filter(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} = _ref;
|
|
54
|
-
return originalName === name;
|
|
55
|
-
});
|
|
50
|
+
const blocks = getDownloadableBlocks('block:' + originalName).filter(({
|
|
51
|
+
name
|
|
52
|
+
}) => originalName === name);
|
|
56
53
|
return {
|
|
57
54
|
hasPermission: select(_coreData.store).canUser('read', 'block-directory/search'),
|
|
58
55
|
block: blocks.length && blocks[0]
|
|
@@ -68,11 +65,10 @@ const getInstallMissing = OriginalComponent => props => {
|
|
|
68
65
|
}));
|
|
69
66
|
};
|
|
70
67
|
|
|
71
|
-
const ModifiedWarning =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} = _ref2;
|
|
68
|
+
const ModifiedWarning = ({
|
|
69
|
+
originalBlock,
|
|
70
|
+
...props
|
|
71
|
+
}) => {
|
|
76
72
|
const {
|
|
77
73
|
originalName,
|
|
78
74
|
originalUndelimitedContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"names":["getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","blockEditorStore","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","push"],"mappings":";;;;;;;;;AAMA;;;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AASA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAKC,iBAAF,IAA2BC,KAAF,IAAa;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAmBD,KAAK,CAACE,UAA/B,CAD+D,CAE/D;AACA;;AACA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAA2B,qBAC9BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,YAAF,CAAxC;AACA,UAAMC,MAAM,GAAGF,qBAAqB,CACnC,WAAWL,YADwB,CAArB,CAEbQ,MAFa,CAEL
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/index.js"],"names":["getInstallMissing","OriginalComponent","props","originalName","attributes","block","hasPermission","select","getDownloadableBlocks","blockDirectoryStore","blocks","filter","name","coreStore","canUser","length","ModifiedWarning","originalBlock","originalUndelimitedContent","clientId","replaceBlock","blockEditorStore","convertToHTML","content","hasContent","hasHTMLBlock","canInsertBlockType","getBlockRootClientId","messageHTML","title","actions","push"],"mappings":";;;;;;;;;AAMA;;;;AAHA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AASA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAKC,iBAAF,IAA2BC,KAAF,IAAa;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAmBD,KAAK,CAACE,UAA/B,CAD+D,CAE/D;AACA;;AACA,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAA2B,qBAC9BC,MAAF,IAAc;AACb,UAAM;AAAEC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,MAAM,CAAEc,kBAAF,CADP;AAGA,WAAOK,kBAAkB,CACxB,WADwB,EAExBC,oBAAoB,CAAER,QAAF,CAFI,CAAzB;AAIA,GATmB,EAUpB,CAAEA,QAAF,CAVoB,CAArB;AAaA,MAAIS,WAAW,GAAG;AACjB;AACA,gBACC,6GADD,CAFiB,EAKjBX,aAAa,CAACY,KAAd,IAAuB1B,YALN,CAAlB;AAOA,QAAM2B,OAAO,GAAG,CACf,4BAAC,sBAAD;AACC,IAAA,GAAG,EAAC,SADL;AAEC,IAAA,KAAK,EAAGb,aAFT;AAGC,IAAA,UAAU,EAAGf,KAAK,CAACE,UAHpB;AAIC,IAAA,QAAQ,EAAGF,KAAK,CAACiB;AAJlB,IADe,CAAhB;;AASA,MAAKK,UAAU,IAAIC,YAAnB,EAAkC;AACjCG,IAAAA,WAAW,GAAG;AACb;AACA,kBACC,iJADD,CAFa,EAKbX,aAAa,CAACY,KAAd,IAAuB1B,YALV,CAAd;AAOA2B,IAAAA,OAAO,CAACC,IAAR,CACC,4BAAC,kBAAD;AAAQ,MAAA,GAAG,EAAC,SAAZ;AAAsB,MAAA,OAAO,EAAGT,aAAhC;AAAgD,MAAA,OAAO,EAAC;AAAxD,OACG,cAAI,cAAJ,CADH,CADD;AAKA;;AAED,SACC,mCAAU,iCAAV,EACC,4BAAC,oBAAD;AAAS,IAAA,OAAO,EAAGQ;AAAnB,KAA+BF,WAA/B,CADD,EAEC,4BAAC,gBAAD,QAAWV,0BAAX,CAFD,CADD;AAMA,CAhED;;eAkEelB,iB","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 key=\"convert\" onClick={ convertToHTML } variant=\"tertiary\">\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"]}
|
|
@@ -26,12 +26,11 @@ var _store = require("../../store");
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
|
-
function InstallButton(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = _ref;
|
|
29
|
+
function InstallButton({
|
|
30
|
+
attributes,
|
|
31
|
+
block,
|
|
32
|
+
clientId
|
|
33
|
+
}) {
|
|
35
34
|
const isInstallingBlock = (0, _data.useSelect)(select => select(_store.store).isInstalling(block.id), [block.id]);
|
|
36
35
|
const {
|
|
37
36
|
installBlockType
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/install-button.js"],"names":["InstallButton","attributes","block","clientId","isInstallingBlock","select","blockDirectoryStore","isInstalling","id","installBlockType","replaceBlock","blockEditorStore","then","success","blockType","name","originalBlock","originalContent","innerBlocks","title"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,aAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/plugins/get-install-missing/install-button.js"],"names":["InstallButton","attributes","block","clientId","isInstallingBlock","select","blockDirectoryStore","isInstalling","id","installBlockType","replaceBlock","blockEditorStore","then","success","blockType","name","originalBlock","originalContent","innerBlocks","title"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,aAAT,CAAwB;AAAEC,EAAAA,UAAF;AAAcC,EAAAA,KAAd;AAAqBC,EAAAA;AAArB,CAAxB,EAA0D;AACxE,QAAMC,iBAAiB,GAAG,qBACvBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAA8BC,YAA9B,CAA4CL,KAAK,CAACM,EAAlD,CADW,EAEzB,CAAEN,KAAK,CAACM,EAAR,CAFyB,CAA1B;AAIA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaH,YAAb,CAA7B;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAmB,uBAAaC,kBAAb,CAAzB;AAEA,SACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAG,MACTF,gBAAgB,CAAEP,KAAF,CAAhB,CAA0BU,IAA1B,CAAkCC,OAAF,IAAe;AAC9C,UAAKA,OAAL,EAAe;AACd,cAAMC,SAAS,GAAG,0BAAcZ,KAAK,CAACa,IAApB,CAAlB;AACA,cAAM,CAAEC,aAAF,IAAoB,mBACzBf,UAAU,CAACgB,eADc,CAA1B;;AAGA,YAAKD,aAAa,IAAIF,SAAtB,EAAkC;AACjCJ,UAAAA,YAAY,CACXP,QADW,EAEX,yBACCW,SAAS,CAACC,IADX,EAECC,aAAa,CAACf,UAFf,EAGCe,aAAa,CAACE,WAHf,CAFW,CAAZ;AAQA;AACD;AACD,KAjBD,CAFF;AAqBC,IAAA,QAAQ,EAAGd,iBArBZ;AAsBC,IAAA,MAAM,EAAGA,iBAtBV;AAuBC,IAAA,OAAO,EAAC;AAvBT,KAyBG;AACD;AACA,gBAAI,YAAJ,CAFC,EAGDF,KAAK,CAACiB,KAHL,CAzBH,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { createBlock, getBlockType, parse } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as blockDirectoryStore } from '../../store';\n\nexport default function InstallButton( { attributes, block, clientId } ) {\n\tconst isInstallingBlock = useSelect(\n\t\t( select ) => select( blockDirectoryStore ).isInstalling( block.id ),\n\t\t[ block.id ]\n\t);\n\tconst { installBlockType } = useDispatch( blockDirectoryStore );\n\tconst { replaceBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tinstallBlockType( block ).then( ( success ) => {\n\t\t\t\t\tif ( success ) {\n\t\t\t\t\t\tconst blockType = getBlockType( block.name );\n\t\t\t\t\t\tconst [ originalBlock ] = parse(\n\t\t\t\t\t\t\tattributes.originalContent\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( originalBlock && blockType ) {\n\t\t\t\t\t\t\treplaceBlock(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\tblockType.name,\n\t\t\t\t\t\t\t\t\toriginalBlock.attributes,\n\t\t\t\t\t\t\t\t\toriginalBlock.innerBlocks\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}\n\t\t\t\t} )\n\t\t\t}\n\t\t\tdisabled={ isInstallingBlock }\n\t\t\tisBusy={ isInstallingBlock }\n\t\t\tvariant=\"primary\"\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %s: block name */\n\t\t\t\t__( 'Install %s' ),\n\t\t\t\tblock.title\n\t\t\t) }\n\t\t</Button>\n\t);\n}\n"]}
|
|
@@ -25,15 +25,13 @@ var _downloadableBlocksPanel = _interopRequireDefault(require("../../components/
|
|
|
25
25
|
function InserterMenuDownloadableBlocksPanel() {
|
|
26
26
|
const [debouncedFilterValue, setFilterValue] = (0, _element.useState)('');
|
|
27
27
|
const debouncedSetFilterValue = (0, _compose.debounce)(setFilterValue, 400);
|
|
28
|
-
return (0, _element.createElement)(_blockEditor.__unstableInserterMenuExtension, null,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
36
|
-
|
|
28
|
+
return (0, _element.createElement)(_blockEditor.__unstableInserterMenuExtension, null, ({
|
|
29
|
+
onSelect,
|
|
30
|
+
onHover,
|
|
31
|
+
filterValue,
|
|
32
|
+
hasItems,
|
|
33
|
+
rootClientId
|
|
34
|
+
}) => {
|
|
37
35
|
if (debouncedFilterValue !== filterValue) {
|
|
38
36
|
debouncedSetFilterValue(filterValue);
|
|
39
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],"names":["InserterMenuDownloadableBlocksPanel","debouncedFilterValue","setFilterValue","debouncedSetFilterValue","onSelect","onHover","filterValue","hasItems","rootClientId"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAMA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGA,SAASA,mCAAT,GAA+C;AAC9C,QAAM,CAAEC,oBAAF,EAAwBC,cAAxB,IAA2C,uBAAU,EAAV,CAAjD;AACA,QAAMC,uBAAuB,GAAG,uBAAUD,cAAV,EAA0B,GAA1B,CAAhC;AAEA,SACC,4BAAC,4CAAD,QACG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-directory/src/plugins/inserter-menu-downloadable-blocks-panel/index.js"],"names":["InserterMenuDownloadableBlocksPanel","debouncedFilterValue","setFilterValue","debouncedSetFilterValue","onSelect","onHover","filterValue","hasItems","rootClientId"],"mappings":";;;;;;;;;AAKA;;AAFA;;AACA;;AAMA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAGA,SAASA,mCAAT,GAA+C;AAC9C,QAAM,CAAEC,oBAAF,EAAwBC,cAAxB,IAA2C,uBAAU,EAAV,CAAjD;AACA,QAAMC,uBAAuB,GAAG,uBAAUD,cAAV,EAA0B,GAA1B,CAAhC;AAEA,SACC,4BAAC,4CAAD,QACG,CAAE;AACHE,IAAAA,QADG;AAEHC,IAAAA,OAFG;AAGHC,IAAAA,WAHG;AAIHC,IAAAA,QAJG;AAKHC,IAAAA;AALG,GAAF,KAMK;AACN,QAAKP,oBAAoB,KAAKK,WAA9B,EAA4C;AAC3CH,MAAAA,uBAAuB,CAAEG,WAAF,CAAvB;AACA;;AAED,QAAK,CAAEL,oBAAP,EAA8B;AAC7B,aAAO,IAAP;AACA;;AAED,WACC,4BAAC,gCAAD;AACC,MAAA,QAAQ,EAAGG,QADZ;AAEC,MAAA,OAAO,EAAGC,OAFX;AAGC,MAAA,YAAY,EAAGG,YAHhB;AAIC,MAAA,WAAW,EAAGP,oBAJf;AAKC,MAAA,cAAc,EAAGM,QALlB;AAMC,MAAA,QAAQ,EAAGD,WAAW,KAAKL;AAN5B,MADD;AAUA,GA1BF,CADD;AA8BA;;eAEcD,mC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableInserterMenuExtension } from '@wordpress/block-editor';\nimport { debounce } from '@wordpress/compose';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DownloadableBlocksPanel from '../../components/downloadable-blocks-panel';\n\nfunction InserterMenuDownloadableBlocksPanel() {\n\tconst [ debouncedFilterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSetFilterValue = debounce( setFilterValue, 400 );\n\n\treturn (\n\t\t<__unstableInserterMenuExtension>\n\t\t\t{ ( {\n\t\t\t\tonSelect,\n\t\t\t\tonHover,\n\t\t\t\tfilterValue,\n\t\t\t\thasItems,\n\t\t\t\trootClientId,\n\t\t\t} ) => {\n\t\t\t\tif ( debouncedFilterValue !== filterValue ) {\n\t\t\t\t\tdebouncedSetFilterValue( filterValue );\n\t\t\t\t}\n\n\t\t\t\tif ( ! debouncedFilterValue ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DownloadableBlocksPanel\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\tfilterValue={ debouncedFilterValue }\n\t\t\t\t\t\thasLocalBlocks={ hasItems }\n\t\t\t\t\t\tisTyping={ filterValue !== debouncedFilterValue }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</__unstableInserterMenuExtension>\n\t);\n}\n\nexport default InserterMenuDownloadableBlocksPanel;\n"]}
|
|
@@ -19,13 +19,13 @@ var _compactList = _interopRequireDefault(require("../../components/compact-list
|
|
|
19
19
|
|
|
20
20
|
var _store = require("../../store");
|
|
21
21
|
|
|
22
|
-
var _window$wp$editPost
|
|
22
|
+
var _window$wp$editPost;
|
|
23
23
|
|
|
24
24
|
// We shouldn't import the edit-post package directly
|
|
25
25
|
// because it would include the wp-edit-post in all pages loading the block-directory script.
|
|
26
26
|
const {
|
|
27
27
|
PluginPrePublishPanel
|
|
28
|
-
} = (_window$wp$editPost =
|
|
28
|
+
} = (_window$wp$editPost = window?.wp?.editPost) !== null && _window$wp$editPost !== void 0 ? _window$wp$editPost : {};
|
|
29
29
|
|
|
30
30
|
function InstalledBlocksPrePublishPanel() {
|
|
31
31
|
const newBlockTypes = (0, _data.useSelect)(select => select(_store.store).getNewBlockTypes(), []);
|