@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
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { mat4 as y, quat as m } from "@algorisys/tinyfly";
|
|
2
|
+
const S = Math.PI / 180;
|
|
3
|
+
function Y(t) {
|
|
4
|
+
return !Array.isArray(t) || t.length !== 4 ? null : `matrix3d(${y.fromQuat(m.normalize(t)).map((r) => Math.round(r * 1e6) / 1e6 + 0).join(", ")})`;
|
|
5
|
+
}
|
|
6
|
+
function V(t) {
|
|
7
|
+
return t.z !== void 0 || t.rotateX !== void 0 || t.rotateY !== void 0 || t.perspective !== void 0 || Array.isArray(t.quaternion) && t.quaternion.length === 4;
|
|
8
|
+
}
|
|
9
|
+
function T(t) {
|
|
10
|
+
const e = y.identity();
|
|
11
|
+
return t > 0 && (e[11] = -1 / t), e;
|
|
12
|
+
}
|
|
13
|
+
function X(t, e) {
|
|
14
|
+
const r = y.identity();
|
|
15
|
+
return r[4] = Math.tan(t * S), r[1] = Math.tan(e * S), r;
|
|
16
|
+
}
|
|
17
|
+
const R = (t, e) => e ? y.fromQuat(m.fromAxisAngle(t, e)) : null;
|
|
18
|
+
function j(t, e, r) {
|
|
19
|
+
return [
|
|
20
|
+
y.translation([r.x, r.y, 0]),
|
|
21
|
+
t.perspective !== void 0 ? T(t.perspective) : null,
|
|
22
|
+
y.translation([e.x, e.y, t.z ?? 0]),
|
|
23
|
+
R([0, 0, 1], t.rotate),
|
|
24
|
+
R([1, 0, 0], t.rotateX),
|
|
25
|
+
R([0, 1, 0], t.rotateY),
|
|
26
|
+
Array.isArray(t.quaternion) && t.quaternion.length === 4 ? y.fromQuat(m.normalize(t.quaternion)) : null,
|
|
27
|
+
t.scale !== void 0 ? y.scaling([t.scale, t.scale, 1]) : y.scaling([t.scaleX ?? 1, t.scaleY ?? 1, 1]),
|
|
28
|
+
t.skewX !== void 0 || t.skewY !== void 0 ? X(t.skewX ?? 0, t.skewY ?? 0) : null,
|
|
29
|
+
y.translation([-r.x, -r.y, 0])
|
|
30
|
+
].reduce((s, a) => a ? y.multiply(s, a) : s, y.identity());
|
|
31
|
+
}
|
|
32
|
+
function H(t) {
|
|
33
|
+
return t[3] === 0 && t[7] === 0 && t[11] === 0 && t[15] === 1;
|
|
34
|
+
}
|
|
35
|
+
function Q(t) {
|
|
36
|
+
return [t[0], t[1], t[4], t[5], t[12], t[13]];
|
|
37
|
+
}
|
|
38
|
+
function U(t) {
|
|
39
|
+
const e = y.invert(t);
|
|
40
|
+
return e !== null && e[10] < 0;
|
|
41
|
+
}
|
|
42
|
+
function P(t, e, r) {
|
|
43
|
+
const o = t[3] * e + t[7] * r + t[15];
|
|
44
|
+
return o <= 1e-6 ? null : { x: (t[0] * e + t[4] * r + t[12]) / o, y: (t[1] * e + t[5] * r + t[13]) / o };
|
|
45
|
+
}
|
|
46
|
+
function J(t, e) {
|
|
47
|
+
const [r, o, s] = t, [a, h, i] = e, c = o.x - r.x, f = o.y - r.y, p = s.x - r.x, u = s.y - r.y, g = c * u - p * f;
|
|
48
|
+
if (Math.abs(g) < 1e-9) return null;
|
|
49
|
+
const x = h.x - a.x, n = h.y - a.y, l = i.x - a.x, d = i.y - a.y, w = (x * u - l * f) / g, k = (n * u - d * f) / g, O = (l * c - x * p) / g, M = (d * c - n * p) / g;
|
|
50
|
+
return [w, k, O, M, a.x - w * r.x - O * r.y, a.y - k * r.x - M * r.y];
|
|
51
|
+
}
|
|
52
|
+
function E(t, e) {
|
|
53
|
+
const r = [
|
|
54
|
+
P(t, e.x, e.y),
|
|
55
|
+
P(t, e.x + e.width, e.y),
|
|
56
|
+
P(t, e.x, e.y + e.height),
|
|
57
|
+
P(t, e.x + e.width, e.y + e.height)
|
|
58
|
+
];
|
|
59
|
+
if (r.some((c) => c === null)) return 16;
|
|
60
|
+
const [o, s, a, h] = r, i = Math.max(Math.hypot(h.x - o.x, h.y - o.y), Math.hypot(a.x - s.x, a.y - s.y));
|
|
61
|
+
return Math.min(16, Math.max(2, Math.round(i / 40)));
|
|
62
|
+
}
|
|
63
|
+
function K(t, e, r = E(t, e)) {
|
|
64
|
+
const o = Math.max(1, Math.round(r)), s = [];
|
|
65
|
+
for (let i = 0; i <= o; i++) {
|
|
66
|
+
const c = [];
|
|
67
|
+
for (let f = 0; f <= o; f++) {
|
|
68
|
+
const p = { x: e.x + e.width * f / o, y: e.y + e.height * i / o };
|
|
69
|
+
c.push({ source: p, target: P(t, p.x, p.y) });
|
|
70
|
+
}
|
|
71
|
+
s.push(c);
|
|
72
|
+
}
|
|
73
|
+
const a = [], h = (i, c, f) => {
|
|
74
|
+
i.target && c.target && f.target && a.push({ source: [i.source, c.source, f.source], target: [i.target, c.target, f.target] });
|
|
75
|
+
};
|
|
76
|
+
for (let i = 0; i < o; i++)
|
|
77
|
+
for (let c = 0; c < o; c++) {
|
|
78
|
+
const f = s[i][c], p = s[i][c + 1], u = s[i + 1][c], g = s[i + 1][c + 1];
|
|
79
|
+
h(f, p, g), h(f, g, u);
|
|
80
|
+
}
|
|
81
|
+
return a;
|
|
82
|
+
}
|
|
83
|
+
function tt(t, e) {
|
|
84
|
+
const [r, o, s] = t, a = (o.x - r.x) * (s.y - r.y) - (o.y - r.y) * (s.x - r.x) >= 0 ? 1 : -1, h = (i, c) => {
|
|
85
|
+
const f = c.x - i.x, p = c.y - i.y, u = Math.hypot(f, p) || 1;
|
|
86
|
+
return { x: a * p / u, y: -a * f / u };
|
|
87
|
+
};
|
|
88
|
+
return t.map((i, c) => {
|
|
89
|
+
const f = t[(c + 2) % 3], p = t[(c + 1) % 3], u = h(f, i), g = h(i, p), x = u.x + g.x, n = u.y + g.y, l = Math.hypot(x, n) / 2 || 1, d = Math.min(e / l, e * 4), w = Math.hypot(x, n) || 1;
|
|
90
|
+
return { x: i.x + x / w * d, y: i.y + n / w * d };
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const A = /* @__PURE__ */ new Set([
|
|
94
|
+
"blur",
|
|
95
|
+
"brightness",
|
|
96
|
+
"glow",
|
|
97
|
+
"glowColor",
|
|
98
|
+
"shadowX",
|
|
99
|
+
"shadowY",
|
|
100
|
+
"shadowBlur",
|
|
101
|
+
"shadowColor"
|
|
102
|
+
]), C = "#ffffff", _ = "rgba(0, 0, 0, 0.5)";
|
|
103
|
+
function I(t) {
|
|
104
|
+
const e = [];
|
|
105
|
+
if (t.blur !== void 0 && e.push(`blur(${Math.max(0, t.blur)}px)`), t.brightness !== void 0 && e.push(`brightness(${Math.max(0, t.brightness)})`), t.glow !== void 0 && e.push(`drop-shadow(0 0 ${Math.max(0, t.glow)}px ${t.glowColor ?? C})`), t.shadowX !== void 0 || t.shadowY !== void 0 || t.shadowBlur !== void 0) {
|
|
106
|
+
const r = t.shadowX ?? 0, o = t.shadowY ?? 0, s = Math.max(0, t.shadowBlur ?? 0);
|
|
107
|
+
e.push(`drop-shadow(${r}px ${o}px ${s}px ${t.shadowColor ?? _})`);
|
|
108
|
+
}
|
|
109
|
+
return e.length > 0 ? e.join(" ") : null;
|
|
110
|
+
}
|
|
111
|
+
function B(t, e) {
|
|
112
|
+
const r = t.childNodes.length === 1 ? t.firstChild : null;
|
|
113
|
+
if (r && r.nodeType === 3) {
|
|
114
|
+
const o = r;
|
|
115
|
+
o.data !== e && (o.data = e);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
t.textContent !== e && (t.textContent = e);
|
|
119
|
+
}
|
|
120
|
+
function L(t) {
|
|
121
|
+
if (!("ownerSVGElement" in t)) return;
|
|
122
|
+
const e = t.style;
|
|
123
|
+
!e || e.transformBox || (e.transformBox = "fill-box", e.transformOrigin || (e.transformOrigin = "50% 50%"));
|
|
124
|
+
}
|
|
125
|
+
const $ = /* @__PURE__ */ new Set([
|
|
126
|
+
"width",
|
|
127
|
+
"height",
|
|
128
|
+
"top",
|
|
129
|
+
"right",
|
|
130
|
+
"bottom",
|
|
131
|
+
"left",
|
|
132
|
+
"margin",
|
|
133
|
+
"marginTop",
|
|
134
|
+
"marginRight",
|
|
135
|
+
"marginBottom",
|
|
136
|
+
"marginLeft",
|
|
137
|
+
"padding",
|
|
138
|
+
"paddingTop",
|
|
139
|
+
"paddingRight",
|
|
140
|
+
"paddingBottom",
|
|
141
|
+
"paddingLeft",
|
|
142
|
+
"borderRadius",
|
|
143
|
+
"borderWidth",
|
|
144
|
+
"fontSize",
|
|
145
|
+
"lineHeight",
|
|
146
|
+
"letterSpacing",
|
|
147
|
+
"outlineWidth",
|
|
148
|
+
"gap",
|
|
149
|
+
"rowGap",
|
|
150
|
+
"columnGap"
|
|
151
|
+
]), D = /* @__PURE__ */ new Set([
|
|
152
|
+
"x",
|
|
153
|
+
"y",
|
|
154
|
+
"z",
|
|
155
|
+
"rotate",
|
|
156
|
+
"rotateX",
|
|
157
|
+
"rotateY",
|
|
158
|
+
"rotateZ",
|
|
159
|
+
"scale",
|
|
160
|
+
"scaleX",
|
|
161
|
+
"scaleY",
|
|
162
|
+
"scaleZ",
|
|
163
|
+
"skewX",
|
|
164
|
+
"skewY",
|
|
165
|
+
// A rotation as an [x, y, z, w] quaternion (a track with `interpolation: 'slerp'`)
|
|
166
|
+
"quaternion",
|
|
167
|
+
// Motion path properties
|
|
168
|
+
"motionPathX",
|
|
169
|
+
"motionPathY",
|
|
170
|
+
"motionPathRotate"
|
|
171
|
+
]), z = [
|
|
172
|
+
"x",
|
|
173
|
+
"motionPathX",
|
|
174
|
+
"y",
|
|
175
|
+
"motionPathY",
|
|
176
|
+
"z",
|
|
177
|
+
"rotate",
|
|
178
|
+
"rotateZ",
|
|
179
|
+
"motionPathRotate",
|
|
180
|
+
"rotateX",
|
|
181
|
+
"rotateY",
|
|
182
|
+
"quaternion",
|
|
183
|
+
"scale",
|
|
184
|
+
"scaleX",
|
|
185
|
+
"scaleY",
|
|
186
|
+
"scaleZ",
|
|
187
|
+
"skewX",
|
|
188
|
+
"skewY"
|
|
189
|
+
], q = /* @__PURE__ */ new Set(["childPerspective", "perspectiveOriginX", "perspectiveOriginY"]), v = /* @__PURE__ */ new Set(["originX", "originY"]), N = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Z = /* @__PURE__ */ new Set(["drawOn"]), F = {
|
|
190
|
+
fill: "backgroundColor",
|
|
191
|
+
stroke: "borderColor",
|
|
192
|
+
strokeWidth: "borderWidth",
|
|
193
|
+
color: "color",
|
|
194
|
+
backgroundColor: "backgroundColor",
|
|
195
|
+
borderColor: "borderColor"
|
|
196
|
+
}, b = {
|
|
197
|
+
fill: "fill",
|
|
198
|
+
stroke: "stroke",
|
|
199
|
+
strokeWidth: "strokeWidth",
|
|
200
|
+
strokeDasharray: "strokeDasharray",
|
|
201
|
+
strokeDashoffset: "strokeDashoffset",
|
|
202
|
+
fillOpacity: "fillOpacity",
|
|
203
|
+
strokeOpacity: "strokeOpacity"
|
|
204
|
+
}, G = "http://www.w3.org/2000/svg";
|
|
205
|
+
class et {
|
|
206
|
+
targets = /* @__PURE__ */ new Map();
|
|
207
|
+
/**
|
|
208
|
+
* Register an HTML element as an animation target.
|
|
209
|
+
*/
|
|
210
|
+
registerTarget(e, r) {
|
|
211
|
+
this.targets.set(e, r);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Unregister a target by its ID.
|
|
215
|
+
*/
|
|
216
|
+
unregisterTarget(e) {
|
|
217
|
+
this.targets.delete(e);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Get a registered target element.
|
|
221
|
+
*/
|
|
222
|
+
getTarget(e) {
|
|
223
|
+
return this.targets.get(e);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Clear all registered targets.
|
|
227
|
+
*/
|
|
228
|
+
clearTargets() {
|
|
229
|
+
this.targets.clear();
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Apply animation state to all registered targets.
|
|
233
|
+
*/
|
|
234
|
+
applyState(e) {
|
|
235
|
+
for (const [r, o] of e.values) {
|
|
236
|
+
const s = this.targets.get(r);
|
|
237
|
+
s && this.applyProperties(s, o);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Apply properties to a single element.
|
|
242
|
+
*/
|
|
243
|
+
applyProperties(e, r) {
|
|
244
|
+
let o = null, s = null, a = null, h = null, i = null;
|
|
245
|
+
const c = r.has("motionPathX"), f = r.has("motionPathY"), p = r.has("motionPathRotate");
|
|
246
|
+
for (const [n, l] of r)
|
|
247
|
+
if (!(n === "x" && c) && !(n === "y" && f) && !((n === "rotate" || n === "rotateZ") && p) && !Z.has(n)) {
|
|
248
|
+
if (D.has(n))
|
|
249
|
+
(o ??= {})[n] = l;
|
|
250
|
+
else if (q.has(n))
|
|
251
|
+
typeof l == "number" && ((s ??= {})[n] = l);
|
|
252
|
+
else if (v.has(n))
|
|
253
|
+
typeof l == "number" && ((a ??= {})[n] = l);
|
|
254
|
+
else if (N.has(n))
|
|
255
|
+
typeof l == "number" && ((h ??= {})[n] = l);
|
|
256
|
+
else if (A.has(n))
|
|
257
|
+
(i ??= {})[n] = l;
|
|
258
|
+
else if (n !== "perspective") {
|
|
259
|
+
if (n !== "shine") if (n === "text" && typeof l == "string")
|
|
260
|
+
B(e, l);
|
|
261
|
+
else if (n === "d" && typeof l == "string") {
|
|
262
|
+
const d = e;
|
|
263
|
+
(d.tagName?.toLowerCase() === "path" ? d : d.querySelector?.("path"))?.setAttribute?.("d", l);
|
|
264
|
+
} else
|
|
265
|
+
this.applyStyleProperty(e, n, l);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const u = r.get("shine");
|
|
269
|
+
typeof u == "number" && this.applyShine(e, u);
|
|
270
|
+
const g = [], x = r.get("perspective");
|
|
271
|
+
if (typeof x == "number" && x > 0 && g.push(`perspective(${x}px)`), o)
|
|
272
|
+
for (const n of z) {
|
|
273
|
+
const l = o[n];
|
|
274
|
+
if (l === void 0) continue;
|
|
275
|
+
const d = this.buildTransformPart(n, l);
|
|
276
|
+
d && g.push(d);
|
|
277
|
+
}
|
|
278
|
+
if (g.length > 0 && (e.style.transform = g.join(" "), L(e)), s && (s.childPerspective !== void 0 && (e.style.perspective = `${s.childPerspective}px`), (s.perspectiveOriginX !== void 0 || s.perspectiveOriginY !== void 0) && (e.style.perspectiveOrigin = `${s.perspectiveOriginX ?? 50}% ${s.perspectiveOriginY ?? 50}%`)), a) {
|
|
279
|
+
const n = a.originX ?? 50, l = a.originY ?? 50;
|
|
280
|
+
e.style.transformOrigin = `${n}% ${l}%`;
|
|
281
|
+
}
|
|
282
|
+
if (h) {
|
|
283
|
+
const n = h.clipTop ?? 0, l = h.clipRight ?? 0, d = h.clipBottom ?? 0, w = h.clipLeft ?? 0;
|
|
284
|
+
e.style.clipPath = `inset(${n}% ${l}% ${d}% ${w}%)`;
|
|
285
|
+
}
|
|
286
|
+
if (i) {
|
|
287
|
+
const n = I(i);
|
|
288
|
+
n && (e.style.filter = n);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Build a transform function string for a property.
|
|
293
|
+
*/
|
|
294
|
+
buildTransformPart(e, r) {
|
|
295
|
+
if (e === "quaternion") return Y(r);
|
|
296
|
+
if (typeof r != "number") return null;
|
|
297
|
+
switch (e) {
|
|
298
|
+
case "x":
|
|
299
|
+
case "motionPathX":
|
|
300
|
+
return `translateX(${r}px)`;
|
|
301
|
+
case "y":
|
|
302
|
+
case "motionPathY":
|
|
303
|
+
return `translateY(${r}px)`;
|
|
304
|
+
case "z":
|
|
305
|
+
return `translateZ(${r}px)`;
|
|
306
|
+
case "rotate":
|
|
307
|
+
case "rotateZ":
|
|
308
|
+
case "motionPathRotate":
|
|
309
|
+
return `rotate(${r}deg)`;
|
|
310
|
+
case "rotateX":
|
|
311
|
+
return `rotateX(${r}deg)`;
|
|
312
|
+
case "rotateY":
|
|
313
|
+
return `rotateY(${r}deg)`;
|
|
314
|
+
case "scale":
|
|
315
|
+
return `scale(${r})`;
|
|
316
|
+
case "scaleX":
|
|
317
|
+
return `scaleX(${r})`;
|
|
318
|
+
case "scaleY":
|
|
319
|
+
return `scaleY(${r})`;
|
|
320
|
+
case "scaleZ":
|
|
321
|
+
return `scaleZ(${r})`;
|
|
322
|
+
case "skewX":
|
|
323
|
+
return `skewX(${r}deg)`;
|
|
324
|
+
case "skewY":
|
|
325
|
+
return `skewY(${r}deg)`;
|
|
326
|
+
default:
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Apply a shine sweep to a (text) element.
|
|
332
|
+
*
|
|
333
|
+
* `progress` runs 0..1 as the highlight travels from just off the left edge to
|
|
334
|
+
* just off the right. Two layered, text-clipped gradients are used: a moving
|
|
335
|
+
* white highlight band on top of a solid layer of the element's base colour,
|
|
336
|
+
* so the text stays visible while the sheen passes over the glyphs.
|
|
337
|
+
*/
|
|
338
|
+
applyShine(e, r) {
|
|
339
|
+
e.dataset.shineBase || (e.dataset.shineBase = e.style.color || "currentColor");
|
|
340
|
+
const o = e.dataset.shineBase, s = -20 + r * 140, a = e.style;
|
|
341
|
+
a.color = "transparent", a.backgroundImage = `linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${o}, ${o})`, a.backgroundSize = "250% 100%, 100% 100%", a.backgroundPosition = `${s}% 0, 0 0`, a.backgroundRepeat = "no-repeat", a.webkitBackgroundClip = "text", a.backgroundClip = "text";
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Apply a single style property to an element.
|
|
345
|
+
*/
|
|
346
|
+
applyStyleProperty(e, r, o) {
|
|
347
|
+
let s;
|
|
348
|
+
if (e.namespaceURI === G && r in b) {
|
|
349
|
+
const i = Array.isArray(o) ? o.join(", ") : String(o);
|
|
350
|
+
e.style[b[r]] = i;
|
|
351
|
+
return;
|
|
352
|
+
} else r === "fill" && e.dataset?.elementType === "text" ? s = "color" : s = F[r] ?? r;
|
|
353
|
+
let h;
|
|
354
|
+
typeof o == "number" ? $.has(r) || $.has(s) ? h = `${o}px` : h = String(o) : Array.isArray(o) ? h = o.join(", ") : h = o, e.style[s] = h;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
export {
|
|
358
|
+
et as D,
|
|
359
|
+
A as F,
|
|
360
|
+
H as a,
|
|
361
|
+
Q as b,
|
|
362
|
+
I as c,
|
|
363
|
+
L as d,
|
|
364
|
+
j as e,
|
|
365
|
+
tt as g,
|
|
366
|
+
V as h,
|
|
367
|
+
U as i,
|
|
368
|
+
K as p,
|
|
369
|
+
Y as q,
|
|
370
|
+
B as s,
|
|
371
|
+
J as t
|
|
372
|
+
};
|