@vvfx/sdk 0.2.2-beta.4 → 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 +8 -0
- package/dist/html-overlay/manager.d.ts +37 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +491 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +491 -21
- package/dist/index.mjs.map +1 -1
- package/dist/layer-order.d.ts +7 -0
- package/dist/sdk.d.ts +1 -0
- package/dist/types.d.ts +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: TODO
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 赤芍,何即,不择,意绮
|
|
6
|
-
* Version: v0.2.2-beta.
|
|
6
|
+
* Version: v0.2.2-beta.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -47298,7 +47298,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47298
47298
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47299
47299
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47300
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;
|
|
47301
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47301
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty()) && !isCardItem(preSelectedItem)) {
|
|
47302
47302
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47303
47303
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47304
47304
|
}
|
|
@@ -55882,6 +55882,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55882
55882
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55883
55883
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55884
55884
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55885
|
+
var isSingleCardItem = isCardItem(selectedItem);
|
|
55885
55886
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55886
55887
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55887
55888
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55921,9 +55922,11 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55921
55922
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55922
55923
|
// 根据box获取边缘线
|
|
55923
55924
|
var corners = this.wireframe.box.corners;
|
|
55924
|
-
|
|
55925
|
-
|
|
55926
|
-
|
|
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
|
+
}
|
|
55927
55930
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55928
55931
|
// 成组暂不支持缩放
|
|
55929
55932
|
if (selectedItems.length === 1) {
|
|
@@ -63165,10 +63168,13 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63165
63168
|
1
|
|
63166
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;
|
|
63167
63170
|
// 校验 cardType 是否已在配置中注册
|
|
63171
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63172
|
+
return t.type === cardType;
|
|
63173
|
+
});
|
|
63168
63174
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63169
63175
|
return t.type;
|
|
63170
63176
|
});
|
|
63171
|
-
if (!
|
|
63177
|
+
if (!cardTypeConfig) {
|
|
63172
63178
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63173
63179
|
return;
|
|
63174
63180
|
}
|
|
@@ -91897,6 +91903,27 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91897
91903
|
|
|
91898
91904
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91899
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(', ');
|
|
91900
91927
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91901
91928
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91902
91929
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91906,12 +91933,17 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91906
91933
|
var _this = this;
|
|
91907
91934
|
this.options = options;
|
|
91908
91935
|
this.eventCleanups = [];
|
|
91936
|
+
this.htmlRootConfigCleanups = new WeakMap();
|
|
91909
91937
|
this.state = {
|
|
91910
91938
|
frameElements: new Map(),
|
|
91911
91939
|
elements: new Map(),
|
|
91940
|
+
selectionElements: new Map(),
|
|
91912
91941
|
contentScaleElements: new Map(),
|
|
91913
91942
|
contentElements: new Map(),
|
|
91914
91943
|
contentMountElements: new Map(),
|
|
91944
|
+
contentInteractionZones: new Map(),
|
|
91945
|
+
contentInteractionZoneCleanups: new Map(),
|
|
91946
|
+
contentInteractionResizeCleanups: new Map(),
|
|
91915
91947
|
contents: new Map(),
|
|
91916
91948
|
cleanups: new Map(),
|
|
91917
91949
|
autoHeightModes: new Map(),
|
|
@@ -91931,6 +91963,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91931
91963
|
}
|
|
91932
91964
|
return;
|
|
91933
91965
|
}
|
|
91966
|
+
if (!_this.isEditableCard(targetId)) {
|
|
91967
|
+
return;
|
|
91968
|
+
}
|
|
91934
91969
|
event.preventDefault();
|
|
91935
91970
|
event.stopPropagation();
|
|
91936
91971
|
_this.enterEditing(targetId);
|
|
@@ -91946,6 +91981,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91946
91981
|
_this.exitEditing();
|
|
91947
91982
|
};
|
|
91948
91983
|
this.handleContainerMouseMove = function(event) {
|
|
91984
|
+
_this.scheduleActiveContentInteractionSync(event);
|
|
91949
91985
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
91950
91986
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
91951
91987
|
return;
|
|
@@ -91960,6 +91996,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91960
91996
|
}
|
|
91961
91997
|
};
|
|
91962
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);
|
|
91963
92005
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
91964
92006
|
if (!previousId) {
|
|
91965
92007
|
return;
|
|
@@ -91967,6 +92009,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91967
92009
|
_this.state.hoverShellInteractiveId = undefined;
|
|
91968
92010
|
_this.syncContentInteraction(previousId);
|
|
91969
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
|
+
};
|
|
91970
92039
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
91971
92040
|
}
|
|
91972
92041
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -91980,7 +92049,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91980
92049
|
layer.style.position = 'absolute';
|
|
91981
92050
|
layer.style.inset = '0';
|
|
91982
92051
|
layer.style.pointerEvents = 'none';
|
|
91983
|
-
layer.style.zIndex = '1';
|
|
91984
92052
|
container.appendChild(layer);
|
|
91985
92053
|
this.state.layer = layer;
|
|
91986
92054
|
this.initDOMEvents();
|
|
@@ -91993,14 +92061,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91993
92061
|
cancelAnimationFrame(this.state.updateFrame);
|
|
91994
92062
|
this.state.updateFrame = undefined;
|
|
91995
92063
|
}
|
|
92064
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92065
|
+
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92066
|
+
this.contentInteractionFrame = undefined;
|
|
92067
|
+
}
|
|
92068
|
+
this.pendingContentInteractionEvent = undefined;
|
|
91996
92069
|
this.state.cleanups.forEach(function(cleanup) {
|
|
91997
92070
|
cleanup();
|
|
91998
92071
|
});
|
|
91999
92072
|
this.state.frameElements.clear();
|
|
92000
92073
|
this.state.elements.clear();
|
|
92074
|
+
this.state.selectionElements.clear();
|
|
92001
92075
|
this.state.contentScaleElements.clear();
|
|
92002
92076
|
this.state.contentElements.clear();
|
|
92003
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();
|
|
92004
92087
|
this.state.contents.clear();
|
|
92005
92088
|
this.state.cleanups.clear();
|
|
92006
92089
|
this.state.autoHeightModes.clear();
|
|
@@ -92018,10 +92101,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92018
92101
|
this.eventCleanups = [];
|
|
92019
92102
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92020
92103
|
this.state.layer = undefined;
|
|
92104
|
+
this.state.selectionLayer = undefined;
|
|
92021
92105
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92022
92106
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92023
92107
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92024
92108
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92109
|
+
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92025
92110
|
};
|
|
92026
92111
|
_proto.scheduleRender = function scheduleRender() {
|
|
92027
92112
|
var _this = this;
|
|
@@ -92035,6 +92120,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92035
92120
|
};
|
|
92036
92121
|
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92037
92122
|
this.cleanupOverlayContent(id);
|
|
92123
|
+
this.invalidateContentInteractionZones(id);
|
|
92038
92124
|
};
|
|
92039
92125
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92040
92126
|
return _async_to_generator(function() {
|
|
@@ -92128,6 +92214,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92128
92214
|
var events = [
|
|
92129
92215
|
'pageDataChange',
|
|
92130
92216
|
'selectedItemChange',
|
|
92217
|
+
'preSelectedItemChange',
|
|
92131
92218
|
'itemPropertyChange',
|
|
92132
92219
|
'viewportTransform',
|
|
92133
92220
|
'viewRebuildFinish'
|
|
@@ -92137,6 +92224,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92137
92224
|
if (event === 'viewportTransform') {
|
|
92138
92225
|
_this.handleViewportTransform();
|
|
92139
92226
|
}
|
|
92227
|
+
_this.invalidateContentInteractionZones();
|
|
92140
92228
|
_this.scheduleRender();
|
|
92141
92229
|
});
|
|
92142
92230
|
});
|
|
@@ -92146,6 +92234,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92146
92234
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92147
92235
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92148
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"]');
|
|
92149
92244
|
};
|
|
92150
92245
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92151
92246
|
var editing = this.state.editing;
|
|
@@ -92165,6 +92260,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92165
92260
|
}
|
|
92166
92261
|
var items = this.options.getItems();
|
|
92167
92262
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92263
|
+
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92168
92264
|
var visibleCardIds = new Set();
|
|
92169
92265
|
var editingVisible = false;
|
|
92170
92266
|
items.forEach(function(item) {
|
|
@@ -92188,9 +92284,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92188
92284
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92189
92285
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92190
92286
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92287
|
+
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92191
92288
|
if (!_this.state.contents.has(item.id)) {
|
|
92192
92289
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92193
92290
|
}
|
|
92291
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92194
92292
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92195
92293
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92196
92294
|
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
@@ -92200,6 +92298,15 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92200
92298
|
overlay.style.height = boxStyle.height;
|
|
92201
92299
|
overlay.style.transform = boxStyle.transform;
|
|
92202
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);
|
|
92203
92310
|
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92204
92311
|
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92205
92312
|
_this.syncContentInteraction(item.id);
|
|
@@ -92240,6 +92347,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92240
92347
|
}
|
|
92241
92348
|
}
|
|
92242
92349
|
syncElementStackOrder(layer, rootElements);
|
|
92350
|
+
if (this.state.selectionLayer) {
|
|
92351
|
+
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92352
|
+
}
|
|
92243
92353
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92244
92354
|
var frameElements = [];
|
|
92245
92355
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92255,6 +92365,28 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92255
92365
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92256
92366
|
});
|
|
92257
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
|
+
};
|
|
92258
92390
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92259
92391
|
var _this = this;
|
|
92260
92392
|
var visibleFrameIds = new Set();
|
|
@@ -92319,6 +92451,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92319
92451
|
elements.set(id, overlay);
|
|
92320
92452
|
return overlay;
|
|
92321
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
|
+
};
|
|
92322
92489
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92323
92490
|
var layer = this.state.layer;
|
|
92324
92491
|
if (!layer) {
|
|
@@ -92357,13 +92524,143 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92357
92524
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92358
92525
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92359
92526
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92360
|
-
|
|
92361
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92527
|
+
return isMouseEventInsideRect(event, element.getBoundingClientRect());
|
|
92362
92528
|
});
|
|
92363
92529
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92364
92530
|
}
|
|
92365
92531
|
return undefined;
|
|
92366
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
|
+
};
|
|
92367
92664
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92368
92665
|
var rect = this.options.container.getBoundingClientRect();
|
|
92369
92666
|
return {
|
|
@@ -92431,6 +92728,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92431
92728
|
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92432
92729
|
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92433
92730
|
}
|
|
92731
|
+
if (sizeChanged) {
|
|
92732
|
+
this.invalidateContentInteractionZones(id);
|
|
92733
|
+
}
|
|
92434
92734
|
};
|
|
92435
92735
|
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92436
92736
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
@@ -92438,8 +92738,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92438
92738
|
});
|
|
92439
92739
|
};
|
|
92440
92740
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92441
|
-
var _this_state_editing;
|
|
92741
|
+
var _this_state_editing, _this_state_activeContentInteraction;
|
|
92442
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;
|
|
92443
92745
|
var overlay = this.state.elements.get(id);
|
|
92444
92746
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92445
92747
|
var contentOverlay = this.state.contentElements.get(id);
|
|
@@ -92454,34 +92756,49 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92454
92756
|
}
|
|
92455
92757
|
if (contentOverlay) {
|
|
92456
92758
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92457
|
-
contentOverlay.style.pointerEvents = 'none';
|
|
92759
|
+
contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92458
92760
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92459
|
-
|
|
92460
|
-
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;
|
|
92461
92764
|
});
|
|
92462
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92765
|
+
this.syncShellInteraction(id, contentOverlay, isInteractive);
|
|
92766
|
+
this.syncContentInteractionZones(id, contentOverlay, activeInteraction == null ? void 0 : activeInteraction.element, isEditing, isInteractive);
|
|
92463
92767
|
}
|
|
92464
92768
|
if (contentMount) {
|
|
92465
92769
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92466
|
-
contentMount.style.pointerEvents =
|
|
92467
|
-
contentMount.inert = !
|
|
92468
|
-
if (
|
|
92770
|
+
contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92771
|
+
contentMount.inert = !isInteractive;
|
|
92772
|
+
if (isInteractive) {
|
|
92469
92773
|
contentMount.removeAttribute('aria-hidden');
|
|
92470
92774
|
} else {
|
|
92471
92775
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92472
92776
|
}
|
|
92473
92777
|
}
|
|
92474
92778
|
};
|
|
92475
|
-
_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) {
|
|
92476
92793
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92477
|
-
var isShellInteractiveActive =
|
|
92794
|
+
var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
|
|
92478
92795
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92479
92796
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92480
92797
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92481
92798
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92482
92799
|
});
|
|
92483
92800
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92484
|
-
element.style.pointerEvents =
|
|
92801
|
+
element.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92485
92802
|
});
|
|
92486
92803
|
};
|
|
92487
92804
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92489,6 +92806,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92489
92806
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92490
92807
|
return;
|
|
92491
92808
|
}
|
|
92809
|
+
if (!this.isEditableCard(id)) {
|
|
92810
|
+
return;
|
|
92811
|
+
}
|
|
92492
92812
|
var box = this.options.getViewBoxById(id);
|
|
92493
92813
|
if (box.isEmpty()) {
|
|
92494
92814
|
return;
|
|
@@ -92532,6 +92852,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92532
92852
|
this.options.setViewport(editing.restoreViewport);
|
|
92533
92853
|
this.scheduleRender();
|
|
92534
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
|
+
};
|
|
92535
92862
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92536
92863
|
var viewportElement = this.options.container.parentElement;
|
|
92537
92864
|
if (!viewportElement) {
|
|
@@ -92556,6 +92883,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92556
92883
|
};
|
|
92557
92884
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92558
92885
|
this.cleanupOverlayContent(id);
|
|
92886
|
+
this.invalidateContentInteractionZones(id);
|
|
92559
92887
|
overlay.innerHTML = '';
|
|
92560
92888
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92561
92889
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92567,12 +92895,72 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92567
92895
|
id: id,
|
|
92568
92896
|
autoHeight: this.isAutoHeightEnabled(item)
|
|
92569
92897
|
});
|
|
92898
|
+
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92570
92899
|
this.state.cleanups.set(id, function() {
|
|
92571
92900
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92572
92901
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
92573
92902
|
});
|
|
92574
92903
|
this.state.contents.set(id, html);
|
|
92575
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
|
+
};
|
|
92576
92964
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
92577
92965
|
var _this = this;
|
|
92578
92966
|
switch(content.kind){
|
|
@@ -92638,6 +93026,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92638
93026
|
};
|
|
92639
93027
|
};
|
|
92640
93028
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93029
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92641
93030
|
var cleanup = this.state.cleanups.get(id);
|
|
92642
93031
|
if (cleanup) {
|
|
92643
93032
|
cleanup();
|
|
@@ -92646,13 +93035,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92646
93035
|
this.state.contents.delete(id);
|
|
92647
93036
|
this.state.contentMountElements.delete(id);
|
|
92648
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);
|
|
92649
93041
|
this.cleanupAutoHeight(id);
|
|
92650
93042
|
};
|
|
92651
93043
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
92652
|
-
var _this_state_elements_get;
|
|
93044
|
+
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
92653
93045
|
this.cleanupOverlayContent(id);
|
|
92654
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();
|
|
92655
93048
|
this.state.elements.delete(id);
|
|
93049
|
+
this.state.selectionElements.delete(id);
|
|
92656
93050
|
this.state.contentScaleElements.delete(id);
|
|
92657
93051
|
this.state.contentElements.delete(id);
|
|
92658
93052
|
};
|
|
@@ -92885,6 +93279,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92885
93279
|
}
|
|
92886
93280
|
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
92887
93281
|
};
|
|
93282
|
+
_create_class(HTMLOverlayManager, [
|
|
93283
|
+
{
|
|
93284
|
+
key: "layerElement",
|
|
93285
|
+
get: function get() {
|
|
93286
|
+
return this.state.layer;
|
|
93287
|
+
}
|
|
93288
|
+
}
|
|
93289
|
+
]);
|
|
92888
93290
|
return HTMLOverlayManager;
|
|
92889
93291
|
}();
|
|
92890
93292
|
function waitForCardCaptureReady(root) {
|
|
@@ -92926,6 +93328,17 @@ function waitForCardCaptureReady(root) {
|
|
|
92926
93328
|
});
|
|
92927
93329
|
})();
|
|
92928
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
|
+
}
|
|
92929
93342
|
function nextAnimationFrame() {
|
|
92930
93343
|
return new Promise(function(resolve) {
|
|
92931
93344
|
requestAnimationFrame(function() {
|
|
@@ -93344,6 +93757,9 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93344
93757
|
});
|
|
93345
93758
|
return replacement;
|
|
93346
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
|
+
}
|
|
93347
93763
|
function createFlattenedIframeContent(iframe) {
|
|
93348
93764
|
var doc = iframe.contentDocument;
|
|
93349
93765
|
if (!doc) {
|
|
@@ -93383,6 +93799,19 @@ function withTimeout(promise, timeout) {
|
|
|
93383
93799
|
});
|
|
93384
93800
|
}
|
|
93385
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
|
+
|
|
93386
93815
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93387
93816
|
var SDK = /*#__PURE__*/ function() {
|
|
93388
93817
|
function SDK(container, mode) {
|
|
@@ -93489,6 +93918,35 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93489
93918
|
propertyValue: height
|
|
93490
93919
|
});
|
|
93491
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
|
+
},
|
|
93492
93950
|
resolveCardHTML: function resolveCardHTML(item) {
|
|
93493
93951
|
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
93494
93952
|
},
|
|
@@ -93497,6 +93955,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93497
93955
|
}
|
|
93498
93956
|
});
|
|
93499
93957
|
this._htmlOverlayManager.attach();
|
|
93958
|
+
this.syncCanvasLayerOrder();
|
|
93500
93959
|
}
|
|
93501
93960
|
var _proto = SDK.prototype;
|
|
93502
93961
|
_proto.dispose = function dispose() {
|
|
@@ -93592,6 +94051,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93592
94051
|
this.initPlayer(SDK.config.mode);
|
|
93593
94052
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
93594
94053
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94054
|
+
this.syncCanvasLayerOrder();
|
|
93595
94055
|
return [
|
|
93596
94056
|
4,
|
|
93597
94057
|
this.runByPageData(this.pageData)
|
|
@@ -93641,6 +94101,16 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93641
94101
|
env: 'editor'
|
|
93642
94102
|
});
|
|
93643
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
|
+
});
|
|
93644
94114
|
};
|
|
93645
94115
|
_proto.getInitParam = function getInitParam(param) {
|
|
93646
94116
|
return _async_to_generator(function() {
|