@vvfx/sdk 0.2.2-beta.4 → 0.2.2-beta.6
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/html-overlay/overlay-transform.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +505 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +505 -27
- 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.6
|
|
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
|
}
|
|
@@ -55558,6 +55558,16 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55558
55558
|
newWidth,
|
|
55559
55559
|
newHeight
|
|
55560
55560
|
], translation1);
|
|
55561
|
+
} else if (selectedItem && selectedItems.length === 1 && isCardItem(selectedItem)) {
|
|
55562
|
+
void this._pageDataUtils.setItemProperty({
|
|
55563
|
+
itemId: selectedItem.id,
|
|
55564
|
+
type: SDKItemType.CARD,
|
|
55565
|
+
property: {
|
|
55566
|
+
width: selectedItem.width * resultScalar1.x,
|
|
55567
|
+
height: selectedItem.height * resultScalar1.y
|
|
55568
|
+
}
|
|
55569
|
+
});
|
|
55570
|
+
this._pageDataUtils.moveItem(selectedItem.id, translation1);
|
|
55561
55571
|
} else {
|
|
55562
55572
|
// 普通元素的缩放逻辑
|
|
55563
55573
|
selectedItems.forEach(function(item) {
|
|
@@ -55882,6 +55892,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55882
55892
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55883
55893
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55884
55894
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55895
|
+
var isSingleCardItem = isCardItem(selectedItem);
|
|
55885
55896
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55886
55897
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55887
55898
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55921,9 +55932,11 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55921
55932
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55922
55933
|
// 根据box获取边缘线
|
|
55923
55934
|
var corners = this.wireframe.box.corners;
|
|
55924
|
-
|
|
55925
|
-
|
|
55926
|
-
|
|
55935
|
+
if (!isSingleCardItem) {
|
|
55936
|
+
corners.forEach(function(corner, i) {
|
|
55937
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55938
|
+
});
|
|
55939
|
+
}
|
|
55927
55940
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55928
55941
|
// 成组暂不支持缩放
|
|
55929
55942
|
if (selectedItems.length === 1) {
|
|
@@ -63165,10 +63178,13 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63165
63178
|
1
|
|
63166
63179
|
] : _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
63180
|
// 校验 cardType 是否已在配置中注册
|
|
63181
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63182
|
+
return t.type === cardType;
|
|
63183
|
+
});
|
|
63168
63184
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63169
63185
|
return t.type;
|
|
63170
63186
|
});
|
|
63171
|
-
if (!
|
|
63187
|
+
if (!cardTypeConfig) {
|
|
63172
63188
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63173
63189
|
return;
|
|
63174
63190
|
}
|
|
@@ -91818,14 +91834,13 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91818
91834
|
});
|
|
91819
91835
|
}
|
|
91820
91836
|
|
|
91821
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY,
|
|
91837
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, _autoScale) {
|
|
91822
91838
|
if (offsetX === void 0) offsetX = 0;
|
|
91823
91839
|
if (offsetY === void 0) offsetY = 0;
|
|
91824
|
-
if (autoScale === void 0) autoScale = true;
|
|
91825
91840
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91826
91841
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91827
|
-
var contentWidth =
|
|
91828
|
-
var contentHeight =
|
|
91842
|
+
var contentWidth = width;
|
|
91843
|
+
var contentHeight = height;
|
|
91829
91844
|
var a = (rightTop.x - leftTop.x) / contentWidth;
|
|
91830
91845
|
var b = (rightTop.y - leftTop.y) / contentWidth;
|
|
91831
91846
|
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
@@ -91897,6 +91912,27 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91897
91912
|
|
|
91898
91913
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91899
91914
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
91915
|
+
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
91916
|
+
'[data-interaction-zone="self"]',
|
|
91917
|
+
'[data-vvfx-html-interaction-zone="self"]',
|
|
91918
|
+
'a[href]',
|
|
91919
|
+
'button:not([disabled])',
|
|
91920
|
+
'input:not([disabled])',
|
|
91921
|
+
'textarea:not([disabled])',
|
|
91922
|
+
'select:not([disabled])',
|
|
91923
|
+
'summary',
|
|
91924
|
+
'video[controls]',
|
|
91925
|
+
'audio[controls]',
|
|
91926
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
91927
|
+
'[role="button"]',
|
|
91928
|
+
'[role="link"]',
|
|
91929
|
+
'[role="textbox"]',
|
|
91930
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
91931
|
+
].join(', ');
|
|
91932
|
+
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
91933
|
+
'[data-interaction-zone="none"]',
|
|
91934
|
+
'[data-vvfx-html-interaction-zone="none"]'
|
|
91935
|
+
].join(', ');
|
|
91900
91936
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91901
91937
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91902
91938
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91906,12 +91942,17 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91906
91942
|
var _this = this;
|
|
91907
91943
|
this.options = options;
|
|
91908
91944
|
this.eventCleanups = [];
|
|
91945
|
+
this.htmlRootConfigCleanups = new WeakMap();
|
|
91909
91946
|
this.state = {
|
|
91910
91947
|
frameElements: new Map(),
|
|
91911
91948
|
elements: new Map(),
|
|
91949
|
+
selectionElements: new Map(),
|
|
91912
91950
|
contentScaleElements: new Map(),
|
|
91913
91951
|
contentElements: new Map(),
|
|
91914
91952
|
contentMountElements: new Map(),
|
|
91953
|
+
contentInteractionZones: new Map(),
|
|
91954
|
+
contentInteractionZoneCleanups: new Map(),
|
|
91955
|
+
contentInteractionResizeCleanups: new Map(),
|
|
91915
91956
|
contents: new Map(),
|
|
91916
91957
|
cleanups: new Map(),
|
|
91917
91958
|
autoHeightModes: new Map(),
|
|
@@ -91931,6 +91972,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91931
91972
|
}
|
|
91932
91973
|
return;
|
|
91933
91974
|
}
|
|
91975
|
+
if (!_this.isEditableCard(targetId)) {
|
|
91976
|
+
return;
|
|
91977
|
+
}
|
|
91934
91978
|
event.preventDefault();
|
|
91935
91979
|
event.stopPropagation();
|
|
91936
91980
|
_this.enterEditing(targetId);
|
|
@@ -91946,6 +91990,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91946
91990
|
_this.exitEditing();
|
|
91947
91991
|
};
|
|
91948
91992
|
this.handleContainerMouseMove = function(event) {
|
|
91993
|
+
_this.scheduleActiveContentInteractionSync(event);
|
|
91949
91994
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
91950
91995
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
91951
91996
|
return;
|
|
@@ -91960,6 +92005,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91960
92005
|
}
|
|
91961
92006
|
};
|
|
91962
92007
|
this.handleContainerMouseLeave = function() {
|
|
92008
|
+
if (_this.contentInteractionFrame !== undefined) {
|
|
92009
|
+
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
92010
|
+
_this.contentInteractionFrame = undefined;
|
|
92011
|
+
}
|
|
92012
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92013
|
+
_this.setActiveContentInteraction(undefined);
|
|
91963
92014
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
91964
92015
|
if (!previousId) {
|
|
91965
92016
|
return;
|
|
@@ -91967,6 +92018,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91967
92018
|
_this.state.hoverShellInteractiveId = undefined;
|
|
91968
92019
|
_this.syncContentInteraction(previousId);
|
|
91969
92020
|
};
|
|
92021
|
+
this.handleContainerContextMenu = function(event) {
|
|
92022
|
+
var activeInteraction = _this.state.activeContentInteraction;
|
|
92023
|
+
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92024
|
+
return;
|
|
92025
|
+
}
|
|
92026
|
+
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92027
|
+
if (!canvas) {
|
|
92028
|
+
return;
|
|
92029
|
+
}
|
|
92030
|
+
event.preventDefault();
|
|
92031
|
+
event.stopPropagation();
|
|
92032
|
+
_this.setActiveContentInteraction(undefined);
|
|
92033
|
+
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92034
|
+
bubbles: true,
|
|
92035
|
+
cancelable: true,
|
|
92036
|
+
clientX: event.clientX,
|
|
92037
|
+
clientY: event.clientY,
|
|
92038
|
+
screenX: event.screenX,
|
|
92039
|
+
screenY: event.screenY,
|
|
92040
|
+
button: event.button,
|
|
92041
|
+
buttons: event.buttons,
|
|
92042
|
+
ctrlKey: event.ctrlKey,
|
|
92043
|
+
shiftKey: event.shiftKey,
|
|
92044
|
+
altKey: event.altKey,
|
|
92045
|
+
metaKey: event.metaKey
|
|
92046
|
+
}));
|
|
92047
|
+
};
|
|
91970
92048
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
91971
92049
|
}
|
|
91972
92050
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -91980,7 +92058,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91980
92058
|
layer.style.position = 'absolute';
|
|
91981
92059
|
layer.style.inset = '0';
|
|
91982
92060
|
layer.style.pointerEvents = 'none';
|
|
91983
|
-
layer.style.zIndex = '1';
|
|
91984
92061
|
container.appendChild(layer);
|
|
91985
92062
|
this.state.layer = layer;
|
|
91986
92063
|
this.initDOMEvents();
|
|
@@ -91993,14 +92070,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91993
92070
|
cancelAnimationFrame(this.state.updateFrame);
|
|
91994
92071
|
this.state.updateFrame = undefined;
|
|
91995
92072
|
}
|
|
92073
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92074
|
+
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92075
|
+
this.contentInteractionFrame = undefined;
|
|
92076
|
+
}
|
|
92077
|
+
this.pendingContentInteractionEvent = undefined;
|
|
91996
92078
|
this.state.cleanups.forEach(function(cleanup) {
|
|
91997
92079
|
cleanup();
|
|
91998
92080
|
});
|
|
91999
92081
|
this.state.frameElements.clear();
|
|
92000
92082
|
this.state.elements.clear();
|
|
92083
|
+
this.state.selectionElements.clear();
|
|
92001
92084
|
this.state.contentScaleElements.clear();
|
|
92002
92085
|
this.state.contentElements.clear();
|
|
92003
92086
|
this.state.contentMountElements.clear();
|
|
92087
|
+
this.state.contentInteractionZones.clear();
|
|
92088
|
+
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92089
|
+
cleanup();
|
|
92090
|
+
});
|
|
92091
|
+
this.state.contentInteractionZoneCleanups.clear();
|
|
92092
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92093
|
+
cleanup();
|
|
92094
|
+
});
|
|
92095
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92004
92096
|
this.state.contents.clear();
|
|
92005
92097
|
this.state.cleanups.clear();
|
|
92006
92098
|
this.state.autoHeightModes.clear();
|
|
@@ -92018,10 +92110,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92018
92110
|
this.eventCleanups = [];
|
|
92019
92111
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92020
92112
|
this.state.layer = undefined;
|
|
92113
|
+
this.state.selectionLayer = undefined;
|
|
92021
92114
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92022
92115
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92023
92116
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92024
92117
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92118
|
+
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92025
92119
|
};
|
|
92026
92120
|
_proto.scheduleRender = function scheduleRender() {
|
|
92027
92121
|
var _this = this;
|
|
@@ -92035,6 +92129,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92035
92129
|
};
|
|
92036
92130
|
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92037
92131
|
this.cleanupOverlayContent(id);
|
|
92132
|
+
this.invalidateContentInteractionZones(id);
|
|
92038
92133
|
};
|
|
92039
92134
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92040
92135
|
return _async_to_generator(function() {
|
|
@@ -92128,6 +92223,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92128
92223
|
var events = [
|
|
92129
92224
|
'pageDataChange',
|
|
92130
92225
|
'selectedItemChange',
|
|
92226
|
+
'preSelectedItemChange',
|
|
92131
92227
|
'itemPropertyChange',
|
|
92132
92228
|
'viewportTransform',
|
|
92133
92229
|
'viewRebuildFinish'
|
|
@@ -92137,6 +92233,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92137
92233
|
if (event === 'viewportTransform') {
|
|
92138
92234
|
_this.handleViewportTransform();
|
|
92139
92235
|
}
|
|
92236
|
+
_this.invalidateContentInteractionZones();
|
|
92140
92237
|
_this.scheduleRender();
|
|
92141
92238
|
});
|
|
92142
92239
|
});
|
|
@@ -92146,6 +92243,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92146
92243
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92147
92244
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92148
92245
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92246
|
+
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92247
|
+
};
|
|
92248
|
+
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92249
|
+
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92250
|
+
return false;
|
|
92251
|
+
}
|
|
92252
|
+
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92149
92253
|
};
|
|
92150
92254
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92151
92255
|
var editing = this.state.editing;
|
|
@@ -92165,6 +92269,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92165
92269
|
}
|
|
92166
92270
|
var items = this.options.getItems();
|
|
92167
92271
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92272
|
+
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92168
92273
|
var visibleCardIds = new Set();
|
|
92169
92274
|
var editingVisible = false;
|
|
92170
92275
|
items.forEach(function(item) {
|
|
@@ -92188,9 +92293,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92188
92293
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92189
92294
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92190
92295
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92296
|
+
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92191
92297
|
if (!_this.state.contents.has(item.id)) {
|
|
92192
92298
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92193
92299
|
}
|
|
92300
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92194
92301
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92195
92302
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92196
92303
|
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
@@ -92200,6 +92307,15 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92200
92307
|
overlay.style.height = boxStyle.height;
|
|
92201
92308
|
overlay.style.transform = boxStyle.transform;
|
|
92202
92309
|
overlay.style.transformOrigin = '0 0';
|
|
92310
|
+
var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
|
|
92311
|
+
selectionOverlay.style.left = selectionBoxStyle.left;
|
|
92312
|
+
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92313
|
+
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92314
|
+
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92315
|
+
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92316
|
+
selectionOverlay.style.transformOrigin = '0 0';
|
|
92317
|
+
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92318
|
+
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92203
92319
|
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92204
92320
|
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92205
92321
|
_this.syncContentInteraction(item.id);
|
|
@@ -92240,6 +92356,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92240
92356
|
}
|
|
92241
92357
|
}
|
|
92242
92358
|
syncElementStackOrder(layer, rootElements);
|
|
92359
|
+
if (this.state.selectionLayer) {
|
|
92360
|
+
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92361
|
+
}
|
|
92243
92362
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92244
92363
|
var frameElements = [];
|
|
92245
92364
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92255,6 +92374,28 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92255
92374
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92256
92375
|
});
|
|
92257
92376
|
};
|
|
92377
|
+
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92378
|
+
var _layer_ownerDocument;
|
|
92379
|
+
if (this.state.selectionLayer) {
|
|
92380
|
+
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92381
|
+
layer.appendChild(this.state.selectionLayer);
|
|
92382
|
+
}
|
|
92383
|
+
return this.state.selectionLayer;
|
|
92384
|
+
}
|
|
92385
|
+
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92386
|
+
if (!ownerDocument) {
|
|
92387
|
+
return layer;
|
|
92388
|
+
}
|
|
92389
|
+
var selectionLayer = ownerDocument.createElement('div');
|
|
92390
|
+
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92391
|
+
selectionLayer.style.position = 'absolute';
|
|
92392
|
+
selectionLayer.style.inset = '0';
|
|
92393
|
+
selectionLayer.style.pointerEvents = 'none';
|
|
92394
|
+
selectionLayer.style.zIndex = '1';
|
|
92395
|
+
layer.appendChild(selectionLayer);
|
|
92396
|
+
this.state.selectionLayer = selectionLayer;
|
|
92397
|
+
return selectionLayer;
|
|
92398
|
+
};
|
|
92258
92399
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92259
92400
|
var _this = this;
|
|
92260
92401
|
var visibleFrameIds = new Set();
|
|
@@ -92319,6 +92460,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92319
92460
|
elements.set(id, overlay);
|
|
92320
92461
|
return overlay;
|
|
92321
92462
|
};
|
|
92463
|
+
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92464
|
+
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92465
|
+
if (selectionOverlay) {
|
|
92466
|
+
if (selectionOverlay.parentElement !== parent) {
|
|
92467
|
+
parent.appendChild(selectionOverlay);
|
|
92468
|
+
}
|
|
92469
|
+
return selectionOverlay;
|
|
92470
|
+
}
|
|
92471
|
+
selectionOverlay = document.createElement('div');
|
|
92472
|
+
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92473
|
+
selectionOverlay.dataset.itemId = id;
|
|
92474
|
+
selectionOverlay.style.position = 'absolute';
|
|
92475
|
+
selectionOverlay.style.pointerEvents = 'none';
|
|
92476
|
+
selectionOverlay.style.zIndex = '1';
|
|
92477
|
+
parent.appendChild(selectionOverlay);
|
|
92478
|
+
this.state.selectionElements.set(id, selectionOverlay);
|
|
92479
|
+
return selectionOverlay;
|
|
92480
|
+
};
|
|
92481
|
+
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92482
|
+
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92483
|
+
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92484
|
+
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92485
|
+
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92486
|
+
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92487
|
+
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92488
|
+
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92489
|
+
};
|
|
92490
|
+
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92491
|
+
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92492
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92493
|
+
};
|
|
92494
|
+
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92495
|
+
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92496
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92497
|
+
};
|
|
92322
92498
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92323
92499
|
var layer = this.state.layer;
|
|
92324
92500
|
if (!layer) {
|
|
@@ -92357,13 +92533,143 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92357
92533
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92358
92534
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92359
92535
|
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;
|
|
92536
|
+
return isMouseEventInsideRect(event, element.getBoundingClientRect());
|
|
92362
92537
|
});
|
|
92363
92538
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92364
92539
|
}
|
|
92365
92540
|
return undefined;
|
|
92366
92541
|
};
|
|
92542
|
+
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92543
|
+
var zone = this.getContentInteractiveZoneByEvent(event);
|
|
92544
|
+
this.setActiveContentInteraction(zone);
|
|
92545
|
+
};
|
|
92546
|
+
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92547
|
+
var _this = this;
|
|
92548
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
92549
|
+
this.syncActiveContentInteraction(event);
|
|
92550
|
+
return;
|
|
92551
|
+
}
|
|
92552
|
+
this.pendingContentInteractionEvent = event;
|
|
92553
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92554
|
+
return;
|
|
92555
|
+
}
|
|
92556
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92557
|
+
_this.contentInteractionFrame = undefined;
|
|
92558
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92559
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92560
|
+
if (pendingEvent) {
|
|
92561
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92562
|
+
}
|
|
92563
|
+
});
|
|
92564
|
+
};
|
|
92565
|
+
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92566
|
+
var _this = this;
|
|
92567
|
+
var previous = this.state.activeContentInteraction;
|
|
92568
|
+
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)) {
|
|
92569
|
+
return;
|
|
92570
|
+
}
|
|
92571
|
+
this.state.activeContentInteraction = zone;
|
|
92572
|
+
var changedIds = new Set();
|
|
92573
|
+
if (previous) {
|
|
92574
|
+
changedIds.add(previous.id);
|
|
92575
|
+
}
|
|
92576
|
+
if (zone) {
|
|
92577
|
+
changedIds.add(zone.id);
|
|
92578
|
+
}
|
|
92579
|
+
changedIds.forEach(function(id) {
|
|
92580
|
+
_this.syncContentInteraction(id);
|
|
92581
|
+
});
|
|
92582
|
+
};
|
|
92583
|
+
_proto.getContentInteractiveZoneByEvent = function getContentInteractiveZoneByEvent(event) {
|
|
92584
|
+
var id = this.getHTMLCardIdByEvent(event);
|
|
92585
|
+
if (!id || this.isEditableCard(id)) {
|
|
92586
|
+
return undefined;
|
|
92587
|
+
}
|
|
92588
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92589
|
+
if (!contentOverlay) {
|
|
92590
|
+
return undefined;
|
|
92591
|
+
}
|
|
92592
|
+
var zone = this.getContentInteractionZones(id, contentOverlay).find(function(zone) {
|
|
92593
|
+
return isMouseEventInsideRect(event, zone.rect);
|
|
92594
|
+
});
|
|
92595
|
+
return zone ? {
|
|
92596
|
+
id: id,
|
|
92597
|
+
element: zone.element
|
|
92598
|
+
} : undefined;
|
|
92599
|
+
};
|
|
92600
|
+
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92601
|
+
var _this = this;
|
|
92602
|
+
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92603
|
+
if (cachedZones) {
|
|
92604
|
+
return cachedZones;
|
|
92605
|
+
}
|
|
92606
|
+
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92607
|
+
return !_this.isContentInteractionDisabled(element);
|
|
92608
|
+
}).map(function(element) {
|
|
92609
|
+
return {
|
|
92610
|
+
element: element,
|
|
92611
|
+
rect: element.getBoundingClientRect()
|
|
92612
|
+
};
|
|
92613
|
+
});
|
|
92614
|
+
this.state.contentInteractionZones.set(id, zones);
|
|
92615
|
+
this.observeContentInteractionZoneResizes(id, zones);
|
|
92616
|
+
return zones;
|
|
92617
|
+
};
|
|
92618
|
+
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92619
|
+
var _ref;
|
|
92620
|
+
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92621
|
+
var item = this.options.getItems().find(function(item) {
|
|
92622
|
+
return item.id === id;
|
|
92623
|
+
});
|
|
92624
|
+
if (!item) {
|
|
92625
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92626
|
+
}
|
|
92627
|
+
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 : [];
|
|
92628
|
+
if (selectors.length === 0) {
|
|
92629
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92630
|
+
}
|
|
92631
|
+
return [].concat([
|
|
92632
|
+
CONTENT_INTERACTIVE_SELECTOR
|
|
92633
|
+
], selectors).join(', ');
|
|
92634
|
+
};
|
|
92635
|
+
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92636
|
+
if (typeof element.closest !== 'function') {
|
|
92637
|
+
return false;
|
|
92638
|
+
}
|
|
92639
|
+
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92640
|
+
};
|
|
92641
|
+
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92642
|
+
if (id) {
|
|
92643
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92644
|
+
this.state.contentInteractionZones.delete(id);
|
|
92645
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92646
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92647
|
+
return;
|
|
92648
|
+
}
|
|
92649
|
+
this.state.contentInteractionZones.clear();
|
|
92650
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92651
|
+
cleanup();
|
|
92652
|
+
});
|
|
92653
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92654
|
+
};
|
|
92655
|
+
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92656
|
+
var _this = this;
|
|
92657
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92658
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92659
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92660
|
+
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92661
|
+
return;
|
|
92662
|
+
}
|
|
92663
|
+
var observer = new ResizeObserver(function() {
|
|
92664
|
+
_this.invalidateContentInteractionZones(id);
|
|
92665
|
+
});
|
|
92666
|
+
zones.forEach(function(zone) {
|
|
92667
|
+
observer.observe(zone.element);
|
|
92668
|
+
});
|
|
92669
|
+
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92670
|
+
observer.disconnect();
|
|
92671
|
+
});
|
|
92672
|
+
};
|
|
92367
92673
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92368
92674
|
var rect = this.options.container.getBoundingClientRect();
|
|
92369
92675
|
return {
|
|
@@ -92431,6 +92737,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92431
92737
|
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92432
92738
|
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92433
92739
|
}
|
|
92740
|
+
if (sizeChanged) {
|
|
92741
|
+
this.invalidateContentInteractionZones(id);
|
|
92742
|
+
}
|
|
92434
92743
|
};
|
|
92435
92744
|
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92436
92745
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
@@ -92438,8 +92747,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92438
92747
|
});
|
|
92439
92748
|
};
|
|
92440
92749
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92441
|
-
var _this_state_editing;
|
|
92750
|
+
var _this_state_editing, _this_state_activeContentInteraction;
|
|
92442
92751
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
92752
|
+
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92753
|
+
var isInteractive = isEditing || !!activeInteraction;
|
|
92443
92754
|
var overlay = this.state.elements.get(id);
|
|
92444
92755
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92445
92756
|
var contentOverlay = this.state.contentElements.get(id);
|
|
@@ -92454,34 +92765,49 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92454
92765
|
}
|
|
92455
92766
|
if (contentOverlay) {
|
|
92456
92767
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92457
|
-
contentOverlay.style.pointerEvents = 'none';
|
|
92768
|
+
contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92458
92769
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92459
|
-
|
|
92460
|
-
iframe.
|
|
92770
|
+
var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
|
|
92771
|
+
iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
|
|
92772
|
+
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92461
92773
|
});
|
|
92462
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92774
|
+
this.syncShellInteraction(id, contentOverlay, isInteractive);
|
|
92775
|
+
this.syncContentInteractionZones(id, contentOverlay, activeInteraction == null ? void 0 : activeInteraction.element, isEditing, isInteractive);
|
|
92463
92776
|
}
|
|
92464
92777
|
if (contentMount) {
|
|
92465
92778
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92466
|
-
contentMount.style.pointerEvents =
|
|
92467
|
-
contentMount.inert = !
|
|
92468
|
-
if (
|
|
92779
|
+
contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92780
|
+
contentMount.inert = !isInteractive;
|
|
92781
|
+
if (isInteractive) {
|
|
92469
92782
|
contentMount.removeAttribute('aria-hidden');
|
|
92470
92783
|
} else {
|
|
92471
92784
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92472
92785
|
}
|
|
92473
92786
|
}
|
|
92474
92787
|
};
|
|
92475
|
-
_proto.
|
|
92788
|
+
_proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeElement, isEditing, isInteractive) {
|
|
92789
|
+
var _this = this;
|
|
92790
|
+
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
92791
|
+
if (!isInteractive || _this.isContentInteractionDisabled(element)) {
|
|
92792
|
+
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
92793
|
+
element.style.pointerEvents = 'none';
|
|
92794
|
+
return;
|
|
92795
|
+
}
|
|
92796
|
+
var isElementInteractive = isEditing || activeElement === element;
|
|
92797
|
+
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
92798
|
+
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
92799
|
+
});
|
|
92800
|
+
};
|
|
92801
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92476
92802
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92477
|
-
var isShellInteractiveActive =
|
|
92803
|
+
var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
|
|
92478
92804
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92479
92805
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92480
92806
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92481
92807
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92482
92808
|
});
|
|
92483
92809
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92484
|
-
element.style.pointerEvents =
|
|
92810
|
+
element.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92485
92811
|
});
|
|
92486
92812
|
};
|
|
92487
92813
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92489,6 +92815,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92489
92815
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92490
92816
|
return;
|
|
92491
92817
|
}
|
|
92818
|
+
if (!this.isEditableCard(id)) {
|
|
92819
|
+
return;
|
|
92820
|
+
}
|
|
92492
92821
|
var box = this.options.getViewBoxById(id);
|
|
92493
92822
|
if (box.isEmpty()) {
|
|
92494
92823
|
return;
|
|
@@ -92532,6 +92861,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92532
92861
|
this.options.setViewport(editing.restoreViewport);
|
|
92533
92862
|
this.scheduleRender();
|
|
92534
92863
|
};
|
|
92864
|
+
_proto.isEditableCard = function isEditableCard(id) {
|
|
92865
|
+
var _this_options_resolveCardTypeConfig;
|
|
92866
|
+
var item = this.options.getItems().find(function(item) {
|
|
92867
|
+
return item.id === id;
|
|
92868
|
+
});
|
|
92869
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
92870
|
+
};
|
|
92535
92871
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92536
92872
|
var viewportElement = this.options.container.parentElement;
|
|
92537
92873
|
if (!viewportElement) {
|
|
@@ -92556,6 +92892,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92556
92892
|
};
|
|
92557
92893
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92558
92894
|
this.cleanupOverlayContent(id);
|
|
92895
|
+
this.invalidateContentInteractionZones(id);
|
|
92559
92896
|
overlay.innerHTML = '';
|
|
92560
92897
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92561
92898
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92567,12 +92904,72 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92567
92904
|
id: id,
|
|
92568
92905
|
autoHeight: this.isAutoHeightEnabled(item)
|
|
92569
92906
|
});
|
|
92907
|
+
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92570
92908
|
this.state.cleanups.set(id, function() {
|
|
92571
92909
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92572
92910
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
92573
92911
|
});
|
|
92574
92912
|
this.state.contents.set(id, html);
|
|
92575
92913
|
};
|
|
92914
|
+
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
92915
|
+
var _this = this;
|
|
92916
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92917
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
92918
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92919
|
+
if (typeof MutationObserver !== 'function') {
|
|
92920
|
+
return;
|
|
92921
|
+
}
|
|
92922
|
+
var observer = new MutationObserver(function() {
|
|
92923
|
+
_this.invalidateContentInteractionZones(id);
|
|
92924
|
+
});
|
|
92925
|
+
observer.observe(contentContainer, {
|
|
92926
|
+
attributes: true,
|
|
92927
|
+
childList: true,
|
|
92928
|
+
subtree: true
|
|
92929
|
+
});
|
|
92930
|
+
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
92931
|
+
observer.disconnect();
|
|
92932
|
+
});
|
|
92933
|
+
};
|
|
92934
|
+
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
92935
|
+
var _ref, _config_style;
|
|
92936
|
+
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
92937
|
+
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
92938
|
+
this.htmlRootConfigCleanups.delete(root);
|
|
92939
|
+
var config = html.root;
|
|
92940
|
+
if (!config) {
|
|
92941
|
+
return;
|
|
92942
|
+
}
|
|
92943
|
+
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
92944
|
+
var styleProperties = [];
|
|
92945
|
+
classNames.forEach(function(className) {
|
|
92946
|
+
root.classList.add(className);
|
|
92947
|
+
});
|
|
92948
|
+
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
92949
|
+
var property = param[0], value = param[1];
|
|
92950
|
+
if (value === undefined) {
|
|
92951
|
+
return;
|
|
92952
|
+
}
|
|
92953
|
+
styleProperties.push(property);
|
|
92954
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92955
|
+
root.style.setProperty(property, String(value));
|
|
92956
|
+
return;
|
|
92957
|
+
}
|
|
92958
|
+
root.style[property] = String(value);
|
|
92959
|
+
});
|
|
92960
|
+
this.htmlRootConfigCleanups.set(root, function() {
|
|
92961
|
+
classNames.forEach(function(className) {
|
|
92962
|
+
root.classList.remove(className);
|
|
92963
|
+
});
|
|
92964
|
+
styleProperties.forEach(function(property) {
|
|
92965
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92966
|
+
root.style.removeProperty(property);
|
|
92967
|
+
return;
|
|
92968
|
+
}
|
|
92969
|
+
root.style[property] = '';
|
|
92970
|
+
});
|
|
92971
|
+
});
|
|
92972
|
+
};
|
|
92576
92973
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
92577
92974
|
var _this = this;
|
|
92578
92975
|
switch(content.kind){
|
|
@@ -92638,6 +93035,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92638
93035
|
};
|
|
92639
93036
|
};
|
|
92640
93037
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93038
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92641
93039
|
var cleanup = this.state.cleanups.get(id);
|
|
92642
93040
|
if (cleanup) {
|
|
92643
93041
|
cleanup();
|
|
@@ -92646,13 +93044,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92646
93044
|
this.state.contents.delete(id);
|
|
92647
93045
|
this.state.contentMountElements.delete(id);
|
|
92648
93046
|
this.state.autoHeightModes.delete(id);
|
|
93047
|
+
this.invalidateContentInteractionZones(id);
|
|
93048
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93049
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92649
93050
|
this.cleanupAutoHeight(id);
|
|
92650
93051
|
};
|
|
92651
93052
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
92652
|
-
var _this_state_elements_get;
|
|
93053
|
+
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
92653
93054
|
this.cleanupOverlayContent(id);
|
|
92654
93055
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93056
|
+
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
92655
93057
|
this.state.elements.delete(id);
|
|
93058
|
+
this.state.selectionElements.delete(id);
|
|
92656
93059
|
this.state.contentScaleElements.delete(id);
|
|
92657
93060
|
this.state.contentElements.delete(id);
|
|
92658
93061
|
};
|
|
@@ -92885,6 +93288,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92885
93288
|
}
|
|
92886
93289
|
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
92887
93290
|
};
|
|
93291
|
+
_create_class(HTMLOverlayManager, [
|
|
93292
|
+
{
|
|
93293
|
+
key: "layerElement",
|
|
93294
|
+
get: function get() {
|
|
93295
|
+
return this.state.layer;
|
|
93296
|
+
}
|
|
93297
|
+
}
|
|
93298
|
+
]);
|
|
92888
93299
|
return HTMLOverlayManager;
|
|
92889
93300
|
}();
|
|
92890
93301
|
function waitForCardCaptureReady(root) {
|
|
@@ -92926,6 +93337,17 @@ function waitForCardCaptureReady(root) {
|
|
|
92926
93337
|
});
|
|
92927
93338
|
})();
|
|
92928
93339
|
}
|
|
93340
|
+
function formatCssColor(color, alpha) {
|
|
93341
|
+
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93342
|
+
var red = normalizedColor >> 16 & 0xFF;
|
|
93343
|
+
var green = normalizedColor >> 8 & 0xFF;
|
|
93344
|
+
var blue = normalizedColor & 0xFF;
|
|
93345
|
+
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93346
|
+
}
|
|
93347
|
+
function formatCssNumber(value) {
|
|
93348
|
+
var normalized = Number.isFinite(value) ? value : 0;
|
|
93349
|
+
return Number(normalized.toFixed(6)).toString();
|
|
93350
|
+
}
|
|
92929
93351
|
function nextAnimationFrame() {
|
|
92930
93352
|
return new Promise(function(resolve) {
|
|
92931
93353
|
requestAnimationFrame(function() {
|
|
@@ -93344,6 +93766,9 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93344
93766
|
});
|
|
93345
93767
|
return replacement;
|
|
93346
93768
|
}
|
|
93769
|
+
function isMouseEventInsideRect(event, rect) {
|
|
93770
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
93771
|
+
}
|
|
93347
93772
|
function createFlattenedIframeContent(iframe) {
|
|
93348
93773
|
var doc = iframe.contentDocument;
|
|
93349
93774
|
if (!doc) {
|
|
@@ -93383,6 +93808,19 @@ function withTimeout(promise, timeout) {
|
|
|
93383
93808
|
});
|
|
93384
93809
|
}
|
|
93385
93810
|
|
|
93811
|
+
function orderSDKCanvasLayers(param) {
|
|
93812
|
+
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
93813
|
+
[
|
|
93814
|
+
playerContainer,
|
|
93815
|
+
htmlOverlayLayer,
|
|
93816
|
+
gestureCanvas
|
|
93817
|
+
].forEach(function(layer) {
|
|
93818
|
+
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
93819
|
+
container.appendChild(layer);
|
|
93820
|
+
}
|
|
93821
|
+
});
|
|
93822
|
+
}
|
|
93823
|
+
|
|
93386
93824
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93387
93825
|
var SDK = /*#__PURE__*/ function() {
|
|
93388
93826
|
function SDK(container, mode) {
|
|
@@ -93489,6 +93927,35 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93489
93927
|
propertyValue: height
|
|
93490
93928
|
});
|
|
93491
93929
|
},
|
|
93930
|
+
getSelectedItemIds: function getSelectedItemIds() {
|
|
93931
|
+
var _ref;
|
|
93932
|
+
var _this__pageData;
|
|
93933
|
+
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
93934
|
+
},
|
|
93935
|
+
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
93936
|
+
var _this__pageData;
|
|
93937
|
+
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
93938
|
+
},
|
|
93939
|
+
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
93940
|
+
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;
|
|
93941
|
+
return {
|
|
93942
|
+
color: wireframeColor,
|
|
93943
|
+
alpha: wireframeAlpha,
|
|
93944
|
+
width: wireframeWidth
|
|
93945
|
+
};
|
|
93946
|
+
},
|
|
93947
|
+
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
93948
|
+
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
93949
|
+
return {
|
|
93950
|
+
color: preSelectedColor,
|
|
93951
|
+
alpha: 1,
|
|
93952
|
+
width: preSelectedWidth
|
|
93953
|
+
};
|
|
93954
|
+
},
|
|
93955
|
+
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
93956
|
+
var _this__gestureHandler;
|
|
93957
|
+
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
93958
|
+
},
|
|
93492
93959
|
resolveCardHTML: function resolveCardHTML(item) {
|
|
93493
93960
|
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
93494
93961
|
},
|
|
@@ -93497,6 +93964,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93497
93964
|
}
|
|
93498
93965
|
});
|
|
93499
93966
|
this._htmlOverlayManager.attach();
|
|
93967
|
+
this.syncCanvasLayerOrder();
|
|
93500
93968
|
}
|
|
93501
93969
|
var _proto = SDK.prototype;
|
|
93502
93970
|
_proto.dispose = function dispose() {
|
|
@@ -93592,6 +94060,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93592
94060
|
this.initPlayer(SDK.config.mode);
|
|
93593
94061
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
93594
94062
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94063
|
+
this.syncCanvasLayerOrder();
|
|
93595
94064
|
return [
|
|
93596
94065
|
4,
|
|
93597
94066
|
this.runByPageData(this.pageData)
|
|
@@ -93641,6 +94110,16 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93641
94110
|
env: 'editor'
|
|
93642
94111
|
});
|
|
93643
94112
|
this.player.resize();
|
|
94113
|
+
this.syncCanvasLayerOrder();
|
|
94114
|
+
};
|
|
94115
|
+
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94116
|
+
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94117
|
+
orderSDKCanvasLayers({
|
|
94118
|
+
container: this._container,
|
|
94119
|
+
playerContainer: this._playerContainer,
|
|
94120
|
+
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94121
|
+
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94122
|
+
});
|
|
93644
94123
|
};
|
|
93645
94124
|
_proto.getInitParam = function getInitParam(param) {
|
|
93646
94125
|
return _async_to_generator(function() {
|
|
@@ -94735,8 +95214,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94735
95214
|
* @param ignoreClamp 是否忽视约束
|
|
94736
95215
|
*/ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
|
|
94737
95216
|
assertExist$1(this._pageData);
|
|
94738
|
-
this.
|
|
94739
|
-
this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
|
|
95217
|
+
this._pageDataUtils.setPageZoom(zoom, center, ignoreClamp);
|
|
94740
95218
|
this._gestureHandler.render();
|
|
94741
95219
|
};
|
|
94742
95220
|
/**
|