@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.js
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
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -47166,7 +47166,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47166
47166
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47167
47167
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47168
47168
|
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;
|
|
47169
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47169
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty()) && !isCardItem(preSelectedItem)) {
|
|
47170
47170
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47171
47171
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47172
47172
|
}
|
|
@@ -55352,7 +55352,9 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55352
55352
|
return;
|
|
55353
55353
|
}
|
|
55354
55354
|
var selectedItem = (_selectedItems_ = selectedItems[0]) != null ? _selectedItems_ : undefined;
|
|
55355
|
-
|
|
55355
|
+
// html卡片内容在非自动缩放的情况下,拖动的时候内容自适应,因此与智能画板一样,需要默认是自由缩放(即自由改大小)
|
|
55356
|
+
var isSingleAutoFitContentCardItem = selectedItems.length === 1 && selectedItem && isCardItem(selectedItem) && !selectedItem.isAutoScale;
|
|
55357
|
+
var isShiftLockScale = selectedItem && selectedItems.length === 1 && (isFrameItem(selectedItem) || isSingleAutoFitContentCardItem) ? !this.isShiftDown : this.isShiftDown;
|
|
55356
55358
|
var farthestCorner = this.scaleParam.farthestCorner;
|
|
55357
55359
|
var isValidScale = (scaleCorner.x - farthestCorner.x) * (this.cursorPoint.x - farthestCorner.x) > 0 && (scaleCorner.y - farthestCorner.y) * (this.cursorPoint.y - farthestCorner.y) > 0;
|
|
55358
55360
|
if (!isValidScale && this.isLockScale && !this.isShiftDown) {
|
|
@@ -55369,7 +55371,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55369
55371
|
var currentStartScale = startScale.clone().multiply(lastScalar);
|
|
55370
55372
|
var currentScale = worldPosition1.clone().subtract(cornerShift).subtract(center1).applyMatrix(rotationMatrix);
|
|
55371
55373
|
var scalar = new Vector3(1, 1, 1);
|
|
55372
|
-
if (!this.isLockScale ||
|
|
55374
|
+
if (!this.isLockScale || isShiftLockScale) {
|
|
55373
55375
|
scalar.x = isEqual$1(currentStartScale.x, 0) ? 1 : currentScale.x / currentStartScale.x;
|
|
55374
55376
|
scalar.y = isEqual$1(currentStartScale.y, 0) ? 1 : currentScale.y / currentStartScale.y;
|
|
55375
55377
|
scalar.z = isEqual$1(currentStartScale.z, 0) ? 1 : currentScale.z / currentStartScale.z;
|
|
@@ -55426,6 +55428,23 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55426
55428
|
newWidth,
|
|
55427
55429
|
newHeight
|
|
55428
55430
|
], translation1);
|
|
55431
|
+
} else if (isSingleAutoFitContentCardItem && selectedItem && isCardItem(selectedItem)) {
|
|
55432
|
+
var currentWidth1 = selectedItem.pixelWidth;
|
|
55433
|
+
var currentHeight1 = selectedItem.pixelHeight;
|
|
55434
|
+
var newWidth1 = currentWidth1 * resultScalar1.x;
|
|
55435
|
+
var newHeight1 = currentHeight1 * resultScalar1.y;
|
|
55436
|
+
this._pageDataUtils.resizeCardItem(selectedItem.id, [
|
|
55437
|
+
newWidth1,
|
|
55438
|
+
newHeight1
|
|
55439
|
+
], translation1);
|
|
55440
|
+
void this._pageDataUtils.setItemProperty({
|
|
55441
|
+
itemId: selectedItem.id,
|
|
55442
|
+
type: SDKItemType.CARD,
|
|
55443
|
+
property: {
|
|
55444
|
+
width: newWidth1,
|
|
55445
|
+
height: newHeight1
|
|
55446
|
+
}
|
|
55447
|
+
});
|
|
55429
55448
|
} else {
|
|
55430
55449
|
// 普通元素的缩放逻辑
|
|
55431
55450
|
selectedItems.forEach(function(item) {
|
|
@@ -55750,6 +55769,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55750
55769
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55751
55770
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55752
55771
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55772
|
+
var isSingleCardItem = isCardItem(selectedItem);
|
|
55753
55773
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55754
55774
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55755
55775
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55789,9 +55809,11 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55789
55809
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55790
55810
|
// 根据box获取边缘线
|
|
55791
55811
|
var corners = this.wireframe.box.corners;
|
|
55792
|
-
|
|
55793
|
-
|
|
55794
|
-
|
|
55812
|
+
if (!isSingleCardItem) {
|
|
55813
|
+
corners.forEach(function(corner, i) {
|
|
55814
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55815
|
+
});
|
|
55816
|
+
}
|
|
55795
55817
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55796
55818
|
// 成组暂不支持缩放
|
|
55797
55819
|
if (selectedItems.length === 1) {
|
|
@@ -59646,12 +59668,6 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
|
|
|
59646
59668
|
/**
|
|
59647
59669
|
* @description SDKItem position 属性的数字精度(保留小数位数)
|
|
59648
59670
|
*/ var POSITION_PRECISION = 4;
|
|
59649
|
-
function isCardHTMLContentValue(value) {
|
|
59650
|
-
return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
|
|
59651
|
-
}
|
|
59652
|
-
function isCardHTMLValue(value) {
|
|
59653
|
-
return isCardHTMLContentValue(value == null ? void 0 : value.content);
|
|
59654
|
-
}
|
|
59655
59671
|
var PageDataUtils = /*#__PURE__*/ function() {
|
|
59656
59672
|
function PageDataUtils(player, container, emitter, sdk) {
|
|
59657
59673
|
this.player = player;
|
|
@@ -60414,6 +60430,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60414
60430
|
}
|
|
60415
60431
|
}
|
|
60416
60432
|
var isLocked = (_this_getSDKItem = this.getSDKItem(playerItem.getInstanceId())) == null ? void 0 : _this_getSDKItem.isLocked;
|
|
60433
|
+
// 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
|
|
60434
|
+
var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
|
|
60417
60435
|
// 创建基础选项
|
|
60418
60436
|
var baseOptions = {
|
|
60419
60437
|
id: playerItem.getInstanceId(),
|
|
@@ -60425,12 +60443,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60425
60443
|
endBehavior: playerItem.endBehavior,
|
|
60426
60444
|
visible: isVisible,
|
|
60427
60445
|
isLocked: isLocked,
|
|
60428
|
-
isCoreEditable: isCoreEditable
|
|
60446
|
+
isCoreEditable: isCoreEditable,
|
|
60447
|
+
extension: existingSDKItem == null ? void 0 : existingSDKItem.extension
|
|
60429
60448
|
};
|
|
60430
60449
|
// 根据类型创建对应的 SDKItem 类实例
|
|
60431
60450
|
var sdkItem;
|
|
60432
|
-
// 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
|
|
60433
|
-
var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
|
|
60434
60451
|
// 如果找到了现有 SDKItem,根据 SDKItemType 创建
|
|
60435
60452
|
// 将类型转换为 string 进行比较
|
|
60436
60453
|
if ((existingSDKItem == null ? void 0 : existingSDKItem.type) === SDKItemType.GENERATOR) {
|
|
@@ -60469,11 +60486,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60469
60486
|
property: property
|
|
60470
60487
|
}));
|
|
60471
60488
|
} else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
|
|
60472
|
-
var cardType = existingSDKItem.cardType
|
|
60489
|
+
var cardType = existingSDKItem.cardType;
|
|
60473
60490
|
sdkItem = new CardItem(_extends({}, baseOptions, {
|
|
60474
60491
|
property: _extends({}, property, {
|
|
60475
|
-
cardType: cardType
|
|
60476
|
-
html: html
|
|
60492
|
+
cardType: cardType
|
|
60477
60493
|
})
|
|
60478
60494
|
}));
|
|
60479
60495
|
} else {
|
|
@@ -60700,6 +60716,19 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60700
60716
|
}).call(this);
|
|
60701
60717
|
};
|
|
60702
60718
|
/**
|
|
60719
|
+
* @description 设置元素extension字段
|
|
60720
|
+
*/ _proto.setItemExtension = function setItemExtension(itemId, extension) {
|
|
60721
|
+
var item = this.getSDKItem(itemId);
|
|
60722
|
+
if (!item) {
|
|
60723
|
+
console.warn('setItemExtension: item not found');
|
|
60724
|
+
return;
|
|
60725
|
+
}
|
|
60726
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.entries(extension)), _step; !(_step = _iterator()).done;){
|
|
60727
|
+
var _step_value = _step.value, key = _step_value[0], value = _step_value[1];
|
|
60728
|
+
item.extension.set(key, value);
|
|
60729
|
+
}
|
|
60730
|
+
};
|
|
60731
|
+
/**
|
|
60703
60732
|
* @description 场景 1: 设置单个元素的单个属性
|
|
60704
60733
|
*/ _proto.setSingleItemSingleProperty = function setSingleItemSingleProperty(param) {
|
|
60705
60734
|
return _async_to_generator(function() {
|
|
@@ -61057,40 +61086,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61057
61086
|
3,
|
|
61058
61087
|
31
|
|
61059
61088
|
];
|
|
61060
|
-
case 'html':
|
|
61061
|
-
return [
|
|
61062
|
-
3,
|
|
61063
|
-
32
|
|
61064
|
-
];
|
|
61065
61089
|
case 'position':
|
|
61066
61090
|
return [
|
|
61067
61091
|
3,
|
|
61068
|
-
|
|
61092
|
+
32
|
|
61069
61093
|
];
|
|
61070
61094
|
case 'rotation':
|
|
61071
61095
|
return [
|
|
61072
61096
|
3,
|
|
61073
|
-
|
|
61097
|
+
33
|
|
61074
61098
|
];
|
|
61075
61099
|
case 'scale':
|
|
61076
61100
|
return [
|
|
61077
61101
|
3,
|
|
61078
|
-
|
|
61102
|
+
34
|
|
61079
61103
|
];
|
|
61080
61104
|
case 'layoutMode':
|
|
61081
61105
|
return [
|
|
61082
61106
|
3,
|
|
61083
|
-
|
|
61107
|
+
35
|
|
61084
61108
|
];
|
|
61085
61109
|
case 'visible':
|
|
61086
61110
|
return [
|
|
61087
61111
|
3,
|
|
61088
|
-
|
|
61112
|
+
36
|
|
61089
61113
|
];
|
|
61090
61114
|
}
|
|
61091
61115
|
return [
|
|
61092
61116
|
3,
|
|
61093
|
-
|
|
61117
|
+
37
|
|
61094
61118
|
];
|
|
61095
61119
|
case 1:
|
|
61096
61120
|
{
|
|
@@ -61103,7 +61127,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61103
61127
|
}
|
|
61104
61128
|
return [
|
|
61105
61129
|
3,
|
|
61106
|
-
|
|
61130
|
+
38
|
|
61107
61131
|
];
|
|
61108
61132
|
}
|
|
61109
61133
|
case 2:
|
|
@@ -61114,7 +61138,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61114
61138
|
}
|
|
61115
61139
|
return [
|
|
61116
61140
|
3,
|
|
61117
|
-
|
|
61141
|
+
38
|
|
61118
61142
|
];
|
|
61119
61143
|
}
|
|
61120
61144
|
case 3:
|
|
@@ -61146,7 +61170,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61146
61170
|
case 5:
|
|
61147
61171
|
return [
|
|
61148
61172
|
3,
|
|
61149
|
-
|
|
61173
|
+
38
|
|
61150
61174
|
];
|
|
61151
61175
|
case 6:
|
|
61152
61176
|
{
|
|
@@ -61163,7 +61187,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61163
61187
|
}
|
|
61164
61188
|
return [
|
|
61165
61189
|
3,
|
|
61166
|
-
|
|
61190
|
+
38
|
|
61167
61191
|
];
|
|
61168
61192
|
}
|
|
61169
61193
|
case 7:
|
|
@@ -61177,7 +61201,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61177
61201
|
}
|
|
61178
61202
|
return [
|
|
61179
61203
|
3,
|
|
61180
|
-
|
|
61204
|
+
38
|
|
61181
61205
|
];
|
|
61182
61206
|
}
|
|
61183
61207
|
case 8:
|
|
@@ -61190,7 +61214,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61190
61214
|
}
|
|
61191
61215
|
return [
|
|
61192
61216
|
3,
|
|
61193
|
-
|
|
61217
|
+
38
|
|
61194
61218
|
];
|
|
61195
61219
|
}
|
|
61196
61220
|
case 9:
|
|
@@ -61204,7 +61228,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61204
61228
|
}
|
|
61205
61229
|
return [
|
|
61206
61230
|
3,
|
|
61207
|
-
|
|
61231
|
+
38
|
|
61208
61232
|
];
|
|
61209
61233
|
}
|
|
61210
61234
|
case 10:
|
|
@@ -61217,7 +61241,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61217
61241
|
}
|
|
61218
61242
|
return [
|
|
61219
61243
|
3,
|
|
61220
|
-
|
|
61244
|
+
38
|
|
61221
61245
|
];
|
|
61222
61246
|
}
|
|
61223
61247
|
case 11:
|
|
@@ -61230,7 +61254,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61230
61254
|
}
|
|
61231
61255
|
return [
|
|
61232
61256
|
3,
|
|
61233
|
-
|
|
61257
|
+
38
|
|
61234
61258
|
];
|
|
61235
61259
|
}
|
|
61236
61260
|
case 12:
|
|
@@ -61250,7 +61274,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61250
61274
|
}
|
|
61251
61275
|
return [
|
|
61252
61276
|
3,
|
|
61253
|
-
|
|
61277
|
+
38
|
|
61254
61278
|
];
|
|
61255
61279
|
}
|
|
61256
61280
|
case 13:
|
|
@@ -61292,7 +61316,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61292
61316
|
}
|
|
61293
61317
|
return [
|
|
61294
61318
|
3,
|
|
61295
|
-
|
|
61319
|
+
38
|
|
61296
61320
|
];
|
|
61297
61321
|
}
|
|
61298
61322
|
case 14:
|
|
@@ -61327,7 +61351,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61327
61351
|
}
|
|
61328
61352
|
return [
|
|
61329
61353
|
3,
|
|
61330
|
-
|
|
61354
|
+
38
|
|
61331
61355
|
];
|
|
61332
61356
|
}
|
|
61333
61357
|
case 15:
|
|
@@ -61341,7 +61365,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61341
61365
|
}
|
|
61342
61366
|
return [
|
|
61343
61367
|
3,
|
|
61344
|
-
|
|
61368
|
+
38
|
|
61345
61369
|
];
|
|
61346
61370
|
}
|
|
61347
61371
|
case 16:
|
|
@@ -61373,7 +61397,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61373
61397
|
case 20:
|
|
61374
61398
|
return [
|
|
61375
61399
|
3,
|
|
61376
|
-
|
|
61400
|
+
38
|
|
61377
61401
|
];
|
|
61378
61402
|
case 21:
|
|
61379
61403
|
if (!(typeof propertyValue === 'string' && playerItem.type === spec.ItemType.video)) return [
|
|
@@ -61404,7 +61428,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61404
61428
|
case 25:
|
|
61405
61429
|
return [
|
|
61406
61430
|
3,
|
|
61407
|
-
|
|
61431
|
+
38
|
|
61408
61432
|
];
|
|
61409
61433
|
case 26:
|
|
61410
61434
|
if (!(playerItem.type === spec.ItemType.null)) return [
|
|
@@ -61452,7 +61476,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61452
61476
|
case 28:
|
|
61453
61477
|
return [
|
|
61454
61478
|
3,
|
|
61455
|
-
|
|
61479
|
+
38
|
|
61456
61480
|
];
|
|
61457
61481
|
case 29:
|
|
61458
61482
|
{
|
|
@@ -61464,7 +61488,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61464
61488
|
}
|
|
61465
61489
|
return [
|
|
61466
61490
|
3,
|
|
61467
|
-
|
|
61491
|
+
38
|
|
61468
61492
|
];
|
|
61469
61493
|
}
|
|
61470
61494
|
case 30:
|
|
@@ -61477,7 +61501,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61477
61501
|
}
|
|
61478
61502
|
return [
|
|
61479
61503
|
3,
|
|
61480
|
-
|
|
61504
|
+
38
|
|
61481
61505
|
];
|
|
61482
61506
|
}
|
|
61483
61507
|
case 31:
|
|
@@ -61490,20 +61514,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61490
61514
|
}
|
|
61491
61515
|
return [
|
|
61492
61516
|
3,
|
|
61493
|
-
|
|
61517
|
+
38
|
|
61494
61518
|
];
|
|
61495
61519
|
}
|
|
61496
61520
|
case 32:
|
|
61497
|
-
{
|
|
61498
|
-
if (isCardItem(targetItem)) {
|
|
61499
|
-
targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
|
|
61500
|
-
}
|
|
61501
|
-
return [
|
|
61502
|
-
3,
|
|
61503
|
-
39
|
|
61504
|
-
];
|
|
61505
|
-
}
|
|
61506
|
-
case 33:
|
|
61507
61521
|
{
|
|
61508
61522
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61509
61523
|
pixelTranslation = propertyValue.map(function(v, i) {
|
|
@@ -61516,10 +61530,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61516
61530
|
}
|
|
61517
61531
|
return [
|
|
61518
61532
|
3,
|
|
61519
|
-
|
|
61533
|
+
38
|
|
61520
61534
|
];
|
|
61521
61535
|
}
|
|
61522
|
-
case
|
|
61536
|
+
case 33:
|
|
61523
61537
|
{
|
|
61524
61538
|
if (Array.isArray(propertyValue) && propertyValue.length === 3) {
|
|
61525
61539
|
rotation = propertyValue.map(function(v, i) {
|
|
@@ -61530,10 +61544,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61530
61544
|
}
|
|
61531
61545
|
return [
|
|
61532
61546
|
3,
|
|
61533
|
-
|
|
61547
|
+
38
|
|
61534
61548
|
];
|
|
61535
61549
|
}
|
|
61536
|
-
case
|
|
61550
|
+
case 34:
|
|
61537
61551
|
{
|
|
61538
61552
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61539
61553
|
currentScale = targetItem.property.scale;
|
|
@@ -61547,10 +61561,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61547
61561
|
}
|
|
61548
61562
|
return [
|
|
61549
61563
|
3,
|
|
61550
|
-
|
|
61564
|
+
38
|
|
61551
61565
|
];
|
|
61552
61566
|
}
|
|
61553
|
-
case
|
|
61567
|
+
case 35:
|
|
61554
61568
|
{
|
|
61555
61569
|
if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
|
|
61556
61570
|
frameComponent = playerItem.getComponent(FrameComponent);
|
|
@@ -61560,10 +61574,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61560
61574
|
}
|
|
61561
61575
|
return [
|
|
61562
61576
|
3,
|
|
61563
|
-
|
|
61577
|
+
38
|
|
61564
61578
|
];
|
|
61565
61579
|
}
|
|
61566
|
-
case
|
|
61580
|
+
case 36:
|
|
61567
61581
|
{
|
|
61568
61582
|
if (typeof propertyValue === 'boolean') {
|
|
61569
61583
|
playerItem.setVisible(propertyValue);
|
|
@@ -61576,10 +61590,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61576
61590
|
}
|
|
61577
61591
|
return [
|
|
61578
61592
|
3,
|
|
61579
|
-
|
|
61593
|
+
38
|
|
61580
61594
|
];
|
|
61581
61595
|
}
|
|
61582
|
-
case
|
|
61596
|
+
case 37:
|
|
61583
61597
|
{
|
|
61584
61598
|
console.log('ignore property name ', propertyName);
|
|
61585
61599
|
// 对于未明确处理的属性,尝试直接设置到 property 对象
|
|
@@ -61587,8 +61601,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61587
61601
|
targetItem.property[propertyName] = propertyValue;
|
|
61588
61602
|
}
|
|
61589
61603
|
}
|
|
61590
|
-
_state.label =
|
|
61591
|
-
case
|
|
61604
|
+
_state.label = 38;
|
|
61605
|
+
case 38:
|
|
61592
61606
|
// 非位置属性需要刷新播放器
|
|
61593
61607
|
// template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
|
|
61594
61608
|
if (![
|
|
@@ -62471,6 +62485,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
62471
62485
|
}
|
|
62472
62486
|
break;
|
|
62473
62487
|
}
|
|
62488
|
+
case 'cardType':
|
|
62489
|
+
{
|
|
62490
|
+
break;
|
|
62491
|
+
}
|
|
62474
62492
|
default:
|
|
62475
62493
|
{
|
|
62476
62494
|
console.warn("Target property " + propertyName + " can not be changed.");
|
|
@@ -63063,12 +63081,15 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63063
63081
|
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 ? [
|
|
63064
63082
|
1,
|
|
63065
63083
|
1
|
|
63066
|
-
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position,
|
|
63084
|
+
] : _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 ? generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63067
63085
|
// 校验 cardType 是否已在配置中注册
|
|
63086
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63087
|
+
return t.type === cardType;
|
|
63088
|
+
});
|
|
63068
63089
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63069
63090
|
return t.type;
|
|
63070
63091
|
});
|
|
63071
|
-
if (!
|
|
63092
|
+
if (!cardTypeConfig) {
|
|
63072
63093
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63073
63094
|
return;
|
|
63074
63095
|
}
|
|
@@ -63112,9 +63133,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63112
63133
|
width: width,
|
|
63113
63134
|
height: height,
|
|
63114
63135
|
scale: [].concat(scale),
|
|
63115
|
-
cardType: cardType
|
|
63116
|
-
autoHeight: autoHeight,
|
|
63117
|
-
html: html
|
|
63136
|
+
cardType: cardType
|
|
63118
63137
|
},
|
|
63119
63138
|
extension: extension
|
|
63120
63139
|
});
|
|
@@ -64496,8 +64515,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64496
64515
|
scalar.y
|
|
64497
64516
|
],
|
|
64498
64517
|
rotation: [].concat(rotation),
|
|
64499
|
-
position: [].concat(resultPosition)
|
|
64500
|
-
html: sdkItem.html
|
|
64518
|
+
position: [].concat(resultPosition)
|
|
64501
64519
|
},
|
|
64502
64520
|
extension: extension
|
|
64503
64521
|
};
|
|
@@ -65543,7 +65561,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65543
65561
|
_this = this;
|
|
65544
65562
|
changeProeprty = function changeProeprty(targetCreateInfo) {
|
|
65545
65563
|
return _async_to_generator(function() {
|
|
65546
|
-
var currentCreateInfo;
|
|
65564
|
+
var currentCreateInfo, itemId;
|
|
65547
65565
|
return _ts_generator(this, function(_state) {
|
|
65548
65566
|
switch(_state.label){
|
|
65549
65567
|
case 0:
|
|
@@ -65554,16 +65572,20 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65554
65572
|
2
|
|
65555
65573
|
];
|
|
65556
65574
|
}
|
|
65575
|
+
itemId = targetCreateInfo.id;
|
|
65557
65576
|
return [
|
|
65558
65577
|
4,
|
|
65559
65578
|
this.setItemProperty({
|
|
65560
|
-
itemId:
|
|
65579
|
+
itemId: itemId,
|
|
65561
65580
|
type: currentCreateInfo.type,
|
|
65562
65581
|
property: targetCreateInfo.property
|
|
65563
65582
|
})
|
|
65564
65583
|
];
|
|
65565
65584
|
case 1:
|
|
65566
65585
|
_state.sent();
|
|
65586
|
+
if (targetCreateInfo.extension) {
|
|
65587
|
+
this.setItemExtension(itemId, targetCreateInfo.extension);
|
|
65588
|
+
}
|
|
65567
65589
|
return [
|
|
65568
65590
|
2
|
|
65569
65591
|
];
|
|
@@ -65926,35 +65948,56 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65926
65948
|
};
|
|
65927
65949
|
_proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
|
|
65928
65950
|
return _async_to_generator(function() {
|
|
65929
|
-
var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step,
|
|
65951
|
+
var _loop, _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
|
|
65930
65952
|
return _ts_generator(this, function(_state) {
|
|
65931
65953
|
switch(_state.label){
|
|
65932
65954
|
case 0:
|
|
65933
|
-
|
|
65934
|
-
|
|
65935
|
-
|
|
65936
|
-
|
|
65937
|
-
|
|
65938
|
-
|
|
65939
|
-
|
|
65940
|
-
|
|
65941
|
-
|
|
65942
|
-
|
|
65943
|
-
|
|
65944
|
-
|
|
65945
|
-
|
|
65946
|
-
|
|
65947
|
-
|
|
65948
|
-
|
|
65955
|
+
_loop = function() {
|
|
65956
|
+
var createInfo = _step.value;
|
|
65957
|
+
var _ref = function() {
|
|
65958
|
+
switch(createInfo.type){
|
|
65959
|
+
case SDKItemType.SPRITE:
|
|
65960
|
+
{
|
|
65961
|
+
return {
|
|
65962
|
+
url: createInfo.property.image,
|
|
65963
|
+
type: 'image'
|
|
65964
|
+
};
|
|
65965
|
+
}
|
|
65966
|
+
case SDKItemType.VIDEO:
|
|
65967
|
+
{
|
|
65968
|
+
return {
|
|
65969
|
+
url: createInfo.property.video,
|
|
65970
|
+
type: 'video'
|
|
65971
|
+
};
|
|
65972
|
+
}
|
|
65973
|
+
default:
|
|
65974
|
+
{
|
|
65975
|
+
return {};
|
|
65976
|
+
}
|
|
65977
|
+
}
|
|
65978
|
+
}(), url = _ref.url, type = _ref.type;
|
|
65979
|
+
if (url && type) {
|
|
65980
|
+
var textureId = generateGUID();
|
|
65981
|
+
itemToTextureInfo.set(createInfo.id, {
|
|
65949
65982
|
id: textureId,
|
|
65950
65983
|
url: url,
|
|
65951
|
-
type: type
|
|
65984
|
+
type: type
|
|
65952
65985
|
});
|
|
65953
65986
|
Object.assign(createInfo, {
|
|
65954
65987
|
textureId: textureId
|
|
65955
65988
|
});
|
|
65956
65989
|
}
|
|
65957
|
-
}
|
|
65990
|
+
};
|
|
65991
|
+
_this = this;
|
|
65992
|
+
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
65993
|
+
var _createInfo_id;
|
|
65994
|
+
return Object.assign({}, createInfo, {
|
|
65995
|
+
id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : generateGUID()
|
|
65996
|
+
});
|
|
65997
|
+
});
|
|
65998
|
+
itemToTextureInfo = new Map();
|
|
65999
|
+
// 预处理所有 createInfo,分配 textureId
|
|
66000
|
+
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
|
|
65958
66001
|
// 并行创建所有 item
|
|
65959
66002
|
toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
|
|
65960
66003
|
return ![
|
|
@@ -66923,6 +66966,51 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
66923
66966
|
* @param id 元素id
|
|
66924
66967
|
* @param size 目标大小 [width, height]
|
|
66925
66968
|
* @param translation 位置偏移补偿(可选,用于保持拖拽角点固定)
|
|
66969
|
+
*/ _proto.resizeCardItem = function resizeCardItem(id, size, translation) {
|
|
66970
|
+
var _frameController_children;
|
|
66971
|
+
var frameItem = this.getSDKItem(id);
|
|
66972
|
+
if (!frameItem) {
|
|
66973
|
+
return;
|
|
66974
|
+
}
|
|
66975
|
+
var newWidth = size[0], newHeight = size[1];
|
|
66976
|
+
// const originalWidth = frameItem.property.width
|
|
66977
|
+
// 计算世界尺寸(供后续使用)
|
|
66978
|
+
var viewSize = this.interactionUtils.getViewSizeByPixelSize(new Vector2(newWidth, newHeight));
|
|
66979
|
+
var worldSize = this.interactionUtils.getWorldSizeByViewSize(viewSize).abs();
|
|
66980
|
+
// 1 更新 Player 层的预合成和子元素
|
|
66981
|
+
// 1.1 更新 Player Item(空节点控制器)的大小
|
|
66982
|
+
var frameController = this.getPlayerItemById(id);
|
|
66983
|
+
if (frameController) {
|
|
66984
|
+
frameController.transform.setSize(worldSize.x, worldSize.y);
|
|
66985
|
+
// 如果有位移,更新位置
|
|
66986
|
+
if (translation && (translation.x !== 0 || translation.y !== 0)) {
|
|
66987
|
+
var currentPosition = frameController.transform.position;
|
|
66988
|
+
frameController.setPosition(currentPosition.x + translation.x, currentPosition.y + translation.y, currentPosition.z);
|
|
66989
|
+
}
|
|
66990
|
+
}
|
|
66991
|
+
// 1.2 更新 Player Children Item 的大小
|
|
66992
|
+
var subCompositionItem = frameController == null ? void 0 : (_frameController_children = frameController.children) == null ? void 0 : _frameController_children[0];
|
|
66993
|
+
if (subCompositionItem && translation) {
|
|
66994
|
+
// 更新子元素
|
|
66995
|
+
subCompositionItem.children.forEach(function(item) {
|
|
66996
|
+
var _item;
|
|
66997
|
+
var _item_transform_getParentMatrix;
|
|
66998
|
+
var parentMatrix = new Matrix4().copyFrom((_item_transform_getParentMatrix = item.transform.getParentMatrix()) != null ? _item_transform_getParentMatrix : new Matrix4());
|
|
66999
|
+
parentMatrix.setPosition(new Vector3());
|
|
67000
|
+
var result = translation.clone().applyMatrix(parentMatrix.invert()).negate();
|
|
67001
|
+
(_item = item).translate.apply(_item, [].concat(result.toArray()));
|
|
67002
|
+
item.transform.updateLocalMatrix();
|
|
67003
|
+
});
|
|
67004
|
+
}
|
|
67005
|
+
// 2: 刷新 SDKItem 数据
|
|
67006
|
+
// 更新 FrameItem 的 property
|
|
67007
|
+
this.refreshSDKItem(frameItem.id);
|
|
67008
|
+
};
|
|
67009
|
+
/**
|
|
67010
|
+
* @description 修改画板元素大小
|
|
67011
|
+
* @param id 元素id
|
|
67012
|
+
* @param size 目标大小 [width, height]
|
|
67013
|
+
* @param translation 位置偏移补偿(可选,用于保持拖拽角点固定)
|
|
66926
67014
|
*/ _proto.resizeFrameItem = function resizeFrameItem(id, size, translation) {
|
|
66927
67015
|
var _this = this;
|
|
66928
67016
|
var _frameController_children;
|
|
@@ -83255,43 +83343,12 @@ var BaseConfig = {
|
|
|
83255
83343
|
},
|
|
83256
83344
|
cardConfig: {
|
|
83257
83345
|
backgroundColor: [
|
|
83258
|
-
|
|
83259
|
-
|
|
83260
|
-
|
|
83261
|
-
0
|
|
83346
|
+
1,
|
|
83347
|
+
1,
|
|
83348
|
+
1,
|
|
83349
|
+
0
|
|
83262
83350
|
],
|
|
83263
|
-
cardTypes: [
|
|
83264
|
-
{
|
|
83265
|
-
type: 'character',
|
|
83266
|
-
label: '角色图',
|
|
83267
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83268
|
-
},
|
|
83269
|
-
{
|
|
83270
|
-
type: 'environment',
|
|
83271
|
-
label: '环境图',
|
|
83272
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83273
|
-
},
|
|
83274
|
-
{
|
|
83275
|
-
type: 'storyboard',
|
|
83276
|
-
label: '分镜图',
|
|
83277
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83278
|
-
},
|
|
83279
|
-
{
|
|
83280
|
-
type: 'scene-clip',
|
|
83281
|
-
label: '场景剪辑',
|
|
83282
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83283
|
-
},
|
|
83284
|
-
{
|
|
83285
|
-
type: 'video-compose',
|
|
83286
|
-
label: '视频合成',
|
|
83287
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83288
|
-
},
|
|
83289
|
-
{
|
|
83290
|
-
type: 'video-generate',
|
|
83291
|
-
label: '生成视频',
|
|
83292
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83293
|
-
}
|
|
83294
|
-
]
|
|
83351
|
+
cardTypes: []
|
|
83295
83352
|
}
|
|
83296
83353
|
}
|
|
83297
83354
|
};
|
|
@@ -91620,11 +91677,18 @@ function isCardHTMLAutoHeightMessage(data, id) {
|
|
|
91620
91677
|
var message = data;
|
|
91621
91678
|
return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
|
|
91622
91679
|
}
|
|
91680
|
+
function requestCardHTMLAutoHeight(iframe, id) {
|
|
91681
|
+
var _iframe_contentWindow;
|
|
91682
|
+
(_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
|
|
91683
|
+
source: 'vvfx-card-html-auto-height-request',
|
|
91684
|
+
id: id
|
|
91685
|
+
}, '*');
|
|
91686
|
+
}
|
|
91623
91687
|
function withCardHTMLAutoHeightBridge(html, id) {
|
|
91624
91688
|
if (!id) {
|
|
91625
91689
|
return html;
|
|
91626
91690
|
}
|
|
91627
|
-
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const
|
|
91691
|
+
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>";
|
|
91628
91692
|
if (/<\/body>/i.test(html)) {
|
|
91629
91693
|
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91630
91694
|
}
|
|
@@ -91822,6 +91886,17 @@ function withCardHTMLViewportStyle(html) {
|
|
|
91822
91886
|
return "<!doctype html><html><head>" + viewportStyle + "</head><body>" + html + "</body></html>";
|
|
91823
91887
|
}
|
|
91824
91888
|
|
|
91889
|
+
function withCardHTMLAnchorNavigationGuard(html, allowAnchorNavigation) {
|
|
91890
|
+
if (allowAnchorNavigation === true) {
|
|
91891
|
+
return html;
|
|
91892
|
+
}
|
|
91893
|
+
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>";
|
|
91894
|
+
if (/<\/body>/i.test(html)) {
|
|
91895
|
+
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91896
|
+
}
|
|
91897
|
+
return "" + html + script;
|
|
91898
|
+
}
|
|
91899
|
+
|
|
91825
91900
|
function renderDocumentContent(overlay, content, options) {
|
|
91826
91901
|
var _files_get;
|
|
91827
91902
|
var iframe = document.createElement('iframe');
|
|
@@ -91840,7 +91915,7 @@ function renderDocumentContent(overlay, content, options) {
|
|
|
91840
91915
|
iframe.setAttribute('sandbox', content.sandbox);
|
|
91841
91916
|
}
|
|
91842
91917
|
var entryHtml = (_files_get = files.get(entry)) != null ? _files_get : '';
|
|
91843
|
-
iframe.srcdoc = withCardHTMLAutoHeightBridge(withCardHTMLViewportStyle(transformHTMLDocument(entry, entryHtml, createFileUrl)), options == null ? void 0 : options.autoHeightId);
|
|
91918
|
+
iframe.srcdoc = withCardHTMLAutoHeightBridge(withCardHTMLAnchorNavigationGuard(withCardHTMLViewportStyle(transformHTMLDocument(entry, entryHtml, createFileUrl)), content.allowAnchorNavigation), options == null ? void 0 : options.autoHeightId);
|
|
91844
91919
|
overlay.appendChild(iframe);
|
|
91845
91920
|
return function() {
|
|
91846
91921
|
messageCleanup();
|
|
@@ -91897,30 +91972,38 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91897
91972
|
});
|
|
91898
91973
|
}
|
|
91899
91974
|
|
|
91900
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
|
|
91975
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, _autoScale) {
|
|
91901
91976
|
if (offsetX === void 0) offsetX = 0;
|
|
91902
91977
|
if (offsetY === void 0) offsetY = 0;
|
|
91903
91978
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91904
91979
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91905
|
-
var
|
|
91906
|
-
var
|
|
91907
|
-
var
|
|
91908
|
-
var
|
|
91980
|
+
var contentWidth = width;
|
|
91981
|
+
var contentHeight = height;
|
|
91982
|
+
var a = (rightTop.x - leftTop.x) / contentWidth;
|
|
91983
|
+
var b = (rightTop.y - leftTop.y) / contentWidth;
|
|
91984
|
+
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
91985
|
+
var d = (leftBottom.y - leftTop.y) / contentHeight;
|
|
91909
91986
|
var e = leftTop.x - offsetX;
|
|
91910
91987
|
var f = leftTop.y - offsetY;
|
|
91911
91988
|
return {
|
|
91912
91989
|
left: '0px',
|
|
91913
91990
|
top: '0px',
|
|
91914
|
-
width: "" +
|
|
91915
|
-
height: "" +
|
|
91991
|
+
width: "" + formatPixelNumber(contentWidth) + "px",
|
|
91992
|
+
height: "" + formatPixelNumber(contentHeight) + "px",
|
|
91993
|
+
contentWidth: contentWidth,
|
|
91994
|
+
contentHeight: contentHeight,
|
|
91916
91995
|
transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
|
|
91917
91996
|
};
|
|
91918
91997
|
}
|
|
91998
|
+
var contentWidth1 = box.max.x - box.min.x;
|
|
91999
|
+
var contentHeight1 = box.max.y - box.min.y;
|
|
91919
92000
|
return {
|
|
91920
92001
|
left: "" + (box.min.x - offsetX) + "px",
|
|
91921
92002
|
top: "" + (box.min.y - offsetY) + "px",
|
|
91922
|
-
width: "" +
|
|
91923
|
-
height: "" +
|
|
92003
|
+
width: "" + contentWidth1 + "px",
|
|
92004
|
+
height: "" + contentHeight1 + "px",
|
|
92005
|
+
contentWidth: contentWidth1,
|
|
92006
|
+
contentHeight: contentHeight1,
|
|
91924
92007
|
transform: ''
|
|
91925
92008
|
};
|
|
91926
92009
|
}
|
|
@@ -91943,6 +92026,10 @@ function formatMatrixNumber(value) {
|
|
|
91943
92026
|
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91944
92027
|
return Number(normalized.toFixed(6)).toString();
|
|
91945
92028
|
}
|
|
92029
|
+
function formatPixelNumber(value) {
|
|
92030
|
+
var normalized = Object.is(value, -0) ? 0 : value;
|
|
92031
|
+
return Number(normalized.toFixed(6)).toString();
|
|
92032
|
+
}
|
|
91946
92033
|
|
|
91947
92034
|
function mountHTMLShell(container, content, shell) {
|
|
91948
92035
|
if (!shell) {
|
|
@@ -91963,23 +92050,73 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91963
92050
|
|
|
91964
92051
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91965
92052
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
92053
|
+
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
92054
|
+
'[data-vvfx-html-interaction-zone="self"]',
|
|
92055
|
+
'[data-vvfx-html-interaction-zone="subtree"]',
|
|
92056
|
+
'a[href]',
|
|
92057
|
+
'button:not([disabled])',
|
|
92058
|
+
'input:not([disabled])',
|
|
92059
|
+
'textarea:not([disabled])',
|
|
92060
|
+
'select:not([disabled])',
|
|
92061
|
+
'summary',
|
|
92062
|
+
'video[controls]',
|
|
92063
|
+
'audio[controls]',
|
|
92064
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
92065
|
+
'[role="button"]',
|
|
92066
|
+
'[role="link"]',
|
|
92067
|
+
'[role="textbox"]',
|
|
92068
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
92069
|
+
].join(', ');
|
|
92070
|
+
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
92071
|
+
'[data-vvfx-html-interaction-zone="none"]'
|
|
92072
|
+
].join(', ');
|
|
91966
92073
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91967
92074
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91968
92075
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
91969
92076
|
var CARD_RASTERIZE_READY_TIMEOUT = 3000;
|
|
92077
|
+
var CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
92078
|
+
var requestHTMLOverlayFrame = function requestHTMLOverlayFrame(callback) {
|
|
92079
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
92080
|
+
try {
|
|
92081
|
+
return requestAnimationFrame(callback);
|
|
92082
|
+
} catch (unused) {
|
|
92083
|
+
// Some non-browser test runtimes install a RAF polyfill that depends on window.
|
|
92084
|
+
}
|
|
92085
|
+
}
|
|
92086
|
+
return setTimeout(function() {
|
|
92087
|
+
callback(Date.now());
|
|
92088
|
+
}, 16);
|
|
92089
|
+
};
|
|
92090
|
+
var cancelHTMLOverlayFrame = function cancelHTMLOverlayFrame(frame) {
|
|
92091
|
+
if (typeof cancelAnimationFrame === 'function') {
|
|
92092
|
+
try {
|
|
92093
|
+
cancelAnimationFrame(frame);
|
|
92094
|
+
return;
|
|
92095
|
+
} catch (unused) {
|
|
92096
|
+
// Fall back to clearTimeout for frames created by requestHTMLOverlayFrame.
|
|
92097
|
+
}
|
|
92098
|
+
}
|
|
92099
|
+
clearTimeout(frame);
|
|
92100
|
+
};
|
|
91970
92101
|
var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
91971
92102
|
function HTMLOverlayManager(options) {
|
|
91972
92103
|
var _this = this;
|
|
91973
92104
|
this.options = options;
|
|
91974
92105
|
this.eventCleanups = [];
|
|
92106
|
+
this.htmlRootConfigCleanups = new WeakMap();
|
|
91975
92107
|
this.state = {
|
|
91976
92108
|
frameElements: new Map(),
|
|
91977
92109
|
elements: new Map(),
|
|
92110
|
+
selectionElements: new Map(),
|
|
91978
92111
|
contentScaleElements: new Map(),
|
|
91979
92112
|
contentElements: new Map(),
|
|
91980
92113
|
contentMountElements: new Map(),
|
|
92114
|
+
contentInteractionZones: new Map(),
|
|
92115
|
+
contentInteractionZoneCleanups: new Map(),
|
|
92116
|
+
contentInteractionResizeCleanups: new Map(),
|
|
91981
92117
|
contents: new Map(),
|
|
91982
92118
|
cleanups: new Map(),
|
|
92119
|
+
autoHeightModes: new Map(),
|
|
91983
92120
|
autoHeightCleanups: new Map(),
|
|
91984
92121
|
autoHeightFrames: new Map()
|
|
91985
92122
|
};
|
|
@@ -91996,12 +92133,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91996
92133
|
}
|
|
91997
92134
|
return;
|
|
91998
92135
|
}
|
|
92136
|
+
if (!_this.isEditableCard(targetId)) {
|
|
92137
|
+
return;
|
|
92138
|
+
}
|
|
91999
92139
|
event.preventDefault();
|
|
92000
92140
|
event.stopPropagation();
|
|
92001
92141
|
_this.enterEditing(targetId);
|
|
92002
92142
|
};
|
|
92003
92143
|
this.handleContainerMouseDown = function(event) {
|
|
92004
92144
|
var _this_state_editing;
|
|
92145
|
+
if (event.button === 0) {
|
|
92146
|
+
_this.selectHTMLInteractionCard(event);
|
|
92147
|
+
}
|
|
92005
92148
|
var editingId = (_this_state_editing = _this.state.editing) == null ? void 0 : _this_state_editing.id;
|
|
92006
92149
|
if (!editingId || _this.isEventInsideOverlay(editingId, event)) {
|
|
92007
92150
|
return;
|
|
@@ -92011,6 +92154,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92011
92154
|
_this.exitEditing();
|
|
92012
92155
|
};
|
|
92013
92156
|
this.handleContainerMouseMove = function(event) {
|
|
92157
|
+
_this.scheduleActiveContentInteractionSync(event);
|
|
92014
92158
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
92015
92159
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
92016
92160
|
return;
|
|
@@ -92024,7 +92168,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92024
92168
|
_this.syncContentInteraction(hoverShellInteractiveId);
|
|
92025
92169
|
}
|
|
92026
92170
|
};
|
|
92027
|
-
this.handleContainerMouseLeave = function() {
|
|
92171
|
+
this.handleContainerMouseLeave = function(event) {
|
|
92172
|
+
if (_this.isMouseLeaveWithinContainer(event)) {
|
|
92173
|
+
return;
|
|
92174
|
+
}
|
|
92175
|
+
if (_this.contentInteractionFrame !== undefined) {
|
|
92176
|
+
cancelHTMLOverlayFrame(_this.contentInteractionFrame);
|
|
92177
|
+
_this.contentInteractionFrame = undefined;
|
|
92178
|
+
}
|
|
92179
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92180
|
+
_this.setActiveContentInteraction(undefined);
|
|
92028
92181
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
92029
92182
|
if (!previousId) {
|
|
92030
92183
|
return;
|
|
@@ -92032,6 +92185,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92032
92185
|
_this.state.hoverShellInteractiveId = undefined;
|
|
92033
92186
|
_this.syncContentInteraction(previousId);
|
|
92034
92187
|
};
|
|
92188
|
+
this.handleContainerContextMenu = function(event) {
|
|
92189
|
+
var activeInteraction = _this.state.activeContentInteraction;
|
|
92190
|
+
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92191
|
+
return;
|
|
92192
|
+
}
|
|
92193
|
+
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92194
|
+
if (!canvas) {
|
|
92195
|
+
return;
|
|
92196
|
+
}
|
|
92197
|
+
event.preventDefault();
|
|
92198
|
+
event.stopPropagation();
|
|
92199
|
+
_this.setActiveContentInteraction(undefined);
|
|
92200
|
+
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92201
|
+
bubbles: true,
|
|
92202
|
+
cancelable: true,
|
|
92203
|
+
clientX: event.clientX,
|
|
92204
|
+
clientY: event.clientY,
|
|
92205
|
+
screenX: event.screenX,
|
|
92206
|
+
screenY: event.screenY,
|
|
92207
|
+
button: event.button,
|
|
92208
|
+
buttons: event.buttons,
|
|
92209
|
+
ctrlKey: event.ctrlKey,
|
|
92210
|
+
shiftKey: event.shiftKey,
|
|
92211
|
+
altKey: event.altKey,
|
|
92212
|
+
metaKey: event.metaKey
|
|
92213
|
+
}));
|
|
92214
|
+
};
|
|
92035
92215
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
92036
92216
|
}
|
|
92037
92217
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -92045,7 +92225,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92045
92225
|
layer.style.position = 'absolute';
|
|
92046
92226
|
layer.style.inset = '0';
|
|
92047
92227
|
layer.style.pointerEvents = 'none';
|
|
92048
|
-
layer.style.zIndex = '1';
|
|
92049
92228
|
container.appendChild(layer);
|
|
92050
92229
|
this.state.layer = layer;
|
|
92051
92230
|
this.initDOMEvents();
|
|
@@ -92055,25 +92234,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92055
92234
|
_proto.dispose = function dispose() {
|
|
92056
92235
|
var _this_state_layer;
|
|
92057
92236
|
if (this.state.updateFrame !== undefined) {
|
|
92058
|
-
|
|
92237
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92059
92238
|
this.state.updateFrame = undefined;
|
|
92060
92239
|
}
|
|
92240
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92241
|
+
cancelHTMLOverlayFrame(this.contentInteractionFrame);
|
|
92242
|
+
this.contentInteractionFrame = undefined;
|
|
92243
|
+
}
|
|
92244
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92061
92245
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92062
92246
|
cleanup();
|
|
92063
92247
|
});
|
|
92064
92248
|
this.state.frameElements.clear();
|
|
92065
92249
|
this.state.elements.clear();
|
|
92250
|
+
this.state.selectionElements.clear();
|
|
92066
92251
|
this.state.contentScaleElements.clear();
|
|
92067
92252
|
this.state.contentElements.clear();
|
|
92068
92253
|
this.state.contentMountElements.clear();
|
|
92254
|
+
this.state.contentInteractionZones.clear();
|
|
92255
|
+
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92256
|
+
cleanup();
|
|
92257
|
+
});
|
|
92258
|
+
this.state.contentInteractionZoneCleanups.clear();
|
|
92259
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92260
|
+
cleanup();
|
|
92261
|
+
});
|
|
92262
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92069
92263
|
this.state.contents.clear();
|
|
92070
92264
|
this.state.cleanups.clear();
|
|
92265
|
+
this.state.autoHeightModes.clear();
|
|
92071
92266
|
this.state.autoHeightCleanups.forEach(function(cleanup) {
|
|
92072
92267
|
cleanup();
|
|
92073
92268
|
});
|
|
92074
92269
|
this.state.autoHeightCleanups.clear();
|
|
92075
92270
|
this.state.autoHeightFrames.forEach(function(frame) {
|
|
92076
|
-
|
|
92271
|
+
cancelHTMLOverlayFrame(frame);
|
|
92077
92272
|
});
|
|
92078
92273
|
this.state.autoHeightFrames.clear();
|
|
92079
92274
|
this.eventCleanups.forEach(function(cleanup) {
|
|
@@ -92082,21 +92277,61 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92082
92277
|
this.eventCleanups = [];
|
|
92083
92278
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92084
92279
|
this.state.layer = undefined;
|
|
92280
|
+
this.state.selectionLayer = undefined;
|
|
92085
92281
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92086
92282
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92087
92283
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92088
92284
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92285
|
+
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92089
92286
|
};
|
|
92090
92287
|
_proto.scheduleRender = function scheduleRender() {
|
|
92091
92288
|
var _this = this;
|
|
92092
92289
|
if (this.state.updateFrame !== undefined) {
|
|
92093
|
-
|
|
92290
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92094
92291
|
}
|
|
92095
|
-
this.state.updateFrame =
|
|
92292
|
+
this.state.updateFrame = requestHTMLOverlayFrame(function() {
|
|
92096
92293
|
_this.state.updateFrame = undefined;
|
|
92097
92294
|
_this.render();
|
|
92098
92295
|
});
|
|
92099
92296
|
};
|
|
92297
|
+
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92298
|
+
this.cleanupOverlayContent(id);
|
|
92299
|
+
this.invalidateContentInteractionZones(id);
|
|
92300
|
+
};
|
|
92301
|
+
_proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
92302
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92303
|
+
var iframe = contentOverlay == null ? void 0 : contentOverlay.querySelector('iframe');
|
|
92304
|
+
return iframe == null ? void 0 : iframe.contentWindow;
|
|
92305
|
+
};
|
|
92306
|
+
_proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
92307
|
+
var html = this.state.contents.get(id);
|
|
92308
|
+
if (!html) {
|
|
92309
|
+
return false;
|
|
92310
|
+
}
|
|
92311
|
+
var patchHandler = html.content.patch;
|
|
92312
|
+
if (!patchHandler) {
|
|
92313
|
+
return false;
|
|
92314
|
+
}
|
|
92315
|
+
var context = this.createPatchContext(id, html);
|
|
92316
|
+
return patchHandler(patch, context) !== false;
|
|
92317
|
+
};
|
|
92318
|
+
_proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
92319
|
+
var targetWindow = this.getHtmlCardWindow(id);
|
|
92320
|
+
try {
|
|
92321
|
+
if (!targetWindow || typeof targetWindow.postMessage !== 'function') {
|
|
92322
|
+
return false;
|
|
92323
|
+
}
|
|
92324
|
+
targetWindow.postMessage({
|
|
92325
|
+
detail: detail,
|
|
92326
|
+
payload: detail,
|
|
92327
|
+
source: CARD_HTML_EVENT_MESSAGE_SOURCE,
|
|
92328
|
+
type: type
|
|
92329
|
+
}, '*');
|
|
92330
|
+
return true;
|
|
92331
|
+
} catch (unused) {
|
|
92332
|
+
return false;
|
|
92333
|
+
}
|
|
92334
|
+
};
|
|
92100
92335
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92101
92336
|
return _async_to_generator(function() {
|
|
92102
92337
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92104,7 +92339,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92104
92339
|
switch(_state.label){
|
|
92105
92340
|
case 0:
|
|
92106
92341
|
if (this.state.updateFrame !== undefined) {
|
|
92107
|
-
|
|
92342
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92108
92343
|
this.state.updateFrame = undefined;
|
|
92109
92344
|
}
|
|
92110
92345
|
this.render();
|
|
@@ -92189,6 +92424,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92189
92424
|
var events = [
|
|
92190
92425
|
'pageDataChange',
|
|
92191
92426
|
'selectedItemChange',
|
|
92427
|
+
'preSelectedItemChange',
|
|
92192
92428
|
'itemPropertyChange',
|
|
92193
92429
|
'viewportTransform',
|
|
92194
92430
|
'viewRebuildFinish'
|
|
@@ -92198,6 +92434,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92198
92434
|
if (event === 'viewportTransform') {
|
|
92199
92435
|
_this.handleViewportTransform();
|
|
92200
92436
|
}
|
|
92437
|
+
_this.invalidateContentInteractionZones();
|
|
92201
92438
|
_this.scheduleRender();
|
|
92202
92439
|
});
|
|
92203
92440
|
});
|
|
@@ -92207,6 +92444,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92207
92444
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92208
92445
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92209
92446
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92447
|
+
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92448
|
+
};
|
|
92449
|
+
_proto.selectHTMLInteractionCard = function selectHTMLInteractionCard(event) {
|
|
92450
|
+
var decision = this.resolveHTMLInteractionTarget(event);
|
|
92451
|
+
if (decision.kind !== 'html') {
|
|
92452
|
+
return;
|
|
92453
|
+
}
|
|
92454
|
+
this.options.setSelectedItemIds([
|
|
92455
|
+
decision.interaction.id
|
|
92456
|
+
]);
|
|
92457
|
+
};
|
|
92458
|
+
_proto.isMouseLeaveWithinContainer = function isMouseLeaveWithinContainer(event) {
|
|
92459
|
+
var relatedTarget = event.relatedTarget;
|
|
92460
|
+
if (!relatedTarget) {
|
|
92461
|
+
return false;
|
|
92462
|
+
}
|
|
92463
|
+
try {
|
|
92464
|
+
return this.options.container.contains(relatedTarget);
|
|
92465
|
+
} catch (unused) {
|
|
92466
|
+
return false;
|
|
92467
|
+
}
|
|
92468
|
+
};
|
|
92469
|
+
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92470
|
+
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92471
|
+
return false;
|
|
92472
|
+
}
|
|
92473
|
+
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92210
92474
|
};
|
|
92211
92475
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92212
92476
|
var editing = this.state.editing;
|
|
@@ -92226,11 +92490,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92226
92490
|
}
|
|
92227
92491
|
var items = this.options.getItems();
|
|
92228
92492
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92493
|
+
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92229
92494
|
var visibleCardIds = new Set();
|
|
92230
92495
|
var editingVisible = false;
|
|
92231
92496
|
items.forEach(function(item) {
|
|
92232
92497
|
var _this_state_editing;
|
|
92233
|
-
if (!isCardItem(item) || !item.visible
|
|
92498
|
+
if (!isCardItem(item) || !item.visible) {
|
|
92499
|
+
return;
|
|
92500
|
+
}
|
|
92501
|
+
var html = _this.options.resolveCardHTML(item);
|
|
92502
|
+
if (html === undefined) {
|
|
92234
92503
|
return;
|
|
92235
92504
|
}
|
|
92236
92505
|
var itemBox = _this.options.getViewBoxById(item.id);
|
|
@@ -92245,21 +92514,32 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92245
92514
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92246
92515
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92247
92516
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92248
|
-
var
|
|
92249
|
-
if (html && _this.state.contents.get(item.id) !== html) {
|
|
92250
|
-
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92251
|
-
}
|
|
92517
|
+
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92252
92518
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92253
92519
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92254
|
-
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
|
|
92520
|
+
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
92521
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92255
92522
|
overlay.style.left = boxStyle.left;
|
|
92256
92523
|
overlay.style.top = boxStyle.top;
|
|
92257
92524
|
overlay.style.width = boxStyle.width;
|
|
92258
92525
|
overlay.style.height = boxStyle.height;
|
|
92259
92526
|
overlay.style.transform = boxStyle.transform;
|
|
92260
92527
|
overlay.style.transformOrigin = '0 0';
|
|
92261
|
-
|
|
92262
|
-
|
|
92528
|
+
var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
|
|
92529
|
+
selectionOverlay.style.left = selectionBoxStyle.left;
|
|
92530
|
+
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92531
|
+
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92532
|
+
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92533
|
+
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92534
|
+
selectionOverlay.style.transformOrigin = '0 0';
|
|
92535
|
+
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92536
|
+
_this.makeSelectionOverlayTransparent(selectionOverlay);
|
|
92537
|
+
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92538
|
+
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92539
|
+
if (!_this.state.contents.has(item.id)) {
|
|
92540
|
+
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92541
|
+
}
|
|
92542
|
+
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92263
92543
|
_this.syncContentInteraction(item.id);
|
|
92264
92544
|
});
|
|
92265
92545
|
elements.forEach(function(_overlay, id) {
|
|
@@ -92298,6 +92578,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92298
92578
|
}
|
|
92299
92579
|
}
|
|
92300
92580
|
syncElementStackOrder(layer, rootElements);
|
|
92581
|
+
if (this.state.selectionLayer) {
|
|
92582
|
+
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92583
|
+
}
|
|
92301
92584
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92302
92585
|
var frameElements = [];
|
|
92303
92586
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92313,6 +92596,28 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92313
92596
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92314
92597
|
});
|
|
92315
92598
|
};
|
|
92599
|
+
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92600
|
+
var _layer_ownerDocument;
|
|
92601
|
+
if (this.state.selectionLayer) {
|
|
92602
|
+
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92603
|
+
layer.appendChild(this.state.selectionLayer);
|
|
92604
|
+
}
|
|
92605
|
+
return this.state.selectionLayer;
|
|
92606
|
+
}
|
|
92607
|
+
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92608
|
+
if (!ownerDocument) {
|
|
92609
|
+
return layer;
|
|
92610
|
+
}
|
|
92611
|
+
var selectionLayer = ownerDocument.createElement('div');
|
|
92612
|
+
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92613
|
+
selectionLayer.style.position = 'absolute';
|
|
92614
|
+
selectionLayer.style.inset = '0';
|
|
92615
|
+
selectionLayer.style.pointerEvents = 'none';
|
|
92616
|
+
selectionLayer.style.zIndex = '1';
|
|
92617
|
+
layer.appendChild(selectionLayer);
|
|
92618
|
+
this.state.selectionLayer = selectionLayer;
|
|
92619
|
+
return selectionLayer;
|
|
92620
|
+
};
|
|
92316
92621
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92317
92622
|
var _this = this;
|
|
92318
92623
|
var visibleFrameIds = new Set();
|
|
@@ -92377,6 +92682,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92377
92682
|
elements.set(id, overlay);
|
|
92378
92683
|
return overlay;
|
|
92379
92684
|
};
|
|
92685
|
+
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92686
|
+
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92687
|
+
if (selectionOverlay) {
|
|
92688
|
+
if (selectionOverlay.parentElement !== parent) {
|
|
92689
|
+
parent.appendChild(selectionOverlay);
|
|
92690
|
+
}
|
|
92691
|
+
return selectionOverlay;
|
|
92692
|
+
}
|
|
92693
|
+
selectionOverlay = document.createElement('div');
|
|
92694
|
+
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92695
|
+
selectionOverlay.dataset.itemId = id;
|
|
92696
|
+
selectionOverlay.style.position = 'absolute';
|
|
92697
|
+
selectionOverlay.style.pointerEvents = 'none';
|
|
92698
|
+
selectionOverlay.style.zIndex = '1';
|
|
92699
|
+
parent.appendChild(selectionOverlay);
|
|
92700
|
+
this.state.selectionElements.set(id, selectionOverlay);
|
|
92701
|
+
return selectionOverlay;
|
|
92702
|
+
};
|
|
92703
|
+
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92704
|
+
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92705
|
+
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92706
|
+
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92707
|
+
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92708
|
+
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92709
|
+
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92710
|
+
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92711
|
+
};
|
|
92712
|
+
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92713
|
+
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92714
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92715
|
+
};
|
|
92716
|
+
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92717
|
+
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92718
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92719
|
+
};
|
|
92380
92720
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92381
92721
|
var layer = this.state.layer;
|
|
92382
92722
|
if (!layer) {
|
|
@@ -92386,7 +92726,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92386
92726
|
var items = this.options.getItems();
|
|
92387
92727
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92388
92728
|
var item = items[i];
|
|
92389
|
-
if (!isCardItem(item) || !item.visible || item
|
|
92729
|
+
if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
|
|
92390
92730
|
continue;
|
|
92391
92731
|
}
|
|
92392
92732
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -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);
|
|
@@ -92415,13 +92755,212 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92415
92755
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92416
92756
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92417
92757
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92418
|
-
|
|
92419
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92758
|
+
return isMouseEventInsideRect(event, element.getBoundingClientRect());
|
|
92420
92759
|
});
|
|
92421
92760
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92422
92761
|
}
|
|
92423
92762
|
return undefined;
|
|
92424
92763
|
};
|
|
92764
|
+
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92765
|
+
var decision = this.resolveHTMLInteractionTarget(event);
|
|
92766
|
+
if (decision.kind === 'canvas' && this.shouldKeepActiveContentInteractionForFocusedElement()) {
|
|
92767
|
+
return;
|
|
92768
|
+
}
|
|
92769
|
+
this.setActiveContentInteraction(decision.kind === 'html' ? decision.interaction : undefined);
|
|
92770
|
+
};
|
|
92771
|
+
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92772
|
+
var _this = this;
|
|
92773
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
92774
|
+
this.syncActiveContentInteraction(event);
|
|
92775
|
+
return;
|
|
92776
|
+
}
|
|
92777
|
+
this.pendingContentInteractionEvent = event;
|
|
92778
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92779
|
+
return;
|
|
92780
|
+
}
|
|
92781
|
+
try {
|
|
92782
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92783
|
+
_this.contentInteractionFrame = undefined;
|
|
92784
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92785
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92786
|
+
if (pendingEvent) {
|
|
92787
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92788
|
+
}
|
|
92789
|
+
});
|
|
92790
|
+
} catch (unused) {
|
|
92791
|
+
this.contentInteractionFrame = undefined;
|
|
92792
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92793
|
+
this.syncActiveContentInteraction(event);
|
|
92794
|
+
}
|
|
92795
|
+
};
|
|
92796
|
+
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92797
|
+
var _this = this;
|
|
92798
|
+
var previous = this.state.activeContentInteraction;
|
|
92799
|
+
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)) {
|
|
92800
|
+
return;
|
|
92801
|
+
}
|
|
92802
|
+
this.state.activeContentInteraction = zone;
|
|
92803
|
+
var changedIds = new Set();
|
|
92804
|
+
if (previous) {
|
|
92805
|
+
changedIds.add(previous.id);
|
|
92806
|
+
}
|
|
92807
|
+
if (zone) {
|
|
92808
|
+
changedIds.add(zone.id);
|
|
92809
|
+
}
|
|
92810
|
+
changedIds.forEach(function(id) {
|
|
92811
|
+
_this.syncContentInteraction(id);
|
|
92812
|
+
});
|
|
92813
|
+
};
|
|
92814
|
+
_proto.shouldKeepActiveContentInteractionForFocusedElement = function shouldKeepActiveContentInteractionForFocusedElement() {
|
|
92815
|
+
var activeInteraction = this.state.activeContentInteraction;
|
|
92816
|
+
if (!activeInteraction || typeof document === 'undefined') {
|
|
92817
|
+
return false;
|
|
92818
|
+
}
|
|
92819
|
+
var activeElement = document.activeElement;
|
|
92820
|
+
if (!activeElement || activeElement === document.body) {
|
|
92821
|
+
return false;
|
|
92822
|
+
}
|
|
92823
|
+
var interactionElement = activeInteraction.element;
|
|
92824
|
+
return interactionElement === activeElement || typeof interactionElement.contains === 'function' && interactionElement.contains(activeElement);
|
|
92825
|
+
};
|
|
92826
|
+
_proto.resolveHTMLInteractionTarget = function resolveHTMLInteractionTarget(event) {
|
|
92827
|
+
var id = this.getHTMLCardIdByEvent(event);
|
|
92828
|
+
if (!id || this.isEditableCard(id)) {
|
|
92829
|
+
return {
|
|
92830
|
+
kind: 'canvas',
|
|
92831
|
+
id: id
|
|
92832
|
+
};
|
|
92833
|
+
}
|
|
92834
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92835
|
+
if (!contentOverlay) {
|
|
92836
|
+
return {
|
|
92837
|
+
kind: 'canvas',
|
|
92838
|
+
id: id
|
|
92839
|
+
};
|
|
92840
|
+
}
|
|
92841
|
+
var activeSubtree = this.getActiveSubtreeInteractionAtEvent(id, event);
|
|
92842
|
+
if (activeSubtree) {
|
|
92843
|
+
return {
|
|
92844
|
+
kind: 'html',
|
|
92845
|
+
interaction: activeSubtree
|
|
92846
|
+
};
|
|
92847
|
+
}
|
|
92848
|
+
var matchedZones = this.getContentInteractionZones(id, contentOverlay).filter(function(zone) {
|
|
92849
|
+
return isMouseEventInsideRect(event, zone.rect);
|
|
92850
|
+
});
|
|
92851
|
+
var zone = this.resolveContentInteractionZone(matchedZones);
|
|
92852
|
+
if (zone) {
|
|
92853
|
+
return {
|
|
92854
|
+
kind: 'html',
|
|
92855
|
+
interaction: {
|
|
92856
|
+
id: id,
|
|
92857
|
+
element: zone.element,
|
|
92858
|
+
zone: zone.zone
|
|
92859
|
+
}
|
|
92860
|
+
};
|
|
92861
|
+
}
|
|
92862
|
+
return {
|
|
92863
|
+
kind: 'canvas',
|
|
92864
|
+
id: id
|
|
92865
|
+
};
|
|
92866
|
+
};
|
|
92867
|
+
_proto.getActiveSubtreeInteractionAtEvent = function getActiveSubtreeInteractionAtEvent(id, event) {
|
|
92868
|
+
var activeInteraction = this.state.activeContentInteraction;
|
|
92869
|
+
if ((activeInteraction == null ? void 0 : activeInteraction.id) !== id || activeInteraction.zone !== 'subtree') {
|
|
92870
|
+
return undefined;
|
|
92871
|
+
}
|
|
92872
|
+
var rect = activeInteraction.element.getBoundingClientRect();
|
|
92873
|
+
return isMouseEventInsideRect(event, rect) ? activeInteraction : undefined;
|
|
92874
|
+
};
|
|
92875
|
+
_proto.resolveContentInteractionZone = function resolveContentInteractionZone(zones) {
|
|
92876
|
+
if (zones.length <= 1) {
|
|
92877
|
+
return zones[0];
|
|
92878
|
+
}
|
|
92879
|
+
var subtreeRoot = zones.find(function(candidate) {
|
|
92880
|
+
return candidate.zone === 'subtree' && typeof candidate.element.contains === 'function' && zones.some(function(zone) {
|
|
92881
|
+
return zone.element !== candidate.element && candidate.element.contains(zone.element);
|
|
92882
|
+
});
|
|
92883
|
+
});
|
|
92884
|
+
return subtreeRoot != null ? subtreeRoot : zones[0];
|
|
92885
|
+
};
|
|
92886
|
+
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92887
|
+
var _this = this;
|
|
92888
|
+
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92889
|
+
if (cachedZones) {
|
|
92890
|
+
return cachedZones;
|
|
92891
|
+
}
|
|
92892
|
+
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92893
|
+
return !_this.isContentInteractionDisabled(element);
|
|
92894
|
+
}).map(function(element) {
|
|
92895
|
+
return {
|
|
92896
|
+
element: element,
|
|
92897
|
+
rect: element.getBoundingClientRect(),
|
|
92898
|
+
zone: _this.getContentInteractionZoneMode(element)
|
|
92899
|
+
};
|
|
92900
|
+
});
|
|
92901
|
+
this.state.contentInteractionZones.set(id, zones);
|
|
92902
|
+
this.observeContentInteractionZoneResizes(id, zones);
|
|
92903
|
+
return zones;
|
|
92904
|
+
};
|
|
92905
|
+
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92906
|
+
var _ref;
|
|
92907
|
+
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92908
|
+
var item = this.options.getItems().find(function(item) {
|
|
92909
|
+
return item.id === id;
|
|
92910
|
+
});
|
|
92911
|
+
if (!item) {
|
|
92912
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92913
|
+
}
|
|
92914
|
+
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 : [];
|
|
92915
|
+
if (selectors.length === 0) {
|
|
92916
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92917
|
+
}
|
|
92918
|
+
return [].concat([
|
|
92919
|
+
CONTENT_INTERACTIVE_SELECTOR
|
|
92920
|
+
], selectors).join(', ');
|
|
92921
|
+
};
|
|
92922
|
+
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92923
|
+
if (typeof element.closest !== 'function') {
|
|
92924
|
+
return false;
|
|
92925
|
+
}
|
|
92926
|
+
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92927
|
+
};
|
|
92928
|
+
_proto.getContentInteractionZoneMode = function getContentInteractionZoneMode(element) {
|
|
92929
|
+
var zone = element.dataset.vvfxHtmlInteractionZone;
|
|
92930
|
+
return zone === 'subtree' ? 'subtree' : 'self';
|
|
92931
|
+
};
|
|
92932
|
+
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92933
|
+
if (id) {
|
|
92934
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92935
|
+
this.state.contentInteractionZones.delete(id);
|
|
92936
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92937
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92938
|
+
return;
|
|
92939
|
+
}
|
|
92940
|
+
this.state.contentInteractionZones.clear();
|
|
92941
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92942
|
+
cleanup();
|
|
92943
|
+
});
|
|
92944
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92945
|
+
};
|
|
92946
|
+
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92947
|
+
var _this = this;
|
|
92948
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92949
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92950
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92951
|
+
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92952
|
+
return;
|
|
92953
|
+
}
|
|
92954
|
+
var observer = new ResizeObserver(function() {
|
|
92955
|
+
_this.invalidateContentInteractionZones(id);
|
|
92956
|
+
});
|
|
92957
|
+
zones.forEach(function(zone) {
|
|
92958
|
+
observer.observe(zone.element);
|
|
92959
|
+
});
|
|
92960
|
+
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92961
|
+
observer.disconnect();
|
|
92962
|
+
});
|
|
92963
|
+
};
|
|
92425
92964
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92426
92965
|
var rect = this.options.container.getBoundingClientRect();
|
|
92427
92966
|
return {
|
|
@@ -92478,19 +93017,35 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92478
93017
|
if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
|
|
92479
93018
|
return;
|
|
92480
93019
|
}
|
|
92481
|
-
|
|
92482
|
-
|
|
93020
|
+
var nextWidth = "" + width + "px";
|
|
93021
|
+
var nextHeight = "" + height + "px";
|
|
93022
|
+
var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
|
|
93023
|
+
scaleOverlay.style.width = nextWidth;
|
|
93024
|
+
scaleOverlay.style.height = nextHeight;
|
|
92483
93025
|
scaleOverlay.style.transform = 'none';
|
|
92484
|
-
contentOverlay.style.width =
|
|
92485
|
-
contentOverlay.style.height =
|
|
93026
|
+
contentOverlay.style.width = nextWidth;
|
|
93027
|
+
contentOverlay.style.height = nextHeight;
|
|
93028
|
+
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
93029
|
+
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
93030
|
+
}
|
|
93031
|
+
if (sizeChanged) {
|
|
93032
|
+
this.invalidateContentInteractionZones(id);
|
|
93033
|
+
}
|
|
93034
|
+
};
|
|
93035
|
+
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
93036
|
+
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
93037
|
+
requestCardHTMLAutoHeight(iframe, id);
|
|
93038
|
+
});
|
|
92486
93039
|
};
|
|
92487
93040
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92488
|
-
var _this_state_editing;
|
|
93041
|
+
var _this_state_editing, _this_state_activeContentInteraction;
|
|
92489
93042
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
93043
|
+
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92490
93044
|
var overlay = this.state.elements.get(id);
|
|
92491
93045
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92492
93046
|
var contentOverlay = this.state.contentElements.get(id);
|
|
92493
93047
|
var contentMount = this.state.contentMountElements.get(id);
|
|
93048
|
+
var isInteractive = isEditing || !!activeInteraction;
|
|
92494
93049
|
if (overlay) {
|
|
92495
93050
|
overlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92496
93051
|
overlay.style.pointerEvents = 'none';
|
|
@@ -92501,34 +93056,62 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92501
93056
|
}
|
|
92502
93057
|
if (contentOverlay) {
|
|
92503
93058
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92504
|
-
contentOverlay.style.pointerEvents = 'none';
|
|
93059
|
+
contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92505
93060
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92506
|
-
|
|
92507
|
-
iframe.
|
|
93061
|
+
var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
|
|
93062
|
+
iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
|
|
93063
|
+
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92508
93064
|
});
|
|
92509
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
93065
|
+
this.syncShellInteraction(id, contentOverlay, isInteractive);
|
|
93066
|
+
this.syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive);
|
|
92510
93067
|
}
|
|
92511
93068
|
if (contentMount) {
|
|
92512
93069
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92513
|
-
contentMount.style.pointerEvents =
|
|
92514
|
-
contentMount.inert = !
|
|
92515
|
-
if (
|
|
93070
|
+
contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
93071
|
+
contentMount.inert = !isInteractive;
|
|
93072
|
+
if (isInteractive) {
|
|
92516
93073
|
contentMount.removeAttribute('aria-hidden');
|
|
92517
93074
|
} else {
|
|
92518
93075
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92519
93076
|
}
|
|
92520
93077
|
}
|
|
92521
93078
|
};
|
|
92522
|
-
_proto.
|
|
93079
|
+
_proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive) {
|
|
93080
|
+
var _this = this;
|
|
93081
|
+
var activeElement = activeInteraction == null ? void 0 : activeInteraction.element;
|
|
93082
|
+
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
93083
|
+
if ((activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && activeElement && element !== activeElement && typeof activeElement.contains === 'function' && activeElement.contains(element)) {
|
|
93084
|
+
_this.clearContentInteractionState(element);
|
|
93085
|
+
return;
|
|
93086
|
+
}
|
|
93087
|
+
if (!isInteractive) {
|
|
93088
|
+
_this.clearContentInteractionState(element);
|
|
93089
|
+
return;
|
|
93090
|
+
}
|
|
93091
|
+
if (_this.isContentInteractionDisabled(element)) {
|
|
93092
|
+
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
93093
|
+
element.style.pointerEvents = 'none';
|
|
93094
|
+
return;
|
|
93095
|
+
}
|
|
93096
|
+
var isElementInteractive = isEditing || activeElement === element || (activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && typeof (activeElement == null ? void 0 : activeElement.contains) === 'function' && activeElement.contains(element);
|
|
93097
|
+
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
93098
|
+
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
93099
|
+
});
|
|
93100
|
+
};
|
|
93101
|
+
_proto.clearContentInteractionState = function clearContentInteractionState(element) {
|
|
93102
|
+
delete element.dataset.vvfxHtmlInteractionActive;
|
|
93103
|
+
element.style.pointerEvents = '';
|
|
93104
|
+
};
|
|
93105
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92523
93106
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92524
|
-
var isShellInteractiveActive =
|
|
93107
|
+
var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
|
|
92525
93108
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92526
93109
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92527
93110
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92528
93111
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92529
93112
|
});
|
|
92530
93113
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92531
|
-
element.style.pointerEvents =
|
|
93114
|
+
element.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92532
93115
|
});
|
|
92533
93116
|
};
|
|
92534
93117
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92536,6 +93119,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92536
93119
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92537
93120
|
return;
|
|
92538
93121
|
}
|
|
93122
|
+
if (!this.isEditableCard(id)) {
|
|
93123
|
+
return;
|
|
93124
|
+
}
|
|
92539
93125
|
var box = this.options.getViewBoxById(id);
|
|
92540
93126
|
if (box.isEmpty()) {
|
|
92541
93127
|
return;
|
|
@@ -92579,6 +93165,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92579
93165
|
this.options.setViewport(editing.restoreViewport);
|
|
92580
93166
|
this.scheduleRender();
|
|
92581
93167
|
};
|
|
93168
|
+
_proto.isEditableCard = function isEditableCard(id) {
|
|
93169
|
+
var _this_options_resolveCardTypeConfig;
|
|
93170
|
+
var item = this.options.getItems().find(function(item) {
|
|
93171
|
+
return item.id === id;
|
|
93172
|
+
});
|
|
93173
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
93174
|
+
};
|
|
92582
93175
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92583
93176
|
var viewportElement = this.options.container.parentElement;
|
|
92584
93177
|
if (!viewportElement) {
|
|
@@ -92603,6 +93196,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92603
93196
|
};
|
|
92604
93197
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92605
93198
|
this.cleanupOverlayContent(id);
|
|
93199
|
+
this.invalidateContentInteractionZones(id);
|
|
92606
93200
|
overlay.innerHTML = '';
|
|
92607
93201
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92608
93202
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92612,18 +93206,99 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92612
93206
|
});
|
|
92613
93207
|
var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
|
|
92614
93208
|
id: id,
|
|
92615
|
-
autoHeight:
|
|
93209
|
+
autoHeight: this.isAutoHeightEnabled(item)
|
|
92616
93210
|
});
|
|
93211
|
+
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92617
93212
|
this.state.cleanups.set(id, function() {
|
|
92618
93213
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92619
93214
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
92620
93215
|
});
|
|
92621
93216
|
this.state.contents.set(id, html);
|
|
92622
93217
|
};
|
|
93218
|
+
_proto.createPatchContext = function createPatchContext(id, html) {
|
|
93219
|
+
var _this = this;
|
|
93220
|
+
return {
|
|
93221
|
+
id: id,
|
|
93222
|
+
html: html,
|
|
93223
|
+
content: html.content,
|
|
93224
|
+
container: this.state.contentMountElements.get(id),
|
|
93225
|
+
contentWindow: this.getHtmlCardWindow(id),
|
|
93226
|
+
refresh: function refresh() {
|
|
93227
|
+
_this.invalidateCardHTML(id);
|
|
93228
|
+
_this.scheduleRender();
|
|
93229
|
+
}
|
|
93230
|
+
};
|
|
93231
|
+
};
|
|
93232
|
+
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
93233
|
+
var _this = this;
|
|
93234
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
93235
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93236
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93237
|
+
if (typeof MutationObserver !== 'function') {
|
|
93238
|
+
return;
|
|
93239
|
+
}
|
|
93240
|
+
var observer = new MutationObserver(function() {
|
|
93241
|
+
_this.invalidateContentInteractionZones(id);
|
|
93242
|
+
});
|
|
93243
|
+
observer.observe(contentContainer, {
|
|
93244
|
+
attributes: true,
|
|
93245
|
+
childList: true,
|
|
93246
|
+
subtree: true
|
|
93247
|
+
});
|
|
93248
|
+
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
93249
|
+
observer.disconnect();
|
|
93250
|
+
});
|
|
93251
|
+
};
|
|
93252
|
+
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
93253
|
+
var _ref, _config_style;
|
|
93254
|
+
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
93255
|
+
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
93256
|
+
this.htmlRootConfigCleanups.delete(root);
|
|
93257
|
+
var config = html.root;
|
|
93258
|
+
if (!config) {
|
|
93259
|
+
return;
|
|
93260
|
+
}
|
|
93261
|
+
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
93262
|
+
var styleProperties = [];
|
|
93263
|
+
classNames.forEach(function(className) {
|
|
93264
|
+
root.classList.add(className);
|
|
93265
|
+
});
|
|
93266
|
+
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
93267
|
+
var property = param[0], value = param[1];
|
|
93268
|
+
if (value === undefined) {
|
|
93269
|
+
return;
|
|
93270
|
+
}
|
|
93271
|
+
styleProperties.push(property);
|
|
93272
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
93273
|
+
root.style.setProperty(property, String(value));
|
|
93274
|
+
return;
|
|
93275
|
+
}
|
|
93276
|
+
root.style[property] = String(value);
|
|
93277
|
+
});
|
|
93278
|
+
this.htmlRootConfigCleanups.set(root, function() {
|
|
93279
|
+
classNames.forEach(function(className) {
|
|
93280
|
+
root.classList.remove(className);
|
|
93281
|
+
});
|
|
93282
|
+
styleProperties.forEach(function(property) {
|
|
93283
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
93284
|
+
root.style.removeProperty(property);
|
|
93285
|
+
return;
|
|
93286
|
+
}
|
|
93287
|
+
root.style[property] = '';
|
|
93288
|
+
});
|
|
93289
|
+
});
|
|
93290
|
+
};
|
|
93291
|
+
_proto.makeSelectionOverlayTransparent = function makeSelectionOverlayTransparent(selectionOverlay) {
|
|
93292
|
+
selectionOverlay.style.background = 'transparent';
|
|
93293
|
+
selectionOverlay.style.backgroundColor = 'transparent';
|
|
93294
|
+
};
|
|
92623
93295
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
92624
93296
|
var _this = this;
|
|
92625
93297
|
switch(content.kind){
|
|
92626
93298
|
case 'inline':
|
|
93299
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
93300
|
+
this.state.autoHeightModes.set(options.id, 'message');
|
|
93301
|
+
}
|
|
92627
93302
|
return this.chainCleanups(function() {
|
|
92628
93303
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
92629
93304
|
}, renderDocumentContent(overlay, {
|
|
@@ -92631,7 +93306,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92631
93306
|
entry: 'index.html',
|
|
92632
93307
|
files: {
|
|
92633
93308
|
'index.html': content.html
|
|
92634
|
-
}
|
|
93309
|
+
},
|
|
93310
|
+
allowAnchorNavigation: content.allowAnchorNavigation,
|
|
93311
|
+
sandbox: content.sandbox
|
|
92635
93312
|
}, {
|
|
92636
93313
|
autoHeightId: (options == null ? void 0 : options.autoHeight) ? options.id : undefined,
|
|
92637
93314
|
onAutoHeight: (options == null ? void 0 : options.autoHeight) ? function(height) {
|
|
@@ -92640,6 +93317,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92640
93317
|
}));
|
|
92641
93318
|
case 'dom':
|
|
92642
93319
|
{
|
|
93320
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
93321
|
+
this.state.autoHeightModes.set(options.id, 'measure');
|
|
93322
|
+
}
|
|
92643
93323
|
if (content.target === 'iframe') {
|
|
92644
93324
|
return renderDOMContentInIframe(overlay, content.render, content.cleanup);
|
|
92645
93325
|
}
|
|
@@ -92649,6 +93329,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92649
93329
|
} : undefined;
|
|
92650
93330
|
}
|
|
92651
93331
|
case 'document':
|
|
93332
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
93333
|
+
this.state.autoHeightModes.set(options.id, 'message');
|
|
93334
|
+
}
|
|
92652
93335
|
return this.chainCleanups(function() {
|
|
92653
93336
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
92654
93337
|
}, renderDocumentContent(overlay, content, {
|
|
@@ -92676,6 +93359,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92676
93359
|
};
|
|
92677
93360
|
};
|
|
92678
93361
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93362
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92679
93363
|
var cleanup = this.state.cleanups.get(id);
|
|
92680
93364
|
if (cleanup) {
|
|
92681
93365
|
cleanup();
|
|
@@ -92683,13 +93367,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92683
93367
|
}
|
|
92684
93368
|
this.state.contents.delete(id);
|
|
92685
93369
|
this.state.contentMountElements.delete(id);
|
|
93370
|
+
this.state.autoHeightModes.delete(id);
|
|
93371
|
+
this.invalidateContentInteractionZones(id);
|
|
93372
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93373
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92686
93374
|
this.cleanupAutoHeight(id);
|
|
92687
93375
|
};
|
|
92688
93376
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
92689
|
-
var _this_state_elements_get;
|
|
93377
|
+
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
92690
93378
|
this.cleanupOverlayContent(id);
|
|
92691
93379
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93380
|
+
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
92692
93381
|
this.state.elements.delete(id);
|
|
93382
|
+
this.state.selectionElements.delete(id);
|
|
92693
93383
|
this.state.contentScaleElements.delete(id);
|
|
92694
93384
|
this.state.contentElements.delete(id);
|
|
92695
93385
|
};
|
|
@@ -92698,11 +93388,27 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92698
93388
|
this.cleanupAutoHeight(id);
|
|
92699
93389
|
return;
|
|
92700
93390
|
}
|
|
93391
|
+
this.ensureAutoHeightMode(id);
|
|
93392
|
+
if (this.state.autoHeightModes.get(id) === 'message') {
|
|
93393
|
+
this.cleanupAutoHeight(id);
|
|
93394
|
+
return;
|
|
93395
|
+
}
|
|
92701
93396
|
if (!this.state.autoHeightCleanups.has(id)) {
|
|
92702
93397
|
this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
|
|
92703
93398
|
}
|
|
92704
93399
|
this.scheduleAutoHeightMeasure(id);
|
|
92705
93400
|
};
|
|
93401
|
+
_proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
|
|
93402
|
+
var _this_state_contents_get;
|
|
93403
|
+
if (this.state.autoHeightModes.has(id)) {
|
|
93404
|
+
return;
|
|
93405
|
+
}
|
|
93406
|
+
var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
|
|
93407
|
+
if (!content) {
|
|
93408
|
+
return;
|
|
93409
|
+
}
|
|
93410
|
+
this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
|
|
93411
|
+
};
|
|
92706
93412
|
_proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
|
|
92707
93413
|
var _this = this;
|
|
92708
93414
|
var cleanupFns = [];
|
|
@@ -92780,7 +93486,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92780
93486
|
if (this.state.autoHeightFrames.has(id)) {
|
|
92781
93487
|
return;
|
|
92782
93488
|
}
|
|
92783
|
-
var frame =
|
|
93489
|
+
var frame = requestHTMLOverlayFrame(function() {
|
|
92784
93490
|
_this.state.autoHeightFrames.delete(id);
|
|
92785
93491
|
_this.measureAutoHeight(id);
|
|
92786
93492
|
});
|
|
@@ -92790,7 +93496,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92790
93496
|
var item = this.options.getItems().find(function(candidate) {
|
|
92791
93497
|
return candidate.id === id;
|
|
92792
93498
|
});
|
|
92793
|
-
if (!
|
|
93499
|
+
if (!this.isAutoHeightEnabled(item)) {
|
|
92794
93500
|
this.cleanupAutoHeight(id);
|
|
92795
93501
|
return;
|
|
92796
93502
|
}
|
|
@@ -92809,7 +93515,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92809
93515
|
}).filter(function(height) {
|
|
92810
93516
|
return typeof height === 'number' && Number.isFinite(height) && height > 0;
|
|
92811
93517
|
});
|
|
92812
|
-
var childHeight = this.getChildrenNaturalHeight(element
|
|
93518
|
+
var childHeight = this.getChildrenNaturalHeight(element, {
|
|
93519
|
+
includeIframes: iframeHeights.length === 0
|
|
93520
|
+
});
|
|
92813
93521
|
var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
|
|
92814
93522
|
childHeight
|
|
92815
93523
|
], iframeHeights));
|
|
@@ -92829,10 +93537,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92829
93537
|
}
|
|
92830
93538
|
return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
|
|
92831
93539
|
};
|
|
92832
|
-
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
|
|
92833
|
-
|
|
92834
|
-
|
|
92835
|
-
|
|
93540
|
+
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element, options) {
|
|
93541
|
+
var _ref;
|
|
93542
|
+
var includeIframes = (_ref = options == null ? void 0 : options.includeIframes) != null ? _ref : true;
|
|
93543
|
+
return Array.from(element.childNodes).reduce(function(height, child) {
|
|
93544
|
+
var _child_textContent;
|
|
93545
|
+
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
93546
|
+
var childElement = child;
|
|
93547
|
+
if (!includeIframes && childElement.tagName === 'IFRAME') {
|
|
93548
|
+
return height;
|
|
93549
|
+
}
|
|
93550
|
+
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93551
|
+
}
|
|
93552
|
+
if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
|
|
93553
|
+
var range = element.ownerDocument.createRange();
|
|
93554
|
+
range.selectNodeContents(child);
|
|
93555
|
+
var rects = Array.from(range.getClientRects());
|
|
93556
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
93557
|
+
range.detach();
|
|
93558
|
+
return rects.reduce(function(textHeight, rect) {
|
|
93559
|
+
return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
|
|
93560
|
+
}, height);
|
|
93561
|
+
}
|
|
93562
|
+
return height;
|
|
92836
93563
|
}, 0);
|
|
92837
93564
|
};
|
|
92838
93565
|
_proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
|
|
@@ -92843,7 +93570,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92843
93570
|
}
|
|
92844
93571
|
var frame = this.state.autoHeightFrames.get(id);
|
|
92845
93572
|
if (frame !== undefined) {
|
|
92846
|
-
|
|
93573
|
+
cancelHTMLOverlayFrame(frame);
|
|
92847
93574
|
this.state.autoHeightFrames.delete(id);
|
|
92848
93575
|
}
|
|
92849
93576
|
};
|
|
@@ -92851,14 +93578,59 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92851
93578
|
var item = this.options.getItems().find(function(candidate) {
|
|
92852
93579
|
return candidate.id === id;
|
|
92853
93580
|
});
|
|
92854
|
-
if (!isCardItem(item) || item
|
|
93581
|
+
if (!isCardItem(item) || !this.isAutoHeightEnabled(item)) {
|
|
93582
|
+
return;
|
|
93583
|
+
}
|
|
93584
|
+
if (!Number.isFinite(height) || height <= 0) {
|
|
92855
93585
|
return;
|
|
92856
93586
|
}
|
|
92857
|
-
|
|
93587
|
+
var nextHeight = Math.ceil(this.getAutoHeightItemHeight(item, height));
|
|
93588
|
+
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
92858
93589
|
return;
|
|
92859
93590
|
}
|
|
92860
|
-
this.options.setCardItemHeight(id,
|
|
93591
|
+
this.options.setCardItemHeight(id, nextHeight, {
|
|
93592
|
+
anchor: this.getAutoHeightAnchor(item),
|
|
93593
|
+
previousHeight: item.property.height
|
|
93594
|
+
});
|
|
92861
93595
|
};
|
|
93596
|
+
_proto.getAutoHeightAnchor = function getAutoHeightAnchor(item) {
|
|
93597
|
+
var _ref;
|
|
93598
|
+
var _this_options_resolveCardTypeConfig;
|
|
93599
|
+
if (!isCardItem(item)) {
|
|
93600
|
+
return 'top';
|
|
93601
|
+
}
|
|
93602
|
+
return (_ref = (_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeightAnchor) != null ? _ref : 'top';
|
|
93603
|
+
};
|
|
93604
|
+
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
93605
|
+
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
93606
|
+
return contentHeight;
|
|
93607
|
+
}
|
|
93608
|
+
var scaleOverlay = this.state.contentScaleElements.get(item.id);
|
|
93609
|
+
var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
|
|
93610
|
+
if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
|
|
93611
|
+
return contentHeight;
|
|
93612
|
+
}
|
|
93613
|
+
return contentHeight / displayedHeight * item.property.height;
|
|
93614
|
+
};
|
|
93615
|
+
_proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
|
|
93616
|
+
var _this_options_resolveCardTypeConfig;
|
|
93617
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
|
|
93618
|
+
};
|
|
93619
|
+
_proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
|
|
93620
|
+
var _this_options_resolveCardTypeConfig;
|
|
93621
|
+
if (!isCardItem(item)) {
|
|
93622
|
+
return true;
|
|
93623
|
+
}
|
|
93624
|
+
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
93625
|
+
};
|
|
93626
|
+
_create_class(HTMLOverlayManager, [
|
|
93627
|
+
{
|
|
93628
|
+
key: "layerElement",
|
|
93629
|
+
get: function get() {
|
|
93630
|
+
return this.state.layer;
|
|
93631
|
+
}
|
|
93632
|
+
}
|
|
93633
|
+
]);
|
|
92862
93634
|
return HTMLOverlayManager;
|
|
92863
93635
|
}();
|
|
92864
93636
|
function waitForCardCaptureReady(root) {
|
|
@@ -92900,9 +93672,20 @@ function waitForCardCaptureReady(root) {
|
|
|
92900
93672
|
});
|
|
92901
93673
|
})();
|
|
92902
93674
|
}
|
|
93675
|
+
function formatCssColor(color, alpha) {
|
|
93676
|
+
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93677
|
+
var red = normalizedColor >> 16 & 0xFF;
|
|
93678
|
+
var green = normalizedColor >> 8 & 0xFF;
|
|
93679
|
+
var blue = normalizedColor & 0xFF;
|
|
93680
|
+
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93681
|
+
}
|
|
93682
|
+
function formatCssNumber(value) {
|
|
93683
|
+
var normalized = Number.isFinite(value) ? value : 0;
|
|
93684
|
+
return Number(normalized.toFixed(6)).toString();
|
|
93685
|
+
}
|
|
92903
93686
|
function nextAnimationFrame() {
|
|
92904
93687
|
return new Promise(function(resolve) {
|
|
92905
|
-
|
|
93688
|
+
requestHTMLOverlayFrame(function() {
|
|
92906
93689
|
resolve();
|
|
92907
93690
|
});
|
|
92908
93691
|
});
|
|
@@ -93318,6 +94101,9 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93318
94101
|
});
|
|
93319
94102
|
return replacement;
|
|
93320
94103
|
}
|
|
94104
|
+
function isMouseEventInsideRect(event, rect) {
|
|
94105
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
94106
|
+
}
|
|
93321
94107
|
function createFlattenedIframeContent(iframe) {
|
|
93322
94108
|
var doc = iframe.contentDocument;
|
|
93323
94109
|
if (!doc) {
|
|
@@ -93357,6 +94143,19 @@ function withTimeout(promise, timeout) {
|
|
|
93357
94143
|
});
|
|
93358
94144
|
}
|
|
93359
94145
|
|
|
94146
|
+
function orderSDKCanvasLayers(param) {
|
|
94147
|
+
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
94148
|
+
[
|
|
94149
|
+
playerContainer,
|
|
94150
|
+
htmlOverlayLayer,
|
|
94151
|
+
gestureCanvas
|
|
94152
|
+
].forEach(function(layer) {
|
|
94153
|
+
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
94154
|
+
container.appendChild(layer);
|
|
94155
|
+
}
|
|
94156
|
+
});
|
|
94157
|
+
}
|
|
94158
|
+
|
|
93360
94159
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93361
94160
|
var SDK = /*#__PURE__*/ function() {
|
|
93362
94161
|
function SDK(container, mode) {
|
|
@@ -93455,16 +94254,72 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93455
94254
|
bottom: HTML_CARD_EDITING_VIEWPORT_PADDING
|
|
93456
94255
|
}, box);
|
|
93457
94256
|
},
|
|
93458
|
-
setCardItemHeight: function setCardItemHeight(id, height) {
|
|
94257
|
+
setCardItemHeight: function setCardItemHeight(id, height, options) {
|
|
94258
|
+
var item = _this.getSDKItem(id);
|
|
94259
|
+
if (!isCardItem(item) || options.anchor === 'center') {
|
|
94260
|
+
void _this.setItemProperty({
|
|
94261
|
+
itemId: id,
|
|
94262
|
+
type: SDKItemType.CARD,
|
|
94263
|
+
propertyName: 'height',
|
|
94264
|
+
propertyValue: height
|
|
94265
|
+
});
|
|
94266
|
+
return;
|
|
94267
|
+
}
|
|
94268
|
+
var _item_property_position = item.property.position, x = _item_property_position[0], y = _item_property_position[1];
|
|
94269
|
+
var deltaY = (height - options.previousHeight) / 2;
|
|
93459
94270
|
void _this.setItemProperty({
|
|
93460
94271
|
itemId: id,
|
|
93461
94272
|
type: SDKItemType.CARD,
|
|
93462
|
-
|
|
93463
|
-
|
|
94273
|
+
property: {
|
|
94274
|
+
height: height,
|
|
94275
|
+
position: [
|
|
94276
|
+
x,
|
|
94277
|
+
y + deltaY
|
|
94278
|
+
]
|
|
94279
|
+
}
|
|
93464
94280
|
});
|
|
94281
|
+
},
|
|
94282
|
+
getSelectedItemIds: function getSelectedItemIds() {
|
|
94283
|
+
var _ref;
|
|
94284
|
+
var _this__pageData;
|
|
94285
|
+
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
94286
|
+
},
|
|
94287
|
+
setSelectedItemIds: function setSelectedItemIds(ids) {
|
|
94288
|
+
_this.setSelectedItems(ids);
|
|
94289
|
+
},
|
|
94290
|
+
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
94291
|
+
var _this__pageData;
|
|
94292
|
+
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
94293
|
+
},
|
|
94294
|
+
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
94295
|
+
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;
|
|
94296
|
+
return {
|
|
94297
|
+
color: wireframeColor,
|
|
94298
|
+
alpha: wireframeAlpha,
|
|
94299
|
+
width: wireframeWidth
|
|
94300
|
+
};
|
|
94301
|
+
},
|
|
94302
|
+
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
94303
|
+
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
94304
|
+
return {
|
|
94305
|
+
color: preSelectedColor,
|
|
94306
|
+
alpha: 1,
|
|
94307
|
+
width: preSelectedWidth
|
|
94308
|
+
};
|
|
94309
|
+
},
|
|
94310
|
+
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
94311
|
+
var _this__gestureHandler;
|
|
94312
|
+
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
94313
|
+
},
|
|
94314
|
+
resolveCardHTML: function resolveCardHTML(item) {
|
|
94315
|
+
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
94316
|
+
},
|
|
94317
|
+
resolveCardTypeConfig: function resolveCardTypeConfig(item) {
|
|
94318
|
+
return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
|
|
93465
94319
|
}
|
|
93466
94320
|
});
|
|
93467
94321
|
this._htmlOverlayManager.attach();
|
|
94322
|
+
this.syncCanvasLayerOrder();
|
|
93468
94323
|
}
|
|
93469
94324
|
var _proto = SDK.prototype;
|
|
93470
94325
|
_proto.dispose = function dispose() {
|
|
@@ -93484,18 +94339,22 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93484
94339
|
_proto.initPlayer = function initPlayer(mode) {
|
|
93485
94340
|
var _this = this;
|
|
93486
94341
|
var playerContainer = document.createElement('div');
|
|
93487
|
-
var _ref = mode === '
|
|
93488
|
-
this._container.clientWidth,
|
|
93489
|
-
this._container.clientHeight
|
|
93490
|
-
] : [
|
|
94342
|
+
var _ref = mode === 'template' ? [
|
|
93491
94343
|
this._container.offsetWidth,
|
|
93492
94344
|
this._container.offsetHeight
|
|
94345
|
+
] : [
|
|
94346
|
+
document.documentElement.clientWidth,
|
|
94347
|
+
document.documentElement.clientHeight
|
|
93493
94348
|
], width = _ref[0], height = _ref[1];
|
|
93494
94349
|
this._playerContainer = playerContainer;
|
|
93495
94350
|
this._playerContainer.id = 'player-container';
|
|
93496
94351
|
this._playerContainer.style.position = 'absolute';
|
|
93497
94352
|
this._playerContainer.style.width = "" + width + "px";
|
|
93498
94353
|
this._playerContainer.style.height = "" + height + "px";
|
|
94354
|
+
if (mode === 'editor') {
|
|
94355
|
+
this._playerContainer.style.left = '0px';
|
|
94356
|
+
this._playerContainer.style.top = '0px';
|
|
94357
|
+
}
|
|
93499
94358
|
this._container.appendChild(playerContainer);
|
|
93500
94359
|
this.player = new Player({
|
|
93501
94360
|
container: this._playerContainer,
|
|
@@ -93554,18 +94413,48 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93554
94413
|
_this._gestureHandler.dispose();
|
|
93555
94414
|
setTimeout(function() {
|
|
93556
94415
|
return _async_to_generator(function() {
|
|
94416
|
+
var itemExtension, _this_pageData, _this_pageData1, createInfos;
|
|
93557
94417
|
return _ts_generator(this, function(_state) {
|
|
93558
94418
|
switch(_state.label){
|
|
93559
94419
|
case 0:
|
|
93560
94420
|
this.initPlayer(SDK.config.mode);
|
|
93561
94421
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
93562
94422
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94423
|
+
this.syncCanvasLayerOrder();
|
|
94424
|
+
itemExtension = {};
|
|
94425
|
+
if (!(SDK.config.mode === 'template')) return [
|
|
94426
|
+
3,
|
|
94427
|
+
2
|
|
94428
|
+
];
|
|
94429
|
+
(_this_pageData = this.pageData) == null ? void 0 : _this_pageData.items.forEach(function(item) {
|
|
94430
|
+
itemExtension[item.id] = item.getAllExtension();
|
|
94431
|
+
});
|
|
93563
94432
|
return [
|
|
93564
94433
|
4,
|
|
93565
94434
|
this.runByPageData(this.pageData)
|
|
93566
94435
|
];
|
|
93567
94436
|
case 1:
|
|
93568
94437
|
_state.sent();
|
|
94438
|
+
(_this_pageData1 = this.pageData) == null ? void 0 : _this_pageData1.items.forEach(function(item) {
|
|
94439
|
+
var extension = itemExtension[item.id];
|
|
94440
|
+
if (extension) {
|
|
94441
|
+
item.setExtensions(extension);
|
|
94442
|
+
}
|
|
94443
|
+
});
|
|
94444
|
+
return [
|
|
94445
|
+
3,
|
|
94446
|
+
4
|
|
94447
|
+
];
|
|
94448
|
+
case 2:
|
|
94449
|
+
createInfos = this.getItemCreateInfos();
|
|
94450
|
+
return [
|
|
94451
|
+
4,
|
|
94452
|
+
this.runByCreateInfos(createInfos)
|
|
94453
|
+
];
|
|
94454
|
+
case 3:
|
|
94455
|
+
_state.sent();
|
|
94456
|
+
_state.label = 4;
|
|
94457
|
+
case 4:
|
|
93569
94458
|
this._eventEmitter.emit('viewRebuildFinish');
|
|
93570
94459
|
return [
|
|
93571
94460
|
2
|
|
@@ -93609,6 +94498,16 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93609
94498
|
env: 'editor'
|
|
93610
94499
|
});
|
|
93611
94500
|
this.player.resize();
|
|
94501
|
+
this.syncCanvasLayerOrder();
|
|
94502
|
+
};
|
|
94503
|
+
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94504
|
+
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94505
|
+
orderSDKCanvasLayers({
|
|
94506
|
+
container: this._container,
|
|
94507
|
+
playerContainer: this._playerContainer,
|
|
94508
|
+
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94509
|
+
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94510
|
+
});
|
|
93612
94511
|
};
|
|
93613
94512
|
_proto.getInitParam = function getInitParam(param) {
|
|
93614
94513
|
return _async_to_generator(function() {
|
|
@@ -94405,6 +95304,55 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94405
95304
|
});
|
|
94406
95305
|
}).call(this);
|
|
94407
95306
|
};
|
|
95307
|
+
_proto.runByCreateInfos = function runByCreateInfos(createInfos) {
|
|
95308
|
+
return _async_to_generator(function() {
|
|
95309
|
+
var _this__pageData_activeData_view, _this__pageData_activeData_view1, viewSize, scene, targetViewProperty;
|
|
95310
|
+
return _ts_generator(this, function(_state) {
|
|
95311
|
+
switch(_state.label){
|
|
95312
|
+
case 0:
|
|
95313
|
+
assertExist$1(this._pageData, 'You must call SDK#run() first');
|
|
95314
|
+
this._pageData.property.zoom = 1;
|
|
95315
|
+
this._pageData.property.translation = [
|
|
95316
|
+
0,
|
|
95317
|
+
0
|
|
95318
|
+
];
|
|
95319
|
+
this._pageDataUtils.init();
|
|
95320
|
+
return [
|
|
95321
|
+
4,
|
|
95322
|
+
this._gestureHandler.init(this._pageDataUtils, this._eventEmitter)
|
|
95323
|
+
];
|
|
95324
|
+
case 1:
|
|
95325
|
+
_state.sent();
|
|
95326
|
+
viewSize = [
|
|
95327
|
+
this._playerContainer.offsetWidth,
|
|
95328
|
+
this._playerContainer.offsetHeight
|
|
95329
|
+
];
|
|
95330
|
+
scene = getBasicScene(viewSize);
|
|
95331
|
+
targetViewProperty = this.getViewProperty((_this__pageData_activeData_view = this._pageData.activeData.view) != null ? _this__pageData_activeData_view : 0);
|
|
95332
|
+
if (targetViewProperty) {
|
|
95333
|
+
targetViewProperty.scene = scene;
|
|
95334
|
+
}
|
|
95335
|
+
return [
|
|
95336
|
+
4,
|
|
95337
|
+
this._pageDataUtils.loadScene((_this__pageData_activeData_view1 = this._pageData.activeData.view) != null ? _this__pageData_activeData_view1 : 0)
|
|
95338
|
+
];
|
|
95339
|
+
case 2:
|
|
95340
|
+
_state.sent();
|
|
95341
|
+
return [
|
|
95342
|
+
4,
|
|
95343
|
+
this.addItemByCreateInfos(createInfos)
|
|
95344
|
+
];
|
|
95345
|
+
case 3:
|
|
95346
|
+
_state.sent();
|
|
95347
|
+
this._pageDataUtils.refreshPageTime(this._pageData.time);
|
|
95348
|
+
this._eventEmitter.emit('pageDataChange', this.pageData);
|
|
95349
|
+
return [
|
|
95350
|
+
2
|
|
95351
|
+
];
|
|
95352
|
+
}
|
|
95353
|
+
});
|
|
95354
|
+
}).call(this);
|
|
95355
|
+
};
|
|
94408
95356
|
_proto.reloadPageDataByScene = function reloadPageDataByScene(scene) {
|
|
94409
95357
|
return _async_to_generator(function() {
|
|
94410
95358
|
var _ref, _this__pageData_activeData_view, _ref1, _ref2, _loadScene_compositions_find, _this_player_getCompositions_, _this_player_getCompositions_1, loadScene, response, error;
|
|
@@ -94703,8 +95651,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94703
95651
|
* @param ignoreClamp 是否忽视约束
|
|
94704
95652
|
*/ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
|
|
94705
95653
|
assertExist$1(this._pageData);
|
|
94706
|
-
this.
|
|
94707
|
-
this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
|
|
95654
|
+
this._pageDataUtils.setPageZoom(zoom, center, ignoreClamp);
|
|
94708
95655
|
this._gestureHandler.render();
|
|
94709
95656
|
};
|
|
94710
95657
|
/**
|
|
@@ -95100,7 +96047,11 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95100
96047
|
return item.id;
|
|
95101
96048
|
})) != null ? _ref : [];
|
|
95102
96049
|
ids.forEach(function(id) {
|
|
95103
|
-
var
|
|
96050
|
+
var _this__pageDataUtils_getItemCreateInfo;
|
|
96051
|
+
var _this_pageData_items_find, _this_pageData;
|
|
96052
|
+
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) {
|
|
96053
|
+
return item.id === id;
|
|
96054
|
+
})) == null ? void 0 : _this_pageData_items_find.toCreateInfo(true);
|
|
95104
96055
|
if (createInfo) {
|
|
95105
96056
|
createInfos.push(createInfo);
|
|
95106
96057
|
}
|
|
@@ -95600,6 +96551,76 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95600
96551
|
});
|
|
95601
96552
|
};
|
|
95602
96553
|
/**
|
|
96554
|
+
* @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
|
|
96555
|
+
* @param item 卡片元素
|
|
96556
|
+
* @returns HTML 渲染配置
|
|
96557
|
+
*/ _proto.resolveCardHTML = function resolveCardHTML(item) {
|
|
96558
|
+
var _cardTypeConfig_html;
|
|
96559
|
+
var cardTypeConfig = this.resolveCardTypeConfig(item);
|
|
96560
|
+
return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
|
|
96561
|
+
};
|
|
96562
|
+
/**
|
|
96563
|
+
* @description 按 cardType 从注册表解析卡片类型配置。
|
|
96564
|
+
* @param item 卡片元素
|
|
96565
|
+
* @returns 卡片类型配置
|
|
96566
|
+
*/ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
|
|
96567
|
+
return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
96568
|
+
return t.type === item.cardType;
|
|
96569
|
+
});
|
|
96570
|
+
};
|
|
96571
|
+
/**
|
|
96572
|
+
* @description 重新解析并挂载指定卡片的 HTML 内容。
|
|
96573
|
+
* @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
|
|
96574
|
+
* @param id 卡片元素 ID
|
|
96575
|
+
* @returns 是否成功触发刷新
|
|
96576
|
+
*/ _proto.refreshCardHTML = function refreshCardHTML(id) {
|
|
96577
|
+
var _this__htmlOverlayManager, _this__htmlOverlayManager1;
|
|
96578
|
+
var item = this.getSDKItem(id);
|
|
96579
|
+
if (!isCardItem(item)) {
|
|
96580
|
+
console.warn('CardItem "' + id + '" not found.');
|
|
96581
|
+
return false;
|
|
96582
|
+
}
|
|
96583
|
+
if (!this.resolveCardHTML(item)) {
|
|
96584
|
+
console.warn('CardItem "' + id + '" has no registered HTML renderer.');
|
|
96585
|
+
return false;
|
|
96586
|
+
}
|
|
96587
|
+
(_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
|
|
96588
|
+
(_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
|
|
96589
|
+
return true;
|
|
96590
|
+
};
|
|
96591
|
+
/**
|
|
96592
|
+
* @description 获取指定 HTML 卡片当前 iframe 的 window。
|
|
96593
|
+
* @description 仅 inline/document 或自行渲染 iframe 的 DOM 内容会返回 window。
|
|
96594
|
+
* @param id 卡片元素 ID
|
|
96595
|
+
* @returns HTML iframe window
|
|
96596
|
+
*/ _proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
96597
|
+
var _this__htmlOverlayManager;
|
|
96598
|
+
return (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.getHtmlCardWindow(id);
|
|
96599
|
+
};
|
|
96600
|
+
/**
|
|
96601
|
+
* @description 向指定 HTML 卡片发送增量 patch。
|
|
96602
|
+
* @description 当卡片内容配置了 CardHTMLPatchHandler 时,可用于局部更新 HTML,而不必整卡 refresh。
|
|
96603
|
+
* @param id 卡片元素 ID
|
|
96604
|
+
* @param patch patch 负载,由卡片内容自己的 patch handler 解释
|
|
96605
|
+
* @returns 是否被 patch handler 处理
|
|
96606
|
+
*/ _proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
96607
|
+
var _ref;
|
|
96608
|
+
var _this__htmlOverlayManager;
|
|
96609
|
+
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.patchCardHTML(id, patch)) != null ? _ref : false;
|
|
96610
|
+
};
|
|
96611
|
+
/**
|
|
96612
|
+
* @description 向指定 HTML 卡片 iframe 派发事件。
|
|
96613
|
+
* @description 通过 postMessage 投递事件,跨源/同源行为一致,消息 source 为 vvfx-card-html-event。
|
|
96614
|
+
* @param id 卡片元素 ID
|
|
96615
|
+
* @param type 事件名称
|
|
96616
|
+
* @param detail 事件 detail
|
|
96617
|
+
* @returns 是否成功派发或投递
|
|
96618
|
+
*/ _proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
96619
|
+
var _ref;
|
|
96620
|
+
var _this__htmlOverlayManager;
|
|
96621
|
+
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.dispatchHtmlCardEvent(id, type, detail)) != null ? _ref : false;
|
|
96622
|
+
};
|
|
96623
|
+
/**
|
|
95603
96624
|
* @description 创建卡片元素
|
|
95604
96625
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
95605
96626
|
* @param createInfo 卡片创建信息
|
|
@@ -95894,8 +96915,8 @@ SDK.config = BaseConfig;
|
|
|
95894
96915
|
_inherits(CardItem, BaseItem);
|
|
95895
96916
|
function CardItem(options) {
|
|
95896
96917
|
var _this;
|
|
95897
|
-
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5
|
|
95898
|
-
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5
|
|
96918
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
|
96919
|
+
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5;
|
|
95899
96920
|
_this = BaseItem.call(this, options) || this, /**
|
|
95900
96921
|
* @description 元素类型
|
|
95901
96922
|
*/ _this.type = SDKItemType.CARD;
|
|
@@ -95916,9 +96937,7 @@ SDK.config = BaseConfig;
|
|
|
95916
96937
|
1,
|
|
95917
96938
|
1
|
|
95918
96939
|
],
|
|
95919
|
-
cardType: (_ref5 = (
|
|
95920
|
-
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
95921
|
-
html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
|
|
96940
|
+
cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown'
|
|
95922
96941
|
};
|
|
95923
96942
|
return _this;
|
|
95924
96943
|
}
|
|
@@ -95929,22 +96948,18 @@ SDK.config = BaseConfig;
|
|
|
95929
96948
|
* @param withParent 是否包含父节点ID
|
|
95930
96949
|
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
95931
96950
|
var extension = this.getAllExtension();
|
|
95932
|
-
var property = deepClone(this.property);
|
|
95933
|
-
property.html = this.html;
|
|
95934
96951
|
return {
|
|
95935
96952
|
type: SDKItemType.CARD,
|
|
95936
96953
|
id: this.id,
|
|
95937
96954
|
name: this.name,
|
|
95938
96955
|
parentId: withParent ? this.parentId : undefined,
|
|
95939
96956
|
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
95940
|
-
property: property
|
|
96957
|
+
property: deepClone(this.property)
|
|
95941
96958
|
};
|
|
95942
96959
|
};
|
|
95943
96960
|
/**
|
|
95944
96961
|
* @description 克隆 SDKItem
|
|
95945
96962
|
*/ _proto.clone = function clone() {
|
|
95946
|
-
var property = deepClone(this.property);
|
|
95947
|
-
property.html = this.html;
|
|
95948
96963
|
return new CardItem({
|
|
95949
96964
|
id: generateGUID(),
|
|
95950
96965
|
name: this.name,
|
|
@@ -95954,7 +96969,7 @@ SDK.config = BaseConfig;
|
|
|
95954
96969
|
endBehavior: this.endBehavior,
|
|
95955
96970
|
isLocked: this.isLocked,
|
|
95956
96971
|
isCoreEditable: this.isCoreEditable,
|
|
95957
|
-
property: property,
|
|
96972
|
+
property: deepClone(this.property),
|
|
95958
96973
|
extension: this.getAllExtension()
|
|
95959
96974
|
});
|
|
95960
96975
|
};
|
|
@@ -95971,17 +96986,6 @@ SDK.config = BaseConfig;
|
|
|
95971
96986
|
this.property.cardType = value;
|
|
95972
96987
|
}
|
|
95973
96988
|
},
|
|
95974
|
-
{
|
|
95975
|
-
key: "html",
|
|
95976
|
-
get: /**
|
|
95977
|
-
* @description HTML 覆盖层配置
|
|
95978
|
-
*/ function get() {
|
|
95979
|
-
return this.property.html;
|
|
95980
|
-
},
|
|
95981
|
-
set: function set(value) {
|
|
95982
|
-
this.property.html = value;
|
|
95983
|
-
}
|
|
95984
|
-
},
|
|
95985
96989
|
{
|
|
95986
96990
|
key: "position",
|
|
95987
96991
|
get: // ==================== 便捷访问器 ====================
|
|
@@ -95994,6 +96998,16 @@ SDK.config = BaseConfig;
|
|
|
95994
96998
|
this.property.position = value;
|
|
95995
96999
|
}
|
|
95996
97000
|
},
|
|
97001
|
+
{
|
|
97002
|
+
key: "isAutoScale",
|
|
97003
|
+
get: function get() {
|
|
97004
|
+
var _this = this;
|
|
97005
|
+
var config = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
97006
|
+
return t.type === _this.cardType;
|
|
97007
|
+
});
|
|
97008
|
+
return (config == null ? void 0 : config.autoScale) !== false;
|
|
97009
|
+
}
|
|
97010
|
+
},
|
|
95997
97011
|
{
|
|
95998
97012
|
key: "width",
|
|
95999
97013
|
get: /**
|