@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.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.6
|
|
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
|
}
|
|
@@ -55577,6 +55577,16 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55577
55577
|
newWidth,
|
|
55578
55578
|
newHeight
|
|
55579
55579
|
], translation1);
|
|
55580
|
+
} else if (selectedItem && selectedItems.length === 1 && isCardItem(selectedItem)) {
|
|
55581
|
+
void this._pageDataUtils.setItemProperty({
|
|
55582
|
+
itemId: selectedItem.id,
|
|
55583
|
+
type: SDKItemType.CARD,
|
|
55584
|
+
property: {
|
|
55585
|
+
width: selectedItem.width * resultScalar1.x,
|
|
55586
|
+
height: selectedItem.height * resultScalar1.y
|
|
55587
|
+
}
|
|
55588
|
+
});
|
|
55589
|
+
this._pageDataUtils.moveItem(selectedItem.id, translation1);
|
|
55580
55590
|
} else {
|
|
55581
55591
|
// 普通元素的缩放逻辑
|
|
55582
55592
|
selectedItems.forEach(function(item) {
|
|
@@ -55901,6 +55911,7 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55901
55911
|
var selectedItems = this._pageDataUtils.getSelectedItems();
|
|
55902
55912
|
var isTemplateMode = SDK.config.mode === 'template';
|
|
55903
55913
|
var selectedItem = selectedItems.length === 1 ? selectedItems[0] : undefined;
|
|
55914
|
+
var isSingleCardItem = isCardItem(selectedItem);
|
|
55904
55915
|
var isGeneratorItem = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.GENERATOR;
|
|
55905
55916
|
var isAutoLayoutFrame = (selectedItem == null ? void 0 : selectedItem.type) === SDKItemType.FRAME && (selectedItem == null ? void 0 : selectedItem.layoutMode) === FrameLayoutMode.AUTO;
|
|
55906
55917
|
var canScale = selectedItems.length === 1 && (selectedItem == null ? void 0 : selectedItem.type) !== SDKItemType.GROUP && !isAutoLayoutFrame && !isGeneratorItem;
|
|
@@ -55940,9 +55951,11 @@ var TransformGizmo = /*#__PURE__*/ function(Gizmo) {
|
|
|
55940
55951
|
this.wireframe.totalBox.copyFrom(box).expandByScalar(totalBoxExpandScalar);
|
|
55941
55952
|
// 根据box获取边缘线
|
|
55942
55953
|
var corners = this.wireframe.box.corners;
|
|
55943
|
-
|
|
55944
|
-
|
|
55945
|
-
|
|
55954
|
+
if (!isSingleCardItem) {
|
|
55955
|
+
corners.forEach(function(corner, i) {
|
|
55956
|
+
_this.wireframe.edges.push(new Line2(new Vector2().copyFrom(corner), new Vector2().copyFrom(corners[(i + 1) % 4])));
|
|
55957
|
+
});
|
|
55958
|
+
}
|
|
55946
55959
|
var _SDK_config_gestureHandlerConfig_transformGizmoConfig = SDK.config.gestureHandlerConfig.transformGizmoConfig, scaleCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.scaleCircleSize, rotationCircleSize = _SDK_config_gestureHandlerConfig_transformGizmoConfig.rotationCircleSize;
|
|
55947
55960
|
// 成组暂不支持缩放
|
|
55948
55961
|
if (selectedItems.length === 1) {
|
|
@@ -63184,10 +63197,13 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
63184
63197
|
1
|
|
63185
63198
|
] : _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
63199
|
// 校验 cardType 是否已在配置中注册
|
|
63200
|
+
var cardTypeConfig = SDK.config.itemConfig.cardConfig.cardTypes.find(function(t) {
|
|
63201
|
+
return t.type === cardType;
|
|
63202
|
+
});
|
|
63187
63203
|
var registeredTypes = SDK.config.itemConfig.cardConfig.cardTypes.map(function(t) {
|
|
63188
63204
|
return t.type;
|
|
63189
63205
|
});
|
|
63190
|
-
if (!
|
|
63206
|
+
if (!cardTypeConfig) {
|
|
63191
63207
|
console.warn('CardItem cardType "' + cardType + '" is not registered. Registered types: ' + registeredTypes.join(', '));
|
|
63192
63208
|
return;
|
|
63193
63209
|
}
|
|
@@ -91837,14 +91853,13 @@ function syncElementStackOrder(_container, elements) {
|
|
|
91837
91853
|
});
|
|
91838
91854
|
}
|
|
91839
91855
|
|
|
91840
|
-
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY,
|
|
91856
|
+
function getCardOverlayBoxStyle(box, width, height, offsetX, offsetY, _autoScale) {
|
|
91841
91857
|
if (offsetX === void 0) offsetX = 0;
|
|
91842
91858
|
if (offsetY === void 0) offsetY = 0;
|
|
91843
|
-
if (autoScale === void 0) autoScale = true;
|
|
91844
91859
|
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
91845
91860
|
var _box_corners = box.corners, rightTop = _box_corners[0], leftBottom = _box_corners[2], leftTop = _box_corners[3];
|
|
91846
|
-
var contentWidth =
|
|
91847
|
-
var contentHeight =
|
|
91861
|
+
var contentWidth = width;
|
|
91862
|
+
var contentHeight = height;
|
|
91848
91863
|
var a = (rightTop.x - leftTop.x) / contentWidth;
|
|
91849
91864
|
var b = (rightTop.y - leftTop.y) / contentWidth;
|
|
91850
91865
|
var c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
@@ -91916,6 +91931,27 @@ function mountHTMLShell(container, content, shell) {
|
|
|
91916
91931
|
|
|
91917
91932
|
var SHELL_INTERACTIVE_SELECTOR = '[data-vvfx-html-shell-interactive="true"]';
|
|
91918
91933
|
var EDITING_INTERACTIVE_SELECTOR = '[data-vvfx-html-editing-interactive="true"]';
|
|
91934
|
+
var CONTENT_INTERACTIVE_SELECTOR = [
|
|
91935
|
+
'[data-interaction-zone="self"]',
|
|
91936
|
+
'[data-vvfx-html-interaction-zone="self"]',
|
|
91937
|
+
'a[href]',
|
|
91938
|
+
'button:not([disabled])',
|
|
91939
|
+
'input:not([disabled])',
|
|
91940
|
+
'textarea:not([disabled])',
|
|
91941
|
+
'select:not([disabled])',
|
|
91942
|
+
'summary',
|
|
91943
|
+
'video[controls]',
|
|
91944
|
+
'audio[controls]',
|
|
91945
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
91946
|
+
'[role="button"]',
|
|
91947
|
+
'[role="link"]',
|
|
91948
|
+
'[role="textbox"]',
|
|
91949
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
91950
|
+
].join(', ');
|
|
91951
|
+
var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
91952
|
+
'[data-interaction-zone="none"]',
|
|
91953
|
+
'[data-vvfx-html-interaction-zone="none"]'
|
|
91954
|
+
].join(', ');
|
|
91919
91955
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
91920
91956
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91921
91957
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
@@ -91925,12 +91961,17 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91925
91961
|
var _this = this;
|
|
91926
91962
|
this.options = options;
|
|
91927
91963
|
this.eventCleanups = [];
|
|
91964
|
+
this.htmlRootConfigCleanups = new WeakMap();
|
|
91928
91965
|
this.state = {
|
|
91929
91966
|
frameElements: new Map(),
|
|
91930
91967
|
elements: new Map(),
|
|
91968
|
+
selectionElements: new Map(),
|
|
91931
91969
|
contentScaleElements: new Map(),
|
|
91932
91970
|
contentElements: new Map(),
|
|
91933
91971
|
contentMountElements: new Map(),
|
|
91972
|
+
contentInteractionZones: new Map(),
|
|
91973
|
+
contentInteractionZoneCleanups: new Map(),
|
|
91974
|
+
contentInteractionResizeCleanups: new Map(),
|
|
91934
91975
|
contents: new Map(),
|
|
91935
91976
|
cleanups: new Map(),
|
|
91936
91977
|
autoHeightModes: new Map(),
|
|
@@ -91950,6 +91991,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91950
91991
|
}
|
|
91951
91992
|
return;
|
|
91952
91993
|
}
|
|
91994
|
+
if (!_this.isEditableCard(targetId)) {
|
|
91995
|
+
return;
|
|
91996
|
+
}
|
|
91953
91997
|
event.preventDefault();
|
|
91954
91998
|
event.stopPropagation();
|
|
91955
91999
|
_this.enterEditing(targetId);
|
|
@@ -91965,6 +92009,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91965
92009
|
_this.exitEditing();
|
|
91966
92010
|
};
|
|
91967
92011
|
this.handleContainerMouseMove = function(event) {
|
|
92012
|
+
_this.scheduleActiveContentInteractionSync(event);
|
|
91968
92013
|
var hoverShellInteractiveId = _this.getHoverShellInteractiveIdByEvent(event);
|
|
91969
92014
|
if (_this.state.hoverShellInteractiveId === hoverShellInteractiveId) {
|
|
91970
92015
|
return;
|
|
@@ -91979,6 +92024,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91979
92024
|
}
|
|
91980
92025
|
};
|
|
91981
92026
|
this.handleContainerMouseLeave = function() {
|
|
92027
|
+
if (_this.contentInteractionFrame !== undefined) {
|
|
92028
|
+
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
92029
|
+
_this.contentInteractionFrame = undefined;
|
|
92030
|
+
}
|
|
92031
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92032
|
+
_this.setActiveContentInteraction(undefined);
|
|
91982
92033
|
var previousId = _this.state.hoverShellInteractiveId;
|
|
91983
92034
|
if (!previousId) {
|
|
91984
92035
|
return;
|
|
@@ -91986,6 +92037,33 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91986
92037
|
_this.state.hoverShellInteractiveId = undefined;
|
|
91987
92038
|
_this.syncContentInteraction(previousId);
|
|
91988
92039
|
};
|
|
92040
|
+
this.handleContainerContextMenu = function(event) {
|
|
92041
|
+
var activeInteraction = _this.state.activeContentInteraction;
|
|
92042
|
+
if (!activeInteraction || !_this.isEventInsideOverlay(activeInteraction.id, event) || _this.isHTMLContextMenuEvent(event)) {
|
|
92043
|
+
return;
|
|
92044
|
+
}
|
|
92045
|
+
var canvas = _this.options.getCanvasEventTarget == null ? void 0 : _this.options.getCanvasEventTarget.call(_this.options);
|
|
92046
|
+
if (!canvas) {
|
|
92047
|
+
return;
|
|
92048
|
+
}
|
|
92049
|
+
event.preventDefault();
|
|
92050
|
+
event.stopPropagation();
|
|
92051
|
+
_this.setActiveContentInteraction(undefined);
|
|
92052
|
+
canvas.dispatchEvent(new MouseEvent('contextmenu', {
|
|
92053
|
+
bubbles: true,
|
|
92054
|
+
cancelable: true,
|
|
92055
|
+
clientX: event.clientX,
|
|
92056
|
+
clientY: event.clientY,
|
|
92057
|
+
screenX: event.screenX,
|
|
92058
|
+
screenY: event.screenY,
|
|
92059
|
+
button: event.button,
|
|
92060
|
+
buttons: event.buttons,
|
|
92061
|
+
ctrlKey: event.ctrlKey,
|
|
92062
|
+
shiftKey: event.shiftKey,
|
|
92063
|
+
altKey: event.altKey,
|
|
92064
|
+
metaKey: event.metaKey
|
|
92065
|
+
}));
|
|
92066
|
+
};
|
|
91989
92067
|
this.isAutoHeightMessage = isCardHTMLAutoHeightMessage;
|
|
91990
92068
|
}
|
|
91991
92069
|
var _proto = HTMLOverlayManager.prototype;
|
|
@@ -91999,7 +92077,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91999
92077
|
layer.style.position = 'absolute';
|
|
92000
92078
|
layer.style.inset = '0';
|
|
92001
92079
|
layer.style.pointerEvents = 'none';
|
|
92002
|
-
layer.style.zIndex = '1';
|
|
92003
92080
|
container.appendChild(layer);
|
|
92004
92081
|
this.state.layer = layer;
|
|
92005
92082
|
this.initDOMEvents();
|
|
@@ -92012,14 +92089,29 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92012
92089
|
cancelAnimationFrame(this.state.updateFrame);
|
|
92013
92090
|
this.state.updateFrame = undefined;
|
|
92014
92091
|
}
|
|
92092
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92093
|
+
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92094
|
+
this.contentInteractionFrame = undefined;
|
|
92095
|
+
}
|
|
92096
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92015
92097
|
this.state.cleanups.forEach(function(cleanup) {
|
|
92016
92098
|
cleanup();
|
|
92017
92099
|
});
|
|
92018
92100
|
this.state.frameElements.clear();
|
|
92019
92101
|
this.state.elements.clear();
|
|
92102
|
+
this.state.selectionElements.clear();
|
|
92020
92103
|
this.state.contentScaleElements.clear();
|
|
92021
92104
|
this.state.contentElements.clear();
|
|
92022
92105
|
this.state.contentMountElements.clear();
|
|
92106
|
+
this.state.contentInteractionZones.clear();
|
|
92107
|
+
this.state.contentInteractionZoneCleanups.forEach(function(cleanup) {
|
|
92108
|
+
cleanup();
|
|
92109
|
+
});
|
|
92110
|
+
this.state.contentInteractionZoneCleanups.clear();
|
|
92111
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92112
|
+
cleanup();
|
|
92113
|
+
});
|
|
92114
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92023
92115
|
this.state.contents.clear();
|
|
92024
92116
|
this.state.cleanups.clear();
|
|
92025
92117
|
this.state.autoHeightModes.clear();
|
|
@@ -92037,10 +92129,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92037
92129
|
this.eventCleanups = [];
|
|
92038
92130
|
(_this_state_layer = this.state.layer) == null ? void 0 : _this_state_layer.remove();
|
|
92039
92131
|
this.state.layer = undefined;
|
|
92132
|
+
this.state.selectionLayer = undefined;
|
|
92040
92133
|
this.options.container.removeEventListener('dblclick', this.handleContainerDoubleClick, true);
|
|
92041
92134
|
this.options.container.removeEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92042
92135
|
this.options.container.removeEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92043
92136
|
this.options.container.removeEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92137
|
+
this.options.container.removeEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92044
92138
|
};
|
|
92045
92139
|
_proto.scheduleRender = function scheduleRender() {
|
|
92046
92140
|
var _this = this;
|
|
@@ -92054,6 +92148,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92054
92148
|
};
|
|
92055
92149
|
_proto.invalidateCardHTML = function invalidateCardHTML(id) {
|
|
92056
92150
|
this.cleanupOverlayContent(id);
|
|
92151
|
+
this.invalidateContentInteractionZones(id);
|
|
92057
92152
|
};
|
|
92058
92153
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92059
92154
|
return _async_to_generator(function() {
|
|
@@ -92147,6 +92242,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92147
92242
|
var events = [
|
|
92148
92243
|
'pageDataChange',
|
|
92149
92244
|
'selectedItemChange',
|
|
92245
|
+
'preSelectedItemChange',
|
|
92150
92246
|
'itemPropertyChange',
|
|
92151
92247
|
'viewportTransform',
|
|
92152
92248
|
'viewRebuildFinish'
|
|
@@ -92156,6 +92252,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92156
92252
|
if (event === 'viewportTransform') {
|
|
92157
92253
|
_this.handleViewportTransform();
|
|
92158
92254
|
}
|
|
92255
|
+
_this.invalidateContentInteractionZones();
|
|
92159
92256
|
_this.scheduleRender();
|
|
92160
92257
|
});
|
|
92161
92258
|
});
|
|
@@ -92165,6 +92262,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92165
92262
|
this.options.container.addEventListener('mousedown', this.handleContainerMouseDown, true);
|
|
92166
92263
|
this.options.container.addEventListener('mousemove', this.handleContainerMouseMove, true);
|
|
92167
92264
|
this.options.container.addEventListener('mouseleave', this.handleContainerMouseLeave, true);
|
|
92265
|
+
this.options.container.addEventListener('contextmenu', this.handleContainerContextMenu, true);
|
|
92266
|
+
};
|
|
92267
|
+
_proto.isHTMLContextMenuEvent = function isHTMLContextMenuEvent(event) {
|
|
92268
|
+
if (typeof Element !== 'function' || !_instanceof(event.target, Element)) {
|
|
92269
|
+
return false;
|
|
92270
|
+
}
|
|
92271
|
+
return !!event.target.closest('[data-interaction-contextmenu="self"], [data-vvfx-html-contextmenu="self"]');
|
|
92168
92272
|
};
|
|
92169
92273
|
_proto.handleViewportTransform = function handleViewportTransform() {
|
|
92170
92274
|
var editing = this.state.editing;
|
|
@@ -92184,6 +92288,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92184
92288
|
}
|
|
92185
92289
|
var items = this.options.getItems();
|
|
92186
92290
|
var frameByChildId = this.renderFrameOverlays(items, layer);
|
|
92291
|
+
var selectionLayer = this.getOrCreateSelectionLayer(layer);
|
|
92187
92292
|
var visibleCardIds = new Set();
|
|
92188
92293
|
var editingVisible = false;
|
|
92189
92294
|
items.forEach(function(item) {
|
|
@@ -92207,9 +92312,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92207
92312
|
var frameBox = frameId ? _this.options.getViewBoxById(frameId) : undefined;
|
|
92208
92313
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92209
92314
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92315
|
+
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92210
92316
|
if (!_this.state.contents.has(item.id)) {
|
|
92211
92317
|
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92212
92318
|
}
|
|
92319
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92213
92320
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92214
92321
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92215
92322
|
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
@@ -92219,6 +92326,15 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92219
92326
|
overlay.style.height = boxStyle.height;
|
|
92220
92327
|
overlay.style.transform = boxStyle.transform;
|
|
92221
92328
|
overlay.style.transformOrigin = '0 0';
|
|
92329
|
+
var selectionBoxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, 0, 0, _this.isAutoScaleEnabled(item));
|
|
92330
|
+
selectionOverlay.style.left = selectionBoxStyle.left;
|
|
92331
|
+
selectionOverlay.style.top = selectionBoxStyle.top;
|
|
92332
|
+
selectionOverlay.style.width = selectionBoxStyle.width;
|
|
92333
|
+
selectionOverlay.style.height = selectionBoxStyle.height;
|
|
92334
|
+
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92335
|
+
selectionOverlay.style.transformOrigin = '0 0';
|
|
92336
|
+
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92337
|
+
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92222
92338
|
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92223
92339
|
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92224
92340
|
_this.syncContentInteraction(item.id);
|
|
@@ -92259,6 +92375,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92259
92375
|
}
|
|
92260
92376
|
}
|
|
92261
92377
|
syncElementStackOrder(layer, rootElements);
|
|
92378
|
+
if (this.state.selectionLayer) {
|
|
92379
|
+
this.state.selectionLayer.style.zIndex = "" + (rootElements.length + 1);
|
|
92380
|
+
}
|
|
92262
92381
|
this.state.frameElements.forEach(function(frameOverlay, frameId) {
|
|
92263
92382
|
var frameElements = [];
|
|
92264
92383
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
@@ -92274,6 +92393,28 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92274
92393
|
syncElementStackOrder(frameOverlay, frameElements);
|
|
92275
92394
|
});
|
|
92276
92395
|
};
|
|
92396
|
+
_proto.getOrCreateSelectionLayer = function getOrCreateSelectionLayer(layer) {
|
|
92397
|
+
var _layer_ownerDocument;
|
|
92398
|
+
if (this.state.selectionLayer) {
|
|
92399
|
+
if (this.state.selectionLayer.parentElement !== layer) {
|
|
92400
|
+
layer.appendChild(this.state.selectionLayer);
|
|
92401
|
+
}
|
|
92402
|
+
return this.state.selectionLayer;
|
|
92403
|
+
}
|
|
92404
|
+
var ownerDocument = (_layer_ownerDocument = layer.ownerDocument) != null ? _layer_ownerDocument : typeof document === 'undefined' ? undefined : document;
|
|
92405
|
+
if (!ownerDocument) {
|
|
92406
|
+
return layer;
|
|
92407
|
+
}
|
|
92408
|
+
var selectionLayer = ownerDocument.createElement('div');
|
|
92409
|
+
selectionLayer.className = 'vvfx-card-html-overlay-selection-layer';
|
|
92410
|
+
selectionLayer.style.position = 'absolute';
|
|
92411
|
+
selectionLayer.style.inset = '0';
|
|
92412
|
+
selectionLayer.style.pointerEvents = 'none';
|
|
92413
|
+
selectionLayer.style.zIndex = '1';
|
|
92414
|
+
layer.appendChild(selectionLayer);
|
|
92415
|
+
this.state.selectionLayer = selectionLayer;
|
|
92416
|
+
return selectionLayer;
|
|
92417
|
+
};
|
|
92277
92418
|
_proto.renderFrameOverlays = function renderFrameOverlays(items, layer) {
|
|
92278
92419
|
var _this = this;
|
|
92279
92420
|
var visibleFrameIds = new Set();
|
|
@@ -92338,6 +92479,41 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92338
92479
|
elements.set(id, overlay);
|
|
92339
92480
|
return overlay;
|
|
92340
92481
|
};
|
|
92482
|
+
_proto.getOrCreateSelectionOverlay = function getOrCreateSelectionOverlay(id, parent) {
|
|
92483
|
+
var selectionOverlay = this.state.selectionElements.get(id);
|
|
92484
|
+
if (selectionOverlay) {
|
|
92485
|
+
if (selectionOverlay.parentElement !== parent) {
|
|
92486
|
+
parent.appendChild(selectionOverlay);
|
|
92487
|
+
}
|
|
92488
|
+
return selectionOverlay;
|
|
92489
|
+
}
|
|
92490
|
+
selectionOverlay = document.createElement('div');
|
|
92491
|
+
selectionOverlay.className = 'vvfx-card-html-overlay-selection';
|
|
92492
|
+
selectionOverlay.dataset.itemId = id;
|
|
92493
|
+
selectionOverlay.style.position = 'absolute';
|
|
92494
|
+
selectionOverlay.style.pointerEvents = 'none';
|
|
92495
|
+
selectionOverlay.style.zIndex = '1';
|
|
92496
|
+
parent.appendChild(selectionOverlay);
|
|
92497
|
+
this.state.selectionElements.set(id, selectionOverlay);
|
|
92498
|
+
return selectionOverlay;
|
|
92499
|
+
};
|
|
92500
|
+
_proto.syncOverlaySelection = function syncOverlaySelection(id, overlay, selectionOverlay) {
|
|
92501
|
+
var isSelected = this.options.getSelectedItemIds().includes(id);
|
|
92502
|
+
var isPreSelected = !isSelected && this.options.getPreSelectedItemId() === id;
|
|
92503
|
+
overlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92504
|
+
overlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92505
|
+
selectionOverlay.dataset.selected = isSelected ? 'true' : 'false';
|
|
92506
|
+
selectionOverlay.dataset.preSelected = isPreSelected ? 'true' : 'false';
|
|
92507
|
+
selectionOverlay.style.boxShadow = isSelected ? this.getSelectionBoxShadow() : isPreSelected ? this.getPreSelectionBoxShadow() : '';
|
|
92508
|
+
};
|
|
92509
|
+
_proto.getSelectionBoxShadow = function getSelectionBoxShadow() {
|
|
92510
|
+
var _this_options_getSelectionEdgeStyle = this.options.getSelectionEdgeStyle(), color = _this_options_getSelectionEdgeStyle.color, alpha = _this_options_getSelectionEdgeStyle.alpha, width = _this_options_getSelectionEdgeStyle.width;
|
|
92511
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92512
|
+
};
|
|
92513
|
+
_proto.getPreSelectionBoxShadow = function getPreSelectionBoxShadow() {
|
|
92514
|
+
var _this_options_getPreSelectionEdgeStyle = this.options.getPreSelectionEdgeStyle(), color = _this_options_getPreSelectionEdgeStyle.color, alpha = _this_options_getPreSelectionEdgeStyle.alpha, width = _this_options_getPreSelectionEdgeStyle.width;
|
|
92515
|
+
return "inset 0 0 0 " + formatCssNumber(width) + "px " + formatCssColor(color, alpha);
|
|
92516
|
+
};
|
|
92341
92517
|
_proto.getHTMLCardIdByEvent = function getHTMLCardIdByEvent(event) {
|
|
92342
92518
|
var layer = this.state.layer;
|
|
92343
92519
|
if (!layer) {
|
|
@@ -92376,13 +92552,143 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92376
92552
|
var contentOverlay = this.state.contentElements.get(item.id);
|
|
92377
92553
|
var interactiveElements = contentOverlay ? Array.from(contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR)) : [];
|
|
92378
92554
|
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;
|
|
92555
|
+
return isMouseEventInsideRect(event, element.getBoundingClientRect());
|
|
92381
92556
|
});
|
|
92382
92557
|
return isHoveringShellInteractive ? item.id : undefined;
|
|
92383
92558
|
}
|
|
92384
92559
|
return undefined;
|
|
92385
92560
|
};
|
|
92561
|
+
_proto.syncActiveContentInteraction = function syncActiveContentInteraction(event) {
|
|
92562
|
+
var zone = this.getContentInteractiveZoneByEvent(event);
|
|
92563
|
+
this.setActiveContentInteraction(zone);
|
|
92564
|
+
};
|
|
92565
|
+
_proto.scheduleActiveContentInteractionSync = function scheduleActiveContentInteractionSync(event) {
|
|
92566
|
+
var _this = this;
|
|
92567
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
92568
|
+
this.syncActiveContentInteraction(event);
|
|
92569
|
+
return;
|
|
92570
|
+
}
|
|
92571
|
+
this.pendingContentInteractionEvent = event;
|
|
92572
|
+
if (this.contentInteractionFrame !== undefined) {
|
|
92573
|
+
return;
|
|
92574
|
+
}
|
|
92575
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92576
|
+
_this.contentInteractionFrame = undefined;
|
|
92577
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92578
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92579
|
+
if (pendingEvent) {
|
|
92580
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92581
|
+
}
|
|
92582
|
+
});
|
|
92583
|
+
};
|
|
92584
|
+
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92585
|
+
var _this = this;
|
|
92586
|
+
var previous = this.state.activeContentInteraction;
|
|
92587
|
+
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)) {
|
|
92588
|
+
return;
|
|
92589
|
+
}
|
|
92590
|
+
this.state.activeContentInteraction = zone;
|
|
92591
|
+
var changedIds = new Set();
|
|
92592
|
+
if (previous) {
|
|
92593
|
+
changedIds.add(previous.id);
|
|
92594
|
+
}
|
|
92595
|
+
if (zone) {
|
|
92596
|
+
changedIds.add(zone.id);
|
|
92597
|
+
}
|
|
92598
|
+
changedIds.forEach(function(id) {
|
|
92599
|
+
_this.syncContentInteraction(id);
|
|
92600
|
+
});
|
|
92601
|
+
};
|
|
92602
|
+
_proto.getContentInteractiveZoneByEvent = function getContentInteractiveZoneByEvent(event) {
|
|
92603
|
+
var id = this.getHTMLCardIdByEvent(event);
|
|
92604
|
+
if (!id || this.isEditableCard(id)) {
|
|
92605
|
+
return undefined;
|
|
92606
|
+
}
|
|
92607
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92608
|
+
if (!contentOverlay) {
|
|
92609
|
+
return undefined;
|
|
92610
|
+
}
|
|
92611
|
+
var zone = this.getContentInteractionZones(id, contentOverlay).find(function(zone) {
|
|
92612
|
+
return isMouseEventInsideRect(event, zone.rect);
|
|
92613
|
+
});
|
|
92614
|
+
return zone ? {
|
|
92615
|
+
id: id,
|
|
92616
|
+
element: zone.element
|
|
92617
|
+
} : undefined;
|
|
92618
|
+
};
|
|
92619
|
+
_proto.getContentInteractionZones = function getContentInteractionZones(id, contentOverlay) {
|
|
92620
|
+
var _this = this;
|
|
92621
|
+
var cachedZones = this.state.contentInteractionZones.get(id);
|
|
92622
|
+
if (cachedZones) {
|
|
92623
|
+
return cachedZones;
|
|
92624
|
+
}
|
|
92625
|
+
var zones = Array.from(contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id))).filter(function(element) {
|
|
92626
|
+
return !_this.isContentInteractionDisabled(element);
|
|
92627
|
+
}).map(function(element) {
|
|
92628
|
+
return {
|
|
92629
|
+
element: element,
|
|
92630
|
+
rect: element.getBoundingClientRect()
|
|
92631
|
+
};
|
|
92632
|
+
});
|
|
92633
|
+
this.state.contentInteractionZones.set(id, zones);
|
|
92634
|
+
this.observeContentInteractionZoneResizes(id, zones);
|
|
92635
|
+
return zones;
|
|
92636
|
+
};
|
|
92637
|
+
_proto.getContentInteractiveSelector = function getContentInteractiveSelector(id) {
|
|
92638
|
+
var _ref;
|
|
92639
|
+
var _this_options_resolveCardTypeConfig_htmlInteractionSelectors, _this_options_resolveCardTypeConfig;
|
|
92640
|
+
var item = this.options.getItems().find(function(item) {
|
|
92641
|
+
return item.id === id;
|
|
92642
|
+
});
|
|
92643
|
+
if (!item) {
|
|
92644
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92645
|
+
}
|
|
92646
|
+
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 : [];
|
|
92647
|
+
if (selectors.length === 0) {
|
|
92648
|
+
return CONTENT_INTERACTIVE_SELECTOR;
|
|
92649
|
+
}
|
|
92650
|
+
return [].concat([
|
|
92651
|
+
CONTENT_INTERACTIVE_SELECTOR
|
|
92652
|
+
], selectors).join(', ');
|
|
92653
|
+
};
|
|
92654
|
+
_proto.isContentInteractionDisabled = function isContentInteractionDisabled(element) {
|
|
92655
|
+
if (typeof element.closest !== 'function') {
|
|
92656
|
+
return false;
|
|
92657
|
+
}
|
|
92658
|
+
return !!element.closest(CONTENT_INTERACTION_NONE_SELECTOR);
|
|
92659
|
+
};
|
|
92660
|
+
_proto.invalidateContentInteractionZones = function invalidateContentInteractionZones(id) {
|
|
92661
|
+
if (id) {
|
|
92662
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92663
|
+
this.state.contentInteractionZones.delete(id);
|
|
92664
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92665
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92666
|
+
return;
|
|
92667
|
+
}
|
|
92668
|
+
this.state.contentInteractionZones.clear();
|
|
92669
|
+
this.state.contentInteractionResizeCleanups.forEach(function(cleanup) {
|
|
92670
|
+
cleanup();
|
|
92671
|
+
});
|
|
92672
|
+
this.state.contentInteractionResizeCleanups.clear();
|
|
92673
|
+
};
|
|
92674
|
+
_proto.observeContentInteractionZoneResizes = function observeContentInteractionZoneResizes(id, zones) {
|
|
92675
|
+
var _this = this;
|
|
92676
|
+
var _this_state_contentInteractionResizeCleanups_get;
|
|
92677
|
+
(_this_state_contentInteractionResizeCleanups_get = this.state.contentInteractionResizeCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionResizeCleanups_get();
|
|
92678
|
+
this.state.contentInteractionResizeCleanups.delete(id);
|
|
92679
|
+
if (zones.length === 0 || typeof ResizeObserver !== 'function') {
|
|
92680
|
+
return;
|
|
92681
|
+
}
|
|
92682
|
+
var observer = new ResizeObserver(function() {
|
|
92683
|
+
_this.invalidateContentInteractionZones(id);
|
|
92684
|
+
});
|
|
92685
|
+
zones.forEach(function(zone) {
|
|
92686
|
+
observer.observe(zone.element);
|
|
92687
|
+
});
|
|
92688
|
+
this.state.contentInteractionResizeCleanups.set(id, function() {
|
|
92689
|
+
observer.disconnect();
|
|
92690
|
+
});
|
|
92691
|
+
};
|
|
92386
92692
|
_proto.getLayerPoint = function getLayerPoint(event) {
|
|
92387
92693
|
var rect = this.options.container.getBoundingClientRect();
|
|
92388
92694
|
return {
|
|
@@ -92450,6 +92756,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92450
92756
|
if (sizeChanged && this.state.autoHeightModes.get(id) === 'message') {
|
|
92451
92757
|
this.requestAutoHeightFromIframes(id, contentOverlay);
|
|
92452
92758
|
}
|
|
92759
|
+
if (sizeChanged) {
|
|
92760
|
+
this.invalidateContentInteractionZones(id);
|
|
92761
|
+
}
|
|
92453
92762
|
};
|
|
92454
92763
|
_proto.requestAutoHeightFromIframes = function requestAutoHeightFromIframes(id, contentOverlay) {
|
|
92455
92764
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
@@ -92457,8 +92766,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92457
92766
|
});
|
|
92458
92767
|
};
|
|
92459
92768
|
_proto.syncContentInteraction = function syncContentInteraction(id) {
|
|
92460
|
-
var _this_state_editing;
|
|
92769
|
+
var _this_state_editing, _this_state_activeContentInteraction;
|
|
92461
92770
|
var isEditing = ((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id;
|
|
92771
|
+
var activeInteraction = ((_this_state_activeContentInteraction = this.state.activeContentInteraction) == null ? void 0 : _this_state_activeContentInteraction.id) === id ? this.state.activeContentInteraction : undefined;
|
|
92772
|
+
var isInteractive = isEditing || !!activeInteraction;
|
|
92462
92773
|
var overlay = this.state.elements.get(id);
|
|
92463
92774
|
var scaleOverlay = this.state.contentScaleElements.get(id);
|
|
92464
92775
|
var contentOverlay = this.state.contentElements.get(id);
|
|
@@ -92473,34 +92784,49 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92473
92784
|
}
|
|
92474
92785
|
if (contentOverlay) {
|
|
92475
92786
|
contentOverlay.dataset.editing = isEditing ? 'true' : 'false';
|
|
92476
|
-
contentOverlay.style.pointerEvents = 'none';
|
|
92787
|
+
contentOverlay.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92477
92788
|
contentOverlay.querySelectorAll('iframe').forEach(function(iframe) {
|
|
92478
|
-
|
|
92479
|
-
iframe.
|
|
92789
|
+
var isActiveIframe = isEditing || (activeInteraction == null ? void 0 : activeInteraction.element) === iframe;
|
|
92790
|
+
iframe.style.pointerEvents = isActiveIframe ? 'auto' : 'none';
|
|
92791
|
+
iframe.tabIndex = isActiveIframe ? 0 : -1;
|
|
92480
92792
|
});
|
|
92481
|
-
this.syncShellInteraction(id, contentOverlay,
|
|
92793
|
+
this.syncShellInteraction(id, contentOverlay, isInteractive);
|
|
92794
|
+
this.syncContentInteractionZones(id, contentOverlay, activeInteraction == null ? void 0 : activeInteraction.element, isEditing, isInteractive);
|
|
92482
92795
|
}
|
|
92483
92796
|
if (contentMount) {
|
|
92484
92797
|
contentMount.dataset.editing = isEditing ? 'true' : 'false';
|
|
92485
|
-
contentMount.style.pointerEvents =
|
|
92486
|
-
contentMount.inert = !
|
|
92487
|
-
if (
|
|
92798
|
+
contentMount.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92799
|
+
contentMount.inert = !isInteractive;
|
|
92800
|
+
if (isInteractive) {
|
|
92488
92801
|
contentMount.removeAttribute('aria-hidden');
|
|
92489
92802
|
} else {
|
|
92490
92803
|
contentMount.setAttribute('aria-hidden', 'true');
|
|
92491
92804
|
}
|
|
92492
92805
|
}
|
|
92493
92806
|
};
|
|
92494
|
-
_proto.
|
|
92807
|
+
_proto.syncContentInteractionZones = function syncContentInteractionZones(id, contentOverlay, activeElement, isEditing, isInteractive) {
|
|
92808
|
+
var _this = this;
|
|
92809
|
+
contentOverlay.querySelectorAll(this.getContentInteractiveSelector(id)).forEach(function(element) {
|
|
92810
|
+
if (!isInteractive || _this.isContentInteractionDisabled(element)) {
|
|
92811
|
+
element.dataset.vvfxHtmlInteractionActive = 'false';
|
|
92812
|
+
element.style.pointerEvents = 'none';
|
|
92813
|
+
return;
|
|
92814
|
+
}
|
|
92815
|
+
var isElementInteractive = isEditing || activeElement === element;
|
|
92816
|
+
element.dataset.vvfxHtmlInteractionActive = isElementInteractive ? 'true' : 'false';
|
|
92817
|
+
element.style.pointerEvents = isElementInteractive ? 'auto' : 'none';
|
|
92818
|
+
});
|
|
92819
|
+
};
|
|
92820
|
+
_proto.syncShellInteraction = function syncShellInteraction(id, contentOverlay, isInteractive) {
|
|
92495
92821
|
var isHoveringShellInteractive = this.state.hoverShellInteractiveId === id;
|
|
92496
|
-
var isShellInteractiveActive =
|
|
92822
|
+
var isShellInteractiveActive = isInteractive || isHoveringShellInteractive;
|
|
92497
92823
|
contentOverlay.querySelectorAll(SHELL_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92498
92824
|
element.dataset.vvfxHtmlShellInteractiveHover = isHoveringShellInteractive ? 'true' : 'false';
|
|
92499
92825
|
element.dataset.vvfxHtmlShellInteractiveActive = isShellInteractiveActive ? 'true' : 'false';
|
|
92500
92826
|
element.style.pointerEvents = isShellInteractiveActive ? 'auto' : 'none';
|
|
92501
92827
|
});
|
|
92502
92828
|
contentOverlay.querySelectorAll(EDITING_INTERACTIVE_SELECTOR).forEach(function(element) {
|
|
92503
|
-
element.style.pointerEvents =
|
|
92829
|
+
element.style.pointerEvents = isInteractive ? 'auto' : 'none';
|
|
92504
92830
|
});
|
|
92505
92831
|
};
|
|
92506
92832
|
_proto.enterEditing = function enterEditing(id) {
|
|
@@ -92508,6 +92834,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92508
92834
|
if (((_this_state_editing = this.state.editing) == null ? void 0 : _this_state_editing.id) === id) {
|
|
92509
92835
|
return;
|
|
92510
92836
|
}
|
|
92837
|
+
if (!this.isEditableCard(id)) {
|
|
92838
|
+
return;
|
|
92839
|
+
}
|
|
92511
92840
|
var box = this.options.getViewBoxById(id);
|
|
92512
92841
|
if (box.isEmpty()) {
|
|
92513
92842
|
return;
|
|
@@ -92551,6 +92880,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92551
92880
|
this.options.setViewport(editing.restoreViewport);
|
|
92552
92881
|
this.scheduleRender();
|
|
92553
92882
|
};
|
|
92883
|
+
_proto.isEditableCard = function isEditableCard(id) {
|
|
92884
|
+
var _this_options_resolveCardTypeConfig;
|
|
92885
|
+
var item = this.options.getItems().find(function(item) {
|
|
92886
|
+
return item.id === id;
|
|
92887
|
+
});
|
|
92888
|
+
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.editable) !== false;
|
|
92889
|
+
};
|
|
92554
92890
|
_proto.getEditingFitZoom = function getEditingFitZoom(box, currentZoom) {
|
|
92555
92891
|
var viewportElement = this.options.container.parentElement;
|
|
92556
92892
|
if (!viewportElement) {
|
|
@@ -92575,6 +92911,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92575
92911
|
};
|
|
92576
92912
|
_proto.renderOverlayHTML = function renderOverlayHTML(id, overlay, html) {
|
|
92577
92913
|
this.cleanupOverlayContent(id);
|
|
92914
|
+
this.invalidateContentInteractionZones(id);
|
|
92578
92915
|
overlay.innerHTML = '';
|
|
92579
92916
|
var shell = mountHTMLShell(overlay, html.content, html.shell);
|
|
92580
92917
|
var autoHeightMeasureElement = shell.contentContainer.isConnected ? shell.contentContainer : overlay;
|
|
@@ -92586,12 +92923,72 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92586
92923
|
id: id,
|
|
92587
92924
|
autoHeight: this.isAutoHeightEnabled(item)
|
|
92588
92925
|
});
|
|
92926
|
+
this.observeContentInteractionZones(id, shell.contentContainer);
|
|
92589
92927
|
this.state.cleanups.set(id, function() {
|
|
92590
92928
|
contentCleanup == null ? void 0 : contentCleanup();
|
|
92591
92929
|
shell.cleanup == null ? void 0 : shell.cleanup.call(shell);
|
|
92592
92930
|
});
|
|
92593
92931
|
this.state.contents.set(id, html);
|
|
92594
92932
|
};
|
|
92933
|
+
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
92934
|
+
var _this = this;
|
|
92935
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92936
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
92937
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92938
|
+
if (typeof MutationObserver !== 'function') {
|
|
92939
|
+
return;
|
|
92940
|
+
}
|
|
92941
|
+
var observer = new MutationObserver(function() {
|
|
92942
|
+
_this.invalidateContentInteractionZones(id);
|
|
92943
|
+
});
|
|
92944
|
+
observer.observe(contentContainer, {
|
|
92945
|
+
attributes: true,
|
|
92946
|
+
childList: true,
|
|
92947
|
+
subtree: true
|
|
92948
|
+
});
|
|
92949
|
+
this.state.contentInteractionZoneCleanups.set(id, function() {
|
|
92950
|
+
observer.disconnect();
|
|
92951
|
+
});
|
|
92952
|
+
};
|
|
92953
|
+
_proto.applyHTMLRootConfig = function applyHTMLRootConfig(root, html) {
|
|
92954
|
+
var _ref, _config_style;
|
|
92955
|
+
var _this_htmlRootConfigCleanups_get, _config_className;
|
|
92956
|
+
(_this_htmlRootConfigCleanups_get = this.htmlRootConfigCleanups.get(root)) == null ? void 0 : _this_htmlRootConfigCleanups_get();
|
|
92957
|
+
this.htmlRootConfigCleanups.delete(root);
|
|
92958
|
+
var config = html.root;
|
|
92959
|
+
if (!config) {
|
|
92960
|
+
return;
|
|
92961
|
+
}
|
|
92962
|
+
var classNames = (_ref = (_config_className = config.className) == null ? void 0 : _config_className.split(/\s+/).filter(Boolean)) != null ? _ref : [];
|
|
92963
|
+
var styleProperties = [];
|
|
92964
|
+
classNames.forEach(function(className) {
|
|
92965
|
+
root.classList.add(className);
|
|
92966
|
+
});
|
|
92967
|
+
Object.entries((_config_style = config.style) != null ? _config_style : {}).forEach(function(param) {
|
|
92968
|
+
var property = param[0], value = param[1];
|
|
92969
|
+
if (value === undefined) {
|
|
92970
|
+
return;
|
|
92971
|
+
}
|
|
92972
|
+
styleProperties.push(property);
|
|
92973
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92974
|
+
root.style.setProperty(property, String(value));
|
|
92975
|
+
return;
|
|
92976
|
+
}
|
|
92977
|
+
root.style[property] = String(value);
|
|
92978
|
+
});
|
|
92979
|
+
this.htmlRootConfigCleanups.set(root, function() {
|
|
92980
|
+
classNames.forEach(function(className) {
|
|
92981
|
+
root.classList.remove(className);
|
|
92982
|
+
});
|
|
92983
|
+
styleProperties.forEach(function(property) {
|
|
92984
|
+
if (property.startsWith('--') || property.includes('-')) {
|
|
92985
|
+
root.style.removeProperty(property);
|
|
92986
|
+
return;
|
|
92987
|
+
}
|
|
92988
|
+
root.style[property] = '';
|
|
92989
|
+
});
|
|
92990
|
+
});
|
|
92991
|
+
};
|
|
92595
92992
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
92596
92993
|
var _this = this;
|
|
92597
92994
|
switch(content.kind){
|
|
@@ -92657,6 +93054,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92657
93054
|
};
|
|
92658
93055
|
};
|
|
92659
93056
|
_proto.cleanupOverlayContent = function cleanupOverlayContent(id) {
|
|
93057
|
+
var _this_state_contentInteractionZoneCleanups_get;
|
|
92660
93058
|
var cleanup = this.state.cleanups.get(id);
|
|
92661
93059
|
if (cleanup) {
|
|
92662
93060
|
cleanup();
|
|
@@ -92665,13 +93063,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92665
93063
|
this.state.contents.delete(id);
|
|
92666
93064
|
this.state.contentMountElements.delete(id);
|
|
92667
93065
|
this.state.autoHeightModes.delete(id);
|
|
93066
|
+
this.invalidateContentInteractionZones(id);
|
|
93067
|
+
(_this_state_contentInteractionZoneCleanups_get = this.state.contentInteractionZoneCleanups.get(id)) == null ? void 0 : _this_state_contentInteractionZoneCleanups_get();
|
|
93068
|
+
this.state.contentInteractionZoneCleanups.delete(id);
|
|
92668
93069
|
this.cleanupAutoHeight(id);
|
|
92669
93070
|
};
|
|
92670
93071
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
92671
|
-
var _this_state_elements_get;
|
|
93072
|
+
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
92672
93073
|
this.cleanupOverlayContent(id);
|
|
92673
93074
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
93075
|
+
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
92674
93076
|
this.state.elements.delete(id);
|
|
93077
|
+
this.state.selectionElements.delete(id);
|
|
92675
93078
|
this.state.contentScaleElements.delete(id);
|
|
92676
93079
|
this.state.contentElements.delete(id);
|
|
92677
93080
|
};
|
|
@@ -92904,6 +93307,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92904
93307
|
}
|
|
92905
93308
|
return ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoScale) !== false;
|
|
92906
93309
|
};
|
|
93310
|
+
_create_class(HTMLOverlayManager, [
|
|
93311
|
+
{
|
|
93312
|
+
key: "layerElement",
|
|
93313
|
+
get: function get() {
|
|
93314
|
+
return this.state.layer;
|
|
93315
|
+
}
|
|
93316
|
+
}
|
|
93317
|
+
]);
|
|
92907
93318
|
return HTMLOverlayManager;
|
|
92908
93319
|
}();
|
|
92909
93320
|
function waitForCardCaptureReady(root) {
|
|
@@ -92945,6 +93356,17 @@ function waitForCardCaptureReady(root) {
|
|
|
92945
93356
|
});
|
|
92946
93357
|
})();
|
|
92947
93358
|
}
|
|
93359
|
+
function formatCssColor(color, alpha) {
|
|
93360
|
+
var normalizedColor = Math.max(0, Math.min(0xFFFFFF, Math.round(color)));
|
|
93361
|
+
var red = normalizedColor >> 16 & 0xFF;
|
|
93362
|
+
var green = normalizedColor >> 8 & 0xFF;
|
|
93363
|
+
var blue = normalizedColor & 0xFF;
|
|
93364
|
+
return "rgba(" + red + ", " + green + ", " + blue + ", " + formatCssNumber(alpha) + ")";
|
|
93365
|
+
}
|
|
93366
|
+
function formatCssNumber(value) {
|
|
93367
|
+
var normalized = Number.isFinite(value) ? value : 0;
|
|
93368
|
+
return Number(normalized.toFixed(6)).toString();
|
|
93369
|
+
}
|
|
92948
93370
|
function nextAnimationFrame() {
|
|
92949
93371
|
return new Promise(function(resolve) {
|
|
92950
93372
|
requestAnimationFrame(function() {
|
|
@@ -93363,6 +93785,9 @@ function createFlattenedContent(target, frameStyle, ownerDocument) {
|
|
|
93363
93785
|
});
|
|
93364
93786
|
return replacement;
|
|
93365
93787
|
}
|
|
93788
|
+
function isMouseEventInsideRect(event, rect) {
|
|
93789
|
+
return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
|
|
93790
|
+
}
|
|
93366
93791
|
function createFlattenedIframeContent(iframe) {
|
|
93367
93792
|
var doc = iframe.contentDocument;
|
|
93368
93793
|
if (!doc) {
|
|
@@ -93402,6 +93827,19 @@ function withTimeout(promise, timeout) {
|
|
|
93402
93827
|
});
|
|
93403
93828
|
}
|
|
93404
93829
|
|
|
93830
|
+
function orderSDKCanvasLayers(param) {
|
|
93831
|
+
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
93832
|
+
[
|
|
93833
|
+
playerContainer,
|
|
93834
|
+
htmlOverlayLayer,
|
|
93835
|
+
gestureCanvas
|
|
93836
|
+
].forEach(function(layer) {
|
|
93837
|
+
if ((layer == null ? void 0 : layer.parentElement) === container) {
|
|
93838
|
+
container.appendChild(layer);
|
|
93839
|
+
}
|
|
93840
|
+
});
|
|
93841
|
+
}
|
|
93842
|
+
|
|
93405
93843
|
var HTML_CARD_EDITING_VIEWPORT_PADDING = 48;
|
|
93406
93844
|
var SDK = /*#__PURE__*/ function() {
|
|
93407
93845
|
function SDK(container, mode) {
|
|
@@ -93508,6 +93946,35 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93508
93946
|
propertyValue: height
|
|
93509
93947
|
});
|
|
93510
93948
|
},
|
|
93949
|
+
getSelectedItemIds: function getSelectedItemIds() {
|
|
93950
|
+
var _ref;
|
|
93951
|
+
var _this__pageData;
|
|
93952
|
+
return (_ref = (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.selectedItems) != null ? _ref : [];
|
|
93953
|
+
},
|
|
93954
|
+
getPreSelectedItemId: function getPreSelectedItemId() {
|
|
93955
|
+
var _this__pageData;
|
|
93956
|
+
return (_this__pageData = _this._pageData) == null ? void 0 : _this__pageData.activeData.preSelectedItem;
|
|
93957
|
+
},
|
|
93958
|
+
getSelectionEdgeStyle: function getSelectionEdgeStyle() {
|
|
93959
|
+
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;
|
|
93960
|
+
return {
|
|
93961
|
+
color: wireframeColor,
|
|
93962
|
+
alpha: wireframeAlpha,
|
|
93963
|
+
width: wireframeWidth
|
|
93964
|
+
};
|
|
93965
|
+
},
|
|
93966
|
+
getPreSelectionEdgeStyle: function getPreSelectionEdgeStyle() {
|
|
93967
|
+
var _SDK_config_gestureHandlerConfig_selectorGizmoConfig = SDK.config.gestureHandlerConfig.selectorGizmoConfig, preSelectedColor = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedColor, preSelectedWidth = _SDK_config_gestureHandlerConfig_selectorGizmoConfig.preSelectedWidth;
|
|
93968
|
+
return {
|
|
93969
|
+
color: preSelectedColor,
|
|
93970
|
+
alpha: 1,
|
|
93971
|
+
width: preSelectedWidth
|
|
93972
|
+
};
|
|
93973
|
+
},
|
|
93974
|
+
getCanvasEventTarget: function getCanvasEventTarget() {
|
|
93975
|
+
var _this__gestureHandler;
|
|
93976
|
+
return (_this__gestureHandler = _this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view;
|
|
93977
|
+
},
|
|
93511
93978
|
resolveCardHTML: function resolveCardHTML(item) {
|
|
93512
93979
|
return isCardItem(item) ? _this.resolveCardHTML(item) : undefined;
|
|
93513
93980
|
},
|
|
@@ -93516,6 +93983,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93516
93983
|
}
|
|
93517
93984
|
});
|
|
93518
93985
|
this._htmlOverlayManager.attach();
|
|
93986
|
+
this.syncCanvasLayerOrder();
|
|
93519
93987
|
}
|
|
93520
93988
|
var _proto = SDK.prototype;
|
|
93521
93989
|
_proto.dispose = function dispose() {
|
|
@@ -93611,6 +94079,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93611
94079
|
this.initPlayer(SDK.config.mode);
|
|
93612
94080
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
93613
94081
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94082
|
+
this.syncCanvasLayerOrder();
|
|
93614
94083
|
return [
|
|
93615
94084
|
4,
|
|
93616
94085
|
this.runByPageData(this.pageData)
|
|
@@ -93660,6 +94129,16 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93660
94129
|
env: 'editor'
|
|
93661
94130
|
});
|
|
93662
94131
|
this.player.resize();
|
|
94132
|
+
this.syncCanvasLayerOrder();
|
|
94133
|
+
};
|
|
94134
|
+
_proto.syncCanvasLayerOrder = function syncCanvasLayerOrder() {
|
|
94135
|
+
var _this__htmlOverlayManager, _this__gestureHandler;
|
|
94136
|
+
orderSDKCanvasLayers({
|
|
94137
|
+
container: this._container,
|
|
94138
|
+
playerContainer: this._playerContainer,
|
|
94139
|
+
htmlOverlayLayer: (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.layerElement,
|
|
94140
|
+
gestureCanvas: (_this__gestureHandler = this._gestureHandler) == null ? void 0 : _this__gestureHandler.wireframeApplication.view
|
|
94141
|
+
});
|
|
93663
94142
|
};
|
|
93664
94143
|
_proto.getInitParam = function getInitParam(param) {
|
|
93665
94144
|
return _async_to_generator(function() {
|
|
@@ -94754,8 +95233,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94754
95233
|
* @param ignoreClamp 是否忽视约束
|
|
94755
95234
|
*/ _proto.setPageZoom = function setPageZoom(zoom, center, ignoreClamp) {
|
|
94756
95235
|
EFFECTS.assertExist(this._pageData);
|
|
94757
|
-
this.
|
|
94758
|
-
this._pageDataUtils.setPageZoom(this._pageData.property.zoom, center, ignoreClamp);
|
|
95236
|
+
this._pageDataUtils.setPageZoom(zoom, center, ignoreClamp);
|
|
94759
95237
|
this._gestureHandler.render();
|
|
94760
95238
|
};
|
|
94761
95239
|
/**
|