@vvfx/sdk 0.2.3 → 0.2.4
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/dist/config.d.ts +29 -1
- package/dist/html-overlay/anchor-navigation-runtime.d.ts +1 -0
- package/dist/html-overlay/auto-height-runtime.d.ts +5 -0
- package/dist/html-overlay/manager.d.ts +66 -1
- package/dist/html-overlay/overlay-transform.d.ts +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1241 -227
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1241 -227
- package/dist/index.mjs.map +1 -1
- package/dist/layer-order.d.ts +7 -0
- package/dist/sdk-item/card-item.d.ts +2 -6
- package/dist/sdk.d.ts +47 -2
- package/dist/types.d.ts +77 -18
- package/dist/utils/page-data-utils.d.ts +11 -0
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: TODO
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 赤芍,何即,不择,意绮
|
|
6
|
-
* Version: v0.2.
|
|
6
|
+
* Version: v0.2.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -47185,7 +47185,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47185
47185
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47186
47186
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47187
47187
|
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, regionBoxColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxColor, regionBoxAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxAlpha, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, regionWireframeWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeWidth, regionWireframeColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeColor, regionWireframeAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeAlpha;
|
|
47188
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47188
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty()) && !isCardItem(preSelectedItem)) {
|
|
47189
47189
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47190
47190
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47191
47191
|
}
|
|
@@ -55371,7 +55371,9 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55371
55371
|
return;
|
|
55372
55372
|
}
|
|
55373
55373
|
var selectedItem = (_selectedItems_ = selectedItems[0]) != null ? _selectedItems_ : undefined;
|
|
55374
|
-
|
|
55374
|
+
// html卡片内容在非自动缩放的情况下,拖动的时候内容自适应,因此与智能画板一样,需要默认是自由缩放(即自由改大小)
|
|
55375
|
+
var isSingleAutoFitContentCardItem = selectedItems.length === 1 && selectedItem && isCardItem(selectedItem) && !selectedItem.isAutoScale;
|
|
55376
|
+
var isShiftLockScale = selectedItem && selectedItems.length === 1 && (isFrameItem(selectedItem) || isSingleAutoFitContentCardItem) ? !this.isShiftDown : this.isShiftDown;
|
|
55375
55377
|
var farthestCorner = this.scaleParam.farthestCorner;
|
|
55376
55378
|
var isValidScale = (scaleCorner.x - farthestCorner.x) * (this.cursorPoint.x - farthestCorner.x) > 0 && (scaleCorner.y - farthestCorner.y) * (this.cursorPoint.y - farthestCorner.y) > 0;
|
|
55377
55379
|
if (!isValidScale && this.isLockScale && !this.isShiftDown) {
|
|
@@ -55388,7 +55390,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55388
55390
|
var currentStartScale = startScale.clone().multiply(lastScalar);
|
|
55389
55391
|
var currentScale = worldPosition1.clone().subtract(cornerShift).subtract(center1).applyMatrix(rotationMatrix);
|
|
55390
55392
|
var scalar = new Vector3(1, 1, 1);
|
|
55391
|
-
if (!this.isLockScale ||
|
|
55393
|
+
if (!this.isLockScale || isShiftLockScale) {
|
|
55392
55394
|
scalar.x = isEqual$1(currentStartScale.x, 0) ? 1 : currentScale.x / currentStartScale.x;
|
|
55393
55395
|
scalar.y = isEqual$1(currentStartScale.y, 0) ? 1 : currentScale.y / currentStartScale.y;
|
|
55394
55396
|
scalar.z = isEqual$1(currentStartScale.z, 0) ? 1 : currentScale.z / currentStartScale.z;
|
|
@@ -55445,6 +55447,23 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55445
55447
|
newWidth,
|
|
55446
55448
|
newHeight
|
|
55447
55449
|
], translation1);
|
|
55450
|
+
} else if (isSingleAutoFitContentCardItem && selectedItem && isCardItem(selectedItem)) {
|
|
55451
|
+
var currentWidth1 = selectedItem.pixelWidth;
|
|
55452
|
+
var currentHeight1 = selectedItem.pixelHeight;
|
|
55453
|
+
var newWidth1 = currentWidth1 * resultScalar1.x;
|
|
55454
|
+
var newHeight1 = currentHeight1 * resultScalar1.y;
|
|
55455
|
+
this._pageDataUtils.resizeCardItem(selectedItem.id, [
|
|
55456
|
+
newWidth1,
|
|
55457
|
+
newHeight1
|
|
55458
|
+
], translation1);
|
|
55459
|
+
void this._pageDataUtils.setItemProperty({
|
|
55460
|
+
itemId: selectedItem.id,
|
|
55461
|
+
type: SDKItemType.CARD,
|
|
55462
|
+
property: {
|
|
55463
|
+
width: newWidth1,
|
|
55464
|
+
height: newHeight1
|
|
55465
|
+
}
|
|
55466
|
+
});
|
|
55448
55467
|
} else {
|
|
55449
55468
|
// 普通元素的缩放逻辑
|
|
55450
55469
|
selectedItems.forEach(function(item) {
|
|
@@ -55769,6 +55788,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55769
55788
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55770
55789
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55771
55790
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55791
|
+
var isSingleCardItem = isCardItem(selectedItem);
|
|
55772
55792
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55773
55793
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55774
55794
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55808,9 +55828,11 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55808
55828
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55809
55829
|
// 根据box获取边缘线
|
|
55810
55830
|
var corners = this.wireframe.box.corners;
|
|
55811
|
-
|
|
55812
|
-
|
|
55813
|
-
|
|
55831
|
+
if (!isSingleCardItem) {
|
|
55832
|
+
corners.forEach(function(corner, i) {
|
|
55833
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55834
|
+
});
|
|
55835
|
+
}
|
|
55814
55836
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55815
55837
|
// 成组暂不支持缩放
|
|
55816
55838
|
if (selectedItems.length === 1) {
|
|
@@ -59665,12 +59687,6 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
|
|
|
59665
59687
|
/**
|
|
59666
59688
|
* @description SDKItem position 属性的数字精度(保留小数位数)
|
|
59667
59689
|
*/ var POSITION_PRECISION = 4;
|
|
59668
|
-
function isCardHTMLContentValue(value) {
|
|
59669
|
-
return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
|
|
59670
|
-
}
|
|
59671
|
-
function isCardHTMLValue(value) {
|
|
59672
|
-
return isCardHTMLContentValue(value == null ? void 0 : value.content);
|
|
59673
|
-
}
|
|
59674
59690
|
var PageDataUtils = /*#__PURE__*/ function() {
|
|
59675
59691
|
function PageDataUtils(player, container, emitter, sdk) {
|
|
59676
59692
|
this.player = player;
|
|
@@ -60433,6 +60449,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60433
60449
|
}
|
|
60434
60450
|
}
|
|
60435
60451
|
var isLocked = (_this_getSDKItem = this.getSDKItem(playerItem.getInstanceId())) == null ? void 0 : _this_getSDKItem.isLocked;
|
|
60452
|
+
// 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
|
|
60453
|
+
var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
|
|
60436
60454
|
// 创建基础选项
|
|
60437
60455
|
var baseOptions = {
|
|
60438
60456
|
id: playerItem.getInstanceId(),
|
|
@@ -60444,12 +60462,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60444
60462
|
endBehavior: playerItem.endBehavior,
|
|
60445
60463
|
visible: isVisible,
|
|
60446
60464
|
isLocked: isLocked,
|
|
60447
|
-
isCoreEditable: isCoreEditable
|
|
60465
|
+
isCoreEditable: isCoreEditable,
|
|
60466
|
+
extension: existingSDKItem == null ? void 0 : existingSDKItem.extension
|
|
60448
60467
|
};
|
|
60449
60468
|
// 根据类型创建对应的 SDKItem 类实例
|
|
60450
60469
|
var sdkItem;
|
|
60451
|
-
// 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
|
|
60452
|
-
var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
|
|
60453
60470
|
// 如果找到了现有 SDKItem,根据 SDKItemType 创建
|
|
60454
60471
|
// 将类型转换为 string 进行比较
|
|
60455
60472
|
if ((existingSDKItem == null ? void 0 : existingSDKItem.type) === SDKItemType.GENERATOR) {
|
|
@@ -60488,11 +60505,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60488
60505
|
property: property
|
|
60489
60506
|
}));
|
|
60490
60507
|
} else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
|
|
60491
|
-
var cardType = existingSDKItem.cardType
|
|
60508
|
+
var cardType = existingSDKItem.cardType;
|
|
60492
60509
|
sdkItem = new CardItem(_extends({}, baseOptions, {
|
|
60493
60510
|
property: _extends({}, property, {
|
|
60494
|
-
cardType: cardType
|
|
60495
|
-
html: html
|
|
60511
|
+
cardType: cardType
|
|
60496
60512
|
})
|
|
60497
60513
|
}));
|
|
60498
60514
|
} else {
|
|
@@ -60719,6 +60735,19 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60719
60735
|
}).call(this);
|
|
60720
60736
|
};
|
|
60721
60737
|
/**
|
|
60738
|
+
* @description 设置元素extension字段
|
|
60739
|
+
*/ _proto.setItemExtension = function setItemExtension(itemId, extension) {
|
|
60740
|
+
var item = this.getSDKItem(itemId);
|
|
60741
|
+
if (!item) {
|
|
60742
|
+
console.warn('setItemExtension: item not found');
|
|
60743
|
+
return;
|
|
60744
|
+
}
|
|
60745
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.entries(extension)), _step; !(_step = _iterator()).done;){
|
|
60746
|
+
var _step_value = _step.value, key = _step_value[0], value = _step_value[1];
|
|
60747
|
+
item.extension.set(key, value);
|
|
60748
|
+
}
|
|
60749
|
+
};
|
|
60750
|
+
/**
|
|
60722
60751
|
* @description 场景 1: 设置单个元素的单个属性
|
|
60723
60752
|
*/ _proto.setSingleItemSingleProperty = function setSingleItemSingleProperty(param) {
|
|
60724
60753
|
return _async_to_generator(function() {
|
|
@@ -61076,40 +61105,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61076
61105
|
3,
|
|
61077
61106
|
31
|
|
61078
61107
|
];
|
|
61079
|
-
case 'html':
|
|
61080
|
-
return [
|
|
61081
|
-
3,
|
|
61082
|
-
32
|
|
61083
|
-
];
|
|
61084
61108
|
case 'position':
|
|
61085
61109
|
return [
|
|
61086
61110
|
3,
|
|
61087
|
-
|
|
61111
|
+
32
|
|
61088
61112
|
];
|
|
61089
61113
|
case 'rotation':
|
|
61090
61114
|
return [
|
|
61091
61115
|
3,
|
|
61092
|
-
|
|
61116
|
+
33
|
|
61093
61117
|
];
|
|
61094
61118
|
case 'scale':
|
|
61095
61119
|
return [
|
|
61096
61120
|
3,
|
|
61097
|
-
|
|
61121
|
+
34
|
|
61098
61122
|
];
|
|
61099
61123
|
case 'layoutMode':
|
|
61100
61124
|
return [
|
|
61101
61125
|
3,
|
|
61102
|
-
|
|
61126
|
+
35
|
|
61103
61127
|
];
|
|
61104
61128
|
case 'visible':
|
|
61105
61129
|
return [
|
|
61106
61130
|
3,
|
|
61107
|
-
|
|
61131
|
+
36
|
|
61108
61132
|
];
|
|
61109
61133
|
}
|
|
61110
61134
|
return [
|
|
61111
61135
|
3,
|
|
61112
|
-
|
|
61136
|
+
37
|
|
61113
61137
|
];
|
|
61114
61138
|
case 1:
|
|
61115
61139
|
{
|
|
@@ -61122,7 +61146,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61122
61146
|
}
|
|
61123
61147
|
return [
|
|
61124
61148
|
3,
|
|
61125
|
-
|
|
61149
|
+
38
|
|
61126
61150
|
];
|
|
61127
61151
|
}
|
|
61128
61152
|
case 2:
|
|
@@ -61133,7 +61157,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61133
61157
|
}
|
|
61134
61158
|
return [
|
|
61135
61159
|
3,
|
|
61136
|
-
|
|
61160
|
+
38
|
|
61137
61161
|
];
|
|
61138
61162
|
}
|
|
61139
61163
|
case 3:
|
|
@@ -61165,7 +61189,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61165
61189
|
case 5:
|
|
61166
61190
|
return [
|
|
61167
61191
|
3,
|
|
61168
|
-
|
|
61192
|
+
38
|
|
61169
61193
|
];
|
|
61170
61194
|
case 6:
|
|
61171
61195
|
{
|
|
@@ -61182,7 +61206,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61182
61206
|
}
|
|
61183
61207
|
return [
|
|
61184
61208
|
3,
|
|
61185
|
-
|
|
61209
|
+
38
|
|
61186
61210
|
];
|
|
61187
61211
|
}
|
|
61188
61212
|
case 7:
|
|
@@ -61196,7 +61220,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61196
61220
|
}
|
|
61197
61221
|
return [
|
|
61198
61222
|
3,
|
|
61199
|
-
|
|
61223
|
+
38
|
|
61200
61224
|
];
|
|
61201
61225
|
}
|
|
61202
61226
|
case 8:
|
|
@@ -61209,7 +61233,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61209
61233
|
}
|
|
61210
61234
|
return [
|
|
61211
61235
|
3,
|
|
61212
|
-
|
|
61236
|
+
38
|
|
61213
61237
|
];
|
|
61214
61238
|
}
|
|
61215
61239
|
case 9:
|
|
@@ -61223,7 +61247,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61223
61247
|
}
|
|
61224
61248
|
return [
|
|
61225
61249
|
3,
|
|
61226
|
-
|
|
61250
|
+
38
|
|
61227
61251
|
];
|
|
61228
61252
|
}
|
|
61229
61253
|
case 10:
|
|
@@ -61236,7 +61260,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61236
61260
|
}
|
|
61237
61261
|
return [
|
|
61238
61262
|
3,
|
|
61239
|
-
|
|
61263
|
+
38
|
|
61240
61264
|
];
|
|
61241
61265
|
}
|
|
61242
61266
|
case 11:
|
|
@@ -61249,7 +61273,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61249
61273
|
}
|
|
61250
61274
|
return [
|
|
61251
61275
|
3,
|
|
61252
|
-
|
|
61276
|
+
38
|
|
61253
61277
|
];
|
|
61254
61278
|
}
|
|
61255
61279
|
case 12:
|
|
@@ -61269,7 +61293,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61269
61293
|
}
|
|
61270
61294
|
return [
|
|
61271
61295
|
3,
|
|
61272
|
-
|
|
61296
|
+
38
|
|
61273
61297
|
];
|
|
61274
61298
|
}
|
|
61275
61299
|
case 13:
|
|
@@ -61311,7 +61335,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61311
61335
|
}
|
|
61312
61336
|
return [
|
|
61313
61337
|
3,
|
|
61314
|
-
|
|
61338
|
+
38
|
|
61315
61339
|
];
|
|
61316
61340
|
}
|
|
61317
61341
|
case 14:
|
|
@@ -61346,7 +61370,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61346
61370
|
}
|
|
61347
61371
|
return [
|
|
61348
61372
|
3,
|
|
61349
|
-
|
|
61373
|
+
38
|
|
61350
61374
|
];
|
|
61351
61375
|
}
|
|
61352
61376
|
case 15:
|
|
@@ -61360,7 +61384,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61360
61384
|
}
|
|
61361
61385
|
return [
|
|
61362
61386
|
3,
|
|
61363
|
-
|
|
61387
|
+
38
|
|
61364
61388
|
];
|
|
61365
61389
|
}
|
|
61366
61390
|
case 16:
|
|
@@ -61392,7 +61416,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61392
61416
|
case 20:
|
|
61393
61417
|
return [
|
|
61394
61418
|
3,
|
|
61395
|
-
|
|
61419
|
+
38
|
|
61396
61420
|
];
|
|
61397
61421
|
case 21:
|
|
61398
61422
|
if (!(typeof propertyValue === 'string' && playerItem.type === EFFECTS.spec.ItemType.video)) return [
|
|
@@ -61423,7 +61447,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61423
61447
|
case 25:
|
|
61424
61448
|
return [
|
|
61425
61449
|
3,
|
|
61426
|
-
|
|
61450
|
+
38
|
|
61427
61451
|
];
|
|
61428
61452
|
case 26:
|
|
61429
61453
|
if (!(playerItem.type === EFFECTS.spec.ItemType.null)) return [
|
|
@@ -61471,7 +61495,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61471
61495
|
case 28:
|
|
61472
61496
|
return [
|
|
61473
61497
|
3,
|
|
61474
|
-
|
|
61498
|
+
38
|
|
61475
61499
|
];
|
|
61476
61500
|
case 29:
|
|
61477
61501
|
{
|
|
@@ -61483,7 +61507,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61483
61507
|
}
|
|
61484
61508
|
return [
|
|
61485
61509
|
3,
|
|
61486
|
-
|
|
61510
|
+
38
|
|
61487
61511
|
];
|
|
61488
61512
|
}
|
|
61489
61513
|
case 30:
|
|
@@ -61496,7 +61520,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61496
61520
|
}
|
|
61497
61521
|
return [
|
|
61498
61522
|
3,
|
|
61499
|
-
|
|
61523
|
+
38
|
|
61500
61524
|
];
|
|
61501
61525
|
}
|
|
61502
61526
|
case 31:
|
|
@@ -61509,20 +61533,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61509
61533
|
}
|
|
61510
61534
|
return [
|
|
61511
61535
|
3,
|
|
61512
|
-
|
|
61536
|
+
38
|
|
61513
61537
|
];
|
|
61514
61538
|
}
|
|
61515
61539
|
case 32:
|
|
61516
|
-
{
|
|
61517
|
-
if (isCardItem(targetItem)) {
|
|
61518
|
-
targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
|
|
61519
|
-
}
|
|
61520
|
-
return [
|
|
61521
|
-
3,
|
|
61522
|
-
39
|
|
61523
|
-
];
|
|
61524
|
-
}
|
|
61525
|
-
case 33:
|
|
61526
61540
|
{
|
|
61527
61541
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61528
61542
|
pixelTranslation = propertyValue.map(function(v, i) {
|
|
@@ -61535,10 +61549,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61535
61549
|
}
|
|
61536
61550
|
return [
|
|
61537
61551
|
3,
|
|
61538
|
-
|
|
61552
|
+
38
|
|
61539
61553
|
];
|
|
61540
61554
|
}
|
|
61541
|
-
case
|
|
61555
|
+
case 33:
|
|
61542
61556
|
{
|
|
61543
61557
|
if (Array.isArray(propertyValue) && propertyValue.length === 3) {
|
|
61544
61558
|
rotation = propertyValue.map(function(v, i) {
|
|
@@ -61549,10 +61563,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61549
61563
|
}
|
|
61550
61564
|
return [
|
|
61551
61565
|
3,
|
|
61552
|
-
|
|
61566
|
+
38
|
|
61553
61567
|
];
|
|
61554
61568
|
}
|
|
61555
|
-
case
|
|
61569
|
+
case 34:
|
|
61556
61570
|
{
|
|
61557
61571
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61558
61572
|
currentScale = targetItem.property.scale;
|
|
@@ -61566,10 +61580,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61566
61580
|
}
|
|
61567
61581
|
return [
|
|
61568
61582
|
3,
|
|
61569
|
-
|
|
61583
|
+
38
|
|
61570
61584
|
];
|
|
61571
61585
|
}
|
|
61572
|
-
case
|
|
61586
|
+
case 35:
|
|
61573
61587
|
{
|
|
61574
61588
|
if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
|
|
61575
61589
|
frameComponent = playerItem.getComponent(EFFECTS.FrameComponent);
|
|
@@ -61579,10 +61593,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61579
61593
|
}
|
|
61580
61594
|
return [
|
|
61581
61595
|
3,
|
|
61582
|
-
|
|
61596
|
+
38
|
|
61583
61597
|
];
|
|
61584
61598
|
}
|
|
61585
|
-
case
|
|
61599
|
+
case 36:
|
|
61586
61600
|
{
|
|
61587
61601
|
if (typeof propertyValue === 'boolean') {
|
|
61588
61602
|
playerItem.setVisible(propertyValue);
|
|
@@ -61595,10 +61609,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61595
61609
|
}
|
|
61596
61610
|
return [
|
|
61597
61611
|
3,
|
|
61598
|
-
|
|
61612
|
+
38
|
|
61599
61613
|
];
|
|
61600
61614
|
}
|
|
61601
|
-
case
|
|
61615
|
+
case 37:
|
|
61602
61616
|
{
|
|
61603
61617
|
console.log('ignore property name ', propertyName);
|
|
61604
61618
|
// 对于未明确处理的属性,尝试直接设置到 property 对象
|
|
@@ -61606,8 +61620,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61606
61620
|
targetItem.property[propertyName] = propertyValue;
|
|
61607
61621
|
}
|
|
61608
61622
|
}
|
|
61609
|
-
_state.label =
|
|
61610
|
-
case
|
|
61623
|
+
_state.label = 38;
|
|
61624
|
+
case 38:
|
|
61611
61625
|
// 非位置属性需要刷新播放器
|
|
61612
61626
|
// template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
|
|
61613
61627
|
if (![
|
|
@@ -62490,6 +62504,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
62490
62504
|
}
|
|
62491
62505
|
break;
|
|
62492
62506
|
}
|
|
62507
|
+
case 'cardType':
|
|
62508
|
+
{
|
|
62509
|
+
break;
|
|
62510
|
+
}
|
|
62493
62511
|
default:
|
|
62494
62512
|
{
|
|
62495
62513
|
console.warn("Target property " + propertyName + " can not be changed.");
|
|
@@ -63082,12 +63100,15 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63082
63100
|
var _cardInfo_name = cardInfo.name, name = _cardInfo_name === void 0 ? '卡片' : _cardInfo_name, _cardInfo_property = cardInfo.property, width = _cardInfo_property.width, height = _cardInfo_property.height, _cardInfo_property_scale = _cardInfo_property.scale, scale = _cardInfo_property_scale === void 0 ? [
|
|
63083
63101
|
1,
|
|
63084
63102
|
1
|
|
63085
|
-
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position,
|
|
63103
|
+
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? EFFECTS.generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63086
63104
|
// 校验 cardType 是否已在配置中注册
|
|
63105
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63106
|
+
return t.type === cardType;
|
|
63107
|
+
});
|
|
63087
63108
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63088
63109
|
return t.type;
|
|
63089
63110
|
});
|
|
63090
|
-
if (!
|
|
63111
|
+
if (!cardTypeConfig) {
|
|
63091
63112
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63092
63113
|
return;
|
|
63093
63114
|
}
|
|
@@ -63131,9 +63152,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63131
63152
|
width: width,
|
|
63132
63153
|
height: height,
|
|
63133
63154
|
scale: [].concat(scale),
|
|
63134
|
-
cardType: cardType
|
|
63135
|
-
autoHeight: autoHeight,
|
|
63136
|
-
html: html
|
|
63155
|
+
cardType: cardType
|
|
63137
63156
|
},
|
|
63138
63157
|
extension: extension
|
|
63139
63158
|
});
|
|
@@ -64515,8 +64534,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64515
64534
|
scalar.y
|
|
64516
64535
|
],
|
|
64517
64536
|
rotation: [].concat(rotation),
|
|
64518
|
-
position: [].concat(resultPosition)
|
|
64519
|
-
html: sdkItem.html
|
|
64537
|
+
position: [].concat(resultPosition)
|
|
64520
64538
|
},
|
|
64521
64539
|
extension: extension
|
|
64522
64540
|
};
|
|
@@ -65562,7 +65580,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65562
65580
|
_this = this;
|
|
65563
65581
|
changeProeprty = function changeProeprty(targetCreateInfo) {
|
|
65564
65582
|
return _async_to_generator(function() {
|
|
65565
|
-
var currentCreateInfo;
|
|
65583
|
+
var currentCreateInfo, itemId;
|
|
65566
65584
|
return _ts_generator(this, function(_state) {
|
|
65567
65585
|
switch(_state.label){
|
|
65568
65586
|
case 0:
|
|
@@ -65573,16 +65591,20 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65573
65591
|
2
|
|
65574
65592
|
];
|
|
65575
65593
|
}
|
|
65594
|
+
itemId = targetCreateInfo.id;
|
|
65576
65595
|
return [
|
|
65577
65596
|
4,
|
|
65578
65597
|
this.setItemProperty({
|
|
65579
|
-
itemId:
|
|
65598
|
+
itemId: itemId,
|
|
65580
65599
|
type: currentCreateInfo.type,
|
|
65581
65600
|
property: targetCreateInfo.property
|
|
65582
65601
|
})
|
|
65583
65602
|
];
|
|
65584
65603
|
case 1:
|
|
65585
65604
|
_state.sent();
|
|
65605
|
+
if (targetCreateInfo.extension) {
|
|
65606
|
+
this.setItemExtension(itemId, targetCreateInfo.extension);
|
|
65607
|
+
}
|
|
65586
65608
|
return [
|
|
65587
65609
|
2
|
|
65588
65610
|
];
|
|
@@ -65945,35 +65967,56 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65945
65967
|
};
|
|
65946
65968
|
_proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
|
|
65947
65969
|
return _async_to_generator(function() {
|
|
65948
|
-
var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step,
|
|
65970
|
+
var _loop, _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
|
|
65949
65971
|
return _ts_generator(this, function(_state) {
|
|
65950
65972
|
switch(_state.label){
|
|
65951
65973
|
case 0:
|
|
65952
|
-
|
|
65953
|
-
|
|
65954
|
-
|
|
65955
|
-
|
|
65956
|
-
|
|
65957
|
-
|
|
65958
|
-
|
|
65959
|
-
|
|
65960
|
-
|
|
65961
|
-
|
|
65962
|
-
|
|
65963
|
-
|
|
65964
|
-
|
|
65965
|
-
|
|
65966
|
-
|
|
65967
|
-
|
|
65974
|
+
_loop = function() {
|
|
65975
|
+
var createInfo = _step.value;
|
|
65976
|
+
var _ref = function() {
|
|
65977
|
+
switch(createInfo.type){
|
|
65978
|
+
case SDKItemType.SPRITE:
|
|
65979
|
+
{
|
|
65980
|
+
return {
|
|
65981
|
+
url: createInfo.property.image,
|
|
65982
|
+
type: 'image'
|
|
65983
|
+
};
|
|
65984
|
+
}
|
|
65985
|
+
case SDKItemType.VIDEO:
|
|
65986
|
+
{
|
|
65987
|
+
return {
|
|
65988
|
+
url: createInfo.property.video,
|
|
65989
|
+
type: 'video'
|
|
65990
|
+
};
|
|
65991
|
+
}
|
|
65992
|
+
default:
|
|
65993
|
+
{
|
|
65994
|
+
return {};
|
|
65995
|
+
}
|
|
65996
|
+
}
|
|
65997
|
+
}(), url = _ref.url, type = _ref.type;
|
|
65998
|
+
if (url && type) {
|
|
65999
|
+
var textureId = EFFECTS.generateGUID();
|
|
66000
|
+
itemToTextureInfo.set(createInfo.id, {
|
|
65968
66001
|
id: textureId,
|
|
65969
66002
|
url: url,
|
|
65970
|
-
type: type
|
|
66003
|
+
type: type
|
|
65971
66004
|
});
|
|
65972
66005
|
Object.assign(createInfo, {
|
|
65973
66006
|
textureId: textureId
|
|
65974
66007
|
});
|
|
65975
66008
|
}
|
|
65976
|
-
}
|
|
66009
|
+
};
|
|
66010
|
+
_this = this;
|
|
66011
|
+
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
66012
|
+
var _createInfo_id;
|
|
66013
|
+
return Object.assign({}, createInfo, {
|
|
66014
|
+
id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : EFFECTS.generateGUID()
|
|
66015
|
+
});
|
|
66016
|
+
});
|
|
66017
|
+
itemToTextureInfo = new Map();
|
|
66018
|
+
// 预处理所有 createInfo,分配 textureId
|
|
66019
|
+
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
|
|
65977
66020
|
// 并行创建所有 item
|
|
65978
66021
|
toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
|
|
65979
66022
|
return ![
|
|
@@ -66942,6 +66985,51 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
66942
66985
|
* @param id 元素id
|
|
66943
66986
|
* @param size 目标大小 [width, height]
|
|
66944
66987
|
* @param translation 位置偏移补偿(可选,用于保持拖拽角点固定)
|
|
66988
|
+
*/ _proto.resizeCardItem = function resizeCardItem(id, size, translation) {
|
|
66989
|
+
var _frameController_children;
|
|
66990
|
+
var frameItem = this.getSDKItem(id);
|
|
66991
|
+
if (!frameItem) {
|
|
66992
|
+
return;
|
|
66993
|
+
}
|
|
66994
|
+
var newWidth = size[0], newHeight = size[1];
|
|
66995
|
+
// const originalWidth = frameItem.property.width
|
|
66996
|
+
// 计算世界尺寸(供后续使用)
|
|
66997
|
+
var viewSize = this.interactionUtils.getViewSizeByPixelSize(new Vector2(newWidth, newHeight));
|
|
66998
|
+
var worldSize = this.interactionUtils.getWorldSizeByViewSize(viewSize).abs();
|
|
66999
|
+
// 1 更新 Player 层的预合成和子元素
|
|
67000
|
+
// 1.1 更新 Player Item(空节点控制器)的大小
|
|
67001
|
+
var frameController = this.getPlayerItemById(id);
|
|
67002
|
+
if (frameController) {
|
|
67003
|
+
frameController.transform.setSize(worldSize.x, worldSize.y);
|
|
67004
|
+
// 如果有位移,更新位置
|
|
67005
|
+
if (translation && (translation.x !== 0 || translation.y !== 0)) {
|
|
67006
|
+
var currentPosition = frameController.transform.position;
|
|
67007
|
+
frameController.setPosition(currentPosition.x + translation.x, currentPosition.y + translation.y, currentPosition.z);
|
|
67008
|
+
}
|
|
67009
|
+
}
|
|
67010
|
+
// 1.2 更新 Player Children Item 的大小
|
|
67011
|
+
var subCompositionItem = frameController == null ? void 0 : (_frameController_children = frameController.children) == null ? void 0 : _frameController_children[0];
|
|
67012
|
+
if (subCompositionItem && translation) {
|
|
67013
|
+
// 更新子元素
|
|
67014
|
+
subCompositionItem.children.forEach(function(item) {
|
|
67015
|
+
var _item;
|
|
67016
|
+
var _item_transform_getParentMatrix;
|
|
67017
|
+
var parentMatrix = new Matrix4().copyFrom((_item_transform_getParentMatrix = item.transform.getParentMatrix()) != null ? _item_transform_getParentMatrix : new Matrix4());
|
|
67018
|
+
parentMatrix.setPosition(new Vector3());
|
|
67019
|
+
var result = translation.clone().applyMatrix(parentMatrix.invert()).negate();
|
|
67020
|
+
(_item = item).translate.apply(_item, [].concat(result.toArray()));
|
|
67021
|
+
item.transform.updateLocalMatrix();
|
|
67022
|
+
});
|
|
67023
|
+
}
|
|
67024
|
+
// 2: 刷新 SDKItem 数据
|
|
67025
|
+
// 更新 FrameItem 的 property
|
|
67026
|
+
this.refreshSDKItem(frameItem.id);
|
|
67027
|
+
};
|
|
67028
|
+
/**
|
|
67029
|
+
* @description 修改画板元素大小
|
|
67030
|
+
* @param id 元素id
|
|
67031
|
+
* @param size 目标大小 [width, height]
|
|
67032
|
+
* @param translation 位置偏移补偿(可选,用于保持拖拽角点固定)
|
|
66945
67033
|
*/ _proto.resizeFrameItem = function resizeFrameItem(id, size, translation) {
|
|
66946
67034
|
var _this = this;
|
|
66947
67035
|
var _frameController_children;
|
|
@@ -83274,43 +83362,12 @@ var BaseConfig = {
|
|
|
83274
83362
|
},
|
|
83275
83363
|
cardConfig: {
|
|
83276
83364
|
backgroundColor: [
|
|
83277
|
-
|
|
83278
|
-
|
|
83279
|
-
|
|
83280
|
-
0
|
|
83365
|
+
1,
|
|
83366
|
+
1,
|
|
83367
|
+
1,
|
|
83368
|
+
0
|
|
83281
83369
|
],
|
|
83282
|
-
cardTypes: [
|
|
83283
|
-
{
|
|
83284
|
-
type: 'character',
|
|
83285
|
-
label: '角色图',
|
|
83286
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83287
|
-
},
|
|
83288
|
-
{
|
|
83289
|
-
type: 'environment',
|
|
83290
|
-
label: '环境图',
|
|
83291
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83292
|
-
},
|
|
83293
|
-
{
|
|
83294
|
-
type: 'storyboard',
|
|
83295
|
-
label: '分镜图',
|
|
83296
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83297
|
-
},
|
|
83298
|
-
{
|
|
83299
|
-
type: 'scene-clip',
|
|
83300
|
-
label: '场景剪辑',
|
|
83301
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83302
|
-
},
|
|
83303
|
-
{
|
|
83304
|
-
type: 'video-compose',
|
|
83305
|
-
label: '视频合成',
|
|
83306
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83307
|
-
},
|
|
83308
|
-
{
|
|
83309
|
-
type: 'video-generate',
|
|
83310
|
-
label: '生成视频',
|
|
83311
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83312
|
-
}
|
|
83313
|
-
]
|
|
83370
|
+
cardTypes: []
|
|
83314
83371
|
}
|
|
83315
83372
|
}
|
|
83316
83373
|
};
|
|
@@ -91639,11 +91696,18 @@ function isCardHTMLAutoHeightMessage(data, id) {
|
|
|
91639
91696
|
var message = data;
|
|
91640
91697
|
return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
|
|
91641
91698
|
}
|
|
91699
|
+
function requestCardHTMLAutoHeight(iframe, id) {
|
|
91700
|
+
var _iframe_contentWindow;
|
|
91701
|
+
(_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
|
|
91702
|
+
source: 'vvfx-card-html-auto-height-request',
|
|
91703
|
+
id: id
|
|
91704
|
+
}, '*');
|
|
91705
|
+
}
|
|
91642
91706
|
function withCardHTMLAutoHeightBridge(html, id) {
|
|
91643
91707
|
if (!id) {
|
|
91644
91708
|
return html;
|
|
91645
91709
|
}
|
|
91646
|
-
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const
|
|
91710
|
+
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const getNodeHeight = (node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const rect = node.getBoundingClientRect();\n return rect.bottom + window.scrollY;\n }\n if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) {\n const range = document.createRange();\n range.selectNodeContents(node);\n const rects = Array.from(range.getClientRects());\n range.detach();\n return rects.reduce((height, rect) => Math.max(height, rect.bottom + window.scrollY), 0);\n }\n\n return 0;\n };\n const getContentHeight = (element) => {\n if (!element) return 0;\n return Array.from(element.childNodes).reduce((height, child) => {\n return Math.max(height, getNodeHeight(child));\n }, 0);\n };\n const getHeight = () => {\n const body = document.body;\n const root = document.documentElement;\n const contentHeight = getContentHeight(body);\n const scrollHeight = Math.max(root.scrollHeight, body ? body.scrollHeight : 0);\n return Math.ceil(contentHeight > 0 ? contentHeight : scrollHeight);\n };\n const postHeight = () => {\n frame = 0;\n window.parent.postMessage({\n source: 'vvfx-card-html-auto-height',\n id,\n height: getHeight(),\n }, '*');\n };\n const schedule = () => {\n if (frame) return;\n frame = requestAnimationFrame(postHeight);\n };\n window.addEventListener('message', (event) => {\n const message = event.data;\n if (!message || message.source !== 'vvfx-card-html-auto-height-request' || message.id !== id) {\n return;\n }\n\n schedule();\n });\n window.addEventListener('load', schedule);\n window.addEventListener('resize', schedule);\n new ResizeObserver(schedule).observe(document.documentElement);\n if (document.body) {\n new ResizeObserver(schedule).observe(document.body);\n new MutationObserver(schedule).observe(document.body, {\n attributes: true,\n childList: true,\n subtree: true,\n characterData: true,\n });\n }\n schedule();\n})();\n</script>";
|
|
91647
91711
|
if (/<\/body>/i.test(html)) {
|
|
91648
91712
|
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91649
91713
|
}
|
|
@@ -91841,6 +91905,17 @@ function withCardHTMLViewportStyle(html) {
|
|
|
91841
91905
|
return "<!doctype html><html><head>" + viewportStyle + "</head><body>" + html + "</body></html>";
|
|
91842
91906
|
}
|
|
91843
91907
|
|
|
91908
|
+
function withCardHTMLAnchorNavigationGuard(html, allowAnchorNavigation) {
|
|
91909
|
+
if (allowAnchorNavigation === true) {
|
|
91910
|
+
return html;
|
|
91911
|
+
}
|
|
91912
|
+
var script = "\n<script data-vvfx-card-html-anchor-navigation-guard>\n(() => {\n document.addEventListener('click', event => {\n const target = event.target;\n if (!(target instanceof Element)) {\n return;\n }\n\n const anchor = target.closest('a[href]');\n if (!anchor) {\n return;\n }\n\n event.preventDefault();\n }, true);\n})();\n</script>";
|
|
91913
|
+
if (/<\/body>/i.test(html)) {
|
|
91914
|
+
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91915
|
+
}
|
|
91916
|
+
return "" + html + script;
|
|
91917
|
+
}
|
|
91918
|
+
|
|
91844
91919
|
function renderDocumentContent(overlay, content, options) {
|
|
91845
91920
|
var _files_get;
|
|
91846
91921
|
var iframe = document.createElement('iframe');
|
|
@@ -91859,7 +91934,7 @@ function renderDocumentContent(overlay, content, options) {
|
|
|
91859
91934
|
iframe.setAttribute('sandbox', content.sandbox);
|
|
91860
91935
|
}
|
|
91861
91936
|
var entryHtml = (_files_get = files.get(entry)) != null ? _files_get : '';
|
|
91862
|
-
iframe.srcdoc = withCardHTMLAutoHeightBridge(withCardHTMLViewportStyle(transformHTMLDocument(entry, entryHtml, createFileUrl)), options == null ? void 0 : options.autoHeightId);
|
|
91937
|
+
iframe.srcdoc = withCardHTMLAutoHeightBridge(withCardHTMLAnchorNavigationGuard(withCardHTMLViewportStyle(transformHTMLDocument(entry, entryHtml, createFileUrl)), content.allowAnchorNavigation), options == null ? void 0 : options.autoHeightId);
|
|
91863
91938
|
overlay.appendChild(iframe);
|
|
91864
91939
|
return function() {
|
|
91865
91940
|
messageCleanup();
|
|
@@ -91916,30 +91991,38 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91916
91991
|
});
|
|
91917
91992
|
}
|
|
91918
91993
|
|
|
91919
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
|
|
91994
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, _autoScale) {
|
|
91920
91995
|
if (offsetX === void 0) offsetX = 0;
|
|
91921
91996
|
if (offsetY === void 0) offsetY = 0;
|
|
91922
91997
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91923
91998
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91924
|
-
var
|
|
91925
|
-
var
|
|
91926
|
-
var
|
|
91927
|
-
var
|
|
91999
|
+
var contentWidth = width;
|
|
92000
|
+
var contentHeight = height;
|
|
92001
|
+
var a = (rightTop.x - leftTop.x) / contentWidth;
|
|
92002
|
+
var b = (rightTop.y - leftTop.y) / contentWidth;
|
|
92003
|
+
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
92004
|
+
var d = (leftBottom.y - leftTop.y) / contentHeight;
|
|
91928
92005
|
var e = leftTop.x - offsetX;
|
|
91929
92006
|
var f = leftTop.y - offsetY;
|
|
91930
92007
|
return {
|
|
91931
92008
|
left: '0px',
|
|
91932
92009
|
top: '0px',
|
|
91933
|
-
width: "" +
|
|
91934
|
-
height: "" +
|
|
92010
|
+
width: "" + formatPixelNumber(contentWidth) + "px",
|
|
92011
|
+
height: "" + formatPixelNumber(contentHeight) + "px",
|
|
92012
|
+
contentWidth: contentWidth,
|
|
92013
|
+
contentHeight: contentHeight,
|
|
91935
92014
|
transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
|
|
91936
92015
|
};
|
|
91937
92016
|
}
|
|
92017
|
+
var contentWidth1 = box.max.x - box.min.x;
|
|
92018
|
+
var contentHeight1 = box.max.y - box.min.y;
|
|
91938
92019
|
return {
|
|
91939
92020
|
left: "" + (box.min.x - offsetX) + "px",
|
|
91940
92021
|
top: "" + (box.min.y - offsetY) + "px",
|
|
91941
|
-
width: "" +
|
|
91942
|
-
height: "" +
|
|
92022
|
+
width: "" + contentWidth1 + "px",
|
|
92023
|
+
height: "" + contentHeight1 + "px",
|
|
92024
|
+
contentWidth: contentWidth1,
|
|
92025
|
+
contentHeight: contentHeight1,
|
|
91943
92026
|
transform: ''
|
|
91944
92027
|
};
|
|
91945
92028
|
}
|
|
@@ -91962,6 +92045,10 @@ function formatMatrixNumber(value) {
|
|
|
91962
92045
|
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91963
92046
|
return Number(normalized.toFixed(6)).toString();
|
|
91964
92047
|
}
|
|
92048
|
+
function formatPixelNumber(value) {
|
|
92049
|
+
var normalized = Object.is(value, -0) ? 0 : value;
|
|
92050
|
+
return Number(normalized.toFixed(6)).toString();
|
|
92051
|
+
}
|
|
91965
92052
|
|
|
91966
92053
|
function mountHTMLShell(container, content, shell) {
|
|
91967
92054
|
if (!shell) {
|
|
@@ -91982,23 +92069,73 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91982
92069
|
|
|
91983
92070
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91984
92071
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
92072
|
+
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
92073
|
+
'[data-vvfx-html-interaction-zone="self"]',
|
|
92074
|
+
'[data-vvfx-html-interaction-zone="subtree"]',
|
|
92075
|
+
'a[href]',
|
|
92076
|
+
'button:not([disabled])',
|
|
92077
|
+
'input:not([disabled])',
|
|
92078
|
+
'textarea:not([disabled])',
|
|
92079
|
+
'select:not([disabled])',
|
|
92080
|
+
'summary',
|
|
92081
|
+
'video[controls]',
|
|
92082
|
+
'audio[controls]',
|
|
92083
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
92084
|
+
'[role="button"]',
|
|
92085
|
+
'[role="link"]',
|
|
92086
|
+
'[role="textbox"]',
|
|
92087
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
92088
|
+
].join(', ');
|
|
92089
|
+
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
92090
|
+
'[data-vvfx-html-interaction-zone="none"]'
|
|
92091
|
+
].join(', ');
|
|
91985
92092
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91986
92093
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91987
92094
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
91988
92095
|
var CARD_RASTERIZE_READY_TIMEOUT = 3000;
|
|
92096
|
+
var CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
92097
|
+
var requestHTMLOverlayFrame = function requestHTMLOverlayFrame(callback) {
|
|
92098
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
92099
|
+
try {
|
|
92100
|
+
return requestAnimationFrame(callback);
|
|
92101
|
+
} catch (unused) {
|
|
92102
|
+
// Some non-browser test runtimes install a RAF polyfill that depends on window.
|
|
92103
|
+
}
|
|
92104
|
+
}
|
|
92105
|
+
return setTimeout(function() {
|
|
92106
|
+
callback(Date.now());
|
|
92107
|
+
}, 16);
|
|
92108
|
+
};
|
|
92109
|
+
var cancelHTMLOverlayFrame = function cancelHTMLOverlayFrame(frame) {
|
|
92110
|
+
if (typeof cancelAnimationFrame === 'function') {
|
|
92111
|
+
try {
|
|
92112
|
+
cancelAnimationFrame(frame);
|
|
92113
|
+
return;
|
|
92114
|
+
} catch (unused) {
|
|
92115
|
+
// Fall back to clearTimeout for frames created by requestHTMLOverlayFrame.
|
|
92116
|
+
}
|
|
92117
|
+
}
|
|
92118
|
+
clearTimeout(frame);
|
|
92119
|
+
};
|
|
91989
92120
|
var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
91990
92121
|
function HTMLOverlayManager(options) {
|
|
91991
92122
|
var _this = this;
|
|
91992
92123
|
this.options = options;
|
|
91993
92124
|
this.eventCleanups = [];
|
|
92125
|
+
this.htmlRootConfigCleanups = new WeakMap();
|
|
91994
92126
|
this.state = {
|
|
91995
92127
|
frameElements: new Map(),
|
|
91996
92128
|
elements: new Map(),
|
|
92129
|
+
selectionElements: new Map(),
|
|
91997
92130
|
contentScaleElements: new Map(),
|
|
91998
92131
|
contentElements: new Map(),
|
|
91999
92132
|
contentMountElements: new Map(),
|
|
92133
|
+
contentInteractionZones: new Map(),
|
|
92134
|
+
contentInteractionZoneCleanups: new Map(),
|
|
92135
|
+
contentInteractionResizeCleanups: new Map(),
|
|
92000
92136
|
contents: new Map(),
|
|
92001
92137
|
cleanups: new Map(),
|
|
92138
|
+
autoHeightModes: new Map(),
|
|
92002
92139
|
autoHeightCleanups: new Map(),
|
|
92003
92140
|
autoHeightFrames: new Map()
|
|
92004
92141
|
};
|
|
@@ -92015,12 +92152,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92015
92152
|
}
|
|
92016
92153
|
return;
|
|
92017
92154
|
}
|
|
92155
|
+
if (!_this.isEditableCard(targetId)) {
|
|
92156
|
+
return;
|
|
92157
|
+
}
|
|
92018
92158
|
event.preventDefault();
|
|
92019
92159
|
event.stopPropagation();
|
|
92020
92160
|
_this.enterEditing(targetId);
|
|
92021
92161
|
};
|
|
92022
92162
|
this.handleContainerMouseDown = function(event) {
|
|
92023
92163
|
var _this_state_editing;
|
|
92164
|
+
if (event.button === 0) {
|
|
92165
|
+
_this.selectHTMLInteractionCard(event);
|
|
92166
|
+
}
|
|
92024
92167
|
var editingId = (_this_state_editing = _this.state.editing) == null ? void 0 : _this_state_editing.id;
|
|
92025
92168
|
if (!editingId || _this.isEventInsideOverlay(editingId, event)) {
|
|
92026
92169
|
return;
|
|
@@ -92030,6 +92173,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92030
92173
|
_this.exitEditing();
|
|
92031
92174
|
};
|
|
92032
92175
|
this.handleContainerMouseMove = function(event) {
|
|
92176
|
+
_this.scheduleActiveContentInteractionSync(event);
|
|
92033
92177
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
92034
92178
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
92035
92179
|
return;
|
|
@@ -92043,7 +92187,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92043
92187
|
_this.syncContentInteraction(hoverShellInteractiveId);
|
|
92044
92188
|
}
|
|
92045
92189
|
};
|
|
92046
|
-
this.handleContainerMouseLeave = function() {
|
|
92190
|
+
this.handleContainerMouseLeave = function(event) {
|
|
92191
|
+
if (_this.isMouseLeaveWithinContainer(event)) {
|
|
92192
|
+
return;
|
|
92193
|
+
}
|
|
92194
|
+
if (_this.contentInteractionFrame !== undefined) {
|
|
92195
|
+
cancelHTMLOverlayFrame(_this.contentInteractionFrame);
|
|
92196
|
+
_this.contentInteractionFrame = undefined;
|
|
92197
|
+
}
|
|
92198
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92199
|
+
_this.setActiveContentInteraction(undefined);
|
|
92047
92200
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
92048
92201
|
if (!previousId) {
|
|
92049
92202
|
return;
|
|
@@ -92051,6 +92204,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92051
92204
|
_this.state.hoverShellInteractiveId = undefined;
|
|
92052
92205
|
_this.syncContentInteraction(previousId);
|
|
92053
92206
|
};
|
|
92207
|
+
this.handleContainerContextMenu = function(event) {
|
|
92208
|
+
var activeInteraction = _this.state.activeContentInteraction;
|
|
92209
|
+
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92210
|
+
return;
|
|
92211
|
+
}
|
|
92212
|
+
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92213
|
+
if (!canvas) {
|
|
92214
|
+
return;
|
|
92215
|
+
}
|
|
92216
|
+
event.preventDefault();
|
|
92217
|
+
event.stopPropagation();
|
|
92218
|
+
_this.setActiveContentInteraction(undefined);
|
|
92219
|
+
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92220
|
+
bubbles: true,
|
|
92221
|
+
cancelable: true,
|
|
92222
|
+
clientX: event.clientX,
|
|
92223
|
+
clientY: event.clientY,
|
|
92224
|
+
screenX: event.screenX,
|
|
92225
|
+
screenY: event.screenY,
|
|
92226
|
+
button: event.button,
|
|
92227
|
+
buttons: event.buttons,
|
|
92228
|
+
ctrlKey: event.ctrlKey,
|
|
92229
|
+
shiftKey: event.shiftKey,
|
|
92230
|
+
altKey: event.altKey,
|
|
92231
|
+
metaKey: event.metaKey
|
|
92232
|
+
}));
|
|
92233
|
+
};
|
|
92054
92234
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
92055
92235
|
}
|
|
92056
92236
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -92064,7 +92244,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92064
92244
|
layer.style.position = 'absolute';
|
|
92065
92245
|
layer.style.inset = '0';
|
|
92066
92246
|
layer.style.pointerEvents = 'none';
|
|
92067
|
-
layer.style.zIndex = '1';
|
|
92068
92247
|
container.appendChild(layer);
|
|
92069
92248
|
this.state.layer = layer;
|
|
92070
92249
|
this.initDOMEvents();
|
|
@@ -92074,25 +92253,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92074
92253
|
_proto.dispose = function dispose() {
|
|
92075
92254
|
var _this_state_layer;
|
|
92076
92255
|
if (this.state.updateFrame !== undefined) {
|
|
92077
|
-
|
|
92256
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92078
92257
|
this.state.updateFrame = undefined;
|
|
92079
92258
|
}
|
|
92259
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92260
|
+
cancelHTMLOverlayFrame(this.contentInteractionFrame);
|
|
92261
|
+
this.contentInteractionFrame = undefined;
|
|
92262
|
+
}
|
|
92263
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92080
92264
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92081
92265
|
cleanup();
|
|
92082
92266
|
});
|
|
92083
92267
|
this.state.frameElements.clear();
|
|
92084
92268
|
this.state.elements.clear();
|
|
92269
|
+
this.state.selectionElements.clear();
|
|
92085
92270
|
this.state.contentScaleElements.clear();
|
|
92086
92271
|
this.state.contentElements.clear();
|
|
92087
92272
|
this.state.contentMountElements.clear();
|
|
92273
|
+
this.state.contentInteractionZones.clear();
|
|
92274
|
+
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92275
|
+
cleanup();
|
|
92276
|
+
});
|
|
92277
|
+
this.state.contentInteractionZoneCleanups.clear();
|
|
92278
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92279
|
+
cleanup();
|
|
92280
|
+
});
|
|
92281
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92088
92282
|
this.state.contents.clear();
|
|
92089
92283
|
this.state.cleanups.clear();
|
|
92284
|
+
this.state.autoHeightModes.clear();
|
|
92090
92285
|
this.state.autoHeightCleanups.forEach(function(cleanup) {
|
|
92091
92286
|
cleanup();
|
|
92092
92287
|
});
|
|
92093
92288
|
this.state.autoHeightCleanups.clear();
|
|
92094
92289
|
this.state.autoHeightFrames.forEach(function(frame) {
|
|
92095
|
-
|
|
92290
|
+
cancelHTMLOverlayFrame(frame);
|
|
92096
92291
|
});
|
|
92097
92292
|
this.state.autoHeightFrames.clear();
|
|
92098
92293
|
this.eventCleanups.forEach(function(cleanup) {
|
|
@@ -92101,21 +92296,61 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92101
92296
|
this.eventCleanups = [];
|
|
92102
92297
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92103
92298
|
this.state.layer = undefined;
|
|
92299
|
+
this.state.selectionLayer = undefined;
|
|
92104
92300
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92105
92301
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92106
92302
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92107
92303
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92304
|
+
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92108
92305
|
};
|
|
92109
92306
|
_proto.scheduleRender = function scheduleRender() {
|
|
92110
92307
|
var _this = this;
|
|
92111
92308
|
if (this.state.updateFrame !== undefined) {
|
|
92112
|
-
|
|
92309
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92113
92310
|
}
|
|
92114
|
-
this.state.updateFrame =
|
|
92311
|
+
this.state.updateFrame = requestHTMLOverlayFrame(function() {
|
|
92115
92312
|
_this.state.updateFrame = undefined;
|
|
92116
92313
|
_this.render();
|
|
92117
92314
|
});
|
|
92118
92315
|
};
|
|
92316
|
+
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92317
|
+
this.cleanupOverlayContent(id);
|
|
92318
|
+
this.invalidateContentInteractionZones(id);
|
|
92319
|
+
};
|
|
92320
|
+
_proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
92321
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92322
|
+
var iframe = contentOverlay == null ? void 0 : contentOverlay.querySelector('iframe');
|
|
92323
|
+
return iframe == null ? void 0 : iframe.contentWindow;
|
|
92324
|
+
};
|
|
92325
|
+
_proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
92326
|
+
var html = this.state.contents.get(id);
|
|
92327
|
+
if (!html) {
|
|
92328
|
+
return false;
|
|
92329
|
+
}
|
|
92330
|
+
var patchHandler = html.content.patch;
|
|
92331
|
+
if (!patchHandler) {
|
|
92332
|
+
return false;
|
|
92333
|
+
}
|
|
92334
|
+
var context = this.createPatchContext(id, html);
|
|
92335
|
+
return patchHandler(patch, context) !== false;
|
|
92336
|
+
};
|
|
92337
|
+
_proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
92338
|
+
var targetWindow = this.getHtmlCardWindow(id);
|
|
92339
|
+
try {
|
|
92340
|
+
if (!targetWindow || typeof targetWindow.postMessage !== 'function') {
|
|
92341
|
+
return false;
|
|
92342
|
+
}
|
|
92343
|
+
targetWindow.postMessage({
|
|
92344
|
+
detail: detail,
|
|
92345
|
+
payload: detail,
|
|
92346
|
+
source: CARD_HTML_EVENT_MESSAGE_SOURCE,
|
|
92347
|
+
type: type
|
|
92348
|
+
}, '*');
|
|
92349
|
+
return true;
|
|
92350
|
+
} catch (unused) {
|
|
92351
|
+
return false;
|
|
92352
|
+
}
|
|
92353
|
+
};
|
|
92119
92354
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92120
92355
|
return _async_to_generator(function() {
|
|
92121
92356
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92123,7 +92358,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92123
92358
|
switch(_state.label){
|
|
92124
92359
|
case 0:
|
|
92125
92360
|
if (this.state.updateFrame !== undefined) {
|
|
92126
|
-
|
|
92361
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92127
92362
|
this.state.updateFrame = undefined;
|
|
92128
92363
|
}
|
|
92129
92364
|
this.render();
|
|
@@ -92208,6 +92443,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92208
92443
|
var events = [
|
|
92209
92444
|
'pageDataChange',
|
|
92210
92445
|
'selectedItemChange',
|
|
92446
|
+
'preSelectedItemChange',
|
|
92211
92447
|
'itemPropertyChange',
|
|
92212
92448
|
'viewportTransform',
|
|
92213
92449
|
'viewRebuildFinish'
|
|
@@ -92217,6 +92453,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92217
92453
|
if (event === 'viewportTransform') {
|
|
92218
92454
|
_this.handleViewportTransform();
|
|
92219
92455
|
}
|
|
92456
|
+
_this.invalidateContentInteractionZones();
|
|
92220
92457
|
_this.scheduleRender();
|
|
92221
92458
|
});
|
|
92222
92459
|
});
|
|
@@ -92226,6 +92463,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92226
92463
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92227
92464
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92228
92465
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92466
|
+
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92467
|
+
};
|
|
92468
|
+
_proto.selectHTMLInteractionCard = function selectHTMLInteractionCard(event) {
|
|
92469
|
+
var decision = this.resolveHTMLInteractionTarget(event);
|
|
92470
|
+
if (decision.kind !== 'html') {
|
|
92471
|
+
return;
|
|
92472
|
+
}
|
|
92473
|
+
this.options.setSelectedItemIds([
|
|
92474
|
+
decision.interaction.id
|
|
92475
|
+
]);
|
|
92476
|
+
};
|
|
92477
|
+
_proto.isMouseLeaveWithinContainer = function isMouseLeaveWithinContainer(event) {
|
|
92478
|
+
var relatedTarget = event.relatedTarget;
|
|
92479
|
+
if (!relatedTarget) {
|
|
92480
|
+
return false;
|
|
92481
|
+
}
|
|
92482
|
+
try {
|
|
92483
|
+
return this.options.container.contains(relatedTarget);
|
|
92484
|
+
} catch (unused) {
|
|
92485
|
+
return false;
|
|
92486
|
+
}
|
|
92487
|
+
};
|
|
92488
|
+
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92489
|
+
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92490
|
+
return false;
|
|
92491
|
+
}
|
|
92492
|
+
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92229
92493
|
};
|
|
92230
92494
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92231
92495
|
var editing = this.state.editing;
|
|
@@ -92245,11 +92509,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92245
92509
|
}
|
|
92246
92510
|
var items = this.options.getItems();
|
|
92247
92511
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92512
|
+
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92248
92513
|
var visibleCardIds = new Set();
|
|
92249
92514
|
var editingVisible = false;
|
|
92250
92515
|
items.forEach(function(item) {
|
|
92251
92516
|
var _this_state_editing;
|
|
92252
|
-
if (!isCardItem(item) || !item.visible
|
|
92517
|
+
if (!isCardItem(item) || !item.visible) {
|
|
92518
|
+
return;
|
|
92519
|
+
}
|
|
92520
|
+
var html = _this.options.resolveCardHTML(item);
|
|
92521
|
+
if (html === undefined) {
|
|
92253
92522
|
return;
|
|
92254
92523
|
}
|
|
92255
92524
|
var itemBox = _this.options.getViewBoxById(item.id);
|
|
@@ -92264,21 +92533,32 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92264
92533
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92265
92534
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92266
92535
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92267
|
-
var
|
|
92268
|
-
if (html && _this.state.contents.get(item.id) !== html) {
|
|
92269
|
-
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92270
|
-
}
|
|
92536
|
+
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92271
92537
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92272
92538
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92273
|
-
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
|
|
92539
|
+
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
92540
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92274
92541
|
overlay.style.left = boxStyle.left;
|
|
92275
92542
|
overlay.style.top = boxStyle.top;
|
|
92276
92543
|
overlay.style.width = boxStyle.width;
|
|
92277
92544
|
overlay.style.height = boxStyle.height;
|
|
92278
92545
|
overlay.style.transform = boxStyle.transform;
|
|
92279
92546
|
overlay.style.transformOrigin = '0 0';
|
|
92280
|
-
|
|
92281
|
-
|
|
92547
|
+
var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
|
|
92548
|
+
selectionOverlay.style.left = selectionBoxStyle.left;
|
|
92549
|
+
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92550
|
+
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92551
|
+
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92552
|
+
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92553
|
+
selectionOverlay.style.transformOrigin = '0 0';
|
|
92554
|
+
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92555
|
+
_this.makeSelectionOverlayTransparent(selectionOverlay);
|
|
92556
|
+
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92557
|
+
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92558
|
+
if (!_this.state.contents.has(item.id)) {
|
|
92559
|
+
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92560
|
+
}
|
|
92561
|
+
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92282
92562
|
_this.syncContentInteraction(item.id);
|
|
92283
92563
|
});
|
|
92284
92564
|
elements.forEach(function(_overlay, id) {
|
|
@@ -92317,6 +92597,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92317
92597
|
}
|
|
92318
92598
|
}
|
|
92319
92599
|
syncElementStackOrder(layer, rootElements);
|
|
92600
|
+
if (this.state.selectionLayer) {
|
|
92601
|
+
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92602
|
+
}
|
|
92320
92603
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92321
92604
|
var frameElements = [];
|
|
92322
92605
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92332,6 +92615,28 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92332
92615
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92333
92616
|
});
|
|
92334
92617
|
};
|
|
92618
|
+
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92619
|
+
var _layer_ownerDocument;
|
|
92620
|
+
if (this.state.selectionLayer) {
|
|
92621
|
+
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92622
|
+
layer.appendChild(this.state.selectionLayer);
|
|
92623
|
+
}
|
|
92624
|
+
return this.state.selectionLayer;
|
|
92625
|
+
}
|
|
92626
|
+
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92627
|
+
if (!ownerDocument) {
|
|
92628
|
+
return layer;
|
|
92629
|
+
}
|
|
92630
|
+
var selectionLayer = ownerDocument.createElement('div');
|
|
92631
|
+
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92632
|
+
selectionLayer.style.position = 'absolute';
|
|
92633
|
+
selectionLayer.style.inset = '0';
|
|
92634
|
+
selectionLayer.style.pointerEvents = 'none';
|
|
92635
|
+
selectionLayer.style.zIndex = '1';
|
|
92636
|
+
layer.appendChild(selectionLayer);
|
|
92637
|
+
this.state.selectionLayer = selectionLayer;
|
|
92638
|
+
return selectionLayer;
|
|
92639
|
+
};
|
|
92335
92640
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92336
92641
|
var _this = this;
|
|
92337
92642
|
var visibleFrameIds = new Set();
|
|
@@ -92396,6 +92701,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92396
92701
|
elements.set(id, overlay);
|
|
92397
92702
|
return overlay;
|
|
92398
92703
|
};
|
|
92704
|
+
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92705
|
+
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92706
|
+
if (selectionOverlay) {
|
|
92707
|
+
if (selectionOverlay.parentElement !== parent) {
|
|
92708
|
+
parent.appendChild(selectionOverlay);
|
|
92709
|
+
}
|
|
92710
|
+
return selectionOverlay;
|
|
92711
|
+
}
|
|
92712
|
+
selectionOverlay = document.createElement('div');
|
|
92713
|
+
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92714
|
+
selectionOverlay.dataset.itemId = id;
|
|
92715
|
+
selectionOverlay.style.position = 'absolute';
|
|
92716
|
+
selectionOverlay.style.pointerEvents = 'none';
|
|
92717
|
+
selectionOverlay.style.zIndex = '1';
|
|
92718
|
+
parent.appendChild(selectionOverlay);
|
|
92719
|
+
this.state.selectionElements.set(id, selectionOverlay);
|
|
92720
|
+
return selectionOverlay;
|
|
92721
|
+
};
|
|
92722
|
+
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92723
|
+
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92724
|
+
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92725
|
+
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92726
|
+
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92727
|
+
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92728
|
+
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92729
|
+
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92730
|
+
};
|
|
92731
|
+
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92732
|
+
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92733
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92734
|
+
};
|
|
92735
|
+
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92736
|
+
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92737
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92738
|
+
};
|
|
92399
92739
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92400
92740
|
var layer = this.state.layer;
|
|
92401
92741
|
if (!layer) {
|
|
@@ -92405,7 +92745,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92405
92745
|
var items = this.options.getItems();
|
|
92406
92746
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92407
92747
|
var item = items[i];
|
|
92408
|
-
if (!isCardItem(item) || !item.visible || item
|
|
92748
|
+
if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
|
|
92409
92749
|
continue;
|
|
92410
92750
|
}
|
|
92411
92751
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92424,7 +92764,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92424
92764
|
var items = this.options.getItems();
|
|
92425
92765
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92426
92766
|
var item = items[i];
|
|
92427
|
-
if (!isCardItem(item) || !item.visible || item
|
|
92767
|
+
if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
|
|
92428
92768
|
continue;
|
|
92429
92769
|
}
|
|
92430
92770
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92434,13 +92774,212 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92434
92774
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92435
92775
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92436
92776
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92437
|
-
|
|
92438
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92777
|
+
return isMouseEventInsideRect(event, element.getBoundingClientRect());
|
|
92439
92778
|
});
|
|
92440
92779
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92441
92780
|
}
|
|
92442
92781
|
return undefined;
|
|
92443
92782
|
};
|
|
92783
|
+
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92784
|
+
var decision = this.resolveHTMLInteractionTarget(event);
|
|
92785
|
+
if (decision.kind === 'canvas' && this.shouldKeepActiveContentInteractionForFocusedElement()) {
|
|
92786
|
+
return;
|
|
92787
|
+
}
|
|
92788
|
+
this.setActiveContentInteraction(decision.kind === 'html' ? decision.interaction : undefined);
|
|
92789
|
+
};
|
|
92790
|
+
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92791
|
+
var _this = this;
|
|
92792
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
92793
|
+
this.syncActiveContentInteraction(event);
|
|
92794
|
+
return;
|
|
92795
|
+
}
|
|
92796
|
+
this.pendingContentInteractionEvent = event;
|
|
92797
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92798
|
+
return;
|
|
92799
|
+
}
|
|
92800
|
+
try {
|
|
92801
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92802
|
+
_this.contentInteractionFrame = undefined;
|
|
92803
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92804
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92805
|
+
if (pendingEvent) {
|
|
92806
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92807
|
+
}
|
|
92808
|
+
});
|
|
92809
|
+
} catch (unused) {
|
|
92810
|
+
this.contentInteractionFrame = undefined;
|
|
92811
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92812
|
+
this.syncActiveContentInteraction(event);
|
|
92813
|
+
}
|
|
92814
|
+
};
|
|
92815
|
+
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92816
|
+
var _this = this;
|
|
92817
|
+
var previous = this.state.activeContentInteraction;
|
|
92818
|
+
if ((previous == null ? void 0 : previous.id) === (zone == null ? void 0 : zone.id) && (previous == null ? void 0 : previous.element) === (zone == null ? void 0 : zone.element) && (previous == null ? void 0 : previous.zone) === (zone == null ? void 0 : zone.zone)) {
|
|
92819
|
+
return;
|
|
92820
|
+
}
|
|
92821
|
+
this.state.activeContentInteraction = zone;
|
|
92822
|
+
var changedIds = new Set();
|
|
92823
|
+
if (previous) {
|
|
92824
|
+
changedIds.add(previous.id);
|
|
92825
|
+
}
|
|
92826
|
+
if (zone) {
|
|
92827
|
+
changedIds.add(zone.id);
|
|
92828
|
+
}
|
|
92829
|
+
changedIds.forEach(function(id) {
|
|
92830
|
+
_this.syncContentInteraction(id);
|
|
92831
|
+
});
|
|
92832
|
+
};
|
|
92833
|
+
_proto.shouldKeepActiveContentInteractionForFocusedElement = function shouldKeepActiveContentInteractionForFocusedElement() {
|
|
92834
|
+
var activeInteraction = this.state.activeContentInteraction;
|
|
92835
|
+
if (!activeInteraction || typeof document === 'undefined') {
|
|
92836
|
+
return false;
|
|
92837
|
+
}
|
|
92838
|
+
var activeElement = document.activeElement;
|
|
92839
|
+
if (!activeElement || activeElement === document.body) {
|
|
92840
|
+
return false;
|
|
92841
|
+
}
|
|
92842
|
+
var interactionElement = activeInteraction.element;
|
|
92843
|
+
return interactionElement === activeElement || typeof interactionElement.contains === 'function' && interactionElement.contains(activeElement);
|
|
92844
|
+
};
|
|
92845
|
+
_proto.resolveHTMLInteractionTarget = function resolveHTMLInteractionTarget(event) {
|
|
92846
|
+
var id = this.getHTMLCardIdByEvent(event);
|
|
92847
|
+
if (!id || this.isEditableCard(id)) {
|
|
92848
|
+
return {
|
|
92849
|
+
kind: 'canvas',
|
|
92850
|
+
id: id
|
|
92851
|
+
};
|
|
92852
|
+
}
|
|
92853
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92854
|
+
if (!contentOverlay) {
|
|
92855
|
+
return {
|
|
92856
|
+
kind: 'canvas',
|
|
92857
|
+
id: id
|
|
92858
|
+
};
|
|
92859
|
+
}
|
|
92860
|
+
var activeSubtree = this.getActiveSubtreeInteractionAtEvent(id, event);
|
|
92861
|
+
if (activeSubtree) {
|
|
92862
|
+
return {
|
|
92863
|
+
kind: 'html',
|
|
92864
|
+
interaction: activeSubtree
|
|
92865
|
+
};
|
|
92866
|
+
}
|
|
92867
|
+
var matchedZones = this.getContentInteractionZones(id, contentOverlay).filter(function(zone) {
|
|
92868
|
+
return isMouseEventInsideRect(event, zone.rect);
|
|
92869
|
+
});
|
|
92870
|
+
var zone = this.resolveContentInteractionZone(matchedZones);
|
|
92871
|
+
if (zone) {
|
|
92872
|
+
return {
|
|
92873
|
+
kind: 'html',
|
|
92874
|
+
interaction: {
|
|
92875
|
+
id: id,
|
|
92876
|
+
element: zone.element,
|
|
92877
|
+
zone: zone.zone
|
|
92878
|
+
}
|
|
92879
|
+
};
|
|
92880
|
+
}
|
|
92881
|
+
return {
|
|
92882
|
+
kind: 'canvas',
|
|
92883
|
+
id: id
|
|
92884
|
+
};
|
|
92885
|
+
};
|
|
92886
|
+
_proto.getActiveSubtreeInteractionAtEvent = function getActiveSubtreeInteractionAtEvent(id, event) {
|
|
92887
|
+
var activeInteraction = this.state.activeContentInteraction;
|
|
92888
|
+
if ((activeInteraction == null ? void 0 : activeInteraction.id) !== id || activeInteraction.zone !== 'subtree') {
|
|
92889
|
+
return undefined;
|
|
92890
|
+
}
|
|
92891
|
+
var rect = activeInteraction.element.getBoundingClientRect();
|
|
92892
|
+
return isMouseEventInsideRect(event, rect) ? activeInteraction : undefined;
|
|
92893
|
+
};
|
|
92894
|
+
_proto.resolveContentInteractionZone = function resolveContentInteractionZone(zones) {
|
|
92895
|
+
if (zones.length <= 1) {
|
|
92896
|
+
return zones[0];
|
|
92897
|
+
}
|
|
92898
|
+
var subtreeRoot = zones.find(function(candidate) {
|
|
92899
|
+
return candidate.zone === 'subtree' && typeof candidate.element.contains === 'function' && zones.some(function(zone) {
|
|
92900
|
+
return zone.element !== candidate.element && candidate.element.contains(zone.element);
|
|
92901
|
+
});
|
|
92902
|
+
});
|
|
92903
|
+
return subtreeRoot != null ? subtreeRoot : zones[0];
|
|
92904
|
+
};
|
|
92905
|
+
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92906
|
+
var _this = this;
|
|
92907
|
+
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92908
|
+
if (cachedZones) {
|
|
92909
|
+
return cachedZones;
|
|
92910
|
+
}
|
|
92911
|
+
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92912
|
+
return !_this.isContentInteractionDisabled(element);
|
|
92913
|
+
}).map(function(element) {
|
|
92914
|
+
return {
|
|
92915
|
+
element: element,
|
|
92916
|
+
rect: element.getBoundingClientRect(),
|
|
92917
|
+
zone: _this.getContentInteractionZoneMode(element)
|
|
92918
|
+
};
|
|
92919
|
+
});
|
|
92920
|
+
this.state.contentInteractionZones.set(id, zones);
|
|
92921
|
+
this.observeContentInteractionZoneResizes(id, zones);
|
|
92922
|
+
return zones;
|
|
92923
|
+
};
|
|
92924
|
+
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92925
|
+
var _ref;
|
|
92926
|
+
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92927
|
+
var item = this.options.getItems().find(function(item) {
|
|
92928
|
+
return item.id === id;
|
|
92929
|
+
});
|
|
92930
|
+
if (!item) {
|
|
92931
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92932
|
+
}
|
|
92933
|
+
var selectors = (_ref = (_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : (_this_options_resolveCardTypeConfig_htmlInteractionSelectors = _this_options_resolveCardTypeConfig.htmlInteractionSelectors) == null ? void 0 : _this_options_resolveCardTypeConfig_htmlInteractionSelectors.filter(Boolean)) != null ? _ref : [];
|
|
92934
|
+
if (selectors.length === 0) {
|
|
92935
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92936
|
+
}
|
|
92937
|
+
return [].concat([
|
|
92938
|
+
CONTENT_INTERACTIVE_SELECTOR
|
|
92939
|
+
], selectors).join(', ');
|
|
92940
|
+
};
|
|
92941
|
+
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92942
|
+
if (typeof element.closest !== 'function') {
|
|
92943
|
+
return false;
|
|
92944
|
+
}
|
|
92945
|
+
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92946
|
+
};
|
|
92947
|
+
_proto.getContentInteractionZoneMode = function getContentInteractionZoneMode(element) {
|
|
92948
|
+
var zone = element.dataset.vvfxHtmlInteractionZone;
|
|
92949
|
+
return zone === 'subtree' ? 'subtree' : 'self';
|
|
92950
|
+
};
|
|
92951
|
+
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92952
|
+
if (id) {
|
|
92953
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92954
|
+
this.state.contentInteractionZones.delete(id);
|
|
92955
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92956
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92957
|
+
return;
|
|
92958
|
+
}
|
|
92959
|
+
this.state.contentInteractionZones.clear();
|
|
92960
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92961
|
+
cleanup();
|
|
92962
|
+
});
|
|
92963
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92964
|
+
};
|
|
92965
|
+
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92966
|
+
var _this = this;
|
|
92967
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92968
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92969
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92970
|
+
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92971
|
+
return;
|
|
92972
|
+
}
|
|
92973
|
+
var observer = new ResizeObserver(function() {
|
|
92974
|
+
_this.invalidateContentInteractionZones(id);
|
|
92975
|
+
});
|
|
92976
|
+
zones.forEach(function(zone) {
|
|
92977
|
+
observer.observe(zone.element);
|
|
92978
|
+
});
|
|
92979
|
+
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92980
|
+
observer.disconnect();
|
|
92981
|
+
});
|
|
92982
|
+
};
|
|
92444
92983
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92445
92984
|
var rect = this.options.container.getBoundingClientRect();
|
|
92446
92985
|
return {
|
|
@@ -92497,19 +93036,35 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92497
93036
|
if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
|
|
92498
93037
|
return;
|
|
92499
93038
|
}
|
|
92500
|
-
|
|
92501
|
-
|
|
93039
|
+
var nextWidth = "" + width + "px";
|
|
93040
|
+
var nextHeight = "" + height + "px";
|
|
93041
|
+
var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
|
|
93042
|
+
scaleOverlay.style.width = nextWidth;
|
|
93043
|
+
scaleOverlay.style.height = nextHeight;
|
|
92502
93044
|
scaleOverlay.style.transform = 'none';
|
|
92503
|
-
contentOverlay.style.width =
|
|
92504
|
-
contentOverlay.style.height =
|
|
93045
|
+
contentOverlay.style.width = nextWidth;
|
|
93046
|
+
contentOverlay.style.height = nextHeight;
|
|
93047
|
+
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
93048
|
+
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
93049
|
+
}
|
|
93050
|
+
if (sizeChanged) {
|
|
93051
|
+
this.invalidateContentInteractionZones(id);
|
|
93052
|
+
}
|
|
93053
|
+
};
|
|
93054
|
+
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
93055
|
+
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
93056
|
+
requestCardHTMLAutoHeight(iframe, id);
|
|
93057
|
+
});
|
|
92505
93058
|
};
|
|
92506
93059
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92507
|
-
var _this_state_editing;
|
|
93060
|
+
var _this_state_editing, _this_state_activeContentInteraction;
|
|
92508
93061
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
93062
|
+
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92509
93063
|
var overlay = this.state.elements.get(id);
|
|
92510
93064
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92511
93065
|
var contentOverlay = this.state.contentElements.get(id);
|
|
92512
93066
|
var contentMount = this.state.contentMountElements.get(id);
|
|
93067
|
+
var isInteractive = isEditing || !!activeInteraction;
|
|
92513
93068
|
if (overlay) {
|
|
92514
93069
|
overlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92515
93070
|
overlay.style.pointerEvents = 'none';
|
|
@@ -92520,34 +93075,62 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92520
93075
|
}
|
|
92521
93076
|
if (contentOverlay) {
|
|
92522
93077
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92523
|
-
contentOverlay.style.pointerEvents = 'none';
|
|
93078
|
+
contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92524
93079
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92525
|
-
|
|
92526
|
-
iframe.
|
|
93080
|
+
var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
|
|
93081
|
+
iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
|
|
93082
|
+
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92527
93083
|
});
|
|
92528
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
93084
|
+
this.syncShellInteraction(id, contentOverlay, isInteractive);
|
|
93085
|
+
this.syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive);
|
|
92529
93086
|
}
|
|
92530
93087
|
if (contentMount) {
|
|
92531
93088
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92532
|
-
contentMount.style.pointerEvents =
|
|
92533
|
-
contentMount.inert = !
|
|
92534
|
-
if (
|
|
93089
|
+
contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
93090
|
+
contentMount.inert = !isInteractive;
|
|
93091
|
+
if (isInteractive) {
|
|
92535
93092
|
contentMount.removeAttribute('aria-hidden');
|
|
92536
93093
|
} else {
|
|
92537
93094
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92538
93095
|
}
|
|
92539
93096
|
}
|
|
92540
93097
|
};
|
|
92541
|
-
_proto.
|
|
93098
|
+
_proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive) {
|
|
93099
|
+
var _this = this;
|
|
93100
|
+
var activeElement = activeInteraction == null ? void 0 : activeInteraction.element;
|
|
93101
|
+
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
93102
|
+
if ((activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && activeElement && element !== activeElement && typeof activeElement.contains === 'function' && activeElement.contains(element)) {
|
|
93103
|
+
_this.clearContentInteractionState(element);
|
|
93104
|
+
return;
|
|
93105
|
+
}
|
|
93106
|
+
if (!isInteractive) {
|
|
93107
|
+
_this.clearContentInteractionState(element);
|
|
93108
|
+
return;
|
|
93109
|
+
}
|
|
93110
|
+
if (_this.isContentInteractionDisabled(element)) {
|
|
93111
|
+
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
93112
|
+
element.style.pointerEvents = 'none';
|
|
93113
|
+
return;
|
|
93114
|
+
}
|
|
93115
|
+
var isElementInteractive = isEditing || activeElement === element || (activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && typeof (activeElement == null ? void 0 : activeElement.contains) === 'function' && activeElement.contains(element);
|
|
93116
|
+
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
93117
|
+
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
93118
|
+
});
|
|
93119
|
+
};
|
|
93120
|
+
_proto.clearContentInteractionState = function clearContentInteractionState(element) {
|
|
93121
|
+
delete element.dataset.vvfxHtmlInteractionActive;
|
|
93122
|
+
element.style.pointerEvents = '';
|
|
93123
|
+
};
|
|
93124
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92542
93125
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92543
|
-
var isShellInteractiveActive =
|
|
93126
|
+
var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
|
|
92544
93127
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92545
93128
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92546
93129
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92547
93130
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92548
93131
|
});
|
|
92549
93132
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92550
|
-
element.style.pointerEvents =
|
|
93133
|
+
element.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92551
93134
|
});
|
|
92552
93135
|
};
|
|
92553
93136
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92555,6 +93138,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92555
93138
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92556
93139
|
return;
|
|
92557
93140
|
}
|
|
93141
|
+
if (!this.isEditableCard(id)) {
|
|
93142
|
+
return;
|
|
93143
|
+
}
|
|
92558
93144
|
var box = this.options.getViewBoxById(id);
|
|
92559
93145
|
if (box.isEmpty()) {
|
|
92560
93146
|
return;
|
|
@@ -92598,6 +93184,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92598
93184
|
this.options.setViewport(editing.restoreViewport);
|
|
92599
93185
|
this.scheduleRender();
|
|
92600
93186
|
};
|
|
93187
|
+
_proto.isEditableCard = function isEditableCard(id) {
|
|
93188
|
+
var _this_options_resolveCardTypeConfig;
|
|
93189
|
+
var item = this.options.getItems().find(function(item) {
|
|
93190
|
+
return item.id === id;
|
|
93191
|
+
});
|
|
93192
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
93193
|
+
};
|
|
92601
93194
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92602
93195
|
var viewportElement = this.options.container.parentElement;
|
|
92603
93196
|
if (!viewportElement) {
|
|
@@ -92622,6 +93215,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92622
93215
|
};
|
|
92623
93216
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92624
93217
|
this.cleanupOverlayContent(id);
|
|
93218
|
+
this.invalidateContentInteractionZones(id);
|
|
92625
93219
|
overlay.innerHTML = '';
|
|
92626
93220
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92627
93221
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92631,18 +93225,99 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92631
93225
|
});
|
|
92632
93226
|
var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
|
|
92633
93227
|
id: id,
|
|
92634
|
-
autoHeight:
|
|
93228
|
+
autoHeight: this.isAutoHeightEnabled(item)
|
|
92635
93229
|
});
|
|
93230
|
+
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92636
93231
|
this.state.cleanups.set(id, function() {
|
|
92637
93232
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92638
93233
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
92639
93234
|
});
|
|
92640
93235
|
this.state.contents.set(id, html);
|
|
92641
93236
|
};
|
|
93237
|
+
_proto.createPatchContext = function createPatchContext(id, html) {
|
|
93238
|
+
var _this = this;
|
|
93239
|
+
return {
|
|
93240
|
+
id: id,
|
|
93241
|
+
html: html,
|
|
93242
|
+
content: html.content,
|
|
93243
|
+
container: this.state.contentMountElements.get(id),
|
|
93244
|
+
contentWindow: this.getHtmlCardWindow(id),
|
|
93245
|
+
refresh: function refresh() {
|
|
93246
|
+
_this.invalidateCardHTML(id);
|
|
93247
|
+
_this.scheduleRender();
|
|
93248
|
+
}
|
|
93249
|
+
};
|
|
93250
|
+
};
|
|
93251
|
+
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
93252
|
+
var _this = this;
|
|
93253
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
93254
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93255
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93256
|
+
if (typeof MutationObserver !== 'function') {
|
|
93257
|
+
return;
|
|
93258
|
+
}
|
|
93259
|
+
var observer = new MutationObserver(function() {
|
|
93260
|
+
_this.invalidateContentInteractionZones(id);
|
|
93261
|
+
});
|
|
93262
|
+
observer.observe(contentContainer, {
|
|
93263
|
+
attributes: true,
|
|
93264
|
+
childList: true,
|
|
93265
|
+
subtree: true
|
|
93266
|
+
});
|
|
93267
|
+
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
93268
|
+
observer.disconnect();
|
|
93269
|
+
});
|
|
93270
|
+
};
|
|
93271
|
+
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
93272
|
+
var _ref, _config_style;
|
|
93273
|
+
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
93274
|
+
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
93275
|
+
this.htmlRootConfigCleanups.delete(root);
|
|
93276
|
+
var config = html.root;
|
|
93277
|
+
if (!config) {
|
|
93278
|
+
return;
|
|
93279
|
+
}
|
|
93280
|
+
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
93281
|
+
var styleProperties = [];
|
|
93282
|
+
classNames.forEach(function(className) {
|
|
93283
|
+
root.classList.add(className);
|
|
93284
|
+
});
|
|
93285
|
+
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
93286
|
+
var property = param[0], value = param[1];
|
|
93287
|
+
if (value === undefined) {
|
|
93288
|
+
return;
|
|
93289
|
+
}
|
|
93290
|
+
styleProperties.push(property);
|
|
93291
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
93292
|
+
root.style.setProperty(property, String(value));
|
|
93293
|
+
return;
|
|
93294
|
+
}
|
|
93295
|
+
root.style[property] = String(value);
|
|
93296
|
+
});
|
|
93297
|
+
this.htmlRootConfigCleanups.set(root, function() {
|
|
93298
|
+
classNames.forEach(function(className) {
|
|
93299
|
+
root.classList.remove(className);
|
|
93300
|
+
});
|
|
93301
|
+
styleProperties.forEach(function(property) {
|
|
93302
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
93303
|
+
root.style.removeProperty(property);
|
|
93304
|
+
return;
|
|
93305
|
+
}
|
|
93306
|
+
root.style[property] = '';
|
|
93307
|
+
});
|
|
93308
|
+
});
|
|
93309
|
+
};
|
|
93310
|
+
_proto.makeSelectionOverlayTransparent = function makeSelectionOverlayTransparent(selectionOverlay) {
|
|
93311
|
+
selectionOverlay.style.background = 'transparent';
|
|
93312
|
+
selectionOverlay.style.backgroundColor = 'transparent';
|
|
93313
|
+
};
|
|
92642
93314
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
92643
93315
|
var _this = this;
|
|
92644
93316
|
switch(content.kind){
|
|
92645
93317
|
case 'inline':
|
|
93318
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
93319
|
+
this.state.autoHeightModes.set(options.id, 'message');
|
|
93320
|
+
}
|
|
92646
93321
|
return this.chainCleanups(function() {
|
|
92647
93322
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
92648
93323
|
}, renderDocumentContent(overlay, {
|
|
@@ -92650,7 +93325,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92650
93325
|
entry: 'index.html',
|
|
92651
93326
|
files: {
|
|
92652
93327
|
'index.html': content.html
|
|
92653
|
-
}
|
|
93328
|
+
},
|
|
93329
|
+
allowAnchorNavigation: content.allowAnchorNavigation,
|
|
93330
|
+
sandbox: content.sandbox
|
|
92654
93331
|
}, {
|
|
92655
93332
|
autoHeightId: (options == null ? void 0 : options.autoHeight) ? options.id : undefined,
|
|
92656
93333
|
onAutoHeight: (options == null ? void 0 : options.autoHeight) ? function(height) {
|
|
@@ -92659,6 +93336,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92659
93336
|
}));
|
|
92660
93337
|
case 'dom':
|
|
92661
93338
|
{
|
|
93339
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
93340
|
+
this.state.autoHeightModes.set(options.id, 'measure');
|
|
93341
|
+
}
|
|
92662
93342
|
if (content.target === 'iframe') {
|
|
92663
93343
|
return renderDOMContentInIframe(overlay, content.render, content.cleanup);
|
|
92664
93344
|
}
|
|
@@ -92668,6 +93348,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92668
93348
|
} : undefined;
|
|
92669
93349
|
}
|
|
92670
93350
|
case 'document':
|
|
93351
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
93352
|
+
this.state.autoHeightModes.set(options.id, 'message');
|
|
93353
|
+
}
|
|
92671
93354
|
return this.chainCleanups(function() {
|
|
92672
93355
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
92673
93356
|
}, renderDocumentContent(overlay, content, {
|
|
@@ -92695,6 +93378,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92695
93378
|
};
|
|
92696
93379
|
};
|
|
92697
93380
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93381
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92698
93382
|
var cleanup = this.state.cleanups.get(id);
|
|
92699
93383
|
if (cleanup) {
|
|
92700
93384
|
cleanup();
|
|
@@ -92702,13 +93386,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92702
93386
|
}
|
|
92703
93387
|
this.state.contents.delete(id);
|
|
92704
93388
|
this.state.contentMountElements.delete(id);
|
|
93389
|
+
this.state.autoHeightModes.delete(id);
|
|
93390
|
+
this.invalidateContentInteractionZones(id);
|
|
93391
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93392
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92705
93393
|
this.cleanupAutoHeight(id);
|
|
92706
93394
|
};
|
|
92707
93395
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
92708
|
-
var _this_state_elements_get;
|
|
93396
|
+
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
92709
93397
|
this.cleanupOverlayContent(id);
|
|
92710
93398
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93399
|
+
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
92711
93400
|
this.state.elements.delete(id);
|
|
93401
|
+
this.state.selectionElements.delete(id);
|
|
92712
93402
|
this.state.contentScaleElements.delete(id);
|
|
92713
93403
|
this.state.contentElements.delete(id);
|
|
92714
93404
|
};
|
|
@@ -92717,11 +93407,27 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92717
93407
|
this.cleanupAutoHeight(id);
|
|
92718
93408
|
return;
|
|
92719
93409
|
}
|
|
93410
|
+
this.ensureAutoHeightMode(id);
|
|
93411
|
+
if (this.state.autoHeightModes.get(id) === 'message') {
|
|
93412
|
+
this.cleanupAutoHeight(id);
|
|
93413
|
+
return;
|
|
93414
|
+
}
|
|
92720
93415
|
if (!this.state.autoHeightCleanups.has(id)) {
|
|
92721
93416
|
this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
|
|
92722
93417
|
}
|
|
92723
93418
|
this.scheduleAutoHeightMeasure(id);
|
|
92724
93419
|
};
|
|
93420
|
+
_proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
|
|
93421
|
+
var _this_state_contents_get;
|
|
93422
|
+
if (this.state.autoHeightModes.has(id)) {
|
|
93423
|
+
return;
|
|
93424
|
+
}
|
|
93425
|
+
var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
|
|
93426
|
+
if (!content) {
|
|
93427
|
+
return;
|
|
93428
|
+
}
|
|
93429
|
+
this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
|
|
93430
|
+
};
|
|
92725
93431
|
_proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
|
|
92726
93432
|
var _this = this;
|
|
92727
93433
|
var cleanupFns = [];
|
|
@@ -92799,7 +93505,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92799
93505
|
if (this.state.autoHeightFrames.has(id)) {
|
|
92800
93506
|
return;
|
|
92801
93507
|
}
|
|
92802
|
-
var frame =
|
|
93508
|
+
var frame = requestHTMLOverlayFrame(function() {
|
|
92803
93509
|
_this.state.autoHeightFrames.delete(id);
|
|
92804
93510
|
_this.measureAutoHeight(id);
|
|
92805
93511
|
});
|
|
@@ -92809,7 +93515,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92809
93515
|
var item = this.options.getItems().find(function(candidate) {
|
|
92810
93516
|
return candidate.id === id;
|
|
92811
93517
|
});
|
|
92812
|
-
if (!
|
|
93518
|
+
if (!this.isAutoHeightEnabled(item)) {
|
|
92813
93519
|
this.cleanupAutoHeight(id);
|
|
92814
93520
|
return;
|
|
92815
93521
|
}
|
|
@@ -92828,7 +93534,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92828
93534
|
}).filter(function(height) {
|
|
92829
93535
|
return typeof height === 'number' && Number.isFinite(height) && height > 0;
|
|
92830
93536
|
});
|
|
92831
|
-
var childHeight = this.getChildrenNaturalHeight(element
|
|
93537
|
+
var childHeight = this.getChildrenNaturalHeight(element, {
|
|
93538
|
+
includeIframes: iframeHeights.length === 0
|
|
93539
|
+
});
|
|
92832
93540
|
var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
|
|
92833
93541
|
childHeight
|
|
92834
93542
|
], iframeHeights));
|
|
@@ -92848,10 +93556,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92848
93556
|
}
|
|
92849
93557
|
return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
|
|
92850
93558
|
};
|
|
92851
|
-
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
|
|
92852
|
-
|
|
92853
|
-
|
|
92854
|
-
|
|
93559
|
+
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element, options) {
|
|
93560
|
+
var _ref;
|
|
93561
|
+
var includeIframes = (_ref = options == null ? void 0 : options.includeIframes) != null ? _ref : true;
|
|
93562
|
+
return Array.from(element.childNodes).reduce(function(height, child) {
|
|
93563
|
+
var _child_textContent;
|
|
93564
|
+
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
93565
|
+
var childElement = child;
|
|
93566
|
+
if (!includeIframes && childElement.tagName === 'IFRAME') {
|
|
93567
|
+
return height;
|
|
93568
|
+
}
|
|
93569
|
+
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93570
|
+
}
|
|
93571
|
+
if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
|
|
93572
|
+
var range = element.ownerDocument.createRange();
|
|
93573
|
+
range.selectNodeContents(child);
|
|
93574
|
+
var rects = Array.from(range.getClientRects());
|
|
93575
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
93576
|
+
range.detach();
|
|
93577
|
+
return rects.reduce(function(textHeight, rect) {
|
|
93578
|
+
return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
|
|
93579
|
+
}, height);
|
|
93580
|
+
}
|
|
93581
|
+
return height;
|
|
92855
93582
|
}, 0);
|
|
92856
93583
|
};
|
|
92857
93584
|
_proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
|
|
@@ -92862,7 +93589,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92862
93589
|
}
|
|
92863
93590
|
var frame = this.state.autoHeightFrames.get(id);
|
|
92864
93591
|
if (frame !== undefined) {
|
|
92865
|
-
|
|
93592
|
+
cancelHTMLOverlayFrame(frame);
|
|
92866
93593
|
this.state.autoHeightFrames.delete(id);
|
|
92867
93594
|
}
|
|
92868
93595
|
};
|
|
@@ -92870,14 +93597,59 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92870
93597
|
var item = this.options.getItems().find(function(candidate) {
|
|
92871
93598
|
return candidate.id === id;
|
|
92872
93599
|
});
|
|
92873
|
-
if (!isCardItem(item) || item
|
|
93600
|
+
if (!isCardItem(item) || !this.isAutoHeightEnabled(item)) {
|
|
93601
|
+
return;
|
|
93602
|
+
}
|
|
93603
|
+
if (!Number.isFinite(height) || height <= 0) {
|
|
92874
93604
|
return;
|
|
92875
93605
|
}
|
|
92876
|
-
|
|
93606
|
+
var nextHeight = Math.ceil(this.getAutoHeightItemHeight(item, height));
|
|
93607
|
+
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
92877
93608
|
return;
|
|
92878
93609
|
}
|
|
92879
|
-
this.options.setCardItemHeight(id,
|
|
93610
|
+
this.options.setCardItemHeight(id, nextHeight, {
|
|
93611
|
+
anchor: this.getAutoHeightAnchor(item),
|
|
93612
|
+
previousHeight: item.property.height
|
|
93613
|
+
});
|
|
92880
93614
|
};
|
|
93615
|
+
_proto.getAutoHeightAnchor = function getAutoHeightAnchor(item) {
|
|
93616
|
+
var _ref;
|
|
93617
|
+
var _this_options_resolveCardTypeConfig;
|
|
93618
|
+
if (!isCardItem(item)) {
|
|
93619
|
+
return 'top';
|
|
93620
|
+
}
|
|
93621
|
+
return (_ref = (_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeightAnchor) != null ? _ref : 'top';
|
|
93622
|
+
};
|
|
93623
|
+
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
93624
|
+
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
93625
|
+
return contentHeight;
|
|
93626
|
+
}
|
|
93627
|
+
var scaleOverlay = this.state.contentScaleElements.get(item.id);
|
|
93628
|
+
var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
|
|
93629
|
+
if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
|
|
93630
|
+
return contentHeight;
|
|
93631
|
+
}
|
|
93632
|
+
return contentHeight / displayedHeight * item.property.height;
|
|
93633
|
+
};
|
|
93634
|
+
_proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
|
|
93635
|
+
var _this_options_resolveCardTypeConfig;
|
|
93636
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
|
|
93637
|
+
};
|
|
93638
|
+
_proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
|
|
93639
|
+
var _this_options_resolveCardTypeConfig;
|
|
93640
|
+
if (!isCardItem(item)) {
|
|
93641
|
+
return true;
|
|
93642
|
+
}
|
|
93643
|
+
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
93644
|
+
};
|
|
93645
|
+
_create_class(HTMLOverlayManager, [
|
|
93646
|
+
{
|
|
93647
|
+
key: "layerElement",
|
|
93648
|
+
get: function get() {
|
|
93649
|
+
return this.state.layer;
|
|
93650
|
+
}
|
|
93651
|
+
}
|
|
93652
|
+
]);
|
|
92881
93653
|
return HTMLOverlayManager;
|
|
92882
93654
|
}();
|
|
92883
93655
|
function waitForCardCaptureReady(root) {
|
|
@@ -92919,9 +93691,20 @@ function waitForCardCaptureReady(root) {
|
|
|
92919
93691
|
});
|
|
92920
93692
|
})();
|
|
92921
93693
|
}
|
|
93694
|
+
function formatCssColor(color, alpha) {
|
|
93695
|
+
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93696
|
+
var red = normalizedColor >> 16 & 0xFF;
|
|
93697
|
+
var green = normalizedColor >> 8 & 0xFF;
|
|
93698
|
+
var blue = normalizedColor & 0xFF;
|
|
93699
|
+
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93700
|
+
}
|
|
93701
|
+
function formatCssNumber(value) {
|
|
93702
|
+
var normalized = Number.isFinite(value) ? value : 0;
|
|
93703
|
+
return Number(normalized.toFixed(6)).toString();
|
|
93704
|
+
}
|
|
92922
93705
|
function nextAnimationFrame() {
|
|
92923
93706
|
return new Promise(function(resolve) {
|
|
92924
|
-
|
|
93707
|
+
requestHTMLOverlayFrame(function() {
|
|
92925
93708
|
resolve();
|
|
92926
93709
|
});
|
|
92927
93710
|
});
|
|
@@ -93337,6 +94120,9 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93337
94120
|
});
|
|
93338
94121
|
return replacement;
|
|
93339
94122
|
}
|
|
94123
|
+
function isMouseEventInsideRect(event, rect) {
|
|
94124
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
94125
|
+
}
|
|
93340
94126
|
function createFlattenedIframeContent(iframe) {
|
|
93341
94127
|
var doc = iframe.contentDocument;
|
|
93342
94128
|
if (!doc) {
|
|
@@ -93376,6 +94162,19 @@ function withTimeout(promise, timeout) {
|
|
|
93376
94162
|
});
|
|
93377
94163
|
}
|
|
93378
94164
|
|
|
94165
|
+
function orderSDKCanvasLayers(param) {
|
|
94166
|
+
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
94167
|
+
[
|
|
94168
|
+
playerContainer,
|
|
94169
|
+
htmlOverlayLayer,
|
|
94170
|
+
gestureCanvas
|
|
94171
|
+
].forEach(function(layer) {
|
|
94172
|
+
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
94173
|
+
container.appendChild(layer);
|
|
94174
|
+
}
|
|
94175
|
+
});
|
|
94176
|
+
}
|
|
94177
|
+
|
|
93379
94178
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93380
94179
|
var SDK = /*#__PURE__*/ function() {
|
|
93381
94180
|
function SDK(container, mode) {
|
|
@@ -93474,16 +94273,72 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93474
94273
|
bottom: HTML_CARD_EDITING_VIEWPORT_PADDING
|
|
93475
94274
|
}, box);
|
|
93476
94275
|
},
|
|
93477
|
-
setCardItemHeight: function setCardItemHeight(id, height) {
|
|
94276
|
+
setCardItemHeight: function setCardItemHeight(id, height, options) {
|
|
94277
|
+
var item = _this.getSDKItem(id);
|
|
94278
|
+
if (!isCardItem(item) || options.anchor === 'center') {
|
|
94279
|
+
void _this.setItemProperty({
|
|
94280
|
+
itemId: id,
|
|
94281
|
+
type: SDKItemType.CARD,
|
|
94282
|
+
propertyName: 'height',
|
|
94283
|
+
propertyValue: height
|
|
94284
|
+
});
|
|
94285
|
+
return;
|
|
94286
|
+
}
|
|
94287
|
+
var _item_property_position = item.property.position, x = _item_property_position[0], y = _item_property_position[1];
|
|
94288
|
+
var deltaY = (height - options.previousHeight) / 2;
|
|
93478
94289
|
void _this.setItemProperty({
|
|
93479
94290
|
itemId: id,
|
|
93480
94291
|
type: SDKItemType.CARD,
|
|
93481
|
-
|
|
93482
|
-
|
|
94292
|
+
property: {
|
|
94293
|
+
height: height,
|
|
94294
|
+
position: [
|
|
94295
|
+
x,
|
|
94296
|
+
y + deltaY
|
|
94297
|
+
]
|
|
94298
|
+
}
|
|
93483
94299
|
});
|
|
94300
|
+
},
|
|
94301
|
+
getSelectedItemIds: function getSelectedItemIds() {
|
|
94302
|
+
var _ref;
|
|
94303
|
+
var _this__pageData;
|
|
94304
|
+
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
94305
|
+
},
|
|
94306
|
+
setSelectedItemIds: function setSelectedItemIds(ids) {
|
|
94307
|
+
_this.setSelectedItems(ids);
|
|
94308
|
+
},
|
|
94309
|
+
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
94310
|
+
var _this__pageData;
|
|
94311
|
+
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
94312
|
+
},
|
|
94313
|
+
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
94314
|
+
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, wireframeColor = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeColor, wireframeAlpha = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeAlpha, wireframeWidth = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeWidth;
|
|
94315
|
+
return {
|
|
94316
|
+
color: wireframeColor,
|
|
94317
|
+
alpha: wireframeAlpha,
|
|
94318
|
+
width: wireframeWidth
|
|
94319
|
+
};
|
|
94320
|
+
},
|
|
94321
|
+
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
94322
|
+
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
94323
|
+
return {
|
|
94324
|
+
color: preSelectedColor,
|
|
94325
|
+
alpha: 1,
|
|
94326
|
+
width: preSelectedWidth
|
|
94327
|
+
};
|
|
94328
|
+
},
|
|
94329
|
+
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
94330
|
+
var _this__gestureHandler;
|
|
94331
|
+
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
94332
|
+
},
|
|
94333
|
+
resolveCardHTML: function resolveCardHTML(item) {
|
|
94334
|
+
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
94335
|
+
},
|
|
94336
|
+
resolveCardTypeConfig: function resolveCardTypeConfig(item) {
|
|
94337
|
+
return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
|
|
93484
94338
|
}
|
|
93485
94339
|
});
|
|
93486
94340
|
this._htmlOverlayManager.attach();
|
|
94341
|
+
this.syncCanvasLayerOrder();
|
|
93487
94342
|
}
|
|
93488
94343
|
var _proto = SDK.prototype;
|
|
93489
94344
|
_proto.dispose = function dispose() {
|
|
@@ -93503,18 +94358,22 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93503
94358
|
_proto.initPlayer = function initPlayer(mode) {
|
|
93504
94359
|
var _this = this;
|
|
93505
94360
|
var playerContainer = document.createElement('div');
|
|
93506
|
-
var _ref = mode === '
|
|
93507
|
-
this._container.clientWidth,
|
|
93508
|
-
this._container.clientHeight
|
|
93509
|
-
] : [
|
|
94361
|
+
var _ref = mode === 'template' ? [
|
|
93510
94362
|
this._container.offsetWidth,
|
|
93511
94363
|
this._container.offsetHeight
|
|
94364
|
+
] : [
|
|
94365
|
+
document.documentElement.clientWidth,
|
|
94366
|
+
document.documentElement.clientHeight
|
|
93512
94367
|
], width = _ref[0], height = _ref[1];
|
|
93513
94368
|
this._playerContainer = playerContainer;
|
|
93514
94369
|
this._playerContainer.id = 'player-container';
|
|
93515
94370
|
this._playerContainer.style.position = 'absolute';
|
|
93516
94371
|
this._playerContainer.style.width = "" + width + "px";
|
|
93517
94372
|
this._playerContainer.style.height = "" + height + "px";
|
|
94373
|
+
if (mode === 'editor') {
|
|
94374
|
+
this._playerContainer.style.left = '0px';
|
|
94375
|
+
this._playerContainer.style.top = '0px';
|
|
94376
|
+
}
|
|
93518
94377
|
this._container.appendChild(playerContainer);
|
|
93519
94378
|
this.player = new EFFECTS.Player({
|
|
93520
94379
|
container: this._playerContainer,
|
|
@@ -93573,18 +94432,48 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93573
94432
|
_this._gestureHandler.dispose();
|
|
93574
94433
|
setTimeout(function() {
|
|
93575
94434
|
return _async_to_generator(function() {
|
|
94435
|
+
var itemExtension, _this_pageData, _this_pageData1, createInfos;
|
|
93576
94436
|
return _ts_generator(this, function(_state) {
|
|
93577
94437
|
switch(_state.label){
|
|
93578
94438
|
case 0:
|
|
93579
94439
|
this.initPlayer(SDK.config.mode);
|
|
93580
94440
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
93581
94441
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94442
|
+
this.syncCanvasLayerOrder();
|
|
94443
|
+
itemExtension = {};
|
|
94444
|
+
if (!(SDK.config.mode === 'template')) return [
|
|
94445
|
+
3,
|
|
94446
|
+
2
|
|
94447
|
+
];
|
|
94448
|
+
(_this_pageData = this.pageData) == null ? void 0 : _this_pageData.items.forEach(function(item) {
|
|
94449
|
+
itemExtension[item.id] = item.getAllExtension();
|
|
94450
|
+
});
|
|
93582
94451
|
return [
|
|
93583
94452
|
4,
|
|
93584
94453
|
this.runByPageData(this.pageData)
|
|
93585
94454
|
];
|
|
93586
94455
|
case 1:
|
|
93587
94456
|
_state.sent();
|
|
94457
|
+
(_this_pageData1 = this.pageData) == null ? void 0 : _this_pageData1.items.forEach(function(item) {
|
|
94458
|
+
var extension = itemExtension[item.id];
|
|
94459
|
+
if (extension) {
|
|
94460
|
+
item.setExtensions(extension);
|
|
94461
|
+
}
|
|
94462
|
+
});
|
|
94463
|
+
return [
|
|
94464
|
+
3,
|
|
94465
|
+
4
|
|
94466
|
+
];
|
|
94467
|
+
case 2:
|
|
94468
|
+
createInfos = this.getItemCreateInfos();
|
|
94469
|
+
return [
|
|
94470
|
+
4,
|
|
94471
|
+
this.runByCreateInfos(createInfos)
|
|
94472
|
+
];
|
|
94473
|
+
case 3:
|
|
94474
|
+
_state.sent();
|
|
94475
|
+
_state.label = 4;
|
|
94476
|
+
case 4:
|
|
93588
94477
|
this._eventEmitter.emit('viewRebuildFinish');
|
|
93589
94478
|
return [
|
|
93590
94479
|
2
|
|
@@ -93628,6 +94517,16 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93628
94517
|
env: 'editor'
|
|
93629
94518
|
});
|
|
93630
94519
|
this.player.resize();
|
|
94520
|
+
this.syncCanvasLayerOrder();
|
|
94521
|
+
};
|
|
94522
|
+
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94523
|
+
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94524
|
+
orderSDKCanvasLayers({
|
|
94525
|
+
container: this._container,
|
|
94526
|
+
playerContainer: this._playerContainer,
|
|
94527
|
+
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94528
|
+
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94529
|
+
});
|
|
93631
94530
|
};
|
|
93632
94531
|
_proto.getInitParam = function getInitParam(param) {
|
|
93633
94532
|
return _async_to_generator(function() {
|
|
@@ -94424,6 +95323,55 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94424
95323
|
});
|
|
94425
95324
|
}).call(this);
|
|
94426
95325
|
};
|
|
95326
|
+
_proto.runByCreateInfos = function runByCreateInfos(createInfos) {
|
|
95327
|
+
return _async_to_generator(function() {
|
|
95328
|
+
var _this__pageData_activeData_view, _this__pageData_activeData_view1, viewSize, scene, targetViewProperty;
|
|
95329
|
+
return _ts_generator(this, function(_state) {
|
|
95330
|
+
switch(_state.label){
|
|
95331
|
+
case 0:
|
|
95332
|
+
EFFECTS.assertExist(this._pageData, 'You must call SDK#run() first');
|
|
95333
|
+
this._pageData.property.zoom = 1;
|
|
95334
|
+
this._pageData.property.translation = [
|
|
95335
|
+
0,
|
|
95336
|
+
0
|
|
95337
|
+
];
|
|
95338
|
+
this._pageDataUtils.init();
|
|
95339
|
+
return [
|
|
95340
|
+
4,
|
|
95341
|
+
this._gestureHandler.init(this._pageDataUtils, this._eventEmitter)
|
|
95342
|
+
];
|
|
95343
|
+
case 1:
|
|
95344
|
+
_state.sent();
|
|
95345
|
+
viewSize = [
|
|
95346
|
+
this._playerContainer.offsetWidth,
|
|
95347
|
+
this._playerContainer.offsetHeight
|
|
95348
|
+
];
|
|
95349
|
+
scene = getBasicScene(viewSize);
|
|
95350
|
+
targetViewProperty = this.getViewProperty((_this__pageData_activeData_view = this._pageData.activeData.view) != null ? _this__pageData_activeData_view : 0);
|
|
95351
|
+
if (targetViewProperty) {
|
|
95352
|
+
targetViewProperty.scene = scene;
|
|
95353
|
+
}
|
|
95354
|
+
return [
|
|
95355
|
+
4,
|
|
95356
|
+
this._pageDataUtils.loadScene((_this__pageData_activeData_view1 = this._pageData.activeData.view) != null ? _this__pageData_activeData_view1 : 0)
|
|
95357
|
+
];
|
|
95358
|
+
case 2:
|
|
95359
|
+
_state.sent();
|
|
95360
|
+
return [
|
|
95361
|
+
4,
|
|
95362
|
+
this.addItemByCreateInfos(createInfos)
|
|
95363
|
+
];
|
|
95364
|
+
case 3:
|
|
95365
|
+
_state.sent();
|
|
95366
|
+
this._pageDataUtils.refreshPageTime(this._pageData.time);
|
|
95367
|
+
this._eventEmitter.emit('pageDataChange', this.pageData);
|
|
95368
|
+
return [
|
|
95369
|
+
2
|
|
95370
|
+
];
|
|
95371
|
+
}
|
|
95372
|
+
});
|
|
95373
|
+
}).call(this);
|
|
95374
|
+
};
|
|
94427
95375
|
_proto.reloadPageDataByScene = function reloadPageDataByScene(scene) {
|
|
94428
95376
|
return _async_to_generator(function() {
|
|
94429
95377
|
var _ref, _this__pageData_activeData_view, _ref1, _ref2, _loadScene_compositions_find, _this_player_getCompositions_, _this_player_getCompositions_1, loadScene, response, error;
|
|
@@ -94722,8 +95670,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94722
95670
|
* @param ignoreClamp 是否忽视约束
|
|
94723
95671
|
*/ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
|
|
94724
95672
|
EFFECTS.assertExist(this._pageData);
|
|
94725
|
-
this.
|
|
94726
|
-
this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
|
|
95673
|
+
this._pageDataUtils.setPageZoom(zoom, center, ignoreClamp);
|
|
94727
95674
|
this._gestureHandler.render();
|
|
94728
95675
|
};
|
|
94729
95676
|
/**
|
|
@@ -95119,7 +96066,11 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95119
96066
|
return item.id;
|
|
95120
96067
|
})) != null ? _ref : [];
|
|
95121
96068
|
ids.forEach(function(id) {
|
|
95122
|
-
var
|
|
96069
|
+
var _this__pageDataUtils_getItemCreateInfo;
|
|
96070
|
+
var _this_pageData_items_find, _this_pageData;
|
|
96071
|
+
var createInfo = (_this__pageDataUtils_getItemCreateInfo = _this._pageDataUtils.getItemCreateInfo(id, true)) != null ? _this__pageDataUtils_getItemCreateInfo : (_this_pageData = _this.pageData) == null ? void 0 : (_this_pageData_items_find = _this_pageData.items.find(function(item) {
|
|
96072
|
+
return item.id === id;
|
|
96073
|
+
})) == null ? void 0 : _this_pageData_items_find.toCreateInfo(true);
|
|
95123
96074
|
if (createInfo) {
|
|
95124
96075
|
createInfos.push(createInfo);
|
|
95125
96076
|
}
|
|
@@ -95619,6 +96570,76 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95619
96570
|
});
|
|
95620
96571
|
};
|
|
95621
96572
|
/**
|
|
96573
|
+
* @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
|
|
96574
|
+
* @param item 卡片元素
|
|
96575
|
+
* @returns HTML 渲染配置
|
|
96576
|
+
*/ _proto.resolveCardHTML = function resolveCardHTML(item) {
|
|
96577
|
+
var _cardTypeConfig_html;
|
|
96578
|
+
var cardTypeConfig = this.resolveCardTypeConfig(item);
|
|
96579
|
+
return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
|
|
96580
|
+
};
|
|
96581
|
+
/**
|
|
96582
|
+
* @description 按 cardType 从注册表解析卡片类型配置。
|
|
96583
|
+
* @param item 卡片元素
|
|
96584
|
+
* @returns 卡片类型配置
|
|
96585
|
+
*/ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
|
|
96586
|
+
return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
96587
|
+
return t.type === item.cardType;
|
|
96588
|
+
});
|
|
96589
|
+
};
|
|
96590
|
+
/**
|
|
96591
|
+
* @description 重新解析并挂载指定卡片的 HTML 内容。
|
|
96592
|
+
* @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
|
|
96593
|
+
* @param id 卡片元素 ID
|
|
96594
|
+
* @returns 是否成功触发刷新
|
|
96595
|
+
*/ _proto.refreshCardHTML = function refreshCardHTML(id) {
|
|
96596
|
+
var _this__htmlOverlayManager, _this__htmlOverlayManager1;
|
|
96597
|
+
var item = this.getSDKItem(id);
|
|
96598
|
+
if (!isCardItem(item)) {
|
|
96599
|
+
console.warn('CardItem "' + id + '" not found.');
|
|
96600
|
+
return false;
|
|
96601
|
+
}
|
|
96602
|
+
if (!this.resolveCardHTML(item)) {
|
|
96603
|
+
console.warn('CardItem "' + id + '" has no registered HTML renderer.');
|
|
96604
|
+
return false;
|
|
96605
|
+
}
|
|
96606
|
+
(_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
|
|
96607
|
+
(_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
|
|
96608
|
+
return true;
|
|
96609
|
+
};
|
|
96610
|
+
/**
|
|
96611
|
+
* @description 获取指定 HTML 卡片当前 iframe 的 window。
|
|
96612
|
+
* @description 仅 inline/document 或自行渲染 iframe 的 DOM 内容会返回 window。
|
|
96613
|
+
* @param id 卡片元素 ID
|
|
96614
|
+
* @returns HTML iframe window
|
|
96615
|
+
*/ _proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
96616
|
+
var _this__htmlOverlayManager;
|
|
96617
|
+
return (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.getHtmlCardWindow(id);
|
|
96618
|
+
};
|
|
96619
|
+
/**
|
|
96620
|
+
* @description 向指定 HTML 卡片发送增量 patch。
|
|
96621
|
+
* @description 当卡片内容配置了 CardHTMLPatchHandler 时,可用于局部更新 HTML,而不必整卡 refresh。
|
|
96622
|
+
* @param id 卡片元素 ID
|
|
96623
|
+
* @param patch patch 负载,由卡片内容自己的 patch handler 解释
|
|
96624
|
+
* @returns 是否被 patch handler 处理
|
|
96625
|
+
*/ _proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
96626
|
+
var _ref;
|
|
96627
|
+
var _this__htmlOverlayManager;
|
|
96628
|
+
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.patchCardHTML(id, patch)) != null ? _ref : false;
|
|
96629
|
+
};
|
|
96630
|
+
/**
|
|
96631
|
+
* @description 向指定 HTML 卡片 iframe 派发事件。
|
|
96632
|
+
* @description 通过 postMessage 投递事件,跨源/同源行为一致,消息 source 为 vvfx-card-html-event。
|
|
96633
|
+
* @param id 卡片元素 ID
|
|
96634
|
+
* @param type 事件名称
|
|
96635
|
+
* @param detail 事件 detail
|
|
96636
|
+
* @returns 是否成功派发或投递
|
|
96637
|
+
*/ _proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
96638
|
+
var _ref;
|
|
96639
|
+
var _this__htmlOverlayManager;
|
|
96640
|
+
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.dispatchHtmlCardEvent(id, type, detail)) != null ? _ref : false;
|
|
96641
|
+
};
|
|
96642
|
+
/**
|
|
95622
96643
|
* @description 创建卡片元素
|
|
95623
96644
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
95624
96645
|
* @param createInfo 卡片创建信息
|
|
@@ -95913,8 +96934,8 @@ SDK.config = BaseConfig;
|
|
|
95913
96934
|
_inherits(CardItem, BaseItem);
|
|
95914
96935
|
function CardItem(options) {
|
|
95915
96936
|
var _this;
|
|
95916
|
-
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5
|
|
95917
|
-
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5
|
|
96937
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
|
96938
|
+
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5;
|
|
95918
96939
|
_this = BaseItem.call(this, options) || this, /**
|
|
95919
96940
|
* @description 元素类型
|
|
95920
96941
|
*/ _this.type = SDKItemType.CARD;
|
|
@@ -95935,9 +96956,7 @@ SDK.config = BaseConfig;
|
|
|
95935
96956
|
1,
|
|
95936
96957
|
1
|
|
95937
96958
|
],
|
|
95938
|
-
cardType: (_ref5 = (
|
|
95939
|
-
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
95940
|
-
html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
|
|
96959
|
+
cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown'
|
|
95941
96960
|
};
|
|
95942
96961
|
return _this;
|
|
95943
96962
|
}
|
|
@@ -95948,22 +96967,18 @@ SDK.config = BaseConfig;
|
|
|
95948
96967
|
* @param withParent 是否包含父节点ID
|
|
95949
96968
|
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
95950
96969
|
var extension = this.getAllExtension();
|
|
95951
|
-
var property = deepClone(this.property);
|
|
95952
|
-
property.html = this.html;
|
|
95953
96970
|
return {
|
|
95954
96971
|
type: SDKItemType.CARD,
|
|
95955
96972
|
id: this.id,
|
|
95956
96973
|
name: this.name,
|
|
95957
96974
|
parentId: withParent ? this.parentId : undefined,
|
|
95958
96975
|
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
95959
|
-
property: property
|
|
96976
|
+
property: deepClone(this.property)
|
|
95960
96977
|
};
|
|
95961
96978
|
};
|
|
95962
96979
|
/**
|
|
95963
96980
|
* @description 克隆 SDKItem
|
|
95964
96981
|
*/ _proto.clone = function clone() {
|
|
95965
|
-
var property = deepClone(this.property);
|
|
95966
|
-
property.html = this.html;
|
|
95967
96982
|
return new CardItem({
|
|
95968
96983
|
id: EFFECTS.generateGUID(),
|
|
95969
96984
|
name: this.name,
|
|
@@ -95973,7 +96988,7 @@ SDK.config = BaseConfig;
|
|
|
95973
96988
|
endBehavior: this.endBehavior,
|
|
95974
96989
|
isLocked: this.isLocked,
|
|
95975
96990
|
isCoreEditable: this.isCoreEditable,
|
|
95976
|
-
property: property,
|
|
96991
|
+
property: deepClone(this.property),
|
|
95977
96992
|
extension: this.getAllExtension()
|
|
95978
96993
|
});
|
|
95979
96994
|
};
|
|
@@ -95990,17 +97005,6 @@ SDK.config = BaseConfig;
|
|
|
95990
97005
|
this.property.cardType = value;
|
|
95991
97006
|
}
|
|
95992
97007
|
},
|
|
95993
|
-
{
|
|
95994
|
-
key: "html",
|
|
95995
|
-
get: /**
|
|
95996
|
-
* @description HTML 覆盖层配置
|
|
95997
|
-
*/ function get() {
|
|
95998
|
-
return this.property.html;
|
|
95999
|
-
},
|
|
96000
|
-
set: function set(value) {
|
|
96001
|
-
this.property.html = value;
|
|
96002
|
-
}
|
|
96003
|
-
},
|
|
96004
97008
|
{
|
|
96005
97009
|
key: "position",
|
|
96006
97010
|
get: // ==================== 便捷访问器 ====================
|
|
@@ -96013,6 +97017,16 @@ SDK.config = BaseConfig;
|
|
|
96013
97017
|
this.property.position = value;
|
|
96014
97018
|
}
|
|
96015
97019
|
},
|
|
97020
|
+
{
|
|
97021
|
+
key: "isAutoScale",
|
|
97022
|
+
get: function get() {
|
|
97023
|
+
var _this = this;
|
|
97024
|
+
var config = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
97025
|
+
return t.type === _this.cardType;
|
|
97026
|
+
});
|
|
97027
|
+
return (config == null ? void 0 : config.autoScale) !== false;
|
|
97028
|
+
}
|
|
97029
|
+
},
|
|
96016
97030
|
{
|
|
96017
97031
|
key: "width",
|
|
96018
97032
|
get: /**
|