@vvfx/sdk 0.2.2-beta.1 → 0.2.2-beta.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/index.js +369 -305
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +369 -305
- package/dist/index.mjs.map +1 -1
- package/dist/src/card-type-registry.test.d.ts +1 -0
- package/dist/src/config.d.ts +8 -1
- package/dist/src/html-overlay/auto-height-runtime.d.ts +5 -0
- package/dist/src/html-overlay/auto-height-runtime.test.d.ts +1 -0
- package/dist/src/html-overlay/manager.d.ts +5 -0
- package/dist/src/html-overlay/manager.test.d.ts +1 -0
- package/dist/src/html-overlay/overlay-transform.d.ts +3 -1
- package/dist/src/html-overlay/overlay-transform.test.d.ts +1 -0
- package/dist/src/sdk-item/card-item.d.ts +1 -6
- package/dist/src/sdk.d.ts +8 -2
- package/dist/src/types.d.ts +8 -8
- package/package.json +1 -1
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-beta.
|
|
6
|
+
* Version: v0.2.2-beta.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -25153,6 +25153,152 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
|
|
|
25153
25153
|
return _instanceof(obj, FrameItem);
|
|
25154
25154
|
}
|
|
25155
25155
|
|
|
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, _options_property6, _options_property7;
|
|
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
|
+
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
25188
|
+
autoScale: (_options_property7 = options.property) == null ? void 0 : _options_property7.autoScale
|
|
25189
|
+
};
|
|
25190
|
+
return _this;
|
|
25191
|
+
}
|
|
25192
|
+
var _proto = CardItem.prototype;
|
|
25193
|
+
// ==================== 实现抽象方法 ====================
|
|
25194
|
+
/**
|
|
25195
|
+
* @description 转换为 CardCreateInfo
|
|
25196
|
+
* @param withParent 是否包含父节点ID
|
|
25197
|
+
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
25198
|
+
var extension = this.getAllExtension();
|
|
25199
|
+
return {
|
|
25200
|
+
type: SDKItemType.CARD,
|
|
25201
|
+
id: this.id,
|
|
25202
|
+
name: this.name,
|
|
25203
|
+
parentId: withParent ? this.parentId : undefined,
|
|
25204
|
+
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
25205
|
+
property: deepClone(this.property)
|
|
25206
|
+
};
|
|
25207
|
+
};
|
|
25208
|
+
/**
|
|
25209
|
+
* @description 克隆 SDKItem
|
|
25210
|
+
*/ _proto.clone = function clone() {
|
|
25211
|
+
return new CardItem({
|
|
25212
|
+
id: generateGUID(),
|
|
25213
|
+
name: this.name,
|
|
25214
|
+
parentId: this.parentId,
|
|
25215
|
+
duration: this.duration,
|
|
25216
|
+
delay: this.delay,
|
|
25217
|
+
endBehavior: this.endBehavior,
|
|
25218
|
+
isLocked: this.isLocked,
|
|
25219
|
+
isCoreEditable: this.isCoreEditable,
|
|
25220
|
+
property: deepClone(this.property),
|
|
25221
|
+
extension: this.getAllExtension()
|
|
25222
|
+
});
|
|
25223
|
+
};
|
|
25224
|
+
_create_class(CardItem, [
|
|
25225
|
+
{
|
|
25226
|
+
key: "cardType",
|
|
25227
|
+
get: // ==================== cardType 访问器 ====================
|
|
25228
|
+
/**
|
|
25229
|
+
* @description 卡片类型
|
|
25230
|
+
*/ function get() {
|
|
25231
|
+
return this.property.cardType;
|
|
25232
|
+
},
|
|
25233
|
+
set: function set(value) {
|
|
25234
|
+
this.property.cardType = value;
|
|
25235
|
+
}
|
|
25236
|
+
},
|
|
25237
|
+
{
|
|
25238
|
+
key: "position",
|
|
25239
|
+
get: // ==================== 便捷访问器 ====================
|
|
25240
|
+
/**
|
|
25241
|
+
* @description 位置
|
|
25242
|
+
*/ function get() {
|
|
25243
|
+
return this.property.position;
|
|
25244
|
+
},
|
|
25245
|
+
set: function set(value) {
|
|
25246
|
+
this.property.position = value;
|
|
25247
|
+
}
|
|
25248
|
+
},
|
|
25249
|
+
{
|
|
25250
|
+
key: "width",
|
|
25251
|
+
get: /**
|
|
25252
|
+
* @description 宽度
|
|
25253
|
+
*/ function get() {
|
|
25254
|
+
return this.property.width;
|
|
25255
|
+
},
|
|
25256
|
+
set: function set(value) {
|
|
25257
|
+
this.property.width = value;
|
|
25258
|
+
}
|
|
25259
|
+
},
|
|
25260
|
+
{
|
|
25261
|
+
key: "height",
|
|
25262
|
+
get: /**
|
|
25263
|
+
* @description 高度
|
|
25264
|
+
*/ function get() {
|
|
25265
|
+
return this.property.height;
|
|
25266
|
+
},
|
|
25267
|
+
set: function set(value) {
|
|
25268
|
+
this.property.height = value;
|
|
25269
|
+
}
|
|
25270
|
+
},
|
|
25271
|
+
{
|
|
25272
|
+
key: "rotation",
|
|
25273
|
+
get: /**
|
|
25274
|
+
* @description 旋转(二维旋转角度)
|
|
25275
|
+
*/ function get() {
|
|
25276
|
+
return this.property.rotation[2];
|
|
25277
|
+
},
|
|
25278
|
+
set: function set(value) {
|
|
25279
|
+
this.property.rotation[2] = value;
|
|
25280
|
+
}
|
|
25281
|
+
},
|
|
25282
|
+
{
|
|
25283
|
+
key: "fullRotation",
|
|
25284
|
+
get: /**
|
|
25285
|
+
* @description 完整旋转(包含 x, y, z)
|
|
25286
|
+
*/ function get() {
|
|
25287
|
+
return this.property.rotation;
|
|
25288
|
+
},
|
|
25289
|
+
set: function set(value) {
|
|
25290
|
+
this.property.rotation = value;
|
|
25291
|
+
}
|
|
25292
|
+
}
|
|
25293
|
+
]);
|
|
25294
|
+
return CardItem;
|
|
25295
|
+
}(BaseItem);
|
|
25296
|
+
/**
|
|
25297
|
+
* @description 类型守卫:检查是否是 CardItem
|
|
25298
|
+
*/ function isCardItem(obj) {
|
|
25299
|
+
return _instanceof(obj, CardItem);
|
|
25300
|
+
}
|
|
25301
|
+
|
|
25156
25302
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
25157
25303
|
try {
|
|
25158
25304
|
var info = gen[key](arg);
|
|
@@ -59630,12 +59776,6 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
|
|
|
59630
59776
|
/**
|
|
59631
59777
|
* @description SDKItem position 属性的数字精度(保留小数位数)
|
|
59632
59778
|
*/ var POSITION_PRECISION = 4;
|
|
59633
|
-
function isCardHTMLContentValue(value) {
|
|
59634
|
-
return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
|
|
59635
|
-
}
|
|
59636
|
-
function isCardHTMLValue(value) {
|
|
59637
|
-
return isCardHTMLContentValue(value == null ? void 0 : value.content);
|
|
59638
|
-
}
|
|
59639
59779
|
var PageDataUtils = /*#__PURE__*/ function() {
|
|
59640
59780
|
function PageDataUtils(player, container, emitter, sdk) {
|
|
59641
59781
|
this.player = player;
|
|
@@ -60453,11 +60593,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60453
60593
|
property: property
|
|
60454
60594
|
}));
|
|
60455
60595
|
} else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
|
|
60456
|
-
var cardType = existingSDKItem.cardType
|
|
60596
|
+
var cardType = existingSDKItem.cardType;
|
|
60457
60597
|
sdkItem = new CardItem(_extends({}, baseOptions, {
|
|
60458
60598
|
property: _extends({}, property, {
|
|
60459
|
-
cardType: cardType
|
|
60460
|
-
html: html
|
|
60599
|
+
cardType: cardType
|
|
60461
60600
|
})
|
|
60462
60601
|
}));
|
|
60463
60602
|
} else {
|
|
@@ -61041,40 +61180,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61041
61180
|
3,
|
|
61042
61181
|
31
|
|
61043
61182
|
];
|
|
61044
|
-
case 'html':
|
|
61045
|
-
return [
|
|
61046
|
-
3,
|
|
61047
|
-
32
|
|
61048
|
-
];
|
|
61049
61183
|
case 'position':
|
|
61050
61184
|
return [
|
|
61051
61185
|
3,
|
|
61052
|
-
|
|
61186
|
+
32
|
|
61053
61187
|
];
|
|
61054
61188
|
case 'rotation':
|
|
61055
61189
|
return [
|
|
61056
61190
|
3,
|
|
61057
|
-
|
|
61191
|
+
33
|
|
61058
61192
|
];
|
|
61059
61193
|
case 'scale':
|
|
61060
61194
|
return [
|
|
61061
61195
|
3,
|
|
61062
|
-
|
|
61196
|
+
34
|
|
61063
61197
|
];
|
|
61064
61198
|
case 'layoutMode':
|
|
61065
61199
|
return [
|
|
61066
61200
|
3,
|
|
61067
|
-
|
|
61201
|
+
35
|
|
61068
61202
|
];
|
|
61069
61203
|
case 'visible':
|
|
61070
61204
|
return [
|
|
61071
61205
|
3,
|
|
61072
|
-
|
|
61206
|
+
36
|
|
61073
61207
|
];
|
|
61074
61208
|
}
|
|
61075
61209
|
return [
|
|
61076
61210
|
3,
|
|
61077
|
-
|
|
61211
|
+
37
|
|
61078
61212
|
];
|
|
61079
61213
|
case 1:
|
|
61080
61214
|
{
|
|
@@ -61087,7 +61221,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61087
61221
|
}
|
|
61088
61222
|
return [
|
|
61089
61223
|
3,
|
|
61090
|
-
|
|
61224
|
+
38
|
|
61091
61225
|
];
|
|
61092
61226
|
}
|
|
61093
61227
|
case 2:
|
|
@@ -61098,7 +61232,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61098
61232
|
}
|
|
61099
61233
|
return [
|
|
61100
61234
|
3,
|
|
61101
|
-
|
|
61235
|
+
38
|
|
61102
61236
|
];
|
|
61103
61237
|
}
|
|
61104
61238
|
case 3:
|
|
@@ -61130,7 +61264,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61130
61264
|
case 5:
|
|
61131
61265
|
return [
|
|
61132
61266
|
3,
|
|
61133
|
-
|
|
61267
|
+
38
|
|
61134
61268
|
];
|
|
61135
61269
|
case 6:
|
|
61136
61270
|
{
|
|
@@ -61147,7 +61281,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61147
61281
|
}
|
|
61148
61282
|
return [
|
|
61149
61283
|
3,
|
|
61150
|
-
|
|
61284
|
+
38
|
|
61151
61285
|
];
|
|
61152
61286
|
}
|
|
61153
61287
|
case 7:
|
|
@@ -61161,7 +61295,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61161
61295
|
}
|
|
61162
61296
|
return [
|
|
61163
61297
|
3,
|
|
61164
|
-
|
|
61298
|
+
38
|
|
61165
61299
|
];
|
|
61166
61300
|
}
|
|
61167
61301
|
case 8:
|
|
@@ -61174,7 +61308,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61174
61308
|
}
|
|
61175
61309
|
return [
|
|
61176
61310
|
3,
|
|
61177
|
-
|
|
61311
|
+
38
|
|
61178
61312
|
];
|
|
61179
61313
|
}
|
|
61180
61314
|
case 9:
|
|
@@ -61188,7 +61322,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61188
61322
|
}
|
|
61189
61323
|
return [
|
|
61190
61324
|
3,
|
|
61191
|
-
|
|
61325
|
+
38
|
|
61192
61326
|
];
|
|
61193
61327
|
}
|
|
61194
61328
|
case 10:
|
|
@@ -61201,7 +61335,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61201
61335
|
}
|
|
61202
61336
|
return [
|
|
61203
61337
|
3,
|
|
61204
|
-
|
|
61338
|
+
38
|
|
61205
61339
|
];
|
|
61206
61340
|
}
|
|
61207
61341
|
case 11:
|
|
@@ -61214,7 +61348,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61214
61348
|
}
|
|
61215
61349
|
return [
|
|
61216
61350
|
3,
|
|
61217
|
-
|
|
61351
|
+
38
|
|
61218
61352
|
];
|
|
61219
61353
|
}
|
|
61220
61354
|
case 12:
|
|
@@ -61234,7 +61368,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61234
61368
|
}
|
|
61235
61369
|
return [
|
|
61236
61370
|
3,
|
|
61237
|
-
|
|
61371
|
+
38
|
|
61238
61372
|
];
|
|
61239
61373
|
}
|
|
61240
61374
|
case 13:
|
|
@@ -61276,7 +61410,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61276
61410
|
}
|
|
61277
61411
|
return [
|
|
61278
61412
|
3,
|
|
61279
|
-
|
|
61413
|
+
38
|
|
61280
61414
|
];
|
|
61281
61415
|
}
|
|
61282
61416
|
case 14:
|
|
@@ -61311,7 +61445,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61311
61445
|
}
|
|
61312
61446
|
return [
|
|
61313
61447
|
3,
|
|
61314
|
-
|
|
61448
|
+
38
|
|
61315
61449
|
];
|
|
61316
61450
|
}
|
|
61317
61451
|
case 15:
|
|
@@ -61325,7 +61459,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61325
61459
|
}
|
|
61326
61460
|
return [
|
|
61327
61461
|
3,
|
|
61328
|
-
|
|
61462
|
+
38
|
|
61329
61463
|
];
|
|
61330
61464
|
}
|
|
61331
61465
|
case 16:
|
|
@@ -61357,7 +61491,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61357
61491
|
case 20:
|
|
61358
61492
|
return [
|
|
61359
61493
|
3,
|
|
61360
|
-
|
|
61494
|
+
38
|
|
61361
61495
|
];
|
|
61362
61496
|
case 21:
|
|
61363
61497
|
if (!(typeof propertyValue === 'string' && playerItem.type === spec.ItemType.video)) return [
|
|
@@ -61388,7 +61522,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61388
61522
|
case 25:
|
|
61389
61523
|
return [
|
|
61390
61524
|
3,
|
|
61391
|
-
|
|
61525
|
+
38
|
|
61392
61526
|
];
|
|
61393
61527
|
case 26:
|
|
61394
61528
|
if (!(playerItem.type === spec.ItemType.null)) return [
|
|
@@ -61433,7 +61567,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61433
61567
|
case 28:
|
|
61434
61568
|
return [
|
|
61435
61569
|
3,
|
|
61436
|
-
|
|
61570
|
+
38
|
|
61437
61571
|
];
|
|
61438
61572
|
case 29:
|
|
61439
61573
|
{
|
|
@@ -61445,7 +61579,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61445
61579
|
}
|
|
61446
61580
|
return [
|
|
61447
61581
|
3,
|
|
61448
|
-
|
|
61582
|
+
38
|
|
61449
61583
|
];
|
|
61450
61584
|
}
|
|
61451
61585
|
case 30:
|
|
@@ -61458,7 +61592,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61458
61592
|
}
|
|
61459
61593
|
return [
|
|
61460
61594
|
3,
|
|
61461
|
-
|
|
61595
|
+
38
|
|
61462
61596
|
];
|
|
61463
61597
|
}
|
|
61464
61598
|
case 31:
|
|
@@ -61471,20 +61605,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61471
61605
|
}
|
|
61472
61606
|
return [
|
|
61473
61607
|
3,
|
|
61474
|
-
|
|
61608
|
+
38
|
|
61475
61609
|
];
|
|
61476
61610
|
}
|
|
61477
61611
|
case 32:
|
|
61478
|
-
{
|
|
61479
|
-
if (isCardItem(targetItem)) {
|
|
61480
|
-
targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
|
|
61481
|
-
}
|
|
61482
|
-
return [
|
|
61483
|
-
3,
|
|
61484
|
-
39
|
|
61485
|
-
];
|
|
61486
|
-
}
|
|
61487
|
-
case 33:
|
|
61488
61612
|
{
|
|
61489
61613
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61490
61614
|
pixelTranslation = propertyValue.map(function(v, i) {
|
|
@@ -61497,10 +61621,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61497
61621
|
}
|
|
61498
61622
|
return [
|
|
61499
61623
|
3,
|
|
61500
|
-
|
|
61624
|
+
38
|
|
61501
61625
|
];
|
|
61502
61626
|
}
|
|
61503
|
-
case
|
|
61627
|
+
case 33:
|
|
61504
61628
|
{
|
|
61505
61629
|
if (Array.isArray(propertyValue) && propertyValue.length === 3) {
|
|
61506
61630
|
rotation = propertyValue.map(function(v, i) {
|
|
@@ -61511,10 +61635,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61511
61635
|
}
|
|
61512
61636
|
return [
|
|
61513
61637
|
3,
|
|
61514
|
-
|
|
61638
|
+
38
|
|
61515
61639
|
];
|
|
61516
61640
|
}
|
|
61517
|
-
case
|
|
61641
|
+
case 34:
|
|
61518
61642
|
{
|
|
61519
61643
|
if (Array.isArray(propertyValue) && propertyValue.length === 2) {
|
|
61520
61644
|
currentScale = targetItem.property.scale;
|
|
@@ -61528,10 +61652,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61528
61652
|
}
|
|
61529
61653
|
return [
|
|
61530
61654
|
3,
|
|
61531
|
-
|
|
61655
|
+
38
|
|
61532
61656
|
];
|
|
61533
61657
|
}
|
|
61534
|
-
case
|
|
61658
|
+
case 35:
|
|
61535
61659
|
{
|
|
61536
61660
|
if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
|
|
61537
61661
|
frameComponent = playerItem.getComponent(FrameComponent);
|
|
@@ -61541,10 +61665,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61541
61665
|
}
|
|
61542
61666
|
return [
|
|
61543
61667
|
3,
|
|
61544
|
-
|
|
61668
|
+
38
|
|
61545
61669
|
];
|
|
61546
61670
|
}
|
|
61547
|
-
case
|
|
61671
|
+
case 36:
|
|
61548
61672
|
{
|
|
61549
61673
|
if (typeof propertyValue === 'boolean') {
|
|
61550
61674
|
playerItem.setVisible(propertyValue);
|
|
@@ -61557,10 +61681,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61557
61681
|
}
|
|
61558
61682
|
return [
|
|
61559
61683
|
3,
|
|
61560
|
-
|
|
61684
|
+
38
|
|
61561
61685
|
];
|
|
61562
61686
|
}
|
|
61563
|
-
case
|
|
61687
|
+
case 37:
|
|
61564
61688
|
{
|
|
61565
61689
|
console.log('ignore property name ', propertyName);
|
|
61566
61690
|
// 对于未明确处理的属性,尝试直接设置到 property 对象
|
|
@@ -61568,8 +61692,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
61568
61692
|
targetItem.property[propertyName] = propertyValue;
|
|
61569
61693
|
}
|
|
61570
61694
|
}
|
|
61571
|
-
_state.label =
|
|
61572
|
-
case
|
|
61695
|
+
_state.label = 38;
|
|
61696
|
+
case 38:
|
|
61573
61697
|
// 非位置属性需要刷新播放器
|
|
61574
61698
|
// template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
|
|
61575
61699
|
if (![
|
|
@@ -63041,7 +63165,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63041
63165
|
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 ? [
|
|
63042
63166
|
1,
|
|
63043
63167
|
1
|
|
63044
|
-
] : _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,
|
|
63168
|
+
] : _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, autoScale = _cardInfo_property.autoScale, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63045
63169
|
// 校验 cardType 是否已在配置中注册
|
|
63046
63170
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63047
63171
|
return t.type;
|
|
@@ -63092,7 +63216,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63092
63216
|
scale: [].concat(scale),
|
|
63093
63217
|
cardType: cardType,
|
|
63094
63218
|
autoHeight: autoHeight,
|
|
63095
|
-
|
|
63219
|
+
autoScale: autoScale
|
|
63096
63220
|
},
|
|
63097
63221
|
extension: extension
|
|
63098
63222
|
});
|
|
@@ -64474,8 +64598,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
64474
64598
|
scalar.y
|
|
64475
64599
|
],
|
|
64476
64600
|
rotation: [].concat(rotation),
|
|
64477
|
-
position: [].concat(resultPosition)
|
|
64478
|
-
html: sdkItem.html
|
|
64601
|
+
position: [].concat(resultPosition)
|
|
64479
64602
|
},
|
|
64480
64603
|
extension: extension
|
|
64481
64604
|
};
|
|
@@ -65859,35 +65982,56 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
65859
65982
|
};
|
|
65860
65983
|
_proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
|
|
65861
65984
|
return _async_to_generator(function() {
|
|
65862
|
-
var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step,
|
|
65985
|
+
var _loop, _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
|
|
65863
65986
|
return _ts_generator(this, function(_state) {
|
|
65864
65987
|
switch(_state.label){
|
|
65865
65988
|
case 0:
|
|
65866
|
-
|
|
65867
|
-
|
|
65868
|
-
|
|
65869
|
-
|
|
65870
|
-
|
|
65871
|
-
|
|
65872
|
-
|
|
65873
|
-
|
|
65874
|
-
|
|
65875
|
-
|
|
65876
|
-
|
|
65877
|
-
|
|
65878
|
-
|
|
65879
|
-
|
|
65880
|
-
|
|
65881
|
-
|
|
65989
|
+
_loop = function() {
|
|
65990
|
+
var createInfo = _step.value;
|
|
65991
|
+
var _ref = function() {
|
|
65992
|
+
switch(createInfo.type){
|
|
65993
|
+
case SDKItemType.SPRITE:
|
|
65994
|
+
{
|
|
65995
|
+
return {
|
|
65996
|
+
url: createInfo.property.image,
|
|
65997
|
+
type: 'image'
|
|
65998
|
+
};
|
|
65999
|
+
}
|
|
66000
|
+
case SDKItemType.VIDEO:
|
|
66001
|
+
{
|
|
66002
|
+
return {
|
|
66003
|
+
url: createInfo.property.video,
|
|
66004
|
+
type: 'video'
|
|
66005
|
+
};
|
|
66006
|
+
}
|
|
66007
|
+
default:
|
|
66008
|
+
{
|
|
66009
|
+
return {};
|
|
66010
|
+
}
|
|
66011
|
+
}
|
|
66012
|
+
}(), url = _ref.url, type = _ref.type;
|
|
66013
|
+
if (url && type) {
|
|
66014
|
+
var textureId = generateGUID();
|
|
66015
|
+
itemToTextureInfo.set(createInfo.id, {
|
|
65882
66016
|
id: textureId,
|
|
65883
66017
|
url: url,
|
|
65884
|
-
type: type
|
|
66018
|
+
type: type
|
|
65885
66019
|
});
|
|
65886
66020
|
Object.assign(createInfo, {
|
|
65887
66021
|
textureId: textureId
|
|
65888
66022
|
});
|
|
65889
66023
|
}
|
|
65890
|
-
}
|
|
66024
|
+
};
|
|
66025
|
+
_this = this;
|
|
66026
|
+
createInfoWithIds = createInfos.map(function(createInfo) {
|
|
66027
|
+
var _createInfo_id;
|
|
66028
|
+
return Object.assign({}, createInfo, {
|
|
66029
|
+
id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : generateGUID()
|
|
66030
|
+
});
|
|
66031
|
+
});
|
|
66032
|
+
itemToTextureInfo = new Map();
|
|
66033
|
+
// 预处理所有 createInfo,分配 textureId
|
|
66034
|
+
for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
|
|
65891
66035
|
// 并行创建所有 item
|
|
65892
66036
|
toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
|
|
65893
66037
|
return ![
|
|
@@ -83065,38 +83209,7 @@ var BaseConfig = {
|
|
|
83065
83209
|
0.6,
|
|
83066
83210
|
0.12
|
|
83067
83211
|
],
|
|
83068
|
-
cardTypes: [
|
|
83069
|
-
{
|
|
83070
|
-
type: 'character',
|
|
83071
|
-
label: '角色图',
|
|
83072
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83073
|
-
},
|
|
83074
|
-
{
|
|
83075
|
-
type: 'environment',
|
|
83076
|
-
label: '环境图',
|
|
83077
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83078
|
-
},
|
|
83079
|
-
{
|
|
83080
|
-
type: 'storyboard',
|
|
83081
|
-
label: '分镜图',
|
|
83082
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83083
|
-
},
|
|
83084
|
-
{
|
|
83085
|
-
type: 'scene-clip',
|
|
83086
|
-
label: '场景剪辑',
|
|
83087
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83088
|
-
},
|
|
83089
|
-
{
|
|
83090
|
-
type: 'video-compose',
|
|
83091
|
-
label: '视频合成',
|
|
83092
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83093
|
-
},
|
|
83094
|
-
{
|
|
83095
|
-
type: 'video-generate',
|
|
83096
|
-
label: '生成视频',
|
|
83097
|
-
iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
|
|
83098
|
-
}
|
|
83099
|
-
]
|
|
83212
|
+
cardTypes: []
|
|
83100
83213
|
}
|
|
83101
83214
|
}
|
|
83102
83215
|
};
|
|
@@ -91425,11 +91538,18 @@ function isCardHTMLAutoHeightMessage(data, id) {
|
|
|
91425
91538
|
var message = data;
|
|
91426
91539
|
return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
|
|
91427
91540
|
}
|
|
91541
|
+
function requestCardHTMLAutoHeight(iframe, id) {
|
|
91542
|
+
var _iframe_contentWindow;
|
|
91543
|
+
(_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
|
|
91544
|
+
source: 'vvfx-card-html-auto-height-request',
|
|
91545
|
+
id: id
|
|
91546
|
+
}, '*');
|
|
91547
|
+
}
|
|
91428
91548
|
function withCardHTMLAutoHeightBridge(html, id) {
|
|
91429
91549
|
if (!id) {
|
|
91430
91550
|
return html;
|
|
91431
91551
|
}
|
|
91432
|
-
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const
|
|
91552
|
+
var script = "\n<script data-vvfx-card-html-auto-height>\n(() => {\n const id = " + JSON.stringify(id) + ";\n let frame = 0;\n const getNodeHeight = (node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const rect = node.getBoundingClientRect();\n return rect.bottom + window.scrollY;\n }\n if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) {\n const range = document.createRange();\n range.selectNodeContents(node);\n const rects = Array.from(range.getClientRects());\n range.detach();\n return rects.reduce((height, rect) => Math.max(height, rect.bottom + window.scrollY), 0);\n }\n\n return 0;\n };\n const getContentHeight = (element) => {\n if (!element) return 0;\n return Array.from(element.childNodes).reduce((height, child) => {\n return Math.max(height, getNodeHeight(child));\n }, 0);\n };\n const getHeight = () => {\n const body = document.body;\n const root = document.documentElement;\n const contentHeight = getContentHeight(body);\n const scrollHeight = Math.max(root.scrollHeight, body ? body.scrollHeight : 0);\n return Math.ceil(contentHeight > 0 ? contentHeight : scrollHeight);\n };\n const postHeight = () => {\n frame = 0;\n window.parent.postMessage({\n source: 'vvfx-card-html-auto-height',\n id,\n height: getHeight(),\n }, '*');\n };\n const schedule = () => {\n if (frame) return;\n frame = requestAnimationFrame(postHeight);\n };\n window.addEventListener('message', (event) => {\n const message = event.data;\n if (!message || message.source !== 'vvfx-card-html-auto-height-request' || message.id !== id) {\n return;\n }\n\n schedule();\n });\n window.addEventListener('load', schedule);\n window.addEventListener('resize', schedule);\n new ResizeObserver(schedule).observe(document.documentElement);\n if (document.body) {\n new ResizeObserver(schedule).observe(document.body);\n new MutationObserver(schedule).observe(document.body, {\n attributes: true,\n childList: true,\n subtree: true,\n characterData: true,\n });\n }\n schedule();\n})();\n</script>";
|
|
91433
91553
|
if (/<\/body>/i.test(html)) {
|
|
91434
91554
|
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91435
91555
|
}
|
|
@@ -91702,30 +91822,39 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91702
91822
|
});
|
|
91703
91823
|
}
|
|
91704
91824
|
|
|
91705
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
|
|
91825
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, autoScale) {
|
|
91706
91826
|
if (offsetX === void 0) offsetX = 0;
|
|
91707
91827
|
if (offsetY === void 0) offsetY = 0;
|
|
91828
|
+
if (autoScale === void 0) autoScale = true;
|
|
91708
91829
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91709
91830
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91710
|
-
var
|
|
91711
|
-
var
|
|
91712
|
-
var
|
|
91713
|
-
var
|
|
91831
|
+
var contentWidth = autoScale ? width : rightTop.distanceTo(leftTop);
|
|
91832
|
+
var contentHeight = autoScale ? height : leftBottom.distanceTo(leftTop);
|
|
91833
|
+
var a = (rightTop.x - leftTop.x) / contentWidth;
|
|
91834
|
+
var b = (rightTop.y - leftTop.y) / contentWidth;
|
|
91835
|
+
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
91836
|
+
var d = (leftBottom.y - leftTop.y) / contentHeight;
|
|
91714
91837
|
var e = leftTop.x - offsetX;
|
|
91715
91838
|
var f = leftTop.y - offsetY;
|
|
91716
91839
|
return {
|
|
91717
91840
|
left: '0px',
|
|
91718
91841
|
top: '0px',
|
|
91719
|
-
width: "" +
|
|
91720
|
-
height: "" +
|
|
91842
|
+
width: "" + formatPixelNumber(contentWidth) + "px",
|
|
91843
|
+
height: "" + formatPixelNumber(contentHeight) + "px",
|
|
91844
|
+
contentWidth: contentWidth,
|
|
91845
|
+
contentHeight: contentHeight,
|
|
91721
91846
|
transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
|
|
91722
91847
|
};
|
|
91723
91848
|
}
|
|
91849
|
+
var contentWidth1 = box.max.x - box.min.x;
|
|
91850
|
+
var contentHeight1 = box.max.y - box.min.y;
|
|
91724
91851
|
return {
|
|
91725
91852
|
left: "" + (box.min.x - offsetX) + "px",
|
|
91726
91853
|
top: "" + (box.min.y - offsetY) + "px",
|
|
91727
|
-
width: "" +
|
|
91728
|
-
height: "" +
|
|
91854
|
+
width: "" + contentWidth1 + "px",
|
|
91855
|
+
height: "" + contentHeight1 + "px",
|
|
91856
|
+
contentWidth: contentWidth1,
|
|
91857
|
+
contentHeight: contentHeight1,
|
|
91729
91858
|
transform: ''
|
|
91730
91859
|
};
|
|
91731
91860
|
}
|
|
@@ -91748,6 +91877,10 @@ function formatMatrixNumber(value) {
|
|
|
91748
91877
|
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91749
91878
|
return Number(normalized.toFixed(6)).toString();
|
|
91750
91879
|
}
|
|
91880
|
+
function formatPixelNumber(value) {
|
|
91881
|
+
var normalized = Object.is(value, -0) ? 0 : value;
|
|
91882
|
+
return Number(normalized.toFixed(6)).toString();
|
|
91883
|
+
}
|
|
91751
91884
|
|
|
91752
91885
|
function mountHTMLShell(container, content, shell) {
|
|
91753
91886
|
if (!shell) {
|
|
@@ -91785,6 +91918,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91785
91918
|
contentMountElements: new Map(),
|
|
91786
91919
|
contents: new Map(),
|
|
91787
91920
|
cleanups: new Map(),
|
|
91921
|
+
autoHeightModes: new Map(),
|
|
91788
91922
|
autoHeightCleanups: new Map(),
|
|
91789
91923
|
autoHeightFrames: new Map()
|
|
91790
91924
|
};
|
|
@@ -91873,6 +92007,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91873
92007
|
this.state.contentMountElements.clear();
|
|
91874
92008
|
this.state.contents.clear();
|
|
91875
92009
|
this.state.cleanups.clear();
|
|
92010
|
+
this.state.autoHeightModes.clear();
|
|
91876
92011
|
this.state.autoHeightCleanups.forEach(function(cleanup) {
|
|
91877
92012
|
cleanup();
|
|
91878
92013
|
});
|
|
@@ -92035,7 +92170,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92035
92170
|
var editingVisible = false;
|
|
92036
92171
|
items.forEach(function(item) {
|
|
92037
92172
|
var _this_state_editing;
|
|
92038
|
-
if (!isCardItem(item) || !item.visible
|
|
92173
|
+
if (!isCardItem(item) || !item.visible) {
|
|
92174
|
+
return;
|
|
92175
|
+
}
|
|
92176
|
+
var html = _this.options.resolveCardHTML(item);
|
|
92177
|
+
if (html === undefined) {
|
|
92039
92178
|
return;
|
|
92040
92179
|
}
|
|
92041
92180
|
var itemBox = _this.options.getViewBoxById(item.id);
|
|
@@ -92050,20 +92189,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92050
92189
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92051
92190
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92052
92191
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92053
|
-
var html = item.html;
|
|
92054
92192
|
if (html && _this.state.contents.get(item.id) !== html) {
|
|
92055
92193
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92056
92194
|
}
|
|
92057
92195
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92058
92196
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92059
|
-
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
|
|
92197
|
+
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, item.property.autoScale !== false);
|
|
92060
92198
|
overlay.style.left = boxStyle.left;
|
|
92061
92199
|
overlay.style.top = boxStyle.top;
|
|
92062
92200
|
overlay.style.width = boxStyle.width;
|
|
92063
92201
|
overlay.style.height = boxStyle.height;
|
|
92064
92202
|
overlay.style.transform = boxStyle.transform;
|
|
92065
92203
|
overlay.style.transformOrigin = '0 0';
|
|
92066
|
-
_this.syncContentScale(item.id,
|
|
92204
|
+
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92067
92205
|
_this.syncAutoHeight(item.id, item.property.autoHeight === true);
|
|
92068
92206
|
_this.syncContentInteraction(item.id);
|
|
92069
92207
|
});
|
|
@@ -92191,7 +92329,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92191
92329
|
var items = this.options.getItems();
|
|
92192
92330
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92193
92331
|
var item = items[i];
|
|
92194
|
-
if (!isCardItem(item) || !item.visible || item
|
|
92332
|
+
if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
|
|
92195
92333
|
continue;
|
|
92196
92334
|
}
|
|
92197
92335
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92210,7 +92348,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92210
92348
|
var items = this.options.getItems();
|
|
92211
92349
|
for(var i = items.length - 1; i >= 0; i--){
|
|
92212
92350
|
var item = items[i];
|
|
92213
|
-
if (!isCardItem(item) || !item.visible || item
|
|
92351
|
+
if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
|
|
92214
92352
|
continue;
|
|
92215
92353
|
}
|
|
92216
92354
|
var box = this.options.getViewBoxById(item.id);
|
|
@@ -92283,11 +92421,22 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92283
92421
|
if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
|
|
92284
92422
|
return;
|
|
92285
92423
|
}
|
|
92286
|
-
|
|
92287
|
-
|
|
92424
|
+
var nextWidth = "" + width + "px";
|
|
92425
|
+
var nextHeight = "" + height + "px";
|
|
92426
|
+
var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
|
|
92427
|
+
scaleOverlay.style.width = nextWidth;
|
|
92428
|
+
scaleOverlay.style.height = nextHeight;
|
|
92288
92429
|
scaleOverlay.style.transform = 'none';
|
|
92289
|
-
contentOverlay.style.width =
|
|
92290
|
-
contentOverlay.style.height =
|
|
92430
|
+
contentOverlay.style.width = nextWidth;
|
|
92431
|
+
contentOverlay.style.height = nextHeight;
|
|
92432
|
+
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92433
|
+
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92434
|
+
}
|
|
92435
|
+
};
|
|
92436
|
+
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92437
|
+
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92438
|
+
requestCardHTMLAutoHeight(iframe, id);
|
|
92439
|
+
});
|
|
92291
92440
|
};
|
|
92292
92441
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92293
92442
|
var _this_state_editing;
|
|
@@ -92429,6 +92578,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92429
92578
|
var _this = this;
|
|
92430
92579
|
switch(content.kind){
|
|
92431
92580
|
case 'inline':
|
|
92581
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
92582
|
+
this.state.autoHeightModes.set(options.id, 'message');
|
|
92583
|
+
}
|
|
92432
92584
|
return this.chainCleanups(function() {
|
|
92433
92585
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
92434
92586
|
}, renderDocumentContent(overlay, {
|
|
@@ -92445,6 +92597,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92445
92597
|
}));
|
|
92446
92598
|
case 'dom':
|
|
92447
92599
|
{
|
|
92600
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
92601
|
+
this.state.autoHeightModes.set(options.id, 'measure');
|
|
92602
|
+
}
|
|
92448
92603
|
if (content.target === 'iframe') {
|
|
92449
92604
|
return renderDOMContentInIframe(overlay, content.render, content.cleanup);
|
|
92450
92605
|
}
|
|
@@ -92454,6 +92609,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92454
92609
|
} : undefined;
|
|
92455
92610
|
}
|
|
92456
92611
|
case 'document':
|
|
92612
|
+
if (options == null ? void 0 : options.autoHeight) {
|
|
92613
|
+
this.state.autoHeightModes.set(options.id, 'message');
|
|
92614
|
+
}
|
|
92457
92615
|
return this.chainCleanups(function() {
|
|
92458
92616
|
return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
|
|
92459
92617
|
}, renderDocumentContent(overlay, content, {
|
|
@@ -92488,6 +92646,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92488
92646
|
}
|
|
92489
92647
|
this.state.contents.delete(id);
|
|
92490
92648
|
this.state.contentMountElements.delete(id);
|
|
92649
|
+
this.state.autoHeightModes.delete(id);
|
|
92491
92650
|
this.cleanupAutoHeight(id);
|
|
92492
92651
|
};
|
|
92493
92652
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
@@ -92503,11 +92662,27 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92503
92662
|
this.cleanupAutoHeight(id);
|
|
92504
92663
|
return;
|
|
92505
92664
|
}
|
|
92665
|
+
this.ensureAutoHeightMode(id);
|
|
92666
|
+
if (this.state.autoHeightModes.get(id) === 'message') {
|
|
92667
|
+
this.cleanupAutoHeight(id);
|
|
92668
|
+
return;
|
|
92669
|
+
}
|
|
92506
92670
|
if (!this.state.autoHeightCleanups.has(id)) {
|
|
92507
92671
|
this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
|
|
92508
92672
|
}
|
|
92509
92673
|
this.scheduleAutoHeightMeasure(id);
|
|
92510
92674
|
};
|
|
92675
|
+
_proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
|
|
92676
|
+
var _this_state_contents_get;
|
|
92677
|
+
if (this.state.autoHeightModes.has(id)) {
|
|
92678
|
+
return;
|
|
92679
|
+
}
|
|
92680
|
+
var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
|
|
92681
|
+
if (!content) {
|
|
92682
|
+
return;
|
|
92683
|
+
}
|
|
92684
|
+
this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
|
|
92685
|
+
};
|
|
92511
92686
|
_proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
|
|
92512
92687
|
var _this = this;
|
|
92513
92688
|
var cleanupFns = [];
|
|
@@ -92614,7 +92789,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92614
92789
|
}).filter(function(height) {
|
|
92615
92790
|
return typeof height === 'number' && Number.isFinite(height) && height > 0;
|
|
92616
92791
|
});
|
|
92617
|
-
var childHeight = this.getChildrenNaturalHeight(element
|
|
92792
|
+
var childHeight = this.getChildrenNaturalHeight(element, {
|
|
92793
|
+
includeIframes: iframeHeights.length === 0
|
|
92794
|
+
});
|
|
92618
92795
|
var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
|
|
92619
92796
|
childHeight
|
|
92620
92797
|
], iframeHeights));
|
|
@@ -92634,10 +92811,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92634
92811
|
}
|
|
92635
92812
|
return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
|
|
92636
92813
|
};
|
|
92637
|
-
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
|
|
92638
|
-
|
|
92639
|
-
|
|
92640
|
-
|
|
92814
|
+
_proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element, options) {
|
|
92815
|
+
var _ref;
|
|
92816
|
+
var includeIframes = (_ref = options == null ? void 0 : options.includeIframes) != null ? _ref : true;
|
|
92817
|
+
return Array.from(element.childNodes).reduce(function(height, child) {
|
|
92818
|
+
var _child_textContent;
|
|
92819
|
+
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
92820
|
+
var childElement = child;
|
|
92821
|
+
if (!includeIframes && childElement.tagName === 'IFRAME') {
|
|
92822
|
+
return height;
|
|
92823
|
+
}
|
|
92824
|
+
return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
|
|
92825
|
+
}
|
|
92826
|
+
if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
|
|
92827
|
+
var range = element.ownerDocument.createRange();
|
|
92828
|
+
range.selectNodeContents(child);
|
|
92829
|
+
var rects = Array.from(range.getClientRects());
|
|
92830
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
92831
|
+
range.detach();
|
|
92832
|
+
return rects.reduce(function(textHeight, rect) {
|
|
92833
|
+
return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
|
|
92834
|
+
}, height);
|
|
92835
|
+
}
|
|
92836
|
+
return height;
|
|
92641
92837
|
}, 0);
|
|
92642
92838
|
};
|
|
92643
92839
|
_proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
|
|
@@ -92659,10 +92855,25 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92659
92855
|
if (!isCardItem(item) || item.property.autoHeight !== true) {
|
|
92660
92856
|
return;
|
|
92661
92857
|
}
|
|
92662
|
-
if (!Number.isFinite(height) || height <= 0
|
|
92858
|
+
if (!Number.isFinite(height) || height <= 0) {
|
|
92859
|
+
return;
|
|
92860
|
+
}
|
|
92861
|
+
var nextHeight = Math.ceil(this.getAutoHeightItemHeight(item, height));
|
|
92862
|
+
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
92663
92863
|
return;
|
|
92664
92864
|
}
|
|
92665
|
-
this.options.setCardItemHeight(id,
|
|
92865
|
+
this.options.setCardItemHeight(id, nextHeight);
|
|
92866
|
+
};
|
|
92867
|
+
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
92868
|
+
if (!isCardItem(item) || item.property.autoScale !== false) {
|
|
92869
|
+
return contentHeight;
|
|
92870
|
+
}
|
|
92871
|
+
var scaleOverlay = this.state.contentScaleElements.get(item.id);
|
|
92872
|
+
var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
|
|
92873
|
+
if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
|
|
92874
|
+
return contentHeight;
|
|
92875
|
+
}
|
|
92876
|
+
return contentHeight / displayedHeight * item.property.height;
|
|
92666
92877
|
};
|
|
92667
92878
|
return HTMLOverlayManager;
|
|
92668
92879
|
}();
|
|
@@ -93267,6 +93478,9 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93267
93478
|
propertyName: 'height',
|
|
93268
93479
|
propertyValue: height
|
|
93269
93480
|
});
|
|
93481
|
+
},
|
|
93482
|
+
resolveCardHTML: function resolveCardHTML(item) {
|
|
93483
|
+
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
93270
93484
|
}
|
|
93271
93485
|
});
|
|
93272
93486
|
this._htmlOverlayManager.attach();
|
|
@@ -95405,6 +95619,17 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95405
95619
|
});
|
|
95406
95620
|
};
|
|
95407
95621
|
/**
|
|
95622
|
+
* @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
|
|
95623
|
+
* @param item 卡片元素
|
|
95624
|
+
* @returns HTML 渲染配置
|
|
95625
|
+
*/ _proto.resolveCardHTML = function resolveCardHTML(item) {
|
|
95626
|
+
var _cardTypeConfig_html;
|
|
95627
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
95628
|
+
return t.type === item.cardType;
|
|
95629
|
+
});
|
|
95630
|
+
return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
|
|
95631
|
+
};
|
|
95632
|
+
/**
|
|
95408
95633
|
* @description 创建卡片元素
|
|
95409
95634
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
95410
95635
|
* @param createInfo 卡片创建信息
|
|
@@ -95691,166 +95916,5 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95691
95916
|
}();
|
|
95692
95917
|
SDK.config = BaseConfig;
|
|
95693
95918
|
|
|
95694
|
-
/**
|
|
95695
|
-
* @description 卡片元素 SDKItem 类
|
|
95696
|
-
* @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
|
|
95697
|
-
* @description 支持设置卡片类型(cardType)
|
|
95698
|
-
*/ var CardItem = /*#__PURE__*/ function(BaseItem) {
|
|
95699
|
-
_inherits(CardItem, BaseItem);
|
|
95700
|
-
function CardItem(options) {
|
|
95701
|
-
var _this;
|
|
95702
|
-
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
|
|
95703
|
-
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5, _SDK_config_itemConfig_cardConfig_cardTypes_, _options_property6, _options_property7;
|
|
95704
|
-
_this = BaseItem.call(this, options) || this, /**
|
|
95705
|
-
* @description 元素类型
|
|
95706
|
-
*/ _this.type = SDKItemType.CARD;
|
|
95707
|
-
// 初始化属性(包含 cardType)
|
|
95708
|
-
_this.property = {
|
|
95709
|
-
position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
|
|
95710
|
-
0,
|
|
95711
|
-
0
|
|
95712
|
-
],
|
|
95713
|
-
rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
|
|
95714
|
-
0,
|
|
95715
|
-
0,
|
|
95716
|
-
0
|
|
95717
|
-
],
|
|
95718
|
-
width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
|
|
95719
|
-
height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
|
|
95720
|
-
scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
|
|
95721
|
-
1,
|
|
95722
|
-
1
|
|
95723
|
-
],
|
|
95724
|
-
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 : '',
|
|
95725
|
-
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
95726
|
-
html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
|
|
95727
|
-
};
|
|
95728
|
-
return _this;
|
|
95729
|
-
}
|
|
95730
|
-
var _proto = CardItem.prototype;
|
|
95731
|
-
// ==================== 实现抽象方法 ====================
|
|
95732
|
-
/**
|
|
95733
|
-
* @description 转换为 CardCreateInfo
|
|
95734
|
-
* @param withParent 是否包含父节点ID
|
|
95735
|
-
*/ _proto.toCreateInfo = function toCreateInfo(withParent) {
|
|
95736
|
-
var extension = this.getAllExtension();
|
|
95737
|
-
var property = deepClone(this.property);
|
|
95738
|
-
property.html = this.html;
|
|
95739
|
-
return {
|
|
95740
|
-
type: SDKItemType.CARD,
|
|
95741
|
-
id: this.id,
|
|
95742
|
-
name: this.name,
|
|
95743
|
-
parentId: withParent ? this.parentId : undefined,
|
|
95744
|
-
extension: Object.keys(extension).length > 0 ? extension : undefined,
|
|
95745
|
-
property: property
|
|
95746
|
-
};
|
|
95747
|
-
};
|
|
95748
|
-
/**
|
|
95749
|
-
* @description 克隆 SDKItem
|
|
95750
|
-
*/ _proto.clone = function clone() {
|
|
95751
|
-
var property = deepClone(this.property);
|
|
95752
|
-
property.html = this.html;
|
|
95753
|
-
return new CardItem({
|
|
95754
|
-
id: generateGUID(),
|
|
95755
|
-
name: this.name,
|
|
95756
|
-
parentId: this.parentId,
|
|
95757
|
-
duration: this.duration,
|
|
95758
|
-
delay: this.delay,
|
|
95759
|
-
endBehavior: this.endBehavior,
|
|
95760
|
-
isLocked: this.isLocked,
|
|
95761
|
-
isCoreEditable: this.isCoreEditable,
|
|
95762
|
-
property: property,
|
|
95763
|
-
extension: this.getAllExtension()
|
|
95764
|
-
});
|
|
95765
|
-
};
|
|
95766
|
-
_create_class(CardItem, [
|
|
95767
|
-
{
|
|
95768
|
-
key: "cardType",
|
|
95769
|
-
get: // ==================== cardType 访问器 ====================
|
|
95770
|
-
/**
|
|
95771
|
-
* @description 卡片类型
|
|
95772
|
-
*/ function get() {
|
|
95773
|
-
return this.property.cardType;
|
|
95774
|
-
},
|
|
95775
|
-
set: function set(value) {
|
|
95776
|
-
this.property.cardType = value;
|
|
95777
|
-
}
|
|
95778
|
-
},
|
|
95779
|
-
{
|
|
95780
|
-
key: "html",
|
|
95781
|
-
get: /**
|
|
95782
|
-
* @description HTML 覆盖层配置
|
|
95783
|
-
*/ function get() {
|
|
95784
|
-
return this.property.html;
|
|
95785
|
-
},
|
|
95786
|
-
set: function set(value) {
|
|
95787
|
-
this.property.html = value;
|
|
95788
|
-
}
|
|
95789
|
-
},
|
|
95790
|
-
{
|
|
95791
|
-
key: "position",
|
|
95792
|
-
get: // ==================== 便捷访问器 ====================
|
|
95793
|
-
/**
|
|
95794
|
-
* @description 位置
|
|
95795
|
-
*/ function get() {
|
|
95796
|
-
return this.property.position;
|
|
95797
|
-
},
|
|
95798
|
-
set: function set(value) {
|
|
95799
|
-
this.property.position = value;
|
|
95800
|
-
}
|
|
95801
|
-
},
|
|
95802
|
-
{
|
|
95803
|
-
key: "width",
|
|
95804
|
-
get: /**
|
|
95805
|
-
* @description 宽度
|
|
95806
|
-
*/ function get() {
|
|
95807
|
-
return this.property.width;
|
|
95808
|
-
},
|
|
95809
|
-
set: function set(value) {
|
|
95810
|
-
this.property.width = value;
|
|
95811
|
-
}
|
|
95812
|
-
},
|
|
95813
|
-
{
|
|
95814
|
-
key: "height",
|
|
95815
|
-
get: /**
|
|
95816
|
-
* @description 高度
|
|
95817
|
-
*/ function get() {
|
|
95818
|
-
return this.property.height;
|
|
95819
|
-
},
|
|
95820
|
-
set: function set(value) {
|
|
95821
|
-
this.property.height = value;
|
|
95822
|
-
}
|
|
95823
|
-
},
|
|
95824
|
-
{
|
|
95825
|
-
key: "rotation",
|
|
95826
|
-
get: /**
|
|
95827
|
-
* @description 旋转(二维旋转角度)
|
|
95828
|
-
*/ function get() {
|
|
95829
|
-
return this.property.rotation[2];
|
|
95830
|
-
},
|
|
95831
|
-
set: function set(value) {
|
|
95832
|
-
this.property.rotation[2] = value;
|
|
95833
|
-
}
|
|
95834
|
-
},
|
|
95835
|
-
{
|
|
95836
|
-
key: "fullRotation",
|
|
95837
|
-
get: /**
|
|
95838
|
-
* @description 完整旋转(包含 x, y, z)
|
|
95839
|
-
*/ function get() {
|
|
95840
|
-
return this.property.rotation;
|
|
95841
|
-
},
|
|
95842
|
-
set: function set(value) {
|
|
95843
|
-
this.property.rotation = value;
|
|
95844
|
-
}
|
|
95845
|
-
}
|
|
95846
|
-
]);
|
|
95847
|
-
return CardItem;
|
|
95848
|
-
}(BaseItem);
|
|
95849
|
-
/**
|
|
95850
|
-
* @description 类型守卫:检查是否是 CardItem
|
|
95851
|
-
*/ function isCardItem(obj) {
|
|
95852
|
-
return _instanceof(obj, CardItem);
|
|
95853
|
-
}
|
|
95854
|
-
|
|
95855
95919
|
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 };
|
|
95856
95920
|
//# sourceMappingURL=index.js.map
|