@wordpress/annotations 2.39.0 → 2.40.1

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 (36) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/index.js +0 -5
  3. package/build/block/index.js.map +1 -1
  4. package/build/format/annotation.js +9 -29
  5. package/build/format/annotation.js.map +1 -1
  6. package/build/format/index.js +1 -2
  7. package/build/format/index.js.map +1 -1
  8. package/build/index.js +0 -3
  9. package/build/index.js.map +1 -1
  10. package/build/store/actions.js +3 -10
  11. package/build/store/actions.js.map +1 -1
  12. package/build/store/constants.js +0 -1
  13. package/build/store/constants.js.map +1 -1
  14. package/build/store/index.js +0 -9
  15. package/build/store/index.js.map +1 -1
  16. package/build/store/reducer.js +9 -19
  17. package/build/store/reducer.js.map +1 -1
  18. package/build/store/selectors.js +5 -17
  19. package/build/store/selectors.js.map +1 -1
  20. package/build-module/block/index.js +1 -4
  21. package/build-module/block/index.js.map +1 -1
  22. package/build-module/format/annotation.js +9 -25
  23. package/build-module/format/annotation.js.map +1 -1
  24. package/build-module/format/index.js +1 -1
  25. package/build-module/format/index.js.map +1 -1
  26. package/build-module/index.js.map +1 -1
  27. package/build-module/store/actions.js +4 -6
  28. package/build-module/store/actions.js.map +1 -1
  29. package/build-module/store/constants.js.map +1 -1
  30. package/build-module/store/index.js +3 -3
  31. package/build-module/store/index.js.map +1 -1
  32. package/build-module/store/reducer.js +9 -17
  33. package/build-module/store/reducer.js.map +1 -1
  34. package/build-module/store/selectors.js +6 -10
  35. package/build-module/store/selectors.js.map +1 -1
  36. package/package.json +9 -6
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.40.0 (2023-08-16)
6
+
5
7
  ## 2.39.0 (2023-08-10)
6
8
 
7
9
  ## 2.38.0 (2023-07-20)
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var _hooks = require("@wordpress/hooks");
4
-
5
4
  var _data = require("@wordpress/data");
6
-
7
5
  var _constants = require("../store/constants");
8
-
9
6
  /**
10
7
  * WordPress dependencies
11
8
  */
@@ -26,7 +23,6 @@ const addAnnotationClassName = OriginalComponent => {
26
23
  className
27
24
  }) => {
28
25
  const annotations = select(_constants.STORE_NAME).__experimentalGetAnnotationsForBlock(clientId);
29
-
30
26
  return {
31
27
  className: annotations.map(annotation => {
32
28
  return 'is-annotated-by-' + annotation.source;
@@ -34,6 +30,5 @@ const addAnnotationClassName = OriginalComponent => {
34
30
  };
35
31
  })(OriginalComponent);
36
32
  };
37
-
38
33
  (0, _hooks.addFilter)('editor.BlockListBlock', 'core/annotations', addAnnotationClassName);
39
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/block/index.js"],"names":["addAnnotationClassName","OriginalComponent","select","clientId","className","annotations","STORE_NAME","__experimentalGetAnnotationsForBlock","map","annotation","source","concat","filter","Boolean","join"],"mappings":";;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,sBAAsB,GAAKC,iBAAF,IAAyB;AACvD,SAAO,sBAAY,CAAEC,MAAF,EAAU;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAV,KAAuC;AACzD,UAAMC,WAAW,GAChBH,MAAM,CAAEI,qBAAF,CAAN,CAAqBC,oCAArB,CACCJ,QADD,CADD;;AAKA,WAAO;AACNC,MAAAA,SAAS,EAAEC,WAAW,CACpBG,GADS,CACFC,UAAF,IAAkB;AACvB,eAAO,qBAAqBA,UAAU,CAACC,MAAvC;AACA,OAHS,EAITC,MAJS,CAIDP,SAJC,EAKTQ,MALS,CAKDC,OALC,EAMTC,IANS,CAMH,GANG;AADL,KAAP;AASA,GAfM,EAeFb,iBAfE,CAAP;AAgBA,CAjBD;;AAmBA,sBACC,uBADD,EAEC,kBAFD,EAGCD,sBAHD","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"]}
1
+ {"version":3,"names":["_hooks","require","_data","_constants","addAnnotationClassName","OriginalComponent","withSelect","select","clientId","className","annotations","STORE_NAME","__experimentalGetAnnotationsForBlock","map","annotation","source","concat","filter","Boolean","join","addFilter"],"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":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,sBAAsB,GAAKC,iBAAiB,IAAM;EACvD,OAAO,IAAAC,gBAAU,EAAE,CAAEC,MAAM,EAAE;IAAEC,QAAQ;IAAEC;EAAU,CAAC,KAAM;IACzD,MAAMC,WAAW,GAChBH,MAAM,CAAEI,qBAAW,CAAC,CAACC,oCAAoC,CACxDJ,QACD,CAAC;IAEF,OAAO;MACNC,SAAS,EAAEC,WAAW,CACpBG,GAAG,CAAIC,UAAU,IAAM;QACvB,OAAO,kBAAkB,GAAGA,UAAU,CAACC,MAAM;MAC9C,CAAE,CAAC,CACFC,MAAM,CAAEP,SAAU,CAAC,CACnBQ,MAAM,CAAEC,OAAQ,CAAC,CACjBC,IAAI,CAAE,GAAI;IACb,CAAC;EACF,CAAE,CAAC,CAAEd,iBAAkB,CAAC;AACzB,CAAC;AAED,IAAAe,gBAAS,EACR,uBAAuB,EACvB,kBAAkB,EAClBhB,sBACD,CAAC"}
@@ -6,16 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.annotation = void 0;
7
7
  exports.applyAnnotations = applyAnnotations;
8
8
  exports.removeAnnotations = removeAnnotations;
9
-
10
9
  var _i18n = require("@wordpress/i18n");
11
-
12
10
  var _richText = require("@wordpress/rich-text");
13
-
14
11
  var _constants = require("../store/constants");
15
-
16
12
  /**
17
13
  * WordPress dependencies
18
14
  */
15
+
19
16
  const FORMAT_NAME = 'core/annotation';
20
17
  const ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-';
21
18
  /**
@@ -35,15 +32,12 @@ function applyAnnotations(record, annotations = []) {
35
32
  start,
36
33
  end
37
34
  } = annotation;
38
-
39
35
  if (start > record.text.length) {
40
36
  start = record.text.length;
41
37
  }
42
-
43
38
  if (end > record.text.length) {
44
39
  end = record.text.length;
45
40
  }
46
-
47
41
  const className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source;
48
42
  const id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id;
49
43
  record = (0, _richText.applyFormat)(record, {
@@ -56,25 +50,23 @@ function applyAnnotations(record, annotations = []) {
56
50
  });
57
51
  return record;
58
52
  }
53
+
59
54
  /**
60
55
  * Removes annotations from the given record.
61
56
  *
62
57
  * @param {Object} record Record to remove annotations from.
63
58
  * @return {Object} The cleaned record.
64
59
  */
65
-
66
-
67
60
  function removeAnnotations(record) {
68
61
  return (0, _richText.removeFormat)(record, 'core/annotation', 0, record.text.length);
69
62
  }
63
+
70
64
  /**
71
65
  * Retrieves the positions of annotations inside an array of formats.
72
66
  *
73
67
  * @param {Array} formats Formats with annotations in there.
74
68
  * @return {Object} ID keyed positions of annotations.
75
69
  */
76
-
77
-
78
70
  function retrieveAnnotationPositions(formats) {
79
71
  const positions = {};
80
72
  formats.forEach((characterFormats, i) => {
@@ -85,21 +77,21 @@ function retrieveAnnotationPositions(formats) {
85
77
  id
86
78
  } = format.attributes;
87
79
  id = id.replace(ANNOTATION_ATTRIBUTE_PREFIX, '');
88
-
89
80
  if (!positions.hasOwnProperty(id)) {
90
81
  positions[id] = {
91
82
  start: i
92
83
  };
93
- } // Annotations refer to positions between characters.
84
+ }
85
+
86
+ // Annotations refer to positions between characters.
94
87
  // Formats refer to the character themselves.
95
88
  // So we need to adjust for that here.
96
-
97
-
98
89
  positions[id].end = i + 1;
99
90
  });
100
91
  });
101
92
  return positions;
102
93
  }
94
+
103
95
  /**
104
96
  * Updates annotations in the state based on positions retrieved from RichText.
105
97
  *
@@ -109,33 +101,28 @@ function retrieveAnnotationPositions(formats) {
109
101
  * @param {Function} actions.removeAnnotation Function to remove an annotation from the state.
110
102
  * @param {Function} actions.updateAnnotationRange Function to update an annotation range in the state.
111
103
  */
112
-
113
-
114
104
  function updateAnnotationsWithPositions(annotations, positions, {
115
105
  removeAnnotation,
116
106
  updateAnnotationRange
117
107
  }) {
118
108
  annotations.forEach(currentAnnotation => {
119
- const position = positions[currentAnnotation.id]; // If we cannot find an annotation, delete it.
120
-
109
+ const position = positions[currentAnnotation.id];
110
+ // If we cannot find an annotation, delete it.
121
111
  if (!position) {
122
112
  // Apparently the annotation has been removed, so remove it from the state:
123
113
  // Remove...
124
114
  removeAnnotation(currentAnnotation.id);
125
115
  return;
126
116
  }
127
-
128
117
  const {
129
118
  start,
130
119
  end
131
120
  } = currentAnnotation;
132
-
133
121
  if (start !== position.start || end !== position.end) {
134
122
  updateAnnotationRange(currentAnnotation.id, position.start, position.end);
135
123
  }
136
124
  });
137
125
  }
138
-
139
126
  const annotation = {
140
127
  name: FORMAT_NAME,
141
128
  title: (0, _i18n.__)('Annotation'),
@@ -145,11 +132,9 @@ const annotation = {
145
132
  className: 'class',
146
133
  id: 'id'
147
134
  },
148
-
149
135
  edit() {
150
136
  return null;
151
137
  },
152
-
153
138
  __experimentalGetPropsForEditableTreePreparation(select, {
154
139
  richTextIdentifier,
155
140
  blockClientId
@@ -158,7 +143,6 @@ const annotation = {
158
143
  annotations: select(_constants.STORE_NAME).__experimentalGetAnnotationsForRichText(blockClientId, richTextIdentifier)
159
144
  };
160
145
  },
161
-
162
146
  __experimentalCreatePrepareEditableTree({
163
147
  annotations
164
148
  }) {
@@ -166,7 +150,6 @@ const annotation = {
166
150
  if (annotations.length === 0) {
167
151
  return formats;
168
152
  }
169
-
170
153
  let record = {
171
154
  formats,
172
155
  text
@@ -175,14 +158,12 @@ const annotation = {
175
158
  return record.formats;
176
159
  };
177
160
  },
178
-
179
161
  __experimentalGetPropsForEditableTreeChangeHandler(dispatch) {
180
162
  return {
181
163
  removeAnnotation: dispatch(_constants.STORE_NAME).__experimentalRemoveAnnotation,
182
164
  updateAnnotationRange: dispatch(_constants.STORE_NAME).__experimentalUpdateAnnotationRange
183
165
  };
184
166
  },
185
-
186
167
  __experimentalCreateOnChangeEditableValue(props) {
187
168
  return formats => {
188
169
  const positions = retrieveAnnotationPositions(formats);
@@ -197,7 +178,6 @@ const annotation = {
197
178
  });
198
179
  };
199
180
  }
200
-
201
181
  };
202
182
  exports.annotation = annotation;
203
183
  //# sourceMappingURL=annotation.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/format/annotation.js"],"names":["FORMAT_NAME","ANNOTATION_ATTRIBUTE_PREFIX","applyAnnotations","record","annotations","forEach","annotation","start","end","text","length","className","source","id","type","attributes","removeAnnotations","retrieveAnnotationPositions","formats","positions","characterFormats","i","filter","format","replace","hasOwnProperty","updateAnnotationsWithPositions","removeAnnotation","updateAnnotationRange","currentAnnotation","position","name","title","tagName","edit","__experimentalGetPropsForEditableTreePreparation","select","richTextIdentifier","blockClientId","STORE_NAME","__experimentalGetAnnotationsForRichText","__experimentalCreatePrepareEditableTree","__experimentalGetPropsForEditableTreeChangeHandler","dispatch","__experimentalRemoveAnnotation","__experimentalUpdateAnnotationRange","__experimentalCreateOnChangeEditableValue","props"],"mappings":";;;;;;;;;AAGA;;AACA;;AAQA;;AAZA;AACA;AACA;AAIA,MAAMA,WAAW,GAAG,iBAApB;AAEA,MAAMC,2BAA2B,GAAG,kBAApC;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAT,CAA2BC,MAA3B,EAAmCC,WAAW,GAAG,EAAjD,EAAsD;AAC5DA,EAAAA,WAAW,CAACC,OAAZ,CAAuBC,UAAF,IAAkB;AACtC,QAAI;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,QAAiBF,UAAr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AA7C;AACA,YAAM;AAAES,QAAAA,gBAAF;AAAoBC,QAAAA,qBAApB;AAA2CxB,QAAAA;AAA3C,UACL2C,KADD;AAGArB,MAAAA,8BAA8B,CAAEtB,WAAF,EAAee,SAAf,EAA0B;AACvDQ,QAAAA,gBADuD;AAEvDC,QAAAA;AAFuD,OAA1B,CAA9B;AAIA,KATD;AAUA;;AAvDwB,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { applyFormat, removeFormat } from '@wordpress/rich-text';\n\nconst FORMAT_NAME = 'core/annotation';\n\nconst ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-';\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../store/constants';\n\n/**\n * Applies given annotations to the given record.\n *\n * @param {Object} record The record to apply annotations to.\n * @param {Array} annotations The annotation to apply.\n * @return {Object} A record with the annotations applied.\n */\nexport function applyAnnotations( record, annotations = [] ) {\n\tannotations.forEach( ( annotation ) => {\n\t\tlet { start, end } = annotation;\n\n\t\tif ( start > record.text.length ) {\n\t\t\tstart = record.text.length;\n\t\t}\n\n\t\tif ( end > record.text.length ) {\n\t\t\tend = record.text.length;\n\t\t}\n\n\t\tconst className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source;\n\t\tconst id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id;\n\n\t\trecord = applyFormat(\n\t\t\trecord,\n\t\t\t{\n\t\t\t\ttype: FORMAT_NAME,\n\t\t\t\tattributes: {\n\t\t\t\t\tclassName,\n\t\t\t\t\tid,\n\t\t\t\t},\n\t\t\t},\n\t\t\tstart,\n\t\t\tend\n\t\t);\n\t} );\n\n\treturn record;\n}\n\n/**\n * Removes annotations from the given record.\n *\n * @param {Object} record Record to remove annotations from.\n * @return {Object} The cleaned record.\n */\nexport function removeAnnotations( record ) {\n\treturn removeFormat( record, 'core/annotation', 0, record.text.length );\n}\n\n/**\n * Retrieves the positions of annotations inside an array of formats.\n *\n * @param {Array} formats Formats with annotations in there.\n * @return {Object} ID keyed positions of annotations.\n */\nfunction retrieveAnnotationPositions( formats ) {\n\tconst positions = {};\n\n\tformats.forEach( ( characterFormats, i ) => {\n\t\tcharacterFormats = characterFormats || [];\n\t\tcharacterFormats = characterFormats.filter(\n\t\t\t( format ) => format.type === FORMAT_NAME\n\t\t);\n\t\tcharacterFormats.forEach( ( format ) => {\n\t\t\tlet { id } = format.attributes;\n\t\t\tid = id.replace( ANNOTATION_ATTRIBUTE_PREFIX, '' );\n\n\t\t\tif ( ! positions.hasOwnProperty( id ) ) {\n\t\t\t\tpositions[ id ] = {\n\t\t\t\t\tstart: i,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Annotations refer to positions between characters.\n\t\t\t// Formats refer to the character themselves.\n\t\t\t// So we need to adjust for that here.\n\t\t\tpositions[ id ].end = i + 1;\n\t\t} );\n\t} );\n\n\treturn positions;\n}\n\n/**\n * Updates annotations in the state based on positions retrieved from RichText.\n *\n * @param {Array} annotations The annotations that are currently applied.\n * @param {Array} positions The current positions of the given annotations.\n * @param {Object} actions\n * @param {Function} actions.removeAnnotation Function to remove an annotation from the state.\n * @param {Function} actions.updateAnnotationRange Function to update an annotation range in the state.\n */\nfunction updateAnnotationsWithPositions(\n\tannotations,\n\tpositions,\n\t{ removeAnnotation, updateAnnotationRange }\n) {\n\tannotations.forEach( ( currentAnnotation ) => {\n\t\tconst position = positions[ currentAnnotation.id ];\n\t\t// If we cannot find an annotation, delete it.\n\t\tif ( ! position ) {\n\t\t\t// Apparently the annotation has been removed, so remove it from the state:\n\t\t\t// Remove...\n\t\t\tremoveAnnotation( currentAnnotation.id );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { start, end } = currentAnnotation;\n\t\tif ( start !== position.start || end !== position.end ) {\n\t\t\tupdateAnnotationRange(\n\t\t\t\tcurrentAnnotation.id,\n\t\t\t\tposition.start,\n\t\t\t\tposition.end\n\t\t\t);\n\t\t}\n\t} );\n}\n\nexport const annotation = {\n\tname: FORMAT_NAME,\n\ttitle: __( 'Annotation' ),\n\ttagName: 'mark',\n\tclassName: 'annotation-text',\n\tattributes: {\n\t\tclassName: 'class',\n\t\tid: 'id',\n\t},\n\tedit() {\n\t\treturn null;\n\t},\n\t__experimentalGetPropsForEditableTreePreparation(\n\t\tselect,\n\t\t{ richTextIdentifier, blockClientId }\n\t) {\n\t\treturn {\n\t\t\tannotations: select(\n\t\t\t\tSTORE_NAME\n\t\t\t).__experimentalGetAnnotationsForRichText(\n\t\t\t\tblockClientId,\n\t\t\t\trichTextIdentifier\n\t\t\t),\n\t\t};\n\t},\n\t__experimentalCreatePrepareEditableTree( { annotations } ) {\n\t\treturn ( formats, text ) => {\n\t\t\tif ( annotations.length === 0 ) {\n\t\t\t\treturn formats;\n\t\t\t}\n\n\t\t\tlet record = { formats, text };\n\t\t\trecord = applyAnnotations( record, annotations );\n\t\t\treturn record.formats;\n\t\t};\n\t},\n\t__experimentalGetPropsForEditableTreeChangeHandler( dispatch ) {\n\t\treturn {\n\t\t\tremoveAnnotation:\n\t\t\t\tdispatch( STORE_NAME ).__experimentalRemoveAnnotation,\n\t\t\tupdateAnnotationRange:\n\t\t\t\tdispatch( STORE_NAME ).__experimentalUpdateAnnotationRange,\n\t\t};\n\t},\n\t__experimentalCreateOnChangeEditableValue( props ) {\n\t\treturn ( formats ) => {\n\t\t\tconst positions = retrieveAnnotationPositions( formats );\n\t\t\tconst { removeAnnotation, updateAnnotationRange, annotations } =\n\t\t\t\tprops;\n\n\t\t\tupdateAnnotationsWithPositions( annotations, positions, {\n\t\t\t\tremoveAnnotation,\n\t\t\t\tupdateAnnotationRange,\n\t\t\t} );\n\t\t};\n\t},\n};\n"]}
1
+ {"version":3,"names":["_i18n","require","_richText","_constants","FORMAT_NAME","ANNOTATION_ATTRIBUTE_PREFIX","applyAnnotations","record","annotations","forEach","annotation","start","end","text","length","className","source","id","applyFormat","type","attributes","removeAnnotations","removeFormat","retrieveAnnotationPositions","formats","positions","characterFormats","i","filter","format","replace","hasOwnProperty","updateAnnotationsWithPositions","removeAnnotation","updateAnnotationRange","currentAnnotation","position","name","title","__","tagName","edit","__experimentalGetPropsForEditableTreePreparation","select","richTextIdentifier","blockClientId","STORE_NAME","__experimentalGetAnnotationsForRichText","__experimentalCreatePrepareEditableTree","__experimentalGetPropsForEditableTreeChangeHandler","dispatch","__experimentalRemoveAnnotation","__experimentalUpdateAnnotationRange","__experimentalCreateOnChangeEditableValue","props","exports"],"sources":["@wordpress/annotations/src/format/annotation.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { applyFormat, removeFormat } from '@wordpress/rich-text';\n\nconst FORMAT_NAME = 'core/annotation';\n\nconst ANNOTATION_ATTRIBUTE_PREFIX = 'annotation-text-';\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from '../store/constants';\n\n/**\n * Applies given annotations to the given record.\n *\n * @param {Object} record The record to apply annotations to.\n * @param {Array} annotations The annotation to apply.\n * @return {Object} A record with the annotations applied.\n */\nexport function applyAnnotations( record, annotations = [] ) {\n\tannotations.forEach( ( annotation ) => {\n\t\tlet { start, end } = annotation;\n\n\t\tif ( start > record.text.length ) {\n\t\t\tstart = record.text.length;\n\t\t}\n\n\t\tif ( end > record.text.length ) {\n\t\t\tend = record.text.length;\n\t\t}\n\n\t\tconst className = ANNOTATION_ATTRIBUTE_PREFIX + annotation.source;\n\t\tconst id = ANNOTATION_ATTRIBUTE_PREFIX + annotation.id;\n\n\t\trecord = applyFormat(\n\t\t\trecord,\n\t\t\t{\n\t\t\t\ttype: FORMAT_NAME,\n\t\t\t\tattributes: {\n\t\t\t\t\tclassName,\n\t\t\t\t\tid,\n\t\t\t\t},\n\t\t\t},\n\t\t\tstart,\n\t\t\tend\n\t\t);\n\t} );\n\n\treturn record;\n}\n\n/**\n * Removes annotations from the given record.\n *\n * @param {Object} record Record to remove annotations from.\n * @return {Object} The cleaned record.\n */\nexport function removeAnnotations( record ) {\n\treturn removeFormat( record, 'core/annotation', 0, record.text.length );\n}\n\n/**\n * Retrieves the positions of annotations inside an array of formats.\n *\n * @param {Array} formats Formats with annotations in there.\n * @return {Object} ID keyed positions of annotations.\n */\nfunction retrieveAnnotationPositions( formats ) {\n\tconst positions = {};\n\n\tformats.forEach( ( characterFormats, i ) => {\n\t\tcharacterFormats = characterFormats || [];\n\t\tcharacterFormats = characterFormats.filter(\n\t\t\t( format ) => format.type === FORMAT_NAME\n\t\t);\n\t\tcharacterFormats.forEach( ( format ) => {\n\t\t\tlet { id } = format.attributes;\n\t\t\tid = id.replace( ANNOTATION_ATTRIBUTE_PREFIX, '' );\n\n\t\t\tif ( ! positions.hasOwnProperty( id ) ) {\n\t\t\t\tpositions[ id ] = {\n\t\t\t\t\tstart: i,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Annotations refer to positions between characters.\n\t\t\t// Formats refer to the character themselves.\n\t\t\t// So we need to adjust for that here.\n\t\t\tpositions[ id ].end = i + 1;\n\t\t} );\n\t} );\n\n\treturn positions;\n}\n\n/**\n * Updates annotations in the state based on positions retrieved from RichText.\n *\n * @param {Array} annotations The annotations that are currently applied.\n * @param {Array} positions The current positions of the given annotations.\n * @param {Object} actions\n * @param {Function} actions.removeAnnotation Function to remove an annotation from the state.\n * @param {Function} actions.updateAnnotationRange Function to update an annotation range in the state.\n */\nfunction updateAnnotationsWithPositions(\n\tannotations,\n\tpositions,\n\t{ removeAnnotation, updateAnnotationRange }\n) {\n\tannotations.forEach( ( currentAnnotation ) => {\n\t\tconst position = positions[ currentAnnotation.id ];\n\t\t// If we cannot find an annotation, delete it.\n\t\tif ( ! position ) {\n\t\t\t// Apparently the annotation has been removed, so remove it from the state:\n\t\t\t// Remove...\n\t\t\tremoveAnnotation( currentAnnotation.id );\n\t\t\treturn;\n\t\t}\n\n\t\tconst { start, end } = currentAnnotation;\n\t\tif ( start !== position.start || end !== position.end ) {\n\t\t\tupdateAnnotationRange(\n\t\t\t\tcurrentAnnotation.id,\n\t\t\t\tposition.start,\n\t\t\t\tposition.end\n\t\t\t);\n\t\t}\n\t} );\n}\n\nexport const annotation = {\n\tname: FORMAT_NAME,\n\ttitle: __( 'Annotation' ),\n\ttagName: 'mark',\n\tclassName: 'annotation-text',\n\tattributes: {\n\t\tclassName: 'class',\n\t\tid: 'id',\n\t},\n\tedit() {\n\t\treturn null;\n\t},\n\t__experimentalGetPropsForEditableTreePreparation(\n\t\tselect,\n\t\t{ richTextIdentifier, blockClientId }\n\t) {\n\t\treturn {\n\t\t\tannotations: select(\n\t\t\t\tSTORE_NAME\n\t\t\t).__experimentalGetAnnotationsForRichText(\n\t\t\t\tblockClientId,\n\t\t\t\trichTextIdentifier\n\t\t\t),\n\t\t};\n\t},\n\t__experimentalCreatePrepareEditableTree( { annotations } ) {\n\t\treturn ( formats, text ) => {\n\t\t\tif ( annotations.length === 0 ) {\n\t\t\t\treturn formats;\n\t\t\t}\n\n\t\t\tlet record = { formats, text };\n\t\t\trecord = applyAnnotations( record, annotations );\n\t\t\treturn record.formats;\n\t\t};\n\t},\n\t__experimentalGetPropsForEditableTreeChangeHandler( dispatch ) {\n\t\treturn {\n\t\t\tremoveAnnotation:\n\t\t\t\tdispatch( STORE_NAME ).__experimentalRemoveAnnotation,\n\t\t\tupdateAnnotationRange:\n\t\t\t\tdispatch( STORE_NAME ).__experimentalUpdateAnnotationRange,\n\t\t};\n\t},\n\t__experimentalCreateOnChangeEditableValue( props ) {\n\t\treturn ( formats ) => {\n\t\t\tconst positions = retrieveAnnotationPositions( formats );\n\t\t\tconst { removeAnnotation, updateAnnotationRange, annotations } =\n\t\t\t\tprops;\n\n\t\t\tupdateAnnotationsWithPositions( annotations, positions, {\n\t\t\t\tremoveAnnotation,\n\t\t\t\tupdateAnnotationRange,\n\t\t\t} );\n\t\t};\n\t},\n};\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAQA,IAAAE,UAAA,GAAAF,OAAA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AAEC,qBAAqB;QAAE1B;MAAY,CAAC,GAC7D8C,KAAK;MAENtB,8BAA8B,CAAExB,WAAW,EAAEiB,SAAS,EAAE;QACvDQ,gBAAgB;QAChBC;MACD,CAAE,CAAC;IACJ,CAAC;EACF;AACD,CAAC;AAACqB,OAAA,CAAA7C,UAAA,GAAAA,UAAA"}
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _richText = require("@wordpress/rich-text");
4
-
5
4
  var _annotation = require("./annotation");
6
-
7
5
  /**
8
6
  * WordPress dependencies
9
7
  */
@@ -11,6 +9,7 @@ var _annotation = require("./annotation");
11
9
  /**
12
10
  * Internal dependencies
13
11
  */
12
+
14
13
  const {
15
14
  name,
16
15
  ...settings
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/format/index.js"],"names":["name","settings","annotation"],"mappings":";;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAM;AAAEA,EAAAA,IAAF;AAAQ,KAAGC;AAAX,IAAwBC,sBAA9B;AAEA,kCAAoBF,IAApB,EAA0BC,QAA1B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerFormatType } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { annotation } from './annotation';\n\nconst { name, ...settings } = annotation;\n\nregisterFormatType( name, settings );\n"]}
1
+ {"version":3,"names":["_richText","require","_annotation","name","settings","annotation","registerFormatType"],"sources":["@wordpress/annotations/src/format/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerFormatType } from '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport { annotation } from './annotation';\n\nconst { name, ...settings } = annotation;\n\nregisterFormatType( name, settings );\n"],"mappings":";;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEE,IAAI;EAAE,GAAGC;AAAS,CAAC,GAAGC,sBAAU;AAExC,IAAAC,4BAAkB,EAAEH,IAAI,EAAEC,QAAS,CAAC"}
package/build/index.js CHANGED
@@ -9,10 +9,7 @@ Object.defineProperty(exports, "store", {
9
9
  return _store.store;
10
10
  }
11
11
  });
12
-
13
12
  require("./format");
14
-
15
13
  require("./block");
16
-
17
14
  var _store = require("./store");
18
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAEA","sourcesContent":["/**\n * Internal dependencies\n */\nimport './format';\nimport './block';\n\nexport { store } from './store';\n"]}
1
+ {"version":3,"names":["require","_store"],"sources":["@wordpress/annotations/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './format';\nimport './block';\n\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;AAGAA,OAAA;AACAA,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA"}
@@ -7,9 +7,7 @@ exports.__experimentalAddAnnotation = __experimentalAddAnnotation;
7
7
  exports.__experimentalRemoveAnnotation = __experimentalRemoveAnnotation;
8
8
  exports.__experimentalRemoveAnnotationsBySource = __experimentalRemoveAnnotationsBySource;
9
9
  exports.__experimentalUpdateAnnotationRange = __experimentalUpdateAnnotationRange;
10
-
11
10
  var _uuid = require("uuid");
12
-
13
11
  /**
14
12
  * External dependencies
15
13
  */
@@ -57,13 +55,12 @@ function __experimentalAddAnnotation({
57
55
  source,
58
56
  selector
59
57
  };
60
-
61
58
  if (selector === 'range') {
62
59
  action.range = range;
63
60
  }
64
-
65
61
  return action;
66
62
  }
63
+
67
64
  /**
68
65
  * Removes an annotation with a specific ID.
69
66
  *
@@ -71,14 +68,13 @@ function __experimentalAddAnnotation({
71
68
  *
72
69
  * @return {Object} Action object.
73
70
  */
74
-
75
-
76
71
  function __experimentalRemoveAnnotation(annotationId) {
77
72
  return {
78
73
  type: 'ANNOTATION_REMOVE',
79
74
  annotationId
80
75
  };
81
76
  }
77
+
82
78
  /**
83
79
  * Updates the range of an annotation.
84
80
  *
@@ -88,8 +84,6 @@ function __experimentalRemoveAnnotation(annotationId) {
88
84
  *
89
85
  * @return {Object} Action object.
90
86
  */
91
-
92
-
93
87
  function __experimentalUpdateAnnotationRange(annotationId, start, end) {
94
88
  return {
95
89
  type: 'ANNOTATION_UPDATE_RANGE',
@@ -98,6 +92,7 @@ function __experimentalUpdateAnnotationRange(annotationId, start, end) {
98
92
  end
99
93
  };
100
94
  }
95
+
101
96
  /**
102
97
  * Removes all annotations of a specific source.
103
98
  *
@@ -105,8 +100,6 @@ function __experimentalUpdateAnnotationRange(annotationId, start, end) {
105
100
  *
106
101
  * @return {Object} Action object.
107
102
  */
108
-
109
-
110
103
  function __experimentalRemoveAnnotationsBySource(source) {
111
104
  return {
112
105
  type: 'ANNOTATION_REMOVE_SOURCE',
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/store/actions.js"],"names":["__experimentalAddAnnotation","blockClientId","richTextIdentifier","range","selector","source","id","action","type","__experimentalRemoveAnnotation","annotationId","__experimentalUpdateAnnotationRange","start","end","__experimentalRemoveAnnotationsBySource"],"mappings":";;;;;;;;;;AAGA;;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,SAASA,2BAAT,CAAsC;AAC5CC,EAAAA,aAD4C;AAE5CC,EAAAA,kBAAkB,GAAG,IAFuB;AAG5CC,EAAAA,KAAK,GAAG,IAHoC;AAI5CC,EAAAA,QAAQ,GAAG,OAJiC;AAK5CC,EAAAA,MAAM,GAAG,SALmC;AAM5CC,EAAAA,EAAE,GAAG;AANuC,CAAtC,EAOH;AACH,QAAMC,MAAM,GAAG;AACdC,IAAAA,IAAI,EAAE,gBADQ;AAEdF,IAAAA,EAFc;AAGdL,IAAAA,aAHc;AAIdC,IAAAA,kBAJc;AAKdG,IAAAA,MALc;AAMdD,IAAAA;AANc,GAAf;;AASA,MAAKA,QAAQ,KAAK,OAAlB,EAA4B;AAC3BG,IAAAA,MAAM,CAACJ,KAAP,GAAeA,KAAf;AACA;;AAED,SAAOI,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,8BAAT,CAAyCC,YAAzC,EAAwD;AAC9D,SAAO;AACNF,IAAAA,IAAI,EAAE,mBADA;AAENE,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,mCAAT,CACND,YADM,EAENE,KAFM,EAGNC,GAHM,EAIL;AACD,SAAO;AACNL,IAAAA,IAAI,EAAE,yBADA;AAENE,IAAAA,YAFM;AAGNE,IAAAA,KAHM;AAINC,IAAAA;AAJM,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,uCAAT,CAAkDT,MAAlD,EAA2D;AACjE,SAAO;AACNG,IAAAA,IAAI,EAAE,0BADA;AAENH,IAAAA;AAFM,GAAP;AAIA","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"]}
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"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.STORE_NAME = void 0;
7
-
8
7
  /**
9
8
  * The identifier for the data store.
10
9
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/store/constants.js"],"names":["STORE_NAME"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAG,kBAAnB","sourcesContent":["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/annotations';\n"]}
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,GAAG,kBAAkB;AAACC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
@@ -1,26 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.store = void 0;
9
-
10
8
  var _data = require("@wordpress/data");
11
-
12
9
  var _reducer = _interopRequireDefault(require("./reducer"));
13
-
14
10
  var selectors = _interopRequireWildcard(require("./selectors"));
15
-
16
11
  var actions = _interopRequireWildcard(require("./actions"));
17
-
18
12
  var _constants = require("./constants");
19
-
20
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
15
  /**
25
16
  * WordPress dependencies
26
17
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/store/index.js"],"names":["store","STORE_NAME","reducer","selectors","actions"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;;;;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B;AAClDC,EAAAA,OAAO,EAAPA,gBADkD;AAElDC,EAAAA,SAFkD;AAGlDC,EAAAA;AAHkD,CAA9B,CAAd;;AAMP,oBAAUJ,KAAV","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"]}
1
+ {"version":3,"names":["_data","require","_reducer","_interopRequireDefault","selectors","_interopRequireWildcard","actions","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","store","createReduxStore","STORE_NAME","reducer","exports","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,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAJ,wBAAAQ,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAfzC;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,KAAK,GAAG,IAAAC,sBAAgB,EAAEC,qBAAU,EAAE;EAClDC,OAAO,EAAPA,gBAAO;EACP7B,SAAS;EACTE;AACD,CAAE,CAAC;AAAC4B,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AAEJ,IAAAK,cAAQ,EAAEL,KAAM,CAAC"}
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.annotations = annotations;
7
7
  exports.default = void 0;
8
-
9
8
  /**
10
9
  * Filters an array based on the predicate, but keeps the reference the same if
11
10
  * the array hasn't changed.
@@ -19,6 +18,7 @@ function filterWithReference(collection, predicate) {
19
18
  const filteredCollection = collection.filter(predicate);
20
19
  return collection.length === filteredCollection.length ? collection : filteredCollection;
21
20
  }
21
+
22
22
  /**
23
23
  * Creates a new object with the same keys, but with `callback()` called as
24
24
  * a transformer function on each of the values.
@@ -27,22 +27,21 @@ function filterWithReference(collection, predicate) {
27
27
  * @param {Function} callback The function to transform each object value.
28
28
  * @return {Array} Transformed object.
29
29
  */
30
-
31
-
32
- const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({ ...acc,
30
+ const mapValues = (obj, callback) => Object.entries(obj).reduce((acc, [key, value]) => ({
31
+ ...acc,
33
32
  [key]: callback(value)
34
33
  }), {});
34
+
35
35
  /**
36
36
  * Verifies whether the given annotations is a valid annotation.
37
37
  *
38
38
  * @param {Object} annotation The annotation to verify.
39
39
  * @return {boolean} Whether the given annotation is valid.
40
40
  */
41
-
42
-
43
41
  function isValidAnnotationRange(annotation) {
44
42
  return typeof annotation.start === 'number' && typeof annotation.end === 'number' && annotation.start <= annotation.end;
45
43
  }
44
+
46
45
  /**
47
46
  * Reducer managing annotations.
48
47
  *
@@ -51,11 +50,8 @@ function isValidAnnotationRange(annotation) {
51
50
  *
52
51
  * @return {Array} Updated state.
53
52
  */
54
-
55
-
56
53
  function annotations(state = {}, action) {
57
54
  var _state$blockClientId;
58
-
59
55
  switch (action.type) {
60
56
  case 'ANNOTATION_ADD':
61
57
  const blockClientId = action.blockClientId;
@@ -67,42 +63,38 @@ function annotations(state = {}, action) {
67
63
  selector: action.selector,
68
64
  range: action.range
69
65
  };
70
-
71
66
  if (newAnnotation.selector === 'range' && !isValidAnnotationRange(newAnnotation.range)) {
72
67
  return state;
73
68
  }
74
-
75
69
  const previousAnnotationsForBlock = (_state$blockClientId = state?.[blockClientId]) !== null && _state$blockClientId !== void 0 ? _state$blockClientId : [];
76
- return { ...state,
70
+ return {
71
+ ...state,
77
72
  [blockClientId]: [...previousAnnotationsForBlock, newAnnotation]
78
73
  };
79
-
80
74
  case 'ANNOTATION_REMOVE':
81
75
  return mapValues(state, annotationsForBlock => {
82
76
  return filterWithReference(annotationsForBlock, annotation => {
83
77
  return annotation.id !== action.annotationId;
84
78
  });
85
79
  });
86
-
87
80
  case 'ANNOTATION_UPDATE_RANGE':
88
81
  return mapValues(state, annotationsForBlock => {
89
82
  let hasChangedRange = false;
90
83
  const newAnnotations = annotationsForBlock.map(annotation => {
91
84
  if (annotation.id === action.annotationId) {
92
85
  hasChangedRange = true;
93
- return { ...annotation,
86
+ return {
87
+ ...annotation,
94
88
  range: {
95
89
  start: action.start,
96
90
  end: action.end
97
91
  }
98
92
  };
99
93
  }
100
-
101
94
  return annotation;
102
95
  });
103
96
  return hasChangedRange ? newAnnotations : annotationsForBlock;
104
97
  });
105
-
106
98
  case 'ANNOTATION_REMOVE_SOURCE':
107
99
  return mapValues(state, annotationsForBlock => {
108
100
  return filterWithReference(annotationsForBlock, annotation => {
@@ -110,10 +102,8 @@ function annotations(state = {}, action) {
110
102
  });
111
103
  });
112
104
  }
113
-
114
105
  return state;
115
106
  }
116
-
117
107
  var _default = annotations;
118
108
  exports.default = _default;
119
109
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/annotations/src/store/reducer.js"],"names":["filterWithReference","collection","predicate","filteredCollection","filter","length","mapValues","obj","callback","Object","entries","reduce","acc","key","value","isValidAnnotationRange","annotation","start","end","annotations","state","action","type","blockClientId","newAnnotation","id","richTextIdentifier","source","selector","range","previousAnnotationsForBlock","annotationsForBlock","annotationId","hasChangedRange","newAnnotations","map"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAT,CAA8BC,UAA9B,EAA0CC,SAA1C,EAAsD;AACrD,QAAMC,kBAAkB,GAAGF,UAAU,CAACG,MAAX,CAAmBF,SAAnB,CAA3B;AAEA,SAAOD,UAAU,CAACI,MAAX,KAAsBF,kBAAkB,CAACE,MAAzC,GACJJ,UADI,GAEJE,kBAFH;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,SAAS,GAAG,CAAEC,GAAF,EAAOC,QAAP,KACjBC,MAAM,CAACC,OAAP,CAAgBH,GAAhB,EAAsBI,MA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AAS,CAAEc,KAAF,EAAWW,mBAAF,IAA2B;AACnD,eAAO/B,mBAAmB,CACzB+B,mBADyB,EAEvBf,UAAF,IAAkB;AACjB,iBAAOA,UAAU,CAACS,EAAX,KAAkBJ,MAAM,CAACW,YAAhC;AACA,SAJwB,CAA1B;AAMA,OAPe,CAAhB;;AASD,SAAK,yBAAL;AACC,aAAO1B,SAAS,CAAEc,KAAF,EAAWW,mBAAF,IAA2B;AACnD,YAAIE,eAAe,GAAG,KAAtB;AAEA,cAAMC,cAAc,GAAGH,mBAAmB,CAACI,GAApB,CACpBnB,UAAF,IAAkB;AACjB,cAAKA,UAAU,CAACS,EAAX,KAAkBJ,MAAM,CAACW,YAA9B,EAA6C;AAC5CC,YAAAA,eAAe,GAAG,IAAlB;AACA,mBAAO,EACN,GAAGjB,UADG;AAENa,cAAAA,KAAK,EAAE;AACNZ,gBAAAA,KAAK,EAAEI,MAAM,CAACJ,KADR;AAENC,gBAAAA,GAAG,EAAEG,MAAM,CAACH;AAFN;AAFD,aAAP;AAOA;;AAED,iBAAOF,UAAP;AACA,SAdqB,CAAvB;AAiBA,eAAOiB,eAAe,GAAGC,cAAH,GAAoBH,mBAA1C;AACA,OArBe,CAAhB;;AAuBD,SAAK,0BAAL;AACC,aAAOzB,SAAS,CAAEc,KAAF,EAAWW,mBAAF,IAA2B;AACnD,eAAO/B,mBAAmB,CACzB+B,mBADyB,EAEvBf,UAAF,IAAkB;AACjB,iBAAOA,UAAU,CAACW,MAAX,KAAsBN,MAAM,CAACM,MAApC;AACA,SAJwB,CAA1B;AAMA,OAPe,CAAhB;AAhEF;;AA0EA,SAAOP,KAAP;AACA;;eAEcD,W","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"]}
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;AAC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