@contrail/documents 1.18.0-alpha.c618827 → 1.18.0
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
|
@@ -5,16 +5,12 @@ All notable changes to `@contrail/documents` are documented here.
|
|
|
5
5
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [1.18.0] - 2026-09-
|
|
8
|
+
## [1.18.0] - 2026-09-10
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
-
- `
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Fixed
|
|
16
|
-
|
|
17
|
-
- `updateSizeAndPosition` no longer reserves space above the thumbnail for an annotation row that renders nothing. `calculateAnnotationHeight` returned a flat `fontSize + ANNOTATION_PADDING_Y` minimum even when the row was hidden or the item had no annotations, pushing the thumbnail down ~8px on every such card (DESIGN-150). It now returns `0` in those cases and the thumbnail sits at the card origin. Cards whose row does show a badge are unchanged.
|
|
12
|
+
- `DocumentChange.gestureId?: string` — optional marker a producer sets to correlate the
|
|
13
|
+
actions of one user gesture across a batch.
|
|
18
14
|
|
|
19
15
|
## [1.17.0] - 2026-09-09
|
|
20
16
|
|
|
@@ -15,8 +15,6 @@ export interface ScaledItemCardResult {
|
|
|
15
15
|
export declare class ItemComponentService {
|
|
16
16
|
static isItemComponent(element: DocumentElement): boolean;
|
|
17
17
|
static isThumbnailOnlyComponent(element: DocumentElement): boolean;
|
|
18
|
-
static isAnnotationRowEmpty(annotationElement: DocumentElement, annotations?: any[]): boolean;
|
|
19
|
-
static getAnnotationRowHeight(annotationElement: DocumentElement, annotations?: any[], width?: number): number;
|
|
20
18
|
static updateSizeAndPosition(propertyElements: any[], componentElement: DocumentElement, annotatedElements?: any[]): any;
|
|
21
19
|
private static getYMargin;
|
|
22
20
|
private static calculateAnnotationHeight;
|
|
@@ -17,30 +17,6 @@ class ItemComponentService {
|
|
|
17
17
|
const imageElement = element.elements.find((e) => e.type == 'image');
|
|
18
18
|
return (!annotationElement || annotationElement.isHidden) && imageElement && !imageElement.isHidden;
|
|
19
19
|
}
|
|
20
|
-
static isAnnotationRowEmpty(annotationElement, annotations = []) {
|
|
21
|
-
if (annotationElement === null || annotationElement === void 0 ? void 0 : annotationElement.isHidden) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
return !(annotations === null || annotations === void 0 ? void 0 : annotations.some((annotation) => (annotation === null || annotation === void 0 ? void 0 : annotation.category) === 'property'));
|
|
25
|
-
}
|
|
26
|
-
static getAnnotationRowHeight(annotationElement, annotations = [], width = exports.DEFAULT_THUMBNAIL_WIDTH) {
|
|
27
|
-
var _a, _b;
|
|
28
|
-
if (this.isAnnotationRowEmpty(annotationElement, annotations)) {
|
|
29
|
-
return 0;
|
|
30
|
-
}
|
|
31
|
-
const annotationSize = ((_b = (_a = annotationElement === null || annotationElement === void 0 ? void 0 : annotationElement.style) === null || _a === void 0 ? void 0 : _a.font) === null || _b === void 0 ? void 0 : _b.size) || document_element_constants_1.ANNOTATION_IMG_SIZE;
|
|
32
|
-
const propertyAnnotations = annotations.filter((annotation) => (annotation === null || annotation === void 0 ? void 0 : annotation.category) === 'property');
|
|
33
|
-
let height = annotationSize + document_element_constants_1.ANNOTATION_PADDING_Y;
|
|
34
|
-
let count = 0;
|
|
35
|
-
propertyAnnotations.forEach(() => {
|
|
36
|
-
if ((count + 1) * annotationSize * 1.25 > width) {
|
|
37
|
-
count = 0;
|
|
38
|
-
height = height + annotationSize + document_element_constants_1.ANNOTATION_PADDING_Y;
|
|
39
|
-
}
|
|
40
|
-
count++;
|
|
41
|
-
});
|
|
42
|
-
return height;
|
|
43
|
-
}
|
|
44
20
|
static updateSizeAndPosition(propertyElements, componentElement, annotatedElements = []) {
|
|
45
21
|
var _a, _b, _c, _d;
|
|
46
22
|
const newElements = [];
|
|
@@ -88,11 +64,9 @@ class ItemComponentService {
|
|
|
88
64
|
lastYPosition = element.position.y;
|
|
89
65
|
}
|
|
90
66
|
const annotationHeight = this.calculateAnnotationHeight(element, componentElement, width, annotatedElements);
|
|
67
|
+
lastYPosition = lastYPosition + annotationHeight;
|
|
91
68
|
if (annotationHeight === 0 && index === 0) {
|
|
92
|
-
lastYPosition =
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
lastYPosition = lastYPosition + annotationHeight;
|
|
69
|
+
lastYPosition = lastYPosition + document_element_constants_1.ANNOTATION_IMG_SIZE;
|
|
96
70
|
}
|
|
97
71
|
}
|
|
98
72
|
element.size.width = width;
|
|
@@ -138,8 +112,28 @@ class ItemComponentService {
|
|
|
138
112
|
return marginY;
|
|
139
113
|
}
|
|
140
114
|
static calculateAnnotationHeight(element, componentElement, width, annotatedElements = []) {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
const annotationSize = ((_b = (_a = element.style) === null || _a === void 0 ? void 0 : _a.font) === null || _b === void 0 ? void 0 : _b.size) || document_element_constants_1.ANNOTATION_IMG_SIZE;
|
|
117
|
+
let height = annotationSize + document_element_constants_1.ANNOTATION_PADDING_Y;
|
|
118
|
+
let xPos = 0;
|
|
141
119
|
const annotatedElement = annotatedElements.find((elem) => elem.id === componentElement.id);
|
|
142
|
-
|
|
120
|
+
if (!annotatedElement || element.isHidden) {
|
|
121
|
+
return height;
|
|
122
|
+
}
|
|
123
|
+
const annotations = annotatedElement.annotations.filter((annotation) => annotation.category === 'property');
|
|
124
|
+
if (annotations.length > 0) {
|
|
125
|
+
let count = 0;
|
|
126
|
+
annotations === null || annotations === void 0 ? void 0 : annotations.forEach((annotation) => {
|
|
127
|
+
if ((count + 1) * annotationSize * 1.25 > width) {
|
|
128
|
+
count = 0;
|
|
129
|
+
xPos = -width * 0.5;
|
|
130
|
+
height = height + annotationSize + document_element_constants_1.ANNOTATION_PADDING_Y;
|
|
131
|
+
}
|
|
132
|
+
xPos = xPos + annotationSize * 1.25;
|
|
133
|
+
count++;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return height;
|
|
143
137
|
}
|
|
144
138
|
static getImageElement(element) {
|
|
145
139
|
var _a;
|