@contrail/documents 1.15.0 → 1.16.0-alpha.96c651c
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,6 +5,16 @@ 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.16.0] - 2026-08-28
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `ASSET_VIEW_TEMPLATE` and its `asset-view` entry in `ComponentRegistry` — the component definition for an asset card. Image-forward: one image bound to the asset's viewable, one text row bound to `asset.name`. Consumers resolve it by slug through `DocumentElementFactory.createComponent('asset-view', …)`.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- `DocumentElementPropertyBindingHandler` only unwrapped `viewable.content` when it was an array, which is the item shape. An asset's `content` is a single object, so asset viewables never resolved `alternateUrls.originalFile`, and an SVG asset's high-resolution url fell back to a raster derivative instead of its source file. Both shapes are now handled; item viewables still select the record matching `primaryViewableId`.
|
|
17
|
+
|
|
8
18
|
## [1.15.0] - 2026-08-21
|
|
9
19
|
|
|
10
20
|
### Added
|
|
@@ -353,6 +353,46 @@ export declare const PATTERN_VIEW_TEMPLATE: {
|
|
|
353
353
|
};
|
|
354
354
|
})[];
|
|
355
355
|
};
|
|
356
|
+
export declare const ASSET_VIEW_TEMPLATE: {
|
|
357
|
+
elements: ({
|
|
358
|
+
type: string;
|
|
359
|
+
size: {
|
|
360
|
+
width: number;
|
|
361
|
+
height: number;
|
|
362
|
+
};
|
|
363
|
+
style: {
|
|
364
|
+
background: {
|
|
365
|
+
size: BackgroundSizeType;
|
|
366
|
+
};
|
|
367
|
+
font?: undefined;
|
|
368
|
+
};
|
|
369
|
+
propertyBindings: {
|
|
370
|
+
url: string;
|
|
371
|
+
text?: undefined;
|
|
372
|
+
};
|
|
373
|
+
position?: undefined;
|
|
374
|
+
} | {
|
|
375
|
+
type: string;
|
|
376
|
+
position: {
|
|
377
|
+
x: number;
|
|
378
|
+
y: number;
|
|
379
|
+
};
|
|
380
|
+
size: {
|
|
381
|
+
height: number;
|
|
382
|
+
width: number;
|
|
383
|
+
};
|
|
384
|
+
style: {
|
|
385
|
+
font: {
|
|
386
|
+
size: number;
|
|
387
|
+
};
|
|
388
|
+
background?: undefined;
|
|
389
|
+
};
|
|
390
|
+
propertyBindings: {
|
|
391
|
+
text: string;
|
|
392
|
+
url?: undefined;
|
|
393
|
+
};
|
|
394
|
+
})[];
|
|
395
|
+
};
|
|
356
396
|
export declare const ITEM_VIEW: {
|
|
357
397
|
slug: string;
|
|
358
398
|
defaultTemplate: {
|
|
@@ -717,6 +757,49 @@ export declare const PATTERN_VIEW: {
|
|
|
717
757
|
})[];
|
|
718
758
|
};
|
|
719
759
|
};
|
|
760
|
+
export declare const ASSET_VIEW: {
|
|
761
|
+
slug: string;
|
|
762
|
+
defaultTemplate: {
|
|
763
|
+
elements: ({
|
|
764
|
+
type: string;
|
|
765
|
+
size: {
|
|
766
|
+
width: number;
|
|
767
|
+
height: number;
|
|
768
|
+
};
|
|
769
|
+
style: {
|
|
770
|
+
background: {
|
|
771
|
+
size: BackgroundSizeType;
|
|
772
|
+
};
|
|
773
|
+
font?: undefined;
|
|
774
|
+
};
|
|
775
|
+
propertyBindings: {
|
|
776
|
+
url: string;
|
|
777
|
+
text?: undefined;
|
|
778
|
+
};
|
|
779
|
+
position?: undefined;
|
|
780
|
+
} | {
|
|
781
|
+
type: string;
|
|
782
|
+
position: {
|
|
783
|
+
x: number;
|
|
784
|
+
y: number;
|
|
785
|
+
};
|
|
786
|
+
size: {
|
|
787
|
+
height: number;
|
|
788
|
+
width: number;
|
|
789
|
+
};
|
|
790
|
+
style: {
|
|
791
|
+
font: {
|
|
792
|
+
size: number;
|
|
793
|
+
};
|
|
794
|
+
background?: undefined;
|
|
795
|
+
};
|
|
796
|
+
propertyBindings: {
|
|
797
|
+
text: string;
|
|
798
|
+
url?: undefined;
|
|
799
|
+
};
|
|
800
|
+
})[];
|
|
801
|
+
};
|
|
802
|
+
};
|
|
720
803
|
export declare class ComponentRegistry {
|
|
721
804
|
private static componentDefinitionMap;
|
|
722
805
|
static getComponentDefinition(slug: string): ComponentDefinition;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ComponentRegistry = exports.PATTERN_VIEW = exports.COLOR_VIEW = exports.ITEM_VIEW_V3 = exports.ITEM_VIEW_V2 = exports.ITEM_VIEW = exports.PATTERN_VIEW_TEMPLATE = exports.COLOR_VIEW_TEMPLATE = exports.ITEM_VIEW_TEMPLATE_V3 = exports.ITEM_VIEW_TEMPLATE_V2 = exports.ITEM_VIEW_TEMPLATE = void 0;
|
|
3
|
+
exports.ComponentRegistry = exports.ASSET_VIEW = exports.PATTERN_VIEW = exports.COLOR_VIEW = exports.ITEM_VIEW_V3 = exports.ITEM_VIEW_V2 = exports.ITEM_VIEW = exports.ASSET_VIEW_TEMPLATE = exports.PATTERN_VIEW_TEMPLATE = exports.COLOR_VIEW_TEMPLATE = exports.ITEM_VIEW_TEMPLATE_V3 = exports.ITEM_VIEW_TEMPLATE_V2 = exports.ITEM_VIEW_TEMPLATE = void 0;
|
|
4
4
|
const document_element_constants_1 = require("../document-element-constants");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
exports.ITEM_VIEW_TEMPLATE = {
|
|
@@ -202,6 +202,27 @@ exports.PATTERN_VIEW_TEMPLATE = {
|
|
|
202
202
|
},
|
|
203
203
|
],
|
|
204
204
|
};
|
|
205
|
+
exports.ASSET_VIEW_TEMPLATE = {
|
|
206
|
+
elements: [
|
|
207
|
+
{
|
|
208
|
+
type: 'image',
|
|
209
|
+
size: { width: 125, height: 125 },
|
|
210
|
+
style: { background: { size: types_1.BackgroundSizeType.CONTAIN } },
|
|
211
|
+
propertyBindings: { url: 'viewable.mediumViewableDownloadUrl' },
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
type: 'text',
|
|
215
|
+
position: { x: 0, y: 126 },
|
|
216
|
+
size: { height: 25, width: 125 },
|
|
217
|
+
style: {
|
|
218
|
+
font: {
|
|
219
|
+
size: 8,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
propertyBindings: { text: 'asset.name' },
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
};
|
|
205
226
|
exports.ITEM_VIEW = {
|
|
206
227
|
slug: 'item-view',
|
|
207
228
|
defaultTemplate: exports.ITEM_VIEW_TEMPLATE,
|
|
@@ -222,6 +243,10 @@ exports.PATTERN_VIEW = {
|
|
|
222
243
|
slug: 'pattern-view',
|
|
223
244
|
defaultTemplate: exports.PATTERN_VIEW_TEMPLATE,
|
|
224
245
|
};
|
|
246
|
+
exports.ASSET_VIEW = {
|
|
247
|
+
slug: 'asset-view',
|
|
248
|
+
defaultTemplate: exports.ASSET_VIEW_TEMPLATE,
|
|
249
|
+
};
|
|
225
250
|
class ComponentRegistry {
|
|
226
251
|
static getComponentDefinition(slug) {
|
|
227
252
|
if (!this.componentDefinitionMap) {
|
|
@@ -236,6 +261,7 @@ class ComponentRegistry {
|
|
|
236
261
|
this.componentDefinitionMap.set('item-view-v3', exports.ITEM_VIEW_V3);
|
|
237
262
|
this.componentDefinitionMap.set('color-view', exports.COLOR_VIEW);
|
|
238
263
|
this.componentDefinitionMap.set('pattern-view', exports.PATTERN_VIEW);
|
|
264
|
+
this.componentDefinitionMap.set('asset-view', exports.ASSET_VIEW);
|
|
239
265
|
}
|
|
240
266
|
}
|
|
241
267
|
exports.ComponentRegistry = ComponentRegistry;
|
|
@@ -46,10 +46,13 @@ class DocumentElementPropertyBindingHandler {
|
|
|
46
46
|
let originalFile;
|
|
47
47
|
let viewableObject;
|
|
48
48
|
const content = (_f = model === null || model === void 0 ? void 0 : model.viewable) === null || _f === void 0 ? void 0 : _f.content;
|
|
49
|
-
if ((content
|
|
49
|
+
if (Array.isArray(content) && content.length > 0) {
|
|
50
50
|
const primaryContent = content.find((c) => { var _a; return (c === null || c === void 0 ? void 0 : c.id) === ((_a = model === null || model === void 0 ? void 0 : model.viewable) === null || _a === void 0 ? void 0 : _a.primaryViewableId); });
|
|
51
51
|
viewableObject = primaryContent;
|
|
52
52
|
}
|
|
53
|
+
else if (content && !Array.isArray(content)) {
|
|
54
|
+
viewableObject = content;
|
|
55
|
+
}
|
|
53
56
|
else {
|
|
54
57
|
viewableObject = model === null || model === void 0 ? void 0 : model.viewable;
|
|
55
58
|
}
|