@vvfx/sdk 0.2.7 → 0.2.9

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.
Files changed (108) hide show
  1. package/dist/config.js +231 -0
  2. package/dist/exporter/config.js +18 -0
  3. package/dist/exporter/const.js +71 -0
  4. package/dist/exporter/export-media.js +878 -0
  5. package/dist/exporter/exporter.js +121 -0
  6. package/dist/exporter/index.js +1 -0
  7. package/dist/exporter/types.js +1 -0
  8. package/dist/exporter/utils.js +190 -0
  9. package/dist/exporter/wav-audio.js +50 -0
  10. package/dist/gesture-handler/gizmo/adsorption-gizmo.js +227 -0
  11. package/dist/gesture-handler/gizmo/control-gizmo.js +149 -0
  12. package/dist/gesture-handler/gizmo/gizmo.js +17 -0
  13. package/dist/gesture-handler/gizmo/icon-gizmo.js +189 -0
  14. package/dist/gesture-handler/gizmo/index.js +6 -0
  15. package/dist/gesture-handler/gizmo/item-create-gizmo.js +256 -0
  16. package/dist/gesture-handler/gizmo/loading-gizmo.js +320 -0
  17. package/dist/gesture-handler/gizmo/mask-gizmo.js +648 -0
  18. package/dist/gesture-handler/gizmo/picture-cut-gizmo.js +550 -0
  19. package/dist/gesture-handler/gizmo/picture-expand-gizmo.js +491 -0
  20. package/dist/gesture-handler/gizmo/preference-gizmo.js +148 -0
  21. package/dist/gesture-handler/gizmo/selector-gizmo.d.ts +1 -1
  22. package/dist/gesture-handler/gizmo/selector-gizmo.js +468 -0
  23. package/dist/gesture-handler/gizmo/sprite-text-edit-gizmo.js +247 -0
  24. package/dist/gesture-handler/gizmo/text-gizmo.js +1033 -0
  25. package/dist/gesture-handler/gizmo/transform-gizmo.js +1199 -0
  26. package/dist/gesture-handler/gizmo/type.js +18 -0
  27. package/dist/gesture-handler/index.js +3 -0
  28. package/dist/gesture-handler/src/gesture-handler.js +770 -0
  29. package/dist/gesture-handler/src/icons.js +24 -0
  30. package/dist/gesture-handler/utils.js +40 -0
  31. package/dist/html-overlay/anchor-navigation-runtime.js +27 -0
  32. package/dist/html-overlay/auto-height-runtime.js +132 -0
  33. package/dist/html-overlay/document-runtime.js +71 -0
  34. package/dist/html-overlay/document-transform.js +96 -0
  35. package/dist/html-overlay/dom-order.js +8 -0
  36. package/dist/html-overlay/host-message-runtime.js +24 -0
  37. package/dist/html-overlay/html-capture-runtime.js +282 -0
  38. package/dist/html-overlay/html-viewport-style.js +10 -0
  39. package/dist/html-overlay/index.js +1 -0
  40. package/dist/html-overlay/manager.js +1663 -0
  41. package/dist/html-overlay/mime-utils.js +21 -0
  42. package/dist/html-overlay/overlay-transform.js +57 -0
  43. package/dist/html-overlay/path-utils.js +35 -0
  44. package/dist/html-overlay/shell-runtime.js +12 -0
  45. package/dist/index.cjs +1 -7
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.js +13 -75317
  48. package/dist/index.mjs +75311 -0
  49. package/dist/index.mjs.map +1 -0
  50. package/dist/layer-order.js +8 -0
  51. package/dist/math/box2.js +396 -0
  52. package/dist/math/circle.js +131 -0
  53. package/dist/math/euler.js +35 -0
  54. package/dist/math/index.js +13 -0
  55. package/dist/math/line2.js +153 -0
  56. package/dist/math/line3.js +36 -0
  57. package/dist/math/matrix4.js +207 -0
  58. package/dist/math/plane.js +52 -0
  59. package/dist/math/quaternion.js +3 -0
  60. package/dist/math/ray-caster.js +25 -0
  61. package/dist/math/ray.js +47 -0
  62. package/dist/math/type.js +1 -0
  63. package/dist/math/utils.js +77 -0
  64. package/dist/math/vector2.js +70 -0
  65. package/dist/math/vector3.js +60 -0
  66. package/dist/screen-shot/index.js +1 -0
  67. package/dist/screen-shot/screen-shot.js +113 -0
  68. package/dist/sdk-item/base-item.js +160 -0
  69. package/dist/sdk-item/card-item.js +131 -0
  70. package/dist/sdk-item/effects-item.js +144 -0
  71. package/dist/sdk-item/frame-item.js +217 -0
  72. package/dist/sdk-item/generator-item.js +188 -0
  73. package/dist/sdk-item/group-item.js +116 -0
  74. package/dist/sdk-item/index.js +39 -0
  75. package/dist/sdk-item/sprite-item.js +147 -0
  76. package/dist/sdk-item/text-item.js +223 -0
  77. package/dist/sdk-item/types.d.ts +1 -11
  78. package/dist/sdk-item/types.js +15 -0
  79. package/dist/sdk-item/video-item.js +174 -0
  80. package/dist/sdk.js +1903 -0
  81. package/dist/service/UndoRedo.js +79 -0
  82. package/dist/shared/index.d.ts +1 -0
  83. package/dist/shared/index.js +2 -0
  84. package/dist/shared/player.d.ts +1 -1
  85. package/dist/shared/player.js +9 -0
  86. package/dist/shared/spec.d.ts +1 -0
  87. package/dist/shared/spec.js +1 -0
  88. package/dist/size-adapte/index.js +1 -0
  89. package/dist/size-adapte/size-adapt.js +395 -0
  90. package/dist/types.d.ts +5 -1
  91. package/dist/types.js +17 -0
  92. package/dist/utils/background-manager.js +189 -0
  93. package/dist/utils/common-utils.js +183 -0
  94. package/dist/utils/index.js +8 -0
  95. package/dist/utils/interaction-utils.js +205 -0
  96. package/dist/utils/json-data-utils.js +1529 -0
  97. package/dist/utils/layout-utils.js +1217 -0
  98. package/dist/utils/page-data-utils.js +5397 -0
  99. package/dist/utils/player-data-utils.js +48 -0
  100. package/dist/utils/types.js +8 -0
  101. package/dist/wireframe/common/box.js +18 -0
  102. package/dist/wireframe/common/dashed-line.js +21 -0
  103. package/dist/wireframe/common/line.js +17 -0
  104. package/dist/wireframe/common/pixi-ext.js +1 -0
  105. package/dist/wireframe/common/pixi.js +31 -0
  106. package/dist/wireframe/index.js +4 -0
  107. package/package.json +10 -3
  108. 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.7
6
+ * Version: v0.2.9
7
7
  */
8
8
 
9
9
  'use strict';
@@ -30,12 +30,6 @@ var url$1 = require('url');
30
30
  SDKItemType["CARD"] = "card";
31
31
  return SDKItemType;
32
32
  }({});
33
- var _obj$2;
34
- /**
35
- * @description SDKItemType 与 spec.ItemType 的映射关系
36
- */ (_obj$2 = {}, _obj$2["sprite"] = effects.spec.ItemType.sprite, _obj$2["text"] = effects.spec.ItemType.text, _obj$2["video"] = effects.spec.ItemType.video, _obj$2["group"] = effects.spec.ItemType.null, _obj$2["effects"] = effects.spec.ItemType.composition, _obj$2["frame"] = effects.spec.ItemType.composition, // generator 在底层以 sprite 形式渲染
37
- _obj$2["generator"] = effects.spec.ItemType.sprite, // card 在底层以 sprite 形式渲染
38
- _obj$2["card"] = effects.spec.ItemType.sprite, _obj$2);
39
33
 
40
34
  function _defineProperties(target, props) {
41
35
  for(var i = 0; i < props.length; i++){