@contrail/documents 1.21.0-alpha.7411393 → 1.21.0-alpha.9084452

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,6 @@ export type ContainerElementType = typeof FRAME_ELEMENT_TYPE | typeof SECTION_EL
3
3
  export interface ContainerKind {
4
4
  elementType: ContainerElementType;
5
5
  nests: boolean;
6
- canBeContentOf: readonly ContainerElementType[];
7
6
  }
8
7
  export declare const SECTION_KIND: ContainerKind;
9
8
  export declare const FRAME_KIND: ContainerKind;
@@ -2,14 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CONTAINER_KINDS = exports.FRAME_KIND = exports.SECTION_KIND = void 0;
4
4
  const document_element_constants_1 = require("../document-element-constants");
5
- exports.SECTION_KIND = {
6
- elementType: document_element_constants_1.SECTION_ELEMENT_TYPE,
7
- nests: true,
8
- canBeContentOf: [document_element_constants_1.SECTION_ELEMENT_TYPE],
9
- };
10
- exports.FRAME_KIND = {
11
- elementType: document_element_constants_1.FRAME_ELEMENT_TYPE,
12
- nests: false,
13
- canBeContentOf: [document_element_constants_1.SECTION_ELEMENT_TYPE],
14
- };
5
+ exports.SECTION_KIND = { elementType: document_element_constants_1.SECTION_ELEMENT_TYPE, nests: true };
6
+ exports.FRAME_KIND = { elementType: document_element_constants_1.FRAME_ELEMENT_TYPE, nests: false };
15
7
  exports.CONTAINER_KINDS = [exports.SECTION_KIND, exports.FRAME_KIND];
@@ -98,14 +98,8 @@ class DocumentContainerService {
98
98
  if (!containers.length || !measured.box) {
99
99
  return [];
100
100
  }
101
- const ownKind = container_kind_1.CONTAINER_KINDS.find((candidate) => candidate.elementType === measured.documentElement.type);
102
- if (ownKind) {
103
- if (ownKind.elementType === kind.elementType) {
104
- return kind.nests ? document_container_1.DocumentContainerUtil.chain(this.enclosersOf(measured, containers)) : [];
105
- }
106
- if (!ownKind.canBeContentOf.includes(kind.elementType)) {
107
- return [];
108
- }
101
+ if (measured.documentElement.type === kind.elementType) {
102
+ return kind.nests ? document_container_1.DocumentContainerUtil.chain(this.enclosersOf(measured, containers)) : [];
109
103
  }
110
104
  const candidates = this.candidateContainers(measured, containers);
111
105
  return kind.nests ? document_container_1.DocumentContainerUtil.chain(candidates) : document_container_1.DocumentContainerUtil.topmost(candidates);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.21.0-alpha.7411393",
3
+ "version": "1.21.0-alpha.9084452",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",