@lionweb/utilities 0.6.8-beta.1 → 0.6.8-beta.4

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.
@@ -3,7 +3,7 @@ import { SerializationChunk } from "@lionweb/core";
3
3
  * Removes all annotations from the given {@link SerializationChunk}, i.e.:
4
4
  * * all annotations on nodes in the form of the {@code annotations} property,
5
5
  * * all nodes that can be identified as instances of an {@link Annotation} by being referred to from {@code annotations}.
6
- * It also removes all descendants of all annotations.
6
+ * It also removes all descendants of all annotations (insofar present in the given chunk).
7
7
  * @param serializationChunk - The {@link SerializationChunk}
8
8
  */
9
9
  export declare const withoutAnnotations: (serializationChunk: SerializationChunk) => {
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-remover.d.ts","sourceRoot":"","sources":["../../src/serialization/annotation-remover.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,kBAAkB,EACrB,MAAM,eAAe,CAAA;AAEtB;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,uBAAwB,kBAAkB;;;;CAsBxE,CAAA"}
1
+ {"version":3,"file":"annotation-remover.d.ts","sourceRoot":"","sources":["../../src/serialization/annotation-remover.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,kBAAkB,EACrB,MAAM,eAAe,CAAA;AAEtB;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,uBAAwB,kBAAkB;;;;CAwBxE,CAAA"}
@@ -3,13 +3,15 @@ import { byIdMap } from "@lionweb/core";
3
3
  * Removes all annotations from the given {@link SerializationChunk}, i.e.:
4
4
  * * all annotations on nodes in the form of the {@code annotations} property,
5
5
  * * all nodes that can be identified as instances of an {@link Annotation} by being referred to from {@code annotations}.
6
- * It also removes all descendants of all annotations.
6
+ * It also removes all descendants of all annotations (insofar present in the given chunk).
7
7
  * @param serializationChunk - The {@link SerializationChunk}
8
8
  */
9
9
  export const withoutAnnotations = (serializationChunk) => {
10
10
  const { serializationFormatVersion, languages, nodes } = serializationChunk;
11
11
  const id2node = byIdMap(nodes);
12
- const childIds = (id) => id2node[id].containments.flatMap((containment) => containment.children);
12
+ const childIds = (id) => (id in id2node)
13
+ ? id2node[id].containments.flatMap((containment) => containment.children)
14
+ : [];
13
15
  const descendantIds = (id) => [id, ...childIds(id).flatMap(descendantIds)];
14
16
  const annotationIds = nodes.flatMap((node) => node.annotations); // (are unique, because of parent-child relation)
15
17
  const idsOfNodesToDelete = [
@@ -1 +1 @@
1
- {"version":3,"file":"annotation-remover.js","sourceRoot":"","sources":["../../src/serialization/annotation-remover.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,OAAO,EAGV,MAAM,eAAe,CAAA;AAEtB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,kBAAsC,EAAE,EAAE;IACzE,MAAM,EAAC,0BAA0B,EAAE,SAAS,EAAE,KAAK,EAAC,GAAG,kBAAkB,CAAA;IACzE,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IAC9B,MAAM,QAAQ,GAAG,CAAC,EAAM,EAAE,EAAE,CACxB,OAAO,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC3E,MAAM,aAAa,GAAG,CAAC,EAAM,EAAQ,EAAE,CACnC,CAAC,EAAE,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAA;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA,CAAC,iDAAiD;IACjH,MAAM,kBAAkB,GAAG;QACvB,GAAG,aAAa;QAChB,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;KAC/C,CAAA;IACD,OAAO;QACH,0BAA0B;QAC1B,SAAS;QAC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,GAAG,aAAa,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;KAC/C,CAAA;IACD,OAAO;QACH,0BAA0B;QAC1B,SAAS;QACT,KAAK,EAAE,KAAK;aACP,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,mCAAmC;aAC3F,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACV,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA,CAAG,uEAAuE;YAC/F,OAAO,IAAI,CAAA;QACf,CAAC,CAAC;KACT,CAAA;AACL,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lionweb/utilities",
3
- "version": "0.6.8-beta.1",
3
+ "version": "0.6.8-beta.4",
4
4
  "description": "LionWeb utilities",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,7 @@
15
15
  "url": "https://github.com/LionWeb-io/lionweb-typescript/issues"
16
16
  },
17
17
  "dependencies": {
18
- "@lionweb/core": "0.6.8-beta.1",
18
+ "@lionweb/core": "0.6.8-beta.4",
19
19
  "littoral-templates": "0.2.2",
20
20
  "nanoid": "4.0.2"
21
21
  },