@vvfx/sdk 0.2.2-beta.16 → 0.2.2-beta.17
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 +5 -0
- package/dist/html-overlay/anchor-navigation-runtime.d.ts +1 -0
- package/dist/html-overlay/manager.d.ts +12 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +258 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +258 -31
- package/dist/index.mjs.map +1 -1
- package/dist/sdk.d.ts +25 -0
- package/dist/types.d.ts +60 -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.17
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -91710,6 +91710,17 @@ function withCardHTMLViewportStyle(html) {
|
|
|
91710
91710
|
return "<!doctype html><html><head>" + viewportStyle + "</head><body>" + html + "</body></html>";
|
|
91711
91711
|
}
|
|
91712
91712
|
|
|
91713
|
+
function withCardHTMLAnchorNavigationGuard(html, allowAnchorNavigation) {
|
|
91714
|
+
if (allowAnchorNavigation === true) {
|
|
91715
|
+
return html;
|
|
91716
|
+
}
|
|
91717
|
+
var script = "\n<script data-vvfx-card-html-anchor-navigation-guard>\n(() => {\n document.addEventListener('click', event => {\n const target = event.target;\n if (!(target instanceof Element)) {\n return;\n }\n\n const anchor = target.closest('a[href]');\n if (!anchor) {\n return;\n }\n\n event.preventDefault();\n }, true);\n})();\n</script>";
|
|
91718
|
+
if (/<\/body>/i.test(html)) {
|
|
91719
|
+
return html.replace(/<\/body>/i, "" + script + "</body>");
|
|
91720
|
+
}
|
|
91721
|
+
return "" + html + script;
|
|
91722
|
+
}
|
|
91723
|
+
|
|
91713
91724
|
function renderDocumentContent(overlay, content, options) {
|
|
91714
91725
|
var _files_get;
|
|
91715
91726
|
var iframe = document.createElement('iframe');
|
|
@@ -91728,7 +91739,7 @@ function renderDocumentContent(overlay, content, options) {
|
|
|
91728
91739
|
iframe.setAttribute('sandbox', content.sandbox);
|
|
91729
91740
|
}
|
|
91730
91741
|
var entryHtml = (_files_get = files.get(entry)) != null ? _files_get : '';
|
|
91731
|
-
iframe.srcdoc = withCardHTMLAutoHeightBridge(withCardHTMLViewportStyle(transformHTMLDocument(entry, entryHtml, createFileUrl)), options == null ? void 0 : options.autoHeightId);
|
|
91742
|
+
iframe.srcdoc = withCardHTMLAutoHeightBridge(withCardHTMLAnchorNavigationGuard(withCardHTMLViewportStyle(transformHTMLDocument(entry, entryHtml, createFileUrl)), content.allowAnchorNavigation), options == null ? void 0 : options.autoHeightId);
|
|
91732
91743
|
overlay.appendChild(iframe);
|
|
91733
91744
|
return function() {
|
|
91734
91745
|
messageCleanup();
|
|
@@ -91887,6 +91898,30 @@ var EDITING_VIEWPORT_PADDING = 48;
|
|
|
91887
91898
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91888
91899
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
91889
91900
|
var CARD_RASTERIZE_READY_TIMEOUT = 3000;
|
|
91901
|
+
var CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
91902
|
+
var requestHTMLOverlayFrame = function requestHTMLOverlayFrame(callback) {
|
|
91903
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
91904
|
+
try {
|
|
91905
|
+
return requestAnimationFrame(callback);
|
|
91906
|
+
} catch (unused) {
|
|
91907
|
+
// Some non-browser test runtimes install a RAF polyfill that depends on window.
|
|
91908
|
+
}
|
|
91909
|
+
}
|
|
91910
|
+
return setTimeout(function() {
|
|
91911
|
+
callback(Date.now());
|
|
91912
|
+
}, 16);
|
|
91913
|
+
};
|
|
91914
|
+
var cancelHTMLOverlayFrame = function cancelHTMLOverlayFrame(frame) {
|
|
91915
|
+
if (typeof cancelAnimationFrame === 'function') {
|
|
91916
|
+
try {
|
|
91917
|
+
cancelAnimationFrame(frame);
|
|
91918
|
+
return;
|
|
91919
|
+
} catch (unused) {
|
|
91920
|
+
// Fall back to clearTimeout for frames created by requestHTMLOverlayFrame.
|
|
91921
|
+
}
|
|
91922
|
+
}
|
|
91923
|
+
clearTimeout(frame);
|
|
91924
|
+
};
|
|
91890
91925
|
var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
91891
91926
|
function HTMLOverlayManager(options) {
|
|
91892
91927
|
var _this = this;
|
|
@@ -91959,7 +91994,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91959
91994
|
return;
|
|
91960
91995
|
}
|
|
91961
91996
|
if (_this.contentInteractionFrame !== undefined) {
|
|
91962
|
-
|
|
91997
|
+
cancelHTMLOverlayFrame(_this.contentInteractionFrame);
|
|
91963
91998
|
_this.contentInteractionFrame = undefined;
|
|
91964
91999
|
}
|
|
91965
92000
|
_this.pendingContentInteractionEvent = undefined;
|
|
@@ -92020,11 +92055,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92020
92055
|
_proto.dispose = function dispose() {
|
|
92021
92056
|
var _this_state_layer;
|
|
92022
92057
|
if (this.state.updateFrame !== undefined) {
|
|
92023
|
-
|
|
92058
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92024
92059
|
this.state.updateFrame = undefined;
|
|
92025
92060
|
}
|
|
92026
92061
|
if (this.contentInteractionFrame !== undefined) {
|
|
92027
|
-
|
|
92062
|
+
cancelHTMLOverlayFrame(this.contentInteractionFrame);
|
|
92028
92063
|
this.contentInteractionFrame = undefined;
|
|
92029
92064
|
}
|
|
92030
92065
|
this.pendingContentInteractionEvent = undefined;
|
|
@@ -92054,7 +92089,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92054
92089
|
});
|
|
92055
92090
|
this.state.autoHeightCleanups.clear();
|
|
92056
92091
|
this.state.autoHeightFrames.forEach(function(frame) {
|
|
92057
|
-
|
|
92092
|
+
cancelHTMLOverlayFrame(frame);
|
|
92058
92093
|
});
|
|
92059
92094
|
this.state.autoHeightFrames.clear();
|
|
92060
92095
|
this.eventCleanups.forEach(function(cleanup) {
|
|
@@ -92073,9 +92108,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92073
92108
|
_proto.scheduleRender = function scheduleRender() {
|
|
92074
92109
|
var _this = this;
|
|
92075
92110
|
if (this.state.updateFrame !== undefined) {
|
|
92076
|
-
|
|
92111
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92077
92112
|
}
|
|
92078
|
-
this.state.updateFrame =
|
|
92113
|
+
this.state.updateFrame = requestHTMLOverlayFrame(function() {
|
|
92079
92114
|
_this.state.updateFrame = undefined;
|
|
92080
92115
|
_this.render();
|
|
92081
92116
|
});
|
|
@@ -92084,6 +92119,40 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92084
92119
|
this.cleanupOverlayContent(id);
|
|
92085
92120
|
this.invalidateContentInteractionZones(id);
|
|
92086
92121
|
};
|
|
92122
|
+
_proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
92123
|
+
var contentOverlay = this.state.contentElements.get(id);
|
|
92124
|
+
var iframe = contentOverlay == null ? void 0 : contentOverlay.querySelector('iframe');
|
|
92125
|
+
return iframe == null ? void 0 : iframe.contentWindow;
|
|
92126
|
+
};
|
|
92127
|
+
_proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
92128
|
+
var html = this.state.contents.get(id);
|
|
92129
|
+
if (!html) {
|
|
92130
|
+
return false;
|
|
92131
|
+
}
|
|
92132
|
+
var patchHandler = html.content.patch;
|
|
92133
|
+
if (!patchHandler) {
|
|
92134
|
+
return false;
|
|
92135
|
+
}
|
|
92136
|
+
var context = this.createPatchContext(id, html);
|
|
92137
|
+
return patchHandler(patch, context) !== false;
|
|
92138
|
+
};
|
|
92139
|
+
_proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
92140
|
+
var targetWindow = this.getHtmlCardWindow(id);
|
|
92141
|
+
try {
|
|
92142
|
+
if (!targetWindow || typeof targetWindow.postMessage !== 'function') {
|
|
92143
|
+
return false;
|
|
92144
|
+
}
|
|
92145
|
+
targetWindow.postMessage({
|
|
92146
|
+
detail: detail,
|
|
92147
|
+
payload: detail,
|
|
92148
|
+
source: CARD_HTML_EVENT_MESSAGE_SOURCE,
|
|
92149
|
+
type: type
|
|
92150
|
+
}, '*');
|
|
92151
|
+
return true;
|
|
92152
|
+
} catch (unused) {
|
|
92153
|
+
return false;
|
|
92154
|
+
}
|
|
92155
|
+
};
|
|
92087
92156
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92088
92157
|
return _async_to_generator(function() {
|
|
92089
92158
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92091,7 +92160,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92091
92160
|
switch(_state.label){
|
|
92092
92161
|
case 0:
|
|
92093
92162
|
if (this.state.updateFrame !== undefined) {
|
|
92094
|
-
|
|
92163
|
+
cancelHTMLOverlayFrame(this.state.updateFrame);
|
|
92095
92164
|
this.state.updateFrame = undefined;
|
|
92096
92165
|
}
|
|
92097
92166
|
this.render();
|
|
@@ -92258,13 +92327,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92258
92327
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92259
92328
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92260
92329
|
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92261
|
-
if (!_this.state.contents.has(item.id)) {
|
|
92262
|
-
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92263
|
-
}
|
|
92264
|
-
_this.applyHTMLRootConfig(overlay, html);
|
|
92265
92330
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92266
92331
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92267
92332
|
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
92333
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92268
92334
|
overlay.style.left = boxStyle.left;
|
|
92269
92335
|
overlay.style.top = boxStyle.top;
|
|
92270
92336
|
overlay.style.width = boxStyle.width;
|
|
@@ -92279,8 +92345,12 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92279
92345
|
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92280
92346
|
selectionOverlay.style.transformOrigin = '0 0';
|
|
92281
92347
|
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92348
|
+
_this.makeSelectionOverlayTransparent(selectionOverlay);
|
|
92282
92349
|
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92283
92350
|
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92351
|
+
if (!_this.state.contents.has(item.id)) {
|
|
92352
|
+
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92353
|
+
}
|
|
92284
92354
|
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92285
92355
|
_this.syncContentInteraction(item.id);
|
|
92286
92356
|
});
|
|
@@ -92520,14 +92590,20 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92520
92590
|
if (this.contentInteractionFrame !== undefined) {
|
|
92521
92591
|
return;
|
|
92522
92592
|
}
|
|
92523
|
-
|
|
92524
|
-
|
|
92525
|
-
|
|
92526
|
-
|
|
92527
|
-
|
|
92528
|
-
|
|
92529
|
-
|
|
92530
|
-
|
|
92593
|
+
try {
|
|
92594
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92595
|
+
_this.contentInteractionFrame = undefined;
|
|
92596
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92597
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92598
|
+
if (pendingEvent) {
|
|
92599
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92600
|
+
}
|
|
92601
|
+
});
|
|
92602
|
+
} catch (unused) {
|
|
92603
|
+
this.contentInteractionFrame = undefined;
|
|
92604
|
+
this.pendingContentInteractionEvent = undefined;
|
|
92605
|
+
this.syncActiveContentInteraction(event);
|
|
92606
|
+
}
|
|
92531
92607
|
};
|
|
92532
92608
|
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92533
92609
|
var _this = this;
|
|
@@ -92951,6 +93027,20 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92951
93027
|
});
|
|
92952
93028
|
this.state.contents.set(id, html);
|
|
92953
93029
|
};
|
|
93030
|
+
_proto.createPatchContext = function createPatchContext(id, html) {
|
|
93031
|
+
var _this = this;
|
|
93032
|
+
return {
|
|
93033
|
+
id: id,
|
|
93034
|
+
html: html,
|
|
93035
|
+
content: html.content,
|
|
93036
|
+
container: this.state.contentMountElements.get(id),
|
|
93037
|
+
contentWindow: this.getHtmlCardWindow(id),
|
|
93038
|
+
refresh: function refresh() {
|
|
93039
|
+
_this.invalidateCardHTML(id);
|
|
93040
|
+
_this.scheduleRender();
|
|
93041
|
+
}
|
|
93042
|
+
};
|
|
93043
|
+
};
|
|
92954
93044
|
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
92955
93045
|
var _this = this;
|
|
92956
93046
|
var _this_state_contentInteractionZoneCleanups_get;
|
|
@@ -93010,6 +93100,10 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93010
93100
|
});
|
|
93011
93101
|
});
|
|
93012
93102
|
};
|
|
93103
|
+
_proto.makeSelectionOverlayTransparent = function makeSelectionOverlayTransparent(selectionOverlay) {
|
|
93104
|
+
selectionOverlay.style.background = 'transparent';
|
|
93105
|
+
selectionOverlay.style.backgroundColor = 'transparent';
|
|
93106
|
+
};
|
|
93013
93107
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
93014
93108
|
var _this = this;
|
|
93015
93109
|
switch(content.kind){
|
|
@@ -93024,7 +93118,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93024
93118
|
entry: 'index.html',
|
|
93025
93119
|
files: {
|
|
93026
93120
|
'index.html': content.html
|
|
93027
|
-
}
|
|
93121
|
+
},
|
|
93122
|
+
allowAnchorNavigation: content.allowAnchorNavigation,
|
|
93123
|
+
sandbox: content.sandbox
|
|
93028
93124
|
}, {
|
|
93029
93125
|
autoHeightId: (options == null ? void 0 : options.autoHeight) ? options.id : undefined,
|
|
93030
93126
|
onAutoHeight: (options == null ? void 0 : options.autoHeight) ? function(height) {
|
|
@@ -93202,7 +93298,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93202
93298
|
if (this.state.autoHeightFrames.has(id)) {
|
|
93203
93299
|
return;
|
|
93204
93300
|
}
|
|
93205
|
-
var frame =
|
|
93301
|
+
var frame = requestHTMLOverlayFrame(function() {
|
|
93206
93302
|
_this.state.autoHeightFrames.delete(id);
|
|
93207
93303
|
_this.measureAutoHeight(id);
|
|
93208
93304
|
});
|
|
@@ -93286,7 +93382,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93286
93382
|
}
|
|
93287
93383
|
var frame = this.state.autoHeightFrames.get(id);
|
|
93288
93384
|
if (frame !== undefined) {
|
|
93289
|
-
|
|
93385
|
+
cancelHTMLOverlayFrame(frame);
|
|
93290
93386
|
this.state.autoHeightFrames.delete(id);
|
|
93291
93387
|
}
|
|
93292
93388
|
};
|
|
@@ -93304,7 +93400,18 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93304
93400
|
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93305
93401
|
return;
|
|
93306
93402
|
}
|
|
93307
|
-
this.options.setCardItemHeight(id, nextHeight
|
|
93403
|
+
this.options.setCardItemHeight(id, nextHeight, {
|
|
93404
|
+
anchor: this.getAutoHeightAnchor(item),
|
|
93405
|
+
previousHeight: item.property.height
|
|
93406
|
+
});
|
|
93407
|
+
};
|
|
93408
|
+
_proto.getAutoHeightAnchor = function getAutoHeightAnchor(item) {
|
|
93409
|
+
var _ref;
|
|
93410
|
+
var _this_options_resolveCardTypeConfig;
|
|
93411
|
+
if (!isCardItem(item)) {
|
|
93412
|
+
return 'top';
|
|
93413
|
+
}
|
|
93414
|
+
return (_ref = (_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeightAnchor) != null ? _ref : 'top';
|
|
93308
93415
|
};
|
|
93309
93416
|
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
93310
93417
|
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
@@ -93390,7 +93497,7 @@ function formatCssNumber(value) {
|
|
|
93390
93497
|
}
|
|
93391
93498
|
function nextAnimationFrame() {
|
|
93392
93499
|
return new Promise(function(resolve) {
|
|
93393
|
-
|
|
93500
|
+
requestHTMLOverlayFrame(function() {
|
|
93394
93501
|
resolve();
|
|
93395
93502
|
});
|
|
93396
93503
|
});
|
|
@@ -93959,12 +94066,29 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
93959
94066
|
bottom: HTML_CARD_EDITING_VIEWPORT_PADDING
|
|
93960
94067
|
}, box);
|
|
93961
94068
|
},
|
|
93962
|
-
setCardItemHeight: function setCardItemHeight(id, height) {
|
|
94069
|
+
setCardItemHeight: function setCardItemHeight(id, height, options) {
|
|
94070
|
+
var item = _this.getSDKItem(id);
|
|
94071
|
+
if (!isCardItem(item) || options.anchor === 'center') {
|
|
94072
|
+
void _this.setItemProperty({
|
|
94073
|
+
itemId: id,
|
|
94074
|
+
type: SDKItemType.CARD,
|
|
94075
|
+
propertyName: 'height',
|
|
94076
|
+
propertyValue: height
|
|
94077
|
+
});
|
|
94078
|
+
return;
|
|
94079
|
+
}
|
|
94080
|
+
var _item_property_position = item.property.position, x = _item_property_position[0], y = _item_property_position[1];
|
|
94081
|
+
var deltaY = (height - options.previousHeight) / 2;
|
|
93963
94082
|
void _this.setItemProperty({
|
|
93964
94083
|
itemId: id,
|
|
93965
94084
|
type: SDKItemType.CARD,
|
|
93966
|
-
|
|
93967
|
-
|
|
94085
|
+
property: {
|
|
94086
|
+
height: height,
|
|
94087
|
+
position: [
|
|
94088
|
+
x,
|
|
94089
|
+
y + deltaY
|
|
94090
|
+
]
|
|
94091
|
+
}
|
|
93968
94092
|
});
|
|
93969
94093
|
},
|
|
93970
94094
|
getSelectedItemIds: function getSelectedItemIds() {
|
|
@@ -94098,7 +94222,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94098
94222
|
_this._gestureHandler.dispose();
|
|
94099
94223
|
setTimeout(function() {
|
|
94100
94224
|
return _async_to_generator(function() {
|
|
94101
|
-
var _this_pageData, _this_pageData1,
|
|
94225
|
+
var itemExtension, _this_pageData, _this_pageData1, createInfos;
|
|
94102
94226
|
return _ts_generator(this, function(_state) {
|
|
94103
94227
|
switch(_state.label){
|
|
94104
94228
|
case 0:
|
|
@@ -94107,6 +94231,10 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94107
94231
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94108
94232
|
this.syncCanvasLayerOrder();
|
|
94109
94233
|
itemExtension = {};
|
|
94234
|
+
if (!(SDK.config.mode === 'template')) return [
|
|
94235
|
+
3,
|
|
94236
|
+
2
|
|
94237
|
+
];
|
|
94110
94238
|
(_this_pageData = this.pageData) == null ? void 0 : _this_pageData.items.forEach(function(item) {
|
|
94111
94239
|
itemExtension[item.id] = item.getAllExtension();
|
|
94112
94240
|
});
|
|
@@ -94122,6 +94250,20 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94122
94250
|
item.setExtensions(extension);
|
|
94123
94251
|
}
|
|
94124
94252
|
});
|
|
94253
|
+
return [
|
|
94254
|
+
3,
|
|
94255
|
+
4
|
|
94256
|
+
];
|
|
94257
|
+
case 2:
|
|
94258
|
+
createInfos = this.getItemCreateInfos();
|
|
94259
|
+
return [
|
|
94260
|
+
4,
|
|
94261
|
+
this.runByCreateInfos(createInfos)
|
|
94262
|
+
];
|
|
94263
|
+
case 3:
|
|
94264
|
+
_state.sent();
|
|
94265
|
+
_state.label = 4;
|
|
94266
|
+
case 4:
|
|
94125
94267
|
this._eventEmitter.emit('viewRebuildFinish');
|
|
94126
94268
|
return [
|
|
94127
94269
|
2
|
|
@@ -94971,6 +95113,55 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94971
95113
|
});
|
|
94972
95114
|
}).call(this);
|
|
94973
95115
|
};
|
|
95116
|
+
_proto.runByCreateInfos = function runByCreateInfos(createInfos) {
|
|
95117
|
+
return _async_to_generator(function() {
|
|
95118
|
+
var _this__pageData_activeData_view, _this__pageData_activeData_view1, viewSize, scene, targetViewProperty;
|
|
95119
|
+
return _ts_generator(this, function(_state) {
|
|
95120
|
+
switch(_state.label){
|
|
95121
|
+
case 0:
|
|
95122
|
+
EFFECTS.assertExist(this._pageData, 'You must call SDK#run() first');
|
|
95123
|
+
this._pageData.property.zoom = 1;
|
|
95124
|
+
this._pageData.property.translation = [
|
|
95125
|
+
0,
|
|
95126
|
+
0
|
|
95127
|
+
];
|
|
95128
|
+
this._pageDataUtils.init();
|
|
95129
|
+
return [
|
|
95130
|
+
4,
|
|
95131
|
+
this._gestureHandler.init(this._pageDataUtils, this._eventEmitter)
|
|
95132
|
+
];
|
|
95133
|
+
case 1:
|
|
95134
|
+
_state.sent();
|
|
95135
|
+
viewSize = [
|
|
95136
|
+
this._playerContainer.offsetWidth,
|
|
95137
|
+
this._playerContainer.offsetHeight
|
|
95138
|
+
];
|
|
95139
|
+
scene = getBasicScene(viewSize);
|
|
95140
|
+
targetViewProperty = this.getViewProperty((_this__pageData_activeData_view = this._pageData.activeData.view) != null ? _this__pageData_activeData_view : 0);
|
|
95141
|
+
if (targetViewProperty) {
|
|
95142
|
+
targetViewProperty.scene = scene;
|
|
95143
|
+
}
|
|
95144
|
+
return [
|
|
95145
|
+
4,
|
|
95146
|
+
this._pageDataUtils.loadScene((_this__pageData_activeData_view1 = this._pageData.activeData.view) != null ? _this__pageData_activeData_view1 : 0)
|
|
95147
|
+
];
|
|
95148
|
+
case 2:
|
|
95149
|
+
_state.sent();
|
|
95150
|
+
return [
|
|
95151
|
+
4,
|
|
95152
|
+
this.addItemByCreateInfos(createInfos)
|
|
95153
|
+
];
|
|
95154
|
+
case 3:
|
|
95155
|
+
_state.sent();
|
|
95156
|
+
this._pageDataUtils.refreshPageTime(this._pageData.time);
|
|
95157
|
+
this._eventEmitter.emit('pageDataChange', this.pageData);
|
|
95158
|
+
return [
|
|
95159
|
+
2
|
|
95160
|
+
];
|
|
95161
|
+
}
|
|
95162
|
+
});
|
|
95163
|
+
}).call(this);
|
|
95164
|
+
};
|
|
94974
95165
|
_proto.reloadPageDataByScene = function reloadPageDataByScene(scene) {
|
|
94975
95166
|
return _async_to_generator(function() {
|
|
94976
95167
|
var _ref, _this__pageData_activeData_view, _ref1, _ref2, _loadScene_compositions_find, _this_player_getCompositions_, _this_player_getCompositions_1, loadScene, response, error;
|
|
@@ -95665,7 +95856,11 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
95665
95856
|
return item.id;
|
|
95666
95857
|
})) != null ? _ref : [];
|
|
95667
95858
|
ids.forEach(function(id) {
|
|
95668
|
-
var
|
|
95859
|
+
var _this__pageDataUtils_getItemCreateInfo;
|
|
95860
|
+
var _this_pageData_items_find, _this_pageData;
|
|
95861
|
+
var createInfo = (_this__pageDataUtils_getItemCreateInfo = _this._pageDataUtils.getItemCreateInfo(id, true)) != null ? _this__pageDataUtils_getItemCreateInfo : (_this_pageData = _this.pageData) == null ? void 0 : (_this_pageData_items_find = _this_pageData.items.find(function(item) {
|
|
95862
|
+
return item.id === id;
|
|
95863
|
+
})) == null ? void 0 : _this_pageData_items_find.toCreateInfo(true);
|
|
95669
95864
|
if (createInfo) {
|
|
95670
95865
|
createInfos.push(createInfo);
|
|
95671
95866
|
}
|
|
@@ -96203,6 +96398,38 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96203
96398
|
return true;
|
|
96204
96399
|
};
|
|
96205
96400
|
/**
|
|
96401
|
+
* @description 获取指定 HTML 卡片当前 iframe 的 window。
|
|
96402
|
+
* @description 仅 inline/document 或自行渲染 iframe 的 DOM 内容会返回 window。
|
|
96403
|
+
* @param id 卡片元素 ID
|
|
96404
|
+
* @returns HTML iframe window
|
|
96405
|
+
*/ _proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
96406
|
+
var _this__htmlOverlayManager;
|
|
96407
|
+
return (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.getHtmlCardWindow(id);
|
|
96408
|
+
};
|
|
96409
|
+
/**
|
|
96410
|
+
* @description 向指定 HTML 卡片发送增量 patch。
|
|
96411
|
+
* @description 当卡片内容配置了 CardHTMLPatchHandler 时,可用于局部更新 HTML,而不必整卡 refresh。
|
|
96412
|
+
* @param id 卡片元素 ID
|
|
96413
|
+
* @param patch patch 负载,由卡片内容自己的 patch handler 解释
|
|
96414
|
+
* @returns 是否被 patch handler 处理
|
|
96415
|
+
*/ _proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
96416
|
+
var _ref;
|
|
96417
|
+
var _this__htmlOverlayManager;
|
|
96418
|
+
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.patchCardHTML(id, patch)) != null ? _ref : false;
|
|
96419
|
+
};
|
|
96420
|
+
/**
|
|
96421
|
+
* @description 向指定 HTML 卡片 iframe 派发事件。
|
|
96422
|
+
* @description 通过 postMessage 投递事件,跨源/同源行为一致,消息 source 为 vvfx-card-html-event。
|
|
96423
|
+
* @param id 卡片元素 ID
|
|
96424
|
+
* @param type 事件名称
|
|
96425
|
+
* @param detail 事件 detail
|
|
96426
|
+
* @returns 是否成功派发或投递
|
|
96427
|
+
*/ _proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
96428
|
+
var _ref;
|
|
96429
|
+
var _this__htmlOverlayManager;
|
|
96430
|
+
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.dispatchHtmlCardEvent(id, type, detail)) != null ? _ref : false;
|
|
96431
|
+
};
|
|
96432
|
+
/**
|
|
96206
96433
|
* @description 创建卡片元素
|
|
96207
96434
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
96208
96435
|
* @param createInfo 卡片创建信息
|