@designcombo/video 0.0.1 → 0.0.3
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/{SharedSystems-BhqLJf5z.js → SharedSystems-s9Js69L7.js} +20 -20
- package/dist/{WebGLRenderer-BzdmWLtP.js → WebGLRenderer-C-0unSMy.js} +22 -22
- package/dist/{WebGPURenderer-Cypu9NWE.js → WebGPURenderer-D7pcgSJJ.js} +19 -19
- package/dist/{browserAll-7OZQazmn.js → browserAll-D5pTiGnC.js} +2 -2
- package/dist/clips/audio-clip.d.ts +1 -1
- package/dist/clips/base-clip.d.ts +1 -0
- package/dist/clips/caption-clip.d.ts +27 -0
- package/dist/clips/effect-clip.d.ts +33 -0
- package/dist/clips/iclip.d.ts +4 -0
- package/dist/clips/image-clip.d.ts +28 -1
- package/dist/clips/index.d.ts +1 -0
- package/dist/clips/text-clip.d.ts +41 -2
- package/dist/clips/video-clip.d.ts +31 -3
- package/dist/colorToUniform-C2jGzNe1.js +97 -0
- package/dist/effect/effect.d.ts +6 -0
- package/dist/effect/glsl/custom-glsl.d.ts +1017 -0
- package/dist/effect/glsl/gl-effect.d.ts +14 -0
- package/dist/effect/types.d.ts +24 -0
- package/dist/effect/vertex.d.ts +1 -0
- package/dist/event-emitter.d.ts +47 -0
- package/dist/{index-BuRTeJh6.js → index-BVO9qrk3.js} +17619 -11273
- package/dist/index.d.ts +4 -1
- package/dist/index.es.js +17 -14
- package/dist/index.umd.js +3361 -130
- package/dist/json-serialization.d.ts +25 -0
- package/dist/sprite/base-sprite.d.ts +48 -0
- package/dist/sprite/pixi-sprite-renderer.d.ts +4 -13
- package/dist/studio.d.ts +100 -2
- package/dist/{webworkerAll-DChKIQQa.js → webworkerAll-zvzmYHny.js} +70 -97
- package/package.json +3 -3
- package/dist/colorToUniform-B0NRe8Du.js +0 -274
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as p, U as
|
|
2
|
-
import {
|
|
1
|
+
import { E as p, U as Ne, T as ee, F as je, G as he, v as fe, af as qe, M as P, l as C, d as pe, I as v, t as w, a8 as $, R as N, w as L, H as me, a5 as G, a6 as ge, c as F, B as T, D as j, S as M, y as D, ag as Qe, ah as q, L as Y, ai as U, s as Q, a0 as Je, $ as X, n as xe, q as _e, aa as be, ad as ye, o as Ze, p as et, ab as tt, ac as rt, ae as nt, aj as st, ak as it, al as at, am as H, an as ot, ao as ut, m as ve, ap as te, aq as k, e as b, ar as lt } from "./index-BVO9qrk3.js";
|
|
2
|
+
import { c as A, a as ct, b as dt, B as Te } from "./colorToUniform-C2jGzNe1.js";
|
|
3
3
|
class Pe {
|
|
4
4
|
/**
|
|
5
5
|
* Initialize the plugin with scope of application instance
|
|
@@ -62,7 +62,7 @@ class we {
|
|
|
62
62
|
{
|
|
63
63
|
configurable: !0,
|
|
64
64
|
set(t) {
|
|
65
|
-
this._ticker && this._ticker.remove(this.render, this), this._ticker = t, t && t.add(this.render, this,
|
|
65
|
+
this._ticker && this._ticker.remove(this.render, this), this._ticker = t, t && t.add(this.render, this, Ne.LOW);
|
|
66
66
|
},
|
|
67
67
|
get() {
|
|
68
68
|
return this._ticker;
|
|
@@ -86,34 +86,7 @@ class we {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
we.extension = p.Application;
|
|
89
|
-
var
|
|
90
|
-
out vec2 vTextureCoord;
|
|
91
|
-
|
|
92
|
-
uniform vec4 uInputSize;
|
|
93
|
-
uniform vec4 uOutputFrame;
|
|
94
|
-
uniform vec4 uOutputTexture;
|
|
95
|
-
|
|
96
|
-
vec4 filterVertexPosition( void )
|
|
97
|
-
{
|
|
98
|
-
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
99
|
-
|
|
100
|
-
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
101
|
-
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
102
|
-
|
|
103
|
-
return vec4(position, 0.0, 1.0);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
vec2 filterTextureCoord( void )
|
|
107
|
-
{
|
|
108
|
-
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
void main(void)
|
|
112
|
-
{
|
|
113
|
-
gl_Position = filterVertexPosition();
|
|
114
|
-
vTextureCoord = filterTextureCoord();
|
|
115
|
-
}
|
|
116
|
-
`, ht = `in vec2 vTextureCoord;
|
|
89
|
+
var ht = `in vec2 vTextureCoord;
|
|
117
90
|
out vec4 finalColor;
|
|
118
91
|
uniform sampler2D uTexture;
|
|
119
92
|
void main() {
|
|
@@ -169,14 +142,14 @@ fn mainFragment(
|
|
|
169
142
|
return textureSample(uTexture, uSampler, uv);
|
|
170
143
|
}
|
|
171
144
|
`;
|
|
172
|
-
class ft extends
|
|
145
|
+
class ft extends je {
|
|
173
146
|
constructor() {
|
|
174
147
|
const e = he.from({
|
|
175
148
|
vertex: { source: re, entryPoint: "mainVertex" },
|
|
176
149
|
fragment: { source: re, entryPoint: "mainFragment" },
|
|
177
150
|
name: "passthrough-filter"
|
|
178
151
|
}), t = fe.from({
|
|
179
|
-
vertex:
|
|
152
|
+
vertex: qe,
|
|
180
153
|
fragment: ht,
|
|
181
154
|
name: "passthrough-filter"
|
|
182
155
|
});
|
|
@@ -234,7 +207,7 @@ function pt(a, e) {
|
|
|
234
207
|
}
|
|
235
208
|
return e.matrix = t, e;
|
|
236
209
|
}
|
|
237
|
-
const mt = new
|
|
210
|
+
const mt = new $({
|
|
238
211
|
attributes: {
|
|
239
212
|
aPosition: {
|
|
240
213
|
buffer: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
|
|
@@ -440,7 +413,7 @@ class Se {
|
|
|
440
413
|
shader: e,
|
|
441
414
|
state: e._state,
|
|
442
415
|
topology: "triangle-list"
|
|
443
|
-
}), r.type ===
|
|
416
|
+
}), r.type === N.WEBGL && r.renderTarget.finishRenderPass();
|
|
444
417
|
}
|
|
445
418
|
/**
|
|
446
419
|
* Sets up the filter textures including input texture and back texture if needed.
|
|
@@ -570,7 +543,7 @@ class Se {
|
|
|
570
543
|
break;
|
|
571
544
|
}
|
|
572
545
|
if (y.blendRequired && !(i.backBuffer?.useBackBuffer ?? !0)) {
|
|
573
|
-
|
|
546
|
+
L("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."), f = !1;
|
|
574
547
|
break;
|
|
575
548
|
}
|
|
576
549
|
f = !0, d || (d = y.blendRequired);
|
|
@@ -606,7 +579,7 @@ Se.extension = {
|
|
|
606
579
|
],
|
|
607
580
|
name: "filter"
|
|
608
581
|
};
|
|
609
|
-
const Fe = class Re extends
|
|
582
|
+
const Fe = class Re extends $ {
|
|
610
583
|
constructor(...e) {
|
|
611
584
|
let t = e[0] ?? {};
|
|
612
585
|
t instanceof Float32Array && (G(ge, "use new MeshGeometry({ positions, uvs, indices }) instead"), t = {
|
|
@@ -721,13 +694,13 @@ class _t {
|
|
|
721
694
|
}
|
|
722
695
|
destroy() {
|
|
723
696
|
this.batches.forEach((e) => {
|
|
724
|
-
|
|
697
|
+
D.return(e);
|
|
725
698
|
}), this.batches.length = 0;
|
|
726
699
|
}
|
|
727
700
|
}
|
|
728
701
|
class Be {
|
|
729
702
|
constructor(e, t) {
|
|
730
|
-
this.state =
|
|
703
|
+
this.state = M.for2d(), this.renderer = e, this._adaptor = t, this.renderer.runners.contextChange.add(this);
|
|
731
704
|
}
|
|
732
705
|
contextChange() {
|
|
733
706
|
this._adaptor.contextChange(this.renderer);
|
|
@@ -756,7 +729,7 @@ class Be {
|
|
|
756
729
|
const s = r.customShader || this._adaptor.shader;
|
|
757
730
|
this.state.blendMode = e.groupBlendMode;
|
|
758
731
|
const i = s.resources.localUniforms.uniforms;
|
|
759
|
-
i.uTransformMatrix = e.groupTransform, i.uRound = t._roundPixels | e._roundPixels,
|
|
732
|
+
i.uTransformMatrix = e.groupTransform, i.uRound = t._roundPixels | e._roundPixels, A(
|
|
760
733
|
e.groupColorAlpha,
|
|
761
734
|
i.uColor,
|
|
762
735
|
0
|
|
@@ -783,7 +756,7 @@ class Be {
|
|
|
783
756
|
_updateBatchesForRenderable(e, t) {
|
|
784
757
|
const r = e.context, n = this.renderer.graphicsContext.getGpuContext(r), s = this.renderer._roundPixels | e._roundPixels;
|
|
785
758
|
t.batches = n.batches.map((i) => {
|
|
786
|
-
const o =
|
|
759
|
+
const o = D.get(Qe);
|
|
787
760
|
return i.copyTo(o), o.renderable = e, o.roundPixels = s, o;
|
|
788
761
|
});
|
|
789
762
|
}
|
|
@@ -942,7 +915,7 @@ class De {
|
|
|
942
915
|
return;
|
|
943
916
|
e.state.blendMode = q(e.groupBlendMode, e.texture._source);
|
|
944
917
|
const t = this.localUniforms;
|
|
945
|
-
t.uniforms.uTransformMatrix = e.groupTransform, t.uniforms.uRound = this.renderer._roundPixels | e._roundPixels, t.update(),
|
|
918
|
+
t.uniforms.uTransformMatrix = e.groupTransform, t.uniforms.uRound = this.renderer._roundPixels | e._roundPixels, t.update(), A(
|
|
946
919
|
e.groupColorAlpha,
|
|
947
920
|
t.uniforms.uColor,
|
|
948
921
|
0
|
|
@@ -1033,7 +1006,7 @@ function le(a, e) {
|
|
|
1033
1006
|
if (e !== i.dynamic)
|
|
1034
1007
|
continue;
|
|
1035
1008
|
t.push(`offset = index + ${r}`), t.push(i.code);
|
|
1036
|
-
const o =
|
|
1009
|
+
const o = Y(i.format);
|
|
1037
1010
|
r += o.stride / 4;
|
|
1038
1011
|
}
|
|
1039
1012
|
t.push(`
|
|
@@ -1052,11 +1025,11 @@ class Pt {
|
|
|
1052
1025
|
const t = this._size = e.size ?? 1e3, r = e.properties;
|
|
1053
1026
|
let n = 0, s = 0;
|
|
1054
1027
|
for (const h in r) {
|
|
1055
|
-
const l = r[h], d =
|
|
1028
|
+
const l = r[h], d = Y(l.format);
|
|
1056
1029
|
l.dynamic ? s += d.stride : n += d.stride;
|
|
1057
1030
|
}
|
|
1058
1031
|
this._dynamicStride = s / 4, this._staticStride = n / 4, this.staticAttributeBuffer = new U(t * 4 * n), this.dynamicAttributeBuffer = new U(t * 4 * s), this.indexBuffer = ue(t);
|
|
1059
|
-
const i = new
|
|
1032
|
+
const i = new $();
|
|
1060
1033
|
let o = 0, u = 0;
|
|
1061
1034
|
this._staticBuffer = new F({
|
|
1062
1035
|
data: new Float32Array(1),
|
|
@@ -1070,7 +1043,7 @@ class Pt {
|
|
|
1070
1043
|
usage: T.VERTEX | T.COPY_DST
|
|
1071
1044
|
});
|
|
1072
1045
|
for (const h in r) {
|
|
1073
|
-
const l = r[h], d =
|
|
1046
|
+
const l = r[h], d = Y(l.format);
|
|
1074
1047
|
l.dynamic ? (i.addAttribute(l.attributeName, {
|
|
1075
1048
|
buffer: this._dynamicBuffer,
|
|
1076
1049
|
stride: this._dynamicStride * 4,
|
|
@@ -1262,7 +1235,7 @@ class Ft extends Q {
|
|
|
1262
1235
|
// this will be replaced with the local uniforms from the particle container
|
|
1263
1236
|
uniforms: {
|
|
1264
1237
|
uTranslationMatrix: { value: new P(), type: "mat3x3<f32>" },
|
|
1265
|
-
uColor: { value: new
|
|
1238
|
+
uColor: { value: new Je(16777215), type: "vec4<f32>" },
|
|
1266
1239
|
uRound: { value: 1, type: "f32" },
|
|
1267
1240
|
uResolution: { value: [0, 0], type: "vec2<f32>" }
|
|
1268
1241
|
}
|
|
@@ -1270,18 +1243,18 @@ class Ft extends Q {
|
|
|
1270
1243
|
});
|
|
1271
1244
|
}
|
|
1272
1245
|
}
|
|
1273
|
-
class
|
|
1246
|
+
class Ae {
|
|
1274
1247
|
/**
|
|
1275
1248
|
* @param renderer - The renderer this sprite batch works for.
|
|
1276
1249
|
* @param adaptor
|
|
1277
1250
|
*/
|
|
1278
1251
|
constructor(e, t) {
|
|
1279
|
-
this.state =
|
|
1252
|
+
this.state = M.for2d(), this.localUniforms = new C({
|
|
1280
1253
|
uTranslationMatrix: { value: new P(), type: "mat3x3<f32>" },
|
|
1281
1254
|
uColor: { value: new Float32Array(4), type: "vec4<f32>" },
|
|
1282
1255
|
uRound: { value: 1, type: "f32" },
|
|
1283
1256
|
uResolution: { value: [0, 0], type: "vec2<f32>" }
|
|
1284
|
-
}), this.renderer = e, this.adaptor = t, this.defaultShader = new Ft(), this.state =
|
|
1257
|
+
}), this.renderer = e, this.adaptor = t, this.defaultShader = new Ft(), this.state = M.for2d();
|
|
1285
1258
|
}
|
|
1286
1259
|
validateRenderable(e) {
|
|
1287
1260
|
return !1;
|
|
@@ -1309,7 +1282,7 @@ class ze {
|
|
|
1309
1282
|
const s = this.state;
|
|
1310
1283
|
n.update(t, e._childrenDirty), e._childrenDirty = !1, s.blendMode = q(e.blendMode, e.texture._source);
|
|
1311
1284
|
const i = this.localUniforms.uniforms, o = i.uTranslationMatrix;
|
|
1312
|
-
e.worldTransform.copyTo(o), o.prepend(r.globalUniforms.globalUniformData.projectionMatrix), i.uResolution = r.globalUniforms.globalUniformData.resolution, i.uRound = r._roundPixels | e._roundPixels,
|
|
1285
|
+
e.worldTransform.copyTo(o), o.prepend(r.globalUniforms.globalUniformData.projectionMatrix), i.uResolution = r.globalUniforms.globalUniformData.resolution, i.uRound = r._roundPixels | e._roundPixels, A(
|
|
1313
1286
|
e.groupColorAlpha,
|
|
1314
1287
|
i.uColor,
|
|
1315
1288
|
0
|
|
@@ -1320,18 +1293,18 @@ class ze {
|
|
|
1320
1293
|
this.renderer = null, this.defaultShader && (this.defaultShader.destroy(), this.defaultShader = null);
|
|
1321
1294
|
}
|
|
1322
1295
|
}
|
|
1323
|
-
class
|
|
1296
|
+
class ze extends Ae {
|
|
1324
1297
|
constructor(e) {
|
|
1325
1298
|
super(e, new yt());
|
|
1326
1299
|
}
|
|
1327
1300
|
}
|
|
1328
|
-
|
|
1301
|
+
ze.extension = {
|
|
1329
1302
|
type: [
|
|
1330
1303
|
p.WebGLPipes
|
|
1331
1304
|
],
|
|
1332
1305
|
name: "particle"
|
|
1333
1306
|
};
|
|
1334
|
-
class ke extends
|
|
1307
|
+
class ke extends Ae {
|
|
1335
1308
|
constructor(e) {
|
|
1336
1309
|
super(e, new vt());
|
|
1337
1310
|
}
|
|
@@ -1564,14 +1537,14 @@ class Mt extends Q {
|
|
|
1564
1537
|
O ?? (O = xe({
|
|
1565
1538
|
name: "tiling-sprite-shader",
|
|
1566
1539
|
bits: [
|
|
1567
|
-
|
|
1540
|
+
ct,
|
|
1568
1541
|
Bt,
|
|
1569
1542
|
_e
|
|
1570
1543
|
]
|
|
1571
1544
|
})), I ?? (I = be({
|
|
1572
1545
|
name: "tiling-sprite-shader",
|
|
1573
1546
|
bits: [
|
|
1574
|
-
|
|
1547
|
+
dt,
|
|
1575
1548
|
Gt,
|
|
1576
1549
|
ye
|
|
1577
1550
|
]
|
|
@@ -1619,11 +1592,11 @@ class Dt extends J {
|
|
|
1619
1592
|
});
|
|
1620
1593
|
}
|
|
1621
1594
|
}
|
|
1622
|
-
function
|
|
1595
|
+
function At(a, e) {
|
|
1623
1596
|
const t = a.anchor.x, r = a.anchor.y;
|
|
1624
1597
|
e[0] = -t * a.width, e[1] = -r * a.height, e[2] = (1 - t) * a.width, e[3] = -r * a.height, e[4] = (1 - t) * a.width, e[5] = (1 - r) * a.height, e[6] = -t * a.width, e[7] = (1 - r) * a.height;
|
|
1625
1598
|
}
|
|
1626
|
-
function
|
|
1599
|
+
function zt(a, e, t, r) {
|
|
1627
1600
|
let n = 0;
|
|
1628
1601
|
const s = a.length / e, i = r.a, o = r.b, u = r.c, c = r.d, h = r.tx, l = r.ty;
|
|
1629
1602
|
for (t *= e; n < s; ) {
|
|
@@ -1636,7 +1609,7 @@ function kt(a, e) {
|
|
|
1636
1609
|
let s = 0, i = 0;
|
|
1637
1610
|
a.applyAnchorToTexture && (s = a.anchor.x, i = a.anchor.y), e[0] = e[6] = -s, e[2] = e[4] = 1 - s, e[1] = e[3] = -i, e[5] = e[7] = 1 - i;
|
|
1638
1611
|
const o = P.shared;
|
|
1639
|
-
o.copyFrom(a._tileTransform.matrix), o.tx /= a.width, o.ty /= a.height, o.invert(), o.scale(a.width / r, a.height / n),
|
|
1612
|
+
o.copyFrom(a._tileTransform.matrix), o.tx /= a.width, o.ty /= a.height, o.invert(), o.scale(a.width / r, a.height / n), zt(e, 2, 0, o);
|
|
1640
1613
|
}
|
|
1641
1614
|
const B = new Dt();
|
|
1642
1615
|
class Ot {
|
|
@@ -1653,7 +1626,7 @@ class Ot {
|
|
|
1653
1626
|
}
|
|
1654
1627
|
class Ve {
|
|
1655
1628
|
constructor(e) {
|
|
1656
|
-
this._state =
|
|
1629
|
+
this._state = M.default2d, this._renderer = e;
|
|
1657
1630
|
}
|
|
1658
1631
|
validateRenderable(e) {
|
|
1659
1632
|
const t = this._getTilingSpriteData(e), r = t.canBatch;
|
|
@@ -1683,7 +1656,7 @@ class Ve {
|
|
|
1683
1656
|
const { shader: t } = this._getTilingSpriteData(e);
|
|
1684
1657
|
t.groups[0] = this._renderer.globalUniforms.bindGroup;
|
|
1685
1658
|
const r = t.resources.localUniforms.uniforms;
|
|
1686
|
-
r.uTransformMatrix = e.groupTransform, r.uRound = this._renderer._roundPixels | e._roundPixels,
|
|
1659
|
+
r.uTransformMatrix = e.groupTransform, r.uRound = this._renderer._roundPixels | e._roundPixels, A(
|
|
1687
1660
|
e.groupColorAlpha,
|
|
1688
1661
|
r.uColor,
|
|
1689
1662
|
0
|
|
@@ -1719,7 +1692,7 @@ class Ve {
|
|
|
1719
1692
|
}
|
|
1720
1693
|
_updateBatchableMesh(e) {
|
|
1721
1694
|
const t = this._getTilingSpriteData(e), { geometry: r } = t, n = e.texture.source.style;
|
|
1722
|
-
n.addressMode !== "repeat" && (n.addressMode = "repeat", n.update()), kt(e, r.uvs),
|
|
1695
|
+
n.addressMode !== "repeat" && (n.addressMode = "repeat", n.update()), kt(e, r.uvs), At(e, r.positions);
|
|
1723
1696
|
}
|
|
1724
1697
|
destroy() {
|
|
1725
1698
|
this._renderer = null;
|
|
@@ -1727,7 +1700,7 @@ class Ve {
|
|
|
1727
1700
|
_updateCanBatch(e) {
|
|
1728
1701
|
const t = this._getTilingSpriteData(e), r = e.texture;
|
|
1729
1702
|
let n = !0;
|
|
1730
|
-
return this._renderer.type ===
|
|
1703
|
+
return this._renderer.type === N.WEBGL && (n = this._renderer.context.supports.nonPowOf2wrapping), t.canBatch = r.textureMatrix.isSimple && (n || r.source.isPowerOfTwo), t.canBatch;
|
|
1731
1704
|
}
|
|
1732
1705
|
}
|
|
1733
1706
|
Ve.extension = {
|
|
@@ -1905,7 +1878,7 @@ const It = {
|
|
|
1905
1878
|
}
|
|
1906
1879
|
};
|
|
1907
1880
|
let E, V;
|
|
1908
|
-
class
|
|
1881
|
+
class Lt extends Q {
|
|
1909
1882
|
constructor(e) {
|
|
1910
1883
|
const t = new C({
|
|
1911
1884
|
uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
|
|
@@ -1916,8 +1889,8 @@ class Yt extends Q {
|
|
|
1916
1889
|
E ?? (E = xe({
|
|
1917
1890
|
name: "sdf-shader",
|
|
1918
1891
|
bits: [
|
|
1919
|
-
|
|
1920
|
-
|
|
1892
|
+
Ze,
|
|
1893
|
+
et(e),
|
|
1921
1894
|
It,
|
|
1922
1895
|
Vt,
|
|
1923
1896
|
_e
|
|
@@ -1925,8 +1898,8 @@ class Yt extends Q {
|
|
|
1925
1898
|
})), V ?? (V = be({
|
|
1926
1899
|
name: "sdf-shader",
|
|
1927
1900
|
bits: [
|
|
1928
|
-
|
|
1929
|
-
|
|
1901
|
+
tt,
|
|
1902
|
+
rt(e),
|
|
1930
1903
|
Et,
|
|
1931
1904
|
Wt,
|
|
1932
1905
|
ye
|
|
@@ -1936,12 +1909,12 @@ class Yt extends Q {
|
|
|
1936
1909
|
gpuProgram: E,
|
|
1937
1910
|
resources: {
|
|
1938
1911
|
localUniforms: t,
|
|
1939
|
-
batchSamplers:
|
|
1912
|
+
batchSamplers: nt(e)
|
|
1940
1913
|
}
|
|
1941
1914
|
});
|
|
1942
1915
|
}
|
|
1943
1916
|
}
|
|
1944
|
-
class
|
|
1917
|
+
class Yt extends ot {
|
|
1945
1918
|
destroy() {
|
|
1946
1919
|
this.context.customShader && this.context.customShader.destroy(), super.destroy();
|
|
1947
1920
|
}
|
|
@@ -1963,11 +1936,11 @@ class We {
|
|
|
1963
1936
|
de(e, t), this._renderer.renderPipes.graphics.updateRenderable(t), t.context.customShader && this._updateDistanceField(e);
|
|
1964
1937
|
}
|
|
1965
1938
|
_updateContext(e, t) {
|
|
1966
|
-
const { context: r } = t, n =
|
|
1967
|
-
r.clear(), n.distanceField.type !== "none" && (r.customShader || (r.customShader = new
|
|
1968
|
-
const s =
|
|
1939
|
+
const { context: r } = t, n = st.getFont(e.text, e._style);
|
|
1940
|
+
r.clear(), n.distanceField.type !== "none" && (r.customShader || (r.customShader = new Lt(this._renderer.limits.maxBatchableTextures)));
|
|
1941
|
+
const s = it.graphemeSegmenter(e.text), i = e._style;
|
|
1969
1942
|
let o = n.baseLineOffset;
|
|
1970
|
-
const u =
|
|
1943
|
+
const u = at(s, i, n, !0), c = i.padding, h = u.scale;
|
|
1971
1944
|
let l = u.width, d = u.height + u.offsetY;
|
|
1972
1945
|
i._stroke && (l += i._stroke.width / h, d += i._stroke.width / h), r.translate(-e._anchor._x * l - c, -e._anchor._y * d - c).scale(h, h);
|
|
1973
1946
|
const f = n.applyFillAsTint ? i._fill.color : 16777215;
|
|
@@ -1978,16 +1951,16 @@ class We {
|
|
|
1978
1951
|
for (let _ = 0; _ < u.lines.length; _++) {
|
|
1979
1952
|
const y = u.lines[_];
|
|
1980
1953
|
for (let S = 0; S < y.charPositions.length; S++) {
|
|
1981
|
-
const
|
|
1954
|
+
const $e = y.chars[S], R = n.chars[$e];
|
|
1982
1955
|
if (R?.texture) {
|
|
1983
|
-
const
|
|
1956
|
+
const z = R.texture;
|
|
1984
1957
|
r.texture(
|
|
1985
|
-
|
|
1958
|
+
z,
|
|
1986
1959
|
f || "black",
|
|
1987
1960
|
Math.round(y.charPositions[S] + R.xOffset),
|
|
1988
1961
|
Math.round(o + R.yOffset + x),
|
|
1989
|
-
|
|
1990
|
-
|
|
1962
|
+
z.orig.width,
|
|
1963
|
+
z.orig.height
|
|
1991
1964
|
);
|
|
1992
1965
|
}
|
|
1993
1966
|
}
|
|
@@ -1998,7 +1971,7 @@ class We {
|
|
|
1998
1971
|
return e._gpuData[this._renderer.uid] || this.initGpuText(e);
|
|
1999
1972
|
}
|
|
2000
1973
|
initGpuText(e) {
|
|
2001
|
-
const t = new
|
|
1974
|
+
const t = new Yt();
|
|
2002
1975
|
return e._gpuData[this._renderer.uid] = t, this._updateContext(e, t), t;
|
|
2003
1976
|
}
|
|
2004
1977
|
_updateDistanceField(e) {
|
|
@@ -2041,11 +2014,11 @@ class Xt extends Te {
|
|
|
2041
2014
|
}
|
|
2042
2015
|
function K(a, e) {
|
|
2043
2016
|
const { texture: t, bounds: r } = a, n = e._style._getFinalPadding();
|
|
2044
|
-
|
|
2017
|
+
ut(r, e._anchor, t);
|
|
2045
2018
|
const s = e._anchor._x * n * 2, i = e._anchor._y * n * 2;
|
|
2046
2019
|
r.minX -= n - s, r.minY -= n - i, r.maxX -= n - s, r.maxY -= n - i;
|
|
2047
2020
|
}
|
|
2048
|
-
class
|
|
2021
|
+
class Le {
|
|
2049
2022
|
constructor(e) {
|
|
2050
2023
|
this._renderer = e;
|
|
2051
2024
|
}
|
|
@@ -2092,7 +2065,7 @@ class Ye {
|
|
|
2092
2065
|
this._renderer = null;
|
|
2093
2066
|
}
|
|
2094
2067
|
}
|
|
2095
|
-
|
|
2068
|
+
Le.extension = {
|
|
2096
2069
|
type: [
|
|
2097
2070
|
p.WebGLPipes,
|
|
2098
2071
|
p.WebGPUPipes,
|
|
@@ -2105,7 +2078,7 @@ function Ht() {
|
|
|
2105
2078
|
return /^((?!chrome|android).)*safari/i.test(a);
|
|
2106
2079
|
}
|
|
2107
2080
|
const Kt = new me();
|
|
2108
|
-
function
|
|
2081
|
+
function Ye(a, e, t, r) {
|
|
2109
2082
|
const n = Kt;
|
|
2110
2083
|
n.minX = 0, n.minY = 0, n.maxX = a.width / r | 0, n.maxY = a.height / r | 0;
|
|
2111
2084
|
const s = v.getOptimalTexture(
|
|
@@ -2116,7 +2089,7 @@ function Le(a, e, t, r) {
|
|
|
2116
2089
|
);
|
|
2117
2090
|
return s.source.uploadMethodId = "image", s.source.resource = a, s.source.alphaMode = "premultiply-alpha-on-upload", s.frame.width = e / r, s.frame.height = t / r, s.source.emit("update", s.source), s.updateUvs(), s;
|
|
2118
2091
|
}
|
|
2119
|
-
function
|
|
2092
|
+
function $t(a, e) {
|
|
2120
2093
|
const t = e.fontFamily, r = [], n = {}, s = /font-family:([^;"\s]+)/g, i = a.match(s);
|
|
2121
2094
|
function o(u) {
|
|
2122
2095
|
n[u] || (r.push(u), n[u] = !0);
|
|
@@ -2136,14 +2109,14 @@ function Nt(a, e) {
|
|
|
2136
2109
|
}
|
|
2137
2110
|
return r;
|
|
2138
2111
|
}
|
|
2139
|
-
async function
|
|
2112
|
+
async function Nt(a) {
|
|
2140
2113
|
const t = await (await j.get().fetch(a)).blob(), r = new FileReader();
|
|
2141
2114
|
return await new Promise((s, i) => {
|
|
2142
2115
|
r.onloadend = () => s(r.result), r.onerror = i, r.readAsDataURL(t);
|
|
2143
2116
|
});
|
|
2144
2117
|
}
|
|
2145
2118
|
async function jt(a, e) {
|
|
2146
|
-
const t = await
|
|
2119
|
+
const t = await Nt(e);
|
|
2147
2120
|
return `@font-face {
|
|
2148
2121
|
font-family: "${a.fontFamily}";
|
|
2149
2122
|
font-weight: ${a.fontWeight};
|
|
@@ -2204,7 +2177,7 @@ function Zt(a, e, t) {
|
|
|
2204
2177
|
}
|
|
2205
2178
|
class Xe {
|
|
2206
2179
|
constructor(e) {
|
|
2207
|
-
this._activeTextures = {}, this._renderer = e, this._createCanvas = e.type ===
|
|
2180
|
+
this._activeTextures = {}, this._renderer = e, this._createCanvas = e.type === N.WEBGPU;
|
|
2208
2181
|
}
|
|
2209
2182
|
/**
|
|
2210
2183
|
* @param options
|
|
@@ -2249,7 +2222,7 @@ class Xe {
|
|
|
2249
2222
|
t && (t.usageCount--, t.usageCount === 0 && (t.texture ? this._cleanUp(t.texture) : t.promise.then((r) => {
|
|
2250
2223
|
t.texture = r, this._cleanUp(t.texture);
|
|
2251
2224
|
}).catch(() => {
|
|
2252
|
-
|
|
2225
|
+
L("HTMLTextSystem: Failed to clean texture");
|
|
2253
2226
|
}), this._activeTextures[e] = null));
|
|
2254
2227
|
}
|
|
2255
2228
|
/**
|
|
@@ -2261,26 +2234,26 @@ class Xe {
|
|
|
2261
2234
|
return this._buildTexturePromise(e);
|
|
2262
2235
|
}
|
|
2263
2236
|
async _buildTexturePromise(e) {
|
|
2264
|
-
const { text: t, style: r, resolution: n, textureStyle: s } = e, i =
|
|
2237
|
+
const { text: t, style: r, resolution: n, textureStyle: s } = e, i = D.get(Ue), o = $t(t, r), u = await qt(o), c = xt(t, r, u, i), h = Math.ceil(Math.ceil(Math.max(1, c.width) + r.padding * 2) * n), l = Math.ceil(Math.ceil(Math.max(1, c.height) + r.padding * 2) * n), d = i.image, f = 2;
|
|
2265
2238
|
d.width = (h | 0) + f, d.height = (l | 0) + f;
|
|
2266
2239
|
const g = Qt(t, r, n, u, i);
|
|
2267
2240
|
await Zt(d, g, Ht() && o.length > 0);
|
|
2268
2241
|
const m = d;
|
|
2269
2242
|
let x;
|
|
2270
2243
|
this._createCanvas && (x = Jt(d, n));
|
|
2271
|
-
const _ =
|
|
2244
|
+
const _ = Ye(
|
|
2272
2245
|
x ? x.canvas : m,
|
|
2273
2246
|
d.width - f,
|
|
2274
2247
|
d.height - f,
|
|
2275
2248
|
n
|
|
2276
2249
|
);
|
|
2277
|
-
return s && (_.source.style = s), this._createCanvas && (this._renderer.texture.initSource(_.source), ve.returnCanvasAndContext(x)),
|
|
2250
|
+
return s && (_.source.style = s), this._createCanvas && (this._renderer.texture.initSource(_.source), ve.returnCanvasAndContext(x)), D.return(i), _;
|
|
2278
2251
|
}
|
|
2279
2252
|
returnTexturePromise(e) {
|
|
2280
2253
|
e.then((t) => {
|
|
2281
2254
|
this._cleanUp(t);
|
|
2282
2255
|
}).catch(() => {
|
|
2283
|
-
|
|
2256
|
+
L("HTMLTextSystem: Failed to clean texture");
|
|
2284
2257
|
});
|
|
2285
2258
|
}
|
|
2286
2259
|
_cleanUp(e) {
|
|
@@ -2371,7 +2344,7 @@ class Ke {
|
|
|
2371
2344
|
text: s,
|
|
2372
2345
|
style: i,
|
|
2373
2346
|
resolution: u
|
|
2374
|
-
}), l =
|
|
2347
|
+
}), l = Ye(h.canvas, c.width, c.height, u);
|
|
2375
2348
|
if (o && (l.source.style = o), i.trim && (c.pad(i.padding), l.frame.copyFrom(c), l.frame.scale(1 / u), l.updateUvs()), i.filters) {
|
|
2376
2349
|
const d = this._applyFilters(l, i.filters);
|
|
2377
2350
|
return this.returnTexture(l), k.returnCanvasAndContext(h), d;
|
|
@@ -2482,15 +2455,15 @@ Ke.extension = {
|
|
|
2482
2455
|
b.add(Pe);
|
|
2483
2456
|
b.add(we);
|
|
2484
2457
|
b.add(Be);
|
|
2485
|
-
b.add(
|
|
2458
|
+
b.add(lt);
|
|
2486
2459
|
b.add(De);
|
|
2487
|
-
b.add(
|
|
2460
|
+
b.add(ze);
|
|
2488
2461
|
b.add(ke);
|
|
2489
2462
|
b.add(Ke);
|
|
2490
2463
|
b.add(He);
|
|
2491
2464
|
b.add(We);
|
|
2492
2465
|
b.add(Xe);
|
|
2493
|
-
b.add(
|
|
2466
|
+
b.add(Le);
|
|
2494
2467
|
b.add(Ve);
|
|
2495
2468
|
b.add(Ee);
|
|
2496
2469
|
b.add(Se);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designcombo/video",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Video rendering and processing library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"types": "dist/index.d.ts",
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
|
-
"types": "./dist/index.d.ts",
|
|
31
30
|
"import": "./dist/index.es.js",
|
|
32
|
-
"require": "./dist/index.umd.js"
|
|
31
|
+
"require": "./dist/index.umd.js",
|
|
32
|
+
"types": "./dist/index.d.ts"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|