@vvfx/sdk 0.2.2-beta.9 → 0.2.2
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 +1 -24
- package/dist/html-overlay/auto-height-runtime.d.ts +0 -5
- package/dist/html-overlay/manager.d.ts +0 -53
- package/dist/html-overlay/overlay-transform.d.ts +1 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +357 -1037
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +357 -1037
- package/dist/index.mjs.map +1 -1
- package/dist/sdk-item/card-item.d.ts +6 -1
- package/dist/sdk-item/text-item.d.ts +2 -0
- package/dist/sdk.d.ts +2 -22
- package/dist/types.d.ts +18 -17
- package/dist/utils/page-data-utils.d.ts +0 -4
- package/package.json +11 -10
- package/dist/layer-order.d.ts +0 -7
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { ExportMediaInitOptions } from './exporter';
|
|
2
2
|
import { GlobalLayoutMode } from './utils';
|
|
3
|
-
import type { CardHTML } from './types';
|
|
4
|
-
import type { CardItem } from './sdk-item/card-item';
|
|
5
3
|
export type SDKMode = 'editor' | 'template';
|
|
6
|
-
export type CardTypeHTMLResolver = (item: CardItem) => CardHTML | undefined;
|
|
7
4
|
/**
|
|
8
5
|
* @description SDK功能配置
|
|
9
6
|
*/
|
|
@@ -139,26 +136,6 @@ export type CardTypeConfig = {
|
|
|
139
136
|
* @description TransformGizmo 左上角展示的 icon URL
|
|
140
137
|
*/
|
|
141
138
|
iconUrl: string;
|
|
142
|
-
/**
|
|
143
|
-
* @description 卡片类型对应的运行时 HTML 渲染配置;函数不会进入序列化数据,恢复时由 cardType 动态解析。
|
|
144
|
-
*/
|
|
145
|
-
html?: CardTypeHTMLResolver;
|
|
146
|
-
/**
|
|
147
|
-
* @description 是否根据 HTML 挂载内容的自然高度自动更新卡片高度
|
|
148
|
-
*/
|
|
149
|
-
autoHeight?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* @description HTML 内容是否跟随卡片 scale 缩放,关闭后 HTML 按最终显示尺寸重新布局
|
|
152
|
-
*/
|
|
153
|
-
autoScale?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* @description 是否启用编辑态交互。未配置时默认 true;只有显式 false 时,卡片默认直接交互且不进入编辑态。
|
|
156
|
-
*/
|
|
157
|
-
editable?: boolean;
|
|
158
|
-
/**
|
|
159
|
-
* @description HTML 内容中可在非编辑态直接响应事件的额外 CSS 选择器;会与 SDK 默认交互选择器合并。
|
|
160
|
-
*/
|
|
161
|
-
htmlInteractionSelectors?: string[];
|
|
162
139
|
};
|
|
163
140
|
/**
|
|
164
141
|
* @description 卡片元素参数配置
|
|
@@ -169,7 +146,7 @@ export type CardConfig = {
|
|
|
169
146
|
*/
|
|
170
147
|
backgroundColor: [number, number, number, number];
|
|
171
148
|
/**
|
|
172
|
-
* @description
|
|
149
|
+
* @description 注册的卡片类型列表,支持动态配置
|
|
173
150
|
* 每个条目包含 type 标识、显示名称和图标 URL
|
|
174
151
|
*/
|
|
175
152
|
cardTypes: CardTypeConfig[];
|
|
@@ -4,15 +4,10 @@ export type CardHTMLAutoHeightMessage = {
|
|
|
4
4
|
id: string;
|
|
5
5
|
height: number;
|
|
6
6
|
};
|
|
7
|
-
export type CardHTMLAutoHeightRequest = {
|
|
8
|
-
source: 'vvfx-card-html-auto-height-request';
|
|
9
|
-
id: string;
|
|
10
|
-
};
|
|
11
7
|
export type CardHTMLAutoHeightOptions = {
|
|
12
8
|
autoHeightId?: string;
|
|
13
9
|
onAutoHeight?: (height: number) => void;
|
|
14
10
|
};
|
|
15
11
|
export declare function createAutoHeightMessageListener(iframe: HTMLIFrameElement, options?: CardHTMLAutoHeightOptions): CardHTMLRenderCleanup;
|
|
16
12
|
export declare function isCardHTMLAutoHeightMessage(data: unknown, id: string): data is CardHTMLAutoHeightMessage;
|
|
17
|
-
export declare function requestCardHTMLAutoHeight(iframe: HTMLIFrameElement, id: string): void;
|
|
18
13
|
export declare function withCardHTMLAutoHeightBridge(html: string, id?: string): string;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { Box2 } from '../math';
|
|
2
2
|
import { type SnapdomOptions } from '@zumer/snapdom';
|
|
3
|
-
import type { CardTypeConfig } from '../config';
|
|
4
3
|
import type { EventEmitter } from '../shared';
|
|
5
4
|
import type { SDKEvents } from '../sdk';
|
|
6
5
|
import { type SDKItem } from '../sdk-item';
|
|
7
|
-
import type { CardHTML } from '../types';
|
|
8
6
|
type CardRasterizeOptions = {
|
|
9
7
|
width: number;
|
|
10
8
|
height: number;
|
|
@@ -26,35 +24,15 @@ type HTMLOverlayManagerOptions = {
|
|
|
26
24
|
}) => void;
|
|
27
25
|
viewportFit: (box: Box2) => void;
|
|
28
26
|
setCardItemHeight: (id: string, height: number) => void;
|
|
29
|
-
getSelectedItemIds: () => string[];
|
|
30
|
-
getPreSelectedItemId: () => string | undefined;
|
|
31
|
-
getSelectionEdgeStyle: () => {
|
|
32
|
-
color: number;
|
|
33
|
-
alpha: number;
|
|
34
|
-
width: number;
|
|
35
|
-
};
|
|
36
|
-
getPreSelectionEdgeStyle: () => {
|
|
37
|
-
color: number;
|
|
38
|
-
alpha: number;
|
|
39
|
-
width: number;
|
|
40
|
-
};
|
|
41
|
-
getCanvasEventTarget?: () => HTMLElement | undefined;
|
|
42
|
-
resolveCardHTML: (item: SDKItem) => CardHTML | undefined;
|
|
43
|
-
resolveCardTypeConfig: (item: SDKItem) => CardTypeConfig | undefined;
|
|
44
27
|
};
|
|
45
28
|
export declare class HTMLOverlayManager {
|
|
46
29
|
private options;
|
|
47
30
|
private eventCleanups;
|
|
48
|
-
private htmlRootConfigCleanups;
|
|
49
|
-
private pendingContentInteractionEvent?;
|
|
50
|
-
private contentInteractionFrame?;
|
|
51
31
|
private state;
|
|
52
32
|
constructor(options: HTMLOverlayManagerOptions);
|
|
53
33
|
attach(): void;
|
|
54
|
-
get layerElement(): HTMLElement | undefined;
|
|
55
34
|
dispose(): void;
|
|
56
35
|
scheduleRender(): void;
|
|
57
|
-
invalidateCardHTML(id: string): void;
|
|
58
36
|
rasterizeCard(id: string, options: CardRasterizeOptions): Promise<string | undefined>;
|
|
59
37
|
private initEvents;
|
|
60
38
|
private initDOMEvents;
|
|
@@ -62,58 +40,30 @@ export declare class HTMLOverlayManager {
|
|
|
62
40
|
private handleContainerMouseDown;
|
|
63
41
|
private handleContainerMouseMove;
|
|
64
42
|
private handleContainerMouseLeave;
|
|
65
|
-
private isMouseLeaveWithinContainer;
|
|
66
|
-
private handleContainerContextMenu;
|
|
67
|
-
private isHTMLContextMenuEvent;
|
|
68
43
|
private handleViewportTransform;
|
|
69
44
|
private render;
|
|
70
45
|
private syncOverlayOrder;
|
|
71
|
-
private getOrCreateSelectionLayer;
|
|
72
46
|
private renderFrameOverlays;
|
|
73
47
|
private getOrCreateFrameOverlay;
|
|
74
48
|
private getOrCreateOverlay;
|
|
75
|
-
private getOrCreateSelectionOverlay;
|
|
76
|
-
private syncOverlaySelection;
|
|
77
|
-
private getSelectionBoxShadow;
|
|
78
|
-
private getPreSelectionBoxShadow;
|
|
79
49
|
private getHTMLCardIdByEvent;
|
|
80
50
|
private getHoverShellInteractiveIdByEvent;
|
|
81
|
-
private syncActiveContentInteraction;
|
|
82
|
-
private scheduleActiveContentInteractionSync;
|
|
83
|
-
private setActiveContentInteraction;
|
|
84
|
-
private shouldKeepActiveContentInteractionForFocusedElement;
|
|
85
|
-
private resolveHTMLInteractionTarget;
|
|
86
|
-
private getActiveSubtreeInteractionAtEvent;
|
|
87
|
-
private resolveContentInteractionZone;
|
|
88
|
-
private getContentInteractionZones;
|
|
89
|
-
private getContentInteractiveSelector;
|
|
90
|
-
private isContentInteractionDisabled;
|
|
91
|
-
private getContentInteractionZoneMode;
|
|
92
|
-
private invalidateContentInteractionZones;
|
|
93
|
-
private observeContentInteractionZoneResizes;
|
|
94
51
|
private getLayerPoint;
|
|
95
52
|
private getOrCreateContentOverlay;
|
|
96
53
|
private createContentScaleOverlay;
|
|
97
54
|
private syncContentScale;
|
|
98
|
-
private requestAutoHeightFromIframes;
|
|
99
55
|
private syncContentInteraction;
|
|
100
|
-
private syncContentInteractionZones;
|
|
101
|
-
private clearContentInteractionState;
|
|
102
56
|
private syncShellInteraction;
|
|
103
57
|
private enterEditing;
|
|
104
58
|
private exitEditing;
|
|
105
|
-
private isEditableCard;
|
|
106
59
|
private getEditingFitZoom;
|
|
107
60
|
private isEventInsideOverlay;
|
|
108
61
|
private renderOverlayHTML;
|
|
109
|
-
private observeContentInteractionZones;
|
|
110
|
-
private applyHTMLRootConfig;
|
|
111
62
|
private renderOverlayContent;
|
|
112
63
|
private chainCleanups;
|
|
113
64
|
private cleanupOverlayContent;
|
|
114
65
|
private removeOverlay;
|
|
115
66
|
private syncAutoHeight;
|
|
116
|
-
private ensureAutoHeightMode;
|
|
117
67
|
private createAutoHeightObserver;
|
|
118
68
|
private scheduleAutoHeightMeasure;
|
|
119
69
|
private measureAutoHeight;
|
|
@@ -122,9 +72,6 @@ export declare class HTMLOverlayManager {
|
|
|
122
72
|
private getChildrenNaturalHeight;
|
|
123
73
|
private cleanupAutoHeight;
|
|
124
74
|
private applyAutoHeight;
|
|
125
|
-
private getAutoHeightItemHeight;
|
|
126
75
|
private isAutoHeightMessage;
|
|
127
|
-
private isAutoHeightEnabled;
|
|
128
|
-
private isAutoScaleEnabled;
|
|
129
76
|
}
|
|
130
77
|
export {};
|
|
@@ -4,11 +4,9 @@ export type CardOverlayBoxStyle = {
|
|
|
4
4
|
top: string;
|
|
5
5
|
width: string;
|
|
6
6
|
height: string;
|
|
7
|
-
contentWidth: number;
|
|
8
|
-
contentHeight: number;
|
|
9
7
|
transform: string;
|
|
10
8
|
};
|
|
11
|
-
export declare function getCardOverlayBoxStyle(box: Box2, width: number, height: number, offsetX?: number, offsetY?: number
|
|
9
|
+
export declare function getCardOverlayBoxStyle(box: Box2, width: number, height: number, offsetX?: number, offsetY?: number): CardOverlayBoxStyle;
|
|
12
10
|
export declare function isPointInCardOverlayBox(box: Box2, point: {
|
|
13
11
|
x: number;
|
|
14
12
|
y: number;
|
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,
|
|
2
|
-
export type {
|
|
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, ItemCreateInfo, } from './types';
|
|
2
|
+
export type { CardTypeConfig, CardConfig } 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';
|