textmode.js 0.1.6-beta.7 → 0.1.8-beta.1
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/textmode.esm.js +25 -22
- package/dist/textmode.esm.min.js +16 -13
- package/dist/textmode.umd.js +17 -17
- package/dist/textmode.umd.min.js +3 -3
- package/dist/types/export/base/DataExtractor.d.ts +2 -1
- package/dist/types/export/txt/TXTDataExtractor.d.ts +3 -2
- package/dist/types/export/txt/TXTExporter.d.ts +5 -5
- package/dist/types/export/txt/types.d.ts +8 -0
- package/dist/types/textmode/Textmodifier.d.ts +2 -1
- package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +1 -1
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -310,9 +310,9 @@ class eA extends X {
|
|
|
310
310
|
const n = B / 2, a = this.BA(A - n, t - n), h = this.BA(A + n, t + n);
|
|
311
311
|
this.QA(a.nx, a.ny, h.nx, h.ny);
|
|
312
312
|
} else {
|
|
313
|
-
const n = -i / o, a = s / o, h = B / 2, C = A + n * h, D = t + a * h, c = A - n * h, u = t - a * h, f = e + n * h, d = r + a * h, m = e - n * h, p = r - a * h, M = this.BA(C, D),
|
|
313
|
+
const n = -i / o, a = s / o, h = B / 2, C = A + n * h, D = t + a * h, c = A - n * h, u = t - a * h, f = e + n * h, d = r + a * h, m = e - n * h, p = r - a * h, M = this.BA(C, D), b = this.BA(c, u), v = this.BA(f, d), z = this.BA(m, p), y = this.P;
|
|
314
314
|
this.AA(), y.bindBuffer(y.ARRAY_BUFFER, this.N);
|
|
315
|
-
const j = new Float32Array([M.nx, M.ny, 0, 0,
|
|
315
|
+
const j = new Float32Array([M.nx, M.ny, 0, 0, b.nx, b.ny, 0, 1, v.nx, v.ny, 1, 0, b.nx, b.ny, 0, 1, z.nx, z.ny, 1, 1, v.nx, v.ny, 1, 0]);
|
|
316
316
|
y.bufferData(y.ARRAY_BUFFER, j, y.DYNAMIC_DRAW);
|
|
317
317
|
}
|
|
318
318
|
const g = this.tA();
|
|
@@ -404,10 +404,10 @@ class rA {
|
|
|
404
404
|
}
|
|
405
405
|
$A(A, t, e, r) {
|
|
406
406
|
if (this.oA !== null) {
|
|
407
|
-
const c = (A + e) / 2, u = (t + r) / 2, f = Math.abs(e - A) || 1, d = Math.abs(r - t) || 1, { centerX: m, centerY: p, radians: M, aspectRatio:
|
|
408
|
-
this.GA("u_rotation", M), this.GA("u_center", [m, p]), this.GA("u_aspectRatio",
|
|
409
|
-
const
|
|
410
|
-
return this.aA.iA(A, t, e, r,
|
|
407
|
+
const c = (A + e) / 2, u = (t + r) / 2, f = Math.abs(e - A) || 1, d = Math.abs(r - t) || 1, { centerX: m, centerY: p, radians: M, aspectRatio: b } = this.YA(c - f / 2, u - d / 2, f, d);
|
|
408
|
+
this.GA("u_rotation", M), this.GA("u_center", [m, p]), this.GA("u_aspectRatio", b);
|
|
409
|
+
const v = this.CA > 0 ? this.CA : 1;
|
|
410
|
+
return this.aA.iA(A, t, e, r, v), void (this.oA = null);
|
|
411
411
|
}
|
|
412
412
|
if (!this.cA || this.CA <= 0) return;
|
|
413
413
|
const B = this.gA, s = (A + e) / 2, i = (t + r) / 2, o = Math.abs(e - A) || 1, g = Math.abs(r - t) || 1, n = this.uA !== 0;
|
|
@@ -1292,8 +1292,8 @@ const lA = (E) => class extends E {
|
|
|
1292
1292
|
};
|
|
1293
1293
|
class Y {
|
|
1294
1294
|
Ce(A) {
|
|
1295
|
-
const t = A.
|
|
1296
|
-
return
|
|
1295
|
+
const t = A.characterFramebuffer, e = A.primaryColorFramebuffer, r = A.secondaryColorFramebuffer, B = A.transformFramebuffer, s = A.rotationFramebuffer;
|
|
1296
|
+
return t == null || t.loadPixels(), e == null || e.loadPixels(), r == null || r.loadPixels(), B == null || B.loadPixels(), s == null || s.loadPixels(), { characterPixels: (t == null ? void 0 : t.pixels) || new Uint8Array(0), primaryColorPixels: (e == null ? void 0 : e.pixels) || new Uint8Array(0), secondaryColorPixels: (r == null ? void 0 : r.pixels) || new Uint8Array(0), transformPixels: (B == null ? void 0 : B.pixels) || new Uint8Array(0), rotationPixels: (s == null ? void 0 : s.pixels) || new Uint8Array(0) };
|
|
1297
1297
|
}
|
|
1298
1298
|
ce(A, t) {
|
|
1299
1299
|
return A[t] + (A[t + 1] << 8);
|
|
@@ -1663,12 +1663,12 @@ class xA {
|
|
|
1663
1663
|
this.Ke.sB(e, B, r);
|
|
1664
1664
|
}
|
|
1665
1665
|
}
|
|
1666
|
-
const
|
|
1666
|
+
const bA = (E) => class extends E {
|
|
1667
1667
|
toString(A = {}) {
|
|
1668
|
-
return new H().AB(this, A);
|
|
1668
|
+
return new H().AB({ pipeline: this.oB, grid: this.zt, font: this.et }, A);
|
|
1669
1669
|
}
|
|
1670
1670
|
saveStrings(A = {}) {
|
|
1671
|
-
new H().Xe(this, A);
|
|
1671
|
+
new H().Xe({ pipeline: this.oB, grid: this.zt, font: this.et }, A);
|
|
1672
1672
|
}
|
|
1673
1673
|
toSVG(A = {}) {
|
|
1674
1674
|
return new k().je(this, A);
|
|
@@ -1677,9 +1677,9 @@ const vA = (E) => class extends E {
|
|
|
1677
1677
|
new k().ze(this, A);
|
|
1678
1678
|
}
|
|
1679
1679
|
async saveCanvas(A, t = "png", e = {}) {
|
|
1680
|
-
await new xA().sB(this.
|
|
1680
|
+
await new xA().sB(this.bt, { ...e, filename: A, format: t });
|
|
1681
1681
|
}
|
|
1682
|
-
},
|
|
1682
|
+
}, vA = (E) => class extends E {
|
|
1683
1683
|
async loadFont(A) {
|
|
1684
1684
|
return this.et.It(A).then(() => {
|
|
1685
1685
|
const t = this.et.maxGlyphDimensions;
|
|
@@ -1705,13 +1705,13 @@ class _A {
|
|
|
1705
1705
|
Q(this, "WA");
|
|
1706
1706
|
Q(this, "et");
|
|
1707
1707
|
Q(this, "oB");
|
|
1708
|
-
Q(this, "
|
|
1708
|
+
Q(this, "bt");
|
|
1709
1709
|
Q(this, "zt");
|
|
1710
1710
|
}
|
|
1711
1711
|
}
|
|
1712
1712
|
class J extends function(t, ...e) {
|
|
1713
1713
|
return e.reduce((r, B) => B(r), t);
|
|
1714
|
-
}(_A, lA,
|
|
1714
|
+
}(_A, lA, bA, vA, yA) {
|
|
1715
1715
|
constructor(t = null, e = {}) {
|
|
1716
1716
|
super();
|
|
1717
1717
|
Q(this, "St");
|
|
@@ -1740,9 +1740,9 @@ class J extends function(t, ...e) {
|
|
|
1740
1740
|
static async create(t = null, e = {}) {
|
|
1741
1741
|
const r = new this(t, e), B = r.mB ? e : void 0;
|
|
1742
1742
|
let s, i;
|
|
1743
|
-
r.
|
|
1743
|
+
r.bt = new gA(r.captureSource, r.mB, B), r.WA = new rA(r.bt.Rt()), r.mB ? (s = e.width || 800, i = e.height || 600) : (s = r.bt.width || 800, i = r.bt.height || 600), r.nB = r.WA.TA(s, i), r.et = new QA(r.WA, e.fontSize ?? 16), await r.et.Ct(e.fontSource);
|
|
1744
1744
|
const o = r.et.maxGlyphDimensions;
|
|
1745
|
-
return r.zt = new oA(r.
|
|
1745
|
+
return r.zt = new oA(r.bt.canvas, o.width, o.height), r.oB = new hA(r.WA, r.et, r.zt), r.bB(), r.xB(), r;
|
|
1746
1746
|
}
|
|
1747
1747
|
bB() {
|
|
1748
1748
|
this.vB = () => {
|
|
@@ -1755,7 +1755,7 @@ class J extends function(t, ...e) {
|
|
|
1755
1755
|
this.MB(), this.IB++, this.dB ? console.warn("Cannot render: Required resources have been disposed") : (this.mB ? (this.nB.begin(), this.pB(), this.nB.end()) : this.nB.update(this.St), this.oB.hasEnabledConverters() ? (this.oB.le(this.nB), this.WA.SA(0), this.WA.kA(this.oB.texture, this.zt.offsetX, this.zt.offsetY, this.oB.texture.width, this.oB.texture.height)) : (this.WA.OA(), this.WA.kA(this.nB, this.zt.offsetX, this.zt.offsetY, this.nB.width, this.nB.height)));
|
|
1756
1756
|
}
|
|
1757
1757
|
yB() {
|
|
1758
|
-
this.
|
|
1758
|
+
this.bt.$t(), this.nB.resize(this.bt.width, this.bt.height), this.zt.$t(), this.oB.$t(), this.WA.UA(), this.aB !== "manual" && this.render();
|
|
1759
1759
|
}
|
|
1760
1760
|
xB() {
|
|
1761
1761
|
if (this.aB !== "auto" || !this.cB) return;
|
|
@@ -1806,7 +1806,7 @@ class J extends function(t, ...e) {
|
|
|
1806
1806
|
this._B = t;
|
|
1807
1807
|
}
|
|
1808
1808
|
resizeCanvas(t, e) {
|
|
1809
|
-
this.
|
|
1809
|
+
this.bt.$t(t, e), this.nB.resize(this.bt.width, this.bt.height), this.zt.$t(), this.oB.$t(), this.WA.UA(), this.aB !== "manual" && this.render();
|
|
1810
1810
|
}
|
|
1811
1811
|
destroy() {
|
|
1812
1812
|
this.dB || (this.GB(), window.removeEventListener("resize", this.vB), this.Ut && this.Ut.disconnect(), this.oB.S(), this.et.S(), this.nB.S(), this.WA.S(), this.dB = !0);
|
|
@@ -1830,10 +1830,13 @@ class J extends function(t, ...e) {
|
|
|
1830
1830
|
this.IB = t;
|
|
1831
1831
|
}
|
|
1832
1832
|
get width() {
|
|
1833
|
-
return this.
|
|
1833
|
+
return this.bt.width;
|
|
1834
1834
|
}
|
|
1835
1835
|
get height() {
|
|
1836
|
-
return this.
|
|
1836
|
+
return this.bt.height;
|
|
1837
|
+
}
|
|
1838
|
+
get canvas() {
|
|
1839
|
+
return this.bt;
|
|
1837
1840
|
}
|
|
1838
1841
|
get isDisposed() {
|
|
1839
1842
|
return this.dB;
|
|
@@ -1851,7 +1854,7 @@ class L {
|
|
|
1851
1854
|
P.u(A);
|
|
1852
1855
|
}
|
|
1853
1856
|
static get version() {
|
|
1854
|
-
return "0.1.
|
|
1857
|
+
return "0.1.7";
|
|
1855
1858
|
}
|
|
1856
1859
|
}
|
|
1857
1860
|
const MA = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), RA = L.create, FA = L.setErrorLevel, UA = L.version;
|
package/dist/textmode.esm.min.js
CHANGED
|
@@ -1291,8 +1291,8 @@ const gt = (a) => class extends a {
|
|
|
1291
1291
|
};
|
|
1292
1292
|
class j {
|
|
1293
1293
|
vr(t) {
|
|
1294
|
-
const e = t.
|
|
1295
|
-
return
|
|
1294
|
+
const e = t.characterFramebuffer, r = t.primaryColorFramebuffer, s = t.secondaryColorFramebuffer, i = t.transformFramebuffer, o = t.rotationFramebuffer;
|
|
1295
|
+
return e == null || e.loadPixels(), r == null || r.loadPixels(), s == null || s.loadPixels(), i == null || i.loadPixels(), o == null || o.loadPixels(), { characterPixels: (e == null ? void 0 : e.pixels) || new Uint8Array(0), primaryColorPixels: (r == null ? void 0 : r.pixels) || new Uint8Array(0), secondaryColorPixels: (s == null ? void 0 : s.pixels) || new Uint8Array(0), transformPixels: (i == null ? void 0 : i.pixels) || new Uint8Array(0), rotationPixels: (o == null ? void 0 : o.pixels) || new Uint8Array(0) };
|
|
1296
1296
|
}
|
|
1297
1297
|
br(t, e) {
|
|
1298
1298
|
return t[e] + (t[e + 1] << 8);
|
|
@@ -1664,10 +1664,10 @@ class Pt {
|
|
|
1664
1664
|
}
|
|
1665
1665
|
const Rt = (a) => class extends a {
|
|
1666
1666
|
toString(t = {}) {
|
|
1667
|
-
return new Y().ss(this, t);
|
|
1667
|
+
return new Y().ss({ pipeline: this._s, grid: this.je, font: this.oe }, t);
|
|
1668
1668
|
}
|
|
1669
1669
|
saveStrings(t = {}) {
|
|
1670
|
-
new Y().es(this, t);
|
|
1670
|
+
new Y().es({ pipeline: this._s, grid: this.je, font: this.oe }, t);
|
|
1671
1671
|
}
|
|
1672
1672
|
toSVG(t = {}) {
|
|
1673
1673
|
return new V().Jr(this, t);
|
|
@@ -1676,7 +1676,7 @@ const Rt = (a) => class extends a {
|
|
|
1676
1676
|
new V().Xr(this, t);
|
|
1677
1677
|
}
|
|
1678
1678
|
async saveCanvas(t, e = "png", r = {}) {
|
|
1679
|
-
await new Pt().us(this.
|
|
1679
|
+
await new Pt().us(this.Me, { ...r, filename: t, format: e });
|
|
1680
1680
|
}
|
|
1681
1681
|
}, Ft = (a) => class extends a {
|
|
1682
1682
|
async loadFont(t) {
|
|
@@ -1704,7 +1704,7 @@ class At {
|
|
|
1704
1704
|
h(this, "Zt");
|
|
1705
1705
|
h(this, "oe");
|
|
1706
1706
|
h(this, "_s");
|
|
1707
|
-
h(this, "
|
|
1707
|
+
h(this, "Me");
|
|
1708
1708
|
h(this, "je");
|
|
1709
1709
|
}
|
|
1710
1710
|
}
|
|
@@ -1739,9 +1739,9 @@ class O extends function(e, ...r) {
|
|
|
1739
1739
|
static async create(e = null, r = {}) {
|
|
1740
1740
|
const s = new this(e, r), i = s.zs ? r : void 0;
|
|
1741
1741
|
let o, n;
|
|
1742
|
-
s.
|
|
1742
|
+
s.Me = new ct(s.captureSource, s.zs, i), s.Zt = new st(s.Me.He()), s.zs ? (o = r.width || 800, n = r.height || 600) : (o = s.Me.width || 800, n = s.Me.height || 600), s.vs = s.Zt.Et(o, n), s.oe = new ht(s.Zt, r.fontSize ?? 16), await s.oe.ve(r.fontSource);
|
|
1743
1743
|
const l = s.oe.maxGlyphDimensions;
|
|
1744
|
-
return s.je = new lt(s.
|
|
1744
|
+
return s.je = new lt(s.Me.canvas, l.width, l.height), s._s = new ft(s.Zt, s.oe, s.je), s.As(), s.Gs(), s;
|
|
1745
1745
|
}
|
|
1746
1746
|
As() {
|
|
1747
1747
|
this.Us = () => {
|
|
@@ -1754,7 +1754,7 @@ class O extends function(e, ...r) {
|
|
|
1754
1754
|
this.Ls(), this.Ss++, this.ks ? console.warn("Cannot render: Required resources have been disposed") : (this.zs ? (this.vs.begin(), this.Is(), this.vs.end()) : this.vs.update(this.Ae), this._s.hasEnabledConverters() ? (this._s._r(this.vs), this.Zt.Lt(0), this.Zt.Ot(this._s.texture, this.je.offsetX, this.je.offsetY, this._s.texture.width, this._s.texture.height)) : (this.Zt.Bt(), this.Zt.Ot(this.vs, this.je.offsetX, this.je.offsetY, this.vs.width, this.vs.height)));
|
|
1755
1755
|
}
|
|
1756
1756
|
Es() {
|
|
1757
|
-
this.
|
|
1757
|
+
this.Me.Pe(), this.vs.resize(this.Me.width, this.Me.height), this.je.Pe(), this._s.Pe(), this.Zt.Ht(), this.bs !== "manual" && this.render();
|
|
1758
1758
|
}
|
|
1759
1759
|
Gs() {
|
|
1760
1760
|
if (this.bs !== "auto" || !this.Ts) return;
|
|
@@ -1805,7 +1805,7 @@ class O extends function(e, ...r) {
|
|
|
1805
1805
|
this.Ps = e;
|
|
1806
1806
|
}
|
|
1807
1807
|
resizeCanvas(e, r) {
|
|
1808
|
-
this.
|
|
1808
|
+
this.Me.Pe(e, r), this.vs.resize(this.Me.width, this.Me.height), this.je.Pe(), this._s.Pe(), this.Zt.Ht(), this.bs !== "manual" && this.render();
|
|
1809
1809
|
}
|
|
1810
1810
|
destroy() {
|
|
1811
1811
|
this.ks || (this.Bs(), window.removeEventListener("resize", this.Us), this.Ee && this.Ee.disconnect(), this._s.P(), this.oe.P(), this.vs.P(), this.Zt.P(), this.ks = !0);
|
|
@@ -1829,10 +1829,13 @@ class O extends function(e, ...r) {
|
|
|
1829
1829
|
this.Ss = e;
|
|
1830
1830
|
}
|
|
1831
1831
|
get width() {
|
|
1832
|
-
return this.
|
|
1832
|
+
return this.Me.width;
|
|
1833
1833
|
}
|
|
1834
1834
|
get height() {
|
|
1835
|
-
return this.
|
|
1835
|
+
return this.Me.height;
|
|
1836
|
+
}
|
|
1837
|
+
get canvas() {
|
|
1838
|
+
return this.Me;
|
|
1836
1839
|
}
|
|
1837
1840
|
get isDisposed() {
|
|
1838
1841
|
return this.ks;
|
|
@@ -1850,7 +1853,7 @@ class N {
|
|
|
1850
1853
|
C._(t);
|
|
1851
1854
|
}
|
|
1852
1855
|
static get version() {
|
|
1853
|
-
return "0.1.
|
|
1856
|
+
return "0.1.7";
|
|
1854
1857
|
}
|
|
1855
1858
|
}
|
|
1856
1859
|
const St = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), Zt = N.create, $t = N.setErrorLevel, Bt = N.version;
|