@vvfx/sdk 0.2.2-beta.9 → 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.9
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 {
@@ -60853,19 +60715,6 @@ var PageDataUtils = /*#__PURE__*/ function() {
60853
60715
  }).call(this);
60854
60716
  };
60855
60717
  /**
60856
- * @description 设置元素extension字段
60857
- */ _proto.setItemExtension = function setItemExtension(itemId, extension) {
60858
- var item = this.getSDKItem(itemId);
60859
- if (!item) {
60860
- console.warn('setItemExtension: item not found');
60861
- return;
60862
- }
60863
- for(var _iterator = _create_for_of_iterator_helper_loose(Object.entries(extension)), _step; !(_step = _iterator()).done;){
60864
- var _step_value = _step.value, key = _step_value[0], value = _step_value[1];
60865
- item.extension.set(key, value);
60866
- }
60867
- };
60868
- /**
60869
60718
  * @description 场景 1: 设置单个元素的单个属性
60870
60719
  */ _proto.setSingleItemSingleProperty = function setSingleItemSingleProperty(param) {
60871
60720
  return _async_to_generator(function() {
@@ -61223,35 +61072,40 @@ var PageDataUtils = /*#__PURE__*/ function() {
61223
61072
  3,
61224
61073
  31
61225
61074
  ];
61226
- case 'position':
61075
+ case 'html':
61227
61076
  return [
61228
61077
  3,
61229
61078
  32
61230
61079
  ];
61231
- case 'rotation':
61080
+ case 'position':
61232
61081
  return [
61233
61082
  3,
61234
61083
  33
61235
61084
  ];
61236
- case 'scale':
61085
+ case 'rotation':
61237
61086
  return [
61238
61087
  3,
61239
61088
  34
61240
61089
  ];
61241
- case 'layoutMode':
61090
+ case 'scale':
61242
61091
  return [
61243
61092
  3,
61244
61093
  35
61245
61094
  ];
61246
- case 'visible':
61095
+ case 'layoutMode':
61247
61096
  return [
61248
61097
  3,
61249
61098
  36
61250
61099
  ];
61100
+ case 'visible':
61101
+ return [
61102
+ 3,
61103
+ 37
61104
+ ];
61251
61105
  }
61252
61106
  return [
61253
61107
  3,
61254
- 37
61108
+ 38
61255
61109
  ];
61256
61110
  case 1:
61257
61111
  {
@@ -61264,7 +61118,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61264
61118
  }
61265
61119
  return [
61266
61120
  3,
61267
- 38
61121
+ 39
61268
61122
  ];
61269
61123
  }
61270
61124
  case 2:
@@ -61275,7 +61129,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61275
61129
  }
61276
61130
  return [
61277
61131
  3,
61278
- 38
61132
+ 39
61279
61133
  ];
61280
61134
  }
61281
61135
  case 3:
@@ -61307,7 +61161,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61307
61161
  case 5:
61308
61162
  return [
61309
61163
  3,
61310
- 38
61164
+ 39
61311
61165
  ];
61312
61166
  case 6:
61313
61167
  {
@@ -61324,7 +61178,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61324
61178
  }
61325
61179
  return [
61326
61180
  3,
61327
- 38
61181
+ 39
61328
61182
  ];
61329
61183
  }
61330
61184
  case 7:
@@ -61338,7 +61192,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61338
61192
  }
61339
61193
  return [
61340
61194
  3,
61341
- 38
61195
+ 39
61342
61196
  ];
61343
61197
  }
61344
61198
  case 8:
@@ -61351,7 +61205,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61351
61205
  }
61352
61206
  return [
61353
61207
  3,
61354
- 38
61208
+ 39
61355
61209
  ];
61356
61210
  }
61357
61211
  case 9:
@@ -61365,7 +61219,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61365
61219
  }
61366
61220
  return [
61367
61221
  3,
61368
- 38
61222
+ 39
61369
61223
  ];
61370
61224
  }
61371
61225
  case 10:
@@ -61378,7 +61232,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61378
61232
  }
61379
61233
  return [
61380
61234
  3,
61381
- 38
61235
+ 39
61382
61236
  ];
61383
61237
  }
61384
61238
  case 11:
@@ -61391,7 +61245,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61391
61245
  }
61392
61246
  return [
61393
61247
  3,
61394
- 38
61248
+ 39
61395
61249
  ];
61396
61250
  }
61397
61251
  case 12:
@@ -61411,7 +61265,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61411
61265
  }
61412
61266
  return [
61413
61267
  3,
61414
- 38
61268
+ 39
61415
61269
  ];
61416
61270
  }
61417
61271
  case 13:
@@ -61453,7 +61307,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61453
61307
  }
61454
61308
  return [
61455
61309
  3,
61456
- 38
61310
+ 39
61457
61311
  ];
61458
61312
  }
61459
61313
  case 14:
@@ -61488,7 +61342,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61488
61342
  }
61489
61343
  return [
61490
61344
  3,
61491
- 38
61345
+ 39
61492
61346
  ];
61493
61347
  }
61494
61348
  case 15:
@@ -61502,7 +61356,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61502
61356
  }
61503
61357
  return [
61504
61358
  3,
61505
- 38
61359
+ 39
61506
61360
  ];
61507
61361
  }
61508
61362
  case 16:
@@ -61534,7 +61388,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61534
61388
  case 20:
61535
61389
  return [
61536
61390
  3,
61537
- 38
61391
+ 39
61538
61392
  ];
61539
61393
  case 21:
61540
61394
  if (!(typeof propertyValue === 'string' && playerItem.type === EFFECTS.spec.ItemType.video)) return [
@@ -61565,7 +61419,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61565
61419
  case 25:
61566
61420
  return [
61567
61421
  3,
61568
- 38
61422
+ 39
61569
61423
  ];
61570
61424
  case 26:
61571
61425
  if (!(playerItem.type === EFFECTS.spec.ItemType.null)) return [
@@ -61610,7 +61464,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61610
61464
  case 28:
61611
61465
  return [
61612
61466
  3,
61613
- 38
61467
+ 39
61614
61468
  ];
61615
61469
  case 29:
61616
61470
  {
@@ -61622,7 +61476,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61622
61476
  }
61623
61477
  return [
61624
61478
  3,
61625
- 38
61479
+ 39
61626
61480
  ];
61627
61481
  }
61628
61482
  case 30:
@@ -61635,7 +61489,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
61635
61489
  }
61636
61490
  return [
61637
61491
  3,
61638
- 38
61492
+ 39
61639
61493
  ];
61640
61494
  }
61641
61495
  case 31:
@@ -61648,10 +61502,20 @@ var PageDataUtils = /*#__PURE__*/ function() {
61648
61502
  }
61649
61503
  return [
61650
61504
  3,
61651
- 38
61505
+ 39
61652
61506
  ];
61653
61507
  }
61654
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:
61655
61519
  {
61656
61520
  if (Array.isArray(propertyValue) && propertyValue.length === 2) {
61657
61521
  pixelTranslation = propertyValue.map(function(v, i) {
@@ -61664,10 +61528,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61664
61528
  }
61665
61529
  return [
61666
61530
  3,
61667
- 38
61531
+ 39
61668
61532
  ];
61669
61533
  }
61670
- case 33:
61534
+ case 34:
61671
61535
  {
61672
61536
  if (Array.isArray(propertyValue) && propertyValue.length === 3) {
61673
61537
  rotation = propertyValue.map(function(v, i) {
@@ -61678,10 +61542,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61678
61542
  }
61679
61543
  return [
61680
61544
  3,
61681
- 38
61545
+ 39
61682
61546
  ];
61683
61547
  }
61684
- case 34:
61548
+ case 35:
61685
61549
  {
61686
61550
  if (Array.isArray(propertyValue) && propertyValue.length === 2) {
61687
61551
  currentScale = targetItem.property.scale;
@@ -61695,10 +61559,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61695
61559
  }
61696
61560
  return [
61697
61561
  3,
61698
- 38
61562
+ 39
61699
61563
  ];
61700
61564
  }
61701
- case 35:
61565
+ case 36:
61702
61566
  {
61703
61567
  if (propertyValue === FrameLayoutMode.AUTO || propertyValue === FrameLayoutMode.FREE) {
61704
61568
  frameComponent = playerItem.getComponent(EFFECTS.FrameComponent);
@@ -61708,10 +61572,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61708
61572
  }
61709
61573
  return [
61710
61574
  3,
61711
- 38
61575
+ 39
61712
61576
  ];
61713
61577
  }
61714
- case 36:
61578
+ case 37:
61715
61579
  {
61716
61580
  if (typeof propertyValue === 'boolean') {
61717
61581
  playerItem.setVisible(propertyValue);
@@ -61724,10 +61588,10 @@ var PageDataUtils = /*#__PURE__*/ function() {
61724
61588
  }
61725
61589
  return [
61726
61590
  3,
61727
- 38
61591
+ 39
61728
61592
  ];
61729
61593
  }
61730
- case 37:
61594
+ case 38:
61731
61595
  {
61732
61596
  console.log('ignore property name ', propertyName);
61733
61597
  // 对于未明确处理的属性,尝试直接设置到 property 对象
@@ -61735,8 +61599,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
61735
61599
  targetItem.property[propertyName] = propertyValue;
61736
61600
  }
61737
61601
  }
61738
- _state.label = 38;
61739
- case 38:
61602
+ _state.label = 39;
61603
+ case 39:
61740
61604
  // 非位置属性需要刷新播放器
61741
61605
  // template 模式下保持暂停态以避免播放器自动播放,editor 模式继续推进
61742
61606
  if (![
@@ -62616,10 +62480,6 @@ var PageDataUtils = /*#__PURE__*/ function() {
62616
62480
  }
62617
62481
  break;
62618
62482
  }
62619
- case 'cardType':
62620
- {
62621
- break;
62622
- }
62623
62483
  default:
62624
62484
  {
62625
62485
  console.warn("Target property " + propertyName + " can not be changed.");
@@ -63212,15 +63072,12 @@ var PageDataUtils = /*#__PURE__*/ function() {
63212
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 ? [
63213
63073
  1,
63214
63074
  1
63215
- ] : _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;
63216
63076
  // 校验 cardType 是否已在配置中注册
63217
- var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
63218
- return t.type === cardType;
63219
- });
63220
63077
  var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
63221
63078
  return t.type;
63222
63079
  });
63223
- if (!cardTypeConfig) {
63080
+ if (!registeredTypes.includes(cardType)) {
63224
63081
  console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
63225
63082
  return;
63226
63083
  }
@@ -63264,7 +63121,9 @@ var PageDataUtils = /*#__PURE__*/ function() {
63264
63121
  width: width,
63265
63122
  height: height,
63266
63123
  scale: [].concat(scale),
63267
- cardType: cardType
63124
+ cardType: cardType,
63125
+ autoHeight: autoHeight,
63126
+ html: html
63268
63127
  },
63269
63128
  extension: extension
63270
63129
  });
@@ -64646,7 +64505,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
64646
64505
  scalar.y
64647
64506
  ],
64648
64507
  rotation: [].concat(rotation),
64649
- position: [].concat(resultPosition)
64508
+ position: [].concat(resultPosition),
64509
+ html: sdkItem.html
64650
64510
  },
64651
64511
  extension: extension
64652
64512
  };
@@ -64731,7 +64591,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
64731
64591
  };
64732
64592
  addTextItemIntoNewScene = function addTextItemIntoNewScene(textCreateInfo, sceneSize, itemViewPosition) {
64733
64593
  var _scene_fonts;
64734
- 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;
64735
64595
  var rotation = Array.isArray(sourceRotation) ? [].concat(sourceRotation) : [
64736
64596
  0,
64737
64597
  0,
@@ -64761,7 +64621,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
64761
64621
  fontSize: fontSize,
64762
64622
  textColor: resutlTextColor,
64763
64623
  fontWeight: fontWeight,
64764
- letterSpace: 0,
64624
+ letterSpace: letterSpacing,
64765
64625
  textAlign: textAlign,
64766
64626
  fontStyle: fontStyle,
64767
64627
  textWidth: textWidth,
@@ -65692,7 +65552,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
65692
65552
  _this = this;
65693
65553
  changeProeprty = function changeProeprty(targetCreateInfo) {
65694
65554
  return _async_to_generator(function() {
65695
- var currentCreateInfo, itemId;
65555
+ var currentCreateInfo;
65696
65556
  return _ts_generator(this, function(_state) {
65697
65557
  switch(_state.label){
65698
65558
  case 0:
@@ -65703,20 +65563,16 @@ var PageDataUtils = /*#__PURE__*/ function() {
65703
65563
  2
65704
65564
  ];
65705
65565
  }
65706
- itemId = targetCreateInfo.id;
65707
65566
  return [
65708
65567
  4,
65709
65568
  this.setItemProperty({
65710
- itemId: itemId,
65569
+ itemId: currentCreateInfo.id,
65711
65570
  type: currentCreateInfo.type,
65712
65571
  property: targetCreateInfo.property
65713
65572
  })
65714
65573
  ];
65715
65574
  case 1:
65716
65575
  _state.sent();
65717
- if (targetCreateInfo.extension) {
65718
- this.setItemExtension(itemId, targetCreateInfo.extension);
65719
- }
65720
65576
  return [
65721
65577
  2
65722
65578
  ];
@@ -66034,56 +65890,35 @@ var PageDataUtils = /*#__PURE__*/ function() {
66034
65890
  };
66035
65891
  _proto.asyncAddItemByCreateInfos = function asyncAddItemByCreateInfos(createInfos) {
66036
65892
  return _async_to_generator(function() {
66037
- 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;
66038
65894
  return _ts_generator(this, function(_state) {
66039
65895
  switch(_state.label){
66040
65896
  case 0:
66041
- _loop = function() {
66042
- var createInfo = _step.value;
66043
- var _ref = function() {
66044
- switch(createInfo.type){
66045
- case SDKItemType.SPRITE:
66046
- {
66047
- return {
66048
- url: createInfo.property.image,
66049
- type: 'image'
66050
- };
66051
- }
66052
- case SDKItemType.VIDEO:
66053
- {
66054
- return {
66055
- url: createInfo.property.video,
66056
- type: 'video'
66057
- };
66058
- }
66059
- default:
66060
- {
66061
- return {};
66062
- }
66063
- }
66064
- }(), url = _ref.url, type = _ref.type;
66065
- if (url && type) {
66066
- var textureId = EFFECTS.generateGUID();
66067
- 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, {
66068
65913
  id: textureId,
66069
65914
  url: url,
66070
- type: type
65915
+ type: type === SDKItemType.SPRITE ? 'image' : 'video'
66071
65916
  });
66072
65917
  Object.assign(createInfo, {
66073
65918
  textureId: textureId
66074
65919
  });
66075
65920
  }
66076
- };
66077
- _this = this;
66078
- createInfoWithIds = createInfos.map(function(createInfo) {
66079
- var _createInfo_id;
66080
- return Object.assign({}, createInfo, {
66081
- id: (_createInfo_id = createInfo.id) != null ? _createInfo_id : EFFECTS.generateGUID()
66082
- });
66083
- });
66084
- itemToTextureInfo = new Map();
66085
- // 预处理所有 createInfo,分配 textureId
66086
- for(_iterator = _create_for_of_iterator_helper_loose(createInfoWithIds); !(_step = _iterator()).done;)_loop();
65921
+ }
66087
65922
  // 并行创建所有 item
66088
65923
  toAddedCreateInfo = createInfoWithIds.filter(function(createInfo) {
66089
65924
  return ![
@@ -83256,12 +83091,43 @@ var BaseConfig = {
83256
83091
  },
83257
83092
  cardConfig: {
83258
83093
  backgroundColor: [
83259
- 1,
83260
- 1,
83261
- 1,
83262
- 0
83094
+ 0.6,
83095
+ 0.6,
83096
+ 0.6,
83097
+ 0.12
83263
83098
  ],
83264
- 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
+ ]
83265
83131
  }
83266
83132
  }
83267
83133
  };
@@ -91590,18 +91456,11 @@ function isCardHTMLAutoHeightMessage(data, id) {
91590
91456
  var message = data;
91591
91457
  return message.source === 'vvfx-card-html-auto-height' && message.id === id && typeof message.height === 'number';
91592
91458
  }
91593
- function requestCardHTMLAutoHeight(iframe, id) {
91594
- var _iframe_contentWindow;
91595
- (_iframe_contentWindow = iframe.contentWindow) == null ? void 0 : _iframe_contentWindow.postMessage({
91596
- source: 'vvfx-card-html-auto-height-request',
91597
- id: id
91598
- }, '*');
91599
- }
91600
91459
  function withCardHTMLAutoHeightBridge(html, id) {
91601
91460
  if (!id) {
91602
91461
  return html;
91603
91462
  }
91604
- 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>";
91605
91464
  if (/<\/body>/i.test(html)) {
91606
91465
  return html.replace(/<\/body>/i, "" + script + "</body>");
91607
91466
  }
@@ -91874,38 +91733,30 @@ function syncElementStackOrder(_container, elements) {
91874
91733
  });
91875
91734
  }
91876
91735
 
91877
- function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, _autoScale) {
91736
+ function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY) {
91878
91737
  if (offsetX === void 0) offsetX = 0;
91879
91738
  if (offsetY === void 0) offsetY = 0;
91880
91739
  if (box.corners.length === 4 && width > 0 && height > 0) {
91881
91740
  var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
91882
- var contentWidth = width;
91883
- var contentHeight = height;
91884
- var a = (rightTop.x - leftTop.x) / contentWidth;
91885
- var b = (rightTop.y - leftTop.y) / contentWidth;
91886
- var c = (leftBottom.x - leftTop.x) / contentHeight;
91887
- 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;
91888
91745
  var e = leftTop.x - offsetX;
91889
91746
  var f = leftTop.y - offsetY;
91890
91747
  return {
91891
91748
  left: '0px',
91892
91749
  top: '0px',
91893
- width: "" + formatPixelNumber(contentWidth) + "px",
91894
- height: "" + formatPixelNumber(contentHeight) + "px",
91895
- contentWidth: contentWidth,
91896
- contentHeight: contentHeight,
91750
+ width: "" + width + "px",
91751
+ height: "" + height + "px",
91897
91752
  transform: "matrix(" + formatMatrixNumber(a) + ", " + formatMatrixNumber(b) + ", " + formatMatrixNumber(c) + ", " + formatMatrixNumber(d) + ", " + formatMatrixNumber(e) + ", " + formatMatrixNumber(f) + ")"
91898
91753
  };
91899
91754
  }
91900
- var contentWidth1 = box.max.x - box.min.x;
91901
- var contentHeight1 = box.max.y - box.min.y;
91902
91755
  return {
91903
91756
  left: "" + (box.min.x - offsetX) + "px",
91904
91757
  top: "" + (box.min.y - offsetY) + "px",
91905
- width: "" + contentWidth1 + "px",
91906
- height: "" + contentHeight1 + "px",
91907
- contentWidth: contentWidth1,
91908
- contentHeight: contentHeight1,
91758
+ width: "" + (box.max.x - box.min.x) + "px",
91759
+ height: "" + (box.max.y - box.min.y) + "px",
91909
91760
  transform: ''
91910
91761
  };
91911
91762
  }
@@ -91928,10 +91779,6 @@ function formatMatrixNumber(value) {
91928
91779
  var normalized = Object.is(value, -0) ? 0 : value;
91929
91780
  return Number(normalized.toFixed(6)).toString();
91930
91781
  }
91931
- function formatPixelNumber(value) {
91932
- var normalized = Object.is(value, -0) ? 0 : value;
91933
- return Number(normalized.toFixed(6)).toString();
91934
- }
91935
91782
 
91936
91783
  function mountHTMLShell(container, content, shell) {
91937
91784
  if (!shell) {
@@ -91952,26 +91799,6 @@ function mountHTMLShell(container, content, shell) {
91952
91799
 
91953
91800
  var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
91954
91801
  var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
91955
- var CONTENT_INTERACTIVE_SELECTOR = [
91956
- '[data-vvfx-html-interaction-zone="self"]',
91957
- '[data-vvfx-html-interaction-zone="subtree"]',
91958
- 'a[href]',
91959
- 'button:not([disabled])',
91960
- 'input:not([disabled])',
91961
- 'textarea:not([disabled])',
91962
- 'select:not([disabled])',
91963
- 'summary',
91964
- 'video[controls]',
91965
- 'audio[controls]',
91966
- '[contenteditable]:not([contenteditable="false"])',
91967
- '[role="button"]',
91968
- '[role="link"]',
91969
- '[role="textbox"]',
91970
- '[tabindex]:not([tabindex="-1"])'
91971
- ].join(', ');
91972
- var CONTENT_INTERACTION_NONE_SELECTOR = [
91973
- '[data-vvfx-html-interaction-zone="none"]'
91974
- ].join(', ');
91975
91802
  var EDITING_VIEWPORT_PADDING = 48;
91976
91803
  var EDITING_VIEWPORT_BOX_SCALE = 1.1;
91977
91804
  var AUTO_HEIGHT_EPSILON = 0.5;
@@ -91981,20 +91808,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
91981
91808
  var _this = this;
91982
91809
  this.options = options;
91983
91810
  this.eventCleanups = [];
91984
- this.htmlRootConfigCleanups = new WeakMap();
91985
91811
  this.state = {
91986
91812
  frameElements: new Map(),
91987
91813
  elements: new Map(),
91988
- selectionElements: new Map(),
91989
91814
  contentScaleElements: new Map(),
91990
91815
  contentElements: new Map(),
91991
91816
  contentMountElements: new Map(),
91992
- contentInteractionZones: new Map(),
91993
- contentInteractionZoneCleanups: new Map(),
91994
- contentInteractionResizeCleanups: new Map(),
91995
91817
  contents: new Map(),
91996
91818
  cleanups: new Map(),
91997
- autoHeightModes: new Map(),
91998
91819
  autoHeightCleanups: new Map(),
91999
91820
  autoHeightFrames: new Map()
92000
91821
  };
@@ -92011,9 +91832,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92011
91832
  }
92012
91833
  return;
92013
91834
  }
92014
- if (!_this.isEditableCard(targetId)) {
92015
- return;
92016
- }
92017
91835
  event.preventDefault();
92018
91836
  event.stopPropagation();
92019
91837
  _this.enterEditing(targetId);
@@ -92029,7 +91847,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92029
91847
  _this.exitEditing();
92030
91848
  };
92031
91849
  this.handleContainerMouseMove = function(event) {
92032
- _this.scheduleActiveContentInteractionSync(event);
92033
91850
  var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
92034
91851
  if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
92035
91852
  return;
@@ -92043,16 +91860,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92043
91860
  _this.syncContentInteraction(hoverShellInteractiveId);
92044
91861
  }
92045
91862
  };
92046
- this.handleContainerMouseLeave = function(event) {
92047
- if (_this.isMouseLeaveWithinContainer(event)) {
92048
- return;
92049
- }
92050
- if (_this.contentInteractionFrame !== undefined) {
92051
- cancelAnimationFrame(_this.contentInteractionFrame);
92052
- _this.contentInteractionFrame = undefined;
92053
- }
92054
- _this.pendingContentInteractionEvent = undefined;
92055
- _this.setActiveContentInteraction(undefined);
91863
+ this.handleContainerMouseLeave = function() {
92056
91864
  var previousId = _this.state.hoverShellInteractiveId;
92057
91865
  if (!previousId) {
92058
91866
  return;
@@ -92060,33 +91868,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92060
91868
  _this.state.hoverShellInteractiveId = undefined;
92061
91869
  _this.syncContentInteraction(previousId);
92062
91870
  };
92063
- this.handleContainerContextMenu = function(event) {
92064
- var activeInteraction = _this.state.activeContentInteraction;
92065
- if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
92066
- return;
92067
- }
92068
- var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
92069
- if (!canvas) {
92070
- return;
92071
- }
92072
- event.preventDefault();
92073
- event.stopPropagation();
92074
- _this.setActiveContentInteraction(undefined);
92075
- canvas.dispatchEvent(new MouseEvent('contextmenu', {
92076
- bubbles: true,
92077
- cancelable: true,
92078
- clientX: event.clientX,
92079
- clientY: event.clientY,
92080
- screenX: event.screenX,
92081
- screenY: event.screenY,
92082
- button: event.button,
92083
- buttons: event.buttons,
92084
- ctrlKey: event.ctrlKey,
92085
- shiftKey: event.shiftKey,
92086
- altKey: event.altKey,
92087
- metaKey: event.metaKey
92088
- }));
92089
- };
92090
91871
  this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
92091
91872
  }
92092
91873
  var _proto = HTMLOverlayManager.prototype;
@@ -92100,6 +91881,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92100
91881
  layer.style.position = 'absolute';
92101
91882
  layer.style.inset = '0';
92102
91883
  layer.style.pointerEvents = 'none';
91884
+ layer.style.zIndex = '1';
92103
91885
  container.appendChild(layer);
92104
91886
  this.state.layer = layer;
92105
91887
  this.initDOMEvents();
@@ -92112,32 +91894,16 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92112
91894
  cancelAnimationFrame(this.state.updateFrame);
92113
91895
  this.state.updateFrame = undefined;
92114
91896
  }
92115
- if (this.contentInteractionFrame !== undefined) {
92116
- cancelAnimationFrame(this.contentInteractionFrame);
92117
- this.contentInteractionFrame = undefined;
92118
- }
92119
- this.pendingContentInteractionEvent = undefined;
92120
91897
  this.state.cleanups.forEach(function(cleanup) {
92121
91898
  cleanup();
92122
91899
  });
92123
91900
  this.state.frameElements.clear();
92124
91901
  this.state.elements.clear();
92125
- this.state.selectionElements.clear();
92126
91902
  this.state.contentScaleElements.clear();
92127
91903
  this.state.contentElements.clear();
92128
91904
  this.state.contentMountElements.clear();
92129
- this.state.contentInteractionZones.clear();
92130
- this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
92131
- cleanup();
92132
- });
92133
- this.state.contentInteractionZoneCleanups.clear();
92134
- this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
92135
- cleanup();
92136
- });
92137
- this.state.contentInteractionResizeCleanups.clear();
92138
91905
  this.state.contents.clear();
92139
91906
  this.state.cleanups.clear();
92140
- this.state.autoHeightModes.clear();
92141
91907
  this.state.autoHeightCleanups.forEach(function(cleanup) {
92142
91908
  cleanup();
92143
91909
  });
@@ -92152,12 +91918,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92152
91918
  this.eventCleanups = [];
92153
91919
  (_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
92154
91920
  this.state.layer = undefined;
92155
- this.state.selectionLayer = undefined;
92156
91921
  this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
92157
91922
  this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
92158
91923
  this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
92159
91924
  this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
92160
- this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
92161
91925
  };
92162
91926
  _proto.scheduleRender = function scheduleRender() {
92163
91927
  var _this = this;
@@ -92169,10 +91933,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92169
91933
  _this.render();
92170
91934
  });
92171
91935
  };
92172
- _proto.invalidateCardHTML = function invalidateCardHTML(id) {
92173
- this.cleanupOverlayContent(id);
92174
- this.invalidateContentInteractionZones(id);
92175
- };
92176
91936
  _proto.rasterizeCard = function rasterizeCard(id, options) {
92177
91937
  return _async_to_generator(function() {
92178
91938
  var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
@@ -92265,7 +92025,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92265
92025
  var events = [
92266
92026
  'pageDataChange',
92267
92027
  'selectedItemChange',
92268
- 'preSelectedItemChange',
92269
92028
  'itemPropertyChange',
92270
92029
  'viewportTransform',
92271
92030
  'viewRebuildFinish'
@@ -92275,7 +92034,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92275
92034
  if (event === 'viewportTransform') {
92276
92035
  _this.handleViewportTransform();
92277
92036
  }
92278
- _this.invalidateContentInteractionZones();
92279
92037
  _this.scheduleRender();
92280
92038
  });
92281
92039
  });
@@ -92285,24 +92043,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92285
92043
  this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
92286
92044
  this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
92287
92045
  this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
92288
- this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
92289
- };
92290
- _proto.isMouseLeaveWithinContainer = function isMouseLeaveWithinContainer(event) {
92291
- var relatedTarget = event.relatedTarget;
92292
- if (!relatedTarget) {
92293
- return false;
92294
- }
92295
- try {
92296
- return this.options.container.contains(relatedTarget);
92297
- } catch (unused) {
92298
- return false;
92299
- }
92300
- };
92301
- _proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
92302
- if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
92303
- return false;
92304
- }
92305
- return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
92306
92046
  };
92307
92047
  _proto.handleViewportTransform = function handleViewportTransform() {
92308
92048
  var editing = this.state.editing;
@@ -92322,16 +92062,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92322
92062
  }
92323
92063
  var items = this.options.getItems();
92324
92064
  var frameByChildId = this.renderFrameOverlays(items, layer);
92325
- var selectionLayer = this.getOrCreateSelectionLayer(layer);
92326
92065
  var visibleCardIds = new Set();
92327
92066
  var editingVisible = false;
92328
92067
  items.forEach(function(item) {
92329
92068
  var _this_state_editing;
92330
- if (!isCardItem(item) || !item.visible) {
92331
- return;
92332
- }
92333
- var html = _this.options.resolveCardHTML(item);
92334
- if (html === undefined) {
92069
+ if (!isCardItem(item) || !item.visible || item.html === undefined) {
92335
92070
  return;
92336
92071
  }
92337
92072
  var itemBox = _this.options.getViewBoxById(item.id);
@@ -92346,31 +92081,21 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92346
92081
  var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
92347
92082
  var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
92348
92083
  var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
92349
- var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
92350
- if (!_this.state.contents.has(item.id)) {
92084
+ var html = item.html;
92085
+ if (html && _this.state.contents.get(item.id) !== html) {
92351
92086
  _this.renderOverlayHTML(item.id, contentOverlay, html);
92352
92087
  }
92353
- _this.applyHTMLRootConfig(overlay, html);
92354
92088
  var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
92355
92089
  var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
92356
- 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);
92357
92091
  overlay.style.left = boxStyle.left;
92358
92092
  overlay.style.top = boxStyle.top;
92359
92093
  overlay.style.width = boxStyle.width;
92360
92094
  overlay.style.height = boxStyle.height;
92361
92095
  overlay.style.transform = boxStyle.transform;
92362
92096
  overlay.style.transformOrigin = '0 0';
92363
- var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
92364
- selectionOverlay.style.left = selectionBoxStyle.left;
92365
- selectionOverlay.style.top = selectionBoxStyle.top;
92366
- selectionOverlay.style.width = selectionBoxStyle.width;
92367
- selectionOverlay.style.height = selectionBoxStyle.height;
92368
- selectionOverlay.style.transform = selectionBoxStyle.transform;
92369
- selectionOverlay.style.transformOrigin = '0 0';
92370
- _this.applyHTMLRootConfig(selectionOverlay, html);
92371
- _this.syncOverlaySelection(item.id, overlay, selectionOverlay);
92372
- _this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
92373
- _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);
92374
92099
  _this.syncContentInteraction(item.id);
92375
92100
  });
92376
92101
  elements.forEach(function(_overlay, id) {
@@ -92409,9 +92134,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92409
92134
  }
92410
92135
  }
92411
92136
  syncElementStackOrder(layer, rootElements);
92412
- if (this.state.selectionLayer) {
92413
- this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
92414
- }
92415
92137
  this.state.frameElements.forEach(function(frameOverlay, frameId) {
92416
92138
  var frameElements = [];
92417
92139
  for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
@@ -92427,28 +92149,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92427
92149
  syncElementStackOrder(frameOverlay, frameElements);
92428
92150
  });
92429
92151
  };
92430
- _proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
92431
- var _layer_ownerDocument;
92432
- if (this.state.selectionLayer) {
92433
- if (this.state.selectionLayer.parentElement !== layer) {
92434
- layer.appendChild(this.state.selectionLayer);
92435
- }
92436
- return this.state.selectionLayer;
92437
- }
92438
- var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
92439
- if (!ownerDocument) {
92440
- return layer;
92441
- }
92442
- var selectionLayer = ownerDocument.createElement('div');
92443
- selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
92444
- selectionLayer.style.position = 'absolute';
92445
- selectionLayer.style.inset = '0';
92446
- selectionLayer.style.pointerEvents = 'none';
92447
- selectionLayer.style.zIndex = '1';
92448
- layer.appendChild(selectionLayer);
92449
- this.state.selectionLayer = selectionLayer;
92450
- return selectionLayer;
92451
- };
92452
92152
  _proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
92453
92153
  var _this = this;
92454
92154
  var visibleFrameIds = new Set();
@@ -92513,41 +92213,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92513
92213
  elements.set(id, overlay);
92514
92214
  return overlay;
92515
92215
  };
92516
- _proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
92517
- var selectionOverlay = this.state.selectionElements.get(id);
92518
- if (selectionOverlay) {
92519
- if (selectionOverlay.parentElement !== parent) {
92520
- parent.appendChild(selectionOverlay);
92521
- }
92522
- return selectionOverlay;
92523
- }
92524
- selectionOverlay = document.createElement('div');
92525
- selectionOverlay.className = 'vvfx-card-html-overlay-selection';
92526
- selectionOverlay.dataset.itemId = id;
92527
- selectionOverlay.style.position = 'absolute';
92528
- selectionOverlay.style.pointerEvents = 'none';
92529
- selectionOverlay.style.zIndex = '1';
92530
- parent.appendChild(selectionOverlay);
92531
- this.state.selectionElements.set(id, selectionOverlay);
92532
- return selectionOverlay;
92533
- };
92534
- _proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
92535
- var isSelected = this.options.getSelectedItemIds().includes(id);
92536
- var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
92537
- overlay.dataset.selected = isSelected ? 'true' : 'false';
92538
- overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
92539
- selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
92540
- selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
92541
- selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
92542
- };
92543
- _proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
92544
- var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
92545
- return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
92546
- };
92547
- _proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
92548
- var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
92549
- return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
92550
- };
92551
92216
  _proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
92552
92217
  var layer = this.state.layer;
92553
92218
  if (!layer) {
@@ -92557,7 +92222,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92557
92222
  var items = this.options.getItems();
92558
92223
  for(var i = items.length - 1; i >= 0; i--){
92559
92224
  var item = items[i];
92560
- if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
92225
+ if (!isCardItem(item) || !item.visible || item.html === undefined) {
92561
92226
  continue;
92562
92227
  }
92563
92228
  var box = this.options.getViewBoxById(item.id);
@@ -92576,7 +92241,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92576
92241
  var items = this.options.getItems();
92577
92242
  for(var i = items.length - 1; i >= 0; i--){
92578
92243
  var item = items[i];
92579
- if (!isCardItem(item) || !item.visible || this.options.resolveCardHTML(item) === undefined) {
92244
+ if (!isCardItem(item) || !item.visible || item.html === undefined) {
92580
92245
  continue;
92581
92246
  }
92582
92247
  var box = this.options.getViewBoxById(item.id);
@@ -92586,206 +92251,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92586
92251
  var contentOverlay = this.state.contentElements.get(item.id);
92587
92252
  var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
92588
92253
  var isHoveringShellInteractive = interactiveElements.some(function(element) {
92589
- 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;
92590
92256
  });
92591
92257
  return isHoveringShellInteractive ? item.id : undefined;
92592
92258
  }
92593
92259
  return undefined;
92594
92260
  };
92595
- _proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
92596
- var decision = this.resolveHTMLInteractionTarget(event);
92597
- if (decision.kind === 'canvas' && this.shouldKeepActiveContentInteractionForFocusedElement()) {
92598
- return;
92599
- }
92600
- this.setActiveContentInteraction(decision.kind === 'html' ? decision.interaction : undefined);
92601
- };
92602
- _proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
92603
- var _this = this;
92604
- if (typeof requestAnimationFrame !== 'function') {
92605
- this.syncActiveContentInteraction(event);
92606
- return;
92607
- }
92608
- this.pendingContentInteractionEvent = event;
92609
- if (this.contentInteractionFrame !== undefined) {
92610
- return;
92611
- }
92612
- this.contentInteractionFrame = requestAnimationFrame(function() {
92613
- _this.contentInteractionFrame = undefined;
92614
- var pendingEvent = _this.pendingContentInteractionEvent;
92615
- _this.pendingContentInteractionEvent = undefined;
92616
- if (pendingEvent) {
92617
- _this.syncActiveContentInteraction(pendingEvent);
92618
- }
92619
- });
92620
- };
92621
- _proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
92622
- var _this = this;
92623
- var previous = this.state.activeContentInteraction;
92624
- 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)) {
92625
- return;
92626
- }
92627
- this.state.activeContentInteraction = zone;
92628
- var changedIds = new Set();
92629
- if (previous) {
92630
- changedIds.add(previous.id);
92631
- }
92632
- if (zone) {
92633
- changedIds.add(zone.id);
92634
- }
92635
- changedIds.forEach(function(id) {
92636
- _this.syncContentInteraction(id);
92637
- });
92638
- };
92639
- _proto.shouldKeepActiveContentInteractionForFocusedElement = function shouldKeepActiveContentInteractionForFocusedElement() {
92640
- var activeInteraction = this.state.activeContentInteraction;
92641
- if (!activeInteraction || typeof document === 'undefined') {
92642
- return false;
92643
- }
92644
- var activeElement = document.activeElement;
92645
- if (!activeElement || activeElement === document.body) {
92646
- return false;
92647
- }
92648
- var interactionElement = activeInteraction.element;
92649
- return interactionElement === activeElement || typeof interactionElement.contains === 'function' && interactionElement.contains(activeElement);
92650
- };
92651
- _proto.resolveHTMLInteractionTarget = function resolveHTMLInteractionTarget(event) {
92652
- var id = this.getHTMLCardIdByEvent(event);
92653
- if (!id || this.isEditableCard(id)) {
92654
- return {
92655
- kind: 'canvas',
92656
- id: id
92657
- };
92658
- }
92659
- var contentOverlay = this.state.contentElements.get(id);
92660
- if (!contentOverlay) {
92661
- return {
92662
- kind: 'canvas',
92663
- id: id
92664
- };
92665
- }
92666
- var activeSubtree = this.getActiveSubtreeInteractionAtEvent(id, event);
92667
- if (activeSubtree) {
92668
- return {
92669
- kind: 'html',
92670
- interaction: activeSubtree
92671
- };
92672
- }
92673
- var matchedZones = this.getContentInteractionZones(id, contentOverlay).filter(function(zone) {
92674
- return isMouseEventInsideRect(event, zone.rect);
92675
- });
92676
- var zone = this.resolveContentInteractionZone(matchedZones);
92677
- if (zone) {
92678
- return {
92679
- kind: 'html',
92680
- interaction: {
92681
- id: id,
92682
- element: zone.element,
92683
- zone: zone.zone
92684
- }
92685
- };
92686
- }
92687
- return {
92688
- kind: 'canvas',
92689
- id: id
92690
- };
92691
- };
92692
- _proto.getActiveSubtreeInteractionAtEvent = function getActiveSubtreeInteractionAtEvent(id, event) {
92693
- var activeInteraction = this.state.activeContentInteraction;
92694
- if ((activeInteraction == null ? void 0 : activeInteraction.id) !== id || activeInteraction.zone !== 'subtree') {
92695
- return undefined;
92696
- }
92697
- var rect = activeInteraction.element.getBoundingClientRect();
92698
- return isMouseEventInsideRect(event, rect) ? activeInteraction : undefined;
92699
- };
92700
- _proto.resolveContentInteractionZone = function resolveContentInteractionZone(zones) {
92701
- if (zones.length <= 1) {
92702
- return zones[0];
92703
- }
92704
- var subtreeRoot = zones.find(function(candidate) {
92705
- return candidate.zone === 'subtree' && typeof candidate.element.contains === 'function' && zones.some(function(zone) {
92706
- return zone.element !== candidate.element && candidate.element.contains(zone.element);
92707
- });
92708
- });
92709
- return subtreeRoot != null ? subtreeRoot : zones[0];
92710
- };
92711
- _proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
92712
- var _this = this;
92713
- var cachedZones = this.state.contentInteractionZones.get(id);
92714
- if (cachedZones) {
92715
- return cachedZones;
92716
- }
92717
- var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
92718
- return !_this.isContentInteractionDisabled(element);
92719
- }).map(function(element) {
92720
- return {
92721
- element: element,
92722
- rect: element.getBoundingClientRect(),
92723
- zone: _this.getContentInteractionZoneMode(element)
92724
- };
92725
- });
92726
- this.state.contentInteractionZones.set(id, zones);
92727
- this.observeContentInteractionZoneResizes(id, zones);
92728
- return zones;
92729
- };
92730
- _proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
92731
- var _ref;
92732
- var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
92733
- var item = this.options.getItems().find(function(item) {
92734
- return item.id === id;
92735
- });
92736
- if (!item) {
92737
- return CONTENT_INTERACTIVE_SELECTOR;
92738
- }
92739
- 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 : [];
92740
- if (selectors.length === 0) {
92741
- return CONTENT_INTERACTIVE_SELECTOR;
92742
- }
92743
- return [].concat([
92744
- CONTENT_INTERACTIVE_SELECTOR
92745
- ], selectors).join(', ');
92746
- };
92747
- _proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
92748
- if (typeof element.closest !== 'function') {
92749
- return false;
92750
- }
92751
- return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
92752
- };
92753
- _proto.getContentInteractionZoneMode = function getContentInteractionZoneMode(element) {
92754
- var zone = element.dataset.vvfxHtmlInteractionZone;
92755
- return zone === 'subtree' ? 'subtree' : 'self';
92756
- };
92757
- _proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
92758
- if (id) {
92759
- var _this_state_contentInteractionResizeCleanups_get;
92760
- this.state.contentInteractionZones.delete(id);
92761
- (_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
92762
- this.state.contentInteractionResizeCleanups.delete(id);
92763
- return;
92764
- }
92765
- this.state.contentInteractionZones.clear();
92766
- this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
92767
- cleanup();
92768
- });
92769
- this.state.contentInteractionResizeCleanups.clear();
92770
- };
92771
- _proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
92772
- var _this = this;
92773
- var _this_state_contentInteractionResizeCleanups_get;
92774
- (_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
92775
- this.state.contentInteractionResizeCleanups.delete(id);
92776
- if (zones.length === 0 || typeof ResizeObserver !== 'function') {
92777
- return;
92778
- }
92779
- var observer = new ResizeObserver(function() {
92780
- _this.invalidateContentInteractionZones(id);
92781
- });
92782
- zones.forEach(function(zone) {
92783
- observer.observe(zone.element);
92784
- });
92785
- this.state.contentInteractionResizeCleanups.set(id, function() {
92786
- observer.disconnect();
92787
- });
92788
- };
92789
92261
  _proto.getLayerPoint = function getLayerPoint(event) {
92790
92262
  var rect = this.options.container.getBoundingClientRect();
92791
92263
  return {
@@ -92842,35 +92314,19 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92842
92314
  if (!scaleOverlay || !contentOverlay || width <= 0 || height <= 0) {
92843
92315
  return;
92844
92316
  }
92845
- var nextWidth = "" + width + "px";
92846
- var nextHeight = "" + height + "px";
92847
- var sizeChanged = scaleOverlay.style.width !== nextWidth || scaleOverlay.style.height !== nextHeight;
92848
- scaleOverlay.style.width = nextWidth;
92849
- scaleOverlay.style.height = nextHeight;
92317
+ scaleOverlay.style.width = "" + width + "px";
92318
+ scaleOverlay.style.height = "" + height + "px";
92850
92319
  scaleOverlay.style.transform = 'none';
92851
- contentOverlay.style.width = nextWidth;
92852
- contentOverlay.style.height = nextHeight;
92853
- if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
92854
- this.requestAutoHeightFromIframes(id, contentOverlay);
92855
- }
92856
- if (sizeChanged) {
92857
- this.invalidateContentInteractionZones(id);
92858
- }
92859
- };
92860
- _proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
92861
- contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
92862
- requestCardHTMLAutoHeight(iframe, id);
92863
- });
92320
+ contentOverlay.style.width = "" + width + "px";
92321
+ contentOverlay.style.height = "" + height + "px";
92864
92322
  };
92865
92323
  _proto.syncContentInteraction = function syncContentInteraction(id) {
92866
- var _this_state_editing, _this_state_activeContentInteraction;
92324
+ var _this_state_editing;
92867
92325
  var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
92868
- var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
92869
92326
  var overlay = this.state.elements.get(id);
92870
92327
  var scaleOverlay = this.state.contentScaleElements.get(id);
92871
92328
  var contentOverlay = this.state.contentElements.get(id);
92872
92329
  var contentMount = this.state.contentMountElements.get(id);
92873
- var isInteractive = isEditing || !!activeInteraction;
92874
92330
  if (overlay) {
92875
92331
  overlay.dataset.editing = isEditing ? 'true' : 'false';
92876
92332
  overlay.style.pointerEvents = 'none';
@@ -92881,62 +92337,34 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92881
92337
  }
92882
92338
  if (contentOverlay) {
92883
92339
  contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
92884
- contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
92340
+ contentOverlay.style.pointerEvents = 'none';
92885
92341
  contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
92886
- var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
92887
- iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
92888
- iframe.tabIndex = isActiveIframe ? 0 : -1;
92342
+ iframe.style.pointerEvents = isEditing ? 'auto' : 'none';
92343
+ iframe.tabIndex = isEditing ? 0 : -1;
92889
92344
  });
92890
- this.syncShellInteraction(id, contentOverlay, isInteractive);
92891
- this.syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive);
92345
+ this.syncShellInteraction(id, contentOverlay, isEditing);
92892
92346
  }
92893
92347
  if (contentMount) {
92894
92348
  contentMount.dataset.editing = isEditing ? 'true' : 'false';
92895
- contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
92896
- contentMount.inert = !isInteractive;
92897
- if (isInteractive) {
92349
+ contentMount.style.pointerEvents = isEditing ? 'auto' : 'none';
92350
+ contentMount.inert = !isEditing;
92351
+ if (isEditing) {
92898
92352
  contentMount.removeAttribute('aria-hidden');
92899
92353
  } else {
92900
92354
  contentMount.setAttribute('aria-hidden', 'true');
92901
92355
  }
92902
92356
  }
92903
92357
  };
92904
- _proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeInteraction, isEditing, isInteractive) {
92905
- var _this = this;
92906
- var activeElement = activeInteraction == null ? void 0 : activeInteraction.element;
92907
- contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
92908
- if ((activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && activeElement && element !== activeElement && typeof activeElement.contains === 'function' && activeElement.contains(element)) {
92909
- _this.clearContentInteractionState(element);
92910
- return;
92911
- }
92912
- if (!isInteractive) {
92913
- _this.clearContentInteractionState(element);
92914
- return;
92915
- }
92916
- if (_this.isContentInteractionDisabled(element)) {
92917
- element.dataset.vvfxHtmlInteractionActive = 'false';
92918
- element.style.pointerEvents = 'none';
92919
- return;
92920
- }
92921
- var isElementInteractive = isEditing || activeElement === element || (activeInteraction == null ? void 0 : activeInteraction.zone) === 'subtree' && typeof (activeElement == null ? void 0 : activeElement.contains) === 'function' && activeElement.contains(element);
92922
- element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
92923
- element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
92924
- });
92925
- };
92926
- _proto.clearContentInteractionState = function clearContentInteractionState(element) {
92927
- delete element.dataset.vvfxHtmlInteractionActive;
92928
- element.style.pointerEvents = '';
92929
- };
92930
- _proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
92358
+ _proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isEditing) {
92931
92359
  var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
92932
- var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
92360
+ var isShellInteractiveActive = isEditing || isHoveringShellInteractive;
92933
92361
  contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
92934
92362
  element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
92935
92363
  element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
92936
92364
  element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
92937
92365
  });
92938
92366
  contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
92939
- element.style.pointerEvents = isInteractive ? 'auto' : 'none';
92367
+ element.style.pointerEvents = isEditing ? 'auto' : 'none';
92940
92368
  });
92941
92369
  };
92942
92370
  _proto.enterEditing = function enterEditing(id) {
@@ -92944,9 +92372,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92944
92372
  if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
92945
92373
  return;
92946
92374
  }
92947
- if (!this.isEditableCard(id)) {
92948
- return;
92949
- }
92950
92375
  var box = this.options.getViewBoxById(id);
92951
92376
  if (box.isEmpty()) {
92952
92377
  return;
@@ -92990,13 +92415,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
92990
92415
  this.options.setViewport(editing.restoreViewport);
92991
92416
  this.scheduleRender();
92992
92417
  };
92993
- _proto.isEditableCard = function isEditableCard(id) {
92994
- var _this_options_resolveCardTypeConfig;
92995
- var item = this.options.getItems().find(function(item) {
92996
- return item.id === id;
92997
- });
92998
- return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
92999
- };
93000
92418
  _proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
93001
92419
  var viewportElement = this.options.container.parentElement;
93002
92420
  if (!viewportElement) {
@@ -93021,7 +92439,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93021
92439
  };
93022
92440
  _proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
93023
92441
  this.cleanupOverlayContent(id);
93024
- this.invalidateContentInteractionZones(id);
93025
92442
  overlay.innerHTML = '';
93026
92443
  var shell = mountHTMLShell(overlay, html.content, html.shell);
93027
92444
  var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
@@ -93031,81 +92448,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93031
92448
  });
93032
92449
  var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
93033
92450
  id: id,
93034
- autoHeight: this.isAutoHeightEnabled(item)
92451
+ autoHeight: isCardItem(item) && item.property.autoHeight === true
93035
92452
  });
93036
- this.observeContentInteractionZones(id, shell.contentContainer);
93037
92453
  this.state.cleanups.set(id, function() {
93038
92454
  contentCleanup == null ? void 0 : contentCleanup();
93039
92455
  shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
93040
92456
  });
93041
92457
  this.state.contents.set(id, html);
93042
92458
  };
93043
- _proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
93044
- var _this = this;
93045
- var _this_state_contentInteractionZoneCleanups_get;
93046
- (_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
93047
- this.state.contentInteractionZoneCleanups.delete(id);
93048
- if (typeof MutationObserver !== 'function') {
93049
- return;
93050
- }
93051
- var observer = new MutationObserver(function() {
93052
- _this.invalidateContentInteractionZones(id);
93053
- });
93054
- observer.observe(contentContainer, {
93055
- attributes: true,
93056
- childList: true,
93057
- subtree: true
93058
- });
93059
- this.state.contentInteractionZoneCleanups.set(id, function() {
93060
- observer.disconnect();
93061
- });
93062
- };
93063
- _proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
93064
- var _ref, _config_style;
93065
- var _this_htmlRootConfigCleanups_get, _config_className;
93066
- (_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
93067
- this.htmlRootConfigCleanups.delete(root);
93068
- var config = html.root;
93069
- if (!config) {
93070
- return;
93071
- }
93072
- var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
93073
- var styleProperties = [];
93074
- classNames.forEach(function(className) {
93075
- root.classList.add(className);
93076
- });
93077
- Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
93078
- var property = param[0], value = param[1];
93079
- if (value === undefined) {
93080
- return;
93081
- }
93082
- styleProperties.push(property);
93083
- if (property.startsWith('--') || property.includes('-')) {
93084
- root.style.setProperty(property, String(value));
93085
- return;
93086
- }
93087
- root.style[property] = String(value);
93088
- });
93089
- this.htmlRootConfigCleanups.set(root, function() {
93090
- classNames.forEach(function(className) {
93091
- root.classList.remove(className);
93092
- });
93093
- styleProperties.forEach(function(property) {
93094
- if (property.startsWith('--') || property.includes('-')) {
93095
- root.style.removeProperty(property);
93096
- return;
93097
- }
93098
- root.style[property] = '';
93099
- });
93100
- });
93101
- };
93102
92459
  _proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
93103
92460
  var _this = this;
93104
92461
  switch(content.kind){
93105
92462
  case 'inline':
93106
- if (options == null ? void 0 : options.autoHeight) {
93107
- this.state.autoHeightModes.set(options.id, 'message');
93108
- }
93109
92463
  return this.chainCleanups(function() {
93110
92464
  return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
93111
92465
  }, renderDocumentContent(overlay, {
@@ -93122,9 +92476,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93122
92476
  }));
93123
92477
  case 'dom':
93124
92478
  {
93125
- if (options == null ? void 0 : options.autoHeight) {
93126
- this.state.autoHeightModes.set(options.id, 'measure');
93127
- }
93128
92479
  if (content.target === 'iframe') {
93129
92480
  return renderDOMContentInIframe(overlay, content.render, content.cleanup);
93130
92481
  }
@@ -93134,9 +92485,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93134
92485
  } : undefined;
93135
92486
  }
93136
92487
  case 'document':
93137
- if (options == null ? void 0 : options.autoHeight) {
93138
- this.state.autoHeightModes.set(options.id, 'message');
93139
- }
93140
92488
  return this.chainCleanups(function() {
93141
92489
  return content.cleanup == null ? void 0 : content.cleanup.call(content, overlay);
93142
92490
  }, renderDocumentContent(overlay, content, {
@@ -93164,7 +92512,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93164
92512
  };
93165
92513
  };
93166
92514
  _proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
93167
- var _this_state_contentInteractionZoneCleanups_get;
93168
92515
  var cleanup = this.state.cleanups.get(id);
93169
92516
  if (cleanup) {
93170
92517
  cleanup();
@@ -93172,19 +92519,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93172
92519
  }
93173
92520
  this.state.contents.delete(id);
93174
92521
  this.state.contentMountElements.delete(id);
93175
- this.state.autoHeightModes.delete(id);
93176
- this.invalidateContentInteractionZones(id);
93177
- (_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
93178
- this.state.contentInteractionZoneCleanups.delete(id);
93179
92522
  this.cleanupAutoHeight(id);
93180
92523
  };
93181
92524
  _proto.removeOverlay = function removeOverlay(id) {
93182
- var _this_state_elements_get, _this_state_selectionElements_get;
92525
+ var _this_state_elements_get;
93183
92526
  this.cleanupOverlayContent(id);
93184
92527
  (_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
93185
- (_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
93186
92528
  this.state.elements.delete(id);
93187
- this.state.selectionElements.delete(id);
93188
92529
  this.state.contentScaleElements.delete(id);
93189
92530
  this.state.contentElements.delete(id);
93190
92531
  };
@@ -93193,27 +92534,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93193
92534
  this.cleanupAutoHeight(id);
93194
92535
  return;
93195
92536
  }
93196
- this.ensureAutoHeightMode(id);
93197
- if (this.state.autoHeightModes.get(id) === 'message') {
93198
- this.cleanupAutoHeight(id);
93199
- return;
93200
- }
93201
92537
  if (!this.state.autoHeightCleanups.has(id)) {
93202
92538
  this.state.autoHeightCleanups.set(id, this.createAutoHeightObserver(id));
93203
92539
  }
93204
92540
  this.scheduleAutoHeightMeasure(id);
93205
92541
  };
93206
- _proto.ensureAutoHeightMode = function ensureAutoHeightMode(id) {
93207
- var _this_state_contents_get;
93208
- if (this.state.autoHeightModes.has(id)) {
93209
- return;
93210
- }
93211
- var content = (_this_state_contents_get = this.state.contents.get(id)) == null ? void 0 : _this_state_contents_get.content;
93212
- if (!content) {
93213
- return;
93214
- }
93215
- this.state.autoHeightModes.set(id, content.kind === 'inline' || content.kind === 'document' ? 'message' : 'measure');
93216
- };
93217
92542
  _proto.createAutoHeightObserver = function createAutoHeightObserver(id) {
93218
92543
  var _this = this;
93219
92544
  var cleanupFns = [];
@@ -93301,7 +92626,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93301
92626
  var item = this.options.getItems().find(function(candidate) {
93302
92627
  return candidate.id === id;
93303
92628
  });
93304
- if (!this.isAutoHeightEnabled(item)) {
92629
+ if (!isCardItem(item) || item.property.autoHeight !== true) {
93305
92630
  this.cleanupAutoHeight(id);
93306
92631
  return;
93307
92632
  }
@@ -93320,9 +92645,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93320
92645
  }).filter(function(height) {
93321
92646
  return typeof height === 'number' && Number.isFinite(height) && height > 0;
93322
92647
  });
93323
- var childHeight = this.getChildrenNaturalHeight(element, {
93324
- includeIframes: iframeHeights.length === 0
93325
- });
92648
+ var childHeight = this.getChildrenNaturalHeight(element);
93326
92649
  var naturalHeight = (_Math = Math).max.apply(_Math, [].concat([
93327
92650
  childHeight
93328
92651
  ], iframeHeights));
@@ -93342,29 +92665,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93342
92665
  }
93343
92666
  return Math.max(documentElement.scrollHeight, (_ref = body == null ? void 0 : body.scrollHeight) != null ? _ref : 0);
93344
92667
  };
93345
- _proto.getChildrenNaturalHeight = function getChildrenNaturalHeight(element, options) {
93346
- var _ref;
93347
- var includeIframes = (_ref = options == null ? void 0 : options.includeIframes) != null ? _ref : true;
93348
- return Array.from(element.childNodes).reduce(function(height, child) {
93349
- var _child_textContent;
93350
- if (child.nodeType === Node.ELEMENT_NODE) {
93351
- var childElement = child;
93352
- if (!includeIframes && childElement.tagName === 'IFRAME') {
93353
- return height;
93354
- }
93355
- return Math.max(height, childElement.offsetTop + childElement.offsetHeight);
93356
- }
93357
- if (child.nodeType === Node.TEXT_NODE && ((_child_textContent = child.textContent) == null ? void 0 : _child_textContent.trim())) {
93358
- var range = element.ownerDocument.createRange();
93359
- range.selectNodeContents(child);
93360
- var rects = Array.from(range.getClientRects());
93361
- // eslint-disable-next-line @typescript-eslint/no-deprecated
93362
- range.detach();
93363
- return rects.reduce(function(textHeight, rect) {
93364
- return Math.max(textHeight, rect.bottom - element.getBoundingClientRect().top);
93365
- }, height);
93366
- }
93367
- 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);
93368
92672
  }, 0);
93369
92673
  };
93370
92674
  _proto.cleanupAutoHeight = function cleanupAutoHeight(id) {
@@ -93383,48 +92687,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
93383
92687
  var item = this.options.getItems().find(function(candidate) {
93384
92688
  return candidate.id === id;
93385
92689
  });
93386
- if (!isCardItem(item) || !this.isAutoHeightEnabled(item)) {
92690
+ if (!isCardItem(item) || item.property.autoHeight !== true) {
93387
92691
  return;
93388
92692
  }
93389
- if (!Number.isFinite(height) || height <= 0) {
92693
+ if (!Number.isFinite(height) || height <= 0 || Math.abs(height - item.property.height) <= AUTO_HEIGHT_EPSILON) {
93390
92694
  return;
93391
92695
  }
93392
- var nextHeight = Math.ceil(this.getAutoHeightItemHeight(item, height));
93393
- if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
93394
- return;
93395
- }
93396
- this.options.setCardItemHeight(id, nextHeight);
93397
- };
93398
- _proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
93399
- if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
93400
- return contentHeight;
93401
- }
93402
- var scaleOverlay = this.state.contentScaleElements.get(item.id);
93403
- var displayedHeight = scaleOverlay ? Number.parseFloat(scaleOverlay.style.height) : 0;
93404
- if (!Number.isFinite(displayedHeight) || displayedHeight <= 0 || item.property.height <= 0) {
93405
- return contentHeight;
93406
- }
93407
- return contentHeight / displayedHeight * item.property.height;
93408
- };
93409
- _proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
93410
- var _this_options_resolveCardTypeConfig;
93411
- return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
92696
+ this.options.setCardItemHeight(id, Math.ceil(height));
93412
92697
  };
93413
- _proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
93414
- var _this_options_resolveCardTypeConfig;
93415
- if (!isCardItem(item)) {
93416
- return true;
93417
- }
93418
- return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
93419
- };
93420
- _create_class(HTMLOverlayManager, [
93421
- {
93422
- key: "layerElement",
93423
- get: function get() {
93424
- return this.state.layer;
93425
- }
93426
- }
93427
- ]);
93428
92698
  return HTMLOverlayManager;
93429
92699
  }();
93430
92700
  function waitForCardCaptureReady(root) {
@@ -93466,17 +92736,6 @@ function waitForCardCaptureReady(root) {
93466
92736
  });
93467
92737
  })();
93468
92738
  }
93469
- function formatCssColor(color, alpha) {
93470
- var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
93471
- var red = normalizedColor >> 16 & 0xFF;
93472
- var green = normalizedColor >> 8 & 0xFF;
93473
- var blue = normalizedColor & 0xFF;
93474
- return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
93475
- }
93476
- function formatCssNumber(value) {
93477
- var normalized = Number.isFinite(value) ? value : 0;
93478
- return Number(normalized.toFixed(6)).toString();
93479
- }
93480
92739
  function nextAnimationFrame() {
93481
92740
  return new Promise(function(resolve) {
93482
92741
  requestAnimationFrame(function() {
@@ -93895,9 +93154,6 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
93895
93154
  });
93896
93155
  return replacement;
93897
93156
  }
93898
- function isMouseEventInsideRect(event, rect) {
93899
- return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
93900
- }
93901
93157
  function createFlattenedIframeContent(iframe) {
93902
93158
  var doc = iframe.contentDocument;
93903
93159
  if (!doc) {
@@ -93937,19 +93193,6 @@ function withTimeout(promise, timeout) {
93937
93193
  });
93938
93194
  }
93939
93195
 
93940
- function orderSDKCanvasLayers(param) {
93941
- var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
93942
- [
93943
- playerContainer,
93944
- htmlOverlayLayer,
93945
- gestureCanvas
93946
- ].forEach(function(layer) {
93947
- if ((layer == null ? void 0 : layer.parentElement) === container) {
93948
- container.appendChild(layer);
93949
- }
93950
- });
93951
- }
93952
-
93953
93196
  var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
93954
93197
  var SDK = /*#__PURE__*/ function() {
93955
93198
  function SDK(container, mode) {
@@ -94055,45 +93298,9 @@ var SDK = /*#__PURE__*/ function() {
94055
93298
  propertyName: 'height',
94056
93299
  propertyValue: height
94057
93300
  });
94058
- },
94059
- getSelectedItemIds: function getSelectedItemIds() {
94060
- var _ref;
94061
- var _this__pageData;
94062
- return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
94063
- },
94064
- getPreSelectedItemId: function getPreSelectedItemId() {
94065
- var _this__pageData;
94066
- return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
94067
- },
94068
- getSelectionEdgeStyle: function getSelectionEdgeStyle() {
94069
- 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;
94070
- return {
94071
- color: wireframeColor,
94072
- alpha: wireframeAlpha,
94073
- width: wireframeWidth
94074
- };
94075
- },
94076
- getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
94077
- var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
94078
- return {
94079
- color: preSelectedColor,
94080
- alpha: 1,
94081
- width: preSelectedWidth
94082
- };
94083
- },
94084
- getCanvasEventTarget: function getCanvasEventTarget() {
94085
- var _this__gestureHandler;
94086
- return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
94087
- },
94088
- resolveCardHTML: function resolveCardHTML(item) {
94089
- return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
94090
- },
94091
- resolveCardTypeConfig: function resolveCardTypeConfig(item) {
94092
- return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
94093
93301
  }
94094
93302
  });
94095
93303
  this._htmlOverlayManager.attach();
94096
- this.syncCanvasLayerOrder();
94097
93304
  }
94098
93305
  var _proto = SDK.prototype;
94099
93306
  _proto.dispose = function dispose() {
@@ -94189,7 +93396,6 @@ var SDK = /*#__PURE__*/ function() {
94189
93396
  this.initPlayer(SDK.config.mode);
94190
93397
  this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
94191
93398
  this._gestureHandler = new GestureHandler(this._container);
94192
- this.syncCanvasLayerOrder();
94193
93399
  return [
94194
93400
  4,
94195
93401
  this.runByPageData(this.pageData)
@@ -94239,16 +93445,6 @@ var SDK = /*#__PURE__*/ function() {
94239
93445
  env: 'editor'
94240
93446
  });
94241
93447
  this.player.resize();
94242
- this.syncCanvasLayerOrder();
94243
- };
94244
- _proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
94245
- var _this__htmlOverlayManager, _this__gestureHandler;
94246
- orderSDKCanvasLayers({
94247
- container: this._container,
94248
- playerContainer: this._playerContainer,
94249
- htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
94250
- gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
94251
- });
94252
93448
  };
94253
93449
  _proto.getInitParam = function getInitParam(param) {
94254
93450
  return _async_to_generator(function() {
@@ -95343,7 +94539,8 @@ var SDK = /*#__PURE__*/ function() {
95343
94539
  * @param ignoreClamp 是否忽视约束
95344
94540
  */ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
95345
94541
  EFFECTS.assertExist(this._pageData);
95346
- this._pageDataUtils.setPageZoom(zoom, center, ignoreClamp);
94542
+ this._pageData.property.zoom = zoom;
94543
+ this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
95347
94544
  this._gestureHandler.render();
95348
94545
  };
95349
94546
  /**
@@ -96239,44 +95436,6 @@ var SDK = /*#__PURE__*/ function() {
96239
95436
  });
96240
95437
  };
96241
95438
  /**
96242
- * @description 按 cardType 从注册表解析卡片的 HTML 渲染配置。
96243
- * @param item 卡片元素
96244
- * @returns HTML 渲染配置
96245
- */ _proto.resolveCardHTML = function resolveCardHTML(item) {
96246
- var _cardTypeConfig_html;
96247
- var cardTypeConfig = this.resolveCardTypeConfig(item);
96248
- return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
96249
- };
96250
- /**
96251
- * @description 按 cardType 从注册表解析卡片类型配置。
96252
- * @param item 卡片元素
96253
- * @returns 卡片类型配置
96254
- */ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
96255
- return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
96256
- return t.type === item.cardType;
96257
- });
96258
- };
96259
- /**
96260
- * @description 重新解析并挂载指定卡片的 HTML 内容。
96261
- * @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
96262
- * @param id 卡片元素 ID
96263
- * @returns 是否成功触发刷新
96264
- */ _proto.refreshCardHTML = function refreshCardHTML(id) {
96265
- var _this__htmlOverlayManager, _this__htmlOverlayManager1;
96266
- var item = this.getSDKItem(id);
96267
- if (!isCardItem(item)) {
96268
- console.warn('CardItem "' + id + '" not found.');
96269
- return false;
96270
- }
96271
- if (!this.resolveCardHTML(item)) {
96272
- console.warn('CardItem "' + id + '" has no registered HTML renderer.');
96273
- return false;
96274
- }
96275
- (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
96276
- (_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
96277
- return true;
96278
- };
96279
- /**
96280
95439
  * @description 创建卡片元素
96281
95440
  * @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
96282
95441
  * @param createInfo 卡片创建信息
@@ -96563,6 +95722,167 @@ var SDK = /*#__PURE__*/ function() {
96563
95722
  }();
96564
95723
  SDK.config = BaseConfig;
96565
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
+
96566
95886
  Object.defineProperty(exports, "generateGUID", {
96567
95887
  enumerable: true,
96568
95888
  get: function () { return EFFECTS.generateGUID; }