@vvfx/sdk 0.2.2-beta.3 → 0.2.2-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +16 -0
- package/dist/html-overlay/manager.d.ts +42 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +552 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +552 -42
- package/dist/index.mjs.map +1 -1
- package/dist/layer-order.d.ts +7 -0
- package/dist/sdk.d.ts +14 -0
- package/dist/types.d.ts +15 -16
- package/package.json +2 -2
- package/dist/html-overlay/auto-height-runtime.test.d.ts +0 -1
- package/dist/html-overlay/manager.test.d.ts +0 -1
- package/dist/html-overlay/overlay-transform.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: TODO
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 赤芍,何即,不择,意绮
|
|
6
|
-
* Version: v0.2.2-beta.
|
|
6
|
+
* Version: v0.2.2-beta.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -25162,7 +25162,7 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
|
|
|
25162
25162
|
function CardItem(options) {
|
|
25163
25163
|
var _this;
|
|
25164
25164
|
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
|
25165
|
-
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5
|
|
25165
|
+
var _options_property, _options_property1, _options_property2, _options_property3, _options_property4, _options_property5;
|
|
25166
25166
|
_this = BaseItem.call(this, options) || this, /**
|
|
25167
25167
|
* @description 元素类型
|
|
25168
25168
|
*/ _this.type = SDKItemType.CARD;
|
|
@@ -25183,9 +25183,7 @@ var ItemOrderAction = /*#__PURE__*/ function(ItemOrderAction) {
|
|
|
25183
25183
|
1,
|
|
25184
25184
|
1
|
|
25185
25185
|
],
|
|
25186
|
-
cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown'
|
|
25187
|
-
autoHeight: (_options_property6 = options.property) == null ? void 0 : _options_property6.autoHeight,
|
|
25188
|
-
autoScale: (_options_property7 = options.property) == null ? void 0 : _options_property7.autoScale
|
|
25186
|
+
cardType: (_ref5 = (_options_property5 = options.property) == null ? void 0 : _options_property5.cardType) != null ? _ref5 : 'unknown'
|
|
25189
25187
|
};
|
|
25190
25188
|
return _this;
|
|
25191
25189
|
}
|
|
@@ -47300,7 +47298,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47300
47298
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47301
47299
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47302
47300
|
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;
|
|
47303
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47301
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty()) && !isCardItem(preSelectedItem)) {
|
|
47304
47302
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47305
47303
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47306
47304
|
}
|
|
@@ -55884,6 +55882,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55884
55882
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55885
55883
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55886
55884
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55885
|
+
var isSingleCardItem = isCardItem(selectedItem);
|
|
55887
55886
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55888
55887
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55889
55888
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55923,9 +55922,11 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55923
55922
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55924
55923
|
// 根据box获取边缘线
|
|
55925
55924
|
var corners = this.wireframe.box.corners;
|
|
55926
|
-
|
|
55927
|
-
|
|
55928
|
-
|
|
55925
|
+
if (!isSingleCardItem) {
|
|
55926
|
+
corners.forEach(function(corner, i) {
|
|
55927
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55928
|
+
});
|
|
55929
|
+
}
|
|
55929
55930
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55930
55931
|
// 成组暂不支持缩放
|
|
55931
55932
|
if (selectedItems.length === 1) {
|
|
@@ -63165,12 +63166,15 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63165
63166
|
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 ? [
|
|
63166
63167
|
1,
|
|
63167
63168
|
1
|
|
63168
|
-
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position,
|
|
63169
|
+
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63169
63170
|
// 校验 cardType 是否已在配置中注册
|
|
63171
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63172
|
+
return t.type === cardType;
|
|
63173
|
+
});
|
|
63170
63174
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63171
63175
|
return t.type;
|
|
63172
63176
|
});
|
|
63173
|
-
if (!
|
|
63177
|
+
if (!cardTypeConfig) {
|
|
63174
63178
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63175
63179
|
return;
|
|
63176
63180
|
}
|
|
@@ -63214,9 +63218,7 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63214
63218
|
width: width,
|
|
63215
63219
|
height: height,
|
|
63216
63220
|
scale: [].concat(scale),
|
|
63217
|
-
cardType: cardType
|
|
63218
|
-
autoHeight: autoHeight,
|
|
63219
|
-
autoScale: autoScale
|
|
63221
|
+
cardType: cardType
|
|
63220
63222
|
},
|
|
63221
63223
|
extension: extension
|
|
63222
63224
|
});
|
|
@@ -83204,10 +83206,10 @@ var BaseConfig = {
|
|
|
83204
83206
|
},
|
|
83205
83207
|
cardConfig: {
|
|
83206
83208
|
backgroundColor: [
|
|
83207
|
-
|
|
83208
|
-
|
|
83209
|
-
|
|
83210
|
-
0
|
|
83209
|
+
1,
|
|
83210
|
+
1,
|
|
83211
|
+
1,
|
|
83212
|
+
0
|
|
83211
83213
|
],
|
|
83212
83214
|
cardTypes: []
|
|
83213
83215
|
}
|
|
@@ -91901,6 +91903,27 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91901
91903
|
|
|
91902
91904
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91903
91905
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
91906
|
+
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
91907
|
+
'[data-interaction-zone="self"]',
|
|
91908
|
+
'[data-vvfx-html-interaction-zone="self"]',
|
|
91909
|
+
'a[href]',
|
|
91910
|
+
'button:not([disabled])',
|
|
91911
|
+
'input:not([disabled])',
|
|
91912
|
+
'textarea:not([disabled])',
|
|
91913
|
+
'select:not([disabled])',
|
|
91914
|
+
'summary',
|
|
91915
|
+
'video[controls]',
|
|
91916
|
+
'audio[controls]',
|
|
91917
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
91918
|
+
'[role="button"]',
|
|
91919
|
+
'[role="link"]',
|
|
91920
|
+
'[role="textbox"]',
|
|
91921
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
91922
|
+
].join(', ');
|
|
91923
|
+
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
91924
|
+
'[data-interaction-zone="none"]',
|
|
91925
|
+
'[data-vvfx-html-interaction-zone="none"]'
|
|
91926
|
+
].join(', ');
|
|
91904
91927
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91905
91928
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91906
91929
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91910,12 +91933,17 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91910
91933
|
var _this = this;
|
|
91911
91934
|
this.options = options;
|
|
91912
91935
|
this.eventCleanups = [];
|
|
91936
|
+
this.htmlRootConfigCleanups = new WeakMap();
|
|
91913
91937
|
this.state = {
|
|
91914
91938
|
frameElements: new Map(),
|
|
91915
91939
|
elements: new Map(),
|
|
91940
|
+
selectionElements: new Map(),
|
|
91916
91941
|
contentScaleElements: new Map(),
|
|
91917
91942
|
contentElements: new Map(),
|
|
91918
91943
|
contentMountElements: new Map(),
|
|
91944
|
+
contentInteractionZones: new Map(),
|
|
91945
|
+
contentInteractionZoneCleanups: new Map(),
|
|
91946
|
+
contentInteractionResizeCleanups: new Map(),
|
|
91919
91947
|
contents: new Map(),
|
|
91920
91948
|
cleanups: new Map(),
|
|
91921
91949
|
autoHeightModes: new Map(),
|
|
@@ -91935,6 +91963,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91935
91963
|
}
|
|
91936
91964
|
return;
|
|
91937
91965
|
}
|
|
91966
|
+
if (!_this.isEditableCard(targetId)) {
|
|
91967
|
+
return;
|
|
91968
|
+
}
|
|
91938
91969
|
event.preventDefault();
|
|
91939
91970
|
event.stopPropagation();
|
|
91940
91971
|
_this.enterEditing(targetId);
|
|
@@ -91950,6 +91981,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91950
91981
|
_this.exitEditing();
|
|
91951
91982
|
};
|
|
91952
91983
|
this.handleContainerMouseMove = function(event) {
|
|
91984
|
+
_this.scheduleActiveContentInteractionSync(event);
|
|
91953
91985
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
91954
91986
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
91955
91987
|
return;
|
|
@@ -91964,6 +91996,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91964
91996
|
}
|
|
91965
91997
|
};
|
|
91966
91998
|
this.handleContainerMouseLeave = function() {
|
|
91999
|
+
if (_this.contentInteractionFrame !== undefined) {
|
|
92000
|
+
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
92001
|
+
_this.contentInteractionFrame = undefined;
|
|
92002
|
+
}
|
|
92003
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92004
|
+
_this.setActiveContentInteraction(undefined);
|
|
91967
92005
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
91968
92006
|
if (!previousId) {
|
|
91969
92007
|
return;
|
|
@@ -91971,6 +92009,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91971
92009
|
_this.state.hoverShellInteractiveId = undefined;
|
|
91972
92010
|
_this.syncContentInteraction(previousId);
|
|
91973
92011
|
};
|
|
92012
|
+
this.handleContainerContextMenu = function(event) {
|
|
92013
|
+
var activeInteraction = _this.state.activeContentInteraction;
|
|
92014
|
+
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92015
|
+
return;
|
|
92016
|
+
}
|
|
92017
|
+
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92018
|
+
if (!canvas) {
|
|
92019
|
+
return;
|
|
92020
|
+
}
|
|
92021
|
+
event.preventDefault();
|
|
92022
|
+
event.stopPropagation();
|
|
92023
|
+
_this.setActiveContentInteraction(undefined);
|
|
92024
|
+
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92025
|
+
bubbles: true,
|
|
92026
|
+
cancelable: true,
|
|
92027
|
+
clientX: event.clientX,
|
|
92028
|
+
clientY: event.clientY,
|
|
92029
|
+
screenX: event.screenX,
|
|
92030
|
+
screenY: event.screenY,
|
|
92031
|
+
button: event.button,
|
|
92032
|
+
buttons: event.buttons,
|
|
92033
|
+
ctrlKey: event.ctrlKey,
|
|
92034
|
+
shiftKey: event.shiftKey,
|
|
92035
|
+
altKey: event.altKey,
|
|
92036
|
+
metaKey: event.metaKey
|
|
92037
|
+
}));
|
|
92038
|
+
};
|
|
91974
92039
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
91975
92040
|
}
|
|
91976
92041
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -91984,7 +92049,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91984
92049
|
layer.style.position = 'absolute';
|
|
91985
92050
|
layer.style.inset = '0';
|
|
91986
92051
|
layer.style.pointerEvents = 'none';
|
|
91987
|
-
layer.style.zIndex = '1';
|
|
91988
92052
|
container.appendChild(layer);
|
|
91989
92053
|
this.state.layer = layer;
|
|
91990
92054
|
this.initDOMEvents();
|
|
@@ -91997,14 +92061,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91997
92061
|
cancelAnimationFrame(this.state.updateFrame);
|
|
91998
92062
|
this.state.updateFrame = undefined;
|
|
91999
92063
|
}
|
|
92064
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92065
|
+
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92066
|
+
this.contentInteractionFrame = undefined;
|
|
92067
|
+
}
|
|
92068
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92000
92069
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92001
92070
|
cleanup();
|
|
92002
92071
|
});
|
|
92003
92072
|
this.state.frameElements.clear();
|
|
92004
92073
|
this.state.elements.clear();
|
|
92074
|
+
this.state.selectionElements.clear();
|
|
92005
92075
|
this.state.contentScaleElements.clear();
|
|
92006
92076
|
this.state.contentElements.clear();
|
|
92007
92077
|
this.state.contentMountElements.clear();
|
|
92078
|
+
this.state.contentInteractionZones.clear();
|
|
92079
|
+
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92080
|
+
cleanup();
|
|
92081
|
+
});
|
|
92082
|
+
this.state.contentInteractionZoneCleanups.clear();
|
|
92083
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92084
|
+
cleanup();
|
|
92085
|
+
});
|
|
92086
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92008
92087
|
this.state.contents.clear();
|
|
92009
92088
|
this.state.cleanups.clear();
|
|
92010
92089
|
this.state.autoHeightModes.clear();
|
|
@@ -92022,10 +92101,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92022
92101
|
this.eventCleanups = [];
|
|
92023
92102
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92024
92103
|
this.state.layer = undefined;
|
|
92104
|
+
this.state.selectionLayer = undefined;
|
|
92025
92105
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92026
92106
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92027
92107
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92028
92108
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92109
|
+
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92029
92110
|
};
|
|
92030
92111
|
_proto.scheduleRender = function scheduleRender() {
|
|
92031
92112
|
var _this = this;
|
|
@@ -92037,6 +92118,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92037
92118
|
_this.render();
|
|
92038
92119
|
});
|
|
92039
92120
|
};
|
|
92121
|
+
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92122
|
+
this.cleanupOverlayContent(id);
|
|
92123
|
+
this.invalidateContentInteractionZones(id);
|
|
92124
|
+
};
|
|
92040
92125
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92041
92126
|
return _async_to_generator(function() {
|
|
92042
92127
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92129,6 +92214,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92129
92214
|
var events = [
|
|
92130
92215
|
'pageDataChange',
|
|
92131
92216
|
'selectedItemChange',
|
|
92217
|
+
'preSelectedItemChange',
|
|
92132
92218
|
'itemPropertyChange',
|
|
92133
92219
|
'viewportTransform',
|
|
92134
92220
|
'viewRebuildFinish'
|
|
@@ -92138,6 +92224,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92138
92224
|
if (event === 'viewportTransform') {
|
|
92139
92225
|
_this.handleViewportTransform();
|
|
92140
92226
|
}
|
|
92227
|
+
_this.invalidateContentInteractionZones();
|
|
92141
92228
|
_this.scheduleRender();
|
|
92142
92229
|
});
|
|
92143
92230
|
});
|
|
@@ -92147,6 +92234,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92147
92234
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92148
92235
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92149
92236
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92237
|
+
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92238
|
+
};
|
|
92239
|
+
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92240
|
+
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92241
|
+
return false;
|
|
92242
|
+
}
|
|
92243
|
+
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92150
92244
|
};
|
|
92151
92245
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92152
92246
|
var editing = this.state.editing;
|
|
@@ -92166,6 +92260,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92166
92260
|
}
|
|
92167
92261
|
var items = this.options.getItems();
|
|
92168
92262
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92263
|
+
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92169
92264
|
var visibleCardIds = new Set();
|
|
92170
92265
|
var editingVisible = false;
|
|
92171
92266
|
items.forEach(function(item) {
|
|
@@ -92189,20 +92284,31 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92189
92284
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92190
92285
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92191
92286
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92192
|
-
|
|
92287
|
+
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92288
|
+
if (!_this.state.contents.has(item.id)) {
|
|
92193
92289
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92194
92290
|
}
|
|
92291
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92195
92292
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92196
92293
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92197
|
-
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, item
|
|
92294
|
+
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
92198
92295
|
overlay.style.left = boxStyle.left;
|
|
92199
92296
|
overlay.style.top = boxStyle.top;
|
|
92200
92297
|
overlay.style.width = boxStyle.width;
|
|
92201
92298
|
overlay.style.height = boxStyle.height;
|
|
92202
92299
|
overlay.style.transform = boxStyle.transform;
|
|
92203
92300
|
overlay.style.transformOrigin = '0 0';
|
|
92301
|
+
var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
|
|
92302
|
+
selectionOverlay.style.left = selectionBoxStyle.left;
|
|
92303
|
+
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92304
|
+
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92305
|
+
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92306
|
+
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92307
|
+
selectionOverlay.style.transformOrigin = '0 0';
|
|
92308
|
+
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92309
|
+
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92204
92310
|
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92205
|
-
_this.syncAutoHeight(item.id, item
|
|
92311
|
+
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92206
92312
|
_this.syncContentInteraction(item.id);
|
|
92207
92313
|
});
|
|
92208
92314
|
elements.forEach(function(_overlay, id) {
|
|
@@ -92241,6 +92347,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92241
92347
|
}
|
|
92242
92348
|
}
|
|
92243
92349
|
syncElementStackOrder(layer, rootElements);
|
|
92350
|
+
if (this.state.selectionLayer) {
|
|
92351
|
+
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92352
|
+
}
|
|
92244
92353
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92245
92354
|
var frameElements = [];
|
|
92246
92355
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92256,6 +92365,28 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92256
92365
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92257
92366
|
});
|
|
92258
92367
|
};
|
|
92368
|
+
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92369
|
+
var _layer_ownerDocument;
|
|
92370
|
+
if (this.state.selectionLayer) {
|
|
92371
|
+
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92372
|
+
layer.appendChild(this.state.selectionLayer);
|
|
92373
|
+
}
|
|
92374
|
+
return this.state.selectionLayer;
|
|
92375
|
+
}
|
|
92376
|
+
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92377
|
+
if (!ownerDocument) {
|
|
92378
|
+
return layer;
|
|
92379
|
+
}
|
|
92380
|
+
var selectionLayer = ownerDocument.createElement('div');
|
|
92381
|
+
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92382
|
+
selectionLayer.style.position = 'absolute';
|
|
92383
|
+
selectionLayer.style.inset = '0';
|
|
92384
|
+
selectionLayer.style.pointerEvents = 'none';
|
|
92385
|
+
selectionLayer.style.zIndex = '1';
|
|
92386
|
+
layer.appendChild(selectionLayer);
|
|
92387
|
+
this.state.selectionLayer = selectionLayer;
|
|
92388
|
+
return selectionLayer;
|
|
92389
|
+
};
|
|
92259
92390
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92260
92391
|
var _this = this;
|
|
92261
92392
|
var visibleFrameIds = new Set();
|
|
@@ -92320,6 +92451,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92320
92451
|
elements.set(id, overlay);
|
|
92321
92452
|
return overlay;
|
|
92322
92453
|
};
|
|
92454
|
+
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92455
|
+
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92456
|
+
if (selectionOverlay) {
|
|
92457
|
+
if (selectionOverlay.parentElement !== parent) {
|
|
92458
|
+
parent.appendChild(selectionOverlay);
|
|
92459
|
+
}
|
|
92460
|
+
return selectionOverlay;
|
|
92461
|
+
}
|
|
92462
|
+
selectionOverlay = document.createElement('div');
|
|
92463
|
+
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92464
|
+
selectionOverlay.dataset.itemId = id;
|
|
92465
|
+
selectionOverlay.style.position = 'absolute';
|
|
92466
|
+
selectionOverlay.style.pointerEvents = 'none';
|
|
92467
|
+
selectionOverlay.style.zIndex = '1';
|
|
92468
|
+
parent.appendChild(selectionOverlay);
|
|
92469
|
+
this.state.selectionElements.set(id, selectionOverlay);
|
|
92470
|
+
return selectionOverlay;
|
|
92471
|
+
};
|
|
92472
|
+
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92473
|
+
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92474
|
+
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92475
|
+
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92476
|
+
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92477
|
+
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92478
|
+
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92479
|
+
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92480
|
+
};
|
|
92481
|
+
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92482
|
+
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92483
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92484
|
+
};
|
|
92485
|
+
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92486
|
+
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92487
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92488
|
+
};
|
|
92323
92489
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92324
92490
|
var layer = this.state.layer;
|
|
92325
92491
|
if (!layer) {
|
|
@@ -92358,13 +92524,143 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92358
92524
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92359
92525
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92360
92526
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92361
|
-
|
|
92362
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92527
|
+
return isMouseEventInsideRect(event, element.getBoundingClientRect());
|
|
92363
92528
|
});
|
|
92364
92529
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92365
92530
|
}
|
|
92366
92531
|
return undefined;
|
|
92367
92532
|
};
|
|
92533
|
+
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92534
|
+
var zone = this.getContentInteractiveZoneByEvent(event);
|
|
92535
|
+
this.setActiveContentInteraction(zone);
|
|
92536
|
+
};
|
|
92537
|
+
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92538
|
+
var _this = this;
|
|
92539
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
92540
|
+
this.syncActiveContentInteraction(event);
|
|
92541
|
+
return;
|
|
92542
|
+
}
|
|
92543
|
+
this.pendingContentInteractionEvent = event;
|
|
92544
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92545
|
+
return;
|
|
92546
|
+
}
|
|
92547
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92548
|
+
_this.contentInteractionFrame = undefined;
|
|
92549
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92550
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92551
|
+
if (pendingEvent) {
|
|
92552
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92553
|
+
}
|
|
92554
|
+
});
|
|
92555
|
+
};
|
|
92556
|
+
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92557
|
+
var _this = this;
|
|
92558
|
+
var previous = this.state.activeContentInteraction;
|
|
92559
|
+
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)) {
|
|
92560
|
+
return;
|
|
92561
|
+
}
|
|
92562
|
+
this.state.activeContentInteraction = zone;
|
|
92563
|
+
var changedIds = new Set();
|
|
92564
|
+
if (previous) {
|
|
92565
|
+
changedIds.add(previous.id);
|
|
92566
|
+
}
|
|
92567
|
+
if (zone) {
|
|
92568
|
+
changedIds.add(zone.id);
|
|
92569
|
+
}
|
|
92570
|
+
changedIds.forEach(function(id) {
|
|
92571
|
+
_this.syncContentInteraction(id);
|
|
92572
|
+
});
|
|
92573
|
+
};
|
|
92574
|
+
_proto.getContentInteractiveZoneByEvent = function getContentInteractiveZoneByEvent(event) {
|
|
92575
|
+
var id = this.getHTMLCardIdByEvent(event);
|
|
92576
|
+
if (!id || this.isEditableCard(id)) {
|
|
92577
|
+
return undefined;
|
|
92578
|
+
}
|
|
92579
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92580
|
+
if (!contentOverlay) {
|
|
92581
|
+
return undefined;
|
|
92582
|
+
}
|
|
92583
|
+
var zone = this.getContentInteractionZones(id, contentOverlay).find(function(zone) {
|
|
92584
|
+
return isMouseEventInsideRect(event, zone.rect);
|
|
92585
|
+
});
|
|
92586
|
+
return zone ? {
|
|
92587
|
+
id: id,
|
|
92588
|
+
element: zone.element
|
|
92589
|
+
} : undefined;
|
|
92590
|
+
};
|
|
92591
|
+
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92592
|
+
var _this = this;
|
|
92593
|
+
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92594
|
+
if (cachedZones) {
|
|
92595
|
+
return cachedZones;
|
|
92596
|
+
}
|
|
92597
|
+
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92598
|
+
return !_this.isContentInteractionDisabled(element);
|
|
92599
|
+
}).map(function(element) {
|
|
92600
|
+
return {
|
|
92601
|
+
element: element,
|
|
92602
|
+
rect: element.getBoundingClientRect()
|
|
92603
|
+
};
|
|
92604
|
+
});
|
|
92605
|
+
this.state.contentInteractionZones.set(id, zones);
|
|
92606
|
+
this.observeContentInteractionZoneResizes(id, zones);
|
|
92607
|
+
return zones;
|
|
92608
|
+
};
|
|
92609
|
+
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92610
|
+
var _ref;
|
|
92611
|
+
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92612
|
+
var item = this.options.getItems().find(function(item) {
|
|
92613
|
+
return item.id === id;
|
|
92614
|
+
});
|
|
92615
|
+
if (!item) {
|
|
92616
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92617
|
+
}
|
|
92618
|
+
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 : [];
|
|
92619
|
+
if (selectors.length === 0) {
|
|
92620
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92621
|
+
}
|
|
92622
|
+
return [].concat([
|
|
92623
|
+
CONTENT_INTERACTIVE_SELECTOR
|
|
92624
|
+
], selectors).join(', ');
|
|
92625
|
+
};
|
|
92626
|
+
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92627
|
+
if (typeof element.closest !== 'function') {
|
|
92628
|
+
return false;
|
|
92629
|
+
}
|
|
92630
|
+
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92631
|
+
};
|
|
92632
|
+
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92633
|
+
if (id) {
|
|
92634
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92635
|
+
this.state.contentInteractionZones.delete(id);
|
|
92636
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92637
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92638
|
+
return;
|
|
92639
|
+
}
|
|
92640
|
+
this.state.contentInteractionZones.clear();
|
|
92641
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92642
|
+
cleanup();
|
|
92643
|
+
});
|
|
92644
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92645
|
+
};
|
|
92646
|
+
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92647
|
+
var _this = this;
|
|
92648
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92649
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92650
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92651
|
+
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92652
|
+
return;
|
|
92653
|
+
}
|
|
92654
|
+
var observer = new ResizeObserver(function() {
|
|
92655
|
+
_this.invalidateContentInteractionZones(id);
|
|
92656
|
+
});
|
|
92657
|
+
zones.forEach(function(zone) {
|
|
92658
|
+
observer.observe(zone.element);
|
|
92659
|
+
});
|
|
92660
|
+
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92661
|
+
observer.disconnect();
|
|
92662
|
+
});
|
|
92663
|
+
};
|
|
92368
92664
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92369
92665
|
var rect = this.options.container.getBoundingClientRect();
|
|
92370
92666
|
return {
|
|
@@ -92432,6 +92728,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92432
92728
|
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92433
92729
|
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92434
92730
|
}
|
|
92731
|
+
if (sizeChanged) {
|
|
92732
|
+
this.invalidateContentInteractionZones(id);
|
|
92733
|
+
}
|
|
92435
92734
|
};
|
|
92436
92735
|
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92437
92736
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
@@ -92439,8 +92738,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92439
92738
|
});
|
|
92440
92739
|
};
|
|
92441
92740
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92442
|
-
var _this_state_editing;
|
|
92741
|
+
var _this_state_editing, _this_state_activeContentInteraction;
|
|
92443
92742
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
92743
|
+
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92744
|
+
var isInteractive = isEditing || !!activeInteraction;
|
|
92444
92745
|
var overlay = this.state.elements.get(id);
|
|
92445
92746
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92446
92747
|
var contentOverlay = this.state.contentElements.get(id);
|
|
@@ -92455,34 +92756,49 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92455
92756
|
}
|
|
92456
92757
|
if (contentOverlay) {
|
|
92457
92758
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92458
|
-
contentOverlay.style.pointerEvents = 'none';
|
|
92759
|
+
contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92459
92760
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92460
|
-
|
|
92461
|
-
iframe.
|
|
92761
|
+
var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
|
|
92762
|
+
iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
|
|
92763
|
+
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92462
92764
|
});
|
|
92463
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92765
|
+
this.syncShellInteraction(id, contentOverlay, isInteractive);
|
|
92766
|
+
this.syncContentInteractionZones(id, contentOverlay, activeInteraction == null ? void 0 : activeInteraction.element, isEditing, isInteractive);
|
|
92464
92767
|
}
|
|
92465
92768
|
if (contentMount) {
|
|
92466
92769
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92467
|
-
contentMount.style.pointerEvents =
|
|
92468
|
-
contentMount.inert = !
|
|
92469
|
-
if (
|
|
92770
|
+
contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92771
|
+
contentMount.inert = !isInteractive;
|
|
92772
|
+
if (isInteractive) {
|
|
92470
92773
|
contentMount.removeAttribute('aria-hidden');
|
|
92471
92774
|
} else {
|
|
92472
92775
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92473
92776
|
}
|
|
92474
92777
|
}
|
|
92475
92778
|
};
|
|
92476
|
-
_proto.
|
|
92779
|
+
_proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeElement, isEditing, isInteractive) {
|
|
92780
|
+
var _this = this;
|
|
92781
|
+
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
92782
|
+
if (!isInteractive || _this.isContentInteractionDisabled(element)) {
|
|
92783
|
+
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
92784
|
+
element.style.pointerEvents = 'none';
|
|
92785
|
+
return;
|
|
92786
|
+
}
|
|
92787
|
+
var isElementInteractive = isEditing || activeElement === element;
|
|
92788
|
+
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
92789
|
+
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
92790
|
+
});
|
|
92791
|
+
};
|
|
92792
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92477
92793
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92478
|
-
var isShellInteractiveActive =
|
|
92794
|
+
var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
|
|
92479
92795
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92480
92796
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92481
92797
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92482
92798
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92483
92799
|
});
|
|
92484
92800
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92485
|
-
element.style.pointerEvents =
|
|
92801
|
+
element.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92486
92802
|
});
|
|
92487
92803
|
};
|
|
92488
92804
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92490,6 +92806,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92490
92806
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92491
92807
|
return;
|
|
92492
92808
|
}
|
|
92809
|
+
if (!this.isEditableCard(id)) {
|
|
92810
|
+
return;
|
|
92811
|
+
}
|
|
92493
92812
|
var box = this.options.getViewBoxById(id);
|
|
92494
92813
|
if (box.isEmpty()) {
|
|
92495
92814
|
return;
|
|
@@ -92533,6 +92852,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92533
92852
|
this.options.setViewport(editing.restoreViewport);
|
|
92534
92853
|
this.scheduleRender();
|
|
92535
92854
|
};
|
|
92855
|
+
_proto.isEditableCard = function isEditableCard(id) {
|
|
92856
|
+
var _this_options_resolveCardTypeConfig;
|
|
92857
|
+
var item = this.options.getItems().find(function(item) {
|
|
92858
|
+
return item.id === id;
|
|
92859
|
+
});
|
|
92860
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
92861
|
+
};
|
|
92536
92862
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92537
92863
|
var viewportElement = this.options.container.parentElement;
|
|
92538
92864
|
if (!viewportElement) {
|
|
@@ -92557,6 +92883,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92557
92883
|
};
|
|
92558
92884
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92559
92885
|
this.cleanupOverlayContent(id);
|
|
92886
|
+
this.invalidateContentInteractionZones(id);
|
|
92560
92887
|
overlay.innerHTML = '';
|
|
92561
92888
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92562
92889
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92566,14 +92893,74 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92566
92893
|
});
|
|
92567
92894
|
var contentCleanup = this.renderOverlayContent(shell.contentContainer, html.content, {
|
|
92568
92895
|
id: id,
|
|
92569
|
-
autoHeight:
|
|
92896
|
+
autoHeight: this.isAutoHeightEnabled(item)
|
|
92570
92897
|
});
|
|
92898
|
+
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92571
92899
|
this.state.cleanups.set(id, function() {
|
|
92572
92900
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92573
92901
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
92574
92902
|
});
|
|
92575
92903
|
this.state.contents.set(id, html);
|
|
92576
92904
|
};
|
|
92905
|
+
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
92906
|
+
var _this = this;
|
|
92907
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92908
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
92909
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92910
|
+
if (typeof MutationObserver !== 'function') {
|
|
92911
|
+
return;
|
|
92912
|
+
}
|
|
92913
|
+
var observer = new MutationObserver(function() {
|
|
92914
|
+
_this.invalidateContentInteractionZones(id);
|
|
92915
|
+
});
|
|
92916
|
+
observer.observe(contentContainer, {
|
|
92917
|
+
attributes: true,
|
|
92918
|
+
childList: true,
|
|
92919
|
+
subtree: true
|
|
92920
|
+
});
|
|
92921
|
+
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
92922
|
+
observer.disconnect();
|
|
92923
|
+
});
|
|
92924
|
+
};
|
|
92925
|
+
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
92926
|
+
var _ref, _config_style;
|
|
92927
|
+
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
92928
|
+
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
92929
|
+
this.htmlRootConfigCleanups.delete(root);
|
|
92930
|
+
var config = html.root;
|
|
92931
|
+
if (!config) {
|
|
92932
|
+
return;
|
|
92933
|
+
}
|
|
92934
|
+
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
92935
|
+
var styleProperties = [];
|
|
92936
|
+
classNames.forEach(function(className) {
|
|
92937
|
+
root.classList.add(className);
|
|
92938
|
+
});
|
|
92939
|
+
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
92940
|
+
var property = param[0], value = param[1];
|
|
92941
|
+
if (value === undefined) {
|
|
92942
|
+
return;
|
|
92943
|
+
}
|
|
92944
|
+
styleProperties.push(property);
|
|
92945
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92946
|
+
root.style.setProperty(property, String(value));
|
|
92947
|
+
return;
|
|
92948
|
+
}
|
|
92949
|
+
root.style[property] = String(value);
|
|
92950
|
+
});
|
|
92951
|
+
this.htmlRootConfigCleanups.set(root, function() {
|
|
92952
|
+
classNames.forEach(function(className) {
|
|
92953
|
+
root.classList.remove(className);
|
|
92954
|
+
});
|
|
92955
|
+
styleProperties.forEach(function(property) {
|
|
92956
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92957
|
+
root.style.removeProperty(property);
|
|
92958
|
+
return;
|
|
92959
|
+
}
|
|
92960
|
+
root.style[property] = '';
|
|
92961
|
+
});
|
|
92962
|
+
});
|
|
92963
|
+
};
|
|
92577
92964
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
92578
92965
|
var _this = this;
|
|
92579
92966
|
switch(content.kind){
|
|
@@ -92639,6 +93026,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92639
93026
|
};
|
|
92640
93027
|
};
|
|
92641
93028
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93029
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92642
93030
|
var cleanup = this.state.cleanups.get(id);
|
|
92643
93031
|
if (cleanup) {
|
|
92644
93032
|
cleanup();
|
|
@@ -92647,13 +93035,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92647
93035
|
this.state.contents.delete(id);
|
|
92648
93036
|
this.state.contentMountElements.delete(id);
|
|
92649
93037
|
this.state.autoHeightModes.delete(id);
|
|
93038
|
+
this.invalidateContentInteractionZones(id);
|
|
93039
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93040
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92650
93041
|
this.cleanupAutoHeight(id);
|
|
92651
93042
|
};
|
|
92652
93043
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
92653
|
-
var _this_state_elements_get;
|
|
93044
|
+
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
92654
93045
|
this.cleanupOverlayContent(id);
|
|
92655
93046
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93047
|
+
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
92656
93048
|
this.state.elements.delete(id);
|
|
93049
|
+
this.state.selectionElements.delete(id);
|
|
92657
93050
|
this.state.contentScaleElements.delete(id);
|
|
92658
93051
|
this.state.contentElements.delete(id);
|
|
92659
93052
|
};
|
|
@@ -92770,7 +93163,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92770
93163
|
var item = this.options.getItems().find(function(candidate) {
|
|
92771
93164
|
return candidate.id === id;
|
|
92772
93165
|
});
|
|
92773
|
-
if (!
|
|
93166
|
+
if (!this.isAutoHeightEnabled(item)) {
|
|
92774
93167
|
this.cleanupAutoHeight(id);
|
|
92775
93168
|
return;
|
|
92776
93169
|
}
|
|
@@ -92852,7 +93245,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92852
93245
|
var item = this.options.getItems().find(function(candidate) {
|
|
92853
93246
|
return candidate.id === id;
|
|
92854
93247
|
});
|
|
92855
|
-
if (!isCardItem(item) || item
|
|
93248
|
+
if (!isCardItem(item) || !this.isAutoHeightEnabled(item)) {
|
|
92856
93249
|
return;
|
|
92857
93250
|
}
|
|
92858
93251
|
if (!Number.isFinite(height) || height <= 0) {
|
|
@@ -92865,7 +93258,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92865
93258
|
this.options.setCardItemHeight(id, nextHeight);
|
|
92866
93259
|
};
|
|
92867
93260
|
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
92868
|
-
if (!isCardItem(item) || item
|
|
93261
|
+
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
92869
93262
|
return contentHeight;
|
|
92870
93263
|
}
|
|
92871
93264
|
var scaleOverlay = this.state.contentScaleElements.get(item.id);
|
|
@@ -92875,6 +93268,25 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92875
93268
|
}
|
|
92876
93269
|
return contentHeight / displayedHeight * item.property.height;
|
|
92877
93270
|
};
|
|
93271
|
+
_proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
|
|
93272
|
+
var _this_options_resolveCardTypeConfig;
|
|
93273
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
|
|
93274
|
+
};
|
|
93275
|
+
_proto.isAutoScaleEnabled = function isAutoScaleEnabled(item) {
|
|
93276
|
+
var _this_options_resolveCardTypeConfig;
|
|
93277
|
+
if (!isCardItem(item)) {
|
|
93278
|
+
return true;
|
|
93279
|
+
}
|
|
93280
|
+
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
93281
|
+
};
|
|
93282
|
+
_create_class(HTMLOverlayManager, [
|
|
93283
|
+
{
|
|
93284
|
+
key: "layerElement",
|
|
93285
|
+
get: function get() {
|
|
93286
|
+
return this.state.layer;
|
|
93287
|
+
}
|
|
93288
|
+
}
|
|
93289
|
+
]);
|
|
92878
93290
|
return HTMLOverlayManager;
|
|
92879
93291
|
}();
|
|
92880
93292
|
function waitForCardCaptureReady(root) {
|
|
@@ -92916,6 +93328,17 @@ function waitForCardCaptureReady(root) {
|
|
|
92916
93328
|
});
|
|
92917
93329
|
})();
|
|
92918
93330
|
}
|
|
93331
|
+
function formatCssColor(color, alpha) {
|
|
93332
|
+
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93333
|
+
var red = normalizedColor >> 16 & 0xFF;
|
|
93334
|
+
var green = normalizedColor >> 8 & 0xFF;
|
|
93335
|
+
var blue = normalizedColor & 0xFF;
|
|
93336
|
+
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93337
|
+
}
|
|
93338
|
+
function formatCssNumber(value) {
|
|
93339
|
+
var normalized = Number.isFinite(value) ? value : 0;
|
|
93340
|
+
return Number(normalized.toFixed(6)).toString();
|
|
93341
|
+
}
|
|
92919
93342
|
function nextAnimationFrame() {
|
|
92920
93343
|
return new Promise(function(resolve) {
|
|
92921
93344
|
requestAnimationFrame(function() {
|
|
@@ -93334,6 +93757,9 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93334
93757
|
});
|
|
93335
93758
|
return replacement;
|
|
93336
93759
|
}
|
|
93760
|
+
function isMouseEventInsideRect(event, rect) {
|
|
93761
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
93762
|
+
}
|
|
93337
93763
|
function createFlattenedIframeContent(iframe) {
|
|
93338
93764
|
var doc = iframe.contentDocument;
|
|
93339
93765
|
if (!doc) {
|
|
@@ -93373,6 +93799,19 @@ function withTimeout(promise, timeout) {
|
|
|
93373
93799
|
});
|
|
93374
93800
|
}
|
|
93375
93801
|
|
|
93802
|
+
function orderSDKCanvasLayers(param) {
|
|
93803
|
+
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
93804
|
+
[
|
|
93805
|
+
playerContainer,
|
|
93806
|
+
htmlOverlayLayer,
|
|
93807
|
+
gestureCanvas
|
|
93808
|
+
].forEach(function(layer) {
|
|
93809
|
+
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
93810
|
+
container.appendChild(layer);
|
|
93811
|
+
}
|
|
93812
|
+
});
|
|
93813
|
+
}
|
|
93814
|
+
|
|
93376
93815
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93377
93816
|
var SDK = /*#__PURE__*/ function() {
|
|
93378
93817
|
function SDK(container, mode) {
|
|
@@ -93479,11 +93918,44 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93479
93918
|
propertyValue: height
|
|
93480
93919
|
});
|
|
93481
93920
|
},
|
|
93921
|
+
getSelectedItemIds: function getSelectedItemIds() {
|
|
93922
|
+
var _ref;
|
|
93923
|
+
var _this__pageData;
|
|
93924
|
+
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
93925
|
+
},
|
|
93926
|
+
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
93927
|
+
var _this__pageData;
|
|
93928
|
+
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
93929
|
+
},
|
|
93930
|
+
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
93931
|
+
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;
|
|
93932
|
+
return {
|
|
93933
|
+
color: wireframeColor,
|
|
93934
|
+
alpha: wireframeAlpha,
|
|
93935
|
+
width: wireframeWidth
|
|
93936
|
+
};
|
|
93937
|
+
},
|
|
93938
|
+
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
93939
|
+
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
93940
|
+
return {
|
|
93941
|
+
color: preSelectedColor,
|
|
93942
|
+
alpha: 1,
|
|
93943
|
+
width: preSelectedWidth
|
|
93944
|
+
};
|
|
93945
|
+
},
|
|
93946
|
+
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
93947
|
+
var _this__gestureHandler;
|
|
93948
|
+
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
93949
|
+
},
|
|
93482
93950
|
resolveCardHTML: function resolveCardHTML(item) {
|
|
93483
93951
|
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
93952
|
+
},
|
|
93953
|
+
resolveCardTypeConfig: function resolveCardTypeConfig(item) {
|
|
93954
|
+
return isCardItem(item) ? _this.resolveCardTypeConfig(item) : undefined;
|
|
93484
93955
|
}
|
|
93485
93956
|
});
|
|
93486
93957
|
this._htmlOverlayManager.attach();
|
|
93958
|
+
this.syncCanvasLayerOrder();
|
|
93487
93959
|
}
|
|
93488
93960
|
var _proto = SDK.prototype;
|
|
93489
93961
|
_proto.dispose = function dispose() {
|
|
@@ -93579,6 +94051,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93579
94051
|
this.initPlayer(SDK.config.mode);
|
|
93580
94052
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
93581
94053
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94054
|
+
this.syncCanvasLayerOrder();
|
|
93582
94055
|
return [
|
|
93583
94056
|
4,
|
|
93584
94057
|
this.runByPageData(this.pageData)
|
|
@@ -93628,6 +94101,16 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93628
94101
|
env: 'editor'
|
|
93629
94102
|
});
|
|
93630
94103
|
this.player.resize();
|
|
94104
|
+
this.syncCanvasLayerOrder();
|
|
94105
|
+
};
|
|
94106
|
+
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94107
|
+
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94108
|
+
orderSDKCanvasLayers({
|
|
94109
|
+
container: this._container,
|
|
94110
|
+
playerContainer: this._playerContainer,
|
|
94111
|
+
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94112
|
+
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94113
|
+
});
|
|
93631
94114
|
};
|
|
93632
94115
|
_proto.getInitParam = function getInitParam(param) {
|
|
93633
94116
|
return _async_to_generator(function() {
|
|
@@ -95624,10 +96107,37 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95624
96107
|
* @returns HTML 渲染配置
|
|
95625
96108
|
*/ _proto.resolveCardHTML = function resolveCardHTML(item) {
|
|
95626
96109
|
var _cardTypeConfig_html;
|
|
95627
|
-
var cardTypeConfig =
|
|
96110
|
+
var cardTypeConfig = this.resolveCardTypeConfig(item);
|
|
96111
|
+
return cardTypeConfig == null ? void 0 : (_cardTypeConfig_html = cardTypeConfig.html) == null ? void 0 : _cardTypeConfig_html.call(cardTypeConfig, item);
|
|
96112
|
+
};
|
|
96113
|
+
/**
|
|
96114
|
+
* @description 按 cardType 从注册表解析卡片类型配置。
|
|
96115
|
+
* @param item 卡片元素
|
|
96116
|
+
* @returns 卡片类型配置
|
|
96117
|
+
*/ _proto.resolveCardTypeConfig = function resolveCardTypeConfig(item) {
|
|
96118
|
+
return SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
95628
96119
|
return t.type === item.cardType;
|
|
95629
96120
|
});
|
|
95630
|
-
|
|
96121
|
+
};
|
|
96122
|
+
/**
|
|
96123
|
+
* @description 重新解析并挂载指定卡片的 HTML 内容。
|
|
96124
|
+
* @description 当 inline/document 内容依赖 extension 或外部状态变化时,可调用此方法刷新 DOM。
|
|
96125
|
+
* @param id 卡片元素 ID
|
|
96126
|
+
* @returns 是否成功触发刷新
|
|
96127
|
+
*/ _proto.refreshCardHTML = function refreshCardHTML(id) {
|
|
96128
|
+
var _this__htmlOverlayManager, _this__htmlOverlayManager1;
|
|
96129
|
+
var item = this.getSDKItem(id);
|
|
96130
|
+
if (!isCardItem(item)) {
|
|
96131
|
+
console.warn('CardItem "' + id + '" not found.');
|
|
96132
|
+
return false;
|
|
96133
|
+
}
|
|
96134
|
+
if (!this.resolveCardHTML(item)) {
|
|
96135
|
+
console.warn('CardItem "' + id + '" has no registered HTML renderer.');
|
|
96136
|
+
return false;
|
|
96137
|
+
}
|
|
96138
|
+
(_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.invalidateCardHTML(id);
|
|
96139
|
+
(_this__htmlOverlayManager1 = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager1.scheduleRender();
|
|
96140
|
+
return true;
|
|
95631
96141
|
};
|
|
95632
96142
|
/**
|
|
95633
96143
|
* @description 创建卡片元素
|