@contrail/documents 2.4.0-alpha.bce8caa → 2.4.0-alpha.cb23d8e

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.
package/CHANGELOG.md CHANGED
@@ -13,15 +13,12 @@ Also shipped on the 1.x line as 1.21.0.
13
13
 
14
14
  - `DocumentContainerService.buildIndex` and `DocumentContainerIndex` — which containers hold which
15
15
  elements, for one document, resolved once and read back by lookup. A container is a frame or a
16
- section, described by a `ContainerKind` carrying `elementType` and `nests`. An element belongs to
17
- the container whose box covers its anchor point and which is drawn below it, unless the element's
18
- own box encloses that container or the element is a group holding it. `nests` decides the shape of
19
- the answer: sections nest, so an element in a section inside another is in both, and the chain
20
- requires the inner container to be drawn above the outer; frames do not, so an element covered by
21
- two frames is in the topmost. A container of another kind is placed by the same rules as any
22
- element, so a frame can be in a section and a section drawn above a frame is in that frame. The
23
- rule is written out in `src/containers/DOCUMENT_CONTAINERS_SPEC.md`, which the code is measured
24
- against.
16
+ section, described by a `ContainerKind` carrying `elementType`, `nests` and `layer`. An element
17
+ belongs to the container whose box covers its anchor point and which is drawn below it. Nesting
18
+ gives a path with one container per depth, the later-drawn one winning where two cross. A
19
+ container is only ever content of a kind layered behind it, so a frame belongs to a section and a
20
+ section never to a frame. Shapes wider and taller than the container, and groups holding it, are
21
+ excluded.
25
22
  - `SECTION_ELEMENT_TYPE`, `FRAME_ELEMENT_TYPE` and `SHAPE_ELEMENT_TYPES` in
26
23
  `document-element-constants`, so the rule above has one definition rather than one per app.
27
24
  - `DocumentContainerUtil` — the container geometry as statics, with `anchorFor` for a caller
@@ -54,17 +51,10 @@ Also shipped on the 1.x line as 1.21.0.
54
51
  - The corner is the rotated one (VIBE-9567). A 200x20 text turned on its side draws as a 20x200
55
52
  column, and its unrotated `position` can sit well clear of the frame it is visibly on, which
56
53
  reported "Move to a frame" for a vertical text the user could see was placed correctly.
57
- - An element covering a container is not inside it, whatever its type. This replaces a rule that
58
- excluded only shapes wider and taller than the container, which let a background image join the
59
- frame it covered and needed an exemption for dynamic text, whose size the container decides. An
60
- unrotated dynamic text cannot be excluded by enclosure, since its anchor is the corner of the box
61
- it would have to cover with.
62
- - `isDynamicText` requires a `propertyBindings.text` binding, which is the one the value is read
63
- from. The text tool creates an element with empty `propertyBindings` and `propertyBindingsMetaData`
64
- and both are truthy, so an unconfigured text was anchored at its corner while the canvas centred
65
- it.
66
- - A line or callout is measured from the elements it connects even with no stored `position` of its
67
- own, where it was previously left out of the index entirely.
54
+ - A dynamic text is also exempt from the oversized-shape exclusion, which keeps a shape wider and
55
+ taller than a container off it. That rule reads size too, so a dynamic text larger than its frame
56
+ in both directions had two self-consistent answers and kept whichever it started from. The rule
57
+ exists to keep a backdrop shape off a frame it covers, which is not what a dynamic text is doing.
68
58
  - `min` and `max` rendered an infinity sign when every member value was empty. The early return
69
59
  checked the list length before the empty values were filtered out, so `Math.min` of nothing
70
60
  reached the formatter. Both now fall through to `n/a`.
@@ -81,12 +71,9 @@ Also shipped on the 1.x line as 1.21.0.
81
71
  caller holding an element gets the answer the index would give it. Reading `size` directly
82
72
  disagreed for the types whose box is not position plus size: a component's box is built from the
83
73
  rows it draws, and a line's comes from its `lineDefinition`.
84
- - A container path is a containment chain, walked outward from the container the element sits on.
85
- Two containers that merely cross are not a chain, so the later-drawn one takes the element rather
86
- than both claiming it. `containerPathAtPoint` walks the same chain, so a drop preview agrees with
87
- the drop; it applies only the anchor rule, having no element to compare against a container.
88
- - `buildIndex` scans element types before measuring anything, so a document holding no containers
89
- of the kinds asked for returns an empty index without a geometry pass.
74
+ - Container depth counts nesting levels rather than enclosing boxes. Two containers that merely
75
+ cross both enclose anything inside the overlap, so counting ancestors put that inner container a
76
+ level too deep and made `maxDepth` report a level no path could reach.
90
77
 
91
78
  ## [2.3.0] - 2026-09-21
92
79
 
@@ -69,9 +69,12 @@ class DocumentContainerService {
69
69
  }
70
70
  static measure(documentElement, documentElementsById) {
71
71
  var _a, _b;
72
+ if (!(documentElement === null || documentElement === void 0 ? void 0 : documentElement.position)) {
73
+ return null;
74
+ }
72
75
  try {
73
- const start = ((_a = documentElement === null || documentElement === void 0 ? void 0 : documentElement.start) === null || _a === void 0 ? void 0 : _a.id) ? documentElementsById.get(documentElement.start.id) : undefined;
74
- const end = ((_b = documentElement === null || documentElement === void 0 ? void 0 : documentElement.end) === null || _b === void 0 ? void 0 : _b.id) ? documentElementsById.get(documentElement.end.id) : undefined;
76
+ const start = ((_a = documentElement.start) === null || _a === void 0 ? void 0 : _a.id) ? documentElementsById.get(documentElement.start.id) : undefined;
77
+ const end = ((_b = documentElement.end) === null || _b === void 0 ? void 0 : _b.id) ? documentElementsById.get(documentElement.end.id) : undefined;
75
78
  const { x, y, width, height } = document_element_factory_1.DocumentElementFactory.getBoundingClientRectScaled(documentElement, start, end);
76
79
  return document_container_1.DocumentContainerUtil.toCoordinateBox(x, y, width, height);
77
80
  }
@@ -56,9 +56,8 @@ function isContainerBinding(bindingProperty) {
56
56
  }
57
57
  class DynamicTextUtil {
58
58
  static isDynamicText(documentElement) {
59
- var _a;
60
59
  return ((documentElement === null || documentElement === void 0 ? void 0 : documentElement.type) === 'text' &&
61
- !!((_a = documentElement.propertyBindings) === null || _a === void 0 ? void 0 : _a.text) &&
60
+ !!documentElement.propertyBindings &&
62
61
  !!documentElement.propertyBindingsMetaData);
63
62
  }
64
63
  static takesValueFromContainer(bindingProperty) {
@@ -209,7 +208,7 @@ class DynamicTextUtil {
209
208
  }
210
209
  else if (displayFunction === DynamicTextDisplayFunction.UNIQUE_ARRAY) {
211
210
  text = Array.from(new Set(memberValues
212
- .filter((e) => e !== null && e !== undefined && e !== '')
211
+ .filter((e) => e !== null && e !== undefined)
213
212
  .flat()
214
213
  .map((e) => formatter.formatValueForProperty(e, property))))
215
214
  .sort()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "2.4.0-alpha.bce8caa",
3
+ "version": "2.4.0-alpha.cb23d8e",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",