@algorisys/tinyfly 0.81.0 → 0.86.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/README.md +12 -5
- package/lib/addons/adapters.js +363 -248
- package/lib/addons/characters.js +1658 -1342
- package/lib/addons/dom-adapter-Cphr2HZn.js +372 -0
- package/lib/addons/gsap-compat.js +197 -187
- package/lib/addons/load-scene-vp14_Jj-.js +324 -0
- package/lib/addons/scene-3d-webgl.js +237 -0
- package/lib/addons/scene-3d.js +306 -0
- package/lib/addons/shading-ByG9UXd0.js +85 -0
- package/lib/browser/tinyfly-scene-3d-webgl.iife.js +114 -0
- package/lib/browser/tinyfly-scene-3d.iife.js +3 -0
- package/lib/browser/tinyfly.iife.js +4 -4
- package/lib/browser/tinyfly.js +3295 -2613
- package/lib/browser/tinyfly.umd.js +4 -4
- package/lib/cli/tools.js +137 -22
- package/lib/embed/tinyfly-embed.iife.js +4 -4
- package/lib/embed/tinyfly-embed.js +921 -833
- package/lib/engine/tinyfly-engine.js +1022 -776
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/headless/headless.js +264 -7
- package/lib/player/tinyfly-player.es.js +459 -371
- package/lib/player/tinyfly-player.iife.js +2 -2
- package/lib/player/tinyfly-player.umd.js +2 -2
- package/lib/types/adapters/canvas/canvas-adapter.d.ts +36 -0
- package/lib/types/adapters/transform-3d.d.ts +99 -0
- package/lib/types/adapters/webgl/webgl-adapter.d.ts +17 -0
- package/lib/types/characters/character.d.ts +20 -1
- package/lib/types/characters/dance.d.ts +47 -0
- package/lib/types/characters/index.d.ts +3 -1
- package/lib/types/characters/rig/body-plan.d.ts +3 -1
- package/lib/types/characters/rig/skeleton.d.ts +57 -0
- package/lib/types/characters/scene-objects.d.ts +2 -0
- package/lib/types/characters/species/human.d.ts +8 -0
- package/lib/types/compat/gsap/vars.d.ts +8 -0
- package/lib/types/engine/core/bake.d.ts +3 -1
- package/lib/types/engine/index.d.ts +1 -0
- package/lib/types/engine/interpolation/interpolators.d.ts +10 -3
- package/lib/types/engine/math/index.d.ts +11 -0
- package/lib/types/engine/math/mat4.d.ts +37 -0
- package/lib/types/engine/math/quat.d.ts +39 -0
- package/lib/types/engine/math/vec3.d.ts +16 -0
- package/lib/types/engine/types.d.ts +23 -2
- package/lib/types/scene-3d/camera.d.ts +27 -0
- package/lib/types/scene-3d/canvas-2d-renderer.d.ts +21 -0
- package/lib/types/scene-3d/geometry/extrude.d.ts +17 -0
- package/lib/types/scene-3d/geometry/mesh.d.ts +36 -0
- package/lib/types/scene-3d/geometry/primitives.d.ts +16 -0
- package/lib/types/scene-3d/geometry/triangulate.d.ts +24 -0
- package/lib/types/scene-3d/index.d.ts +20 -0
- package/lib/types/scene-3d/load-scene.d.ts +31 -0
- package/lib/types/scene-3d/object-kind.d.ts +54 -0
- package/lib/types/scene-3d/resolve-scene.d.ts +122 -0
- package/lib/types/scene-3d/scene-3d-adapter.d.ts +46 -0
- package/lib/types/scene-3d/scene-types.d.ts +191 -0
- package/lib/types/scene-3d/shading.d.ts +20 -0
- package/lib/types/scene-3d/validate-scene.d.ts +11 -0
- package/lib/types/scene-3d/webgl/gl-data.d.ts +28 -0
- package/lib/types/scene-3d/webgl/index.d.ts +16 -0
- package/lib/types/scene-3d/webgl/shaders.d.ts +29 -0
- package/lib/types/scene-3d/webgl/webgl2-renderer.d.ts +33 -0
- package/package.json +10 -2
- package/lib/addons/dom-adapter-CrNwoomd.js +0 -243
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
const w = /* @__PURE__ */ new Set([
|
|
2
|
-
"blur",
|
|
3
|
-
"brightness",
|
|
4
|
-
"glow",
|
|
5
|
-
"glowColor",
|
|
6
|
-
"shadowX",
|
|
7
|
-
"shadowY",
|
|
8
|
-
"shadowBlur",
|
|
9
|
-
"shadowColor"
|
|
10
|
-
]), b = "#ffffff", R = "rgba(0, 0, 0, 0.5)";
|
|
11
|
-
function x(r) {
|
|
12
|
-
const t = [];
|
|
13
|
-
if (r.blur !== void 0 && t.push(`blur(${Math.max(0, r.blur)}px)`), r.brightness !== void 0 && t.push(`brightness(${Math.max(0, r.brightness)})`), r.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, r.glow)}px ${r.glowColor ?? b})`), r.shadowX !== void 0 || r.shadowY !== void 0 || r.shadowBlur !== void 0) {
|
|
14
|
-
const o = r.shadowX ?? 0, e = r.shadowY ?? 0, a = Math.max(0, r.shadowBlur ?? 0);
|
|
15
|
-
t.push(`drop-shadow(${o}px ${e}px ${a}px ${r.shadowColor ?? R})`);
|
|
16
|
-
}
|
|
17
|
-
return t.length > 0 ? t.join(" ") : null;
|
|
18
|
-
}
|
|
19
|
-
function S(r, t) {
|
|
20
|
-
const o = r.childNodes.length === 1 ? r.firstChild : null;
|
|
21
|
-
if (o && o.nodeType === 3) {
|
|
22
|
-
const e = o;
|
|
23
|
-
e.data !== t && (e.data = t);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
r.textContent !== t && (r.textContent = t);
|
|
27
|
-
}
|
|
28
|
-
function $(r) {
|
|
29
|
-
if (!("ownerSVGElement" in r)) return;
|
|
30
|
-
const t = r.style;
|
|
31
|
-
!t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
|
|
32
|
-
}
|
|
33
|
-
const d = /* @__PURE__ */ new Set([
|
|
34
|
-
"width",
|
|
35
|
-
"height",
|
|
36
|
-
"top",
|
|
37
|
-
"right",
|
|
38
|
-
"bottom",
|
|
39
|
-
"left",
|
|
40
|
-
"margin",
|
|
41
|
-
"marginTop",
|
|
42
|
-
"marginRight",
|
|
43
|
-
"marginBottom",
|
|
44
|
-
"marginLeft",
|
|
45
|
-
"padding",
|
|
46
|
-
"paddingTop",
|
|
47
|
-
"paddingRight",
|
|
48
|
-
"paddingBottom",
|
|
49
|
-
"paddingLeft",
|
|
50
|
-
"borderRadius",
|
|
51
|
-
"borderWidth",
|
|
52
|
-
"fontSize",
|
|
53
|
-
"lineHeight",
|
|
54
|
-
"letterSpacing",
|
|
55
|
-
"outlineWidth",
|
|
56
|
-
"gap",
|
|
57
|
-
"rowGap",
|
|
58
|
-
"columnGap"
|
|
59
|
-
]), m = /* @__PURE__ */ new Set([
|
|
60
|
-
"x",
|
|
61
|
-
"y",
|
|
62
|
-
"z",
|
|
63
|
-
"rotate",
|
|
64
|
-
"rotateX",
|
|
65
|
-
"rotateY",
|
|
66
|
-
"rotateZ",
|
|
67
|
-
"scale",
|
|
68
|
-
"scaleX",
|
|
69
|
-
"scaleY",
|
|
70
|
-
"scaleZ",
|
|
71
|
-
"skewX",
|
|
72
|
-
"skewY",
|
|
73
|
-
// Motion path properties
|
|
74
|
-
"motionPathX",
|
|
75
|
-
"motionPathY",
|
|
76
|
-
"motionPathRotate"
|
|
77
|
-
]), k = /* @__PURE__ */ new Set(["originX", "originY"]), O = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), T = /* @__PURE__ */ new Set(["drawOn"]), C = {
|
|
78
|
-
fill: "backgroundColor",
|
|
79
|
-
stroke: "borderColor",
|
|
80
|
-
strokeWidth: "borderWidth",
|
|
81
|
-
color: "color",
|
|
82
|
-
backgroundColor: "backgroundColor",
|
|
83
|
-
borderColor: "borderColor"
|
|
84
|
-
}, u = {
|
|
85
|
-
fill: "fill",
|
|
86
|
-
stroke: "stroke",
|
|
87
|
-
strokeWidth: "strokeWidth",
|
|
88
|
-
strokeDasharray: "strokeDasharray",
|
|
89
|
-
strokeDashoffset: "strokeDashoffset",
|
|
90
|
-
fillOpacity: "fillOpacity",
|
|
91
|
-
strokeOpacity: "strokeOpacity"
|
|
92
|
-
}, Y = "http://www.w3.org/2000/svg";
|
|
93
|
-
class E {
|
|
94
|
-
targets = /* @__PURE__ */ new Map();
|
|
95
|
-
/**
|
|
96
|
-
* Register an HTML element as an animation target.
|
|
97
|
-
*/
|
|
98
|
-
registerTarget(t, o) {
|
|
99
|
-
this.targets.set(t, o);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Unregister a target by its ID.
|
|
103
|
-
*/
|
|
104
|
-
unregisterTarget(t) {
|
|
105
|
-
this.targets.delete(t);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Get a registered target element.
|
|
109
|
-
*/
|
|
110
|
-
getTarget(t) {
|
|
111
|
-
return this.targets.get(t);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Clear all registered targets.
|
|
115
|
-
*/
|
|
116
|
-
clearTargets() {
|
|
117
|
-
this.targets.clear();
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Apply animation state to all registered targets.
|
|
121
|
-
*/
|
|
122
|
-
applyState(t) {
|
|
123
|
-
for (const [o, e] of t.values) {
|
|
124
|
-
const a = this.targets.get(o);
|
|
125
|
-
a && this.applyProperties(a, e);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Apply properties to a single element.
|
|
130
|
-
*/
|
|
131
|
-
applyProperties(t, o) {
|
|
132
|
-
const e = [];
|
|
133
|
-
let a = null, n = null, c = null;
|
|
134
|
-
const h = o.has("motionPathX"), y = o.has("motionPathY"), P = o.has("motionPathRotate");
|
|
135
|
-
for (const [s, i] of o)
|
|
136
|
-
if (!(s === "x" && h) && !(s === "y" && y) && !((s === "rotate" || s === "rotateZ") && P) && !T.has(s)) {
|
|
137
|
-
if (m.has(s)) {
|
|
138
|
-
const l = this.buildTransformPart(s, i);
|
|
139
|
-
l && e.push(l);
|
|
140
|
-
} else if (k.has(s))
|
|
141
|
-
typeof i == "number" && ((a ??= {})[s] = i);
|
|
142
|
-
else if (O.has(s))
|
|
143
|
-
typeof i == "number" && ((n ??= {})[s] = i);
|
|
144
|
-
else if (w.has(s))
|
|
145
|
-
(c ??= {})[s] = i;
|
|
146
|
-
else if (s !== "perspective") {
|
|
147
|
-
if (s !== "shine") if (s === "text" && typeof i == "string")
|
|
148
|
-
S(t, i);
|
|
149
|
-
else if (s === "d" && typeof i == "string") {
|
|
150
|
-
const l = t;
|
|
151
|
-
(l.tagName?.toLowerCase() === "path" ? l : l.querySelector?.("path"))?.setAttribute?.("d", i);
|
|
152
|
-
} else
|
|
153
|
-
this.applyStyleProperty(t, s, i);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
const f = o.get("shine");
|
|
157
|
-
typeof f == "number" && this.applyShine(t, f);
|
|
158
|
-
const g = o.get("perspective");
|
|
159
|
-
if (typeof g == "number" && e.unshift(`perspective(${g}px)`), e.length > 0 && (t.style.transform = e.join(" "), $(t)), a) {
|
|
160
|
-
const s = a.originX ?? 50, i = a.originY ?? 50;
|
|
161
|
-
t.style.transformOrigin = `${s}% ${i}%`;
|
|
162
|
-
}
|
|
163
|
-
if (n) {
|
|
164
|
-
const s = n.clipTop ?? 0, i = n.clipRight ?? 0, l = n.clipBottom ?? 0, p = n.clipLeft ?? 0;
|
|
165
|
-
t.style.clipPath = `inset(${s}% ${i}% ${l}% ${p}%)`;
|
|
166
|
-
}
|
|
167
|
-
if (c) {
|
|
168
|
-
const s = x(c);
|
|
169
|
-
s && (t.style.filter = s);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Build a transform function string for a property.
|
|
174
|
-
*/
|
|
175
|
-
buildTransformPart(t, o) {
|
|
176
|
-
if (typeof o != "number") return null;
|
|
177
|
-
switch (t) {
|
|
178
|
-
case "x":
|
|
179
|
-
case "motionPathX":
|
|
180
|
-
return `translateX(${o}px)`;
|
|
181
|
-
case "y":
|
|
182
|
-
case "motionPathY":
|
|
183
|
-
return `translateY(${o}px)`;
|
|
184
|
-
case "z":
|
|
185
|
-
return `translateZ(${o}px)`;
|
|
186
|
-
case "rotate":
|
|
187
|
-
case "rotateZ":
|
|
188
|
-
case "motionPathRotate":
|
|
189
|
-
return `rotate(${o}deg)`;
|
|
190
|
-
case "rotateX":
|
|
191
|
-
return `rotateX(${o}deg)`;
|
|
192
|
-
case "rotateY":
|
|
193
|
-
return `rotateY(${o}deg)`;
|
|
194
|
-
case "scale":
|
|
195
|
-
return `scale(${o})`;
|
|
196
|
-
case "scaleX":
|
|
197
|
-
return `scaleX(${o})`;
|
|
198
|
-
case "scaleY":
|
|
199
|
-
return `scaleY(${o})`;
|
|
200
|
-
case "scaleZ":
|
|
201
|
-
return `scaleZ(${o})`;
|
|
202
|
-
case "skewX":
|
|
203
|
-
return `skewX(${o}deg)`;
|
|
204
|
-
case "skewY":
|
|
205
|
-
return `skewY(${o}deg)`;
|
|
206
|
-
default:
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Apply a shine sweep to a (text) element.
|
|
212
|
-
*
|
|
213
|
-
* `progress` runs 0..1 as the highlight travels from just off the left edge to
|
|
214
|
-
* just off the right. Two layered, text-clipped gradients are used: a moving
|
|
215
|
-
* white highlight band on top of a solid layer of the element's base colour,
|
|
216
|
-
* so the text stays visible while the sheen passes over the glyphs.
|
|
217
|
-
*/
|
|
218
|
-
applyShine(t, o) {
|
|
219
|
-
t.dataset.shineBase || (t.dataset.shineBase = t.style.color || "currentColor");
|
|
220
|
-
const e = t.dataset.shineBase, a = -20 + o * 140, n = t.style;
|
|
221
|
-
n.color = "transparent", n.backgroundImage = `linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${e}, ${e})`, n.backgroundSize = "250% 100%, 100% 100%", n.backgroundPosition = `${a}% 0, 0 0`, n.backgroundRepeat = "no-repeat", n.webkitBackgroundClip = "text", n.backgroundClip = "text";
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Apply a single style property to an element.
|
|
225
|
-
*/
|
|
226
|
-
applyStyleProperty(t, o, e) {
|
|
227
|
-
let a;
|
|
228
|
-
if (t.namespaceURI === Y && o in u) {
|
|
229
|
-
const h = Array.isArray(e) ? e.join(", ") : String(e);
|
|
230
|
-
t.style[u[o]] = h;
|
|
231
|
-
return;
|
|
232
|
-
} else o === "fill" && t.dataset?.elementType === "text" ? a = "color" : a = C[o] ?? o;
|
|
233
|
-
let c;
|
|
234
|
-
typeof e == "number" ? d.has(o) || d.has(a) ? c = `${e}px` : c = String(e) : Array.isArray(e) ? c = e.join(", ") : c = e, t.style[a] = c;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
export {
|
|
238
|
-
E as D,
|
|
239
|
-
w as F,
|
|
240
|
-
x as c,
|
|
241
|
-
$ as e,
|
|
242
|
-
S as s
|
|
243
|
-
};
|