@wordpress/block-directory 3.12.0 → 3.14.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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.14.0 (2022-08-24)
6
+
7
+ ## 3.13.0 (2022-08-10)
8
+
5
9
  ## 3.12.0 (2022-07-27)
6
10
 
7
11
  ## 3.11.0 (2022-07-13)
@@ -7,16 +7,10 @@ exports.default = void 0;
7
7
 
8
8
  var _element = require("@wordpress/element");
9
9
 
10
- var _lodash = require("lodash");
11
-
12
10
  var _i18n = require("@wordpress/i18n");
13
11
 
14
12
  var _icons = require("@wordpress/icons");
15
13
 
16
- /**
17
- * External dependencies
18
- */
19
-
20
14
  /**
21
15
  * WordPress dependencies
22
16
  */
@@ -32,17 +26,23 @@ function Stars(_ref) {
32
26
  "aria-label": (0, _i18n.sprintf)(
33
27
  /* translators: %s: number of stars. */
34
28
  (0, _i18n.__)('%s out of 5 stars'), stars)
35
- }, (0, _lodash.times)(fullStarCount, i => (0, _element.createElement)(_icons.Icon, {
29
+ }, Array.from({
30
+ length: fullStarCount
31
+ }).map((_, i) => (0, _element.createElement)(_icons.Icon, {
36
32
  key: `full_stars_${i}`,
37
33
  className: "block-directory-block-ratings__star-full",
38
34
  icon: _icons.starFilled,
39
35
  size: 16
40
- })), (0, _lodash.times)(halfStarCount, i => (0, _element.createElement)(_icons.Icon, {
36
+ })), Array.from({
37
+ length: halfStarCount
38
+ }).map((_, i) => (0, _element.createElement)(_icons.Icon, {
41
39
  key: `half_stars_${i}`,
42
40
  className: "block-directory-block-ratings__star-half-full",
43
41
  icon: _icons.starHalf,
44
42
  size: 16
45
- })), (0, _lodash.times)(emptyStarCount, i => (0, _element.createElement)(_icons.Icon, {
43
+ })), Array.from({
44
+ length: emptyStarCount
45
+ }).map((_, i) => (0, _element.createElement)(_icons.Icon, {
46
46
  key: `empty_stars_${i}`,
47
47
  className: "block-directory-block-ratings__star-empty",
48
48
  icon: _icons.starEmpty,
@@ -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","i","starFilled","starHalf","starEmpty"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,KAAT,OAA6B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;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,KAOG,mBAAOG,aAAP,EAAwBK,CAAF,IACvB,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,EAeG,mBAAOJ,aAAP,EAAwBG,CAAF,IACvB,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,EAuBG,mBAAOH,cAAP,EAAyBC,CAAF,IACxB,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;;eAEcb,K","sourcesContent":["/**\n * External dependencies\n */\nimport { times } from 'lodash';\n\n/**\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{ times( fullStarCount, ( 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{ times( halfStarCount, ( 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{ times( emptyStarCount, ( 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"]}
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,OAA6B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;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"]}
@@ -24,9 +24,9 @@ function DownloadableBlocksNoResults() {
24
24
  icon: _icons.blockDefault
25
25
  }), (0, _element.createElement)("p", null, (0, _i18n.__)('No results found.'))), (0, _element.createElement)("div", {
26
26
  className: "block-editor-inserter__tips"
27
- }, (0, _element.createElement)(_components.Tip, null, (0, _element.createElement)("div", null, (0, _element.createElement)("p", null, (0, _i18n.__)('Interested in creating your own block?')), (0, _element.createElement)(_components.ExternalLink, {
27
+ }, (0, _element.createElement)(_components.Tip, null, (0, _i18n.__)('Interested in creating your own block?'), (0, _element.createElement)("br", null), (0, _element.createElement)(_components.ExternalLink, {
28
28
  href: "https://developer.wordpress.org/block-editor/"
29
- }, (0, _i18n.__)('Get started here'), ".")))));
29
+ }, (0, _i18n.__)('Get started here'), "."))));
30
30
  }
31
31
 
32
32
  var _default = DownloadableBlocksNoResults;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"names":["DownloadableBlocksNoResults","blockDefault"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,SAASA,2BAAT,GAAuC;AACtC,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,WAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,IAAI,EAAGC;AAFR,IADD,EAKC,uCAAK,cAAI,mBAAJ,CAAL,CALD,CADD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,eAAD,QACC,yCACC,uCACG,cAAI,wCAAJ,CADH,CADD,EAIC,4BAAC,wBAAD;AAAc,IAAA,IAAI,EAAC;AAAnB,KACG,cAAI,kBAAJ,CADH,MAJD,CADD,CADD,CARD,CADD;AAuBA;;eAEcD,2B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</div>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"names":["DownloadableBlocksNoResults","blockDefault"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;AAKA,SAASA,2BAAT,GAAuC;AACtC,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,WAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,IAAI,EAAGC;AAFR,IADD,EAKC,uCAAK,cAAI,mBAAJ,CAAL,CALD,CADD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,eAAD,QACG,cAAI,wCAAJ,CADH,EAEC,uCAFD,EAGC,4BAAC,wBAAD;AAAc,IAAA,IAAI,EAAC;AAAnB,KACG,cAAI,kBAAJ,CADH,MAHD,CADD,CARD,CADD;AAoBA;;eAEcD,2B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"]}
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.getDownloadableBlocks = void 0;
9
9
 
10
- var _lodash = require("lodash");
10
+ var _changeCase = require("change-case");
11
11
 
12
12
  var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
13
13
 
@@ -38,7 +38,10 @@ const getDownloadableBlocks = filterValue => async _ref => {
38
38
  const results = await (0, _apiFetch.default)({
39
39
  path: `wp/v2/block-directory/search?term=${filterValue}`
40
40
  });
41
- const blocks = results.map(result => (0, _lodash.mapKeys)(result, (value, key) => (0, _lodash.camelCase)(key)));
41
+ const blocks = results.map(result => Object.fromEntries(Object.entries(result).map(_ref2 => {
42
+ let [key, value] = _ref2;
43
+ return [(0, _changeCase.camelCase)(key), value];
44
+ })));
42
45
  dispatch((0, _actions.receiveDownloadableBlocks)(blocks, filterValue));
43
46
  } catch {}
44
47
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/store/resolvers.js"],"names":["getDownloadableBlocks","filterValue","dispatch","results","path","blocks","map","result","value","key"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGO,MAAMA,qBAAqB,GAC/BC,WAAF,IACA,cAA0B;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;;AACzB,MAAK,CAAED,WAAP,EAAqB;AACpB;AACA;;AAED,MAAI;AACHC,IAAAA,QAAQ,CAAE,sCAAyBD,WAAzB,CAAF,CAAR;AACA,UAAME,OAAO,GAAG,MAAM,uBAAU;AAC/BC,MAAAA,IAAI,EAAG,qCAAqCH,WAAa;AAD1B,KAAV,CAAtB;AAGA,UAAMI,MAAM,GAAGF,OAAO,CAACG,GAAR,CAAeC,MAAF,IAC3B,qBAASA,MAAT,EAAiB,CAAEC,KAAF,EAASC,GAAT,KAAkB,uBAAWA,GAAX,CAAnC,CADc,CAAf;AAIAP,IAAAA,QAAQ,CAAE,wCAA2BG,MAA3B,EAAmCJ,WAAnC,CAAF,CAAR;AACA,GAVD,CAUE,MAAM,CAAE;AACV,CAlBK","sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase, mapKeys } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tmapKeys( result, ( value, key ) => camelCase( key ) )\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {}\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-directory/src/store/resolvers.js"],"names":["getDownloadableBlocks","filterValue","dispatch","results","path","blocks","map","result","Object","fromEntries","entries","key","value"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGO,MAAMA,qBAAqB,GAC/BC,WAAF,IACA,cAA0B;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;;AACzB,MAAK,CAAED,WAAP,EAAqB;AACpB;AACA;;AAED,MAAI;AACHC,IAAAA,QAAQ,CAAE,sCAAyBD,WAAzB,CAAF,CAAR;AACA,UAAME,OAAO,GAAG,MAAM,uBAAU;AAC/BC,MAAAA,IAAI,EAAG,qCAAqCH,WAAa;AAD1B,KAAV,CAAtB;AAGA,UAAMI,MAAM,GAAGF,OAAO,CAACG,GAAR,CAAeC,MAAF,IAC3BC,MAAM,CAACC,WAAP,CACCD,MAAM,CAACE,OAAP,CAAgBH,MAAhB,EAAyBD,GAAzB,CAA8B;AAAA,UAAE,CAAEK,GAAF,EAAOC,KAAP,CAAF;AAAA,aAAsB,CACnD,2BAAWD,GAAX,CADmD,EAEnDC,KAFmD,CAAtB;AAAA,KAA9B,CADD,CADc,CAAf;AASAV,IAAAA,QAAQ,CAAE,wCAA2BG,MAA3B,EAAmCJ,WAAnC,CAAF,CAAR;AACA,GAfD,CAeE,MAAM,CAAE;AACV,CAvBK","sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( result ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {}\n\t};\n"]}
@@ -1,13 +1,8 @@
1
1
  import { createElement } from "@wordpress/element";
2
2
 
3
- /**
4
- * External dependencies
5
- */
6
- import { times } from 'lodash';
7
3
  /**
8
4
  * WordPress dependencies
9
5
  */
10
-
11
6
  import { __, sprintf } from '@wordpress/i18n';
12
7
  import { Icon, starEmpty, starFilled, starHalf } from '@wordpress/icons';
13
8
 
@@ -23,17 +18,23 @@ function Stars(_ref) {
23
18
  "aria-label": sprintf(
24
19
  /* translators: %s: number of stars. */
25
20
  __('%s out of 5 stars'), stars)
26
- }, times(fullStarCount, i => createElement(Icon, {
21
+ }, Array.from({
22
+ length: fullStarCount
23
+ }).map((_, i) => createElement(Icon, {
27
24
  key: `full_stars_${i}`,
28
25
  className: "block-directory-block-ratings__star-full",
29
26
  icon: starFilled,
30
27
  size: 16
31
- })), times(halfStarCount, i => createElement(Icon, {
28
+ })), Array.from({
29
+ length: halfStarCount
30
+ }).map((_, i) => createElement(Icon, {
32
31
  key: `half_stars_${i}`,
33
32
  className: "block-directory-block-ratings__star-half-full",
34
33
  icon: starHalf,
35
34
  size: 16
36
- })), times(emptyStarCount, i => createElement(Icon, {
35
+ })), Array.from({
36
+ length: emptyStarCount
37
+ }).map((_, i) => createElement(Icon, {
37
38
  key: `empty_stars_${i}`,
38
39
  className: "block-directory-block-ratings__star-empty",
39
40
  icon: starEmpty,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"names":["times","__","sprintf","Icon","starEmpty","starFilled","starHalf","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","i"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,IAAT,EAAeC,SAAf,EAA0BC,UAA1B,EAAsCC,QAAtC,QAAsD,kBAAtD;;AAEA,SAASC,KAAT,OAA6B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;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,kBAAaZ,OAAO;AACnB;AACAD,IAAAA,EAAE,CAAE,mBAAF,CAFiB,EAGnBQ,KAHmB;AADrB,KAOGT,KAAK,CAAEY,aAAF,EAAmBK,CAAF,IACvB,cAAC,IAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,IAAI,EAAGZ,UAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADM,CAPR,EAeGL,KAAK,CAAEc,aAAF,EAAmBG,CAAF,IACvB,cAAC,IAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGX,QAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADM,CAfR,EAuBGN,KAAK,CAAEgB,cAAF,EAAoBC,CAAF,IACxB,cAAC,IAAD;AACC,IAAA,GAAG,EAAI,eAAeA,CAAG,EAD1B;AAEC,IAAA,SAAS,EAAC,2CAFX;AAGC,IAAA,IAAI,EAAGb,SAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADM,CAvBR,CADD;AAkCA;;AAED,eAAeG,KAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { times } from 'lodash';\n\n/**\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{ times( fullStarCount, ( 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{ times( halfStarCount, ( 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{ times( emptyStarCount, ( 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"]}
1
+ {"version":3,"sources":["@wordpress/block-directory/src/components/block-ratings/stars.js"],"names":["__","sprintf","Icon","starEmpty","starFilled","starHalf","Stars","rating","stars","Math","round","fullStarCount","floor","halfStarCount","ceil","emptyStarCount","Array","from","length","map","_","i"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,IAAT,EAAeC,SAAf,EAA0BC,UAA1B,EAAsCC,QAAtC,QAAsD,kBAAtD;;AAEA,SAASC,KAAT,OAA6B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;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,kBAAaZ,OAAO;AACnB;AACAD,IAAAA,EAAE,CAAE,mBAAF,CAFiB,EAGnBQ,KAHmB;AADrB,KAOGQ,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEP;AAAV,GAAZ,EAAwCQ,GAAxC,CAA6C,CAAEC,CAAF,EAAKC,CAAL,KAC9C,cAAC,IAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,IAAI,EAAGjB,UAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAPH,EAeGY,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEL;AAAV,GAAZ,EAAwCM,GAAxC,CAA6C,CAAEC,CAAF,EAAKC,CAAL,KAC9C,cAAC,IAAD;AACC,IAAA,GAAG,EAAI,cAAcA,CAAG,EADzB;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGhB,QAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAfH,EAuBGW,KAAK,CAACC,IAAN,CAAY;AAAEC,IAAAA,MAAM,EAAEH;AAAV,GAAZ,EAAyCI,GAAzC,CAA8C,CAAEC,CAAF,EAAKC,CAAL,KAC/C,cAAC,IAAD;AACC,IAAA,GAAG,EAAI,eAAeA,CAAG,EAD1B;AAEC,IAAA,SAAS,EAAC,2CAFX;AAGC,IAAA,IAAI,EAAGlB,SAHR;AAIC,IAAA,IAAI,EAAG;AAJR,IADC,CAvBH,CADD;AAkCA;;AAED,eAAeG,KAAf","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"]}
@@ -15,9 +15,9 @@ function DownloadableBlocksNoResults() {
15
15
  icon: blockDefault
16
16
  }), createElement("p", null, __('No results found.'))), createElement("div", {
17
17
  className: "block-editor-inserter__tips"
18
- }, createElement(Tip, null, createElement("div", null, createElement("p", null, __('Interested in creating your own block?')), createElement(ExternalLink, {
18
+ }, createElement(Tip, null, __('Interested in creating your own block?'), createElement("br", null), createElement(ExternalLink, {
19
19
  href: "https://developer.wordpress.org/block-editor/"
20
- }, __('Get started here'), ".")))));
20
+ }, __('Get started here'), "."))));
21
21
  }
22
22
 
23
23
  export default DownloadableBlocksNoResults;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"names":["__","Icon","blockDefault","Tip","ExternalLink","DownloadableBlocksNoResults"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,YAAf,QAAmC,kBAAnC;AACA,SAASC,GAAT,EAAcC,YAAd,QAAkC,uBAAlC;;AAEA,SAASC,2BAAT,GAAuC;AACtC,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,IAAI,EAAGH;AAFR,IADD,EAKC,yBAAKF,EAAE,CAAE,mBAAF,CAAP,CALD,CADD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,GAAD,QACC,2BACC,yBACGA,EAAE,CAAE,wCAAF,CADL,CADD,EAIC,cAAC,YAAD;AAAc,IAAA,IAAI,EAAC;AAAnB,KACGA,EAAE,CAAE,kBAAF,CADL,MAJD,CADD,CADD,CARD,CADD;AAuBA;;AAED,eAAeK,2BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</div>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-directory/src/components/downloadable-blocks-panel/no-results.js"],"names":["__","Icon","blockDefault","Tip","ExternalLink","DownloadableBlocksNoResults"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,IAAT,EAAeC,YAAf,QAAmC,kBAAnC;AACA,SAASC,GAAT,EAAcC,YAAd,QAAkC,uBAAlC;;AAEA,SAASC,2BAAT,GAAuC;AACtC,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,wCADX;AAEC,IAAA,IAAI,EAAGH;AAFR,IADD,EAKC,yBAAKF,EAAE,CAAE,mBAAF,CAAP,CALD,CADD,EAQC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,GAAD,QACGA,EAAE,CAAE,wCAAF,CADL,EAEC,yBAFD,EAGC,cAAC,YAAD;AAAc,IAAA,IAAI,EAAC;AAAnB,KACGA,EAAE,CAAE,kBAAF,CADL,MAHD,CADD,CARD,CADD;AAoBA;;AAED,eAAeK,2BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, blockDefault } from '@wordpress/icons';\nimport { Tip, ExternalLink } from '@wordpress/components';\n\nfunction DownloadableBlocksNoResults() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"block-editor-inserter__no-results\">\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"block-editor-inserter__no-results-icon\"\n\t\t\t\t\ticon={ blockDefault }\n\t\t\t\t/>\n\t\t\t\t<p>{ __( 'No results found.' ) }</p>\n\t\t\t</div>\n\t\t\t<div className=\"block-editor-inserter__tips\">\n\t\t\t\t<Tip>\n\t\t\t\t\t{ __( 'Interested in creating your own block?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink href=\"https://developer.wordpress.org/block-editor/\">\n\t\t\t\t\t\t{ __( 'Get started here' ) }.\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</Tip>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default DownloadableBlocksNoResults;\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { camelCase, mapKeys } from 'lodash';
4
+ import { camelCase } from 'change-case';
5
5
  /**
6
6
  * WordPress dependencies
7
7
  */
@@ -26,7 +26,10 @@ export const getDownloadableBlocks = filterValue => async _ref => {
26
26
  const results = await apiFetch({
27
27
  path: `wp/v2/block-directory/search?term=${filterValue}`
28
28
  });
29
- const blocks = results.map(result => mapKeys(result, (value, key) => camelCase(key)));
29
+ const blocks = results.map(result => Object.fromEntries(Object.entries(result).map(_ref2 => {
30
+ let [key, value] = _ref2;
31
+ return [camelCase(key), value];
32
+ })));
30
33
  dispatch(receiveDownloadableBlocks(blocks, filterValue));
31
34
  } catch {}
32
35
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-directory/src/store/resolvers.js"],"names":["camelCase","mapKeys","apiFetch","fetchDownloadableBlocks","receiveDownloadableBlocks","getDownloadableBlocks","filterValue","dispatch","results","path","blocks","map","result","value","key"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,OAApB,QAAmC,QAAnC;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAEA;AACA;AACA;;AACA,SAASC,uBAAT,EAAkCC,yBAAlC,QAAmE,WAAnE;AAEA,OAAO,MAAMC,qBAAqB,GAC/BC,WAAF,IACA,cAA0B;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;;AACzB,MAAK,CAAED,WAAP,EAAqB;AACpB;AACA;;AAED,MAAI;AACHC,IAAAA,QAAQ,CAAEJ,uBAAuB,CAAEG,WAAF,CAAzB,CAAR;AACA,UAAME,OAAO,GAAG,MAAMN,QAAQ,CAAE;AAC/BO,MAAAA,IAAI,EAAG,qCAAqCH,WAAa;AAD1B,KAAF,CAA9B;AAGA,UAAMI,MAAM,GAAGF,OAAO,CAACG,GAAR,CAAeC,MAAF,IAC3BX,OAAO,CAAEW,MAAF,EAAU,CAAEC,KAAF,EAASC,GAAT,KAAkBd,SAAS,CAAEc,GAAF,CAArC,CADO,CAAf;AAIAP,IAAAA,QAAQ,CAAEH,yBAAyB,CAAEM,MAAF,EAAUJ,WAAV,CAA3B,CAAR;AACA,GAVD,CAUE,MAAM,CAAE;AACV,CAlBK","sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase, mapKeys } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tmapKeys( result, ( value, key ) => camelCase( key ) )\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {}\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-directory/src/store/resolvers.js"],"names":["camelCase","apiFetch","fetchDownloadableBlocks","receiveDownloadableBlocks","getDownloadableBlocks","filterValue","dispatch","results","path","blocks","map","result","Object","fromEntries","entries","key","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,aAA1B;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAEA;AACA;AACA;;AACA,SAASC,uBAAT,EAAkCC,yBAAlC,QAAmE,WAAnE;AAEA,OAAO,MAAMC,qBAAqB,GAC/BC,WAAF,IACA,cAA0B;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;;AACzB,MAAK,CAAED,WAAP,EAAqB;AACpB;AACA;;AAED,MAAI;AACHC,IAAAA,QAAQ,CAAEJ,uBAAuB,CAAEG,WAAF,CAAzB,CAAR;AACA,UAAME,OAAO,GAAG,MAAMN,QAAQ,CAAE;AAC/BO,MAAAA,IAAI,EAAG,qCAAqCH,WAAa;AAD1B,KAAF,CAA9B;AAGA,UAAMI,MAAM,GAAGF,OAAO,CAACG,GAAR,CAAeC,MAAF,IAC3BC,MAAM,CAACC,WAAP,CACCD,MAAM,CAACE,OAAP,CAAgBH,MAAhB,EAAyBD,GAAzB,CAA8B;AAAA,UAAE,CAAEK,GAAF,EAAOC,KAAP,CAAF;AAAA,aAAsB,CACnDhB,SAAS,CAAEe,GAAF,CAD0C,EAEnDC,KAFmD,CAAtB;AAAA,KAA9B,CADD,CADc,CAAf;AASAV,IAAAA,QAAQ,CAAEH,yBAAyB,CAAEM,MAAF,EAAUJ,WAAV,CAA3B,CAAR;AACA,GAfD,CAeE,MAAM,CAAE;AACV,CAvBK","sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { fetchDownloadableBlocks, receiveDownloadableBlocks } from './actions';\n\nexport const getDownloadableBlocks =\n\t( filterValue ) =>\n\tasync ( { dispatch } ) => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tdispatch( fetchDownloadableBlocks( filterValue ) );\n\t\t\tconst results = await apiFetch( {\n\t\t\t\tpath: `wp/v2/block-directory/search?term=${ filterValue }`,\n\t\t\t} );\n\t\t\tconst blocks = results.map( ( result ) =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries( result ).map( ( [ key, value ] ) => [\n\t\t\t\t\t\tcamelCase( key ),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t] )\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tdispatch( receiveDownloadableBlocks( blocks, filterValue ) );\n\t\t} catch {}\n\t};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-directory",
3
- "version": "3.12.0",
3
+ "version": "3.14.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",
@@ -26,24 +26,25 @@
26
26
  "react-native": "src/index",
27
27
  "dependencies": {
28
28
  "@babel/runtime": "^7.16.0",
29
- "@wordpress/a11y": "^3.14.0",
30
- "@wordpress/api-fetch": "^6.11.0",
31
- "@wordpress/block-editor": "^9.6.0",
32
- "@wordpress/blocks": "^11.13.0",
33
- "@wordpress/components": "^19.16.0",
34
- "@wordpress/compose": "^5.12.0",
35
- "@wordpress/core-data": "^4.12.0",
36
- "@wordpress/data": "^6.14.0",
37
- "@wordpress/edit-post": "^6.11.0",
38
- "@wordpress/editor": "^12.13.0",
39
- "@wordpress/element": "^4.12.0",
40
- "@wordpress/hooks": "^3.14.0",
41
- "@wordpress/html-entities": "^3.14.0",
42
- "@wordpress/i18n": "^4.14.0",
43
- "@wordpress/icons": "^9.5.0",
44
- "@wordpress/notices": "^3.14.0",
45
- "@wordpress/plugins": "^4.12.0",
46
- "@wordpress/url": "^3.15.0",
29
+ "@wordpress/a11y": "^3.16.0",
30
+ "@wordpress/api-fetch": "^6.13.0",
31
+ "@wordpress/block-editor": "^9.8.0",
32
+ "@wordpress/blocks": "^11.15.0",
33
+ "@wordpress/components": "^20.0.0",
34
+ "@wordpress/compose": "^5.14.0",
35
+ "@wordpress/core-data": "^4.14.0",
36
+ "@wordpress/data": "^7.0.0",
37
+ "@wordpress/edit-post": "^6.13.0",
38
+ "@wordpress/editor": "^12.15.0",
39
+ "@wordpress/element": "^4.14.0",
40
+ "@wordpress/hooks": "^3.16.0",
41
+ "@wordpress/html-entities": "^3.16.0",
42
+ "@wordpress/i18n": "^4.16.0",
43
+ "@wordpress/icons": "^9.7.0",
44
+ "@wordpress/notices": "^3.16.0",
45
+ "@wordpress/plugins": "^4.14.0",
46
+ "@wordpress/url": "^3.17.0",
47
+ "change-case": "^4.1.2",
47
48
  "lodash": "^4.17.21"
48
49
  },
49
50
  "peerDependencies": {
@@ -53,5 +54,5 @@
53
54
  "publishConfig": {
54
55
  "access": "public"
55
56
  },
56
- "gitHead": "0315dbc240cb2aa146d7c1bafd251f004b88300e"
57
+ "gitHead": "171b87c7465b93e685e081c5f57f153507363c95"
57
58
  }
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { times } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -24,7 +19,7 @@ function Stars( { rating } ) {
24
19
  stars
25
20
  ) }
26
21
  >
27
- { times( fullStarCount, ( i ) => (
22
+ { Array.from( { length: fullStarCount } ).map( ( _, i ) => (
28
23
  <Icon
29
24
  key={ `full_stars_${ i }` }
30
25
  className="block-directory-block-ratings__star-full"
@@ -32,7 +27,7 @@ function Stars( { rating } ) {
32
27
  size={ 16 }
33
28
  />
34
29
  ) ) }
35
- { times( halfStarCount, ( i ) => (
30
+ { Array.from( { length: halfStarCount } ).map( ( _, i ) => (
36
31
  <Icon
37
32
  key={ `half_stars_${ i }` }
38
33
  className="block-directory-block-ratings__star-half-full"
@@ -40,7 +35,7 @@ function Stars( { rating } ) {
40
35
  size={ 16 }
41
36
  />
42
37
  ) ) }
43
- { times( emptyStarCount, ( i ) => (
38
+ { Array.from( { length: emptyStarCount } ).map( ( _, i ) => (
44
39
  <Icon
45
40
  key={ `empty_stars_${ i }` }
46
41
  className="block-directory-block-ratings__star-empty"
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render, fireEvent } from '@testing-library/react';
4
+ import { render, screen } from '@testing-library/react';
5
+ import userEvent from '@testing-library/user-event';
5
6
 
6
7
  /**
7
8
  * WordPress dependencies
@@ -27,11 +28,11 @@ describe( 'DownloadableBlockListItem', () => {
27
28
  isInstallable: true,
28
29
  } ) );
29
30
 
30
- const { queryByText } = render(
31
+ render(
31
32
  <DownloadableBlockListItem onClick={ jest.fn() } item={ plugin } />
32
33
  );
33
- const author = queryByText( `by ${ plugin.author }` );
34
- const description = queryByText( plugin.description );
34
+ const author = screen.queryByText( `by ${ plugin.author }` );
35
+ const description = screen.queryByText( plugin.description );
35
36
  expect( author ).not.toBeNull();
36
37
  expect( description ).not.toBeNull();
37
38
  } );
@@ -42,10 +43,10 @@ describe( 'DownloadableBlockListItem', () => {
42
43
  isInstallable: true,
43
44
  } ) );
44
45
 
45
- const { queryByText } = render(
46
+ render(
46
47
  <DownloadableBlockListItem onClick={ jest.fn() } item={ plugin } />
47
48
  );
48
- const statusLabel = queryByText( 'Installing…' );
49
+ const statusLabel = screen.queryByText( 'Installing…' );
49
50
  expect( statusLabel ).not.toBeNull();
50
51
  } );
51
52
 
@@ -55,27 +56,30 @@ describe( 'DownloadableBlockListItem', () => {
55
56
  isInstallable: false,
56
57
  } ) );
57
58
 
58
- const { getByRole } = render(
59
+ render(
59
60
  <DownloadableBlockListItem onClick={ jest.fn() } item={ plugin } />
60
61
  );
61
- const button = getByRole( 'option' );
62
+ const button = screen.getByRole( 'option' );
62
63
  // Keeping it false to avoid focus loss and disable it using aria-disabled.
63
64
  expect( button.disabled ).toBe( false );
64
65
  expect( button.getAttribute( 'aria-disabled' ) ).toBe( 'true' );
65
66
  } );
66
67
 
67
- it( 'should try to install the block plugin', () => {
68
+ it( 'should try to install the block plugin', async () => {
69
+ const user = userEvent.setup( {
70
+ advanceTimers: jest.advanceTimersByTime,
71
+ } );
72
+
68
73
  useSelect.mockImplementation( () => ( {
69
74
  isInstalling: false,
70
75
  isInstallable: true,
71
76
  } ) );
72
77
  const onClick = jest.fn();
73
- const { getByRole } = render(
78
+ render(
74
79
  <DownloadableBlockListItem onClick={ onClick } item={ plugin } />
75
80
  );
76
81
 
77
- const button = getByRole( 'option' );
78
- fireEvent.click( button );
82
+ await user.click( screen.getByRole( 'option' ) );
79
83
 
80
84
  expect( onClick ).toHaveBeenCalledTimes( 1 );
81
85
  } );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { render } from '@testing-library/react';
4
+ import { render, screen } from '@testing-library/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -44,14 +44,14 @@ describe( 'DownloadableBlocksList', () => {
44
44
  } );
45
45
 
46
46
  it( 'should render plugins items into the list', () => {
47
- const { getAllByRole } = render(
47
+ render(
48
48
  <DownloadableBlocksList
49
49
  items={ items }
50
50
  onSelect={ jest.fn() }
51
51
  onHover={ jest.fn() }
52
52
  />
53
53
  );
54
- const downloadableBlocks = getAllByRole( 'option' );
54
+ const downloadableBlocks = screen.getAllByRole( 'option' );
55
55
 
56
56
  expect( downloadableBlocks ).toHaveLength( items.length );
57
57
  } );
@@ -17,14 +17,11 @@ function DownloadableBlocksNoResults() {
17
17
  </div>
18
18
  <div className="block-editor-inserter__tips">
19
19
  <Tip>
20
- <div>
21
- <p>
22
- { __( 'Interested in creating your own block?' ) }
23
- </p>
24
- <ExternalLink href="https://developer.wordpress.org/block-editor/">
25
- { __( 'Get started here' ) }.
26
- </ExternalLink>
27
- </div>
20
+ { __( 'Interested in creating your own block?' ) }
21
+ <br />
22
+ <ExternalLink href="https://developer.wordpress.org/block-editor/">
23
+ { __( 'Get started here' ) }.
24
+ </ExternalLink>
28
25
  </Tip>
29
26
  </div>
30
27
  </>
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { camelCase, mapKeys } from 'lodash';
4
+ import { camelCase } from 'change-case';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -26,7 +26,12 @@ export const getDownloadableBlocks =
26
26
  path: `wp/v2/block-directory/search?term=${ filterValue }`,
27
27
  } );
28
28
  const blocks = results.map( ( result ) =>
29
- mapKeys( result, ( value, key ) => camelCase( key ) )
29
+ Object.fromEntries(
30
+ Object.entries( result ).map( ( [ key, value ] ) => [
31
+ camelCase( key ),
32
+ value,
33
+ ] )
34
+ )
30
35
  );
31
36
 
32
37
  dispatch( receiveDownloadableBlocks( blocks, filterValue ) );