UNPKG

2.84 kBJavaScriptView Raw
1/* Sutton SignWriting Unicode 8 Module v1.1.2 (https://github.com/sutton-signwriting/unicode8), author: Steve Slevinski (https://SteveSlevinski.me), license: MIT */
2var t=Object.freeze({__proto__:null,cssAppend:function(t=""){if(!document.getElementById("SgnwUnicode8FontCss")){const n=document.createElement("style");n.setAttribute("id","SgnwUnicode8FontCss"),n.appendChild(document.createTextNode(`\n @font-face {\n font-family: "NotoSansSignWriting";\n src: \n local('NotoSansSignWriting'),\n local('Noto Sans SignWriting'),\n local('Noto_Sans_SignWriting'),\n local('Noto Sans SignWriting Regular'),\n local('Noto_Sans_SignWriting_Regular'),\n ${t?`url('${t}NotoSansSignWriting-Regular.otf') format('truetype'),`:""}\n url('https://cdn.jsdelivr.net/gh/googlefonts/noto-fonts/unhinted/otf/NotoSansSignWriting/NotoSansSignWriting-Regular.otf') format('opentype');\n }\n `)),document.head.appendChild(n)}}});let n={base:"(?:\ud836[\udc00-\ude8b])",fill:"(?:\ud836[\ude9b-\ude9f])",rotation:"(?:\ud836[\udea1-\udeaf])"};n.full=`(${n.base})(${n.fill})?(${n.rotation})?`;const o=t=>{const o="^"+n.full,e=("string"==typeof t?t.match(new RegExp(o)):[])||[];return{base:e[1]?e[1]:void 0,fill:e[2]?e[2]:void 0,rotation:e[3]?e[3]:void 0}};var e=Object.freeze({__proto__:null,re:n,parse:o,compose:t=>{if("object"!=typeof t||null===t)return;const n=(t.base?t.base:"")+(t.fill?t.fill:"")+(t.rotation?t.rotation:"");return n||void 0}});let i={full:`(?:${n.full})+`};var r=Object.freeze({__proto__:null,re:i,parse:t=>{const o=`^(${i.full})`,e=("string"==typeof t?t.match(new RegExp(o)):[])||[];return e[1]?[...e[1].matchAll(new RegExp(n.full,"g"))].map(t=>t[0]):[]},compose:t=>{if(Array.isArray(t))return t.join("")}});const l=t=>String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023));var a=Object.freeze({__proto__:null,code2uni:l,uni2code:t=>t.codePointAt(0),uni2hex:t=>t.codePointAt(0).toString(16).toUpperCase(),uni2fsw:t=>{let n=o(t);return n.base?(n.base=n.base.codePointAt(0)-120576,n.fill=n.fill?n.fill.codePointAt(0)-121498:0,n.rotation=n.rotation?n.rotation.codePointAt(0)-121504:0,"S"+n.base.toString(16)+n.fill.toString(16)+n.rotation.toString(16)):void 0},uni2swu:t=>{let n=o(t);return n.base?(n.base=n.base.codePointAt(0)-120832,n.fill=n.fill?n.fill.codePointAt(0)-121498:0,n.rotation=n.rotation?n.rotation.codePointAt(0)-121504:0,l(262145+96*n.base+16*n.fill+n.rotation)):void 0},fsw2uni:t=>{let n=parseInt(t.slice(1,4),16),o=parseInt(t.slice(4,5),16),e=parseInt(t.slice(5,6),16);return l(n+120576)+(o?l(o+121498):"")+(e?l(e+121504):"")},swu2uni:t=>{const n=t.codePointAt(0)-262145,o=parseInt(n/96),e=parseInt((n-96*o)/16),i=parseInt(n-96*o-16*e);return l(o+120832)+(e?l(e+121498):"")+(i?l(i+121504):"")}});export{a as convert,t as font,r as string,e as symbol};