@vvfx/sdk 0.2.2-beta.13 → 0.2.2-beta.16
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 +0 -5
- package/dist/html-overlay/manager.d.ts +2 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +50 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -177
- package/dist/index.mjs.map +1 -1
- package/dist/sdk.d.ts +0 -24
- package/dist/types.d.ts +0 -48
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { CardHTML } from './types';
|
|
|
4
4
|
import type { CardItem } from './sdk-item/card-item';
|
|
5
5
|
export type SDKMode = 'editor' | 'template';
|
|
6
6
|
export type CardTypeHTMLResolver = (item: CardItem) => CardHTML | undefined;
|
|
7
|
-
export type CardAutoHeightAnchor = 'top' | 'center';
|
|
8
7
|
/**
|
|
9
8
|
* @description SDK功能配置
|
|
10
9
|
*/
|
|
@@ -148,10 +147,6 @@ export type CardTypeConfig = {
|
|
|
148
147
|
* @description 是否根据 HTML 挂载内容的自然高度自动更新卡片高度
|
|
149
148
|
*/
|
|
150
149
|
autoHeight?: boolean;
|
|
151
|
-
/**
|
|
152
|
-
* @description autoHeight 更新卡片高度时的锚点。top 保持上边缘不动,center 保持中心点不动。未配置时默认 top。
|
|
153
|
-
*/
|
|
154
|
-
autoHeightAnchor?: CardAutoHeightAnchor;
|
|
155
150
|
/**
|
|
156
151
|
* @description HTML 内容是否跟随卡片 scale 缩放,关闭后 HTML 按最终显示尺寸重新布局
|
|
157
152
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Box2 } from '../math';
|
|
2
2
|
import { type SnapdomOptions } from '@zumer/snapdom';
|
|
3
|
-
import type {
|
|
3
|
+
import type { CardTypeConfig } from '../config';
|
|
4
4
|
import type { EventEmitter } from '../shared';
|
|
5
5
|
import type { SDKEvents } from '../sdk';
|
|
6
6
|
import { type SDKItem } from '../sdk-item';
|
|
@@ -11,10 +11,6 @@ type CardRasterizeOptions = {
|
|
|
11
11
|
pixelRatio?: number;
|
|
12
12
|
snapdomOptions?: SnapdomOptions;
|
|
13
13
|
};
|
|
14
|
-
type SetCardItemHeightOptions = {
|
|
15
|
-
anchor: CardAutoHeightAnchor;
|
|
16
|
-
previousHeight: number;
|
|
17
|
-
};
|
|
18
14
|
type HTMLOverlayManagerOptions = {
|
|
19
15
|
container: HTMLElement;
|
|
20
16
|
emitter: EventEmitter<SDKEvents>;
|
|
@@ -29,7 +25,7 @@ type HTMLOverlayManagerOptions = {
|
|
|
29
25
|
translation: [number, number];
|
|
30
26
|
}) => void;
|
|
31
27
|
viewportFit: (box: Box2) => void;
|
|
32
|
-
setCardItemHeight: (id: string, height: number
|
|
28
|
+
setCardItemHeight: (id: string, height: number) => void;
|
|
33
29
|
getSelectedItemIds: () => string[];
|
|
34
30
|
getPreSelectedItemId: () => string | undefined;
|
|
35
31
|
getSelectionEdgeStyle: () => {
|
|
@@ -59,9 +55,6 @@ export declare class HTMLOverlayManager {
|
|
|
59
55
|
dispose(): void;
|
|
60
56
|
scheduleRender(): void;
|
|
61
57
|
invalidateCardHTML(id: string): void;
|
|
62
|
-
getHtmlCardWindow(id: string): Window | null | undefined;
|
|
63
|
-
patchCardHTML(id: string, patch: unknown): boolean;
|
|
64
|
-
dispatchHtmlCardEvent(id: string, type: string, detail?: unknown): boolean;
|
|
65
58
|
rasterizeCard(id: string, options: CardRasterizeOptions): Promise<string | undefined>;
|
|
66
59
|
private initEvents;
|
|
67
60
|
private initDOMEvents;
|
|
@@ -113,10 +106,8 @@ export declare class HTMLOverlayManager {
|
|
|
113
106
|
private getEditingFitZoom;
|
|
114
107
|
private isEventInsideOverlay;
|
|
115
108
|
private renderOverlayHTML;
|
|
116
|
-
private createPatchContext;
|
|
117
109
|
private observeContentInteractionZones;
|
|
118
110
|
private applyHTMLRootConfig;
|
|
119
|
-
private makeSelectionOverlayTransparent;
|
|
120
111
|
private renderOverlayContent;
|
|
121
112
|
private chainCleanups;
|
|
122
113
|
private cleanupOverlayContent;
|
|
@@ -131,7 +122,6 @@ export declare class HTMLOverlayManager {
|
|
|
131
122
|
private getChildrenNaturalHeight;
|
|
132
123
|
private cleanupAutoHeight;
|
|
133
124
|
private applyAutoHeight;
|
|
134
|
-
private getAutoHeightAnchor;
|
|
135
125
|
private getAutoHeightItemHeight;
|
|
136
126
|
private isAutoHeightMessage;
|
|
137
127
|
private isAutoHeightEnabled;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { SDKOptions, SDKInputParam, PageData, PageProperty, ViewProperty, ActiveData, ViewParam, BaseItemProperty, SpriteItemProperty, TextItemProperty, VideoItemProperty, GeneratorItemProperty, FrameItemProperty, FrameLayoutMode, SpriteCreateInfo, TextCreateInfo, GroupCreateInfo, VideoCreateInfo, GeneratorCreateInfo, EffectsCreateInfo, FrameCreateInfo, CardCreateInfo, CardItemProperty, CardItemTransformInfo, CardHTML, CardHTMLContent, CardHTMLInlineContent, CardHTMLDOMRendererContent, CardHTMLDocumentContent, CardHTMLDocumentMessage, CardHTMLShellContent, CardHTMLShellRenderer, CardHTMLShellRendererContext, CardHTMLShellRendererResult, CardHTMLDOMRenderer, CardHTMLContentCleanup, CardHTMLRenderCleanup,
|
|
2
|
-
export type { SDKConfig, SDKMode, CardTypeConfig, CardConfig,
|
|
1
|
+
export type { SDKOptions, SDKInputParam, PageData, PageProperty, ViewProperty, ActiveData, ViewParam, BaseItemProperty, SpriteItemProperty, TextItemProperty, VideoItemProperty, GeneratorItemProperty, FrameItemProperty, FrameLayoutMode, SpriteCreateInfo, TextCreateInfo, GroupCreateInfo, VideoCreateInfo, GeneratorCreateInfo, EffectsCreateInfo, FrameCreateInfo, CardCreateInfo, CardItemProperty, CardItemTransformInfo, CardHTML, CardHTMLContent, CardHTMLInlineContent, CardHTMLDOMRendererContent, CardHTMLDocumentContent, CardHTMLDocumentMessage, CardHTMLShellContent, CardHTMLShellRenderer, CardHTMLShellRendererContext, CardHTMLShellRendererResult, CardHTMLDOMRenderer, CardHTMLContentCleanup, CardHTMLRenderCleanup, CardHTMLRootConfig, CardHTMLRootStyle, ItemCreateInfo, } from './types';
|
|
2
|
+
export type { SDKConfig, SDKMode, CardTypeConfig, CardConfig, CardTypeHTMLResolver, } from './config';
|
|
3
3
|
export type { SDKItem } from './sdk-item';
|
|
4
4
|
export { BaseItem, SpriteItem, TextItem, VideoItem, GroupItem, GeneratorItem, EffectsItem, FrameItem, CardItem, isBaseItem, isSpriteItem, isTextItem, isVideoItem, isGroupItem, isGeneratorItem, isEffectsItem, isFrameItem, isCardItem, SDKItemType, } from './sdk-item';
|
|
5
5
|
export type { SDKItemOptions, SpriteItemOptions, TextItemOptions, VideoItemOptions, GroupItemOptions, GeneratorItemOptions, EffectsItemOptions, FrameItemOptions, CardItemOptions, } from './sdk-item';
|
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.16
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as EFFECTS from '@galacean/effects';
|
|
@@ -60414,6 +60414,8 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60414
60414
|
}
|
|
60415
60415
|
}
|
|
60416
60416
|
var isLocked = (_this_getSDKItem = this.getSDKItem(playerItem.getInstanceId())) == null ? void 0 : _this_getSDKItem.isLocked;
|
|
60417
|
+
// 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
|
|
60418
|
+
var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
|
|
60417
60419
|
// 创建基础选项
|
|
60418
60420
|
var baseOptions = {
|
|
60419
60421
|
id: playerItem.getInstanceId(),
|
|
@@ -60425,12 +60427,11 @@ var PageDataUtils = /*#__PURE__*/ function() {
|
|
|
60425
60427
|
endBehavior: playerItem.endBehavior,
|
|
60426
60428
|
visible: isVisible,
|
|
60427
60429
|
isLocked: isLocked,
|
|
60428
|
-
isCoreEditable: isCoreEditable
|
|
60430
|
+
isCoreEditable: isCoreEditable,
|
|
60431
|
+
extension: existingSDKItem == null ? void 0 : existingSDKItem.extension
|
|
60429
60432
|
};
|
|
60430
60433
|
// 根据类型创建对应的 SDKItem 类实例
|
|
60431
60434
|
var sdkItem;
|
|
60432
|
-
// 优先通过 ID 查找现有 SDKItem,获取其 SDKItemType
|
|
60433
|
-
var existingSDKItem = this.getSDKItem(playerItem.getInstanceId());
|
|
60434
60435
|
// 如果找到了现有 SDKItem,根据 SDKItemType 创建
|
|
60435
60436
|
// 将类型转换为 string 进行比较
|
|
60436
60437
|
if ((existingSDKItem == null ? void 0 : existingSDKItem.type) === SDKItemType.GENERATOR) {
|
|
@@ -91867,30 +91868,6 @@ var EDITING_VIEWPORT_PADDING = 48;
|
|
|
91867
91868
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
91868
91869
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
91869
91870
|
var CARD_RASTERIZE_READY_TIMEOUT = 3000;
|
|
91870
|
-
var CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
91871
|
-
var requestHTMLOverlayFrame = function requestHTMLOverlayFrame(callback) {
|
|
91872
|
-
if (typeof requestAnimationFrame === 'function') {
|
|
91873
|
-
try {
|
|
91874
|
-
return requestAnimationFrame(callback);
|
|
91875
|
-
} catch (unused) {
|
|
91876
|
-
// Some non-browser test runtimes install a RAF polyfill that depends on window.
|
|
91877
|
-
}
|
|
91878
|
-
}
|
|
91879
|
-
return setTimeout(function() {
|
|
91880
|
-
callback(Date.now());
|
|
91881
|
-
}, 16);
|
|
91882
|
-
};
|
|
91883
|
-
var cancelHTMLOverlayFrame = function cancelHTMLOverlayFrame(frame) {
|
|
91884
|
-
if (typeof cancelAnimationFrame === 'function') {
|
|
91885
|
-
try {
|
|
91886
|
-
cancelAnimationFrame(frame);
|
|
91887
|
-
return;
|
|
91888
|
-
} catch (unused) {
|
|
91889
|
-
// Fall back to clearTimeout for frames created by requestHTMLOverlayFrame.
|
|
91890
|
-
}
|
|
91891
|
-
}
|
|
91892
|
-
clearTimeout(frame);
|
|
91893
|
-
};
|
|
91894
91871
|
var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
91895
91872
|
function HTMLOverlayManager(options) {
|
|
91896
91873
|
var _this = this;
|
|
@@ -91963,7 +91940,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
91963
91940
|
return;
|
|
91964
91941
|
}
|
|
91965
91942
|
if (_this.contentInteractionFrame !== undefined) {
|
|
91966
|
-
|
|
91943
|
+
cancelAnimationFrame(_this.contentInteractionFrame);
|
|
91967
91944
|
_this.contentInteractionFrame = undefined;
|
|
91968
91945
|
}
|
|
91969
91946
|
_this.pendingContentInteractionEvent = undefined;
|
|
@@ -92024,11 +92001,11 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92024
92001
|
_proto.dispose = function dispose() {
|
|
92025
92002
|
var _this_state_layer;
|
|
92026
92003
|
if (this.state.updateFrame !== undefined) {
|
|
92027
|
-
|
|
92004
|
+
cancelAnimationFrame(this.state.updateFrame);
|
|
92028
92005
|
this.state.updateFrame = undefined;
|
|
92029
92006
|
}
|
|
92030
92007
|
if (this.contentInteractionFrame !== undefined) {
|
|
92031
|
-
|
|
92008
|
+
cancelAnimationFrame(this.contentInteractionFrame);
|
|
92032
92009
|
this.contentInteractionFrame = undefined;
|
|
92033
92010
|
}
|
|
92034
92011
|
this.pendingContentInteractionEvent = undefined;
|
|
@@ -92058,7 +92035,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92058
92035
|
});
|
|
92059
92036
|
this.state.autoHeightCleanups.clear();
|
|
92060
92037
|
this.state.autoHeightFrames.forEach(function(frame) {
|
|
92061
|
-
|
|
92038
|
+
cancelAnimationFrame(frame);
|
|
92062
92039
|
});
|
|
92063
92040
|
this.state.autoHeightFrames.clear();
|
|
92064
92041
|
this.eventCleanups.forEach(function(cleanup) {
|
|
@@ -92077,9 +92054,9 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92077
92054
|
_proto.scheduleRender = function scheduleRender() {
|
|
92078
92055
|
var _this = this;
|
|
92079
92056
|
if (this.state.updateFrame !== undefined) {
|
|
92080
|
-
|
|
92057
|
+
cancelAnimationFrame(this.state.updateFrame);
|
|
92081
92058
|
}
|
|
92082
|
-
this.state.updateFrame =
|
|
92059
|
+
this.state.updateFrame = requestAnimationFrame(function() {
|
|
92083
92060
|
_this.state.updateFrame = undefined;
|
|
92084
92061
|
_this.render();
|
|
92085
92062
|
});
|
|
@@ -92088,40 +92065,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92088
92065
|
this.cleanupOverlayContent(id);
|
|
92089
92066
|
this.invalidateContentInteractionZones(id);
|
|
92090
92067
|
};
|
|
92091
|
-
_proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
92092
|
-
var contentOverlay = this.state.contentElements.get(id);
|
|
92093
|
-
var iframe = contentOverlay == null ? void 0 : contentOverlay.querySelector('iframe');
|
|
92094
|
-
return iframe == null ? void 0 : iframe.contentWindow;
|
|
92095
|
-
};
|
|
92096
|
-
_proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
92097
|
-
var html = this.state.contents.get(id);
|
|
92098
|
-
if (!html) {
|
|
92099
|
-
return false;
|
|
92100
|
-
}
|
|
92101
|
-
var patchHandler = html.content.patch;
|
|
92102
|
-
if (!patchHandler) {
|
|
92103
|
-
return false;
|
|
92104
|
-
}
|
|
92105
|
-
var context = this.createPatchContext(id, html);
|
|
92106
|
-
return patchHandler(patch, context) !== false;
|
|
92107
|
-
};
|
|
92108
|
-
_proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
92109
|
-
var targetWindow = this.getHtmlCardWindow(id);
|
|
92110
|
-
try {
|
|
92111
|
-
if (!targetWindow || typeof targetWindow.postMessage !== 'function') {
|
|
92112
|
-
return false;
|
|
92113
|
-
}
|
|
92114
|
-
targetWindow.postMessage({
|
|
92115
|
-
detail: detail,
|
|
92116
|
-
payload: detail,
|
|
92117
|
-
source: CARD_HTML_EVENT_MESSAGE_SOURCE,
|
|
92118
|
-
type: type
|
|
92119
|
-
}, '*');
|
|
92120
|
-
return true;
|
|
92121
|
-
} catch (unused) {
|
|
92122
|
-
return false;
|
|
92123
|
-
}
|
|
92124
|
-
};
|
|
92125
92068
|
_proto.rasterizeCard = function rasterizeCard(id, options) {
|
|
92126
92069
|
return _async_to_generator(function() {
|
|
92127
92070
|
var contentOverlay, capture, _ref, _options_pixelRatio, image, error;
|
|
@@ -92129,7 +92072,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92129
92072
|
switch(_state.label){
|
|
92130
92073
|
case 0:
|
|
92131
92074
|
if (this.state.updateFrame !== undefined) {
|
|
92132
|
-
|
|
92075
|
+
cancelAnimationFrame(this.state.updateFrame);
|
|
92133
92076
|
this.state.updateFrame = undefined;
|
|
92134
92077
|
}
|
|
92135
92078
|
this.render();
|
|
@@ -92296,10 +92239,13 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92296
92239
|
var overlay = _this.getOrCreateOverlay(item.id, parentOverlay, elements);
|
|
92297
92240
|
var contentOverlay = _this.getOrCreateContentOverlay(item.id, overlay);
|
|
92298
92241
|
var selectionOverlay = _this.getOrCreateSelectionOverlay(item.id, selectionLayer);
|
|
92242
|
+
if (!_this.state.contents.has(item.id)) {
|
|
92243
|
+
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92244
|
+
}
|
|
92245
|
+
_this.applyHTMLRootConfig(overlay, html);
|
|
92299
92246
|
var offsetX = frameBox && !frameBox.isEmpty() ? frameBox.min.x : 0;
|
|
92300
92247
|
var offsetY = frameBox && !frameBox.isEmpty() ? frameBox.min.y : 0;
|
|
92301
92248
|
var boxStyle = getCardOverlayBoxStyle(itemBox, item.property.width, item.property.height, offsetX, offsetY, _this.isAutoScaleEnabled(item));
|
|
92302
|
-
_this.applyHTMLRootConfig(overlay, html);
|
|
92303
92249
|
overlay.style.left = boxStyle.left;
|
|
92304
92250
|
overlay.style.top = boxStyle.top;
|
|
92305
92251
|
overlay.style.width = boxStyle.width;
|
|
@@ -92314,12 +92260,8 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92314
92260
|
selectionOverlay.style.transform = selectionBoxStyle.transform;
|
|
92315
92261
|
selectionOverlay.style.transformOrigin = '0 0';
|
|
92316
92262
|
_this.applyHTMLRootConfig(selectionOverlay, html);
|
|
92317
|
-
_this.makeSelectionOverlayTransparent(selectionOverlay);
|
|
92318
92263
|
_this.syncOverlaySelection(item.id, overlay, selectionOverlay);
|
|
92319
92264
|
_this.syncContentScale(item.id, boxStyle.contentWidth, boxStyle.contentHeight);
|
|
92320
|
-
if (!_this.state.contents.has(item.id)) {
|
|
92321
|
-
_this.renderOverlayHTML(item.id, contentOverlay, html);
|
|
92322
|
-
}
|
|
92323
92265
|
_this.syncAutoHeight(item.id, _this.isAutoHeightEnabled(item));
|
|
92324
92266
|
_this.syncContentInteraction(item.id);
|
|
92325
92267
|
});
|
|
@@ -92559,20 +92501,14 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92559
92501
|
if (this.contentInteractionFrame !== undefined) {
|
|
92560
92502
|
return;
|
|
92561
92503
|
}
|
|
92562
|
-
|
|
92563
|
-
|
|
92564
|
-
|
|
92565
|
-
|
|
92566
|
-
|
|
92567
|
-
|
|
92568
|
-
|
|
92569
|
-
|
|
92570
|
-
});
|
|
92571
|
-
} catch (unused) {
|
|
92572
|
-
this.contentInteractionFrame = undefined;
|
|
92573
|
-
this.pendingContentInteractionEvent = undefined;
|
|
92574
|
-
this.syncActiveContentInteraction(event);
|
|
92575
|
-
}
|
|
92504
|
+
this.contentInteractionFrame = requestAnimationFrame(function() {
|
|
92505
|
+
_this.contentInteractionFrame = undefined;
|
|
92506
|
+
var pendingEvent = _this.pendingContentInteractionEvent;
|
|
92507
|
+
_this.pendingContentInteractionEvent = undefined;
|
|
92508
|
+
if (pendingEvent) {
|
|
92509
|
+
_this.syncActiveContentInteraction(pendingEvent);
|
|
92510
|
+
}
|
|
92511
|
+
});
|
|
92576
92512
|
};
|
|
92577
92513
|
_proto.setActiveContentInteraction = function setActiveContentInteraction(zone) {
|
|
92578
92514
|
var _this = this;
|
|
@@ -92996,20 +92932,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
92996
92932
|
});
|
|
92997
92933
|
this.state.contents.set(id, html);
|
|
92998
92934
|
};
|
|
92999
|
-
_proto.createPatchContext = function createPatchContext(id, html) {
|
|
93000
|
-
var _this = this;
|
|
93001
|
-
return {
|
|
93002
|
-
id: id,
|
|
93003
|
-
html: html,
|
|
93004
|
-
content: html.content,
|
|
93005
|
-
container: this.state.contentMountElements.get(id),
|
|
93006
|
-
contentWindow: this.getHtmlCardWindow(id),
|
|
93007
|
-
refresh: function refresh() {
|
|
93008
|
-
_this.invalidateCardHTML(id);
|
|
93009
|
-
_this.scheduleRender();
|
|
93010
|
-
}
|
|
93011
|
-
};
|
|
93012
|
-
};
|
|
93013
92935
|
_proto.observeContentInteractionZones = function observeContentInteractionZones(id, contentContainer) {
|
|
93014
92936
|
var _this = this;
|
|
93015
92937
|
var _this_state_contentInteractionZoneCleanups_get;
|
|
@@ -93069,10 +92991,6 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93069
92991
|
});
|
|
93070
92992
|
});
|
|
93071
92993
|
};
|
|
93072
|
-
_proto.makeSelectionOverlayTransparent = function makeSelectionOverlayTransparent(selectionOverlay) {
|
|
93073
|
-
selectionOverlay.style.background = 'transparent';
|
|
93074
|
-
selectionOverlay.style.backgroundColor = 'transparent';
|
|
93075
|
-
};
|
|
93076
92994
|
_proto.renderOverlayContent = function renderOverlayContent(overlay, content, options) {
|
|
93077
92995
|
var _this = this;
|
|
93078
92996
|
switch(content.kind){
|
|
@@ -93265,7 +93183,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93265
93183
|
if (this.state.autoHeightFrames.has(id)) {
|
|
93266
93184
|
return;
|
|
93267
93185
|
}
|
|
93268
|
-
var frame =
|
|
93186
|
+
var frame = requestAnimationFrame(function() {
|
|
93269
93187
|
_this.state.autoHeightFrames.delete(id);
|
|
93270
93188
|
_this.measureAutoHeight(id);
|
|
93271
93189
|
});
|
|
@@ -93349,7 +93267,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93349
93267
|
}
|
|
93350
93268
|
var frame = this.state.autoHeightFrames.get(id);
|
|
93351
93269
|
if (frame !== undefined) {
|
|
93352
|
-
|
|
93270
|
+
cancelAnimationFrame(frame);
|
|
93353
93271
|
this.state.autoHeightFrames.delete(id);
|
|
93354
93272
|
}
|
|
93355
93273
|
};
|
|
@@ -93367,18 +93285,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
93367
93285
|
if (Math.abs(nextHeight - item.property.height) <= AUTO_HEIGHT_EPSILON) {
|
|
93368
93286
|
return;
|
|
93369
93287
|
}
|
|
93370
|
-
this.options.setCardItemHeight(id, nextHeight
|
|
93371
|
-
anchor: this.getAutoHeightAnchor(item),
|
|
93372
|
-
previousHeight: item.property.height
|
|
93373
|
-
});
|
|
93374
|
-
};
|
|
93375
|
-
_proto.getAutoHeightAnchor = function getAutoHeightAnchor(item) {
|
|
93376
|
-
var _ref;
|
|
93377
|
-
var _this_options_resolveCardTypeConfig;
|
|
93378
|
-
if (!isCardItem(item)) {
|
|
93379
|
-
return 'top';
|
|
93380
|
-
}
|
|
93381
|
-
return (_ref = (_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeightAnchor) != null ? _ref : 'top';
|
|
93288
|
+
this.options.setCardItemHeight(id, nextHeight);
|
|
93382
93289
|
};
|
|
93383
93290
|
_proto.getAutoHeightItemHeight = function getAutoHeightItemHeight(item, contentHeight) {
|
|
93384
93291
|
if (!isCardItem(item) || this.isAutoScaleEnabled(item)) {
|
|
@@ -93464,7 +93371,7 @@ function formatCssNumber(value) {
|
|
|
93464
93371
|
}
|
|
93465
93372
|
function nextAnimationFrame() {
|
|
93466
93373
|
return new Promise(function(resolve) {
|
|
93467
|
-
|
|
93374
|
+
requestAnimationFrame(function() {
|
|
93468
93375
|
resolve();
|
|
93469
93376
|
});
|
|
93470
93377
|
});
|
|
@@ -94033,29 +93940,12 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94033
93940
|
bottom: HTML_CARD_EDITING_VIEWPORT_PADDING
|
|
94034
93941
|
}, box);
|
|
94035
93942
|
},
|
|
94036
|
-
setCardItemHeight: function setCardItemHeight(id, height
|
|
94037
|
-
var item = _this.getSDKItem(id);
|
|
94038
|
-
if (!isCardItem(item) || options.anchor === 'center') {
|
|
94039
|
-
void _this.setItemProperty({
|
|
94040
|
-
itemId: id,
|
|
94041
|
-
type: SDKItemType.CARD,
|
|
94042
|
-
propertyName: 'height',
|
|
94043
|
-
propertyValue: height
|
|
94044
|
-
});
|
|
94045
|
-
return;
|
|
94046
|
-
}
|
|
94047
|
-
var _item_property_position = item.property.position, x = _item_property_position[0], y = _item_property_position[1];
|
|
94048
|
-
var deltaY = (height - options.previousHeight) / 2;
|
|
93943
|
+
setCardItemHeight: function setCardItemHeight(id, height) {
|
|
94049
93944
|
void _this.setItemProperty({
|
|
94050
93945
|
itemId: id,
|
|
94051
93946
|
type: SDKItemType.CARD,
|
|
94052
|
-
|
|
94053
|
-
|
|
94054
|
-
position: [
|
|
94055
|
-
x,
|
|
94056
|
-
y + deltaY
|
|
94057
|
-
]
|
|
94058
|
-
}
|
|
93947
|
+
propertyName: 'height',
|
|
93948
|
+
propertyValue: height
|
|
94059
93949
|
});
|
|
94060
93950
|
},
|
|
94061
93951
|
getSelectedItemIds: function getSelectedItemIds() {
|
|
@@ -94115,18 +94005,22 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94115
94005
|
_proto.initPlayer = function initPlayer(mode) {
|
|
94116
94006
|
var _this = this;
|
|
94117
94007
|
var playerContainer = document.createElement('div');
|
|
94118
|
-
var _ref = mode === '
|
|
94119
|
-
this._container.clientWidth,
|
|
94120
|
-
this._container.clientHeight
|
|
94121
|
-
] : [
|
|
94008
|
+
var _ref = mode === 'template' ? [
|
|
94122
94009
|
this._container.offsetWidth,
|
|
94123
94010
|
this._container.offsetHeight
|
|
94011
|
+
] : [
|
|
94012
|
+
document.documentElement.clientWidth,
|
|
94013
|
+
document.documentElement.clientHeight
|
|
94124
94014
|
], width = _ref[0], height = _ref[1];
|
|
94125
94015
|
this._playerContainer = playerContainer;
|
|
94126
94016
|
this._playerContainer.id = 'player-container';
|
|
94127
94017
|
this._playerContainer.style.position = 'absolute';
|
|
94128
94018
|
this._playerContainer.style.width = "" + width + "px";
|
|
94129
94019
|
this._playerContainer.style.height = "" + height + "px";
|
|
94020
|
+
if (mode === 'editor') {
|
|
94021
|
+
this._playerContainer.style.left = '0px';
|
|
94022
|
+
this._playerContainer.style.top = '0px';
|
|
94023
|
+
}
|
|
94130
94024
|
this._container.appendChild(playerContainer);
|
|
94131
94025
|
this.player = new Player({
|
|
94132
94026
|
container: this._playerContainer,
|
|
@@ -94185,6 +94079,7 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94185
94079
|
_this._gestureHandler.dispose();
|
|
94186
94080
|
setTimeout(function() {
|
|
94187
94081
|
return _async_to_generator(function() {
|
|
94082
|
+
var _this_pageData, _this_pageData1, itemExtension;
|
|
94188
94083
|
return _ts_generator(this, function(_state) {
|
|
94189
94084
|
switch(_state.label){
|
|
94190
94085
|
case 0:
|
|
@@ -94192,12 +94087,22 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
94192
94087
|
this._pageDataUtils = new PageDataUtils(this.player, this._playerContainer, this._eventEmitter, this);
|
|
94193
94088
|
this._gestureHandler = new GestureHandler(this._container);
|
|
94194
94089
|
this.syncCanvasLayerOrder();
|
|
94090
|
+
itemExtension = {};
|
|
94091
|
+
(_this_pageData = this.pageData) == null ? void 0 : _this_pageData.items.forEach(function(item) {
|
|
94092
|
+
itemExtension[item.id] = item.getAllExtension();
|
|
94093
|
+
});
|
|
94195
94094
|
return [
|
|
94196
94095
|
4,
|
|
94197
94096
|
this.runByPageData(this.pageData)
|
|
94198
94097
|
];
|
|
94199
94098
|
case 1:
|
|
94200
94099
|
_state.sent();
|
|
94100
|
+
(_this_pageData1 = this.pageData) == null ? void 0 : _this_pageData1.items.forEach(function(item) {
|
|
94101
|
+
var extension = itemExtension[item.id];
|
|
94102
|
+
if (extension) {
|
|
94103
|
+
item.setExtensions(extension);
|
|
94104
|
+
}
|
|
94105
|
+
});
|
|
94201
94106
|
this._eventEmitter.emit('viewRebuildFinish');
|
|
94202
94107
|
return [
|
|
94203
94108
|
2
|
|
@@ -96279,38 +96184,6 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
96279
96184
|
return true;
|
|
96280
96185
|
};
|
|
96281
96186
|
/**
|
|
96282
|
-
* @description 获取指定 HTML 卡片当前 iframe 的 window。
|
|
96283
|
-
* @description 仅 inline/document 或自行渲染 iframe 的 DOM 内容会返回 window。
|
|
96284
|
-
* @param id 卡片元素 ID
|
|
96285
|
-
* @returns HTML iframe window
|
|
96286
|
-
*/ _proto.getHtmlCardWindow = function getHtmlCardWindow(id) {
|
|
96287
|
-
var _this__htmlOverlayManager;
|
|
96288
|
-
return (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.getHtmlCardWindow(id);
|
|
96289
|
-
};
|
|
96290
|
-
/**
|
|
96291
|
-
* @description 向指定 HTML 卡片发送增量 patch。
|
|
96292
|
-
* @description 当卡片内容配置了 CardHTMLPatchHandler 时,可用于局部更新 HTML,而不必整卡 refresh。
|
|
96293
|
-
* @param id 卡片元素 ID
|
|
96294
|
-
* @param patch patch 负载,由卡片内容自己的 patch handler 解释
|
|
96295
|
-
* @returns 是否被 patch handler 处理
|
|
96296
|
-
*/ _proto.patchCardHTML = function patchCardHTML(id, patch) {
|
|
96297
|
-
var _ref;
|
|
96298
|
-
var _this__htmlOverlayManager;
|
|
96299
|
-
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.patchCardHTML(id, patch)) != null ? _ref : false;
|
|
96300
|
-
};
|
|
96301
|
-
/**
|
|
96302
|
-
* @description 向指定 HTML 卡片 iframe 派发事件。
|
|
96303
|
-
* @description 通过 postMessage 投递事件,跨源/同源行为一致,消息 source 为 vvfx-card-html-event。
|
|
96304
|
-
* @param id 卡片元素 ID
|
|
96305
|
-
* @param type 事件名称
|
|
96306
|
-
* @param detail 事件 detail
|
|
96307
|
-
* @returns 是否成功派发或投递
|
|
96308
|
-
*/ _proto.dispatchHtmlCardEvent = function dispatchHtmlCardEvent(id, type, detail) {
|
|
96309
|
-
var _ref;
|
|
96310
|
-
var _this__htmlOverlayManager;
|
|
96311
|
-
return (_ref = (_this__htmlOverlayManager = this._htmlOverlayManager) == null ? void 0 : _this__htmlOverlayManager.dispatchHtmlCardEvent(id, type, detail)) != null ? _ref : false;
|
|
96312
|
-
};
|
|
96313
|
-
/**
|
|
96314
96187
|
* @description 创建卡片元素
|
|
96315
96188
|
* @description 底层以透明 SpriteItem 形式渲染,支持 cardType 属性
|
|
96316
96189
|
* @param createInfo 卡片创建信息
|