@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.mjs 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.1
6
+ * Version: v0.2.2-beta.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -25172,6 +25172,152 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
25172
25172
  return _instanceof(obj, FrameItem);
25173
25173
  }
25174
25174
 
25175
+ /**
25176
+ * @description 卡片元素 SDKItem 类
25177
+ * @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
25178
+ * @description 支持设置卡片类型(cardType)
25179
+ */ var CardItem = /*#__PURE__*/ function(BaseItem) {
25180
+ _inherits(CardItem, BaseItem);
25181
+ function CardItem(options) {
25182
+ var _this;
25183
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
25184
+ var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5, _options_property6, _options_property7;
25185
+ _this = BaseItem.call(this, options) || this, /**
25186
+ * @description 元素类型
25187
+ */ _this.type = SDKItemType.CARD;
25188
+ // 初始化属性(包含 cardType)
25189
+ _this.property = {
25190
+ position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
25191
+ 0,
25192
+ 0
25193
+ ],
25194
+ rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
25195
+ 0,
25196
+ 0,
25197
+ 0
25198
+ ],
25199
+ width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
25200
+ height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
25201
+ scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
25202
+ 1,
25203
+ 1
25204
+ ],
25205
+ cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown',
25206
+ autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
25207
+ autoScale: (_options_property7 = options.property) == null ? void 0 : _options_property7.autoScale
25208
+ };
25209
+ return _this;
25210
+ }
25211
+ var _proto = CardItem.prototype;
25212
+ // ==================== 实现抽象方法 ====================
25213
+ /**
25214
+ * @description 转换为 CardCreateInfo
25215
+ * @param withParent 是否包含父节点ID
25216
+ */ _proto.toCreateInfo = function toCreateInfo(withParent) {
25217
+ var extension = this.getAllExtension();
25218
+ return {
25219
+ type: SDKItemType.CARD,
25220
+ id: this.id,
25221
+ name: this.name,
25222
+ parentId: withParent ? this.parentId : undefined,
25223
+ extension: Object.keys(extension).length > 0 ? extension : undefined,
25224
+ property: deepClone(this.property)
25225
+ };
25226
+ };
25227
+ /**
25228
+ * @description 克隆 SDKItem
25229
+ */ _proto.clone = function clone() {
25230
+ return new CardItem({
25231
+ id: EFFECTS.generateGUID(),
25232
+ name: this.name,
25233
+ parentId: this.parentId,
25234
+ duration: this.duration,
25235
+ delay: this.delay,
25236
+ endBehavior: this.endBehavior,
25237
+ isLocked: this.isLocked,
25238
+ isCoreEditable: this.isCoreEditable,
25239
+ property: deepClone(this.property),
25240
+ extension: this.getAllExtension()
25241
+ });
25242
+ };
25243
+ _create_class(CardItem, [
25244
+ {
25245
+ key: "cardType",
25246
+ get: // ==================== cardType 访问器 ====================
25247
+ /**
25248
+ * @description 卡片类型
25249
+ */ function get() {
25250
+ return this.property.cardType;
25251
+ },
25252
+ set: function set(value) {
25253
+ this.property.cardType = value;
25254
+ }
25255
+ },
25256
+ {
25257
+ key: "position",
25258
+ get: // ==================== 便捷访问器 ====================
25259
+ /**
25260
+ * @description 位置
25261
+ */ function get() {
25262
+ return this.property.position;
25263
+ },
25264
+ set: function set(value) {
25265
+ this.property.position = value;
25266
+ }
25267
+ },
25268
+ {
25269
+ key: "width",
25270
+ get: /**
25271
+ * @description 宽度
25272
+ */ function get() {
25273
+ return this.property.width;
25274
+ },
25275
+ set: function set(value) {
25276
+ this.property.width = value;
25277
+ }
25278
+ },
25279
+ {
25280
+ key: "height",
25281
+ get: /**
25282
+ * @description 高度
25283
+ */ function get() {
25284
+ return this.property.height;
25285
+ },
25286
+ set: function set(value) {
25287
+ this.property.height = value;
25288
+ }
25289
+ },
25290
+ {
25291
+ key: "rotation",
25292
+ get: /**
25293
+ * @description 旋转(二维旋转角度)
25294
+ */ function get() {
25295
+ return this.property.rotation[2];
25296
+ },
25297
+ set: function set(value) {
25298
+ this.property.rotation[2] = value;
25299
+ }
25300
+ },
25301
+ {
25302
+ key: "fullRotation",
25303
+ get: /**
25304
+ * @description 完整旋转(包含 x, y, z)
25305
+ */ function get() {
25306
+ return this.property.rotation;
25307
+ },
25308
+ set: function set(value) {
25309
+ this.property.rotation = value;
25310
+ }
25311
+ }
25312
+ ]);
25313
+ return CardItem;
25314
+ }(BaseItem);
25315
+ /**
25316
+ * @description 类型守卫:检查是否是 CardItem
25317
+ */ function isCardItem(obj) {
25318
+ return _instanceof(obj, CardItem);
25319
+ }
25320
+
25175
25321
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
25176
25322
  try {
25177
25323
  var info = gen[key](arg);
@@ -59649,12 +59795,6 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
59649
59795
  /**
59650
59796
  * @description SDKItem position 属性的数字精度(保留小数位数)
59651
59797
  */ var POSITION_PRECISION = 4;
59652
- function isCardHTMLContentValue(value) {
59653
- return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
59654
- }
59655
- function isCardHTMLValue(value) {
59656
- return isCardHTMLContentValue(value == null ? void 0 : value.content);
59657
- }
59658
59798
  var PageDataUtils = /*#__PURE__*/ function() {
59659
59799
  function PageDataUtils(player, container, emitter, sdk) {
59660
59800
  this.player = player;
@@ -60472,11 +60612,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
60472
60612
  property: property
60473
60613
  }));
60474
60614
  } else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
60475
- var cardType = existingSDKItem.cardType, html = existingSDKItem.html;
60615
+ var cardType = existingSDKItem.cardType;
60476
60616
  sdkItem = new CardItem(_extends({}, baseOptions, {
60477
60617
  property: _extends({}, property, {
60478
- cardType: cardType,
60479
- html: html
60618
+ cardType: cardType
60480
60619
  })
60481
60620
  }));
60482
60621
  } else {
@@ -61060,40 +61199,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
61060
61199
  3,
61061
61200
  31
61062
61201
  ];
61063
- case 'html':
61064
- return [
61065
- 3,
61066
- 32
61067
- ];
61068
61202
  case 'position':
61069
61203
  return [
61070
61204
  3,
61071
- 33
61205
+ 32
61072
61206
  ];
61073
61207
  case 'rotation':
61074
61208
  return [
61075
61209
  3,
61076
- 34
61210
+ 33
61077
61211
  ];
61078
61212
  case 'scale':
61079
61213
  return [
61080
61214
  3,
61081
- 35
61215
+ 34
61082
61216
  ];
61083
61217
  case 'layoutMode':
61084
61218
  return [
61085
61219
  3,
61086
- 36
61220
+ 35
61087
61221
  ];
61088
61222
  case 'visible':
61089
61223
  return [
61090
61224
  3,
61091
- 37
61225
+ 36
61092
61226
  ];
61093
61227
  }
61094
61228
  return [
61095
61229
  3,
61096
- 38
61230
+ 37
61097
61231
  ];
61098
61232
  case 1:
61099
61233
  {
@@ -61106,7 +61240,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61106
61240
  }
61107
61241
  return [
61108
61242
  3,
61109
- 39
61243
+ 38
61110
61244
  ];
61111
61245
  }
61112
61246
  case 2:
@@ -61117,7 +61251,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61117
61251
  }
61118
61252
  return [
61119
61253
  3,
61120
- 39
61254
+ 38
61121
61255
  ];
61122
61256
  }
61123
61257
  case 3:
@@ -61149,7 +61283,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61149
61283
  case 5:
61150
61284
  return [
61151
61285
  3,
61152
- 39
61286
+ 38
61153
61287
  ];
61154
61288
  case 6:
61155
61289
  {
@@ -61166,7 +61300,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61166
61300
  }
61167
61301
  return [
61168
61302
  3,
61169
- 39
61303
+ 38
61170
61304
  ];
61171
61305
  }
61172
61306
  case 7:
@@ -61180,7 +61314,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61180
61314
  }
61181
61315
  return [
61182
61316
  3,
61183
- 39
61317
+ 38
61184
61318
  ];
61185
61319
  }
61186
61320
  case 8:
@@ -61193,7 +61327,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61193
61327
  }
61194
61328
  return [
61195
61329
  3,
61196
- 39
61330
+ 38
61197
61331
  ];
61198
61332
  }
61199
61333
  case 9:
@@ -61207,7 +61341,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61207
61341
  }
61208
61342
  return [
61209
61343
  3,
61210
- 39
61344
+ 38
61211
61345
  ];
61212
61346
  }
61213
61347
  case 10:
@@ -61220,7 +61354,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61220
61354
  }
61221
61355
  return [
61222
61356
  3,
61223
- 39
61357
+ 38
61224
61358
  ];
61225
61359
  }
61226
61360
  case 11:
@@ -61233,7 +61367,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61233
61367
  }
61234
61368
  return [
61235
61369
  3,
61236
- 39
61370
+ 38
61237
61371
  ];
61238
61372
  }
61239
61373
  case 12:
@@ -61253,7 +61387,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61253
61387
  }
61254
61388
  return [
61255
61389
  3,
61256
- 39
61390
+ 38
61257
61391
  ];
61258
61392
  }
61259
61393
  case 13:
@@ -61295,7 +61429,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61295
61429
  }
61296
61430
  return [
61297
61431
  3,
61298
- 39
61432
+ 38
61299
61433
  ];
61300
61434
  }
61301
61435
  case 14:
@@ -61330,7 +61464,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61330
61464
  }
61331
61465
  return [
61332
61466
  3,
61333
- 39
61467
+ 38
61334
61468
  ];
61335
61469
  }
61336
61470
  case 15:
@@ -61344,7 +61478,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61344
61478
  }
61345
61479
  return [
61346
61480
  3,
61347
- 39
61481
+ 38
61348
61482
  ];
61349
61483
  }
61350
61484
  case 16:
@@ -61376,7 +61510,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61376
61510
  case 20:
61377
61511
  return [
61378
61512
  3,
61379
- 39
61513
+ 38
61380
61514
  ];
61381
61515
  case 21:
61382
61516
  if (!(typeof propertyValue === 'string' && playerItem.type === EFFECTS.spec.ItemType.video)) return [
@@ -61407,7 +61541,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61407
61541
  case 25:
61408
61542
  return [
61409
61543
  3,
61410
- 39
61544
+ 38
61411
61545
  ];
61412
61546
  case 26:
61413
61547
  if (!(playerItem.type === EFFECTS.spec.ItemType.null)) return [
@@ -61452,7 +61586,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61452
61586
  case 28:
61453
61587
  return [
61454
61588
  3,
61455
- 39
61589
+ 38
61456
61590
  ];
61457
61591
  case 29:
61458
61592
  {
@@ -61464,7 +61598,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61464
61598
  }
61465
61599
  return [
61466
61600
  3,
61467
- 39
61601
+ 38
61468
61602
  ];
61469
61603
  }
61470
61604
  case 30:
@@ -61477,7 +61611,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61477
61611
  }
61478
61612
  return [
61479
61613
  3,
61480
- 39
61614
+ 38
61481
61615
  ];
61482
61616
  }
61483
61617
  case 31:
@@ -61490,20 +61624,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61490
61624
  }
61491
61625
  return [
61492
61626
  3,
61493
- 39
61627
+ 38
61494
61628
  ];
61495
61629
  }
61496
61630
  case 32:
61497
- {
61498
- if (isCardItem(targetItem)) {
61499
- targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
61500
- }
61501
- return [
61502
- 3,
61503
- 39
61504
- ];
61505
- }
61506
- case 33:
61507
61631
  {
61508
61632
  if (Array.isArray(propertyValue) && propertyValue.length === 2) {
61509
61633
  pixelTranslation = propertyValue.map(function(v, i) {
@@ -61516,10 +61640,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61516
61640
  }
61517
61641
  return [
61518
61642
  3,
61519
- 39
61643
+ 38
61520
61644
  ];
61521
61645
  }
61522
- case 34:
61646
+ case 33:
61523
61647
  {
61524
61648
  if (Array.isArray(propertyValue) && propertyValue.length === 3) {
61525
61649
  rotation = propertyValue.map(function(v, i) {
@@ -61530,10 +61654,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61530
61654
  }
61531
61655
  return [
61532
61656
  3,
61533
- 39
61657
+ 38
61534
61658
  ];
61535
61659
  }
61536
- case 35:
61660
+ case 34:
61537
61661
  {
61538
61662
  if (Array.isArray(propertyValue) && propertyValue.length === 2) {
61539
61663
  currentScale = targetItem.property.scale;
@@ -61547,10 +61671,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61547
61671
  }
61548
61672
  return [
61549
61673
  3,
61550
- 39
61674
+ 38
61551
61675
  ];
61552
61676
  }
61553
- case 36:
61677
+ case 35:
61554
61678
  {
61555
61679
  if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
61556
61680
  frameComponent = playerItem.getComponent(EFFECTS.FrameComponent);
@@ -61560,10 +61684,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61560
61684
  }
61561
61685
  return [
61562
61686
  3,
61563
- 39
61687
+ 38
61564
61688
  ];
61565
61689
  }
61566
- case 37:
61690
+ case 36:
61567
61691
  {
61568
61692
  if (typeof propertyValue === 'boolean') {
61569
61693
  playerItem.setVisible(propertyValue);
@@ -61576,10 +61700,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61576
61700
  }
61577
61701
  return [
61578
61702
  3,
61579
- 39
61703
+ 38
61580
61704
  ];
61581
61705
  }
61582
- case 38:
61706
+ case 37:
61583
61707
  {
61584
61708
  console.log('ignore property name ', propertyName);
61585
61709
  // 对于未明确处理的属性,尝试直接设置到 property 对象
@@ -61587,8 +61711,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
61587
61711
  targetItem.property[propertyName] = propertyValue;
61588
61712
  }
61589
61713
  }
61590
- _state.label = 39;
61591
- case 39:
61714
+ _state.label = 38;
61715
+ case 38:
61592
61716
  // 非位置属性需要刷新播放器
61593
61717
  // template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
61594
61718
  if (![
@@ -63060,7 +63184,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
63060
63184
  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 ? [
63061
63185
  1,
63062
63186
  1
63063
- ] : _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 ? EFFECTS.generateGUID() : _cardInfo_id, extension = cardInfo.extension;
63187
+ ] : _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 ? EFFECTS.generateGUID() : _cardInfo_id, extension = cardInfo.extension;
63064
63188
  // 校验 cardType 是否已在配置中注册
63065
63189
  var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
63066
63190
  return t.type;
@@ -63111,7 +63235,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
63111
63235
  scale: [].concat(scale),
63112
63236
  cardType: cardType,
63113
63237
  autoHeight: autoHeight,
63114
- html: html
63238
+ autoScale: autoScale
63115
63239
  },
63116
63240
  extension: extension
63117
63241
  });
@@ -64493,8 +64617,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
64493
64617
  scalar.y
64494
64618
  ],
64495
64619
  rotation: [].concat(rotation),
64496
- position: [].concat(resultPosition),
64497
- html: sdkItem.html
64620
+ position: [].concat(resultPosition)
64498
64621
  },
64499
64622
  extension: extension
64500
64623
  };
@@ -65878,35 +66001,56 @@ var PageDataUtils = /*#__PURE__*/ function() {
65878
66001
  };
65879
66002
  _proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
65880
66003
  return _async_to_generator(function() {
65881
- var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, createInfo, id, type, url, textureId, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
66004
+ var _loop, _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
65882
66005
  return _ts_generator(this, function(_state) {
65883
66006
  switch(_state.label){
65884
66007
  case 0:
65885
- _this = this;
65886
- createInfoWithIds = createInfos.map(function(createInfo) {
65887
- return Object.assign({}, createInfo, createInfo.id ? {} : {
65888
- id: EFFECTS.generateGUID()
65889
- });
65890
- });
65891
- itemToTextureInfo = new Map();
65892
- // 预处理所有 createInfo,分配 textureId
65893
- for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;){
65894
- createInfo = _step.value;
65895
- id = createInfo.id;
65896
- type = createInfo.type;
65897
- url = type === SDKItemType.SPRITE ? createInfo.property.image : type === SDKItemType.VIDEO ? createInfo.property.video : undefined;
65898
- if ((type === SDKItemType.SPRITE || type === SDKItemType.VIDEO) && url) {
65899
- textureId = EFFECTS.generateGUID();
65900
- itemToTextureInfo.set(id, {
66008
+ _loop = function() {
66009
+ var createInfo = _step.value;
66010
+ var _ref = function() {
66011
+ switch(createInfo.type){
66012
+ case SDKItemType.SPRITE:
66013
+ {
66014
+ return {
66015
+ url: createInfo.property.image,
66016
+ type: 'image'
66017
+ };
66018
+ }
66019
+ case SDKItemType.VIDEO:
66020
+ {
66021
+ return {
66022
+ url: createInfo.property.video,
66023
+ type: 'video'
66024
+ };
66025
+ }
66026
+ default:
66027
+ {
66028
+ return {};
66029
+ }
66030
+ }
66031
+ }(), url = _ref.url, type = _ref.type;
66032
+ if (url && type) {
66033
+ var textureId = EFFECTS.generateGUID();
66034
+ itemToTextureInfo.set(createInfo.id, {
65901
66035
  id: textureId,
65902
66036
  url: url,
65903
- type: type === SDKItemType.SPRITE ? 'image' : 'video'
66037
+ type: type
65904
66038
  });
65905
66039
  Object.assign(createInfo, {
65906
66040
  textureId: textureId
65907
66041
  });
65908
66042
  }
65909
- }
66043
+ };
66044
+ _this = this;
66045
+ createInfoWithIds = createInfos.map(function(createInfo) {
66046
+ var _createInfo_id;
66047
+ return Object.assign({}, createInfo, {
66048
+ id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : EFFECTS.generateGUID()
66049
+ });
66050
+ });
66051
+ itemToTextureInfo = new Map();
66052
+ // 预处理所有 createInfo,分配 textureId
66053
+ for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
65910
66054
  // 并行创建所有 item
65911
66055
  toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
65912
66056
  return ![
@@ -83084,38 +83228,7 @@ var BaseConfig = {
83084
83228
  0.6,
83085
83229
  0.12
83086
83230
  ],
83087
- cardTypes: [
83088
- {
83089
- type: 'character',
83090
- label: '角色图',
83091
- iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83092
- },
83093
- {
83094
- type: 'environment',
83095
- label: '环境图',
83096
- iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83097
- },
83098
- {
83099
- type: 'storyboard',
83100
- label: '分镜图',
83101
- iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83102
- },
83103
- {
83104
- type: 'scene-clip',
83105
- label: '场景剪辑',
83106
- iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83107
- },
83108
- {
83109
- type: 'video-compose',
83110
- label: '视频合成',
83111
- iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83112
- },
83113
- {
83114
- type: 'video-generate',
83115
- label: '生成视频',
83116
- iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83117
- }
83118
- ]
83231
+ cardTypes: []
83119
83232
  }
83120
83233
  }
83121
83234
  };
@@ -91444,11 +91557,18 @@ function isCardHTMLAutoHeightMessage(data, id) {
91444
91557
  var message = data;
91445
91558
  return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
91446
91559
  }
91560
+ function requestCardHTMLAutoHeight(iframe, id) {
91561
+ var _iframe_contentWindow;
91562
+ (_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
91563
+ source: 'vvfx-card-html-auto-height-request',
91564
+ id: id
91565
+ }, '*');
91566
+ }
91447
91567
  function withCardHTMLAutoHeightBridge(html, id) {
91448
91568
  if (!id) {
91449
91569
  return html;
91450
91570
  }
91451
- 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>";
91571
+ 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>";
91452
91572
  if (/<\/body>/i.test(html)) {
91453
91573
  return html.replace(/<\/body>/i, "" + script + "</body>");
91454
91574
  }
@@ -91721,30 +91841,39 @@ function syncElementStackOrder(_container, elements) {
91721
91841
  });
91722
91842
  }
91723
91843
 
91724
- function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
91844
+ function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, autoScale) {
91725
91845
  if (offsetX === void 0) offsetX = 0;
91726
91846
  if (offsetY === void 0) offsetY = 0;
91847
+ if (autoScale === void 0) autoScale = true;
91727
91848
  if (box.corners.length === 4 && width > 0 && height > 0) {
91728
91849
  var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
91729
- var a = (rightTop.x - leftTop.x) / width;
91730
- var b = (rightTop.y - leftTop.y) / width;
91731
- var c = (leftBottom.x - leftTop.x) / height;
91732
- var d = (leftBottom.y - leftTop.y) / height;
91850
+ var contentWidth = autoScale ? width : rightTop.distanceTo(leftTop);
91851
+ var contentHeight = autoScale ? height : leftBottom.distanceTo(leftTop);
91852
+ var a = (rightTop.x - leftTop.x) / contentWidth;
91853
+ var b = (rightTop.y - leftTop.y) / contentWidth;
91854
+ var c = (leftBottom.x - leftTop.x) / contentHeight;
91855
+ var d = (leftBottom.y - leftTop.y) / contentHeight;
91733
91856
  var e = leftTop.x - offsetX;
91734
91857
  var f = leftTop.y - offsetY;
91735
91858
  return {
91736
91859
  left: '0px',
91737
91860
  top: '0px',
91738
- width: "" + width + "px",
91739
- height: "" + height + "px",
91861
+ width: "" + formatPixelNumber(contentWidth) + "px",
91862
+ height: "" + formatPixelNumber(contentHeight) + "px",
91863
+ contentWidth: contentWidth,
91864
+ contentHeight: contentHeight,
91740
91865
  transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
91741
91866
  };
91742
91867
  }
91868
+ var contentWidth1 = box.max.x - box.min.x;
91869
+ var contentHeight1 = box.max.y - box.min.y;
91743
91870
  return {
91744
91871
  left: "" + (box.min.x - offsetX) + "px",
91745
91872
  top: "" + (box.min.y - offsetY) + "px",
91746
- width: "" + (box.max.x - box.min.x) + "px",
91747
- height: "" + (box.max.y - box.min.y) + "px",
91873
+ width: "" + contentWidth1 + "px",
91874
+ height: "" + contentHeight1 + "px",
91875
+ contentWidth: contentWidth1,
91876
+ contentHeight: contentHeight1,
91748
91877
  transform: ''
91749
91878
  };
91750
91879
  }
@@ -91767,6 +91896,10 @@ function formatMatrixNumber(value) {
91767
91896
  var normalized = Object.is(value, -0) ? 0 : value;
91768
91897
  return Number(normalized.toFixed(6)).toString();
91769
91898
  }
91899
+ function formatPixelNumber(value) {
91900
+ var normalized = Object.is(value, -0) ? 0 : value;
91901
+ return Number(normalized.toFixed(6)).toString();
91902
+ }
91770
91903
 
91771
91904
  function mountHTMLShell(container, content, shell) {
91772
91905
  if (!shell) {
@@ -91804,6 +91937,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
91804
91937
  contentMountElements: new Map(),
91805
91938
  contents: new Map(),
91806
91939
  cleanups: new Map(),
91940
+ autoHeightModes: new Map(),
91807
91941
  autoHeightCleanups: new Map(),
91808
91942
  autoHeightFrames: new Map()
91809
91943
  };
@@ -91892,6 +92026,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
91892
92026
  this.state.contentMountElements.clear();
91893
92027
  this.state.contents.clear();
91894
92028
  this.state.cleanups.clear();
92029
+ this.state.autoHeightModes.clear();
91895
92030
  this.state.autoHeightCleanups.forEach(function(cleanup) {
91896
92031
  cleanup();
91897
92032
  });
@@ -92054,7 +92189,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92054
92189
  var editingVisible = false;
92055
92190
  items.forEach(function(item) {
92056
92191
  var _this_state_editing;
92057
- if (!isCardItem(item) || !item.visible || item.html === undefined) {
92192
+ if (!isCardItem(item) || !item.visible) {
92193
+ return;
92194
+ }
92195
+ var html = _this.options.resolveCardHTML(item);
92196
+ if (html === undefined) {
92058
92197
  return;
92059
92198
  }
92060
92199
  var itemBox = _this.options.getViewBoxById(item.id);
@@ -92069,20 +92208,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92069
92208
  var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
92070
92209
  var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
92071
92210
  var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
92072
- var html = item.html;
92073
92211
  if (html && _this.state.contents.get(item.id) !== html) {
92074
92212
  _this.renderOverlayHTML(item.id, contentOverlay, html);
92075
92213
  }
92076
92214
  var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
92077
92215
  var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
92078
- var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
92216
+ var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, item.property.autoScale !== false);
92079
92217
  overlay.style.left = boxStyle.left;
92080
92218
  overlay.style.top = boxStyle.top;
92081
92219
  overlay.style.width = boxStyle.width;
92082
92220
  overlay.style.height = boxStyle.height;
92083
92221
  overlay.style.transform = boxStyle.transform;
92084
92222
  overlay.style.transformOrigin = '0 0';
92085
- _this.syncContentScale(item.id, item.property.width, item.property.height);
92223
+ _this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
92086
92224
  _this.syncAutoHeight(item.id, item.property.autoHeight === true);
92087
92225
  _this.syncContentInteraction(item.id);
92088
92226
  });
@@ -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.html === undefined) {
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);
@@ -92229,7 +92367,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92229
92367
  var items = this.options.getItems();
92230
92368
  for(var i = items.length - 1; i >= 0; i--){
92231
92369
  var item = items[i];
92232
- if (!isCardItem(item) || !item.visible || item.html === undefined) {
92370
+ if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
92233
92371
  continue;
92234
92372
  }
92235
92373
  var box = this.options.getViewBoxById(item.id);
@@ -92302,11 +92440,22 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92302
92440
  if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
92303
92441
  return;
92304
92442
  }
92305
- scaleOverlay.style.width = "" + width + "px";
92306
- scaleOverlay.style.height = "" + height + "px";
92443
+ var nextWidth = "" + width + "px";
92444
+ var nextHeight = "" + height + "px";
92445
+ var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
92446
+ scaleOverlay.style.width = nextWidth;
92447
+ scaleOverlay.style.height = nextHeight;
92307
92448
  scaleOverlay.style.transform = 'none';
92308
- contentOverlay.style.width = "" + width + "px";
92309
- contentOverlay.style.height = "" + height + "px";
92449
+ contentOverlay.style.width = nextWidth;
92450
+ contentOverlay.style.height = nextHeight;
92451
+ if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
92452
+ this.requestAutoHeightFromIframes(id, contentOverlay);
92453
+ }
92454
+ };
92455
+ _proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
92456
+ contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
92457
+ requestCardHTMLAutoHeight(iframe, id);
92458
+ });
92310
92459
  };
92311
92460
  _proto.syncContentInteraction = function syncContentInteraction(id) {
92312
92461
  var _this_state_editing;
@@ -92448,6 +92597,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92448
92597
  var _this = this;
92449
92598
  switch(content.kind){
92450
92599
  case 'inline':
92600
+ if (options == null ? void 0 : options.autoHeight) {
92601
+ this.state.autoHeightModes.set(options.id, 'message');
92602
+ }
92451
92603
  return this.chainCleanups(function() {
92452
92604
  return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
92453
92605
  }, renderDocumentContent(overlay, {
@@ -92464,6 +92616,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92464
92616
  }));
92465
92617
  case 'dom':
92466
92618
  {
92619
+ if (options == null ? void 0 : options.autoHeight) {
92620
+ this.state.autoHeightModes.set(options.id, 'measure');
92621
+ }
92467
92622
  if (content.target === 'iframe') {
92468
92623
  return renderDOMContentInIframe(overlay, content.render, content.cleanup);
92469
92624
  }
@@ -92473,6 +92628,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92473
92628
  } : undefined;
92474
92629
  }
92475
92630
  case 'document':
92631
+ if (options == null ? void 0 : options.autoHeight) {
92632
+ this.state.autoHeightModes.set(options.id, 'message');
92633
+ }
92476
92634
  return this.chainCleanups(function() {
92477
92635
  return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
92478
92636
  }, renderDocumentContent(overlay, content, {
@@ -92507,6 +92665,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92507
92665
  }
92508
92666
  this.state.contents.delete(id);
92509
92667
  this.state.contentMountElements.delete(id);
92668
+ this.state.autoHeightModes.delete(id);
92510
92669
  this.cleanupAutoHeight(id);
92511
92670
  };
92512
92671
  _proto.removeOverlay = function removeOverlay(id) {
@@ -92522,11 +92681,27 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92522
92681
  this.cleanupAutoHeight(id);
92523
92682
  return;
92524
92683
  }
92684
+ this.ensureAutoHeightMode(id);
92685
+ if (this.state.autoHeightModes.get(id) === 'message') {
92686
+ this.cleanupAutoHeight(id);
92687
+ return;
92688
+ }
92525
92689
  if (!this.state.autoHeightCleanups.has(id)) {
92526
92690
  this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
92527
92691
  }
92528
92692
  this.scheduleAutoHeightMeasure(id);
92529
92693
  };
92694
+ _proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
92695
+ var _this_state_contents_get;
92696
+ if (this.state.autoHeightModes.has(id)) {
92697
+ return;
92698
+ }
92699
+ var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
92700
+ if (!content) {
92701
+ return;
92702
+ }
92703
+ this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
92704
+ };
92530
92705
  _proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
92531
92706
  var _this = this;
92532
92707
  var cleanupFns = [];
@@ -92633,7 +92808,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92633
92808
  }).filter(function(height) {
92634
92809
  return typeof height === 'number' && Number.isFinite(height) && height > 0;
92635
92810
  });
92636
- var childHeight = this.getChildrenNaturalHeight(element);
92811
+ var childHeight = this.getChildrenNaturalHeight(element, {
92812
+ includeIframes: iframeHeights.length === 0
92813
+ });
92637
92814
  var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
92638
92815
  childHeight
92639
92816
  ], iframeHeights));
@@ -92653,10 +92830,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92653
92830
  }
92654
92831
  return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
92655
92832
  };
92656
- _proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
92657
- return Array.from(element.children).reduce(function(height, child) {
92658
- var childElement = child;
92659
- return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
92833
+ _proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element, options) {
92834
+ var _ref;
92835
+ var includeIframes = (_ref = options == null ? void 0 : options.includeIframes) != null ? _ref : true;
92836
+ return Array.from(element.childNodes).reduce(function(height, child) {
92837
+ var _child_textContent;
92838
+ if (child.nodeType === Node.ELEMENT_NODE) {
92839
+ var childElement = child;
92840
+ if (!includeIframes && childElement.tagName === 'IFRAME') {
92841
+ return height;
92842
+ }
92843
+ return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
92844
+ }
92845
+ if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
92846
+ var range = element.ownerDocument.createRange();
92847
+ range.selectNodeContents(child);
92848
+ var rects = Array.from(range.getClientRects());
92849
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
92850
+ range.detach();
92851
+ return rects.reduce(function(textHeight, rect) {
92852
+ return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
92853
+ }, height);
92854
+ }
92855
+ return height;
92660
92856
  }, 0);
92661
92857
  };
92662
92858
  _proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
@@ -92678,10 +92874,25 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92678
92874
  if (!isCardItem(item) || item.property.autoHeight !== true) {
92679
92875
  return;
92680
92876
  }
92681
- if (!Number.isFinite(height) || height <= 0 || Math.abs(height - item.property.height) <= AUTO_HEIGHT_EPSILON) {
92877
+ if (!Number.isFinite(height) || height <= 0) {
92878
+ return;
92879
+ }
92880
+ var nextHeight = Math.ceil(this.getAutoHeightItemHeight(item, height));
92881
+ if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
92682
92882
  return;
92683
92883
  }
92684
- this.options.setCardItemHeight(id, Math.ceil(height));
92884
+ this.options.setCardItemHeight(id, nextHeight);
92885
+ };
92886
+ _proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
92887
+ if (!isCardItem(item) || item.property.autoScale !== false) {
92888
+ return contentHeight;
92889
+ }
92890
+ var scaleOverlay = this.state.contentScaleElements.get(item.id);
92891
+ var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
92892
+ if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
92893
+ return contentHeight;
92894
+ }
92895
+ return contentHeight / displayedHeight * item.property.height;
92685
92896
  };
92686
92897
  return HTMLOverlayManager;
92687
92898
  }();
@@ -93286,6 +93497,9 @@ var SDK = /*#__PURE__*/ function() {
93286
93497
  propertyName: 'height',
93287
93498
  propertyValue: height
93288
93499
  });
93500
+ },
93501
+ resolveCardHTML: function resolveCardHTML(item) {
93502
+ return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
93289
93503
  }
93290
93504
  });
93291
93505
  this._htmlOverlayManager.attach();
@@ -95424,6 +95638,17 @@ var SDK = /*#__PURE__*/ function() {
95424
95638
  });
95425
95639
  };
95426
95640
  /**
95641
+ * @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
95642
+ * @param item 卡片元素
95643
+ * @returns HTML 渲染配置
95644
+ */ _proto.resolveCardHTML = function resolveCardHTML(item) {
95645
+ var _cardTypeConfig_html;
95646
+ var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
95647
+ return t.type === item.cardType;
95648
+ });
95649
+ return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
95650
+ };
95651
+ /**
95427
95652
  * @description 创建卡片元素
95428
95653
  * @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
95429
95654
  * @param createInfo 卡片创建信息
@@ -95710,167 +95935,6 @@ var SDK = /*#__PURE__*/ function() {
95710
95935
  }();
95711
95936
  SDK.config = BaseConfig;
95712
95937
 
95713
- /**
95714
- * @description 卡片元素 SDKItem 类
95715
- * @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
95716
- * @description 支持设置卡片类型(cardType)
95717
- */ var CardItem = /*#__PURE__*/ function(BaseItem) {
95718
- _inherits(CardItem, BaseItem);
95719
- function CardItem(options) {
95720
- var _this;
95721
- var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
95722
- var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5, _SDK_config_itemConfig_cardConfig_cardTypes_, _options_property6, _options_property7;
95723
- _this = BaseItem.call(this, options) || this, /**
95724
- * @description 元素类型
95725
- */ _this.type = SDKItemType.CARD;
95726
- // 初始化属性(包含 cardType)
95727
- _this.property = {
95728
- position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
95729
- 0,
95730
- 0
95731
- ],
95732
- rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
95733
- 0,
95734
- 0,
95735
- 0
95736
- ],
95737
- width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
95738
- height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
95739
- scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
95740
- 1,
95741
- 1
95742
- ],
95743
- 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 : '',
95744
- autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
95745
- html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
95746
- };
95747
- return _this;
95748
- }
95749
- var _proto = CardItem.prototype;
95750
- // ==================== 实现抽象方法 ====================
95751
- /**
95752
- * @description 转换为 CardCreateInfo
95753
- * @param withParent 是否包含父节点ID
95754
- */ _proto.toCreateInfo = function toCreateInfo(withParent) {
95755
- var extension = this.getAllExtension();
95756
- var property = deepClone(this.property);
95757
- property.html = this.html;
95758
- return {
95759
- type: SDKItemType.CARD,
95760
- id: this.id,
95761
- name: this.name,
95762
- parentId: withParent ? this.parentId : undefined,
95763
- extension: Object.keys(extension).length > 0 ? extension : undefined,
95764
- property: property
95765
- };
95766
- };
95767
- /**
95768
- * @description 克隆 SDKItem
95769
- */ _proto.clone = function clone() {
95770
- var property = deepClone(this.property);
95771
- property.html = this.html;
95772
- return new CardItem({
95773
- id: EFFECTS.generateGUID(),
95774
- name: this.name,
95775
- parentId: this.parentId,
95776
- duration: this.duration,
95777
- delay: this.delay,
95778
- endBehavior: this.endBehavior,
95779
- isLocked: this.isLocked,
95780
- isCoreEditable: this.isCoreEditable,
95781
- property: property,
95782
- extension: this.getAllExtension()
95783
- });
95784
- };
95785
- _create_class(CardItem, [
95786
- {
95787
- key: "cardType",
95788
- get: // ==================== cardType 访问器 ====================
95789
- /**
95790
- * @description 卡片类型
95791
- */ function get() {
95792
- return this.property.cardType;
95793
- },
95794
- set: function set(value) {
95795
- this.property.cardType = value;
95796
- }
95797
- },
95798
- {
95799
- key: "html",
95800
- get: /**
95801
- * @description HTML 覆盖层配置
95802
- */ function get() {
95803
- return this.property.html;
95804
- },
95805
- set: function set(value) {
95806
- this.property.html = value;
95807
- }
95808
- },
95809
- {
95810
- key: "position",
95811
- get: // ==================== 便捷访问器 ====================
95812
- /**
95813
- * @description 位置
95814
- */ function get() {
95815
- return this.property.position;
95816
- },
95817
- set: function set(value) {
95818
- this.property.position = value;
95819
- }
95820
- },
95821
- {
95822
- key: "width",
95823
- get: /**
95824
- * @description 宽度
95825
- */ function get() {
95826
- return this.property.width;
95827
- },
95828
- set: function set(value) {
95829
- this.property.width = value;
95830
- }
95831
- },
95832
- {
95833
- key: "height",
95834
- get: /**
95835
- * @description 高度
95836
- */ function get() {
95837
- return this.property.height;
95838
- },
95839
- set: function set(value) {
95840
- this.property.height = value;
95841
- }
95842
- },
95843
- {
95844
- key: "rotation",
95845
- get: /**
95846
- * @description 旋转(二维旋转角度)
95847
- */ function get() {
95848
- return this.property.rotation[2];
95849
- },
95850
- set: function set(value) {
95851
- this.property.rotation[2] = value;
95852
- }
95853
- },
95854
- {
95855
- key: "fullRotation",
95856
- get: /**
95857
- * @description 完整旋转(包含 x, y, z)
95858
- */ function get() {
95859
- return this.property.rotation;
95860
- },
95861
- set: function set(value) {
95862
- this.property.rotation = value;
95863
- }
95864
- }
95865
- ]);
95866
- return CardItem;
95867
- }(BaseItem);
95868
- /**
95869
- * @description 类型守卫:检查是否是 CardItem
95870
- */ function isCardItem(obj) {
95871
- return _instanceof(obj, CardItem);
95872
- }
95873
-
95874
95938
  Object.defineProperty(exports, "generateGUID", {
95875
95939
  enumerable: true,
95876
95940
  get: function () { return EFFECTS.generateGUID; }