@contrail/documents 1.19.0-alpha.6e25ad5 → 1.19.0-alpha.8326aa7

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
@@ -19,11 +19,6 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
19
19
  are excluded.
20
20
  - `SECTION_ELEMENT_TYPE`, `FRAME_ELEMENT_TYPE` and `SHAPE_ELEMENT_TYPES` in
21
21
  `document-element-constants`, so the rule above has one definition rather than one per app.
22
- - `DocumentElementFactory.getBoundingClientRectScaled` — the space an element covers on the canvas,
23
- with `scale` applied. `getBoundingClientRect` keeps returning the element's own box before scale,
24
- which is what layout works in: `@contrail/document-table` places table members from it, and
25
- scaling it moves a scaled member into a different cell. Anything deciding what an element overlaps
26
- or sits on wants the scaled one.
27
22
 
28
23
  ### Deprecated
29
24
 
@@ -39,10 +34,6 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
39
34
  feed membership meant its own text could choose its container: near an edge the two answers
40
35
  disagreed indefinitely, flipping between a value and "Move to a frame" on every read. Everything
41
36
  else still resolves on its centre.
42
- - A dynamic text is also exempt from the oversized-shape exclusion, which keeps a shape wider and
43
- taller than a container off it. That rule reads size too, so a dynamic text larger than its frame
44
- in both directions had two self-consistent answers and kept whichever it started from. The rule
45
- exists to keep a backdrop shape off a frame it covers, which is not what a dynamic text is doing.
46
37
  - `min` and `max` rendered an infinity sign when every member value was empty. The early return
47
38
  checked the list length before the empty values were filtered out, so `Math.min` of nothing
48
39
  reached the formatter. Both now fall through to `n/a`.
@@ -51,9 +42,12 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
51
42
 
52
43
  ### Changed
53
44
 
54
- - Container membership measures a scaled element from its scaled box, through the new
55
- `getBoundingClientRectScaled` below. A scaled element previously measured at its unscaled size
56
- and could resolve to the wrong container.
45
+ - Container membership measures a scaled element from its scaled box. Scale grows an element from
46
+ its top-left, so it widens the box and moves the centre; a scaled element previously measured at
47
+ its unscaled size and could resolve to the wrong container. Applied in
48
+ `DocumentContainerService`, not in `DocumentElementFactory.getBoundingClientRect`, which is
49
+ unchanged: `@contrail/document-table` sizes table members from that box, and scaling it there
50
+ moved scaled members into different cells.
57
51
 
58
52
  ## [1.18.0] - 2026-09-10
59
53
 
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DocumentContainerService = void 0;
4
4
  const document_element_factory_1 = require("../document-element-factory");
5
- const dynamic_text_util_1 = require("../util/dynamic-text/dynamic-text-util");
6
5
  const document_element_constants_1 = require("../document-element-constants");
7
6
  const container_kind_1 = require("./container-kind");
8
7
  const document_container_index_1 = require("./document-container-index");
@@ -57,17 +56,19 @@ class DocumentContainerService {
57
56
  }));
58
57
  }
59
58
  static measure(documentElement, documentElementsById) {
60
- var _a, _b;
59
+ var _a, _b, _c, _d, _e, _f;
61
60
  if (!(documentElement === null || documentElement === void 0 ? void 0 : documentElement.position)) {
62
61
  return null;
63
62
  }
64
63
  try {
65
64
  const start = ((_a = documentElement.start) === null || _a === void 0 ? void 0 : _a.id) ? documentElementsById.get(documentElement.start.id) : undefined;
66
65
  const end = ((_b = documentElement.end) === null || _b === void 0 ? void 0 : _b.id) ? documentElementsById.get(documentElement.end.id) : undefined;
67
- const { x, y, width, height } = document_element_factory_1.DocumentElementFactory.getBoundingClientRectScaled(documentElement, start, end);
68
- return (0, document_container_1.toCoordinateBox)(x, y, width, height);
66
+ const { x, y, width, height } = document_element_factory_1.DocumentElementFactory.getBoundingClientRect(documentElement, start, end);
67
+ const scaleX = (_d = (_c = documentElement.scale) === null || _c === void 0 ? void 0 : _c.x) !== null && _d !== void 0 ? _d : 1;
68
+ const scaleY = (_f = (_e = documentElement.scale) === null || _e === void 0 ? void 0 : _e.y) !== null && _f !== void 0 ? _f : 1;
69
+ return (0, document_container_1.toCoordinateBox)(x, y, width * scaleX, height * scaleY);
69
70
  }
70
- catch (_c) {
71
+ catch (_g) {
71
72
  return null;
72
73
  }
73
74
  }
@@ -127,8 +128,7 @@ class DocumentContainerService {
127
128
  }
128
129
  static candidateContainers(measured, containers) {
129
130
  const anchor = (0, document_container_1.anchorOf)(measured.documentElement, measured.box);
130
- const isShape = document_element_constants_1.SHAPE_ELEMENT_TYPES.includes(measured.documentElement.type) &&
131
- !dynamic_text_util_1.DynamicTextUtil.isDynamicText(measured.documentElement);
131
+ const isShape = document_element_constants_1.SHAPE_ELEMENT_TYPES.includes(measured.documentElement.type);
132
132
  return containers.filter((container) => {
133
133
  var _a;
134
134
  if (container.id === measured.documentElement.id || measured.drawOrder <= container.drawOrder) {
@@ -22,12 +22,6 @@ export declare class DocumentElementFactory {
22
22
  width: any;
23
23
  height: any;
24
24
  };
25
- static getBoundingClientRectScaled(documentElement: DocumentElement, startElement?: DocumentElement, endElement?: DocumentElement): {
26
- x: any;
27
- y: any;
28
- width: any;
29
- height: any;
30
- };
31
25
  private static getPosition;
32
26
  private static getSize;
33
27
  private static getComponentSize;
@@ -216,16 +216,6 @@ class DocumentElementFactory {
216
216
  height,
217
217
  };
218
218
  }
219
- static getBoundingClientRectScaled(documentElement, startElement, endElement) {
220
- var _a, _b, _c, _d;
221
- const { x, y, width, height } = this.getBoundingClientRect(documentElement, startElement, endElement);
222
- return {
223
- x,
224
- y,
225
- width: width * ((_b = (_a = documentElement.scale) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 1),
226
- height: height * ((_d = (_c = documentElement.scale) === null || _c === void 0 ? void 0 : _c.y) !== null && _d !== void 0 ? _d : 1),
227
- };
228
- }
229
219
  static getPosition(documentElement, startElement, endElement) {
230
220
  var _a, _b;
231
221
  if (documentElement.type === 'line' || documentElement.type === 'callout') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.19.0-alpha.6e25ad5",
3
+ "version": "1.19.0-alpha.8326aa7",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",