@contrail/documents 1.21.0-alpha.294740f → 1.21.0-alpha.4368075

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.
@@ -21,5 +21,4 @@ export declare class DocumentContainerIndex {
21
21
  private containersOfType;
22
22
  private resolveAll;
23
23
  private containerPath;
24
- private containerPathCopy;
25
24
  }
@@ -23,7 +23,7 @@ class DocumentContainerIndex {
23
23
  return this.resolveAll(this.containerIdsOf(documentElementId, elementType));
24
24
  }
25
25
  containerIdsOf(documentElementId, elementType) {
26
- return this.containerPathCopy(documentElementId, elementType);
26
+ return this.containerPath(documentElementId, elementType);
27
27
  }
28
28
  innermostContainerIdOf(documentElementId, elementType) {
29
29
  const path = this.containerPath(documentElementId, elementType);
@@ -31,7 +31,7 @@ class DocumentContainerIndex {
31
31
  }
32
32
  memberIdsOf(containerId) {
33
33
  var _a;
34
- return [...((_a = this.data.memberIdsByContainerId.get(containerId)) !== null && _a !== void 0 ? _a : [])];
34
+ return (_a = this.data.memberIdsByContainerId.get(containerId)) !== null && _a !== void 0 ? _a : [];
35
35
  }
36
36
  memberDocumentElementsOf(containerId) {
37
37
  const members = [];
@@ -69,8 +69,5 @@ class DocumentContainerIndex {
69
69
  var _a, _b;
70
70
  return (_b = (_a = this.data.containerPathsByDocumentElementId.get(documentElementId)) === null || _a === void 0 ? void 0 : _a.get(elementType)) !== null && _b !== void 0 ? _b : [];
71
71
  }
72
- containerPathCopy(documentElementId, elementType) {
73
- return [...this.containerPath(documentElementId, elementType)];
74
- }
75
72
  }
76
73
  exports.DocumentContainerIndex = DocumentContainerIndex;
@@ -43,14 +43,9 @@ class DocumentContainerUtil {
43
43
  if (!at) {
44
44
  return null;
45
45
  }
46
- try {
47
- const measured = document_element_factory_1.DocumentElementFactory.getBoundingClientRectScaled(Object.assign(Object.assign({}, documentElement), { position: at }), startElement, endElement);
48
- const box = DocumentContainerUtil.toCoordinateBox(measured.x, measured.y, measured.width, measured.height);
49
- return DocumentContainerUtil.anchorOf(documentElement, box);
50
- }
51
- catch (_a) {
52
- return null;
53
- }
46
+ const measured = document_element_factory_1.DocumentElementFactory.getBoundingClientRectScaled(Object.assign(Object.assign({}, documentElement), { position: at }), startElement, endElement);
47
+ const box = DocumentContainerUtil.toCoordinateBox(measured.x, measured.y, measured.width, measured.height);
48
+ return DocumentContainerUtil.anchorOf(documentElement, box);
54
49
  }
55
50
  static containsPoint(box, point) {
56
51
  return point.x >= box.left && point.x <= box.right && point.y >= box.top && point.y <= box.bottom;
@@ -8,9 +8,9 @@ const document_container_1 = require("./document-container");
8
8
  class DocumentContainerService {
9
9
  static buildIndex(documentElements, kinds = container_kind_1.CONTAINER_KINDS) {
10
10
  var _a, _b;
11
- const elements = (documentElements !== null && documentElements !== void 0 ? documentElements : []).filter((element) => !!element);
11
+ const elements = documentElements !== null && documentElements !== void 0 ? documentElements : [];
12
12
  const containerElementTypes = new Set(kinds.map((kind) => kind.elementType));
13
- if (!elements.some((element) => containerElementTypes.has(element.type))) {
13
+ if (!elements.some((element) => containerElementTypes.has(element === null || element === void 0 ? void 0 : element.type))) {
14
14
  return document_container_index_1.DocumentContainerIndex.empty();
15
15
  }
16
16
  const documentElementsById = new Map(elements.map((element) => [element.id, element]));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.21.0-alpha.294740f",
3
+ "version": "1.21.0-alpha.4368075",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",