textmode.figlet.js 1.0.0 → 1.0.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.figlet.esm.js +1 -1
- package/dist/textmode.figlet.umd.js +1 -1
- package/dist/types/figfont/types.d.ts +2 -2
- package/dist/types/figfont/types.d.ts.map +1 -1
- package/dist/types/plugin/FigletPlugin.d.ts +1 -1
- package/dist/types/plugin/FigletPlugin.d.ts.map +1 -1
- package/package.json +34 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);import{TextmodeColor as n}from"textmode.js";class r extends Error{constructor(t,e){super(r.formatMessage(t,e)),this.name="FigletError"}static formatMessage(t,e){if(!e||0===Object.keys(e).length)return t;return`${t}\n\nContext:${Object.entries(e).map(([t,e])=>`\n - ${t}: ${r.formatValue(e)}`).join("")}`}static formatValue(t){return null===t?"null":void 0===t?"undefined":"string"==typeof t?`"${t}"`:"number"==typeof t||"boolean"==typeof t?t+"":Array.isArray(t)?`[${t.map(t=>r.formatValue(t)).join(", ")}]`:"object"==typeof t?JSON.stringify(t):t+""}}const i=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223];class s{static t(t){if(0===t.length)throw new r("Cannot parse an empty FIGfont file.");const e=t.replace(/\r\n?/g,"\n").split("\n"),n=e[0];if(!n)throw new r("Missing FIGfont header line.");const i=this.i(n);let s=1+i.commentLines;if(s>e.length)throw new r("FIGfont comment line count exceeds file length.",{commentLines:i.commentLines,totalLines:e.length});const o=new Map;return s=this.o(e,s,i,o),this.l(e,s,i,o),{header:i,characters:o}}static i(t){const e=t.trim().split(/\s+/),n=e[0]??"";if(n.length<6)throw new r("Invalid FIGfont header token.",{headerToken:n});const i=n.slice(0,5),s=n.slice(5);if("flf2a"!==i)throw new r("Unsupported FIGfont signature.",{signature:i});if(1!==s.length)throw new r("FIGfont hardblank must be a single character.",{hardblank:s});if(e.length<6)throw new r("Incomplete FIGfont header.",{headerLine:t});return{signature:i,hardblank:s,height:this.u(e[1],"height"),baseline:this.u(e[2],"baseline"),maxLength:this.u(e[3],"maxLength"),oldLayout:this.u(e[4],"oldLayout"),commentLines:this.u(e[5],"commentLines"),printDirection:this.u(e[6]??"0","printDirection"),fullLayout:this.u(e[7]??"0","fullLayout"),codetagCount:this.u(e[8]??"0","codetagCount")}}static o(t,e,n,r){let s=e;for(const e of i){const i=this.h(t,s,n.height,e);r.set(e,i),s+=n.height}return s}static l(t,e,n,r){var i;let s=e;for(;s<t.length;){const e=(null==(i=t[s])?void 0:i.trim())??"";if(0===e.length){s+=1;continue}const o=this._(e);s+=1;const a=this.h(t,s,n.height,o);r.set(o,a),s+=n.height}}static h(t,e,n,i){if(e+n>t.length)throw new r("Unexpected end of FIGfont character data.",{codePoint:i,startIndex:e,height:n,totalLines:t.length});const s=[];let o=0;for(let a=0;a<n;a+=1){const n=t[e+a]??"";if(0===n.length)throw new r("Encountered an empty FIGcharacter row.",{codePoint:i,row:a,startIndex:e});const l=n.at(-1);if(!l)throw new r("Failed to determine FIGcharacter endmark.",{codePoint:i,row:a});const c=n.replace(RegExp(this.escapeForRegExp(l)+"+$"),"");s.push(c),o=Math.max(o,c.length)}return{code:i,lines:s,width:o}}static _(t){const e=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(e))return Number.parseInt(e,16);if(/^[-+]?0[0-7]+$/.test(e))return Number.parseInt(e,8);if(/^[-+]?\d+$/.test(e))return Number.parseInt(e,10);throw new r("Invalid FIGfont code tag.",{codetagLine:t})}static u(t,e){if(!/^-?\d+$/.test(t))throw new r("Invalid FIGfont header value.",{field:e,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class o{static p(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.v(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.C(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.L(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.R(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.F(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.A(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static v(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.v(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.C(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.L(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.H(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.S(t,e):null)}static C(t,e,n){return t===e&&t!==n?t:null}static L(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static R(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static F(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static A(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static H(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static S(t,e){return"|"===t&&"|"===e?"|":null}}e(o,"RULE_EQUAL_CHARACTER",1),e(o,"RULE_UNDERSCORE",2),e(o,"RULE_HIERARCHY",4),e(o,"RULE_OPPOSITE_PAIR",8),e(o,"RULE_BIG_X",16),e(o,"RULE_HARDBLANK",32),e(o,"VERTICAL_RULE_EQUAL_CHARACTER",256),e(o,"VERTICAL_RULE_UNDERSCORE",512),e(o,"VERTICAL_RULE_HIERARCHY",1024),e(o,"VERTICAL_RULE_HORIZONTAL_LINE",2048),e(o,"VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH",4096);class a{constructor(t){e(this,"_header"),e(this,"_horizontalRuleMask"),e(this,"_verticalRuleMask"),this.$=t,this.k=o.p(t),this.M=o.m(t)}O(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.G(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const t of r.cells)i[t.row][t.col]=t.char;return i}G(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.$.height};let i=this.N(t[0],e[0],r),s=t[0].width;for(let a=1;a<t.length;a+=1){const l=t[a],c=e[a]??{inputIndex:a,inputChar:String.fromCodePoint(l.code)},u=s-this.P(i,s,l,n),h=Math.max(s,u+l.width),f=i.map(t=>Array.from({length:h},(e,n)=>t[n]));for(let t=0;t<this.$.height;t+=1){const e=l.lines[t]??"",n=f[t];for(let i=0;i<l.width;i+=1){const s=e[i]??" ";if(" "===s)continue;const a=u+i,h=n[a],f=this.V(a,t,i,r,l,c,s);if(!h){n[a]=f;continue}const d=o.I(h.char,s,this.$.hardblank,this.k);n[a]=this.D(h,f,d??s)}}i=f,s=h}return this.B(i,s,r)}j(t,e){var n;if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let r=this.W(t[0]),i=t[0].cols,s=t[0].rows;const a=[this.q(t[0],0)];for(let l=1;l<t.length;l+=1){const c=t[l],u=s-this.X(r,s,i,c,e),h=Math.max(i,c.cols),f=Math.max(s,u+c.rows),d=Array.from({length:f},(t,e)=>Array.from({length:h},(t,n)=>{var i;return null==(i=r[e])?void 0:i[n]}));for(const t of c.cells){const e=u+t.row,r=t.col,i=null==(n=d[e])?void 0:n[r];if(!i){d[e][r]={...t,row:e};continue}const s=o.U(i.char,t.char,this.M);d[e][r]=this.D(i,{...t,row:e},s??t.char)}r=d,i=h,s=f,a.push(this.q(c,u))}return this.Y(r,i,s,a)}P(t,e,n,r){var i;if("full"===r)return 0;for(let s=e;s>=0;s-=1){let o=!0;for(let a=0;a<this.$.height&&o;a+=1){const l=t[a]??[],c=n.lines[a]??"";for(let t=0;t<s;t+=1){const n=(null==(i=l[e-s+t])?void 0:i.char)??" ",a=c[t]??" ";if(!this.J(n,a,r)){o=!1;break}}}if(o)return s}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==o.I(t,e,this.$.hardblank,this.k)}N(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.$.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.V(o,i,o,n,t,e,a)})})}V(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}D(t,e,n){return n===t.char?t:{...e,char:n}}B(t,e,n){const r=[];for(let i=0;i<this.$.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];!e||e.char===this.$.hardblank||r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.$.height}}X(t,e,n,r,i){var s,o;if("full"===i)return 0;const a=this.W(r),l=Math.min(e,r.rows),c=Math.max(n,r.cols);for(let n=l;n>=0;n-=1){let r=!0;for(let l=0;l<n&&r;l+=1){const u=t[e-n+l]??[],h=a[l]??[];for(let t=0;t<c;t+=1){const e=(null==(s=u[t])?void 0:s.char)??" ",n=(null==(o=h[t])?void 0:o.char)??" ";if(!this.K(e,n,i)){r=!1;break}}}if(r)return n}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==o.U(t,e,this.M)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){var i;const s=[];for(let r=0;r<n;r+=1)for(let n=0;n<e;n+=1){const e=null==(i=t[r])?void 0:i[n];e&&s.push({...e,row:r,col:n})}return{cells:s,lines:r,cols:e,rows:n}}}class l{constructor(){e(this,"_onDisposeCallbacks",new Set)}Z(t){this.tt.add(t)}dispose(){for(const t of this.tt)t();this.tt.clear()}}class c extends l{constructor(t,n,r){super(),e(this,"_name"),e(this,"_header"),e(this,"_characters"),e(this,"_layoutEngine"),this.et=t,this.$=n,this.nt=r,this.rt=new a(n)}static async it(t){const e=await fetch(t);if(!e.ok)throw new r("Failed to load FIGfont file.",{source:t+"",status:e.status,statusText:e.statusText});const n=await e.text();return this.st(this.ot(t),n)}static st(t,e){const n=s.t(e);return new c(t,n.header,n.characters)}getCharacter(t){var e;const n="number"==typeof t?t:null==(e=Array.from(t)[0])?void 0:e.codePointAt(0);if(void 0!==n)return u(this.nt.get(n))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.lt(e.direction),s=this.ct(t).map(t=>this.ut(t,i)).flatMap(t=>this.ht(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.G(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.j(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const t of n.cells)r[t.row][t.col]=t.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.$}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,u(e)]))}get hardblank(){return this.$.hardblank}get height(){return this.$.height}get baseline(){return this.$.baseline}get defaultLayout(){return 128&this.$.fullLayout?"smushed":64&this.$.fullLayout?"fitted":-1===this.$.oldLayout?"full":0===this.$.oldLayout?"fitted":this.$.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.$.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.$.fullLayout?"smushed":8192&this.$.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}ct(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ut(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const e=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),n=e.find(t=>void 0===t.figChar);if(n)throw new r("FIGfont is missing a required character for layout.",{character:n.inputChar,index:n.inputIndex});return e}ht(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const t of r){if(t.isWhitespace){s.length>0&&(o=t.characters);continue}const r=0===s.length?t.characters:s.concat(o,t.characters);s.length>0&&this.wt(r,e)>n?(i.push(s),s=t.characters.slice()):s=r,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.G(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}lt(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}}function u(t){if(t)return{...t,lines:[...t.lines]}}const h="textmode.figlet.js",f="1.0.0",d=Symbol.for("textmode.figlet.state");function g(t){const e=t;return e[d]||(e[d]={activeFont:void 0,align:"left",baseline:"baseline"}),e[d]}const _=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function p(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function w(t,e,r){return r instanceof n||"string"==typeof r||"number"==typeof r?"charColor"===e?void t.charColor(r):void t.cellColor(r):4===r.length?"charColor"===e?void t.charColor(r[0],r[1],r[2],r[3]):void t.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==e?t.cellColor(r[0],r[1],r[2]):t.charColor(r[0],r[1],r[2]))}function m(t){const e=g(t).activeFont;if(!e)throw new r("No FIGlet font is active. Call figFont() first.");return e}function I(t,e){var n;null==(n=t.It)||n.call(t,e)}function v(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}function C(t){v(t,"loadFigFont",async function(t){const e=await c.it(t);return I(this,e),e}),v(t,"parseFigFont",function(t,e){const n=c.st(t,e);return I(this,n),n}),v(t,"figFont",function(t){const e=g(this);if(void 0===t)return e.activeFont;e.activeFont=t}),v(t,"figText",function(t,e,n,r={}){const i=m(this),s=i.planText(t,r),o=g(this),a=e+function(t,e){return"center"===e?-Math.floor(t/2):"right"===e?-(t-1):0}(s.cols,o.align),l=n+function(t,e,n){return"top"===n?0:"center"===n?-Math.floor(t/2):"bottom"===n?-(t-1):-(e-1)}(s.rows,i.baseline,o.baseline);this.push(),this.translate(a,l,0);for(const t of s.cells){this.push(),this.translate(t.col,t.row,0);const e=p(r.charColor,t),n=p(r.cellColor,t);this.char(t.char),void 0!==e&&w(this,"charColor",e),void 0!==n&&w(this,"cellColor",n),this.point(),this.pop()}this.pop()}),v(t,"figTextWidth",function(t,e={}){return m(this).measureText(t,e).cols}),v(t,"figTextHeight",function(t,e={}){return m(this).measureText(t,e).rows}),v(t,"figTextBounds",function(t,e={}){return m(this).measureText(t,e)}),v(t,"figTextAlign",function(t){const e=g(this);if(void 0===t)return e.align;e.align=t}),v(t,"figTextBaseline",function(t){const e=g(this);if(void 0===t)return e.baseline;e.baseline=t})}function L(t){for(const e of _)delete t[e];!function(t){delete t[d]}(t)}const y={name:h,version:f,install(t,e){C(t)},uninstall(t,e){L(t)}};if(typeof window<"u"){const t=window;t.FigletPlugin=y,t.TextmodeFigFont=c,t.FigFontParser=s,t.FigLayoutEngine=a,t.FigSmushRules=o,t.FIGFONT_REQUIRED_CODEPOINTS=i}export{i as FIGFONT_REQUIRED_CODEPOINTS,s as FigFontParser,a as FigLayoutEngine,o as FigSmushRules,y as FigletPlugin,c as TextmodeFigFont};
|
|
1
|
+
var t=Object.defineProperty,e=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r);import{color as n}from"textmode.js";class r extends Error{constructor(t,e){super(r.formatMessage(t,e)),this.name="FigletError"}static formatMessage(t,e){if(!e||0===Object.keys(e).length)return t;return`${t}\n\nContext:${Object.entries(e).map(([t,e])=>`\n - ${t}: ${r.formatValue(e)}`).join("")}`}static formatValue(t){return null===t?"null":void 0===t?"undefined":"string"==typeof t?`"${t}"`:"number"==typeof t||"boolean"==typeof t?t+"":Array.isArray(t)?`[${t.map(t=>r.formatValue(t)).join(", ")}]`:"object"==typeof t?JSON.stringify(t):t+""}}const i=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223];class s{static t(t){if(0===t.length)throw new r("Cannot parse an empty FIGfont file.");const e=t.replace(/\r\n?/g,"\n").split("\n"),n=e[0];if(!n)throw new r("Missing FIGfont header line.");const i=this.i(n);let s=1+i.commentLines;if(s>e.length)throw new r("FIGfont comment line count exceeds file length.",{commentLines:i.commentLines,totalLines:e.length});const o=new Map;return s=this.o(e,s,i,o),this.l(e,s,i,o),{header:i,characters:o}}static i(t){const e=t.trim().split(/\s+/),n=e[0]??"";if(n.length<6)throw new r("Invalid FIGfont header token.",{headerToken:n});const i=n.slice(0,5),s=n.slice(5);if("flf2a"!==i)throw new r("Unsupported FIGfont signature.",{signature:i});if(1!==s.length)throw new r("FIGfont hardblank must be a single character.",{hardblank:s});if(e.length<6)throw new r("Incomplete FIGfont header.",{headerLine:t});return{signature:i,hardblank:s,height:this.u(e[1],"height"),baseline:this.u(e[2],"baseline"),maxLength:this.u(e[3],"maxLength"),oldLayout:this.u(e[4],"oldLayout"),commentLines:this.u(e[5],"commentLines"),printDirection:this.u(e[6]??"0","printDirection"),fullLayout:this.u(e[7]??"0","fullLayout"),codetagCount:this.u(e[8]??"0","codetagCount")}}static o(t,e,n,r){let s=e;for(const e of i){const i=this.h(t,s,n.height,e);r.set(e,i),s+=n.height}return s}static l(t,e,n,r){var i;let s=e;for(;s<t.length;){const e=(null==(i=t[s])?void 0:i.trim())??"";if(0===e.length){s+=1;continue}const o=this._(e);s+=1;const a=this.h(t,s,n.height,o);r.set(o,a),s+=n.height}}static h(t,e,n,i){if(e+n>t.length)throw new r("Unexpected end of FIGfont character data.",{codePoint:i,startIndex:e,height:n,totalLines:t.length});const s=[];let o=0;for(let a=0;a<n;a+=1){const n=t[e+a]??"";if(0===n.length)throw new r("Encountered an empty FIGcharacter row.",{codePoint:i,row:a,startIndex:e});const l=n.at(-1);if(!l)throw new r("Failed to determine FIGcharacter endmark.",{codePoint:i,row:a});const c=n.replace(RegExp(this.escapeForRegExp(l)+"+$"),"");s.push(c),o=Math.max(o,c.length)}return{code:i,lines:s,width:o}}static _(t){const e=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(e))return Number.parseInt(e,16);if(/^[-+]?0[0-7]+$/.test(e))return Number.parseInt(e,8);if(/^[-+]?\d+$/.test(e))return Number.parseInt(e,10);throw new r("Invalid FIGfont code tag.",{codetagLine:t})}static u(t,e){if(!/^-?\d+$/.test(t))throw new r("Invalid FIGfont header value.",{field:e,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class o{static p(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.v(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.L(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.R(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.F(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.A(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static v(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.v(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.L(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.H(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.S(t,e):null)}static L(t,e,n){return t===e&&t!==n?t:null}static C(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static R(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static F(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static A(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static H(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static S(t,e){return"|"===t&&"|"===e?"|":null}}e(o,"RULE_EQUAL_CHARACTER",1),e(o,"RULE_UNDERSCORE",2),e(o,"RULE_HIERARCHY",4),e(o,"RULE_OPPOSITE_PAIR",8),e(o,"RULE_BIG_X",16),e(o,"RULE_HARDBLANK",32),e(o,"VERTICAL_RULE_EQUAL_CHARACTER",256),e(o,"VERTICAL_RULE_UNDERSCORE",512),e(o,"VERTICAL_RULE_HIERARCHY",1024),e(o,"VERTICAL_RULE_HORIZONTAL_LINE",2048),e(o,"VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH",4096);class a{constructor(t){e(this,"_header"),e(this,"_horizontalRuleMask"),e(this,"_verticalRuleMask"),this.$=t,this.k=o.p(t),this.M=o.m(t)}O(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.G(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const t of r.cells)i[t.row][t.col]=t.char;return i}G(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.$.height};let i=this.N(t[0],e[0],r),s=t[0].width;for(let a=1;a<t.length;a+=1){const l=t[a],c=e[a]??{inputIndex:a,inputChar:String.fromCodePoint(l.code)},u=s-this.P(i,s,l,n),h=Math.max(s,u+l.width),f=i.map(t=>Array.from({length:h},(e,n)=>t[n]));for(let t=0;t<this.$.height;t+=1){const e=l.lines[t]??"",n=f[t];for(let i=0;i<l.width;i+=1){const s=e[i]??" ";if(" "===s)continue;const a=u+i,h=n[a],f=this.V(a,t,i,r,l,c,s);if(!h){n[a]=f;continue}const d=o.I(h.char,s,this.$.hardblank,this.k);n[a]=this.D(h,f,d??s)}}i=f,s=h}return this.B(i,s,r)}j(t,e){var n;if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let r=this.W(t[0]),i=t[0].cols,s=t[0].rows;const a=[this.q(t[0],0)];for(let l=1;l<t.length;l+=1){const c=t[l],u=s-this.X(r,s,i,c,e),h=Math.max(i,c.cols),f=Math.max(s,u+c.rows),d=Array.from({length:f},(t,e)=>Array.from({length:h},(t,n)=>{var i;return null==(i=r[e])?void 0:i[n]}));for(const t of c.cells){const e=u+t.row,r=t.col,i=null==(n=d[e])?void 0:n[r];if(!i){d[e][r]={...t,row:e};continue}const s=o.U(i.char,t.char,this.M);d[e][r]=this.D(i,{...t,row:e},s??t.char)}r=d,i=h,s=f,a.push(this.q(c,u))}return this.Y(r,i,s,a)}P(t,e,n,r){var i;if("full"===r)return 0;for(let s=e;s>=0;s-=1){let o=!0;for(let a=0;a<this.$.height&&o;a+=1){const l=t[a]??[],c=n.lines[a]??"";for(let t=0;t<s;t+=1){const n=(null==(i=l[e-s+t])?void 0:i.char)??" ",a=c[t]??" ";if(!this.J(n,a,r)){o=!1;break}}}if(o)return s}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==o.I(t,e,this.$.hardblank,this.k)}N(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.$.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.V(o,i,o,n,t,e,a)})})}V(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}D(t,e,n){return n===t.char?t:{...e,char:n}}B(t,e,n){const r=[];for(let i=0;i<this.$.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];!e||e.char===this.$.hardblank||r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.$.height}}X(t,e,n,r,i){var s,o;if("full"===i)return 0;const a=this.W(r),l=Math.min(e,r.rows),c=Math.max(n,r.cols);for(let n=l;n>=0;n-=1){let r=!0;for(let l=0;l<n&&r;l+=1){const u=t[e-n+l]??[],h=a[l]??[];for(let t=0;t<c;t+=1){const e=(null==(s=u[t])?void 0:s.char)??" ",n=(null==(o=h[t])?void 0:o.char)??" ";if(!this.K(e,n,i)){r=!1;break}}}if(r)return n}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==o.U(t,e,this.M)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){var i;const s=[];for(let r=0;r<n;r+=1)for(let n=0;n<e;n+=1){const e=null==(i=t[r])?void 0:i[n];e&&s.push({...e,row:r,col:n})}return{cells:s,lines:r,cols:e,rows:n}}}class l{constructor(){e(this,"_onDisposeCallbacks",new Set)}Z(t){this.tt.add(t)}dispose(){for(const t of this.tt)t();this.tt.clear()}}class c extends l{constructor(t,n,r){super(),e(this,"_name"),e(this,"_header"),e(this,"_characters"),e(this,"_layoutEngine"),this.et=t,this.$=n,this.nt=r,this.rt=new a(n)}static async it(t){const e=await fetch(t);if(!e.ok)throw new r("Failed to load FIGfont file.",{source:t+"",status:e.status,statusText:e.statusText});const n=await e.text();return this.st(this.ot(t),n)}static st(t,e){const n=s.t(e);return new c(t,n.header,n.characters)}getCharacter(t){var e;const n="number"==typeof t?t:null==(e=Array.from(t)[0])?void 0:e.codePointAt(0);if(void 0!==n)return u(this.nt.get(n))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.lt(e.direction),s=this.ct(t).map(t=>this.ut(t,i)).flatMap(t=>this.ht(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.G(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.j(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const t of n.cells)r[t.row][t.col]=t.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.$}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,u(e)]))}get hardblank(){return this.$.hardblank}get height(){return this.$.height}get baseline(){return this.$.baseline}get defaultLayout(){return 128&this.$.fullLayout?"smushed":64&this.$.fullLayout?"fitted":-1===this.$.oldLayout?"full":0===this.$.oldLayout?"fitted":this.$.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.$.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.$.fullLayout?"smushed":8192&this.$.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}ct(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ut(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const e=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),n=e.find(t=>void 0===t.figChar);if(n)throw new r("FIGfont is missing a required character for layout.",{character:n.inputChar,index:n.inputIndex});return e}ht(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const t of r){if(t.isWhitespace){s.length>0&&(o=t.characters);continue}const r=0===s.length?t.characters:s.concat(o,t.characters);s.length>0&&this.wt(r,e)>n?(i.push(s),s=t.characters.slice()):s=r,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.G(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}lt(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}}function u(t){if(t)return{...t,lines:[...t.lines]}}const h="textmode.figlet.js",f="1.0.1",d=Symbol.for("textmode.figlet.state");function g(t){const e=t;return e[d]||(e[d]={activeFont:void 0,align:"left",baseline:"baseline"}),e[d]}const _=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function p(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function w(t,e,r){return r instanceof n.TextmodeColor||"string"==typeof r||"number"==typeof r?"charColor"===e?void t.charColor(r):void t.cellColor(r):4===r.length?"charColor"===e?void t.charColor(r[0],r[1],r[2],r[3]):void t.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==e?t.cellColor(r[0],r[1],r[2]):t.charColor(r[0],r[1],r[2]))}function m(t){const e=g(t).activeFont;if(!e)throw new r("No FIGlet font is active. Call figFont() first.");return e}function I(t,e){var n;null==(n=t.It)||n.call(t,e)}function v(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}function L(t){v(t,"loadFigFont",async function(t){const e=await c.it(t);return I(this,e),e}),v(t,"parseFigFont",function(t,e){const n=c.st(t,e);return I(this,n),n}),v(t,"figFont",function(t){const e=g(this);if(void 0===t)return e.activeFont;e.activeFont=t}),v(t,"figText",function(t,e,n,r={}){const i=m(this),s=i.planText(t,r),o=g(this),a=e+function(t,e){return"center"===e?-Math.floor(t/2):"right"===e?-(t-1):0}(s.cols,o.align),l=n+function(t,e,n){return"top"===n?0:"center"===n?-Math.floor(t/2):"bottom"===n?-(t-1):-(e-1)}(s.rows,i.baseline,o.baseline);this.push(),this.translate(a,l,0);for(const t of s.cells){this.push(),this.translate(t.col,t.row,0);const e=p(r.charColor,t),n=p(r.cellColor,t);this.char(t.char),void 0!==e&&w(this,"charColor",e),void 0!==n&&w(this,"cellColor",n),this.point(),this.pop()}this.pop()}),v(t,"figTextWidth",function(t,e={}){return m(this).measureText(t,e).cols}),v(t,"figTextHeight",function(t,e={}){return m(this).measureText(t,e).rows}),v(t,"figTextBounds",function(t,e={}){return m(this).measureText(t,e)}),v(t,"figTextAlign",function(t){const e=g(this);if(void 0===t)return e.align;e.align=t}),v(t,"figTextBaseline",function(t){const e=g(this);if(void 0===t)return e.baseline;e.baseline=t})}function y(t){for(const e of _)delete t[e];!function(t){delete t[d]}(t)}const C={name:h,version:f,install(t,e){L(t)},uninstall(t,e){y(t)}};if(typeof window<"u"){const t=window;t.FigletPlugin=C,t.TextmodeFigFont=c,t.FigFontParser=s,t.FigLayoutEngine=a,t.FigSmushRules=o,t.FIGFONT_REQUIRED_CODEPOINTS=i}export{i as FIGFONT_REQUIRED_CODEPOINTS,s as FigFontParser,a as FigLayoutEngine,o as FigSmushRules,C as FigletPlugin,c as TextmodeFigFont};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&typeof module<"u"?e(exports,require("textmode.js")):"function"==typeof define&&define.amd?define(["exports","textmode.js"],e):e((t=typeof globalThis<"u"?globalThis:t||self).TextmodeFiglet={},t.textmode)}(this,function(t,e){"use strict";var n=Object.defineProperty,r=(t,e,r)=>((t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class i extends Error{constructor(t,e){super(i.formatMessage(t,e)),this.name="FigletError"}static formatMessage(t,e){if(!e||0===Object.keys(e).length)return t;return`${t}\n\nContext:${Object.entries(e).map(([t,e])=>`\n - ${t}: ${i.formatValue(e)}`).join("")}`}static formatValue(t){return null===t?"null":void 0===t?"undefined":"string"==typeof t?`"${t}"`:"number"==typeof t||"boolean"==typeof t?String(t):Array.isArray(t)?`[${t.map(t=>i.formatValue(t)).join(", ")}]`:"object"==typeof t?JSON.stringify(t):String(t)}}const s=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223];class o{static t(t){if(0===t.length)throw new i("Cannot parse an empty FIGfont file.");const e=t.replace(/\r\n?/g,"\n").split("\n"),n=e[0];if(!n)throw new i("Missing FIGfont header line.");const r=this.i(n);let s=1+r.commentLines;if(s>e.length)throw new i("FIGfont comment line count exceeds file length.",{commentLines:r.commentLines,totalLines:e.length});const o=new Map;return s=this.o(e,s,r,o),this.l(e,s,r,o),{header:r,characters:o}}static i(t){const e=t.trim().split(/\s+/),n=e[0]??"";if(n.length<6)throw new i("Invalid FIGfont header token.",{headerToken:n});const r=n.slice(0,5),s=n.slice(5);if("flf2a"!==r)throw new i("Unsupported FIGfont signature.",{signature:r});if(1!==s.length)throw new i("FIGfont hardblank must be a single character.",{hardblank:s});if(e.length<6)throw new i("Incomplete FIGfont header.",{headerLine:t});return{signature:r,hardblank:s,height:this.u(e[1],"height"),baseline:this.u(e[2],"baseline"),maxLength:this.u(e[3],"maxLength"),oldLayout:this.u(e[4],"oldLayout"),commentLines:this.u(e[5],"commentLines"),printDirection:this.u(e[6]??"0","printDirection"),fullLayout:this.u(e[7]??"0","fullLayout"),codetagCount:this.u(e[8]??"0","codetagCount")}}static o(t,e,n,r){let i=e;for(const e of s){const s=this.h(t,i,n.height,e);r.set(e,s),i+=n.height}return i}static l(t,e,n,r){var i;let s=e;for(;s<t.length;){const e=(null==(i=t[s])?void 0:i.trim())??"";if(0===e.length){s+=1;continue}const o=this.p(e);s+=1;const a=this.h(t,s,n.height,o);r.set(o,a),s+=n.height}}static h(t,e,n,r){if(e+n>t.length)throw new i("Unexpected end of FIGfont character data.",{codePoint:r,startIndex:e,height:n,totalLines:t.length});const s=[];let o=0;for(let a=0;a<n;a+=1){const n=t[e+a]??"";if(0===n.length)throw new i("Encountered an empty FIGcharacter row.",{codePoint:r,row:a,startIndex:e});const l=n.at(-1);if(!l)throw new i("Failed to determine FIGcharacter endmark.",{codePoint:r,row:a});const c=n.replace(new RegExp(`${this.escapeForRegExp(l)}+$`),"");s.push(c),o=Math.max(o,c.length)}return{code:r,lines:s,width:o}}static p(t){const e=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(e))return Number.parseInt(e,16);if(/^[-+]?0[0-7]+$/.test(e))return Number.parseInt(e,8);if(/^[-+]?\d+$/.test(e))return Number.parseInt(e,10);throw new i("Invalid FIGfont code tag.",{codetagLine:t})}static u(t,e){if(!/^-?\d+$/.test(t))throw new i("Invalid FIGfont header value.",{field:e,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class a{static _(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.v(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.L(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.R(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.A(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.F(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static v(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.v(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.L(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.S(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.$(t,e):null)}static L(t,e,n){return t===e&&t!==n?t:null}static C(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static R(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static A(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static F(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static S(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static $(t,e){return"|"===t&&"|"===e?"|":null}}r(a,"RULE_EQUAL_CHARACTER",1),r(a,"RULE_UNDERSCORE",2),r(a,"RULE_HIERARCHY",4),r(a,"RULE_OPPOSITE_PAIR",8),r(a,"RULE_BIG_X",16),r(a,"RULE_HARDBLANK",32),r(a,"VERTICAL_RULE_EQUAL_CHARACTER",256),r(a,"VERTICAL_RULE_UNDERSCORE",512),r(a,"VERTICAL_RULE_HIERARCHY",1024),r(a,"VERTICAL_RULE_HORIZONTAL_LINE",2048),r(a,"VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH",4096);class l{constructor(t){r(this,"_header"),r(this,"_horizontalRuleMask"),r(this,"_verticalRuleMask"),this.H=t,this.M=a._(t),this.k=a.m(t)}G(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.O(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const t of r.cells)i[t.row][t.col]=t.char;return i}O(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.H.height};let i=this.N(t[0],e[0],r),s=t[0].width;for(let o=1;o<t.length;o+=1){const l=t[o],c=e[o]??{inputIndex:o,inputChar:String.fromCodePoint(l.code)},u=s-this.V(i,s,l,n),h=Math.max(s,u+l.width),f=i.map(t=>Array.from({length:h},(e,n)=>t[n]));for(let t=0;t<this.H.height;t+=1){const e=l.lines[t]??"",n=f[t];for(let i=0;i<l.width;i+=1){const s=e[i]??" ";if(" "===s)continue;const o=u+i,h=n[o],f=this.P(o,t,i,r,l,c,s);if(!h){n[o]=f;continue}const d=a.I(h.char,s,this.H.hardblank,this.M);n[o]=this.B(h,f,d??s)}}i=f,s=h}return this.j(i,s,r)}D(t,e){var n;if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let r=this.W(t[0]),i=t[0].cols,s=t[0].rows;const o=[this.q(t[0],0)];for(let l=1;l<t.length;l+=1){const c=t[l],u=s-this.X(r,s,i,c,e),h=Math.max(i,c.cols),f=Math.max(s,u+c.rows),d=Array.from({length:f},(t,e)=>Array.from({length:h},(t,n)=>{var i;return null==(i=r[e])?void 0:i[n]}));for(const t of c.cells){const e=u+t.row,r=t.col,i=null==(n=d[e])?void 0:n[r];if(!i){d[e][r]={...t,row:e};continue}const s=a.U(i.char,t.char,this.k);d[e][r]=this.B(i,{...t,row:e},s??t.char)}r=d,i=h,s=f,o.push(this.q(c,u))}return this.Y(r,i,s,o)}V(t,e,n,r){var i;if("full"===r)return 0;for(let s=e;s>=0;s-=1){let o=!0;for(let a=0;a<this.H.height&&o;a+=1){const l=t[a]??[],c=n.lines[a]??"";for(let t=0;t<s;t+=1){const n=(null==(i=l[e-s+t])?void 0:i.char)??" ",a=c[t]??" ";if(!this.J(n,a,r)){o=!1;break}}}if(o)return s}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==a.I(t,e,this.H.hardblank,this.M)}N(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.H.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.P(o,i,o,n,t,e,a)})})}P(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}B(t,e,n){return n===t.char?t:{...e,char:n}}j(t,e,n){const r=[];for(let i=0;i<this.H.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];!e||e.char===this.H.hardblank||r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.H.height}}X(t,e,n,r,i){var s,o;if("full"===i)return 0;const a=this.W(r),l=Math.min(e,r.rows),c=Math.max(n,r.cols);for(let n=l;n>=0;n-=1){let r=!0;for(let l=0;l<n&&r;l+=1){const u=t[e-n+l]??[],h=a[l]??[];for(let t=0;t<c;t+=1){const e=(null==(s=u[t])?void 0:s.char)??" ",n=(null==(o=h[t])?void 0:o.char)??" ";if(!this.K(e,n,i)){r=!1;break}}}if(r)return n}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==a.U(t,e,this.k)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){var i;const s=[];for(let r=0;r<n;r+=1)for(let n=0;n<e;n+=1){const e=null==(i=t[r])?void 0:i[n];e&&s.push({...e,row:r,col:n})}return{cells:s,lines:r,cols:e,rows:n}}}class c{constructor(){r(this,"_onDisposeCallbacks",new Set)}Z(t){this.tt.add(t)}dispose(){for(const t of this.tt)t();this.tt.clear()}}class u extends c{constructor(t,e,n){super(),r(this,"_name"),r(this,"_header"),r(this,"_characters"),r(this,"_layoutEngine"),this.et=t,this.H=e,this.nt=n,this.rt=new l(e)}static async it(t){const e=await fetch(t);if(!e.ok)throw new i("Failed to load FIGfont file.",{source:String(t),status:e.status,statusText:e.statusText});const n=await e.text();return this.st(this.ot(t),n)}static st(t,e){const n=o.t(e);return new u(t,n.header,n.characters)}getCharacter(t){var e;const n="number"==typeof t?t:null==(e=Array.from(t)[0])?void 0:e.codePointAt(0);if(void 0!==n)return h(this.nt.get(n))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.lt(e.direction),s=this.ct(t).map(t=>this.ut(t,i)).flatMap(t=>this.ht(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.O(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.D(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const t of n.cells)r[t.row][t.col]=t.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.H}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,h(e)]))}get hardblank(){return this.H.hardblank}get height(){return this.H.height}get baseline(){return this.H.baseline}get defaultLayout(){return 128&this.H.fullLayout?"smushed":64&this.H.fullLayout?"fitted":-1===this.H.oldLayout?"full":0===this.H.oldLayout?"fitted":this.H.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.H.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.H.fullLayout?"smushed":8192&this.H.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}ct(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ut(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const e=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),n=e.find(t=>void 0===t.figChar);if(n)throw new i("FIGfont is missing a required character for layout.",{character:n.inputChar,index:n.inputIndex});return e}ht(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const t of r){if(t.isWhitespace){s.length>0&&(o=t.characters);continue}const r=0===s.length?t.characters:s.concat(o,t.characters);s.length>0&&this.wt(r,e)>n?(i.push(s),s=t.characters.slice()):s=r,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.O(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}lt(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}}function h(t){if(t)return{...t,lines:[...t.lines]}}const f="textmode.figlet.js",d="1.0.0",g=Symbol.for("textmode.figlet.state");function p(t){const e=t;return e[g]||(e[g]={activeFont:void 0,align:"left",baseline:"baseline"}),e[g]}const _=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function w(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function m(t,n,r){return r instanceof e.TextmodeColor||"string"==typeof r||"number"==typeof r?"charColor"===n?void t.charColor(r):void t.cellColor(r):4===r.length?"charColor"===n?void t.charColor(r[0],r[1],r[2],r[3]):void t.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==n?t.cellColor(r[0],r[1],r[2]):t.charColor(r[0],r[1],r[2]))}function I(t){const e=p(t).activeFont;if(!e)throw new i("No FIGlet font is active. Call figFont() first.");return e}function y(t,e){var n;null==(n=t.It)||n.call(t,e)}function v(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}function x(t){v(t,"loadFigFont",async function(t){const e=await u.it(t);return y(this,e),e}),v(t,"parseFigFont",function(t,e){const n=u.st(t,e);return y(this,n),n}),v(t,"figFont",function(t){const e=p(this);if(void 0===t)return e.activeFont;e.activeFont=t}),v(t,"figText",function(t,e,n,r={}){const i=I(this),s=i.planText(t,r),o=p(this),a=e+function(t,e){return"center"===e?-Math.floor(t/2):"right"===e?-(t-1):0}(s.cols,o.align),l=n+function(t,e,n){return"top"===n?0:"center"===n?-Math.floor(t/2):"bottom"===n?-(t-1):-(e-1)}(s.rows,i.baseline,o.baseline);this.push(),this.translate(a,l,0);for(const t of s.cells){this.push(),this.translate(t.col,t.row,0);const e=w(r.charColor,t),n=w(r.cellColor,t);this.char(t.char),void 0!==e&&m(this,"charColor",e),void 0!==n&&m(this,"cellColor",n),this.point(),this.pop()}this.pop()}),v(t,"figTextWidth",function(t,e={}){return I(this).measureText(t,e).cols}),v(t,"figTextHeight",function(t,e={}){return I(this).measureText(t,e).rows}),v(t,"figTextBounds",function(t,e={}){return I(this).measureText(t,e)}),v(t,"figTextAlign",function(t){const e=p(this);if(void 0===t)return e.align;e.align=t}),v(t,"figTextBaseline",function(t){const e=p(this);if(void 0===t)return e.baseline;e.baseline=t})}function L(t){for(const e of _)delete t[e];!function(t){delete t[g]}(t)}const C={name:f,version:d,install(t,e){x(t)},uninstall(t,e){L(t)}};if(typeof window<"u"){const t=window;t.FigletPlugin=C,t.TextmodeFigFont=u,t.FigFontParser=o,t.FigLayoutEngine=l,t.FigSmushRules=a,t.FIGFONT_REQUIRED_CODEPOINTS=s}t.FIGFONT_REQUIRED_CODEPOINTS=s,t.FigFontParser=o,t.FigLayoutEngine=l,t.FigSmushRules=a,t.FigletPlugin=C,t.TextmodeFigFont=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
!function(t,e){"object"==typeof exports&&typeof module<"u"?e(exports,require("textmode.js")):"function"==typeof define&&define.amd?define(["exports","textmode.js"],e):e((t=typeof globalThis<"u"?globalThis:t||self).TextmodeFiglet={},t.textmode)}(this,function(t,e){"use strict";var n=Object.defineProperty,r=(t,e,r)=>((t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r)(t,"symbol"!=typeof e?e+"":e,r);class i extends Error{constructor(t,e){super(i.formatMessage(t,e)),this.name="FigletError"}static formatMessage(t,e){if(!e||0===Object.keys(e).length)return t;return`${t}\n\nContext:${Object.entries(e).map(([t,e])=>`\n - ${t}: ${i.formatValue(e)}`).join("")}`}static formatValue(t){return null===t?"null":void 0===t?"undefined":"string"==typeof t?`"${t}"`:"number"==typeof t||"boolean"==typeof t?String(t):Array.isArray(t)?`[${t.map(t=>i.formatValue(t)).join(", ")}]`:"object"==typeof t?JSON.stringify(t):String(t)}}const s=[...Array.from({length:95},(t,e)=>e+32),196,214,220,228,246,252,223];class o{static t(t){if(0===t.length)throw new i("Cannot parse an empty FIGfont file.");const e=t.replace(/\r\n?/g,"\n").split("\n"),n=e[0];if(!n)throw new i("Missing FIGfont header line.");const r=this.i(n);let s=1+r.commentLines;if(s>e.length)throw new i("FIGfont comment line count exceeds file length.",{commentLines:r.commentLines,totalLines:e.length});const o=new Map;return s=this.o(e,s,r,o),this.l(e,s,r,o),{header:r,characters:o}}static i(t){const e=t.trim().split(/\s+/),n=e[0]??"";if(n.length<6)throw new i("Invalid FIGfont header token.",{headerToken:n});const r=n.slice(0,5),s=n.slice(5);if("flf2a"!==r)throw new i("Unsupported FIGfont signature.",{signature:r});if(1!==s.length)throw new i("FIGfont hardblank must be a single character.",{hardblank:s});if(e.length<6)throw new i("Incomplete FIGfont header.",{headerLine:t});return{signature:r,hardblank:s,height:this.u(e[1],"height"),baseline:this.u(e[2],"baseline"),maxLength:this.u(e[3],"maxLength"),oldLayout:this.u(e[4],"oldLayout"),commentLines:this.u(e[5],"commentLines"),printDirection:this.u(e[6]??"0","printDirection"),fullLayout:this.u(e[7]??"0","fullLayout"),codetagCount:this.u(e[8]??"0","codetagCount")}}static o(t,e,n,r){let i=e;for(const e of s){const s=this.h(t,i,n.height,e);r.set(e,s),i+=n.height}return i}static l(t,e,n,r){var i;let s=e;for(;s<t.length;){const e=(null==(i=t[s])?void 0:i.trim())??"";if(0===e.length){s+=1;continue}const o=this.p(e);s+=1;const a=this.h(t,s,n.height,o);r.set(o,a),s+=n.height}}static h(t,e,n,r){if(e+n>t.length)throw new i("Unexpected end of FIGfont character data.",{codePoint:r,startIndex:e,height:n,totalLines:t.length});const s=[];let o=0;for(let a=0;a<n;a+=1){const n=t[e+a]??"";if(0===n.length)throw new i("Encountered an empty FIGcharacter row.",{codePoint:r,row:a,startIndex:e});const l=n.at(-1);if(!l)throw new i("Failed to determine FIGcharacter endmark.",{codePoint:r,row:a});const c=n.replace(new RegExp(`${this.escapeForRegExp(l)}+$`),"");s.push(c),o=Math.max(o,c.length)}return{code:r,lines:s,width:o}}static p(t){const e=t.split(/\s+/,1)[0];if(/^[-+]?0x[0-9a-f]+$/i.test(e))return Number.parseInt(e,16);if(/^[-+]?0[0-7]+$/.test(e))return Number.parseInt(e,8);if(/^[-+]?\d+$/.test(e))return Number.parseInt(e,10);throw new i("Invalid FIGfont code tag.",{codetagLine:t})}static u(t,e){if(!/^-?\d+$/.test(t))throw new i("Invalid FIGfont header value.",{field:e,token:t});return Number.parseInt(t,10)}static escapeForRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class a{static _(t){return 0!==t.fullLayout?63&t.fullLayout:t.oldLayout>0?63&t.oldLayout:0}static m(t){return 7936&t.fullLayout}static I(t,e,n,r){return" "===t?e:" "===e?t:0===r?this.v(t,e,n):(0!==(r&this.RULE_EQUAL_CHARACTER)?this.L(t,e,n):null)??(0!==(r&this.RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(r&this.RULE_HIERARCHY)?this.R(t,e):null)??(0!==(r&this.RULE_OPPOSITE_PAIR)?this.A(t,e):null)??(0!==(r&this.RULE_BIG_X)?this.F(t,e):null)??(0!==(r&this.RULE_HARDBLANK)?this.T(t,e,n):null)}static v(t,e,n){return" "===t?e:" "===e?t:e}static U(t,e,n){return" "===t?e:" "===e?t:0===n?this.v(t,e," "):(0!==(n&this.VERTICAL_RULE_EQUAL_CHARACTER)?this.L(t,e," "):null)??(0!==(n&this.VERTICAL_RULE_UNDERSCORE)?this.C(t,e):null)??(0!==(n&this.VERTICAL_RULE_HIERARCHY)?this.R(t,e):null)??(0!==(n&this.VERTICAL_RULE_HORIZONTAL_LINE)?this.S(t,e):null)??(0!==(n&this.VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH)?this.$(t,e):null)}static L(t,e,n){return t===e&&t!==n?t:null}static C(t,e){const n="|/\\[]{}()<>";return"_"===t&&n.includes(e)?e:"_"===e&&n.includes(t)?t:null}static R(t,e){const n=["|","/\\","[]","{}","()","<>"],r=n.findIndex(e=>e.includes(t)),i=n.findIndex(t=>t.includes(e));return-1===r||-1===i||r===i?null:r>i?t:e}static A(t,e){return["[]","][","{}","}{","()",")("].includes(`${t}${e}`)?"|":null}static F(t,e){const n=`${t}${e}`;return"/\\"===n?"|":"\\/"===n?"Y":"><"===n?"X":null}static T(t,e,n){return t===n&&e===n?n:null}static S(t,e){const n=`${t}${e}`;return"-_"===n||"_-"===n?"=":null}static $(t,e){return"|"===t&&"|"===e?"|":null}}r(a,"RULE_EQUAL_CHARACTER",1),r(a,"RULE_UNDERSCORE",2),r(a,"RULE_HIERARCHY",4),r(a,"RULE_OPPOSITE_PAIR",8),r(a,"RULE_BIG_X",16),r(a,"RULE_HARDBLANK",32),r(a,"VERTICAL_RULE_EQUAL_CHARACTER",256),r(a,"VERTICAL_RULE_UNDERSCORE",512),r(a,"VERTICAL_RULE_HIERARCHY",1024),r(a,"VERTICAL_RULE_HORIZONTAL_LINE",2048),r(a,"VERTICAL_RULE_VERTICAL_LINE_SUPERSMUSH",4096);class l{constructor(t){r(this,"_header"),r(this,"_horizontalRuleMask"),r(this,"_verticalRuleMask"),this.H=t,this.M=a._(t),this.k=a.m(t)}G(t,e){const n=t.map((t,e)=>({inputIndex:e,inputChar:String.fromCodePoint(t.code)})),r=this.O(t,n,e,0),i=Array.from({length:r.rows},()=>Array.from({length:r.cols},()=>" "));for(const t of r.cells)i[t.row][t.col]=t.char;return i}O(t,e,n,r){if(0===t.length)return{lineIndex:r,cells:[],cols:0,rows:this.H.height};let i=this.N(t[0],e[0],r),s=t[0].width;for(let o=1;o<t.length;o+=1){const l=t[o],c=e[o]??{inputIndex:o,inputChar:String.fromCodePoint(l.code)},u=s-this.V(i,s,l,n),h=Math.max(s,u+l.width),f=i.map(t=>Array.from({length:h},(e,n)=>t[n]));for(let t=0;t<this.H.height;t+=1){const e=l.lines[t]??"",n=f[t];for(let i=0;i<l.width;i+=1){const s=e[i]??" ";if(" "===s)continue;const o=u+i,h=n[o],f=this.P(o,t,i,r,l,c,s);if(!h){n[o]=f;continue}const d=a.I(h.char,s,this.H.hardblank,this.M);n[o]=this.B(h,f,d??s)}}i=f,s=h}return this.j(i,s,r)}D(t,e){var n;if(0===t.length)return{cells:[],lines:[],cols:0,rows:0};let r=this.W(t[0]),i=t[0].cols,s=t[0].rows;const o=[this.q(t[0],0)];for(let l=1;l<t.length;l+=1){const c=t[l],u=s-this.X(r,s,i,c,e),h=Math.max(i,c.cols),f=Math.max(s,u+c.rows),d=Array.from({length:f},(t,e)=>Array.from({length:h},(t,n)=>{var i;return null==(i=r[e])?void 0:i[n]}));for(const t of c.cells){const e=u+t.row,r=t.col,i=null==(n=d[e])?void 0:n[r];if(!i){d[e][r]={...t,row:e};continue}const s=a.U(i.char,t.char,this.k);d[e][r]=this.B(i,{...t,row:e},s??t.char)}r=d,i=h,s=f,o.push(this.q(c,u))}return this.Y(r,i,s,o)}V(t,e,n,r){var i;if("full"===r)return 0;for(let s=e;s>=0;s-=1){let o=!0;for(let a=0;a<this.H.height&&o;a+=1){const l=t[a]??[],c=n.lines[a]??"";for(let t=0;t<s;t+=1){const n=(null==(i=l[e-s+t])?void 0:i.char)??" ",a=c[t]??" ";if(!this.J(n,a,r)){o=!1;break}}}if(o)return s}return 0}J(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==a.I(t,e,this.H.hardblank,this.M)}N(t,e={inputIndex:0,inputChar:String.fromCodePoint(t.code)},n=0){return Array.from({length:this.H.height},(r,i)=>{const s=t.lines[i]??"";return Array.from({length:t.width},(r,o)=>{const a=s[o]??" ";return" "===a?void 0:this.P(o,i,o,n,t,e,a)})})}P(t,e,n,r,i,s,o){return{char:o,col:t,row:e,inputIndex:s.inputIndex,inputChar:s.inputChar,figCharCode:i.code,subRow:e,subCol:n,lineIndex:r}}B(t,e,n){return n===t.char?t:{...e,char:n}}j(t,e,n){const r=[];for(let i=0;i<this.H.height;i+=1){const s=t[i]??[];for(let t=0;t<e;t+=1){const e=s[t];!e||e.char===this.H.hardblank||r.push({...e,col:t,row:i,lineIndex:n})}}return{lineIndex:n,cells:r,cols:e,rows:this.H.height}}X(t,e,n,r,i){var s,o;if("full"===i)return 0;const a=this.W(r),l=Math.min(e,r.rows),c=Math.max(n,r.cols);for(let n=l;n>=0;n-=1){let r=!0;for(let l=0;l<n&&r;l+=1){const u=t[e-n+l]??[],h=a[l]??[];for(let t=0;t<c;t+=1){const e=(null==(s=u[t])?void 0:s.char)??" ",n=(null==(o=h[t])?void 0:o.char)??" ";if(!this.K(e,n,i)){r=!1;break}}}if(r)return n}return 0}K(t,e,n){return" "===t||" "===e||"fitted"!==n&&null!==a.U(t,e,this.k)}W(t){const e=Array.from({length:t.rows},()=>Array.from({length:t.cols},()=>{}));for(const n of t.cells)e[n.row][n.col]=n;return e}q(t,e){return{...t,cells:t.cells.map(t=>({...t,row:t.row+e}))}}Y(t,e,n,r){var i;const s=[];for(let r=0;r<n;r+=1)for(let n=0;n<e;n+=1){const e=null==(i=t[r])?void 0:i[n];e&&s.push({...e,row:r,col:n})}return{cells:s,lines:r,cols:e,rows:n}}}class c{constructor(){r(this,"_onDisposeCallbacks",new Set)}Z(t){this.tt.add(t)}dispose(){for(const t of this.tt)t();this.tt.clear()}}class u extends c{constructor(t,e,n){super(),r(this,"_name"),r(this,"_header"),r(this,"_characters"),r(this,"_layoutEngine"),this.et=t,this.H=e,this.nt=n,this.rt=new l(e)}static async it(t){const e=await fetch(t);if(!e.ok)throw new i("Failed to load FIGfont file.",{source:String(t),status:e.status,statusText:e.statusText});const n=await e.text();return this.st(this.ot(t),n)}static st(t,e){const n=o.t(e);return new u(t,n.header,n.characters)}getCharacter(t){var e;const n="number"==typeof t?t:null==(e=Array.from(t)[0])?void 0:e.codePointAt(0);if(void 0!==n)return h(this.nt.get(n))}planText(t,e={}){const n=e.horizontalLayout??this.defaultLayout,r=e.verticalLayout??this.defaultVerticalLayout,i=this.lt(e.direction),s=this.ct(t).map(t=>this.ut(t,i)).flatMap(t=>this.ht(t,n,e)).map((t,e)=>{const r=this.ft(t);return this.rt.O(r.map(t=>t.figChar),r.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),n,e)}),o=this.rt.D(s,r);return{cells:o.cells,lines:o.lines,cols:o.cols,rows:o.rows,direction:i}}renderText(t,e={}){const n=this.planText(t,e),r=Array.from({length:n.rows},()=>Array.from({length:n.cols},()=>" "));for(const t of n.cells)r[t.row][t.col]=t.char;return{grid:r,cols:n.cols,rows:n.rows}}measureText(t,e={}){const n=this.planText(t,e);return{cols:n.cols,rows:n.rows}}get name(){return this.et}get header(){return{...this.H}}get characters(){return new Map(Array.from(this.nt,([t,e])=>[t,h(e)]))}get hardblank(){return this.H.hardblank}get height(){return this.H.height}get baseline(){return this.H.baseline}get defaultLayout(){return 128&this.H.fullLayout?"smushed":64&this.H.fullLayout?"fitted":-1===this.H.oldLayout?"full":0===this.H.oldLayout?"fitted":this.H.oldLayout>0?"smushed":"full"}get defaultPrintDirection(){return 1===this.H.printDirection?"rtl":"ltr"}get defaultVerticalLayout(){return 16384&this.H.fullLayout?"smushed":8192&this.H.fullLayout?"fitted":"full"}static ot(t){const e=t instanceof URL?t.pathname:t,n=(e.split(/[?#]/,1)[0]??e).split("/").filter(Boolean).pop()??"figfont";return n.toLowerCase().endsWith(".flf")?n.slice(0,-4)||"figfont":n}ct(t){const e=[[]];for(const[n,r]of Array.from(t).entries())"\n"!==r?e[e.length-1].push({character:r,inputIndex:n}):e.push([]);return e}ut(t,e){return"rtl"===e?[...t].reverse():t}ft(t){const e=t.map(({character:t,inputIndex:e})=>({figChar:this.getCharacter(t)??this.getCharacter(32),inputChar:t,inputIndex:e})),n=e.find(t=>void 0===t.figChar);if(n)throw new i("FIGfont is missing a required character for layout.",{character:n.inputChar,index:n.inputIndex});return e}ht(t,e,n){const r="number"==typeof n.maxCols&&Number.isFinite(n.maxCols)?Math.floor(n.maxCols):void 0,i=n.wrap??"none";return 0===t.length||!r||r<1||"none"===i?[t]:"char"===i?this.dt(t,e,r):this.gt(t,e,r)}gt(t,e,n){const r=this._t(t);if(!r.some(t=>!t.isWhitespace))return[t];const i=[];let s=[],o=[];for(const t of r){if(t.isWhitespace){s.length>0&&(o=t.characters);continue}const r=0===s.length?t.characters:s.concat(o,t.characters);s.length>0&&this.wt(r,e)>n?(i.push(s),s=t.characters.slice()):s=r,o=[]}return 0===s.length?[[]]:(i.push(s),i)}dt(t,e,n){const r=[];let i=[];for(const s of t){const t=i.concat(s);i.length>0&&this.wt(t,e)>n?(r.push(i),i=[s]):i=t}return 0===i.length?[[]]:(r.push(i),r)}wt(t,e){const n=this.ft(t);return this.rt.O(n.map(t=>t.figChar),n.map(({inputChar:t,inputIndex:e})=>({inputChar:t,inputIndex:e})),e,0).cols}_t(t){const e=[];for(const n of t){const t=/\s/u.test(n.character),r=e[e.length-1];r&&r.isWhitespace===t?r.characters.push(n):e.push({isWhitespace:t,characters:[n]})}return e}lt(t){return"ltr"===t||"rtl"===t?t:this.defaultPrintDirection}}function h(t){if(t)return{...t,lines:[...t.lines]}}const f="textmode.figlet.js",d="1.0.1",g=Symbol.for("textmode.figlet.state");function p(t){const e=t;return e[g]||(e[g]={activeFont:void 0,align:"left",baseline:"baseline"}),e[g]}const _=["loadFigFont","parseFigFont","figFont","figText","figTextWidth","figTextHeight","figTextBounds","figTextAlign","figTextBaseline"];function w(t,e){if(void 0!==t)return"function"==typeof t?t(e):t}function m(t,n,r){return r instanceof e.color.TextmodeColor||"string"==typeof r||"number"==typeof r?"charColor"===n?void t.charColor(r):void t.cellColor(r):4===r.length?"charColor"===n?void t.charColor(r[0],r[1],r[2],r[3]):void t.cellColor(r[0],r[1],r[2],r[3]):void("charColor"!==n?t.cellColor(r[0],r[1],r[2]):t.charColor(r[0],r[1],r[2]))}function I(t){const e=p(t).activeFont;if(!e)throw new i("No FIGlet font is active. Call figFont() first.");return e}function y(t,e){var n;null==(n=t.It)||n.call(t,e)}function v(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0,enumerable:!1})}function x(t){v(t,"loadFigFont",async function(t){const e=await u.it(t);return y(this,e),e}),v(t,"parseFigFont",function(t,e){const n=u.st(t,e);return y(this,n),n}),v(t,"figFont",function(t){const e=p(this);if(void 0===t)return e.activeFont;e.activeFont=t}),v(t,"figText",function(t,e,n,r={}){const i=I(this),s=i.planText(t,r),o=p(this),a=e+function(t,e){return"center"===e?-Math.floor(t/2):"right"===e?-(t-1):0}(s.cols,o.align),l=n+function(t,e,n){return"top"===n?0:"center"===n?-Math.floor(t/2):"bottom"===n?-(t-1):-(e-1)}(s.rows,i.baseline,o.baseline);this.push(),this.translate(a,l,0);for(const t of s.cells){this.push(),this.translate(t.col,t.row,0);const e=w(r.charColor,t),n=w(r.cellColor,t);this.char(t.char),void 0!==e&&m(this,"charColor",e),void 0!==n&&m(this,"cellColor",n),this.point(),this.pop()}this.pop()}),v(t,"figTextWidth",function(t,e={}){return I(this).measureText(t,e).cols}),v(t,"figTextHeight",function(t,e={}){return I(this).measureText(t,e).rows}),v(t,"figTextBounds",function(t,e={}){return I(this).measureText(t,e)}),v(t,"figTextAlign",function(t){const e=p(this);if(void 0===t)return e.align;e.align=t}),v(t,"figTextBaseline",function(t){const e=p(this);if(void 0===t)return e.baseline;e.baseline=t})}function L(t){for(const e of _)delete t[e];!function(t){delete t[g]}(t)}const C={name:f,version:d,install(t,e){x(t)},uninstall(t,e){L(t)}};if(typeof window<"u"){const t=window;t.FigletPlugin=C,t.TextmodeFigFont=u,t.FigFontParser=o,t.FigLayoutEngine=l,t.FigSmushRules=a,t.FIGFONT_REQUIRED_CODEPOINTS=s}t.FIGFONT_REQUIRED_CODEPOINTS=s,t.FigFontParser=o,t.FigLayoutEngine=l,t.FigSmushRules=a,t.FigletPlugin=C,t.TextmodeFigFont=u,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { color } from 'textmode.js';
|
|
2
2
|
/**
|
|
3
3
|
* Required FIGfont character order defined by the FIGfont v2 spec:
|
|
4
4
|
* ASCII 32-126 followed by 7 German characters.
|
|
@@ -70,7 +70,7 @@ export type FigPrintDirection = 'font' | 'ltr' | 'rtl';
|
|
|
70
70
|
/**
|
|
71
71
|
* Accepted color input for per-cell FIGlet styling.
|
|
72
72
|
*/
|
|
73
|
-
export type FigTextColorValue = number | string | TextmodeColor | [number, number, number] | [number, number, number, number];
|
|
73
|
+
export type FigTextColorValue = number | string | color.TextmodeColor | [number, number, number] | [number, number, number, number];
|
|
74
74
|
/**
|
|
75
75
|
* Public cell metadata exposed to FIGlet styling callbacks.
|
|
76
76
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/figfont/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/figfont/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigletPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/FigletPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"FigletPlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/FigletPlugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAyB,MAAM,aAAa,CAAC;AAKzE;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAW1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "textmode.figlet.js",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "FIGlet font
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "FIGlet font support for textmode.js",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"types": "./dist/types/index.d.ts",
|
|
7
6
|
"main": "./dist/textmode.figlet.umd.js",
|
|
8
7
|
"module": "./dist/textmode.figlet.esm.js",
|
|
8
|
+
"types": "./dist/types/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/types/index.d.ts",
|
|
@@ -17,11 +17,17 @@
|
|
|
17
17
|
"./dist/textmode.figlet.esm.js",
|
|
18
18
|
"./dist/textmode.figlet.umd.js"
|
|
19
19
|
],
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
20
23
|
"scripts": {
|
|
21
24
|
"dev": "vite --port 5175 --host",
|
|
22
|
-
"build": "vite build
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
+
"build:bundle": "vite build",
|
|
26
|
+
"build:types": "tsc",
|
|
27
|
+
"build": "npm run build:bundle && npm run build:types",
|
|
28
|
+
"check": "npm run check:format && npm run lint && npm run lint:md && npm run check:types && npm run check:api-docs && npm run check:examples && npm run test && npm run build",
|
|
29
|
+
"check:api-docs": "node ./scripts/check-public-api-docs.mjs",
|
|
30
|
+
"check:examples": "node ./scripts/check-examples.mjs",
|
|
25
31
|
"dev:docs": "typedoc --watch",
|
|
26
32
|
"build:docs": "typedoc",
|
|
27
33
|
"preview": "vite preview",
|
|
@@ -31,12 +37,11 @@
|
|
|
31
37
|
"test:coverage": "vitest --coverage",
|
|
32
38
|
"test:unit": "vitest run --project unit",
|
|
33
39
|
"test:integration": "vitest run --project integration",
|
|
34
|
-
"
|
|
35
|
-
"format": "prettier --
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"lint:md": "markdownlint-cli2 --
|
|
39
|
-
"lint:md:fix": "markdownlint-cli2 --fix --no-globs README.md",
|
|
40
|
+
"format": "prettier --write .",
|
|
41
|
+
"check:format": "prettier --check .",
|
|
42
|
+
"check:types": "tsc --noEmit",
|
|
43
|
+
"lint:md": "markdownlint-cli2",
|
|
44
|
+
"lint:md:fix": "markdownlint-cli2 --fix",
|
|
40
45
|
"lint": "eslint src --config eslint.config.js",
|
|
41
46
|
"prepare": "husky"
|
|
42
47
|
},
|
|
@@ -44,32 +49,35 @@
|
|
|
44
49
|
"textmode.js": ">=0.11.0"
|
|
45
50
|
},
|
|
46
51
|
"devDependencies": {
|
|
47
|
-
"@commitlint/cli": "^20.
|
|
48
|
-
"@commitlint/config-conventional": "^20.
|
|
52
|
+
"@commitlint/cli": "^20.5.0",
|
|
53
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
54
|
+
"@eslint/js": "^9.39.4",
|
|
49
55
|
"@rollup/plugin-terser": "^0.4.4",
|
|
50
56
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
51
57
|
"@semantic-release/exec": "^7.1.0",
|
|
52
|
-
"@semantic-release/
|
|
53
|
-
"@semantic-release/
|
|
58
|
+
"@semantic-release/git": "^10.0.1",
|
|
59
|
+
"@semantic-release/github": "^12.0.6",
|
|
60
|
+
"@semantic-release/npm": "^13.1.5",
|
|
54
61
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
55
62
|
"@types/node": "^24.0.13",
|
|
56
63
|
"@vitest/ui": "^3.1.2",
|
|
57
64
|
"eslint": "^9.39.2",
|
|
58
|
-
"eslint-plugin-jsdoc": "^62.
|
|
59
|
-
"globals": "^17.
|
|
65
|
+
"eslint-plugin-jsdoc": "^62.9.0",
|
|
66
|
+
"globals": "^17.5.0",
|
|
60
67
|
"husky": "^9.1.7",
|
|
61
68
|
"jsdom": "^26.1.0",
|
|
62
69
|
"lint-staged": "^16.4.0",
|
|
63
|
-
"markdownlint-cli2": "^0.
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
70
|
+
"markdownlint-cli2": "^0.22.1",
|
|
71
|
+
"markdownlint-cli2-formatter-default": "^0.0.6",
|
|
72
|
+
"prettier": "^3.8.3",
|
|
73
|
+
"semantic-release": "^25.0.3",
|
|
74
|
+
"textmode.js": "^0.16.0",
|
|
75
|
+
"typedoc": "^0.28.19",
|
|
68
76
|
"typedoc-plugin-frontmatter": "^1.3.1",
|
|
69
|
-
"typedoc-plugin-markdown": "^4.
|
|
77
|
+
"typedoc-plugin-markdown": "^4.11.0",
|
|
70
78
|
"typedoc-vitepress-theme": "^1.1.2",
|
|
71
79
|
"typescript": "^5.9.2",
|
|
72
|
-
"typescript-eslint": "^8.
|
|
80
|
+
"typescript-eslint": "^8.59.0",
|
|
73
81
|
"vite": "^6.3.4",
|
|
74
82
|
"vitest": "^3.1.2"
|
|
75
83
|
},
|
|
@@ -85,11 +93,8 @@
|
|
|
85
93
|
"license": "MIT",
|
|
86
94
|
"homepage": "https://code.textmode.art",
|
|
87
95
|
"lint-staged": {
|
|
88
|
-
"
|
|
96
|
+
"*": "prettier --ignore-unknown --write"
|
|
89
97
|
},
|
|
90
|
-
"files": [
|
|
91
|
-
"dist"
|
|
92
|
-
],
|
|
93
98
|
"repository": {
|
|
94
99
|
"type": "git",
|
|
95
100
|
"url": "git+https://github.com/humanbydefinition/textmode.figlet.js.git"
|