textmode.js 0.1.8-beta.3 → 0.1.8
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
CHANGED
|
@@ -2044,7 +2044,7 @@ class j {
|
|
|
2044
2044
|
u.u(A);
|
|
2045
2045
|
}
|
|
2046
2046
|
static get version() {
|
|
2047
|
-
return "0.1.8
|
|
2047
|
+
return "0.1.8";
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
2050
|
const LA = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), kA = j.create, jA = j.setErrorLevel, VA = j.version;
|
package/dist/textmode.esm.min.js
CHANGED
|
@@ -2043,7 +2043,7 @@ class V {
|
|
|
2043
2043
|
x._(t);
|
|
2044
2044
|
}
|
|
2045
2045
|
static get version() {
|
|
2046
|
-
return "0.1.8
|
|
2046
|
+
return "0.1.8";
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
2049
|
const Yt = Object.freeze(Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), Ht = V.create, Vt = V.setErrorLevel, Wt = V.version;
|
package/dist/textmode.umd.js
CHANGED
|
@@ -61,4 +61,4 @@ void main() {\r
|
|
|
61
61
|
<g id="ascii-cells">`;for(const E of e)B+=this.Es(E,s,r,i);return B+=this.es(),B}ns(e){return e.replace(/<path[^>]*d=""[^>]*\/>/g,"").replace(/\n\s*\n/g,`
|
|
62
62
|
`).replace(/[ \t]+$/gm,"")}}class xA extends N{hs(e){return this.ke(e,"image/svg+xml;charset=utf-8")}ls(e,s){this.Ve(e,this.ze(s)+".svg","image/svg+xml;charset=utf-8")}cs(e,s){this.ls(e,s||this.Le())}}class sA{constructor(){n(this,"Ds");n(this,"Cs");n(this,"us");this.Ds=new wA,this.Cs=new mA,this.us=new xA}Ps(e){return{includeBackgroundRectangles:e.includeBackgroundRectangles??!0,drawMode:e.drawMode??"fill",strokeWidth:e.strokeWidth??1,backgroundColor:e.backgroundColor??[0,0,0,0]}}Is(e,s={}){const r=this.Ps(s),i=this.Ds.Se(e.pipeline),B=this.Ds.Ke(i,e.grid),E=this.Cs.gs(B,e.grid,e.font,r);return this.Cs.ns(E)}cs(e,s={}){const r=this.Is(e,s),i=s.filename||this.us.Le();this.us.cs(r,i)}}class bA extends ${ws(e,s,r,i=" "){var o;const B=[];let E=0;for(let g=0;g<s.rows;g++){const h=[];for(let a=0;a<s.cols;a++){const c=4*E,l=this.Oe(e.characterPixels,c),u=((o=r.characters[l])==null?void 0:o.character)||i;h.push(u),E++}B.push(h)}return B}}class vA{fs(e,s){const r=[];for(const B of e){let E=B.join("");s.preserveTrailingSpaces||(E=E.replace(/\s+$/,"")),r.push(E)}const i=s.lineEnding==="crlf"?`\r
|
|
63
63
|
`:`
|
|
64
|
-
`;return r.join(i)}}class yA extends N{ds(e,s){const r=this.ps(s);this.Ve(e,r,"text/plain;charset=utf-8")}ps(e){let s=this.ze(e);return s===".txt"||s.length<=4?this.Le():s}}class rA{constructor(){n(this,"Ds");n(this,"Cs");n(this,"us");this.Ds=new bA,this.Cs=new vA,this.us=new yA}Ps(e){return{preserveTrailingSpaces:e.preserveTrailingSpaces??!1,lineEnding:e.lineEnding??"lf",emptyCharacter:e.emptyCharacter??" "}}_s(e,s={}){const r=this.Ps(s),i=this.Ds.Se(e.pipeline),B=this.Ds.ws(i,e.grid,e.font,r.emptyCharacter);return this.Cs.fs(B,r)}ds(e,s={}){const r=this._s(e,s),i=s.filename||this.us.Le();this.us.ds(r,i)}}class _A extends ${vs(e,s=1,r="transparent"){const i=e.canvas;if(s===1&&r==="transparent")return i;const B=document.createElement("canvas"),E=B.getContext("2d"),o=Math.round(i.width*s),g=Math.round(i.height*s);return B.width=o,B.height=g,r!=="transparent"&&(E.fillStyle=r,E.fillRect(0,0,o,g)),E.imageSmoothingEnabled=!1,E.drawImage(i,0,0,i.width,i.height,0,0,o,g),B}}class MA{bs(e,s){const r=this.Ms(s.format);return s.format==="png"?e.toDataURL(r):e.toDataURL(r,s.quality)}async Gs(e,s){return new Promise((r,i)=>{const B=this.Ms(s.format),E=o=>{o?r(o):i(Error(`Failed to generate ${s.format.toUpperCase()} blob`))};s.format==="png"?e.toBlob(E,B):e.toBlob(E,B,s.quality)})}Ms(e){switch(e){case"png":return"image/png";case"jpg":return"image/jpeg";case"webp":return"image/webp";default:throw Error("Unsupported image format: "+e)}}}const TA={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},iA={png:".png",jpg:".jpg",webp:".webp"};class GA extends N{Fs(e,s,r){this.$s(e,this.ze(s)+iA[r])}$s(e,s){const r=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=r,i.download=s,i.style.display="none",i.rel="noopener",document.body.appendChild(i),i.click(),document.body.removeChild(i)}finally{URL.revokeObjectURL(r)}}Ys(e){return e in TA&&e in iA}}class RA{constructor(){n(this,"Ds");n(this,"Cs");n(this,"us");this.Ds=new _A,this.Cs=new MA,this.us=new GA}Ps(e){return{format:e.format??"png",quality:e.quality??1,scale:e.scale??1,backgroundColor:e.backgroundColor??"transparent"}}Ts(e){if(console.log("Validating image export options:",e),!this.us.Ys(e.format))throw Error(`Saving '${e.format}' files is not supported`);if(e.quality<0||e.quality>1)throw Error("Image quality must be between 0.0 and 1.0");if(e.scale<=0)throw Error("Scale factor must be greater than 0");e.scale>10&&console.warn("Large scale factors may result in very large files and slow performance"),e.format==="jpg"&&e.backgroundColor==="transparent"&&(e.backgroundColor="black")}Ss(e,s={}){const r=this.Ps(s);if(this.Ts(r),r.scale===1&&r.backgroundColor==="transparent")return this.Cs.bs(e.canvas,r);const i=this.Ds.vs(e,r.scale,r.backgroundColor);return this.Cs.bs(i,r)}async Gs(e,s={}){const r=this.Ps(s);if(this.Ts(r),r.scale===1&&r.backgroundColor==="transparent")return await this.Cs.Gs(e.canvas,r);const i=this.Ds.vs(e,r.scale,r.backgroundColor);return await this.Cs.Gs(i,r)}async Fs(e,s={}){const r=await this.Gs(e,s),i=s.format??"png",B=s.filename||this.us.Le();this.us.Fs(r,B,i)}}const FA=Q=>class extends Q{toString(e={}){return new rA()._s({pipeline:this.Os,grid:this.ne,font:this._t},e)}saveStrings(e={}){new rA().ds({pipeline:this.Os,grid:this.ne,font:this._t},e)}toSVG(e={}){return new sA().Is(this,e)}saveSVG(e={}){new sA().cs(this,e)}async saveCanvas(e,s="png",r={}){await new RA().Fs(this.Wt,{...r,filename:e,format:s})}},UA=Q=>class extends Q{async loadFont(e){return this._t.Ht(e).then(()=>{const s=this._t.maxGlyphDimensions;this.ne.qt(s.width,s.height),this.Os.ee()})}fontSize(e){if(!I.C(typeof e=="number"&&e>0,"Font size must be a positive number greater than 0.",{method:"fontSize",providedValue:e})||this._t.fontSize===e)return;this._t.Rt(e);const s=this._t.maxGlyphDimensions;this.ne.qt(s.width,s.height),this.Os.ee(),this.Dt.UA()}},YA=Q=>class extends Q{addConverter(e){return this.Os.add(e)}removeConverter(e){this.Os.remove(e)}};class SA{constructor(){n(this,"Dt");n(this,"_t");n(this,"Os");n(this,"Wt");n(this,"ne")}}class z extends function(s,...r){return r.reduce((i,B)=>B(i),s)}(SA,fA,FA,UA,YA){constructor(s=null,r={}){super();n(this,"re");n(this,"Us");n(this,"ie");n(this,"ks");n(this,"Vs");n(this,"Rs",null);n(this,"Hs",0);n(this,"zs");n(this,"Ls",!0);n(this,"Js",0);n(this,"js",0);n(this,"Ks",0);n(this,"Ws",[]);n(this,"Ns",10);n(this,"Zs",!1);n(this,"Xs",!1);n(this,"qs",()=>{});n(this,"Ar",()=>{});n(this,"tr");this.re=s,this.Xs=s===null,this.ks=r.renderMode??"auto",this.Vs=r.frameRate??60,this.zs=1e3/this.Vs}static async create(s=null,r={}){const i=new this(s,r),B=i.Xs?r:void 0;let E,o;i.Wt=new tA(i.re,i.Xs,B),i.Dt=new QA(i.Wt.ge()),i.Xs?(E=r.width||800,o=r.height||600):(E=i.Wt.width||800,o=i.Wt.height||600),i.Us=i.Dt.TA(E,o),i._t=new q(i.Dt,r.fontSize??16),await i._t.Ut(r.fontSource);const g=i._t.maxGlyphDimensions;return i.ne=new AA(i.Wt.canvas,g.width,g.height),i.Os=new eA(i.Dt,i._t,i.ne),i.er(),i.sr(),i}er(){this.tr=()=>{this.Xs?this.Ar():this.rr()},window.addEventListener("resize",this.tr),window.ResizeObserver&&this.re&&!this.Xs&&(this.ie=new ResizeObserver(()=>{this.rr()}),this.ie.observe(this.re))}render(){this.Br(),this.Ks++,this.Zs?console.warn("Cannot render: Required resources have been disposed"):(this.Xs?(this.Us.begin(),this.qs(),this.Us.end()):this.Us.update(this.re),this.Os.hasEnabledConverters()?(this.Os.Te(this.Us),this.Dt.SA(0),this.Dt.kA(this.Os.texture,this.ne.offsetX,this.ne.offsetY,this.Os.texture.width,this.Os.texture.height)):(this.Dt.OA(),this.Dt.kA(this.Us,this.ne.offsetX,this.ne.offsetY,this.Us.width,this.Us.height)))}rr(){this.Wt.ee(),this.Us.resize(this.Wt.width,this.Wt.height),this.ne.ee(),this.Os.ee(),this.Dt.UA(),this.ks!=="manual"&&this.render()}sr(){if(this.ks!=="auto"||!this.Ls)return;this.Hs=performance.now();const s=r=>{if(!this.Ls)return void(this.Rs=null);const i=r-this.Hs;i>=this.zs&&(this.render(),this.Hs=r-i%this.zs),this.Ls&&(this.Rs=requestAnimationFrame(s))};this.Rs=requestAnimationFrame(s)}Br(){const s=performance.now();if(this.js>0){const r=s-this.js;this.Ws.push(r),this.Ws.length>this.Ns&&this.Ws.shift();const i=this.Ws.reduce((B,E)=>B+E,0)/this.Ws.length;this.Js=1e3/i}this.js=s}ir(){this.Rs&&(cancelAnimationFrame(this.Rs),this.Rs=null)}renderMode(s){this.ks!==s&&(this.ir(),this.ks=s,s==="auto"&&this.Ls&&this.sr())}frameRate(s){if(s===void 0)return this.Js;this.Vs=s,this.zs=1e3/s,this.ks==="auto"&&this.Ls&&(this.ir(),this.sr())}noLoop(){this.Ls&&(this.Ls=!1,this.Rs&&(cancelAnimationFrame(this.Rs),this.Rs=null))}loop(){this.Ls||(this.Ls=!0,this.ks==="auto"&&this.sr())}redraw(s=1){if(I.C(typeof s=="number"&&s>0&&Number.isInteger(s),"Redraw count must be a positive integer.",{method:"redraw",providedValue:s}))for(let r=0;r<s;r++)this.render()}isLooping(){return this.ks==="auto"&&this.Ls}draw(s){this.qs=s}windowResized(s){this.Ar=s}resizeCanvas(s,r){this.Xs&&(this.Wt.ee(s,r),this.Us.resize(this.Wt.width,this.Wt.height),this.ne.ee(),this.Os.ee(),this.Dt.UA(),this.ks!=="manual"&&this.render())}destroy(){this.Zs||(this.ir(),window.removeEventListener("resize",this.tr),this.ie&&this.ie.disconnect(),this.Os.S(),this._t.S(),this.Us.S(),this.Dt.S(),this.Zs=!0)}get grid(){return this.ne}get font(){return this._t}get mode(){return this.ks}get pipeline(){return this.Os}get frameCount(){return this.Ks}set frameCount(s){this.Ks=s}get width(){return this.Wt.width}get height(){return this.Wt.height}get canvas(){return this.Wt}get isDisposed(){return this.Zs}}class Y{constructor(){throw new P("Textmode is a static class and cannot be instantiated.")}static async create(e,s={}){if(!(e==null||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||typeof e=="object"))throw new P("First parameter must be HTMLCanvasElement, HTMLVideoElement, or options object.");if(typeof s!="object")throw new P("Second parameter must be an options object.");if(e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement)return z.create(e,s);{const r=e||{};return z.create(null,r)}}static setErrorLevel(e){I.u(e)}static get version(){return"0.1.8
|
|
64
|
+
`;return r.join(i)}}class yA extends N{ds(e,s){const r=this.ps(s);this.Ve(e,r,"text/plain;charset=utf-8")}ps(e){let s=this.ze(e);return s===".txt"||s.length<=4?this.Le():s}}class rA{constructor(){n(this,"Ds");n(this,"Cs");n(this,"us");this.Ds=new bA,this.Cs=new vA,this.us=new yA}Ps(e){return{preserveTrailingSpaces:e.preserveTrailingSpaces??!1,lineEnding:e.lineEnding??"lf",emptyCharacter:e.emptyCharacter??" "}}_s(e,s={}){const r=this.Ps(s),i=this.Ds.Se(e.pipeline),B=this.Ds.ws(i,e.grid,e.font,r.emptyCharacter);return this.Cs.fs(B,r)}ds(e,s={}){const r=this._s(e,s),i=s.filename||this.us.Le();this.us.ds(r,i)}}class _A extends ${vs(e,s=1,r="transparent"){const i=e.canvas;if(s===1&&r==="transparent")return i;const B=document.createElement("canvas"),E=B.getContext("2d"),o=Math.round(i.width*s),g=Math.round(i.height*s);return B.width=o,B.height=g,r!=="transparent"&&(E.fillStyle=r,E.fillRect(0,0,o,g)),E.imageSmoothingEnabled=!1,E.drawImage(i,0,0,i.width,i.height,0,0,o,g),B}}class MA{bs(e,s){const r=this.Ms(s.format);return s.format==="png"?e.toDataURL(r):e.toDataURL(r,s.quality)}async Gs(e,s){return new Promise((r,i)=>{const B=this.Ms(s.format),E=o=>{o?r(o):i(Error(`Failed to generate ${s.format.toUpperCase()} blob`))};s.format==="png"?e.toBlob(E,B):e.toBlob(E,B,s.quality)})}Ms(e){switch(e){case"png":return"image/png";case"jpg":return"image/jpeg";case"webp":return"image/webp";default:throw Error("Unsupported image format: "+e)}}}const TA={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},iA={png:".png",jpg:".jpg",webp:".webp"};class GA extends N{Fs(e,s,r){this.$s(e,this.ze(s)+iA[r])}$s(e,s){const r=URL.createObjectURL(e);try{const i=document.createElement("a");i.href=r,i.download=s,i.style.display="none",i.rel="noopener",document.body.appendChild(i),i.click(),document.body.removeChild(i)}finally{URL.revokeObjectURL(r)}}Ys(e){return e in TA&&e in iA}}class RA{constructor(){n(this,"Ds");n(this,"Cs");n(this,"us");this.Ds=new _A,this.Cs=new MA,this.us=new GA}Ps(e){return{format:e.format??"png",quality:e.quality??1,scale:e.scale??1,backgroundColor:e.backgroundColor??"transparent"}}Ts(e){if(console.log("Validating image export options:",e),!this.us.Ys(e.format))throw Error(`Saving '${e.format}' files is not supported`);if(e.quality<0||e.quality>1)throw Error("Image quality must be between 0.0 and 1.0");if(e.scale<=0)throw Error("Scale factor must be greater than 0");e.scale>10&&console.warn("Large scale factors may result in very large files and slow performance"),e.format==="jpg"&&e.backgroundColor==="transparent"&&(e.backgroundColor="black")}Ss(e,s={}){const r=this.Ps(s);if(this.Ts(r),r.scale===1&&r.backgroundColor==="transparent")return this.Cs.bs(e.canvas,r);const i=this.Ds.vs(e,r.scale,r.backgroundColor);return this.Cs.bs(i,r)}async Gs(e,s={}){const r=this.Ps(s);if(this.Ts(r),r.scale===1&&r.backgroundColor==="transparent")return await this.Cs.Gs(e.canvas,r);const i=this.Ds.vs(e,r.scale,r.backgroundColor);return await this.Cs.Gs(i,r)}async Fs(e,s={}){const r=await this.Gs(e,s),i=s.format??"png",B=s.filename||this.us.Le();this.us.Fs(r,B,i)}}const FA=Q=>class extends Q{toString(e={}){return new rA()._s({pipeline:this.Os,grid:this.ne,font:this._t},e)}saveStrings(e={}){new rA().ds({pipeline:this.Os,grid:this.ne,font:this._t},e)}toSVG(e={}){return new sA().Is(this,e)}saveSVG(e={}){new sA().cs(this,e)}async saveCanvas(e,s="png",r={}){await new RA().Fs(this.Wt,{...r,filename:e,format:s})}},UA=Q=>class extends Q{async loadFont(e){return this._t.Ht(e).then(()=>{const s=this._t.maxGlyphDimensions;this.ne.qt(s.width,s.height),this.Os.ee()})}fontSize(e){if(!I.C(typeof e=="number"&&e>0,"Font size must be a positive number greater than 0.",{method:"fontSize",providedValue:e})||this._t.fontSize===e)return;this._t.Rt(e);const s=this._t.maxGlyphDimensions;this.ne.qt(s.width,s.height),this.Os.ee(),this.Dt.UA()}},YA=Q=>class extends Q{addConverter(e){return this.Os.add(e)}removeConverter(e){this.Os.remove(e)}};class SA{constructor(){n(this,"Dt");n(this,"_t");n(this,"Os");n(this,"Wt");n(this,"ne")}}class z extends function(s,...r){return r.reduce((i,B)=>B(i),s)}(SA,fA,FA,UA,YA){constructor(s=null,r={}){super();n(this,"re");n(this,"Us");n(this,"ie");n(this,"ks");n(this,"Vs");n(this,"Rs",null);n(this,"Hs",0);n(this,"zs");n(this,"Ls",!0);n(this,"Js",0);n(this,"js",0);n(this,"Ks",0);n(this,"Ws",[]);n(this,"Ns",10);n(this,"Zs",!1);n(this,"Xs",!1);n(this,"qs",()=>{});n(this,"Ar",()=>{});n(this,"tr");this.re=s,this.Xs=s===null,this.ks=r.renderMode??"auto",this.Vs=r.frameRate??60,this.zs=1e3/this.Vs}static async create(s=null,r={}){const i=new this(s,r),B=i.Xs?r:void 0;let E,o;i.Wt=new tA(i.re,i.Xs,B),i.Dt=new QA(i.Wt.ge()),i.Xs?(E=r.width||800,o=r.height||600):(E=i.Wt.width||800,o=i.Wt.height||600),i.Us=i.Dt.TA(E,o),i._t=new q(i.Dt,r.fontSize??16),await i._t.Ut(r.fontSource);const g=i._t.maxGlyphDimensions;return i.ne=new AA(i.Wt.canvas,g.width,g.height),i.Os=new eA(i.Dt,i._t,i.ne),i.er(),i.sr(),i}er(){this.tr=()=>{this.Xs?this.Ar():this.rr()},window.addEventListener("resize",this.tr),window.ResizeObserver&&this.re&&!this.Xs&&(this.ie=new ResizeObserver(()=>{this.rr()}),this.ie.observe(this.re))}render(){this.Br(),this.Ks++,this.Zs?console.warn("Cannot render: Required resources have been disposed"):(this.Xs?(this.Us.begin(),this.qs(),this.Us.end()):this.Us.update(this.re),this.Os.hasEnabledConverters()?(this.Os.Te(this.Us),this.Dt.SA(0),this.Dt.kA(this.Os.texture,this.ne.offsetX,this.ne.offsetY,this.Os.texture.width,this.Os.texture.height)):(this.Dt.OA(),this.Dt.kA(this.Us,this.ne.offsetX,this.ne.offsetY,this.Us.width,this.Us.height)))}rr(){this.Wt.ee(),this.Us.resize(this.Wt.width,this.Wt.height),this.ne.ee(),this.Os.ee(),this.Dt.UA(),this.ks!=="manual"&&this.render()}sr(){if(this.ks!=="auto"||!this.Ls)return;this.Hs=performance.now();const s=r=>{if(!this.Ls)return void(this.Rs=null);const i=r-this.Hs;i>=this.zs&&(this.render(),this.Hs=r-i%this.zs),this.Ls&&(this.Rs=requestAnimationFrame(s))};this.Rs=requestAnimationFrame(s)}Br(){const s=performance.now();if(this.js>0){const r=s-this.js;this.Ws.push(r),this.Ws.length>this.Ns&&this.Ws.shift();const i=this.Ws.reduce((B,E)=>B+E,0)/this.Ws.length;this.Js=1e3/i}this.js=s}ir(){this.Rs&&(cancelAnimationFrame(this.Rs),this.Rs=null)}renderMode(s){this.ks!==s&&(this.ir(),this.ks=s,s==="auto"&&this.Ls&&this.sr())}frameRate(s){if(s===void 0)return this.Js;this.Vs=s,this.zs=1e3/s,this.ks==="auto"&&this.Ls&&(this.ir(),this.sr())}noLoop(){this.Ls&&(this.Ls=!1,this.Rs&&(cancelAnimationFrame(this.Rs),this.Rs=null))}loop(){this.Ls||(this.Ls=!0,this.ks==="auto"&&this.sr())}redraw(s=1){if(I.C(typeof s=="number"&&s>0&&Number.isInteger(s),"Redraw count must be a positive integer.",{method:"redraw",providedValue:s}))for(let r=0;r<s;r++)this.render()}isLooping(){return this.ks==="auto"&&this.Ls}draw(s){this.qs=s}windowResized(s){this.Ar=s}resizeCanvas(s,r){this.Xs&&(this.Wt.ee(s,r),this.Us.resize(this.Wt.width,this.Wt.height),this.ne.ee(),this.Os.ee(),this.Dt.UA(),this.ks!=="manual"&&this.render())}destroy(){this.Zs||(this.ir(),window.removeEventListener("resize",this.tr),this.ie&&this.ie.disconnect(),this.Os.S(),this._t.S(),this.Us.S(),this.Dt.S(),this.Zs=!0)}get grid(){return this.ne}get font(){return this._t}get mode(){return this.ks}get pipeline(){return this.Os}get frameCount(){return this.Ks}set frameCount(s){this.Ks=s}get width(){return this.Wt.width}get height(){return this.Wt.height}get canvas(){return this.Wt}get isDisposed(){return this.Zs}}class Y{constructor(){throw new P("Textmode is a static class and cannot be instantiated.")}static async create(e,s={}){if(!(e==null||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||typeof e=="object"))throw new P("First parameter must be HTMLCanvasElement, HTMLVideoElement, or options object.");if(typeof s!="object")throw new P("Second parameter must be an options object.");if(e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement)return z.create(e,s);{const r=e||{};return z.create(null,r)}}static setErrorLevel(e){I.u(e)}static get version(){return"0.1.8"}}const OA=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),WA=Y.create,LA=Y.setErrorLevel,kA=Y.version;d.TextmodeCanvas=tA,d.TextmodeConversionPipeline=eA,d.TextmodeErrorLevel=M,d.TextmodeFont=q,d.TextmodeGrid=AA,d.Textmodifier=z,d.converters=IA,d.create=WA,d.default=Y,d.export=OA,d.setErrorLevel=LA,d.textmode=Y,d.version=kA,Object.defineProperties(d,{Qr:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):t((A=typeof globalThis<"u"?globalThis:A||self).textmode={});
|
package/dist/textmode.umd.min.js
CHANGED
|
@@ -60,4 +60,4 @@ void main() {\r
|
|
|
60
60
|
<g id="ascii-cells">`;for(const h of r)o+=this.mr(h,s,i,n);return o+=this.lr(),o}_r(r){return r.replace(/<path[^>]*d=""[^>]*\/>/g,"").replace(/\n\s*\n/g,`
|
|
61
61
|
`).replace(/[ \t]+$/gm,"")}}class Rt extends z{vr(r){return this.Ns(r,"image/svg+xml;charset=utf-8")}br(r,s){this.Xs(r,this.Qs(s)+".svg","image/svg+xml;charset=utf-8")}wr(r,s){this.br(r,s||this.Zs())}}class st{constructor(){c(this,"Cr");c(this,"yr");c(this,"$r");this.Cr=new _t,this.yr=new Et,this.$r=new Rt}Fr(r){return{includeBackgroundRectangles:r.includeBackgroundRectangles??!0,drawMode:r.drawMode??"fill",strokeWidth:r.strokeWidth??1,backgroundColor:r.backgroundColor??[0,0,0,0]}}Tr(r,s={}){const i=this.Fr(s),n=this.Cr.Os(r.pipeline),o=this.Cr.tr(n,r.grid),h=this.yr.gr(o,r.grid,r.font,i);return this.yr._r(h)}wr(r,s={}){const i=this.Tr(r,s),n=s.filename||this.$r.Zs();this.$r.wr(i,n)}}class Ft extends N{Mr(r,s,i,n=" "){var a;const o=[];let h=0;for(let u=0;u<s.rows;u++){const d=[];for(let f=0;f<s.cols;f++){const p=4*h,g=this.Bs(r.characterPixels,p),x=((a=i.characters[g])==null?void 0:a.character)||n;d.push(x),h++}o.push(d)}return o}}class Mt{Sr(r,s){const i=[];for(const o of r){let h=o.join("");s.preserveTrailingSpaces||(h=h.replace(/\s+$/,"")),i.push(h)}const n=s.lineEnding==="crlf"?`\r
|
|
62
62
|
`:`
|
|
63
|
-
`;return i.join(n)}}class At extends z{Dr(r,s){const i=this.Rr(s);this.Xs(r,i,"text/plain;charset=utf-8")}Rr(r){let s=this.Qs(r);return s===".txt"||s.length<=4?this.Zs():s}}class it{constructor(){c(this,"Cr");c(this,"yr");c(this,"$r");this.Cr=new Ft,this.yr=new Mt,this.$r=new At}Fr(r){return{preserveTrailingSpaces:r.preserveTrailingSpaces??!1,lineEnding:r.lineEnding??"lf",emptyCharacter:r.emptyCharacter??" "}}Vr(r,s={}){const i=this.Fr(s),n=this.Cr.Os(r.pipeline),o=this.Cr.Mr(n,r.grid,r.font,i.emptyCharacter);return this.yr.Sr(o,i)}Dr(r,s={}){const i=this.Vr(r,s),n=s.filename||this.$r.Zs();this.$r.Dr(i,n)}}class Pt extends N{kr(r,s=1,i="transparent"){const n=r.canvas;if(s===1&&i==="transparent")return n;const o=document.createElement("canvas"),h=o.getContext("2d"),a=Math.round(n.width*s),u=Math.round(n.height*s);return o.width=a,o.height=u,i!=="transparent"&&(h.fillStyle=i,h.fillRect(0,0,a,u)),h.imageSmoothingEnabled=!1,h.drawImage(n,0,0,n.width,n.height,0,0,a,u),o}}class Ut{Ir(r,s){const i=this.zr(s.format);return s.format==="png"?r.toDataURL(i):r.toDataURL(i,s.quality)}async Er(r,s){return new Promise((i,n)=>{const o=this.zr(s.format),h=a=>{a?i(a):n(Error(`Failed to generate ${s.format.toUpperCase()} blob`))};s.format==="png"?r.toBlob(h,o):r.toBlob(h,o,s.quality)})}zr(r){switch(r){case"png":return"image/png";case"jpg":return"image/jpeg";case"webp":return"image/webp";default:throw Error("Unsupported image format: "+r)}}}const Dt={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},nt={png:".png",jpg:".jpg",webp:".webp"};class St extends z{Gr(r,s,i){this.Pr(r,this.Qs(s)+nt[i])}Pr(r,s){const i=URL.createObjectURL(r);try{const n=document.createElement("a");n.href=i,n.download=s,n.style.display="none",n.rel="noopener",document.body.appendChild(n),n.click(),document.body.removeChild(n)}finally{URL.revokeObjectURL(i)}}Ar(r){return r in Dt&&r in nt}}class $t{constructor(){c(this,"Cr");c(this,"yr");c(this,"$r");this.Cr=new Pt,this.yr=new Ut,this.$r=new St}Fr(r){return{format:r.format??"png",quality:r.quality??1,scale:r.scale??1,backgroundColor:r.backgroundColor??"transparent"}}Ur(r){if(console.log("Validating image export options:",r),!this.$r.Ar(r.format))throw Error(`Saving '${r.format}' files is not supported`);if(r.quality<0||r.quality>1)throw Error("Image quality must be between 0.0 and 1.0");if(r.scale<=0)throw Error("Scale factor must be greater than 0");r.scale>10&&console.warn("Large scale factors may result in very large files and slow performance"),r.format==="jpg"&&r.backgroundColor==="transparent"&&(r.backgroundColor="black")}Lr(r,s={}){const i=this.Fr(s);if(this.Ur(i),i.scale===1&&i.backgroundColor==="transparent")return this.yr.Ir(r.canvas,i);const n=this.Cr.kr(r,i.scale,i.backgroundColor);return this.yr.Ir(n,i)}async Er(r,s={}){const i=this.Fr(s);if(this.Ur(i),i.scale===1&&i.backgroundColor==="transparent")return await this.yr.Er(r.canvas,i);const n=this.Cr.kr(r,i.scale,i.backgroundColor);return await this.yr.Er(n,i)}async Gr(r,s={}){const i=await this.Er(r,s),n=s.format??"png",o=s.filename||this.$r.Zs();this.$r.Gr(i,o,n)}}const It=l=>class extends l{toString(r={}){return new it().Vr({pipeline:this.jr,grid:this.ps,font:this.Te},r)}saveStrings(r={}){new it().Dr({pipeline:this.jr,grid:this.ps,font:this.Te},r)}toSVG(r={}){return new st().Tr(this,r)}saveSVG(r={}){new st().wr(this,r)}async saveCanvas(r,s="png",i={}){await new $t().Gr(this.Ye,{...i,filename:r,format:s})}},Gt=l=>class extends l{async loadFont(r){return this.Te.Oe(r).then(()=>{const s=this.Te.maxGlyphDimensions;this.ps.Ke(s.width,s.height),this.jr.ss()})}fontSize(r){if(!C.m(typeof r=="number"&&r>0,"Font size must be a positive number greater than 0.",{method:"fontSize",providedValue:r})||this.Te.fontSize===r)return;this.Te.He(r);const s=this.Te.maxGlyphDimensions;this.ps.Ke(s.width,s.height),this.jr.ss(),this.ve.Ht()}},kt=l=>class extends l{addConverter(r){return this.jr.add(r)}removeConverter(r){this.jr.remove(r)}};class Lt{constructor(){c(this,"ve");c(this,"Te");c(this,"jr");c(this,"Ye");c(this,"ps")}}class H extends function(s,...i){return i.reduce((n,o)=>o(n),s)}(Lt,yt,It,Gt,kt){constructor(s=null,i={}){super();c(this,"ns");c(this,"Hr");c(this,"ls");c(this,"Or");c(this,"Br");c(this,"Wr",null);c(this,"Nr",0);c(this,"Xr");c(this,"qr",!0);c(this,"Yr",0);c(this,"Qr",0);c(this,"Zr",0);c(this,"Jr",[]);c(this,"Kr",10);c(this,"ti",!1);c(this,"ei",!1);c(this,"si",()=>{});c(this,"ri",()=>{});c(this,"ii");this.ns=s,this.ei=s===null,this.Or=i.renderMode??"auto",this.Br=i.frameRate??60,this.Xr=1e3/this.Br}static async create(s=null,i={}){const n=new this(s,i),o=n.ei?i:void 0;let h,a;n.Ye=new et(n.ns,n.ei,o),n.ve=new lt(n.Ye.fs()),n.ei?(h=i.width||800,a=i.height||600):(h=n.Ye.width||800,a=n.Ye.height||600),n.Hr=n.ve.Ut(h,a),n.Te=new K(n.ve,i.fontSize??16),await n.Te.Ue(i.fontSource);const u=n.Te.maxGlyphDimensions;return n.ps=new tt(n.Ye.canvas,u.width,u.height),n.jr=new rt(n.ve,n.Te,n.ps),n.ni(),n.oi(),n}ni(){this.ii=()=>{this.ei?this.ri():this.ai()},window.addEventListener("resize",this.ii),window.ResizeObserver&&this.ns&&!this.ei&&(this.ls=new ResizeObserver(()=>{this.ai()}),this.ls.observe(this.ns))}render(){this.hi(),this.Zr++,this.ti?console.warn("Cannot render: Required resources have been disposed"):(this.ei?(this.Hr.begin(),this.si(),this.Hr.end()):this.Hr.update(this.ns),this.jr.hasEnabledConverters()?(this.jr.Hs(this.Hr),this.ve.Lt(0),this.ve.Ot(this.jr.texture,this.ps.offsetX,this.ps.offsetY,this.jr.texture.width,this.jr.texture.height)):(this.ve.jt(),this.ve.Ot(this.Hr,this.ps.offsetX,this.ps.offsetY,this.Hr.width,this.Hr.height)))}ai(){this.Ye.ss(),this.Hr.resize(this.Ye.width,this.Ye.height),this.ps.ss(),this.jr.ss(),this.ve.Ht(),this.Or!=="manual"&&this.render()}oi(){if(this.Or!=="auto"||!this.qr)return;this.Nr=performance.now();const s=i=>{if(!this.qr)return void(this.Wr=null);const n=i-this.Nr;n>=this.Xr&&(this.render(),this.Nr=i-n%this.Xr),this.qr&&(this.Wr=requestAnimationFrame(s))};this.Wr=requestAnimationFrame(s)}hi(){const s=performance.now();if(this.Qr>0){const i=s-this.Qr;this.Jr.push(i),this.Jr.length>this.Kr&&this.Jr.shift();const n=this.Jr.reduce((o,h)=>o+h,0)/this.Jr.length;this.Yr=1e3/n}this.Qr=s}li(){this.Wr&&(cancelAnimationFrame(this.Wr),this.Wr=null)}renderMode(s){this.Or!==s&&(this.li(),this.Or=s,s==="auto"&&this.qr&&this.oi())}frameRate(s){if(s===void 0)return this.Yr;this.Br=s,this.Xr=1e3/s,this.Or==="auto"&&this.qr&&(this.li(),this.oi())}noLoop(){this.qr&&(this.qr=!1,this.Wr&&(cancelAnimationFrame(this.Wr),this.Wr=null))}loop(){this.qr||(this.qr=!0,this.Or==="auto"&&this.oi())}redraw(s=1){if(C.m(typeof s=="number"&&s>0&&Number.isInteger(s),"Redraw count must be a positive integer.",{method:"redraw",providedValue:s}))for(let i=0;i<s;i++)this.render()}isLooping(){return this.Or==="auto"&&this.qr}draw(s){this.si=s}windowResized(s){this.ri=s}resizeCanvas(s,i){this.ei&&(this.Ye.ss(s,i),this.Hr.resize(this.Ye.width,this.Ye.height),this.ps.ss(),this.jr.ss(),this.ve.Ht(),this.Or!=="manual"&&this.render())}destroy(){this.ti||(this.li(),window.removeEventListener("resize",this.ii),this.ls&&this.ls.disconnect(),this.jr.G(),this.Te.G(),this.Hr.G(),this.ve.G(),this.ti=!0)}get grid(){return this.ps}get font(){return this.Te}get mode(){return this.Or}get pipeline(){return this.jr}get frameCount(){return this.Zr}set frameCount(s){this.Zr=s}get width(){return this.Ye.width}get height(){return this.Ye.height}get canvas(){return this.Ye}get isDisposed(){return this.ti}}class k{constructor(){throw new b("Textmode is a static class and cannot be instantiated.")}static async create(r,s={}){if(!(r==null||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||typeof r=="object"))throw new b("First parameter must be HTMLCanvasElement, HTMLVideoElement, or options object.");if(typeof s!="object")throw new b("Second parameter must be an options object.");if(r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement)return H.create(r,s);{const i=r||{};return H.create(null,i)}}static setErrorLevel(r){C._(r)}static get version(){return"0.1.8
|
|
63
|
+
`;return i.join(n)}}class At extends z{Dr(r,s){const i=this.Rr(s);this.Xs(r,i,"text/plain;charset=utf-8")}Rr(r){let s=this.Qs(r);return s===".txt"||s.length<=4?this.Zs():s}}class it{constructor(){c(this,"Cr");c(this,"yr");c(this,"$r");this.Cr=new Ft,this.yr=new Mt,this.$r=new At}Fr(r){return{preserveTrailingSpaces:r.preserveTrailingSpaces??!1,lineEnding:r.lineEnding??"lf",emptyCharacter:r.emptyCharacter??" "}}Vr(r,s={}){const i=this.Fr(s),n=this.Cr.Os(r.pipeline),o=this.Cr.Mr(n,r.grid,r.font,i.emptyCharacter);return this.yr.Sr(o,i)}Dr(r,s={}){const i=this.Vr(r,s),n=s.filename||this.$r.Zs();this.$r.Dr(i,n)}}class Pt extends N{kr(r,s=1,i="transparent"){const n=r.canvas;if(s===1&&i==="transparent")return n;const o=document.createElement("canvas"),h=o.getContext("2d"),a=Math.round(n.width*s),u=Math.round(n.height*s);return o.width=a,o.height=u,i!=="transparent"&&(h.fillStyle=i,h.fillRect(0,0,a,u)),h.imageSmoothingEnabled=!1,h.drawImage(n,0,0,n.width,n.height,0,0,a,u),o}}class Ut{Ir(r,s){const i=this.zr(s.format);return s.format==="png"?r.toDataURL(i):r.toDataURL(i,s.quality)}async Er(r,s){return new Promise((i,n)=>{const o=this.zr(s.format),h=a=>{a?i(a):n(Error(`Failed to generate ${s.format.toUpperCase()} blob`))};s.format==="png"?r.toBlob(h,o):r.toBlob(h,o,s.quality)})}zr(r){switch(r){case"png":return"image/png";case"jpg":return"image/jpeg";case"webp":return"image/webp";default:throw Error("Unsupported image format: "+r)}}}const Dt={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},nt={png:".png",jpg:".jpg",webp:".webp"};class St extends z{Gr(r,s,i){this.Pr(r,this.Qs(s)+nt[i])}Pr(r,s){const i=URL.createObjectURL(r);try{const n=document.createElement("a");n.href=i,n.download=s,n.style.display="none",n.rel="noopener",document.body.appendChild(n),n.click(),document.body.removeChild(n)}finally{URL.revokeObjectURL(i)}}Ar(r){return r in Dt&&r in nt}}class $t{constructor(){c(this,"Cr");c(this,"yr");c(this,"$r");this.Cr=new Pt,this.yr=new Ut,this.$r=new St}Fr(r){return{format:r.format??"png",quality:r.quality??1,scale:r.scale??1,backgroundColor:r.backgroundColor??"transparent"}}Ur(r){if(console.log("Validating image export options:",r),!this.$r.Ar(r.format))throw Error(`Saving '${r.format}' files is not supported`);if(r.quality<0||r.quality>1)throw Error("Image quality must be between 0.0 and 1.0");if(r.scale<=0)throw Error("Scale factor must be greater than 0");r.scale>10&&console.warn("Large scale factors may result in very large files and slow performance"),r.format==="jpg"&&r.backgroundColor==="transparent"&&(r.backgroundColor="black")}Lr(r,s={}){const i=this.Fr(s);if(this.Ur(i),i.scale===1&&i.backgroundColor==="transparent")return this.yr.Ir(r.canvas,i);const n=this.Cr.kr(r,i.scale,i.backgroundColor);return this.yr.Ir(n,i)}async Er(r,s={}){const i=this.Fr(s);if(this.Ur(i),i.scale===1&&i.backgroundColor==="transparent")return await this.yr.Er(r.canvas,i);const n=this.Cr.kr(r,i.scale,i.backgroundColor);return await this.yr.Er(n,i)}async Gr(r,s={}){const i=await this.Er(r,s),n=s.format??"png",o=s.filename||this.$r.Zs();this.$r.Gr(i,o,n)}}const It=l=>class extends l{toString(r={}){return new it().Vr({pipeline:this.jr,grid:this.ps,font:this.Te},r)}saveStrings(r={}){new it().Dr({pipeline:this.jr,grid:this.ps,font:this.Te},r)}toSVG(r={}){return new st().Tr(this,r)}saveSVG(r={}){new st().wr(this,r)}async saveCanvas(r,s="png",i={}){await new $t().Gr(this.Ye,{...i,filename:r,format:s})}},Gt=l=>class extends l{async loadFont(r){return this.Te.Oe(r).then(()=>{const s=this.Te.maxGlyphDimensions;this.ps.Ke(s.width,s.height),this.jr.ss()})}fontSize(r){if(!C.m(typeof r=="number"&&r>0,"Font size must be a positive number greater than 0.",{method:"fontSize",providedValue:r})||this.Te.fontSize===r)return;this.Te.He(r);const s=this.Te.maxGlyphDimensions;this.ps.Ke(s.width,s.height),this.jr.ss(),this.ve.Ht()}},kt=l=>class extends l{addConverter(r){return this.jr.add(r)}removeConverter(r){this.jr.remove(r)}};class Lt{constructor(){c(this,"ve");c(this,"Te");c(this,"jr");c(this,"Ye");c(this,"ps")}}class H extends function(s,...i){return i.reduce((n,o)=>o(n),s)}(Lt,yt,It,Gt,kt){constructor(s=null,i={}){super();c(this,"ns");c(this,"Hr");c(this,"ls");c(this,"Or");c(this,"Br");c(this,"Wr",null);c(this,"Nr",0);c(this,"Xr");c(this,"qr",!0);c(this,"Yr",0);c(this,"Qr",0);c(this,"Zr",0);c(this,"Jr",[]);c(this,"Kr",10);c(this,"ti",!1);c(this,"ei",!1);c(this,"si",()=>{});c(this,"ri",()=>{});c(this,"ii");this.ns=s,this.ei=s===null,this.Or=i.renderMode??"auto",this.Br=i.frameRate??60,this.Xr=1e3/this.Br}static async create(s=null,i={}){const n=new this(s,i),o=n.ei?i:void 0;let h,a;n.Ye=new et(n.ns,n.ei,o),n.ve=new lt(n.Ye.fs()),n.ei?(h=i.width||800,a=i.height||600):(h=n.Ye.width||800,a=n.Ye.height||600),n.Hr=n.ve.Ut(h,a),n.Te=new K(n.ve,i.fontSize??16),await n.Te.Ue(i.fontSource);const u=n.Te.maxGlyphDimensions;return n.ps=new tt(n.Ye.canvas,u.width,u.height),n.jr=new rt(n.ve,n.Te,n.ps),n.ni(),n.oi(),n}ni(){this.ii=()=>{this.ei?this.ri():this.ai()},window.addEventListener("resize",this.ii),window.ResizeObserver&&this.ns&&!this.ei&&(this.ls=new ResizeObserver(()=>{this.ai()}),this.ls.observe(this.ns))}render(){this.hi(),this.Zr++,this.ti?console.warn("Cannot render: Required resources have been disposed"):(this.ei?(this.Hr.begin(),this.si(),this.Hr.end()):this.Hr.update(this.ns),this.jr.hasEnabledConverters()?(this.jr.Hs(this.Hr),this.ve.Lt(0),this.ve.Ot(this.jr.texture,this.ps.offsetX,this.ps.offsetY,this.jr.texture.width,this.jr.texture.height)):(this.ve.jt(),this.ve.Ot(this.Hr,this.ps.offsetX,this.ps.offsetY,this.Hr.width,this.Hr.height)))}ai(){this.Ye.ss(),this.Hr.resize(this.Ye.width,this.Ye.height),this.ps.ss(),this.jr.ss(),this.ve.Ht(),this.Or!=="manual"&&this.render()}oi(){if(this.Or!=="auto"||!this.qr)return;this.Nr=performance.now();const s=i=>{if(!this.qr)return void(this.Wr=null);const n=i-this.Nr;n>=this.Xr&&(this.render(),this.Nr=i-n%this.Xr),this.qr&&(this.Wr=requestAnimationFrame(s))};this.Wr=requestAnimationFrame(s)}hi(){const s=performance.now();if(this.Qr>0){const i=s-this.Qr;this.Jr.push(i),this.Jr.length>this.Kr&&this.Jr.shift();const n=this.Jr.reduce((o,h)=>o+h,0)/this.Jr.length;this.Yr=1e3/n}this.Qr=s}li(){this.Wr&&(cancelAnimationFrame(this.Wr),this.Wr=null)}renderMode(s){this.Or!==s&&(this.li(),this.Or=s,s==="auto"&&this.qr&&this.oi())}frameRate(s){if(s===void 0)return this.Yr;this.Br=s,this.Xr=1e3/s,this.Or==="auto"&&this.qr&&(this.li(),this.oi())}noLoop(){this.qr&&(this.qr=!1,this.Wr&&(cancelAnimationFrame(this.Wr),this.Wr=null))}loop(){this.qr||(this.qr=!0,this.Or==="auto"&&this.oi())}redraw(s=1){if(C.m(typeof s=="number"&&s>0&&Number.isInteger(s),"Redraw count must be a positive integer.",{method:"redraw",providedValue:s}))for(let i=0;i<s;i++)this.render()}isLooping(){return this.Or==="auto"&&this.qr}draw(s){this.si=s}windowResized(s){this.ri=s}resizeCanvas(s,i){this.ei&&(this.Ye.ss(s,i),this.Hr.resize(this.Ye.width,this.Ye.height),this.ps.ss(),this.jr.ss(),this.ve.Ht(),this.Or!=="manual"&&this.render())}destroy(){this.ti||(this.li(),window.removeEventListener("resize",this.ii),this.ls&&this.ls.disconnect(),this.jr.G(),this.Te.G(),this.Hr.G(),this.ve.G(),this.ti=!0)}get grid(){return this.ps}get font(){return this.Te}get mode(){return this.Or}get pipeline(){return this.jr}get frameCount(){return this.Zr}set frameCount(s){this.Zr=s}get width(){return this.Ye.width}get height(){return this.Ye.height}get canvas(){return this.Ye}get isDisposed(){return this.ti}}class k{constructor(){throw new b("Textmode is a static class and cannot be instantiated.")}static async create(r,s={}){if(!(r==null||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||typeof r=="object"))throw new b("First parameter must be HTMLCanvasElement, HTMLVideoElement, or options object.");if(typeof s!="object")throw new b("Second parameter must be an options object.");if(r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement)return H.create(r,s);{const i=r||{};return H.create(null,i)}}static setErrorLevel(r){C._(r)}static get version(){return"0.1.8"}}const Yt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),Bt=k.create,jt=k.setErrorLevel,Vt=k.version;w.TextmodeCanvas=et,w.TextmodeConversionPipeline=rt,w.TextmodeErrorLevel=U,w.TextmodeFont=K,w.TextmodeGrid=tt,w.Textmodifier=H,w.converters=Ct,w.create=Bt,w.default=k,w.export=Yt,w.setErrorLevel=jt,w.textmode=k,w.version=Vt,Object.defineProperties(w,{ci:{value:!0},[Symbol.toStringTag]:{value:"Module"}})},typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):e((t=typeof globalThis<"u"?globalThis:t||self).textmode={});
|