@vvfx/sdk 0.2.2-beta.8 → 0.2.2
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 +1 -24
- package/dist/html-overlay/auto-height-runtime.d.ts +0 -5
- package/dist/html-overlay/manager.d.ts +0 -53
- package/dist/html-overlay/overlay-transform.d.ts +1 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +355 -1014
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +355 -1014
- package/dist/index.mjs.map +1 -1
- package/dist/sdk-item/card-item.d.ts +6 -1
- package/dist/sdk-item/text-item.d.ts +2 -0
- package/dist/sdk.d.ts +2 -22
- package/dist/types.d.ts +18 -17
- package/package.json +11 -10
- package/dist/layer-order.d.ts +0 -7
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.2
|
|
6
|
+
* Version: v0.2.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -24013,9 +24013,21 @@ function getUniqueName(name, names) {
|
|
|
24013
24013
|
};
|
|
24014
24014
|
_create_class(TextItem, [
|
|
24015
24015
|
{
|
|
24016
|
-
key: "
|
|
24016
|
+
key: "pixelWidth",
|
|
24017
24017
|
get: // ==================== 便捷访问器 ====================
|
|
24018
|
-
|
|
24018
|
+
function get() {
|
|
24019
|
+
return this.width;
|
|
24020
|
+
}
|
|
24021
|
+
},
|
|
24022
|
+
{
|
|
24023
|
+
key: "pixelHeight",
|
|
24024
|
+
get: function get() {
|
|
24025
|
+
return this.height;
|
|
24026
|
+
}
|
|
24027
|
+
},
|
|
24028
|
+
{
|
|
24029
|
+
key: "text",
|
|
24030
|
+
get: /**
|
|
24019
24031
|
* @description 文本内容
|
|
24020
24032
|
*/ function get() {
|
|
24021
24033
|
return this.property.text;
|
|
@@ -25153,150 +25165,6 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
|
|
|
25153
25165
|
return _instanceof(obj, FrameItem);
|
|
25154
25166
|
}
|
|
25155
25167
|
|
|
25156
|
-
/**
|
|
25157
|
-
* @description 卡片元素 SDKItem 类
|
|
25158
|
-
* @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
|
|
25159
|
-
* @description 支持设置卡片类型(cardType)
|
|
25160
|
-
*/ var CardItem = /*#__PURE__*/ function(BaseItem) {
|
|
25161
|
-
_inherits(CardItem, BaseItem);
|
|
25162
|
-
function CardItem(options) {
|
|
25163
|
-
var _this;
|
|
25164
|
-
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
|
25165
|
-
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5;
|
|
25166
|
-
_this = BaseItem.call(this, options) || this, /**
|
|
25167
|
-
* @description 元素类型
|
|
25168
|
-
*/ _this.type = SDKItemType.CARD;
|
|
25169
|
-
// 初始化属性(包含 cardType)
|
|
25170
|
-
_this.property = {
|
|
25171
|
-
position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
|
|
25172
|
-
0,
|
|
25173
|
-
0
|
|
25174
|
-
],
|
|
25175
|
-
rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
|
|
25176
|
-
0,
|
|
25177
|
-
0,
|
|
25178
|
-
0
|
|
25179
|
-
],
|
|
25180
|
-
width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
|
|
25181
|
-
height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
|
|
25182
|
-
scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
|
|
25183
|
-
1,
|
|
25184
|
-
1
|
|
25185
|
-
],
|
|
25186
|
-
cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown'
|
|
25187
|
-
};
|
|
25188
|
-
return _this;
|
|
25189
|
-
}
|
|
25190
|
-
var _proto = CardItem.prototype;
|
|
25191
|
-
// ==================== 实现抽象方法 ====================
|
|
25192
|
-
/**
|
|
25193
|
-
* @description 转换为 CardCreateInfo
|
|
25194
|
-
* @param withParent 是否包含父节点ID
|
|
25195
|
-
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
25196
|
-
var extension = this.getAllExtension();
|
|
25197
|
-
return {
|
|
25198
|
-
type: SDKItemType.CARD,
|
|
25199
|
-
id: this.id,
|
|
25200
|
-
name: this.name,
|
|
25201
|
-
parentId: withParent ? this.parentId : undefined,
|
|
25202
|
-
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
25203
|
-
property: deepClone(this.property)
|
|
25204
|
-
};
|
|
25205
|
-
};
|
|
25206
|
-
/**
|
|
25207
|
-
* @description 克隆 SDKItem
|
|
25208
|
-
*/ _proto.clone = function clone() {
|
|
25209
|
-
return new CardItem({
|
|
25210
|
-
id: generateGUID(),
|
|
25211
|
-
name: this.name,
|
|
25212
|
-
parentId: this.parentId,
|
|
25213
|
-
duration: this.duration,
|
|
25214
|
-
delay: this.delay,
|
|
25215
|
-
endBehavior: this.endBehavior,
|
|
25216
|
-
isLocked: this.isLocked,
|
|
25217
|
-
isCoreEditable: this.isCoreEditable,
|
|
25218
|
-
property: deepClone(this.property),
|
|
25219
|
-
extension: this.getAllExtension()
|
|
25220
|
-
});
|
|
25221
|
-
};
|
|
25222
|
-
_create_class(CardItem, [
|
|
25223
|
-
{
|
|
25224
|
-
key: "cardType",
|
|
25225
|
-
get: // ==================== cardType 访问器 ====================
|
|
25226
|
-
/**
|
|
25227
|
-
* @description 卡片类型
|
|
25228
|
-
*/ function get() {
|
|
25229
|
-
return this.property.cardType;
|
|
25230
|
-
},
|
|
25231
|
-
set: function set(value) {
|
|
25232
|
-
this.property.cardType = value;
|
|
25233
|
-
}
|
|
25234
|
-
},
|
|
25235
|
-
{
|
|
25236
|
-
key: "position",
|
|
25237
|
-
get: // ==================== 便捷访问器 ====================
|
|
25238
|
-
/**
|
|
25239
|
-
* @description 位置
|
|
25240
|
-
*/ function get() {
|
|
25241
|
-
return this.property.position;
|
|
25242
|
-
},
|
|
25243
|
-
set: function set(value) {
|
|
25244
|
-
this.property.position = value;
|
|
25245
|
-
}
|
|
25246
|
-
},
|
|
25247
|
-
{
|
|
25248
|
-
key: "width",
|
|
25249
|
-
get: /**
|
|
25250
|
-
* @description 宽度
|
|
25251
|
-
*/ function get() {
|
|
25252
|
-
return this.property.width;
|
|
25253
|
-
},
|
|
25254
|
-
set: function set(value) {
|
|
25255
|
-
this.property.width = value;
|
|
25256
|
-
}
|
|
25257
|
-
},
|
|
25258
|
-
{
|
|
25259
|
-
key: "height",
|
|
25260
|
-
get: /**
|
|
25261
|
-
* @description 高度
|
|
25262
|
-
*/ function get() {
|
|
25263
|
-
return this.property.height;
|
|
25264
|
-
},
|
|
25265
|
-
set: function set(value) {
|
|
25266
|
-
this.property.height = value;
|
|
25267
|
-
}
|
|
25268
|
-
},
|
|
25269
|
-
{
|
|
25270
|
-
key: "rotation",
|
|
25271
|
-
get: /**
|
|
25272
|
-
* @description 旋转(二维旋转角度)
|
|
25273
|
-
*/ function get() {
|
|
25274
|
-
return this.property.rotation[2];
|
|
25275
|
-
},
|
|
25276
|
-
set: function set(value) {
|
|
25277
|
-
this.property.rotation[2] = value;
|
|
25278
|
-
}
|
|
25279
|
-
},
|
|
25280
|
-
{
|
|
25281
|
-
key: "fullRotation",
|
|
25282
|
-
get: /**
|
|
25283
|
-
* @description 完整旋转(包含 x, y, z)
|
|
25284
|
-
*/ function get() {
|
|
25285
|
-
return this.property.rotation;
|
|
25286
|
-
},
|
|
25287
|
-
set: function set(value) {
|
|
25288
|
-
this.property.rotation = value;
|
|
25289
|
-
}
|
|
25290
|
-
}
|
|
25291
|
-
]);
|
|
25292
|
-
return CardItem;
|
|
25293
|
-
}(BaseItem);
|
|
25294
|
-
/**
|
|
25295
|
-
* @description 类型守卫:检查是否是 CardItem
|
|
25296
|
-
*/ function isCardItem(obj) {
|
|
25297
|
-
return _instanceof(obj, CardItem);
|
|
25298
|
-
}
|
|
25299
|
-
|
|
25300
25168
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
25301
25169
|
try {
|
|
25302
25170
|
var info = gen[key](arg);
|
|
@@ -47298,7 +47166,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47298
47166
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47299
47167
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47300
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;
|
|
47301
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())
|
|
47169
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47302
47170
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47303
47171
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47304
47172
|
}
|
|
@@ -55558,16 +55426,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55558
55426
|
newWidth,
|
|
55559
55427
|
newHeight
|
|
55560
55428
|
], translation1);
|
|
55561
|
-
} else if (selectedItem && selectedItems.length === 1 && isCardItem(selectedItem)) {
|
|
55562
|
-
void this._pageDataUtils.setItemProperty({
|
|
55563
|
-
itemId: selectedItem.id,
|
|
55564
|
-
type: SDKItemType.CARD,
|
|
55565
|
-
property: {
|
|
55566
|
-
width: selectedItem.width * resultScalar1.x,
|
|
55567
|
-
height: selectedItem.height * resultScalar1.y
|
|
55568
|
-
}
|
|
55569
|
-
});
|
|
55570
|
-
this._pageDataUtils.moveItem(selectedItem.id, translation1);
|
|
55571
55429
|
} else {
|
|
55572
55430
|
// 普通元素的缩放逻辑
|
|
55573
55431
|
selectedItems.forEach(function(item) {
|
|
@@ -55892,7 +55750,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55892
55750
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55893
55751
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55894
55752
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55895
|
-
var isSingleCardItem = isCardItem(selectedItem);
|
|
55896
55753
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55897
55754
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55898
55755
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55932,11 +55789,9 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55932
55789
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55933
55790
|
// 根据box获取边缘线
|
|
55934
55791
|
var corners = this.wireframe.box.corners;
|
|
55935
|
-
|
|
55936
|
-
|
|
55937
|
-
|
|
55938
|
-
});
|
|
55939
|
-
}
|
|
55792
|
+
corners.forEach(function(corner, i) {
|
|
55793
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55794
|
+
});
|
|
55940
55795
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55941
55796
|
// 成组暂不支持缩放
|
|
55942
55797
|
if (selectedItems.length === 1) {
|
|
@@ -59787,6 +59642,12 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
|
|
|
59787
59642
|
/**
|
|
59788
59643
|
* @description SDKItem position 属性的数字精度(保留小数位数)
|
|
59789
59644
|
*/ var POSITION_PRECISION = 4;
|
|
59645
|
+
function isCardHTMLContentValue(value) {
|
|
59646
|
+
return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
|
|
59647
|
+
}
|
|
59648
|
+
function isCardHTMLValue(value) {
|
|
59649
|
+
return isCardHTMLContentValue(value == null ? void 0 : value.content);
|
|
59650
|
+
}
|
|
59790
59651
|
var PageDataUtils = /*#__PURE__*/ function() {
|
|
59791
59652
|
function PageDataUtils(player, container, emitter, sdk) {
|
|
59792
59653
|
this.player = player;
|
|
@@ -60604,10 +60465,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60604
60465
|
property: property
|
|
60605
60466
|
}));
|
|
60606
60467
|
} else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
|
|
60607
|
-
var cardType = existingSDKItem.cardType;
|
|
60468
|
+
var cardType = existingSDKItem.cardType, html = existingSDKItem.html;
|
|
60608
60469
|
sdkItem = new CardItem(_extends({}, baseOptions, {
|
|
60609
60470
|
property: _extends({}, property, {
|
|
60610
|
-
cardType: cardType
|
|
60471
|
+
cardType: cardType,
|
|
60472
|
+
html: html
|
|
60611
60473
|
})
|
|
60612
60474
|
}));
|
|
60613
60475
|
} else {
|
|
@@ -61191,35 +61053,40 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61191
61053
|
3,
|
|
61192
61054
|
31
|
|
61193
61055
|
];
|
|
61194
|
-
case '
|
|
61056
|
+
case 'html':
|
|
61195
61057
|
return [
|
|
61196
61058
|
3,
|
|
61197
61059
|
32
|
|
61198
61060
|
];
|
|
61199
|
-
case '
|
|
61061
|
+
case 'position':
|
|
61200
61062
|
return [
|
|
61201
61063
|
3,
|
|
61202
61064
|
33
|
|
61203
61065
|
];
|
|
61204
|
-
case '
|
|
61066
|
+
case 'rotation':
|
|
61205
61067
|
return [
|
|
61206
61068
|
3,
|
|
61207
61069
|
34
|
|
61208
61070
|
];
|
|
61209
|
-
case '
|
|
61071
|
+
case 'scale':
|
|
61210
61072
|
return [
|
|
61211
61073
|
3,
|
|
61212
61074
|
35
|
|
61213
61075
|
];
|
|
61214
|
-
case '
|
|
61076
|
+
case 'layoutMode':
|
|
61215
61077
|
return [
|
|
61216
61078
|
3,
|
|
61217
61079
|
36
|
|
61218
61080
|
];
|
|
61081
|
+
case 'visible':
|
|
61082
|
+
return [
|
|
61083
|
+
3,
|
|
61084
|
+
37
|
|
61085
|
+
];
|
|
61219
61086
|
}
|
|
61220
61087
|
return [
|
|
61221
61088
|
3,
|
|
61222
|
-
|
|
61089
|
+
38
|
|
61223
61090
|
];
|
|
61224
61091
|
case 1:
|
|
61225
61092
|
{
|
|
@@ -61232,7 +61099,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61232
61099
|
}
|
|
61233
61100
|
return [
|
|
61234
61101
|
3,
|
|
61235
|
-
|
|
61102
|
+
39
|
|
61236
61103
|
];
|
|
61237
61104
|
}
|
|
61238
61105
|
case 2:
|
|
@@ -61243,7 +61110,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61243
61110
|
}
|
|
61244
61111
|
return [
|
|
61245
61112
|
3,
|
|
61246
|
-
|
|
61113
|
+
39
|
|
61247
61114
|
];
|
|
61248
61115
|
}
|
|
61249
61116
|
case 3:
|
|
@@ -61275,7 +61142,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61275
61142
|
case 5:
|
|
61276
61143
|
return [
|
|
61277
61144
|
3,
|
|
61278
|
-
|
|
61145
|
+
39
|
|
61279
61146
|
];
|
|
61280
61147
|
case 6:
|
|
61281
61148
|
{
|
|
@@ -61292,7 +61159,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61292
61159
|
}
|
|
61293
61160
|
return [
|
|
61294
61161
|
3,
|
|
61295
|
-
|
|
61162
|
+
39
|
|
61296
61163
|
];
|
|
61297
61164
|
}
|
|
61298
61165
|
case 7:
|
|
@@ -61306,7 +61173,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61306
61173
|
}
|
|
61307
61174
|
return [
|
|
61308
61175
|
3,
|
|
61309
|
-
|
|
61176
|
+
39
|
|
61310
61177
|
];
|
|
61311
61178
|
}
|
|
61312
61179
|
case 8:
|
|
@@ -61319,7 +61186,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61319
61186
|
}
|
|
61320
61187
|
return [
|
|
61321
61188
|
3,
|
|
61322
|
-
|
|
61189
|
+
39
|
|
61323
61190
|
];
|
|
61324
61191
|
}
|
|
61325
61192
|
case 9:
|
|
@@ -61333,7 +61200,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61333
61200
|
}
|
|
61334
61201
|
return [
|
|
61335
61202
|
3,
|
|
61336
|
-
|
|
61203
|
+
39
|
|
61337
61204
|
];
|
|
61338
61205
|
}
|
|
61339
61206
|
case 10:
|
|
@@ -61346,7 +61213,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61346
61213
|
}
|
|
61347
61214
|
return [
|
|
61348
61215
|
3,
|
|
61349
|
-
|
|
61216
|
+
39
|
|
61350
61217
|
];
|
|
61351
61218
|
}
|
|
61352
61219
|
case 11:
|
|
@@ -61359,7 +61226,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61359
61226
|
}
|
|
61360
61227
|
return [
|
|
61361
61228
|
3,
|
|
61362
|
-
|
|
61229
|
+
39
|
|
61363
61230
|
];
|
|
61364
61231
|
}
|
|
61365
61232
|
case 12:
|
|
@@ -61379,7 +61246,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61379
61246
|
}
|
|
61380
61247
|
return [
|
|
61381
61248
|
3,
|
|
61382
|
-
|
|
61249
|
+
39
|
|
61383
61250
|
];
|
|
61384
61251
|
}
|
|
61385
61252
|
case 13:
|
|
@@ -61421,7 +61288,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61421
61288
|
}
|
|
61422
61289
|
return [
|
|
61423
61290
|
3,
|
|
61424
|
-
|
|
61291
|
+
39
|
|
61425
61292
|
];
|
|
61426
61293
|
}
|
|
61427
61294
|
case 14:
|
|
@@ -61456,7 +61323,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61456
61323
|
}
|
|
61457
61324
|
return [
|
|
61458
61325
|
3,
|
|
61459
|
-
|
|
61326
|
+
39
|
|
61460
61327
|
];
|
|
61461
61328
|
}
|
|
61462
61329
|
case 15:
|
|
@@ -61470,7 +61337,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61470
61337
|
}
|
|
61471
61338
|
return [
|
|
61472
61339
|
3,
|
|
61473
|
-
|
|
61340
|
+
39
|
|
61474
61341
|
];
|
|
61475
61342
|
}
|
|
61476
61343
|
case 16:
|
|
@@ -61502,7 +61369,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61502
61369
|
case 20:
|
|
61503
61370
|
return [
|
|
61504
61371
|
3,
|
|
61505
|
-
|
|
61372
|
+
39
|
|
61506
61373
|
];
|
|
61507
61374
|
case 21:
|
|
61508
61375
|
if (!(typeof propertyValue === 'string' && playerItem.type === spec.ItemType.video)) return [
|
|
@@ -61533,7 +61400,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61533
61400
|
case 25:
|
|
61534
61401
|
return [
|
|
61535
61402
|
3,
|
|
61536
|
-
|
|
61403
|
+
39
|
|
61537
61404
|
];
|
|
61538
61405
|
case 26:
|
|
61539
61406
|
if (!(playerItem.type === spec.ItemType.null)) return [
|
|
@@ -61578,7 +61445,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61578
61445
|
case 28:
|
|
61579
61446
|
return [
|
|
61580
61447
|
3,
|
|
61581
|
-
|
|
61448
|
+
39
|
|
61582
61449
|
];
|
|
61583
61450
|
case 29:
|
|
61584
61451
|
{
|
|
@@ -61590,7 +61457,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61590
61457
|
}
|
|
61591
61458
|
return [
|
|
61592
61459
|
3,
|
|
61593
|
-
|
|
61460
|
+
39
|
|
61594
61461
|
];
|
|
61595
61462
|
}
|
|
61596
61463
|
case 30:
|
|
@@ -61603,7 +61470,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61603
61470
|
}
|
|
61604
61471
|
return [
|
|
61605
61472
|
3,
|
|
61606
|
-
|
|
61473
|
+
39
|
|
61607
61474
|
];
|
|
61608
61475
|
}
|
|
61609
61476
|
case 31:
|
|
@@ -61616,10 +61483,20 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61616
61483
|
}
|
|
61617
61484
|
return [
|
|
61618
61485
|
3,
|
|
61619
|
-
|
|
61486
|
+
39
|
|
61620
61487
|
];
|
|
61621
61488
|
}
|
|
61622
61489
|
case 32:
|
|
61490
|
+
{
|
|
61491
|
+
if (isCardItem(targetItem)) {
|
|
61492
|
+
targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
|
|
61493
|
+
}
|
|
61494
|
+
return [
|
|
61495
|
+
3,
|
|
61496
|
+
39
|
|
61497
|
+
];
|
|
61498
|
+
}
|
|
61499
|
+
case 33:
|
|
61623
61500
|
{
|
|
61624
61501
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61625
61502
|
pixelTranslation = propertyValue.map(function(v, i) {
|
|
@@ -61632,10 +61509,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61632
61509
|
}
|
|
61633
61510
|
return [
|
|
61634
61511
|
3,
|
|
61635
|
-
|
|
61512
|
+
39
|
|
61636
61513
|
];
|
|
61637
61514
|
}
|
|
61638
|
-
case
|
|
61515
|
+
case 34:
|
|
61639
61516
|
{
|
|
61640
61517
|
if (Array.isArray(propertyValue) && propertyValue.length === 3) {
|
|
61641
61518
|
rotation = propertyValue.map(function(v, i) {
|
|
@@ -61646,10 +61523,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61646
61523
|
}
|
|
61647
61524
|
return [
|
|
61648
61525
|
3,
|
|
61649
|
-
|
|
61526
|
+
39
|
|
61650
61527
|
];
|
|
61651
61528
|
}
|
|
61652
|
-
case
|
|
61529
|
+
case 35:
|
|
61653
61530
|
{
|
|
61654
61531
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61655
61532
|
currentScale = targetItem.property.scale;
|
|
@@ -61663,10 +61540,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61663
61540
|
}
|
|
61664
61541
|
return [
|
|
61665
61542
|
3,
|
|
61666
|
-
|
|
61543
|
+
39
|
|
61667
61544
|
];
|
|
61668
61545
|
}
|
|
61669
|
-
case
|
|
61546
|
+
case 36:
|
|
61670
61547
|
{
|
|
61671
61548
|
if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
|
|
61672
61549
|
frameComponent = playerItem.getComponent(FrameComponent);
|
|
@@ -61676,10 +61553,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61676
61553
|
}
|
|
61677
61554
|
return [
|
|
61678
61555
|
3,
|
|
61679
|
-
|
|
61556
|
+
39
|
|
61680
61557
|
];
|
|
61681
61558
|
}
|
|
61682
|
-
case
|
|
61559
|
+
case 37:
|
|
61683
61560
|
{
|
|
61684
61561
|
if (typeof propertyValue === 'boolean') {
|
|
61685
61562
|
playerItem.setVisible(propertyValue);
|
|
@@ -61692,10 +61569,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61692
61569
|
}
|
|
61693
61570
|
return [
|
|
61694
61571
|
3,
|
|
61695
|
-
|
|
61572
|
+
39
|
|
61696
61573
|
];
|
|
61697
61574
|
}
|
|
61698
|
-
case
|
|
61575
|
+
case 38:
|
|
61699
61576
|
{
|
|
61700
61577
|
console.log('ignore property name ', propertyName);
|
|
61701
61578
|
// 对于未明确处理的属性,尝试直接设置到 property 对象
|
|
@@ -61703,8 +61580,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61703
61580
|
targetItem.property[propertyName] = propertyValue;
|
|
61704
61581
|
}
|
|
61705
61582
|
}
|
|
61706
|
-
_state.label =
|
|
61707
|
-
case
|
|
61583
|
+
_state.label = 39;
|
|
61584
|
+
case 39:
|
|
61708
61585
|
// 非位置属性需要刷新播放器
|
|
61709
61586
|
// template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
|
|
61710
61587
|
if (![
|
|
@@ -63176,15 +63053,12 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63176
63053
|
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 ? [
|
|
63177
63054
|
1,
|
|
63178
63055
|
1
|
|
63179
|
-
] : _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;
|
|
63056
|
+
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position, autoHeight = _cardInfo_property.autoHeight, html = _cardInfo_property.html, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63180
63057
|
// 校验 cardType 是否已在配置中注册
|
|
63181
|
-
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63182
|
-
return t.type === cardType;
|
|
63183
|
-
});
|
|
63184
63058
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63185
63059
|
return t.type;
|
|
63186
63060
|
});
|
|
63187
|
-
if (!
|
|
63061
|
+
if (!registeredTypes.includes(cardType)) {
|
|
63188
63062
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63189
63063
|
return;
|
|
63190
63064
|
}
|
|
@@ -63228,7 +63102,9 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63228
63102
|
width: width,
|
|
63229
63103
|
height: height,
|
|
63230
63104
|
scale: [].concat(scale),
|
|
63231
|
-
cardType: cardType
|
|
63105
|
+
cardType: cardType,
|
|
63106
|
+
autoHeight: autoHeight,
|
|
63107
|
+
html: html
|
|
63232
63108
|
},
|
|
63233
63109
|
extension: extension
|
|
63234
63110
|
});
|
|
@@ -64610,7 +64486,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64610
64486
|
scalar.y
|
|
64611
64487
|
],
|
|
64612
64488
|
rotation: [].concat(rotation),
|
|
64613
|
-
position: [].concat(resultPosition)
|
|
64489
|
+
position: [].concat(resultPosition),
|
|
64490
|
+
html: sdkItem.html
|
|
64614
64491
|
},
|
|
64615
64492
|
extension: extension
|
|
64616
64493
|
};
|
|
@@ -64695,7 +64572,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64695
64572
|
};
|
|
64696
64573
|
addTextItemIntoNewScene = function addTextItemIntoNewScene(textCreateInfo, sceneSize, itemViewPosition) {
|
|
64697
64574
|
var _scene_fonts;
|
|
64698
|
-
var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? generateGUID() : _textCreateInfo_id, _textCreateInfo_name = textCreateInfo.name, name = _textCreateInfo_name === void 0 ? '文本' : _textCreateInfo_name, _textCreateInfo_property = textCreateInfo.property, lineHeight = _textCreateInfo_property.lineHeight, textWidth = _textCreateInfo_property.width, tmp = _textCreateInfo_property.height, textHeight = tmp === void 0 ? lineHeight : tmp, fontFamily = _textCreateInfo_property.fontFamily, fontSize = _textCreateInfo_property.fontSize, _textCreateInfo_property_fontWeight = _textCreateInfo_property.fontWeight, fontWeight = _textCreateInfo_property_fontWeight === void 0 ? spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? spec.TextAlignment.left : _textCreateInfo_property_textAlign, text = _textCreateInfo_property.text, textColor = _textCreateInfo_property.color, tmp1 = _textCreateInfo_property.rotation, sourceRotation = tmp1 === void 0 ? 0 : tmp1, url = _textCreateInfo_property.fontUrl, outlineColor = _textCreateInfo_property.outlineColor, outlineWidth = _textCreateInfo_property.outlineWidth, outlineEnabled = _textCreateInfo_property.outlineEnabled;
|
|
64575
|
+
var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? generateGUID() : _textCreateInfo_id, _textCreateInfo_name = textCreateInfo.name, name = _textCreateInfo_name === void 0 ? '文本' : _textCreateInfo_name, _textCreateInfo_property = textCreateInfo.property, lineHeight = _textCreateInfo_property.lineHeight, textWidth = _textCreateInfo_property.width, tmp = _textCreateInfo_property.height, textHeight = tmp === void 0 ? lineHeight : tmp, fontFamily = _textCreateInfo_property.fontFamily, fontSize = _textCreateInfo_property.fontSize, _textCreateInfo_property_fontWeight = _textCreateInfo_property.fontWeight, fontWeight = _textCreateInfo_property_fontWeight === void 0 ? spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? spec.TextAlignment.left : _textCreateInfo_property_textAlign, text = _textCreateInfo_property.text, textColor = _textCreateInfo_property.color, tmp1 = _textCreateInfo_property.rotation, sourceRotation = tmp1 === void 0 ? 0 : tmp1, url = _textCreateInfo_property.fontUrl, outlineColor = _textCreateInfo_property.outlineColor, outlineWidth = _textCreateInfo_property.outlineWidth, outlineEnabled = _textCreateInfo_property.outlineEnabled, letterSpacing = _textCreateInfo_property.letterSpacing;
|
|
64699
64576
|
var rotation = Array.isArray(sourceRotation) ? [].concat(sourceRotation) : [
|
|
64700
64577
|
0,
|
|
64701
64578
|
0,
|
|
@@ -64725,7 +64602,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64725
64602
|
fontSize: fontSize,
|
|
64726
64603
|
textColor: resutlTextColor,
|
|
64727
64604
|
fontWeight: fontWeight,
|
|
64728
|
-
letterSpace:
|
|
64605
|
+
letterSpace: letterSpacing,
|
|
64729
64606
|
textAlign: textAlign,
|
|
64730
64607
|
fontStyle: fontStyle,
|
|
64731
64608
|
textWidth: textWidth,
|
|
@@ -65994,56 +65871,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65994
65871
|
};
|
|
65995
65872
|
_proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
|
|
65996
65873
|
return _async_to_generator(function() {
|
|
65997
|
-
var
|
|
65874
|
+
var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, createInfo, id, type, url, textureId, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
|
|
65998
65875
|
return _ts_generator(this, function(_state) {
|
|
65999
65876
|
switch(_state.label){
|
|
66000
65877
|
case 0:
|
|
66001
|
-
|
|
66002
|
-
|
|
66003
|
-
|
|
66004
|
-
|
|
66005
|
-
|
|
66006
|
-
|
|
66007
|
-
|
|
66008
|
-
|
|
66009
|
-
|
|
66010
|
-
|
|
66011
|
-
|
|
66012
|
-
|
|
66013
|
-
|
|
66014
|
-
|
|
66015
|
-
|
|
66016
|
-
|
|
66017
|
-
};
|
|
66018
|
-
}
|
|
66019
|
-
default:
|
|
66020
|
-
{
|
|
66021
|
-
return {};
|
|
66022
|
-
}
|
|
66023
|
-
}
|
|
66024
|
-
}(), url = _ref.url, type = _ref.type;
|
|
66025
|
-
if (url && type) {
|
|
66026
|
-
var textureId = generateGUID();
|
|
66027
|
-
itemToTextureInfo.set(createInfo.id, {
|
|
65878
|
+
_this = this;
|
|
65879
|
+
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
65880
|
+
return Object.assign({}, createInfo, createInfo.id ? {} : {
|
|
65881
|
+
id: generateGUID()
|
|
65882
|
+
});
|
|
65883
|
+
});
|
|
65884
|
+
itemToTextureInfo = new Map();
|
|
65885
|
+
// 预处理所有 createInfo,分配 textureId
|
|
65886
|
+
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;){
|
|
65887
|
+
createInfo = _step.value;
|
|
65888
|
+
id = createInfo.id;
|
|
65889
|
+
type = createInfo.type;
|
|
65890
|
+
url = type === SDKItemType.SPRITE ? createInfo.property.image : type === SDKItemType.VIDEO ? createInfo.property.video : undefined;
|
|
65891
|
+
if ((type === SDKItemType.SPRITE || type === SDKItemType.VIDEO) && url) {
|
|
65892
|
+
textureId = generateGUID();
|
|
65893
|
+
itemToTextureInfo.set(id, {
|
|
66028
65894
|
id: textureId,
|
|
66029
65895
|
url: url,
|
|
66030
|
-
type: type
|
|
65896
|
+
type: type === SDKItemType.SPRITE ? 'image' : 'video'
|
|
66031
65897
|
});
|
|
66032
65898
|
Object.assign(createInfo, {
|
|
66033
65899
|
textureId: textureId
|
|
66034
65900
|
});
|
|
66035
65901
|
}
|
|
66036
|
-
}
|
|
66037
|
-
_this = this;
|
|
66038
|
-
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
66039
|
-
var _createInfo_id;
|
|
66040
|
-
return Object.assign({}, createInfo, {
|
|
66041
|
-
id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : generateGUID()
|
|
66042
|
-
});
|
|
66043
|
-
});
|
|
66044
|
-
itemToTextureInfo = new Map();
|
|
66045
|
-
// 预处理所有 createInfo,分配 textureId
|
|
66046
|
-
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
|
|
65902
|
+
}
|
|
66047
65903
|
// 并行创建所有 item
|
|
66048
65904
|
toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
|
|
66049
65905
|
return ![
|
|
@@ -83216,12 +83072,43 @@ var BaseConfig = {
|
|
|
83216
83072
|
},
|
|
83217
83073
|
cardConfig: {
|
|
83218
83074
|
backgroundColor: [
|
|
83219
|
-
|
|
83220
|
-
|
|
83221
|
-
|
|
83222
|
-
0
|
|
83075
|
+
0.6,
|
|
83076
|
+
0.6,
|
|
83077
|
+
0.6,
|
|
83078
|
+
0.12
|
|
83223
83079
|
],
|
|
83224
|
-
cardTypes: [
|
|
83080
|
+
cardTypes: [
|
|
83081
|
+
{
|
|
83082
|
+
type: 'character',
|
|
83083
|
+
label: '角色图',
|
|
83084
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83085
|
+
},
|
|
83086
|
+
{
|
|
83087
|
+
type: 'environment',
|
|
83088
|
+
label: '环境图',
|
|
83089
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83090
|
+
},
|
|
83091
|
+
{
|
|
83092
|
+
type: 'storyboard',
|
|
83093
|
+
label: '分镜图',
|
|
83094
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83095
|
+
},
|
|
83096
|
+
{
|
|
83097
|
+
type: 'scene-clip',
|
|
83098
|
+
label: '场景剪辑',
|
|
83099
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83100
|
+
},
|
|
83101
|
+
{
|
|
83102
|
+
type: 'video-compose',
|
|
83103
|
+
label: '视频合成',
|
|
83104
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83105
|
+
},
|
|
83106
|
+
{
|
|
83107
|
+
type: 'video-generate',
|
|
83108
|
+
label: '生成视频',
|
|
83109
|
+
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83110
|
+
}
|
|
83111
|
+
]
|
|
83225
83112
|
}
|
|
83226
83113
|
}
|
|
83227
83114
|
};
|
|
@@ -91550,18 +91437,11 @@ function isCardHTMLAutoHeightMessage(data, id) {
|
|
|
91550
91437
|
var message = data;
|
|
91551
91438
|
return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
|
|
91552
91439
|
}
|
|
91553
|
-
function requestCardHTMLAutoHeight(iframe, id) {
|
|
91554
|
-
var _iframe_contentWindow;
|
|
91555
|
-
(_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
|
|
91556
|
-
source: 'vvfx-card-html-auto-height-request',
|
|
91557
|
-
id: id
|
|
91558
|
-
}, '*');
|
|
91559
|
-
}
|
|
91560
91440
|
function withCardHTMLAutoHeightBridge(html, id) {
|
|
91561
91441
|
if (!id) {
|
|
91562
91442
|
return html;
|
|
91563
91443
|
}
|
|
91564
|
-
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const
|
|
91444
|
+
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const getChildrenHeight = (element) => {\n if (!element) return 0;\n return Array.from(element.children).reduce((height, child) => {\n const rect = child.getBoundingClientRect();\n return Math.max(height, rect.bottom + window.scrollY);\n }, 0);\n };\n const getHeight = () => {\n const body = document.body;\n const root = document.documentElement;\n const childHeight = getChildrenHeight(body);\n const scrollHeight = Math.max(root.scrollHeight, body ? body.scrollHeight : 0);\n return Math.ceil(Math.max(childHeight, 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('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>";
|
|
91565
91445
|
if (/<\/body>/i.test(html)) {
|
|
91566
91446
|
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91567
91447
|
}
|
|
@@ -91834,38 +91714,30 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91834
91714
|
});
|
|
91835
91715
|
}
|
|
91836
91716
|
|
|
91837
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY
|
|
91717
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
|
|
91838
91718
|
if (offsetX === void 0) offsetX = 0;
|
|
91839
91719
|
if (offsetY === void 0) offsetY = 0;
|
|
91840
91720
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91841
91721
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91842
|
-
var
|
|
91843
|
-
var
|
|
91844
|
-
var
|
|
91845
|
-
var
|
|
91846
|
-
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
91847
|
-
var d = (leftBottom.y - leftTop.y) / contentHeight;
|
|
91722
|
+
var a = (rightTop.x - leftTop.x) / width;
|
|
91723
|
+
var b = (rightTop.y - leftTop.y) / width;
|
|
91724
|
+
var c = (leftBottom.x - leftTop.x) / height;
|
|
91725
|
+
var d = (leftBottom.y - leftTop.y) / height;
|
|
91848
91726
|
var e = leftTop.x - offsetX;
|
|
91849
91727
|
var f = leftTop.y - offsetY;
|
|
91850
91728
|
return {
|
|
91851
91729
|
left: '0px',
|
|
91852
91730
|
top: '0px',
|
|
91853
|
-
width: "" +
|
|
91854
|
-
height: "" +
|
|
91855
|
-
contentWidth: contentWidth,
|
|
91856
|
-
contentHeight: contentHeight,
|
|
91731
|
+
width: "" + width + "px",
|
|
91732
|
+
height: "" + height + "px",
|
|
91857
91733
|
transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
|
|
91858
91734
|
};
|
|
91859
91735
|
}
|
|
91860
|
-
var contentWidth1 = box.max.x - box.min.x;
|
|
91861
|
-
var contentHeight1 = box.max.y - box.min.y;
|
|
91862
91736
|
return {
|
|
91863
91737
|
left: "" + (box.min.x - offsetX) + "px",
|
|
91864
91738
|
top: "" + (box.min.y - offsetY) + "px",
|
|
91865
|
-
width: "" +
|
|
91866
|
-
height: "" +
|
|
91867
|
-
contentWidth: contentWidth1,
|
|
91868
|
-
contentHeight: contentHeight1,
|
|
91739
|
+
width: "" + (box.max.x - box.min.x) + "px",
|
|
91740
|
+
height: "" + (box.max.y - box.min.y) + "px",
|
|
91869
91741
|
transform: ''
|
|
91870
91742
|
};
|
|
91871
91743
|
}
|
|
@@ -91888,10 +91760,6 @@ function formatMatrixNumber(value) {
|
|
|
91888
91760
|
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91889
91761
|
return Number(normalized.toFixed(6)).toString();
|
|
91890
91762
|
}
|
|
91891
|
-
function formatPixelNumber(value) {
|
|
91892
|
-
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91893
|
-
return Number(normalized.toFixed(6)).toString();
|
|
91894
|
-
}
|
|
91895
91763
|
|
|
91896
91764
|
function mountHTMLShell(container, content, shell) {
|
|
91897
91765
|
if (!shell) {
|
|
@@ -91912,26 +91780,6 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91912
91780
|
|
|
91913
91781
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91914
91782
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
91915
|
-
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
91916
|
-
'[data-vvfx-html-interaction-zone="self"]',
|
|
91917
|
-
'[data-vvfx-html-interaction-zone="subtree"]',
|
|
91918
|
-
'a[href]',
|
|
91919
|
-
'button:not([disabled])',
|
|
91920
|
-
'input:not([disabled])',
|
|
91921
|
-
'textarea:not([disabled])',
|
|
91922
|
-
'select:not([disabled])',
|
|
91923
|
-
'summary',
|
|
91924
|
-
'video[controls]',
|
|
91925
|
-
'audio[controls]',
|
|
91926
|
-
'[contenteditable]:not([contenteditable="false"])',
|
|
91927
|
-
'[role="button"]',
|
|
91928
|
-
'[role="link"]',
|
|
91929
|
-
'[role="textbox"]',
|
|
91930
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
91931
|
-
].join(', ');
|
|
91932
|
-
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
91933
|
-
'[data-vvfx-html-interaction-zone="none"]'
|
|
91934
|
-
].join(', ');
|
|
91935
91783
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91936
91784
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91937
91785
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91941,20 +91789,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91941
91789
|
var _this = this;
|
|
91942
91790
|
this.options = options;
|
|
91943
91791
|
this.eventCleanups = [];
|
|
91944
|
-
this.htmlRootConfigCleanups = new WeakMap();
|
|
91945
91792
|
this.state = {
|
|
91946
91793
|
frameElements: new Map(),
|
|
91947
91794
|
elements: new Map(),
|
|
91948
|
-
selectionElements: new Map(),
|
|
91949
91795
|
contentScaleElements: new Map(),
|
|
91950
91796
|
contentElements: new Map(),
|
|
91951
91797
|
contentMountElements: new Map(),
|
|
91952
|
-
contentInteractionZones: new Map(),
|
|
91953
|
-
contentInteractionZoneCleanups: new Map(),
|
|
91954
|
-
contentInteractionResizeCleanups: new Map(),
|
|
91955
91798
|
contents: new Map(),
|
|
91956
91799
|
cleanups: new Map(),
|
|
91957
|
-
autoHeightModes: new Map(),
|
|
91958
91800
|
autoHeightCleanups: new Map(),
|
|
91959
91801
|
autoHeightFrames: new Map()
|
|
91960
91802
|
};
|
|
@@ -91971,9 +91813,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91971
91813
|
}
|
|
91972
91814
|
return;
|
|
91973
91815
|
}
|
|
91974
|
-
if (!_this.isEditableCard(targetId)) {
|
|
91975
|
-
return;
|
|
91976
|
-
}
|
|
91977
91816
|
event.preventDefault();
|
|
91978
91817
|
event.stopPropagation();
|
|
91979
91818
|
_this.enterEditing(targetId);
|
|
@@ -91989,7 +91828,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91989
91828
|
_this.exitEditing();
|
|
91990
91829
|
};
|
|
91991
91830
|
this.handleContainerMouseMove = function(event) {
|
|
91992
|
-
_this.scheduleActiveContentInteractionSync(event);
|
|
91993
91831
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
91994
91832
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
91995
91833
|
return;
|
|
@@ -92003,16 +91841,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92003
91841
|
_this.syncContentInteraction(hoverShellInteractiveId);
|
|
92004
91842
|
}
|
|
92005
91843
|
};
|
|
92006
|
-
this.handleContainerMouseLeave = function(
|
|
92007
|
-
if (_this.isMouseLeaveWithinContainer(event)) {
|
|
92008
|
-
return;
|
|
92009
|
-
}
|
|
92010
|
-
if (_this.contentInteractionFrame !== undefined) {
|
|
92011
|
-
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
92012
|
-
_this.contentInteractionFrame = undefined;
|
|
92013
|
-
}
|
|
92014
|
-
_this.pendingContentInteractionEvent = undefined;
|
|
92015
|
-
_this.setActiveContentInteraction(undefined);
|
|
91844
|
+
this.handleContainerMouseLeave = function() {
|
|
92016
91845
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
92017
91846
|
if (!previousId) {
|
|
92018
91847
|
return;
|
|
@@ -92020,33 +91849,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92020
91849
|
_this.state.hoverShellInteractiveId = undefined;
|
|
92021
91850
|
_this.syncContentInteraction(previousId);
|
|
92022
91851
|
};
|
|
92023
|
-
this.handleContainerContextMenu = function(event) {
|
|
92024
|
-
var activeInteraction = _this.state.activeContentInteraction;
|
|
92025
|
-
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92026
|
-
return;
|
|
92027
|
-
}
|
|
92028
|
-
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92029
|
-
if (!canvas) {
|
|
92030
|
-
return;
|
|
92031
|
-
}
|
|
92032
|
-
event.preventDefault();
|
|
92033
|
-
event.stopPropagation();
|
|
92034
|
-
_this.setActiveContentInteraction(undefined);
|
|
92035
|
-
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92036
|
-
bubbles: true,
|
|
92037
|
-
cancelable: true,
|
|
92038
|
-
clientX: event.clientX,
|
|
92039
|
-
clientY: event.clientY,
|
|
92040
|
-
screenX: event.screenX,
|
|
92041
|
-
screenY: event.screenY,
|
|
92042
|
-
button: event.button,
|
|
92043
|
-
buttons: event.buttons,
|
|
92044
|
-
ctrlKey: event.ctrlKey,
|
|
92045
|
-
shiftKey: event.shiftKey,
|
|
92046
|
-
altKey: event.altKey,
|
|
92047
|
-
metaKey: event.metaKey
|
|
92048
|
-
}));
|
|
92049
|
-
};
|
|
92050
91852
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
92051
91853
|
}
|
|
92052
91854
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -92060,6 +91862,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92060
91862
|
layer.style.position = 'absolute';
|
|
92061
91863
|
layer.style.inset = '0';
|
|
92062
91864
|
layer.style.pointerEvents = 'none';
|
|
91865
|
+
layer.style.zIndex = '1';
|
|
92063
91866
|
container.appendChild(layer);
|
|
92064
91867
|
this.state.layer = layer;
|
|
92065
91868
|
this.initDOMEvents();
|
|
@@ -92072,32 +91875,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92072
91875
|
cancelAnimationFrame(this.state.updateFrame);
|
|
92073
91876
|
this.state.updateFrame = undefined;
|
|
92074
91877
|
}
|
|
92075
|
-
if (this.contentInteractionFrame !== undefined) {
|
|
92076
|
-
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92077
|
-
this.contentInteractionFrame = undefined;
|
|
92078
|
-
}
|
|
92079
|
-
this.pendingContentInteractionEvent = undefined;
|
|
92080
91878
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92081
91879
|
cleanup();
|
|
92082
91880
|
});
|
|
92083
91881
|
this.state.frameElements.clear();
|
|
92084
91882
|
this.state.elements.clear();
|
|
92085
|
-
this.state.selectionElements.clear();
|
|
92086
91883
|
this.state.contentScaleElements.clear();
|
|
92087
91884
|
this.state.contentElements.clear();
|
|
92088
91885
|
this.state.contentMountElements.clear();
|
|
92089
|
-
this.state.contentInteractionZones.clear();
|
|
92090
|
-
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92091
|
-
cleanup();
|
|
92092
|
-
});
|
|
92093
|
-
this.state.contentInteractionZoneCleanups.clear();
|
|
92094
|
-
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92095
|
-
cleanup();
|
|
92096
|
-
});
|
|
92097
|
-
this.state.contentInteractionResizeCleanups.clear();
|
|
92098
91886
|
this.state.contents.clear();
|
|
92099
91887
|
this.state.cleanups.clear();
|
|
92100
|
-
this.state.autoHeightModes.clear();
|
|
92101
91888
|
this.state.autoHeightCleanups.forEach(function(cleanup) {
|
|
92102
91889
|
cleanup();
|
|
92103
91890
|
});
|
|
@@ -92112,12 +91899,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92112
91899
|
this.eventCleanups = [];
|
|
92113
91900
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92114
91901
|
this.state.layer = undefined;
|
|
92115
|
-
this.state.selectionLayer = undefined;
|
|
92116
91902
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92117
91903
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92118
91904
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92119
91905
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92120
|
-
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92121
91906
|
};
|
|
92122
91907
|
_proto.scheduleRender = function scheduleRender() {
|
|
92123
91908
|
var _this = this;
|
|
@@ -92129,10 +91914,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92129
91914
|
_this.render();
|
|
92130
91915
|
});
|
|
92131
91916
|
};
|
|
92132
|
-
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92133
|
-
this.cleanupOverlayContent(id);
|
|
92134
|
-
this.invalidateContentInteractionZones(id);
|
|
92135
|
-
};
|
|
92136
91917
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92137
91918
|
return _async_to_generator(function() {
|
|
92138
91919
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92225,7 +92006,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92225
92006
|
var events = [
|
|
92226
92007
|
'pageDataChange',
|
|
92227
92008
|
'selectedItemChange',
|
|
92228
|
-
'preSelectedItemChange',
|
|
92229
92009
|
'itemPropertyChange',
|
|
92230
92010
|
'viewportTransform',
|
|
92231
92011
|
'viewRebuildFinish'
|
|
@@ -92235,7 +92015,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92235
92015
|
if (event === 'viewportTransform') {
|
|
92236
92016
|
_this.handleViewportTransform();
|
|
92237
92017
|
}
|
|
92238
|
-
_this.invalidateContentInteractionZones();
|
|
92239
92018
|
_this.scheduleRender();
|
|
92240
92019
|
});
|
|
92241
92020
|
});
|
|
@@ -92245,24 +92024,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92245
92024
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92246
92025
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92247
92026
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92248
|
-
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92249
|
-
};
|
|
92250
|
-
_proto.isMouseLeaveWithinContainer = function isMouseLeaveWithinContainer(event) {
|
|
92251
|
-
var relatedTarget = event.relatedTarget;
|
|
92252
|
-
if (!relatedTarget) {
|
|
92253
|
-
return false;
|
|
92254
|
-
}
|
|
92255
|
-
try {
|
|
92256
|
-
return this.options.container.contains(relatedTarget);
|
|
92257
|
-
} catch (unused) {
|
|
92258
|
-
return false;
|
|
92259
|
-
}
|
|
92260
|
-
};
|
|
92261
|
-
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92262
|
-
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92263
|
-
return false;
|
|
92264
|
-
}
|
|
92265
|
-
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92266
92027
|
};
|
|
92267
92028
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92268
92029
|
var editing = this.state.editing;
|
|
@@ -92282,16 +92043,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92282
92043
|
}
|
|
92283
92044
|
var items = this.options.getItems();
|
|
92284
92045
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92285
|
-
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92286
92046
|
var visibleCardIds = new Set();
|
|
92287
92047
|
var editingVisible = false;
|
|
92288
92048
|
items.forEach(function(item) {
|
|
92289
92049
|
var _this_state_editing;
|
|
92290
|
-
if (!isCardItem(item) || !item.visible) {
|
|
92291
|
-
return;
|
|
92292
|
-
}
|
|
92293
|
-
var html = _this.options.resolveCardHTML(item);
|
|
92294
|
-
if (html === undefined) {
|
|
92050
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92295
92051
|
return;
|
|
92296
92052
|
}
|
|
92297
92053
|
var itemBox = _this.options.getViewBoxById(item.id);
|
|
@@ -92306,31 +92062,21 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92306
92062
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92307
92063
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92308
92064
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92309
|
-
var
|
|
92310
|
-
if (
|
|
92065
|
+
var html = item.html;
|
|
92066
|
+
if (html && _this.state.contents.get(item.id) !== html) {
|
|
92311
92067
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92312
92068
|
}
|
|
92313
|
-
_this.applyHTMLRootConfig(overlay, html);
|
|
92314
92069
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92315
92070
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92316
|
-
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY
|
|
92071
|
+
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
|
|
92317
92072
|
overlay.style.left = boxStyle.left;
|
|
92318
92073
|
overlay.style.top = boxStyle.top;
|
|
92319
92074
|
overlay.style.width = boxStyle.width;
|
|
92320
92075
|
overlay.style.height = boxStyle.height;
|
|
92321
92076
|
overlay.style.transform = boxStyle.transform;
|
|
92322
92077
|
overlay.style.transformOrigin = '0 0';
|
|
92323
|
-
|
|
92324
|
-
|
|
92325
|
-
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92326
|
-
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92327
|
-
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92328
|
-
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92329
|
-
selectionOverlay.style.transformOrigin = '0 0';
|
|
92330
|
-
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92331
|
-
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92332
|
-
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92333
|
-
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92078
|
+
_this.syncContentScale(item.id, item.property.width, item.property.height);
|
|
92079
|
+
_this.syncAutoHeight(item.id, item.property.autoHeight === true);
|
|
92334
92080
|
_this.syncContentInteraction(item.id);
|
|
92335
92081
|
});
|
|
92336
92082
|
elements.forEach(function(_overlay, id) {
|
|
@@ -92369,9 +92115,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92369
92115
|
}
|
|
92370
92116
|
}
|
|
92371
92117
|
syncElementStackOrder(layer, rootElements);
|
|
92372
|
-
if (this.state.selectionLayer) {
|
|
92373
|
-
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92374
|
-
}
|
|
92375
92118
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92376
92119
|
var frameElements = [];
|
|
92377
92120
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92387,28 +92130,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92387
92130
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92388
92131
|
});
|
|
92389
92132
|
};
|
|
92390
|
-
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92391
|
-
var _layer_ownerDocument;
|
|
92392
|
-
if (this.state.selectionLayer) {
|
|
92393
|
-
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92394
|
-
layer.appendChild(this.state.selectionLayer);
|
|
92395
|
-
}
|
|
92396
|
-
return this.state.selectionLayer;
|
|
92397
|
-
}
|
|
92398
|
-
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92399
|
-
if (!ownerDocument) {
|
|
92400
|
-
return layer;
|
|
92401
|
-
}
|
|
92402
|
-
var selectionLayer = ownerDocument.createElement('div');
|
|
92403
|
-
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92404
|
-
selectionLayer.style.position = 'absolute';
|
|
92405
|
-
selectionLayer.style.inset = '0';
|
|
92406
|
-
selectionLayer.style.pointerEvents = 'none';
|
|
92407
|
-
selectionLayer.style.zIndex = '1';
|
|
92408
|
-
layer.appendChild(selectionLayer);
|
|
92409
|
-
this.state.selectionLayer = selectionLayer;
|
|
92410
|
-
return selectionLayer;
|
|
92411
|
-
};
|
|
92412
92133
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92413
92134
|
var _this = this;
|
|
92414
92135
|
var visibleFrameIds = new Set();
|
|
@@ -92473,41 +92194,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92473
92194
|
elements.set(id, overlay);
|
|
92474
92195
|
return overlay;
|
|
92475
92196
|
};
|
|
92476
|
-
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92477
|
-
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92478
|
-
if (selectionOverlay) {
|
|
92479
|
-
if (selectionOverlay.parentElement !== parent) {
|
|
92480
|
-
parent.appendChild(selectionOverlay);
|
|
92481
|
-
}
|
|
92482
|
-
return selectionOverlay;
|
|
92483
|
-
}
|
|
92484
|
-
selectionOverlay = document.createElement('div');
|
|
92485
|
-
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92486
|
-
selectionOverlay.dataset.itemId = id;
|
|
92487
|
-
selectionOverlay.style.position = 'absolute';
|
|
92488
|
-
selectionOverlay.style.pointerEvents = 'none';
|
|
92489
|
-
selectionOverlay.style.zIndex = '1';
|
|
92490
|
-
parent.appendChild(selectionOverlay);
|
|
92491
|
-
this.state.selectionElements.set(id, selectionOverlay);
|
|
92492
|
-
return selectionOverlay;
|
|
92493
|
-
};
|
|
92494
|
-
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92495
|
-
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92496
|
-
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92497
|
-
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92498
|
-
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92499
|
-
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92500
|
-
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92501
|
-
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92502
|
-
};
|
|
92503
|
-
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92504
|
-
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92505
|
-
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92506
|
-
};
|
|
92507
|
-
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92508
|
-
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92509
|
-
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92510
|
-
};
|
|
92511
92197
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92512
92198
|
var layer = this.state.layer;
|
|
92513
92199
|
if (!layer) {
|
|
@@ -92517,7 +92203,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92517
92203
|
var items = this.options.getItems();
|
|
92518
92204
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92519
92205
|
var item = items[i];
|
|
92520
|
-
if (!isCardItem(item) || !item.visible ||
|
|
92206
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92521
92207
|
continue;
|
|
92522
92208
|
}
|
|
92523
92209
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92536,7 +92222,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92536
92222
|
var items = this.options.getItems();
|
|
92537
92223
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92538
92224
|
var item = items[i];
|
|
92539
|
-
if (!isCardItem(item) || !item.visible ||
|
|
92225
|
+
if (!isCardItem(item) || !item.visible || item.html === undefined) {
|
|
92540
92226
|
continue;
|
|
92541
92227
|
}
|
|
92542
92228
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92546,206 +92232,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92546
92232
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92547
92233
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92548
92234
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92549
|
-
|
|
92235
|
+
var rect = element.getBoundingClientRect();
|
|
92236
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92550
92237
|
});
|
|
92551
92238
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92552
92239
|
}
|
|
92553
92240
|
return undefined;
|
|
92554
92241
|
};
|
|
92555
|
-
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92556
|
-
var decision = this.resolveHTMLInteractionTarget(event);
|
|
92557
|
-
if (decision.kind === 'canvas' && this.shouldKeepActiveContentInteractionForFocusedElement()) {
|
|
92558
|
-
return;
|
|
92559
|
-
}
|
|
92560
|
-
this.setActiveContentInteraction(decision.kind === 'html' ? decision.interaction : undefined);
|
|
92561
|
-
};
|
|
92562
|
-
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92563
|
-
var _this = this;
|
|
92564
|
-
if (typeof requestAnimationFrame !== 'function') {
|
|
92565
|
-
this.syncActiveContentInteraction(event);
|
|
92566
|
-
return;
|
|
92567
|
-
}
|
|
92568
|
-
this.pendingContentInteractionEvent = event;
|
|
92569
|
-
if (this.contentInteractionFrame !== undefined) {
|
|
92570
|
-
return;
|
|
92571
|
-
}
|
|
92572
|
-
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92573
|
-
_this.contentInteractionFrame = undefined;
|
|
92574
|
-
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92575
|
-
_this.pendingContentInteractionEvent = undefined;
|
|
92576
|
-
if (pendingEvent) {
|
|
92577
|
-
_this.syncActiveContentInteraction(pendingEvent);
|
|
92578
|
-
}
|
|
92579
|
-
});
|
|
92580
|
-
};
|
|
92581
|
-
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92582
|
-
var _this = this;
|
|
92583
|
-
var previous = this.state.activeContentInteraction;
|
|
92584
|
-
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)) {
|
|
92585
|
-
return;
|
|
92586
|
-
}
|
|
92587
|
-
this.state.activeContentInteraction = zone;
|
|
92588
|
-
var changedIds = new Set();
|
|
92589
|
-
if (previous) {
|
|
92590
|
-
changedIds.add(previous.id);
|
|
92591
|
-
}
|
|
92592
|
-
if (zone) {
|
|
92593
|
-
changedIds.add(zone.id);
|
|
92594
|
-
}
|
|
92595
|
-
changedIds.forEach(function(id) {
|
|
92596
|
-
_this.syncContentInteraction(id);
|
|
92597
|
-
});
|
|
92598
|
-
};
|
|
92599
|
-
_proto.shouldKeepActiveContentInteractionForFocusedElement = function shouldKeepActiveContentInteractionForFocusedElement() {
|
|
92600
|
-
var activeInteraction = this.state.activeContentInteraction;
|
|
92601
|
-
if (!activeInteraction || typeof document === 'undefined') {
|
|
92602
|
-
return false;
|
|
92603
|
-
}
|
|
92604
|
-
var activeElement = document.activeElement;
|
|
92605
|
-
if (!activeElement || activeElement === document.body) {
|
|
92606
|
-
return false;
|
|
92607
|
-
}
|
|
92608
|
-
var interactionElement = activeInteraction.element;
|
|
92609
|
-
return interactionElement === activeElement || typeof interactionElement.contains === 'function' && interactionElement.contains(activeElement);
|
|
92610
|
-
};
|
|
92611
|
-
_proto.resolveHTMLInteractionTarget = function resolveHTMLInteractionTarget(event) {
|
|
92612
|
-
var id = this.getHTMLCardIdByEvent(event);
|
|
92613
|
-
if (!id || this.isEditableCard(id)) {
|
|
92614
|
-
return {
|
|
92615
|
-
kind: 'canvas',
|
|
92616
|
-
id: id
|
|
92617
|
-
};
|
|
92618
|
-
}
|
|
92619
|
-
var contentOverlay = this.state.contentElements.get(id);
|
|
92620
|
-
if (!contentOverlay) {
|
|
92621
|
-
return {
|
|
92622
|
-
kind: 'canvas',
|
|
92623
|
-
id: id
|
|
92624
|
-
};
|
|
92625
|
-
}
|
|
92626
|
-
var activeSubtree = this.getActiveSubtreeInteractionAtEvent(id, event);
|
|
92627
|
-
if (activeSubtree) {
|
|
92628
|
-
return {
|
|
92629
|
-
kind: 'html',
|
|
92630
|
-
interaction: activeSubtree
|
|
92631
|
-
};
|
|
92632
|
-
}
|
|
92633
|
-
var matchedZones = this.getContentInteractionZones(id, contentOverlay).filter(function(zone) {
|
|
92634
|
-
return isMouseEventInsideRect(event, zone.rect);
|
|
92635
|
-
});
|
|
92636
|
-
var zone = this.resolveContentInteractionZone(matchedZones);
|
|
92637
|
-
if (zone) {
|
|
92638
|
-
return {
|
|
92639
|
-
kind: 'html',
|
|
92640
|
-
interaction: {
|
|
92641
|
-
id: id,
|
|
92642
|
-
element: zone.element,
|
|
92643
|
-
zone: zone.zone
|
|
92644
|
-
}
|
|
92645
|
-
};
|
|
92646
|
-
}
|
|
92647
|
-
return {
|
|
92648
|
-
kind: 'canvas',
|
|
92649
|
-
id: id
|
|
92650
|
-
};
|
|
92651
|
-
};
|
|
92652
|
-
_proto.getActiveSubtreeInteractionAtEvent = function getActiveSubtreeInteractionAtEvent(id, event) {
|
|
92653
|
-
var activeInteraction = this.state.activeContentInteraction;
|
|
92654
|
-
if ((activeInteraction == null ? void 0 : activeInteraction.id) !== id || activeInteraction.zone !== 'subtree') {
|
|
92655
|
-
return undefined;
|
|
92656
|
-
}
|
|
92657
|
-
var rect = activeInteraction.element.getBoundingClientRect();
|
|
92658
|
-
return isMouseEventInsideRect(event, rect) ? activeInteraction : undefined;
|
|
92659
|
-
};
|
|
92660
|
-
_proto.resolveContentInteractionZone = function resolveContentInteractionZone(zones) {
|
|
92661
|
-
if (zones.length <= 1) {
|
|
92662
|
-
return zones[0];
|
|
92663
|
-
}
|
|
92664
|
-
var subtreeRoot = zones.find(function(candidate) {
|
|
92665
|
-
return candidate.zone === 'subtree' && typeof candidate.element.contains === 'function' && zones.some(function(zone) {
|
|
92666
|
-
return zone.element !== candidate.element && candidate.element.contains(zone.element);
|
|
92667
|
-
});
|
|
92668
|
-
});
|
|
92669
|
-
return subtreeRoot != null ? subtreeRoot : zones[0];
|
|
92670
|
-
};
|
|
92671
|
-
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92672
|
-
var _this = this;
|
|
92673
|
-
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92674
|
-
if (cachedZones) {
|
|
92675
|
-
return cachedZones;
|
|
92676
|
-
}
|
|
92677
|
-
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92678
|
-
return !_this.isContentInteractionDisabled(element);
|
|
92679
|
-
}).map(function(element) {
|
|
92680
|
-
return {
|
|
92681
|
-
element: element,
|
|
92682
|
-
rect: element.getBoundingClientRect(),
|
|
92683
|
-
zone: _this.getContentInteractionZoneMode(element)
|
|
92684
|
-
};
|
|
92685
|
-
});
|
|
92686
|
-
this.state.contentInteractionZones.set(id, zones);
|
|
92687
|
-
this.observeContentInteractionZoneResizes(id, zones);
|
|
92688
|
-
return zones;
|
|
92689
|
-
};
|
|
92690
|
-
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92691
|
-
var _ref;
|
|
92692
|
-
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92693
|
-
var item = this.options.getItems().find(function(item) {
|
|
92694
|
-
return item.id === id;
|
|
92695
|
-
});
|
|
92696
|
-
if (!item) {
|
|
92697
|
-
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92698
|
-
}
|
|
92699
|
-
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 : [];
|
|
92700
|
-
if (selectors.length === 0) {
|
|
92701
|
-
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92702
|
-
}
|
|
92703
|
-
return [].concat([
|
|
92704
|
-
CONTENT_INTERACTIVE_SELECTOR
|
|
92705
|
-
], selectors).join(', ');
|
|
92706
|
-
};
|
|
92707
|
-
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92708
|
-
if (typeof element.closest !== 'function') {
|
|
92709
|
-
return false;
|
|
92710
|
-
}
|
|
92711
|
-
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92712
|
-
};
|
|
92713
|
-
_proto.getContentInteractionZoneMode = function getContentInteractionZoneMode(element) {
|
|
92714
|
-
var zone = element.dataset.vvfxHtmlInteractionZone;
|
|
92715
|
-
return zone === 'subtree' ? 'subtree' : 'self';
|
|
92716
|
-
};
|
|
92717
|
-
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92718
|
-
if (id) {
|
|
92719
|
-
var _this_state_contentInteractionResizeCleanups_get;
|
|
92720
|
-
this.state.contentInteractionZones.delete(id);
|
|
92721
|
-
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92722
|
-
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92723
|
-
return;
|
|
92724
|
-
}
|
|
92725
|
-
this.state.contentInteractionZones.clear();
|
|
92726
|
-
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92727
|
-
cleanup();
|
|
92728
|
-
});
|
|
92729
|
-
this.state.contentInteractionResizeCleanups.clear();
|
|
92730
|
-
};
|
|
92731
|
-
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92732
|
-
var _this = this;
|
|
92733
|
-
var _this_state_contentInteractionResizeCleanups_get;
|
|
92734
|
-
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92735
|
-
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92736
|
-
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92737
|
-
return;
|
|
92738
|
-
}
|
|
92739
|
-
var observer = new ResizeObserver(function() {
|
|
92740
|
-
_this.invalidateContentInteractionZones(id);
|
|
92741
|
-
});
|
|
92742
|
-
zones.forEach(function(zone) {
|
|
92743
|
-
observer.observe(zone.element);
|
|
92744
|
-
});
|
|
92745
|
-
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92746
|
-
observer.disconnect();
|
|
92747
|
-
});
|
|
92748
|
-
};
|
|
92749
92242
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92750
92243
|
var rect = this.options.container.getBoundingClientRect();
|
|
92751
92244
|
return {
|
|
@@ -92802,35 +92295,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92802
92295
|
if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
|
|
92803
92296
|
return;
|
|
92804
92297
|
}
|
|
92805
|
-
|
|
92806
|
-
|
|
92807
|
-
var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
|
|
92808
|
-
scaleOverlay.style.width = nextWidth;
|
|
92809
|
-
scaleOverlay.style.height = nextHeight;
|
|
92298
|
+
scaleOverlay.style.width = "" + width + "px";
|
|
92299
|
+
scaleOverlay.style.height = "" + height + "px";
|
|
92810
92300
|
scaleOverlay.style.transform = 'none';
|
|
92811
|
-
contentOverlay.style.width =
|
|
92812
|
-
contentOverlay.style.height =
|
|
92813
|
-
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92814
|
-
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92815
|
-
}
|
|
92816
|
-
if (sizeChanged) {
|
|
92817
|
-
this.invalidateContentInteractionZones(id);
|
|
92818
|
-
}
|
|
92819
|
-
};
|
|
92820
|
-
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92821
|
-
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92822
|
-
requestCardHTMLAutoHeight(iframe, id);
|
|
92823
|
-
});
|
|
92301
|
+
contentOverlay.style.width = "" + width + "px";
|
|
92302
|
+
contentOverlay.style.height = "" + height + "px";
|
|
92824
92303
|
};
|
|
92825
92304
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92826
|
-
var _this_state_editing
|
|
92305
|
+
var _this_state_editing;
|
|
92827
92306
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
92828
|
-
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92829
92307
|
var overlay = this.state.elements.get(id);
|
|
92830
92308
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92831
92309
|
var contentOverlay = this.state.contentElements.get(id);
|
|
92832
92310
|
var contentMount = this.state.contentMountElements.get(id);
|
|
92833
|
-
var isInteractive = isEditing || !!activeInteraction;
|
|
92834
92311
|
if (overlay) {
|
|
92835
92312
|
overlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92836
92313
|
overlay.style.pointerEvents = 'none';
|
|
@@ -92841,62 +92318,34 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92841
92318
|
}
|
|
92842
92319
|
if (contentOverlay) {
|
|
92843
92320
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92844
|
-
contentOverlay.style.pointerEvents =
|
|
92321
|
+
contentOverlay.style.pointerEvents = 'none';
|
|
92845
92322
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92846
|
-
|
|
92847
|
-
iframe.
|
|
92848
|
-
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92323
|
+
iframe.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92324
|
+
iframe.tabIndex = isEditing ? 0 : -1;
|
|
92849
92325
|
});
|
|
92850
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92851
|
-
this.syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive);
|
|
92326
|
+
this.syncShellInteraction(id, contentOverlay, isEditing);
|
|
92852
92327
|
}
|
|
92853
92328
|
if (contentMount) {
|
|
92854
92329
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92855
|
-
contentMount.style.pointerEvents =
|
|
92856
|
-
contentMount.inert = !
|
|
92857
|
-
if (
|
|
92330
|
+
contentMount.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92331
|
+
contentMount.inert = !isEditing;
|
|
92332
|
+
if (isEditing) {
|
|
92858
92333
|
contentMount.removeAttribute('aria-hidden');
|
|
92859
92334
|
} else {
|
|
92860
92335
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92861
92336
|
}
|
|
92862
92337
|
}
|
|
92863
92338
|
};
|
|
92864
|
-
_proto.
|
|
92865
|
-
var _this = this;
|
|
92866
|
-
var activeElement = activeInteraction == null ? void 0 : activeInteraction.element;
|
|
92867
|
-
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
92868
|
-
if ((activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && activeElement && element !== activeElement && typeof activeElement.contains === 'function' && activeElement.contains(element)) {
|
|
92869
|
-
_this.clearContentInteractionState(element);
|
|
92870
|
-
return;
|
|
92871
|
-
}
|
|
92872
|
-
if (!isInteractive) {
|
|
92873
|
-
_this.clearContentInteractionState(element);
|
|
92874
|
-
return;
|
|
92875
|
-
}
|
|
92876
|
-
if (_this.isContentInteractionDisabled(element)) {
|
|
92877
|
-
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
92878
|
-
element.style.pointerEvents = 'none';
|
|
92879
|
-
return;
|
|
92880
|
-
}
|
|
92881
|
-
var isElementInteractive = isEditing || activeElement === element || (activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && typeof (activeElement == null ? void 0 : activeElement.contains) === 'function' && activeElement.contains(element);
|
|
92882
|
-
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
92883
|
-
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
92884
|
-
});
|
|
92885
|
-
};
|
|
92886
|
-
_proto.clearContentInteractionState = function clearContentInteractionState(element) {
|
|
92887
|
-
delete element.dataset.vvfxHtmlInteractionActive;
|
|
92888
|
-
element.style.pointerEvents = '';
|
|
92889
|
-
};
|
|
92890
|
-
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92339
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isEditing) {
|
|
92891
92340
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92892
|
-
var isShellInteractiveActive =
|
|
92341
|
+
var isShellInteractiveActive = isEditing || isHoveringShellInteractive;
|
|
92893
92342
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92894
92343
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92895
92344
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92896
92345
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92897
92346
|
});
|
|
92898
92347
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92899
|
-
element.style.pointerEvents =
|
|
92348
|
+
element.style.pointerEvents = isEditing ? 'auto' : 'none';
|
|
92900
92349
|
});
|
|
92901
92350
|
};
|
|
92902
92351
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92904,9 +92353,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92904
92353
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92905
92354
|
return;
|
|
92906
92355
|
}
|
|
92907
|
-
if (!this.isEditableCard(id)) {
|
|
92908
|
-
return;
|
|
92909
|
-
}
|
|
92910
92356
|
var box = this.options.getViewBoxById(id);
|
|
92911
92357
|
if (box.isEmpty()) {
|
|
92912
92358
|
return;
|
|
@@ -92950,13 +92396,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92950
92396
|
this.options.setViewport(editing.restoreViewport);
|
|
92951
92397
|
this.scheduleRender();
|
|
92952
92398
|
};
|
|
92953
|
-
_proto.isEditableCard = function isEditableCard(id) {
|
|
92954
|
-
var _this_options_resolveCardTypeConfig;
|
|
92955
|
-
var item = this.options.getItems().find(function(item) {
|
|
92956
|
-
return item.id === id;
|
|
92957
|
-
});
|
|
92958
|
-
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
92959
|
-
};
|
|
92960
92399
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92961
92400
|
var viewportElement = this.options.container.parentElement;
|
|
92962
92401
|
if (!viewportElement) {
|
|
@@ -92981,7 +92420,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92981
92420
|
};
|
|
92982
92421
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92983
92422
|
this.cleanupOverlayContent(id);
|
|
92984
|
-
this.invalidateContentInteractionZones(id);
|
|
92985
92423
|
overlay.innerHTML = '';
|
|
92986
92424
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92987
92425
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92991,81 +92429,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92991
92429
|
});
|
|
92992
92430
|
var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
|
|
92993
92431
|
id: id,
|
|
92994
|
-
autoHeight:
|
|
92432
|
+
autoHeight: isCardItem(item) && item.property.autoHeight === true
|
|
92995
92433
|
});
|
|
92996
|
-
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92997
92434
|
this.state.cleanups.set(id, function() {
|
|
92998
92435
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92999
92436
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
93000
92437
|
});
|
|
93001
92438
|
this.state.contents.set(id, html);
|
|
93002
92439
|
};
|
|
93003
|
-
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
93004
|
-
var _this = this;
|
|
93005
|
-
var _this_state_contentInteractionZoneCleanups_get;
|
|
93006
|
-
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93007
|
-
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93008
|
-
if (typeof MutationObserver !== 'function') {
|
|
93009
|
-
return;
|
|
93010
|
-
}
|
|
93011
|
-
var observer = new MutationObserver(function() {
|
|
93012
|
-
_this.invalidateContentInteractionZones(id);
|
|
93013
|
-
});
|
|
93014
|
-
observer.observe(contentContainer, {
|
|
93015
|
-
attributes: true,
|
|
93016
|
-
childList: true,
|
|
93017
|
-
subtree: true
|
|
93018
|
-
});
|
|
93019
|
-
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
93020
|
-
observer.disconnect();
|
|
93021
|
-
});
|
|
93022
|
-
};
|
|
93023
|
-
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
93024
|
-
var _ref, _config_style;
|
|
93025
|
-
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
93026
|
-
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
93027
|
-
this.htmlRootConfigCleanups.delete(root);
|
|
93028
|
-
var config = html.root;
|
|
93029
|
-
if (!config) {
|
|
93030
|
-
return;
|
|
93031
|
-
}
|
|
93032
|
-
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
93033
|
-
var styleProperties = [];
|
|
93034
|
-
classNames.forEach(function(className) {
|
|
93035
|
-
root.classList.add(className);
|
|
93036
|
-
});
|
|
93037
|
-
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
93038
|
-
var property = param[0], value = param[1];
|
|
93039
|
-
if (value === undefined) {
|
|
93040
|
-
return;
|
|
93041
|
-
}
|
|
93042
|
-
styleProperties.push(property);
|
|
93043
|
-
if (property.startsWith('--') || property.includes('-')) {
|
|
93044
|
-
root.style.setProperty(property, String(value));
|
|
93045
|
-
return;
|
|
93046
|
-
}
|
|
93047
|
-
root.style[property] = String(value);
|
|
93048
|
-
});
|
|
93049
|
-
this.htmlRootConfigCleanups.set(root, function() {
|
|
93050
|
-
classNames.forEach(function(className) {
|
|
93051
|
-
root.classList.remove(className);
|
|
93052
|
-
});
|
|
93053
|
-
styleProperties.forEach(function(property) {
|
|
93054
|
-
if (property.startsWith('--') || property.includes('-')) {
|
|
93055
|
-
root.style.removeProperty(property);
|
|
93056
|
-
return;
|
|
93057
|
-
}
|
|
93058
|
-
root.style[property] = '';
|
|
93059
|
-
});
|
|
93060
|
-
});
|
|
93061
|
-
};
|
|
93062
92440
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
93063
92441
|
var _this = this;
|
|
93064
92442
|
switch(content.kind){
|
|
93065
92443
|
case 'inline':
|
|
93066
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93067
|
-
this.state.autoHeightModes.set(options.id, 'message');
|
|
93068
|
-
}
|
|
93069
92444
|
return this.chainCleanups(function() {
|
|
93070
92445
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
93071
92446
|
}, renderDocumentContent(overlay, {
|
|
@@ -93082,9 +92457,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93082
92457
|
}));
|
|
93083
92458
|
case 'dom':
|
|
93084
92459
|
{
|
|
93085
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93086
|
-
this.state.autoHeightModes.set(options.id, 'measure');
|
|
93087
|
-
}
|
|
93088
92460
|
if (content.target === 'iframe') {
|
|
93089
92461
|
return renderDOMContentInIframe(overlay, content.render, content.cleanup);
|
|
93090
92462
|
}
|
|
@@ -93094,9 +92466,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93094
92466
|
} : undefined;
|
|
93095
92467
|
}
|
|
93096
92468
|
case 'document':
|
|
93097
|
-
if (options == null ? void 0 : options.autoHeight) {
|
|
93098
|
-
this.state.autoHeightModes.set(options.id, 'message');
|
|
93099
|
-
}
|
|
93100
92469
|
return this.chainCleanups(function() {
|
|
93101
92470
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
93102
92471
|
}, renderDocumentContent(overlay, content, {
|
|
@@ -93124,7 +92493,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93124
92493
|
};
|
|
93125
92494
|
};
|
|
93126
92495
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93127
|
-
var _this_state_contentInteractionZoneCleanups_get;
|
|
93128
92496
|
var cleanup = this.state.cleanups.get(id);
|
|
93129
92497
|
if (cleanup) {
|
|
93130
92498
|
cleanup();
|
|
@@ -93132,19 +92500,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93132
92500
|
}
|
|
93133
92501
|
this.state.contents.delete(id);
|
|
93134
92502
|
this.state.contentMountElements.delete(id);
|
|
93135
|
-
this.state.autoHeightModes.delete(id);
|
|
93136
|
-
this.invalidateContentInteractionZones(id);
|
|
93137
|
-
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93138
|
-
this.state.contentInteractionZoneCleanups.delete(id);
|
|
93139
92503
|
this.cleanupAutoHeight(id);
|
|
93140
92504
|
};
|
|
93141
92505
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
93142
|
-
var _this_state_elements_get
|
|
92506
|
+
var _this_state_elements_get;
|
|
93143
92507
|
this.cleanupOverlayContent(id);
|
|
93144
92508
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93145
|
-
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
93146
92509
|
this.state.elements.delete(id);
|
|
93147
|
-
this.state.selectionElements.delete(id);
|
|
93148
92510
|
this.state.contentScaleElements.delete(id);
|
|
93149
92511
|
this.state.contentElements.delete(id);
|
|
93150
92512
|
};
|
|
@@ -93153,27 +92515,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93153
92515
|
this.cleanupAutoHeight(id);
|
|
93154
92516
|
return;
|
|
93155
92517
|
}
|
|
93156
|
-
this.ensureAutoHeightMode(id);
|
|
93157
|
-
if (this.state.autoHeightModes.get(id) === 'message') {
|
|
93158
|
-
this.cleanupAutoHeight(id);
|
|
93159
|
-
return;
|
|
93160
|
-
}
|
|
93161
92518
|
if (!this.state.autoHeightCleanups.has(id)) {
|
|
93162
92519
|
this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
|
|
93163
92520
|
}
|
|
93164
92521
|
this.scheduleAutoHeightMeasure(id);
|
|
93165
92522
|
};
|
|
93166
|
-
_proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
|
|
93167
|
-
var _this_state_contents_get;
|
|
93168
|
-
if (this.state.autoHeightModes.has(id)) {
|
|
93169
|
-
return;
|
|
93170
|
-
}
|
|
93171
|
-
var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
|
|
93172
|
-
if (!content) {
|
|
93173
|
-
return;
|
|
93174
|
-
}
|
|
93175
|
-
this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
|
|
93176
|
-
};
|
|
93177
92523
|
_proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
|
|
93178
92524
|
var _this = this;
|
|
93179
92525
|
var cleanupFns = [];
|
|
@@ -93261,7 +92607,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93261
92607
|
var item = this.options.getItems().find(function(candidate) {
|
|
93262
92608
|
return candidate.id === id;
|
|
93263
92609
|
});
|
|
93264
|
-
if (!
|
|
92610
|
+
if (!isCardItem(item) || item.property.autoHeight !== true) {
|
|
93265
92611
|
this.cleanupAutoHeight(id);
|
|
93266
92612
|
return;
|
|
93267
92613
|
}
|
|
@@ -93280,9 +92626,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93280
92626
|
}).filter(function(height) {
|
|
93281
92627
|
return typeof height === 'number' && Number.isFinite(height) && height > 0;
|
|
93282
92628
|
});
|
|
93283
|
-
var childHeight = this.getChildrenNaturalHeight(element
|
|
93284
|
-
includeIframes: iframeHeights.length === 0
|
|
93285
|
-
});
|
|
92629
|
+
var childHeight = this.getChildrenNaturalHeight(element);
|
|
93286
92630
|
var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
|
|
93287
92631
|
childHeight
|
|
93288
92632
|
], iframeHeights));
|
|
@@ -93302,29 +92646,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93302
92646
|
}
|
|
93303
92647
|
return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
|
|
93304
92648
|
};
|
|
93305
|
-
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element
|
|
93306
|
-
|
|
93307
|
-
|
|
93308
|
-
|
|
93309
|
-
var _child_textContent;
|
|
93310
|
-
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
93311
|
-
var childElement = child;
|
|
93312
|
-
if (!includeIframes && childElement.tagName === 'IFRAME') {
|
|
93313
|
-
return height;
|
|
93314
|
-
}
|
|
93315
|
-
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93316
|
-
}
|
|
93317
|
-
if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
|
|
93318
|
-
var range = element.ownerDocument.createRange();
|
|
93319
|
-
range.selectNodeContents(child);
|
|
93320
|
-
var rects = Array.from(range.getClientRects());
|
|
93321
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
93322
|
-
range.detach();
|
|
93323
|
-
return rects.reduce(function(textHeight, rect) {
|
|
93324
|
-
return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
|
|
93325
|
-
}, height);
|
|
93326
|
-
}
|
|
93327
|
-
return height;
|
|
92649
|
+
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
|
|
92650
|
+
return Array.from(element.children).reduce(function(height, child) {
|
|
92651
|
+
var childElement = child;
|
|
92652
|
+
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
93328
92653
|
}, 0);
|
|
93329
92654
|
};
|
|
93330
92655
|
_proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
|
|
@@ -93343,48 +92668,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93343
92668
|
var item = this.options.getItems().find(function(candidate) {
|
|
93344
92669
|
return candidate.id === id;
|
|
93345
92670
|
});
|
|
93346
|
-
if (!isCardItem(item) ||
|
|
92671
|
+
if (!isCardItem(item) || item.property.autoHeight !== true) {
|
|
93347
92672
|
return;
|
|
93348
92673
|
}
|
|
93349
|
-
if (!Number.isFinite(height) || height <= 0) {
|
|
92674
|
+
if (!Number.isFinite(height) || height <= 0 || Math.abs(height - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93350
92675
|
return;
|
|
93351
92676
|
}
|
|
93352
|
-
|
|
93353
|
-
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93354
|
-
return;
|
|
93355
|
-
}
|
|
93356
|
-
this.options.setCardItemHeight(id, nextHeight);
|
|
93357
|
-
};
|
|
93358
|
-
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
93359
|
-
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
93360
|
-
return contentHeight;
|
|
93361
|
-
}
|
|
93362
|
-
var scaleOverlay = this.state.contentScaleElements.get(item.id);
|
|
93363
|
-
var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
|
|
93364
|
-
if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
|
|
93365
|
-
return contentHeight;
|
|
93366
|
-
}
|
|
93367
|
-
return contentHeight / displayedHeight * item.property.height;
|
|
93368
|
-
};
|
|
93369
|
-
_proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
|
|
93370
|
-
var _this_options_resolveCardTypeConfig;
|
|
93371
|
-
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
|
|
93372
|
-
};
|
|
93373
|
-
_proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
|
|
93374
|
-
var _this_options_resolveCardTypeConfig;
|
|
93375
|
-
if (!isCardItem(item)) {
|
|
93376
|
-
return true;
|
|
93377
|
-
}
|
|
93378
|
-
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
92677
|
+
this.options.setCardItemHeight(id, Math.ceil(height));
|
|
93379
92678
|
};
|
|
93380
|
-
_create_class(HTMLOverlayManager, [
|
|
93381
|
-
{
|
|
93382
|
-
key: "layerElement",
|
|
93383
|
-
get: function get() {
|
|
93384
|
-
return this.state.layer;
|
|
93385
|
-
}
|
|
93386
|
-
}
|
|
93387
|
-
]);
|
|
93388
92679
|
return HTMLOverlayManager;
|
|
93389
92680
|
}();
|
|
93390
92681
|
function waitForCardCaptureReady(root) {
|
|
@@ -93426,17 +92717,6 @@ function waitForCardCaptureReady(root) {
|
|
|
93426
92717
|
});
|
|
93427
92718
|
})();
|
|
93428
92719
|
}
|
|
93429
|
-
function formatCssColor(color, alpha) {
|
|
93430
|
-
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93431
|
-
var red = normalizedColor >> 16 & 0xFF;
|
|
93432
|
-
var green = normalizedColor >> 8 & 0xFF;
|
|
93433
|
-
var blue = normalizedColor & 0xFF;
|
|
93434
|
-
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93435
|
-
}
|
|
93436
|
-
function formatCssNumber(value) {
|
|
93437
|
-
var normalized = Number.isFinite(value) ? value : 0;
|
|
93438
|
-
return Number(normalized.toFixed(6)).toString();
|
|
93439
|
-
}
|
|
93440
92720
|
function nextAnimationFrame() {
|
|
93441
92721
|
return new Promise(function(resolve) {
|
|
93442
92722
|
requestAnimationFrame(function() {
|
|
@@ -93855,9 +93135,6 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93855
93135
|
});
|
|
93856
93136
|
return replacement;
|
|
93857
93137
|
}
|
|
93858
|
-
function isMouseEventInsideRect(event, rect) {
|
|
93859
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
93860
|
-
}
|
|
93861
93138
|
function createFlattenedIframeContent(iframe) {
|
|
93862
93139
|
var doc = iframe.contentDocument;
|
|
93863
93140
|
if (!doc) {
|
|
@@ -93897,19 +93174,6 @@ function withTimeout(promise, timeout) {
|
|
|
93897
93174
|
});
|
|
93898
93175
|
}
|
|
93899
93176
|
|
|
93900
|
-
function orderSDKCanvasLayers(param) {
|
|
93901
|
-
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
93902
|
-
[
|
|
93903
|
-
playerContainer,
|
|
93904
|
-
htmlOverlayLayer,
|
|
93905
|
-
gestureCanvas
|
|
93906
|
-
].forEach(function(layer) {
|
|
93907
|
-
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
93908
|
-
container.appendChild(layer);
|
|
93909
|
-
}
|
|
93910
|
-
});
|
|
93911
|
-
}
|
|
93912
|
-
|
|
93913
93177
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93914
93178
|
var SDK = /*#__PURE__*/ function() {
|
|
93915
93179
|
function SDK(container, mode) {
|
|
@@ -94015,45 +93279,9 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94015
93279
|
propertyName: 'height',
|
|
94016
93280
|
propertyValue: height
|
|
94017
93281
|
});
|
|
94018
|
-
},
|
|
94019
|
-
getSelectedItemIds: function getSelectedItemIds() {
|
|
94020
|
-
var _ref;
|
|
94021
|
-
var _this__pageData;
|
|
94022
|
-
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
94023
|
-
},
|
|
94024
|
-
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
94025
|
-
var _this__pageData;
|
|
94026
|
-
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
94027
|
-
},
|
|
94028
|
-
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
94029
|
-
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;
|
|
94030
|
-
return {
|
|
94031
|
-
color: wireframeColor,
|
|
94032
|
-
alpha: wireframeAlpha,
|
|
94033
|
-
width: wireframeWidth
|
|
94034
|
-
};
|
|
94035
|
-
},
|
|
94036
|
-
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
94037
|
-
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
94038
|
-
return {
|
|
94039
|
-
color: preSelectedColor,
|
|
94040
|
-
alpha: 1,
|
|
94041
|
-
width: preSelectedWidth
|
|
94042
|
-
};
|
|
94043
|
-
},
|
|
94044
|
-
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
94045
|
-
var _this__gestureHandler;
|
|
94046
|
-
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
94047
|
-
},
|
|
94048
|
-
resolveCardHTML: function resolveCardHTML(item) {
|
|
94049
|
-
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
94050
|
-
},
|
|
94051
|
-
resolveCardTypeConfig: function resolveCardTypeConfig(item) {
|
|
94052
|
-
return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
|
|
94053
93282
|
}
|
|
94054
93283
|
});
|
|
94055
93284
|
this._htmlOverlayManager.attach();
|
|
94056
|
-
this.syncCanvasLayerOrder();
|
|
94057
93285
|
}
|
|
94058
93286
|
var _proto = SDK.prototype;
|
|
94059
93287
|
_proto.dispose = function dispose() {
|
|
@@ -94149,7 +93377,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94149
93377
|
this.initPlayer(SDK.config.mode);
|
|
94150
93378
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
94151
93379
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94152
|
-
this.syncCanvasLayerOrder();
|
|
94153
93380
|
return [
|
|
94154
93381
|
4,
|
|
94155
93382
|
this.runByPageData(this.pageData)
|
|
@@ -94199,16 +93426,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94199
93426
|
env: 'editor'
|
|
94200
93427
|
});
|
|
94201
93428
|
this.player.resize();
|
|
94202
|
-
this.syncCanvasLayerOrder();
|
|
94203
|
-
};
|
|
94204
|
-
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94205
|
-
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94206
|
-
orderSDKCanvasLayers({
|
|
94207
|
-
container: this._container,
|
|
94208
|
-
playerContainer: this._playerContainer,
|
|
94209
|
-
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94210
|
-
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94211
|
-
});
|
|
94212
93429
|
};
|
|
94213
93430
|
_proto.getInitParam = function getInitParam(param) {
|
|
94214
93431
|
return _async_to_generator(function() {
|
|
@@ -95303,7 +94520,8 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95303
94520
|
* @param ignoreClamp 是否忽视约束
|
|
95304
94521
|
*/ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
|
|
95305
94522
|
assertExist$1(this._pageData);
|
|
95306
|
-
this.
|
|
94523
|
+
this._pageData.property.zoom = zoom;
|
|
94524
|
+
this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
|
|
95307
94525
|
this._gestureHandler.render();
|
|
95308
94526
|
};
|
|
95309
94527
|
/**
|
|
@@ -96199,44 +95417,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96199
95417
|
});
|
|
96200
95418
|
};
|
|
96201
95419
|
/**
|
|
96202
|
-
* @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
|
|
96203
|
-
* @param item 卡片元素
|
|
96204
|
-
* @returns HTML 渲染配置
|
|
96205
|
-
*/ _proto.resolveCardHTML = function resolveCardHTML(item) {
|
|
96206
|
-
var _cardTypeConfig_html;
|
|
96207
|
-
var cardTypeConfig = this.resolveCardTypeConfig(item);
|
|
96208
|
-
return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
|
|
96209
|
-
};
|
|
96210
|
-
/**
|
|
96211
|
-
* @description 按 cardType 从注册表解析卡片类型配置。
|
|
96212
|
-
* @param item 卡片元素
|
|
96213
|
-
* @returns 卡片类型配置
|
|
96214
|
-
*/ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
|
|
96215
|
-
return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
96216
|
-
return t.type === item.cardType;
|
|
96217
|
-
});
|
|
96218
|
-
};
|
|
96219
|
-
/**
|
|
96220
|
-
* @description 重新解析并挂载指定卡片的 HTML 内容。
|
|
96221
|
-
* @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
|
|
96222
|
-
* @param id 卡片元素 ID
|
|
96223
|
-
* @returns 是否成功触发刷新
|
|
96224
|
-
*/ _proto.refreshCardHTML = function refreshCardHTML(id) {
|
|
96225
|
-
var _this__htmlOverlayManager, _this__htmlOverlayManager1;
|
|
96226
|
-
var item = this.getSDKItem(id);
|
|
96227
|
-
if (!isCardItem(item)) {
|
|
96228
|
-
console.warn('CardItem "' + id + '" not found.');
|
|
96229
|
-
return false;
|
|
96230
|
-
}
|
|
96231
|
-
if (!this.resolveCardHTML(item)) {
|
|
96232
|
-
console.warn('CardItem "' + id + '" has no registered HTML renderer.');
|
|
96233
|
-
return false;
|
|
96234
|
-
}
|
|
96235
|
-
(_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
|
|
96236
|
-
(_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
|
|
96237
|
-
return true;
|
|
96238
|
-
};
|
|
96239
|
-
/**
|
|
96240
95420
|
* @description 创建卡片元素
|
|
96241
95421
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
96242
95422
|
* @param createInfo 卡片创建信息
|
|
@@ -96523,5 +95703,166 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96523
95703
|
}();
|
|
96524
95704
|
SDK.config = BaseConfig;
|
|
96525
95705
|
|
|
95706
|
+
/**
|
|
95707
|
+
* @description 卡片元素 SDKItem 类
|
|
95708
|
+
* @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
|
|
95709
|
+
* @description 支持设置卡片类型(cardType)
|
|
95710
|
+
*/ var CardItem = /*#__PURE__*/ function(BaseItem) {
|
|
95711
|
+
_inherits(CardItem, BaseItem);
|
|
95712
|
+
function CardItem(options) {
|
|
95713
|
+
var _this;
|
|
95714
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
|
|
95715
|
+
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5, _SDK_config_itemConfig_cardConfig_cardTypes_, _options_property6, _options_property7;
|
|
95716
|
+
_this = BaseItem.call(this, options) || this, /**
|
|
95717
|
+
* @description 元素类型
|
|
95718
|
+
*/ _this.type = SDKItemType.CARD;
|
|
95719
|
+
// 初始化属性(包含 cardType)
|
|
95720
|
+
_this.property = {
|
|
95721
|
+
position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
|
|
95722
|
+
0,
|
|
95723
|
+
0
|
|
95724
|
+
],
|
|
95725
|
+
rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
|
|
95726
|
+
0,
|
|
95727
|
+
0,
|
|
95728
|
+
0
|
|
95729
|
+
],
|
|
95730
|
+
width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
|
|
95731
|
+
height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
|
|
95732
|
+
scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
|
|
95733
|
+
1,
|
|
95734
|
+
1
|
|
95735
|
+
],
|
|
95736
|
+
cardType: (_ref5 = (_ref6 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref6 : (_SDK_config_itemConfig_cardConfig_cardTypes_ = SDK.config.itemConfig.cardConfig.cardTypes[0]) == null ? void 0 : _SDK_config_itemConfig_cardConfig_cardTypes_.type) != null ? _ref5 : '',
|
|
95737
|
+
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
95738
|
+
html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
|
|
95739
|
+
};
|
|
95740
|
+
return _this;
|
|
95741
|
+
}
|
|
95742
|
+
var _proto = CardItem.prototype;
|
|
95743
|
+
// ==================== 实现抽象方法 ====================
|
|
95744
|
+
/**
|
|
95745
|
+
* @description 转换为 CardCreateInfo
|
|
95746
|
+
* @param withParent 是否包含父节点ID
|
|
95747
|
+
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
95748
|
+
var extension = this.getAllExtension();
|
|
95749
|
+
var property = deepClone(this.property);
|
|
95750
|
+
property.html = this.html;
|
|
95751
|
+
return {
|
|
95752
|
+
type: SDKItemType.CARD,
|
|
95753
|
+
id: this.id,
|
|
95754
|
+
name: this.name,
|
|
95755
|
+
parentId: withParent ? this.parentId : undefined,
|
|
95756
|
+
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
95757
|
+
property: property
|
|
95758
|
+
};
|
|
95759
|
+
};
|
|
95760
|
+
/**
|
|
95761
|
+
* @description 克隆 SDKItem
|
|
95762
|
+
*/ _proto.clone = function clone() {
|
|
95763
|
+
var property = deepClone(this.property);
|
|
95764
|
+
property.html = this.html;
|
|
95765
|
+
return new CardItem({
|
|
95766
|
+
id: generateGUID(),
|
|
95767
|
+
name: this.name,
|
|
95768
|
+
parentId: this.parentId,
|
|
95769
|
+
duration: this.duration,
|
|
95770
|
+
delay: this.delay,
|
|
95771
|
+
endBehavior: this.endBehavior,
|
|
95772
|
+
isLocked: this.isLocked,
|
|
95773
|
+
isCoreEditable: this.isCoreEditable,
|
|
95774
|
+
property: property,
|
|
95775
|
+
extension: this.getAllExtension()
|
|
95776
|
+
});
|
|
95777
|
+
};
|
|
95778
|
+
_create_class(CardItem, [
|
|
95779
|
+
{
|
|
95780
|
+
key: "cardType",
|
|
95781
|
+
get: // ==================== cardType 访问器 ====================
|
|
95782
|
+
/**
|
|
95783
|
+
* @description 卡片类型
|
|
95784
|
+
*/ function get() {
|
|
95785
|
+
return this.property.cardType;
|
|
95786
|
+
},
|
|
95787
|
+
set: function set(value) {
|
|
95788
|
+
this.property.cardType = value;
|
|
95789
|
+
}
|
|
95790
|
+
},
|
|
95791
|
+
{
|
|
95792
|
+
key: "html",
|
|
95793
|
+
get: /**
|
|
95794
|
+
* @description HTML 覆盖层配置
|
|
95795
|
+
*/ function get() {
|
|
95796
|
+
return this.property.html;
|
|
95797
|
+
},
|
|
95798
|
+
set: function set(value) {
|
|
95799
|
+
this.property.html = value;
|
|
95800
|
+
}
|
|
95801
|
+
},
|
|
95802
|
+
{
|
|
95803
|
+
key: "position",
|
|
95804
|
+
get: // ==================== 便捷访问器 ====================
|
|
95805
|
+
/**
|
|
95806
|
+
* @description 位置
|
|
95807
|
+
*/ function get() {
|
|
95808
|
+
return this.property.position;
|
|
95809
|
+
},
|
|
95810
|
+
set: function set(value) {
|
|
95811
|
+
this.property.position = value;
|
|
95812
|
+
}
|
|
95813
|
+
},
|
|
95814
|
+
{
|
|
95815
|
+
key: "width",
|
|
95816
|
+
get: /**
|
|
95817
|
+
* @description 宽度
|
|
95818
|
+
*/ function get() {
|
|
95819
|
+
return this.property.width;
|
|
95820
|
+
},
|
|
95821
|
+
set: function set(value) {
|
|
95822
|
+
this.property.width = value;
|
|
95823
|
+
}
|
|
95824
|
+
},
|
|
95825
|
+
{
|
|
95826
|
+
key: "height",
|
|
95827
|
+
get: /**
|
|
95828
|
+
* @description 高度
|
|
95829
|
+
*/ function get() {
|
|
95830
|
+
return this.property.height;
|
|
95831
|
+
},
|
|
95832
|
+
set: function set(value) {
|
|
95833
|
+
this.property.height = value;
|
|
95834
|
+
}
|
|
95835
|
+
},
|
|
95836
|
+
{
|
|
95837
|
+
key: "rotation",
|
|
95838
|
+
get: /**
|
|
95839
|
+
* @description 旋转(二维旋转角度)
|
|
95840
|
+
*/ function get() {
|
|
95841
|
+
return this.property.rotation[2];
|
|
95842
|
+
},
|
|
95843
|
+
set: function set(value) {
|
|
95844
|
+
this.property.rotation[2] = value;
|
|
95845
|
+
}
|
|
95846
|
+
},
|
|
95847
|
+
{
|
|
95848
|
+
key: "fullRotation",
|
|
95849
|
+
get: /**
|
|
95850
|
+
* @description 完整旋转(包含 x, y, z)
|
|
95851
|
+
*/ function get() {
|
|
95852
|
+
return this.property.rotation;
|
|
95853
|
+
},
|
|
95854
|
+
set: function set(value) {
|
|
95855
|
+
this.property.rotation = value;
|
|
95856
|
+
}
|
|
95857
|
+
}
|
|
95858
|
+
]);
|
|
95859
|
+
return CardItem;
|
|
95860
|
+
}(BaseItem);
|
|
95861
|
+
/**
|
|
95862
|
+
* @description 类型守卫:检查是否是 CardItem
|
|
95863
|
+
*/ function isCardItem(obj) {
|
|
95864
|
+
return _instanceof(obj, CardItem);
|
|
95865
|
+
}
|
|
95866
|
+
|
|
96526
95867
|
export { BackgroundManager, BaseItem, Box2, CardItem, DefaultVFXItems, EffectsItem, FrameItem, GeneratorItem, GroupItem, InteractionUtils, ItemOrderAction, PageDataUtils, SDK, SDKItemType, SafeConstraint, SpriteItem, TextItem, VFXItemFactory, Vector2, VideoItem, addCompositionItemByComposition, addItemInfoToScene, adjustOtherElementsLayoutInfo, arrAdd, assertExist, asserts, autoLayout, calculateAutoLayoutIndicatorLine, calculateAutoLayoutPositionByMouse, calculateDisplacement, calculateInsertPositionFromLayout, calculateLayoutDisplacements, clearItemParentInfo, createCompositionItemJSON, createFrameCompositionScene, createNullItemJSON, createSpriteItemJSON, createTextItemJSON, createVideoGeneratorItemJSON, createVideoItemJSON, deepClone, deepEquals, deleteCompositionFromScene, deleteCompositionItemFromScene, deleteItemInfoFromScene, downloadBlob, extractSubCompositionToScene, fixStandardJSON, getBasicScene, getColorByNormalizeColor, getCompositionDataByRefCompositionItemId, getCompositionIdByRefCompositionItemId, getNormalizeColorByColor, getTextureUrlById, getTransformRatioByViewAndCamera, getUniqueName, globalAutoLayout, isBaseItem, isCardItem, isEffectsItem, isEqual, isFrameItem, isGeneratorItem, isGroupItem, isObj, isSpriteItem, isTextItem, isVideoItem, loadScriptAsync, logger, moveItemBetweenCompositions, removeItemInfoFromScene, resetSubCompositionItemId, setItemJSONParentId, setJSONItemName, updateItemLayoutInfo };
|
|
96527
95868
|
//# sourceMappingURL=index.js.map
|