@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.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: TODO
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 赤芍,何即,不择,意绮
|
|
6
|
-
* Version: v0.2.2-beta.
|
|
6
|
+
* Version: v0.2.2-beta.5
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -47317,7 +47317,7 @@ var SelectorGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
47317
47317
|
var preSelectedItem = this.pageDataUtils.getPreSelectedItem();
|
|
47318
47318
|
var preSelectedItemBox = this.pageDataUtils.getViewBoxById((_ref = preSelectedItem == null ? void 0 : preSelectedItem.id) != null ? _ref : '');
|
|
47319
47319
|
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, regionBoxColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxColor, regionBoxAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionBoxAlpha, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, regionWireframeWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeWidth, regionWireframeColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeColor, regionWireframeAlpha = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.regionWireframeAlpha;
|
|
47320
|
-
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty())) {
|
|
47320
|
+
if (!(preSelectedItemBox == null ? void 0 : preSelectedItemBox.isEmpty()) && !isCardItem(preSelectedItem)) {
|
|
47321
47321
|
this.graphics.lineStyle(preSelectedWidth, preSelectedColor);
|
|
47322
47322
|
this.graphics.drawBox(preSelectedItemBox);
|
|
47323
47323
|
}
|
|
@@ -55901,6 +55901,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55901
55901
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55902
55902
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55903
55903
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55904
|
+
var isSingleCardItem = isCardItem(selectedItem);
|
|
55904
55905
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55905
55906
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55906
55907
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55940,9 +55941,11 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55940
55941
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55941
55942
|
// 根据box获取边缘线
|
|
55942
55943
|
var corners = this.wireframe.box.corners;
|
|
55943
|
-
|
|
55944
|
-
|
|
55945
|
-
|
|
55944
|
+
if (!isSingleCardItem) {
|
|
55945
|
+
corners.forEach(function(corner, i) {
|
|
55946
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55947
|
+
});
|
|
55948
|
+
}
|
|
55946
55949
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55947
55950
|
// 成组暂不支持缩放
|
|
55948
55951
|
if (selectedItems.length === 1) {
|
|
@@ -63184,10 +63187,13 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63184
63187
|
1
|
|
63185
63188
|
] : _cardInfo_property_scale, cardType = _cardInfo_property.cardType, tmp = _cardInfo_property.rotation, sourceRotation = tmp === void 0 ? 0 : tmp, sourcePosition = _cardInfo_property.position, parentId = cardInfo.parentId, _cardInfo_id = cardInfo.id, id = _cardInfo_id === void 0 ? EFFECTS.generateGUID() : _cardInfo_id, extension = cardInfo.extension;
|
|
63186
63189
|
// 校验 cardType 是否已在配置中注册
|
|
63190
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63191
|
+
return t.type === cardType;
|
|
63192
|
+
});
|
|
63187
63193
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63188
63194
|
return t.type;
|
|
63189
63195
|
});
|
|
63190
|
-
if (!
|
|
63196
|
+
if (!cardTypeConfig) {
|
|
63191
63197
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63192
63198
|
return;
|
|
63193
63199
|
}
|
|
@@ -91916,6 +91922,27 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91916
91922
|
|
|
91917
91923
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91918
91924
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
91925
|
+
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
91926
|
+
'[data-interaction-zone="self"]',
|
|
91927
|
+
'[data-vvfx-html-interaction-zone="self"]',
|
|
91928
|
+
'a[href]',
|
|
91929
|
+
'button:not([disabled])',
|
|
91930
|
+
'input:not([disabled])',
|
|
91931
|
+
'textarea:not([disabled])',
|
|
91932
|
+
'select:not([disabled])',
|
|
91933
|
+
'summary',
|
|
91934
|
+
'video[controls]',
|
|
91935
|
+
'audio[controls]',
|
|
91936
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
91937
|
+
'[role="button"]',
|
|
91938
|
+
'[role="link"]',
|
|
91939
|
+
'[role="textbox"]',
|
|
91940
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
91941
|
+
].join(', ');
|
|
91942
|
+
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
91943
|
+
'[data-interaction-zone="none"]',
|
|
91944
|
+
'[data-vvfx-html-interaction-zone="none"]'
|
|
91945
|
+
].join(', ');
|
|
91919
91946
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91920
91947
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91921
91948
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91925,12 +91952,17 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91925
91952
|
var _this = this;
|
|
91926
91953
|
this.options = options;
|
|
91927
91954
|
this.eventCleanups = [];
|
|
91955
|
+
this.htmlRootConfigCleanups = new WeakMap();
|
|
91928
91956
|
this.state = {
|
|
91929
91957
|
frameElements: new Map(),
|
|
91930
91958
|
elements: new Map(),
|
|
91959
|
+
selectionElements: new Map(),
|
|
91931
91960
|
contentScaleElements: new Map(),
|
|
91932
91961
|
contentElements: new Map(),
|
|
91933
91962
|
contentMountElements: new Map(),
|
|
91963
|
+
contentInteractionZones: new Map(),
|
|
91964
|
+
contentInteractionZoneCleanups: new Map(),
|
|
91965
|
+
contentInteractionResizeCleanups: new Map(),
|
|
91934
91966
|
contents: new Map(),
|
|
91935
91967
|
cleanups: new Map(),
|
|
91936
91968
|
autoHeightModes: new Map(),
|
|
@@ -91950,6 +91982,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91950
91982
|
}
|
|
91951
91983
|
return;
|
|
91952
91984
|
}
|
|
91985
|
+
if (!_this.isEditableCard(targetId)) {
|
|
91986
|
+
return;
|
|
91987
|
+
}
|
|
91953
91988
|
event.preventDefault();
|
|
91954
91989
|
event.stopPropagation();
|
|
91955
91990
|
_this.enterEditing(targetId);
|
|
@@ -91965,6 +92000,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91965
92000
|
_this.exitEditing();
|
|
91966
92001
|
};
|
|
91967
92002
|
this.handleContainerMouseMove = function(event) {
|
|
92003
|
+
_this.scheduleActiveContentInteractionSync(event);
|
|
91968
92004
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
91969
92005
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
91970
92006
|
return;
|
|
@@ -91979,6 +92015,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91979
92015
|
}
|
|
91980
92016
|
};
|
|
91981
92017
|
this.handleContainerMouseLeave = function() {
|
|
92018
|
+
if (_this.contentInteractionFrame !== undefined) {
|
|
92019
|
+
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
92020
|
+
_this.contentInteractionFrame = undefined;
|
|
92021
|
+
}
|
|
92022
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92023
|
+
_this.setActiveContentInteraction(undefined);
|
|
91982
92024
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
91983
92025
|
if (!previousId) {
|
|
91984
92026
|
return;
|
|
@@ -91986,6 +92028,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91986
92028
|
_this.state.hoverShellInteractiveId = undefined;
|
|
91987
92029
|
_this.syncContentInteraction(previousId);
|
|
91988
92030
|
};
|
|
92031
|
+
this.handleContainerContextMenu = function(event) {
|
|
92032
|
+
var activeInteraction = _this.state.activeContentInteraction;
|
|
92033
|
+
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92034
|
+
return;
|
|
92035
|
+
}
|
|
92036
|
+
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92037
|
+
if (!canvas) {
|
|
92038
|
+
return;
|
|
92039
|
+
}
|
|
92040
|
+
event.preventDefault();
|
|
92041
|
+
event.stopPropagation();
|
|
92042
|
+
_this.setActiveContentInteraction(undefined);
|
|
92043
|
+
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92044
|
+
bubbles: true,
|
|
92045
|
+
cancelable: true,
|
|
92046
|
+
clientX: event.clientX,
|
|
92047
|
+
clientY: event.clientY,
|
|
92048
|
+
screenX: event.screenX,
|
|
92049
|
+
screenY: event.screenY,
|
|
92050
|
+
button: event.button,
|
|
92051
|
+
buttons: event.buttons,
|
|
92052
|
+
ctrlKey: event.ctrlKey,
|
|
92053
|
+
shiftKey: event.shiftKey,
|
|
92054
|
+
altKey: event.altKey,
|
|
92055
|
+
metaKey: event.metaKey
|
|
92056
|
+
}));
|
|
92057
|
+
};
|
|
91989
92058
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
91990
92059
|
}
|
|
91991
92060
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -91999,7 +92068,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91999
92068
|
layer.style.position = 'absolute';
|
|
92000
92069
|
layer.style.inset = '0';
|
|
92001
92070
|
layer.style.pointerEvents = 'none';
|
|
92002
|
-
layer.style.zIndex = '1';
|
|
92003
92071
|
container.appendChild(layer);
|
|
92004
92072
|
this.state.layer = layer;
|
|
92005
92073
|
this.initDOMEvents();
|
|
@@ -92012,14 +92080,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92012
92080
|
cancelAnimationFrame(this.state.updateFrame);
|
|
92013
92081
|
this.state.updateFrame = undefined;
|
|
92014
92082
|
}
|
|
92083
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92084
|
+
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92085
|
+
this.contentInteractionFrame = undefined;
|
|
92086
|
+
}
|
|
92087
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92015
92088
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92016
92089
|
cleanup();
|
|
92017
92090
|
});
|
|
92018
92091
|
this.state.frameElements.clear();
|
|
92019
92092
|
this.state.elements.clear();
|
|
92093
|
+
this.state.selectionElements.clear();
|
|
92020
92094
|
this.state.contentScaleElements.clear();
|
|
92021
92095
|
this.state.contentElements.clear();
|
|
92022
92096
|
this.state.contentMountElements.clear();
|
|
92097
|
+
this.state.contentInteractionZones.clear();
|
|
92098
|
+
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92099
|
+
cleanup();
|
|
92100
|
+
});
|
|
92101
|
+
this.state.contentInteractionZoneCleanups.clear();
|
|
92102
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92103
|
+
cleanup();
|
|
92104
|
+
});
|
|
92105
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92023
92106
|
this.state.contents.clear();
|
|
92024
92107
|
this.state.cleanups.clear();
|
|
92025
92108
|
this.state.autoHeightModes.clear();
|
|
@@ -92037,10 +92120,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92037
92120
|
this.eventCleanups = [];
|
|
92038
92121
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92039
92122
|
this.state.layer = undefined;
|
|
92123
|
+
this.state.selectionLayer = undefined;
|
|
92040
92124
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92041
92125
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92042
92126
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92043
92127
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92128
|
+
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92044
92129
|
};
|
|
92045
92130
|
_proto.scheduleRender = function scheduleRender() {
|
|
92046
92131
|
var _this = this;
|
|
@@ -92054,6 +92139,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92054
92139
|
};
|
|
92055
92140
|
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92056
92141
|
this.cleanupOverlayContent(id);
|
|
92142
|
+
this.invalidateContentInteractionZones(id);
|
|
92057
92143
|
};
|
|
92058
92144
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92059
92145
|
return _async_to_generator(function() {
|
|
@@ -92147,6 +92233,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92147
92233
|
var events = [
|
|
92148
92234
|
'pageDataChange',
|
|
92149
92235
|
'selectedItemChange',
|
|
92236
|
+
'preSelectedItemChange',
|
|
92150
92237
|
'itemPropertyChange',
|
|
92151
92238
|
'viewportTransform',
|
|
92152
92239
|
'viewRebuildFinish'
|
|
@@ -92156,6 +92243,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92156
92243
|
if (event === 'viewportTransform') {
|
|
92157
92244
|
_this.handleViewportTransform();
|
|
92158
92245
|
}
|
|
92246
|
+
_this.invalidateContentInteractionZones();
|
|
92159
92247
|
_this.scheduleRender();
|
|
92160
92248
|
});
|
|
92161
92249
|
});
|
|
@@ -92165,6 +92253,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92165
92253
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92166
92254
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92167
92255
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92256
|
+
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92257
|
+
};
|
|
92258
|
+
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92259
|
+
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92260
|
+
return false;
|
|
92261
|
+
}
|
|
92262
|
+
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92168
92263
|
};
|
|
92169
92264
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92170
92265
|
var editing = this.state.editing;
|
|
@@ -92184,6 +92279,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92184
92279
|
}
|
|
92185
92280
|
var items = this.options.getItems();
|
|
92186
92281
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92282
|
+
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92187
92283
|
var visibleCardIds = new Set();
|
|
92188
92284
|
var editingVisible = false;
|
|
92189
92285
|
items.forEach(function(item) {
|
|
@@ -92207,9 +92303,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92207
92303
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92208
92304
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92209
92305
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92306
|
+
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92210
92307
|
if (!_this.state.contents.has(item.id)) {
|
|
92211
92308
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92212
92309
|
}
|
|
92310
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92213
92311
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92214
92312
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92215
92313
|
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
@@ -92219,6 +92317,15 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92219
92317
|
overlay.style.height = boxStyle.height;
|
|
92220
92318
|
overlay.style.transform = boxStyle.transform;
|
|
92221
92319
|
overlay.style.transformOrigin = '0 0';
|
|
92320
|
+
var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
|
|
92321
|
+
selectionOverlay.style.left = selectionBoxStyle.left;
|
|
92322
|
+
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92323
|
+
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92324
|
+
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92325
|
+
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92326
|
+
selectionOverlay.style.transformOrigin = '0 0';
|
|
92327
|
+
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92328
|
+
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92222
92329
|
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92223
92330
|
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92224
92331
|
_this.syncContentInteraction(item.id);
|
|
@@ -92259,6 +92366,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92259
92366
|
}
|
|
92260
92367
|
}
|
|
92261
92368
|
syncElementStackOrder(layer, rootElements);
|
|
92369
|
+
if (this.state.selectionLayer) {
|
|
92370
|
+
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92371
|
+
}
|
|
92262
92372
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92263
92373
|
var frameElements = [];
|
|
92264
92374
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92274,6 +92384,28 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92274
92384
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92275
92385
|
});
|
|
92276
92386
|
};
|
|
92387
|
+
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92388
|
+
var _layer_ownerDocument;
|
|
92389
|
+
if (this.state.selectionLayer) {
|
|
92390
|
+
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92391
|
+
layer.appendChild(this.state.selectionLayer);
|
|
92392
|
+
}
|
|
92393
|
+
return this.state.selectionLayer;
|
|
92394
|
+
}
|
|
92395
|
+
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92396
|
+
if (!ownerDocument) {
|
|
92397
|
+
return layer;
|
|
92398
|
+
}
|
|
92399
|
+
var selectionLayer = ownerDocument.createElement('div');
|
|
92400
|
+
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92401
|
+
selectionLayer.style.position = 'absolute';
|
|
92402
|
+
selectionLayer.style.inset = '0';
|
|
92403
|
+
selectionLayer.style.pointerEvents = 'none';
|
|
92404
|
+
selectionLayer.style.zIndex = '1';
|
|
92405
|
+
layer.appendChild(selectionLayer);
|
|
92406
|
+
this.state.selectionLayer = selectionLayer;
|
|
92407
|
+
return selectionLayer;
|
|
92408
|
+
};
|
|
92277
92409
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92278
92410
|
var _this = this;
|
|
92279
92411
|
var visibleFrameIds = new Set();
|
|
@@ -92338,6 +92470,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92338
92470
|
elements.set(id, overlay);
|
|
92339
92471
|
return overlay;
|
|
92340
92472
|
};
|
|
92473
|
+
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92474
|
+
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92475
|
+
if (selectionOverlay) {
|
|
92476
|
+
if (selectionOverlay.parentElement !== parent) {
|
|
92477
|
+
parent.appendChild(selectionOverlay);
|
|
92478
|
+
}
|
|
92479
|
+
return selectionOverlay;
|
|
92480
|
+
}
|
|
92481
|
+
selectionOverlay = document.createElement('div');
|
|
92482
|
+
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92483
|
+
selectionOverlay.dataset.itemId = id;
|
|
92484
|
+
selectionOverlay.style.position = 'absolute';
|
|
92485
|
+
selectionOverlay.style.pointerEvents = 'none';
|
|
92486
|
+
selectionOverlay.style.zIndex = '1';
|
|
92487
|
+
parent.appendChild(selectionOverlay);
|
|
92488
|
+
this.state.selectionElements.set(id, selectionOverlay);
|
|
92489
|
+
return selectionOverlay;
|
|
92490
|
+
};
|
|
92491
|
+
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92492
|
+
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92493
|
+
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92494
|
+
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92495
|
+
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92496
|
+
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92497
|
+
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92498
|
+
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92499
|
+
};
|
|
92500
|
+
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92501
|
+
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92502
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92503
|
+
};
|
|
92504
|
+
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92505
|
+
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92506
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92507
|
+
};
|
|
92341
92508
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92342
92509
|
var layer = this.state.layer;
|
|
92343
92510
|
if (!layer) {
|
|
@@ -92376,13 +92543,143 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92376
92543
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92377
92544
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92378
92545
|
var isHoveringShellInteractive = interactiveElements.some(function(element) {
|
|
92379
|
-
|
|
92380
|
-
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
92546
|
+
return isMouseEventInsideRect(event, element.getBoundingClientRect());
|
|
92381
92547
|
});
|
|
92382
92548
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92383
92549
|
}
|
|
92384
92550
|
return undefined;
|
|
92385
92551
|
};
|
|
92552
|
+
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92553
|
+
var zone = this.getContentInteractiveZoneByEvent(event);
|
|
92554
|
+
this.setActiveContentInteraction(zone);
|
|
92555
|
+
};
|
|
92556
|
+
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92557
|
+
var _this = this;
|
|
92558
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
92559
|
+
this.syncActiveContentInteraction(event);
|
|
92560
|
+
return;
|
|
92561
|
+
}
|
|
92562
|
+
this.pendingContentInteractionEvent = event;
|
|
92563
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92564
|
+
return;
|
|
92565
|
+
}
|
|
92566
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92567
|
+
_this.contentInteractionFrame = undefined;
|
|
92568
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92569
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92570
|
+
if (pendingEvent) {
|
|
92571
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92572
|
+
}
|
|
92573
|
+
});
|
|
92574
|
+
};
|
|
92575
|
+
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92576
|
+
var _this = this;
|
|
92577
|
+
var previous = this.state.activeContentInteraction;
|
|
92578
|
+
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)) {
|
|
92579
|
+
return;
|
|
92580
|
+
}
|
|
92581
|
+
this.state.activeContentInteraction = zone;
|
|
92582
|
+
var changedIds = new Set();
|
|
92583
|
+
if (previous) {
|
|
92584
|
+
changedIds.add(previous.id);
|
|
92585
|
+
}
|
|
92586
|
+
if (zone) {
|
|
92587
|
+
changedIds.add(zone.id);
|
|
92588
|
+
}
|
|
92589
|
+
changedIds.forEach(function(id) {
|
|
92590
|
+
_this.syncContentInteraction(id);
|
|
92591
|
+
});
|
|
92592
|
+
};
|
|
92593
|
+
_proto.getContentInteractiveZoneByEvent = function getContentInteractiveZoneByEvent(event) {
|
|
92594
|
+
var id = this.getHTMLCardIdByEvent(event);
|
|
92595
|
+
if (!id || this.isEditableCard(id)) {
|
|
92596
|
+
return undefined;
|
|
92597
|
+
}
|
|
92598
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92599
|
+
if (!contentOverlay) {
|
|
92600
|
+
return undefined;
|
|
92601
|
+
}
|
|
92602
|
+
var zone = this.getContentInteractionZones(id, contentOverlay).find(function(zone) {
|
|
92603
|
+
return isMouseEventInsideRect(event, zone.rect);
|
|
92604
|
+
});
|
|
92605
|
+
return zone ? {
|
|
92606
|
+
id: id,
|
|
92607
|
+
element: zone.element
|
|
92608
|
+
} : undefined;
|
|
92609
|
+
};
|
|
92610
|
+
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92611
|
+
var _this = this;
|
|
92612
|
+
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92613
|
+
if (cachedZones) {
|
|
92614
|
+
return cachedZones;
|
|
92615
|
+
}
|
|
92616
|
+
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92617
|
+
return !_this.isContentInteractionDisabled(element);
|
|
92618
|
+
}).map(function(element) {
|
|
92619
|
+
return {
|
|
92620
|
+
element: element,
|
|
92621
|
+
rect: element.getBoundingClientRect()
|
|
92622
|
+
};
|
|
92623
|
+
});
|
|
92624
|
+
this.state.contentInteractionZones.set(id, zones);
|
|
92625
|
+
this.observeContentInteractionZoneResizes(id, zones);
|
|
92626
|
+
return zones;
|
|
92627
|
+
};
|
|
92628
|
+
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92629
|
+
var _ref;
|
|
92630
|
+
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92631
|
+
var item = this.options.getItems().find(function(item) {
|
|
92632
|
+
return item.id === id;
|
|
92633
|
+
});
|
|
92634
|
+
if (!item) {
|
|
92635
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92636
|
+
}
|
|
92637
|
+
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 : [];
|
|
92638
|
+
if (selectors.length === 0) {
|
|
92639
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92640
|
+
}
|
|
92641
|
+
return [].concat([
|
|
92642
|
+
CONTENT_INTERACTIVE_SELECTOR
|
|
92643
|
+
], selectors).join(', ');
|
|
92644
|
+
};
|
|
92645
|
+
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92646
|
+
if (typeof element.closest !== 'function') {
|
|
92647
|
+
return false;
|
|
92648
|
+
}
|
|
92649
|
+
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92650
|
+
};
|
|
92651
|
+
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92652
|
+
if (id) {
|
|
92653
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92654
|
+
this.state.contentInteractionZones.delete(id);
|
|
92655
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92656
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92657
|
+
return;
|
|
92658
|
+
}
|
|
92659
|
+
this.state.contentInteractionZones.clear();
|
|
92660
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92661
|
+
cleanup();
|
|
92662
|
+
});
|
|
92663
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92664
|
+
};
|
|
92665
|
+
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92666
|
+
var _this = this;
|
|
92667
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92668
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92669
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92670
|
+
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92671
|
+
return;
|
|
92672
|
+
}
|
|
92673
|
+
var observer = new ResizeObserver(function() {
|
|
92674
|
+
_this.invalidateContentInteractionZones(id);
|
|
92675
|
+
});
|
|
92676
|
+
zones.forEach(function(zone) {
|
|
92677
|
+
observer.observe(zone.element);
|
|
92678
|
+
});
|
|
92679
|
+
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92680
|
+
observer.disconnect();
|
|
92681
|
+
});
|
|
92682
|
+
};
|
|
92386
92683
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92387
92684
|
var rect = this.options.container.getBoundingClientRect();
|
|
92388
92685
|
return {
|
|
@@ -92450,6 +92747,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92450
92747
|
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92451
92748
|
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92452
92749
|
}
|
|
92750
|
+
if (sizeChanged) {
|
|
92751
|
+
this.invalidateContentInteractionZones(id);
|
|
92752
|
+
}
|
|
92453
92753
|
};
|
|
92454
92754
|
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92455
92755
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
@@ -92457,8 +92757,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92457
92757
|
});
|
|
92458
92758
|
};
|
|
92459
92759
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92460
|
-
var _this_state_editing;
|
|
92760
|
+
var _this_state_editing, _this_state_activeContentInteraction;
|
|
92461
92761
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
92762
|
+
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92763
|
+
var isInteractive = isEditing || !!activeInteraction;
|
|
92462
92764
|
var overlay = this.state.elements.get(id);
|
|
92463
92765
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92464
92766
|
var contentOverlay = this.state.contentElements.get(id);
|
|
@@ -92473,34 +92775,49 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92473
92775
|
}
|
|
92474
92776
|
if (contentOverlay) {
|
|
92475
92777
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92476
|
-
contentOverlay.style.pointerEvents = 'none';
|
|
92778
|
+
contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92477
92779
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92478
|
-
|
|
92479
|
-
iframe.
|
|
92780
|
+
var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
|
|
92781
|
+
iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
|
|
92782
|
+
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92480
92783
|
});
|
|
92481
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92784
|
+
this.syncShellInteraction(id, contentOverlay, isInteractive);
|
|
92785
|
+
this.syncContentInteractionZones(id, contentOverlay, activeInteraction == null ? void 0 : activeInteraction.element, isEditing, isInteractive);
|
|
92482
92786
|
}
|
|
92483
92787
|
if (contentMount) {
|
|
92484
92788
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92485
|
-
contentMount.style.pointerEvents =
|
|
92486
|
-
contentMount.inert = !
|
|
92487
|
-
if (
|
|
92789
|
+
contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92790
|
+
contentMount.inert = !isInteractive;
|
|
92791
|
+
if (isInteractive) {
|
|
92488
92792
|
contentMount.removeAttribute('aria-hidden');
|
|
92489
92793
|
} else {
|
|
92490
92794
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92491
92795
|
}
|
|
92492
92796
|
}
|
|
92493
92797
|
};
|
|
92494
|
-
_proto.
|
|
92798
|
+
_proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeElement, isEditing, isInteractive) {
|
|
92799
|
+
var _this = this;
|
|
92800
|
+
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
92801
|
+
if (!isInteractive || _this.isContentInteractionDisabled(element)) {
|
|
92802
|
+
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
92803
|
+
element.style.pointerEvents = 'none';
|
|
92804
|
+
return;
|
|
92805
|
+
}
|
|
92806
|
+
var isElementInteractive = isEditing || activeElement === element;
|
|
92807
|
+
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
92808
|
+
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
92809
|
+
});
|
|
92810
|
+
};
|
|
92811
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92495
92812
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92496
|
-
var isShellInteractiveActive =
|
|
92813
|
+
var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
|
|
92497
92814
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92498
92815
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92499
92816
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92500
92817
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92501
92818
|
});
|
|
92502
92819
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92503
|
-
element.style.pointerEvents =
|
|
92820
|
+
element.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92504
92821
|
});
|
|
92505
92822
|
};
|
|
92506
92823
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92508,6 +92825,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92508
92825
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92509
92826
|
return;
|
|
92510
92827
|
}
|
|
92828
|
+
if (!this.isEditableCard(id)) {
|
|
92829
|
+
return;
|
|
92830
|
+
}
|
|
92511
92831
|
var box = this.options.getViewBoxById(id);
|
|
92512
92832
|
if (box.isEmpty()) {
|
|
92513
92833
|
return;
|
|
@@ -92551,6 +92871,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92551
92871
|
this.options.setViewport(editing.restoreViewport);
|
|
92552
92872
|
this.scheduleRender();
|
|
92553
92873
|
};
|
|
92874
|
+
_proto.isEditableCard = function isEditableCard(id) {
|
|
92875
|
+
var _this_options_resolveCardTypeConfig;
|
|
92876
|
+
var item = this.options.getItems().find(function(item) {
|
|
92877
|
+
return item.id === id;
|
|
92878
|
+
});
|
|
92879
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
92880
|
+
};
|
|
92554
92881
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92555
92882
|
var viewportElement = this.options.container.parentElement;
|
|
92556
92883
|
if (!viewportElement) {
|
|
@@ -92575,6 +92902,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92575
92902
|
};
|
|
92576
92903
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92577
92904
|
this.cleanupOverlayContent(id);
|
|
92905
|
+
this.invalidateContentInteractionZones(id);
|
|
92578
92906
|
overlay.innerHTML = '';
|
|
92579
92907
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92580
92908
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92586,12 +92914,72 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92586
92914
|
id: id,
|
|
92587
92915
|
autoHeight: this.isAutoHeightEnabled(item)
|
|
92588
92916
|
});
|
|
92917
|
+
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92589
92918
|
this.state.cleanups.set(id, function() {
|
|
92590
92919
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92591
92920
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
92592
92921
|
});
|
|
92593
92922
|
this.state.contents.set(id, html);
|
|
92594
92923
|
};
|
|
92924
|
+
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
92925
|
+
var _this = this;
|
|
92926
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92927
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
92928
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92929
|
+
if (typeof MutationObserver !== 'function') {
|
|
92930
|
+
return;
|
|
92931
|
+
}
|
|
92932
|
+
var observer = new MutationObserver(function() {
|
|
92933
|
+
_this.invalidateContentInteractionZones(id);
|
|
92934
|
+
});
|
|
92935
|
+
observer.observe(contentContainer, {
|
|
92936
|
+
attributes: true,
|
|
92937
|
+
childList: true,
|
|
92938
|
+
subtree: true
|
|
92939
|
+
});
|
|
92940
|
+
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
92941
|
+
observer.disconnect();
|
|
92942
|
+
});
|
|
92943
|
+
};
|
|
92944
|
+
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
92945
|
+
var _ref, _config_style;
|
|
92946
|
+
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
92947
|
+
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
92948
|
+
this.htmlRootConfigCleanups.delete(root);
|
|
92949
|
+
var config = html.root;
|
|
92950
|
+
if (!config) {
|
|
92951
|
+
return;
|
|
92952
|
+
}
|
|
92953
|
+
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
92954
|
+
var styleProperties = [];
|
|
92955
|
+
classNames.forEach(function(className) {
|
|
92956
|
+
root.classList.add(className);
|
|
92957
|
+
});
|
|
92958
|
+
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
92959
|
+
var property = param[0], value = param[1];
|
|
92960
|
+
if (value === undefined) {
|
|
92961
|
+
return;
|
|
92962
|
+
}
|
|
92963
|
+
styleProperties.push(property);
|
|
92964
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92965
|
+
root.style.setProperty(property, String(value));
|
|
92966
|
+
return;
|
|
92967
|
+
}
|
|
92968
|
+
root.style[property] = String(value);
|
|
92969
|
+
});
|
|
92970
|
+
this.htmlRootConfigCleanups.set(root, function() {
|
|
92971
|
+
classNames.forEach(function(className) {
|
|
92972
|
+
root.classList.remove(className);
|
|
92973
|
+
});
|
|
92974
|
+
styleProperties.forEach(function(property) {
|
|
92975
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92976
|
+
root.style.removeProperty(property);
|
|
92977
|
+
return;
|
|
92978
|
+
}
|
|
92979
|
+
root.style[property] = '';
|
|
92980
|
+
});
|
|
92981
|
+
});
|
|
92982
|
+
};
|
|
92595
92983
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
92596
92984
|
var _this = this;
|
|
92597
92985
|
switch(content.kind){
|
|
@@ -92657,6 +93045,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92657
93045
|
};
|
|
92658
93046
|
};
|
|
92659
93047
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93048
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92660
93049
|
var cleanup = this.state.cleanups.get(id);
|
|
92661
93050
|
if (cleanup) {
|
|
92662
93051
|
cleanup();
|
|
@@ -92665,13 +93054,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92665
93054
|
this.state.contents.delete(id);
|
|
92666
93055
|
this.state.contentMountElements.delete(id);
|
|
92667
93056
|
this.state.autoHeightModes.delete(id);
|
|
93057
|
+
this.invalidateContentInteractionZones(id);
|
|
93058
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93059
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92668
93060
|
this.cleanupAutoHeight(id);
|
|
92669
93061
|
};
|
|
92670
93062
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
92671
|
-
var _this_state_elements_get;
|
|
93063
|
+
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
92672
93064
|
this.cleanupOverlayContent(id);
|
|
92673
93065
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93066
|
+
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
92674
93067
|
this.state.elements.delete(id);
|
|
93068
|
+
this.state.selectionElements.delete(id);
|
|
92675
93069
|
this.state.contentScaleElements.delete(id);
|
|
92676
93070
|
this.state.contentElements.delete(id);
|
|
92677
93071
|
};
|
|
@@ -92904,6 +93298,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92904
93298
|
}
|
|
92905
93299
|
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
92906
93300
|
};
|
|
93301
|
+
_create_class(HTMLOverlayManager, [
|
|
93302
|
+
{
|
|
93303
|
+
key: "layerElement",
|
|
93304
|
+
get: function get() {
|
|
93305
|
+
return this.state.layer;
|
|
93306
|
+
}
|
|
93307
|
+
}
|
|
93308
|
+
]);
|
|
92907
93309
|
return HTMLOverlayManager;
|
|
92908
93310
|
}();
|
|
92909
93311
|
function waitForCardCaptureReady(root) {
|
|
@@ -92945,6 +93347,17 @@ function waitForCardCaptureReady(root) {
|
|
|
92945
93347
|
});
|
|
92946
93348
|
})();
|
|
92947
93349
|
}
|
|
93350
|
+
function formatCssColor(color, alpha) {
|
|
93351
|
+
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93352
|
+
var red = normalizedColor >> 16 & 0xFF;
|
|
93353
|
+
var green = normalizedColor >> 8 & 0xFF;
|
|
93354
|
+
var blue = normalizedColor & 0xFF;
|
|
93355
|
+
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93356
|
+
}
|
|
93357
|
+
function formatCssNumber(value) {
|
|
93358
|
+
var normalized = Number.isFinite(value) ? value : 0;
|
|
93359
|
+
return Number(normalized.toFixed(6)).toString();
|
|
93360
|
+
}
|
|
92948
93361
|
function nextAnimationFrame() {
|
|
92949
93362
|
return new Promise(function(resolve) {
|
|
92950
93363
|
requestAnimationFrame(function() {
|
|
@@ -93363,6 +93776,9 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93363
93776
|
});
|
|
93364
93777
|
return replacement;
|
|
93365
93778
|
}
|
|
93779
|
+
function isMouseEventInsideRect(event, rect) {
|
|
93780
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
93781
|
+
}
|
|
93366
93782
|
function createFlattenedIframeContent(iframe) {
|
|
93367
93783
|
var doc = iframe.contentDocument;
|
|
93368
93784
|
if (!doc) {
|
|
@@ -93402,6 +93818,19 @@ function withTimeout(promise, timeout) {
|
|
|
93402
93818
|
});
|
|
93403
93819
|
}
|
|
93404
93820
|
|
|
93821
|
+
function orderSDKCanvasLayers(param) {
|
|
93822
|
+
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
93823
|
+
[
|
|
93824
|
+
playerContainer,
|
|
93825
|
+
htmlOverlayLayer,
|
|
93826
|
+
gestureCanvas
|
|
93827
|
+
].forEach(function(layer) {
|
|
93828
|
+
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
93829
|
+
container.appendChild(layer);
|
|
93830
|
+
}
|
|
93831
|
+
});
|
|
93832
|
+
}
|
|
93833
|
+
|
|
93405
93834
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93406
93835
|
var SDK = /*#__PURE__*/ function() {
|
|
93407
93836
|
function SDK(container, mode) {
|
|
@@ -93508,6 +93937,35 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93508
93937
|
propertyValue: height
|
|
93509
93938
|
});
|
|
93510
93939
|
},
|
|
93940
|
+
getSelectedItemIds: function getSelectedItemIds() {
|
|
93941
|
+
var _ref;
|
|
93942
|
+
var _this__pageData;
|
|
93943
|
+
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
93944
|
+
},
|
|
93945
|
+
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
93946
|
+
var _this__pageData;
|
|
93947
|
+
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
93948
|
+
},
|
|
93949
|
+
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
93950
|
+
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;
|
|
93951
|
+
return {
|
|
93952
|
+
color: wireframeColor,
|
|
93953
|
+
alpha: wireframeAlpha,
|
|
93954
|
+
width: wireframeWidth
|
|
93955
|
+
};
|
|
93956
|
+
},
|
|
93957
|
+
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
93958
|
+
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
93959
|
+
return {
|
|
93960
|
+
color: preSelectedColor,
|
|
93961
|
+
alpha: 1,
|
|
93962
|
+
width: preSelectedWidth
|
|
93963
|
+
};
|
|
93964
|
+
},
|
|
93965
|
+
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
93966
|
+
var _this__gestureHandler;
|
|
93967
|
+
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
93968
|
+
},
|
|
93511
93969
|
resolveCardHTML: function resolveCardHTML(item) {
|
|
93512
93970
|
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
93513
93971
|
},
|
|
@@ -93516,6 +93974,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93516
93974
|
}
|
|
93517
93975
|
});
|
|
93518
93976
|
this._htmlOverlayManager.attach();
|
|
93977
|
+
this.syncCanvasLayerOrder();
|
|
93519
93978
|
}
|
|
93520
93979
|
var _proto = SDK.prototype;
|
|
93521
93980
|
_proto.dispose = function dispose() {
|
|
@@ -93611,6 +94070,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93611
94070
|
this.initPlayer(SDK.config.mode);
|
|
93612
94071
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
93613
94072
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94073
|
+
this.syncCanvasLayerOrder();
|
|
93614
94074
|
return [
|
|
93615
94075
|
4,
|
|
93616
94076
|
this.runByPageData(this.pageData)
|
|
@@ -93660,6 +94120,16 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93660
94120
|
env: 'editor'
|
|
93661
94121
|
});
|
|
93662
94122
|
this.player.resize();
|
|
94123
|
+
this.syncCanvasLayerOrder();
|
|
94124
|
+
};
|
|
94125
|
+
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94126
|
+
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94127
|
+
orderSDKCanvasLayers({
|
|
94128
|
+
container: this._container,
|
|
94129
|
+
playerContainer: this._playerContainer,
|
|
94130
|
+
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94131
|
+
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94132
|
+
});
|
|
93663
94133
|
};
|
|
93664
94134
|
_proto.getInitParam = function getInitParam(param) {
|
|
93665
94135
|
return _async_to_generator(function() {
|