@vvfx/sdk 0.2.8 → 0.2.10
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.js +231 -0
- package/dist/exporter/config.js +18 -0
- package/dist/exporter/const.js +71 -0
- package/dist/exporter/export-media.js +878 -0
- package/dist/exporter/exporter.js +121 -0
- package/dist/exporter/index.js +1 -0
- package/dist/exporter/types.js +1 -0
- package/dist/exporter/utils.js +190 -0
- package/dist/exporter/wav-audio.js +50 -0
- package/dist/gesture-handler/gizmo/adsorption-gizmo.js +227 -0
- package/dist/gesture-handler/gizmo/control-gizmo.js +149 -0
- package/dist/gesture-handler/gizmo/gizmo.js +17 -0
- package/dist/gesture-handler/gizmo/icon-gizmo.js +189 -0
- package/dist/gesture-handler/gizmo/index.js +6 -0
- package/dist/gesture-handler/gizmo/item-create-gizmo.js +256 -0
- package/dist/gesture-handler/gizmo/loading-gizmo.js +320 -0
- package/dist/gesture-handler/gizmo/mask-gizmo.js +648 -0
- package/dist/gesture-handler/gizmo/picture-cut-gizmo.js +550 -0
- package/dist/gesture-handler/gizmo/picture-expand-gizmo.js +491 -0
- package/dist/gesture-handler/gizmo/preference-gizmo.js +148 -0
- package/dist/gesture-handler/gizmo/selector-gizmo.d.ts +1 -1
- package/dist/gesture-handler/gizmo/selector-gizmo.js +468 -0
- package/dist/gesture-handler/gizmo/sprite-text-edit-gizmo.js +247 -0
- package/dist/gesture-handler/gizmo/text-gizmo.js +1033 -0
- package/dist/gesture-handler/gizmo/transform-gizmo.js +1199 -0
- package/dist/gesture-handler/gizmo/type.js +18 -0
- package/dist/gesture-handler/index.js +3 -0
- package/dist/gesture-handler/src/gesture-handler.js +770 -0
- package/dist/gesture-handler/src/icons.js +24 -0
- package/dist/gesture-handler/utils.js +40 -0
- package/dist/html-overlay/anchor-navigation-runtime.js +27 -0
- package/dist/html-overlay/auto-height-layout.d.ts +6 -0
- package/dist/html-overlay/auto-height-layout.js +7 -0
- package/dist/html-overlay/auto-height-runtime.js +132 -0
- package/dist/html-overlay/document-runtime.js +71 -0
- package/dist/html-overlay/document-transform.js +96 -0
- package/dist/html-overlay/dom-order.js +8 -0
- package/dist/html-overlay/host-message-runtime.js +24 -0
- package/dist/html-overlay/html-capture-runtime.js +282 -0
- package/dist/html-overlay/html-viewport-style.js +10 -0
- package/dist/html-overlay/index.js +1 -0
- package/dist/html-overlay/manager.d.ts +1 -0
- package/dist/html-overlay/manager.js +1677 -0
- package/dist/html-overlay/mime-utils.js +21 -0
- package/dist/html-overlay/overlay-transform.js +57 -0
- package/dist/html-overlay/path-utils.js +35 -0
- package/dist/html-overlay/shell-runtime.js +12 -0
- package/dist/index.cjs +34 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -75311
- package/dist/index.mjs +75337 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layer-order.js +8 -0
- package/dist/math/box2.js +396 -0
- package/dist/math/circle.js +131 -0
- package/dist/math/euler.js +35 -0
- package/dist/math/index.js +13 -0
- package/dist/math/line2.js +153 -0
- package/dist/math/line3.js +36 -0
- package/dist/math/matrix4.js +207 -0
- package/dist/math/plane.js +52 -0
- package/dist/math/quaternion.js +3 -0
- package/dist/math/ray-caster.js +25 -0
- package/dist/math/ray.js +47 -0
- package/dist/math/type.js +1 -0
- package/dist/math/utils.js +77 -0
- package/dist/math/vector2.js +70 -0
- package/dist/math/vector3.js +60 -0
- package/dist/screen-shot/index.js +1 -0
- package/dist/screen-shot/screen-shot.js +113 -0
- package/dist/sdk-item/base-item.js +160 -0
- package/dist/sdk-item/card-item.js +131 -0
- package/dist/sdk-item/effects-item.js +144 -0
- package/dist/sdk-item/frame-item.js +217 -0
- package/dist/sdk-item/generator-item.js +188 -0
- package/dist/sdk-item/group-item.js +116 -0
- package/dist/sdk-item/index.js +39 -0
- package/dist/sdk-item/sprite-item.js +147 -0
- package/dist/sdk-item/text-item.js +223 -0
- package/dist/sdk-item/types.d.ts +1 -1
- package/dist/sdk-item/types.js +15 -0
- package/dist/sdk-item/video-item.js +174 -0
- package/dist/sdk.js +1908 -0
- package/dist/service/UndoRedo.js +79 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +2 -0
- package/dist/shared/player.d.ts +1 -1
- package/dist/shared/player.js +9 -0
- package/dist/shared/spec.d.ts +1 -0
- package/dist/shared/spec.js +1 -0
- package/dist/size-adapte/index.js +1 -0
- package/dist/size-adapte/size-adapt.js +395 -0
- package/dist/types.d.ts +5 -1
- package/dist/types.js +17 -0
- package/dist/utils/background-manager.js +189 -0
- package/dist/utils/common-utils.js +183 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/interaction-utils.js +205 -0
- package/dist/utils/json-data-utils.js +1529 -0
- package/dist/utils/layout-utils.js +1217 -0
- package/dist/utils/page-data-utils.js +5397 -0
- package/dist/utils/player-data-utils.js +48 -0
- package/dist/utils/types.js +8 -0
- package/dist/wireframe/common/box.js +18 -0
- package/dist/wireframe/common/dashed-line.js +21 -0
- package/dist/wireframe/common/line.js +17 -0
- package/dist/wireframe/common/pixi-ext.js +1 -0
- package/dist/wireframe/common/pixi.js +31 -0
- package/dist/wireframe/index.js +4 -0
- package/package.json +10 -3
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getMimeType(path) {
|
|
2
|
+
if (path.endsWith('.css')) {
|
|
3
|
+
return 'text/css';
|
|
4
|
+
}
|
|
5
|
+
if (path.endsWith('.js') || path.endsWith('.mjs')) {
|
|
6
|
+
return 'text/javascript';
|
|
7
|
+
}
|
|
8
|
+
if (path.endsWith('.html') || path.endsWith('.htm')) {
|
|
9
|
+
return 'text/html';
|
|
10
|
+
}
|
|
11
|
+
if (path.endsWith('.svg')) {
|
|
12
|
+
return 'image/svg+xml';
|
|
13
|
+
}
|
|
14
|
+
if (path.endsWith('.json')) {
|
|
15
|
+
return 'application/json';
|
|
16
|
+
}
|
|
17
|
+
return 'text/plain';
|
|
18
|
+
}
|
|
19
|
+
export function createDataUrl(source, mimeType) {
|
|
20
|
+
return `data:${mimeType};charset=utf-8,${encodeURIComponent(source)}`;
|
|
21
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export function getCardOverlayBoxStyle(box, width, height, offsetX = 0, offsetY = 0, _autoScale = true) {
|
|
2
|
+
if (box.corners.length === 4 && width > 0 && height > 0) {
|
|
3
|
+
const [rightTop, , leftBottom, leftTop] = box.corners;
|
|
4
|
+
const contentWidth = width;
|
|
5
|
+
const contentHeight = height;
|
|
6
|
+
const a = (rightTop.x - leftTop.x) / contentWidth;
|
|
7
|
+
const b = (rightTop.y - leftTop.y) / contentWidth;
|
|
8
|
+
const c = (leftBottom.x - leftTop.x) / contentHeight;
|
|
9
|
+
const d = (leftBottom.y - leftTop.y) / contentHeight;
|
|
10
|
+
const e = leftTop.x - offsetX;
|
|
11
|
+
const f = leftTop.y - offsetY;
|
|
12
|
+
return {
|
|
13
|
+
left: '0px',
|
|
14
|
+
top: '0px',
|
|
15
|
+
width: `${formatPixelNumber(contentWidth)}px`,
|
|
16
|
+
height: `${formatPixelNumber(contentHeight)}px`,
|
|
17
|
+
contentWidth,
|
|
18
|
+
contentHeight,
|
|
19
|
+
transform: `matrix(${formatMatrixNumber(a)}, ${formatMatrixNumber(b)}, ${formatMatrixNumber(c)}, ${formatMatrixNumber(d)}, ${formatMatrixNumber(e)}, ${formatMatrixNumber(f)})`,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const contentWidth = box.max.x - box.min.x;
|
|
23
|
+
const contentHeight = box.max.y - box.min.y;
|
|
24
|
+
return {
|
|
25
|
+
left: `${box.min.x - offsetX}px`,
|
|
26
|
+
top: `${box.min.y - offsetY}px`,
|
|
27
|
+
width: `${contentWidth}px`,
|
|
28
|
+
height: `${contentHeight}px`,
|
|
29
|
+
contentWidth,
|
|
30
|
+
contentHeight,
|
|
31
|
+
transform: '',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function isPointInCardOverlayBox(box, point) {
|
|
35
|
+
if (box.corners.length !== 4) {
|
|
36
|
+
return point.x >= box.min.x && point.x <= box.max.x && point.y >= box.min.y && point.y <= box.max.y;
|
|
37
|
+
}
|
|
38
|
+
let inside = false;
|
|
39
|
+
for (let i = 0, j = box.corners.length - 1; i < box.corners.length; j = i, i += 1) {
|
|
40
|
+
const current = box.corners[i];
|
|
41
|
+
const previous = box.corners[j];
|
|
42
|
+
const intersects = ((current.y > point.y) !== (previous.y > point.y)) &&
|
|
43
|
+
(point.x < (previous.x - current.x) * (point.y - current.y) / (previous.y - current.y) + current.x);
|
|
44
|
+
if (intersects) {
|
|
45
|
+
inside = !inside;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return inside;
|
|
49
|
+
}
|
|
50
|
+
function formatMatrixNumber(value) {
|
|
51
|
+
const normalized = Object.is(value, -0) ? 0 : value;
|
|
52
|
+
return Number(normalized.toFixed(6)).toString();
|
|
53
|
+
}
|
|
54
|
+
function formatPixelNumber(value) {
|
|
55
|
+
const normalized = Object.is(value, -0) ? 0 : value;
|
|
56
|
+
return Number(normalized.toFixed(6)).toString();
|
|
57
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function normalizePath(path) {
|
|
2
|
+
const parts = [];
|
|
3
|
+
path.split('/').forEach((part) => {
|
|
4
|
+
if (!part || part === '.') {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (part === '..') {
|
|
8
|
+
parts.pop();
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
parts.push(part);
|
|
12
|
+
});
|
|
13
|
+
return parts.join('/');
|
|
14
|
+
}
|
|
15
|
+
export function dirname(path) {
|
|
16
|
+
const normalizedPath = normalizePath(path);
|
|
17
|
+
const index = normalizedPath.lastIndexOf('/');
|
|
18
|
+
return index >= 0 ? normalizedPath.slice(0, index) : '';
|
|
19
|
+
}
|
|
20
|
+
export function resolvePath(path, fromPath) {
|
|
21
|
+
if (path.startsWith('/')) {
|
|
22
|
+
return normalizePath(path);
|
|
23
|
+
}
|
|
24
|
+
return normalizePath(`${dirname(fromPath)}/${path}`);
|
|
25
|
+
}
|
|
26
|
+
export function splitResourcePath(path) {
|
|
27
|
+
const match = /^([^?#]*)([?#].*)?$/.exec(path);
|
|
28
|
+
return {
|
|
29
|
+
path: match?.[1] ?? path,
|
|
30
|
+
suffix: match?.[2] ?? '',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function shouldRewriteResource(url) {
|
|
34
|
+
return !/^(?:[a-z][a-z\d+.-]*:|#|\/\/)/i.test(url);
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function mountHTMLShell(container, content, shell) {
|
|
2
|
+
if (!shell) {
|
|
3
|
+
return { contentContainer: container };
|
|
4
|
+
}
|
|
5
|
+
const result = shell.render(container, {
|
|
6
|
+
content,
|
|
7
|
+
});
|
|
8
|
+
if (result instanceof HTMLElement) {
|
|
9
|
+
return { contentContainer: result };
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: TODO
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 赤芍,何即,不择,意绮
|
|
6
|
-
* Version: v0.2.
|
|
6
|
+
* Version: v0.2.10
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -70484,6 +70484,7 @@ var CONTENT_INTERACTION_NONE_SELECTOR = [
|
|
|
70484
70484
|
var EDITING_VIEWPORT_PADDING = 48;
|
|
70485
70485
|
var EDITING_VIEWPORT_BOX_SCALE = 1.1;
|
|
70486
70486
|
var AUTO_HEIGHT_EPSILON = 0.5;
|
|
70487
|
+
var AUTO_HEIGHT_MAX_MULTIPLIER = 32;
|
|
70487
70488
|
var CARD_RASTERIZE_READY_TIMEOUT = 3000;
|
|
70488
70489
|
var CARD_HTML_EVENT_MESSAGE_SOURCE = 'vvfx-card-html-event';
|
|
70489
70490
|
var requestHTMLOverlayFrame = function requestHTMLOverlayFrame(callback) {
|
|
@@ -70530,6 +70531,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
70530
70531
|
autoHeightModes: new Map(),
|
|
70531
70532
|
autoHeightCleanups: new Map(),
|
|
70532
70533
|
autoHeightFrames: new Map(),
|
|
70534
|
+
autoHeightInitialHeights: new Map(),
|
|
70533
70535
|
autoHeightStreamPhases: new Map()
|
|
70534
70536
|
};
|
|
70535
70537
|
this.handleContainerDoubleClick = function(event) {
|
|
@@ -70682,6 +70684,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
70682
70684
|
cancelHTMLOverlayFrame(frame);
|
|
70683
70685
|
});
|
|
70684
70686
|
this.state.autoHeightFrames.clear();
|
|
70687
|
+
this.state.autoHeightInitialHeights.clear();
|
|
70685
70688
|
this.state.autoHeightStreamPhases.clear();
|
|
70686
70689
|
this.eventCleanups.forEach(function(cleanup) {
|
|
70687
70690
|
cleanup();
|
|
@@ -71796,6 +71799,7 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
71796
71799
|
_proto.removeOverlay = function removeOverlay(id) {
|
|
71797
71800
|
var _this_state_elements_get, _this_state_selectionElements_get;
|
|
71798
71801
|
this.cleanupOverlayContent(id);
|
|
71802
|
+
this.state.autoHeightInitialHeights.delete(id);
|
|
71799
71803
|
(_this_state_elements_get = this.state.elements.get(id)) == null ? void 0 : _this_state_elements_get.remove();
|
|
71800
71804
|
(_this_state_selectionElements_get = this.state.selectionElements.get(id)) == null ? void 0 : _this_state_selectionElements_get.remove();
|
|
71801
71805
|
this.state.elements.delete(id);
|
|
@@ -71990,7 +71994,8 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
71990
71994
|
if (!Number.isFinite(height) || height <= 0) {
|
|
71991
71995
|
return;
|
|
71992
71996
|
}
|
|
71993
|
-
var
|
|
71997
|
+
var measuredHeight = Math.ceil(this.getAutoHeightItemHeight(item, height));
|
|
71998
|
+
var nextHeight = Math.min(measuredHeight, this.getAutoHeightLimit(item));
|
|
71994
71999
|
if (this.isAutoHeightStreamActive(id) && nextHeight < item.property.height) {
|
|
71995
72000
|
return;
|
|
71996
72001
|
}
|
|
@@ -72031,6 +72036,15 @@ var HTMLOverlayManager = /*#__PURE__*/ function() {
|
|
|
72031
72036
|
}
|
|
72032
72037
|
return contentHeight / displayedHeight * item.property.height;
|
|
72033
72038
|
};
|
|
72039
|
+
_proto.getAutoHeightLimit = function getAutoHeightLimit(item) {
|
|
72040
|
+
var persistedInitialHeight = this.state.autoHeightInitialHeights.get(item.id);
|
|
72041
|
+
if (persistedInitialHeight !== undefined) {
|
|
72042
|
+
return persistedInitialHeight * AUTO_HEIGHT_MAX_MULTIPLIER;
|
|
72043
|
+
}
|
|
72044
|
+
var initialHeight = item.property.height;
|
|
72045
|
+
this.state.autoHeightInitialHeights.set(item.id, initialHeight);
|
|
72046
|
+
return initialHeight * AUTO_HEIGHT_MAX_MULTIPLIER;
|
|
72047
|
+
};
|
|
72034
72048
|
_proto.isAutoHeightEnabled = function isAutoHeightEnabled(item) {
|
|
72035
72049
|
var _this_options_resolveCardTypeConfig;
|
|
72036
72050
|
return isCardItem(item) && ((_this_options_resolveCardTypeConfig = this.options.resolveCardTypeConfig(item)) == null ? void 0 : _this_options_resolveCardTypeConfig.autoHeight) === true;
|
|
@@ -72390,6 +72404,15 @@ function withTimeout(promise, timeout) {
|
|
|
72390
72404
|
});
|
|
72391
72405
|
}
|
|
72392
72406
|
|
|
72407
|
+
function resolveTopAnchoredCardPosition(param) {
|
|
72408
|
+
var nextHeight = param.nextHeight, position = param.position, previousHeight = param.previousHeight, scaleY = param.scaleY;
|
|
72409
|
+
var normalizedScaleY = Number.isFinite(scaleY) ? scaleY : 1;
|
|
72410
|
+
return [
|
|
72411
|
+
position[0],
|
|
72412
|
+
position[1] + (nextHeight - previousHeight) * normalizedScaleY / 2
|
|
72413
|
+
];
|
|
72414
|
+
}
|
|
72415
|
+
|
|
72393
72416
|
function orderSDKCanvasLayers(param) {
|
|
72394
72417
|
var container = param.container, playerContainer = param.playerContainer, htmlOverlayLayer = param.htmlOverlayLayer, gestureCanvas = param.gestureCanvas;
|
|
72395
72418
|
[
|
|
@@ -72502,6 +72525,8 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
72502
72525
|
}, box);
|
|
72503
72526
|
},
|
|
72504
72527
|
setCardItemHeight: function setCardItemHeight(id, height, options) {
|
|
72528
|
+
var _ref;
|
|
72529
|
+
var _item_property_scale;
|
|
72505
72530
|
var item = _this.getSDKItem(id);
|
|
72506
72531
|
if (!isCardItem(item) || options.anchor === 'center') {
|
|
72507
72532
|
void _this.setItemProperty({
|
|
@@ -72512,17 +72537,18 @@ var SDK = /*#__PURE__*/ function() {
|
|
|
72512
72537
|
});
|
|
72513
72538
|
return;
|
|
72514
72539
|
}
|
|
72515
|
-
var
|
|
72516
|
-
|
|
72540
|
+
var position = resolveTopAnchoredCardPosition({
|
|
72541
|
+
nextHeight: height,
|
|
72542
|
+
position: item.property.position,
|
|
72543
|
+
previousHeight: options.previousHeight,
|
|
72544
|
+
scaleY: (_ref = (_item_property_scale = item.property.scale) == null ? void 0 : _item_property_scale[1]) != null ? _ref : 1
|
|
72545
|
+
});
|
|
72517
72546
|
void _this.setItemProperty({
|
|
72518
72547
|
itemId: id,
|
|
72519
72548
|
type: SDKItemType.CARD,
|
|
72520
72549
|
property: {
|
|
72521
72550
|
height: height,
|
|
72522
|
-
position:
|
|
72523
|
-
x,
|
|
72524
|
-
y + deltaY
|
|
72525
|
-
]
|
|
72551
|
+
position: position
|
|
72526
72552
|
}
|
|
72527
72553
|
});
|
|
72528
72554
|
},
|