@vvfx/sdk 0.2.2-beta.8 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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.8
6
+ * Version: v0.2.2
7
7
  */
8
8
 
9
9
  'use strict';
@@ -24032,9 +24032,21 @@ function getUniqueName(name, names) {
24032
24032
  };
24033
24033
  _create_class(TextItem, [
24034
24034
  {
24035
- key: "text",
24035
+ key: "pixelWidth",
24036
24036
  get: // ==================== 便捷访问器 ====================
24037
- /**
24037
+ function get() {
24038
+ return this.width;
24039
+ }
24040
+ },
24041
+ {
24042
+ key: "pixelHeight",
24043
+ get: function get() {
24044
+ return this.height;
24045
+ }
24046
+ },
24047
+ {
24048
+ key: "text",
24049
+ get: /**
24038
24050
  * @description 文本内容
24039
24051
  */ function get() {
24040
24052
  return this.property.text;
@@ -25172,150 +25184,6 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
25172
25184
  return _instanceof(obj, FrameItem);
25173
25185
  }
25174
25186
 
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;
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
- };
25207
- return _this;
25208
- }
25209
- var _proto = CardItem.prototype;
25210
- // ==================== 实现抽象方法 ====================
25211
- /**
25212
- * @description 转换为 CardCreateInfo
25213
- * @param withParent 是否包含父节点ID
25214
- */ _proto.toCreateInfo = function toCreateInfo(withParent) {
25215
- var extension = this.getAllExtension();
25216
- return {
25217
- type: SDKItemType.CARD,
25218
- id: this.id,
25219
- name: this.name,
25220
- parentId: withParent ? this.parentId : undefined,
25221
- extension: Object.keys(extension).length > 0 ? extension : undefined,
25222
- property: deepClone(this.property)
25223
- };
25224
- };
25225
- /**
25226
- * @description 克隆 SDKItem
25227
- */ _proto.clone = function clone() {
25228
- return new CardItem({
25229
- id: EFFECTS.generateGUID(),
25230
- name: this.name,
25231
- parentId: this.parentId,
25232
- duration: this.duration,
25233
- delay: this.delay,
25234
- endBehavior: this.endBehavior,
25235
- isLocked: this.isLocked,
25236
- isCoreEditable: this.isCoreEditable,
25237
- property: deepClone(this.property),
25238
- extension: this.getAllExtension()
25239
- });
25240
- };
25241
- _create_class(CardItem, [
25242
- {
25243
- key: "cardType",
25244
- get: // ==================== cardType 访问器 ====================
25245
- /**
25246
- * @description 卡片类型
25247
- */ function get() {
25248
- return this.property.cardType;
25249
- },
25250
- set: function set(value) {
25251
- this.property.cardType = value;
25252
- }
25253
- },
25254
- {
25255
- key: "position",
25256
- get: // ==================== 便捷访问器 ====================
25257
- /**
25258
- * @description 位置
25259
- */ function get() {
25260
- return this.property.position;
25261
- },
25262
- set: function set(value) {
25263
- this.property.position = value;
25264
- }
25265
- },
25266
- {
25267
- key: "width",
25268
- get: /**
25269
- * @description 宽度
25270
- */ function get() {
25271
- return this.property.width;
25272
- },
25273
- set: function set(value) {
25274
- this.property.width = value;
25275
- }
25276
- },
25277
- {
25278
- key: "height",
25279
- get: /**
25280
- * @description 高度
25281
- */ function get() {
25282
- return this.property.height;
25283
- },
25284
- set: function set(value) {
25285
- this.property.height = value;
25286
- }
25287
- },
25288
- {
25289
- key: "rotation",
25290
- get: /**
25291
- * @description 旋转(二维旋转角度)
25292
- */ function get() {
25293
- return this.property.rotation[2];
25294
- },
25295
- set: function set(value) {
25296
- this.property.rotation[2] = value;
25297
- }
25298
- },
25299
- {
25300
- key: "fullRotation",
25301
- get: /**
25302
- * @description 完整旋转(包含 x, y, z)
25303
- */ function get() {
25304
- return this.property.rotation;
25305
- },
25306
- set: function set(value) {
25307
- this.property.rotation = value;
25308
- }
25309
- }
25310
- ]);
25311
- return CardItem;
25312
- }(BaseItem);
25313
- /**
25314
- * @description 类型守卫:检查是否是 CardItem
25315
- */ function isCardItem(obj) {
25316
- return _instanceof(obj, CardItem);
25317
- }
25318
-
25319
25187
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
25320
25188
  try {
25321
25189
  var info = gen[key](arg);
@@ -47317,7 +47185,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
47317
47185
  var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
47318
47186
  var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
47319
47187
  var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, regionBoxColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxColor, regionBoxAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxAlpha, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, regionWireframeWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeWidth, regionWireframeColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeColor, regionWireframeAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeAlpha;
47320
- if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty()) && !isCardItem(preSelectedItem)) {
47188
+ if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
47321
47189
  this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
47322
47190
  this.graphics.drawBox(preSelectedItemBox);
47323
47191
  }
@@ -55577,16 +55445,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
55577
55445
  newWidth,
55578
55446
  newHeight
55579
55447
  ], translation1);
55580
- } else if (selectedItem && selectedItems.length === 1 && isCardItem(selectedItem)) {
55581
- void this._pageDataUtils.setItemProperty({
55582
- itemId: selectedItem.id,
55583
- type: SDKItemType.CARD,
55584
- property: {
55585
- width: selectedItem.width * resultScalar1.x,
55586
- height: selectedItem.height * resultScalar1.y
55587
- }
55588
- });
55589
- this._pageDataUtils.moveItem(selectedItem.id, translation1);
55590
55448
  } else {
55591
55449
  // 普通元素的缩放逻辑
55592
55450
  selectedItems.forEach(function(item) {
@@ -55911,7 +55769,6 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
55911
55769
  var selectedItems = this._pageDataUtils.getSelectedItems();
55912
55770
  var isTemplateMode = SDK.config.mode === 'template';
55913
55771
  var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
55914
- var isSingleCardItem = isCardItem(selectedItem);
55915
55772
  var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
55916
55773
  var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
55917
55774
  var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
@@ -55951,11 +55808,9 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
55951
55808
  this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
55952
55809
  // 根据box获取边缘线
55953
55810
  var corners = this.wireframe.box.corners;
55954
- if (!isSingleCardItem) {
55955
- corners.forEach(function(corner, i) {
55956
- _this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
55957
- });
55958
- }
55811
+ corners.forEach(function(corner, i) {
55812
+ _this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
55813
+ });
55959
55814
  var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
55960
55815
  // 成组暂不支持缩放
55961
55816
  if (selectedItems.length === 1) {
@@ -59806,6 +59661,12 @@ var MAX_ITEM_DISTANCE_THRESHOLD = 100000;
59806
59661
  /**
59807
59662
  * @description SDKItem position 属性的数字精度(保留小数位数)
59808
59663
  */ var POSITION_PRECISION = 4;
59664
+ function isCardHTMLContentValue(value) {
59665
+ return (value == null ? void 0 : value.kind) === 'inline' || (value == null ? void 0 : value.kind) === 'dom' || (value == null ? void 0 : value.kind) === 'document';
59666
+ }
59667
+ function isCardHTMLValue(value) {
59668
+ return isCardHTMLContentValue(value == null ? void 0 : value.content);
59669
+ }
59809
59670
  var PageDataUtils = /*#__PURE__*/ function() {
59810
59671
  function PageDataUtils(player, container, emitter, sdk) {
59811
59672
  this.player = player;
@@ -60623,10 +60484,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
60623
60484
  property: property
60624
60485
  }));
60625
60486
  } else if ((existingSDKItem == null ? void 0 : existingSDKItem.type) == SDKItemType.CARD) {
60626
- var cardType = existingSDKItem.cardType;
60487
+ var cardType = existingSDKItem.cardType, html = existingSDKItem.html;
60627
60488
  sdkItem = new CardItem(_extends({}, baseOptions, {
60628
60489
  property: _extends({}, property, {
60629
- cardType: cardType
60490
+ cardType: cardType,
60491
+ html: html
60630
60492
  })
60631
60493
  }));
60632
60494
  } else {
@@ -61210,35 +61072,40 @@ var PageDataUtils = /*#__PURE__*/ function() {
61210
61072
  3,
61211
61073
  31
61212
61074
  ];
61213
- case 'position':
61075
+ case 'html':
61214
61076
  return [
61215
61077
  3,
61216
61078
  32
61217
61079
  ];
61218
- case 'rotation':
61080
+ case 'position':
61219
61081
  return [
61220
61082
  3,
61221
61083
  33
61222
61084
  ];
61223
- case 'scale':
61085
+ case 'rotation':
61224
61086
  return [
61225
61087
  3,
61226
61088
  34
61227
61089
  ];
61228
- case 'layoutMode':
61090
+ case 'scale':
61229
61091
  return [
61230
61092
  3,
61231
61093
  35
61232
61094
  ];
61233
- case 'visible':
61095
+ case 'layoutMode':
61234
61096
  return [
61235
61097
  3,
61236
61098
  36
61237
61099
  ];
61100
+ case 'visible':
61101
+ return [
61102
+ 3,
61103
+ 37
61104
+ ];
61238
61105
  }
61239
61106
  return [
61240
61107
  3,
61241
- 37
61108
+ 38
61242
61109
  ];
61243
61110
  case 1:
61244
61111
  {
@@ -61251,7 +61118,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61251
61118
  }
61252
61119
  return [
61253
61120
  3,
61254
- 38
61121
+ 39
61255
61122
  ];
61256
61123
  }
61257
61124
  case 2:
@@ -61262,7 +61129,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61262
61129
  }
61263
61130
  return [
61264
61131
  3,
61265
- 38
61132
+ 39
61266
61133
  ];
61267
61134
  }
61268
61135
  case 3:
@@ -61294,7 +61161,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61294
61161
  case 5:
61295
61162
  return [
61296
61163
  3,
61297
- 38
61164
+ 39
61298
61165
  ];
61299
61166
  case 6:
61300
61167
  {
@@ -61311,7 +61178,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61311
61178
  }
61312
61179
  return [
61313
61180
  3,
61314
- 38
61181
+ 39
61315
61182
  ];
61316
61183
  }
61317
61184
  case 7:
@@ -61325,7 +61192,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61325
61192
  }
61326
61193
  return [
61327
61194
  3,
61328
- 38
61195
+ 39
61329
61196
  ];
61330
61197
  }
61331
61198
  case 8:
@@ -61338,7 +61205,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61338
61205
  }
61339
61206
  return [
61340
61207
  3,
61341
- 38
61208
+ 39
61342
61209
  ];
61343
61210
  }
61344
61211
  case 9:
@@ -61352,7 +61219,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61352
61219
  }
61353
61220
  return [
61354
61221
  3,
61355
- 38
61222
+ 39
61356
61223
  ];
61357
61224
  }
61358
61225
  case 10:
@@ -61365,7 +61232,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61365
61232
  }
61366
61233
  return [
61367
61234
  3,
61368
- 38
61235
+ 39
61369
61236
  ];
61370
61237
  }
61371
61238
  case 11:
@@ -61378,7 +61245,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61378
61245
  }
61379
61246
  return [
61380
61247
  3,
61381
- 38
61248
+ 39
61382
61249
  ];
61383
61250
  }
61384
61251
  case 12:
@@ -61398,7 +61265,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61398
61265
  }
61399
61266
  return [
61400
61267
  3,
61401
- 38
61268
+ 39
61402
61269
  ];
61403
61270
  }
61404
61271
  case 13:
@@ -61440,7 +61307,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61440
61307
  }
61441
61308
  return [
61442
61309
  3,
61443
- 38
61310
+ 39
61444
61311
  ];
61445
61312
  }
61446
61313
  case 14:
@@ -61475,7 +61342,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61475
61342
  }
61476
61343
  return [
61477
61344
  3,
61478
- 38
61345
+ 39
61479
61346
  ];
61480
61347
  }
61481
61348
  case 15:
@@ -61489,7 +61356,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61489
61356
  }
61490
61357
  return [
61491
61358
  3,
61492
- 38
61359
+ 39
61493
61360
  ];
61494
61361
  }
61495
61362
  case 16:
@@ -61521,7 +61388,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61521
61388
  case 20:
61522
61389
  return [
61523
61390
  3,
61524
- 38
61391
+ 39
61525
61392
  ];
61526
61393
  case 21:
61527
61394
  if (!(typeof propertyValue === 'string' && playerItem.type === EFFECTS.spec.ItemType.video)) return [
@@ -61552,7 +61419,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61552
61419
  case 25:
61553
61420
  return [
61554
61421
  3,
61555
- 38
61422
+ 39
61556
61423
  ];
61557
61424
  case 26:
61558
61425
  if (!(playerItem.type === EFFECTS.spec.ItemType.null)) return [
@@ -61597,7 +61464,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61597
61464
  case 28:
61598
61465
  return [
61599
61466
  3,
61600
- 38
61467
+ 39
61601
61468
  ];
61602
61469
  case 29:
61603
61470
  {
@@ -61609,7 +61476,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61609
61476
  }
61610
61477
  return [
61611
61478
  3,
61612
- 38
61479
+ 39
61613
61480
  ];
61614
61481
  }
61615
61482
  case 30:
@@ -61622,7 +61489,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61622
61489
  }
61623
61490
  return [
61624
61491
  3,
61625
- 38
61492
+ 39
61626
61493
  ];
61627
61494
  }
61628
61495
  case 31:
@@ -61635,10 +61502,20 @@ var PageDataUtils = /*#__PURE__*/ function() {
61635
61502
  }
61636
61503
  return [
61637
61504
  3,
61638
- 38
61505
+ 39
61639
61506
  ];
61640
61507
  }
61641
61508
  case 32:
61509
+ {
61510
+ if (isCardItem(targetItem)) {
61511
+ targetItem.html = isCardHTMLValue(propertyValue) ? propertyValue : undefined;
61512
+ }
61513
+ return [
61514
+ 3,
61515
+ 39
61516
+ ];
61517
+ }
61518
+ case 33:
61642
61519
  {
61643
61520
  if (Array.isArray(propertyValue) && propertyValue.length === 2) {
61644
61521
  pixelTranslation = propertyValue.map(function(v, i) {
@@ -61651,10 +61528,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61651
61528
  }
61652
61529
  return [
61653
61530
  3,
61654
- 38
61531
+ 39
61655
61532
  ];
61656
61533
  }
61657
- case 33:
61534
+ case 34:
61658
61535
  {
61659
61536
  if (Array.isArray(propertyValue) && propertyValue.length === 3) {
61660
61537
  rotation = propertyValue.map(function(v, i) {
@@ -61665,10 +61542,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61665
61542
  }
61666
61543
  return [
61667
61544
  3,
61668
- 38
61545
+ 39
61669
61546
  ];
61670
61547
  }
61671
- case 34:
61548
+ case 35:
61672
61549
  {
61673
61550
  if (Array.isArray(propertyValue) && propertyValue.length === 2) {
61674
61551
  currentScale = targetItem.property.scale;
@@ -61682,10 +61559,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61682
61559
  }
61683
61560
  return [
61684
61561
  3,
61685
- 38
61562
+ 39
61686
61563
  ];
61687
61564
  }
61688
- case 35:
61565
+ case 36:
61689
61566
  {
61690
61567
  if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
61691
61568
  frameComponent = playerItem.getComponent(EFFECTS.FrameComponent);
@@ -61695,10 +61572,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61695
61572
  }
61696
61573
  return [
61697
61574
  3,
61698
- 38
61575
+ 39
61699
61576
  ];
61700
61577
  }
61701
- case 36:
61578
+ case 37:
61702
61579
  {
61703
61580
  if (typeof propertyValue === 'boolean') {
61704
61581
  playerItem.setVisible(propertyValue);
@@ -61711,10 +61588,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61711
61588
  }
61712
61589
  return [
61713
61590
  3,
61714
- 38
61591
+ 39
61715
61592
  ];
61716
61593
  }
61717
- case 37:
61594
+ case 38:
61718
61595
  {
61719
61596
  console.log('ignore property name ', propertyName);
61720
61597
  // 对于未明确处理的属性,尝试直接设置到 property 对象
@@ -61722,8 +61599,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
61722
61599
  targetItem.property[propertyName] = propertyValue;
61723
61600
  }
61724
61601
  }
61725
- _state.label = 38;
61726
- case 38:
61602
+ _state.label = 39;
61603
+ case 39:
61727
61604
  // 非位置属性需要刷新播放器
61728
61605
  // template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
61729
61606
  if (![
@@ -63195,15 +63072,12 @@ var PageDataUtils = /*#__PURE__*/ function() {
63195
63072
  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 ? [
63196
63073
  1,
63197
63074
  1
63198
- ] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? EFFECTS.generateGUID() : _cardInfo_id, extension = cardInfo.extension;
63075
+ ] : _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;
63199
63076
  // 校验 cardType 是否已在配置中注册
63200
- var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
63201
- return t.type === cardType;
63202
- });
63203
63077
  var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
63204
63078
  return t.type;
63205
63079
  });
63206
- if (!cardTypeConfig) {
63080
+ if (!registeredTypes.includes(cardType)) {
63207
63081
  console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
63208
63082
  return;
63209
63083
  }
@@ -63247,7 +63121,9 @@ var PageDataUtils = /*#__PURE__*/ function() {
63247
63121
  width: width,
63248
63122
  height: height,
63249
63123
  scale: [].concat(scale),
63250
- cardType: cardType
63124
+ cardType: cardType,
63125
+ autoHeight: autoHeight,
63126
+ html: html
63251
63127
  },
63252
63128
  extension: extension
63253
63129
  });
@@ -64629,7 +64505,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
64629
64505
  scalar.y
64630
64506
  ],
64631
64507
  rotation: [].concat(rotation),
64632
- position: [].concat(resultPosition)
64508
+ position: [].concat(resultPosition),
64509
+ html: sdkItem.html
64633
64510
  },
64634
64511
  extension: extension
64635
64512
  };
@@ -64714,7 +64591,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
64714
64591
  };
64715
64592
  addTextItemIntoNewScene = function addTextItemIntoNewScene(textCreateInfo, sceneSize, itemViewPosition) {
64716
64593
  var _scene_fonts;
64717
- var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? EFFECTS.generateGUID() : _textCreateInfo_id, _textCreateInfo_name = textCreateInfo.name, name = _textCreateInfo_name === void 0 ? '文本' : _textCreateInfo_name, _textCreateInfo_property = textCreateInfo.property, lineHeight = _textCreateInfo_property.lineHeight, textWidth = _textCreateInfo_property.width, tmp = _textCreateInfo_property.height, textHeight = tmp === void 0 ? lineHeight : tmp, fontFamily = _textCreateInfo_property.fontFamily, fontSize = _textCreateInfo_property.fontSize, _textCreateInfo_property_fontWeight = _textCreateInfo_property.fontWeight, fontWeight = _textCreateInfo_property_fontWeight === void 0 ? EFFECTS.spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? EFFECTS.spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? EFFECTS.spec.TextAlignment.left : _textCreateInfo_property_textAlign, text = _textCreateInfo_property.text, textColor = _textCreateInfo_property.color, tmp1 = _textCreateInfo_property.rotation, sourceRotation = tmp1 === void 0 ? 0 : tmp1, url = _textCreateInfo_property.fontUrl, outlineColor = _textCreateInfo_property.outlineColor, outlineWidth = _textCreateInfo_property.outlineWidth, outlineEnabled = _textCreateInfo_property.outlineEnabled;
64594
+ var _textCreateInfo_id = textCreateInfo.id, id = _textCreateInfo_id === void 0 ? EFFECTS.generateGUID() : _textCreateInfo_id, _textCreateInfo_name = textCreateInfo.name, name = _textCreateInfo_name === void 0 ? '文本' : _textCreateInfo_name, _textCreateInfo_property = textCreateInfo.property, lineHeight = _textCreateInfo_property.lineHeight, textWidth = _textCreateInfo_property.width, tmp = _textCreateInfo_property.height, textHeight = tmp === void 0 ? lineHeight : tmp, fontFamily = _textCreateInfo_property.fontFamily, fontSize = _textCreateInfo_property.fontSize, _textCreateInfo_property_fontWeight = _textCreateInfo_property.fontWeight, fontWeight = _textCreateInfo_property_fontWeight === void 0 ? EFFECTS.spec.TextWeight.normal : _textCreateInfo_property_fontWeight, _textCreateInfo_property_fontStyle = _textCreateInfo_property.fontStyle, fontStyle = _textCreateInfo_property_fontStyle === void 0 ? EFFECTS.spec.FontStyle.normal : _textCreateInfo_property_fontStyle, _textCreateInfo_property_textAlign = _textCreateInfo_property.textAlign, textAlign = _textCreateInfo_property_textAlign === void 0 ? EFFECTS.spec.TextAlignment.left : _textCreateInfo_property_textAlign, text = _textCreateInfo_property.text, textColor = _textCreateInfo_property.color, tmp1 = _textCreateInfo_property.rotation, sourceRotation = tmp1 === void 0 ? 0 : tmp1, url = _textCreateInfo_property.fontUrl, outlineColor = _textCreateInfo_property.outlineColor, outlineWidth = _textCreateInfo_property.outlineWidth, outlineEnabled = _textCreateInfo_property.outlineEnabled, letterSpacing = _textCreateInfo_property.letterSpacing;
64718
64595
  var rotation = Array.isArray(sourceRotation) ? [].concat(sourceRotation) : [
64719
64596
  0,
64720
64597
  0,
@@ -64744,7 +64621,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
64744
64621
  fontSize: fontSize,
64745
64622
  textColor: resutlTextColor,
64746
64623
  fontWeight: fontWeight,
64747
- letterSpace: 0,
64624
+ letterSpace: letterSpacing,
64748
64625
  textAlign: textAlign,
64749
64626
  fontStyle: fontStyle,
64750
64627
  textWidth: textWidth,
@@ -66013,56 +65890,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
66013
65890
  };
66014
65891
  _proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
66015
65892
  return _async_to_generator(function() {
66016
- var _loop, _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
65893
+ var _this, createInfoWithIds, itemToTextureInfo, _iterator, _step, createInfo, id, type, url, textureId, toAddedCreateInfo, groupCreateInfos, frameCreateInfos, ids, composition, loadTexture;
66017
65894
  return _ts_generator(this, function(_state) {
66018
65895
  switch(_state.label){
66019
65896
  case 0:
66020
- _loop = function() {
66021
- var createInfo = _step.value;
66022
- var _ref = function() {
66023
- switch(createInfo.type){
66024
- case SDKItemType.SPRITE:
66025
- {
66026
- return {
66027
- url: createInfo.property.image,
66028
- type: 'image'
66029
- };
66030
- }
66031
- case SDKItemType.VIDEO:
66032
- {
66033
- return {
66034
- url: createInfo.property.video,
66035
- type: 'video'
66036
- };
66037
- }
66038
- default:
66039
- {
66040
- return {};
66041
- }
66042
- }
66043
- }(), url = _ref.url, type = _ref.type;
66044
- if (url && type) {
66045
- var textureId = EFFECTS.generateGUID();
66046
- itemToTextureInfo.set(createInfo.id, {
65897
+ _this = this;
65898
+ createInfoWithIds = createInfos.map(function(createInfo) {
65899
+ return Object.assign({}, createInfo, createInfo.id ? {} : {
65900
+ id: EFFECTS.generateGUID()
65901
+ });
65902
+ });
65903
+ itemToTextureInfo = new Map();
65904
+ // 预处理所有 createInfo,分配 textureId
65905
+ for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;){
65906
+ createInfo = _step.value;
65907
+ id = createInfo.id;
65908
+ type = createInfo.type;
65909
+ url = type === SDKItemType.SPRITE ? createInfo.property.image : type === SDKItemType.VIDEO ? createInfo.property.video : undefined;
65910
+ if ((type === SDKItemType.SPRITE || type === SDKItemType.VIDEO) && url) {
65911
+ textureId = EFFECTS.generateGUID();
65912
+ itemToTextureInfo.set(id, {
66047
65913
  id: textureId,
66048
65914
  url: url,
66049
- type: type
65915
+ type: type === SDKItemType.SPRITE ? 'image' : 'video'
66050
65916
  });
66051
65917
  Object.assign(createInfo, {
66052
65918
  textureId: textureId
66053
65919
  });
66054
65920
  }
66055
- };
66056
- _this = this;
66057
- createInfoWithIds = createInfos.map(function(createInfo) {
66058
- var _createInfo_id;
66059
- return Object.assign({}, createInfo, {
66060
- id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : EFFECTS.generateGUID()
66061
- });
66062
- });
66063
- itemToTextureInfo = new Map();
66064
- // 预处理所有 createInfo,分配 textureId
66065
- for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
65921
+ }
66066
65922
  // 并行创建所有 item
66067
65923
  toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
66068
65924
  return ![
@@ -83235,12 +83091,43 @@ var BaseConfig = {
83235
83091
  },
83236
83092
  cardConfig: {
83237
83093
  backgroundColor: [
83238
- 1,
83239
- 1,
83240
- 1,
83241
- 0
83094
+ 0.6,
83095
+ 0.6,
83096
+ 0.6,
83097
+ 0.12
83242
83098
  ],
83243
- cardTypes: []
83099
+ cardTypes: [
83100
+ {
83101
+ type: 'character',
83102
+ label: '角色图',
83103
+ iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83104
+ },
83105
+ {
83106
+ type: 'environment',
83107
+ label: '环境图',
83108
+ iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83109
+ },
83110
+ {
83111
+ type: 'storyboard',
83112
+ label: '分镜图',
83113
+ iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83114
+ },
83115
+ {
83116
+ type: 'scene-clip',
83117
+ label: '场景剪辑',
83118
+ iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83119
+ },
83120
+ {
83121
+ type: 'video-compose',
83122
+ label: '视频合成',
83123
+ iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83124
+ },
83125
+ {
83126
+ type: 'video-generate',
83127
+ label: '生成视频',
83128
+ iconUrl: 'https://mdn.alipayobjects.com/huamei_ixsp8m/afts/img/A*F2wVS7x0MfIAAAAAQBAAAAgAev-aAQ/original'
83129
+ }
83130
+ ]
83244
83131
  }
83245
83132
  }
83246
83133
  };
@@ -91569,18 +91456,11 @@ function isCardHTMLAutoHeightMessage(data, id) {
91569
91456
  var message = data;
91570
91457
  return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
91571
91458
  }
91572
- function requestCardHTMLAutoHeight(iframe, id) {
91573
- var _iframe_contentWindow;
91574
- (_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
91575
- source: 'vvfx-card-html-auto-height-request',
91576
- id: id
91577
- }, '*');
91578
- }
91579
91459
  function withCardHTMLAutoHeightBridge(html, id) {
91580
91460
  if (!id) {
91581
91461
  return html;
91582
91462
  }
91583
- 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>";
91463
+ 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>";
91584
91464
  if (/<\/body>/i.test(html)) {
91585
91465
  return html.replace(/<\/body>/i, "" + script + "</body>");
91586
91466
  }
@@ -91853,38 +91733,30 @@ function syncElementStackOrder(_container, elements) {
91853
91733
  });
91854
91734
  }
91855
91735
 
91856
- function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, _autoScale) {
91736
+ function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
91857
91737
  if (offsetX === void 0) offsetX = 0;
91858
91738
  if (offsetY === void 0) offsetY = 0;
91859
91739
  if (box.corners.length === 4 && width > 0 && height > 0) {
91860
91740
  var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
91861
- var contentWidth = width;
91862
- var contentHeight = height;
91863
- var a = (rightTop.x - leftTop.x) / contentWidth;
91864
- var b = (rightTop.y - leftTop.y) / contentWidth;
91865
- var c = (leftBottom.x - leftTop.x) / contentHeight;
91866
- var d = (leftBottom.y - leftTop.y) / contentHeight;
91741
+ var a = (rightTop.x - leftTop.x) / width;
91742
+ var b = (rightTop.y - leftTop.y) / width;
91743
+ var c = (leftBottom.x - leftTop.x) / height;
91744
+ var d = (leftBottom.y - leftTop.y) / height;
91867
91745
  var e = leftTop.x - offsetX;
91868
91746
  var f = leftTop.y - offsetY;
91869
91747
  return {
91870
91748
  left: '0px',
91871
91749
  top: '0px',
91872
- width: "" + formatPixelNumber(contentWidth) + "px",
91873
- height: "" + formatPixelNumber(contentHeight) + "px",
91874
- contentWidth: contentWidth,
91875
- contentHeight: contentHeight,
91750
+ width: "" + width + "px",
91751
+ height: "" + height + "px",
91876
91752
  transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
91877
91753
  };
91878
91754
  }
91879
- var contentWidth1 = box.max.x - box.min.x;
91880
- var contentHeight1 = box.max.y - box.min.y;
91881
91755
  return {
91882
91756
  left: "" + (box.min.x - offsetX) + "px",
91883
91757
  top: "" + (box.min.y - offsetY) + "px",
91884
- width: "" + contentWidth1 + "px",
91885
- height: "" + contentHeight1 + "px",
91886
- contentWidth: contentWidth1,
91887
- contentHeight: contentHeight1,
91758
+ width: "" + (box.max.x - box.min.x) + "px",
91759
+ height: "" + (box.max.y - box.min.y) + "px",
91888
91760
  transform: ''
91889
91761
  };
91890
91762
  }
@@ -91907,10 +91779,6 @@ function formatMatrixNumber(value) {
91907
91779
  var normalized = Object.is(value, -0) ? 0 : value;
91908
91780
  return Number(normalized.toFixed(6)).toString();
91909
91781
  }
91910
- function formatPixelNumber(value) {
91911
- var normalized = Object.is(value, -0) ? 0 : value;
91912
- return Number(normalized.toFixed(6)).toString();
91913
- }
91914
91782
 
91915
91783
  function mountHTMLShell(container, content, shell) {
91916
91784
  if (!shell) {
@@ -91931,26 +91799,6 @@ function mountHTMLShell(container, content, shell) {
91931
91799
 
91932
91800
  var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
91933
91801
  var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
91934
- var CONTENT_INTERACTIVE_SELECTOR = [
91935
- '[data-vvfx-html-interaction-zone="self"]',
91936
- '[data-vvfx-html-interaction-zone="subtree"]',
91937
- 'a[href]',
91938
- 'button:not([disabled])',
91939
- 'input:not([disabled])',
91940
- 'textarea:not([disabled])',
91941
- 'select:not([disabled])',
91942
- 'summary',
91943
- 'video[controls]',
91944
- 'audio[controls]',
91945
- '[contenteditable]:not([contenteditable="false"])',
91946
- '[role="button"]',
91947
- '[role="link"]',
91948
- '[role="textbox"]',
91949
- '[tabindex]:not([tabindex="-1"])'
91950
- ].join(', ');
91951
- var CONTENT_INTERACTION_NONE_SELECTOR = [
91952
- '[data-vvfx-html-interaction-zone="none"]'
91953
- ].join(', ');
91954
91802
  var EDITING_VIEWPORT_PADDING = 48;
91955
91803
  var EDITING_VIEWPORT_BOX_SCALE = 1.1;
91956
91804
  var AUTO_HEIGHT_EPSILON = 0.5;
@@ -91960,20 +91808,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
91960
91808
  var _this = this;
91961
91809
  this.options = options;
91962
91810
  this.eventCleanups = [];
91963
- this.htmlRootConfigCleanups = new WeakMap();
91964
91811
  this.state = {
91965
91812
  frameElements: new Map(),
91966
91813
  elements: new Map(),
91967
- selectionElements: new Map(),
91968
91814
  contentScaleElements: new Map(),
91969
91815
  contentElements: new Map(),
91970
91816
  contentMountElements: new Map(),
91971
- contentInteractionZones: new Map(),
91972
- contentInteractionZoneCleanups: new Map(),
91973
- contentInteractionResizeCleanups: new Map(),
91974
91817
  contents: new Map(),
91975
91818
  cleanups: new Map(),
91976
- autoHeightModes: new Map(),
91977
91819
  autoHeightCleanups: new Map(),
91978
91820
  autoHeightFrames: new Map()
91979
91821
  };
@@ -91990,9 +91832,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
91990
91832
  }
91991
91833
  return;
91992
91834
  }
91993
- if (!_this.isEditableCard(targetId)) {
91994
- return;
91995
- }
91996
91835
  event.preventDefault();
91997
91836
  event.stopPropagation();
91998
91837
  _this.enterEditing(targetId);
@@ -92008,7 +91847,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92008
91847
  _this.exitEditing();
92009
91848
  };
92010
91849
  this.handleContainerMouseMove = function(event) {
92011
- _this.scheduleActiveContentInteractionSync(event);
92012
91850
  var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
92013
91851
  if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
92014
91852
  return;
@@ -92022,16 +91860,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92022
91860
  _this.syncContentInteraction(hoverShellInteractiveId);
92023
91861
  }
92024
91862
  };
92025
- this.handleContainerMouseLeave = function(event) {
92026
- if (_this.isMouseLeaveWithinContainer(event)) {
92027
- return;
92028
- }
92029
- if (_this.contentInteractionFrame !== undefined) {
92030
- cancelAnimationFrame(_this.contentInteractionFrame);
92031
- _this.contentInteractionFrame = undefined;
92032
- }
92033
- _this.pendingContentInteractionEvent = undefined;
92034
- _this.setActiveContentInteraction(undefined);
91863
+ this.handleContainerMouseLeave = function() {
92035
91864
  var previousId = _this.state.hoverShellInteractiveId;
92036
91865
  if (!previousId) {
92037
91866
  return;
@@ -92039,33 +91868,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92039
91868
  _this.state.hoverShellInteractiveId = undefined;
92040
91869
  _this.syncContentInteraction(previousId);
92041
91870
  };
92042
- this.handleContainerContextMenu = function(event) {
92043
- var activeInteraction = _this.state.activeContentInteraction;
92044
- if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
92045
- return;
92046
- }
92047
- var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
92048
- if (!canvas) {
92049
- return;
92050
- }
92051
- event.preventDefault();
92052
- event.stopPropagation();
92053
- _this.setActiveContentInteraction(undefined);
92054
- canvas.dispatchEvent(new MouseEvent('contextmenu', {
92055
- bubbles: true,
92056
- cancelable: true,
92057
- clientX: event.clientX,
92058
- clientY: event.clientY,
92059
- screenX: event.screenX,
92060
- screenY: event.screenY,
92061
- button: event.button,
92062
- buttons: event.buttons,
92063
- ctrlKey: event.ctrlKey,
92064
- shiftKey: event.shiftKey,
92065
- altKey: event.altKey,
92066
- metaKey: event.metaKey
92067
- }));
92068
- };
92069
91871
  this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
92070
91872
  }
92071
91873
  var _proto = HTMLOverlayManager.prototype;
@@ -92079,6 +91881,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92079
91881
  layer.style.position = 'absolute';
92080
91882
  layer.style.inset = '0';
92081
91883
  layer.style.pointerEvents = 'none';
91884
+ layer.style.zIndex = '1';
92082
91885
  container.appendChild(layer);
92083
91886
  this.state.layer = layer;
92084
91887
  this.initDOMEvents();
@@ -92091,32 +91894,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92091
91894
  cancelAnimationFrame(this.state.updateFrame);
92092
91895
  this.state.updateFrame = undefined;
92093
91896
  }
92094
- if (this.contentInteractionFrame !== undefined) {
92095
- cancelAnimationFrame(this.contentInteractionFrame);
92096
- this.contentInteractionFrame = undefined;
92097
- }
92098
- this.pendingContentInteractionEvent = undefined;
92099
91897
  this.state.cleanups.forEach(function(cleanup) {
92100
91898
  cleanup();
92101
91899
  });
92102
91900
  this.state.frameElements.clear();
92103
91901
  this.state.elements.clear();
92104
- this.state.selectionElements.clear();
92105
91902
  this.state.contentScaleElements.clear();
92106
91903
  this.state.contentElements.clear();
92107
91904
  this.state.contentMountElements.clear();
92108
- this.state.contentInteractionZones.clear();
92109
- this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
92110
- cleanup();
92111
- });
92112
- this.state.contentInteractionZoneCleanups.clear();
92113
- this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
92114
- cleanup();
92115
- });
92116
- this.state.contentInteractionResizeCleanups.clear();
92117
91905
  this.state.contents.clear();
92118
91906
  this.state.cleanups.clear();
92119
- this.state.autoHeightModes.clear();
92120
91907
  this.state.autoHeightCleanups.forEach(function(cleanup) {
92121
91908
  cleanup();
92122
91909
  });
@@ -92131,12 +91918,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92131
91918
  this.eventCleanups = [];
92132
91919
  (_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
92133
91920
  this.state.layer = undefined;
92134
- this.state.selectionLayer = undefined;
92135
91921
  this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
92136
91922
  this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
92137
91923
  this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
92138
91924
  this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
92139
- this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
92140
91925
  };
92141
91926
  _proto.scheduleRender = function scheduleRender() {
92142
91927
  var _this = this;
@@ -92148,10 +91933,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92148
91933
  _this.render();
92149
91934
  });
92150
91935
  };
92151
- _proto.invalidateCardHTML = function invalidateCardHTML(id) {
92152
- this.cleanupOverlayContent(id);
92153
- this.invalidateContentInteractionZones(id);
92154
- };
92155
91936
  _proto.rasterizeCard = function rasterizeCard(id, options) {
92156
91937
  return _async_to_generator(function() {
92157
91938
  var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
@@ -92244,7 +92025,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92244
92025
  var events = [
92245
92026
  'pageDataChange',
92246
92027
  'selectedItemChange',
92247
- 'preSelectedItemChange',
92248
92028
  'itemPropertyChange',
92249
92029
  'viewportTransform',
92250
92030
  'viewRebuildFinish'
@@ -92254,7 +92034,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92254
92034
  if (event === 'viewportTransform') {
92255
92035
  _this.handleViewportTransform();
92256
92036
  }
92257
- _this.invalidateContentInteractionZones();
92258
92037
  _this.scheduleRender();
92259
92038
  });
92260
92039
  });
@@ -92264,24 +92043,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92264
92043
  this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
92265
92044
  this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
92266
92045
  this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
92267
- this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
92268
- };
92269
- _proto.isMouseLeaveWithinContainer = function isMouseLeaveWithinContainer(event) {
92270
- var relatedTarget = event.relatedTarget;
92271
- if (!relatedTarget) {
92272
- return false;
92273
- }
92274
- try {
92275
- return this.options.container.contains(relatedTarget);
92276
- } catch (unused) {
92277
- return false;
92278
- }
92279
- };
92280
- _proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
92281
- if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
92282
- return false;
92283
- }
92284
- return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
92285
92046
  };
92286
92047
  _proto.handleViewportTransform = function handleViewportTransform() {
92287
92048
  var editing = this.state.editing;
@@ -92301,16 +92062,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92301
92062
  }
92302
92063
  var items = this.options.getItems();
92303
92064
  var frameByChildId = this.renderFrameOverlays(items, layer);
92304
- var selectionLayer = this.getOrCreateSelectionLayer(layer);
92305
92065
  var visibleCardIds = new Set();
92306
92066
  var editingVisible = false;
92307
92067
  items.forEach(function(item) {
92308
92068
  var _this_state_editing;
92309
- if (!isCardItem(item) || !item.visible) {
92310
- return;
92311
- }
92312
- var html = _this.options.resolveCardHTML(item);
92313
- if (html === undefined) {
92069
+ if (!isCardItem(item) || !item.visible || item.html === undefined) {
92314
92070
  return;
92315
92071
  }
92316
92072
  var itemBox = _this.options.getViewBoxById(item.id);
@@ -92325,31 +92081,21 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92325
92081
  var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
92326
92082
  var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
92327
92083
  var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
92328
- var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
92329
- if (!_this.state.contents.has(item.id)) {
92084
+ var html = item.html;
92085
+ if (html && _this.state.contents.get(item.id) !== html) {
92330
92086
  _this.renderOverlayHTML(item.id, contentOverlay, html);
92331
92087
  }
92332
- _this.applyHTMLRootConfig(overlay, html);
92333
92088
  var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
92334
92089
  var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
92335
- var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
92090
+ var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY);
92336
92091
  overlay.style.left = boxStyle.left;
92337
92092
  overlay.style.top = boxStyle.top;
92338
92093
  overlay.style.width = boxStyle.width;
92339
92094
  overlay.style.height = boxStyle.height;
92340
92095
  overlay.style.transform = boxStyle.transform;
92341
92096
  overlay.style.transformOrigin = '0 0';
92342
- var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
92343
- selectionOverlay.style.left = selectionBoxStyle.left;
92344
- selectionOverlay.style.top = selectionBoxStyle.top;
92345
- selectionOverlay.style.width = selectionBoxStyle.width;
92346
- selectionOverlay.style.height = selectionBoxStyle.height;
92347
- selectionOverlay.style.transform = selectionBoxStyle.transform;
92348
- selectionOverlay.style.transformOrigin = '0 0';
92349
- _this.applyHTMLRootConfig(selectionOverlay, html);
92350
- _this.syncOverlaySelection(item.id, overlay, selectionOverlay);
92351
- _this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
92352
- _this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
92097
+ _this.syncContentScale(item.id, item.property.width, item.property.height);
92098
+ _this.syncAutoHeight(item.id, item.property.autoHeight === true);
92353
92099
  _this.syncContentInteraction(item.id);
92354
92100
  });
92355
92101
  elements.forEach(function(_overlay, id) {
@@ -92388,9 +92134,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92388
92134
  }
92389
92135
  }
92390
92136
  syncElementStackOrder(layer, rootElements);
92391
- if (this.state.selectionLayer) {
92392
- this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
92393
- }
92394
92137
  this.state.frameElements.forEach(function(frameOverlay, frameId) {
92395
92138
  var frameElements = [];
92396
92139
  for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
@@ -92406,28 +92149,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92406
92149
  syncElementStackOrder(frameOverlay, frameElements);
92407
92150
  });
92408
92151
  };
92409
- _proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
92410
- var _layer_ownerDocument;
92411
- if (this.state.selectionLayer) {
92412
- if (this.state.selectionLayer.parentElement !== layer) {
92413
- layer.appendChild(this.state.selectionLayer);
92414
- }
92415
- return this.state.selectionLayer;
92416
- }
92417
- var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
92418
- if (!ownerDocument) {
92419
- return layer;
92420
- }
92421
- var selectionLayer = ownerDocument.createElement('div');
92422
- selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
92423
- selectionLayer.style.position = 'absolute';
92424
- selectionLayer.style.inset = '0';
92425
- selectionLayer.style.pointerEvents = 'none';
92426
- selectionLayer.style.zIndex = '1';
92427
- layer.appendChild(selectionLayer);
92428
- this.state.selectionLayer = selectionLayer;
92429
- return selectionLayer;
92430
- };
92431
92152
  _proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
92432
92153
  var _this = this;
92433
92154
  var visibleFrameIds = new Set();
@@ -92492,41 +92213,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92492
92213
  elements.set(id, overlay);
92493
92214
  return overlay;
92494
92215
  };
92495
- _proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
92496
- var selectionOverlay = this.state.selectionElements.get(id);
92497
- if (selectionOverlay) {
92498
- if (selectionOverlay.parentElement !== parent) {
92499
- parent.appendChild(selectionOverlay);
92500
- }
92501
- return selectionOverlay;
92502
- }
92503
- selectionOverlay = document.createElement('div');
92504
- selectionOverlay.className = 'vvfx-card-html-overlay-selection';
92505
- selectionOverlay.dataset.itemId = id;
92506
- selectionOverlay.style.position = 'absolute';
92507
- selectionOverlay.style.pointerEvents = 'none';
92508
- selectionOverlay.style.zIndex = '1';
92509
- parent.appendChild(selectionOverlay);
92510
- this.state.selectionElements.set(id, selectionOverlay);
92511
- return selectionOverlay;
92512
- };
92513
- _proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
92514
- var isSelected = this.options.getSelectedItemIds().includes(id);
92515
- var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
92516
- overlay.dataset.selected = isSelected ? 'true' : 'false';
92517
- overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
92518
- selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
92519
- selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
92520
- selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
92521
- };
92522
- _proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
92523
- var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
92524
- return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
92525
- };
92526
- _proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
92527
- var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
92528
- return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
92529
- };
92530
92216
  _proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
92531
92217
  var layer = this.state.layer;
92532
92218
  if (!layer) {
@@ -92536,7 +92222,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92536
92222
  var items = this.options.getItems();
92537
92223
  for(var i = items.length - 1; i >= 0; i--){
92538
92224
  var item = items[i];
92539
- if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
92225
+ if (!isCardItem(item) || !item.visible || item.html === undefined) {
92540
92226
  continue;
92541
92227
  }
92542
92228
  var box = this.options.getViewBoxById(item.id);
@@ -92555,7 +92241,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92555
92241
  var items = this.options.getItems();
92556
92242
  for(var i = items.length - 1; i >= 0; i--){
92557
92243
  var item = items[i];
92558
- if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
92244
+ if (!isCardItem(item) || !item.visible || item.html === undefined) {
92559
92245
  continue;
92560
92246
  }
92561
92247
  var box = this.options.getViewBoxById(item.id);
@@ -92565,206 +92251,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92565
92251
  var contentOverlay = this.state.contentElements.get(item.id);
92566
92252
  var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
92567
92253
  var isHoveringShellInteractive = interactiveElements.some(function(element) {
92568
- return isMouseEventInsideRect(event, element.getBoundingClientRect());
92254
+ var rect = element.getBoundingClientRect();
92255
+ return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
92569
92256
  });
92570
92257
  return isHoveringShellInteractive ? item.id : undefined;
92571
92258
  }
92572
92259
  return undefined;
92573
92260
  };
92574
- _proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
92575
- var decision = this.resolveHTMLInteractionTarget(event);
92576
- if (decision.kind === 'canvas' && this.shouldKeepActiveContentInteractionForFocusedElement()) {
92577
- return;
92578
- }
92579
- this.setActiveContentInteraction(decision.kind === 'html' ? decision.interaction : undefined);
92580
- };
92581
- _proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
92582
- var _this = this;
92583
- if (typeof requestAnimationFrame !== 'function') {
92584
- this.syncActiveContentInteraction(event);
92585
- return;
92586
- }
92587
- this.pendingContentInteractionEvent = event;
92588
- if (this.contentInteractionFrame !== undefined) {
92589
- return;
92590
- }
92591
- this.contentInteractionFrame = requestAnimationFrame(function() {
92592
- _this.contentInteractionFrame = undefined;
92593
- var pendingEvent = _this.pendingContentInteractionEvent;
92594
- _this.pendingContentInteractionEvent = undefined;
92595
- if (pendingEvent) {
92596
- _this.syncActiveContentInteraction(pendingEvent);
92597
- }
92598
- });
92599
- };
92600
- _proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
92601
- var _this = this;
92602
- var previous = this.state.activeContentInteraction;
92603
- if ((previous == null ? void 0 : previous.id) === (zone == null ? void 0 : zone.id) && (previous == null ? void 0 : previous.element) === (zone == null ? void 0 : zone.element) && (previous == null ? void 0 : previous.zone) === (zone == null ? void 0 : zone.zone)) {
92604
- return;
92605
- }
92606
- this.state.activeContentInteraction = zone;
92607
- var changedIds = new Set();
92608
- if (previous) {
92609
- changedIds.add(previous.id);
92610
- }
92611
- if (zone) {
92612
- changedIds.add(zone.id);
92613
- }
92614
- changedIds.forEach(function(id) {
92615
- _this.syncContentInteraction(id);
92616
- });
92617
- };
92618
- _proto.shouldKeepActiveContentInteractionForFocusedElement = function shouldKeepActiveContentInteractionForFocusedElement() {
92619
- var activeInteraction = this.state.activeContentInteraction;
92620
- if (!activeInteraction || typeof document === 'undefined') {
92621
- return false;
92622
- }
92623
- var activeElement = document.activeElement;
92624
- if (!activeElement || activeElement === document.body) {
92625
- return false;
92626
- }
92627
- var interactionElement = activeInteraction.element;
92628
- return interactionElement === activeElement || typeof interactionElement.contains === 'function' && interactionElement.contains(activeElement);
92629
- };
92630
- _proto.resolveHTMLInteractionTarget = function resolveHTMLInteractionTarget(event) {
92631
- var id = this.getHTMLCardIdByEvent(event);
92632
- if (!id || this.isEditableCard(id)) {
92633
- return {
92634
- kind: 'canvas',
92635
- id: id
92636
- };
92637
- }
92638
- var contentOverlay = this.state.contentElements.get(id);
92639
- if (!contentOverlay) {
92640
- return {
92641
- kind: 'canvas',
92642
- id: id
92643
- };
92644
- }
92645
- var activeSubtree = this.getActiveSubtreeInteractionAtEvent(id, event);
92646
- if (activeSubtree) {
92647
- return {
92648
- kind: 'html',
92649
- interaction: activeSubtree
92650
- };
92651
- }
92652
- var matchedZones = this.getContentInteractionZones(id, contentOverlay).filter(function(zone) {
92653
- return isMouseEventInsideRect(event, zone.rect);
92654
- });
92655
- var zone = this.resolveContentInteractionZone(matchedZones);
92656
- if (zone) {
92657
- return {
92658
- kind: 'html',
92659
- interaction: {
92660
- id: id,
92661
- element: zone.element,
92662
- zone: zone.zone
92663
- }
92664
- };
92665
- }
92666
- return {
92667
- kind: 'canvas',
92668
- id: id
92669
- };
92670
- };
92671
- _proto.getActiveSubtreeInteractionAtEvent = function getActiveSubtreeInteractionAtEvent(id, event) {
92672
- var activeInteraction = this.state.activeContentInteraction;
92673
- if ((activeInteraction == null ? void 0 : activeInteraction.id) !== id || activeInteraction.zone !== 'subtree') {
92674
- return undefined;
92675
- }
92676
- var rect = activeInteraction.element.getBoundingClientRect();
92677
- return isMouseEventInsideRect(event, rect) ? activeInteraction : undefined;
92678
- };
92679
- _proto.resolveContentInteractionZone = function resolveContentInteractionZone(zones) {
92680
- if (zones.length <= 1) {
92681
- return zones[0];
92682
- }
92683
- var subtreeRoot = zones.find(function(candidate) {
92684
- return candidate.zone === 'subtree' && typeof candidate.element.contains === 'function' && zones.some(function(zone) {
92685
- return zone.element !== candidate.element && candidate.element.contains(zone.element);
92686
- });
92687
- });
92688
- return subtreeRoot != null ? subtreeRoot : zones[0];
92689
- };
92690
- _proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
92691
- var _this = this;
92692
- var cachedZones = this.state.contentInteractionZones.get(id);
92693
- if (cachedZones) {
92694
- return cachedZones;
92695
- }
92696
- var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
92697
- return !_this.isContentInteractionDisabled(element);
92698
- }).map(function(element) {
92699
- return {
92700
- element: element,
92701
- rect: element.getBoundingClientRect(),
92702
- zone: _this.getContentInteractionZoneMode(element)
92703
- };
92704
- });
92705
- this.state.contentInteractionZones.set(id, zones);
92706
- this.observeContentInteractionZoneResizes(id, zones);
92707
- return zones;
92708
- };
92709
- _proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
92710
- var _ref;
92711
- var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
92712
- var item = this.options.getItems().find(function(item) {
92713
- return item.id === id;
92714
- });
92715
- if (!item) {
92716
- return CONTENT_INTERACTIVE_SELECTOR;
92717
- }
92718
- var selectors = (_ref = (_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : (_this_options_resolveCardTypeConfig_htmlInteractionSelectors = _this_options_resolveCardTypeConfig.htmlInteractionSelectors) == null ? void 0 : _this_options_resolveCardTypeConfig_htmlInteractionSelectors.filter(Boolean)) != null ? _ref : [];
92719
- if (selectors.length === 0) {
92720
- return CONTENT_INTERACTIVE_SELECTOR;
92721
- }
92722
- return [].concat([
92723
- CONTENT_INTERACTIVE_SELECTOR
92724
- ], selectors).join(', ');
92725
- };
92726
- _proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
92727
- if (typeof element.closest !== 'function') {
92728
- return false;
92729
- }
92730
- return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
92731
- };
92732
- _proto.getContentInteractionZoneMode = function getContentInteractionZoneMode(element) {
92733
- var zone = element.dataset.vvfxHtmlInteractionZone;
92734
- return zone === 'subtree' ? 'subtree' : 'self';
92735
- };
92736
- _proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
92737
- if (id) {
92738
- var _this_state_contentInteractionResizeCleanups_get;
92739
- this.state.contentInteractionZones.delete(id);
92740
- (_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
92741
- this.state.contentInteractionResizeCleanups.delete(id);
92742
- return;
92743
- }
92744
- this.state.contentInteractionZones.clear();
92745
- this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
92746
- cleanup();
92747
- });
92748
- this.state.contentInteractionResizeCleanups.clear();
92749
- };
92750
- _proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
92751
- var _this = this;
92752
- var _this_state_contentInteractionResizeCleanups_get;
92753
- (_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
92754
- this.state.contentInteractionResizeCleanups.delete(id);
92755
- if (zones.length === 0 || typeof ResizeObserver !== 'function') {
92756
- return;
92757
- }
92758
- var observer = new ResizeObserver(function() {
92759
- _this.invalidateContentInteractionZones(id);
92760
- });
92761
- zones.forEach(function(zone) {
92762
- observer.observe(zone.element);
92763
- });
92764
- this.state.contentInteractionResizeCleanups.set(id, function() {
92765
- observer.disconnect();
92766
- });
92767
- };
92768
92261
  _proto.getLayerPoint = function getLayerPoint(event) {
92769
92262
  var rect = this.options.container.getBoundingClientRect();
92770
92263
  return {
@@ -92821,35 +92314,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92821
92314
  if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
92822
92315
  return;
92823
92316
  }
92824
- var nextWidth = "" + width + "px";
92825
- var nextHeight = "" + height + "px";
92826
- var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
92827
- scaleOverlay.style.width = nextWidth;
92828
- scaleOverlay.style.height = nextHeight;
92317
+ scaleOverlay.style.width = "" + width + "px";
92318
+ scaleOverlay.style.height = "" + height + "px";
92829
92319
  scaleOverlay.style.transform = 'none';
92830
- contentOverlay.style.width = nextWidth;
92831
- contentOverlay.style.height = nextHeight;
92832
- if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
92833
- this.requestAutoHeightFromIframes(id, contentOverlay);
92834
- }
92835
- if (sizeChanged) {
92836
- this.invalidateContentInteractionZones(id);
92837
- }
92838
- };
92839
- _proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
92840
- contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
92841
- requestCardHTMLAutoHeight(iframe, id);
92842
- });
92320
+ contentOverlay.style.width = "" + width + "px";
92321
+ contentOverlay.style.height = "" + height + "px";
92843
92322
  };
92844
92323
  _proto.syncContentInteraction = function syncContentInteraction(id) {
92845
- var _this_state_editing, _this_state_activeContentInteraction;
92324
+ var _this_state_editing;
92846
92325
  var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
92847
- var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
92848
92326
  var overlay = this.state.elements.get(id);
92849
92327
  var scaleOverlay = this.state.contentScaleElements.get(id);
92850
92328
  var contentOverlay = this.state.contentElements.get(id);
92851
92329
  var contentMount = this.state.contentMountElements.get(id);
92852
- var isInteractive = isEditing || !!activeInteraction;
92853
92330
  if (overlay) {
92854
92331
  overlay.dataset.editing = isEditing ? 'true' : 'false';
92855
92332
  overlay.style.pointerEvents = 'none';
@@ -92860,62 +92337,34 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92860
92337
  }
92861
92338
  if (contentOverlay) {
92862
92339
  contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
92863
- contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
92340
+ contentOverlay.style.pointerEvents = 'none';
92864
92341
  contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
92865
- var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
92866
- iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
92867
- iframe.tabIndex = isActiveIframe ? 0 : -1;
92342
+ iframe.style.pointerEvents = isEditing ? 'auto' : 'none';
92343
+ iframe.tabIndex = isEditing ? 0 : -1;
92868
92344
  });
92869
- this.syncShellInteraction(id, contentOverlay, isInteractive);
92870
- this.syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive);
92345
+ this.syncShellInteraction(id, contentOverlay, isEditing);
92871
92346
  }
92872
92347
  if (contentMount) {
92873
92348
  contentMount.dataset.editing = isEditing ? 'true' : 'false';
92874
- contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
92875
- contentMount.inert = !isInteractive;
92876
- if (isInteractive) {
92349
+ contentMount.style.pointerEvents = isEditing ? 'auto' : 'none';
92350
+ contentMount.inert = !isEditing;
92351
+ if (isEditing) {
92877
92352
  contentMount.removeAttribute('aria-hidden');
92878
92353
  } else {
92879
92354
  contentMount.setAttribute('aria-hidden', 'true');
92880
92355
  }
92881
92356
  }
92882
92357
  };
92883
- _proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive) {
92884
- var _this = this;
92885
- var activeElement = activeInteraction == null ? void 0 : activeInteraction.element;
92886
- contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
92887
- if ((activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && activeElement && element !== activeElement && typeof activeElement.contains === 'function' && activeElement.contains(element)) {
92888
- _this.clearContentInteractionState(element);
92889
- return;
92890
- }
92891
- if (!isInteractive) {
92892
- _this.clearContentInteractionState(element);
92893
- return;
92894
- }
92895
- if (_this.isContentInteractionDisabled(element)) {
92896
- element.dataset.vvfxHtmlInteractionActive = 'false';
92897
- element.style.pointerEvents = 'none';
92898
- return;
92899
- }
92900
- var isElementInteractive = isEditing || activeElement === element || (activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && typeof (activeElement == null ? void 0 : activeElement.contains) === 'function' && activeElement.contains(element);
92901
- element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
92902
- element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
92903
- });
92904
- };
92905
- _proto.clearContentInteractionState = function clearContentInteractionState(element) {
92906
- delete element.dataset.vvfxHtmlInteractionActive;
92907
- element.style.pointerEvents = '';
92908
- };
92909
- _proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
92358
+ _proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isEditing) {
92910
92359
  var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
92911
- var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
92360
+ var isShellInteractiveActive = isEditing || isHoveringShellInteractive;
92912
92361
  contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
92913
92362
  element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
92914
92363
  element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
92915
92364
  element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
92916
92365
  });
92917
92366
  contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
92918
- element.style.pointerEvents = isInteractive ? 'auto' : 'none';
92367
+ element.style.pointerEvents = isEditing ? 'auto' : 'none';
92919
92368
  });
92920
92369
  };
92921
92370
  _proto.enterEditing = function enterEditing(id) {
@@ -92923,9 +92372,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92923
92372
  if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
92924
92373
  return;
92925
92374
  }
92926
- if (!this.isEditableCard(id)) {
92927
- return;
92928
- }
92929
92375
  var box = this.options.getViewBoxById(id);
92930
92376
  if (box.isEmpty()) {
92931
92377
  return;
@@ -92969,13 +92415,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92969
92415
  this.options.setViewport(editing.restoreViewport);
92970
92416
  this.scheduleRender();
92971
92417
  };
92972
- _proto.isEditableCard = function isEditableCard(id) {
92973
- var _this_options_resolveCardTypeConfig;
92974
- var item = this.options.getItems().find(function(item) {
92975
- return item.id === id;
92976
- });
92977
- return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
92978
- };
92979
92418
  _proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
92980
92419
  var viewportElement = this.options.container.parentElement;
92981
92420
  if (!viewportElement) {
@@ -93000,7 +92439,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93000
92439
  };
93001
92440
  _proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
93002
92441
  this.cleanupOverlayContent(id);
93003
- this.invalidateContentInteractionZones(id);
93004
92442
  overlay.innerHTML = '';
93005
92443
  var shell = mountHTMLShell(overlay, html.content, html.shell);
93006
92444
  var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
@@ -93010,81 +92448,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93010
92448
  });
93011
92449
  var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
93012
92450
  id: id,
93013
- autoHeight: this.isAutoHeightEnabled(item)
92451
+ autoHeight: isCardItem(item) && item.property.autoHeight === true
93014
92452
  });
93015
- this.observeContentInteractionZones(id, shell.contentContainer);
93016
92453
  this.state.cleanups.set(id, function() {
93017
92454
  contentCleanup == null ? void 0 : contentCleanup();
93018
92455
  shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
93019
92456
  });
93020
92457
  this.state.contents.set(id, html);
93021
92458
  };
93022
- _proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
93023
- var _this = this;
93024
- var _this_state_contentInteractionZoneCleanups_get;
93025
- (_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
93026
- this.state.contentInteractionZoneCleanups.delete(id);
93027
- if (typeof MutationObserver !== 'function') {
93028
- return;
93029
- }
93030
- var observer = new MutationObserver(function() {
93031
- _this.invalidateContentInteractionZones(id);
93032
- });
93033
- observer.observe(contentContainer, {
93034
- attributes: true,
93035
- childList: true,
93036
- subtree: true
93037
- });
93038
- this.state.contentInteractionZoneCleanups.set(id, function() {
93039
- observer.disconnect();
93040
- });
93041
- };
93042
- _proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
93043
- var _ref, _config_style;
93044
- var _this_htmlRootConfigCleanups_get, _config_className;
93045
- (_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
93046
- this.htmlRootConfigCleanups.delete(root);
93047
- var config = html.root;
93048
- if (!config) {
93049
- return;
93050
- }
93051
- var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
93052
- var styleProperties = [];
93053
- classNames.forEach(function(className) {
93054
- root.classList.add(className);
93055
- });
93056
- Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
93057
- var property = param[0], value = param[1];
93058
- if (value === undefined) {
93059
- return;
93060
- }
93061
- styleProperties.push(property);
93062
- if (property.startsWith('--') || property.includes('-')) {
93063
- root.style.setProperty(property, String(value));
93064
- return;
93065
- }
93066
- root.style[property] = String(value);
93067
- });
93068
- this.htmlRootConfigCleanups.set(root, function() {
93069
- classNames.forEach(function(className) {
93070
- root.classList.remove(className);
93071
- });
93072
- styleProperties.forEach(function(property) {
93073
- if (property.startsWith('--') || property.includes('-')) {
93074
- root.style.removeProperty(property);
93075
- return;
93076
- }
93077
- root.style[property] = '';
93078
- });
93079
- });
93080
- };
93081
92459
  _proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
93082
92460
  var _this = this;
93083
92461
  switch(content.kind){
93084
92462
  case 'inline':
93085
- if (options == null ? void 0 : options.autoHeight) {
93086
- this.state.autoHeightModes.set(options.id, 'message');
93087
- }
93088
92463
  return this.chainCleanups(function() {
93089
92464
  return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
93090
92465
  }, renderDocumentContent(overlay, {
@@ -93101,9 +92476,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93101
92476
  }));
93102
92477
  case 'dom':
93103
92478
  {
93104
- if (options == null ? void 0 : options.autoHeight) {
93105
- this.state.autoHeightModes.set(options.id, 'measure');
93106
- }
93107
92479
  if (content.target === 'iframe') {
93108
92480
  return renderDOMContentInIframe(overlay, content.render, content.cleanup);
93109
92481
  }
@@ -93113,9 +92485,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93113
92485
  } : undefined;
93114
92486
  }
93115
92487
  case 'document':
93116
- if (options == null ? void 0 : options.autoHeight) {
93117
- this.state.autoHeightModes.set(options.id, 'message');
93118
- }
93119
92488
  return this.chainCleanups(function() {
93120
92489
  return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
93121
92490
  }, renderDocumentContent(overlay, content, {
@@ -93143,7 +92512,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93143
92512
  };
93144
92513
  };
93145
92514
  _proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
93146
- var _this_state_contentInteractionZoneCleanups_get;
93147
92515
  var cleanup = this.state.cleanups.get(id);
93148
92516
  if (cleanup) {
93149
92517
  cleanup();
@@ -93151,19 +92519,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93151
92519
  }
93152
92520
  this.state.contents.delete(id);
93153
92521
  this.state.contentMountElements.delete(id);
93154
- this.state.autoHeightModes.delete(id);
93155
- this.invalidateContentInteractionZones(id);
93156
- (_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
93157
- this.state.contentInteractionZoneCleanups.delete(id);
93158
92522
  this.cleanupAutoHeight(id);
93159
92523
  };
93160
92524
  _proto.removeOverlay = function removeOverlay(id) {
93161
- var _this_state_elements_get, _this_state_selectionElements_get;
92525
+ var _this_state_elements_get;
93162
92526
  this.cleanupOverlayContent(id);
93163
92527
  (_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
93164
- (_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
93165
92528
  this.state.elements.delete(id);
93166
- this.state.selectionElements.delete(id);
93167
92529
  this.state.contentScaleElements.delete(id);
93168
92530
  this.state.contentElements.delete(id);
93169
92531
  };
@@ -93172,27 +92534,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93172
92534
  this.cleanupAutoHeight(id);
93173
92535
  return;
93174
92536
  }
93175
- this.ensureAutoHeightMode(id);
93176
- if (this.state.autoHeightModes.get(id) === 'message') {
93177
- this.cleanupAutoHeight(id);
93178
- return;
93179
- }
93180
92537
  if (!this.state.autoHeightCleanups.has(id)) {
93181
92538
  this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
93182
92539
  }
93183
92540
  this.scheduleAutoHeightMeasure(id);
93184
92541
  };
93185
- _proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
93186
- var _this_state_contents_get;
93187
- if (this.state.autoHeightModes.has(id)) {
93188
- return;
93189
- }
93190
- var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
93191
- if (!content) {
93192
- return;
93193
- }
93194
- this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
93195
- };
93196
92542
  _proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
93197
92543
  var _this = this;
93198
92544
  var cleanupFns = [];
@@ -93280,7 +92626,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93280
92626
  var item = this.options.getItems().find(function(candidate) {
93281
92627
  return candidate.id === id;
93282
92628
  });
93283
- if (!this.isAutoHeightEnabled(item)) {
92629
+ if (!isCardItem(item) || item.property.autoHeight !== true) {
93284
92630
  this.cleanupAutoHeight(id);
93285
92631
  return;
93286
92632
  }
@@ -93299,9 +92645,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93299
92645
  }).filter(function(height) {
93300
92646
  return typeof height === 'number' && Number.isFinite(height) && height > 0;
93301
92647
  });
93302
- var childHeight = this.getChildrenNaturalHeight(element, {
93303
- includeIframes: iframeHeights.length === 0
93304
- });
92648
+ var childHeight = this.getChildrenNaturalHeight(element);
93305
92649
  var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
93306
92650
  childHeight
93307
92651
  ], iframeHeights));
@@ -93321,29 +92665,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93321
92665
  }
93322
92666
  return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
93323
92667
  };
93324
- _proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element, options) {
93325
- var _ref;
93326
- var includeIframes = (_ref = options == null ? void 0 : options.includeIframes) != null ? _ref : true;
93327
- return Array.from(element.childNodes).reduce(function(height, child) {
93328
- var _child_textContent;
93329
- if (child.nodeType === Node.ELEMENT_NODE) {
93330
- var childElement = child;
93331
- if (!includeIframes && childElement.tagName === 'IFRAME') {
93332
- return height;
93333
- }
93334
- return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
93335
- }
93336
- if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
93337
- var range = element.ownerDocument.createRange();
93338
- range.selectNodeContents(child);
93339
- var rects = Array.from(range.getClientRects());
93340
- // eslint-disable-next-line @typescript-eslint/no-deprecated
93341
- range.detach();
93342
- return rects.reduce(function(textHeight, rect) {
93343
- return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
93344
- }, height);
93345
- }
93346
- return height;
92668
+ _proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element) {
92669
+ return Array.from(element.children).reduce(function(height, child) {
92670
+ var childElement = child;
92671
+ return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
93347
92672
  }, 0);
93348
92673
  };
93349
92674
  _proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
@@ -93362,48 +92687,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93362
92687
  var item = this.options.getItems().find(function(candidate) {
93363
92688
  return candidate.id === id;
93364
92689
  });
93365
- if (!isCardItem(item) || !this.isAutoHeightEnabled(item)) {
92690
+ if (!isCardItem(item) || item.property.autoHeight !== true) {
93366
92691
  return;
93367
92692
  }
93368
- if (!Number.isFinite(height) || height <= 0) {
92693
+ if (!Number.isFinite(height) || height <= 0 || Math.abs(height - item.property.height) <= AUTO_HEIGHT_EPSILON) {
93369
92694
  return;
93370
92695
  }
93371
- var nextHeight = Math.ceil(this.getAutoHeightItemHeight(item, height));
93372
- if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
93373
- return;
93374
- }
93375
- this.options.setCardItemHeight(id, nextHeight);
93376
- };
93377
- _proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
93378
- if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
93379
- return contentHeight;
93380
- }
93381
- var scaleOverlay = this.state.contentScaleElements.get(item.id);
93382
- var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
93383
- if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
93384
- return contentHeight;
93385
- }
93386
- return contentHeight / displayedHeight * item.property.height;
93387
- };
93388
- _proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
93389
- var _this_options_resolveCardTypeConfig;
93390
- return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
93391
- };
93392
- _proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
93393
- var _this_options_resolveCardTypeConfig;
93394
- if (!isCardItem(item)) {
93395
- return true;
93396
- }
93397
- return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
92696
+ this.options.setCardItemHeight(id, Math.ceil(height));
93398
92697
  };
93399
- _create_class(HTMLOverlayManager, [
93400
- {
93401
- key: "layerElement",
93402
- get: function get() {
93403
- return this.state.layer;
93404
- }
93405
- }
93406
- ]);
93407
92698
  return HTMLOverlayManager;
93408
92699
  }();
93409
92700
  function waitForCardCaptureReady(root) {
@@ -93445,17 +92736,6 @@ function waitForCardCaptureReady(root) {
93445
92736
  });
93446
92737
  })();
93447
92738
  }
93448
- function formatCssColor(color, alpha) {
93449
- var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
93450
- var red = normalizedColor >> 16 & 0xFF;
93451
- var green = normalizedColor >> 8 & 0xFF;
93452
- var blue = normalizedColor & 0xFF;
93453
- return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
93454
- }
93455
- function formatCssNumber(value) {
93456
- var normalized = Number.isFinite(value) ? value : 0;
93457
- return Number(normalized.toFixed(6)).toString();
93458
- }
93459
92739
  function nextAnimationFrame() {
93460
92740
  return new Promise(function(resolve) {
93461
92741
  requestAnimationFrame(function() {
@@ -93874,9 +93154,6 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
93874
93154
  });
93875
93155
  return replacement;
93876
93156
  }
93877
- function isMouseEventInsideRect(event, rect) {
93878
- return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
93879
- }
93880
93157
  function createFlattenedIframeContent(iframe) {
93881
93158
  var doc = iframe.contentDocument;
93882
93159
  if (!doc) {
@@ -93916,19 +93193,6 @@ function withTimeout(promise, timeout) {
93916
93193
  });
93917
93194
  }
93918
93195
 
93919
- function orderSDKCanvasLayers(param) {
93920
- var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
93921
- [
93922
- playerContainer,
93923
- htmlOverlayLayer,
93924
- gestureCanvas
93925
- ].forEach(function(layer) {
93926
- if ((layer == null ? void 0 : layer.parentElement) === container) {
93927
- container.appendChild(layer);
93928
- }
93929
- });
93930
- }
93931
-
93932
93196
  var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
93933
93197
  var SDK = /*#__PURE__*/ function() {
93934
93198
  function SDK(container, mode) {
@@ -94034,45 +93298,9 @@ var SDK = /*#__PURE__*/ function() {
94034
93298
  propertyName: 'height',
94035
93299
  propertyValue: height
94036
93300
  });
94037
- },
94038
- getSelectedItemIds: function getSelectedItemIds() {
94039
- var _ref;
94040
- var _this__pageData;
94041
- return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
94042
- },
94043
- getPreSelectedItemId: function getPreSelectedItemId() {
94044
- var _this__pageData;
94045
- return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
94046
- },
94047
- getSelectionEdgeStyle: function getSelectionEdgeStyle() {
94048
- var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, wireframeColor = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeColor, wireframeAlpha = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeAlpha, wireframeWidth = _SDK_config_gestureHandlerConfig_transformGizmoConfig.wireframeWidth;
94049
- return {
94050
- color: wireframeColor,
94051
- alpha: wireframeAlpha,
94052
- width: wireframeWidth
94053
- };
94054
- },
94055
- getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
94056
- var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
94057
- return {
94058
- color: preSelectedColor,
94059
- alpha: 1,
94060
- width: preSelectedWidth
94061
- };
94062
- },
94063
- getCanvasEventTarget: function getCanvasEventTarget() {
94064
- var _this__gestureHandler;
94065
- return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
94066
- },
94067
- resolveCardHTML: function resolveCardHTML(item) {
94068
- return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
94069
- },
94070
- resolveCardTypeConfig: function resolveCardTypeConfig(item) {
94071
- return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
94072
93301
  }
94073
93302
  });
94074
93303
  this._htmlOverlayManager.attach();
94075
- this.syncCanvasLayerOrder();
94076
93304
  }
94077
93305
  var _proto = SDK.prototype;
94078
93306
  _proto.dispose = function dispose() {
@@ -94168,7 +93396,6 @@ var SDK = /*#__PURE__*/ function() {
94168
93396
  this.initPlayer(SDK.config.mode);
94169
93397
  this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
94170
93398
  this._gestureHandler = new GestureHandler(this._container);
94171
- this.syncCanvasLayerOrder();
94172
93399
  return [
94173
93400
  4,
94174
93401
  this.runByPageData(this.pageData)
@@ -94218,16 +93445,6 @@ var SDK = /*#__PURE__*/ function() {
94218
93445
  env: 'editor'
94219
93446
  });
94220
93447
  this.player.resize();
94221
- this.syncCanvasLayerOrder();
94222
- };
94223
- _proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
94224
- var _this__htmlOverlayManager, _this__gestureHandler;
94225
- orderSDKCanvasLayers({
94226
- container: this._container,
94227
- playerContainer: this._playerContainer,
94228
- htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
94229
- gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
94230
- });
94231
93448
  };
94232
93449
  _proto.getInitParam = function getInitParam(param) {
94233
93450
  return _async_to_generator(function() {
@@ -95322,7 +94539,8 @@ var SDK = /*#__PURE__*/ function() {
95322
94539
  * @param ignoreClamp 是否忽视约束
95323
94540
  */ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
95324
94541
  EFFECTS.assertExist(this._pageData);
95325
- this._pageDataUtils.setPageZoom(zoom, center, ignoreClamp);
94542
+ this._pageData.property.zoom = zoom;
94543
+ this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
95326
94544
  this._gestureHandler.render();
95327
94545
  };
95328
94546
  /**
@@ -96218,44 +95436,6 @@ var SDK = /*#__PURE__*/ function() {
96218
95436
  });
96219
95437
  };
96220
95438
  /**
96221
- * @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
96222
- * @param item 卡片元素
96223
- * @returns HTML 渲染配置
96224
- */ _proto.resolveCardHTML = function resolveCardHTML(item) {
96225
- var _cardTypeConfig_html;
96226
- var cardTypeConfig = this.resolveCardTypeConfig(item);
96227
- return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
96228
- };
96229
- /**
96230
- * @description 按 cardType 从注册表解析卡片类型配置。
96231
- * @param item 卡片元素
96232
- * @returns 卡片类型配置
96233
- */ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
96234
- return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
96235
- return t.type === item.cardType;
96236
- });
96237
- };
96238
- /**
96239
- * @description 重新解析并挂载指定卡片的 HTML 内容。
96240
- * @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
96241
- * @param id 卡片元素 ID
96242
- * @returns 是否成功触发刷新
96243
- */ _proto.refreshCardHTML = function refreshCardHTML(id) {
96244
- var _this__htmlOverlayManager, _this__htmlOverlayManager1;
96245
- var item = this.getSDKItem(id);
96246
- if (!isCardItem(item)) {
96247
- console.warn('CardItem "' + id + '" not found.');
96248
- return false;
96249
- }
96250
- if (!this.resolveCardHTML(item)) {
96251
- console.warn('CardItem "' + id + '" has no registered HTML renderer.');
96252
- return false;
96253
- }
96254
- (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
96255
- (_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
96256
- return true;
96257
- };
96258
- /**
96259
95439
  * @description 创建卡片元素
96260
95440
  * @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
96261
95441
  * @param createInfo 卡片创建信息
@@ -96542,6 +95722,167 @@ var SDK = /*#__PURE__*/ function() {
96542
95722
  }();
96543
95723
  SDK.config = BaseConfig;
96544
95724
 
95725
+ /**
95726
+ * @description 卡片元素 SDKItem 类
95727
+ * @description 在 Player 中以 SpriteItem 形式渲染(透明占位,无图)
95728
+ * @description 支持设置卡片类型(cardType)
95729
+ */ var CardItem = /*#__PURE__*/ function(BaseItem) {
95730
+ _inherits(CardItem, BaseItem);
95731
+ function CardItem(options) {
95732
+ var _this;
95733
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
95734
+ var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5, _SDK_config_itemConfig_cardConfig_cardTypes_, _options_property6, _options_property7;
95735
+ _this = BaseItem.call(this, options) || this, /**
95736
+ * @description 元素类型
95737
+ */ _this.type = SDKItemType.CARD;
95738
+ // 初始化属性(包含 cardType)
95739
+ _this.property = {
95740
+ position: (_ref = (_options_property = options.property) == null ? void 0 : _options_property.position) != null ? _ref : [
95741
+ 0,
95742
+ 0
95743
+ ],
95744
+ rotation: (_ref1 = (_options_property1 = options.property) == null ? void 0 : _options_property1.rotation) != null ? _ref1 : [
95745
+ 0,
95746
+ 0,
95747
+ 0
95748
+ ],
95749
+ width: (_ref2 = (_options_property2 = options.property) == null ? void 0 : _options_property2.width) != null ? _ref2 : 0,
95750
+ height: (_ref3 = (_options_property3 = options.property) == null ? void 0 : _options_property3.height) != null ? _ref3 : 0,
95751
+ scale: (_ref4 = (_options_property4 = options.property) == null ? void 0 : _options_property4.scale) != null ? _ref4 : [
95752
+ 1,
95753
+ 1
95754
+ ],
95755
+ 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 : '',
95756
+ autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
95757
+ html: (_options_property7 = options.property) == null ? void 0 : _options_property7.html
95758
+ };
95759
+ return _this;
95760
+ }
95761
+ var _proto = CardItem.prototype;
95762
+ // ==================== 实现抽象方法 ====================
95763
+ /**
95764
+ * @description 转换为 CardCreateInfo
95765
+ * @param withParent 是否包含父节点ID
95766
+ */ _proto.toCreateInfo = function toCreateInfo(withParent) {
95767
+ var extension = this.getAllExtension();
95768
+ var property = deepClone(this.property);
95769
+ property.html = this.html;
95770
+ return {
95771
+ type: SDKItemType.CARD,
95772
+ id: this.id,
95773
+ name: this.name,
95774
+ parentId: withParent ? this.parentId : undefined,
95775
+ extension: Object.keys(extension).length > 0 ? extension : undefined,
95776
+ property: property
95777
+ };
95778
+ };
95779
+ /**
95780
+ * @description 克隆 SDKItem
95781
+ */ _proto.clone = function clone() {
95782
+ var property = deepClone(this.property);
95783
+ property.html = this.html;
95784
+ return new CardItem({
95785
+ id: EFFECTS.generateGUID(),
95786
+ name: this.name,
95787
+ parentId: this.parentId,
95788
+ duration: this.duration,
95789
+ delay: this.delay,
95790
+ endBehavior: this.endBehavior,
95791
+ isLocked: this.isLocked,
95792
+ isCoreEditable: this.isCoreEditable,
95793
+ property: property,
95794
+ extension: this.getAllExtension()
95795
+ });
95796
+ };
95797
+ _create_class(CardItem, [
95798
+ {
95799
+ key: "cardType",
95800
+ get: // ==================== cardType 访问器 ====================
95801
+ /**
95802
+ * @description 卡片类型
95803
+ */ function get() {
95804
+ return this.property.cardType;
95805
+ },
95806
+ set: function set(value) {
95807
+ this.property.cardType = value;
95808
+ }
95809
+ },
95810
+ {
95811
+ key: "html",
95812
+ get: /**
95813
+ * @description HTML 覆盖层配置
95814
+ */ function get() {
95815
+ return this.property.html;
95816
+ },
95817
+ set: function set(value) {
95818
+ this.property.html = value;
95819
+ }
95820
+ },
95821
+ {
95822
+ key: "position",
95823
+ get: // ==================== 便捷访问器 ====================
95824
+ /**
95825
+ * @description 位置
95826
+ */ function get() {
95827
+ return this.property.position;
95828
+ },
95829
+ set: function set(value) {
95830
+ this.property.position = value;
95831
+ }
95832
+ },
95833
+ {
95834
+ key: "width",
95835
+ get: /**
95836
+ * @description 宽度
95837
+ */ function get() {
95838
+ return this.property.width;
95839
+ },
95840
+ set: function set(value) {
95841
+ this.property.width = value;
95842
+ }
95843
+ },
95844
+ {
95845
+ key: "height",
95846
+ get: /**
95847
+ * @description 高度
95848
+ */ function get() {
95849
+ return this.property.height;
95850
+ },
95851
+ set: function set(value) {
95852
+ this.property.height = value;
95853
+ }
95854
+ },
95855
+ {
95856
+ key: "rotation",
95857
+ get: /**
95858
+ * @description 旋转(二维旋转角度)
95859
+ */ function get() {
95860
+ return this.property.rotation[2];
95861
+ },
95862
+ set: function set(value) {
95863
+ this.property.rotation[2] = value;
95864
+ }
95865
+ },
95866
+ {
95867
+ key: "fullRotation",
95868
+ get: /**
95869
+ * @description 完整旋转(包含 x, y, z)
95870
+ */ function get() {
95871
+ return this.property.rotation;
95872
+ },
95873
+ set: function set(value) {
95874
+ this.property.rotation = value;
95875
+ }
95876
+ }
95877
+ ]);
95878
+ return CardItem;
95879
+ }(BaseItem);
95880
+ /**
95881
+ * @description 类型守卫:检查是否是 CardItem
95882
+ */ function isCardItem(obj) {
95883
+ return _instanceof(obj, CardItem);
95884
+ }
95885
+
96545
95886
  Object.defineProperty(exports, "generateGUID", {
96546
95887
  enumerable: true,
96547
95888
  get: function () { return EFFECTS.generateGUID; }