@wordpress/annotations 3.31.1-next.f56bd8138.0 → 3.32.1-next.47f435fc9.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/index.js +17 -30
  3. package/build/block/index.js.map +7 -1
  4. package/build/format/annotation.js +85 -116
  5. package/build/format/annotation.js.map +7 -1
  6. package/build/format/index.js +5 -18
  7. package/build/format/index.js.map +7 -1
  8. package/build/index.js +28 -13
  9. package/build/index.js.map +7 -1
  10. package/build/store/actions.js +41 -75
  11. package/build/store/actions.js.map +7 -1
  12. package/build/store/constants.js +27 -12
  13. package/build/store/constants.js.map +7 -1
  14. package/build/store/index.js +44 -36
  15. package/build/store/index.js.map +7 -1
  16. package/build/store/reducer.js +75 -76
  17. package/build/store/reducer.js.map +7 -1
  18. package/build/store/selectors.js +56 -80
  19. package/build/store/selectors.js.map +7 -1
  20. package/build-module/block/index.js +17 -27
  21. package/build-module/block/index.js.map +7 -1
  22. package/build-module/format/annotation.js +61 -108
  23. package/build-module/format/annotation.js.map +7 -1
  24. package/build-module/format/index.js +4 -14
  25. package/build-module/format/index.js.map +7 -1
  26. package/build-module/index.js +7 -7
  27. package/build-module/index.js.map +7 -1
  28. package/build-module/store/actions.js +19 -70
  29. package/build-module/store/actions.js.map +7 -1
  30. package/build-module/store/constants.js +5 -7
  31. package/build-module/store/constants.js.map +7 -1
  32. package/build-module/store/index.js +10 -26
  33. package/build-module/store/index.js.map +7 -1
  34. package/build-module/store/reducer.js +54 -71
  35. package/build-module/store/reducer.js.map +7 -1
  36. package/build-module/store/selectors.js +33 -75
  37. package/build-module/store/selectors.js.map +7 -1
  38. package/package.json +13 -7
@@ -1 +1,7 @@
1
- {"version":3,"names":["_uuid","require","__experimentalAddAnnotation","blockClientId","richTextIdentifier","range","selector","source","id","uuid","action","type","__experimentalRemoveAnnotation","annotationId","__experimentalUpdateAnnotationRange","start","end","__experimentalRemoveAnnotationsBySource"],"sources":["@wordpress/annotations/src/store/actions.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * @typedef WPAnnotationRange\n *\n * @property {number} start The offset where the annotation should start.\n * @property {number} end The offset where the annotation should end.\n */\n\n/**\n * Adds an annotation to a block.\n *\n * The `block` attribute refers to a block ID that needs to be annotated.\n * `isBlockAnnotation` controls whether or not the annotation is a block\n * annotation. The `source` is the source of the annotation, this will be used\n * to identity groups of annotations.\n *\n * The `range` property is only relevant if the selector is 'range'.\n *\n * @param {Object} annotation The annotation to add.\n * @param {string} annotation.blockClientId The blockClientId to add the annotation to.\n * @param {string} annotation.richTextIdentifier Identifier for the RichText instance the annotation applies to.\n * @param {WPAnnotationRange} annotation.range The range at which to apply this annotation.\n * @param {string} [annotation.selector=\"range\"] The way to apply this annotation.\n * @param {string} [annotation.source=\"default\"] The source that added the annotation.\n * @param {string} [annotation.id] The ID the annotation should have. Generates a UUID by default.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalAddAnnotation( {\n\tblockClientId,\n\trichTextIdentifier = null,\n\trange = null,\n\tselector = 'range',\n\tsource = 'default',\n\tid = uuid(),\n} ) {\n\tconst action = {\n\t\ttype: 'ANNOTATION_ADD',\n\t\tid,\n\t\tblockClientId,\n\t\trichTextIdentifier,\n\t\tsource,\n\t\tselector,\n\t};\n\n\tif ( selector === 'range' ) {\n\t\taction.range = range;\n\t}\n\n\treturn action;\n}\n\n/**\n * Removes an annotation with a specific ID.\n *\n * @param {string} annotationId The annotation to remove.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalRemoveAnnotation( annotationId ) {\n\treturn {\n\t\ttype: 'ANNOTATION_REMOVE',\n\t\tannotationId,\n\t};\n}\n\n/**\n * Updates the range of an annotation.\n *\n * @param {string} annotationId ID of the annotation to update.\n * @param {number} start The start of the new range.\n * @param {number} end The end of the new range.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalUpdateAnnotationRange(\n\tannotationId,\n\tstart,\n\tend\n) {\n\treturn {\n\t\ttype: 'ANNOTATION_UPDATE_RANGE',\n\t\tannotationId,\n\t\tstart,\n\t\tend,\n\t};\n}\n\n/**\n * Removes all annotations of a specific source.\n *\n * @param {string} source The source to remove.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalRemoveAnnotationsBySource( source ) {\n\treturn {\n\t\ttype: 'ANNOTATION_REMOVE_SOURCE',\n\t\tsource,\n\t};\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,2BAA2BA,CAAE;EAC5CC,aAAa;EACbC,kBAAkB,GAAG,IAAI;EACzBC,KAAK,GAAG,IAAI;EACZC,QAAQ,GAAG,OAAO;EAClBC,MAAM,GAAG,SAAS;EAClBC,EAAE,GAAG,IAAAC,QAAI,EAAC;AACX,CAAC,EAAG;EACH,MAAMC,MAAM,GAAG;IACdC,IAAI,EAAE,gBAAgB;IACtBH,EAAE;IACFL,aAAa;IACbC,kBAAkB;IAClBG,MAAM;IACND;EACD,CAAC;EAED,IAAKA,QAAQ,KAAK,OAAO,EAAG;IAC3BI,MAAM,CAACL,KAAK,GAAGA,KAAK;EACrB;EAEA,OAAOK,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,8BAA8BA,CAAEC,YAAY,EAAG;EAC9D,OAAO;IACNF,IAAI,EAAE,mBAAmB;IACzBE;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mCAAmCA,CAClDD,YAAY,EACZE,KAAK,EACLC,GAAG,EACF;EACD,OAAO;IACNL,IAAI,EAAE,yBAAyB;IAC/BE,YAAY;IACZE,KAAK;IACLC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uCAAuCA,CAAEV,MAAM,EAAG;EACjE,OAAO;IACNI,IAAI,EAAE,0BAA0B;IAChCJ;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/actions.js"],
4
+ "sourcesContent": ["/**\n * External dependencies\n */\nimport { v4 as uuid } from 'uuid';\n\n/**\n * @typedef WPAnnotationRange\n *\n * @property {number} start The offset where the annotation should start.\n * @property {number} end The offset where the annotation should end.\n */\n\n/**\n * Adds an annotation to a block.\n *\n * The `block` attribute refers to a block ID that needs to be annotated.\n * `isBlockAnnotation` controls whether or not the annotation is a block\n * annotation. The `source` is the source of the annotation, this will be used\n * to identity groups of annotations.\n *\n * The `range` property is only relevant if the selector is 'range'.\n *\n * @param {Object} annotation The annotation to add.\n * @param {string} annotation.blockClientId The blockClientId to add the annotation to.\n * @param {string} annotation.richTextIdentifier Identifier for the RichText instance the annotation applies to.\n * @param {WPAnnotationRange} annotation.range The range at which to apply this annotation.\n * @param {string} [annotation.selector=\"range\"] The way to apply this annotation.\n * @param {string} [annotation.source=\"default\"] The source that added the annotation.\n * @param {string} [annotation.id] The ID the annotation should have. Generates a UUID by default.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalAddAnnotation( {\n\tblockClientId,\n\trichTextIdentifier = null,\n\trange = null,\n\tselector = 'range',\n\tsource = 'default',\n\tid = uuid(),\n} ) {\n\tconst action = {\n\t\ttype: 'ANNOTATION_ADD',\n\t\tid,\n\t\tblockClientId,\n\t\trichTextIdentifier,\n\t\tsource,\n\t\tselector,\n\t};\n\n\tif ( selector === 'range' ) {\n\t\taction.range = range;\n\t}\n\n\treturn action;\n}\n\n/**\n * Removes an annotation with a specific ID.\n *\n * @param {string} annotationId The annotation to remove.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalRemoveAnnotation( annotationId ) {\n\treturn {\n\t\ttype: 'ANNOTATION_REMOVE',\n\t\tannotationId,\n\t};\n}\n\n/**\n * Updates the range of an annotation.\n *\n * @param {string} annotationId ID of the annotation to update.\n * @param {number} start The start of the new range.\n * @param {number} end The end of the new range.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalUpdateAnnotationRange(\n\tannotationId,\n\tstart,\n\tend\n) {\n\treturn {\n\t\ttype: 'ANNOTATION_UPDATE_RANGE',\n\t\tannotationId,\n\t\tstart,\n\t\tend,\n\t};\n}\n\n/**\n * Removes all annotations of a specific source.\n *\n * @param {string} source The source to remove.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalRemoveAnnotationsBySource( source ) {\n\treturn {\n\t\ttype: 'ANNOTATION_REMOVE_SOURCE',\n\t\tsource,\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2B;AA6BpB,SAAS,4BAA6B;AAAA,EAC5C;AAAA,EACA,qBAAqB;AAAA,EACrB,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAK,YAAAA,IAAK;AACX,GAAI;AACH,QAAM,SAAS;AAAA,IACd,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,MAAK,aAAa,SAAU;AAC3B,WAAO,QAAQ;AAAA,EAChB;AAEA,SAAO;AACR;AASO,SAAS,+BAAgC,cAAe;AAC9D,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;AAWO,SAAS,oCACf,cACA,OACA,KACC;AACD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AASO,SAAS,wCAAyC,QAAS;AACjE,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
6
+ "names": ["uuid"]
7
+ }
@@ -1,13 +1,28 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ STORE_NAME: () => STORE_NAME
5
21
  });
6
- exports.STORE_NAME = void 0;
7
- /**
8
- * The identifier for the data store.
9
- *
10
- * @type {string}
11
- */
12
- const STORE_NAME = exports.STORE_NAME = 'core/annotations';
13
- //# sourceMappingURL=constants.js.map
22
+ module.exports = __toCommonJS(constants_exports);
23
+ const STORE_NAME = "core/annotations";
24
+ // Annotate the CommonJS export names for ESM import in node:
25
+ 0 && (module.exports = {
26
+ STORE_NAME
27
+ });
28
+ //# sourceMappingURL=constants.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["STORE_NAME","exports"],"sources":["@wordpress/annotations/src/store/constants.js"],"sourcesContent":["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/annotations';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,kBAAkB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/constants.js"],
4
+ "sourcesContent": ["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/annotations';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,aAAa;",
6
+ "names": []
7
+ }
@@ -1,40 +1,48 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var store_exports = {};
29
+ __export(store_exports, {
30
+ store: () => store
6
31
  });
7
- exports.store = void 0;
8
- var _data = require("@wordpress/data");
9
- var _reducer = _interopRequireDefault(require("./reducer"));
10
- var selectors = _interopRequireWildcard(require("./selectors"));
11
- var actions = _interopRequireWildcard(require("./actions"));
12
- var _constants = require("./constants");
13
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
- /**
16
- * WordPress dependencies
17
- */
18
-
19
- /**
20
- * Internal dependencies
21
- */
22
-
23
- /**
24
- * Module Constants
25
- */
26
-
27
- /**
28
- * Store definition for the annotations namespace.
29
- *
30
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
31
- *
32
- * @type {Object}
33
- */
34
- const store = exports.store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
35
- reducer: _reducer.default,
32
+ module.exports = __toCommonJS(store_exports);
33
+ var import_data = require("@wordpress/data");
34
+ var import_reducer = __toESM(require("./reducer"));
35
+ var selectors = __toESM(require("./selectors"));
36
+ var actions = __toESM(require("./actions"));
37
+ var import_constants = require("./constants");
38
+ const store = (0, import_data.createReduxStore)(import_constants.STORE_NAME, {
39
+ reducer: import_reducer.default,
36
40
  selectors,
37
41
  actions
38
42
  });
39
- (0, _data.register)(store);
40
- //# sourceMappingURL=index.js.map
43
+ (0, import_data.register)(store);
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ store
47
+ });
48
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","_reducer","_interopRequireDefault","selectors","_interopRequireWildcard","actions","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","store","exports","createReduxStore","STORE_NAME","reducer","register"],"sources":["@wordpress/annotations/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { register, createReduxStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\n\n/**\n * Module Constants\n */\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the annotations namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tselectors,\n\tactions,\n} );\n\nregister( store );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAD,uBAAA,CAAAJ,OAAA;AAKA,IAAAM,UAAA,GAAAN,OAAA;AAAyC,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAfzC;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG,IAAAE,sBAAgB,EAAEC,qBAAU,EAAE;EAClDC,OAAO,EAAPA,gBAAO;EACP5B,SAAS;EACTE;AACD,CAAE,CAAC;AAEH,IAAA2B,cAAQ,EAAEL,KAAM,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { register, createReduxStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\n\n/**\n * Module Constants\n */\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the annotations namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tselectors,\n\tactions,\n} );\n\nregister( store );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,gBAA2B;AAC3B,cAAyB;AAKzB,uBAA2B;AASpB,MAAM,YAAQ,8BAAkB,6BAAY;AAAA,EAClD,wBAAAA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAAA,IAEF,sBAAU,KAAM;",
6
+ "names": ["reducer"]
7
+ }
@@ -1,59 +1,43 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var reducer_exports = {};
19
+ __export(reducer_exports, {
20
+ annotations: () => annotations,
21
+ default: () => reducer_default
5
22
  });
6
- exports.annotations = annotations;
7
- exports.default = void 0;
8
- /**
9
- * Filters an array based on the predicate, but keeps the reference the same if
10
- * the array hasn't changed.
11
- *
12
- * @param {Array} collection The collection to filter.
13
- * @param {Function} predicate Function that determines if the item should stay
14
- * in the array.
15
- * @return {Array} Filtered array.
16
- */
23
+ module.exports = __toCommonJS(reducer_exports);
17
24
  function filterWithReference(collection, predicate) {
18
25
  const filteredCollection = collection.filter(predicate);
19
26
  return collection.length === filteredCollection.length ? collection : filteredCollection;
20
27
  }
21
-
22
- /**
23
- * Creates a new object with the same keys, but with `callback()` called as
24
- * a transformer function on each of the values.
25
- *
26
- * @param {Object} obj The object to transform.
27
- * @param {Function} callback The function to transform each object value.
28
- * @return {Array} Transformed object.
29
- */
30
- const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({
31
- ...acc,
32
- [key]: callback(value)
33
- }), {});
34
-
35
- /**
36
- * Verifies whether the given annotations is a valid annotation.
37
- *
38
- * @param {Object} annotation The annotation to verify.
39
- * @return {boolean} Whether the given annotation is valid.
40
- */
28
+ const mapValues = (obj, callback) => Object.entries(obj).reduce(
29
+ (acc, [key, value]) => ({
30
+ ...acc,
31
+ [key]: callback(value)
32
+ }),
33
+ {}
34
+ );
41
35
  function isValidAnnotationRange(annotation) {
42
- return typeof annotation.start === 'number' && typeof annotation.end === 'number' && annotation.start <= annotation.end;
36
+ return typeof annotation.start === "number" && typeof annotation.end === "number" && annotation.start <= annotation.end;
43
37
  }
44
-
45
- /**
46
- * Reducer managing annotations.
47
- *
48
- * @param {Object} state The annotations currently shown in the editor.
49
- * @param {Object} action Dispatched action.
50
- *
51
- * @return {Array} Updated state.
52
- */
53
38
  function annotations(state = {}, action) {
54
- var _state$blockClientId;
55
39
  switch (action.type) {
56
- case 'ANNOTATION_ADD':
40
+ case "ANNOTATION_ADD":
57
41
  const blockClientId = action.blockClientId;
58
42
  const newAnnotation = {
59
43
  id: action.id,
@@ -63,46 +47,61 @@ function annotations(state = {}, action) {
63
47
  selector: action.selector,
64
48
  range: action.range
65
49
  };
66
- if (newAnnotation.selector === 'range' && !isValidAnnotationRange(newAnnotation.range)) {
50
+ if (newAnnotation.selector === "range" && !isValidAnnotationRange(newAnnotation.range)) {
67
51
  return state;
68
52
  }
69
- const previousAnnotationsForBlock = (_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : [];
53
+ const previousAnnotationsForBlock = state?.[blockClientId] ?? [];
70
54
  return {
71
55
  ...state,
72
- [blockClientId]: [...previousAnnotationsForBlock, newAnnotation]
56
+ [blockClientId]: [
57
+ ...previousAnnotationsForBlock,
58
+ newAnnotation
59
+ ]
73
60
  };
74
- case 'ANNOTATION_REMOVE':
75
- return mapValues(state, annotationsForBlock => {
76
- return filterWithReference(annotationsForBlock, annotation => {
77
- return annotation.id !== action.annotationId;
78
- });
61
+ case "ANNOTATION_REMOVE":
62
+ return mapValues(state, (annotationsForBlock) => {
63
+ return filterWithReference(
64
+ annotationsForBlock,
65
+ (annotation) => {
66
+ return annotation.id !== action.annotationId;
67
+ }
68
+ );
79
69
  });
80
- case 'ANNOTATION_UPDATE_RANGE':
81
- return mapValues(state, annotationsForBlock => {
70
+ case "ANNOTATION_UPDATE_RANGE":
71
+ return mapValues(state, (annotationsForBlock) => {
82
72
  let hasChangedRange = false;
83
- const newAnnotations = annotationsForBlock.map(annotation => {
84
- if (annotation.id === action.annotationId) {
85
- hasChangedRange = true;
86
- return {
87
- ...annotation,
88
- range: {
89
- start: action.start,
90
- end: action.end
91
- }
92
- };
73
+ const newAnnotations = annotationsForBlock.map(
74
+ (annotation) => {
75
+ if (annotation.id === action.annotationId) {
76
+ hasChangedRange = true;
77
+ return {
78
+ ...annotation,
79
+ range: {
80
+ start: action.start,
81
+ end: action.end
82
+ }
83
+ };
84
+ }
85
+ return annotation;
93
86
  }
94
- return annotation;
95
- });
87
+ );
96
88
  return hasChangedRange ? newAnnotations : annotationsForBlock;
97
89
  });
98
- case 'ANNOTATION_REMOVE_SOURCE':
99
- return mapValues(state, annotationsForBlock => {
100
- return filterWithReference(annotationsForBlock, annotation => {
101
- return annotation.source !== action.source;
102
- });
90
+ case "ANNOTATION_REMOVE_SOURCE":
91
+ return mapValues(state, (annotationsForBlock) => {
92
+ return filterWithReference(
93
+ annotationsForBlock,
94
+ (annotation) => {
95
+ return annotation.source !== action.source;
96
+ }
97
+ );
103
98
  });
104
99
  }
105
100
  return state;
106
101
  }
107
- var _default = exports.default = annotations;
108
- //# sourceMappingURL=reducer.js.map
102
+ var reducer_default = annotations;
103
+ // Annotate the CommonJS export names for ESM import in node:
104
+ 0 && (module.exports = {
105
+ annotations
106
+ });
107
+ //# sourceMappingURL=reducer.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["filterWithReference","collection","predicate","filteredCollection","filter","length","mapValues","obj","callback","Object","entries","reduce","acc","key","value","isValidAnnotationRange","annotation","start","end","annotations","state","action","_state$blockClientId","type","blockClientId","newAnnotation","id","richTextIdentifier","source","selector","range","previousAnnotationsForBlock","annotationsForBlock","annotationId","hasChangedRange","newAnnotations","map","_default","exports","default"],"sources":["@wordpress/annotations/src/store/reducer.js"],"sourcesContent":["/**\n * Filters an array based on the predicate, but keeps the reference the same if\n * the array hasn't changed.\n *\n * @param {Array} collection The collection to filter.\n * @param {Function} predicate Function that determines if the item should stay\n * in the array.\n * @return {Array} Filtered array.\n */\nfunction filterWithReference( collection, predicate ) {\n\tconst filteredCollection = collection.filter( predicate );\n\n\treturn collection.length === filteredCollection.length\n\t\t? collection\n\t\t: filteredCollection;\n}\n\n/**\n * Creates a new object with the same keys, but with `callback()` called as\n * a transformer function on each of the values.\n *\n * @param {Object} obj The object to transform.\n * @param {Function} callback The function to transform each object value.\n * @return {Array} Transformed object.\n */\nconst mapValues = ( obj, callback ) =>\n\tObject.entries( obj ).reduce(\n\t\t( acc, [ key, value ] ) => ( {\n\t\t\t...acc,\n\t\t\t[ key ]: callback( value ),\n\t\t} ),\n\t\t{}\n\t);\n\n/**\n * Verifies whether the given annotations is a valid annotation.\n *\n * @param {Object} annotation The annotation to verify.\n * @return {boolean} Whether the given annotation is valid.\n */\nfunction isValidAnnotationRange( annotation ) {\n\treturn (\n\t\ttypeof annotation.start === 'number' &&\n\t\ttypeof annotation.end === 'number' &&\n\t\tannotation.start <= annotation.end\n\t);\n}\n\n/**\n * Reducer managing annotations.\n *\n * @param {Object} state The annotations currently shown in the editor.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function annotations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ANNOTATION_ADD':\n\t\t\tconst blockClientId = action.blockClientId;\n\t\t\tconst newAnnotation = {\n\t\t\t\tid: action.id,\n\t\t\t\tblockClientId,\n\t\t\t\trichTextIdentifier: action.richTextIdentifier,\n\t\t\t\tsource: action.source,\n\t\t\t\tselector: action.selector,\n\t\t\t\trange: action.range,\n\t\t\t};\n\n\t\t\tif (\n\t\t\t\tnewAnnotation.selector === 'range' &&\n\t\t\t\t! isValidAnnotationRange( newAnnotation.range )\n\t\t\t) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\tconst previousAnnotationsForBlock = state?.[ blockClientId ] ?? [];\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ blockClientId ]: [\n\t\t\t\t\t...previousAnnotationsForBlock,\n\t\t\t\t\tnewAnnotation,\n\t\t\t\t],\n\t\t\t};\n\n\t\tcase 'ANNOTATION_REMOVE':\n\t\t\treturn mapValues( state, ( annotationsForBlock ) => {\n\t\t\t\treturn filterWithReference(\n\t\t\t\t\tannotationsForBlock,\n\t\t\t\t\t( annotation ) => {\n\t\t\t\t\t\treturn annotation.id !== action.annotationId;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\n\t\tcase 'ANNOTATION_UPDATE_RANGE':\n\t\t\treturn mapValues( state, ( annotationsForBlock ) => {\n\t\t\t\tlet hasChangedRange = false;\n\n\t\t\t\tconst newAnnotations = annotationsForBlock.map(\n\t\t\t\t\t( annotation ) => {\n\t\t\t\t\t\tif ( annotation.id === action.annotationId ) {\n\t\t\t\t\t\t\thasChangedRange = true;\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...annotation,\n\t\t\t\t\t\t\t\trange: {\n\t\t\t\t\t\t\t\t\tstart: action.start,\n\t\t\t\t\t\t\t\t\tend: action.end,\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\n\t\t\t\t\t\treturn annotation;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\treturn hasChangedRange ? newAnnotations : annotationsForBlock;\n\t\t\t} );\n\n\t\tcase 'ANNOTATION_REMOVE_SOURCE':\n\t\t\treturn mapValues( state, ( annotationsForBlock ) => {\n\t\t\t\treturn filterWithReference(\n\t\t\t\t\tannotationsForBlock,\n\t\t\t\t\t( annotation ) => {\n\t\t\t\t\t\treturn annotation.source !== action.source;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\treturn state;\n}\n\nexport default annotations;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAmBA,CAAEC,UAAU,EAAEC,SAAS,EAAG;EACrD,MAAMC,kBAAkB,GAAGF,UAAU,CAACG,MAAM,CAAEF,SAAU,CAAC;EAEzD,OAAOD,UAAU,CAACI,MAAM,KAAKF,kBAAkB,CAACE,MAAM,GACnDJ,UAAU,GACVE,kBAAkB;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,SAAS,GAAGA,CAAEC,GAAG,EAAEC,QAAQ,KAChCC,MAAM,CAACC,OAAO,CAAEH,GAAI,CAAC,CAACI,MAAM,CAC3B,CAAEC,GAAG,EAAE,CAAEC,GAAG,EAAEC,KAAK,CAAE,MAAQ;EAC5B,GAAGF,GAAG;EACN,CAAEC,GAAG,GAAIL,QAAQ,CAAEM,KAAM;AAC1B,CAAC,CAAE,EACH,CAAC,CACF,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,sBAAsBA,CAAEC,UAAU,EAAG;EAC7C,OACC,OAAOA,UAAU,CAACC,KAAK,KAAK,QAAQ,IACpC,OAAOD,UAAU,CAACE,GAAG,KAAK,QAAQ,IAClCF,UAAU,CAACC,KAAK,IAAID,UAAU,CAACE,GAAG;AAEpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,WAAWA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAAA,IAAAC,oBAAA;EACjD,QAASD,MAAM,CAACE,IAAI;IACnB,KAAK,gBAAgB;MACpB,MAAMC,aAAa,GAAGH,MAAM,CAACG,aAAa;MAC1C,MAAMC,aAAa,GAAG;QACrBC,EAAE,EAAEL,MAAM,CAACK,EAAE;QACbF,aAAa;QACbG,kBAAkB,EAAEN,MAAM,CAACM,kBAAkB;QAC7CC,MAAM,EAAEP,MAAM,CAACO,MAAM;QACrBC,QAAQ,EAAER,MAAM,CAACQ,QAAQ;QACzBC,KAAK,EAAET,MAAM,CAACS;MACf,CAAC;MAED,IACCL,aAAa,CAACI,QAAQ,KAAK,OAAO,IAClC,CAAEd,sBAAsB,CAAEU,aAAa,CAACK,KAAM,CAAC,EAC9C;QACD,OAAOV,KAAK;MACb;MAEA,MAAMW,2BAA2B,IAAAT,oBAAA,GAAGF,KAAK,GAAII,aAAa,CAAE,cAAAF,oBAAA,cAAAA,oBAAA,GAAI,EAAE;MAElE,OAAO;QACN,GAAGF,KAAK;QACR,CAAEI,aAAa,GAAI,CAClB,GAAGO,2BAA2B,EAC9BN,aAAa;MAEf,CAAC;IAEF,KAAK,mBAAmB;MACvB,OAAOnB,SAAS,CAAEc,KAAK,EAAIY,mBAAmB,IAAM;QACnD,OAAOhC,mBAAmB,CACzBgC,mBAAmB,EACjBhB,UAAU,IAAM;UACjB,OAAOA,UAAU,CAACU,EAAE,KAAKL,MAAM,CAACY,YAAY;QAC7C,CACD,CAAC;MACF,CAAE,CAAC;IAEJ,KAAK,yBAAyB;MAC7B,OAAO3B,SAAS,CAAEc,KAAK,EAAIY,mBAAmB,IAAM;QACnD,IAAIE,eAAe,GAAG,KAAK;QAE3B,MAAMC,cAAc,GAAGH,mBAAmB,CAACI,GAAG,CAC3CpB,UAAU,IAAM;UACjB,IAAKA,UAAU,CAACU,EAAE,KAAKL,MAAM,CAACY,YAAY,EAAG;YAC5CC,eAAe,GAAG,IAAI;YACtB,OAAO;cACN,GAAGlB,UAAU;cACbc,KAAK,EAAE;gBACNb,KAAK,EAAEI,MAAM,CAACJ,KAAK;gBACnBC,GAAG,EAAEG,MAAM,CAACH;cACb;YACD,CAAC;UACF;UAEA,OAAOF,UAAU;QAClB,CACD,CAAC;QAED,OAAOkB,eAAe,GAAGC,cAAc,GAAGH,mBAAmB;MAC9D,CAAE,CAAC;IAEJ,KAAK,0BAA0B;MAC9B,OAAO1B,SAAS,CAAEc,KAAK,EAAIY,mBAAmB,IAAM;QACnD,OAAOhC,mBAAmB,CACzBgC,mBAAmB,EACjBhB,UAAU,IAAM;UACjB,OAAOA,UAAU,CAACY,MAAM,KAAKP,MAAM,CAACO,MAAM;QAC3C,CACD,CAAC;MACF,CAAE,CAAC;EACL;EAEA,OAAOR,KAAK;AACb;AAAC,IAAAiB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcpB,WAAW","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/reducer.js"],
4
+ "sourcesContent": ["/**\n * Filters an array based on the predicate, but keeps the reference the same if\n * the array hasn't changed.\n *\n * @param {Array} collection The collection to filter.\n * @param {Function} predicate Function that determines if the item should stay\n * in the array.\n * @return {Array} Filtered array.\n */\nfunction filterWithReference( collection, predicate ) {\n\tconst filteredCollection = collection.filter( predicate );\n\n\treturn collection.length === filteredCollection.length\n\t\t? collection\n\t\t: filteredCollection;\n}\n\n/**\n * Creates a new object with the same keys, but with `callback()` called as\n * a transformer function on each of the values.\n *\n * @param {Object} obj The object to transform.\n * @param {Function} callback The function to transform each object value.\n * @return {Array} Transformed object.\n */\nconst mapValues = ( obj, callback ) =>\n\tObject.entries( obj ).reduce(\n\t\t( acc, [ key, value ] ) => ( {\n\t\t\t...acc,\n\t\t\t[ key ]: callback( value ),\n\t\t} ),\n\t\t{}\n\t);\n\n/**\n * Verifies whether the given annotations is a valid annotation.\n *\n * @param {Object} annotation The annotation to verify.\n * @return {boolean} Whether the given annotation is valid.\n */\nfunction isValidAnnotationRange( annotation ) {\n\treturn (\n\t\ttypeof annotation.start === 'number' &&\n\t\ttypeof annotation.end === 'number' &&\n\t\tannotation.start <= annotation.end\n\t);\n}\n\n/**\n * Reducer managing annotations.\n *\n * @param {Object} state The annotations currently shown in the editor.\n * @param {Object} action Dispatched action.\n *\n * @return {Array} Updated state.\n */\nexport function annotations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ANNOTATION_ADD':\n\t\t\tconst blockClientId = action.blockClientId;\n\t\t\tconst newAnnotation = {\n\t\t\t\tid: action.id,\n\t\t\t\tblockClientId,\n\t\t\t\trichTextIdentifier: action.richTextIdentifier,\n\t\t\t\tsource: action.source,\n\t\t\t\tselector: action.selector,\n\t\t\t\trange: action.range,\n\t\t\t};\n\n\t\t\tif (\n\t\t\t\tnewAnnotation.selector === 'range' &&\n\t\t\t\t! isValidAnnotationRange( newAnnotation.range )\n\t\t\t) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\tconst previousAnnotationsForBlock = state?.[ blockClientId ] ?? [];\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ blockClientId ]: [\n\t\t\t\t\t...previousAnnotationsForBlock,\n\t\t\t\t\tnewAnnotation,\n\t\t\t\t],\n\t\t\t};\n\n\t\tcase 'ANNOTATION_REMOVE':\n\t\t\treturn mapValues( state, ( annotationsForBlock ) => {\n\t\t\t\treturn filterWithReference(\n\t\t\t\t\tannotationsForBlock,\n\t\t\t\t\t( annotation ) => {\n\t\t\t\t\t\treturn annotation.id !== action.annotationId;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\n\t\tcase 'ANNOTATION_UPDATE_RANGE':\n\t\t\treturn mapValues( state, ( annotationsForBlock ) => {\n\t\t\t\tlet hasChangedRange = false;\n\n\t\t\t\tconst newAnnotations = annotationsForBlock.map(\n\t\t\t\t\t( annotation ) => {\n\t\t\t\t\t\tif ( annotation.id === action.annotationId ) {\n\t\t\t\t\t\t\thasChangedRange = true;\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t...annotation,\n\t\t\t\t\t\t\t\trange: {\n\t\t\t\t\t\t\t\t\tstart: action.start,\n\t\t\t\t\t\t\t\t\tend: action.end,\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\n\t\t\t\t\t\treturn annotation;\n\t\t\t\t\t}\n\t\t\t\t);\n\n\t\t\t\treturn hasChangedRange ? newAnnotations : annotationsForBlock;\n\t\t\t} );\n\n\t\tcase 'ANNOTATION_REMOVE_SOURCE':\n\t\t\treturn mapValues( state, ( annotationsForBlock ) => {\n\t\t\t\treturn filterWithReference(\n\t\t\t\t\tannotationsForBlock,\n\t\t\t\t\t( annotation ) => {\n\t\t\t\t\t\treturn annotation.source !== action.source;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t} );\n\t}\n\n\treturn state;\n}\n\nexport default annotations;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,SAAS,oBAAqB,YAAY,WAAY;AACrD,QAAM,qBAAqB,WAAW,OAAQ,SAAU;AAExD,SAAO,WAAW,WAAW,mBAAmB,SAC7C,aACA;AACJ;AAUA,MAAM,YAAY,CAAE,KAAK,aACxB,OAAO,QAAS,GAAI,EAAE;AAAA,EACrB,CAAE,KAAK,CAAE,KAAK,KAAM,OAAS;AAAA,IAC5B,GAAG;AAAA,IACH,CAAE,GAAI,GAAG,SAAU,KAAM;AAAA,EAC1B;AAAA,EACA,CAAC;AACF;AAQD,SAAS,uBAAwB,YAAa;AAC7C,SACC,OAAO,WAAW,UAAU,YAC5B,OAAO,WAAW,QAAQ,YAC1B,WAAW,SAAS,WAAW;AAEjC;AAUO,SAAS,YAAa,QAAQ,CAAC,GAAG,QAAS;AACjD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,YAAM,gBAAgB,OAAO;AAC7B,YAAM,gBAAgB;AAAA,QACrB,IAAI,OAAO;AAAA,QACX;AAAA,QACA,oBAAoB,OAAO;AAAA,QAC3B,QAAQ,OAAO;AAAA,QACf,UAAU,OAAO;AAAA,QACjB,OAAO,OAAO;AAAA,MACf;AAEA,UACC,cAAc,aAAa,WAC3B,CAAE,uBAAwB,cAAc,KAAM,GAC7C;AACD,eAAO;AAAA,MACR;AAEA,YAAM,8BAA8B,QAAS,aAAc,KAAK,CAAC;AAEjE,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,aAAc,GAAG;AAAA,UAClB,GAAG;AAAA,UACH;AAAA,QACD;AAAA,MACD;AAAA,IAED,KAAK;AACJ,aAAO,UAAW,OAAO,CAAE,wBAAyB;AACnD,eAAO;AAAA,UACN;AAAA,UACA,CAAE,eAAgB;AACjB,mBAAO,WAAW,OAAO,OAAO;AAAA,UACjC;AAAA,QACD;AAAA,MACD,CAAE;AAAA,IAEH,KAAK;AACJ,aAAO,UAAW,OAAO,CAAE,wBAAyB;AACnD,YAAI,kBAAkB;AAEtB,cAAM,iBAAiB,oBAAoB;AAAA,UAC1C,CAAE,eAAgB;AACjB,gBAAK,WAAW,OAAO,OAAO,cAAe;AAC5C,gCAAkB;AAClB,qBAAO;AAAA,gBACN,GAAG;AAAA,gBACH,OAAO;AAAA,kBACN,OAAO,OAAO;AAAA,kBACd,KAAK,OAAO;AAAA,gBACb;AAAA,cACD;AAAA,YACD;AAEA,mBAAO;AAAA,UACR;AAAA,QACD;AAEA,eAAO,kBAAkB,iBAAiB;AAAA,MAC3C,CAAE;AAAA,IAEH,KAAK;AACJ,aAAO,UAAW,OAAO,CAAE,wBAAyB;AACnD,eAAO;AAAA,UACN;AAAA,UACA,CAAE,eAAgB;AACjB,mBAAO,WAAW,WAAW,OAAO;AAAA,UACrC;AAAA,QACD;AAAA,MACD,CAAE;AAAA,EACJ;AAEA,SAAO;AACR;AAEA,IAAO,kBAAQ;",
6
+ "names": []
7
+ }
@@ -1,87 +1,63 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var selectors_exports = {};
19
+ __export(selectors_exports, {
20
+ __experimentalGetAllAnnotationsForBlock: () => __experimentalGetAllAnnotationsForBlock,
21
+ __experimentalGetAnnotations: () => __experimentalGetAnnotations,
22
+ __experimentalGetAnnotationsForBlock: () => __experimentalGetAnnotationsForBlock,
23
+ __experimentalGetAnnotationsForRichText: () => __experimentalGetAnnotationsForRichText
5
24
  });
6
- exports.__experimentalGetAllAnnotationsForBlock = __experimentalGetAllAnnotationsForBlock;
7
- exports.__experimentalGetAnnotations = __experimentalGetAnnotations;
8
- exports.__experimentalGetAnnotationsForRichText = exports.__experimentalGetAnnotationsForBlock = void 0;
9
- var _data = require("@wordpress/data");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Shared reference to an empty array for cases where it is important to avoid
16
- * returning a new array reference on every invocation, as in a connected or
17
- * other pure component which performs `shouldComponentUpdate` check on props.
18
- * This should be used as a last resort, since the normalized data should be
19
- * maintained by the reducer result in state.
20
- *
21
- * @type {Array}
22
- */
25
+ module.exports = __toCommonJS(selectors_exports);
26
+ var import_data = require("@wordpress/data");
23
27
  const EMPTY_ARRAY = [];
24
-
25
- /**
26
- * Returns the annotations for a specific client ID.
27
- *
28
- * @param {Object} state Editor state.
29
- * @param {string} clientId The ID of the block to get the annotations for.
30
- *
31
- * @return {Array} The annotations applicable to this block.
32
- */
33
- const __experimentalGetAnnotationsForBlock = exports.__experimentalGetAnnotationsForBlock = (0, _data.createSelector)((state, blockClientId) => {
34
- var _state$blockClientId;
35
- return ((_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : []).filter(annotation => {
36
- return annotation.selector === 'block';
37
- });
38
- }, (state, blockClientId) => {
39
- var _state$blockClientId2;
40
- return [(_state$blockClientId2 = state?.[blockClientId]) !== null && _state$blockClientId2 !== void 0 ? _state$blockClientId2 : EMPTY_ARRAY];
41
- });
28
+ const __experimentalGetAnnotationsForBlock = (0, import_data.createSelector)(
29
+ (state, blockClientId) => {
30
+ return (state?.[blockClientId] ?? []).filter((annotation) => {
31
+ return annotation.selector === "block";
32
+ });
33
+ },
34
+ (state, blockClientId) => [state?.[blockClientId] ?? EMPTY_ARRAY]
35
+ );
42
36
  function __experimentalGetAllAnnotationsForBlock(state, blockClientId) {
43
- var _state$blockClientId3;
44
- return (_state$blockClientId3 = state?.[blockClientId]) !== null && _state$blockClientId3 !== void 0 ? _state$blockClientId3 : EMPTY_ARRAY;
37
+ return state?.[blockClientId] ?? EMPTY_ARRAY;
45
38
  }
46
-
47
- /**
48
- * Returns the annotations that apply to the given RichText instance.
49
- *
50
- * Both a blockClientId and a richTextIdentifier are required. This is because
51
- * a block might have multiple `RichText` components. This does mean that every
52
- * block needs to implement annotations itself.
53
- *
54
- * @param {Object} state Editor state.
55
- * @param {string} blockClientId The client ID for the block.
56
- * @param {string} richTextIdentifier Unique identifier that identifies the given RichText.
57
- * @return {Array} All the annotations relevant for the `RichText`.
58
- */
59
- const __experimentalGetAnnotationsForRichText = exports.__experimentalGetAnnotationsForRichText = (0, _data.createSelector)((state, blockClientId, richTextIdentifier) => {
60
- var _state$blockClientId4;
61
- return ((_state$blockClientId4 = state?.[blockClientId]) !== null && _state$blockClientId4 !== void 0 ? _state$blockClientId4 : []).filter(annotation => {
62
- return annotation.selector === 'range' && richTextIdentifier === annotation.richTextIdentifier;
63
- }).map(annotation => {
64
- const {
65
- range,
66
- ...other
67
- } = annotation;
68
- return {
69
- ...range,
70
- ...other
71
- };
72
- });
73
- }, (state, blockClientId) => {
74
- var _state$blockClientId5;
75
- return [(_state$blockClientId5 = state?.[blockClientId]) !== null && _state$blockClientId5 !== void 0 ? _state$blockClientId5 : EMPTY_ARRAY];
76
- });
77
-
78
- /**
79
- * Returns all annotations in the editor state.
80
- *
81
- * @param {Object} state Editor state.
82
- * @return {Array} All annotations currently applied.
83
- */
39
+ const __experimentalGetAnnotationsForRichText = (0, import_data.createSelector)(
40
+ (state, blockClientId, richTextIdentifier) => {
41
+ return (state?.[blockClientId] ?? []).filter((annotation) => {
42
+ return annotation.selector === "range" && richTextIdentifier === annotation.richTextIdentifier;
43
+ }).map((annotation) => {
44
+ const { range, ...other } = annotation;
45
+ return {
46
+ ...range,
47
+ ...other
48
+ };
49
+ });
50
+ },
51
+ (state, blockClientId) => [state?.[blockClientId] ?? EMPTY_ARRAY]
52
+ );
84
53
  function __experimentalGetAnnotations(state) {
85
54
  return Object.values(state).flat();
86
55
  }
87
- //# sourceMappingURL=selectors.js.map
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ __experimentalGetAllAnnotationsForBlock,
59
+ __experimentalGetAnnotations,
60
+ __experimentalGetAnnotationsForBlock,
61
+ __experimentalGetAnnotationsForRichText
62
+ });
63
+ //# sourceMappingURL=selectors.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","EMPTY_ARRAY","__experimentalGetAnnotationsForBlock","exports","createSelector","state","blockClientId","_state$blockClientId","filter","annotation","selector","_state$blockClientId2","__experimentalGetAllAnnotationsForBlock","_state$blockClientId3","__experimentalGetAnnotationsForRichText","richTextIdentifier","_state$blockClientId4","map","range","other","_state$blockClientId5","__experimentalGetAnnotations","Object","values","flat"],"sources":["@wordpress/annotations/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns the annotations for a specific client ID.\n *\n * @param {Object} state Editor state.\n * @param {string} clientId The ID of the block to get the annotations for.\n *\n * @return {Array} The annotations applicable to this block.\n */\nexport const __experimentalGetAnnotationsForBlock = createSelector(\n\t( state, blockClientId ) => {\n\t\treturn ( state?.[ blockClientId ] ?? [] ).filter( ( annotation ) => {\n\t\t\treturn annotation.selector === 'block';\n\t\t} );\n\t},\n\t( state, blockClientId ) => [ state?.[ blockClientId ] ?? EMPTY_ARRAY ]\n);\n\nexport function __experimentalGetAllAnnotationsForBlock(\n\tstate,\n\tblockClientId\n) {\n\treturn state?.[ blockClientId ] ?? EMPTY_ARRAY;\n}\n\n/**\n * Returns the annotations that apply to the given RichText instance.\n *\n * Both a blockClientId and a richTextIdentifier are required. This is because\n * a block might have multiple `RichText` components. This does mean that every\n * block needs to implement annotations itself.\n *\n * @param {Object} state Editor state.\n * @param {string} blockClientId The client ID for the block.\n * @param {string} richTextIdentifier Unique identifier that identifies the given RichText.\n * @return {Array} All the annotations relevant for the `RichText`.\n */\nexport const __experimentalGetAnnotationsForRichText = createSelector(\n\t( state, blockClientId, richTextIdentifier ) => {\n\t\treturn ( state?.[ blockClientId ] ?? [] )\n\t\t\t.filter( ( annotation ) => {\n\t\t\t\treturn (\n\t\t\t\t\tannotation.selector === 'range' &&\n\t\t\t\t\trichTextIdentifier === annotation.richTextIdentifier\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.map( ( annotation ) => {\n\t\t\t\tconst { range, ...other } = annotation;\n\n\t\t\t\treturn {\n\t\t\t\t\t...range,\n\t\t\t\t\t...other,\n\t\t\t\t};\n\t\t\t} );\n\t},\n\t( state, blockClientId ) => [ state?.[ blockClientId ] ?? EMPTY_ARRAY ]\n);\n\n/**\n * Returns all annotations in the editor state.\n *\n * @param {Object} state Editor state.\n * @return {Array} All annotations currently applied.\n */\nexport function __experimentalGetAnnotations( state ) {\n\treturn Object.values( state ).flat();\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,oCAAoC,GAAAC,OAAA,CAAAD,oCAAA,GAAG,IAAAE,oBAAc,EACjE,CAAEC,KAAK,EAAEC,aAAa,KAAM;EAAA,IAAAC,oBAAA;EAC3B,OAAO,EAAAA,oBAAA,GAAEF,KAAK,GAAIC,aAAa,CAAE,cAAAC,oBAAA,cAAAA,oBAAA,GAAI,EAAE,EAAGC,MAAM,CAAIC,UAAU,IAAM;IACnE,OAAOA,UAAU,CAACC,QAAQ,KAAK,OAAO;EACvC,CAAE,CAAC;AACJ,CAAC,EACD,CAAEL,KAAK,EAAEC,aAAa;EAAA,IAAAK,qBAAA;EAAA,OAAM,EAAAA,qBAAA,GAAEN,KAAK,GAAIC,aAAa,CAAE,cAAAK,qBAAA,cAAAA,qBAAA,GAAIV,WAAW,CAAE;AAAA,CACxE,CAAC;AAEM,SAASW,uCAAuCA,CACtDP,KAAK,EACLC,aAAa,EACZ;EAAA,IAAAO,qBAAA;EACD,QAAAA,qBAAA,GAAOR,KAAK,GAAIC,aAAa,CAAE,cAAAO,qBAAA,cAAAA,qBAAA,GAAIZ,WAAW;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMa,uCAAuC,GAAAX,OAAA,CAAAW,uCAAA,GAAG,IAAAV,oBAAc,EACpE,CAAEC,KAAK,EAAEC,aAAa,EAAES,kBAAkB,KAAM;EAAA,IAAAC,qBAAA;EAC/C,OAAO,EAAAA,qBAAA,GAAEX,KAAK,GAAIC,aAAa,CAAE,cAAAU,qBAAA,cAAAA,qBAAA,GAAI,EAAE,EACrCR,MAAM,CAAIC,UAAU,IAAM;IAC1B,OACCA,UAAU,CAACC,QAAQ,KAAK,OAAO,IAC/BK,kBAAkB,KAAKN,UAAU,CAACM,kBAAkB;EAEtD,CAAE,CAAC,CACFE,GAAG,CAAIR,UAAU,IAAM;IACvB,MAAM;MAAES,KAAK;MAAE,GAAGC;IAAM,CAAC,GAAGV,UAAU;IAEtC,OAAO;MACN,GAAGS,KAAK;MACR,GAAGC;IACJ,CAAC;EACF,CAAE,CAAC;AACL,CAAC,EACD,CAAEd,KAAK,EAAEC,aAAa;EAAA,IAAAc,qBAAA;EAAA,OAAM,EAAAA,qBAAA,GAAEf,KAAK,GAAIC,aAAa,CAAE,cAAAc,qBAAA,cAAAA,qBAAA,GAAInB,WAAW,CAAE;AAAA,CACxE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACO,SAASoB,4BAA4BA,CAAEhB,KAAK,EAAG;EACrD,OAAOiB,MAAM,CAACC,MAAM,CAAElB,KAAM,CAAC,CAACmB,IAAI,CAAC,CAAC;AACrC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/store/selectors.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createSelector } from '@wordpress/data';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\n/**\n * Returns the annotations for a specific client ID.\n *\n * @param {Object} state Editor state.\n * @param {string} clientId The ID of the block to get the annotations for.\n *\n * @return {Array} The annotations applicable to this block.\n */\nexport const __experimentalGetAnnotationsForBlock = createSelector(\n\t( state, blockClientId ) => {\n\t\treturn ( state?.[ blockClientId ] ?? [] ).filter( ( annotation ) => {\n\t\t\treturn annotation.selector === 'block';\n\t\t} );\n\t},\n\t( state, blockClientId ) => [ state?.[ blockClientId ] ?? EMPTY_ARRAY ]\n);\n\nexport function __experimentalGetAllAnnotationsForBlock(\n\tstate,\n\tblockClientId\n) {\n\treturn state?.[ blockClientId ] ?? EMPTY_ARRAY;\n}\n\n/**\n * Returns the annotations that apply to the given RichText instance.\n *\n * Both a blockClientId and a richTextIdentifier are required. This is because\n * a block might have multiple `RichText` components. This does mean that every\n * block needs to implement annotations itself.\n *\n * @param {Object} state Editor state.\n * @param {string} blockClientId The client ID for the block.\n * @param {string} richTextIdentifier Unique identifier that identifies the given RichText.\n * @return {Array} All the annotations relevant for the `RichText`.\n */\nexport const __experimentalGetAnnotationsForRichText = createSelector(\n\t( state, blockClientId, richTextIdentifier ) => {\n\t\treturn ( state?.[ blockClientId ] ?? [] )\n\t\t\t.filter( ( annotation ) => {\n\t\t\t\treturn (\n\t\t\t\t\tannotation.selector === 'range' &&\n\t\t\t\t\trichTextIdentifier === annotation.richTextIdentifier\n\t\t\t\t);\n\t\t\t} )\n\t\t\t.map( ( annotation ) => {\n\t\t\t\tconst { range, ...other } = annotation;\n\n\t\t\t\treturn {\n\t\t\t\t\t...range,\n\t\t\t\t\t...other,\n\t\t\t\t};\n\t\t\t} );\n\t},\n\t( state, blockClientId ) => [ state?.[ blockClientId ] ?? EMPTY_ARRAY ]\n);\n\n/**\n * Returns all annotations in the editor state.\n *\n * @param {Object} state Editor state.\n * @return {Array} All annotations currently applied.\n */\nexport function __experimentalGetAnnotations( state ) {\n\treturn Object.values( state ).flat();\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA+B;AAW/B,MAAM,cAAc,CAAC;AAUd,MAAM,2CAAuC;AAAA,EACnD,CAAE,OAAO,kBAAmB;AAC3B,YAAS,QAAS,aAAc,KAAK,CAAC,GAAI,OAAQ,CAAE,eAAgB;AACnE,aAAO,WAAW,aAAa;AAAA,IAChC,CAAE;AAAA,EACH;AAAA,EACA,CAAE,OAAO,kBAAmB,CAAE,QAAS,aAAc,KAAK,WAAY;AACvE;AAEO,SAAS,wCACf,OACA,eACC;AACD,SAAO,QAAS,aAAc,KAAK;AACpC;AAcO,MAAM,8CAA0C;AAAA,EACtD,CAAE,OAAO,eAAe,uBAAwB;AAC/C,YAAS,QAAS,aAAc,KAAK,CAAC,GACpC,OAAQ,CAAE,eAAgB;AAC1B,aACC,WAAW,aAAa,WACxB,uBAAuB,WAAW;AAAA,IAEpC,CAAE,EACD,IAAK,CAAE,eAAgB;AACvB,YAAM,EAAE,OAAO,GAAG,MAAM,IAAI;AAE5B,aAAO;AAAA,QACN,GAAG;AAAA,QACH,GAAG;AAAA,MACJ;AAAA,IACD,CAAE;AAAA,EACJ;AAAA,EACA,CAAE,OAAO,kBAAmB,CAAE,QAAS,aAAc,KAAK,WAAY;AACvE;AAQO,SAAS,6BAA8B,OAAQ;AACrD,SAAO,OAAO,OAAQ,KAAM,EAAE,KAAK;AACpC;",
6
+ "names": []
7
+ }
@@ -1,31 +1,21 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { addFilter } from '@wordpress/hooks';
5
- import { withSelect } from '@wordpress/data';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import { STORE_NAME } from '../store/constants';
11
- /**
12
- * Adds annotation className to the block-list-block component.
13
- *
14
- * @param {Object} OriginalComponent The original BlockListBlock component.
15
- * @return {Object} The enhanced component.
16
- */
17
- const addAnnotationClassName = OriginalComponent => {
18
- return withSelect((select, {
19
- clientId,
20
- className
21
- }) => {
22
- const annotations = select(STORE_NAME).__experimentalGetAnnotationsForBlock(clientId);
1
+ import { addFilter } from "@wordpress/hooks";
2
+ import { withSelect } from "@wordpress/data";
3
+ import { STORE_NAME } from "../store/constants";
4
+ const addAnnotationClassName = (OriginalComponent) => {
5
+ return withSelect((select, { clientId, className }) => {
6
+ const annotations = select(STORE_NAME).__experimentalGetAnnotationsForBlock(
7
+ clientId
8
+ );
23
9
  return {
24
- className: annotations.map(annotation => {
25
- return 'is-annotated-by-' + annotation.source;
26
- }).concat(className).filter(Boolean).join(' ')
10
+ className: annotations.map((annotation) => {
11
+ return "is-annotated-by-" + annotation.source;
12
+ }).concat(className).filter(Boolean).join(" ")
27
13
  };
28
14
  })(OriginalComponent);
29
15
  };
30
- addFilter('editor.BlockListBlock', 'core/annotations', addAnnotationClassName);
31
- //# sourceMappingURL=index.js.map
16
+ addFilter(
17
+ "editor.BlockListBlock",
18
+ "core/annotations",
19
+ addAnnotationClassName
20
+ );
21
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["addFilter","withSelect","STORE_NAME","addAnnotationClassName","OriginalComponent","select","clientId","className","annotations","__experimentalGetAnnotationsForBlock","map","annotation","source","concat","filter","Boolean","join"],"sources":["@wordpress/annotations/src/block/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../store/constants';\n/**\n * Adds annotation className to the block-list-block component.\n *\n * @param {Object} OriginalComponent The original BlockListBlock component.\n * @return {Object} The enhanced component.\n */\nconst addAnnotationClassName = ( OriginalComponent ) => {\n\treturn withSelect( ( select, { clientId, className } ) => {\n\t\tconst annotations =\n\t\t\tselect( STORE_NAME ).__experimentalGetAnnotationsForBlock(\n\t\t\t\tclientId\n\t\t\t);\n\n\t\treturn {\n\t\t\tclassName: annotations\n\t\t\t\t.map( ( annotation ) => {\n\t\t\t\t\treturn 'is-annotated-by-' + annotation.source;\n\t\t\t\t} )\n\t\t\t\t.concat( className )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ),\n\t\t};\n\t} )( OriginalComponent );\n};\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/annotations',\n\taddAnnotationClassName\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,UAAU,QAAQ,iBAAiB;;AAE5C;AACA;AACA;AACA,SAASC,UAAU,QAAQ,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAKC,iBAAiB,IAAM;EACvD,OAAOH,UAAU,CAAE,CAAEI,MAAM,EAAE;IAAEC,QAAQ;IAAEC;EAAU,CAAC,KAAM;IACzD,MAAMC,WAAW,GAChBH,MAAM,CAAEH,UAAW,CAAC,CAACO,oCAAoC,CACxDH,QACD,CAAC;IAEF,OAAO;MACNC,SAAS,EAAEC,WAAW,CACpBE,GAAG,CAAIC,UAAU,IAAM;QACvB,OAAO,kBAAkB,GAAGA,UAAU,CAACC,MAAM;MAC9C,CAAE,CAAC,CACFC,MAAM,CAAEN,SAAU,CAAC,CACnBO,MAAM,CAAEC,OAAQ,CAAC,CACjBC,IAAI,CAAE,GAAI;IACb,CAAC;EACF,CAAE,CAAC,CAAEZ,iBAAkB,CAAC;AACzB,CAAC;AAEDJ,SAAS,CACR,uBAAuB,EACvB,kBAAkB,EAClBG,sBACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/block/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../store/constants';\n/**\n * Adds annotation className to the block-list-block component.\n *\n * @param {Object} OriginalComponent The original BlockListBlock component.\n * @return {Object} The enhanced component.\n */\nconst addAnnotationClassName = ( OriginalComponent ) => {\n\treturn withSelect( ( select, { clientId, className } ) => {\n\t\tconst annotations =\n\t\t\tselect( STORE_NAME ).__experimentalGetAnnotationsForBlock(\n\t\t\t\tclientId\n\t\t\t);\n\n\t\treturn {\n\t\t\tclassName: annotations\n\t\t\t\t.map( ( annotation ) => {\n\t\t\t\t\treturn 'is-annotated-by-' + annotation.source;\n\t\t\t\t} )\n\t\t\t\t.concat( className )\n\t\t\t\t.filter( Boolean )\n\t\t\t\t.join( ' ' ),\n\t\t};\n\t} )( OriginalComponent );\n};\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/annotations',\n\taddAnnotationClassName\n);\n"],
5
+ "mappings": "AAGA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAK3B,SAAS,kBAAkB;AAO3B,MAAM,yBAAyB,CAAE,sBAAuB;AACvD,SAAO,WAAY,CAAE,QAAQ,EAAE,UAAU,UAAU,MAAO;AACzD,UAAM,cACL,OAAQ,UAAW,EAAE;AAAA,MACpB;AAAA,IACD;AAED,WAAO;AAAA,MACN,WAAW,YACT,IAAK,CAAE,eAAgB;AACvB,eAAO,qBAAqB,WAAW;AAAA,MACxC,CAAE,EACD,OAAQ,SAAU,EAClB,OAAQ,OAAQ,EAChB,KAAM,GAAI;AAAA,IACb;AAAA,EACD,CAAE,EAAG,iBAAkB;AACxB;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
+ "names": []
7
+ }